aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
Diffstat (limited to 'admin')
-rw-r--r--admin/comments.php16
-rw-r--r--admin/configuration.php54
-rw-r--r--admin/element_set_global.php143
-rw-r--r--admin/element_set_unit.php37
-rw-r--r--admin/notification_by_mail.php38
5 files changed, 115 insertions, 173 deletions
diff --git a/admin/comments.php b/admin/comments.php
index bae32dcb3..a7351ff04 100644
--- a/admin/comments.php
+++ b/admin/comments.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$
@@ -124,9 +124,9 @@ $template->set_filenames(array('comments'=>'admin/comments.tpl'));
// TabSheet initialization
waiting_tabsheet();
-$template->assign_vars(
+$template->assign(
array(
- 'F_ACTION' => PHPWG_ROOT_PATH.'admin.php?page=comments'
+ 'F_ACTION' => get_root_url().'admin.php?page=comments'
)
);
@@ -154,8 +154,8 @@ while ($row = mysql_fetch_assoc($result))
'tn_ext'=>@$row['tn_ext']
)
);
- $template->assign_block_vars(
- 'comment',
+ $template->append(
+ 'comments',
array(
'U_PICTURE' =>
PHPWG_ROOT_PATH.'admin.php?page=picture_modify'.
@@ -171,11 +171,7 @@ while ($row = mysql_fetch_assoc($result))
array_push($list, $row['id']);
}
-$template->assign_vars(
- array(
- 'LIST' => implode(',', $list)
- )
- );
+$template->assign('LIST', implode(',', $list) );
// +-----------------------------------------------------------------------+
// | sending html code |
diff --git a/admin/configuration.php b/admin/configuration.php
index 1f96265ec..9f741ad89 100644
--- a/admin/configuration.php
+++ b/admin/configuration.php
@@ -49,6 +49,7 @@ else
}
$main_checkboxes = array(
+ 'gallery_locked',
'allow_user_registration',
'obligatory_user_mail_address',
'rate',
@@ -169,37 +170,23 @@ $tabsheet->select($page['section']);
// Assign tabsheet to template
$tabsheet->assign();
-$action = PHPWG_ROOT_PATH.'admin.php?page=configuration';
+$action = get_root_url().'admin.php?page=configuration';
$action.= '&section='.$page['section'];
$template->assign_vars(
array(
- 'L_YES'=>l10n('yes'),
- 'L_NO'=>l10n('no'),
- 'L_SUBMIT'=>l10n('submit'),
- 'L_RESET'=>l10n('reset'),
-
- 'U_HELP' => PHPWG_ROOT_PATH.'popuphelp.php?page=configuration',
+ 'U_HELP' => get_root_url().'popuphelp.php?page=configuration',
'F_ACTION'=>$action
));
-$html_check='checked="checked"';
-
-$include_submit_buttons = true;
-
switch ($page['section'])
{
case 'main' :
{
- $lock_yes = ($conf['gallery_locked']==true)?'checked="checked"':'';
- $lock_no = ($conf['gallery_locked']==false)?'checked="checked"':'';
-
- $template->assign_block_vars(
+ $template->assign(
'main',
array(
- 'GALLERY_LOCKED_YES'=>$lock_yes,
- 'GALLERY_LOCKED_NO'=>$lock_no,
'CONF_GALLERY_TITLE' => htmlspecialchars($conf['gallery_title']),
'CONF_PAGE_BANNER' => htmlspecialchars($conf['page_banner']),
'CONF_GALLERY_URL' => $conf['gallery_url'],
@@ -207,11 +194,12 @@ switch ($page['section'])
foreach( $main_checkboxes as $checkbox)
{
- $template->merge_block_vars(
+ $template->append(
'main',
array(
- strtoupper($checkbox) => ($conf[$checkbox]==true)?$html_check:''
- )
+ $checkbox => $conf[$checkbox]
+ ),
+ true
);
}
break;
@@ -219,22 +207,21 @@ switch ($page['section'])
case 'history' :
{
//Necessary for merge_block_vars
- $template->assign_block_vars('history', array());
-
foreach( $history_checkboxes as $checkbox)
{
- $template->merge_block_vars(
+ $template->append(
'history',
array(
- strtoupper($checkbox) => ($conf[$checkbox]==true)?$html_check:''
- )
+ $checkbox => $conf[$checkbox]
+ ),
+ true
);
}
break;
}
case 'comments' :
{
- $template->assign_block_vars(
+ $template->assign(
'comments',
array(
'NB_COMMENTS_PAGE'=>$conf['nb_comment_page'],
@@ -242,11 +229,12 @@ switch ($page['section'])
foreach( $comments_checkboxes as $checkbox)
{
- $template->merge_block_vars(
+ $template->append(
'comments',
array(
- strtoupper($checkbox) => ($conf[$checkbox]==true)?$html_check:''
- )
+ $checkbox => $conf[$checkbox]
+ ),
+ true
);
}
break;
@@ -273,17 +261,11 @@ switch ($page['section'])
'',
$edit_user
);
- $template->assign_block_vars('default', array());
- $include_submit_buttons = false;
+ $template->assign('default', array());
break;
}
}
-if ($include_submit_buttons)
-{
- $template->assign_block_vars('include_submit_buttons', array());
-}
-
//----------------------------------------------------------- sending html code
$template->assign_var_from_handle('ADMIN_CONTENT', 'config');
?>
diff --git a/admin/element_set_global.php b/admin/element_set_global.php
index a6d3eb282..7cc724b57 100644
--- a/admin/element_set_global.php
+++ b/admin/element_set_global.php
@@ -205,16 +205,14 @@ SELECT id
$template->set_filenames(
array('element_set_global' => 'admin/element_set_global.tpl'));
-$base_url = PHPWG_ROOT_PATH.'admin.php';
+$base_url = get_root_url().'admin.php';
// $form_action = $base_url.'?page=element_set_global';
-$template->assign_vars(
+$template->assign(
array(
'CATEGORIES_NAV'=>$page['title'],
- 'L_SUBMIT'=>l10n('submit'),
-
'U_DISPLAY'=>$base_url.get_query_string_diff(array('display')),
'U_UNIT_MODE'
@@ -231,47 +229,22 @@ $template->assign_vars(
// | caddie options |
// +-----------------------------------------------------------------------+
-if ('caddie' == $_GET['cat'])
-{
- $template->assign_block_vars('in_caddie', array());
-}
-else
-{
- $template->assign_block_vars('not_in_caddie', array());
-}
+$template->assign('IN_CADDIE', 'caddie' == $_GET['cat'] ? true : false );
// +-----------------------------------------------------------------------+
// | global mode form |
// +-----------------------------------------------------------------------+
// Virtualy associate a picture to a category
-$blockname = 'associate_option';
-
-$template->assign_block_vars(
- $blockname,
- array('SELECTED' => '',
- 'VALUE'=> 0,
- 'OPTION' => '------------'
- ));
-
$query = '
SELECT id,name,uppercats,global_rank
FROM '.CATEGORIES_TABLE.'
;';
-display_select_cat_wrapper($query, array(), $blockname, true);
+display_select_cat_wrapper($query, array(), 'associate_options', true);
// Dissociate from a category : categories listed for dissociation can
// only represent virtual links. Links to physical categories can't be
// broken
-$blockname = 'dissociate_option';
-
-$template->assign_block_vars(
- $blockname,
- array('SELECTED' => '',
- 'VALUE'=> 0,
- 'OPTION' => '------------'
- ));
-
if (count($page['cat_elements_id']) > 0)
{
$query = '
@@ -284,81 +257,68 @@ SELECT DISTINCT(category_id) AS id, c.name, uppercats, global_rank
AND ic.image_id = i.id
AND ic.category_id != i.storage_category_id
;';
- display_select_cat_wrapper($query, array(), $blockname, true);
+ display_select_cat_wrapper($query, array(), 'dissociate_options', true);
}
$all_tags = get_all_tags();
-if (count($all_tags) == 0)
-{
- $add_tag_selection =
- '<p>'.
- l10n('No tag defined. Use Administration>Pictures>Tags').
- '</p>';
-}
-else
-{
- $add_tag_selection = get_html_tag_selection(
- $all_tags,
- 'add_tags'
+if (count($all_tags) > 0)
+{// add tags
+ $template->assign(
+ array(
+ 'ADD_TAG_SELECTION' => get_html_tag_selection(
+ $all_tags,
+ 'add_tags'
+ ),
+ )
);
}
-// add tags
-$template->assign_vars(
- array(
- 'ADD_TAG_SELECTION' => $add_tag_selection,
- )
- );
-
if (count($page['cat_elements_id']) > 0)
{
// remove tags
$tags = get_common_tags($page['cat_elements_id'], -1);
usort($tags, 'name_compare');
- $template->assign_vars(
+ $template->assign(
array(
'DEL_TAG_SELECTION' => get_html_tag_selection($tags, 'del_tags'),
)
);
}
+
// creation date
$day =
empty($_POST['date_creation_day']) ? date('j') : $_POST['date_creation_day'];
-get_day_list('date_creation_day', $day);
-if (!empty($_POST['date_creation_month']))
-{
- $month = $_POST['date_creation_month'];
-}
-else
-{
- $month = date('n');
-}
-get_month_list('date_creation_month', $month);
+$month =
+empty($_POST['date_creation_month']) ? date('n') : $_POST['date_creation_month'];
-if (!empty($_POST['date_creation_year']))
-{
- $year = $_POST['date_creation_year'];
-}
-else
-{
- $year = date('Y');
-}
-$template->assign_vars(array('DATE_CREATION_YEAR_VALUE'=>$year));
+$year =
+empty($_POST['date_creation_year']) ? date('Y') : $_POST['date_creation_year'];
+
+$month_list = $lang['month'];
+$month_list[0]='------------';
+ksort($month_list);
+$template->assign( array(
+ 'month_list' => $month_list,
+ 'DATE_CREATION_DAY' => (int)$day,
+ 'DATE_CREATION_MONTH'=> (int)$month,
+ 'DATE_CREATION_YEAR' => (int)$year,
+ )
+ );
// image level options
-$blockname = 'level_option';
+$tpl_options = array();
foreach ($conf['available_permission_levels'] as $level)
{
- $template->assign_block_vars(
- $blockname,
- array(
- 'VALUE' => $level,
- 'CONTENT' => l10n( sprintf('Level %d', $level) ),
- ));
+ $tpl_options[$level] = l10n( sprintf('Level %d', $level) );
}
+$template->assign(
+ array(
+ 'level_options'=> $tpl_options,
+ )
+ );
// +-----------------------------------------------------------------------+
// | global mode thumbnails |
@@ -389,7 +349,7 @@ if (count($page['cat_elements_id']) > 0)
$page['start'],
$page['nb_images']
);
- $template->assign_vars(array('NAV_BAR' => $nav_bar));
+ $template->assign('NAV_BAR', $nav_bar);
$query = '
SELECT id,path,tn_ext,file,filesize,level
@@ -402,34 +362,21 @@ SELECT id,path,tn_ext,file,filesize,level
$result = pwg_query($query);
// template thumbnail initialization
- if (mysql_num_rows($result) > 0)
- {
- $template->assign_block_vars('thumbnails', array());
- }
while ($row = mysql_fetch_assoc($result))
{
$src = get_thumbnail_url($row);
- $template->assign_block_vars(
- 'thumbnails.thumbnail',
+ $template->append(
+ 'thumbnails',
array(
'ID' => $row['id'],
- 'SRC' => $src,
- 'ALT' => $row['file'],
- 'TITLE' => get_thumbnail_title($row)
+ 'TN_SRC' => $src,
+ 'FILE' => $row['file'],
+ 'TITLE' => get_thumbnail_title($row),
+ 'LEVEL' => $row['level']
)
);
-
- if ( $row['level']>0 )
- {
- $template->assign_block_vars('thumbnails.thumbnail.level',
- array(
- 'LEVEL' => $row['level'],
- 'TITLE' => l10n( sprintf('Level %d', $row['level']) ),
- )
- );
- }
}
}
diff --git a/admin/element_set_unit.php b/admin/element_set_unit.php
index cefd8ee4c..a9541f576 100644
--- a/admin/element_set_unit.php
+++ b/admin/element_set_unit.php
@@ -2,10 +2,9 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
-// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
+// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
-// | branch : BSF (Best So Far)
-// | file : $RCSfile$
+// | file : $Id$
// | last update : $Date$
// | last modifier : $Author$
// | revision : $Revision$
@@ -49,7 +48,7 @@ check_status(ACCESS_ADMINISTRATOR);
if (isset($_POST['submit']))
{
- $collection = explode(',', $_POST['list']);
+ $collection = explode(',', $_POST['element_ids']);
$datas = array();
@@ -134,14 +133,14 @@ $template->set_filenames(
$base_url = PHPWG_ROOT_PATH.'admin.php';
-// $form_action = $base_url.'?page=element_set_global';
+$month_list = $lang['month'];
+$month_list[0]='------------';
+ksort($month_list);
-$template->assign_vars(
+$template->assign(
array(
'CATEGORIES_NAV'=>$page['title'],
- 'L_SUBMIT'=>l10n('submit'),
-
'U_ELEMENTS_PAGE'
=>$base_url.get_query_string_diff(array('display','start')),
@@ -152,6 +151,8 @@ $template->assign_vars(
.'&amp;mode=global',
'F_ACTION'=>$base_url.get_query_string_diff(array()),
+
+ 'month_list' => $month_list
)
);
@@ -186,7 +187,7 @@ if (count($page['cat_elements_id']) > 0)
$page['start'],
$page['nb_images']
);
- $template->assign_vars(array('NAV_BAR' => $nav_bar));
+ $template->assign(array('NAV_BAR' => $nav_bar));
// tags
$all_tags = get_all_tags();
@@ -223,7 +224,7 @@ SELECT tag_id
}
else
{
- list($year,$month,$day) = array('','','');
+ list($year,$month,$day) = array('',0,0);
}
if (count($all_tags) > 0)
@@ -242,32 +243,30 @@ SELECT tag_id
'</p>';
}
- $template->assign_block_vars(
- 'element',
+ $template->append(
+ 'elements',
array(
+ 'ID' => $row['id'],
+ 'TN_SRC' => $src,
'LEGEND' =>
!empty($row['name']) ?
$row['name'] : get_name_from_file($row['file']),
'U_EDIT' =>
PHPWG_ROOT_PATH.'admin.php?page=picture_modify'.
'&amp;image_id='.$row['id'],
- 'ID' => $row['id'],
- 'FILENAME' => $row['path'],
- 'TN_SRC' => $src,
'NAME' => @$row['name'],
'AUTHOR' => @$row['author'],
'DESCRIPTION' => @$row['comment'],
'DATE_CREATION_YEAR' => $year,
+ 'DATE_CREATION_MONTH' => (int)$month,
+ 'DATE_CREATION_DAY' => (int)$day,
'TAG_SELECTION' => $tag_selection,
)
);
-
- get_day_list('element.date_creation_day', $day);
- get_month_list('element.date_creation_month', $month);
}
- $template->assign_vars(array('IDS_LIST' => implode(',', $element_ids)));
+ $template->assign('ELEMENT_IDS', implode(',', $element_ids));
}
// +-----------------------------------------------------------------------+
diff --git a/admin/notification_by_mail.php b/admin/notification_by_mail.php
index 38fd8cfb6..913d65283 100644
--- a/admin/notification_by_mail.php
+++ b/admin/notification_by_mail.php
@@ -689,19 +689,37 @@ switch ($page['mode'])
);
$data_users = get_user_notifications('subscribe');
+
+ $opt_true=array();
+ $opt_true_selected=array();
+ $opt_false=array();
+ $opt_false_selected=array();
foreach ($data_users as $nbm_user)
{
- $template->assign_block_vars(
- (get_boolean($nbm_user['enabled']) ? 'category_option_true' : 'category_option_false'),
- array('SELECTED' => ( // Keep selected user where enabled are not changed when change has been notify
- get_boolean($nbm_user['enabled']) ? (isset($_POST['falsify']) and isset($_POST['cat_true']) and in_array($nbm_user['check_key'], $_POST['cat_true']))
- : (isset($_POST['trueify']) and isset($_POST['cat_false']) and in_array($nbm_user['check_key'], $_POST['cat_false']))
- ) ? 'selected="selected"' : '',
- 'VALUE' => $nbm_user['check_key'],
- 'OPTION' => $nbm_user['username'].'['.get_email_address_as_display_text($nbm_user['mail_address']).']'
- ));
+ if ( get_boolean($nbm_user['enabled']) )
+ {
+ $opt_true[ $nbm_user['check_key'] ] = $nbm_user['username'].'['.get_email_address_as_display_text($nbm_user['mail_address']).']';
+ if ((isset($_POST['falsify']) and isset($_POST['cat_true']) and in_array($nbm_user['check_key'], $_POST['cat_true'])) )
+ {
+ $opt_true_selected[] = $nbm_user['check_key'];
+ }
+ }
+ else
+ {
+ $opt_false[ $nbm_user['check_key'] ] = $nbm_user['username'].'['.get_email_address_as_display_text($nbm_user['mail_address']).']';
+ if (isset($_POST['trueify']) and isset($_POST['cat_false']) and in_array($nbm_user['check_key'], $_POST['cat_false']))
+ {
+ $opt_false_selected[] = $nbm_user['check_key'];
+ }
+ }
}
-
+ $template->assign( array(
+ 'category_option_true' => $opt_true,
+ 'category_option_true_selected' => $opt_true_selected,
+ 'category_option_false' => $opt_false,
+ 'category_option_true' => $opt_false_selected,
+ )
+ );
break;
}