Changeset 468 for trunk/bin


Ignore:
Timestamp:
Feb 20, 2014 3:03:59 AM (10 years ago)
Author:
anonymous
Message:

Completed integrating /branches/eli_branch into /trunk. Changes include:

  • Removed closing ?> from end of files
  • Upgrade old-style contructor methods to use construct() instead.
  • Class properties and methods defined as public, private, static or protected
  • Ensure code runs under E_ALL with only mysql_* deprecated warnings
  • Search for the '@' symbol anywhere it might be used to supress runtime errors, then replace with proper error recovery.
  • Run the php cli -l option to check files for syntax errors.
  • Bring tests up-to-date with latest version and methods of PHPUnit
Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/bin/acl.cli.php

    r415 r468  
    55 * For details visit the project site: <http://trac.strangecode.com/codebase/>
    66 * Copyright 2001-2012 Strangecode, LLC
    7  * 
     7 *
    88 * This file is part of The Strangecode Codebase.
    99 *
     
    1212 * Free Software Foundation, either version 3 of the License, or (at your option)
    1313 * any later version.
    14  * 
     14 *
    1515 * The Strangecode Codebase is distributed in the hope that it will be useful, but
    1616 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1717 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    1818 * details.
    19  * 
     19 *
    2020 * You should have received a copy of the GNU General Public License along with
    2121 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
     
    113113        break;
    114114    case 'all' :
    115         listObjects('root', 'aro');                               
    116         listObjects('root', 'aco');                               
     115        listObjects('root', 'aro');
     116        listObjects('root', 'aco');
    117117        listObjects('root', 'axo');
    118118        break;
     
    238238but could just as easily be SPICES -> CUISINES -> DISHES. A privilege is
    239239allowed if a user (ARO) can perform an action (ACO) on something (AXO).
    240 For example, with an `ARO->ACO->AXO` of `Bob->edit->4`, Bob can edit article 4. 
    241 If the AXO were omitted (i.e. just `Bob->edit`), this becomes "Bob can edit" 
     240For example, with an `ARO->ACO->AXO` of `Bob->edit->4`, Bob can edit article 4.
     241If the AXO were omitted (i.e. just `Bob->edit`), this becomes "Bob can edit"
    242242(he can edit any object).
    243243
    244 Each access object is stored as a node in hierarchical tree structures. 
     244Each access object is stored as a node in hierarchical tree structures.
    245245A permission granted to a node is applied to all its children. If a child
    246246node is specified a different permission that is more specific than
     
    252252
    253253Where command is any of the following (with arguments):
    254    
     254
    255255    initdb
    256256    list [aro | aco | axo | all | perms]
     
    268268    revoke aro [aco] [axo]
    269269    delete [aro] [aco] [axo]
    270    
    271 
    272 For the add*, mv*, grant, and revoke commands if any of the optional 
    273 args are not provided, 'root' is assumed. For the delete command 
     270
     271
     272For the add*, mv*, grant, and revoke commands if any of the optional
     273args are not provided, 'root' is assumed. For the delete command
    274274'null' is considered a wild-card to delete all objects of that type.
    275275
     
    297297    $db =& DB::getInstance();
    298298    global $this_script;
    299    
     299
    300300    echo "\n";
    301301
     
    324324    $qid = $db->query("SELECT lft, rgt FROM $tbl WHERE name = '" . $db->escapeString($root) . "'");
    325325    list($lft, $rgt) = mysql_fetch_row($qid);
    326    
     326
    327327    $depth = array();
    328    
     328
    329329    // Retrieve all descendants of the root node
    330330    $qid = $db->query("SELECT name, lft, rgt, added_datetime FROM $tbl WHERE lft BETWEEN $lft AND $rgt ORDER BY lft ASC");
     
    334334            array_pop($depth);
    335335        }
    336    
     336
    337337        // Display indented node title.
    338338        printf("%-35s %-5s %-5s %s\n", str_repeat('    ', sizeof($depth)) . $name, $lft, $rgt, date($app->getParam('date_format'), strtotime($added_datetime)));
    339        
     339
    340340        // Add this node to the stack.
    341341        $depth[] = $rgt;
     
    356356    $db =& DB::getInstance();
    357357    global $this_script;
    358    
     358
    359359    // Retrieve access value from db.
    360360    $qid = $db->query("
     
    371371    while ($p = mysql_fetch_assoc($qid)) {
    372372        printf("%-25s %-25s %-25s \033[0;%sm%-6s\033[0m %-10s\n", $p['aro'], $p['aco'], $p['axo'], ('allow' == $p['access'] ? '32' : '31'), $p['access'], date($app->getParam('date_format'), strtotime($p['added_datetime'])));
    373     }   
    374 }
    375 
    376 
    377 ?>
     373    }
     374}
     375
     376
  • trunk/bin/file_importer.php

    r412 r468  
    123123// }
    124124//
    125 // ?>
  • trunk/bin/module_maker/_config.inc.php

    r457 r468  
    7373
    7474
    75 ?>
  • trunk/bin/module_maker/form_template.cli.php

    r412 r468  
    249249
    250250echo join("\n", $output);
    251 
    252 ?>
  • trunk/bin/module_maker/list_template.cli.php

    r461 r468  
    3636    $db_tbl = $_SERVER['argv'][2];
    3737} else {
    38     die(sprintf("Usage: %s site_directory db_table [operation]\nValid operations include: %s", basename($_SERVER['argv'][0]), join(', ', $valid_ops)));
     38    die(sprintf("Usage: %s site_directory db_table [operation]\nValid operations include: %s\n", basename($_SERVER['argv'][0]), join(', ', $valid_ops)));
    3939}
    4040
     
    213213
    214214E_O_F;
    215 
    216 ?>
  • trunk/bin/module_maker/module.cli.php

    r413 r468  
    596596    }
    597597}
    598 
    599 ?>
  • trunk/bin/module_maker/skel/admin.php

    r408 r468  
    44 * For details visit the project site: <http://trac.strangecode.com/codebase/>
    55 * Copyright 2001-2012 Strangecode, LLC
    6  * 
     6 *
    77 * This file is part of The Strangecode Codebase.
    88 *
     
    1111 * Free Software Foundation, either version 3 of the License, or (at your option)
    1212 * any later version.
    13  * 
     13 *
    1414 * The Strangecode Codebase is distributed in the hope that it will be useful, but
    1515 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1616 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    1717 * details.
    18  * 
     18 *
    1919 * You should have received a copy of the GNU General Public License along with
    2020 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
     
    236236    $db =& DB::getInstance();
    237237    $app =& App::getInstance();
    238    
     238
    239239    $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $id);
    240240    if ($lock->isLocked() && !$lock->isMine()) {
     
    278278    $db =& DB::getInstance();
    279279    $app =& App::getInstance();
    280    
     280
    281281    $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $id);
    282282    if ($lock->isLocked() && !$lock->isMine()) {
     
    314314    $db =& DB::getInstance();
    315315    $app =& App::getInstance();
    316    
     316
    317317    // Remove any stale cached list data.
    318318    $cache->delete('list');
     
    337337    $db =& DB::getInstance();
    338338    $app =& App::getInstance();
    339    
     339
    340340    $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $frm['%PRIMARY_KEY%']);
    341341    if ($lock->isLocked() && !$lock->isMine()) {
     
    364364    global $tmp_prefs;
    365365    global $cache;
    366     $db =& DB::getInstance();   
    367     $app =& App::getInstance();
    368    
     366    $db =& DB::getInstance();
     367    $app =& App::getInstance();
     368
    369369    $where_clause = '';
    370370
     
    379379    if (getFormData('filter___///__', false)) {
    380380        // Limit by filter.
    381         $where_clause .= (empty($where_clause) ? 'WHERE' : 'AND') . " __///__ = '" . $db->escapeString(getFormData('filter___///__')) . "'";
     381        $where_clause .= (empty($where_clause) ? 'WHERE' : ' AND') . " __///__ = '" . $db->escapeString(getFormData('filter___///__')) . "'";
    382382    }
    383383
     
    425425        return $list;
    426426    }
    427    
     427
    428428    // The list was not cached, so issue the real query.
    429429    $qid = $db->query($sql);
     
    445445    $db =& DB::getInstance();
    446446    $app =& App::getInstance();
    447    
     447
    448448    if (!is_array($ranks)) {
    449449        $app->logMsg('Saving rank failed, data posted is not an array: ' . $ranks, LOG_ERR, __FILE__, __LINE__);
     
    476476    }
    477477}
    478 
    479 ?>
  • trunk/bin/module_maker/skel/public.php

    r396 r468  
    145145include 'footer.ihtml';
    146146
    147 ?>
  • trunk/bin/module_maker/sql.cli.php

    r412 r468  
    55 * For details visit the project site: <http://trac.strangecode.com/codebase/>
    66 * Copyright 2001-2012 Strangecode, LLC
    7  * 
     7 *
    88 * This file is part of The Strangecode Codebase.
    99 *
     
    1212 * Free Software Foundation, either version 3 of the License, or (at your option)
    1313 * any later version.
    14  * 
     14 *
    1515 * The Strangecode Codebase is distributed in the hope that it will be useful, but
    1616 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1717 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    1818 * details.
    19  * 
     19 *
    2020 * You should have received a copy of the GNU General Public License along with
    2121 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
     
    3636    $db_tbl = $_SERVER['argv'][2];
    3737} else {
    38     die(sprintf("Usage: %s site_directory db_table [operation]\nValid operations include: %s", basename($_SERVER['argv'][0]), join(', ', $valid_ops)));
     38    die(sprintf("Usage: %s site_directory db_table [operation]\nValid operations include: %s\n", basename($_SERVER['argv'][0]), join(', ', $valid_ops)));
    3939}
    4040
     
    218218
    219219echo isset($op) ? '' : "\n\n\n";
    220 ?>
  • trunk/bin/module_maker/validation.cli.php

    r412 r468  
    309309    " . join("\n    ", $o) . "
    310310}";
    311 ?>
Note: See TracChangeset for help on using the changeset viewer.