Plugin Directory

Changeset 1102181


Ignore:
Timestamp:
03/01/2015 12:09:07 AM (11 years ago)
Author:
richhalverson
Message:

Version 2.5 Added disable wptexturization making using < or > in attribute specifications easier. Database names now default to the user name prefix when only one database setting is displayed. Spaces around commas in attributes now allowed. PHP files are no longer uploadable.

Location:
abase/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • abase/trunk/abase.php

    r1098518 r1102181  
    44Plugin URI: http://abase.com/
    55Description: Create a form, display a table or send an email. Short code: [abase ack="" alink="" center="" cols="" columns="" database="" db="" echo="" elements="" emailbcc="" emailcc="" emailfrom="" emailorigin="" emailsubject="" emailto="" fields="" files="" form="" from="" group="" images="" insert="" left="" limit="" notable="" notitle="" or="" order="" password="" required="" right="" rlink="" rownum="" search="" select="" sql="" style="" table="" update="" where=""]. To setup up to 3 databases and for complete attribute documentation, click Settings link at left.
    6 Version: 2.4
     6Version: 2.5
    77Author: Richard Halverson
    88Author URI: http://abase.com/
     
    1414// require 'plugin-updates/plugin-update-checker.php';
    1515// $MyUpdateChecker = new PluginUpdateChecker('http://abase.com/plugins/abase.json',__FILE__,'abase');
     16
     17/*
     18
     19Version 2.5 Added disable wptexturization making using < or > in attribute specifications easier. Database names now default to the user name prefix when only one database setting is displayed. Spaces around commas in attributes now allowed. PHP files are no longer uploadable.
     20
     21*/
     22
     23if(get_option('bus311mtd_disable_wptexturize')) remove_filter('the_content', 'wptexturize');
    1624
    1725add_action( 'admin_menu', 'table_display_plugin_menu' );
     
    205213//  special characters: ^ | $ > >= = <= < != %
    206214//  <operand> ::= <surrogate> | <integer> | ' <constant> '
     215    $key_in=trim($key_in);
    207216    $wkey=htmlspecialchars_decode($key_in);
    208217    $column_title=''; $column_name=''; $foreign_column=''; $submit_button=''; $button_value=''; $op=''; $operand=''; $got_pct=''; $got_pct0=''; $operand_is_constant=0; $element_style=''; $value_format=''; $delete_value='';$element_type='';
     
    351360    $error_string='';
    352361    $fatal_error=0;
     362    $rejectFiles='/\.(sh|asp|cgi|php|php3|ph3|php4|ph4|php5|ph5|phtm|phtml)$/';
    353363    $maxJoinCount=20;
    354364    $maxJoinDepth=20;
     
    669679        $frms=split(',',$form_in);
    670680        foreach($frms as $fm){
     681            $fm=trim($fm);
    671682            $debug_string.=" ,fm=$fm";
    672683            if(is_numeric($fm)){
     
    794805        $acks=split(',',$updateack_in);
    795806        foreach($acks as $ak){
     807            $ak=trim($ak);
    796808            $debug_string.=" ,ak=$ak";
    797809            if($ak>='1' && $ak<='4'){
     
    12291241    if($error_string>''){
    12301242        $top_output.="<font style='color:$error_color; background-color: white;'>";
     1243//      $top_output.='<STRONG>#'.$GLOBALS['bus311mtd_instance'].'.</STRONG> '.$full_short_code;
    12311244        $top_output.='<STRONG>#'.$GLOBALS['bus311mtd_instance'].'.</STRONG> '.htmlspecialchars($full_short_code);
    12321245        $top_output.="<br><STRONG>Non-Fatal Error</STRONG> (".__LINE__.")<br>".substr($error_string,2);
     1246        if(strpos($full_short_code,'&#8221;')>0 && !get_option('bus311mtd_disable_wptexturize')){
     1247            $top_output.="<BR>You might try disabling <I>wptexturize</I> under Settings.";
     1248        };
    12331249        $top_output.='</font>';
    12341250        $top_output.="<BR>";
     
    13371353                                if(!is_dir($dir)){mkdir($dir);};
    13381354                            };
    1339                             move_uploaded_file( $_FILES[$key_]['tmp_name'], $target_Pathfile );
     1355// do not allow \.(sh|asp|cgi|php|php3|ph3|php4|ph4|php5|ph5|phtm|phtml)$
     1356                           
     1357//                          if(!strpos(substr($target_Pathfile,-6,6),'.php')) move_uploaded_file( $_FILES[$key_]['tmp_name'], $target_Pathfile );
     1358                            if(!preg_match($rejectFiles,$target_Pathfile)) move_uploaded_file( $_FILES[$key_]['tmp_name'], $target_Pathfile );
    13401359                            $set.=", `$key`='".$target_Pathfile."'";
    13411360                            $wh.=" AND `$key`='".$target_Pathfile."'";
     
    15061525                            unlink($oldValue);
    15071526                        };
    1508                         move_uploaded_file( $_FILES[$key_]['tmp_name'], $target_Pathfile );
     1527//                      if(!strpos(substr($target_Pathfile,-6,6),'.php')) move_uploaded_file( $_FILES[$key_]['tmp_name'], $target_Pathfile );
     1528                        if(!preg_match($rejectFiles,$target_Pathfile)) move_uploaded_file( $_FILES[$key_]['tmp_name'], $target_Pathfile );
    15091529                        $set.=", `$key`='".$target_Pathfile."'";
    15101530                        $numUpdates+=1;
     
    20042024                                $input_style='';
    20052025                                for($i=0;$i<count($ordr);$i+=1){
    2006                                     if($ordr[$i]==$key){
     2026                                    if(trim($ordr[$i])==trim($key)){
    20072027                                        $input_style=$styls[$i];
    20082028                                    };
  • abase/trunk/abase_plugin_options.php

    r813494 r1102181  
    1515        $db1ok.=$_POST['bus311mtd_dbfiles2'].$_POST['bus311mtd_dbfiles3'];
    1616        $cusrlen=strlen($cusr)+1;
    17 
     17        $wpdbname=DB_NAME; $wpdbnamePrefix=substr($wpdbname,0,strpos($wpdbname,'_'));
     18        $wpdbuser=DB_USER;$wpdbuserPrefix=substr($wpdbuser,0,strpos($wpdbuser,'_'));
     19        $cpanelUser='';
     20        if(strlen($wpdbnamePrefix)>0 && $wpdbnamePrefix==$wpdbuserPrefix){$cpanelUser=$wpdbnamePrefix;};
     21
     22/*
    1823// do not allow switching from show=3 to show=1
    1924// if
     
    2328// any database2 parameter not blank or
    2429// any database3 parameter not blank
     30
     31if(dbshow_old==0 &&
     32
     33*/
    2534
    2635        if($_POST['bus311mtd_hidden'] == 'Y') { 
     
    3241                $dbname_nu=$_POST['bus311mtd_dbname_nu'];
    3342                $dbname='';
    34                 if($dbname_nu>''){$dbname=$cusr.'_'.$dbname_nu; $dbname=$dbname_nu;};
     43                if($dbname_nu>''){
     44                    $dbname=$cusr.'_'.$dbname_nu;
     45//                  $dbname=$dbname_nu;
     46                };
    3547                update_option('bus311mtd_dbname', $dbname); 
    3648                $dbuser_nu=$_POST['bus311mtd_dbuser_nu'];
    3749                $dbuser='';
    38                 if($dbuser_nu>''){$dbuser=$cusr.'_'.$dbuser_nu; $dbuser=$dbuser_nu;};
     50                if($dbuser_nu>''){
     51                    $dbuser=$cusr.'_'.$dbuser_nu;
     52//                  $dbuser=$dbuser_nu;
     53                };
    3954                update_option('bus311mtd_dbuser', $dbuser);
    4055                $dbpwd = $_POST['bus311mtd_dbpwd'];
     
    88103                };
    89104            };
     105            $disable_wptexturize=$_POST['bus311mtd_disable_wptexturize']; update_option('bus311mtd_disable_wptexturize', $disable_wptexturize);
    90106            $form_min=$_POST['bus311mtd_form_min']; update_option('bus311mtd_form_min', $form_min);
    91107            $form_max=$_POST['bus311mtd_form_max']; update_option('bus311mtd_form_max', $form_max);
     
    99115
    100116        $dbshow='';if(get_option('bus311mtd_show')){$dbshow = get_option('bus311mtd_show');}else{update_option('bus311mtd_show', '');};
     117
     118        $disable_wptexturize='';
     119        if(get_option('bus311mtd_disable_wptexturize')){
     120            $disable_wptexturize = get_option('bus311mtd_disable_wptexturize');
     121        }else{
     122            update_option('bus311mtd_disable_wptexturize', '');
     123        };
    101124
    102125        $form_min='';if(get_option('bus311mtd_form_min')){$form_min = get_option('bus311mtd_form_min');}else{update_option('bus311mtd_form_min', '0');};
     
    144167                $lp=1;$fs=0;
    145168                if($dbshow>0){$lp=3;$fs=1;};
    146                 $fsX=1; //remove default user name for cPanel
     169//              $fs=1; //remove default user name for cPanel
    147170                for($i=1;$i<=$lp;$i+=1){
    148171                    if($i==1){
     
    172195                    };
    173196        ?>          <table>
    174         <?php           if($i==1){
     197<?php           if($i==1){
    175198        ?>
    176199                   
     
    180203                    </tr>
    181204                    <tr>
     205                        <td align=right bgcolor="DDDDDD">Texturization:</td>
     206                        <td>&nbsp;<input type="checkbox" name="bus311mtd_disable_wptexturize" value="1" <?php if($disable_wptexturize=='1') echo 'checked'; ?>>Disable wptexturize</td>
     207                        <td colspan=2>Disable wptexturize if you are using less than or greater than symbols in your attributes (&lt; or &gt;), for example, in an SQL WHERE clause.
     208                        <?php echo $cusr; ?>
     209                        </td>
     210                    </tr>
     211                    <tr>
    182212                        <td align=right bgcolor="DDDDDD">Form Life:</td>
    183                         <td><nobr>Min:<input type="text" name="bus311mtd_form_min" size="1" value="<?php echo $form_min; ?>">,</nobr> <nobr>Max:<input type="text" name="bus311mtd_form_max" size="2" value="<?php echo $form_max; ?>"></nobr>
     213                        <td><nobr>Min:<input type="text" name="bus311mtd_form_min" size="1" value="<?php echo $form_min; ?>">,</nobr> <nobr>Max:<input type="text" name="bus311mtd_form_max" size="2" value="<?php echo $form_max; ?>"></nobr></td>
    184214                        <td colspan=2>in Seconds. Valid form life. Before or afterwards, Insert, Update or Delete<BR>form not valid and database update will not occur. Set Max to 0 for non-enforcement.
    185215                        </td>
     
    188218                    <tr>
    189219                        <td colspan=2><h3>Database Settings:</h3></td>
    190                         <td colspan=2 align=left><input type="checkbox" name="bus311mtd_show" value="1" <?php  if($dbshow>0){echo "checked"; }; ?>>Expand to full settings
     220                        <td colspan=2 align=left><table><tr><td><input type="checkbox" name="bus311mtd_show" value="1" <?php  if($dbshow>0){echo "checked"; }; ?>>Expand to full settings (3 databases)</td><td><?php  submit_button() ?></td></tr></table>
    191221                        </td>
    192222                    </tr>
     
    196226                    };
    197227                    $dname_nouser=$dname;
    198 //                  if(substr($dname,0,strlen($cusr)+1)==$cusr.'_'){$dname_nouser=substr($dname,strlen($cusr)+1);};
     228                    if(substr($dname,0,strlen($cusr)+1)==$cusr.'_'){$dname_nouser=substr($dname,strlen($cusr)+1);};
    199229                    $wp_dname_nouser=DB_NAME;
    200 //                  if(substr($wp_dname_nouser,0,strlen($cusr)+1)==$cusr.'_'){$wp_dname_nouser=substr($wp_dname_nouser,strlen($cusr)+1);};
     230                    if(substr($wp_dname_nouser,0,strlen($cusr)+1)==$cusr.'_'){$wp_dname_nouser=substr($wp_dname_nouser,strlen($cusr)+1);};
    201231                    $duser_nouser=$duser;
    202 //                  if(substr($duser,0,strlen($cusr)+1)==$cusr.'_'){$duser_nouser=substr($duser,strlen($cusr)+1);};
     232                    if(substr($duser,0,strlen($cusr)+1)==$cusr.'_'){$duser_nouser=substr($duser,strlen($cusr)+1);};
    203233                    $wp_duser_nouser=DB_USER;
    204 //                  if(substr($wp_duser_nouser,0,strlen($cusr)+1)==$cusr.'_'){$wp_duser_nouser=substr($wp_duser_nouser,strlen($cusr)+1);};
     234                    if(substr($wp_duser_nouser,0,strlen($cusr)+1)==$cusr.'_'){$wp_duser_nouser=substr($wp_duser_nouser,strlen($cusr)+1);};
    205235
    206236                    if($dbshow>0){  ?>
     
    209239                            <td colspan=2>leave blank unless you know specifically otherwise (<?php  echo "default: ".DB_HOST; ?>)</td>
    210240                        </tr>
    211         <?php           };  ?>
     241<?php               };  ?>
    212242                        <tr><td align=right bgcolor="DDDDDD">Database name<?php echo $sdbn;?>:</td>
    213                             <td><?php
    214                         if(!$fs){
    215                         //  echo $cusr.'_';
    216                             ?><input type="text" name="bus311mtd_dbname_nu<?php echo $dbn;?>" value="<?php echo $dname_nouser; ?>" size="20"><?php  }else{ ?><input type="text" name="bus311mtd_dbname<?php echo $dbn;?>" value="<?php echo $dname; ?>" size="20"><?php  }; ?></td>
     243                            <td><nobr>
     244                        <?php if(!$fs){ echo $cusr.'_'; ?><input type="text" name="bus311mtd_dbname_nu<?php echo $dbn;?>" value="<?php echo $dname_nouser; ?>" size="10">
     245                        <?php  }else{ ?>
     246                            <input type="text" name="bus311mtd_dbname<?php echo $dbn;?>" value="<?php echo $dname; ?>" size="20">
     247                        <?php  }; ?>
     248                            </nobr></td>
    217249                            <td><?php  echo " leave blank for WordPress database (".DB_NAME.")"; ?></td>
    218250<?php  if($create_databases==1){ ?>
     
    226258                        </tr> 
    227259                        <tr><td align=right bgcolor="DDDDDD">Database user<?php echo $sdbn;?>:</td>
    228                             <td><?php  if(!$fs){
    229                             //echo $cusr.'_';
    230                             ?><input type="text" name="bus311mtd_dbuser_nu<?php echo $dbn;?>" value="<?php echo $duser_nouser; ?>" size="20"><?php  }else{ ?><input type="text" name="bus311mtd_dbuser<?php echo $dbn;?>" value="<?php echo $duser; ?>" size="20"><?php  }; ?></td>
     260                            <td><?php  if(!$fs){ echo $cusr.'_'; ?><input type="text" name="bus311mtd_dbuser_nu<?php echo $dbn;?>" value="<?php echo $duser_nouser; ?>" size="10">
     261                                <?php  }else{ ?>
     262                                    <input type="text" name="bus311mtd_dbuser<?php echo $dbn;?>" value="<?php echo $duser; ?>" size="20">
     263                                <?php  }; ?>
     264                            </td>
    231265                            <td colspan=2><?php  echo " leave blank if Database name is blank or the WordPress user (".DB_USER.") has permissions to access this database."; ?></td>
    232266                            <td></td>
     
    246280                            </td>
    247281                        </tr>
    248                         <?php  }; ?>
     282                <?php  }; ?>
    249283                    </table>
    250284        <?php   
  • abase/trunk/readme.txt

    r1098518 r1102181  
    2020[abase ack="" alink="" center="" cols="" columns="" database="" db="" echo="" elements="" emailbcc="" emailcc="" emailfrom="" emailorigin="" emailsubject="" emailto="" fields="" files="" form="" from="" group="" images="" insert="" left="" limit="" notable="" notitle="" or="" order="" password="" required="" right="" rlink="" rownum="" search="" select="" sql="" style="" table="" update="" where=""]
    2121<P>
    22 Within the quotes of each attribute can be a parameter value or a list of values separated by commas (,). Empty fields need not be specified. An unrecognized attribute is ignored. Using the shortcode with no (recognizable) attributes ([abase]) lists the database user, database, tables with record counts for the current database. Otherwise, either the <strong>sql</strong>, <strong>from</strong>, or <strong>table</strong> attribute should be used to specify part or all of a database operation, or an email sent, using at least an <strong>emailto</strong> attribute. The attribute names must be lower case. Characters <code>&lt;</code> and <code>&gt;</code> are illegal within the quotes. The <code>&lt</code> must be replaced with <code>&amp;lt;</code> and <code>&gt;</code> must be replaced with <code>&amp;gt;</code>.
     22Within the quotes of each attribute can be a parameter value or a list of values separated by commas (,). Empty fields need not be specified. An unrecognized attribute is ignored. Using the shortcode with no (recognizable) attributes ([abase]) lists the database user, database, tables with record counts for the current database. Otherwise, either the <strong>sql</strong>, <strong>from</strong>, or <strong>table</strong> attribute should be used to specify part or all of a database operation, or an email sent, using at least an <strong>emailto</strong> attribute. The attribute names must be lower case. If you are using <code>&lt;</code> or <code>&gt;</code> within the quotes, be sure to disable wptexturization.
    2323<P>
    2424ABASE shortcodes can also be of the form [abase ...]&lt;content&gt;[/abase]. In this form, &lt;content&gt; will be displayed above what [abase ...] produces. The shortcode name "abase" can be all lower-case or all upper-case but not mixed case. Each functions identically but are treated separately. Note that when including a closing shortcode, it must be case identical. &lt;content&gt; can include ABASE tags as long as the alternate case is used. Embedding shortcodes in content is useful when using ABASE to send emails from your website.
     
    4848    <li><strong>fields</strong> - fields=" &lt;field_spec&gt; ( , &lt;field_spec&gt; )" - Specifies the column names to be displayed in record view. Record view is a two column table with the field names in the first column and the values in the second column.
    4949        <ul><li>Meta language: terms in parentheses are optional, vertical bar (|) - OR operator. (Exception - vertical bar (|) preceded &lt;foreign_column&gt;.)
    50             <li>&lt;field_spec&gt; ::= ( &lt;column_title&gt;^ ) &lt;column_name&gt; ( |&lt;foreign_column&gt; ) ( ! ( '( &lt;element_type&gt; &lt;space&gt; ) &lt;element_style&gt;' ) ) ( [&gt;|&gt;=|=|&lt;=|&lt;|!=] ( % ) &lt;operand&gt; ) ( % ) ( $ ( &lt;button_value&gt; ) ) &nbsp; &nbsp; <strong>Note:</strong> characters <code>&lt;</code> and <code>&gt;</code> are illegal for less-than or greater-than in an expression, so replace <code>&lt</code> with <code>&amp;lt;</code> and <code>&gt;</code> with <code>&amp;gt;</code>.
     50            <li>&lt;field_spec&gt; ::= ( &lt;column_title&gt;^ ) &lt;column_name&gt; ( |&lt;foreign_column&gt; ) ( ! ( '( &lt;element_type&gt; &lt;space&gt; ) &lt;element_style&gt;' ) ) ( [&gt;|&gt;=|=|&lt;=|&lt;|!=] ( % ) &lt;operand&gt; ) ( % ) ( $ ( &lt;button_value&gt; ) ) &nbsp; &nbsp; <strong>Note:</strong> If you are using <code>&lt;</code> or <code>&gt;</code>, be sure to disable wptexturization.
    5151            <li>&lt;operand&gt; ::= &lt;surrogate&gt; | &lt;integer&gt; | ' &lt;constant&gt; '
    5252            <li>&lt;column_title&gt; = optionally precedes &lt;column_name&gt; using a carrot (^) character. It replaces &lt;column_name&gt; as column title in table view and field name in record view.
     
    9696    <li><strong>search</strong> - search="" (depreciated. Use form="search".)
    9797    <li><strong>select</strong> - Specifies the select_expr clause in the MySQL SELECT statement. Default is * (all columns).
    98     <li><strong>sql</strong> - Specifies a complete MySQL statement to be executed. Characters <code>&lt;</code> and <code>&gt;</code> are illegal for less-than or greater-than in an expression, so replace <code>&lt</code> with <code>&amp;lt;</code> and <code>&gt;</code> with <code>&amp;gt;</code>.
     98    <li><strong>sql</strong> - Specifies a complete MySQL statement to be executed. If you are using <code>&lt;</code> or <code>&gt;</code>, be sure to disable wptexturization.
    9999    <li><strong>style</strong> - This will specify a style="" attribute for the table that encloses the shortcode display.
    100100    <li><strong>table</strong> - Specifies the database table to be searched or updated.
    101101    <li><strong>update</strong> - update="" (depreciated. Use form="update".)
    102     <li><strong>where</strong> - Specifies the where_condition clause in the MySQL SELECT statement. If it begins with "AND " or "OR " it will be concatenated to (instead of overridding) any other where expression. Characters <code>&lt;</code> and <code>&gt;</code> are illegal for less-than or greater-than in an expression, so replace <code>&lt</code> with <code>&amp;lt;</code> and <code>&gt;</code> with <code>&amp;gt;</code>.
     102    <li><strong>where</strong> - Specifies the where_condition clause in the MySQL SELECT statement. If it begins with "AND " or "OR " it will be concatenated to (instead of overridding) any other where expression. Be sure to disable wptexturization if you are using <code>&lt;</code> or <code>&gt;</code>.
    103103</ul>
    104104<h3>Displaying Fields</h3>
     
    287287== Changelog ==
    288288
     289= 2.5 =
     290
     291Added disable wptexturization making using &lt; or &gt; in attribute specifications easier. Database names now default to the user name prefix when only one database setting is displayed. Spaces around commas in attributes now allowed. PHP files are no longer uploadable.
     292
    289293= 2.4 =
    290294
     
    357361== Upgrade notice ==
    358362
     363= 2.5 =
     364
     365Added disable wptexturization making using &lt; or &gt; in attribute specifications easier. Database names now default to the user name prefix when only one database setting is displayed. Spaces around commas in attributes now allowed. PHP files are no longer uploadable.
     366
    359367= 2.4 =
    360368
  • abase/trunk/version.txt

    r1098518 r1102181  
    1 Version: 2.4 Updated: February 14, 2015.
     1Version: 2.5 Updated: February 28, 2015.
Note: See TracChangeset for help on using the changeset viewer.