View Single Post
Old 01-30-2014, 12:03 AM  
Too much time...
Join Date: May 2005
Posts: 1,194

After you added the command did you use 'site rehash' to force the server to reload the .ini file? You probably don't want anyone else to use ugrep, but it's best to enter explicit permissions (M is the default for anything not listed) for it in the .ini file as well under [FTP_Site_Permissions] just to make it clear who can use it.

The cookie code used in the file text/Ftp/UserInfo.Section and MyInfo.Section is where you want to make the change to display files and transfer averages. It looks REALLY ugly/complex but after a few minutes you'll get the idea. All the %[T(#)] stuff is applying theme color/bold/etc so you can use 'site color' to make things look pretty. It makes a mess of reading the thing though. There's also some logic to print things differently depending on values in the userfile using %[IF()], but because of the VERY simple cookie parser the brackets change/double because they are inside a cookie/expression. Most of the time it's not bad, but the uinfo/myinfo stuff is REALLY ugly! Bleck. I need a WYSIWYG/GUI editor for this stuff.

I think everything you need should be documented in doc/Cookies.txt and system/Themes.ini and you can also check the Changelog.txt file for maybe more info. All you'll need to do is just add a few more lines for each section and have it use %[ALLDN()] or %[DAYUP()] to get files or speed instead of bytes so you can get whatever you want.

The only other confusing thing you'll find is the *SIZE* argument to something like %[ALLUP()]. It's defined in Cookies.txt and very powerful. Instead of just number of bytes (which is HUGE), you'll want to use MB, but then maybe you'll want it to switch to GB/TB if it gets too big. That is all well documented and pretty straightforward, BUT that isn't what I use because I leave the decision about HOW the data is displayed up to the theme to define. This is VERY cool. If you type 'site myinfo' right now you get the total transferred in MB just like you cut/pasted above. That makes sense since it's what people expected and I found that if I used the auto/3digit modes it was hard to easily tell if someone did 3.23 MB vs 3.23 TB and I liked bigger width numbers meaning more. However I use FlashFXP and it supports ANSI colors so I enable it and all of a sudden 'site myinfo' shows 3.23 MB in GREEN or 3.23 TB in YELLOW which is kind of hard to miss

Almost all server generated responses apply themes I created in a consistent color pattern. Assuming a dark-themed setting MB's are in green, GB in purple, TB in yellow as are some important things, and errors / super-important stuff in red. There are really only 8 colors so it's not a lot of choices. It's a much nicer experience especially for 'site uinfo', but it also helps on 'site users' a lot too. The reason I mention all of this is because leaving how the server colors things, and even how to format a value is left up to the theme designer and that really complicates what the text/ftp Cookie files look like which means you have to deal with my mess if you want to change 'site myinfo' and 'site uinfo' to work for users with color enabled. Basically you use %[F(#)] to point to an entry in the theme and then you prefix the size argument with a '*' and it will use the F entry if a theme is defined else whatever is after the *. The actual way you specify the formatting via a number in the theme is documented in system/Theme.ini. You may not even need to touch that since you can just use existing entries. Again, it's well documented but not really used by anyone.

Anyway, hope that helps point you in the right direction.

If all of that seems to confusing, just ditch all the color stuff by making a new site command which is just a text file full of cookies like mystats = !mystats.txt and just use plain %[ALLDN], etc to display the data. That should be trivially easy. The only thing this wouldn't get you is the ranking against other users which is what I was afraid you wanted...
Yil is offline   Reply With Quote