Changeset 749


Ignore:
Timestamp:
Sep 2, 2021 10:35:20 PM (3 years ago)
Author:
anonymous
Message:

Replace mailman utility functions with stubs. Remove gettext sub functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.1dev/lib/Utilities.inc.php

    r678 r749  
    768768}
    769769
    770 
    771770/**
    772771 * Verifies a signature appened to a value by addSignature().
     
    793792
    794793/**
    795  * Stub functions used when installation does not have
    796  * GNU gettext extension installed
    797  */
    798 if (!extension_loaded('gettext')) {
    799     /**
    800     * Translates text
    801     *
    802     * @access public
    803     * @param string $text the text to be translated
    804     * @return string translated text
    805     */
    806     function gettext($text) {
    807         return $text;
    808     }
    809 
    810     /**
    811     * Translates text
    812     *
    813     * @access public
    814     * @param string $text the text to be translated
    815     * @return string translated text
    816     */
    817     function _($text) {
    818         return $text;
    819     }
    820 
    821     /**
    822     * Translates text by domain
    823     *
    824     * @access public
    825     * @param string $domain the language to translate the text into
    826     * @param string $text the text to be translated
    827     * @return string translated text
    828     */
    829     function dgettext($domain, $text) {
    830         return $text;
    831     }
    832 
    833     /**
    834     * Translates text by domain and category
    835     *
    836     * @access public
    837     * @param string $domain the language to translate the text into
    838     * @param string $text the text to be translated
    839     * @param string $category the language dialect to use
    840     * @return string translated text
    841     */
    842     function dcgettext($domain, $text, $category) {
    843         return $text;
    844     }
    845 
    846     /**
    847     * Binds the text domain
    848     *
    849     * @access public
    850     * @param string $domain the language to translate the text into
    851     * @param string
    852     * @return string translated text
    853     */
    854     function bindtextdomain($domain, $directory) {
    855         return $domain;
    856     }
    857 
    858     /**
    859     * Sets the text domain
    860     *
    861     * @access public
    862     * @param string $domain the language to translate the text into
    863     * @return string translated text
    864     */
    865     function textdomain($domain) {
    866         return $domain;
    867     }
    868 }
    869 
    870 /**
    871794 * Sends empty output to the browser and flushes the php buffer so the client
    872795 * will see data before the page is finished processing.
     
    878801
    879802/**
    880  * Adds email address to mailman mailing list. Requires /etc/sudoers entry for apache to sudo execute add_members.
    881  * Don't forget to allow php_admin_value open_basedir access to "/var/mailman/bin".
     803 * A stub for apps that still use this function.
    882804 *
    883805 * @access  public
    884  *
    885  * @param   string  $email     Email address to add.
    886  * @param   string  $list      Name of list to add to.
    887  * @param   bool    $send_welcome_message   True to send welcome message to subscriber.
    888  *
    889  * @return  bool    True on success, false on failure.
     806 * @return  void
    890807 */
    891808function mailmanAddMember($email, $list, $send_welcome_message=false)
    892809{
    893    $add_members = '/usr/lib/mailman/bin/add_members';
    894     if (true || is_executable($add_members) && is_readable($add_members)) {
    895         $welcome_msg = $send_welcome_message ? 'y' : 'n';
    896         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);
    897         $stdout = is_array($stdout) ? getDump($stdout) : $stdout;
    898         if (0 == $return_code) {
    899             logMsg(sprintf('Mailman add member success for list: %s, user: %s', $list, $email, $stdout), LOG_INFO, __FILE__, __LINE__);
    900             return true;
    901         } else {
    902             logMsg(sprintf('Mailman add member failed for list: %s, user: %s, with message: %s', $list, $email, $stdout), LOG_WARNING, __FILE__, __LINE__);
    903             return false;
    904         }
    905     } else {
    906         logMsg(sprintf('Mailman add member program not executable: %s', $add_members), LOG_ALERT, __FILE__, __LINE__);
    907         return false;
    908     }
    909 }
    910 
    911 /**
    912  * Removes email address from mailman mailing list. Requires /etc/sudoers entry for apache to sudo execute add_members.
    913  * Don't forget to allow php_admin_value open_basedir access to "/var/mailman/bin".
     810    logMsg(sprintf('mailmanAddMember called and ignored: %s, %s, %s', $email, $list, $send_welcome_message), LOG_WARNING, __FILE__, __LINE__);
     811}
     812
     813/**
     814 * A stub for apps that still use this function.
    914815 *
    915816 * @access  public
    916  *
    917  * @param   string  $email     Email address to add.
    918  * @param   string  $list      Name of list to add to.
    919  * @param   bool    $send_user_ack   True to send goodbye message to subscriber.
    920  *
    921  * @return  bool    True on success, false on failure.
     817 * @return  void
    922818 */
    923819function mailmanRemoveMember($email, $list, $send_user_ack=false)
    924820{
    925     $remove_members = '/usr/lib/mailman/bin/remove_members';
    926     if (true || is_executable($remove_members) && is_readable($remove_members)) {
    927         $userack = $send_user_ack ? '' : '--nouserack';
    928         exec(sprintf('/usr/bin/sudo %s %s --noadminack %s %s', escapeshellarg($remove_members), $userack, escapeshellarg($list), escapeshellarg($email)), $stdout, $return_code);
    929         $stdout = is_array($stdout) ? getDump($stdout) : $stdout;
    930         if (0 == $return_code) {
    931             logMsg(sprintf('Mailman remove member success for list: %s, user: %s', $list, $email, $stdout), LOG_INFO, __FILE__, __LINE__);
    932             return true;
    933         } else {
    934             logMsg(sprintf('Mailman remove member failed for list: %s, user: %s, with message: %s', $list, $email, $stdout), LOG_WARNING, __FILE__, __LINE__);
    935             return false;
    936         }
    937     } else {
    938         logMsg(sprintf('Mailman remove member program not executable: %s', $remove_members), LOG_ALERT, __FILE__, __LINE__);
    939         return false;
    940     }
    941 }
    942 
    943 
    944 
    945 ?>
     821    logMsg(sprintf('mailmanRemoveMember called and ignored: %s, %s, %s', $email, $list, $send_user_ack), LOG_WARNING, __FILE__, __LINE__);
     822}
     823
Note: See TracChangeset for help on using the changeset viewer.