[Linpha-cvs] SF.net SVN: linpha: [4563] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2006-08-30 19:16:23
|
Revision: 4563 http://svn.sourceforge.net/linpha/?rev=4563&view=rev Author: fangehrn Date: 2006-08-30 12:16:00 -0700 (Wed, 30 Aug 2006) Log Message: ----------- * working on admin config, may be broken now untill finished Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/index.php trunk/linpha2/admin/permissions_readwrite.php trunk/linpha2/admin/settings.php trunk/linpha2/admin/settings_all.php trunk/linpha2/admin/settings_features.php trunk/linpha2/admin/settings_layout.php trunk/linpha2/lib/classes/linpha.admin.class.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/modules/module.basket.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-08-28 15:09:39 UTC (rev 4562) +++ trunk/linpha2/ChangeLog 2006-08-30 19:16:00 UTC (rev 4563) @@ -1,3 +1,6 @@ +2006-08-30 flo + * working on admin config, may be broken now untill finished + 2006-08-28 flo * fixed php notice Modified: trunk/linpha2/admin/index.php =================================================================== --- trunk/linpha2/admin/index.php 2006-08-28 15:09:39 UTC (rev 4562) +++ trunk/linpha2/admin/index.php 2006-08-30 19:16:00 UTC (rev 4563) @@ -6,7 +6,6 @@ */ include_once(LINPHA_DIR.'/lib/include/common.php'); include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); - include_once(LINPHA_DIR.'/lib/classes/linpha.admin.class.php'); $linpha = new linpha(); $linpha->sql->startSession(); @@ -17,6 +16,10 @@ exit(1); } + include_once(LINPHA_DIR.'/lib/classes/linpha.admin.class.php'); + $LinAdmin = new LinAdmin(); + + /** * @todo admin permission check */ Modified: trunk/linpha2/admin/permissions_readwrite.php =================================================================== --- trunk/linpha2/admin/permissions_readwrite.php 2006-08-28 15:09:39 UTC (rev 4562) +++ trunk/linpha2/admin/permissions_readwrite.php 2006-08-30 19:16:00 UTC (rev 4563) @@ -15,7 +15,7 @@ <?php if(isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') { - LinAdmin::saveConfig( + $LinAdmin->saveConfig( Array( 'plugins_filemanager_enable' ) @@ -23,7 +23,7 @@ } - LinAdmin::printAdminConfig('radio',i18n("Enable Filemanager For Non-Admin Users"),'plugins_filemanager_enable'); + $LinAdmin->printAdminConfig('radio',i18n("Enable Filemanager For Non-Admin Users"),'plugins_filemanager_enable'); ?> <input type="hidden" name="cmd" value="saveconfig" /> Modified: trunk/linpha2/admin/settings.php =================================================================== --- trunk/linpha2/admin/settings.php 2006-08-28 15:09:39 UTC (rev 4562) +++ trunk/linpha2/admin/settings.php 2006-08-30 19:16:00 UTC (rev 4563) @@ -15,16 +15,6 @@ LinAdmin::printAdminMenu($array_menu,$cat2); -/** - * get system option names and values - */ -$query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value FROM ".PREFIX."config WHERE user_id = '0' ORDER by option_name"); -while($data = $query->FetchRow()) -{ - $options[] = $data['option_name']; - $option_value_system[$data['option_name']] = $data['option_value']; -} - switch($cat2) { case 'layout': Modified: trunk/linpha2/admin/settings_all.php =================================================================== --- trunk/linpha2/admin/settings_all.php 2006-08-28 15:09:39 UTC (rev 4562) +++ trunk/linpha2/admin/settings_all.php 2006-08-30 19:16:00 UTC (rev 4563) @@ -13,10 +13,10 @@ */ if(isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') { - LinAdmin::saveConfig($options); + $LinAdmin->saveConfig($LinAdmin->options); } -foreach($options AS $option_name) +foreach($LinAdmin->options AS $option_name) { if(in_array($option_name,$radio_options)) { @@ -26,6 +26,6 @@ { $type = 'text'; } - LinAdmin::printAdminConfig($type,$option_name,$option_name,$option_value_system[$option_name]); + $LinAdmin->printAdminConfig($type,$option_name,$option_name,$LinAdmin->option_value_system[$option_name]); } ?> \ No newline at end of file Modified: trunk/linpha2/admin/settings_features.php =================================================================== --- trunk/linpha2/admin/settings_features.php 2006-08-28 15:09:39 UTC (rev 4562) +++ trunk/linpha2/admin/settings_features.php 2006-08-30 19:16:00 UTC (rev 4563) @@ -24,7 +24,7 @@ */ if(isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') { - LinAdmin::saveConfig(Array( + $LinAdmin->saveConfig(Array( 'sys_image_exif', 'sys_image_iptc', 'sys_image_xmp' @@ -32,9 +32,9 @@ } - LinAdmin::printAdminConfig('radio',i18n("Use EXIF"),'sys_image_exif',$option_value_system['sys_image_exif']); - LinAdmin::printAdminConfig('radio',i18n("Use IPTC"),'sys_image_iptc',$option_value_system['sys_image_iptc']); - LinAdmin::printAdminConfig('radio',i18n("Use XMP"),'sys_image_xmp',$option_value_system['sys_image_xmp']); + $LinAdmin->printAdminConfig('radio',i18n("Use EXIF"),'sys_image_exif',$option_value_system['sys_image_exif']); + $LinAdmin->printAdminConfig('radio',i18n("Use IPTC"),'sys_image_iptc',$option_value_system['sys_image_iptc']); + $LinAdmin->printAdminConfig('radio',i18n("Use XMP"),'sys_image_xmp',$option_value_system['sys_image_xmp']); break; } ?> \ No newline at end of file Modified: trunk/linpha2/admin/settings_layout.php =================================================================== --- trunk/linpha2/admin/settings_layout.php 2006-08-28 15:09:39 UTC (rev 4562) +++ trunk/linpha2/admin/settings_layout.php 2006-08-30 19:16:00 UTC (rev 4563) @@ -34,7 +34,7 @@ */ if(isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') { - LinAdmin::saveConfig(Array('sys_style_home_usedefaultwelcometext', + $LinAdmin->saveConfig(Array('sys_style_home_usedefaultwelcometext', 'sys_style_home_nrrandomimages', 'sys_style_home_showalbums', 'sys_style_home_firstsortorder', @@ -68,17 +68,17 @@ <textarea name="welcometext" rows="10" cols="50"><?php echo htmlspecialchars($welcometxt,ENT_QUOTES); ?></textarea> <br /><br /><br /> <?php - LinAdmin::printAdminConfig('text',i18n("Nr Of Random Images (0 to disable)"),'sys_style_home_nrrandomimages',$option_value_system['sys_style_home_nrrandomimages']); - LinAdmin::printAdminConfig('radio',i18n("Show Browse By Date"),'sys_style_home_showbrowsebydate',$option_value_system['sys_style_home_showbrowsebydate']); - LinAdmin::printAdminConfig('radio',i18n("Show Albums On Home Site"),'sys_style_home_showalbums',$option_value_system['sys_style_home_showalbums']); - LinAdmin::printAdminConfig('select',i18n("Sort Order Of First Level Albums"),'sys_style_home_firstsortorder',$option_value_system['sys_style_home_firstsortorder'],getSortOrders()); + $LinAdmin->printAdminConfig('text',i18n("Nr Of Random Images (0 to disable)"),'sys_style_home_nrrandomimages',$option_value_system['sys_style_home_nrrandomimages']); + $LinAdmin->printAdminConfig('radio',i18n("Show Browse By Date"),'sys_style_home_showbrowsebydate',$option_value_system['sys_style_home_showbrowsebydate']); + $LinAdmin->printAdminConfig('radio',i18n("Show Albums On Home Site"),'sys_style_home_showalbums',$option_value_system['sys_style_home_showalbums']); + $LinAdmin->printAdminConfig('select',i18n("Sort Order Of First Level Albums"),'sys_style_home_firstsortorder',$option_value_system['sys_style_home_firstsortorder'],getSortOrders()); break; case 'thumb': - LinAdmin::printAdminConfig('radio',i18n("Show Subfolders Separate"),'sys_style_thumb_showsubfoldersseparate',$option_value_system['sys_style_thumb_showsubfoldersseparate']); + $LinAdmin->printAdminConfig('radio',i18n("Show Subfolders Separate"),'sys_style_thumb_showsubfoldersseparate',$option_value_system['sys_style_thumb_showsubfoldersseparate']); break; case 'image': - LinAdmin::printAdminConfig('text',i18n("Nr Of Previous/Next Thumbnails"),'sys_style_image_nrprevnextthumbs',$option_value_system['sys_style_image_nrprevnextthumbs']); + $LinAdmin->printAdminConfig('text',i18n("Nr Of Previous/Next Thumbnails"),'sys_style_image_nrprevnextthumbs',$option_value_system['sys_style_image_nrprevnextthumbs']); break; case 'others': Modified: trunk/linpha2/lib/classes/linpha.admin.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.admin.class.php 2006-08-28 15:09:39 UTC (rev 4562) +++ trunk/linpha2/lib/classes/linpha.admin.class.php 2006-08-30 19:16:00 UTC (rev 4563) @@ -25,6 +25,25 @@ class LinAdmin { +public $options; +public $options_value_system; + +/** + * constructor + */ +function __construct() +{ + /** + * get system option names and values and save in array for easier access + */ + $query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value FROM ".PREFIX."config WHERE user_id = '0' ORDER by option_name"); + while($data = $query->FetchRow()) + { + $this->options[] = $data['option_name']; + $this->option_value_system[$data['option_name']] = $data['option_value']; + } +} + function printAdminMenu($array_menu,$active) { ?> @@ -142,14 +161,10 @@ /** * update system config array, used in admin/settings*.php */ - if(isset($GLOBALS['option_value_system'])) + $query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value FROM ".PREFIX."config WHERE user_id = '0' ORDER by option_name"); + while($data = $query->FetchRow()) { - - $query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value FROM ".PREFIX."config WHERE user_id = '0' ORDER by option_name"); - while($data = $query->FetchRow()) - { - $GLOBALS['option_value_system'][$data['option_name']] = $data['option_value']; - } + $this->option_value_system[$data['option_name']] = $data['option_value']; } } Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-08-28 15:09:39 UTC (rev 4562) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-08-30 19:16:00 UTC (rev 4563) @@ -409,27 +409,45 @@ $GLOBALS['linpha']->template->output['menu_Icons'] = ''; if($this->mode == 'thumb') { - $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_all_with_checkout&checkout_as=download">'. - '<img src="'.LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/download.png" border="0" title="'.i18n("Download Images").'" />' - .'</a>'."\n"; - $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_all_with_checkout&checkout_as=print">'. - '<img src="'.LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/print.png" border="0" title="'.i18n("Print Images").'" />' - .'</a>'."\n"; - $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_all_with_checkout&checkout_as=mail">'. - '<img src="'.LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/slideshow.png" border="0" title="'.i18n("Mail Images").'" />' - .'</a>'."\n"; + if( $GLOBALS['linpha']->sql->checkPermission('basket_download')) + { + $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_all_with_checkout&checkout_as=download">'. + '<img src="'.LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/download.png" border="0" title="'.i18n("Download Images").'" />' + .'</a>'."\n"; + } + if( $GLOBALS['linpha']->sql->checkPermission('basket_print')) + { + $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_all_with_checkout&checkout_as=print">'. + '<img src="'.LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/print.png" border="0" title="'.i18n("Print Images").'" />' + .'</a>'."\n"; + } + if( $GLOBALS['linpha']->sql->checkPermission('basket_mail')) + { + $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_all_with_checkout&checkout_as=mail">'. + '<img src="'.LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/slideshow.png" border="0" title="'.i18n("Mail Images").'" />' + .'</a>'."\n"; + } } elseif($this->mode == 'image') { - $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.LINPHA_DIR.'/download_file.php?id='.$this->id_current.'">'. - '<img src="'.LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/download.png" border="0" title="'.i18n("Download Image").'" />' - .'</a>'."\n"; - $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_this_with_checkout&checkout_as=print">'. - '<img src="'.LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/print.png" border="0" title="'.i18n("Print Image").'" />' - .'</a>'."\n"; - $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_this_with_checkout&checkout_as=mail">'. - '<img src="'.LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/slideshow.png" border="0" title="'.i18n("Mail Image").'" />' - .'</a>'."\n"; + if( $GLOBALS['linpha']->sql->checkPermission('download')) + { + $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.LINPHA_DIR.'/download_file.php?id='.$this->id_current.'">'. + '<img src="'.LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/download.png" border="0" title="'.i18n("Download Image").'" />' + .'</a>'."\n"; + } + if( $GLOBALS['linpha']->sql->checkPermission('basket_print')) + { + $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_this_with_checkout&checkout_as=print">'. + '<img src="'.LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/print.png" border="0" title="'.i18n("Print Image").'" />' + .'</a>'."\n"; + } + if( $GLOBALS['linpha']->sql->checkPermission('basket_mail')) + { + $GLOBALS['linpha']->template->output['menu_Icons'] .= '<a href="'.$GLOBALS['linpha']->template->URL_full.'&admin_cmd=basket_add_this_with_checkout&checkout_as=mail">'. + '<img src="'.LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/images/slideshow.png" border="0" title="'.i18n("Mail Image").'" />' + .'</a>'."\n"; + } } } Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2006-08-28 15:09:39 UTC (rev 4562) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2006-08-30 19:16:00 UTC (rev 4563) @@ -491,7 +491,7 @@ { return true; } - + $data = $GLOBALS['linpha']->db->GetRow("SELECT permission FROM ".PREFIX."permissions " . "WHERE perm_type = '".LinSql::linAddslashes($perm_type)."'"); $array_permissions = explodeAndSlice(';',$data['permission']); Modified: trunk/linpha2/lib/modules/module.basket.php =================================================================== --- trunk/linpha2/lib/modules/module.basket.php 2006-08-28 15:09:39 UTC (rev 4562) +++ trunk/linpha2/lib/modules/module.basket.php 2006-08-30 19:16:00 UTC (rev 4563) @@ -55,7 +55,7 @@ /** * check basket permission */ - if(! $GLOBALS['linpha']->sql->checkPermission($_REQUEST['checkout_as'])) + if(! $GLOBALS['linpha']->sql->checkPermission('basket_'.$_REQUEST['checkout_as'])) { throw new Exception(i18n("No Access")); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |