⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 acp_styles.php

📁 这些都是我以前学习是用到的源码
💻 PHP
📖 第 1 页 / 共 5 页
字号:
<?php/** ** @package acp* @version $Id: acp_styles.php,v 1.61 2006/11/27 12:56:35 dhn2 Exp $* @copyright (c) 2005 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU Public License **//*** @package acp*/class acp_styles{	var $u_action;	var $style_cfg;	var $template_cfg;	var $theme_cfg;	var $imageset_cfg;	var $imageset_keys;	function main($id, $mode)	{		global $db, $user, $auth, $template, $cache;		global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;		// Hardcoded template bitfield to add for new templates		$bitfield = new bitfield();		$bitfield->set(0);		$bitfield->set(3);		$bitfield->set(8);		$bitfield->set(9);		$bitfield->set(11);		$bitfield->set(12);		define('TEMPLATE_BITFIELD', $bitfield->get_base64());		$user->add_lang('acp/styles');		$this->tpl_name = 'acp_styles';		$this->page_title = 'ACP_CAT_STYLES';		$action = request_var('action', '');		$action = (isset($_POST['add'])) ? 'add' : $action;		$style_id = request_var('id', 0);		// Fill the configuration variables		$this->style_cfg = $this->template_cfg = $this->theme_cfg = $this->imageset_cfg = '## phpBB {MODE} configuration file## @package phpBB3# @copyright (c) 2005 phpBB Group # @license http://opensource.org/licenses/gpl-license.php GNU Public License ### At the left is the name, please do not change this# At the right the value is entered# For on/off options the valid values are on, off, 1, 0, true and false## Values get trimmed, if you want to add a space in front or at the end of# the value, then enclose the value with single or double quotes. # Single and double quotes do not need to be escaped.## # General Information about this {MODE}name = {NAME}copyright = {COPYRIGHT}version = {VERSION}';		$this->theme_cfg .= '# Some configuration options## You have to turn this option on if you want to use the # path template variables ({T_IMAGESET_PATH} for example) within# your css file.# This is mostly the case if you want to use language specific# images within your css file.#parse_css_file = {PARSE_CSS_FILE}## This option defines the pagination seperator in templates.#pagination_sep = \'{PAGINATION_SEP}\'';		$this->imageset_keys = array(			'logos' => array(				'site_logo',			),			'buttons'	=> array(				'icon_contact_aim', 'icon_contact_email', 'icon_contact_icq', 'icon_contact_jabber', 'icon_contact_msnm', 'icon_contact_pm', 'icon_contact_yahoo', 'icon_contact_www', 'icon_post_delete', 'icon_post_edit', 'icon_post_info', 'icon_post_quote', 'icon_post_report', 'icon_user_online', 'icon_user_offline', 'icon_user_profile', 'icon_user_search', 'icon_user_warn', 'button_pm_forward', 'button_pm_new', 'button_pm_reply', 'button_topic_locked', 'button_topic_new', 'button_topic_reply',			),			'icons'		=> array(				'icon_post_target', 'icon_post_target_unread', 'icon_topic_attach', 'icon_topic_latest', 'icon_topic_newest', 'icon_topic_reported', 'icon_topic_unapproved', 'icon_friend', 'icon_foe',			),			'forums'	=> array(				'forum_link', 'forum_read', 'forum_read_locked', 'forum_read_subforum', 'forum_unread', 'forum_unread_locked', 'forum_unread_subforum',			),			'folders'	=> array(				'topic_moved', 'topic_read', 'topic_read_mine', 'topic_read_hot', 'topic_read_hot_mine', 'topic_read_locked', 'topic_read_locked_mine', 'topic_unread', 'topic_unread_mine', 'topic_unread_hot', 'topic_unread_hot_mine', 'topic_unread_locked', 'topic_unread_locked_mine', 'sticky_read', 'sticky_read_mine', 'sticky_read_locked', 'sticky_read_locked_mine', 'sticky_unread', 'sticky_unread_mine', 'sticky_unread_locked', 'sticky_unread_locked_mine', 'announce_read', 'announce_read_mine', 'announce_read_locked', 'announce_read_locked_mine', 'announce_unread', 'announce_unread_mine', 'announce_unread_locked', 'announce_unread_locked_mine', 'global_read', 'global_read_mine', 'global_read_locked', 'global_read_locked_mine', 'global_unread', 'global_unread_mine', 'global_unread_locked', 'global_unread_locked_mine', 'pm_read', 'pm_unread',			),			'polls'		=> array(				'poll_left', 'poll_center', 'poll_right',			),			'ui'		=> array(				'upload_bar',			),			'user'		=> array(				'user_icon1', 'user_icon2', 'user_icon3', 'user_icon4', 'user_icon5', 'user_icon6', 'user_icon7', 'user_icon8', 'user_icon9', 'user_icon10',			),		);		// Execute overall actions		switch ($action)		{			case 'delete':				if ($style_id)				{					$this->remove($mode, $style_id);					return;				}			break;			case 'export':				if ($style_id)				{					$this->export($mode, $style_id);					return;				}			break;			case 'install':				$this->install($mode);				return;			break;			case 'add':				$this->add($mode);				return;			break;			case 'details':				if ($style_id)				{					$this->details($mode, $style_id);					return;				}			break;			case 'edit':				if ($style_id)				{					switch ($mode)					{						case 'imageset':							return $this->edit_imageset($style_id);						case 'template':							return $this->edit_template($style_id);						case 'theme':							return $this->edit_theme($style_id);					}				}			break;			case 'cache':				if ($style_id)				{					switch ($mode)					{						case 'template':							return $this->template_cache($style_id);					}				}			break;		}		switch ($mode)		{			case 'style':				switch ($action)				{					case 'activate':					case 'deactivate':						if ($style_id == $config['default_style'])						{							trigger_error($user->lang['DEACTIVATE_DEFAULT'] . adm_back_link($this->u_action), E_USER_WARNING);						}						$sql = 'UPDATE ' . STYLES_TABLE . '							SET style_active = ' . (($action == 'activate') ? 1 : 0) . '							WHERE style_id = ' . $style_id;						$db->sql_query($sql);						// Set style to default for any member using deactivated style						if ($action == 'deactivate')						{							$sql = 'UPDATE ' . USERS_TABLE . '								SET user_style = ' . $config['default_style'] . "								WHERE user_style = $style_id";							$db->sql_query($sql);							$sql = 'UPDATE ' . FORUMS_TABLE . '								SET forum_style = 0								WHERE forum_style = ' . $style_id;							$db->sql_query($sql);						}					break;				}				$this->frontend('style', array('details'), array('export', 'delete'));			break;			case 'template':				switch ($action)				{					// Refresh template data stored in db and clear cache					case 'refresh':						$sql = 'SELECT *							FROM ' . STYLES_TEMPLATE_TABLE . "							WHERE template_id = $style_id";						$result = $db->sql_query($sql);						$template_row = $db->sql_fetchrow($result);						$db->sql_freeresult($result);						if (!$template_row)						{							trigger_error($user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING);						}						if (confirm_box(true))						{							$template_refreshed = '';							// Only refresh database if the template is stored in the database							if ($template_row['template_storedb'] && file_exists("{$phpbb_root_path}styles/{$template_row['template_path']}/template/"))							{								$filelist = array('' => array());								$sql = 'SELECT template_filename, template_mtime									FROM ' . STYLES_TEMPLATE_DATA_TABLE . "									WHERE template_id = $style_id";								$result = $db->sql_query($sql);								while ($row = $db->sql_fetchrow($result))								{									if (@filemtime("{$phpbb_root_path}styles/{$template_row['template_path']}/template/" . $row['template_filename']) > $row['template_mtime'])									{										// get folder info from the filename										if (($slash_pos = strrpos($row['template_filename'], '/')) === false)										{											$filelist[''][] = $row['template_filename'];										}										else										{											$filelist[substr($row['template_filename'], 0, $slash_pos + 1)] = substr($row['template_filename'], $slash_pos + 1, strlen($row['template_filename']) - $slashpos - 1);										}									}								}								$db->sql_freeresult($result);								$this->store_templates('update', $style_id, $template_row['template_path'], $filelist);								unset($filelist);								$template_refreshed = $user->lang['TEMPLATE_REFRESHED'] . '<br />';								add_log('admin', 'LOG_TEMPLATE_REFRESHED', $template_row['template_name']);							}							$this->clear_template_cache($template_row);							trigger_error($template_refreshed . $user->lang['TEMPLATE_CACHE_CLEARED'] . adm_back_link($this->u_action));						}						else						{							confirm_box(false, ($template_row['template_storedb']) ? $user->lang['CONFIRM_TEMPLATE_REFRESH'] : $user->lang['CONFIRM_TEMPLATE_CLEAR_CACHE'], build_hidden_fields(array(								'i'			=> $id,								'mode'		=> $mode,								'action'	=> $action,								'id'		=> $style_id							)));						}					break;				}				$this->frontend('template', array('edit', 'cache', 'details'), array('refresh', 'export', 'delete'));			break;			case 'theme':				switch ($action)				{					// Refresh theme data stored in the database					case 'refresh':						$sql = 'SELECT *							FROM ' . STYLES_THEME_TABLE . "							WHERE theme_id = $style_id";						$result = $db->sql_query($sql);						$theme_row = $db->sql_fetchrow($result);						$db->sql_freeresult($result);						if (!$theme_row)						{							trigger_error($user->lang['NO_THEME'] . adm_back_link($this->u_action), E_USER_WARNING);						}						if (!$theme_row['theme_storedb'])						{							trigger_error($user->lang['THEME_ERR_REFRESH_FS'] . adm_back_link($this->u_action), E_USER_WARNING);						}						if (confirm_box(true))						{							if ($theme_row['theme_storedb'] && file_exists("{$phpbb_root_path}styles/{$theme_row['theme_path']}/theme/stylesheet.css"))							{								// Save CSS contents								$sql_ary = array(									'theme_mtime'	=> @filemtime("{$phpbb_root_path}styles/{$theme_row['theme_path']}/theme/stylesheet.css"),									'theme_data'	=> $this->db_theme_data($theme_row)								);								$sql = 'UPDATE ' . STYLES_THEME_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "									WHERE theme_id = $style_id";								$db->sql_query($sql);								$cache->destroy('sql', STYLES_THEME_TABLE);								add_log('admin', 'LOG_THEME_REFRESHED', $theme_row['theme_name']);								trigger_error($user->lang['THEME_REFRESHED'] . adm_back_link($this->u_action));							}						}						else						{							confirm_box(false, $user->lang['CONFIRM_THEME_REFRESH'], build_hidden_fields(array(								'i'			=> $id,								'mode'		=> $mode,								'action'	=> $action,								'id'		=> $style_id							)));						}					break;				}				$this->frontend('theme', array('edit', 'details'), array('refresh', 'export', 'delete'));			break;			case 'imageset':				switch ($action)				{					case 'refresh':						$sql = 'SELECT *							FROM ' . STYLES_IMAGESET_TABLE . "							WHERE imageset_id = $style_id";						$result = $db->sql_query($sql);						$imageset_row = $db->sql_fetchrow($result);						$db->sql_freeresult($result);						if (!$imageset_row)						{							trigger_error($user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING);						}						if (confirm_box(true))						{							$sql_ary = array();							$cfg_data = parse_cfg_file("{$phpbb_root_path}styles/{$imageset_row['imageset_path']}/imageset/imageset.cfg");												$imageset_definitions = array();							foreach ($this->imageset_keys as $topic => $key_array)							{								$imageset_definitions = array_merge($imageset_definitions, $key_array);							}											foreach ($cfg_data as $key => $value)							{								if (strpos($key, 'img_') === 0)								{									$key = substr($key, 4);									if (in_array($key, $imageset_definitions))									{										$sql_ary[$key] = str_replace('{PATH}', "styles/{$imageset_row['imageset_path']}/imageset/", trim($value));									}								}							}							unset($cfg_data);							if (sizeof($sql_ary))							{								$sql = 'UPDATE ' . STYLES_IMAGESET_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "									WHERE imageset_id = $style_id";								$db->sql_query($sql);							}							$cache->destroy('sql', STYLES_IMAGESET_TABLE);							add_log('admin', 'LOG_IMAGESET_REFRESHED', $imageset_row['imageset_name']);							trigger_error($user->lang['IMAGESET_REFRESHED'] . adm_back_link($this->u_action));						}						else						{							confirm_box(false, $user->lang['CONFIRM_IMAGESET_REFRESH'], build_hidden_fields(array(								'i'			=> $id,								'mode'		=> $mode,								'action'	=> $action,								'id'		=> $style_id							)));						}					break;				}				$this->frontend('imageset', array('edit', 'details'), array('refresh', 'export', 'delete'));			break;		}	}	/**	* Build Frontend with supplied options	*/	function frontend($mode, $options, $actions)	{		global $user, $template, $db, $config, $phpbb_root_path, $phpEx;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -