Changeset 632
- Timestamp:
- Dec 4, 2004, 1:10:17 PM (19 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/cat_list.php
r628 r632 133 133 if (isset($_GET['parent_id'])) 134 134 { 135 $separator = ' ->';135 $separator = ' <span style="font-size:15px">→</span> '; 136 136 $base_url = PHPWG_ROOT_PATH.'admin.php?page=cat_list'; 137 137 -
trunk/admin/cat_modify.php
r623 r632 26 26 // +-----------------------------------------------------------------------+ 27 27 28 if ( !defined("PHPWG_ROOT_PATH"))28 if (!defined('PHPWG_ROOT_PATH')) 29 29 { 30 die ("Hacking attempt!");30 die('Hacking attempt!'); 31 31 } 32 include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' ); 33 32 include_once(PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php'); 34 33 //---------------------------------------------------------------- verification 35 34 if ( !isset( $_GET['cat_id'] ) || !is_numeric( $_GET['cat_id'] ) ) … … 43 42 if ( isset( $_POST['submit'] ) ) 44 43 { 45 // if new status is different from previous one, deletion of all related46 // links for access rights47 44 $query = 'SELECT status'; 48 45 $query.= ' FROM '.CATEGORIES_TABLE; … … 64 61 $query.= "'".htmlentities( $_POST['comment'], ENT_QUOTES )."'"; 65 62 66 $query.= ", status = '".$_POST['status']."'";67 $query.= ", visible = '".$_POST['visible']."'";68 63 if ( isset( $_POST['uploadable'] ) ) 69 64 $query.= ", uploadable = '".$_POST['uploadable']."'"; … … 81 76 pwg_query( $query ); 82 77 83 if ( $_POST['status'] != $row['status'] ) 84 { 85 // deletion of all access for groups concerning this category 86 $query = 'DELETE'; 87 $query.= ' FROM '.GROUP_ACCESS_TABLE; 88 $query.= ' WHERE cat_id = '.$_GET['cat_id']; 89 pwg_query( $query ); 90 // deletion of all access for users concerning this category 91 $query = 'DELETE'; 92 $query.= ' FROM '.USER_ACCESS_TABLE; 93 $query.= ' WHERE cat_id = '.$_GET['cat_id']; 94 pwg_query( $query ); 95 } 78 set_cat_visible(array($_GET['cat_id']), $_POST['visible']); 79 set_cat_status(array($_GET['cat_id']), $_POST['status']); 96 80 97 // checking users favorites98 $query = 'SELECT id';99 $query.= ' FROM '.USERS_TABLE;100 $query.= ';';101 $result = pwg_query( $query );102 while ( $row = mysql_fetch_array( $result ) )103 {104 check_favorites( $row['id'] );105 }106 81 $template->assign_block_vars('confirmation' ,array()); 107 82 } 108 83 109 $query = ' SELECT a.*, b.*';110 $query.= ' FROM '.CATEGORIES_TABLE.' as a, '.SITES_TABLE.' as b'; 111 $query.= ' WHERE a.id = '.$_GET['cat_id']; 112 $query.= ' AND a.site_id = b.id'; 113 $query.= ';';84 $query = ' 85 SELECT * 86 FROM '.CATEGORIES_TABLE.' 87 WHERE id = '.$_GET['cat_id'].' 88 ;'; 114 89 $category = mysql_fetch_array( pwg_query( $query ) ); 115 90 // nullable fields 116 foreach (array('comment','dir' ) as $nullable)91 foreach (array('comment','dir','site_id') as $nullable) 117 92 { 118 93 if (!isset($category[$nullable])) … … 126 101 $url = PHPWG_ROOT_PATH.'admin.php?page=cat_list&parent_id='; 127 102 $navigation = '<a class="" href="'.add_session_id(PHPWG_ROOT_PATH.'admin.php?page=cat_list').'">'; 128 $navigation.= $lang['home'].'</a>->'; 129 $navigation.= get_cat_display_name($current_category['name'], '->', $url); 103 $navigation.= $lang['home'].'</a> <span style="font-size:15px">→</span>'; 104 $navigation.= get_cat_display_name( 105 $current_category['name'], 106 ' <span style="font-size:15px">→</span>', 107 $url); 130 108 131 109 $form_action = PHPWG_ROOT_PATH.'admin.php?page=cat_modify&cat_id='.$_GET['cat_id']; 132 $ access = ($category['status']=='public')?'ACCESS_FREE':'ACCESS_RESTRICTED';110 $status = ($category['status']=='public')?'STATUS_PUBLIC':'STATUS_PRIVATE'; 133 111 $lock = ($category['visible']=='true')?'UNLOCKED':'LOCKED'; 112 113 if ($category['commentable'] == 'true') 114 { 115 $commentable = 'COMMENTABLE_TRUE'; 116 } 117 else 118 { 119 $commentable = 'COMMENTABLE_FALSE'; 120 } 121 if ($category['uploadable'] == 'true') 122 { 123 $uploadable = 'UPLOADABLE_TRUE'; 124 } 125 else 126 { 127 $uploadable = 'UPLOADABLE_FALSE'; 128 } 134 129 135 130 //----------------------------------------------------- template initialization … … 138 133 'CAT_NAME'=>$category['name'], 139 134 'CAT_COMMENT'=>$category['comment'], 140 'CATEGORY_DIR'=>$category['dir'], 141 'SITE_URL'=>$category['galleries_url'], 135 'CATEGORY_DIR'=>preg_replace('/\/$/', '', get_complete_dir($category['id'])), 142 136 143 $ access=>'checked="checked"',137 $status=>'checked="checked"', 144 138 $lock=>'checked="checked"', 139 $commentable=>'checked="checked"', 140 $uploadable=>'checked="checked"', 145 141 146 142 'L_EDIT_CONFIRM'=>$lang['editcat_confirm'], 147 143 'L_EDIT_NAME'=>$lang['description'], 148 144 'L_STORAGE'=>$lang['storage'], 145 'L_REMOTE_SITE'=>$lang['remote_site'], 149 146 'L_EDIT_COMMENT'=>$lang['comment'], 150 147 'L_EDIT_STATUS'=>$lang['conf_access'], 151 148 'L_EDIT_STATUS_INFO'=>$lang['cat_access_info'], 152 'L_ ACCESS_FREE'=>$lang['free'],153 'L_ ACCESS_RESTRICTED'=>$lang['restricted'],149 'L_STATUS_PUBLIC'=>$lang['public'], 150 'L_STATUS_PRIVATE'=>$lang['private'], 154 151 'L_EDIT_LOCK'=>$lang['lock'], 155 'L_EDIT_LOCK_INFO'=>$lang['cat_lock_info'], 152 'L_EDIT_LOCK_INFO'=>$lang['editcat_visible_info'], 153 'L_EDIT_UPLOADABLE'=>$lang['editcat_uploadable'], 154 'L_EDIT_UPLOADABLE_INFO'=>$lang['editcat_uploadable_info'], 155 'L_EDIT_COMMENTABLE'=>$lang['editcat_commentable'], 156 'L_EDIT_COMMENTABLE_INFO'=>$lang['editcat_commentable_info'], 156 157 'L_YES'=>$lang['yes'], 157 158 'L_NO'=>$lang['no'], … … 161 162 )); 162 163 163 if ( 164 if (!empty($category['dir'])) 164 165 { 165 166 $template->assign_block_vars('storage' ,array()); 167 $template->assign_block_vars('upload' ,array()); 166 168 } 167 169 168 if ( $category['site_id'] != 1)170 if (is_numeric($category['site_id']) and $category['site_id'] != 1) 169 171 { 170 $template->assign_block_vars('storage' ,array()); 172 $query = ' 173 SELECT galleries_url 174 FROM '.SITES_TABLE.' 175 WHERE id = '.$category['site_id'].' 176 ;'; 177 list($galleries_url) = mysql_fetch_array(pwg_query($query)); 178 $template->assign_block_vars('server', array('SITE_URL' => $galleries_url)); 171 179 } 172 180 -
trunk/admin/cat_options.php
r627 r632 65 65 case 'visible' : 66 66 { 67 // locking a category => all its child categories become locked 68 $subcats = get_subcat_ids($_POST['cat_true']); 69 $query = ' 70 UPDATE '.CATEGORIES_TABLE.' 71 SET visible = \'false\' 72 WHERE id IN ('.implode(',', $subcats).') 73 ;'; 74 pwg_query($query); 67 set_cat_visible($_POST['cat_true'], 'false'); 75 68 break; 76 69 } 77 70 case 'status' : 78 71 { 79 // make a category private => all its child categories become private 80 $subcats = get_subcat_ids($_POST['cat_true']); 81 $query = ' 82 UPDATE '.CATEGORIES_TABLE.' 83 SET status = \'private\' 84 WHERE id IN ('.implode(',', $subcats).') 85 ;'; 86 pwg_query($query); 72 set_cat_status($_POST['cat_true'], 'private'); 87 73 break; 88 74 } … … 117 103 case 'visible' : 118 104 { 119 // unlocking a category => all its parent categories become unlocked 120 $uppercats = array(); 121 $query = ' 122 SELECT uppercats 123 FROM '.CATEGORIES_TABLE.' 124 WHERE id IN ('.implode(',', $_POST['cat_false']).') 125 ;'; 126 $result = pwg_query($query); 127 while ($row = mysql_fetch_array($result)) 128 { 129 $uppercats = array_merge($uppercats, 130 explode(',', $row['uppercats'])); 131 } 132 $uppercats = array_unique($uppercats); 133 134 $query = ' 135 UPDATE '.CATEGORIES_TABLE.' 136 SET visible = \'true\' 137 WHERE id IN ('.implode(',', $uppercats).') 138 ;'; 139 pwg_query($query); 105 set_cat_visible($_POST['cat_false'], 'true'); 140 106 break; 141 107 } 142 108 case 'status' : 143 109 { 144 // make public a category => all its parent categories become public 145 $uppercats = array(); 146 $query = ' 147 SELECT uppercats 148 FROM '.CATEGORIES_TABLE.' 149 WHERE id IN ('.implode(',', $_POST['cat_false']).') 150 ;'; 151 $result = pwg_query($query); 152 while ($row = mysql_fetch_array($result)) 153 { 154 $uppercats = array_merge($uppercats, 155 explode(',', $row['uppercats'])); 156 } 157 $uppercats = array_unique($uppercats); 158 159 $query = ' 160 UPDATE '.CATEGORIES_TABLE.' 161 SET status = \'public\' 162 WHERE id IN ('.implode(',', $uppercats).') 163 ;'; 164 pwg_query($query); 110 set_cat_status($_POST['cat_false'], 'public'); 165 111 break; 166 112 } … … 274 220 array( 275 221 'L_CAT_TITLE' => $lang['cat_lock_title'], 276 'L_CAT_OPTIONS_TRUE' => $lang[' lock'],277 'L_CAT_OPTIONS_FALSE' => $lang[' unlock'],222 'L_CAT_OPTIONS_TRUE' => $lang['unlocked'], 223 'L_CAT_OPTIONS_FALSE' => $lang['locked'], 278 224 'L_CAT_OPTIONS_INFO' => $lang['cat_lock_info'], 279 225 ) -
trunk/admin/include/functions.php
r630 r632 991 991 mass_updates(CATEGORIES_TABLE, $fields, $datas); 992 992 } 993 994 /** 995 * change the visible property on a set of categories 996 * 997 * @param array categories 998 * @param string value 999 * @return void 1000 */ 1001 function set_cat_visible($categories, $value) 1002 { 1003 if (!in_array($value, array('true', 'false'))) 1004 { 1005 return false; 1006 } 1007 1008 // unlocking a category => all its parent categories become unlocked 1009 if ($value == 'true') 1010 { 1011 $uppercats = array(); 1012 $query = ' 1013 SELECT uppercats 1014 FROM '.CATEGORIES_TABLE.' 1015 WHERE id IN ('.implode(',', $categories).') 1016 ;'; 1017 $result = pwg_query($query); 1018 while ($row = mysql_fetch_array($result)) 1019 { 1020 $uppercats = array_merge($uppercats, 1021 explode(',', $row['uppercats'])); 1022 } 1023 $uppercats = array_unique($uppercats); 1024 1025 $query = ' 1026 UPDATE '.CATEGORIES_TABLE.' 1027 SET visible = \'true\' 1028 WHERE id IN ('.implode(',', $uppercats).') 1029 ;'; 1030 pwg_query($query); 1031 } 1032 // locking a category => all its child categories become locked 1033 if ($value == 'false') 1034 { 1035 $subcats = get_subcat_ids($categories); 1036 $query = ' 1037 UPDATE '.CATEGORIES_TABLE.' 1038 SET visible = \'false\' 1039 WHERE id IN ('.implode(',', $subcats).') 1040 ;'; 1041 pwg_query($query); 1042 } 1043 } 1044 1045 /** 1046 * change the status property on a set of categories : private or public 1047 * 1048 * @param array categories 1049 * @param string value 1050 * @return void 1051 */ 1052 function set_cat_status($categories, $value) 1053 { 1054 if (!in_array($value, array('public', 'private'))) 1055 { 1056 return false; 1057 } 1058 1059 // make public a category => all its parent categories become public 1060 if ($value == 'public') 1061 { 1062 $uppercats = array(); 1063 $query = ' 1064 SELECT uppercats 1065 FROM '.CATEGORIES_TABLE.' 1066 WHERE id IN ('.implode(',', $categories).') 1067 ;'; 1068 $result = pwg_query($query); 1069 while ($row = mysql_fetch_array($result)) 1070 { 1071 $uppercats = array_merge($uppercats, 1072 explode(',', $row['uppercats'])); 1073 } 1074 $uppercats = array_unique($uppercats); 1075 1076 $query = ' 1077 UPDATE '.CATEGORIES_TABLE.' 1078 SET status = \'public\' 1079 WHERE id IN ('.implode(',', $uppercats).') 1080 ;'; 1081 pwg_query($query); 1082 } 1083 // make a category private => all its child categories become private 1084 if ($value == 'private') 1085 { 1086 $subcats = get_subcat_ids($categories); 1087 $query = ' 1088 UPDATE '.CATEGORIES_TABLE.' 1089 SET status = \'private\' 1090 WHERE id IN ('.implode(',', $subcats).') 1091 ;'; 1092 pwg_query($query); 1093 } 1094 } 993 1095 ?> -
trunk/language/en_UK.iso-8859-1/admin.lang.php
r631 r632 44 44 $lang['free'] = 'Free'; 45 45 $lang['restricted'] = 'Restricted'; 46 $lang['public'] = 'public'; 47 $lang['private'] = 'private'; 46 48 $lang['metadata']='Metadata'; 47 49 $lang['visitors'] = 'Visitors'; 50 $lang['locked'] = 'Locked'; 51 $lang['unlocked'] = 'Unlocked'; 48 52 $lang['lock'] = 'Lock'; 49 53 $lang['unlock'] = 'Unlock'; … … 90 94 $lang['editcat_confirm'] = 'Category informations updated successfully.'; 91 95 $lang['editcat_perm'] = 'To set permissions for this category, click'; 92 $lang['cat_access_info'] = 'Permission management.'; 96 $lang['editcat_uploadable'] = 'Authorize upload'; 97 $lang['editcat_uploadable_info'] = 'Authorize users to upload files'; 98 $lang['editcat_commentable'] = 'Users comments'; 99 $lang['editcat_commentable_info'] = 'Authorize users to comment elements of this category'; 100 $lang['cat_access_info'] = 'Permission management. If you make a category private, all its child categories becomes private. If you make a category public, all its parent categories becomes public'; 101 $lang['editcat_visible_info'] = 'Lock temporary for maintenance. If you lock a category, all its child categories become locked. If you unlock a category, all its parent categories become unlocked.'; 93 102 $lang['cat_virtual_added'] = 'Virtual category added'; 94 103 $lang['cat_virtual_deleted'] = 'Virtual category deleted'; … … 96 105 $lang['cat_upload_info'] = 'Only non virtual and non remote categories are shown.'; 97 106 $lang['cat_lock_title'] = 'Lock categories'; 98 $lang['cat_lock_info'] = 'Selected categories will temporary been disabled for maintenance.'; 107 $lang['cat_lock_info'] = 'Selected categories will temporary been disabled for maintenance. 108 <br />If you lock a category, all its child categories become locked. 109 <br />If you unlock a category, all its parent categories become unlocked.'; 99 110 $lang['cat_comments_title'] = 'Authorize users to add comments on selected categories'; 100 111 $lang['cat_comments_info'] = 'By inheritance, an element is commentable if it belongs at least to one commentable category.'; … … 102 113 $lang['cat_status_info'] = 'Selected categories are private : you will need to authorize users and/or groups to access to them. 103 114 <br />If you make a category private, all its child categories becomes private. 104 <br />I tyou make a category public, all its parent categories becomes public';115 <br />If you make a category public, all its parent categories becomes public'; 105 116 106 117 // Titles -
trunk/template/default/admin/cat_modify.tpl
r403 r632 8 8 <!-- BEGIN server --> 9 9 <tr> 10 <td style="width:50%;"> {L_REMOTE_SITE}</td>11 <td class="row1">{ SITE_URL}</td>10 <td style="width:50%;"><strong>{L_REMOTE_SITE}</strong></td> 11 <td class="row1">{server.SITE_URL}</td> 12 12 </tr> 13 13 <!-- END server --> … … 33 33 <td><strong>{L_EDIT_STATUS} :</strong><br /><span class="small">{L_EDIT_STATUS_INFO}</span></td> 34 34 <td class="row1"> 35 <input type="radio" class="radio" name="status" value="public" { ACCESS_FREE} />{L_ACCESS_FREE} 36 <input type="radio" class="radio" name="status" value="private" { ACCESS_RESTRICTED} />{L_ACCESS_RESTRICTED}35 <input type="radio" class="radio" name="status" value="public" {STATUS_PUBLIC} />{L_STATUS_PUBLIC} 36 <input type="radio" class="radio" name="status" value="private" {STATUS_PRIVATE} />{L_STATUS_PRIVATE} 37 37 </td> 38 38 </tr> 39 39 <tr> 40 40 <td><strong>{L_EDIT_LOCK} :</strong><br /><span class="small">{L_EDIT_LOCK_INFO}</span></td> 41 41 <td class="row1"> … … 44 44 </td> 45 45 </tr> 46 <tr> 47 <td><strong>{L_EDIT_COMMENTABLE} :</strong><br /><span class="small">{L_EDIT_COMMENTABLE_INFO}</span></td> 48 <td class="row1"> 49 <input type="radio" class="radio" name="commentable" value="false" {COMMENTABLE_TRUE} />{L_YES} 50 <input type="radio" class="radio" name="commentable" value="true" {COMMENTABLE_FALSE} />{L_NO} 51 </td> 52 </tr> 53 <!-- BEGIN upload --> 54 <tr> 55 <td><strong>{L_EDIT_UPLOADABLE} :</strong><br /><span class="small">{L_EDIT_UPLOADABLE_INFO}</span></td> 56 <td class="row1"> 57 <input type="radio" class="radio" name="uploadable" value="true" {UPLOADABLE_TRUE} />{L_YES} 58 <input type="radio" class="radio" name="uploadable" value="false" {UPLOADABLE_FALSE} />{L_NO} 59 </td> 60 </tr> 61 <!-- END upload --> 46 62 <!-- BEGIN parent --> 47 63 <tr>
Note: See TracChangeset
for help on using the changeset viewer.