Changeset 485


Ignore:
Timestamp:
Aug 14, 2014 8:29:47 AM (10 years ago)
Author:
anonymous
Message:

Small bugs fixed while doing SBImedia

Location:
trunk
Files:
7 edited

Legend:

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

    r468 r485  
    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/>.
     
    8282        if (preg_match('/.*_id$/i', $field)) {
    8383            $output[$field] = <<<E_O_F
    84            
     84
    8585<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
    8686    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
     
    101101    <input type="file" name="$field" id="$field" />
    102102    <\x3fphp if ('' != \$upload->getFilenameGlob(getFormData('$primary_key') . '_*') && getFormData('op') == 'edit' || getFormData('op') == 'update') { \x3f>
    103         <div class="sc-help"><\x3fphp printf(_("The current file <a href=\"%s/%2\\\$s\"><strong>%2\\\$s</strong></a> will be deleted if a new file is selected for upload."), '/_db_files/__///__', \$upload->getFilenameGlob(getFormData('$primary_key') . '_*')) \x3f></div>
     103        <div class="sc-help"><\x3fphp printf(_("The current file <a href=\"%s/%2\\$s\"><strong>%2\\$s</strong></a> will be deleted if a new file is selected for upload."), '/_db_files/__///__', \$upload->getFilenameGlob(getFormData('$primary_key') . '_*')) \x3f></div>
    104104    <\x3fphp } \x3f>
    105105    <div class="sc-help"><\x3fphp printf(_("Allowed file types: %s."), join(', ', \$upload->getParam('valid_file_extensions'))) \x3f></div>
     
    157157
    158158        // Textarea small
     159        case 'tinytiny' :
    159160        case 'text' :
    160161        case 'tinyblob' :
     
    164165<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
    165166    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
    166     <textarea name="$field" id="$field" rows="8" cols="40" class="sc-short sc-medium"><\x3fphp echo oTxt(\$frm['$field']); \x3f></textarea>
     167    <textarea name="$field" id="$field" rows="8" cols="40" class="sc-tall sc-medium"><\x3fphp echo oTxt(\$frm['$field']); \x3f></textarea>
    167168</div>
    168169E_O_F;
     
    178179<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
    179180    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
    180     <textarea name="$field" id="$field" rows="8" cols="40" class="sc-short sc-medium"><\x3fphp echo oTxt(\$frm['$field']); \x3f></textarea>
     181    <textarea name="$field" id="$field" rows="8" cols="40" class="sc-fullscreen sc-medium"><\x3fphp echo oTxt(\$frm['$field']); \x3f></textarea>
    181182</div>
    182183E_O_F;
  • trunk/css/codebase.inc.css

    r455 r485  
    1212    z-index: 2000000000;  /* Close to the maximum of a 32-bit integer. */
    1313    margin: 1em 0;
    14     padding: .6em .6em .3em;
    15     border: 1px solid #ddd;
    1614    background: #fafafa;
     15    padding: 0;
     16    border: none;
    1717}
    18 .sc-msg-success { color: #090; }
    19 .sc-msg-notice { color: #C60; }
    20 .sc-msg-warning,
    21 .sc-msg-error { color: #f00; }
     18form .sc-msg-success label { color: #76B15B; font-weight: bold; }
     19form .sc-msg-notice label { color: #B19332; font-weight: bold; }
     20form .sc-msg-warning label { color: #9200AE; font-weight: bold; }
     21form .sc-msg-error label { color: #b34; font-weight: bold; }
     22.sc-msg > .sc-msg-success { color: #76B15B; font-weight: bold; }
     23.sc-msg > .sc-msg-notice { color: #B19332; font-weight: bold; }
     24.sc-msg > .sc-msg-warning { color: #9200AE; font-weight: bold; }
     25.sc-msg > .sc-msg-error { color: #b34; font-weight: bold; }
    2226.sc-msg > .sc-msg-success,
    2327.sc-msg > .sc-msg-notice,
    2428.sc-msg > .sc-msg-warning,
    2529.sc-msg > .sc-msg-error {
    26     background: #fafafa;
    27     padding: 0;
    28     margin: .5em 0;
     30    padding: .25em .5em;
     31    margin: 5px 0;
     32    color: #fff;
    2933}
     34.sc-msg > .sc-msg-success a,
     35.sc-msg > .sc-msg-notice a,
     36.sc-msg > .sc-msg-warning a,
     37.sc-msg > .sc-msg-error a {
     38    color: #fff;
     39}
     40.sc-msg > .sc-msg-success { background-color: #76B15B; }
     41.sc-msg > .sc-msg-notice { background-color: #B19332; }
     42.sc-msg > .sc-msg-warning { background-color: #9200AE; }
     43.sc-msg > .sc-msg-error { background-color: #b34; }
    3044
    3145/* PEdit.inc.php ---------------------------------------------------- */
  • trunk/css/utilities.inc.css

    r456 r485  
    4040.sc-clearboth { clear: both; }
    4141.sc-help { color: #999; font-weight: normal; }
    42 .sc-hidden { display: none; visibility: hidden; }
     42.sc-hidden { display: none; }
    4343.sc-monospaced { font-family: monospace; }
    4444.sc-padleft { padding-left: 10px; }
    4545.sc-padright { padding-right: 10px; }
     46.sc-marginleft { margin-left: 10px; }
     47.sc-marginright { margin-right: 10px; }
    4648.sc-right { text-align: right; }
    4749.sc-normal { font-weight: normal; }
    4850.sc-nowrap { white-space: nowrap; }
    4951.sc-dim {
    50     filter:alpha(opacity=25);
    51     -moz-opacity:.25;
    52     opacity:.25;
     52    filter:alpha(opacity=33);
     53    -moz-opacity:.33;
     54    opacity:.33;
    5355}
    5456.sc-note:hover { cursor: help; }
  • trunk/docs/version.txt

    r380 r485  
    1 2.1.7dev
     12.1.8dev
  • trunk/lib/Navigation.inc.php

    r484 r485  
    198198
    199199    /**
     200     * Returns the path from root up to the current page as an array.
     201     *
     202     * @access  public
     203     * @param   string   $key   Which value to use in the path (usually head_title or body_title or just title).
     204     * @return  mixed           Path (string) or false if path param is not set.
     205     */
     206    public function getPathArray($key='title')
     207    {
     208        $path = array();
     209        if ($this->getParam('path')) {
     210            foreach ($this->pages as $page) {
     211                $path[] = strip_tags($page[$key]);
     212            }
     213        }
     214        return $path;
     215    }
     216
     217    /**
    200218     * Returns the text path from root up to the current page, separated by the
    201219     * path_delimiter.
     
    207225    public function getPath($key='title')
    208226    {
    209         if ($this->getParam('path')) {
    210             $path = '';
    211             $pathmark = '';
     227
     228        $path = $this->getPathArray();
     229        return empty($path) ? '' : join(oTxt($this->getParam('path_delimiter'), true), $path);
     230    }
     231
     232    /**
     233     * Returns the breadcrumbs from the root page to the current page.
     234     * Breadcrumbs are the text path with pages titles linked to that page.
     235     *
     236     * @access  public
     237     * @return  string   Breadcrumbs or empty string if breadcrumbs param not set.
     238     */
     239    public function getBreadcrumbsArray()
     240    {
     241        $app =& App::getInstance();
     242
     243        if ($this->getParam('breadcrumbs')) {
     244            $breadcrumbs = array();
     245            $crumb_count = sizeof($this->pages);
    212246            foreach ($this->pages as $page) {
    213                 $path .= oTxt($pathmark . strip_tags($page[$key]), true);
    214                 $pathmark = $this->getParam('path_delimiter');
    215             }
    216             return $path;
     247                if ($crumb_count <= $this->getParam('chop_breadcrumbs')) {
     248                    // Stop gathering crumbs.
     249                    break;
     250                }
     251                if ($crumb_count <= 1) {
     252                    // The last crumb.
     253                    if ('' == trim($page['url']) || $crumb_count <= $this->getParam('chop_breadcrumb_links')) {
     254                        // A crumb with no link.
     255                        $breadcrumbs[] = array(
     256                            'url' => false,
     257                            'title' => sprintf($this->getParam('last_crumb_format'), $page['title'])
     258                        );
     259                    } else if ($crumb_count > $this->getParam('chop_breadcrumb_links')) {
     260                        // A normal linked crumb.
     261                        $breadcrumbs[] = array(
     262                            'url' => $page['url'],
     263                            'title' => sprintf($this->getParam('last_crumb_format'), $page['title'])
     264                        );
     265                    }
     266                } else {
     267                    if ('' == trim($page['url'])) {
     268                        // A crumb with no link.
     269                        $breadcrumbs[] = array(
     270                            'url' => false,
     271                            'title' => $page['title']
     272                        );
     273                    } else {
     274                        // A normal linked crumb.
     275                        $breadcrumbs[] = array(
     276                            'url' => $page['url'],
     277                            'title' => $page['title']
     278                        );
     279                    }
     280                }
     281                $crumb_count--;
     282            }
     283            return $breadcrumbs;
    217284        } else {
    218             return false;
     285            return array();
    219286        }
    220287    }
     
    247314                    } else if ($crumb_count > $this->getParam('chop_breadcrumb_links')) {
    248315                        // A normal linked crumb.
    249                         $breadcrumbs[] =  '<a href="' . $app->oHREF($page['url']) . '">' . sprintf($this->getParam('last_crumb_format'), oTxt($page['title'], true)) . '</a>';
     316                        $breadcrumbs[] =  '<a href="' . $page['url'] . '">' . sprintf($this->getParam('last_crumb_format'), oTxt($page['title'], true)) . '</a>';
    250317                    }
    251318                } else {
     
    255322                    } else {
    256323                        // A normal linked crumb.
    257                         $breadcrumbs[] = '<a href="' . $app->oHREF($page['url']) . '">' . oTxt($page['title'], true) . '</a>';
     324                        $breadcrumbs[] = '<a href="' . $page['url'] . '">' . oTxt($page['title'], true) . '</a>';
    258325                    }
    259326                }
  • trunk/lib/Upload.inc.php

    r484 r485  
    8282            // Enforce valid upload_path parameter.
    8383            if (isset($params['upload_path'])) {
    84                 $params['upload_path'] = realpath($params['upload_path']);
     84                $upload_path = realpath($params['upload_path']);
    8585                // Source must be directory.
    86                 if (!is_dir($params['upload_path'])) {
    87                     $app->logMsg(sprintf('Attempting to auto-create upload directory: %s', $params['upload_path']), LOG_NOTICE, __FILE__, __LINE__);
     86                if (!is_dir($upload_path)) {
     87                    $app->logMsg(sprintf('Attempting to auto-create upload directory: %s', $upload_path), LOG_NOTICE, __FILE__, __LINE__);
    8888                    if (version_compare(PHP_VERSION, '5.0.0', '>=')) {
    8989                        // Recursive.
    90                         mkdir($params['upload_path'], isset($params['dest_dir_perms']) ? $params['dest_dir_perms'] : $this->getParam('dest_dir_perms'), true);
     90                        mkdir($upload_path, isset($params['dest_dir_perms']) ? $params['dest_dir_perms'] : $this->getParam('dest_dir_perms'), true);
    9191                    } else {
    92                         mkdir($params['upload_path'], isset($params['dest_dir_perms']) ? $params['dest_dir_perms'] : $this->getParam('dest_dir_perms'));
     92                        mkdir($upload_path, isset($params['dest_dir_perms']) ? $params['dest_dir_perms'] : $this->getParam('dest_dir_perms'));
    9393                    }
    94                     if (!is_dir($params['upload_path'])) {
     94                    if (!is_dir($upload_path)) {
    9595                        $app->logMsg(sprintf('Upload directory invalid: %s', $params['upload_path']), LOG_ERR, __FILE__, __LINE__);
    9696                        trigger_error(sprintf('Upload directory invalid: %s', $params['upload_path']), E_USER_ERROR);
     
    9898                }
    9999                // Source must be writable.
    100                 if (!is_writable($params['upload_path'])) {
     100                if (!is_writable($upload_path)) {
    101101                    $app->logMsg(sprintf('Upload directory not writable: %s', $params['upload_path']), LOG_ERR, __FILE__, __LINE__);
    102102                    trigger_error(sprintf('Upload directory not writable: %s', $params['upload_path']), E_USER_ERROR);
     
    197197                    if (is_array($custom_file_name) && sizeof($custom_file_name) == 1) {
    198198                        // Is an array, but just one value. Pull it out.
    199                         $custom_file_name = current($custom_file_name);
     199                        $file_name = current($custom_file_name);
    200200                        $this->_raiseMsg(sprintf(_("The file %s has been renamed to %s."), $files['name'][$i], $file_name), MSG_NOTICE, __FILE__, __LINE__);
    201201                        $app->logMsg(sprintf('Using custom file name: %s', $file_name), LOG_DEBUG, __FILE__, __LINE__);
     
    520520        $app =& App::getInstance();
    521521
    522         if ($this->getParam('display_messages') === true || (is_int($this->getParam('display_messages')) && $this->getParam('display_messages') & $type > 0)) {
     522        if ($this->getParam('display_messages') === true || (is_int($this->getParam('display_messages')) && ($this->getParam('display_messages') & $type) > 0)) {
    523523            $app->raiseMsg($message, $type, $file, $line);
    524524        }
  • trunk/lib/Utilities.inc.php

    r479 r485  
    139139 * @param  string $text             Text to clean.
    140140 * @param  bool   $preserve_html    If set to true, oTxt will not translate <, >, ", or '
    141  *                                  characters into HTML entities. This allows HTML to pass through unmunged.
    142  * @return string                   Cleaned text.
     141 *                                  characters into HTML entities. This allows HTML to pass through undisturbed.
     142 * @return string                   HTML-safe text.
    143143 */
    144144function oTxt($text, $preserve_html=false)
Note: See TracChangeset for help on using the changeset viewer.