From 724671b669d5a0e5a2ffb684ffd4534584c52113 Mon Sep 17 00:00:00 2001 From: rvelices Date: Fri, 10 Nov 2006 01:10:42 +0000 Subject: git-svn-id: http://piwigo.org/svn/trunk@1604 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/include/functions_plugins.inc.php | 2 +- admin/rating.php | 11 ++--------- feed.php | 8 ++++---- include/functions_plugins.inc.php | 19 ++++++++++++------- include/section_init.inc.php | 2 ++ index.php | 30 ++++++++++++------------------ 6 files changed, 33 insertions(+), 39 deletions(-) diff --git a/admin/include/functions_plugins.inc.php b/admin/include/functions_plugins.inc.php index 652aa7e19..45f3c734c 100644 --- a/admin/include/functions_plugins.inc.php +++ b/admin/include/functions_plugins.inc.php @@ -41,7 +41,7 @@ function get_fs_plugins() and file_exists($path.'/main.inc.php') ) { - $plugin = array('name'=>'?', 'version'=>'0', 'uri'=>'', 'description'=>''); + $plugin = array('name'=>$file, 'version'=>'0', 'uri'=>'', 'description'=>''); $plg_data = implode( '', file($path.'/main.inc.php') ); if ( preg_match("|Plugin Name: (.*)|i", $plg_data, $val) ) diff --git a/admin/rating.php b/admin/rating.php index 01a93aecd..9007faa8d 100644 --- a/admin/rating.php +++ b/admin/rating.php @@ -212,22 +212,15 @@ SELECT i.id, $images = array(); $result = pwg_query($query); -while ($row = mysql_fetch_array($result)) +while ($row = mysql_fetch_assoc($result)) { array_push($images, $row); } foreach ($images as $image) { - $thumbnail_src = get_thumbnail_src($image['path'], $image['tn_ext']); + $thumbnail_src = get_thumbnail_url($image); - /*$image_url = make_picture_url( - array( - 'category' => $image['storage_category_id'], - 'image_id' => $image['id'], - 'image_file' => $image['file'], - ) - );*/ $image_url = PHPWG_ROOT_PATH.'admin.php?page=picture_modify'. '&image_id='.$image['id']; diff --git a/feed.php b/feed.php index ebc1ef63b..8026b4def 100644 --- a/feed.php +++ b/feed.php @@ -126,7 +126,7 @@ list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();')); include_once(PHPWG_ROOT_PATH.'include/feedcreator.class.php'); -$base_url = 'http://'.$_SERVER["HTTP_HOST"].cookie_path(); +$base_url = get_host_url().cookie_path(); if ( strrpos($base_url, '/') !== strlen($base_url)-1 ) { $base_url .= '/'; @@ -189,7 +189,7 @@ SELECT date_available, ;'; $result = pwg_query($query); $dates = array(); -while ($row = mysql_fetch_array($result)) +while ($row = mysql_fetch_assoc($result)) { array_push($dates, $row); } @@ -232,9 +232,9 @@ SELECT DISTINCT id, path, name, tn_ext LIMIT 0,6 ;'; $result = pwg_query($query); - while ($row = mysql_fetch_array($result)) + while ($row = mysql_fetch_assoc($result)) { - $tn_src = get_thumbnail_src($row['path'], @$row['tn_ext']); + $tn_src = get_thumbnail_url($row); $item->description .= ''; } $item->description .= '...
'; diff --git a/include/functions_plugins.inc.php b/include/functions_plugins.inc.php index e83f76df7..92adb22e9 100644 --- a/include/functions_plugins.inc.php +++ b/include/functions_plugins.inc.php @@ -54,7 +54,7 @@ function add_event_handler($event, $func, { if ( $handler['function'] == $func ) { - return true; + return false; } } } @@ -230,6 +230,15 @@ WHERE 1=1'; } +function load_plugin($plugin) +{ + $file_name = PHPWG_PLUGINS_PATH.$plugin['id'].'/main.inc.php'; + if ( file_exists($file_name) ) + { + include_once( $file_name ); + } +} + /*loads all the plugins on startup*/ function load_plugins() { @@ -241,12 +250,8 @@ function load_plugins() $plugins = get_db_plugins('active'); foreach( $plugins as $plugin) - { - $file_name = PHPWG_PLUGINS_PATH.$plugin['id'].'/main.inc.php'; - if ( file_exists($file_name) ) - { - include_once( $file_name ); - } + {// include main from a function to avoid using same function context + load_plugin($plugin); } trigger_action('plugins_loaded'); } diff --git a/include/section_init.inc.php b/include/section_init.inc.php index 8d0525422..9db071714 100644 --- a/include/section_init.inc.php +++ b/include/section_init.inc.php @@ -652,4 +652,6 @@ SELECT id,file $page['image_id'] = -1; // will fail in picture.php } } + +trigger_action('loc_end_section_init'); ?> \ No newline at end of file diff --git a/index.php b/index.php index 5b6d011c4..bd9755b85 100644 --- a/index.php +++ b/index.php @@ -30,6 +30,8 @@ define('PHPWG_ROOT_PATH','./'); include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); include(PHPWG_ROOT_PATH.'include/section_init.inc.php'); +trigger_action('loc_begin_index'); + // +-----------------------------------------------------------------------+ // | Check Access and exit when user status is not ok | // +-----------------------------------------------------------------------+ @@ -239,13 +241,7 @@ if (isset($page['thumbnails_include'])) include(PHPWG_ROOT_PATH.$page['thumbnails_include']); } //------------------------------------------------------- category informations -if ( - $page['navigation_bar'] != '' - or (isset($page['comment']) and $page['comment'] != '') - ) -{ - $template->assign_block_vars('cat_infos',array()); -} + // navigation bar if ($page['navigation_bar'] != '') { @@ -286,22 +282,20 @@ if (isset($page['cat_nb_images']) and $page['cat_nb_images'] > 0 } } -if (isset($page['category'])) +// category comment +if (isset($page['comment']) and $page['comment'] != '') { - // category comment - if (isset($page['comment']) and $page['comment'] != '') - { - $template->assign_block_vars( - 'cat_infos.comment', - array( - 'COMMENTS' => $page['comment'] - ) - ); - } + $template->assign_block_vars( + 'cat_infos.comment', + array( + 'COMMENTS' => $page['comment'] + ) + ); } //------------------------------------------------------------ log informations pwg_log('category', $page['title']); +trigger_action('loc_end_index'); $template->parse('index'); include(PHPWG_ROOT_PATH.'include/page_tail.php'); ?> -- cgit v1.2.3