- Timestamp:
- Sep 11, 2007, 4:24:51 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/action.php
r1912 r2084 90 90 WHERE image_id = '.$_GET['id'].' 91 91 '.get_sql_condition_FandF( 92 array('forbidden_categories' => 'category_id'), 92 array( 93 'forbidden_categories' => 'category_id', 94 'forbidden_images' => 'image_id', 95 ), 93 96 ' AND' 94 97 ).' -
trunk/admin/element_set_global.php
r2003 r2084 137 137 $dbfields = array('primary' => array('id'), 'update' => array()); 138 138 139 $formfields = array('author', 'name', 'date_creation' );139 $formfields = array('author', 'name', 'date_creation', 'level'); 140 140 foreach ($formfields as $formfield) 141 141 { … … 164 164 { 165 165 $data['author'] = $_POST['author']; 166 167 166 if ('' == $data['author']) 168 167 { … … 174 173 { 175 174 $data['name'] = $_POST['name']; 176 177 175 if ('' == $data['name']) 178 176 { … … 188 186 .'-'.$_POST['date_creation_day'] 189 187 ; 188 } 189 190 if ('set' == $_POST['level_action']) 191 { 192 $data['level'] = $_POST['level']; 190 193 } 191 194 … … 346 349 $template->assign_vars(array('DATE_CREATION_YEAR_VALUE'=>$year)); 347 350 351 // image level options 352 $blockname = 'level_option'; 353 foreach ($conf['available_permission_levels'] as $level) 354 { 355 $template->assign_block_vars( 356 $blockname, 357 array( 358 'VALUE' => $level, 359 'CONTENT' => l10n( sprintf('Level %d', $level) ), 360 )); 361 } 362 348 363 // +-----------------------------------------------------------------------+ 349 364 // | global mode thumbnails | … … 378 393 379 394 $query = ' 380 SELECT id,path,tn_ext,file,filesize 395 SELECT id,path,tn_ext,file,filesize,level 381 396 FROM '.IMAGES_TABLE.' 382 397 WHERE id IN ('.implode(',', $page['cat_elements_id']).') … … 406 421 ) 407 422 ); 423 424 if ( $row['level']>0 ) 425 { 426 $template->assign_block_vars('thumbnails.thumbnail.level', 427 array( 428 'LEVEL' => $row['level'], 429 'TITLE' => l10n( sprintf('Level %d', $row['level']) ), 430 ) 431 ); 432 } 408 433 } 409 434 } -
trunk/admin/user_list.php
r2041 r2084 98 98 ui.status, 99 99 ui.adviser, 100 ui.enabled_high 100 ui.enabled_high, 101 ui.level 101 102 FROM '.USERS_TABLE.' AS u 102 103 INNER JOIN '.USER_INFOS_TABLE.' AS ui … … 257 258 array_push($page['errors'], l10n('Guest cannot be deleted')); 258 259 } 259 if (($conf['guest_id'] != $conf['default_user_id']) and 260 if (($conf['guest_id'] != $conf['default_user_id']) and 260 261 in_array($conf['default_user_id'], $collection)) 261 262 { … … 352 353 array('nb_image_line', 'nb_line_page', 'template', 'language', 353 354 'recent_period', 'maxwidth', 'expand', 'show_nb_comments', 354 'show_nb_hits', 'maxheight', 'status', 'enabled_high'); 355 356 $true_false_fields = array('expand', 'show_nb_comments', 355 'show_nb_hits', 'maxheight', 'status', 'enabled_high', 356 'level'); 357 358 $true_false_fields = array('expand', 'show_nb_comments', 357 359 'show_nb_hits', 'enabled_high'); 358 360 if ($conf['allow_adviser']) … … 757 759 } 758 760 761 // user level options 762 $blockname = 'level_option'; 763 foreach ($conf['available_permission_levels'] as $level) 764 { 765 $template->assign_block_vars( 766 $blockname, 767 array( 768 'VALUE' => $level, 769 'CONTENT' => l10n( sprintf('Level %d', $level) ), 770 'SELECTED' => $level==$default_user['level'] ? 'selected="selected"' : '', 771 )); 772 } 773 759 774 // +-----------------------------------------------------------------------+ 760 775 // | navigation bar | … … 818 833 $checked = ''; 819 834 } 835 836 $properties = array(); 837 $properties[] = 838 (isset($local_user['enabled_high']) and ($local_user['enabled_high'] == 'true')) 839 ? $lang['is_high_enabled'] : $lang['is_high_disabled']; 840 841 $properties[] = l10n( sprintf('Level %d', $local_user['level']) ); 820 842 821 843 $template->assign_block_vars( … … 837 859 'EMAIL' => get_email_address_as_display_text($local_user['email']), 838 860 'GROUPS' => $groups_string, 839 'PROPERTIES' => 840 (isset($local_user['enabled_high']) and ($local_user['enabled_high'] == 'true')) 841 ? $lang['is_high_enabled'] : $lang['is_high_disabled'] 861 'PROPERTIES' => implode( ',', $properties), 862 842 863 ) 843 864 ); -
trunk/include/config_default.inc.php
r2029 r2084 169 169 // 170 170 // Advenced use: 171 // You can also used special options. Instead to pass a string like parameter value 171 // You can also used special options. Instead to pass a string like parameter value 172 172 // you can pass a array with different optional parameter values 173 173 // $conf['links'] = array( … … 175 175 // 'http://forum.phpwebgallery.net' => array('label' => 'For ADMIN', 'new_window' => true, 'eval_visible' => 'return is_admin();'), 176 176 // 'http://phpwebgallery.net/doc' => array('label' => 'For Guest', 'new_window' => true, 'eval_visible' => 'return is_a_guest();'), 177 // 'http://download.gna.org/phpwebgallery/' => 178 // array('label' => 'PopUp', 'new_window' => true, 177 // 'http://download.gna.org/phpwebgallery/' => 178 // array('label' => 'PopUp', 'new_window' => true, 179 179 // 'nw_name' => 'PopUp', 'nw_features' => 'width=800,height=450,location=no,status=no,toolbar=no,scrollbars=no,menubar=no'), 180 180 // ); … … 264 264 $conf['users_page'] = 20; 265 265 266 // image level permissions available in the admin interface 267 $conf['available_permission_levels'] = array(0,1,2,4,8); 268 266 269 // mail_options: only set it true if you have a send mail warning with 267 270 // "options" parameter missing on mail() function execution. … … 615 618 616 619 // On Access control false / Admim Web Service need Php cURL extension 617 // Controls are done on public basis or 620 // Controls are done on public basis or 618 621 // if connected on member authorization basis 619 622 $conf['ws_access_control'] = false; 620 621 // On Access control true 623 624 // On Access control true 622 625 // Additionnal controls are made based on Web Service Access Table 623 626 … … 629 632 $conf['ws_postponed_start'] = array(0,1,2,3,5,7,14,30); /* In days */ 630 633 631 // By default 10, 5, 2, 1 year(s) or 6, 3, 1 month(s) 634 // By default 10, 5, 2, 1 year(s) or 6, 3, 1 month(s) 632 635 // or 15, 10, 7, 5, 1, 0 day(s) 633 636 // 0 it's temporary closed (Useful for one access) 634 $conf['ws_durations'] = array(3650,1825,730,365,182,91,30,15,10,7,5,1,0); 637 $conf['ws_durations'] = array(3650,1825,730,365,182,91,30,15,10,7,5,1,0); 635 638 636 639 // +-----------------------------------------------------------------------+ … … 676 679 // | Light slideshow | 677 680 // +-----------------------------------------------------------------------+ 678 // $conf['light_slideshow'] indicates to use slideshow.tpl in state of 681 // $conf['light_slideshow'] indicates to use slideshow.tpl in state of 679 682 // picture.tpl for slideshow 680 683 // Take care to have slideshow.tpl in all available templates … … 682 685 // Check if Picture's plugins are compliant with it 683 686 // Every plugin from 1.7 would be design to manage light_slideshow case. 684 $conf['light_slideshow'] = true; 687 $conf['light_slideshow'] = true; 685 688 686 689 ?> -
trunk/include/functions_user.inc.php
r2055 r2084 258 258 calculate_permissions($userdata['id'], $userdata['status']); 259 259 260 /* now we build the list of forbidden images (this list does not contain 261 images that are not in at least an authorized category)*/ 262 $query = ' 263 SELECT DISTINCT(id) 264 FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id=image_id 265 WHERE category_id NOT IN ('.$userdata['forbidden_categories'].') 266 AND level>'.$userdata['level']; 267 $forbidden_ids = array_from_query($query, 'id'); 268 269 if ( empty($forbidden_ids) ) 270 { 271 array_push( $forbidden_ids, 0 ); 272 } 273 $userdata['image_access_type'] = 'NOT IN'; //TODO maybe later 274 $userdata['image_access_list'] = implode(',',$forbidden_ids); 275 260 276 update_user_cache_categories($userdata); 261 277 … … 270 286 FROM '.IMAGE_CATEGORY_TABLE.' 271 287 WHERE category_id NOT IN ('.$userdata['forbidden_categories'].') 288 AND image_id '.$userdata['image_access_type'].' ('.$userdata['image_access_list'].') 272 289 ;'; 273 290 list($userdata['nb_total_images']) = mysql_fetch_array(pwg_query($query)); … … 282 299 $query = ' 283 300 INSERT INTO '.USER_CACHE_TABLE.' 284 (user_id, need_update, forbidden_categories, nb_total_images) 301 (user_id, need_update, forbidden_categories, nb_total_images, 302 image_access_type, image_access_list) 285 303 VALUES 286 304 ('.$userdata['id'].',\''.boolean_to_string($userdata['need_update']).'\',\'' 287 .$userdata['forbidden_categories'].'\','.$userdata['nb_total_images'].') 305 .$userdata['forbidden_categories'].'\','.$userdata['nb_total_images'].',"' 306 .$userdata['image_access_type'].'","'.$userdata['image_access_list'].'") 288 307 ;'; 289 308 pwg_query($query); … … 528 547 529 548 $query = 'SELECT c.id cat_id, global_rank'; 530 if ( !isset($filter_days) ) 531 { 532 $query .= ', 533 date_last cat_date_last, 534 nb_images cat_nb_images 535 FROM '.CATEGORIES_TABLE.' as c'; 536 } 537 else 538 { 539 // Count by date_available to avoid count null 540 $query .= ', 541 MAX(date_available) cat_date_last, 542 COUNT(date_available) cat_nb_images 543 FROM '.CATEGORIES_TABLE.' as c 544 LEFT JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON ic.category_id = c.id 545 LEFT JOIN '.IMAGES_TABLE.' AS i 546 ON ic.image_id = i.id AND 547 i.date_available > SUBDATE(CURRENT_DATE,INTERVAL '.$filter_days.' DAY)'; 548 $group_by = 'c.id'; 549 } 549 // Count by date_available to avoid count null 550 $query .= ', 551 MAX(date_available) cat_date_last, COUNT(date_available) cat_nb_images 552 FROM '.CATEGORIES_TABLE.' as c 553 LEFT JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON ic.category_id = c.id 554 LEFT JOIN '.IMAGES_TABLE.' AS i 555 ON ic.image_id = i.id 556 AND i.level<='.$userdata['level']; 557 558 if ( isset($filter_days) ) 559 { 560 $query .= ' AND i.date_available > SUBDATE(CURRENT_DATE,INTERVAL '.$filter_days.' DAY)'; 561 } 562 $group_by = 'c.id'; 550 563 551 564 if ( !empty($userdata['forbidden_categories']) ) … … 720 733 { 721 734 global $page, $conf; 722 735 723 736 if (!isset($page['cache_default_user'])) 724 737 { … … 728 741 $result = pwg_query($query); 729 742 $page['cache_default_user'] = mysql_fetch_assoc($result); 730 743 731 744 if ($page['cache_default_user'] !== false) 732 745 { … … 840 853 foreach ($user_ids as $user_id) 841 854 { 855 $level= isset($default_user['level']) ? $default_user['level'] : 0; 842 856 if ($user_id == $conf['webmaster_id']) 843 857 { 844 858 $status = 'webmaster'; 845 } 846 else if (($user_id == $conf['guest_id']) or 859 $level = max( $conf['available_permission_levels'] ); 860 } 861 else if (($user_id == $conf['guest_id']) or 847 862 ($user_id == $conf['default_user_id'])) 848 863 { … … 859 874 'user_id' => $user_id, 860 875 'status' => $status, 861 'registration_date' => $dbnow 876 'registration_date' => $dbnow, 877 'level' => $level 862 878 )); 863 879 864 880 array_push($inserts, $insert); 865 881 } 866 882 867 883 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); … … 902 918 * availability of the file 903 919 * 904 * in descending order of preference: 920 * in descending order of preference: 905 921 * param language, user language, default language 906 922 * PhpWebGallery default language. … … 1291 1307 } 1292 1308 case 'visible_images': 1293 {1294 1309 if (!empty($filter['visible_images'])) 1295 1310 { … … 1297 1312 $field_name.' IN ('.$filter['visible_images'].')'; 1298 1313 } 1314 // note there is no break - visible include forbidden 1315 case 'forbidden_images': 1316 if ( 1317 !empty($user['image_access_list']) 1318 or $user['image_access_type']!='NOT IN' 1319 ) 1320 { 1321 $table_prefix=null; 1322 if ($field_name=='id') 1323 { 1324 $table_prefix = ''; 1325 } 1326 elseif ($field_name=='i.id') 1327 { 1328 $table_prefix = 'i.'; 1329 } 1330 if ( isset($table_prefix) ) 1331 { 1332 $sql_list[]=$table_prefix.'level<='.$user['level']; 1333 } 1334 else 1335 { 1336 $sql_list[]=$field_name.' '.$user['image_access_type'] 1337 .' ('.$user['image_access_list'].')'; 1338 } 1339 } 1299 1340 break; 1300 }1301 1341 default: 1302 1342 { -
trunk/install/phpwebgallery_structure.sql
r1963 r2084 199 199 `storage_category_id` smallint(5) unsigned default NULL, 200 200 `high_filesize` mediumint(9) unsigned default NULL, 201 `level` tinyint unsigned NOT NULL default '0', 201 202 PRIMARY KEY (`id`), 202 203 KEY `images_i2` (`date_available`), … … 329 330 `forbidden_categories` text, 330 331 `nb_total_images` mediumint(8) unsigned default NULL, 332 `image_access_type` enum('NOT IN','IN') NOT NULL default 'NOT IN', 333 `image_access_list` text default NULL, 331 334 PRIMARY KEY (`user_id`) 332 335 ) TYPE=MyISAM; … … 390 393 `registration_date` datetime NOT NULL default '0000-00-00 00:00:00', 391 394 `enabled_high` enum('true','false') NOT NULL default 'true', 395 `level` tinyint unsigned NOT NULL default '0', 392 396 UNIQUE KEY `user_infos_ui1` (`user_id`) 393 397 ) TYPE=MyISAM; -
trunk/language/en_UK.iso-8859-1/admin.lang.php
r2068 r2084 642 642 $lang['Thumbnails'] = 'Thumbnails'; 643 643 $lang['obligatory_user_mail_address'] = 'Mail address is obligatory for all users'; 644 $lang['Minimum privacy level'] = 'Minimum privacy level'; 645 $lang['Privacy level'] = 'Privacy level'; 646 $lang['Level 0'] = 'Public'; 647 $lang['Level 1'] = 'Contacts'; 648 $lang['Level 2'] = 'Friends'; 649 $lang['Level 4'] = 'Family'; 650 $lang['Level 8'] = 'Admins'; 644 651 ?> -
trunk/language/fr_FR.iso-8859-1/admin.lang.php
r2068 r2084 643 643 $lang['Thumbnails'] = 'Miniatures'; 644 644 $lang['obligatory_user_mail_address'] = 'L\'adresse mail est obligatoire pour tous les utilisateurs'; 645 $lang['Minimum privacy level'] = 'Niveau minimal de confidentialité'; 646 $lang['Privacy level'] = 'Niveau de confidentialité'; 647 $lang['Level 0'] = 'Public'; 648 $lang['Level 1'] = 'Contacts'; 649 $lang['Level 2'] = 'Amis'; 650 $lang['Level 4'] = 'Famille'; 651 $lang['Level 8'] = 'Admins'; 645 652 ?> -
trunk/template/yoga/admin/element_set_global.tpl
r1902 r2084 35 35 <li><span class="wrap1"> 36 36 <label> 37 <span class="wrap2"><span> 37 <span class="wrap2"> 38 <!-- BEGIN level --> 39 <em class="levelIndicatorB">{thumbnails.thumbnail.level.LEVEL}</em><em class="levelIndicatorF" title="{thumbnails.thumbnail.level.TITLE}">{thumbnails.thumbnail.level.LEVEL}</em> 40 <!-- END level --> 41 <span> 38 42 <img src="{thumbnails.thumbnail.SRC}" 39 43 alt="{thumbnails.thumbnail.ALT}" … … 134 138 </tr> 135 139 140 <tr> 141 <td>{lang:Minimum privacy level}</td> 142 <td> 143 <label><input type="radio" name="level_action" value="leave" checked="checked" />{lang:leave}</label> 144 <label><input type="radio" name="level_action" value="set" id="level_action_set" />{lang:set to}</label> 145 <select onmousedown="document.getElementById('level_action_set').checked = true;" name="level" size="1"> 146 <!-- BEGIN level_option --> 147 <option {level_option.SELECTED} value="{level_option.VALUE}">{level_option.CONTENT} ({level_option.VALUE})</option> 148 <!-- END level_option --> 149 </select> 150 </td> 151 </tr> 152 136 153 </table> 137 154 -
trunk/template/yoga/admin/user_list.tpl
r2041 r2084 191 191 </tr> 192 192 193 <tr> 194 <td>{lang:Privacy level}</td> 195 <td> 196 <label><input type="radio" name="level_action" value="leave" checked="checked" />{lang:leave}</label> 197 <label><input type="radio" name="level_action" value="set" id="level_action_set" />{lang:set to}</label> 198 <select onmousedown="document.getElementById('level_action_set').checked = true;" name="level" size="1"> 199 <!-- BEGIN level_option --> 200 <option {level_option.SELECTED} value="{level_option.VALUE}">{level_option.CONTENT} ({level_option.VALUE})</option> 201 <!-- END level_option --> 202 </select> 203 </td> 204 </tr> 205 193 206 </table> 194 207 -
trunk/template/yoga/menubar.css
r1900 r2084 48 48 font-size: 100%; 49 49 margin-top: 0; 50 margin-bottom: 0; 50 51 } 51 52 -
trunk/template/yoga/thumbnails.css
r1900 r2084 52 52 } 53 53 54 UL.thumbnails .levelIndicatorB { 55 display:block; position:absolute; z-index:100;padding:0px 0 0 14px; color:black; font-weight:bold; fontsize:120%; 56 } 57 58 UL.thumbnails .levelIndicatorF { 59 display:block; position:absolute; z-index:101;padding:1px 0 0 15px; color:white; font-weight:bold; fontsize:120%; 60 }
Note: See TracChangeset
for help on using the changeset viewer.