diff options
author | rvelices <rv-github@modusoptimus.com> | 2010-05-28 19:55:03 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2010-05-28 19:55:03 +0000 |
commit | 1b90ca176434d9e57b8be750216eb637b4685b47 (patch) | |
tree | 2ad024e45e0bf98f7d0f545e06081b8ba5df82d2 /include | |
parent | f0d6ec33ce231f77077ba6535ca8312286f9a40b (diff) |
- merged the linkroot integration with the existing gallery_url (unique $conf['gallery_url'] used for RSS, mail homepage root in the browse path)
- added an option $conf['debug_mail'] - if set all outgoing mails are saved into local_data_dir
git-svn-id: http://piwigo.org/svn/branches/2.1@6410 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r-- | include/config_default.inc.php | 11 | ||||
-rw-r--r-- | include/functions_mail.inc.php | 43 | ||||
-rw-r--r-- | include/functions_url.inc.php | 21 | ||||
-rw-r--r-- | include/section_init.inc.php | 35 |
4 files changed, 51 insertions, 59 deletions
diff --git a/include/config_default.inc.php b/include/config_default.inc.php index 360bac36a..f57407945 100644 --- a/include/config_default.inc.php +++ b/include/config_default.inc.php @@ -328,19 +328,13 @@ $conf['double_password_type_in_admin'] = false; // Define if logins must be case sentitive or not at users registration. ie : // If set true, the login "user" will equal "User" or "USER" or "user", // etc. ... And it will be impossible to use such login variation to create a -// new user account. +// new user account. $conf['insensitive_case_logon'] = false; // how should we check for unicity when adding a photo. Can be 'md5sum' or // 'filename' $conf['uniqueness_mode'] = 'md5sum'; -// home_page : relative url of the homepage. Empty by default. -// It points to the index of the gallery. -// This parameter is used if home page is not index.php of the gallery. -// We suggest avoid the names "index.htm" or "index.html" if you set $conf['php_extension_in_urls'] to false. -$conf['home_page'] = ''; - // +-----------------------------------------------------------------------+ // | metadata | // +-----------------------------------------------------------------------+ @@ -464,6 +458,9 @@ $conf['debug_l10n'] = false; // activate template debugging - a new window will appear $conf['debug_template'] = false; +// save copies of sent mails into local data dir +$conf['debug_mail'] = false; + // die_on_sql_error: if an SQL query fails, should everything stop? $conf['die_on_sql_error'] = true; diff --git a/include/functions_mail.inc.php b/include/functions_mail.inc.php index 49eac6137..83e7f0b91 100644 --- a/include/functions_mail.inc.php +++ b/include/functions_mail.inc.php @@ -150,38 +150,6 @@ function get_strict_email_list($email_list) return implode(',', $result); } -/** - * Returns an completed array template/theme - * completed with get_default_theme() - * - * @params: - * - args: incompleted array of template/theme - * o template: template to use [default get_default_theme()] - * o theme: template to use [default get_default_theme()] - */ -function get_array_template_theme($args = array()) -{ - global $conf; - - $res = array(); - - if (empty($args['template']) or empty($args['theme'])) - { - list($res['template'], $res['theme']) = explode('/', get_default_theme()); - } - - if (!empty($args['template'])) - { - $res['template'] = $args['template']; - } - - if (!empty($args['theme'])) - { - $res['theme'] = $args['theme']; - } - - return $res; -} /** * Return an new mail template @@ -641,9 +609,7 @@ function pwg_mail($to, $args = array()) 'CONTENT_ENCODING' => get_pwg_charset(), // Footer - 'GALLERY_URL' => - isset($page['gallery_url']) ? - $page['gallery_url'] : $conf['gallery_url'], + 'GALLERY_URL' => get_gallery_home_url(), 'GALLERY_TITLE' => isset($page['gallery_title']) ? $page['gallery_title'] : $conf['gallery_title'], @@ -828,13 +794,13 @@ function move_ccs_rules_to_body($content) } /*Testing block*/ -/*function pwg_send_mail_test($result, $to, $subject, $content, $headers, $args) +function pwg_send_mail_test($result, $to, $subject, $content, $headers, $args) { global $conf, $user, $lang_info; $dir = $conf['local_data_dir'].'/tmp'; if ( mkgetdir( $dir, MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR) ) { - $filename = $dir.'/mail.'.stripslashes($user['username']).'.'.$lang_info['code'].'.'.$args['template'].'.'.$args['theme']; + $filename = $dir.'/mail.'.stripslashes($user['username']).'.'.$lang_info['code'].'.'.$args['theme'].'-'.date('YmdHis'); if ($args['content_format'] == 'text/plain') { $filename .= '.txt'; @@ -852,7 +818,8 @@ function move_ccs_rules_to_body($content) } return $result; } -add_event_handler('send_mail', 'pwg_send_mail_test', EVENT_HANDLER_PRIORITY_NEUTRAL+10, 6);*/ +if ($conf['debug_mail']) + add_event_handler('send_mail', 'pwg_send_mail_test', EVENT_HANDLER_PRIORITY_NEUTRAL+10, 6); add_event_handler('send_mail', 'pwg_send_mail', EVENT_HANDLER_PRIORITY_NEUTRAL, 5); diff --git a/include/functions_url.inc.php b/include/functions_url.inc.php index a23dd23ed..fe4e5f5e0 100644 --- a/include/functions_url.inc.php +++ b/include/functions_url.inc.php @@ -58,7 +58,7 @@ function get_absolute_root_url($with_scheme=true) $url = ''; if ($with_scheme) { - if (isset($_SERVER['HTTPS']) && + if (isset($_SERVER['HTTPS']) && ((strtolower($_SERVER['HTTPS']) == 'on') or ($_SERVER['HTTPS'] == 1))) { $url .= 'https://'; @@ -727,4 +727,23 @@ function embellish_url($url) return $url; } +/** + * Returns the 'home page' of this gallery + */ +function get_gallery_home_url() +{ + global $conf; + if (!empty($conf['gallery_url'])) + { + if (url_is_remote($conf['gallery_url']) or strncmp($conf['gallery_url'], '/', 1)==0) + { + return $conf['gallery_url']; + } + return get_root_url().$conf['gallery_url']; + } + else + { + return make_index_url(); + } +} ?>
\ No newline at end of file diff --git a/include/section_init.inc.php b/include/section_init.inc.php index b43b678f7..339c0ef5d 100644 --- a/include/section_init.inc.php +++ b/include/section_init.inc.php @@ -219,8 +219,6 @@ $forbidden = get_sql_condition_FandF( // +-----------------------------------------------------------------------+ if ('categories' == $page['section']) { - $page['title'] = '<a href="'.get_absolute_root_url().$conf['home_page'].'">'.l10n('Home').'</a>'; - if (isset($page['category'])) { $page = array_merge( @@ -232,11 +230,12 @@ if ('categories' == $page['section']) $page['category']['comment'], 'main_page_category_description' ), - 'title' => - $page['title'].$conf['level_separator'].get_cat_display_name($page['category']['upper_names'], '', false), + 'title' => get_cat_display_name($page['category']['upper_names'], '', false), ) ); } + else + $page['title'] = ''; // will be set later if ( @@ -336,7 +335,7 @@ SELECT DISTINCT image_id'.get_extra_fields($conf['order_by']).' $page = array_merge( $page, array( - 'title' => '<a href="'.get_absolute_root_url().$conf['home_page'].'">'.l10n('Home').'</a>'.$conf['level_separator'].get_tags_content_title(), + 'title' => get_tags_content_title(), 'items' => $items, ) ); @@ -358,7 +357,7 @@ SELECT DISTINCT image_id'.get_extra_fields($conf['order_by']).' $page, array( 'items' => $search_result['items'], - 'title' => '<a href="'.get_absolute_root_url().$conf['home_page'].'">'.l10n('Home').'</a>'.$conf['level_separator'].'<a href="'.duplicate_index_url(array('start'=>0)).'">' + 'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">' .l10n('Search results').'</a>', ) ); @@ -373,8 +372,8 @@ SELECT DISTINCT image_id'.get_extra_fields($conf['order_by']).' $page = array_merge( $page, array( - 'title' => '<a href="'.get_absolute_root_url().$conf['home_page'].'">'.l10n('Home').'</a>'.$conf['level_separator'].l10n('Favorites') - ) + 'title' => l10n('Favorites') + ) ); if (!empty($_GET['action']) && ($_GET['action'] == 'remove_all_from_favorites')) @@ -453,7 +452,7 @@ SELECT DISTINCT(id)'.get_extra_fields($conf['order_by']).' $page = array_merge( $page, array( - 'title' => '<a href="'.get_absolute_root_url().$conf['home_page'].'">'.l10n('Home').'</a>'.$conf['level_separator'].'<a href="'.duplicate_index_url(array('start'=>0)).'">' + 'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">' .l10n('Recent pictures').'</a>', 'items' => array_from_query($query, 'id'), ) @@ -467,7 +466,7 @@ SELECT DISTINCT(id)'.get_extra_fields($conf['order_by']).' $page = array_merge( $page, array( - 'title' => '<a href="'.get_absolute_root_url().$conf['home_page'].'">'.l10n('Home').'</a>'.$conf['level_separator'].l10n('Recent categories'), + 'title' => l10n('Recent categories'), ) ); } @@ -491,7 +490,7 @@ SELECT DISTINCT(id), hit, file $page = array_merge( $page, array( - 'title' => '<a href="'.get_absolute_root_url().$conf['home_page'].'">'.l10n('Home').'</a>'.$conf['level_separator'].'<a href="'.duplicate_index_url(array('start'=>0)).'">' + 'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">' .$conf['top_number'].' '.l10n('Most visited').'</a>', 'items' => array_from_query($query, 'id'), ) @@ -517,7 +516,7 @@ SELECT DISTINCT(id), average_rate $page = array_merge( $page, array( - 'title' => '<a href="'.get_absolute_root_url().$conf['home_page'].'">'.l10n('Home').'</a>'.$conf['level_separator'].'<a href="'.duplicate_index_url(array('start'=>0)).'">' + 'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">' .$conf['top_number'].' '.l10n('Best rated').'</a>', 'items' => array_from_query($query, 'id'), ) @@ -540,7 +539,7 @@ SELECT DISTINCT(id)'.get_extra_fields($conf['order_by']).' $page = array_merge( $page, array( - 'title' => '<a href="'.get_absolute_root_url().$conf['home_page'].'">'.l10n('Home').'</a>'.$conf['level_separator'].'<a href="'.duplicate_index_url(array('start'=>0)).'">' + 'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">' .l10n('Random pictures').'</a>', 'items' => array_from_query($query, 'id'), ) @@ -558,6 +557,16 @@ if (isset($page['chronology_field'])) initialize_calendar(); } +// title update +if (isset($page['title'])) +{ + if (!empty($page['title'])) + { + $page['title'] = $conf['level_separator'].$page['title']; + } + $page['title'] = '<a href="'.get_gallery_home_url().'">'.l10n('Home').'</a>'.$page['title']; +} + // add meta robots noindex, nofollow to avoid unnecesary robot crawls $page['meta_robots']=array(); if ( isset($page['chronology_field']) |