aboutsummaryrefslogtreecommitdiffstats
path: root/admin/cat_modify.php
diff options
context:
space:
mode:
authorz0rglub <z0rglub@piwigo.org>2003-07-25 21:33:41 +0000
committerz0rglub <z0rglub@piwigo.org>2003-07-25 21:33:41 +0000
commit963e1ef71418bdad2e81e78b983f57633dbf3c18 (patch)
tree53a64ea75ff14228f3a16da3f07ca5b996f15d4c /admin/cat_modify.php
parent1400807269662dfe7e4bc015c5d1385113c50418 (diff)
Adding support of independant uploadable categories
git-svn-id: http://piwigo.org/svn/trunk@38 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/cat_modify.php')
-rw-r--r--admin/cat_modify.php55
1 files changed, 40 insertions, 15 deletions
diff --git a/admin/cat_modify.php b/admin/cat_modify.php
index 3e171139f..a10655975 100644
--- a/admin/cat_modify.php
+++ b/admin/cat_modify.php
@@ -20,7 +20,8 @@ include_once( './include/isadmin.inc.php' );
$sub = $vtp->Open( '../template/'.$user['template'].'/admin/cat_modify.vtp' );
$tpl = array( 'remote_site','editcat_confirm','editcat_back','editcat_title1',
'editcat_name','editcat_comment','editcat_status',
- 'editcat_visible','editcat_status_info', 'submit' );
+ 'editcat_visible','editcat_visible_info', 'submit',
+ 'editcat_uploadable' );
templatize_array( $tpl, 'lang', $sub );
//---------------------------------------------------------------- verification
if ( !is_numeric( $_GET['cat'] ) )
@@ -53,25 +54,23 @@ if ( isset( $_POST['submit'] ) )
}
$query = 'UPDATE '.PREFIX_TABLE.'categories';
+
+ $query.= ' SET name = ';
if ( $_POST['name'] == '' )
- {
- $query.= ' SET name = NULL';
- }
+ $query.= 'NULL';
else
- {
- $query.= " SET name = '".htmlentities( $_POST['name'], ENT_QUOTES)."'";
- }
+ $query.= "'".htmlentities( $_POST['name'], ENT_QUOTES)."'";
+
+ $query.= ', comment = ';
if ( $_POST['comment'] == '' )
- {
- $query.= ', comment = NULL';
- }
+ $query.= 'NULL';
else
- {
- $query.= ", comment = '".htmlentities( $_POST['comment'], ENT_QUOTES )."'";
- }
+ $query.= "'".htmlentities( $_POST['comment'], ENT_QUOTES )."'";
+
$query.= ", status = '".$_POST['status']."'";
$query.= ", visible = '".$_POST['visible']."'";
- $query.= " WHERE id = '".$_GET['cat']."'";
+ $query.= ", uploadable = '".$_POST['uploadable']."'";
+ $query.= ' WHERE id = '.$_GET['cat'];
$query.= ';';
mysql_query( $query );
@@ -93,7 +92,7 @@ if ( isset( $_POST['submit'] ) )
$form_action = './admin.php?page=cat_modify&amp;cat='.$_GET['cat'];
$vtp->setVar( $sub, 'form_action', add_session_id( $form_action ) );
-$query = 'SELECT a.id,name,dir,status,comment';
+$query = 'SELECT a.id,name,dir,status,comment,uploadable';
$query.= ',id_uppercat,site_id,galleries_url,visible';
$query.= ' FROM '.PREFIX_TABLE.'categories as a, '.PREFIX_TABLE.'sites as b';
$query.= ' WHERE a.id = '.$_GET['cat'];
@@ -148,6 +147,32 @@ if ( $row['visible'] == 'false' )
}
$vtp->setVar( $sub, 'visible_option.checked', $checked );
$vtp->closeSession( $sub, 'visible_option' );
+// uploadable : true or false
+if ( $conf['upload_available'] )
+{
+ $vtp->addSession( $sub, 'uploadable' );
+ $vtp->addSession( $sub, 'uploadable_option' );
+ $vtp->setVar( $sub, 'uploadable_option.value', 'true' );
+ $vtp->setVar( $sub, 'uploadable_option.option', $lang['yes'] );
+ $checked = '';
+ if ( $row['uploadable'] == 'true' )
+ {
+ $checked = ' checked="checked"';
+ }
+ $vtp->setVar( $sub, 'uploadable_option.checked', $checked );
+ $vtp->closeSession( $sub, 'uploadable_option' );
+ $vtp->addSession( $sub, 'uploadable_option' );
+ $vtp->setVar( $sub, 'uploadable_option.value', 'false' );
+ $vtp->setVar( $sub, 'uploadable_option.option', $lang['no'] );
+ $checked = '';
+ if ( $row['uploadable'] == 'false' )
+ {
+ $checked = ' checked="checked"';
+ }
+ $vtp->setVar( $sub, 'uploadable_option.checked', $checked );
+ $vtp->closeSession( $sub, 'uploadable_option' );
+ $vtp->closeSession( $sub, 'uploadable' );
+}
//----------------------------------------------------------- sending html code
$vtp->Parse( $handle , 'sub', $sub );
?> \ No newline at end of file