2009-02-08, 08:29 PM
Pages: 1 2
2009-02-08, 11:31 PM
Looks good. Very nice of you to release this under the GPL license too.
You could add a small readme explaining how to install it, even if uploading is all you have to do. I was a bit confused at first since there were two files called mini_sql.php.
Some minor nitpicks with your code (feel free to ignore all of them):
In mini_sql/mini_sql*.php there is a broken windows/mac? linebreak in the first if
PHP probably ignores all \r\n outside of strings, but maybe you want to fix it anyway.
The IN_MYBB check is also completely missing in the plugin mini_sql.php file, you should probably add it back.
There is no guarantee that group id 17 will be the server group (or that it exists at all), so in worst case that entry will be invalid. Also why do you think that your setting belongs to this group and has to be right at the top of it (disporder 1)?
You can use MYBB_ROOT or MYBB_ROOT.$mybb->config['admin_dir'].'/' depending on where you want to look for a file.
Minor nitpicks with your style (this is where programmers tend to get touchy so please ignore it completely):
mini_sql/mini_sql.php is a bit hard to read, since you break out of php ?> only to get html / javascript intermixed with <?php ?> statements followed by <?php again. Isn't doing this more cumbersome than having to escape a " quote here and there?
Your indentation and codestyle is inconsistent, you mix spaces with tabs, sometimes you write if(x) sometimes if (x) and while even becomes while ( x ).
I also have a feature request:
For forums that do not have a dedicated database, but share one database with other applications, it would be nice if the List of Table(s) could be restricted to tables with the MyBB table prefix. Similar to how it is done in Backups -> New Backup -> Select Forum Tables except that in this case it should probably a filters as in [X] Show only forum tables.
I also have a bug to report:
Show forum columns does not work right for me, I get a warning instead.
Using PHP 5 and MySQL 5... it does show the columns despite this though.
You could add a small readme explaining how to install it, even if uploading is all you have to do. I was a bit confused at first since there were two files called mini_sql.php.
Some minor nitpicks with your code (feel free to ignore all of them):
In mini_sql/mini_sql*.php there is a broken windows/mac? linebreak in the first if
if(!defined("IN_MYBB"))^M{
PHP probably ignores all \r\n outside of strings, but maybe you want to fix it anyway.
The IN_MYBB check is also completely missing in the plugin mini_sql.php file, you should probably add it back.
'disporder' => 1,
'gid' => 17 // Server
There is no guarantee that group id 17 will be the server group (or that it exists at all), so in worst case that entry will be invalid. Also why do you think that your setting belongs to this group and has to be right at the top of it (disporder 1)?
;
// I know this is may not good :)
define('MINI_SQL_CONFIG_FILE', '../../../inc/plugins/mini_sql/mini_sql_config.php');
[...]
// I know this is may not good :)
define('MINI_SQL_FILE', '../../../inc/plugins/mini_sql/mini_sql.php');
You can use MYBB_ROOT or MYBB_ROOT.$mybb->config['admin_dir'].'/' depending on where you want to look for a file.
Minor nitpicks with your style (this is where programmers tend to get touchy so please ignore it completely):
mini_sql/mini_sql.php is a bit hard to read, since you break out of php ?> only to get html / javascript intermixed with <?php ?> statements followed by <?php again. Isn't doing this more cumbersome than having to escape a " quote here and there?
Your indentation and codestyle is inconsistent, you mix spaces with tabs, sometimes you write if(x) sometimes if (x) and while even becomes while ( x ).
I also have a feature request:
For forums that do not have a dedicated database, but share one database with other applications, it would be nice if the List of Table(s) could be restricted to tables with the MyBB table prefix. Similar to how it is done in Backups -> New Backup -> Select Forum Tables except that in this case it should probably a filters as in [X] Show only forum tables.
I also have a bug to report:
Show forum columns does not work right for me, I get a warning instead.
Warning [2] mysql_num_fields(): supplied argument is not a valid MySQL result resource - Line: 97 - File: inc/plugins/mini_sql/mini_sql.php PHP 5.2.8 (Linux)
File Line Function
[PHP] errorHandler->error
/inc/plugins/mini_sql/mini_sql.php 97 mysql_num_fields
/inc/plugins/mini_sql/mini_sql.php 66 mini_sql_generate_fields
/admin/index.php 378 require
Using PHP 5 and MySQL 5... it does show the columns despite this though.
2009-02-09, 02:50 AM
Quote:There is no guarantee that group id 17 will be the server group (or that it exists at all), so in worst case that entry will be invalid. Also why do you think that your setting belongs to this group and has to be right at the top of it (disporder 1)?
Well, when I choose 17 since I think It always be there and I did not find a feature in admin panel that delete the server configuration group. But my main reason was I did not put the User Interface in settings table but in files, so it just dummy value. But then I was wrong. So, I will fix it in next realase.
Quote:You can use MYBB_ROOT or MYBB_ROOT.$mybb->config['admin_dir'].'/' depending on where you want to look for a file.
You're right, I just noticed that $mybb global variable contains this settings. I never check it
Quote:mini_sql/mini_sql.php is a bit hard to read, since you break out of php ?> only to get html / javascript intermixed with <?php ?> statements followed by <?php again. Isn't doing this more cumbersome than having to escape a " quote here and there?
Sorry, I read too many wordpress plugin so I got influenced
Quote:Your indentation and codestyle is inconsistent, you mix spaces with tabs, sometimes you write if(x) sometimes if (x) and while even becomes while ( x ).
yeah... I will try to consistent in next release
Quote:For forums that do not have a dedicated database, but share one database with other applications, it would be nice if the List of Table(s) could be restricted to tables with the MyBB table prefix. Similar to how it is done in Backups -> New Backup -> Select Forum Tables except that in this case it should probably a filters as in [X] Show only forum tables.
OK,
Quote:I also have a bug to report:
Show forum columns does not work right for me, I get a warning instead.
My box using Linux with MySQL 5 and PHP 5. I don't know is there any different between SHOW COLUMNS and SHOW FIELDS? MySQL 4/5?.
Many thanks frostschutz
2009-02-09, 03:03 AM
For the right GID I do a quick query based on the name.
$query = $db->simple_select("settinggroups", "gid", "name='posting'");
$gid = $db->fetch_field($query, "gid");
The you can use $gid in the array...foolproof really. You may have to look in mysql in order to know all the names for the setting groups though. He is right that there is an inconsistency that exists between install and users. What might be gid 17 on one forum will be 22 on another.
$query = $db->simple_select("settinggroups", "gid", "name='posting'");
$gid = $db->fetch_field($query, "gid");
The you can use $gid in the array...foolproof really. You may have to look in mysql in order to know all the names for the setting groups though. He is right that there is an inconsistency that exists between install and users. What might be gid 17 on one forum will be 22 on another.
2009-02-09, 11:46 AM
(2009-02-09, 03:03 AM)labrocca Wrote: [ -> ]For the right GID I do a quick query based on the name.
$query = $db->simple_select("settinggroups", "gid", "name='posting'");
$gid = $db->fetch_field($query, "gid");
The you can use $gid in the array...foolproof really. You may have to look in mysql in order to know all the names for the setting groups though. He is right that there is an inconsistency that exists between install and users. What might be gid 17 on one forum will be 22 on another.
thanks for the tips labrocca
2009-04-27, 01:01 AM
Can do SQLite 2 ?
2009-04-27, 03:48 PM
(2009-04-27, 01:01 AM)qlan Wrote: [ -> ]Can do SQLite 2 ?
Means ??
(2009-02-09, 03:03 AM)labrocca Wrote: [ -> ]For the right GID I do a quick query based on the name.
$query = $db->simple_select("settinggroups", "gid", "name='posting'");
$gid = $db->fetch_field($query, "gid");
The you can use $gid in the array...foolproof really. You may have to look in mysql in order to know all the names for the setting groups though. He is right that there is an inconsistency that exists between install and users. What might be gid 17 on one forum will be 22 on another.
Hey Jesse, Great tip, I am using this technique in my future planed plugins, but the problem is it doesnot support myBB installed on local computer, OR perhaps my MyBB copy have errors, NOT sure about it
2009-04-28, 01:12 PM
You would need some excellent admin control panel protection, good work though.
2009-05-02, 11:27 PM
Thanks Mate. I might use this, it saves me time going into phpmyadmin.
Pages: 1 2