- errors and informations boxes : management centralized in admin.php,
$errors and $infos arrays replaced by $page['errors'] and $page['infos'], special management for admin/update.php (more complex management) git-svn-id: http://piwigo.org/svn/trunk@792 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
4fedaac43a
commit
e851f504ac
27 changed files with 150 additions and 241 deletions
23
admin.php
23
admin.php
|
|
@ -265,6 +265,9 @@ $template->assign_vars(array(
|
|||
//--------------------------------------------------------------------- summary
|
||||
$link_start = PHPWG_ROOT_PATH.'admin.php?page=';
|
||||
//------------------------------------------------------------- content display
|
||||
$page['errors'] = array();
|
||||
$page['infos'] = array();
|
||||
|
||||
if ($page_valide)
|
||||
{
|
||||
switch ($_GET['page'])
|
||||
|
|
@ -294,6 +297,26 @@ else
|
|||
)
|
||||
);
|
||||
}
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | errors & infos |
|
||||
// +-----------------------------------------------------------------------+
|
||||
if (count($page['errors']) != 0)
|
||||
{
|
||||
$template->assign_block_vars('errors',array());
|
||||
foreach ($page['errors'] as $error)
|
||||
{
|
||||
$template->assign_block_vars('errors.error',array('ERROR'=>$error));
|
||||
}
|
||||
}
|
||||
if (count($page['infos']) != 0)
|
||||
{
|
||||
$template->assign_block_vars('infos',array());
|
||||
foreach ($page['infos'] as $info)
|
||||
{
|
||||
$template->assign_block_vars('infos.info',array('INFO'=>$info));
|
||||
}
|
||||
}
|
||||
|
||||
$template->parse('admin');
|
||||
include(PHPWG_ROOT_PATH.'include/page_tail.php');
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
|
|
|||
|
|
@ -33,8 +33,6 @@ include_once(PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php');
|
|||
// +-----------------------------------------------------------------------+
|
||||
// | initialization |
|
||||
// +-----------------------------------------------------------------------+
|
||||
$errors = array();
|
||||
$infos = array();
|
||||
$categories = array();
|
||||
$navigation = $lang['home'];
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
|
@ -44,7 +42,7 @@ $navigation = $lang['home'];
|
|||
if (isset($_GET['delete']) and is_numeric($_GET['delete']))
|
||||
{
|
||||
delete_categories(array($_GET['delete']));
|
||||
array_push($infos, $lang['cat_virtual_deleted']);
|
||||
array_push($page['infos'], $lang['cat_virtual_deleted']);
|
||||
ordering();
|
||||
update_global_rank();
|
||||
}
|
||||
|
|
@ -54,10 +52,10 @@ else if (isset($_POST['submit']))
|
|||
// is the given category name only containing blank spaces ?
|
||||
if (preg_match('/^\s*$/', $_POST['virtual_name']))
|
||||
{
|
||||
array_push($errors, $lang['cat_error_name']);
|
||||
array_push($page['errors'], $lang['cat_error_name']);
|
||||
}
|
||||
|
||||
if (!count($errors))
|
||||
if (!count($page['errors']))
|
||||
{
|
||||
$parent_id = !empty($_GET['parent_id'])?$_GET['parent_id']:'NULL';
|
||||
|
||||
|
|
@ -136,7 +134,7 @@ SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1)
|
|||
'uppercats','global_rank');
|
||||
mass_inserts(CATEGORIES_TABLE, $dbfields, $inserts);
|
||||
|
||||
array_push($infos, $lang['cat_virtual_added']);
|
||||
array_push($page['infos'], $lang['cat_virtual_added']);
|
||||
}
|
||||
}
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
|
@ -344,25 +342,6 @@ $template->assign_vars(array(
|
|||
|
||||
$tpl = array('cat_first','cat_last');
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | errors & infos |
|
||||
// +-----------------------------------------------------------------------+
|
||||
if (count($errors) != 0)
|
||||
{
|
||||
$template->assign_block_vars('errors',array());
|
||||
foreach ($errors as $error)
|
||||
{
|
||||
$template->assign_block_vars('errors.error',array('ERROR'=>$error));
|
||||
}
|
||||
}
|
||||
if (count($infos) != 0)
|
||||
{
|
||||
$template->assign_block_vars('infos',array());
|
||||
foreach ($infos as $info)
|
||||
{
|
||||
$template->assign_block_vars('infos.info',array('INFO'=>$info));
|
||||
}
|
||||
}
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Categories display |
|
||||
// +-----------------------------------------------------------------------+
|
||||
$ranks = array();
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ if ( isset( $_POST['submit'] ) )
|
|||
set_cat_visible(array($_GET['cat_id']), $_POST['visible']);
|
||||
set_cat_status(array($_GET['cat_id']), $_POST['status']);
|
||||
|
||||
$template->assign_block_vars('confirmation' ,array());
|
||||
array_push($infos, $lang['editcat_confirm']);
|
||||
}
|
||||
else if (isset($_POST['set_random_representant']))
|
||||
{
|
||||
|
|
@ -144,7 +144,6 @@ $template->assign_vars(array(
|
|||
$commentable=>'checked="checked"',
|
||||
$uploadable=>'checked="checked"',
|
||||
|
||||
'L_EDIT_CONFIRM'=>$lang['editcat_confirm'],
|
||||
'L_EDIT_NAME'=>$lang['name'],
|
||||
'L_STORAGE'=>$lang['storage'],
|
||||
'L_REMOTE_SITE'=>$lang['remote_site'],
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ while ($row = mysql_fetch_array($result))
|
|||
}
|
||||
}
|
||||
//------------------------------ verification and registration of modifications
|
||||
$errors = array();
|
||||
if (isset($_POST['submit']))
|
||||
{
|
||||
$int_pattern = '/^\d+$/';
|
||||
|
|
@ -64,13 +63,13 @@ if (isset($_POST['submit']))
|
|||
// thumbnail prefix must only contain simple ASCII characters
|
||||
if (!preg_match('/^[\w-]*$/', $_POST['prefix_thumbnail']))
|
||||
{
|
||||
array_push($errors, $lang['conf_prefix_thumbnail_error']);
|
||||
array_push($page['errors'], $lang['conf_prefix_thumbnail_error']);
|
||||
}
|
||||
// mail must be formatted as follows : name@server.com
|
||||
$pattern = '/^[\w-]+(\.[\w-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/';
|
||||
if (!preg_match($pattern, $_POST['mail_webmaster']))
|
||||
{
|
||||
array_push($errors, $lang['conf_mail_webmaster_error']);
|
||||
array_push($page['errors'], $lang['conf_mail_webmaster_error']);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -82,7 +81,7 @@ if (isset($_POST['submit']))
|
|||
or $_POST['nb_comment_page'] < 5
|
||||
or $_POST['nb_comment_page'] > 50)
|
||||
{
|
||||
array_push($errors, $lang['conf_nb_comment_page_error']);
|
||||
array_push($page['errors'], $lang['conf_nb_comment_page_error']);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -92,7 +91,7 @@ if (isset($_POST['submit']))
|
|||
if (!preg_match($int_pattern, $_POST['recent_period'])
|
||||
or $_POST['recent_period'] <= 0)
|
||||
{
|
||||
array_push($errors, $lang['periods_error']);
|
||||
array_push($page['errors'], $lang['periods_error']);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -103,7 +102,7 @@ if (isset($_POST['submit']))
|
|||
or $_POST['upload_maxfilesize'] < 10
|
||||
or $_POST['upload_maxfilesize'] > 1000)
|
||||
{
|
||||
array_push($errors, $lang['conf_upload_maxfilesize_error']);
|
||||
array_push($page['errors'], $lang['conf_upload_maxfilesize_error']);
|
||||
}
|
||||
|
||||
foreach (array('upload_maxwidth',
|
||||
|
|
@ -113,9 +112,9 @@ if (isset($_POST['submit']))
|
|||
as $field)
|
||||
{
|
||||
if (!preg_match($int_pattern, $_POST[$field])
|
||||
or $_POST[$field] < 10)
|
||||
or $_POST[$field] < 10)
|
||||
{
|
||||
array_push($errors, $lang['conf_'.$field.'_error']);
|
||||
array_push($page['errors'], $lang['conf_'.$field.'_error']);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -123,8 +122,9 @@ if (isset($_POST['submit']))
|
|||
}
|
||||
|
||||
// updating configuration if no error found
|
||||
if (count($errors) == 0)
|
||||
if (count($page['errors']) == 0)
|
||||
{
|
||||
echo '<pre>'; print_r($_POST); echo '</pre>';
|
||||
$result = pwg_query('SELECT * FROM '.CONFIG_TABLE);
|
||||
while ($row = mysql_fetch_array($result))
|
||||
{
|
||||
|
|
@ -138,6 +138,7 @@ UPDATE '.CONFIG_TABLE.'
|
|||
pwg_query($query);
|
||||
}
|
||||
}
|
||||
array_push($page['infos'], $lang['conf_confirmation']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -149,7 +150,6 @@ $action.= '&section='.$page['section'];
|
|||
|
||||
$template->assign_vars(
|
||||
array(
|
||||
'L_CONFIRM'=>$lang['conf_confirmation'],
|
||||
'L_YES'=>$lang['yes'],
|
||||
'L_NO'=>$lang['no'],
|
||||
'L_SUBMIT'=>$lang['submit'],
|
||||
|
|
@ -343,19 +343,6 @@ switch ($page['section'])
|
|||
break;
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------- errors display
|
||||
if ( sizeof( $errors ) != 0 )
|
||||
{
|
||||
$template->assign_block_vars('errors',array());
|
||||
for ( $i = 0; $i < sizeof( $errors ); $i++ )
|
||||
{
|
||||
$template->assign_block_vars('errors.error',array('ERROR'=>$errors[$i]));
|
||||
}
|
||||
}
|
||||
elseif ( isset( $_POST['submit'] ) )
|
||||
{
|
||||
$template->assign_block_vars('confirmation' ,array());
|
||||
}
|
||||
//----------------------------------------------------------- sending html code
|
||||
$template->assign_var_from_handle('ADMIN_CONTENT', 'config');
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -74,7 +74,6 @@ SELECT keywords
|
|||
// +-----------------------------------------------------------------------+
|
||||
// | global mode form submission |
|
||||
// +-----------------------------------------------------------------------+
|
||||
$errors = array();
|
||||
|
||||
if (isset($_POST['submit']))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ include_once(PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php');
|
|||
// +-----------------------------------------------------------------------+
|
||||
// | unit mode form submission |
|
||||
// +-----------------------------------------------------------------------+
|
||||
$errors = array();
|
||||
|
||||
if (isset($_POST['submit']))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ if( !defined("PHPWG_ROOT_PATH") )
|
|||
include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
|
||||
|
||||
//-------------------------------------------------------------- delete a group
|
||||
$error = array();
|
||||
if ( isset( $_POST['delete'] ) && isset( $_POST['confirm_delete'] ) )
|
||||
{
|
||||
// destruction of the access linked to the group
|
||||
|
|
@ -57,9 +56,9 @@ elseif ( isset( $_POST['new'] ) )
|
|||
if ( empty($_POST['newgroup']) || preg_match( "/'/", $_POST['newgroup'] )
|
||||
or preg_match( '/"/', $_POST['newgroup'] ) )
|
||||
{
|
||||
array_push( $error, $lang['group_add_error1'] );
|
||||
array_push( $page['errors'], $lang['group_add_error1'] );
|
||||
}
|
||||
if ( count( $error ) == 0 )
|
||||
if ( count( $page['errors'] ) == 0 )
|
||||
{
|
||||
// is the group not already existing ?
|
||||
$query = 'SELECT id FROM '.GROUPS_TABLE;
|
||||
|
|
@ -68,10 +67,10 @@ elseif ( isset( $_POST['new'] ) )
|
|||
$result = pwg_query( $query );
|
||||
if ( mysql_num_rows( $result ) > 0 )
|
||||
{
|
||||
array_push( $error, $lang['group_add_error2'] );
|
||||
array_push( $page['errors'], $lang['group_add_error2'] );
|
||||
}
|
||||
}
|
||||
if ( count( $error ) == 0 )
|
||||
if ( count( $page['errors'] ) == 0 )
|
||||
{
|
||||
// creating the group
|
||||
$query = ' INSERT INTO '.GROUPS_TABLE;
|
||||
|
|
@ -80,13 +79,13 @@ elseif ( isset( $_POST['new'] ) )
|
|||
pwg_query( $query );
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------- user management
|
||||
//------------------------------------------------------------- user management
|
||||
elseif ( isset( $_POST['add'] ) )
|
||||
{
|
||||
$userdata = getuserdata($_POST['username']);
|
||||
if (!$userdata)
|
||||
{
|
||||
array_push($error, $lang['user_err_unknown']);
|
||||
array_push($page['errors'], $lang['user_err_unknown']);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -113,15 +112,6 @@ elseif (isset( $_POST['deny_user'] ))
|
|||
$query.= ') AND group_id = '.$_POST['edit_group_id'];
|
||||
pwg_query( $query );
|
||||
}
|
||||
//-------------------------------------------------------------- errors display
|
||||
if ( sizeof( $error ) != 0 )
|
||||
{
|
||||
$template->assign_block_vars('errors',array());
|
||||
for ( $i = 0; $i < sizeof( $error ); $i++ )
|
||||
{
|
||||
$template->assign_block_vars('errors.error',array('ERROR'=>$error[$i]));
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------- groups list
|
||||
|
||||
$query = 'SELECT id,name FROM '.GROUPS_TABLE;
|
||||
|
|
|
|||
|
|
@ -31,16 +31,15 @@ if(!defined("PHPWG_ROOT_PATH"))
|
|||
}
|
||||
include_once(PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php');
|
||||
//--------------------------------------------------------- update informations
|
||||
$errors = array();
|
||||
// first, we verify whether there is a mistake on the given creation date
|
||||
if (isset($_POST['date_creation']) and !empty($_POST['date_creation']))
|
||||
{
|
||||
if (!check_date_format($_POST['date_creation']))
|
||||
{
|
||||
array_push($errors, $lang['err_date']);
|
||||
array_push($page['errors'], $lang['err_date']);
|
||||
}
|
||||
}
|
||||
if (isset($_POST['submit']) and count($errors) == 0)
|
||||
if (isset($_POST['submit']) and count($page['errors']) == 0)
|
||||
{
|
||||
$query = 'UPDATE '.IMAGES_TABLE.' SET name = ';
|
||||
if ($_POST['name'] == '')
|
||||
|
|
@ -160,7 +159,7 @@ $thumbnail_url = get_thumbnail_src($row['path'], @$row['tn_ext']);
|
|||
|
||||
$url_img = PHPWG_ROOT_PATH.'picture.php?image_id='.$_GET['image_id'];
|
||||
$url_img .= '&cat='.$row['storage_category_id'];
|
||||
$date = isset($_POST['date_creation']) && empty($errors)
|
||||
$date = isset($_POST['date_creation']) && empty($page['errors'])
|
||||
?$_POST['date_creation']:date_convert_back(@$row['date_creation']);
|
||||
|
||||
$url = PHPWG_ROOT_PATH.'admin.php?page=cat_modify&cat_id=';
|
||||
|
|
@ -212,16 +211,6 @@ $template->assign_vars(array(
|
|||
'F_ACTION'=>add_session_id(PHPWG_ROOT_PATH.'admin.php?'.$_SERVER['QUERY_STRING'])
|
||||
));
|
||||
|
||||
//-------------------------------------------------------------- errors display
|
||||
if (count($errors) != 0)
|
||||
{
|
||||
$template->assign_block_vars('errors',array());
|
||||
foreach ($errors as $error)
|
||||
{
|
||||
$template->assign_block_vars('errors.error',array('ERROR'=>$error));
|
||||
}
|
||||
}
|
||||
|
||||
// associate to another category ?
|
||||
$query = '
|
||||
SELECT id,name,uppercats,global_rank
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ define('CURRENT_DATE', date('Y-m-d'));
|
|||
*/
|
||||
function remote_output($url)
|
||||
{
|
||||
global $template, $errors, $lang;
|
||||
global $template, $page, $lang;
|
||||
|
||||
if($lines = @file($url))
|
||||
{
|
||||
|
|
@ -68,7 +68,7 @@ function remote_output($url)
|
|||
}
|
||||
else
|
||||
{
|
||||
array_push($errors, $lang['remote_site_file_not_found']);
|
||||
array_push($page['errors'], $lang['remote_site_file_not_found']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -120,7 +120,7 @@ SELECT id,dir
|
|||
*/
|
||||
function update_remote_site($listing_file, $site_id)
|
||||
{
|
||||
global $lang, $counts, $template, $removes, $errors;
|
||||
global $lang, $counts, $template, $removes, $page;
|
||||
|
||||
if (@fopen($listing_file, 'r'))
|
||||
{
|
||||
|
|
@ -159,7 +159,7 @@ function update_remote_site($listing_file, $site_id)
|
|||
}
|
||||
else
|
||||
{
|
||||
array_push($errors, $lang['remote_site_listing_not_found']);
|
||||
array_push($page['errors'], $lang['remote_site_listing_not_found']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -518,14 +518,12 @@ $template->assign_vars(
|
|||
// +-----------------------------------------------------------------------+
|
||||
// | new site creation form |
|
||||
// +-----------------------------------------------------------------------+
|
||||
$errors = array();
|
||||
|
||||
if (isset($_POST['submit']))
|
||||
{
|
||||
// site must start by http:// or https://
|
||||
if (!preg_match('/^https?:\/\/[~\/\.\w-]+$/', $_POST['galleries_url']))
|
||||
{
|
||||
array_push($errors, $lang['remote_site_uncorrect_url']);
|
||||
array_push($page['errors'], $lang['remote_site_uncorrect_url']);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -542,11 +540,11 @@ SELECT COUNT(id) AS count
|
|||
$row = mysql_fetch_array(pwg_query($query));
|
||||
if ($row['count'] > 0)
|
||||
{
|
||||
array_push($errors, $lang['remote_site_already_exists']);
|
||||
array_push($page['errors'], $lang['remote_site_already_exists']);
|
||||
}
|
||||
}
|
||||
|
||||
if (count($errors) == 0)
|
||||
if (count($page['errors']) == 0)
|
||||
{
|
||||
$url = $page['galleries_url'].'create_listing_file.php';
|
||||
$url.= '?action=test';
|
||||
|
|
@ -556,16 +554,17 @@ SELECT COUNT(id) AS count
|
|||
$first_line = strip_tags($lines[0]);
|
||||
if (!preg_match('/^PWG-INFO-2:/', $first_line))
|
||||
{
|
||||
array_push($errors, $lang['remote_site_error'].' : '.$first_line);
|
||||
array_push($page['errors'],
|
||||
$lang['remote_site_error'].' : '.$first_line);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
array_push($errors, $lang['remote_site_file_not_found']);
|
||||
array_push($page['errors'], $lang['remote_site_file_not_found']);
|
||||
}
|
||||
}
|
||||
|
||||
if (count($errors) == 0)
|
||||
if (count($page['errors']) == 0)
|
||||
{
|
||||
$query = '
|
||||
INSERT INTO '.SITES_TABLE.'
|
||||
|
|
@ -575,11 +574,8 @@ INSERT INTO '.SITES_TABLE.'
|
|||
;';
|
||||
pwg_query($query);
|
||||
|
||||
$template->assign_block_vars(
|
||||
'confirmation',
|
||||
array(
|
||||
'CONTENT'=>$page['galleries_url'].' '.$lang['remote_site_created']
|
||||
));
|
||||
array_push($page['infos'],
|
||||
$page['galleries_url'].' '.$lang['remote_site_created']);
|
||||
}
|
||||
}
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
|
@ -607,13 +603,8 @@ SELECT galleries_url
|
|||
case 'delete' :
|
||||
{
|
||||
delete_site($page['site']);
|
||||
|
||||
$template->assign_block_vars(
|
||||
'confirmation',
|
||||
array(
|
||||
'CONTENT'=>$galleries_url.' '.$lang['remote_site_deleted']
|
||||
));
|
||||
|
||||
array_push($page['infos'],
|
||||
$galleries_url.' '.$lang['remote_site_deleted']);
|
||||
break;
|
||||
}
|
||||
case 'generate' :
|
||||
|
|
@ -738,17 +729,6 @@ while ($row = mysql_fetch_array($result))
|
|||
);
|
||||
}
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | errors display |
|
||||
// +-----------------------------------------------------------------------+
|
||||
if (count($errors) != 0)
|
||||
{
|
||||
$template->assign_block_vars('errors',array());
|
||||
foreach ($errors as $error)
|
||||
{
|
||||
$template->assign_block_vars('errors.error',array('ERROR'=>$error));
|
||||
}
|
||||
}
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | sending html code |
|
||||
// +-----------------------------------------------------------------------+
|
||||
$template->assign_var_from_handle('ADMIN_CONTENT', 'remote_site');
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
|
|||
// "thumbnail".
|
||||
function RatioResizeImg($path, $newWidth, $newHeight, $tn_ext)
|
||||
{
|
||||
global $conf, $lang, $errors;
|
||||
global $conf, $lang, $page;
|
||||
|
||||
$filename = basename($path);
|
||||
$dirname = dirname($path);
|
||||
|
|
@ -100,7 +100,8 @@ function RatioResizeImg($path, $newWidth, $newHeight, $tn_ext)
|
|||
{
|
||||
if (!is_writable($dirname))
|
||||
{
|
||||
array_push($errors, '['.$dirname.'] : '.$lang['no_write_access']);
|
||||
array_push($page['errors'],
|
||||
'['.$dirname.'] : '.$lang['no_write_access']);
|
||||
return false;
|
||||
}
|
||||
umask(0000);
|
||||
|
|
@ -114,7 +115,7 @@ function RatioResizeImg($path, $newWidth, $newHeight, $tn_ext)
|
|||
// creation and backup of final picture
|
||||
if (!is_writable($tndir))
|
||||
{
|
||||
array_push($errors, '['.$tndir.'] : '.$lang['no_write_access']);
|
||||
array_push($page['errors'], '['.$tndir.'] : '.$lang['no_write_access']);
|
||||
return false;
|
||||
}
|
||||
imagejpeg($destImage, $dest_file);
|
||||
|
|
@ -148,7 +149,6 @@ function RatioResizeImg($path, $newWidth, $newHeight, $tn_ext)
|
|||
}
|
||||
}
|
||||
|
||||
$errors = array();
|
||||
$pictures = array();
|
||||
$stats = array();
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
|
@ -247,22 +247,21 @@ foreach ($fs['elements'] as $path)
|
|||
// +-----------------------------------------------------------------------+
|
||||
if (isset($_POST['submit']))
|
||||
{
|
||||
$errors = array();
|
||||
$times = array();
|
||||
$infos = array();
|
||||
|
||||
// checking criteria
|
||||
if (!ereg('^[0-9]{2,3}$', $_POST['width']) or $_POST['width'] < 10)
|
||||
{
|
||||
array_push($errors, $lang['tn_err_width'].' 10');
|
||||
array_push($page['errors'], $lang['tn_err_width'].' 10');
|
||||
}
|
||||
if (!ereg('^[0-9]{2,3}$', $_POST['height']) or $_POST['height'] < 10)
|
||||
{
|
||||
array_push($errors, $lang['tn_err_height'].' 10');
|
||||
array_push($page['errors'], $lang['tn_err_height'].' 10');
|
||||
}
|
||||
|
||||
// picture miniaturization
|
||||
if (count($errors) == 0)
|
||||
if (count($page['errors']) == 0)
|
||||
{
|
||||
$num = 1;
|
||||
foreach ($wo_thumbnails as $path)
|
||||
|
|
@ -345,17 +344,6 @@ if (isset($_POST['submit']))
|
|||
}
|
||||
}
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | errors display |
|
||||
// +-----------------------------------------------------------------------+
|
||||
if (count($errors) != 0)
|
||||
{
|
||||
$template->assign_block_vars('errors',array());
|
||||
foreach ($errors as $error)
|
||||
{
|
||||
$template->assign_block_vars('errors.error',array('ERROR'=>$error));
|
||||
}
|
||||
}
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | form & pictures without thumbnails display |
|
||||
// +-----------------------------------------------------------------------+
|
||||
$remainings = array_diff($wo_thumbnails, $thumbnalized);
|
||||
|
|
|
|||
|
|
@ -654,11 +654,11 @@ if (isset($_POST['submit'])
|
|||
|
||||
if (count($errors) > 0)
|
||||
{
|
||||
$template->assign_block_vars('update.errors', array());
|
||||
$template->assign_block_vars('update.update_errors', array());
|
||||
foreach ($errors as $error)
|
||||
{
|
||||
$template->assign_block_vars(
|
||||
'update.errors.error',
|
||||
'update.update_errors.update_error',
|
||||
array(
|
||||
'ELEMENT' => $error['path'],
|
||||
'LABEL' => $error['type'].' ('.$error_labels[$error['type']].')'
|
||||
|
|
@ -669,11 +669,11 @@ if (isset($_POST['submit'])
|
|||
and isset($_POST['display_info'])
|
||||
and $_POST['display_info'] == 1)
|
||||
{
|
||||
$template->assign_block_vars('update.infos', array());
|
||||
$template->assign_block_vars('update.update_infos', array());
|
||||
foreach ($infos as $info)
|
||||
{
|
||||
$template->assign_block_vars(
|
||||
'update.infos.info',
|
||||
'update.update_infos.update_info',
|
||||
array(
|
||||
'ELEMENT' => $info['path'],
|
||||
'LABEL' => $info['info']
|
||||
|
|
|
|||
|
|
@ -45,18 +45,16 @@ include_once(PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php');
|
|||
|
||||
if (isset($_POST['submit_add']))
|
||||
{
|
||||
$errors = register_user($_POST['login'],
|
||||
$_POST['password'],
|
||||
$_POST['password'],
|
||||
'');
|
||||
$page['errors'] = register_user($_POST['login'],
|
||||
$_POST['password'],
|
||||
$_POST['password'],
|
||||
'');
|
||||
}
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | preferences form submission |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
$errors = array();
|
||||
|
||||
if (isset($_POST['pref_submit']))
|
||||
{
|
||||
$collection = array();
|
||||
|
|
@ -193,7 +191,7 @@ $template->set_filenames(array('user_list'=>'admin/user_list.tpl'));
|
|||
|
||||
$base_url = add_session_id(PHPWG_ROOT_PATH.'admin.php?page=user_list');
|
||||
|
||||
$conf['users_page'] = 20;
|
||||
$conf['users_page'] = 10;
|
||||
|
||||
if (isset($_GET['start']) and is_numeric($_GET['start']))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -72,12 +72,12 @@ if ( isset( $_POST['submit'] ) )
|
|||
}
|
||||
}
|
||||
}
|
||||
array_push($infos, $lang['waiting_update']);
|
||||
}
|
||||
|
||||
//----------------------------------------------------- template initialization
|
||||
$template->set_filenames(array('waiting'=>'admin/waiting.tpl'));
|
||||
$template->assign_vars(array(
|
||||
'L_WAITING_CONFIRMATION'=>$lang['waiting_update'],
|
||||
'L_AUTHOR'=>$lang['author'],
|
||||
'L_THUMBNAIL'=>$lang['thumbnail'],
|
||||
'L_DATE'=>$lang['date'],
|
||||
|
|
@ -90,11 +90,6 @@ $template->assign_vars(array(
|
|||
'F_ACTION'=>add_session_id(str_replace( '&', '&', $_SERVER['REQUEST_URI'] ))
|
||||
));
|
||||
|
||||
//-------------------------------------------------------- confirmation message
|
||||
if (isset($_POST['submit']))
|
||||
{
|
||||
$template->assign_block_vars('confirmation' ,array());
|
||||
}
|
||||
//---------------------------------------------------------------- form display
|
||||
$cat_names = array();
|
||||
$query = 'SELECT * FROM '.WAITING_TABLE;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
2005-06-11 Pierrick LE GALL
|
||||
|
||||
* errors and informations boxes : management centralized in
|
||||
admin.php, $errors and $infos arrays replaced by $page['errors']
|
||||
and $page['infos'], special management for admin/update.php (more
|
||||
complex management)
|
||||
|
||||
2005-06-11 Pierrick LE GALL
|
||||
|
||||
* bug 96 (informations given by uploaders are lost) correction
|
||||
|
|
|
|||
|
|
@ -71,6 +71,27 @@
|
|||
<td style="padding:10px;width:99%;" valign="top">
|
||||
<div class="home">
|
||||
<div class="titrePage">{PAGE_TITLE}</div>
|
||||
|
||||
<!-- BEGIN errors -->
|
||||
<div id="errors">
|
||||
<ul>
|
||||
<!-- BEGIN error -->
|
||||
<li>{errors.error.ERROR}</li>
|
||||
<!-- END error -->
|
||||
</ul>
|
||||
</div>
|
||||
<!-- END errors -->
|
||||
|
||||
<!-- BEGIN infos -->
|
||||
<div id="infos">
|
||||
<ul>
|
||||
<!-- BEGIN info -->
|
||||
<li>{infos.info.INFO}</li>
|
||||
<!-- END info -->
|
||||
</ul>
|
||||
</div>
|
||||
<!-- END infos -->
|
||||
|
||||
<div align="center">{ADMIN_CONTENT}{ADMIN_CONTENT_2}</div>
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
|||
|
|
@ -1,19 +1,3 @@
|
|||
<!-- BEGIN errors -->
|
||||
<div class="errors">
|
||||
<ul>
|
||||
<!-- BEGIN error -->
|
||||
<li>{errors.error.ERROR}</li>
|
||||
<!-- END error -->
|
||||
</ul>
|
||||
</div>
|
||||
<!-- END errors -->
|
||||
<!-- BEGIN infos -->
|
||||
<div class="info">
|
||||
<!-- BEGIN info -->
|
||||
<li>{infos.info.INFO}</li>
|
||||
<!-- END info -->
|
||||
</div>
|
||||
<!-- END infos -->
|
||||
<div class="admin">{CATEGORIES_NAV}</div>
|
||||
<table style="width:100%;">
|
||||
<!-- BEGIN category -->
|
||||
|
|
|
|||
|
|
@ -1,7 +1,3 @@
|
|||
<!-- BEGIN confirmation -->
|
||||
<div style="color:red;text-align:center;">
|
||||
{L_EDIT_CONFIRM} <a href="{U_PERMISSIONS}">{L_HERE}</a></div>
|
||||
<!-- END confirmation -->
|
||||
<div class="admin">{CATEGORIES_NAV}</div>
|
||||
<form action="{F_ACTION}" method="POST">
|
||||
<table style="width:100%;">
|
||||
|
|
|
|||
|
|
@ -1,15 +1,3 @@
|
|||
<!-- BEGIN errors -->
|
||||
<div class="errors">
|
||||
<ul>
|
||||
<!-- BEGIN error -->
|
||||
<li>{errors.error.ERROR}</li>
|
||||
<!-- END error -->
|
||||
</ul>
|
||||
</div>
|
||||
<!-- END errors -->
|
||||
<!-- BEGIN confirmation -->
|
||||
<div class="info">{L_CONFIRM}</div>
|
||||
<!-- END confirmation -->
|
||||
<form method="post" action="{F_ACTION}">
|
||||
<table width="100%" align="center">
|
||||
<!-- BEGIN general -->
|
||||
|
|
|
|||
|
|
@ -1,12 +1,3 @@
|
|||
<!-- BEGIN errors -->
|
||||
<div class="errors">
|
||||
<ul>
|
||||
<!-- BEGIN error -->
|
||||
<li>{errors.error.ERROR}</li>
|
||||
<!-- END error -->
|
||||
</ul>
|
||||
</div>
|
||||
<!-- END errors -->
|
||||
<form method="post" name="post" action="{S_GROUP_ACTION}">
|
||||
<div class="admin">{L_GROUP_SELECT}</div>
|
||||
<!-- BEGIN select_box -->
|
||||
|
|
@ -49,4 +40,4 @@
|
|||
</div>
|
||||
<br />
|
||||
<!-- END edit_group -->
|
||||
</form>
|
||||
</form>
|
||||
|
|
|
|||
BIN
template/default/admin/images/errors.png
Normal file
BIN
template/default/admin/images/errors.png
Normal file
Binary file not shown.
BIN
template/default/admin/images/infos.png
Normal file
BIN
template/default/admin/images/infos.png
Normal file
Binary file not shown.
|
|
@ -1,12 +1,3 @@
|
|||
<!-- BEGIN errors -->
|
||||
<div class="errors">
|
||||
<ul>
|
||||
<!-- BEGIN error -->
|
||||
<li>{errors.error.ERROR}</li>
|
||||
<!-- END error -->
|
||||
</ul>
|
||||
</div>
|
||||
<!-- END errors -->
|
||||
<div class="admin">{TITLE_IMG}</div>
|
||||
<form action="{F_ACTION}" method="POST">
|
||||
<table style="width:100%;">
|
||||
|
|
|
|||
|
|
@ -1,19 +1,5 @@
|
|||
{REMOTE_SITE_TITLE}
|
||||
|
||||
<!-- BEGIN errors -->
|
||||
<div class="errors">
|
||||
<ul>
|
||||
<!-- BEGIN error -->
|
||||
<li>{errors.error.ERROR}</li>
|
||||
<!-- END error -->
|
||||
</ul>
|
||||
</div>
|
||||
<!-- END errors -->
|
||||
|
||||
<!-- BEGIN confirmation -->
|
||||
<div class="info">{confirmation.CONTENT}</div>
|
||||
<!-- END confirmation -->
|
||||
|
||||
<!-- BEGIN update -->
|
||||
<div class="admin">{L_RESULT_UPDATE}</div>
|
||||
<ul style="text-align:left;">
|
||||
|
|
|
|||
|
|
@ -1,13 +1,3 @@
|
|||
<!-- BEGIN errors -->
|
||||
<div class="errors">
|
||||
<ul>
|
||||
<!-- BEGIN error -->
|
||||
<li>{errors.error.ERROR}</li>
|
||||
<!-- END error -->
|
||||
</ul>
|
||||
</div>
|
||||
<!-- END errors -->
|
||||
|
||||
<!-- BEGIN results -->
|
||||
<div class="admin">{L_RESULTS}</div>
|
||||
<table style="width:100%;">
|
||||
|
|
|
|||
|
|
@ -7,27 +7,27 @@
|
|||
<li class="update_summary_del">{update.NB_DEL_ELEMENTS} {L_NB_DEL_ELEMENTS}</li>
|
||||
<li class="update_summary_err">{update.NB_ERRORS} {L_UPDATE_NB_ERRORS}</li>
|
||||
</ul>
|
||||
<!-- BEGIN errors -->
|
||||
<!-- BEGIN update_errors -->
|
||||
<div class="admin">{L_UPDATE_ERROR_LIST_TITLE}</div>
|
||||
<ul style="text-align:left;">
|
||||
<!-- BEGIN error -->
|
||||
<li>[{update.errors.error.ELEMENT}] {update.errors.error.LABEL}</li>
|
||||
<!-- END error -->
|
||||
<!-- BEGIN update_error -->
|
||||
<li>[{update.update_errors.update_error.ELEMENT}] {update.update_errors.update_error.LABEL}</li>
|
||||
<!-- END update_error -->
|
||||
</ul>
|
||||
<div class="admin">{L_UPDATE_ERRORS_CAPTION}</div>
|
||||
<ul style="text-align:left;">
|
||||
<li><strong>PWG-UPDATE-1</strong> : {L_UPDATE_WRONG_DIRNAME_INFO}</li>
|
||||
<li><strong>PWG-UPDATE-2</strong> : {L_UPDATE_MISSING_TN_INFO} {{PICTURE_EXT_LIST}}</li>
|
||||
</ul>
|
||||
<!-- END errors -->
|
||||
<!-- BEGIN infos -->
|
||||
<!-- END update_errors -->
|
||||
<!-- BEGIN update_infos -->
|
||||
<div class="admin">{L_UPDATE_INFOS_TITLE}</div>
|
||||
<ul style="text-align:left;">
|
||||
<!-- BEGIN info -->
|
||||
<li>[{update.infos.info.ELEMENT}] {update.infos.info.LABEL}</li>
|
||||
<!-- END info -->
|
||||
<!-- BEGIN update_info -->
|
||||
<li>[{update.update_infos.update_info.ELEMENT}] {update.update_infos.update_info.LABEL}</li>
|
||||
<!-- END update_info -->
|
||||
</ul>
|
||||
<!-- END infos -->
|
||||
<!-- END update_infos -->
|
||||
<!-- END update -->
|
||||
|
||||
<!-- BEGIN metadata_result -->
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
<form action="{F_ACTION}" method="post">
|
||||
<!-- BEGIN confirmation -->
|
||||
<div class="info">{L_WAITING_CONFIRMATION}</div>
|
||||
<!-- END confirmation -->
|
||||
<table style="width:100%;" >
|
||||
<tr class="throw">
|
||||
<th style="width:20%;">{L_CATEGORY}</th>
|
||||
|
|
|
|||
|
|
@ -381,3 +381,35 @@ pre { text-align:left; }
|
|||
label:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Errors box in administration
|
||||
*/
|
||||
#errors {
|
||||
text-align: left;
|
||||
background-color: red;
|
||||
background-image: url(admin/images/errors.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: top right;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
margin: 5px;
|
||||
border:1px solid black;
|
||||
padding: 10px 50px 10px 10px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Informations box in administration
|
||||
*/
|
||||
#infos {
|
||||
text-align: left;
|
||||
background-color: #eee;
|
||||
background-image: url(admin/images/infos.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: top right;
|
||||
color: black;
|
||||
font-weight: bold;
|
||||
margin: 5px;
|
||||
border:1px solid gray;
|
||||
padding: 10px 50px 10px 10px;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue