diff options
-rw-r--r-- | include/functions.inc.php | 18 | ||||
-rw-r--r-- | include/functions_calendar.inc.php | 2 | ||||
-rw-r--r-- | include/functions_notification.inc.php | 17 | ||||
-rw-r--r-- | include/section_init.inc.php | 8 | ||||
-rw-r--r-- | themes/default/template/comments.tpl | 2 | ||||
-rw-r--r-- | themes/default/template/notification.tpl | 2 | ||||
-rw-r--r-- | themes/default/template/password.tpl | 2 | ||||
-rw-r--r-- | themes/default/template/tags.tpl | 6 | ||||
-rw-r--r-- | themes/default/template/upload.tpl | 2 |
9 files changed, 27 insertions, 32 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php index 0a93d3927..551ad72c0 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -32,18 +32,6 @@ include_once( PHPWG_ROOT_PATH .'include/functions_url.inc.php' ); include_once( PHPWG_ROOT_PATH .'include/functions_plugins.inc.php' ); //----------------------------------------------------------- generic functions -function get_extra_fields($order_by_fields) -{ - $fields = str_ireplace(array(' order by ', ' desc', ' asc'), - array('', '', ''), - $order_by_fields - ); - if (!empty($fields)) - { - $fields = ','.$fields; - } - return $fields; -} // The function get_moment returns a float value coresponding to the number // of seconds since the unix epoch (1st January 1970) and the microseconds @@ -583,7 +571,7 @@ function redirect_html( $url , $msg = '', $refresh_time = 0) { global $user, $template, $lang_info, $conf, $lang, $t2, $page, $debug; - if (!isset($lang_info)) + if (!isset($lang_info) || !isset($template) ) { $user = build_user( $conf['guest_id'], true); load_language('common.lang'); @@ -591,10 +579,6 @@ function redirect_html( $url , $msg = '', $refresh_time = 0) load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) ); $template = new Template(PHPWG_ROOT_PATH.'themes', get_default_theme()); } - else - { - $template = new Template(PHPWG_ROOT_PATH.'themes', $user['theme']); - } if (empty($msg)) { diff --git a/include/functions_calendar.inc.php b/include/functions_calendar.inc.php index 5d0329e1d..990443b38 100644 --- a/include/functions_calendar.inc.php +++ b/include/functions_calendar.inc.php @@ -258,7 +258,7 @@ WHERE id IN (' . implode(',',$page['items']) .')'; if ($must_show_list) { - $query = 'SELECT DISTINCT id '.get_extra_fields($conf['order_by']); + $query = 'SELECT DISTINCT id '; $query .= ','.$calendar->date_field; $query .= $calendar->inner_sql.' '.$calendar->get_date_where(); diff --git a/include/functions_notification.inc.php b/include/functions_notification.inc.php index ebb713fb6..363ea7e58 100644 --- a/include/functions_notification.inc.php +++ b/include/functions_notification.inc.php @@ -79,7 +79,7 @@ function custom_notification_query($action, $type, $start, $end) } if (!empty($end)) { - $query .= ' + $query .= ' AND c.validation_date <= \''.$end.'\''; } $query .= get_std_sql_where_restrict_filter('AND').' @@ -94,7 +94,7 @@ function custom_notification_query($action, $type, $start, $end) $query .= ' AND date> \''.$start.'\''; } if (!empty($end)) - { + { $query .= ' AND date <= \''.$end.'\''; } $query .= ' AND validated = \'false\' @@ -619,9 +619,20 @@ function get_title_recent_post_date($date_detail) $exploded_date = strptime($date, '%Y-%m-%d %H:%M:%S'); $title = l10n_dec('%d new image', '%d new images', $date_detail['nb_elements']); - $title .= ' ('.$lang['month'][(int)$exploded_date['tm_mon']].' '.$exploded_date['tm_mday'].')'; + $title .= ' ('.$lang['month'][1+$exploded_date['tm_mon']].' '.$exploded_date['tm_mday'].')'; return $title; } +if(!function_exists("strptime")) +{ + function strptime($date, $fmt) + { + if ($fmt != '%Y-%m-%d %H:%M:%S') + die('Invalid strptime format '.$fmt); + list($y,$m,$d,$H,$M,$S) = preg_split('/[-: ]/', $date); + $res = localtime( mktime($H,$M,$S,$m,$d,$y), true ); + return $res; + } + } ?>
\ No newline at end of file diff --git a/include/section_init.inc.php b/include/section_init.inc.php index 4e731c2e8..a4e10f806 100644 --- a/include/section_init.inc.php +++ b/include/section_init.inc.php @@ -289,7 +289,7 @@ SELECT id // Main query $query = ' -SELECT DISTINCT(image_id)'.get_extra_fields($conf['order_by']).' +SELECT DISTINCT(image_id) FROM '.IMAGE_CATEGORY_TABLE.' INNER JOIN '.IMAGES_TABLE.' ON id = image_id WHERE @@ -323,7 +323,7 @@ else if (!empty($items) ) { $query = ' -SELECT DISTINCT image_id'.get_extra_fields($conf['order_by']).' +SELECT DISTINCT image_id FROM '.IMAGE_CATEGORY_TABLE.' INNER JOIN '.IMAGES_TABLE.' ON image_id=id WHERE image_id IN ('.implode(',', $items).') '.$forbidden. @@ -438,7 +438,7 @@ SELECT image_id } $query = ' -SELECT DISTINCT(id)'.get_extra_fields($conf['order_by']).' +SELECT DISTINCT(id) FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id WHERE @@ -526,7 +526,7 @@ SELECT DISTINCT(id), average_rate else if ($page['section'] == 'list') { $query =' -SELECT DISTINCT(id)'.get_extra_fields($conf['order_by']).' +SELECT DISTINCT(id) FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id WHERE image_id IN ('.implode(',', $page['list']).') diff --git a/themes/default/template/comments.tpl b/themes/default/template/comments.tpl index 77952ce40..9616d27a9 100644 --- a/themes/default/template/comments.tpl +++ b/themes/default/template/comments.tpl @@ -2,7 +2,7 @@ <div class="titrePage"> <ul class="categoryActions"> - <li><a href="{$U_HOME}" title="{'Home'|@translate}"><img src="{$themeconf.icon_dir}/home.png" class="button" alt="{'Home'|@translate}"></a></li> + <li><a href="{$U_HOME}" title="{'Home'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/home.png" class="button" alt="{'Home'|@translate}"></a></li> </ul> <h2>{'User comments'|@translate}</h2> </div> diff --git a/themes/default/template/notification.tpl b/themes/default/template/notification.tpl index 734ccdbf0..1848e5e46 100644 --- a/themes/default/template/notification.tpl +++ b/themes/default/template/notification.tpl @@ -6,7 +6,7 @@ <div class="titrePage"> <ul class="categoryActions"> - <li><a href="{$U_HOME}" title="{'Home'|@translate}"><img src="{$themeconf.icon_dir}/home.png" class="button" alt="{'Home'|@translate}"></a></li> + <li><a href="{$U_HOME}" title="{'Home'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/home.png" class="button" alt="{'Home'|@translate}"></a></li> </ul> <h2>{'Notification'|@translate}</h2> </div> diff --git a/themes/default/template/password.tpl b/themes/default/template/password.tpl index 7e3b5ed76..413286e29 100644 --- a/themes/default/template/password.tpl +++ b/themes/default/template/password.tpl @@ -2,7 +2,7 @@ <div class="titrePage"> <ul class="categoryActions"> - <li><a href="{$U_HOME}" title="{'Go through the gallery as a visitor'|@translate}"><img src="{$themeconf.icon_dir}/home.png" class="button" alt="{'Home'|@translate}"></a></li> + <li><a href="{$U_HOME}" title="{'Go through the gallery as a visitor'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/home.png" class="button" alt="{'Home'|@translate}"></a></li> </ul> <h2>{'Password forgotten'|@translate}</h2> </div> diff --git a/themes/default/template/tags.tpl b/themes/default/template/tags.tpl index 03cccbbaf..4c226f80c 100644 --- a/themes/default/template/tags.tpl +++ b/themes/default/template/tags.tpl @@ -3,14 +3,14 @@ <div class="titrePage"> <ul class="categoryActions"> {if $display_mode == 'letters'} - <li><a href="{$U_CLOUD}" title="{'show tag cloud'|@translate}" rel="nofollow"><img src="{$themeconf.icon_dir}/tag_cloud.png" class="button" alt="{'cloud'|@translate}"></a></li> + <li><a href="{$U_CLOUD}" title="{'show tag cloud'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/tag_cloud.png" class="button" alt="{'cloud'|@translate}"></a></li> {/if} {if $display_mode == 'cloud'} - <li><a href="{$U_LETTERS}" title="{'group by letters'|@translate}" rel="nofollow"><img src="{$themeconf.icon_dir}/tag_letters.png" class="button" alt="{'letters'|@translate}"></a></li> + <li><a href="{$U_LETTERS}" title="{'group by letters'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/tag_letters.png" class="button" alt="{'letters'|@translate}"></a></li> {/if} - <li><a href="{$U_HOME}" title="{'Home'|@translate}"><img src="{$themeconf.icon_dir}/home.png" class="button" alt="{'Home'|@translate}"></a></li> + <li><a href="{$U_HOME}" title="{'Home'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/home.png" class="button" alt="{'Home'|@translate}"></a></li> </ul> <h2>{'Tags'|@translate}</h2> </div> diff --git a/themes/default/template/upload.tpl b/themes/default/template/upload.tpl index ba57fd877..6e6bdc42a 100644 --- a/themes/default/template/upload.tpl +++ b/themes/default/template/upload.tpl @@ -8,7 +8,7 @@ <div class="titrePage"> <ul class="categoryActions"> - <li><a href="{$U_HOME}" title="{'Home'|@translate}"><img src="{$themeconf.icon_dir}/home.png" class="button" alt="{'Home'|@translate}"></a></li> + <li><a href="{$U_HOME}" title="{'Home'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/home.png" class="button" alt="{'Home'|@translate}"></a></li> </ul> <h2>{'Upload a picture'|@translate}</h2> </div> |