Changeset 2490 for trunk/admin
- Timestamp:
- Aug 28, 2008, 10:05:39 PM (16 years ago)
- Location:
- trunk/admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/cat_modify.php
r2324 r2490 38 38 if ( !isset( $_GET['cat_id'] ) || !is_numeric( $_GET['cat_id'] ) ) 39 39 { 40 $_GET['cat_id'] = '-1';40 trigger_error( 'missing cat_id param', E_USER_ERROR); 41 41 } 42 42 … … 44 44 if (isset($_POST['submit'])) 45 45 { 46 $data = 47 array( 48 'id' => $_GET['cat_id'], 49 'name' => @$_POST['name'], 50 'commentable' => $_POST['commentable'], 51 'uploadable' => 52 isset($_POST['uploadable']) ? $_POST['uploadable'] : 'false', 53 'comment' => 54 $conf['allow_html_descriptions'] ? 55 @$_POST['comment'] : strip_tags(@$_POST['comment']) 56 ); 57 58 mass_updates( 59 CATEGORIES_TABLE, 60 array( 61 'primary' => array('id'), 62 'update' => array_diff(array_keys($data), array('id')) 63 ), 64 array($data) 65 ); 66 67 set_cat_visible(array($_GET['cat_id']), $_POST['visible']); 68 set_cat_status(array($_GET['cat_id']), $_POST['status']); 69 70 if (isset($_POST['parent'])) 71 { 72 move_categories( 73 array($_GET['cat_id']), 74 $_POST['parent'] 75 ); 76 } 77 78 $image_order = ''; 46 $image_order = null; 79 47 if ( !isset($_POST['image_order_default']) ) 80 48 { … … 95 63 } 96 64 } 97 $image_order = empty($image_order) ? 'null' : "'$image_order'"; 98 $query = ' 99 UPDATE '.CATEGORIES_TABLE.' SET image_order='.$image_order.' 100 WHERE '; 65 66 $data = 67 array( 68 'id' => $_GET['cat_id'], 69 'name' => @$_POST['name'], 70 'commentable' => $_POST['commentable'], 71 'uploadable' => 72 isset($_POST['uploadable']) ? $_POST['uploadable'] : 'false', 73 'comment' => 74 $conf['allow_html_descriptions'] ? 75 @$_POST['comment'] : strip_tags(@$_POST['comment']), 76 'image_order' => $image_order, 77 ); 78 79 mass_updates( 80 CATEGORIES_TABLE, 81 array( 82 'primary' => array('id'), 83 'update' => array_diff(array_keys($data), array('id')) 84 ), 85 array($data) 86 ); 87 88 // retrieve cat infos before continuing (following updates are expensive) 89 $cat_info = get_cat_info($_GET['cat_id']); 90 101 91 if (isset($_POST['image_order_subcats'])) 102 92 { 103 $query .= 'uppercats REGEXP \'(^|,)'.$_GET['cat_id'].'(,|$)\''; 104 } 105 else 106 { 107 $query .= 'id='.$_GET['cat_id'].';'; 108 } 109 pwg_query($query); 93 $query = ' 94 UPDATE '.CATEGORIES_TABLE.' SET image_order='.(isset($image_order) ? 'NULL':"'$image_order'").' 95 WHERE uppercats LIKE "'.$cat_info['uppercats'].',%"'; 96 pwg_query($query); 97 } 98 99 if ($cat_info['visible'] != get_boolean( $_POST['visible'] ) ) 100 { 101 set_cat_visible(array($_GET['cat_id']), $_POST['visible']); 102 } 103 if ($cat_info['status'] != get_boolean( $_POST['status'] ) ) 104 { 105 set_cat_status(array($_GET['cat_id']), $_POST['status']); 106 } 107 108 if (isset($_POST['parent']) and $cat_info['id_uppercat'] != $_POST['parent']) 109 { 110 move_categories( array($_GET['cat_id']), $_POST['parent'] ); 111 } 110 112 111 113 array_push($page['infos'], l10n('editcat_confirm')); 112 114 } 113 else 115 elseif (isset($_POST['set_random_representant'])) 114 116 { 115 117 set_random_representant(array($_GET['cat_id'])); 116 118 } 117 else 119 elseif (isset($_POST['delete_representant'])) 118 120 { 119 121 $query = ' … … 124 126 pwg_query($query); 125 127 } 126 else 128 elseif (isset($_POST['submitAdd'])) 127 129 { 128 130 $output_create = create_virtual_category( … … 160 162 } 161 163 } 162 else 164 elseif (isset($_POST['submitDestinations']) 163 165 and isset($_POST['destinations']) 164 166 and count($_POST['destinations']) > 0) -
trunk/admin/template/yoga/admin/cat_modify.tpl
r2482 r2490 71 71 <td><strong>{'lock'|@translate}</strong> 72 72 <td> 73 {html_radios name='visible' values=' false,true'|@explode output='No,Yes'|@explode|translate selected=$CAT_VISIBLE}73 {html_radios name='visible' values='true,false'|@explode output='No,Yes'|@explode|translate selected=$CAT_VISIBLE} 74 74 </td> 75 75 </tr>
Note: See TracChangeset
for help on using the changeset viewer.