Changeset 1018
- Timestamp:
- Feb 1, 2006, 12:38:48 AM (18 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/feed.php
r958 r1018 3 3 // | PhpWebGallery - a PHP based picture gallery | 4 4 // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | 5 // | Copyright (C) 2003-200 5PhpWebGallery Team - http://phpwebgallery.net |5 // | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net | 6 6 // +-----------------------------------------------------------------------+ 7 7 // | branch : BSF (Best So Far) … … 28 28 define('PHPWG_ROOT_PATH','./'); 29 29 include_once(PHPWG_ROOT_PATH.'include/common.inc.php'); 30 include_once(PHPWG_ROOT_PATH.'include/functions_notification.inc.php'); 30 31 31 32 // +-----------------------------------------------------------------------+ 32 33 // | functions | 33 34 // +-----------------------------------------------------------------------+ 34 35 /**36 * new comments between two dates, according to authorized categories37 *38 * @param string start (mysql datetime format)39 * @param string end (mysql datetime format)40 * @param string forbidden categories (comma separated)41 * @return array comment ids42 */43 function new_comments($start, $end)44 {45 global $user;46 47 $query = '48 SELECT DISTINCT c.id AS comment_id49 FROM '.COMMENTS_TABLE.' AS c50 , '.IMAGE_CATEGORY_TABLE.' AS ic51 WHERE c.image_id = ic.image_id52 AND c.validation_date > \''.$start.'\'53 AND c.validation_date <= \''.$end.'\'54 AND category_id NOT IN ('.$user['forbidden_categories'].')55 ;';56 return array_from_query($query, 'comment_id');57 }58 59 /**60 * unvalidated at a precise date61 *62 * Comments that are registered and not validated yet on a precise date63 *64 * @param string date (mysql datetime format)65 * @return array comment ids66 */67 function unvalidated_comments($date)68 {69 $query = '70 SELECT DISTINCT id71 FROM '.COMMENTS_TABLE.'72 WHERE date <= \''.$date.'\'73 AND (validated = \'false\'74 OR validation_date > \''.$date.'\')75 ;';76 return array_from_query($query, 'id');77 }78 79 /**80 * new elements between two dates, according to authorized categories81 *82 * @param string start (mysql datetime format)83 * @param string end (mysql datetime format)84 * @param string forbidden categories (comma separated)85 * @return array element ids86 */87 function new_elements($start, $end)88 {89 global $user;90 91 $query = '92 SELECT DISTINCT image_id93 FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON image_id = id94 WHERE date_available > \''.$start.'\'95 AND date_available <= \''.$end.'\'96 AND category_id NOT IN ('.$user['forbidden_categories'].')97 ;';98 return array_from_query($query, 'image_id');99 }100 101 /**102 * updated categories between two dates, according to authorized categories103 *104 * @param string start (mysql datetime format)105 * @param string end (mysql datetime format)106 * @param string forbidden categories (comma separated)107 * @return array element ids108 */109 function updated_categories($start, $end)110 {111 global $user;112 113 $query = '114 SELECT DISTINCT category_id115 FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON image_id = id116 WHERE date_available > \''.$start.'\'117 AND date_available <= \''.$end.'\'118 AND category_id NOT IN ('.$user['forbidden_categories'].')119 ;';120 return array_from_query($query, 'category_id');121 }122 123 /**124 * new registered users between two dates125 *126 * @param string start (mysql datetime format)127 * @param string end (mysql datetime format)128 * @return array user ids129 */130 function new_users($start, $end)131 {132 $query = '133 SELECT user_id134 FROM '.USER_INFOS_TABLE.'135 WHERE registration_date > \''.$start.'\'136 AND registration_date <= \''.$end.'\'137 ;';138 return array_from_query($query, 'user_id');139 }140 141 /**142 * currently waiting pictures143 *144 * @return array waiting ids145 */146 function waiting_elements()147 {148 $query = '149 SELECT id150 FROM '.WAITING_TABLE.'151 WHERE validated = \'false\'152 ;';153 154 return array_from_query($query, 'id');155 }156 157 /**158 * What's new between two dates ?159 *160 * Informations : number of new comments, number of new elements, number of161 * updated categories. Administrators are also informed about : number of162 * unvalidated comments, number of new users (TODO : number of unvalidated163 * elements)164 *165 * @param string start date (mysql datetime format)166 * @param string end date (mysql datetime format)167 */168 function news($start, $end)169 {170 global $user;171 172 $news = array();173 174 $nb_new_comments = count(new_comments($start, $end));175 if ($nb_new_comments > 0)176 {177 array_push($news, sprintf(l10n('%d new comments'), $nb_new_comments));178 }179 180 $nb_new_elements = count(new_elements($start, $end));181 if ($nb_new_elements > 0)182 {183 array_push($news, sprintf(l10n('%d new elements'), $nb_new_elements));184 }185 186 $nb_updated_categories = count(updated_categories($start, $end));187 if ($nb_updated_categories > 0)188 {189 array_push($news, sprintf(l10n('%d categories updated'),190 $nb_updated_categories));191 }192 193 if ('admin' == $user['status'])194 {195 $nb_unvalidated_comments = count(unvalidated_comments($end));196 if ($nb_unvalidated_comments > 0)197 {198 array_push($news, sprintf(l10n('%d comments to validate'),199 $nb_unvalidated_comments));200 }201 202 $nb_new_users = count(new_users($start, $end));203 if ($nb_new_users > 0)204 {205 array_push($news, sprintf(l10n('%d new users'), $nb_new_users));206 }207 208 $nb_waiting_elements = count(waiting_elements());209 if ($nb_waiting_elements > 0)210 {211 array_push(212 $news,213 sprintf(214 l10n('%d waiting elements'),215 $nb_waiting_elements216 )217 );218 }219 }220 221 return $news;222 }223 35 224 36 /** -
trunk/include/config_default.inc.php
r1007 r1018 3 3 // | PhpWebGallery - a PHP based picture gallery | 4 4 // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | 5 // | Copyright (C) 2003-200 5PhpWebGallery Team - http://phpwebgallery.net |5 // | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net | 6 6 // +-----------------------------------------------------------------------+ 7 7 // | branch : BSF (Best So Far) … … 183 183 $conf['mail_options'] = false; 184 184 185 // Send bcc mail to webmaster 186 // Set true for debug or test 187 $conf['send_bcc_mail_webmaster'] = false; 188 185 189 // check_upgrade_feed: check if there are database upgrade required. Set to 186 190 // true, a message will strongly encourage you to upgrade your database if -
trunk/password.php
r1004 r1018 3 3 // | PhpWebGallery - a PHP based picture gallery | 4 4 // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | 5 // | Copyright (C) 2003-200 5PhpWebGallery Team - http://phpwebgallery.net |5 // | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net | 6 6 // +-----------------------------------------------------------------------+ 7 7 // | branch : BSF (Best So Far) … … 32 32 define('PHPWG_ROOT_PATH','./'); 33 33 include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); 34 35 // +-----------------------------------------------------------------------+ 36 // | functions | 37 // +-----------------------------------------------------------------------+ 38 39 /** 40 * sends an email, using PhpWebGallery specific informations 41 */ 42 function pwg_mail($to, $from, $infos = '') 43 { 44 global $conf; 45 46 $headers = 'From: <'.$from.'>'."\n"; 47 $headers.= 'Reply-To: '.$from."\n"; 48 49 $options = '-f '.$from; 50 51 $subject = l10n('password updated'); 52 53 $content = $infos; 54 $content.= "\n\n-- \nPhpWebGallery ".PHPWG_VERSION; 55 56 if ($conf['mail_options']) 57 { 58 return mail($to, $subject, $content, $headers, $options); 59 } 60 else 61 { 62 return mail($to, $subject, $content, $headers); 63 } 64 } 34 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 65 35 66 36 // +-----------------------------------------------------------------------+ … … 119 89 ; 120 90 121 if (pwg_mail($row['email'], $mail_webmaster, $infos))91 if (pwg_mail($row['email'], $mail_webmaster, l10n('password updated'), $infos)) 122 92 { 123 93 $data =
Note: See TracChangeset
for help on using the changeset viewer.