Changeset 259


Ignore:
Timestamp:
Jun 19, 2007 4:04:42 AM (17 years ago)
Author:
quinn
Message:

Misc bug fixes. Added App::dropQuery() method.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/module_maker/module.cli.php

    r247 r259  
    1111$valid_ops = array('clean', 'var', 'test');
    1212
    13 // Test for a single argument.
     13// Test for arguments.
    1414if (isset($_SERVER['argv'][2]) && isset($_SERVER['argv'][3])) {
    1515    $module_name_singular = $_SERVER['argv'][2];
  • trunk/css/utilities.inc.css

    r254 r259  
    3737.sc-hidden { display: none; visibility: hidden; }
    3838.sc-monospaced { font-family: monaco, courier; font-weight: normal; }
    39 .sc-padleft { padding: 0 0 0 10px; }
    40 .sc-padright { padding: 0 10px 0 0; }
     39.sc-padleft { padding-left: 10px; }
     40.sc-padright { padding-right: 10px; }
    4141.sc-right { text-align: right; }
    4242.sc-normal { font-weight: normal; }
  • trunk/lib/App.inc.php

    r249 r259  
    597597     * @return                The string representation of $priority.
    598598     */
    599     function logPriorityToString ($priority) {
     599    function logPriorityToString($priority) {
    600600        $priorities = array(
    601601            LOG_EMERG   => 'emergency',
     
    621621     *
    622622     * @access  public
    623      * @param   string  $query_key  The key of the query argument to save.
     623     * @param   mixed   $query_key   The key (or keys, as an array) of the query argument to save.
    624624     * @param   mixed   $default    If the key is not available, set to this default value.
    625625     * @author  Quinn Comendant <quinn@strangecode.com>
     
    628628    function carryQuery($query_key, $default=false)
    629629    {
    630         // If not already set, and there is a non-empty value provided in the request...
    631         if (!isset($this->_carry_queries[$query_key]) && false !== getFormData($query_key, $default)) {
    632             // Copy the value of the specified query argument into the _carry_queries array.
    633             $this->_carry_queries[$query_key] = getFormData($query_key, $default);
     630        if (!is_array($query_key)) {
     631            $query_key = array($query_key);
     632        }
     633        foreach ($query_key as $k) {
     634            // If not already set, and there is a non-empty value provided in the request...
     635            if (!isset($this->_carry_queries[$k]) && false !== getFormData($k, $default)) {
     636                // Copy the value of the specified query argument into the _carry_queries array.
     637                $this->_carry_queries[$k] = getFormData($k, $default);
     638            }
     639        }
     640    }
     641
     642    /**
     643     * dropQuery() is the opposite of carryQuery(). The specified value will not appear in
     644     * url()/ohref()/printHiddenSession() modified URLs unless explicitly written in.
     645     *
     646     * @access  public
     647     * @param   mixed   $query_key  The key (or keys, as an array) of the query argument to remove.
     648     * @author  Quinn Comendant <quinn@strangecode.com>
     649     * @since   18 Jun 2007 20:57:29
     650     */
     651    function dropQuery($query_key, $default=false)
     652    {
     653        if (!is_array($query_key)) {
     654            $query_key = array($query_key);
     655        }
     656        foreach ($query_key as $k) {
     657            if (isset($this->_carry_queries[$query_key])) {
     658                // Remove the value of the specified query argument from the _carry_queries array.
     659                unset($this->_carry_queries[$query_key]);
     660            }
    634661        }
    635662    }
  • trunk/lib/Auth_SQL.inc.php

    r247 r259  
    142142                " . $this->getParam('db_primary_key') . " smallint(11) NOT NULL auto_increment,
    143143                " . $this->getParam('db_username_column') . " varchar(255) NOT NULL default '',
    144                 userpass varchar(255) NOT NULL default '',
    145                 first_name varchar(255) NOT NULL default '',
    146                 last_name varchar(255) NOT NULL default '',
    147                 email varchar(255) NOT NULL default '',
    148                 login_abuse_exempt enum('true') default NULL,
    149                 blocked enum('true') default NULL,
    150                 blocked_reason varchar(255) NOT NULL default '',
    151                 abuse_warning_level tinyint(4) NOT NULL default '0',
    152                 seconds_online int(11) NOT NULL default '0',
    153                 last_login_datetime datetime NOT NULL default '0000-00-00 00:00:00',
    154                 last_access_datetime datetime NOT NULL default '0000-00-00 00:00:00',
    155                 last_login_ip varchar(255) NOT NULL default '0.0.0.0',
    156                 added_by_user_id smallint(11) default NULL,
    157                 modified_by_user_id smallint(11) default NULL,
    158                 added_datetime datetime NOT NULL default '0000-00-00 00:00:00',
    159                 modified_datetime datetime NOT NULL default '0000-00-00 00:00:00',
     144                userpass VARCHAR(255) NOT NULL DEFAULT '',
     145                first_name VARCHAR(255) NOT NULL DEFAULT '',
     146                last_name VARCHAR(255) NOT NULL DEFAULT '',
     147                email VARCHAR(255) NOT NULL DEFAULT '',
     148                login_abuse_exempt ENUM('TRUE') DEFAULT NULL,
     149                blocked ENUM('TRUE') DEFAULT NULL,
     150                blocked_reason VARCHAR(255) NOT NULL DEFAULT '',
     151                abuse_warning_level TINYINT(4) NOT NULL DEFAULT '0',
     152                seconds_online INT(11) NOT NULL DEFAULT '0',
     153                last_login_datetime DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
     154                last_access_datetime DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
     155                last_login_ip VARCHAR(255) NOT NULL DEFAULT '0.0.0.0',
     156                added_by_user_id SMALLINT(11) DEFAULT NULL,
     157                modified_by_user_id SMALLINT(11) DEFAULT NULL,
     158                added_datetime DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
     159                modified_datetime DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
    160160                PRIMARY KEY (" . $this->getParam('db_primary_key') . "),
    161161                KEY " . $this->getParam('db_username_column') . " (" . $this->getParam('db_username_column') . "),
     
    195195                }
    196196                $db->query("CREATE TABLE IF NOT EXISTS " . $this->getParam('db_login_table') . " (
    197                     " . $this->getParam('db_primary_key') . " smallint(11) NOT NULL default '0',
    198                     login_datetime datetime NOT NULL default '0000-00-00 00:00:00',
    199                     remote_ip_binary char(32) NOT NULL default '',
     197                    " . $this->getParam('db_primary_key') . " SMALLINT(11) NOT NULL DEFAULT '0',
     198                    login_datetime DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
     199                    remote_ip_binary CHAR(32) NOT NULL DEFAULT '',
    200200                    KEY " . $this->getParam('db_primary_key') . " (" . $this->getParam('db_primary_key') . "),
    201201                    KEY login_datetime (login_datetime),
     
    727727        $str = '';
    728728        for ($i=0; $i<mb_strlen($pattern); $i++) {
    729             $x = mb_substr('bcdfghjklmnprstvwxzBCDFGHJKLMNPRSTVWXZaeiouyAEIOUY0123456789', (mt_rand() % 60), 1);
     729            $x = mb_substr('bcdfghjklmnprstvwxzBCDFGHJKLMNPRSTVWXZaeiouyAEIOUY0123456789!@#%&*-=+.?', (mt_rand() % 71), 1);
    730730            $c = mb_substr('bcdfghjklmnprstvwxz', (mt_rand() % 19), 1);
    731731            $C = mb_substr('bcdfghjklmnprstvwxzBCDFGHJKLMNPRSTVWXZ', (mt_rand() % 38), 1);
     
    733733            $V = mb_substr('aeiouyAEIOUY', (mt_rand() % 12), 1);
    734734            $d = mb_substr('0123456789', (mt_rand() % 10), 1);
    735             $str .= $$pattern{$i};
     735            $str .= $$pattern[$i];
    736736        }
    737737        return $str;
  • trunk/lib/Upload.inc.php

    r256 r259  
    199199
    200200            // Check The php upload error messages.
    201             if (UPLOAD_ERR_INI_SIZE === $files['error'][$i]) {
     201            if (UPLOAD_ERR_INI_SIZE === $files['error'][$i]) { // Error code 1
    202202                $this->_raiseMsg(sprintf(_("The file %s failed uploading: it exceeds the maximum allowed upload file size of %s."), $file_name, ini_get('upload_max_filesize')), MSG_ERR, __FILE__, __LINE__);
    203203                $app->logMsg(sprintf('The file %s failed uploading with PHP error UPLOAD_ERR_INI_SIZE (currently %s).', $file_name, ini_get('upload_max_filesize')), LOG_ERR, __FILE__, __LINE__);
     
    205205                continue;
    206206            }
    207             if (UPLOAD_ERR_FORM_SIZE === $files['error'][$i]) {
     207            if (UPLOAD_ERR_FORM_SIZE === $files['error'][$i]) { // Error code 2
    208208                $this->_raiseMsg(sprintf(_("The file %s failed uploading: it exceeds the maximum allowed upload file size of %s."), $file_name, $_POST['MAX_FILE_SIZE']), MSG_ERR, __FILE__, __LINE__);
    209209                $app->logMsg(sprintf('The file %s failed uploading with PHP error UPLOAD_ERR_FORM_SIZE (currently %s).', $file_name, $_POST['MAX_FILE_SIZE']), LOG_ERR, __FILE__, __LINE__);
     
    211211                continue;
    212212            }
    213             if (UPLOAD_ERR_PARTIAL === $files['error'][$i]) {
     213            if (UPLOAD_ERR_PARTIAL === $files['error'][$i]) { // Error code 3
    214214                $this->_raiseMsg(sprintf(_("The file %s failed uploading: it was only partially uploaded."), $file_name), MSG_ERR, __FILE__, __LINE__);
    215215                $app->logMsg(sprintf('The file %s failed uploading with PHP error UPLOAD_ERR_PARTIAL.', $file_name), LOG_ERR, __FILE__, __LINE__);
     
    217217                continue;
    218218            }
    219             if (UPLOAD_ERR_NO_FILE === $files['error'][$i]) {
     219            if (UPLOAD_ERR_NO_FILE === $files['error'][$i]) { // Error code 4
    220220                $this->_raiseMsg(sprintf(_("The file %s failed uploading: no file was uploaded."), $file_name), MSG_ERR, __FILE__, __LINE__);
    221221                $app->logMsg(sprintf('The file %s failed uploading with PHP error UPLOAD_ERR_NO_FILE.', $file_name), LOG_ERR, __FILE__, __LINE__);
     
    223223                continue;
    224224            }
    225             if (UPLOAD_ERR_NO_TMP_DIR === $files['error'][$i]) {
     225            if (UPLOAD_ERR_NO_TMP_DIR === $files['error'][$i]) { // Error code 6
    226226                $this->_raiseMsg(sprintf(_("The file %s failed uploading: temporary upload directory missing."), $file_name), MSG_ERR, __FILE__, __LINE__);
    227227                $app->logMsg(sprintf('The file %s failed uploading with PHP error UPLOAD_ERR_NO_TMP_DIR.', $file_name), LOG_ERR, __FILE__, __LINE__);
Note: See TracChangeset for help on using the changeset viewer.