Changeset 128


Ignore:
Timestamp:
May 26, 2006 9:29:19 PM (18 years ago)
Author:
scdev
Message:

finished /lib folder

Location:
branches/2.0singleton/lib
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0singleton/lib/ImageThumb.inc.php

    r121 r128  
    9595    function setParam($params)
    9696    {
     97        $app =& App::getInstance();
     98
    9799        if (isset($params) && is_array($params)) {
    98100
     
    102104                // Must be directory.
    103105                if (!is_dir($params['source_dir'])) {
    104                     App::logMsg(sprintf('Source directory invalid: %s', $params['source_dir']), LOG_ERR, __FILE__, __LINE__);
     106                    $app->logMsg(sprintf('Source directory invalid: %s', $params['source_dir']), LOG_ERR, __FILE__, __LINE__);
    105107                    trigger_error(sprintf('Source directory invalid: %s', $params['source_dir']), E_USER_ERROR);
    106108                }
    107109                // Must be readable.
    108110                if (!is_readable($params['source_dir'])) {
    109                     App::logMsg(sprintf('Source directory not readable: %s', $params['source_dir']), LOG_ERR, __FILE__, __LINE__);
     111                    $app->logMsg(sprintf('Source directory not readable: %s', $params['source_dir']), LOG_ERR, __FILE__, __LINE__);
    110112                    trigger_error(sprintf('Source directory not readable: %s', $params['source_dir']), E_USER_ERROR);
    111113                }
     
    115117            $this->_params = array_merge($this->_params, $params);
    116118        } else {
    117             App::logMsg(sprintf('Parameters are not an array: %s', $params), LOG_ERR, __FILE__, __LINE__);
     119            $app->logMsg(sprintf('Parameters are not an array: %s', $params), LOG_ERR, __FILE__, __LINE__);
    118120        }
    119121    }
     
    128130    function getParam($param)
    129131    {
     132        $app =& App::getInstance();
     133
    130134        if (isset($this->_params[$param])) {
    131135            return $this->_params[$param];
    132136        } else {
    133             App::logMsg(sprintf('Parameter is not set: %s', $param), LOG_DEBUG, __FILE__, __LINE__);
     137            $app->logMsg(sprintf('Parameter is not set: %s', $param), LOG_DEBUG, __FILE__, __LINE__);
    134138            return null;
    135139        }
     
    144148    function setSpec($spec, $index=null)
    145149    {
     150        $app =& App::getInstance();
     151
    146152        // A little sanity checking.
    147153        if (!isset($spec['dest_dir']) || '' == $spec['dest_dir']) {
    148             App::logMsg('setSpec error: dest_dir not specified.', LOG_ERR, __FILE__, __LINE__);
     154            $app->logMsg('setSpec error: dest_dir not specified.', LOG_ERR, __FILE__, __LINE__);
    149155        }
    150156        if (isset($spec['dest_file_type'])) {
     
    152158            case IMG_JPG :
    153159                if (imagetypes() & IMG_JPG == 0) {
    154                     App::logMsg(sprintf('IMG_JPG is not supported by this version of PHP GD.', null), LOG_ERR, __FILE__, __LINE__);
     160                    $app->logMsg(sprintf('IMG_JPG is not supported by this version of PHP GD.', null), LOG_ERR, __FILE__, __LINE__);
    155161                }
    156162                $spec['dest_file_extention'] = 'jpg';
     
    158164            case IMG_PNG :
    159165                if (imagetypes() & IMG_PNG == 0) {
    160                     App::logMsg(sprintf('IMG_PNG is not supported by this version of PHP GD.', null), LOG_ERR, __FILE__, __LINE__);
     166                    $app->logMsg(sprintf('IMG_PNG is not supported by this version of PHP GD.', null), LOG_ERR, __FILE__, __LINE__);
    161167                }
    162168                $spec['dest_file_extention'] = 'png';
     
    164170            case IMG_GIF :
    165171                if (imagetypes() & IMG_GIF == 0) {
    166                     App::logMsg(sprintf('IMG_GIF is not supported by this version of PHP GD.', null), LOG_ERR, __FILE__, __LINE__);
     172                    $app->logMsg(sprintf('IMG_GIF is not supported by this version of PHP GD.', null), LOG_ERR, __FILE__, __LINE__);
    167173                }
    168174                $spec['dest_file_extention'] = 'gif';
     
    170176            case IMG_WBMP :
    171177                if (imagetypes() & IMG_WBMP == 0) {
    172                     App::logMsg(sprintf('IMG_WBMP is not supported by this version of PHP GD.', null), LOG_ERR, __FILE__, __LINE__);
     178                    $app->logMsg(sprintf('IMG_WBMP is not supported by this version of PHP GD.', null), LOG_ERR, __FILE__, __LINE__);
    173179                }
    174180                $spec['dest_file_extention'] = 'wbmp';
    175181                break;
    176182            default :
    177                 App::logMsg(sprintf('Invalid dest_file_type: %s', $spec['dest_file_type']), LOG_ERR, __FILE__, __LINE__);
     183                $app->logMsg(sprintf('Invalid dest_file_type: %s', $spec['dest_file_type']), LOG_ERR, __FILE__, __LINE__);
    178184                break;
    179185            }
    180186        }
    181187        if (!isset($spec['width']) || !is_int($spec['width'])) {
    182             App::logMsg('setSpec error: width not specified.', LOG_ERR, __FILE__, __LINE__);
     188            $app->logMsg('setSpec error: width not specified.', LOG_ERR, __FILE__, __LINE__);
    183189        }
    184190        if (!isset($spec['height']) || !is_int($spec['height'])) {
    185             App::logMsg('setSpec error: height not specified.', LOG_ERR, __FILE__, __LINE__);
     191            $app->logMsg('setSpec error: height not specified.', LOG_ERR, __FILE__, __LINE__);
    186192        }
    187193        if (isset($spec['quality']) && IMG_JPG != $spec['dest_file_type']) {
    188             App::logMsg('The "quality" specification is not used unless IMG_JPG is the dest_file_type.', LOG_INFO, __FILE__, __LINE__);
     194            $app->logMsg('The "quality" specification is not used unless IMG_JPG is the dest_file_type.', LOG_INFO, __FILE__, __LINE__);
    189195        }
    190196        if (isset($spec['progressive']) && IMG_JPG != $spec['dest_file_type']) {
    191             App::logMsg('The "progressive" specification is not used unless IMG_JPG is the dest_file_type.', LOG_INFO, __FILE__, __LINE__);
     197            $app->logMsg('The "progressive" specification is not used unless IMG_JPG is the dest_file_type.', LOG_INFO, __FILE__, __LINE__);
    192198        }
    193199       
     
    213219    function processAll($runtime_specs=null)
    214220    {
     221        $app =& App::getInstance();
     222
    215223        // Ensure we have a source.
    216224        if ('' == $this->getParam('source_dir')) {
    217             App::logMsg(sprintf('Source directory not set before processing.'), LOG_ERR, __FILE__, __LINE__);
     225            $app->logMsg(sprintf('Source directory not set before processing.'), LOG_ERR, __FILE__, __LINE__);
    218226            return false;
    219227        }
     
    237245            return 0 === $return_val;
    238246        } else {
    239             App::logMsg(sprintf('No images found to thumbnail in directory %s.', $this->getParam('source_dir')), LOG_NOTICE, __FILE__, __LINE__);
     247            $app->logMsg(sprintf('No images found to thumbnail in directory %s.', $this->getParam('source_dir')), LOG_NOTICE, __FILE__, __LINE__);
    240248            return false;
    241249        }
     
    252260    function processFile($file_name, $runtime_specs=null)
    253261    {
     262        $app =& App::getInstance();
     263
    254264        // Source file determinted by provided file_name.
    255265        $source_file = realpath(sprintf('%s/%s', $this->getParam('source_dir'), $file_name));
     
    260270                $this->setSpec($runtime_specs, 0);
    261271            } else {
    262                 App::logMsg(sprintf('Image specifications not set before processing.'), LOG_ERR, __FILE__, __LINE__);
     272                $app->logMsg(sprintf('Image specifications not set before processing.'), LOG_ERR, __FILE__, __LINE__);
    263273                return false;               
    264274            }
     
    267277        // Ensure we have a source.
    268278        if ('' == $this->getParam('source_dir')) {
    269             App::logMsg(sprintf('Source directory not set before processing.'), LOG_ERR, __FILE__, __LINE__);
     279            $app->logMsg(sprintf('Source directory not set before processing.'), LOG_ERR, __FILE__, __LINE__);
    270280            return false;
    271281        }
     
    274284        if (!file_exists($source_file)) {
    275285            $this->_raiseMsg(sprintf(_("Image resizing failed: source image %s was not found."), $file_name), MSG_ERR, __FILE__, __LINE__);
    276             App::logMsg(sprintf('Source image not found: %s', $source_file), LOG_ALERT, __FILE__, __LINE__);
     286            $app->logMsg(sprintf('Source image not found: %s', $source_file), LOG_ALERT, __FILE__, __LINE__);
    277287            return false;
    278288        }
     
    281291        if (!is_readable($source_file)) {
    282292            $this->_raiseMsg(sprintf(_("Image resizing failed: source image %s is not readable."), $file_name), MSG_ERR, __FILE__, __LINE__);
    283             App::logMsg(sprintf('Source image not readable: %s', $source_file), LOG_ALERT, __FILE__, __LINE__);
     293            $app->logMsg(sprintf('Source image not readable: %s', $source_file), LOG_ALERT, __FILE__, __LINE__);
    284294            return false;
    285295        }
     
    288298        if (filesize($source_file) <= 0) {
    289299            $this->_raiseMsg(sprintf(_("Image resizing failed: source image %s is zero bytes."), $file_name), MSG_ERR, __FILE__, __LINE__);
    290             App::logMsg(sprintf('Source image is zero bytes: %s', $source_file), LOG_ALERT, __FILE__, __LINE__);
     300            $app->logMsg(sprintf('Source image is zero bytes: %s', $source_file), LOG_ALERT, __FILE__, __LINE__);
    291301            return false;
    292302        }
     
    295305        if (!$this->_validFileExtension($file_name)) {
    296306            $this->_raiseMsg(sprintf(_("Image resizing failed: source image %s not a valid type. It must have one of the following file name extensions: %s"), $file_name, join(', ', $this->getParam('valid_file_extensions'))), MSG_ERR, __FILE__, __LINE__);
    297             App::logMsg(sprintf('Image resizing failed: source image not of valid type: %s', $source_file), LOG_ERR, __FILE__, __LINE__);
     307            $app->logMsg(sprintf('Image resizing failed: source image not of valid type: %s', $source_file), LOG_ERR, __FILE__, __LINE__);
    298308            return false;
    299309        }
     
    324334                $file_size = filesize($dest_file);
    325335                if (false !== $file_size && $file_size < $spec['keep_filesize']) {
    326                     App::logMsg(sprintf('Skipping thumbnail %s. File already exists and file size is less than %s bytes.', $spec['dest_dir'] . '/' . $file_name, $spec['keep_filesize']), LOG_DEBUG, __FILE__, __LINE__);
     336                    $app->logMsg(sprintf('Skipping thumbnail %s. File already exists and file size is less than %s bytes.', $spec['dest_dir'] . '/' . $file_name, $spec['keep_filesize']), LOG_DEBUG, __FILE__, __LINE__);
    327337                    continue;
    328338                }
     
    333343            if ($image_size['0'] <= $spec['width'] && $image_size['1'] <= $spec['height'] && !$spec['allow_upscaling']) {
    334344                $spec['scaling_type'] = IMAGETHUMB_NO_SCALE;
    335                 App::logMsg(sprintf('Image %s smaller than specified %s thumbnail size. Keeping original size.', $file_name, $spec['dest_dir']), LOG_DEBUG, __FILE__, __LINE__);
     345                $app->logMsg(sprintf('Image %s smaller than specified %s thumbnail size. Keeping original size.', $file_name, $spec['dest_dir']), LOG_DEBUG, __FILE__, __LINE__);
    336346            }
    337347
     
    339349            if (IMAGETHUMB_METHOD_NETPBM === $this->getParam('resize_method') && file_exists($this->getParam('anytopnm_binary')) && file_exists($this->getParam('pnmscale_binary')) && file_exists($this->getParam('cjpeg_binary'))) {
    340350                // Resize using Netpbm binaries.
    341                 App::logMsg(sprintf('Resizing with Netpbm...', null), LOG_DEBUG, __FILE__, __LINE__);
     351                $app->logMsg(sprintf('Resizing with Netpbm...', null), LOG_DEBUG, __FILE__, __LINE__);
    342352                $return_val += $this->_resizeWithNetpbm($source_file, $dest_file, $spec);
    343353            } else if (IMAGETHUMB_METHOD_GD === $this->getParam('resize_method') && extension_loaded('gd')) {
    344354                // Resize with GD.
    345                 App::logMsg(sprintf('Resizing with GD...', null), LOG_DEBUG, __FILE__, __LINE__);
     355                $app->logMsg(sprintf('Resizing with GD...', null), LOG_DEBUG, __FILE__, __LINE__);
    346356                $return_val += $this->_resizeWithGD($source_file, $dest_file, $spec);
    347357            } else {
    348                 App::logMsg(sprintf('Image thumbnailing failed. Neither Netpbm or GD is available.', null), LOG_DEBUG, __FILE__, __LINE__);
     358                $app->logMsg(sprintf('Image thumbnailing failed. Neither Netpbm or GD is available.', null), LOG_DEBUG, __FILE__, __LINE__);
    349359                return false;
    350360            }
     
    370380    function _resizeWithNetpbm($source_file, $dest_file, $spec)
    371381    {
     382        $app =& App::getInstance();
     383
    372384        // Define pnmscale arguments.
    373385        switch ($spec['scaling_type']) {
     
    405417            escapeshellcmd($file_name)
    406418        );
    407         App::logMsg(sprintf('ImageThumb Netpbm command: %s', $command), LOG_DEBUG, __FILE__, __LINE__);
     419        $app->logMsg(sprintf('ImageThumb Netpbm command: %s', $command), LOG_DEBUG, __FILE__, __LINE__);
    408420       
    409421        // Execute!
     
    414426            // Make the thumbnail writable so the user can delete it over ftp without being 'apache'.
    415427            chmod($dest_file, $this->getParam('dest_file_perms'));
    416             App::logMsg(sprintf('Successfully resized image %s', $spec['dest_dir'] . '/' . basename($dest_file), $return_val), LOG_DEBUG, __FILE__, __LINE__);
     428            $app->logMsg(sprintf('Successfully resized image %s', $spec['dest_dir'] . '/' . basename($dest_file), $return_val), LOG_DEBUG, __FILE__, __LINE__);
    417429        } else {
    418430            // An error occurred.
    419             App::logMsg(sprintf('Image %s failed resizing with return value: %s%s', $spec['dest_dir'] . '/' . basename($dest_file), $return_val, empty($output) ? '' : ' (' . getDump($output) . ')'), LOG_ERR, __FILE__, __LINE__);
     431            $app->logMsg(sprintf('Image %s failed resizing with return value: %s%s', $spec['dest_dir'] . '/' . basename($dest_file), $return_val, empty($output) ? '' : ' (' . getDump($output) . ')'), LOG_ERR, __FILE__, __LINE__);
    420432        }
    421433
     
    438450    function _resizeWithGD($source_file, $dest_file, $spec)
    439451    {
     452        $app =& App::getInstance();
     453
    440454        // Get original file dimensions and type.
    441455        list($source_image_width, $source_image_height, $source_image_type) = getimagesize($source_file);
     
    487501            $source_image_resource = imagecreatefromwbmp($source_file);
    488502        default :
    489             App::logMsg(sprintf('Source image type %s not supported.', $source_image_type), LOG_WARNING, __FILE__, __LINE__);
     503            $app->logMsg(sprintf('Source image type %s not supported.', $source_image_type), LOG_WARNING, __FILE__, __LINE__);
    490504            return 1;
    491505            break;
    492506        }
    493507        if (!$source_image_resource) {
    494             App::logMsg(sprintf('Error creating %s image in memory from %s', $source_image_type, $source_file), LOG_WARNING, __FILE__, __LINE__);
     508            $app->logMsg(sprintf('Error creating %s image in memory from %s', $source_image_type, $source_file), LOG_WARNING, __FILE__, __LINE__);
    495509            return 1;
    496510        }
     
    501515        // Resample!
    502516        if (!imagecopyresampled($dest_image_resource, $source_image_resource, 0, 0, 0, 0, $dest_image_width, $dest_image_height, $source_image_width, $source_image_height)) {
    503             App::logMsg(sprintf('Error resampling image %s', $source_file), LOG_WARNING, __FILE__, __LINE__);
     517            $app->logMsg(sprintf('Error resampling image %s', $source_file), LOG_WARNING, __FILE__, __LINE__);
    504518            return 1;
    505519        }
     
    528542            break;
    529543        default :
    530             App::logMsg(sprintf('Destination image type %s not supported for image %s.', $spec['dest_file_type'], $dest_file), LOG_WARNING, __FILE__, __LINE__);
     544            $app->logMsg(sprintf('Destination image type %s not supported for image %s.', $spec['dest_file_type'], $dest_file), LOG_WARNING, __FILE__, __LINE__);
    531545            return 1;
    532546            break;
     
    537551            // Make the thumbnail writable so the user can delete it over ftp without being 'apache'.
    538552            chmod($dest_file, $this->getParam('dest_file_perms'));
    539             App::logMsg(sprintf('Successfully resized image %s', $dest_file), LOG_DEBUG, __FILE__, __LINE__);
     553            $app->logMsg(sprintf('Successfully resized image %s', $dest_file), LOG_DEBUG, __FILE__, __LINE__);
    540554            return 0;
    541555        } else {
    542556            // An error occurred.
    543             App::logMsg(sprintf('Image %s failed resizing.', $dest_file), LOG_ERR, __FILE__, __LINE__);
     557            $app->logMsg(sprintf('Image %s failed resizing.', $dest_file), LOG_ERR, __FILE__, __LINE__);
    544558            return 1;
    545559        }
     
    555569    function deleteThumbs($file_name)
    556570    {
     571        $app =& App::getInstance();
     572
    557573        // Ensure we have a source.
    558574        if ('' == $this->getParam('source_dir')) {
    559             App::logMsg(sprintf('Source directory not set before processing.'), LOG_ERR, __FILE__, __LINE__);
     575            $app->logMsg(sprintf('Source directory not set before processing.'), LOG_ERR, __FILE__, __LINE__);
    560576            return false;
    561577        }
     
    567583                if (!unlink($dest_file)) {
    568584                    $return_val++;
    569                     App::logMsg(sprintf(_("Delete thumbs failed: %s"), $dest_file), LOG_WARNING, __FILE__, __LINE__);
     585                    $app->logMsg(sprintf(_("Delete thumbs failed: %s"), $dest_file), LOG_WARNING, __FILE__, __LINE__);
    570586                }
    571587            }
     
    584600    function deleteOriginal($file_name)
    585601    {
     602        $app =& App::getInstance();
     603
    586604        // Ensure we have a source.
    587605        if ('' == $this->getParam('source_dir')) {
    588             App::logMsg(sprintf('Source directory not set before processing.'), LOG_ERR, __FILE__, __LINE__);
     606            $app->logMsg(sprintf('Source directory not set before processing.'), LOG_ERR, __FILE__, __LINE__);
    589607            return false;
    590608        }
     
    592610        $source_file = realpath(sprintf('%s/%s', $this->getParam('source_dir'), $file_name));
    593611        if (!unlink($source_file)) {
    594             App::logMsg(sprintf(_("Delete original failed: %s"), $source_file), LOG_WARNING, __FILE__, __LINE__);
     612            $app->logMsg(sprintf(_("Delete original failed: %s"), $source_file), LOG_WARNING, __FILE__, __LINE__);
    595613            return false;
    596614        }
     
    608626    function exists($file_name)
    609627    {
     628        $app =& App::getInstance();
     629
    610630        // Ensure we have a source.
    611631        if ('' == $this->getParam('source_dir')) {
    612             App::logMsg(sprintf('Source directory not set before processing.'), LOG_ERR, __FILE__, __LINE__);
     632            $app->logMsg(sprintf('Source directory not set before processing.'), LOG_ERR, __FILE__, __LINE__);
    613633            return false;
    614634        }
     
    639659    function _createDestDirs()
    640660    {
     661        $app =& App::getInstance();
     662
    641663        static $already_checked = false;
    642664
     
    644666            // Ensure we have a source.
    645667            if ('' == $this->getParam('source_dir')) {
    646                 App::logMsg(sprintf('Source directory not set before creating destination directories.'), LOG_ERR, __FILE__, __LINE__);
     668                $app->logMsg(sprintf('Source directory not set before creating destination directories.'), LOG_ERR, __FILE__, __LINE__);
    647669                return false;
    648670            }
     
    654676                    if (!mkdir($this->getParam('source_dir') . '/' . $spec['dest_dir'], $this->getParam('dest_dir_perms'))) {
    655677                        $return_val++;
    656                         App::logMsg(sprintf('mkdir failure: %s', $this->getParam('source_dir') . '/' . $spec['dest_dir']), LOG_ERR, __FILE__, __LINE__);
     678                        $app->logMsg(sprintf('mkdir failure: %s', $this->getParam('source_dir') . '/' . $spec['dest_dir']), LOG_ERR, __FILE__, __LINE__);
    657679                    }
    658680                }
     
    667689
    668690    /**
    669      * An alias for App::raiseMsg that only sends messages configured by display_messages.
     691     * An alias for $app->raiseMsg that only sends messages configured by display_messages.
    670692     *
    671693     * @access public
     
    679701    function _raiseMsg($message, $type, $file, $line)
    680702    {
     703        $app =& App::getInstance();
     704
    681705        if ($this->getParam('display_messages') === true || (is_int($this->getParam('display_messages')) && $this->getParam('display_messages') & $type > 0)) {
    682             App::raiseMsg($message, $type, $file, $line);
     706            $app->raiseMsg($message, $type, $file, $line);
    683707        }
    684708    }
  • branches/2.0singleton/lib/MCVE.inc.php

    r116 r128  
    2222    function MCVE($username, $password)
    2323    {
     24        $app =& App::getInstance();
     25
    2426        // Ensure PHP was compiled with the MCVE functions.
    2527        if (!extension_loaded('mcve')) {
     
    2729        }
    2830        if ('' == $username || '' == $password) {
    29             App::logMsg(sprintf('Empty username or password provided.', null), LOG_ERR, __FILE__, __LINE__);
     31            $app->logMsg(sprintf('Empty username or password provided.', null), LOG_ERR, __FILE__, __LINE__);
    3032        }
    3133        $this->username = $username;
     
    3537    function _connect()
    3638    {
     39        $app =& App::getInstance();
     40
    3741        if ($this->connected) {
    3842            return true;
     
    4953        case 'ip' :
    5054            if (!MCVE_SetIP($this->conn, $this->host, $this->ip_port)) {
    51                 App::logMsg('Could not set method to IP.', LOG_ERR, __FILE__, __LINE__);
     55                $app->logMsg('Could not set method to IP.', LOG_ERR, __FILE__, __LINE__);
    5256                return false;
    5357            }
     
    5559        case 'ssl' :
    5660            if (!MCVE_SetSSL($this->conn, $this->host, $this->ssl_port)) {
    57                 App::logMsg('Could not set method to IP.', LOG_ERR, __FILE__, __LINE__);
     61                $app->logMsg('Could not set method to IP.', LOG_ERR, __FILE__, __LINE__);
    5862                return false;
    5963            }
     
    6165        case 'dropfile' :
    6266            if (!MCVE_SetDropFile($this->conn, '/var/mcve/trans')) {
    63                 App::logMsg('Could not set method to IP.', LOG_ERR, __FILE__, __LINE__);
     67                $app->logMsg('Could not set method to IP.', LOG_ERR, __FILE__, __LINE__);
    6468                return false;
    6569            }
    6670            break;
    6771        default :
    68             App::logMsg('Connection method not defined.', LOG_ERR, __FILE__, __LINE__);
     72            $app->logMsg('Connection method not defined.', LOG_ERR, __FILE__, __LINE__);
    6973            return false;
    7074        }
     
    7579        // non-blocking, but future versions of php_mcve will default to blocking.
    7680        if (!MCVE_SetBlocking($this->conn, $this->blocking)) {
    77             App::logMsg('Could not set blocking mode.', LOG_ERR, __FILE__, __LINE__);
     81            $app->logMsg('Could not set blocking mode.', LOG_ERR, __FILE__, __LINE__);
    7882            return false;
    7983        }
     
    8185        // Maximum of 30s per transaction allowed. Timeout occurs on server-end, not client-end
    8286        if (!MCVE_SetTimeout($this->conn, $this->timeout)) {
    83             App::logMsg('Could not set timeout.', LOG_ERR, __FILE__, __LINE__);
     87            $app->logMsg('Could not set timeout.', LOG_ERR, __FILE__, __LINE__);
    8488            return false;
    8589        }
     
    8892        if (!MCVE_Connect($this->conn)) {
    8993            $error = MCVE_ConnectionError($this->conn);
    90             App::logMsg("Connection failed: $error. Are you sure the MCVE engine is running?", LOG_ERR, __FILE__, __LINE__);
     94            $app->logMsg("Connection failed: $error. Are you sure the MCVE engine is running?", LOG_ERR, __FILE__, __LINE__);
    9195            return false;
    9296        }
     
    117121    function sendTrans($tid, $type='', $hide_msg=false)
    118122    {
     123        $app =& App::getInstance();
     124
    119125        // Finalize structuring of  to MCVE and ready it to be sent
    120126        if (!MCVE_TransSend($this->conn, $tid)) {
    121             App::logMsg('Transaction improperly structured, possibly not enough info.', LOG_ERR, __FILE__, __LINE__);
     127            $app->logMsg('Transaction improperly structured, possibly not enough info.', LOG_ERR, __FILE__, __LINE__);
    122128            return false;
    123129        }
     
    139145        // Check to see if transaction was successful or not using a strict success/fail function
    140146        if ($ret_status == MCVE_FAIL) {
    141             App::raiseMsg(sprintf('MCVE %s failure: %s %s', $type, $ret_text, ('' == $verbiage ? '' : '(' . trim($verbiage) . ')')), MSG_WARNING, __FILE__, __LINE__);
     147            $app->raiseMsg(sprintf('MCVE %s failure: %s %s', $type, $ret_text, ('' == $verbiage ? '' : '(' . trim($verbiage) . ')')), MSG_WARNING, __FILE__, __LINE__);
    142148            return false;
    143149        } else if ($ret_status == MCVE_SUCCESS) {
    144150            if (!$hide_msg) {
    145                 App::raiseMsg(sprintf(_("MCVE %s success: %s %s"), $type, $ret_text, ('' == $verbiage ? '' : '(' . trim($verbiage) . ')')), MSG_SUCCESS, __FILE__, __LINE__);
     151                $app->raiseMsg(sprintf(_("MCVE %s success: %s %s"), $type, $ret_text, ('' == $verbiage ? '' : '(' . trim($verbiage) . ')')), MSG_SUCCESS, __FILE__, __LINE__);
    146152            }
    147             App::logMsg(sprintf(_("MCVE success details. Auth: %s; Batch: %s; Item: %s; TTID: %s; AVS: %s; CV: %s."),
     153            $app->logMsg(sprintf(_("MCVE success details. Auth: %s; Batch: %s; Item: %s; TTID: %s; AVS: %s; CV: %s."),
    148154                MCVE_TransactionAuth($this->conn, $tid),
    149155                MCVE_TransactionBatch($this->conn, $tid),
     
    155161            return true;
    156162        } else {
    157             App::logMsg(sprintf('Transaction failed. Unknown return code: %s', $ret_status), LOG_ERR, __FILE__, __LINE__);
     163            $app->logMsg(sprintf('Transaction failed. Unknown return code: %s', $ret_status), LOG_ERR, __FILE__, __LINE__);
    158164            return false;
    159165        }
  • branches/2.0singleton/lib/Nav.inc.php

    r44 r128  
    201201    function getBreadcrumbs($page_id=null)
    202202    {
     203        $app =& App::getInstance();
     204
    203205        $page_id = $this->_calculatePageID($page_id);
    204206
     
    219221                    } else if ($crumb_count > $this->getFeature('chop_breadcrumb_links')) {
    220222                        // A normal linked crumb.
    221                         $breadcrumbs .= oTxt($pathmark, true) . '<a href="' . App::oHREF($page['url']) . '">' . sprintf($this->last_crumb_format, oTxt($page['title'], true)) . '</a>';
     223                        $breadcrumbs .= oTxt($pathmark, true) . '<a href="' . $app->oHREF($page['url']) . '">' . sprintf($this->last_crumb_format, oTxt($page['title'], true)) . '</a>';
    222224                    }
    223225                } else {
     
    227229                    } else {
    228230                        // A normal linked crumb.
    229                         $breadcrumbs .= oTxt($pathmark, true) . '<a href="' . App::oHREF($page['url']) . '">' . oTxt($page['title'], true) . '</a>';
     231                        $breadcrumbs .= oTxt($pathmark, true) . '<a href="' . $app->oHREF($page['url']) . '">' . oTxt($page['title'], true) . '</a>';
    230232                    }
    231233                }
  • branches/2.0singleton/lib/PEdit.inc.php

    r121 r128  
    9595    function setParam($params)
    9696    {
     97        $app =& App::getInstance();
     98
    9799        if (isset($params) && is_array($params)) {
    98100            // Merge new parameters with old overriding only those passed.
    99101            $this->_params = array_merge($this->_params, $params);
    100102        } else {
    101             App::logMsg(sprintf('Parameters are not an array: %s', $params), LOG_WARNING, __FILE__, __LINE__);
     103            $app->logMsg(sprintf('Parameters are not an array: %s', $params), LOG_WARNING, __FILE__, __LINE__);
    102104        }
    103105    }
     
    112114    function getParam($param)
    113115    {
     116        $app =& App::getInstance();
     117
    114118        if (isset($this->_params[$param])) {
    115119            return $this->_params[$param];
    116120        } else {
    117             App::logMsg(sprintf('Parameter is not set: %s', $param), LOG_NOTICE, __FILE__, __LINE__);
     121            $app->logMsg(sprintf('Parameter is not set: %s', $param), LOG_NOTICE, __FILE__, __LINE__);
    118122            return null;
    119123        }
     
    129133    function start($initialize_data_file=false)
    130134    {
     135        $app =& App::getInstance();
     136
    131137        if (!is_dir($this->getParam('data_dir'))) {
    132138            trigger_error(sprintf('PEdit data directory not found: %s', $this->getParam('data_dir')), E_USER_WARNING);
     
    143149        case 'Save' :
    144150            if ($this->_writeData()) {
    145                 App::dieURL($_SERVER['PHP_SELF']);
     151                $app->dieURL($_SERVER['PHP_SELF']);
    146152            }
    147153            break;
    148154        case 'Restore' :
    149155            if ($this->_restoreVersion(getFormData('version'))) {
    150                 App::dieURL($_SERVER['PHP_SELF']);
     156                $app->dieURL($_SERVER['PHP_SELF']);
    151157            }
    152158            break;
    153159        case 'View' :
    154160            $this->_data_file = sprintf('%s%s__%s.xml', $this->getParam('data_dir'), $_SERVER['PHP_SELF'], getFormData('version'));
    155             App::raiseMsg(sprintf(_("This is <em><strong>only a preview</strong></em> of version %s."), getFormData('version')), MSG_NOTICE, __FILE__, __LINE__);
     161            $app->raiseMsg(sprintf(_("This is <em><strong>only a preview</strong></em> of version %s."), getFormData('version')), MSG_NOTICE, __FILE__, __LINE__);
    156162            break;
    157163        }
     
    176182    function set($name, $options=array())
    177183    {
     184        $app =& App::getInstance();
     185
    178186        $name = preg_replace('/\s/', '_', $name);
    179187        if (!isset($this->_data[$name])) {
    180188            $this->_data[$name] = array_merge(array('content' => ''), $options);
    181189        } else {
    182             App::logMsg(sprintf('Duplicate set data: %s', $name), LOG_NOTICE, __FILE__, __LINE__);
     190            $app->logMsg(sprintf('Duplicate set data: %s', $name), LOG_NOTICE, __FILE__, __LINE__);
    183191        }
    184192    }
     
    208216    function formBegin()
    209217    {
     218        $app =& App::getInstance();
     219
    210220        if (!$this->_authorized || empty($this->_data)) {
    211221            return false;
     
    216226        <input type="hidden" name="file_hash" value="<?php echo $this->_fileHash(); ?>" />
    217227        <?php
    218         App::printHiddenSession();
     228        $app->printHiddenSession();
    219229        switch ($this->op) {
    220230        case 'Edit' :
     
    345355    function printVersions()
    346356    {
     357        $app =& App::getInstance();
     358
    347359        if ($this->_authorized && $this->op == 'Versions') {
    348360            // Print versions and commands to view/restore.
     
    362374                    ?>
    363375                    <tr>
    364                         <td><?php echo date(App::getParam('date_format'), $v['unixtime']); ?></td>
    365                         <td><?php echo date(App::getParam('time_format'), $v['unixtime']); ?></td>
     376                        <td><?php echo date($app->getParam('date_format'), $v['unixtime']); ?></td>
     377                        <td><?php echo date($app->getParam('time_format'), $v['unixtime']); ?></td>
    366378                        <td><?php echo humanFileSize($v['filesize']); ?></td>
    367                         <td class="sc-nowrap"><a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=View&version=' . $v['unixtime'] . '&file_hash=' . $this->_fileHash()); ?>"><?php echo _("View"); ?></a> <?php echo _("or"); ?> <a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=Restore&version=' . $v['unixtime'] . '&file_hash=' . $this->_fileHash()); ?>"><?php echo _("Restore"); ?></a></td>
     379                        <td class="sc-nowrap"><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=View&version=' . $v['unixtime'] . '&file_hash=' . $this->_fileHash()); ?>"><?php echo _("View"); ?></a> <?php echo _("or"); ?> <a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=Restore&version=' . $v['unixtime'] . '&file_hash=' . $this->_fileHash()); ?>"><?php echo _("Restore"); ?></a></td>
    368380                    </tr>
    369381                    <?php
     
    386398    function _fileHash()
    387399    {
    388         return md5(App::getParam('signing_key') . $_SERVER['PHP_SELF']);
     400        $app =& App::getInstance();
     401
     402        return md5($app->getParam('signing_key') . $_SERVER['PHP_SELF']);
    389403    }
    390404
     
    399413    function _loadDataFile()
    400414    {
     415        $app =& App::getInstance();
     416
    401417        if (!file_exists($this->_data_file)) {
    402418            if (!$this->_initializeDataFile()) {
    403                 App::logMsg(sprintf('Initializing content file failed: %s', $this->_data_file), LOG_WARNING, __FILE__, __LINE__);
     419                $app->logMsg(sprintf('Initializing content file failed: %s', $this->_data_file), LOG_WARNING, __FILE__, __LINE__);
    404420                return false;
    405421            }
     
    408424        $status = $this->xml_unserializer->unserialize($xml_file_contents, false);   
    409425        if (PEAR::isError($status)) {
    410             App::logMsg(sprintf('XML_Unserialize error: %s', $status->getMessage()), LOG_WARNING, __FILE__, __LINE__);
     426            $app->logMsg(sprintf('XML_Unserialize error: %s', $status->getMessage()), LOG_WARNING, __FILE__, __LINE__);
    411427            return false;
    412428        }
     
    436452    function _initializeDataFile()
    437453    {
    438         App::logMsg(sprintf('Initializing data file: %s', $this->_data_file), LOG_INFO, __FILE__, __LINE__);
     454        $app =& App::getInstance();
     455
     456        $app->logMsg(sprintf('Initializing data file: %s', $this->_data_file), LOG_INFO, __FILE__, __LINE__);
    439457        $xml_file_contents = $this->xml_serializer->serialize($this->_data);
    440458        return $this->_filePutContents($this->_data_file, $xml_file_contents);
     
    450468    function _writeData()
    451469    {
     470        $app =& App::getInstance();
     471
    452472        if (!$this->_authorized) {
    453473            return false;
     
    455475        if ($this->_fileHash() != getFormData('file_hash')) {
    456476            // Posted data is NOT for this file!
    457             App::logMsg(sprintf('File_hash does not match current file.', null), LOG_WARNING, __FILE__, __LINE__);
     477            $app->logMsg(sprintf('File_hash does not match current file.', null), LOG_WARNING, __FILE__, __LINE__);
    458478            return false;
    459479        }
     
    466486            $this->_deleteOldVersions();
    467487            if (!$this->_createVersion()) {
    468                 App::logMsg(sprintf('Failed creating new version of file.', null), LOG_NOTICE, __FILE__, __LINE__);
     488                $app->logMsg(sprintf('Failed creating new version of file.', null), LOG_NOTICE, __FILE__, __LINE__);
    469489                return false;
    470490            }
     
    496516    function _filePutContents($filename, $content)
    497517    {
     518        $app =& App::getInstance();
     519
    498520        // Ensure requested filename is within the pedit data dir.
    499521        if (strpos($filename, $this->getParam('data_dir')) === false) {
    500             App::logMsg(sprintf('Failed writing file outside pedit _data_dir: %s', $filename), LOG_ERR, __FILE__, __LINE__);
     522            $app->logMsg(sprintf('Failed writing file outside pedit _data_dir: %s', $filename), LOG_ERR, __FILE__, __LINE__);
    501523            return false;
    502524        }
     
    510532            if (!is_dir($curr_path)) {
    511533                if (!mkdir($curr_path)) {
    512                     App::logMsg(sprintf('Failed mkdir: %s', $curr_path), LOG_ERR, __FILE__, __LINE__);
     534                    $app->logMsg(sprintf('Failed mkdir: %s', $curr_path), LOG_ERR, __FILE__, __LINE__);
    513535                    return false;
    514536                }
     
    522544                flock($fp, LOCK_UN);
    523545            } else {
    524                 App::logMsg(sprintf('Could not lock file for writing: %s', $filename), LOG_ERR, __FILE__, __LINE__);
     546                $app->logMsg(sprintf('Could not lock file for writing: %s', $filename), LOG_ERR, __FILE__, __LINE__);
    525547                return false;
    526548            }
    527549            fclose($fp);
    528550            // Success!
    529             App::logMsg(sprintf('Wrote to file: %s', $filename), LOG_DEBUG, __FILE__, __LINE__);
     551            $app->logMsg(sprintf('Wrote to file: %s', $filename), LOG_DEBUG, __FILE__, __LINE__);
    530552            return true;
    531553        } else {
    532             App::logMsg(sprintf('Could not open file for writing: %s', $filename), LOG_ERR, __FILE__, __LINE__);
     554            $app->logMsg(sprintf('Could not open file for writing: %s', $filename), LOG_ERR, __FILE__, __LINE__);
    533555            return false;
    534556        }
     
    544566    function _createVersion()
    545567    {
     568        $app =& App::getInstance();
     569
    546570        if (!$this->_authorized) {
    547571            return false;
     
    549573        if ($this->_fileHash() != getFormData('file_hash')) {
    550574            // Posted data is NOT for this file!
    551             App::logMsg(sprintf('File_hash does not match current file.', null), LOG_ERR, __FILE__, __LINE__);
     575            $app->logMsg(sprintf('File_hash does not match current file.', null), LOG_ERR, __FILE__, __LINE__);
    552576            return false;
    553577        }
     
    555579        // Ensure current data file exists.
    556580        if (!file_exists($this->_data_file)) {
    557             App::logMsg(sprintf('Data file does not yet exist: %s', $this->_data_file), LOG_NOTICE, __FILE__, __LINE__);
     581            $app->logMsg(sprintf('Data file does not yet exist: %s', $this->_data_file), LOG_NOTICE, __FILE__, __LINE__);
    558582            return false;
    559583        }
     
    563587        $version_file = sprintf('%s__%s.xml', preg_replace('/\.xml$/', '', $this->_data_file), time());
    564588        if (!copy($this->_data_file, $version_file)) {
    565             App::logMsg(sprintf('Failed copying new version: %s -> %s', $this->_data_file, $version_file), LOG_ERR, __FILE__, __LINE__);
     589            $app->logMsg(sprintf('Failed copying new version: %s -> %s', $this->_data_file, $version_file), LOG_ERR, __FILE__, __LINE__);
    566590            return false;
    567591        }
     
    580604    function _deleteOldVersions()
    581605    {
     606        $app =& App::getInstance();
     607
    582608        $version_files = $this->_getVersions();
    583609        if (is_array($version_files) && sizeof($version_files) > $this->getParam('versions_min_qty')) {
     
    590616                $del_file = dirname($this->_data_file) . '/' . $oldest['filename'];
    591617                if (!unlink($del_file)) {
    592                     App::logMsg(sprintf('Failed deleting version: %s', $del_file), LOG_ERR, __FILE__, __LINE__);
     618                    $app->logMsg(sprintf('Failed deleting version: %s', $del_file), LOG_ERR, __FILE__, __LINE__);
    593619                }
    594620                $oldest = array_pop($version_files);
     
    637663    function _restoreVersion($version)
    638664    {
     665        $app =& App::getInstance();
     666
    639667        if (!$this->_authorized) {
    640668            return false;
     
    646674        // Ensure specified version exists.
    647675        if (!file_exists($version_file)) {
    648             App::logMsg(sprintf('Cannot restore non-existant file: %s', $version_file), LOG_NOTICE, __FILE__, __LINE__);
     676            $app->logMsg(sprintf('Cannot restore non-existant file: %s', $version_file), LOG_NOTICE, __FILE__, __LINE__);
    649677            return false;
    650678        }
     
    652680        // Make certain a version is created.
    653681        if (!$this->_createVersion()) {
    654             App::logMsg(sprintf('Failed creating new version of file.', null), LOG_ERR, __FILE__, __LINE__);
     682            $app->logMsg(sprintf('Failed creating new version of file.', null), LOG_ERR, __FILE__, __LINE__);
    655683            return false;
    656684        }
     
    658686        // Do the actual copy.
    659687        if (!copy($version_file, $this->_data_file)) {
    660             App::logMsg(sprintf('Failed copying old version: %s -> %s', $version_file, $this->_data_file), LOG_ERR, __FILE__, __LINE__);
     688            $app->logMsg(sprintf('Failed copying old version: %s -> %s', $version_file, $this->_data_file), LOG_ERR, __FILE__, __LINE__);
    661689            return false;
    662690        }
    663691
    664692        // Success!
    665         App::raiseMsg(sprintf(_("Page has been restored to version %s."), $version), MSG_SUCCESS, __FILE__, __LINE__);
     693        $app->raiseMsg(sprintf(_("Page has been restored to version %s."), $version), MSG_SUCCESS, __FILE__, __LINE__);
    666694        return true;
    667695    }
  • branches/2.0singleton/lib/PageNumbers.inc.php

    r111 r128  
    137137    function calculate()
    138138    {
     139        $app =& App::getInstance();
     140
    139141        if (!$this->set_per_page_initialized) {
    140             App::logMsg(sprintf('set_per_page not initialized'), LOG_ERR, __FILE__, __LINE__);
     142            $app->logMsg(sprintf('set_per_page not initialized'), LOG_ERR, __FILE__, __LINE__);
    141143        }
    142144        if (!$this->set_page_number_initialized) {
    143             App::logMsg(sprintf('set_page_number not initialized'), LOG_ERR, __FILE__, __LINE__);
     145            $app->logMsg(sprintf('set_page_number not initialized'), LOG_ERR, __FILE__, __LINE__);
    144146        }
    145147        if (!$this->set_total_items_initialized) {
    146             App::logMsg(sprintf('set_total_items not initialized'), LOG_ERR, __FILE__, __LINE__);
     148            $app->logMsg(sprintf('set_total_items not initialized'), LOG_ERR, __FILE__, __LINE__);
    147149        }
    148150
     
    189191    function getLimitSQL()
    190192    {
     193        $app =& App::getInstance();
     194
    191195        if (is_numeric($this->first_item) && is_numeric($this->_per_page)) {
    192196            return ' LIMIT ' . DB::escapeString($this->first_item) . ', ' . DB::escapeString($this->_per_page) . ' ';
    193197        } else {
    194             App::logMsg(sprintf('Could not find SQL to LIMIT by %s %s.', $this->first_item, $this->_per_page), LOG_WARNING, __FILE__, __LINE__);
     198            $app->logMsg(sprintf('Could not find SQL to LIMIT by %s %s.', $this->first_item, $this->_per_page), LOG_WARNING, __FILE__, __LINE__);
    195199            return '';
    196200        }
     
    204208    function printPerPageLinks($query_key='per_page')
    205209    {
     210        $app =& App::getInstance();
     211
    206212        $sp = '';
    207213        for ($i=0; $i<sizeof($this->per_page_options); $i++) {
     
    209215                printf('%s<a href="%s">%s</a>',
    210216                    $sp,
    211                     App::oHREF($_SERVER['PHP_SELF'] . '?' . $query_key . '=' . $this->per_page_options[$i]),
     217                    $app->oHREF($_SERVER['PHP_SELF'] . '?' . $query_key . '=' . $this->per_page_options[$i]),
    212218                    $this->per_page_options[$i]
    213219                );
     
    220226
    221227    /**
    222      * Outputs an App::oHREF compatible url that goes to the page $page_number.
     228     * Outputs an $app->oHREF compatible url that goes to the page $page_number.
    223229     * Depends on $this->base_url to build the url onto. This is used in the
    224230     * page_number.ihtml template.
     
    232238    function getPageNumURL($page_number, $carry_args=null)
    233239    {
    234         return App::oHREF($this->url_base . $page_number, $carry_args);
     240        $app =& App::getInstance();
     241
     242        return $app->oHREF($this->url_base . $page_number, $carry_args);
    235243    }
    236244    function printPageNumURL($page_number, $carry_args=null)
  • branches/2.0singleton/lib/PageSequence.inc.php

    r42 r128  
    133133    function setCurrent($step_id)
    134134    {
     135        $app =& App::getInstance();
     136
    135137        if (false !== ($pos = $this->getPosition($step_id))) {
    136138            // Specified step exists (even if numeric).
     
    138140        } else {
    139141            // Step with specified key does not exist.
    140             App::logMsg(sprintf(_("Step %s not defined in sequence %s"), $step_id, $this->sequence_title), LOG_INFO, __FILE__, __LINE__);
     142            $app->logMsg(sprintf(_("Step %s not defined in sequence %s"), $step_id, $this->sequence_title), LOG_INFO, __FILE__, __LINE__);
    141143            return false;
    142144        }
     
    257259    function printEditLink($step_id=null)
    258260    {
     261        $app =& App::getInstance();
     262
    259263        $pos = isset($step_id) ? $this->getPosition($step_id) : $this->getPosition();
    260264        if ($_SESSION[$this->seq]['steps'][$pos]['editable']) {
    261             printf('[<a href="%s">%s</a>]', App::oHREF($_SERVER['PHP_SELF'] . '?step=' . $pos . '&boomerang=confirmation'), _("edit"));
     265            printf('[<a href="%s">%s</a>]', $app->oHREF($_SERVER['PHP_SELF'] . '?step=' . $pos . '&boomerang=confirmation'), _("edit"));
    262266        }
    263267    }
     
    320324    function _auto_timeout()
    321325    {
     326        $app =& App::getInstance();
     327
    322328        if (isset($_SESSION[$this->seq]['last_access_time'])
    323329        && $_SESSION[$this->seq]['last_access_time'] < time() - $this->idle_timeout) {
    324330            // Session has expired, flush all vars to start over.
    325331            $this->startOver();
    326             App::dieURL($this->start_url);
     332            $app->dieURL($this->start_url);
    327333        } else {
    328334            // Set timer.
  • branches/2.0singleton/lib/PayPal.inc.php

    r42 r128  
    7474    function setButtonDefaults($type, $options)
    7575    {
     76        $app =& App::getInstance();
     77
    7678        if (!is_array($options) || empty($options)) {
    77             App::logMsg(sprintf('Invalid options: %s', getDump($options)), LOG_WARNING, __FILE__, __LINE__);
     79            $app->logMsg(sprintf('Invalid options: %s', getDump($options)), LOG_WARNING, __FILE__, __LINE__);
    7880            return false;
    7981        }
     
    8284            $this->_default_button_options['_global'] = array_merge($this->_default_button_options['_global'], $options);
    8385        } else if (!isset($this->_default_button_options[$type])) {
    84             App::logMsg(sprintf('Invalid button type: %s', $type), LOG_WARNING, __FILE__, __LINE__);
     86            $app->logMsg(sprintf('Invalid button type: %s', $type), LOG_WARNING, __FILE__, __LINE__);
    8587            return false;
    8688        }
     
    104106    function newButton($type, $name, $options=null)
    105107    {
     108        $app =& App::getInstance();
     109
    106110        if (!isset($this->_default_button_options[$type])) {
    107             App::logMsg(sprintf('Invalid button type: %s', $type), LOG_WARNING, __FILE__, __LINE__);
     111            $app->logMsg(sprintf('Invalid button type: %s', $type), LOG_WARNING, __FILE__, __LINE__);
    108112            return false;
    109113        }
    110114
    111115        if (!is_array($options) || empty($options)) {
    112             App::logMsg(sprintf('Invalid options: %s', getDump($options)), LOG_WARNING, __FILE__, __LINE__);
     116            $app->logMsg(sprintf('Invalid options: %s', getDump($options)), LOG_WARNING, __FILE__, __LINE__);
    113117            return false;
    114118        }
    115119
    116120        if (isset($this->_buttons[$name])) {
    117             App::logMsg(sprintf('Overwriting existing button name: %s', getDump($this->_buttons[$name])), LOG_DEBUG, __FILE__, __LINE__);
     121            $app->logMsg(sprintf('Overwriting existing button name: %s', getDump($this->_buttons[$name])), LOG_DEBUG, __FILE__, __LINE__);
    118122        }
    119123
     
    137141    function getLink($name)
    138142    {
     143        $app =& App::getInstance();
     144
    139145        if (!isset($this->_buttons[$name])) {
    140             App::logMsg(sprintf('Button does not exist: %s', $name), LOG_WARNING, __FILE__, __LINE__);
     146            $app->logMsg(sprintf('Button does not exist: %s', $name), LOG_WARNING, __FILE__, __LINE__);
    141147            return false;
    142148        }
     
    207213    function setParam($params)
    208214    {
     215        $app =& App::getInstance();
     216
    209217        if (isset($params) && is_array($params)) {
    210218            // Merge new parameters with old overriding only those passed.
    211219            $this->_params = array_merge($this->_params, $params);
    212220        } else {
    213             App::logMsg(sprintf('Parameters are not an array: %s', $params), LOG_ERR, __FILE__, __LINE__);
     221            $app->logMsg(sprintf('Parameters are not an array: %s', $params), LOG_ERR, __FILE__, __LINE__);
    214222        }
    215223    }
     
    224232    function getParam($param)
    225233    {
     234        $app =& App::getInstance();
     235
    226236        if (isset($this->_params[$param])) {
    227237            return $this->_params[$param];
    228238        } else {
    229             App::logMsg(sprintf('Parameter is not set: %s', $param), LOG_DEBUG, __FILE__, __LINE__);
     239            $app->logMsg(sprintf('Parameter is not set: %s', $param), LOG_DEBUG, __FILE__, __LINE__);
    230240            return null;
    231241        }
     
    259269    function processIPN()
    260270    {
     271        $app =& App::getInstance();
     272
    261273        if (getPost('test_ipn') == '1' || $this->getParam('test_mode')) {
    262             App::logMsg(sprintf('Processing PayPal IPN in test mode: %s', getDump(getFormData())), LOG_DEBUG, __FILE__, __LINE__);
     274            $app->logMsg(sprintf('Processing PayPal IPN in test mode: %s', getDump(getFormData())), LOG_DEBUG, __FILE__, __LINE__);
    263275            $url = parse_url('https://www.sandbox.paypal.com/cgi-bin/webscr');
    264276        } else {
    265             App::logMsg(sprintf('Processing PayPal IPN: %s', getDump(getFormData())), LOG_DEBUG, __FILE__, __LINE__);
     277            $app->logMsg(sprintf('Processing PayPal IPN: %s', getDump(getFormData())), LOG_DEBUG, __FILE__, __LINE__);
    266278            $url = parse_url($this->getParam('paypal_url'));
    267279        }
     
    287299
    288300        if (!$fp) {
    289             App::logMsg(sprintf('Connection to PayPal URL %s failed with error: %s (%s)', $ssl . $url['host'], $errstr, $errnum), LOG_WARNING, __FILE__, __LINE__);
     301            $app->logMsg(sprintf('Connection to PayPal URL %s failed with error: %s (%s)', $ssl . $url['host'], $errstr, $errnum), LOG_WARNING, __FILE__, __LINE__);
    290302            return false;
    291303        } else {
     
    304316            fclose($fp);
    305317
    306             App::logMsg(sprintf('IPN response received: %s', $this->_ipn_response), LOG_NOTICE, __FILE__, __LINE__);
     318            $app->logMsg(sprintf('IPN response received: %s', $this->_ipn_response), LOG_NOTICE, __FILE__, __LINE__);
    307319            return true;
    308320        }
     
    318330    function verifiedIPN()
    319331    {
     332        $app =& App::getInstance();
     333
    320334        if (!isset($this->_ipn_response)) {
    321             App::logMsg(sprintf('Cannot verify IPN, response not received.', null), LOG_WARNING, __FILE__, __LINE__);
     335            $app->logMsg(sprintf('Cannot verify IPN, response not received.', null), LOG_WARNING, __FILE__, __LINE__);
    322336            return false;
    323337        }
    324338
    325339        if (empty($this->_ipn_response)) {
    326             App::logMsg(sprintf('Cannot verify IPN, response empty.', null), LOG_WARNING, __FILE__, __LINE__);
     340            $app->logMsg(sprintf('Cannot verify IPN, response empty.', null), LOG_WARNING, __FILE__, __LINE__);
    327341            return false;
    328342        }
    329343
    330344        if (preg_match('/VERIFIED/', $this->_ipn_response)) {
    331             App::logMsg(sprintf('IPN verified!', null), LOG_DEBUG, __FILE__, __LINE__);
     345            $app->logMsg(sprintf('IPN verified!', null), LOG_DEBUG, __FILE__, __LINE__);
    332346            return true;
    333347        } else if (preg_match('/INVALID/', $this->_ipn_response)) {
    334             App::logMsg(sprintf('IPN invalid.', null), LOG_DEBUG, __FILE__, __LINE__);
    335             return false;
    336         } else {
    337             App::logMsg(sprintf('IPN unknown.', null), LOG_WARNING, __FILE__, __LINE__);
     348            $app->logMsg(sprintf('IPN invalid.', null), LOG_DEBUG, __FILE__, __LINE__);
     349            return false;
     350        } else {
     351            $app->logMsg(sprintf('IPN unknown.', null), LOG_WARNING, __FILE__, __LINE__);
    338352            return false;
    339353        }
  • branches/2.0singleton/lib/Prefs.inc.php

    r42 r128  
    207207    function store($prefs=array())
    208208    {
     209        $app =& App::getInstance();
     210
    209211        // If we are not storing prefs in perpetually.
    210212        if (!$_perpetual) {
     
    223225
    224226        if (!is_array($prefs) || empty($prefs)) {
    225             App::raiseMsg(_("No preferences are available."), MSG_ERR, __FILE__, __LINE__);
    226             App::dieBoomerangURL();
     227            $app->raiseMsg(_("No preferences are available."), MSG_ERR, __FILE__, __LINE__);
     228            $app->dieBoomerangURL();
    227229        }
    228230
  • branches/2.0singleton/lib/RecordLock.inc.php

    r111 r128  
    4848    function RecordLock($auth_object)
    4949    {
     50        $app =& App::getInstance();
     51
    5052        if (!is_a($auth_object, 'Auth_SQL')) {
    5153            trigger_error('Constructor not provided a valid Auth_SQL object.', E_USER_ERROR);
     
    5557
    5658        // Get create tables config from global context.
    57         if (!is_null(App::getParam('db_create_tables'))) {
    58             $this->setParam(array('create_table' => App::getParam('db_create_tables')));
     59        if (!is_null($app->getParam('db_create_tables'))) {
     60            $this->setParam(array('create_table' => $app->getParam('db_create_tables')));
    5961        }
    6062    }
     
    6971    function initDB($recreate_db=false)
    7072    {
     73        $app =& App::getInstance();
     74
    7175        static $_db_tested = false;
    7276
     
    7478            if ($recreate_db) {
    7579                DB::query("DROP TABLE IF EXISTS " . $this->getParam('db_table'));
    76                 App::logMsg(sprintf('Dropping and recreating table %s.', $this->getParam('db_table')), LOG_DEBUG, __FILE__, __LINE__);
     80                $app->logMsg(sprintf('Dropping and recreating table %s.', $this->getParam('db_table')), LOG_DEBUG, __FILE__, __LINE__);
    7781            }
    7882            DB::query("CREATE TABLE IF NOT EXISTS " . $this->getParam('db_table') . " (
     
    99103                'lock_datetime',
    100104            ), false, false)) {
    101                 App::logMsg(sprintf('Database table %s has invalid columns. Please update this table manually.', $this->getParam('db_table')), LOG_ALERT, __FILE__, __LINE__);
     105                $app->logMsg(sprintf('Database table %s has invalid columns. Please update this table manually.', $this->getParam('db_table')), LOG_ALERT, __FILE__, __LINE__);
    102106                trigger_error(sprintf('Database table %s has invalid columns. Please update this table manually.', $this->getParam('db_table')), E_USER_ERROR);
    103107            }
     
    128132    function getParam($param)
    129133    {
     134        $app =& App::getInstance();
     135
    130136        if (isset($this->_params[$param])) {
    131137            return $this->_params[$param];
    132138        } else {
    133             App::logMsg(sprintf('Parameter is not set: %s', $param), LOG_DEBUG, __FILE__, __LINE__);
     139            $app->logMsg(sprintf('Parameter is not set: %s', $param), LOG_DEBUG, __FILE__, __LINE__);
    134140            return null;
    135141        }
     
    147153    function select($record_table_or_lock_id, $record_key=null, $record_val=null)
    148154    {
     155        $app =& App::getInstance();
     156
    149157        $this->initDB();
    150158
     
    168176        }
    169177        if ($this->data = mysql_fetch_assoc($qid)) {
    170             App::logMsg(sprintf('Selecting %slocked record: %s %s %s', ($this->data['set_by_admin_id'] == $this->_auth->getVal('user_id') ? 'self-' : ''), $record_table_or_lock_id, $record_key, $record_val), LOG_DEBUG, __FILE__, __LINE__);
     178            $app->logMsg(sprintf('Selecting %slocked record: %s %s %s', ($this->data['set_by_admin_id'] == $this->_auth->getVal('user_id') ? 'self-' : ''), $record_table_or_lock_id, $record_key, $record_val), LOG_DEBUG, __FILE__, __LINE__);
    171179            /// FIX ME: What if admin set lock, but public user is current lock user?
    172180            $this->data['editor'] = $this->_auth->getUsername($this->data['set_by_admin_id']);
    173181            return true;
    174182        } else {
    175             App::logMsg(sprintf('No locked record: %s %s %s', $record_table_or_lock_id, $record_key, $record_val), LOG_DEBUG, __FILE__, __LINE__);
     183            $app->logMsg(sprintf('No locked record: %s %s %s', $record_table_or_lock_id, $record_key, $record_val), LOG_DEBUG, __FILE__, __LINE__);
    176184            return false;
    177185        }
     
    266274    function remove()
    267275    {
     276        $app =& App::getInstance();
     277
    268278        $this->initDB();
    269279
     
    277287        ");
    278288
    279         App::logMsg(sprintf('Removing lock: %s', $this->data['lock_id']), LOG_DEBUG, __FILE__, __LINE__);
     289        $app->logMsg(sprintf('Removing lock: %s', $this->data['lock_id']), LOG_DEBUG, __FILE__, __LINE__);
    280290    }
    281291
     
    285295    function removeAll($user_id=null)
    286296    {
     297        $app =& App::getInstance();
     298
    287299        $this->initDB();
    288300
     
    293305            // Delete specific user's locks.
    294306            DB::query("DELETE FROM " . $this->getParam('db_table') . " WHERE set_by_admin_id = '" . DB::escapeString($user_id) . "'");
    295             App::logMsg(sprintf('Record locks owned by %s %s have been deleted', $this->_auth->getVal('auth_name'), $this->_auth->getUsername($user_id)), LOG_DEBUG, __FILE__, __LINE__);
     307            $app->logMsg(sprintf('Record locks owned by %s %s have been deleted', $this->_auth->getVal('auth_name'), $this->_auth->getUsername($user_id)), LOG_DEBUG, __FILE__, __LINE__);
    296308        } else {
    297309            // Delete ALL locks.
    298310            DB::query("DELETE FROM " . $this->getParam('db_table') . "");
    299             App::logMsg(sprintf('All record locks deleted by %s %s', $this->_auth->getVal('auth_name'), $this->_auth->getVal('username')), LOG_DEBUG, __FILE__, __LINE__);
     311            $app->logMsg(sprintf('All record locks deleted by %s %s', $this->_auth->getVal('auth_name'), $this->_auth->getVal('username')), LOG_DEBUG, __FILE__, __LINE__);
    300312        }
    301313    }
     
    325337    function dieErrorPage()
    326338    {
    327         App::dieURL(sprintf('%s?lock_id=%s&boomerang=%s', $this->getParam('error_url'), $this->data['lock_id'], urlencode(absoluteMe())));
     339        $app =& App::getInstance();
     340
     341        $app->dieURL(sprintf('%s?lock_id=%s&boomerang=%s', $this->getParam('error_url'), $this->data['lock_id'], urlencode(absoluteMe())));
    328342    }
    329343
     
    333347    function printErrorHTML()
    334348    {
     349        $app =& App::getInstance();
     350
    335351        ?>
    336352        <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    337         <?php App::printHiddenSession() ?>
     353        <?php $app->printHiddenSession() ?>
    338354        <input type="hidden" name="lock_id" value="<?php echo $this->getID(); ?>" />
    339355
  • branches/2.0singleton/lib/RecordVersion.inc.php

    r111 r128  
    5555    function RecordVersion($auth_object)
    5656    {
     57        $app =& App::getInstance();
     58
    5759        if (!is_a($auth_object, 'Auth_SQL')) {
    5860            trigger_error('Constructor not provided a valid Auth_SQL object.', E_USER_ERROR);
     
    6264
    6365        // Get create tables config from global context.
    64         if (!is_null(App::getParam('db_create_tables'))) {
    65             $this->setParam(array('create_table' => App::getParam('db_create_tables')));
     66        if (!is_null($app->getParam('db_create_tables'))) {
     67            $this->setParam(array('create_table' => $app->getParam('db_create_tables')));
    6668        }
    6769    }
     
    7678    function initDB($recreate_db=false)
    7779    {
     80        $app =& App::getInstance();
     81
    7882        static $_db_tested = false;
    7983
     
    8185            if ($recreate_db) {
    8286                DB::query("DROP TABLE IF EXISTS " . $this->getParam('db_table'));
    83                 App::logMsg(sprintf('Dropping and recreating table %s.', $this->getParam('db_table')), LOG_DEBUG, __FILE__, __LINE__);
     87                $app->logMsg(sprintf('Dropping and recreating table %s.', $this->getParam('db_table')), LOG_DEBUG, __FILE__, __LINE__);
    8488            }
    8589            DB::query("CREATE TABLE IF NOT EXISTS " . $this->getParam('db_table') . " (
     
    110114                'version_datetime',
    111115            ), false, false)) {
    112                 App::logMsg(sprintf('Database table %s has invalid columns. Please update this table manually.', $this->getParam('db_table')), LOG_ALERT, __FILE__, __LINE__);
     116                $app->logMsg(sprintf('Database table %s has invalid columns. Please update this table manually.', $this->getParam('db_table')), LOG_ALERT, __FILE__, __LINE__);
    113117                trigger_error(sprintf('Database table %s has invalid columns. Please update this table manually.', $this->getParam('db_table')), E_USER_ERROR);
    114118            }
     
    139143    function getParam($param)
    140144    {
     145        $app =& App::getInstance();
     146
    141147        if (isset($this->_params[$param])) {
    142148            return $this->_params[$param];
    143149        } else {
    144             App::logMsg(sprintf('Parameter is not set: %s', $param), LOG_DEBUG, __FILE__, __LINE__);
     150            $app->logMsg(sprintf('Parameter is not set: %s', $param), LOG_DEBUG, __FILE__, __LINE__);
    145151            return null;
    146152        }
     
    159165    function create($record_table, $record_key, $record_val, $title='', $notes='')
    160166    {
     167        $app =& App::getInstance();
     168
    161169        $this->initDB();
    162170
    163171        // Get current record.
    164172        if (!$record = $this->getCurrent($record_table, $record_key, $record_val)) {
    165             App::logMsg(sprintf('Could not create %s version, record not found: %s, %s, %s.', $title, $record_table, $record_key, $record_val), LOG_ERR, __FILE__, __LINE__);
     173            $app->logMsg(sprintf('Could not create %s version, record not found: %s, %s, %s.', $title, $record_table, $record_key, $record_val), LOG_ERR, __FILE__, __LINE__);
    166174            return false;
    167175        }
     
    205213    function restore($version_id)
    206214    {
     215        $app =& App::getInstance();
     216
    207217        $this->initDB();
    208218
     
    213223        ");
    214224        if (!$record = mysql_fetch_assoc($qid)) {
    215             App::raiseMsg(sprintf(_("Version ID %s%s not found."), $version_id, (empty($record['version_title']) ? '' : ' (' . $record['version_title'] . ')')), MSG_WARNING, __FILE__, __LINE__);
    216             App::logMsg(sprintf(_("Version ID %s%s not found."), $version_id, (empty($record['version_title']) ? '' : ' (' . $record['version_title'] . ')')), LOG_WARNING, __FILE__, __LINE__);
     225            $app->raiseMsg(sprintf(_("Version ID %s%s not found."), $version_id, (empty($record['version_title']) ? '' : ' (' . $record['version_title'] . ')')), MSG_WARNING, __FILE__, __LINE__);
     226            $app->logMsg(sprintf(_("Version ID %s%s not found."), $version_id, (empty($record['version_title']) ? '' : ' (' . $record['version_title'] . ')')), LOG_WARNING, __FILE__, __LINE__);
    217227            return false;
    218228        }
     
    221231        // Ensure saved db columns match current table schema.
    222232        if (!DB::columnExists($record['record_table'], array_keys($data), $this->getParam('db_schema_strict'))) {
    223             App::raiseMsg(sprintf(_("Version ID %s%s is not compatible with the current database table."), $version_id, (empty($record['version_title']) ? '' : ' (' . $record['version_title'] . ')')), MSG_ERR, __FILE__, __LINE__);
    224             App::logMsg(sprintf(_("Version ID %s%s restoration failed, DB schema does not match for table %s."), $version_id, (empty($record['version_title']) ? '' : ' (' . $record['version_title'] . ')'), $record['record_table']), LOG_ALERT, __FILE__, __LINE__);
     233            $app->raiseMsg(sprintf(_("Version ID %s%s is not compatible with the current database table."), $version_id, (empty($record['version_title']) ? '' : ' (' . $record['version_title'] . ')')), MSG_ERR, __FILE__, __LINE__);
     234            $app->logMsg(sprintf(_("Version ID %s%s restoration failed, DB schema does not match for table %s."), $version_id, (empty($record['version_title']) ? '' : ' (' . $record['version_title'] . ')'), $record['record_table']), LOG_ALERT, __FILE__, __LINE__);
    225235            return false;
    226236        }
  • branches/2.0singleton/lib/SessionCache.inc.php

    r119 r128  
    4444    function setParam($params)
    4545    {
     46        $app =& App::getInstance();
     47
    4648        if (!isset($_this) || !is_a($_this, 'SessionCache') && !is_subclass_of($_this, 'SessionCache')) {
    4749            $_this =& SessionCache::getInstance();
     
    5254            $_this->_params = array_merge($_this->_params, $params);
    5355        } else {
    54             App::logMsg(sprintf('Parameters are not an array: %s', $params), LOG_ERR, __FILE__, __LINE__);
     56            $app->logMsg(sprintf('Parameters are not an array: %s', $params), LOG_ERR, __FILE__, __LINE__);
    5557        }
    5658    }
     
    6567    function getParam($param)
    6668    {
     69        $app =& App::getInstance();
     70
    6771        if (!isset($_this) || !is_a($_this, 'SessionCache') && !is_subclass_of($_this, 'SessionCache')) {
    6872            $_this =& SessionCache::getInstance();
     
    7276            return $_this->_params[$param];
    7377        } else {
    74             App::logMsg(sprintf('Parameter is not set: %s', $param), LOG_DEBUG, __FILE__, __LINE__);
     78            $app->logMsg(sprintf('Parameter is not set: %s', $param), LOG_DEBUG, __FILE__, __LINE__);
    7579            return null;
    7680        }
     
    9599    function putCache($var, $var_id, $force_it_in=false)
    96100    {
     101        $app =& App::getInstance();
     102
    97103        if (!isset($_this) || !is_a($_this, 'SessionCache') && !is_subclass_of($_this, 'SessionCache')) {
    98104            $_this =& SessionCache::getInstance();
     
    100106
    101107        if (!$_this->getParam('enabled')) {
    102             App::logMsg(sprintf('SessionCache not enabled, not saving data.', null), LOG_DEBUG, __FILE__, __LINE__);
     108            $app->logMsg(sprintf('SessionCache not enabled, not saving data.', null), LOG_DEBUG, __FILE__, __LINE__);
    103109            return false;
    104110        }
     
    109115
    110116        if ($serialized_var_len >= $_this->getParam('soft_limit') && !$force_it_in) {
    111             App::logMsg(sprintf('Serialized variable (%s bytes) more than soft_limit (%s bytes).', $serialized_var_len, $_this->getParam('soft_limit')), LOG_NOTICE, __FILE__, __LINE__);
     117            $app->logMsg(sprintf('Serialized variable (%s bytes) more than soft_limit (%s bytes).', $serialized_var_len, $_this->getParam('soft_limit')), LOG_NOTICE, __FILE__, __LINE__);
    112118            return false;
    113119        }
    114120
    115121        if ($serialized_var_len >= $_this->getParam('hard_limit')) {
    116             App::logMsg(sprintf('Serialized variable (%s bytes) more than hard_limit (%s bytes).', $serialized_var_len, $_this->getParam('hard_limit')), LOG_NOTICE, __FILE__, __LINE__);
     122            $app->logMsg(sprintf('Serialized variable (%s bytes) more than hard_limit (%s bytes).', $serialized_var_len, $_this->getParam('hard_limit')), LOG_NOTICE, __FILE__, __LINE__);
    117123            return false;
    118124        }
     
    131137
    132138        if ($serialized_var_len >= 1024000) {
    133             App::logMsg(sprintf('Successfully cached oversized variable (%s bytes).', $serialized_var_len), LOG_DEBUG, __FILE__, __LINE__);
     139            $app->logMsg(sprintf('Successfully cached oversized variable (%s bytes).', $serialized_var_len), LOG_DEBUG, __FILE__, __LINE__);
    134140        }
    135141
  • branches/2.0singleton/lib/SortOrder.inc.php

    r119 r128  
    128128    function getSortOrderSQL()
    129129    {
     130        $app =& App::getInstance();
     131
    130132        if (!isset($this->_columns[strtolower($this->sort_by)])) {
    131133            $this->sort_by = $this->default_sort;
     
    139141            return sprintf(' ORDER BY %s ', DB::escapeString($this->_columns[strtolower($this->sort_by)][strtolower($this->order)]));
    140142        } else {
    141             App::logMsg(sprintf('Could not find SQL to sort by %s %s.', $this->sort_by, $this->order), LOG_WARNING, __FILE__, __LINE__);
     143            $app->logMsg(sprintf('Could not find SQL to sort by %s %s.', $this->sort_by, $this->order), LOG_WARNING, __FILE__, __LINE__);
    142144            return '';
    143145        }
     
    155157    function printSortHeader($col, $col_name, $default_order='ASC')
    156158    {
     159        $app =& App::getInstance();
     160
    157161        if ($this->sort_by == $col) {
    158162            if (strtolower($this->order) == 'desc') {
    159                 ?><a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?sort=' . $col . '&order=ASC'); ?>" title="<?php echo _("Change to ascending sort order"); ?>"><?php echo $this->desc_widget; ?></a><?php echo $col_name; ?><?php
     163                ?><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?sort=' . $col . '&order=ASC'); ?>" title="<?php echo _("Change to ascending sort order"); ?>"><?php echo $this->desc_widget; ?></a><?php echo $col_name; ?><?php
    160164            } else {
    161                 ?><a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?sort=' . $col . '&order=DESC'); ?>" title="<?php echo _("Change to descending sort order"); ?>"><?php echo $this->asc_widget; ?></a><?php echo $col_name; ?><?php
     165                ?><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?sort=' . $col . '&order=DESC'); ?>" title="<?php echo _("Change to descending sort order"); ?>"><?php echo $this->asc_widget; ?></a><?php echo $col_name; ?><?php
    162166            }
    163167        } else {
    164             ?><a href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?sort=' . $col . '&order=' . $default_order); ?>" title="<?php echo sprintf(_("Sort by %s"), $col_name); ?>"><?php echo $col_name; ?></a><?php
     168            ?><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?sort=' . $col . '&order=' . $default_order); ?>" title="<?php echo sprintf(_("Sort by %s"), $col_name); ?>"><?php echo $col_name; ?></a><?php
    165169        }
    166170    }
  • branches/2.0singleton/lib/SpellCheck.inc.php

    r42 r128  
    6262    function SpellCheck($params)
    6363    {
     64        $app =& App::getInstance();
     65
    6466        if (!is_array($params) || empty($params)) {
    6567            trigger_error('SpellCheck parameters not set properly', E_USER_ERROR);
     
    7577        if ('' != $this->getParam('personal_wordlist')) {
    7678            if (!is_writable(dirname($this->getParam('personal_wordlist'))) || !is_writable($this->getParam('personal_wordlist'))) {
    77                 App::logMsg(sprintf('Personal wordlist file not writable: %s', $this->getParam('personal_wordlist')), LOG_WARNING, __FILE__, __LINE__);
     79                $app->logMsg(sprintf('Personal wordlist file not writable: %s', $this->getParam('personal_wordlist')), LOG_WARNING, __FILE__, __LINE__);
    7880            } else {
    7981                pspell_config_personal($this->_pspell_cfg_handle, $this->getParam('personal_wordlist'));
    8082                $this->_use_personal_wordlist = true;
    81                 App::logMsg(sprintf('Using personal wordlist: %s', $this->getParam('personal_wordlist')), LOG_DEBUG, __FILE__, __LINE__);
     83                $app->logMsg(sprintf('Using personal wordlist: %s', $this->getParam('personal_wordlist')), LOG_DEBUG, __FILE__, __LINE__);
    8284            }
    8385        }
     
    9496    function setParam($params)
    9597    {
     98        $app =& App::getInstance();
     99
    96100        if (isset($params) && is_array($params)) {
    97101            // Merge new parameters with old overriding only those passed.
    98102            $this->_params = array_merge($this->_params, $params);
    99103        } else {
    100             App::logMsg(sprintf('Parameters are not an array: %s', $params), LOG_ERR, __FILE__, __LINE__);
     104            $app->logMsg(sprintf('Parameters are not an array: %s', $params), LOG_ERR, __FILE__, __LINE__);
    101105        }
    102106    }
     
    111115    function getParam($param)
    112116    {
     117        $app =& App::getInstance();
     118
    113119        if (isset($this->_params[$param])) {
    114120            return $this->_params[$param];
    115121        } else {
    116             App::logMsg(sprintf('Parameter is not set: %s', $param), LOG_DEBUG, __FILE__, __LINE__);
     122            $app->logMsg(sprintf('Parameter is not set: %s', $param), LOG_DEBUG, __FILE__, __LINE__);
    117123            return null;
    118124        }
     
    184190    function add($word)
    185191    {
     192        $app =& App::getInstance();
     193
    186194        if ($this->_use_personal_wordlist) {
    187195            if (pspell_add_to_personal($this->_pspell_handle, $word)) {
    188                 App::logMsg(sprintf('Added "%s" to personal wordlist: %s', $word, $this->getParam('personal_wordlist')), LOG_DEBUG, __FILE__, __LINE__);
     196                $app->logMsg(sprintf('Added "%s" to personal wordlist: %s', $word, $this->getParam('personal_wordlist')), LOG_DEBUG, __FILE__, __LINE__);
    189197                return true;
    190198            } else {
    191                 App::logMsg(sprintf('Failed adding "%s" to personal wordlist: %s', $word, $this->getParam('personal_wordlist')), LOG_WARNING, __FILE__, __LINE__);
     199                $app->logMsg(sprintf('Failed adding "%s" to personal wordlist: %s', $word, $this->getParam('personal_wordlist')), LOG_WARNING, __FILE__, __LINE__);
    192200                return false;
    193201            }
     
    207215    function save()
    208216    {
     217        $app =& App::getInstance();
     218
    209219        if ($this->_use_personal_wordlist) {
    210220            if (pspell_save_wordlist($this->_pspell_handle)) {
    211                 App::logMsg(sprintf('Saved personal wordlist: %s', $this->getParam('personal_wordlist')), LOG_DEBUG, __FILE__, __LINE__);
     221                $app->logMsg(sprintf('Saved personal wordlist: %s', $this->getParam('personal_wordlist')), LOG_DEBUG, __FILE__, __LINE__);
    212222                return true;
    213223            } else {
    214                 App::logMsg(sprintf('Failed saving personal wordlist: %s', $this->getParam('personal_wordlist')), LOG_ERR, __FILE__, __LINE__);
     224                $app->logMsg(sprintf('Failed saving personal wordlist: %s', $this->getParam('personal_wordlist')), LOG_ERR, __FILE__, __LINE__);
    215225                return false;
    216226            }
  • branches/2.0singleton/lib/TemplateGlue.inc.php

    r111 r128  
    6666function getSetEnumFieldValues($db_table, $db_col)
    6767{
     68    $app =& App::getInstance();
     69
    6870    $qid = DB::query("SHOW COLUMNS FROM " . DB::escapeString($db_table) . " LIKE '" . DB::escapeString($db_col) . "'",false);
    6971
     
    7274        return $enum[1];
    7375    } else {
    74         App::logMsg(sprintf('No set or enum fields found.', null), LOG_ERR, __FILE__, __LINE__);
     76        $app->logMsg(sprintf('No set or enum fields found.', null), LOG_ERR, __FILE__, __LINE__);
    7577        return false;
    7678    }
  • branches/2.0singleton/lib/Upload.inc.php

    r121 r128  
    5656    function setParam($params)
    5757    {
     58        $app =& App::getInstance();
     59
    5860        if (isset($params) && is_array($params)) {
    5961
     
    6365                // Must be directory.
    6466                if (!is_dir($params['upload_path'])) {
    65                     App::logMsg(sprintf('Attempting to auto-create upload directory: %s', $params['upload_path']), LOG_NOTICE, __FILE__, __LINE__);
     67                    $app->logMsg(sprintf('Attempting to auto-create upload directory: %s', $params['upload_path']), LOG_NOTICE, __FILE__, __LINE__);
    6668                    mkdir($params['upload_path'], $this->getParam('dest_dir_perms'));
    6769                    if (!is_dir($params['upload_path'])) {
    68                         App::logMsg(sprintf('Upload directory invalid: %s', $params['upload_path']), LOG_ERR, __FILE__, __LINE__);
     70                        $app->logMsg(sprintf('Upload directory invalid: %s', $params['upload_path']), LOG_ERR, __FILE__, __LINE__);
    6971                        trigger_error(sprintf('Upload directory invalid: %s', $params['upload_path']), E_USER_ERROR);
    7072                    }
     
    7274                // Must be writable.
    7375                if (!is_writable($params['upload_path'])) {
    74                     App::logMsg(sprintf('Upload directory not writable: %s', $params['upload_path']), LOG_ERR, __FILE__, __LINE__);
     76                    $app->logMsg(sprintf('Upload directory not writable: %s', $params['upload_path']), LOG_ERR, __FILE__, __LINE__);
    7577                    trigger_error(sprintf('Upload directory not writable: %s', $params['upload_path']), E_USER_ERROR);
    7678                }
     
    8082            $this->_params = array_merge($this->_params, $params);
    8183        } else {
    82             App::logMsg(sprintf('Parameters are not an array: %s', $params), LOG_ERR, __FILE__, __LINE__);
     84            $app->logMsg(sprintf('Parameters are not an array: %s', $params), LOG_ERR, __FILE__, __LINE__);
    8385        }
    8486    }
     
    9395    function getParam($param)
    9496    {
     97        $app =& App::getInstance();
     98
    9599        if (isset($this->_params[$param])) {
    96100            return $this->_params[$param];
    97101        } else {
    98             App::logMsg(sprintf('Parameter is not set: %s', $param), LOG_DEBUG, __FILE__, __LINE__);
     102            $app->logMsg(sprintf('Parameter is not set: %s', $param), LOG_DEBUG, __FILE__, __LINE__);
    99103            return null;
    100104        }
     
    117121    function process($form_name, $custom_file_name=null)
    118122    {
     123        $app =& App::getInstance();
     124
    119125        // Ensure we have a upload directory.
    120126        if (!$this->getParam('upload_path')) {
    121             App::logMsg(sprintf('Upload directory not set before processing.'), LOG_ERR, __FILE__, __LINE__);
     127            $app->logMsg(sprintf('Upload directory not set before processing.'), LOG_ERR, __FILE__, __LINE__);
    122128            $this->_raiseMsg(_("There was a problem with the file upload. Please try again later."), MSG_ERR, __FILE__, __LINE__);
    123129            return false;
     
    126132        // Ensure the file form element specified actually exists.
    127133        if (!isset($_FILES[$form_name])) {
    128             App::logMsg(sprintf(_("Form element %s does not exist."), $form_name), LOG_ERR, __FILE__, __LINE__);
     134            $app->logMsg(sprintf(_("Form element %s does not exist."), $form_name), LOG_ERR, __FILE__, __LINE__);
    129135            $this->_raiseMsg(_("There was a problem with the file upload. Please try again later."), MSG_ERR, __FILE__, __LINE__);
    130136            return false;
     
    167173                    $file_name = $custom_file_name;
    168174                    $this->_raiseMsg(sprintf(_("The file %s has been renamed to %s."), $files['name'][$i], $file_name), MSG_NOTICE, __FILE__, __LINE__);
    169                     App::logMsg(sprintf('Using custom file name: %s', $file_name), LOG_DEBUG, __FILE__, __LINE__);
     175                    $app->logMsg(sprintf('Using custom file name: %s', $file_name), LOG_DEBUG, __FILE__, __LINE__);
    170176                } else {
    171177                    // Invalid custom file name provided. Use uploaded file name.
    172178                    $file_name = $files['name'][$i];
    173                     App::logMsg(sprintf('Using uploaded file name: %s', $file_name), LOG_DEBUG, __FILE__, __LINE__);
     179                    $app->logMsg(sprintf('Using uploaded file name: %s', $file_name), LOG_DEBUG, __FILE__, __LINE__);
    174180                }
    175181            } else {
     
    179185                    $file_name = $custom_file_name[$i];
    180186                    $this->_raiseMsg(sprintf(_("The file %s has been renamed to %s."), $files['name'][$i], $file_name), MSG_NOTICE, __FILE__, __LINE__);
    181                     App::logMsg(sprintf('Using custom file name: %s', $file_name), LOG_DEBUG, __FILE__, __LINE__);
     187                    $app->logMsg(sprintf('Using custom file name: %s', $file_name), LOG_DEBUG, __FILE__, __LINE__);
    182188                } else {
    183189                    // Invalid custom file name provided. Use uploaded file name.
    184190                    $file_name = $files['name'][$i];
    185                     App::logMsg(sprintf('Using uploaded file name: %s', $file_name), LOG_DEBUG, __FILE__, __LINE__);
     191                    $app->logMsg(sprintf('Using uploaded file name: %s', $file_name), LOG_DEBUG, __FILE__, __LINE__);
    186192                }
    187193            }
     
    190196            if (UPLOAD_ERR_INI_SIZE === $files['error'][$i]) {
    191197                $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__);
    192                 App::logMsg(sprintf(_("The file %s failed uploading with PHP error %s UPLOAD_ERR_INI_SIZE (currently %s)."), $files['error'][$i], $file_name, ini_get('upload_max_filesize')), LOG_ERR, __FILE__, __LINE__);
     198                $app->logMsg(sprintf(_("The file %s failed uploading with PHP error %s UPLOAD_ERR_INI_SIZE (currently %s)."), $files['error'][$i], $file_name, ini_get('upload_max_filesize')), LOG_ERR, __FILE__, __LINE__);
    193199                $this->errors[] = array('filename' => $file_name, 'errortype' => UPLOAD_ERR_INI_SIZE);
    194200                continue;
     
    196202            if (UPLOAD_ERR_FORM_SIZE === $files['error'][$i]) {
    197203                $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__);
    198                 App::logMsg(sprintf(_("The file %s failed uploading with PHP error %s UPLOAD_ERR_FORM_SIZE (currently %s)."), $files['error'][$i], $file_name, $_POST['MAX_FILE_SIZE']), LOG_ERR, __FILE__, __LINE__);
     204                $app->logMsg(sprintf(_("The file %s failed uploading with PHP error %s UPLOAD_ERR_FORM_SIZE (currently %s)."), $files['error'][$i], $file_name, $_POST['MAX_FILE_SIZE']), LOG_ERR, __FILE__, __LINE__);
    199205                $this->errors[] = array('filename' => $file_name, 'errortype' => UPLOAD_ERR_FORM_SIZE);
    200206                continue;
     
    202208            if (UPLOAD_ERR_PARTIAL === $files['error'][$i]) {
    203209                $this->_raiseMsg(sprintf(_("The file %s failed uploading: it was only partially uploaded."), $file_name), MSG_ERR, __FILE__, __LINE__);
    204                 App::logMsg(sprintf(_("The file %s failed uploading with PHP error %s UPLOAD_ERR_PARTIAL."), $files['error'][$i], $file_name), LOG_ERR, __FILE__, __LINE__);
     210                $app->logMsg(sprintf(_("The file %s failed uploading with PHP error %s UPLOAD_ERR_PARTIAL."), $files['error'][$i], $file_name), LOG_ERR, __FILE__, __LINE__);
    205211                $this->errors[] = array('filename' => $file_name, 'errortype' => UPLOAD_ERR_PARTIAL);
    206212                continue;
     
    208214            if (UPLOAD_ERR_NO_FILE === $files['error'][$i]) {
    209215                $this->_raiseMsg(sprintf(_("The file %s failed uploading: no file was uploaded."), $file_name), MSG_ERR, __FILE__, __LINE__);
    210                 App::logMsg(sprintf(_("The file %s failed uploading with PHP error %s UPLOAD_ERR_NO_FILE."), $files['error'][$i], $file_name), LOG_ERR, __FILE__, __LINE__);
     216                $app->logMsg(sprintf(_("The file %s failed uploading with PHP error %s UPLOAD_ERR_NO_FILE."), $files['error'][$i], $file_name), LOG_ERR, __FILE__, __LINE__);
    211217                $this->errors[] = array('filename' => $file_name, 'errortype' => UPLOAD_ERR_NO_FILE);
    212218                continue;
     
    214220            if (UPLOAD_ERR_NO_TMP_DIR === $files['error'][$i]) {
    215221                $this->_raiseMsg(sprintf(_("The file %s failed uploading: temporary upload directory missing."), $file_name), MSG_ERR, __FILE__, __LINE__);
    216                 App::logMsg(sprintf(_("The file %s failed uploading with PHP error %s UPLOAD_ERR_NO_TMP_DIR."), $files['error'][$i], $file_name), LOG_ERR, __FILE__, __LINE__);
     222                $app->logMsg(sprintf(_("The file %s failed uploading with PHP error %s UPLOAD_ERR_NO_TMP_DIR."), $files['error'][$i], $file_name), LOG_ERR, __FILE__, __LINE__);
    217223                $this->errors[] = array('filename' => $file_name, 'errortype' => UPLOAD_ERR_NO_TMP_DIR);
    218224                continue;
     
    222228            if (!is_uploaded_file($files['tmp_name'][$i])) {
    223229                $this->_raiseMsg(sprintf(_("The file %s failed uploading."), $file_name), MSG_ERR, __FILE__, __LINE__);
    224                 App::logMsg(sprintf(_("The file %s failed is_uploaded_file."), $file_name), LOG_ERR, __FILE__, __LINE__);
     230                $app->logMsg(sprintf(_("The file %s failed is_uploaded_file."), $file_name), LOG_ERR, __FILE__, __LINE__);
    225231                $this->errors[] = array('filename' => $file_name, 'errortype' => UPLOAD_USER_ERR_NOT_UPLOADED_FILE);
    226232                continue;
     
    230236            if ($files['size'][$i] <= 0) {
    231237                $this->_raiseMsg(sprintf(_("The file %s failed uploading: it contains zero bytes."), $file_name), MSG_ERR, __FILE__, __LINE__);
    232                 App::logMsg(sprintf(_("The uploaded file %s contains zero bytes."), $file_name), LOG_ERR, __FILE__, __LINE__);
     238                $app->logMsg(sprintf(_("The uploaded file %s contains zero bytes."), $file_name), LOG_ERR, __FILE__, __LINE__);
    233239                $this->errors[] = array('filename' => $file_name, 'errortype' => UPLOAD_USER_ERR_EMPTY_FILE);
    234240                continue;
     
    238244            if (!in_array(strtolower($this->getFilenameExtension($file_name)), $this->getParam('valid_file_extensions'))) {
    239245                $this->_raiseMsg(sprintf(_("The file %s failed uploading: it is an unrecognized type. Files must have one of the following file name extensions: %s."), $file_name, join(', ', $this->getParam('valid_file_extensions'))), MSG_ERR, __FILE__, __LINE__);
    240                 App::logMsg(sprintf(_("The uploaded file %s has an unrecognized file name extension."), $file_name), LOG_WARNING, __FILE__, __LINE__);
     246                $app->logMsg(sprintf(_("The uploaded file %s has an unrecognized file name extension."), $file_name), LOG_WARNING, __FILE__, __LINE__);
    241247                $this->errors[] = array('filename' => $file_name, 'errortype' => UPLOAD_USER_ERR_INVALID_EXTENSION);
    242248                continue;
     
    246252            if (!$this->getParam('allow_overwriting') && $this->exists($file_name)) {
    247253                $this->_raiseMsg(sprintf(_("The file %s failed uploading: a file with that name already exists."), $file_name), MSG_ERR, __FILE__, __LINE__);
    248                 App::logMsg(sprintf(_("The uploaded file %s doesn't have a unique filename."), $file_name), LOG_WARNING, __FILE__, __LINE__);
     254                $app->logMsg(sprintf(_("The uploaded file %s doesn't have a unique filename."), $file_name), LOG_WARNING, __FILE__, __LINE__);
    249255                $this->errors[] = array('filename' => $file_name, 'errortype' => UPLOAD_USER_ERR_NOT_UNIQUE);
    250256                continue;
     
    269275            if (move_uploaded_file($files['tmp_name'][$i], $file_path_name)) {
    270276                chmod($file_path_name, $this->getParam('dest_file_perms'));
    271                 App::logMsg(sprintf('File uploaded: %s', $file_path_name), LOG_INFO, __FILE__, __LINE__);
     277                $app->logMsg(sprintf('File uploaded: %s', $file_path_name), LOG_INFO, __FILE__, __LINE__);
    272278                $this->_raiseMsg(sprintf(_("The file %s uploaded successfully."), $file_name), MSG_SUCCESS, __FILE__, __LINE__);
    273279                if (!isset($custom_file_name) && $files['name'][$i] != $file_name) {
     
    284290            } else {
    285291                $this->_raiseMsg(sprintf(_("The file %s failed uploading."), $file_name), MSG_ERR, __FILE__, __LINE__);
    286                 App::logMsg(sprintf(_("Moving file failed: %s -> %s"), $files['tmp_name'][$i], $file_path_name), LOG_ALERT, __FILE__, __LINE__);
     292                $app->logMsg(sprintf(_("Moving file failed: %s -> %s"), $files['tmp_name'][$i], $file_path_name), LOG_ALERT, __FILE__, __LINE__);
    287293                $this->errors[] = array('filename' => $file_name, 'errortype' => UPLOAD_USER_ERR_MOVE_FAILED);
    288294            }
     
    290296            // Check file extension with browsers interpretation of file type.
    291297            if (isset($this->mime_extension_map[$file_extension]) && $files['type'][$i] != $this->mime_extension_map[$file_extension]) {
    292                 App::logMsg(sprintf('File extension (%s) does not match mime type (%s).', $file_extension, $files['type'][$i]), LOG_NOTICE, __FILE__, __LINE__);
     298                $app->logMsg(sprintf('File extension (%s) does not match mime type (%s).', $file_extension, $files['type'][$i]), LOG_NOTICE, __FILE__, __LINE__);
    293299            }
    294300        }
     
    307313    function deleteFile($file_name)
    308314    {
     315        $app =& App::getInstance();
     316
    309317        // Ensure we have a upload directory.
    310318        if (!$this->getParam('upload_path')) {
    311             App::logMsg(sprintf('Upload directory not set before processing.'), LOG_ERR, __FILE__, __LINE__);
     319            $app->logMsg(sprintf('Upload directory not set before processing.'), LOG_ERR, __FILE__, __LINE__);
    312320            return false;
    313321        }
     
    316324
    317325        if (!is_file($file_path_name)) {
    318             App::logMsg(sprintf(_("Error deleting nonexistent file: %s"), $file_path_name), LOG_ERR, __FILE__, __LINE__);
     326            $app->logMsg(sprintf(_("Error deleting nonexistent file: %s"), $file_path_name), LOG_ERR, __FILE__, __LINE__);
    319327            return false;
    320328        } else if (unlink($file_path_name)) {
    321             App::logMsg(sprintf('Deleted file: %s', $file_path_name), LOG_INFO, __FILE__, __LINE__);
     329            $app->logMsg(sprintf('Deleted file: %s', $file_path_name), LOG_INFO, __FILE__, __LINE__);
    322330        } else {
    323331            $this->_raiseMsg(sprintf(_("The file %s could not be deleted."), $file_name), MSG_ERR, __FILE__, __LINE__);
    324             App::logMsg(sprintf(_("Failed deleting file: %s"), $file_path_name), LOG_ERR, __FILE__, __LINE__);
     332            $app->logMsg(sprintf(_("Failed deleting file: %s"), $file_path_name), LOG_ERR, __FILE__, __LINE__);
    325333            return false;
    326334        }
     
    337345    function moveFile($old_name, $new_name)
    338346    {
     347        $app =& App::getInstance();
     348
    339349        // Ensure we have an upload directory.
    340350        if (!$this->getParam('upload_path')) {
    341             App::logMsg(sprintf('Upload directory not set before processing.'), LOG_ERR, __FILE__, __LINE__);
     351            $app->logMsg(sprintf('Upload directory not set before processing.'), LOG_ERR, __FILE__, __LINE__);
    342352            return false;
    343353        }
     
    348358            if (rename($old_file_path_name, $new_file_path_name)) {
    349359                $this->_raiseMsg(sprintf(_("The file %s has been renamed to %s."), basename($old_file_path_name), basename($new_file_path_name)), MSG_NOTICE, __FILE__, __LINE__);
    350                 App::logMsg(sprintf('File renamed from %s to %s', $old_file_path_name, $new_file_path_name), LOG_DEBUG, __FILE__, __LINE__);
     360                $app->logMsg(sprintf('File renamed from %s to %s', $old_file_path_name, $new_file_path_name), LOG_DEBUG, __FILE__, __LINE__);
    351361            } else {
    352362                $this->_raiseMsg(sprintf(_("Error renaming file to %s"), $new_file_path_name), MSG_WARNING, __FILE__, __LINE__);
    353                 App::logMsg(sprintf(_("Error renaming file to %s"), $new_file_path_name), LOG_WARNING, __FILE__, __LINE__);
     363                $app->logMsg(sprintf(_("Error renaming file to %s"), $new_file_path_name), LOG_WARNING, __FILE__, __LINE__);
    354364                return false;
    355365            }
    356366        } else {
    357367            $this->_raiseMsg(sprintf(_("Couldn't rename nonexistent file %s."), $old_name), MSG_WARNING, __FILE__, __LINE__);
    358             App::logMsg(sprintf(_("Error renaming nonexistent file: %s"), $old_file_path_name), LOG_WARNING, __FILE__, __LINE__);
     368            $app->logMsg(sprintf(_("Error renaming nonexistent file: %s"), $old_file_path_name), LOG_WARNING, __FILE__, __LINE__);
    359369            return false;
    360370        }
     
    370380    function exists($file_name)
    371381    {
     382        $app =& App::getInstance();
     383
    372384        // Ensure we have a upload directory.
    373385        if (!$this->getParam('upload_path')) {
    374             App::logMsg(sprintf('Upload directory not set before processing.'), LOG_ERR, __FILE__, __LINE__);
     386            $app->logMsg(sprintf('Upload directory not set before processing.'), LOG_ERR, __FILE__, __LINE__);
    375387            return false;
    376388        }
     
    453465
    454466    /**
    455      * An alias for App::raiseMsg that only sends messages configured by display_messages.
     467     * An alias for $app->raiseMsg that only sends messages configured by display_messages.
    456468     *
    457469     * @access public
     
    465477    function _raiseMsg($message, $type, $file, $line)
    466478    {
     479        $app =& App::getInstance();
     480
    467481        if ($this->getParam('display_messages') === true || (is_int($this->getParam('display_messages')) && $this->getParam('display_messages') & $type > 0)) {
    468             App::raiseMsg($message, $type, $file, $line);
     482            $app->raiseMsg($message, $type, $file, $line);
    469483        }
    470484    }
Note: See TracChangeset for help on using the changeset viewer.