[Linpha-cvs] SF.net SVN: linpha: [4729] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <bz...@us...> - 2007-07-05 17:46:16
|
Revision: 4729 http://svn.sourceforge.net/linpha/?rev=4729&view=rev Author: bzrudi Date: 2007-07-05 10:46:10 -0700 (Thu, 05 Jul 2007) Log Message: ----------- "Add option to change background color for field inputs and add lightgrey color example" Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/settings_layout.php trunk/linpha2/install/sql/sql.data.php trunk/linpha2/lib/classes/linpha.admin.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/templates/default/themes/default/colorsettings.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-07-05 15:30:47 UTC (rev 4728) +++ trunk/linpha2/ChangeLog 2007-07-05 17:46:10 UTC (rev 4729) @@ -2,6 +2,10 @@ * Added Exiftool configuration support to Installer. Checks also for Perl and OS. Needs Windows testing! TODO: Save path to perl in DB + * Add option to change background color for field inputs in admin layout + section and add simple "lightgrey" color option. I'm sorry but I was + somewhat sick of the orange and blue colors :-) (I know there are more + important things to do) 2007-07-03 bzrudi * Added support for ignored filetypes stored in DB Modified: trunk/linpha2/admin/settings_layout.php =================================================================== --- trunk/linpha2/admin/settings_layout.php 2007-07-05 15:30:47 UTC (rev 4728) +++ trunk/linpha2/admin/settings_layout.php 2007-07-05 17:46:10 UTC (rev 4729) @@ -27,7 +27,8 @@ $color_examples = array( '' => '', 'blue' => 'blue', - 'orange' => 'orange' + 'orange' => 'orange', + 'lightgrey' => 'lightgrey' ); $color_examples_values = array( @@ -39,6 +40,15 @@ 'links' => '005388', 'linkshover' => '666666', ), + 'lightgrey' => array( + 'bodybg' => 'FFFFFF', + 'elembg' => 'CCCCCC', + 'font' => '000000', + 'albumsbg' => 'DDDDDD', + 'links' => '005388', + 'linkshover' => '666666', + 'fieldscolor' => 'fieldscolor' + ), 'orange' => array( 'bodybg' => 'FFFFFF', 'elembg' => 'F09000', @@ -59,6 +69,8 @@ $_POST['sys_style_layout_color_albumsbg'] = $color_examples_values[ $_POST['select_examples'] ]['albumsbg']; $_POST['sys_style_layout_color_links'] = $color_examples_values[ $_POST['select_examples'] ]['links']; $_POST['sys_style_layout_color_linkshover'] = $color_examples_values[ $_POST['select_examples'] ]['linkshover']; + $_POST['sys_style_layout_color_fields'] = $color_examples_values[ $_POST['select_examples'] ]['fieldscolor']; + } else { @@ -69,6 +81,8 @@ $_POST['sys_style_layout_color_albumsbg'] = LinWatermark::getHtmlFromAll($_POST['sys_style_layout_color_albumsbg']); $_POST['sys_style_layout_color_links'] = LinWatermark::getHtmlFromAll($_POST['sys_style_layout_color_links']); $_POST['sys_style_layout_color_linkshover'] = LinWatermark::getHtmlFromAll($_POST['sys_style_layout_color_linkshover']); + $_POST['sys_style_layout_color_fields'] = LinWatermark::getHtmlFromAll($_POST['sys_style_layout_color_fields']); + } $LinAdmin->saveConfig(Array( @@ -83,6 +97,7 @@ 'sys_style_layout_color_albumsbg', 'sys_style_layout_color_links', 'sys_style_layout_color_linkshover', + 'sys_style_layout_color_fields', )); } @@ -106,6 +121,8 @@ document.getElementsByName('sys_style_layout_color_albumsbg')[0].disabled = false; document.getElementsByName('sys_style_layout_color_links')[0].disabled = false; document.getElementsByName('sys_style_layout_color_linkshover')[0].disabled = false; + document.getElementsByName('sys_style_layout_color_fields')[0].disabled = false; + } else // disable { @@ -115,6 +132,8 @@ document.getElementsByName('sys_style_layout_color_albumsbg')[0].disabled = true; document.getElementsByName('sys_style_layout_color_links')[0].disabled = true; document.getElementsByName('sys_style_layout_color_linkshover')[0].disabled = true; + document.getElementsByName('sys_style_layout_color_fields')[0].disabled = true; + } } </script> @@ -128,6 +147,7 @@ $LinAdmin->printAdminConfig('text',$LinAdmin->getDescriptionByOptionName('sys_style_layout_color_albumsbg'),'sys_style_layout_color_albumsbg',$LinAdmin->option_value_system['sys_style_layout_color_albumsbg']); $LinAdmin->printAdminConfig('text',$LinAdmin->getDescriptionByOptionName('sys_style_layout_color_links'),'sys_style_layout_color_links',$LinAdmin->option_value_system['sys_style_layout_color_links']); $LinAdmin->printAdminConfig('text',$LinAdmin->getDescriptionByOptionName('sys_style_layout_color_linkshover'),'sys_style_layout_color_linkshover',$LinAdmin->option_value_system['sys_style_layout_color_linkshover']); + $LinAdmin->printAdminConfig('text',$LinAdmin->getDescriptionByOptionName('sys_style_layout_color_fields'),'sys_style_layout_color_fields',$LinAdmin->option_value_system['sys_style_layout_color_fields']); break; case 'home': Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2007-07-05 15:30:47 UTC (rev 4728) +++ trunk/linpha2/install/sql/sql.data.php 2007-07-05 17:46:10 UTC (rev 4729) @@ -85,6 +85,7 @@ 'sys_style_layout_color_albumsbg' => 'D5FCF4', 'sys_style_layout_color_links' => '005388', 'sys_style_layout_color_linkshover' => '666666', + 'sys_style_layout_color_fields' => 'CCCCCC', 'sys_style_layout_theme' => 'default', 'sys_style_layout_template' => 'default', @@ -132,6 +133,7 @@ 'sys_style_layout_color_albumsbg' => 'D5FCF4', 'sys_style_layout_color_links' => '005388', 'sys_style_layout_color_linkshover' => '666666', + 'sys_style_layout_color_fields' => 'CCCCCC', 'sys_style_layout_theme' => 'default', 'sys_style_layout_template' => 'default', Modified: trunk/linpha2/lib/classes/linpha.admin.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.admin.class.php 2007-07-05 15:30:47 UTC (rev 4728) +++ trunk/linpha2/lib/classes/linpha.admin.class.php 2007-07-05 17:46:10 UTC (rev 4729) @@ -1,390 +1,391 @@ -<?php -/* -* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> -* Florian Angehrn -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/** - * This class provides functions for edit configs etc. - * @package Admin - */ -class LinAdmin -{ - -public $options; -public $options_value_system; -public $description_array; - -/** - * 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 ".LIN_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']; - } - - $this->description_array = array( - 'sys_image_exif' => i18n("Use EXIF"), - 'sys_image_iptc' => i18n("Use IPTC"), - 'sys_image_xmp' => i18n("Use XMP"), - 'sys_lang_autolang' => i18n("Language Auto Detection"), - 'sys_lang' => i18n("Default Language (if auto detections fails or if it is disabled)"), - - 'sys_style_home_nrrandomimages' => i18n("Nr Of Random Images (0 to disable)"), - 'sys_style_home_showbrowsebydate' => i18n("Show Browse By Date"), - 'sys_style_home_showalbums' => i18n("Show Albums On Home Site"), - 'sys_style_home_firstsortorder' => i18n("Sort Order Of First Level Albums"), - - 'sys_style_image_nrprevnextthumbs' => i18n("Nr Of Previous/Next Thumbnails"), - 'sys_style_image_width' => i18n("Max Image Width"), - 'sys_style_image_height' => i18n("Max Image Height"), - - 'sys_style_thumb_showsubfoldersseparate' => i18n("Show Subfolders Separate"), - 'sys_style_thumb_nojsnrcols' => i18n("Nr Cols if Javascript deactivated"), - 'sys_style_thumb_nojsnrrows' => i18n("Nr Rows if Javascript deactivated"), - 'sys_style_thumb_size_display' => i18n("Thumb size"), - - 'sys_style_others_sortorder' => i18n("Sort order"), - - 'sys_style_layout_title' => i18n("Linpha Title"), - 'sys_style_layout_template' => i18n("Template"), - 'sys_style_layout_theme' => i18n("Theme"), - 'sys_style_layout_color_bodybg' => i18n("Main Background Color"), - 'sys_style_layout_color_elembg' => i18n("Elements Background Color"), - 'sys_style_layout_color_font' => i18n("Fonts Color"), - 'sys_style_layout_color_albumsbg' => i18n("Albums Background Color"), - 'sys_style_layout_color_links' => i18n("Links Color"), - 'sys_style_layout_color_linkshover' => i18n("Links Hover Color"), - - 'plugins_log_filename' => i18n("Log to this filename"), - 'plugins_log_syslog_enable' => i18n("Send important messages to syslog"), - 'plugins_log_syslog_add_events' => i18n("Additional log events sent to syslog"), - 'plugins_log_email_enable' => i18n("Send important messages by email"), - 'plugins_log_email_add_events' => i18n("Additional log events sent by email"), - 'plugins_log_email_to' => i18n("Recipient"), - 'plugins_log_email_headers' => i18n("Extra headers"), - 'plugins_log_email_subject' => i18n("Subject"), - - 'plugins_filemanager_enable' => i18n("Enable Filemanager For Non-Admin Users"), - ); -} - -function printAdminMenu($array_menu,$active) -{ - ?> - <ul class="linUlMenu"> - <?php - foreach($array_menu AS $key=>$value) - { - if($value['link']=='linpha_home') - { - echo '<li><a href="../">'.$value['name'].'</a></li>'; - } - else - { - if($active==$key) - { - echo '<li><a href="./?cat='.$value['link'].'" class="current">'.$value['name'].'</a></li>'; - } - else - { - echo '<li><a href="./?cat='.$value['link'].'">'.$value['name'].'</a></li>'; - } - } - } - ?> - </ul> - <?php -} - -function printAdminConfig($type,$text,$id,$value,$settings=array()) -{ - ?> - <div style="width: 600px; border: 1px solid black; padding: 5px; margin-bottom: 5px;"> - <div align="left" style="float: left;"> - <?php - switch($type) - { - case 'radio': - if($value) - { - $str_enabled = ' checked="checked"'; - $str_disabled = ''; - } - else - { - $str_enabled = ''; - $str_disabled = ' checked="checked"'; - } - echo $text; - ?> - </div> - <div align="right"> - <input type="radio" id="<?php echo $id; ?>01" name="<?php echo $id; ?>" value="1"<?php echo $str_enabled; ?> /><label for="<?php echo $id; ?>01"><?php echo i18n("Enable"); ?></label> - <input type="radio" id="<?php echo $id; ?>02" name="<?php echo $id; ?>" value="0"<?php echo $str_disabled; ?>/><label for="<?php echo $id; ?>02"><?php echo i18n("Disable"); ?></label> - <?php - break; - case 'text': - case 'password': - echo $text; - ?> - </div> - <div align="right"> - <input type="<?php echo $type; ?>" name="<?php echo $id; ?>" value="<?php echo htmlspecialchars($value, ENT_QUOTES); ?>" class="linForms" maxlength="255" style="width: 200px;" /> - <?php - - break; - case 'select': - echo $text; - ?> - </div> - <div align="right"> - <select name="<?php echo $id; ?>" size="1"<?php echo (isset($settings['input_settings']) ? $settings['input_settings'] : '' ); ?> class="linForms"> - <?php - foreach($settings['options'] AS $option_key=>$option_value) - { - if($option_key == $value) - { - $selected = ' selected="selected"'; - } - else - { - $selected = ''; - } - echo '<option value="'.$option_key.'"'.$selected.'>'.$option_value.'</option>'; - } - ?> - </select> - <?php - break; - } - ?> - </div> - </div> - <?php -} - -function saveConfig($array,$userid=0) -{ - foreach($array AS $value) - { - /** - * does this config name exists? - */ - if(isset($GLOBALS['linpha']->sql->config->value[$value]) && - isset($_POST[$value])) - { - $GLOBALS['linpha']->sql->config->updateConfig($value,$_POST[$value],$userid); - } - } - - linSysLog(i18n("Settings saved.")); - - /** - * update config array - */ - $GLOBALS['linpha']->sql->config->reloadConfig(); - - /** - * update system config array, used in admin/settings*.php - */ - $query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value FROM ".LIN_PREFIX."config WHERE user_id = '0' ORDER by option_name"); - while($data = $query->FetchRow()) - { - $this->option_value_system[$data['option_name']] = $data['option_value']; - } -} - -/** - * thanks to http://www.ilovejackdaniels.com/php/email-address-validation/ - */ -function checkValidEmailAddress($email) -{ - // First, we check that there's one @ symbol, and that the lengths are right - if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { - // Email invalid because wrong number of characters in one section, or wrong number of @ symbols. - return false; - } - // Split it into sections to make life easier - $email_array = explode("@", $email); - $local_array = explode(".", $email_array[0]); - for ($i = 0; $i < sizeof($local_array); $i++) { - if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { - return false; - } - } - if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name - $domain_array = explode(".", $email_array[1]); - if (sizeof($domain_array) < 2) { - return false; // Not enough parts to domain - } - for ($i = 0; $i < sizeof($domain_array); $i++) { - if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { - return false; - } - } - } - return true; -} - -/*function getOptions() -{ - return array( - 'sys_db_version', - 'sys_im_bracket_support', - 'sys_im_imagemagick_path', - 'sys_im_use_imagemagick', - 'sys_im_video_thumbnail', - - 'sys_import_autoimport', - 'sys_import_exif', - 'sys_import_exif_autorot', - - 'sys_image_exif', - 'sys_image_iptc', - 'sys_image_xmp', - 'sys_lang', - 'sys_lang_autolang', - 'sys_path_album_dir', - 'sys_path_cache_dir', - 'sys_path_tmp_dir', - - 'sys_basket_mail_max_size', - 'sys_basket_download_limit', - - 'sys_style_sortorder', - 'sys_style_template', - 'sys_style_home_showbrowsebydate', - 'sys_style_home_nrrandomimages', - 'sys_style_home_showalbums', - 'sys_style_home_usedefaultwelcometext', - 'sys_style_home_firstsortorder', - 'sys_style_thumb_size_max', - 'sys_style_thumb_size_display', - 'sys_style_thumb_showsubfoldersseparate', - 'sys_style_thumb_selectsizes', - 'sys_style_thumb_selectnrimages', - 'sys_style_thumb_nojsnrrows', - 'sys_style_thumb_nojsnrcols', - 'sys_style_image_quality', - 'sys_style_image_width', - 'sys_style_image_height', - 'sys_style_image_nrprevnextthumbs', - - 'sys_user_autologin' - ); -}*/ - -/** - * a list of all settings which are enable/disable - * to show radio buttons instead of text field - */ -function getRadioOptions() -{ - return array( - 'sys_im_bracket_support', - 'sys_im_use_imagemagick', - 'sys_im_video_thumbnail', - 'sys_import_use_emb_thumb', - 'sys_import_autoimport', - 'sys_import_exif', - 'sys_import_exif_autorot', - 'sys_import_use_exiftool', - 'sys_image_exif', - 'sys_image_iptc', - 'sys_image_xmp', - 'sys_lang_autolang', - 'sys_style_home_showbrowsebydate', - 'sys_style_home_showalbums', - 'sys_style_home_usedefaultwelcometext', - 'sys_style_thumb_showsubfoldersseparate', - 'sys_style_image_useeffects', - 'sys_user_autologin', - 'plugins_log_syslog_enable', - 'plugins_log_email_enable', - 'plugins_filemanager_enable' - ); -} - -function getDescriptionByOptionName( $option_name ) -{ - if( isset( $this->description_array[ $option_name ] ) ) - { - return $this->description_array[ $option_name ]; - } -} - -function getTemplates() -{ - $templatesdir = LINPHA_DIR."/templates"; - - $file_handle = opendir($templatesdir); - $all_themes = array(); - - while( ($file = readdir($file_handle)) !== false ) - { - if($file != "." && $file != ".." && $file != ".svn" && - is_dir($templatesdir.'/'.$file) && - file_exists($templatesdir.'/'.$file.'/global.html.php') && // do at least this check - file_exists($templatesdir.'/'.$file.'/themes') // do at least this check - ) - { - $all_themes[$file] = $file; - } - } - - closedir($file_handle); - - /* Sort theme files aphabetically */ - asort($all_themes); - - return $all_themes; -} - -function getThemes($template) -{ - $templatesdir = LINPHA_DIR."/templates/".$template."/themes"; - - $file_handle = opendir($templatesdir); - $all_themes = array(); - - while( ($file = readdir($file_handle)) !== false ) - { - if($file != "." && $file != ".." && $file != ".svn" && is_dir($templatesdir.'/'.$file)) - { - $all_themes[$file] = $file; - } - } - - closedir($file_handle); - - /* Sort theme files aphabetically */ - asort($all_themes); - - return $all_themes; -} - -} // end class LinAdmin - +<?php +/* +* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> +* Florian Angehrn +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/** + * This class provides functions for edit configs etc. + * @package Admin + */ +class LinAdmin +{ + +public $options; +public $options_value_system; +public $description_array; + +/** + * 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 ".LIN_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']; + } + + $this->description_array = array( + 'sys_image_exif' => i18n("Use EXIF"), + 'sys_image_iptc' => i18n("Use IPTC"), + 'sys_image_xmp' => i18n("Use XMP"), + 'sys_lang_autolang' => i18n("Language Auto Detection"), + 'sys_lang' => i18n("Default Language (if auto detections fails or if it is disabled)"), + + 'sys_style_home_nrrandomimages' => i18n("Nr Of Random Images (0 to disable)"), + 'sys_style_home_showbrowsebydate' => i18n("Show Browse By Date"), + 'sys_style_home_showalbums' => i18n("Show Albums On Home Site"), + 'sys_style_home_firstsortorder' => i18n("Sort Order Of First Level Albums"), + + 'sys_style_image_nrprevnextthumbs' => i18n("Nr Of Previous/Next Thumbnails"), + 'sys_style_image_width' => i18n("Max Image Width"), + 'sys_style_image_height' => i18n("Max Image Height"), + + 'sys_style_thumb_showsubfoldersseparate' => i18n("Show Subfolders Separate"), + 'sys_style_thumb_nojsnrcols' => i18n("Nr Cols if Javascript deactivated"), + 'sys_style_thumb_nojsnrrows' => i18n("Nr Rows if Javascript deactivated"), + 'sys_style_thumb_size_display' => i18n("Thumb size"), + + 'sys_style_others_sortorder' => i18n("Sort order"), + + 'sys_style_layout_title' => i18n("Linpha Title"), + 'sys_style_layout_template' => i18n("Template"), + 'sys_style_layout_theme' => i18n("Theme"), + 'sys_style_layout_color_bodybg' => i18n("Main Background Color"), + 'sys_style_layout_color_elembg' => i18n("Elements Background Color"), + 'sys_style_layout_color_font' => i18n("Fonts Color"), + 'sys_style_layout_color_albumsbg' => i18n("Albums Background Color"), + 'sys_style_layout_color_links' => i18n("Links Color"), + 'sys_style_layout_color_linkshover' => i18n("Links Hover Color"), + 'sys_style_layout_color_fields' => i18n("Color Of Input and Select fields"), + + 'plugins_log_filename' => i18n("Log to this filename"), + 'plugins_log_syslog_enable' => i18n("Send important messages to syslog"), + 'plugins_log_syslog_add_events' => i18n("Additional log events sent to syslog"), + 'plugins_log_email_enable' => i18n("Send important messages by email"), + 'plugins_log_email_add_events' => i18n("Additional log events sent by email"), + 'plugins_log_email_to' => i18n("Recipient"), + 'plugins_log_email_headers' => i18n("Extra headers"), + 'plugins_log_email_subject' => i18n("Subject"), + + 'plugins_filemanager_enable' => i18n("Enable Filemanager For Non-Admin Users"), + ); +} + +function printAdminMenu($array_menu,$active) +{ + ?> + <ul class="linUlMenu"> + <?php + foreach($array_menu AS $key=>$value) + { + if($value['link']=='linpha_home') + { + echo '<li><a href="../">'.$value['name'].'</a></li>'; + } + else + { + if($active==$key) + { + echo '<li><a href="./?cat='.$value['link'].'" class="current">'.$value['name'].'</a></li>'; + } + else + { + echo '<li><a href="./?cat='.$value['link'].'">'.$value['name'].'</a></li>'; + } + } + } + ?> + </ul> + <?php +} + +function printAdminConfig($type,$text,$id,$value,$settings=array()) +{ + ?> + <div style="width: 600px; border: 1px solid black; padding: 5px; margin-bottom: 5px;"> + <div align="left" style="float: left;"> + <?php + switch($type) + { + case 'radio': + if($value) + { + $str_enabled = ' checked="checked"'; + $str_disabled = ''; + } + else + { + $str_enabled = ''; + $str_disabled = ' checked="checked"'; + } + echo $text; + ?> + </div> + <div align="right"> + <input type="radio" id="<?php echo $id; ?>01" name="<?php echo $id; ?>" value="1"<?php echo $str_enabled; ?> /><label for="<?php echo $id; ?>01"><?php echo i18n("Enable"); ?></label> + <input type="radio" id="<?php echo $id; ?>02" name="<?php echo $id; ?>" value="0"<?php echo $str_disabled; ?>/><label for="<?php echo $id; ?>02"><?php echo i18n("Disable"); ?></label> + <?php + break; + case 'text': + case 'password': + echo $text; + ?> + </div> + <div align="right"> + <input type="<?php echo $type; ?>" name="<?php echo $id; ?>" value="<?php echo htmlspecialchars($value, ENT_QUOTES); ?>" class="linForms" maxlength="255" style="width: 200px;" /> + <?php + + break; + case 'select': + echo $text; + ?> + </div> + <div align="right"> + <select name="<?php echo $id; ?>" size="1"<?php echo (isset($settings['input_settings']) ? $settings['input_settings'] : '' ); ?> class="linForms"> + <?php + foreach($settings['options'] AS $option_key=>$option_value) + { + if($option_key == $value) + { + $selected = ' selected="selected"'; + } + else + { + $selected = ''; + } + echo '<option value="'.$option_key.'"'.$selected.'>'.$option_value.'</option>'; + } + ?> + </select> + <?php + break; + } + ?> + </div> + </div> + <?php +} + +function saveConfig($array,$userid=0) +{ + foreach($array AS $value) + { + /** + * does this config name exists? + */ + if(isset($GLOBALS['linpha']->sql->config->value[$value]) && + isset($_POST[$value])) + { + $GLOBALS['linpha']->sql->config->updateConfig($value,$_POST[$value],$userid); + } + } + + linSysLog(i18n("Settings saved.")); + + /** + * update config array + */ + $GLOBALS['linpha']->sql->config->reloadConfig(); + + /** + * update system config array, used in admin/settings*.php + */ + $query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value FROM ".LIN_PREFIX."config WHERE user_id = '0' ORDER by option_name"); + while($data = $query->FetchRow()) + { + $this->option_value_system[$data['option_name']] = $data['option_value']; + } +} + +/** + * thanks to http://www.ilovejackdaniels.com/php/email-address-validation/ + */ +function checkValidEmailAddress($email) +{ + // First, we check that there's one @ symbol, and that the lengths are right + if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { + // Email invalid because wrong number of characters in one section, or wrong number of @ symbols. + return false; + } + // Split it into sections to make life easier + $email_array = explode("@", $email); + $local_array = explode(".", $email_array[0]); + for ($i = 0; $i < sizeof($local_array); $i++) { + if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { + return false; + } + } + if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name + $domain_array = explode(".", $email_array[1]); + if (sizeof($domain_array) < 2) { + return false; // Not enough parts to domain + } + for ($i = 0; $i < sizeof($domain_array); $i++) { + if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { + return false; + } + } + } + return true; +} + +/*function getOptions() +{ + return array( + 'sys_db_version', + 'sys_im_bracket_support', + 'sys_im_imagemagick_path', + 'sys_im_use_imagemagick', + 'sys_im_video_thumbnail', + + 'sys_import_autoimport', + 'sys_import_exif', + 'sys_import_exif_autorot', + + 'sys_image_exif', + 'sys_image_iptc', + 'sys_image_xmp', + 'sys_lang', + 'sys_lang_autolang', + 'sys_path_album_dir', + 'sys_path_cache_dir', + 'sys_path_tmp_dir', + + 'sys_basket_mail_max_size', + 'sys_basket_download_limit', + + 'sys_style_sortorder', + 'sys_style_template', + 'sys_style_home_showbrowsebydate', + 'sys_style_home_nrrandomimages', + 'sys_style_home_showalbums', + 'sys_style_home_usedefaultwelcometext', + 'sys_style_home_firstsortorder', + 'sys_style_thumb_size_max', + 'sys_style_thumb_size_display', + 'sys_style_thumb_showsubfoldersseparate', + 'sys_style_thumb_selectsizes', + 'sys_style_thumb_selectnrimages', + 'sys_style_thumb_nojsnrrows', + 'sys_style_thumb_nojsnrcols', + 'sys_style_image_quality', + 'sys_style_image_width', + 'sys_style_image_height', + 'sys_style_image_nrprevnextthumbs', + + 'sys_user_autologin' + ); +}*/ + +/** + * a list of all settings which are enable/disable + * to show radio buttons instead of text field + */ +function getRadioOptions() +{ + return array( + 'sys_im_bracket_support', + 'sys_im_use_imagemagick', + 'sys_im_video_thumbnail', + 'sys_import_use_emb_thumb', + 'sys_import_autoimport', + 'sys_import_exif', + 'sys_import_exif_autorot', + 'sys_import_use_exiftool', + 'sys_image_exif', + 'sys_image_iptc', + 'sys_image_xmp', + 'sys_lang_autolang', + 'sys_style_home_showbrowsebydate', + 'sys_style_home_showalbums', + 'sys_style_home_usedefaultwelcometext', + 'sys_style_thumb_showsubfoldersseparate', + 'sys_style_image_useeffects', + 'sys_user_autologin', + 'plugins_log_syslog_enable', + 'plugins_log_email_enable', + 'plugins_filemanager_enable' + ); +} + +function getDescriptionByOptionName( $option_name ) +{ + if( isset( $this->description_array[ $option_name ] ) ) + { + return $this->description_array[ $option_name ]; + } +} + +function getTemplates() +{ + $templatesdir = LINPHA_DIR."/templates"; + + $file_handle = opendir($templatesdir); + $all_themes = array(); + + while( ($file = readdir($file_handle)) !== false ) + { + if($file != "." && $file != ".." && $file != ".svn" && + is_dir($templatesdir.'/'.$file) && + file_exists($templatesdir.'/'.$file.'/global.html.php') && // do at least this check + file_exists($templatesdir.'/'.$file.'/themes') // do at least this check + ) + { + $all_themes[$file] = $file; + } + } + + closedir($file_handle); + + /* Sort theme files aphabetically */ + asort($all_themes); + + return $all_themes; +} + +function getThemes($template) +{ + $templatesdir = LINPHA_DIR."/templates/".$template."/themes"; + + $file_handle = opendir($templatesdir); + $all_themes = array(); + + while( ($file = readdir($file_handle)) !== false ) + { + if($file != "." && $file != ".." && $file != ".svn" && is_dir($templatesdir.'/'.$file)) + { + $all_themes[$file] = $file; + } + } + + closedir($file_handle); + + /* Sort theme files aphabetically */ + asort($all_themes); + + return $all_themes; +} + +} // end class LinAdmin + ?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2007-07-05 15:30:47 UTC (rev 4728) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2007-07-05 17:46:10 UTC (rev 4729) @@ -54,6 +54,8 @@ $this->albumsbgcolor = $GLOBALS['linpha']->sql->config->value['sys_style_layout_color_albumsbg']; $this->linkscolor = $GLOBALS['linpha']->sql->config->value['sys_style_layout_color_links']; $this->linkshovercolor = $GLOBALS['linpha']->sql->config->value['sys_style_layout_color_linkshover']; + $this->fieldscolor = $GLOBALS['linpha']->sql->config->value['sys_style_layout_color_fields']; + } /** @@ -83,13 +85,13 @@ <!-- colorsettings.php --> <link rel='stylesheet' href='<?php echo LINPHA_CLIENT.'/templates/'.$this->template_name.'/themes/default/colorsettings.php'. '?bg='.$this->bgcolor.'&bodybg='.$this->bodybgcolor.'&font='.$this->fontcolor. - '&albumsbg='.$this->albumsbgcolor.'&links='.$this->linkscolor.'&linkshover='.$this->linkshovercolor; ?>' type='text/css'> + '&albumsbg='.$this->albumsbgcolor.'&links='.$this->linkscolor.'&linkshover='.$this->linkshovercolor.'&fieldscolor='.$this->fieldscolor; ?>' type='text/css'> <?php if($this->layout_name != 'default' && file_exists(LINPHA_DIR.'/templates/'.$this->template_name.'/themes/'.$this->layout_name.'/colorsettings.php')) { ?> <link rel='stylesheet' href='<?php echo LINPHA_CLIENT.'/templates/'.$this->template_name.'/themes/'.$this->layout_name."/colorsettings.php?bg=". $this->bgcolor."&bodybg=".$this->bodybgcolor."&font=".$this->fontcolor. - "&albumsbg=".$this->albumsbgcolor."&links=".$this->linkscolor."&linkshover=".$this->linkshovercolor; ?>' type='text/css'> + "&albumsbg=".$this->albumsbgcolor."&links=".$this->linkscolor."&linkshover=".$this->linkshovercolor.'&fieldscolor='.$this->fieldscolor; ?>' type='text/css'> <?php } ?> <!-- global.css --> Modified: trunk/linpha2/templates/default/themes/default/colorsettings.php =================================================================== --- trunk/linpha2/templates/default/themes/default/colorsettings.php 2007-07-05 15:30:47 UTC (rev 4728) +++ trunk/linpha2/templates/default/themes/default/colorsettings.php 2007-07-05 17:46:10 UTC (rev 4729) @@ -1,70 +1,70 @@ -<?php -header("Content-Type: text/css"); - -/** - * force caching in browser - * works in firefox and internet explorer - */ -Header("Last-Modified: " . gmdate("D, d M Y H:i:s",mktime (0,0,0,1,1,2000)) . " GMT"); // Date in the past -Header("Expires: Mon, 26 Jul 2100 05:00:00 GMT"); // In other words... never expire the image -Header("Cache-Control: max-age=10000000, s-maxage=1000000, proxy-revalidate, must-revalidate"); - - -/* - * Created on 26.10.2006 - * - * To change the template for this generated file go to - * Window - Preferences - PHPeclipse - PHP - Code Templates - */ -?> - -/** - * background color - * #linDivThumbNavi amd #divSlideshowControlsInner used in view_img.html.php - */ - body { - background-color: #<?php echo $_GET['bodybg']; ?>; - } - - #linDivMainOuter, #linDivMetaStaticOuter, #linDivNavigationOuter, .linButton, #linDivThumbnaviOuter, #linDivSlideshowControls, .roundAlphabottomInner { - background-color: #<?php echo $_GET['bg']; ?>; - } - -/** - * font color - */ - body, #linDivMenu ul a, #linDivMenu ul span, #linDivMenu ul div { - color: #<?php echo $_GET['font']; ?>; - } - -/** - * albums color - */ - .linDivFolder { - background-color: #<?php echo $_GET['albumsbg']; ?>; - } - -/** - * link/form colors - */ - a:link, a:visited, .linButton { - color: #<?php echo $_GET['links']; ?>; - } - a:hover, .linButton:hover { - color: #<?php echo $_GET['linkshover']; ?>; - } - - .linForms { - background-color: #d5eeff; - border: 1px solid grey; - } - -/** - * menu - */ - #linDivMenu ul a:hover, #linDivMenu ul span:hover { - background: #bbbbbb; - } - #linDivMenu ul ul, .linInputMenu { - background-color: #eeeeee; - } +<?php +header("Content-Type: text/css"); + +/** + * force caching in browser + * works in firefox and internet explorer + */ +Header("Last-Modified: " . gmdate("D, d M Y H:i:s",mktime (0,0,0,1,1,2000)) . " GMT"); // Date in the past +Header("Expires: Mon, 26 Jul 2100 05:00:00 GMT"); // In other words... never expire the image +Header("Cache-Control: max-age=10000000, s-maxage=1000000, proxy-revalidate, must-revalidate"); + + +/* + * Created on 26.10.2006 + * + * To change the template for this generated file go to + * Window - Preferences - PHPeclipse - PHP - Code Templates + */ +?> + +/** + * background color + * #linDivThumbNavi amd #divSlideshowControlsInner used in view_img.html.php + */ + body { + background-color: #<?php echo $_GET['bodybg']; ?>; + } + + #linDivMainOuter, #linDivMetaStaticOuter, #linDivNavigationOuter, .linButton, #linDivThumbnaviOuter, #linDivSlideshowControls, .roundAlphabottomInner { + background-color: #<?php echo $_GET['bg']; ?>; + } + +/** + * font color + */ + body, #linDivMenu ul a, #linDivMenu ul span, #linDivMenu ul div { + color: #<?php echo $_GET['font']; ?>; + } + +/** + * albums color + */ + .linDivFolder { + background-color: #<?php echo $_GET['albumsbg']; ?>; + } + +/** + * link/form colors + */ + a:link, a:visited, .linButton { + color: #<?php echo $_GET['links']; ?>; + } + a:hover, .linButton:hover { + color: #<?php echo $_GET['linkshover']; ?>; + } + + .linForms { + background-color: #<?php echo $_GET['fieldscolor']; ?>; + border: 1px solid grey; + } + +/** + * menu + */ + #linDivMenu ul a:hover, #linDivMenu ul span:hover { + background: #bbbbbb; + } + #linDivMenu ul ul, .linInputMenu { + background-color: #eeeeee; + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |