From 37446caa5c362d998be6e1343995a5a7548a98a6 Mon Sep 17 00:00:00 2001
From: rvelices
Date: Thu, 6 Mar 2008 00:25:47 +0000
Subject: - upgrade goes smarty - event_tracer goes smarty - correction in
index.tpl
git-svn-id: http://piwigo.org/svn/trunk@2254 68402e56-0260-453c-a942-63ccdbb3a9ee
---
include/template.class.php | 7 +++++--
plugins/event_tracer/event_list.php | 5 +++--
plugins/event_tracer/event_list.tpl | 20 ++++++++++----------
plugins/event_tracer/main.inc.php | 21 +++++++++++++++++----
plugins/event_tracer/maintain.inc.php | 9 +++++++++
plugins/event_tracer/tracer_admin.php | 6 +++---
plugins/event_tracer/tracer_admin.tpl | 10 +++++-----
template/yoga/index.tpl | 2 +-
template/yoga/upgrade.tpl | 35 +++++++++++++++++------------------
upgrade.php | 26 ++++++++------------------
10 files changed, 78 insertions(+), 63 deletions(-)
create mode 100644 plugins/event_tracer/maintain.inc.php
diff --git a/include/template.class.php b/include/template.class.php
index 62a5a4cfc..77b6df5f0 100644
--- a/include/template.class.php
+++ b/include/template.class.php
@@ -84,8 +84,11 @@ class Template {
$this->smarty->assign_by_ref( 'pwg', new PwgTemplateAdapter() );
$this->smarty->register_modifier( 'translate', array('Template', 'mod_translate') );
- include($root.'/theme/'.$theme.'/themeconf.inc.php');
- $this->smarty->assign('themeconf', $themeconf);
+ if ( !empty($theme) )
+ {
+ include($root.'/theme/'.$theme.'/themeconf.inc.php');
+ $this->smarty->assign('themeconf', $themeconf);
+ }
$this->_old = & new TemplateOld($root, $theme);
}
diff --git a/plugins/event_tracer/event_list.php b/plugins/event_tracer/event_list.php
index 1f1969629..ae617fe87 100644
--- a/plugins/event_tracer/event_list.php
+++ b/plugins/event_tracer/event_list.php
@@ -67,16 +67,17 @@ global $template;
$url = get_admin_plugin_menu_link(__FILE__);
-$template->assign_vars( array(
+$template->assign( array(
'NB_EVENTS' => count($events),
'U_SORT0' => add_url_params($url, array('sort'=>0) ),
'U_SORT1' => add_url_params($url, array('sort'=>1) ),
'U_SORT2' => add_url_params($url, array('sort'=>2) ),
) );
+$template->assign('events', array());
foreach ($events as $e)
{
- $template->assign_block_vars( 'event', array(
+ $template->append( 'events', array(
'TYPE' => $e[0],
'NAME' => $e[1],
'FILE' => $e[2],
diff --git a/plugins/event_tracer/event_list.tpl b/plugins/event_tracer/event_list.tpl
index fd294e66b..accc27278 100644
--- a/plugins/event_tracer/event_list.tpl
+++ b/plugins/event_tracer/event_list.tpl
@@ -1,17 +1,17 @@
-
-There are {NB_EVENTS} calls to triger_event or triger_action.
+{* $Id$ *}
+There are {$NB_EVENTS} calls to triger_event or triger_action.
- Type
- Name
- File
+ Type
+ Name
+ File
-
+{foreach from=$events item=event}
- {event.TYPE}
- {event.NAME}
- {event.FILE}
+ {$event.TYPE}
+ {$event.NAME}
+ {$event.FILE}
-
+{/foreach}
diff --git a/plugins/event_tracer/main.inc.php b/plugins/event_tracer/main.inc.php
index c2676bd27..633ca697d 100644
--- a/plugins/event_tracer/main.inc.php
+++ b/plugins/event_tracer/main.inc.php
@@ -1,6 +1,6 @@
me_working=0;
}
+ function get_config_file_dir()
+ {
+ global $conf;
+ return $conf['local_data_dir'].'/plugins/';
+ }
+
+ function get_config_file_name()
+ {
+ return basename(dirname(__FILE__)).'.dat';
+ }
+
function load_config()
{
- $x = @file_get_contents( dirname(__FILE__).'/data.dat' );
+ $x = @file_get_contents( $this->get_config_file_dir().$this->get_config_file_name() );
if ($x!==false)
{
$c = unserialize($x);
@@ -38,7 +49,9 @@ class EventTracer
function save_config()
{
- $file = fopen( dirname(__FILE__).'/data.dat', 'w' );
+ $dir = $this->get_config_file_dir();
+ @mkdir($dir);
+ $file = fopen( $dir.$this->get_config_file_name(), 'w' );
fwrite($file, serialize($this->my_config) );
fclose( $file );
}
@@ -97,4 +110,4 @@ add_event_handler('pre_trigger_event', array(&$obj, 'on_pre_trigger_event') );
add_event_handler('post_trigger_event', array(&$obj, 'on_post_trigger_event') );
add_event_handler('trigger_action', array(&$obj, 'on_trigger_action') );
set_plugin_data($plugin['id'], $obj);
-?>
\ No newline at end of file
+?>
diff --git a/plugins/event_tracer/maintain.inc.php b/plugins/event_tracer/maintain.inc.php
new file mode 100644
index 000000000..f7d0131c5
--- /dev/null
+++ b/plugins/event_tracer/maintain.inc.php
@@ -0,0 +1,9 @@
+
diff --git a/plugins/event_tracer/tracer_admin.php b/plugins/event_tracer/tracer_admin.php
index 5b405ba5a..b17f2a301 100644
--- a/plugins/event_tracer/tracer_admin.php
+++ b/plugins/event_tracer/tracer_admin.php
@@ -21,9 +21,9 @@ if ( isset($_POST['eventTracer_filters']) )
global $page;
array_push($page['infos'], 'event tracer options saved');
}
-$template->assign_var('EVENT_TRACER_FILTERS', implode("\n", $me->my_config['filters'] ) );
-$template->assign_var('EVENT_TRACER_SHOW_ARGS', $me->my_config['show_args'] ? 'checked="checked"' : '' );
-$template->assign_var('U_LIST_EVENTS', get_admin_plugin_menu_link(dirname(__FILE__).'/event_list.php'));
+$template->assign('EVENT_TRACER_FILTERS', implode("\n", $me->my_config['filters'] ) );
+$template->assign('EVENT_TRACER_SHOW_ARGS', $me->my_config['show_args'] ? 'checked="checked"' : '' );
+$template->assign('U_LIST_EVENTS', get_admin_plugin_menu_link(dirname(__FILE__).'/event_list.php'));
//$template->assign_var('EVENT_TRACER_F_ACTION', $my_url);
diff --git a/plugins/event_tracer/tracer_admin.tpl b/plugins/event_tracer/tracer_admin.tpl
index 2d859563e..4830a8b85 100644
--- a/plugins/event_tracer/tracer_admin.tpl
+++ b/plugins/event_tracer/tracer_admin.tpl
@@ -1,4 +1,4 @@
-
+{* $Id$ *}
Event Tracer
@@ -8,22 +8,22 @@ The event tracer is a developer tool that logs in the footer of the window all c
You can use this plugin to see what events is PhpWebGallery calling.
Note that $conf['show_queries'] must be true.
-
diff --git a/template/yoga/index.tpl b/template/yoga/index.tpl
index 944c5153e..abe3975ad 100644
--- a/template/yoga/index.tpl
+++ b/template/yoga/index.tpl
@@ -56,7 +56,7 @@
{'calendar_view'|@translate}:
{foreach from=$chronology_views item=view}
- {$view.CONTENT}
+ {$view.CONTENT}
{/foreach}
diff --git a/template/yoga/upgrade.tpl b/template/yoga/upgrade.tpl
index 2d31a690b..42e14a772 100644
--- a/template/yoga/upgrade.tpl
+++ b/template/yoga/upgrade.tpl
@@ -1,45 +1,44 @@
-
+{* $Id$ *}
- PhpWebGallery : Upgrade to {RELEASE}
+ PhpWebGallery : Upgrade to {$RELEASE}
-
+ {if isset($introduction)}
Welcome to PhpWebGallery upgrade page.
This page proposes to upgrade your database corresponding to your old
version of PhpWebGallery to the current version. The upgrade assistant
thinks you are currently running a
-release {introduction.CURRENT_RELEASE} (or equivalent).
+release {$introduction.CURRENT_RELEASE} (or equivalent).
- Upgrade from release
-{introduction.CURRENT_RELEASE} to {RELEASE}
-
+ Upgrade from release
+{$introduction.CURRENT_RELEASE} to {$RELEASE}
+ {/if}
-
- Upgrade from version {upgrade.VERSION} to {RELEASE}
+ {if isset($upgrade)}
+ Upgrade from version {$upgrade.VERSION} to {$RELEASE}
Statistics
- total upgrade time : {upgrade.TOTAL_TIME}
- total SQL time : {upgrade.SQL_TIME}
- SQL queries : {upgrade.NB_QUERIES}
+ total upgrade time : {$upgrade.TOTAL_TIME}
+ total SQL time : {$upgrade.SQL_TIME}
+ SQL queries : {$upgrade.NB_QUERIES}
-
Upgrade informations
-
- {upgrade.infos.info.CONTENT}
-
+ {foreach from=$infos item=info}
+ {$info}
+ {/foreach}
-
-
+
+ {/if}
diff --git a/upgrade.php b/upgrade.php
index ee87a367f..effc008f9 100644
--- a/upgrade.php
+++ b/upgrade.php
@@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
-// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $Id$
// | last update : $Date$
@@ -147,7 +147,7 @@ function print_time($message)
$template = new Template(PHPWG_ROOT_PATH.'template/yoga');
$template->set_filenames(array('upgrade'=>'upgrade.tpl'));
-$template->assign_vars(array('RELEASE'=>PHPWG_VERSION));
+$template->assign('RELEASE', PHPWG_VERSION);
// +-----------------------------------------------------------------------+
// | upgrade choice |
@@ -179,7 +179,7 @@ if (!isset($_GET['version']))
{
$current_release = '1.5.0';
}
- else if (!in_array(PREFIX_TABLE.'history_summary', $tables))
+ else if ( !in_array(PREFIX_TABLE.'history_summary', $tables) )
{
if (!in_array('auto_login_key', $columns_of[PREFIX_TABLE.'user_infos']))
{
@@ -195,7 +195,7 @@ if (!isset($_GET['version']))
die('No upgrade required, the database structure is up to date');
}
- $template->assign_block_vars(
+ $template->assign(
'introduction',
array(
'CURRENT_RELEASE' => $current_release,
@@ -215,7 +215,7 @@ else
{
die('No database upgrade required, do not refresh the page');
}
-
+
$upgrade_file = PHPWG_ROOT_PATH.'install/upgrade_'.$_GET['version'].'.php';
if (is_file($upgrade_file))
{
@@ -249,10 +249,10 @@ else
// Create empty local files to avoid log errors
create_empty_local_files();
-
+
$page['upgrade_end'] = get_moment();
- $template->assign_block_vars(
+ $template->assign(
'upgrade',
array(
'VERSION' => $_GET['version'],
@@ -290,18 +290,8 @@ define(\'PHPWG_IN_UPGRADE\', true);
if you encounter any problem.'
);
- $template->assign_block_vars('upgrade.infos', array());
+ $template->assign('infos', $page['infos']);
- foreach ($page['infos'] as $info)
- {
- $template->assign_block_vars(
- 'upgrade.infos.info',
- array(
- 'CONTENT' => $info,
- )
- );
- }
-
$query = '
UPDATE '.USER_CACHE_TABLE.'
SET need_update = \'true\'
--
cgit v1.2.3