MitsubaBBS / Mitsuba

Project Mitsuba - an opensource imageboard software written in PHP
http://mitsuba.cf/
Other
42 stars 20 forks source link

What I've got so far. #49

Closed infamousbutterly closed 11 years ago

infamousbutterly commented 11 years ago

I'll just say right away (although you've probably guessed by now anyway), I'm not the best programmer, and I'm pretty horrid at SQL.

So far what I've completed is total amount of posts, and unique IP's, or users. Only problem is, is that I'm a bit confused on your method of connecting to the databases. I can't seem to figure out how to use the database presets that where made during installation. I'll share my code so far:

https://gist.github.com/infamousbutterly/6369201

Ends up looking like this (with my css modifications of course): http://img69.imageshack.us/img69/6426/ro8c.png

infamousbutterly commented 11 years ago

I've sort of figured out the total file size thing, but the only problem is that in the database it has both MB, and KB, so it's impossible to get it to be accurate. Is it possible to make it so that it's only MB? Such as, .12 MB, instaed of 120KB?

Desuneko commented 11 years ago

You'll have to add all of the filesizes in bytes then use human_filesize in $mitsuba->common

Desuneko commented 11 years ago

Also: $result = mysql_query("SELECT * FROM posts", $link);

I think it should add MAX(id)s from boards like in 4chan, I'll write the query when I'll have some time.

infamousbutterly commented 11 years ago

"You'll have to add all of the filesizes in bytes then use human_filesize in $mitsuba->common" You sort of lost me there. I'll see what I can do.

infamousbutterly commented 11 years ago
function human_filesize($bytes, $decimals = 2) {
  $sz = 'BKMGTP';
  $factor = floor((strlen($bytes) - 1) / 3);
  return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sz[$factor];
}

Do I have to edit this? I need a bit more help.

infamousbutterly commented 11 years ago

For the record, if none of this really helps you, then it's pointless for me to be doing this. I'm just trying to help, and I feel like you're doing most of the work which sort of defeats the purpose. If all I'm being is a distraction, then just say so.

Desuneko commented 11 years ago

Sorry, I wasn't close to my laptop.

You'll have to use human_filesize to convert from bytes to "human-readable" format and you can make a push request. Any help is welcome, because I'm busy with this permissions stuff and there are bugs to fix (I'm making a to do list)

infamousbutterly commented 11 years ago

Alright, I'll investigate it more. It will probably take me a day or two, because as said earlier, I'm only an ok programmer. Did you go to college for web development, or are you self taught?

Desuneko commented 11 years ago

Well, I knew Perl before PHP, so it was easy for me to start web development in PHP.

This tutorial is really great: http://php.net/manual/en/tutorial.php (I used it to learn the changes in PHP 5)

infamousbutterly commented 11 years ago

Awesome, thanks! I basically just figured out everything I know by trial and error with your software. Unlike tinyboard, it's easy to take it apart and find what does what for the most part. Plus, tinyboards developer is a dick.

Desuneko commented 11 years ago

There will be a big change in code, so if you want to modify mod panel (e.g. adding stuff in ./inc/mod/, ./inc/admin.*.php or ./mod.php) you should wait for those changes.

infamousbutterly commented 11 years ago

Alright, thanks for the protip. I don't really mess with those things too much. Only thing I've ever done is a a post counter into the mod panel.

Desuneko commented 11 years ago

I'm planning on making more hooks for my plugin API. If you have suggestions for those, just tell me.

Also, if you need help with plugin request try this: https://help.github.com/articles/creating-a-pull-request and before commiting code run git pull

Desuneko commented 11 years ago

Also if you need "real-time" help, I can answer your questions on irc irc.snoonet.org/6667 #karachan/#mitsuba or /query [^_^]/LiquidIce/Desuneko

infamousbutterly commented 11 years ago

Wow, that sounds great. I'll take you up on that offer in a bit. I'm leaving for around 5 hours. What timezone do you live in? I'm -6/ central time.

Desuneko commented 11 years ago

UTC+2, usually I'm from 16:00 (14:00 UTC) to 23:00 (21:00 UTC)

infamousbutterly commented 11 years ago

I'm in #mitsuba