Changeset 123


Ignore:
Timestamp:
May 23, 2006 8:56:19 PM (18 years ago)
Author:
scdev
Message:

J - Updated Utilities.inc.php

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

Legend:

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

    r119 r123  
    4545        'site_url' => '', // URL automatically determined by _SERVER['HTTP_HOST'] if not set here.
    4646
    47         // The location the user will go if the system doesn't knew where else to send them.
     47        // The location the user will go if the system doesn't know where else to send them.
    4848        'redirect_home_url' => '/',
    4949
  • branches/2.0singleton/lib/Utilities.inc.php

    r111 r123  
    7474function oTxt($txt, $preserve_html=false)
    7575{
     76    $app =& App::getInstance();
     77
    7678    $search = array();
    7779    $replace = array();
     
    100102    $replace['ampersand']       = '&';
    101103
    102     return preg_replace($search, $replace, htmlentities($txt, ENT_QUOTES, App::getParam('character_set')));
     104    return preg_replace($search, $replace, htmlentities($txt, ENT_QUOTES, $app->getParam('character_set')));
    103105}
    104106
     
    596598function addSignature($val, $seed_key=null)
    597599{
     600    $app =& App::getInstance();
     601   
    598602    if ('' == $val) {
    599         App::logMsg(sprintf('Adding signature to empty string.', null), LOG_NOTICE, __FILE__, __LINE__);
     603        $app->logMsg(sprintf('Adding signature to empty string.', null), LOG_NOTICE, __FILE__, __LINE__);
    600604    }
    601605
    602606    if (!isset($seed_key)) {
    603         $seed_key = App::getParam('signing_key');
     607        $seed_key = $app->getParam('signing_key');
    604608    }
    605609
     
    662666function mailmanAddMember($email, $list, $send_welcome_message=false)
    663667{
    664    $add_members = '/var/mailman/bin/add_members';
     668    $app =& App::getInstance();
     669   
     670    $add_members = '/var/mailman/bin/add_members';
    665671    if (is_executable($add_members) && is_readable($add_members)) {
    666672        $welcome_msg = $send_welcome_message ? 'y' : 'n';
    667673        exec(sprintf('/bin/echo %s | /usr/bin/sudo %s -r - --welcome-msg=%s --admin-notify=n %s', escapeshellarg($email), escapeshellarg($add_members), $welcome_msg, escapeshellarg($list)), $stdout, $return_code);
    668674        if (0 == $return_code) {
    669             App::logMsg(sprintf('Mailman add member success for list: %s, user: %s', $list, $email, $stdout), LOG_INFO, __FILE__, __LINE__);
     675            $app->logMsg(sprintf('Mailman add member success for list: %s, user: %s', $list, $email, $stdout), LOG_INFO, __FILE__, __LINE__);
    670676            return true;
    671677        } else {
    672             App::logMsg(sprintf('Mailman add member failed for list: %s, user: %s, with message: %s', $list, $email, $stdout), LOG_WARNING, __FILE__, __LINE__);
     678            $app->logMsg(sprintf('Mailman add member failed for list: %s, user: %s, with message: %s', $list, $email, $stdout), LOG_WARNING, __FILE__, __LINE__);
    673679            return false;
    674680        }
    675681    } else {
    676         App::logMsg(sprintf('Mailman add member program not executable: %s', $add_members), LOG_ALERT, __FILE__, __LINE__);
     682        $app->logMsg(sprintf('Mailman add member program not executable: %s', $add_members), LOG_ALERT, __FILE__, __LINE__);
    677683        return false;
    678684    }
     
    691697function mailmanRemoveMember($email, $list, $send_user_ack=false)
    692698{
     699    $app =& App::getInstance();
     700   
    693701    $remove_members = '/var/mailman/bin/remove_members';
    694702    if (is_executable($remove_members) && is_readable($remove_members)) {
     
    696704        exec(sprintf('/usr/bin/sudo %s %s --noadminack %s %s', escapeshellarg($remove_members), $userack, escapeshellarg($list), escapeshellarg($email)), $stdout, $return_code);
    697705        if (0 == $return_code) {
    698             App::logMsg(sprintf('Mailman remove member success for list: %s, user: %s', $list, $email, $stdout), LOG_INFO, __FILE__, __LINE__);
     706            $app->logMsg(sprintf('Mailman remove member success for list: %s, user: %s', $list, $email, $stdout), LOG_INFO, __FILE__, __LINE__);
    699707            return true;
    700708        } else {
    701             App::logMsg(sprintf('Mailman remove member failed for list: %s, user: %s, with message: %s', $list, $email, $stdout), LOG_WARNING, __FILE__, __LINE__);
     709            $app->logMsg(sprintf('Mailman remove member failed for list: %s, user: %s, with message: %s', $list, $email, $stdout), LOG_WARNING, __FILE__, __LINE__);
    702710            return false;
    703711        }
    704712    } else {
    705         App::logMsg(sprintf('Mailman remove member program not executable: %s', $remove_members), LOG_ALERT, __FILE__, __LINE__);
     713        $app->logMsg(sprintf('Mailman remove member program not executable: %s', $remove_members), LOG_ALERT, __FILE__, __LINE__);
    706714        return false;
    707715    }
Note: See TracChangeset for help on using the changeset viewer.