mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-07 17:23:04 +02:00
- 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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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],
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<!-- DEV TAG: not smarty migrated -->
|
||||
There are {NB_EVENTS} calls to triger_event or triger_action.
|
||||
{* $Id$ *}
|
||||
There are {$NB_EVENTS} calls to triger_event or triger_action.
|
||||
|
||||
<table width="99%" class="table2">
|
||||
<tr class="throw">
|
||||
<th><a href="{U_SORT0}">Type</a></th>
|
||||
<th><a href="{U_SORT1}">Name</a></th>
|
||||
<th><a href="{U_SORT2}">File</a></th>
|
||||
<th><a href="{$U_SORT0}">Type</a></th>
|
||||
<th><a href="{$U_SORT1}">Name</a></th>
|
||||
<th><a href="{$U_SORT2}">File</a></th>
|
||||
</tr>
|
||||
<!-- BEGIN event -->
|
||||
{foreach from=$events item=event}
|
||||
<tr>
|
||||
<td>{event.TYPE}</td>
|
||||
<td>{event.NAME}</td>
|
||||
<td>{event.FILE}</td>
|
||||
<td>{$event.TYPE}</td>
|
||||
<td>{$event.NAME}</td>
|
||||
<td>{$event.FILE}</td>
|
||||
</tr>
|
||||
<!-- END event -->
|
||||
{/foreach}
|
||||
</table>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php /*
|
||||
Plugin Name: Event tracer
|
||||
Version: 1.8
|
||||
Version: 1.8.a
|
||||
Description: For developers. Shows all calls to trigger_event.
|
||||
Plugin URI: http://www.phpwebgallery.net
|
||||
Author: PhpWebGallery team
|
||||
@@ -18,9 +18,20 @@ class EventTracer
|
||||
$this->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);
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
|
||||
|
||||
function plugin_uninstall($plugin_id)
|
||||
{
|
||||
global $conf;
|
||||
@unlink( $conf['local_data_dir'].'/plugins/'.$plugin_id.'.dat' );
|
||||
}
|
||||
?>
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<!-- DEV TAG: not smarty migrated -->
|
||||
{* $Id$ *}
|
||||
<div class="titrePage">
|
||||
<h2>Event Tracer</h2>
|
||||
</div>
|
||||
@@ -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.
|
||||
<b>Note that $conf['show_queries'] must be true.</b>
|
||||
</p>
|
||||
<form method="post" action="{EVENT_TRACER_F_ACTION}" class="general">
|
||||
<form method="post" action="{$EVENT_TRACER_F_ACTION}" class="general">
|
||||
<fieldset>
|
||||
<legend>Event Tracer</legend>
|
||||
|
||||
<label>Show event argument
|
||||
<input type="checkbox" name="eventTracer_show_args" {EVENT_TRACER_SHOW_ARGS} />
|
||||
<input type="checkbox" name="eventTracer_show_args" {$EVENT_TRACER_SHOW_ARGS} />
|
||||
</label>
|
||||
<br/>
|
||||
<label>Fill below a list of regular expressions (one per line).
|
||||
An event will be logged if its name matches at least one expression in the list.
|
||||
<textarea name="eventTracer_filters" id="eventTracer_filters"rows="10" cols="80">{EVENT_TRACER_FILTERS}</textarea>
|
||||
<textarea name="eventTracer_filters" id="eventTracer_filters"rows="10" cols="80">{$EVENT_TRACER_FILTERS}</textarea>
|
||||
</label>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<p><input class="submit" type="submit" value="Submit" /></p>
|
||||
|
||||
<p><a href="{U_LIST_EVENTS}">Click here to see a complete list of actions and events trigered by this PWG version</a>.</p>
|
||||
<p><a href="{$U_LIST_EVENTS}">Click here to see a complete list of actions and events trigered by this PWG version</a>.</p>
|
||||
</form>
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
<div class="calendarViews">{'calendar_view'|@translate}:
|
||||
<select onchange="document.location = this.options[this.selectedIndex].value;">
|
||||
{foreach from=$chronology_views item=view}
|
||||
<option value="{$view.VALUE}"{if $view.SELECTED} selected="selected"{/if}}>{$view.CONTENT}</option>
|
||||
<option value="{$view.VALUE}"{if $view.SELECTED} selected="selected"{/if}>{$view.CONTENT}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
+17
-18
@@ -1,45 +1,44 @@
|
||||
<!-- DEV TAG: not smarty migrated -->
|
||||
{* $Id$ *}
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<title>PhpWebGallery : Upgrade to {RELEASE}</title>
|
||||
<title>PhpWebGallery : Upgrade to {$RELEASE}</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- BEGIN introduction -->
|
||||
{if isset($introduction)}
|
||||
<h1>Welcome to PhpWebGallery upgrade page.</h1>
|
||||
|
||||
<p>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
|
||||
<strong>release {introduction.CURRENT_RELEASE}</strong> (or equivalent).</p>
|
||||
<strong>release {$introduction.CURRENT_RELEASE}</strong> (or equivalent).</p>
|
||||
|
||||
<p><a href="{introduction.RUN_UPGRADE_URL}">Upgrade from release
|
||||
{introduction.CURRENT_RELEASE} to {RELEASE}</a></p>
|
||||
<!-- END introduction -->
|
||||
<p><a href="{$introduction.RUN_UPGRADE_URL}">Upgrade from release
|
||||
{$introduction.CURRENT_RELEASE} to {$RELEASE}</a></p>
|
||||
{/if}
|
||||
|
||||
<!-- BEGIN upgrade -->
|
||||
<h1>Upgrade from version {upgrade.VERSION} to {RELEASE}</h1>
|
||||
{if isset($upgrade)}
|
||||
<h1>Upgrade from version {$upgrade.VERSION} to {$RELEASE}</h1>
|
||||
|
||||
<p>Statistics</p>
|
||||
<ul>
|
||||
<li>total upgrade time : {upgrade.TOTAL_TIME}</li>
|
||||
<li>total SQL time : {upgrade.SQL_TIME}</li>
|
||||
<li>SQL queries : {upgrade.NB_QUERIES}</li>
|
||||
<li>total upgrade time : {$upgrade.TOTAL_TIME}</li>
|
||||
<li>total SQL time : {$upgrade.SQL_TIME}</li>
|
||||
<li>SQL queries : {$upgrade.NB_QUERIES}</li>
|
||||
</ul>
|
||||
|
||||
<!-- BEGIN infos -->
|
||||
<p>Upgrade informations</p>
|
||||
|
||||
<ul>
|
||||
<!-- BEGIN info -->
|
||||
<li>{upgrade.infos.info.CONTENT}</li>
|
||||
<!-- END info -->
|
||||
{foreach from=$infos item=info}
|
||||
<li>{$info}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
<!-- END infos -->
|
||||
<!-- END upgrade -->
|
||||
|
||||
{/if}
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
+8
-18
@@ -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\'
|
||||
|
||||
Reference in New Issue
Block a user