📄 theme.php
字号:
<?php/*======================================================================*\|| #################################################################### |||| # VirtuaNews - 1.0.4 Pro License ID - [WDYL-WTN]|| # ---------------------------------------------------------------- # |||| # All code in this file is ?2002 VirtuaSystems . # |||| # This file may not be redistributed in whole or significant part. # |||| # --------------- VIRTUANEWS IS NOT FREE SOFTWARE ---------------- # |||| # http://www.virtuanews.co.uk # |||| # http://www.virtuanews.co.uk/license.php # |||| #################################################################### ||\*======================================================================*/if (preg_match("/(admin\/theme.php)/i",$PHP_SELF)) { header("location:../admin.php"); exit;}function echothemeselectcode($title,$name="themeid",$value=0,$shownew=0,$width="") { echo " <tr>\n <td".iif($width," width=\"$width%\"","").">$title</td>\n <td>\n <select name=\"$name\" class=\"form\">\n"; echo iif($shownew," <option value=\"0\">创建新设置</option>\n",""); $getdata = query("SELECT id,title FROM news_theme ORDER BY title"); while ($data_arr = fetch_array($getdata)) { echo " <option value=\"$data_arr[id]\"".iif($value == $data_arr[id]," SELECTED","").">$data_arr[title]</option>\n"; } echo " </select>\n </td>\n </tr>\n";}function echosetselectcode($title,$name,$what="style",$shownew=1,$value=0) { echo " <tr>\n <td>$title</td>\n <td>\n <select name=\"$name\" class=\"form\">\n"; echo iif($shownew," <option value=\"0\">创建新设置</option>\n",""); $getdata = query("SELECT id,title FROM news_".$what."set ORDER BY title"); while ($data_arr = fetch_array($getdata)) { echo " <option value=\"$data_arr[id]\"".iif($value == $data_arr[id]," SELECTED","").">$data_arr[title]</option>\n"; } echo " </select>\n </td>\n </tr>\n";}function returnpagelist($titleselect,$level=1) { global $data_arr,$themeid; if (is_array($titleselect)) { $titleselect = join(" AND ",$titleselect); } $getpages = query("SELECT id,title,description,pagesetid FROM news_page WHERE $titleselect AND (pagesetid IN ('-2','-1','$data_arr[pagesetid]')) ORDER BY pagesetid,title"); while ($data = fetch_array($getpages)) { $pages[$data[title]][id] = $data[id]; $pages[$data[title]][altered] = iif(($data[pagesetid] == -1) | ($data[pagesetid] == -2),0,1); } if ($pages) { foreach ($pages AS $key => $val) { $code .= iif($level == 1," "," ")."<li>".iif($val[altered],"<span class=\"red\">$key</span>",$key).iif($val[altered],returnlinkcode("编辑","admin.php?action=theme_page_edit&id=$val[id]&pagesetid=$data_arr[pagesetid]&themeid=$themeid")." |".iif(substr($key,0,7) == "custom_",returnlinkcode("删除","admin.php?action=theme_page_delete&id=$val[id]&themeid=$themeid"),returnlinkcode("查看最初","admin.php?action=theme_page_view&title=".urlencode($key),1)." |".returnlinkcode("回复","admin.php?action=theme_page_revert&id=$val[id]&themeid=$themeid")),returnlinkcode("编辑最初","admin.php?action=theme_page_edit&id=$val[id]&pagesetid=$data_arr[pagesetid]&themeid=$themeid"))."</li>\n"; } } return $code;}function escapetext($string="") { $string = str_replace("|||||","||| ||",$string); $string = " ".$string." "; return $string;}function undoescapetext($string="") { $string = str_replace("||| ||","|||||",$string); $string = substr($string,1,-1); return $string;}$page_arr[aboutus][title] = "About us pages";$page_arr[aboutus][help] = "This category contains the page to display information about the staff of your site.";$page_arr[archive][title] = "Archive pages";$page_arr[archive][help] = "This category contains the page that displays the news archive on your site.";$page_arr[articles][title] = "Article pages";$page_arr[articles][help] = "This category contains all the pages to do with articles and displaying them.";$page_arr[comments][title] = "Comments display pages";$page_arr[comments][help] = "This category contains the pages which will display indervidual news posts and comments to them.";$page_arr[edit][title] = "Comment Edit pages";$page_arr[edit][help] = "This category contains the pages that will be displayed when a user edits their comments.";$page_arr[error][title] = "Error pages";$page_arr[error][help] = "This category contains the pages which will be displayed when an error occurs, eg a user does not supply the correct information.";$page_arr[help][title] = "Help Pages";$page_arr[help][help] = "This category contains pages which your users may view to get advice on how to use your site, for example, how to use qhtml code and smilies.";$page_arr[main][title] = "Index Pages";$page_arr[main][help] = "This category contains pages that are used to display the latest news and information about each news category, plus the pages for the category lists and custom start page.";$page_arr[member][title] = "Member Pages";$page_arr[member][help] = "This category contains all the pages for members, eg the page allowing people to view profiles, and that to email members.";$page_arr[menu][title] = "Menu bits";$page_arr[menu][help] = "This category contains the menus for each news category.";$page_arr[misc][title] = "Misc bits";$page_arr[misc][help] = "This category contains all the miscellaneous bits that dont fit into any other category, or those which are usesd in multiple places and purposes.";$page_arr[poll][title] = "Poll pages";$page_arr[poll][help] = "This category contains all the pages to do with polls";$page_arr['print'][title] = "Print post pages";$page_arr['print'][help] = "This category contains the pages that display a printable version of the news posts.";$page_arr[redirect][title] = "Redirection pages";$page_arr[redirect][help] = "This category contains pages that users see whent hey are being redirected after submitting something to the site.";$page_arr[register][title] = "Registration pages";$page_arr[register][help] = "This category contains the pages for registering with your site.";$page_arr[stats][title] = "Stats pages";$page_arr[stats][help] = "This category contains pages that will output the site statistics";$page_arr[search][title] = "Search pages";$page_arr[search][help] = "This category contains all the pages for searching the site.";$page_arr[user][title] = "User panel pages";$page_arr[user][help] = "This category contains all the pages for the user control panel.";$page_arr[articles][sub][cats][title] = "Category display pages";$page_arr[articles][sub][display][title] = "Article display pages";$page_arr[articles][sub][index][title] = "Article index pages";$page_arr[comments][sub][add][title] = "Add comment bits";$page_arr[comments][sub][comment][title] = "Comment data bits";$page_arr[comments][sub][emailnotify][title] = "Email notify bits";$page_arr[comments][sub][news][title] = "News display bits";$page_arr[comments][sub][smilies][title] = "Smilie bits";$page_arr[main][sub][news][title] = "News post bits";$page_arr[main][sub][catlist][title] = "Category list pages";$page_arr[member][sub][email][title] = "Email Form pages";$page_arr[member][sub]['list'][title] = "Member List pages";$page_arr[member][sub][profile][title] = "Profile pages";$page_arr[misc][sub][announcement][title] = "Announcement bits";$page_arr[misc][sub][nav][title] = "Nav bar bits";$page_arr[misc][sub][page_nav][title] = "Page navigation bits";$page_arr[misc][sub][recent_post][title] = "Recent post bits";$page_arr[misc][sub][stats][title] = "Stats bits";$page_arr[misc][sub][sitejump][title] = "Site Jump bits";$page_arr[misc][sub][theme_selector][title] = "Theme selector bits";$page_arr[misc][sub][welcometext][title] = "Welcome Text bits";$page_arr[poll][sub][options][title] = "Poll option bits";$page_arr[poll][sub][results][title] = "Poll result bits";$page_arr[poll][sub][view][title] = "Poll display pages";$page_arr[register][sub][email][title] = "Email pages";$page_arr[search][sub][results][title] = "Results pages";$page_arr[user][sub][forget][title] = "Password forget pages";$page_arr[user][sub][pm][title] = "Private messenging pages";if ($use_forum) { unset($page_arr[member]); unset($page_arr[register]); unset($page_arr[user]); $page_arr[user_login][title] = "用户登录页面"; $page_arr[user_login][help] = "This category contains the pages used when a user is logging in or out.";}updateadminlog(iif($id,"id = $id",""));switch ($action) {case "theme": echohtmlheader(); echotableheader("编辑主题"); echotabledescription("使用这个栏目你只需通过下面少数几个简单步骤就可编辑你站点的主题. 你一个步骤是选择你想编辑的主题."); echotabledescription(returnlinkcode("添加主题","admin.php?action=theme_add")); $tablerows = returnminitablerow("<b>主题标题</b>","<b>允许用户选取</b>","<b>选项</b>"); $getdata = query("SELECT id,title,allowselect FROM news_theme ORDER BY title"); while ($data_arr = fetch_array($getdata)) { $tablerows .= returnminitablerow($data_arr[title],iif($data_arr[allowselect],"Yes","No"),returnlinkcode("编辑","admin.php?action=theme_edit&id=$data_arr[id]")." |".returnlinkcode("删除","admin.php?action=theme_delete&id=$data_arr[id]")." |".returnlinkcode("下载","admin.php?action=theme_download&id=$data_arr[id]")." |".returnlinkcode("编辑页面","admin.php?action=theme_pageselect&themeid=$data_arr[id]")." |".returnlinkcode("编辑风格","admin.php?action=theme_style&themeid=$data_arr[id]")); } echotabledescription("\n".returnminitable($tablerows,0,100)." "); echotablefooter(); echo "<br />\n"; echotableheader("编辑页面设置"); echotabledescription("使用这个设置能编辑站点每个页面的详细资料. If you would like to edit the actual pages for your sets then you must do it by clicking on the "Edit Pages" link for the appropriate theme above."); echotabledescription(returnlinkcode("添加页面设置","admin.php?action=theme_pageset_add")); $tablerows = returnminitablerow("<b>页面设置标题</b>","<b>选项</b>"); $getdata = query("SELECT id,title FROM news_pageset ORDER BY title"); while ($data_arr = fetch_array($getdata)) { $tablerows .= returnminitablerow($data_arr[title],returnlinkcode("编辑","admin.php?action=theme_pageset_edit&id=$data_arr[id]")." |".returnlinkcode("删除","admin.php?action=theme_pageset_delete&id=$data_arr[id]")); } echotabledescription("\n".returnminitable($tablerows,0,100)." "); echotablefooter(); echo "<br />\n"; echotableheader("编辑风格设置"); echotabledescription("Using this section you can edit the details of each style set on your site. If you would like to edit the actual style for your sets then you must do it by clicking on the "Edit Style" link for the appropriate theme above."); echotabledescription(returnlinkcode("添加风格设置","admin.php?action=theme_styleset_add")); $tablerows = returnminitablerow("<b>风格设置标题</b>","<b>选项</b>"); $getdata = query("SELECT id,title FROM news_styleset ORDER BY title"); while ($data_arr = fetch_array($getdata)) { $tablerows .= returnminitablerow($data_arr[title],returnlinkcode("编辑","admin.php?action=theme_styleset_edit&id=$data_arr[id]")." |".returnlinkcode("删除","admin.php?action=theme_styleset_delete&id=$data_arr[id]")); } echotabledescription("\n".returnminitable($tablerows,0,100)." "); echotablefooter(); echo "<br />\n"; echoformheader("theme_upload","导入模板",2,1); echotabledescription("从你的计算机导入模板."); echouploadcode("导入文件:","uploadfile"); echothemeselectcode("覆盖现有模板:","overwrite",0,1); echoyesnocode("如果模板有错误仍然使用?","ignore",0); echoformfooter(); echohtmlfooter();break;case "theme_add": echohtmlheader(); echoformheader("theme_new","添加风格"); echotabledescription("通过这个页面,你能给你的站添加风格"); echoinputcode("标题","title"); echosetselectcode("风格设置:","styleid","style",1); echosetselectcode("页面设置:","pageid","page",1); echoyesnocode("允许会员选择:","allowselect",1); echoformfooter(); echohtmlfooter();break;case "theme_new": if ($title == "") { adminerror("空白栏目","所有区域必须填写, 只有一个 <span class=\"red\">(可选)</span> 可以留空"); } if ($styleid) { verifyid("news_styleset",$styleid); } if ($pagesetid) { verifyid("news_pageset",$pagesetid); } if (!$styleid) { query("INSERT INTO news_styleset VALUES (NULL,'$title')"); $styleid = getlastinsert(); } if (!$pageid) { query("INSERT INTO news_pageset VALUES (NULL,'$title')"); $pageid = getlastinsert(); } query("INSERT INTO news_theme VALUES (NULL,'$title','$pageid','$styleid','$allowselect')"); writeallpages(); echoadminredirect("admin.php?action=theme"); exit;break;case "theme_edit": settype($id,"integer"); if ($data_arr = query_first("SELECT title,stylesetid,pagesetid,allowselect FROM news_theme WHERE id = $id")) { echohtmlheader(); echoformheader("theme_update","编辑主题选项"); updatehiddenvar("id",$id); echotabledescription("使用这部分你能编辑设置你的主题.如保存你改变的编辑请点击submit键."); echotabledescription(returnlinkcode("下载模板","admin.php?action=theme_download&id=$id")); echoinputcode("标题:","title",$data_arr[title]); echosetselectcode("风格设置:","styleid","style",0,$data_arr[stylesetid]); echosetselectcode("页面设置:","pagesetid","page",0,$data_arr[pagesetid]); echoyesnocode("允许会员选择:","allowselect",$data_arr[allowselect]); echoformfooter(); echohtmlfooter(); } else { adminerror("无效ID","你指定了一个无效id."); }break;case "theme_update": if ($title == "") { adminerror("空白栏目","所有栏目必须填写, 只有一个 <span class=\"red\">(可选)</span> 可以留空"); } verifyid("news_theme",$id); verifyid("news_styleset",$styleid); verifyid("news_pageset",$pagesetid); query("UPDATE news_theme SET title = '$title' , pagesetid = '$pagesetid' , stylesetid = '$styleid' , allowselect = '$allowselect' WHERE id = $id"); writeallpages(); echoadminredirect("admin.php?action=theme&id=$id"); exit;break;case "theme_delete": verifyid("news_theme",$id); if ($temp = query_first("SELECT name FROM news_category WHERE defaulttheme = $id")) { adminerror("不能删除风格","You cannot delete this theme as it is set as the default theme for the news category $temp[name]"); } echodeleteconfirm("模板","theme_kill",$id);break;case "theme_kill": verifyid("news_theme",$id); if ($temp = query_first("SELECT name FROM news_category WHERE defaulttheme = $id")) { adminerror("不能删除风格","You cannot delete this theme as it is set as the default theme for the news category $temp[name]"); } query("DELETE FROM news_theme WHERE id = $id"); writeallpages(); echoadminredirect("admin.php?action=theme"); exit;break;case "theme_upload": if (empty($uploadfile)) { adminerror("空白栏目","所有栏目必须填写, 只有一个 <span class=\"red\">(可选)</span> 可以留空"); } $name_arr = explode(".",$uploadfile[name]); $filetype = $name_arr[count($name_arr)-1]; if ($filetype != "set") { adminerror("无效风格","这个你上传的风格不是一个有效的主题,你不能继续."); } $filesize = @filesize($uploadfile[tmp_name]); $fp = @fopen($uploadfile[tmp_name],"r"); $filecontent = @fread($fp,$filesize); @fclose($fp); @unlink($uploadfile[tmp_name]);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -