From 4577278acc361facfbd70c6172355ee12e1b80e4 Mon Sep 17 00:00:00 2001 From: rub Date: Mon, 12 Mar 2007 22:33:53 +0000 Subject: [PATCH] Apply property svn:eol-style Value: LF git-svn-id: http://piwigo.org/svn/trunk@1900 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/advanced_feature.php | 234 ++-- admin/include/functions_history.inc.php | 108 +- .../functions_notification_by_mail.inc.php | 1098 ++++++++--------- admin/include/functions_tabsheet.inc.php | 148 +-- include/functions_filter.inc.php | 132 +- install/db/40-database.php | 88 +- install/db/41-database.php | 130 +- .../help/advanced_feature.html | 32 +- .../en_UK.iso-8859-1/help/group_list.html | 42 +- .../en_UK.iso-8859-1/help/web_service.html | 94 +- .../help/advanced_feature.html | 32 +- .../fr_FR.iso-8859-1/help/group_list.html | 40 +- .../fr_FR.iso-8859-1/help/web_service.html | 96 +- plugins/add_index/admin/main_page.tpl | 28 +- plugins/add_index/index.php | 70 +- .../help/advanced_feature.html | 14 +- .../en_UK.iso-8859-1/help/site_manager.html | 14 +- .../language/en_UK.iso-8859-1/plugin.lang.php | 88 +- .../help/advanced_feature.html | 14 +- .../fr_FR.iso-8859-1/help/site_manager.html | 14 +- .../language/fr_FR.iso-8859-1/plugin.lang.php | 88 +- plugins/add_index/language/index.php | 70 +- plugins/add_index/main.admin.inc.php | 198 +-- plugins/add_index/main.base.inc.php | 86 +- plugins/add_index/main.inc.php | 110 +- plugins/add_index/main.normal.inc.php | 128 +- plugins/admin_advices/admin_advices.tpl | 64 +- plugins/admin_advices/default-layout.css | 38 +- .../en_UK.iso-8859-1/lang.adv.php | 888 ++++++------- .../fr_FR.iso-8859-1/lang.adv.php | 958 +++++++------- plugins/admin_advices/main.inc.php | 238 ++-- template-common/csshover.htc | 238 ++-- template-common/default-layout.css | 102 +- template/yoga/admin/advanced_feature.tpl | 30 +- template/yoga/admin/default-layout.css | 354 +++--- template/yoga/admin/tabsheet.tpl | 12 +- template/yoga/admin/ws_checker.tpl | 458 +++---- template/yoga/fix-ie7.css | 64 +- template/yoga/fix-khtml.css | 2 +- .../text/html/admin/notification_by_mail.tpl | 106 +- template/yoga/mail/text/html/footer.tpl | 38 +- .../yoga/mail/text/html/global-mail-css.tpl | 36 +- template/yoga/mail/text/html/header.tpl | 36 +- .../text/plain/admin/notification_by_mail.tpl | 86 +- template/yoga/mail/text/plain/footer.tpl | 6 +- template/yoga/mail/text/plain/header.tpl | 6 +- template/yoga/not-ie.css | 48 +- template/yoga/slideshow.tpl | 36 +- template/yoga/theme/clear/mail-css.tpl | 28 +- template/yoga/theme/dark/mail-css.tpl | 28 +- template/yoga/theme/p0w0/mail-css.tpl | 26 +- template/yoga/theme/wipi/mail-css.tpl | 40 +- template/yoga/theme/wipi/theme.css | 700 +++++------ template/yoga/theme/wipi/themeconf.inc.php | 32 +- 54 files changed, 3947 insertions(+), 3947 deletions(-) diff --git a/admin/advanced_feature.php b/admin/advanced_feature.php index b1614b488..b4a436ca0 100644 --- a/admin/advanced_feature.php +++ b/admin/advanced_feature.php @@ -1,117 +1,117 @@ - l10n('???'), - 'URL' => $start_url.'???' - ));*/ - -array_push($advanced_features, - array - ( - 'CAPTION' => l10n('Elements_not_linked'), - 'URL' => get_root_url().'admin.php?page=element_set&cat=not_linked' - )); - -array_push($advanced_features, - array - ( - 'CAPTION' => l10n('Duplicates'), - 'URL' => get_root_url().'admin.php?page=element_set&cat=duplicates' - )); - -//$advanced_features is array of array composed of CAPTION & URL -$advanced_features = - trigger_event('get_admin_advanced_features_links', $advanced_features); - -// +-----------------------------------------------------------------------+ -// | Template init | -// +-----------------------------------------------------------------------+ - -$template->set_filenames(array('advanced_feature'=>'admin/advanced_feature.tpl')); - -$start_url = get_root_url().'admin.php?page=advanced_feature&action='; - -$template->assign_vars( - array - ( - 'U_HELP' => get_root_url().'popuphelp.php?page=advanced_feature' - )); - -// advanced_features -if (count($advanced_features) > 0) -{ - foreach ($advanced_features as $advanced_feature) - { - $template->assign_block_vars('advanced_features.advanced_feature', $advanced_feature); - } -} - -// +-----------------------------------------------------------------------+ -// | Sending html code | -// +-----------------------------------------------------------------------+ - -$template->assign_var_from_handle('ADMIN_CONTENT', 'advanced_feature'); - -?> + l10n('???'), + 'URL' => $start_url.'???' + ));*/ + +array_push($advanced_features, + array + ( + 'CAPTION' => l10n('Elements_not_linked'), + 'URL' => get_root_url().'admin.php?page=element_set&cat=not_linked' + )); + +array_push($advanced_features, + array + ( + 'CAPTION' => l10n('Duplicates'), + 'URL' => get_root_url().'admin.php?page=element_set&cat=duplicates' + )); + +//$advanced_features is array of array composed of CAPTION & URL +$advanced_features = + trigger_event('get_admin_advanced_features_links', $advanced_features); + +// +-----------------------------------------------------------------------+ +// | Template init | +// +-----------------------------------------------------------------------+ + +$template->set_filenames(array('advanced_feature'=>'admin/advanced_feature.tpl')); + +$start_url = get_root_url().'admin.php?page=advanced_feature&action='; + +$template->assign_vars( + array + ( + 'U_HELP' => get_root_url().'popuphelp.php?page=advanced_feature' + )); + +// advanced_features +if (count($advanced_features) > 0) +{ + foreach ($advanced_features as $advanced_feature) + { + $template->assign_block_vars('advanced_features.advanced_feature', $advanced_feature); + } +} + +// +-----------------------------------------------------------------------+ +// | Sending html code | +// +-----------------------------------------------------------------------+ + +$template->assign_var_from_handle('ADMIN_CONTENT', 'advanced_feature'); + +?> diff --git a/admin/include/functions_history.inc.php b/admin/include/functions_history.inc.php index 1bdd96992..9504afab4 100644 --- a/admin/include/functions_history.inc.php +++ b/admin/include/functions_history.inc.php @@ -1,54 +1,54 @@ - array - ( - 'caption' => l10n('Statistics'), - 'url' => $link_start.'stats' - ), - 'history' => array - ( - 'caption' => l10n('Search'), - 'url' => $link_start.'history' - ) - ); - - $page['tabsheet'][$page['page']]['selected'] = true; - - // Assign tabsheet to template - template_assign_tabsheet(); -} - -?> + array + ( + 'caption' => l10n('Statistics'), + 'url' => $link_start.'stats' + ), + 'history' => array + ( + 'caption' => l10n('Search'), + 'url' => $link_start.'history' + ) + ); + + $page['tabsheet'][$page['page']]['selected'] = true; + + // Assign tabsheet to template + template_assign_tabsheet(); +} + +?> diff --git a/admin/include/functions_notification_by_mail.inc.php b/admin/include/functions_notification_by_mail.inc.php index a3e57639e..8af31caef 100644 --- a/admin/include/functions_notification_by_mail.inc.php +++ b/admin/include/functions_notification_by_mail.inc.php @@ -1,549 +1,549 @@ - get_moment(), - 'sendmail_timeout' => (intval(ini_get('max_execution_time')) * $conf['nbm_max_treatment_timeout_percent']), - 'is_sendmail_timeout' => false - ); - -if - ( - (!isset($env_nbm['sendmail_timeout'])) or - (!is_numeric($env_nbm['sendmail_timeout'])) or - ($env_nbm['sendmail_timeout'] <= 0) - ) -{ - $env_nbm['sendmail_timeout'] = $conf['nbm_treatment_timeout_default']; -} - -/* - * Search an available check_key - * - * It's a copy of function find_available_feed_id - * - * @return string nbm identifier - */ -function find_available_check_key() -{ - while (true) - { - $key = generate_key(16); - $query = ' -select - count(*) -from - '.USER_MAIL_NOTIFICATION_TABLE.' -where - check_key = \''.$key.'\';'; - - list($count) = mysql_fetch_row(pwg_query($query)); - if ($count == 0) - { - return $key; - } - } -} - -/* - * Check sendmail timeout state - * - * @return true, if it's timeout - */ -function check_sendmail_timeout() -{ - global $env_nbm; - - $env_nbm['is_sendmail_timeout'] = ((get_moment() - $env_nbm['start_time']) > $env_nbm['sendmail_timeout']); - - return $env_nbm['is_sendmail_timeout']; -} - - -/* - * Add quote to all elements of check_key_list - * - * @return quoted check key list - */ -function quote_check_key_list($check_key_list = array()) -{ - return array_map(create_function('$s', 'return \'\\\'\'.$s.\'\\\'\';'), $check_key_list); -} - -/* - * Execute all main queries to get list of user - * - * Type are the type of list 'subscribe', 'send' - * - * return array of users - */ -function get_user_notifications($action, $check_key_list = array(), $enabled_filter_value = '') -{ - global $conf; - - $data_users = array(); - - if (in_array($action, array('subscribe', 'send'))) - { - $quoted_check_key_list = quote_check_key_list($check_key_list); - if (count($quoted_check_key_list) != 0 ) - { - $query_and_check_key = ' and - check_key in ('.implode(",", $quoted_check_key_list).') '; - } - else - { - $query_and_check_key = ''; - } - - $query = ' -select - N.user_id, - N.check_key, - U.'.$conf['user_fields']['username'].' as username, - U.'.$conf['user_fields']['email'].' as mail_address, - N.enabled, - N.last_send -from - '.USER_MAIL_NOTIFICATION_TABLE.' as N, - '.USERS_TABLE.' as U -where - N.user_id = U.'.$conf['user_fields']['id']; - - if ($action == 'send') - { - // No mail empty and all users enabled - $query .= ' and - N.enabled = \'true\' and - U.'.$conf['user_fields']['email'].' is not null'; - } - - $query .= $query_and_check_key; - - if (isset($enabled_filter_value) and ($enabled_filter_value != '')) - { - $query .= ' and - N.enabled = \''.boolean_to_string($enabled_filter_value).'\''; - } - - $query .= ' -order by'; - - if ($action == 'send') - { - $query .= ' - last_send, username;'; - } - else - { - $query .= ' - username;'; - } - - $query .= ';'; - - $result = pwg_query($query); - if (!empty($result)) - { - while ($nbm_user = mysql_fetch_array($result)) - { - array_push($data_users, $nbm_user); - } - } - } - return $data_users; -} - -/* - * Begin of use nbm environment - * Prepare and save current environment and initialize data in order to send mail - * - * Return none - */ -function begin_users_env_nbm($is_to_send_mail = false) -{ - global $user, $lang, $lang_info, $conf, $env_nbm; - - // Save $user, $lang_info and $lang arrays (include/user.inc.php has been executed) - $env_nbm['save_user'] = $user; - $env_nbm['save_lang_info'] = $lang_info; - $env_nbm['save_lang'] = $lang; - // Last Language - $env_nbm['last_language'] = $user['language']; - - $env_nbm['is_to_send_mail'] = $is_to_send_mail; - - if ($is_to_send_mail) - { - // Init mail configuration - $env_nbm['email_format'] = get_str_email_format($conf['nbm_send_html_mail']); - $env_nbm['send_as_name'] = ((isset($conf['nbm_send_mail_as']) and !empty($conf['nbm_send_mail_as'])) ? $conf['nbm_send_mail_as'] : $conf['gallery_title']); - $env_nbm['send_as_mail_address'] = get_webmaster_mail_address(); - $env_nbm['send_as_mail_formated'] = format_email($env_nbm['send_as_name'], $env_nbm['send_as_mail_address']); - // Init mail counter - $env_nbm['error_on_mail_count'] = 0; - $env_nbm['sent_mail_count'] = 0; - // Save sendmail message info and error in the original language - $env_nbm['msg_info'] = l10n('nbm_msg_mail_sent_to'); - $env_nbm['msg_error'] = l10n('nbm_msg_error_sending_email_to'); - } -} - -/* - * End of use nbm environment - * Restore environment - * - * Return none - */ -function end_users_env_nbm() -{ - global $user, $lang, $lang_info, $env_nbm; - - // Restore $user, $lang_info and $lang arrays (include/user.inc.php has been executed) - $user = $env_nbm['save_user']; - $lang_info = $env_nbm['save_lang_info']; - $lang = $env_nbm['save_lang']; - - if ($env_nbm['is_to_send_mail']) - { - unset($env_nbm['email_format']); - unset($env_nbm['send_as_name']); - unset($env_nbm['send_as_mail_address']); - unset($env_nbm['send_as_mail_formated']); - // Don t unset counter - //unset($env_nbm['error_on_mail_count']); - //unset($env_nbm['sent_mail_count']); - unset($env_nbm['msg_info']); - unset($env_nbm['msg_error']); - } - - unset($env_nbm['save_user']); - unset($env_nbm['save_lang_info']); - unset($env_nbm['save_lang']); - unset($env_nbm['last_language']); - unset($env_nbm['is_to_send_mail']); - -} - -/* - * Set user on nbm enviromnent - * - * Return none - */ -function set_user_on_env_nbm(&$nbm_user, $is_action_send) -{ - global $user, $lang, $lang_info, $env_nbm; - - $user = build_user( $nbm_user['user_id'], true ); - - if ($env_nbm['last_language'] != $user['language']) - { - $env_nbm['last_language'] = $user['language']; - - // Re-Init language arrays - $lang_info = array(); - $lang = array(); - - // language files - include(get_language_filepath('common.lang.php')); - // No test admin because script is checked admin (user selected no) - // Translations are in admin file too - include(get_language_filepath('admin.lang.php')); - trigger_action('loading_lang'); - @include(get_language_filepath('local.lang.php')); - } - - if ($is_action_send) - { - $nbm_user['template'] = $user['template']; - $nbm_user['theme'] = $user['theme']; - $env_nbm['mail_template'] = - get_mail_template($env_nbm['email_format'], - array('template' => $nbm_user['template'], 'theme' => $nbm_user['theme'])); - $env_nbm['mail_template']->set_filename('notification_by_mail', 'admin/notification_by_mail.tpl'); - } -} - -/* - * Unset user on nbm enviromnent - * - * Return none - */ -function unset_user_on_env_nbm() -{ - global $env_nbm; - - unset($env_nbm['mail_template']); -} - -/* - * Inc Counter success - * - * Return none - */ -function inc_mail_sent_success($nbm_user) -{ - global $page, $env_nbm; - - $env_nbm['sent_mail_count'] += 1; - array_push($page['infos'], sprintf($env_nbm['msg_info'], $nbm_user['username'], $nbm_user['mail_address'])); -} - -/* - * Inc Counter failed - * - * Return none - */ -function inc_mail_sent_failed($nbm_user) -{ - global $page, $env_nbm; - - $env_nbm['error_on_mail_count'] += 1; - array_push($page['errors'], sprintf($env_nbm['msg_error'], $nbm_user['username'], $nbm_user['mail_address'])); -} - -/* - * Display Counter Info - * - * Return none - */ -function display_counter_info() -{ - global $page, $env_nbm; - - if ($env_nbm['error_on_mail_count'] != 0) - { - array_push($page['errors'], l10n_dec('nbm_msg_n_mail_not_send', 'nbm_msg_n_mails_not_send', $env_nbm['error_on_mail_count'])); - if ($env_nbm['sent_mail_count'] != 0) - array_push($page['infos'], l10n_dec('nbm_msg_n_mail_sent', 'nbm_msg_n_mails_sent', $env_nbm['sent_mail_count'])); - } - else - { - if ($env_nbm['sent_mail_count'] == 0) - array_push($page['infos'], l10n('nbm_no_mail_to_send')); - else - array_push($page['infos'], l10n_dec('nbm_msg_n_mail_sent', 'nbm_msg_n_mails_sent', $env_nbm['sent_mail_count'])); - } -} - -function assign_vars_nbm_mail_content($nbm_user) -{ - global $env_nbm; - - set_make_full_url(); - - $env_nbm['mail_template']->assign_vars - ( - array - ( - 'USERNAME' => $nbm_user['username'], - - 'SEND_AS_NAME' => $env_nbm['send_as_name'], - - 'UNSUBSCRIBE_LINK' => add_url_params(get_root_url().'nbm.php', array('unsubscribe' => $nbm_user['check_key'])), - 'SUBSCRIBE_LINK' => add_url_params(get_root_url().'nbm.php', array('subscribe' => $nbm_user['check_key'])), - 'CONTACT_EMAIL' => $env_nbm['send_as_mail_address'] - ) - ); - - unset_make_full_url(); -} - -/* - * Subscribe or unsubscribe notification by mail - * - * is_subscribe define if action=subscribe or unsubscribe - * check_key list where action will be done - * - * @return check_key list treated - */ -function do_subscribe_unsubscribe_notification_by_mail($is_admin_request, $is_subscribe = false, $check_key_list = array()) -{ - global $conf, $page, $env_nbm, $conf; - - $check_key_treated = array(); - $updated_data_count = 0; - $error_on_updated_data_count = 0; - - if ($is_subscribe) - { - $msg_info = l10n('nbm_user_change_enabled_true'); - $msg_error = l10n('nbm_user_not_change_enabled_true'); - } - else - { - $msg_info = l10n('nbm_user_change_enabled_false'); - $msg_error = l10n('nbm_user_not_change_enabled_false'); - } - - if (count($check_key_list) != 0) - { - $updates = array(); - $enabled_value = boolean_to_string($is_subscribe); - $data_users = get_user_notifications('subscribe', $check_key_list, !$is_subscribe); - - // Prepare message after change language - $msg_break_timeout = l10n('nbm_break_timeout_send_mail'); - - // Begin nbm users environment - begin_users_env_nbm(true); - - foreach ($data_users as $nbm_user) - { - if (check_sendmail_timeout()) - { - // Stop fill list on 'send', if the quota is override - array_push($page['errors'], $msg_break_timeout); - break; - } - - // Fill return list - array_push($check_key_treated, $nbm_user['check_key']); - - $do_update = true; - if ($nbm_user['mail_address'] != '') - { - // set env nbm user - set_user_on_env_nbm($nbm_user, true); - - $subject = '['.$conf['gallery_title'].']: '.($is_subscribe ? l10n('nbm_object_subscribe'): l10n('nbm_object_unsubscribe')); - - // Assign current var for nbm mail - assign_vars_nbm_mail_content($nbm_user); - - $section_action_by = ($is_subscribe ? 'subscribe_by_' : 'unsubscribe_by_'); - $section_action_by .= ($is_admin_request ? 'admin' : 'himself'); - $env_nbm['mail_template']->assign_block_vars - ( - $section_action_by, array('DUMMY' => 'dummy') - ); - - if (pwg_mail - ( - format_email($nbm_user['username'], $nbm_user['mail_address']), - array - ( - 'from' => $env_nbm['send_as_mail_formated'], - 'subject' => $subject, - 'email_format' => $env_nbm['email_format'], - 'content' => $env_nbm['mail_template']->parse('notification_by_mail', true), - 'content_format' => $env_nbm['email_format'], - 'template' => $nbm_user['template'], - 'theme' => $nbm_user['theme'] - ) - )) - { - inc_mail_sent_success($nbm_user); - } - else - { - inc_mail_sent_failed($nbm_user); - $do_update = false; - } - - // unset env nbm user - unset_user_on_env_nbm(); - - } - - if ($do_update) - { - array_push - ( - $updates, - array - ( - 'check_key' => $nbm_user['check_key'], - 'enabled' => $enabled_value - ) - ); - $updated_data_count += 1; - array_push($page['infos'], sprintf($msg_info, $nbm_user['username'], $nbm_user['mail_address'])); - } - else - { - $error_on_updated_data_count += 1; - array_push($page['errors'], sprintf($msg_error, $nbm_user['username'], $nbm_user['mail_address'])); - } - - } - - // Restore nbm environment - end_users_env_nbm(); - - display_counter_info(); - - mass_updates( - USER_MAIL_NOTIFICATION_TABLE, - array( - 'primary' => array('check_key'), - 'update' => array('enabled') - ), - $updates - ); - - } - - array_push($page['infos'], l10n_dec('nbm_user_change_enabled_updated_data_count', 'nbm_users_change_enabled_updated_data_count', $updated_data_count)); - if ($error_on_updated_data_count != 0) - { - array_push($page['errors'], - l10n_dec('nbm_user_change_enabled_error_on_updated_data_count', - 'nbm_users_change_enabled_error_on_updated_data_count', - $error_on_updated_data_count)); - } - - return $check_key_treated; -} - -/* - * Unsubscribe notification by mail - * - * check_key list where action will be done - * - * @return check_key list treated - */ -function unsubscribe_notification_by_mail($is_admin_request, $check_key_list = array()) -{ - return do_subscribe_unsubscribe_notification_by_mail($is_admin_request, false, $check_key_list); -} - -/* - * Subscribe notification by mail - * - * check_key list where action will be done - * - * @return check_key list treated - */ -function subscribe_notification_by_mail($is_admin_request, $check_key_list = array()) -{ - return do_subscribe_unsubscribe_notification_by_mail($is_admin_request, true, $check_key_list); -} - -?> + get_moment(), + 'sendmail_timeout' => (intval(ini_get('max_execution_time')) * $conf['nbm_max_treatment_timeout_percent']), + 'is_sendmail_timeout' => false + ); + +if + ( + (!isset($env_nbm['sendmail_timeout'])) or + (!is_numeric($env_nbm['sendmail_timeout'])) or + ($env_nbm['sendmail_timeout'] <= 0) + ) +{ + $env_nbm['sendmail_timeout'] = $conf['nbm_treatment_timeout_default']; +} + +/* + * Search an available check_key + * + * It's a copy of function find_available_feed_id + * + * @return string nbm identifier + */ +function find_available_check_key() +{ + while (true) + { + $key = generate_key(16); + $query = ' +select + count(*) +from + '.USER_MAIL_NOTIFICATION_TABLE.' +where + check_key = \''.$key.'\';'; + + list($count) = mysql_fetch_row(pwg_query($query)); + if ($count == 0) + { + return $key; + } + } +} + +/* + * Check sendmail timeout state + * + * @return true, if it's timeout + */ +function check_sendmail_timeout() +{ + global $env_nbm; + + $env_nbm['is_sendmail_timeout'] = ((get_moment() - $env_nbm['start_time']) > $env_nbm['sendmail_timeout']); + + return $env_nbm['is_sendmail_timeout']; +} + + +/* + * Add quote to all elements of check_key_list + * + * @return quoted check key list + */ +function quote_check_key_list($check_key_list = array()) +{ + return array_map(create_function('$s', 'return \'\\\'\'.$s.\'\\\'\';'), $check_key_list); +} + +/* + * Execute all main queries to get list of user + * + * Type are the type of list 'subscribe', 'send' + * + * return array of users + */ +function get_user_notifications($action, $check_key_list = array(), $enabled_filter_value = '') +{ + global $conf; + + $data_users = array(); + + if (in_array($action, array('subscribe', 'send'))) + { + $quoted_check_key_list = quote_check_key_list($check_key_list); + if (count($quoted_check_key_list) != 0 ) + { + $query_and_check_key = ' and + check_key in ('.implode(",", $quoted_check_key_list).') '; + } + else + { + $query_and_check_key = ''; + } + + $query = ' +select + N.user_id, + N.check_key, + U.'.$conf['user_fields']['username'].' as username, + U.'.$conf['user_fields']['email'].' as mail_address, + N.enabled, + N.last_send +from + '.USER_MAIL_NOTIFICATION_TABLE.' as N, + '.USERS_TABLE.' as U +where + N.user_id = U.'.$conf['user_fields']['id']; + + if ($action == 'send') + { + // No mail empty and all users enabled + $query .= ' and + N.enabled = \'true\' and + U.'.$conf['user_fields']['email'].' is not null'; + } + + $query .= $query_and_check_key; + + if (isset($enabled_filter_value) and ($enabled_filter_value != '')) + { + $query .= ' and + N.enabled = \''.boolean_to_string($enabled_filter_value).'\''; + } + + $query .= ' +order by'; + + if ($action == 'send') + { + $query .= ' + last_send, username;'; + } + else + { + $query .= ' + username;'; + } + + $query .= ';'; + + $result = pwg_query($query); + if (!empty($result)) + { + while ($nbm_user = mysql_fetch_array($result)) + { + array_push($data_users, $nbm_user); + } + } + } + return $data_users; +} + +/* + * Begin of use nbm environment + * Prepare and save current environment and initialize data in order to send mail + * + * Return none + */ +function begin_users_env_nbm($is_to_send_mail = false) +{ + global $user, $lang, $lang_info, $conf, $env_nbm; + + // Save $user, $lang_info and $lang arrays (include/user.inc.php has been executed) + $env_nbm['save_user'] = $user; + $env_nbm['save_lang_info'] = $lang_info; + $env_nbm['save_lang'] = $lang; + // Last Language + $env_nbm['last_language'] = $user['language']; + + $env_nbm['is_to_send_mail'] = $is_to_send_mail; + + if ($is_to_send_mail) + { + // Init mail configuration + $env_nbm['email_format'] = get_str_email_format($conf['nbm_send_html_mail']); + $env_nbm['send_as_name'] = ((isset($conf['nbm_send_mail_as']) and !empty($conf['nbm_send_mail_as'])) ? $conf['nbm_send_mail_as'] : $conf['gallery_title']); + $env_nbm['send_as_mail_address'] = get_webmaster_mail_address(); + $env_nbm['send_as_mail_formated'] = format_email($env_nbm['send_as_name'], $env_nbm['send_as_mail_address']); + // Init mail counter + $env_nbm['error_on_mail_count'] = 0; + $env_nbm['sent_mail_count'] = 0; + // Save sendmail message info and error in the original language + $env_nbm['msg_info'] = l10n('nbm_msg_mail_sent_to'); + $env_nbm['msg_error'] = l10n('nbm_msg_error_sending_email_to'); + } +} + +/* + * End of use nbm environment + * Restore environment + * + * Return none + */ +function end_users_env_nbm() +{ + global $user, $lang, $lang_info, $env_nbm; + + // Restore $user, $lang_info and $lang arrays (include/user.inc.php has been executed) + $user = $env_nbm['save_user']; + $lang_info = $env_nbm['save_lang_info']; + $lang = $env_nbm['save_lang']; + + if ($env_nbm['is_to_send_mail']) + { + unset($env_nbm['email_format']); + unset($env_nbm['send_as_name']); + unset($env_nbm['send_as_mail_address']); + unset($env_nbm['send_as_mail_formated']); + // Don t unset counter + //unset($env_nbm['error_on_mail_count']); + //unset($env_nbm['sent_mail_count']); + unset($env_nbm['msg_info']); + unset($env_nbm['msg_error']); + } + + unset($env_nbm['save_user']); + unset($env_nbm['save_lang_info']); + unset($env_nbm['save_lang']); + unset($env_nbm['last_language']); + unset($env_nbm['is_to_send_mail']); + +} + +/* + * Set user on nbm enviromnent + * + * Return none + */ +function set_user_on_env_nbm(&$nbm_user, $is_action_send) +{ + global $user, $lang, $lang_info, $env_nbm; + + $user = build_user( $nbm_user['user_id'], true ); + + if ($env_nbm['last_language'] != $user['language']) + { + $env_nbm['last_language'] = $user['language']; + + // Re-Init language arrays + $lang_info = array(); + $lang = array(); + + // language files + include(get_language_filepath('common.lang.php')); + // No test admin because script is checked admin (user selected no) + // Translations are in admin file too + include(get_language_filepath('admin.lang.php')); + trigger_action('loading_lang'); + @include(get_language_filepath('local.lang.php')); + } + + if ($is_action_send) + { + $nbm_user['template'] = $user['template']; + $nbm_user['theme'] = $user['theme']; + $env_nbm['mail_template'] = + get_mail_template($env_nbm['email_format'], + array('template' => $nbm_user['template'], 'theme' => $nbm_user['theme'])); + $env_nbm['mail_template']->set_filename('notification_by_mail', 'admin/notification_by_mail.tpl'); + } +} + +/* + * Unset user on nbm enviromnent + * + * Return none + */ +function unset_user_on_env_nbm() +{ + global $env_nbm; + + unset($env_nbm['mail_template']); +} + +/* + * Inc Counter success + * + * Return none + */ +function inc_mail_sent_success($nbm_user) +{ + global $page, $env_nbm; + + $env_nbm['sent_mail_count'] += 1; + array_push($page['infos'], sprintf($env_nbm['msg_info'], $nbm_user['username'], $nbm_user['mail_address'])); +} + +/* + * Inc Counter failed + * + * Return none + */ +function inc_mail_sent_failed($nbm_user) +{ + global $page, $env_nbm; + + $env_nbm['error_on_mail_count'] += 1; + array_push($page['errors'], sprintf($env_nbm['msg_error'], $nbm_user['username'], $nbm_user['mail_address'])); +} + +/* + * Display Counter Info + * + * Return none + */ +function display_counter_info() +{ + global $page, $env_nbm; + + if ($env_nbm['error_on_mail_count'] != 0) + { + array_push($page['errors'], l10n_dec('nbm_msg_n_mail_not_send', 'nbm_msg_n_mails_not_send', $env_nbm['error_on_mail_count'])); + if ($env_nbm['sent_mail_count'] != 0) + array_push($page['infos'], l10n_dec('nbm_msg_n_mail_sent', 'nbm_msg_n_mails_sent', $env_nbm['sent_mail_count'])); + } + else + { + if ($env_nbm['sent_mail_count'] == 0) + array_push($page['infos'], l10n('nbm_no_mail_to_send')); + else + array_push($page['infos'], l10n_dec('nbm_msg_n_mail_sent', 'nbm_msg_n_mails_sent', $env_nbm['sent_mail_count'])); + } +} + +function assign_vars_nbm_mail_content($nbm_user) +{ + global $env_nbm; + + set_make_full_url(); + + $env_nbm['mail_template']->assign_vars + ( + array + ( + 'USERNAME' => $nbm_user['username'], + + 'SEND_AS_NAME' => $env_nbm['send_as_name'], + + 'UNSUBSCRIBE_LINK' => add_url_params(get_root_url().'nbm.php', array('unsubscribe' => $nbm_user['check_key'])), + 'SUBSCRIBE_LINK' => add_url_params(get_root_url().'nbm.php', array('subscribe' => $nbm_user['check_key'])), + 'CONTACT_EMAIL' => $env_nbm['send_as_mail_address'] + ) + ); + + unset_make_full_url(); +} + +/* + * Subscribe or unsubscribe notification by mail + * + * is_subscribe define if action=subscribe or unsubscribe + * check_key list where action will be done + * + * @return check_key list treated + */ +function do_subscribe_unsubscribe_notification_by_mail($is_admin_request, $is_subscribe = false, $check_key_list = array()) +{ + global $conf, $page, $env_nbm, $conf; + + $check_key_treated = array(); + $updated_data_count = 0; + $error_on_updated_data_count = 0; + + if ($is_subscribe) + { + $msg_info = l10n('nbm_user_change_enabled_true'); + $msg_error = l10n('nbm_user_not_change_enabled_true'); + } + else + { + $msg_info = l10n('nbm_user_change_enabled_false'); + $msg_error = l10n('nbm_user_not_change_enabled_false'); + } + + if (count($check_key_list) != 0) + { + $updates = array(); + $enabled_value = boolean_to_string($is_subscribe); + $data_users = get_user_notifications('subscribe', $check_key_list, !$is_subscribe); + + // Prepare message after change language + $msg_break_timeout = l10n('nbm_break_timeout_send_mail'); + + // Begin nbm users environment + begin_users_env_nbm(true); + + foreach ($data_users as $nbm_user) + { + if (check_sendmail_timeout()) + { + // Stop fill list on 'send', if the quota is override + array_push($page['errors'], $msg_break_timeout); + break; + } + + // Fill return list + array_push($check_key_treated, $nbm_user['check_key']); + + $do_update = true; + if ($nbm_user['mail_address'] != '') + { + // set env nbm user + set_user_on_env_nbm($nbm_user, true); + + $subject = '['.$conf['gallery_title'].']: '.($is_subscribe ? l10n('nbm_object_subscribe'): l10n('nbm_object_unsubscribe')); + + // Assign current var for nbm mail + assign_vars_nbm_mail_content($nbm_user); + + $section_action_by = ($is_subscribe ? 'subscribe_by_' : 'unsubscribe_by_'); + $section_action_by .= ($is_admin_request ? 'admin' : 'himself'); + $env_nbm['mail_template']->assign_block_vars + ( + $section_action_by, array('DUMMY' => 'dummy') + ); + + if (pwg_mail + ( + format_email($nbm_user['username'], $nbm_user['mail_address']), + array + ( + 'from' => $env_nbm['send_as_mail_formated'], + 'subject' => $subject, + 'email_format' => $env_nbm['email_format'], + 'content' => $env_nbm['mail_template']->parse('notification_by_mail', true), + 'content_format' => $env_nbm['email_format'], + 'template' => $nbm_user['template'], + 'theme' => $nbm_user['theme'] + ) + )) + { + inc_mail_sent_success($nbm_user); + } + else + { + inc_mail_sent_failed($nbm_user); + $do_update = false; + } + + // unset env nbm user + unset_user_on_env_nbm(); + + } + + if ($do_update) + { + array_push + ( + $updates, + array + ( + 'check_key' => $nbm_user['check_key'], + 'enabled' => $enabled_value + ) + ); + $updated_data_count += 1; + array_push($page['infos'], sprintf($msg_info, $nbm_user['username'], $nbm_user['mail_address'])); + } + else + { + $error_on_updated_data_count += 1; + array_push($page['errors'], sprintf($msg_error, $nbm_user['username'], $nbm_user['mail_address'])); + } + + } + + // Restore nbm environment + end_users_env_nbm(); + + display_counter_info(); + + mass_updates( + USER_MAIL_NOTIFICATION_TABLE, + array( + 'primary' => array('check_key'), + 'update' => array('enabled') + ), + $updates + ); + + } + + array_push($page['infos'], l10n_dec('nbm_user_change_enabled_updated_data_count', 'nbm_users_change_enabled_updated_data_count', $updated_data_count)); + if ($error_on_updated_data_count != 0) + { + array_push($page['errors'], + l10n_dec('nbm_user_change_enabled_error_on_updated_data_count', + 'nbm_users_change_enabled_error_on_updated_data_count', + $error_on_updated_data_count)); + } + + return $check_key_treated; +} + +/* + * Unsubscribe notification by mail + * + * check_key list where action will be done + * + * @return check_key list treated + */ +function unsubscribe_notification_by_mail($is_admin_request, $check_key_list = array()) +{ + return do_subscribe_unsubscribe_notification_by_mail($is_admin_request, false, $check_key_list); +} + +/* + * Subscribe notification by mail + * + * check_key list where action will be done + * + * @return check_key list treated + */ +function subscribe_notification_by_mail($is_admin_request, $check_key_list = array()) +{ + return do_subscribe_unsubscribe_notification_by_mail($is_admin_request, true, $check_key_list); +} + +?> diff --git a/admin/include/functions_tabsheet.inc.php b/admin/include/functions_tabsheet.inc.php index 9952769f3..1f7dbc0d9 100644 --- a/admin/include/functions_tabsheet.inc.php +++ b/admin/include/functions_tabsheet.inc.php @@ -1,74 +1,74 @@ - 0) - { - $template->set_filename('tabsheet', 'admin/tabsheet.tpl'); - - foreach ($page['tabsheet'] as $tab_name => $tab) - { - $is_selected = isset($tab['selected']) and $tab['selected'] === true; - $template->assign_block_vars - ( - 'tab', - array - ( - 'CLASSNAME' => ($is_selected ? 'selected_tab' : 'normal_tab'), - 'URL' => $tab['url'], - 'CAPTION' => $tab['caption'] - ) - ); - - if ($is_selected) - { - $template->assign_vars( - array('TABSHEET_TITLE' => '['.$tab['caption'].']')); - } - } - - $template->assign_var_from_handle('TABSHEET', 'tabsheet'); - } -} - -?> + 0) + { + $template->set_filename('tabsheet', 'admin/tabsheet.tpl'); + + foreach ($page['tabsheet'] as $tab_name => $tab) + { + $is_selected = isset($tab['selected']) and $tab['selected'] === true; + $template->assign_block_vars + ( + 'tab', + array + ( + 'CLASSNAME' => ($is_selected ? 'selected_tab' : 'normal_tab'), + 'URL' => $tab['url'], + 'CAPTION' => $tab['caption'] + ) + ); + + if ($is_selected) + { + $template->assign_vars( + array('TABSHEET_TITLE' => '['.$tab['caption'].']')); + } + } + + $template->assign_var_from_handle('TABSHEET', 'tabsheet'); + } +} + +?> diff --git a/include/functions_filter.inc.php b/include/functions_filter.inc.php index 12d8c051c..d2e3b5325 100644 --- a/include/functions_filter.inc.php +++ b/include/functions_filter.inc.php @@ -1,66 +1,66 @@ - $category) - { - foreach ($upd_fields as $upd_field) - { - $cats[$cat_id][$upd_field] = $filter['categories'][$category['id']][$upd_field]; - } - } - } -} - -?> + $category) + { + foreach ($upd_fields as $upd_field) + { + $cats[$cat_id][$upd_field] = $filter['categories'][$category['id']][$upd_field]; + } + } + } +} + +?> diff --git a/install/db/40-database.php b/install/db/40-database.php index 99779822f..d6f2ae6d1 100644 --- a/install/db/40-database.php +++ b/install/db/40-database.php @@ -1,44 +1,44 @@ - + diff --git a/install/db/41-database.php b/install/db/41-database.php index 42d0bae12..b55fe49bc 100644 --- a/install/db/41-database.php +++ b/install/db/41-database.php @@ -1,65 +1,65 @@ - + diff --git a/language/en_UK.iso-8859-1/help/advanced_feature.html b/language/en_UK.iso-8859-1/help/advanced_feature.html index 59b28616e..2fd5341fb 100644 --- a/language/en_UK.iso-8859-1/help/advanced_feature.html +++ b/language/en_UK.iso-8859-1/help/advanced_feature.html @@ -1,16 +1,16 @@ -

Advanced features

- -

List special functionnalties for expert PWG administrator:

- - +

Advanced features

+ +

List special functionnalties for expert PWG administrator:

+ + diff --git a/language/en_UK.iso-8859-1/help/group_list.html b/language/en_UK.iso-8859-1/help/group_list.html index e76094cae..e918f2e5a 100644 --- a/language/en_UK.iso-8859-1/help/group_list.html +++ b/language/en_UK.iso-8859-1/help/group_list.html @@ -1,22 +1,22 @@ -

Groups list

- -

This is the place where you can manage defined groups.

- -

Add a group

- -

Administrator can add groups.

- -

Groupes list

- -

The list allows for each element to:

- - - - -

Default groups

+

Groups list

+ +

This is the place where you can manage defined groups.

+ +

Add a group

+ +

Administrator can add groups.

+ +

Groupes list

+ +

The list allows for each element to:

+ + + + +

Default groups

Default groups are groups associated automatically to new user.

\ No newline at end of file diff --git a/language/en_UK.iso-8859-1/help/web_service.html b/language/en_UK.iso-8859-1/help/web_service.html index 4e71c13bf..e106a35cb 100644 --- a/language/en_UK.iso-8859-1/help/web_service.html +++ b/language/en_UK.iso-8859-1/help/web_service.html @@ -1,47 +1,47 @@ -

Web Service Checker

- -

This page let you define all parameters for your web service.

- -
- -
Environment setting
- -
If Web Service access control is active (Advanced configuration => $conf['ws_access_control']) - you will see there all Advanced configuration related to Web Service.
- -
Confidential partner key (Mandatory)
- -
Unique key to share with your partner. Keep that one long enough (e.g. 8 characters). - Keep it as complex enough (mixed figures, upper and lower case characters, special characters). - For example: "P!e2r!k Le G@2l". - - Hidden to anyone in adviser mode. - -
Target (Optional)
- -
Can be an image id list like that:
  • - list/277,275,142,235,178,190,204,236-238,253,268,276,285,41,73
  • - a category id list as : cat/16,32,21
  • - or a tag id list as: tag/22,61,36
- all id list will be reduced to the min list as:
  • - list/41,73,142,178,190,204,235-238,253,268,275-277,285
-
- -
Restrict access (Optional)
- -
If you want to limit your partner to a specific request.
- -
Returned images limit
- -
Images limit count: to return to your partner for each request.
- -
Duration
- -
From now, set availability in days. If you postpone over the duration, the service would never be available.
- -
Comment
- -
Let you describe who's behind this Web Service, be clear enough. - Don't forget that if someone is Admin and Adviser on your website. He can read this comment zone.
- -
+

Web Service Checker

+ +

This page let you define all parameters for your web service.

+ +
+ +
Environment setting
+ +
If Web Service access control is active (Advanced configuration => $conf['ws_access_control']) + you will see there all Advanced configuration related to Web Service.
+ +
Confidential partner key (Mandatory)
+ +
Unique key to share with your partner. Keep that one long enough (e.g. 8 characters). + Keep it as complex enough (mixed figures, upper and lower case characters, special characters). + For example: "P!e2r!k Le G@2l". + + Hidden to anyone in adviser mode. + +
Target (Optional)
+ +
Can be an image id list like that:
  • + list/277,275,142,235,178,190,204,236-238,253,268,276,285,41,73
  • + a category id list as : cat/16,32,21
  • + or a tag id list as: tag/22,61,36
+ all id list will be reduced to the min list as:
  • + list/41,73,142,178,190,204,235-238,253,268,275-277,285
+
+ +
Restrict access (Optional)
+ +
If you want to limit your partner to a specific request.
+ +
Returned images limit
+ +
Images limit count: to return to your partner for each request.
+ +
Duration
+ +
From now, set availability in days. If you postpone over the duration, the service would never be available.
+ +
Comment
+ +
Let you describe who's behind this Web Service, be clear enough. + Don't forget that if someone is Admin and Adviser on your website. He can read this comment zone.
+ +
diff --git a/language/fr_FR.iso-8859-1/help/advanced_feature.html b/language/fr_FR.iso-8859-1/help/advanced_feature.html index fb5fbd5b6..8d0d03fec 100644 --- a/language/fr_FR.iso-8859-1/help/advanced_feature.html +++ b/language/fr_FR.iso-8859-1/help/advanced_feature.html @@ -1,16 +1,16 @@ -

Fonctions avancées

- -

Liste des fonctionnalités spéciales pour les administrateurs experts de PWG:

- - +

Fonctions avancées

+ +

Liste des fonctionnalités spéciales pour les administrateurs experts de PWG:

+ + diff --git a/language/fr_FR.iso-8859-1/help/group_list.html b/language/fr_FR.iso-8859-1/help/group_list.html index 321a87e3e..6848d6743 100644 --- a/language/fr_FR.iso-8859-1/help/group_list.html +++ b/language/fr_FR.iso-8859-1/help/group_list.html @@ -1,21 +1,21 @@ -

Liste des groupes

- -

Manipulation des propriétés des groupes définis.

- -

Ajouter un groupe

- -

L'administrateur peut ajouter des groupes.

- -

Liste des groupes

- -

La liste permet pour chaque groupe:

- - - -

Groupes par défaut

+

Liste des groupes

+ +

Manipulation des propriétés des groupes définis.

+ +

Ajouter un groupe

+ +

L'administrateur peut ajouter des groupes.

+ +

Liste des groupes

+ +

La liste permet pour chaque groupe:

+ + + +

Groupes par défaut

Les groupes par défaut sont les groupes associés automatiquement à chaque nouvel utilisateur.

\ No newline at end of file diff --git a/language/fr_FR.iso-8859-1/help/web_service.html b/language/fr_FR.iso-8859-1/help/web_service.html index 944ff4b34..bf420456e 100644 --- a/language/fr_FR.iso-8859-1/help/web_service.html +++ b/language/fr_FR.iso-8859-1/help/web_service.html @@ -1,48 +1,48 @@ -

Web Service Checker

- -

Cette page permet de définir les paramètres de votre web service.

- -
- -
Conditions de fonctionnement
- -
Si l'accès aux Web Services est contrôlé (Configuration avancée => $conf['ws_access_control']) - vous trouverez ici toutes les valeurs de la configuration avancée relative aux Web Services.
- -
Clé confidentielle (Obligatoire)
- -
Clé unique à partager avec votre partenaire. Doit être assez longue ( 8 caractères par exemple), - doit être assez complexe (avec des chiffres, des majuscules et minuscules, et des caractères spéciaux). - Par exemple: "P!e2r!k Le G@2l". - - Ce champ est masqué en mode conseillé. - -
Cible (Facultatif)
- -
Soit une liste d'identifiants d'images ceci:
  • - list/277,275,142,235,178,190,204,236-238,253,268,276,285,41,73
  • - une liste de catégories comme : cat/16,32,21
  • - ou encore une liste de tags : tag/22,61,36
- Tout liste d'identifiants sera réduite a sa plus simple expression:
  • - list/41,73,142,178,190,204,235-238,253,268,275-277,285
- -
- -
Accès restreint (Facultatif)
- -
Si vous souhaitez limiter votre partenaire à un type de requête particulier.
- -
Limite de transmision
- -
Nombre d'images maximum adressées à votre partenaire à chacune de ses requêtes.
- -
Durée
- -
A partir de maintenant, indiquez la disponibilité en jours. Si vous reportez la disponibilité au delà de sa durée, le service ne devrait jamais être rendu.
- -
Commentaire
- -
Vous permet de décrire qui se trouve derrière ce Service Web, de façon plus claire pour vous. - N'oubliez pas qu'un Administrateur en mode conseiller peut lire le contenu de ce commentaire.
- -
+

Web Service Checker

+ +

Cette page permet de définir les paramètres de votre web service.

+ +
+ +
Conditions de fonctionnement
+ +
Si l'accès aux Web Services est contrôlé (Configuration avancée => $conf['ws_access_control']) + vous trouverez ici toutes les valeurs de la configuration avancée relative aux Web Services.
+ +
Clé confidentielle (Obligatoire)
+ +
Clé unique à partager avec votre partenaire. Doit être assez longue ( 8 caractères par exemple), + doit être assez complexe (avec des chiffres, des majuscules et minuscules, et des caractères spéciaux). + Par exemple: "P!e2r!k Le G@2l". + + Ce champ est masqué en mode conseillé. + +
Cible (Facultatif)
+ +
Soit une liste d'identifiants d'images ceci:
  • + list/277,275,142,235,178,190,204,236-238,253,268,276,285,41,73
  • + une liste de catégories comme : cat/16,32,21
  • + ou encore une liste de tags : tag/22,61,36
+ Tout liste d'identifiants sera réduite a sa plus simple expression:
  • + list/41,73,142,178,190,204,235-238,253,268,275-277,285
+ +
+ +
Accès restreint (Facultatif)
+ +
Si vous souhaitez limiter votre partenaire à un type de requête particulier.
+ +
Limite de transmision
+ +
Nombre d'images maximum adressées à votre partenaire à chacune de ses requêtes.
+ +
Durée
+ +
A partir de maintenant, indiquez la disponibilité en jours. Si vous reportez la disponibilité au delà de sa durée, le service ne devrait jamais être rendu.
+ +
Commentaire
+ +
Vous permet de décrire qui se trouve derrière ce Service Web, de façon plus claire pour vous. + N'oubliez pas qu'un Administrateur en mode conseiller peut lire le contenu de ce commentaire.
+ +
diff --git a/plugins/add_index/admin/main_page.tpl b/plugins/add_index/admin/main_page.tpl index 155151851..ecdd3edf1 100644 --- a/plugins/add_index/admin/main_page.tpl +++ b/plugins/add_index/admin/main_page.tpl @@ -1,14 +1,14 @@ - -
-

{lang:Add_Index}

-
- - -
- -
- + +
+

{lang:Add_Index}

+
+ + +
+ +
+ diff --git a/plugins/add_index/index.php b/plugins/add_index/index.php index f0ba36fa3..083b24edf 100644 --- a/plugins/add_index/index.php +++ b/plugins/add_index/index.php @@ -1,35 +1,35 @@ - + diff --git a/plugins/add_index/language/en_UK.iso-8859-1/help/advanced_feature.html b/plugins/add_index/language/en_UK.iso-8859-1/help/advanced_feature.html index 5724d5d1b..00d15b57c 100644 --- a/plugins/add_index/language/en_UK.iso-8859-1/help/advanced_feature.html +++ b/plugins/add_index/language/en_UK.iso-8859-1/help/advanced_feature.html @@ -1,7 +1,7 @@ -

Functionality of AddIndex plugin:

-