Changeset 749
- Timestamp:
- Sep 2, 2021 10:35:20 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.1dev/lib/Utilities.inc.php
r678 r749 768 768 } 769 769 770 771 770 /** 772 771 * Verifies a signature appened to a value by addSignature(). … … 793 792 794 793 /** 795 * Stub functions used when installation does not have796 * GNU gettext extension installed797 */798 if (!extension_loaded('gettext')) {799 /**800 * Translates text801 *802 * @access public803 * @param string $text the text to be translated804 * @return string translated text805 */806 function gettext($text) {807 return $text;808 }809 810 /**811 * Translates text812 *813 * @access public814 * @param string $text the text to be translated815 * @return string translated text816 */817 function _($text) {818 return $text;819 }820 821 /**822 * Translates text by domain823 *824 * @access public825 * @param string $domain the language to translate the text into826 * @param string $text the text to be translated827 * @return string translated text828 */829 function dgettext($domain, $text) {830 return $text;831 }832 833 /**834 * Translates text by domain and category835 *836 * @access public837 * @param string $domain the language to translate the text into838 * @param string $text the text to be translated839 * @param string $category the language dialect to use840 * @return string translated text841 */842 function dcgettext($domain, $text, $category) {843 return $text;844 }845 846 /**847 * Binds the text domain848 *849 * @access public850 * @param string $domain the language to translate the text into851 * @param string852 * @return string translated text853 */854 function bindtextdomain($domain, $directory) {855 return $domain;856 }857 858 /**859 * Sets the text domain860 *861 * @access public862 * @param string $domain the language to translate the text into863 * @return string translated text864 */865 function textdomain($domain) {866 return $domain;867 }868 }869 870 /**871 794 * Sends empty output to the browser and flushes the php buffer so the client 872 795 * will see data before the page is finished processing. … … 878 801 879 802 /** 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. 882 804 * 883 805 * @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 890 807 */ 891 808 function mailmanAddMember($email, $list, $send_welcome_message=false) 892 809 { 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. 914 815 * 915 816 * @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 922 818 */ 923 819 function mailmanRemoveMember($email, $list, $send_user_ack=false) 924 820 { 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.