public static function getInstance() { switch (Option::DEFAULT_MYSQLCONN) { case 'mysqli': return MySqlii::getInstance(); break; case 'mysql': default: return MySql::getInstance(); break; } }
public static function getInstance() { if (class_exists('mysqli', FALSE)) { return MySqlii::getInstance(); } else { if (class_exists('mysql', FALSE)) { return MySql::getInstance(); } else { emMsg('服务器空间PHP不支持MySql数据库'); } } }
/** * 获取Db实例 * @param null */ public function getDbInstance() { if (!is_null($this->_db)) { return $this->_db; } if (class_exists('mysqli')) { $this->_db = MySqlii::getInstance(); } else { $this->_db = MySql::getInstance(); } return $this->_db; }
function asc_time_limit($ip, $time_limit) { $DB = MySql::getInstance(); if ($time_limit <= 0) { return; } $time_line = time() - $time_limit; $sql = "SELECT ip FROM " . DB_PREFIX . "comment WHERE ip='{$ip}' AND date > {$time_line}"; $query = $DB->query($sql); $num = $DB->num_rows($query); if ($num) { ascMsg("{$time_limit}秒内只能发表一次评论,评论发表失败"); } }
public function __construct() { if (is_null(self::$DbHandler)) { if (class_exists('mysqli')) { self::$DbHandler = MySqlii::getInstance(); } else { self::$DbHandler = MySql::getInstance(); } } $this->tableName = DB_PREFIX . $this->tableName; $this->fields = $this->getDbFields(); foreach ($this->fields as $key => $value) { $this->SQLfields .= $this->parseKey($value) . ','; } $this->SQLfields = rtrim($this->SQLfields, ','); #查询的全字段预处理 }
function getSmallImg($gid) { $db = MySql::getInstance(); $sql = "SELECT excerpt FROM " . DB_PREFIX . "blog WHERE checked='y' and password='' and gid=" . $gid; $query = $db->query($sql); while ($row = $db->fetch_array($query)) { preg_match_all("/<img([^>]+)src=\"([^>\"]+)\"?([^>]*)>/i", $row['excerpt'], $matches); //从摘要找缩略图 if ($matches[2][1]) { //$imgsrc=$matches[2][1]?$matches[2][1]:$matches[2][0]; $imgsrc = $matches[2][1]; } else { $imgsrc = TEMPLATE_URL . "img/bgtest.png"; } } return $imgsrc; }
/** * 获取文章信息 * * @return array */ function getBlog($sortid = null) { $DB = MySql::getInstance(); $sorts = Cache::getInstance()->readCache('sort'); if (isset($sorts[$sortid])) { $sort = $sorts[$sortid]; if ($sort['pid'] != 0 || empty($sort['children'])) { $subsql = "and sortid={$sortid}"; } else { $sortids = array_merge(array($sortid), $sort['children']); $subsql = "and sortid in (" . implode(',', $sortids) . ")"; } } else { $subsql = $sortid ? "and sortid={$sortid}" : ''; } $sql = "SELECT * FROM " . DB_PREFIX . "blog WHERE hide='n' and type='blog' {$subsql} ORDER BY date DESC limit 0," . Option::get('rss_output_num'); $result = $DB->query($sql); $blog = array(); while ($re = $DB->fetch_array($result)) { $re['id'] = $re['gid']; $re['title'] = htmlspecialchars($re['title']); $re['date'] = $re['date']; $re['content'] = $re['content']; if (!empty($re['password'])) { $re['content'] = '<p>[该文章已设置加密]</p>'; } elseif (Option::get('rss_output_fulltext') == 'n') { if (!empty($re['excerpt'])) { $re['content'] = $re['excerpt']; } else { $re['content'] = extractHtmlData($re['content'], 330); } $re['content'] .= ' <a href="' . Url::log($re['id']) . '">阅读全文>></a>'; } $blog[] = $re; } return $blog; }
function img_fj($blogid) { $db = MySql::getInstance(); $sql = "SELECT * FROM " . DB_PREFIX . "attachment WHERE blogid=" . $blogid . " AND (`filepath` LIKE '%jpg' OR `filepath` LIKE '%gif' OR `filepath` LIKE '%png') ORDER BY `aid` ASC LIMIT 0,1"; $imgs = $db->query($sql); $img_path = ""; while ($row = $db->fetch_array($imgs)) { $img_path .= BLOG_URL . substr($row['filepath'], 3, strlen($row['filepath'])); } return $img_path; }
/** * 书签函数集合 */ function dbConnect() { include "copy/mysql.php"; $result = MySql::getInstance(); return $result; }
function echo_levels($comment_author_email, $comment_author_url) { $DB = MySql::getInstance(); $vip_list = array('"*****@*****.**"'); if (in_array($comment_author_email, $vip_list)) { echo '<a class="vip" href="mailto:2398112878@qq.com" title="会员认证"></a>'; } $adminEmail = '"*****@*****.**"'; if ($comment_author_email == $adminEmail) { echo '<a class="vip" href="mailto:' . $comment_author_email . '" title="作者认证"></a>'; echo '<a class="vp" href="mailto:infreesu@hotmail.com" title="管理员认证"></a><a class="vip7" title="特别认证"></a>'; } $sql = "SELECT cid as author_count FROM emlog_comment WHERE mail = " . $comment_author_email; $res = $DB->query($sql); $author_count = mysql_num_rows($res); if ($author_count >= 5 && $author_count < 10 && $comment_author_email != $adminEmail) { echo '<a class="vip1" title="路过酱油 LV.1"></a>'; } else { if ($author_count >= 10 && $author_count < 20 && $comment_author_email != $adminEmail) { echo '<a class="vip2" title="偶尔光临 LV.2"></a>'; } else { if ($author_count >= 20 && $author_count < 40 && $comment_author_email != $adminEmail) { echo '<a class="vip3" title="常驻人口 LV.3"></a>'; } else { if ($author_count >= 40 && $author_count < 80 && $comment_author_email != $adminEmail) { echo '<a class="vip4" title="以博为家 LV.4"></a>'; } else { if ($author_count >= 80 && $author_count < 160 && $comment_author_email != $adminEmail) { echo '<a class="vip5" title="情牵小博 LV.5"></a>'; } else { if ($author_count >= 160 && $author_coun < 320 && $comment_author_email != $adminEmail) { echo '<a class="vip6" title="为博终老 LV.6"></a>'; } else { if ($author_count >= 320 && $comment_author_email != $adminEmail) { echo '<a class="vip7" title="三世情牵 LV.7"></a>'; } } } } } } } }
/** * 备份数据库结构和所有数据 * * @param string $table 数据库表名 * @return string */ function dataBak($table) { $DB = MySql::getInstance(); $sql = "DROP TABLE IF EXISTS {$table};\n"; $createtable = $DB->query("SHOW CREATE TABLE {$table}"); $create = $DB->fetch_row($createtable); $sql .= $create[1] . ";\n\n"; $rows = $DB->query("SELECT * FROM {$table}"); $numfields = $DB->num_fields($rows); $numrows = $DB->num_rows($rows); while ($row = $DB->fetch_row($rows)) { $comma = ''; $sql .= "INSERT INTO {$table} VALUES("; for ($i = 0; $i < $numfields; $i++) { $sql .= $comma . "'" . $DB->escape_string($row[$i]) . "'"; $comma = ','; } $sql .= ");\n"; } $sql .= "\n"; return $sql; }
function plugin_setting_view() { $DB = MySql::getInstance(); $ActMe = isset($_GET['downAct']) ? addslashes($_GET['downAct']) : NULL; $Page = isset($_GET['page']) ? intval($_GET['page']) : 1; $DownList = DownloadMe_Ret("SQL"); $File_Unu = 0; $File_Out = 0; $File_Web = 0; $Page_Num = 12; if (!empty($DownList['File'])) { foreach ($DownList['File'] as $Key => $Val) { $Set = $Val['download'] ? unserialize($Val['download']) : array("statis" => 0, "hide" => false, "web" => false); $Val['md5'] = $Val['blogid'] . '-' . $Val['aid']; if ($Set['hide'] === true) { $File_Out++; } if ($Set['web'] === true) { $File_Web++; } if (DownloadMe_File($Val['filepath']) === false && $Set['web'] !== true) { $File_Unu++; } if (!empty($ActMe) && $ActMe == "web" && $Set['web'] === true) { $ListEcho[] = $Val; } if (!empty($ActMe) && $ActMe == "out" && $Set['hide'] === true) { $ListEcho[] = $Val; } if (!empty($ActMe) && $ActMe == "unu" && DownloadMe_File($Val['filepath']) === false && $Set['web'] !== true) { $ListEcho[] = $Val; } if (empty($ActMe)) { $ListEcho[] = $Val; } } } $PageMe = pagination(count($ListEcho), $Page_Num, $Page, './plugin.php?plugin=download' . ($ActMe ? '&downAct=' . $ActMe : '') . '&page='); ?> <div class="DownloadMe"> <div class="Title"><b>附件管理</b> - 就是这么方便! <div class="navMe"> <a title="外链附件"href="./plugin.php?plugin=download&downAct=web" class="urlimg <?php echo $ActMe == 'unu' ? 'strong' : ''; ?> "> ( <font class="File_Unu"><?php echo $File_Web; ?> </font> )</a> <a title="异常附件" href="./plugin.php?plugin=download&downAct=unu" class="unu <?php echo $ActMe == 'unu' ? 'strong' : ''; ?> "> ( <font class="File_Unu"><?php echo $File_Unu; ?> </font> )</a> <a title="暂停下载" href="./plugin.php?plugin=download&downAct=out" class="out <?php echo $ActMe == 'out' ? 'strong' : ''; ?> "> ( <font class="File_Out"><?php echo $File_Out; ?> </font> )</a> <a title="全部附件" href="./plugin.php?plugin=download" class="anImg start <?php echo empty($ActMe) ? 'strong' : ''; ?> "> ( <font class="File_All"><?php echo count($DownList['File']); ?> </font> )</a> <a href="./plugin.php?plugin=download&downAct=gov" class="anImg config <?php echo $ActMe == 'gov' ? 'strong' : ''; ?> "> 设置</a> <a href="javascript:FileActMe('UpCache');" class="anImg cache">缓存</a> <a href="javascript:VersionMe();" class="anImg upload">更新</a> </div> </div> <form action="" method="post" enctype="application/x-www-form-urlencoded"> <div class="List"> <div class="notes">注: <?php echo empty($ActMe) ? '在删除日志时关联附件也会被删除' : ''; ?> <?php echo $ActMe == 'out' ? '文章页面输出附件列表时, 暂停下载的附件将会被剔除 (不输出) ..' : ''; ?> <?php echo $ActMe == 'unu' ? '不存在实体文件, 只存在数据库关联的附件..' : ''; ?> <?php echo $ActMe == 'gov' ? '停用此插件后配置将有可能会被清空!(取决于缓存文件 "downloadMeData_Inc.php")...' : ''; ?> <?php echo $ActMe == 'web' ? '网络上的共享附件,程序不会将附件下载到本地服务器中,只做下载点击的统计!' : ''; ?> </div> <?php if ($ActMe == "gov") { $Inc = DownloadMe_Ret("Inc"); ?> <input name="DownloadMeGov" type="hidden" value="true" /> <table width="100%" class="item_list"> <thead> <tr> <th class="tdcenter"><b>设置</b></th> <th class="tdcenter"><b>说明</b></th> </tr> </thead> <tbody> <tr> <td><textarea name="echo_file" cols="50" rows="5"><?php echo $Inc["file"] ? $Inc["file"] : ECHO_FILE_INC; ?> </textarea></td> <td> 前台输出附件列表时输出的格式,( Html代码 ) 可用参数:<br> [url] : 隐链接。[path] : 明链接。[nameSub] : 截取后的附件名<br> [name] : 完整附件名。[tong] : 下载统计。[time] : 上传时间。[size] : 文件大小<br> 注:<font class="redMe">只有<strong>[url] 隐链接</strong>才能被统计!</font> </td> </tr> <tr> <td><textarea name="echo_wrap" cols="50" rows="3"><?php echo $Inc["wrap"] ? $Inc["wrap"] : ''; ?> </textarea></td> <td> 前台输出附件列表包裹代码,( Html代码 ) 可用参数:<br> [list] : 附件列表<br> 这个参数会把附件列表包裹起来,(用于自定义CSS)。 </td> </tr> <tr> <td> <label><input name="echo_mov" type="radio" value="0" <?php echo empty($Inc["mov"]) ? 'checked' : ''; ?> />钩子输出模式</label> <label><input name="echo_mov" type="radio" value="1" <?php echo $Inc["mov"] == 1 ? 'checked' : ''; ?> />日志输出模式</label> </td> <td> 日志输出模式需要修改前台正在使用的模版文件"module.php"的 blog_att() 功能类<br> 将其替换成 " <font class="redMe">function blog_att($blogid){ doAction('baby_blog_atts',$blogid); }</font> "<br> 如果不想修改模板文件,那么就选择钩子模式吧,<br> </td> </tr> <tr> <td> <label><input name="echo_down" type="radio" value="0" <?php echo empty($Inc["down"]) ? 'checked' : ''; ?> />重新打开博客时</label> <label><input name="echo_down" type="radio" value="1" <?php echo $Inc["down"] == 1 ? 'checked' : ''; ?> />24小时</label> <label><input name="echo_down" type="radio" value="2" <?php echo $Inc["down"] == 2 ? 'checked' : ''; ?> />每IP</label> </td> <td>客户下载某个附件后设置时间段内重复下载同一附件只统计一次,(IP过滤)<br>IP缓存数据 "downloadMeData_Gip.php"</td> </tr> <tr> <td> <label><input name="echo_img" type="radio" value="0" <?php echo empty($Inc["img"]) ? 'checked' : ''; ?> />直接输出图片</label> <label><input name="echo_img" type="radio" value="1" <?php echo $Inc["img"] == 1 ? 'checked' : ''; ?> />仍然以附件形式输出</label> </td> <td>图片类型附件的输出方法</td> </tr> <tr> <td> <label><input name="echo_key" type="radio" value="0" <?php echo empty($Inc["key"]) ? 'checked' : ''; ?> />关闭下载验证</label> <label><input name="echo_key" type="radio" value="1" <?php echo $Inc["key"] == 1 ? 'checked' : ''; ?> />打开下载验证</label> </td> <td>前台下载附件是否需要输入验证码</td> </tr> <tr> <td> <label><input name="echo_rob" type="radio" value="0" <?php echo empty($Inc["rob"]) ? 'checked' : ''; ?> />关闭防盗链</label> <label><input name="echo_rob" type="radio" value="1" <?php echo $Inc["rob"] == 1 ? 'checked' : ''; ?> />打开防盗链</label> </td> <td>前台附件防盗链设置开关</td> </tr> </tbody> </table> <?php } else { ?> <div class="normal"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <thead> <tr> <th width="20"></th> <th>附件名</th> <th width="90">大小</th> <th width="70">统计</th> <th width="120">时间</th> <th width="18"></th> <th class="operate"></th> </tr> </thead> <tbody> <?php $ListNum = 0; for ($i = ($Page - 1) * $Page_Num; $i < $Page * $Page_Num; $i++) { if (!isset($ListEcho[$i])) { continue; } $Echo = $ListEcho[$i]; $ListNum++; $Set = $Echo['download'] ? unserialize($Echo['download']) : array("statis" => 0, "hide" => false, "web" => false); $Onsel = $Set['web'] === true ? 'weburl' : (DownloadMe_File($Echo['filepath']) === false ? "onsels" : "onsel"); $OnseR = array('weburl' => '外链附件', 'onsels' => '错误附件', 'onsel' => '正常附件'); $Show = $Set['hide'] === true ? "hide" : "show"; $BlogId = $Echo['blogid']; $BlogAr = $DownList['Log'][$BlogId]; $BolgUrl = Url::log($BlogId); $BlogMe = ' <a href="' . ($BlogAr[1] == 'n' ? $BolgUrl : 'write_log.php?action=edit&gid=' . $BlogId) . '" target="_blank" class="BlogUrl">' . ($BlogAr[0] ? $BlogAr[0] : '无标题') . ($BlogAr[1] == 'y' ? '( 草稿-未发布 )' : '') . '</a>'; $CacheAid = unserialize($_SESSION['DownloadCacheAid']); if (is_array($CacheAid) === true) { $_SESt = $CacheAid['aid'] != $Echo['blogid'] && $CacheAid['t'] === false ? true : false; } else { $_SESt = true; } if ($_SESt === true) { echo '<tr class="BlogTitle trFile_' . $BlogId . '"><td></td><td colspan="6">Title: ' . $BlogMe . 'ID: <font class="redMe">' . $BlogId . '</font> <a title="增加外链附件" href="javascript:AddUrl(' . $BlogId . ');" class="addurl"></a></td></tr>'; $_SESt = false; } $_SESSION['DownloadCacheAid'] = serialize(array('aid' => $Echo['blogid'], 't' => $_SESt)); ?> <tr class="trFile_Edit trFile_<?php echo $Echo['aid']; ?> _<?php echo $BlogId; ?> "> <td><input name="check[]" class="check" type="checkbox" value="<?php echo $Echo['md5']; ?> " /></td> <td class="name"><input name="filename" class="edit" type="text" value="<?php echo $Echo['filename']; ?> " size="55" /></td> <td> <?php if ($Set['web'] === true && $Echo['filesize'] <= 0) { echo '<span class="hSize size_' . $Echo['md5'] . '" title="获取文件大小" onclick="AddUrl(\'' . $Echo['md5'] . '\',false)">' . changeFileSize($Echo['filesize']) . '</span>'; } elseif ($Set['web'] === true && $Echo['filesize'] > 0) { echo '<span class="hSize upSize size_' . $Echo['md5'] . '" title="更新文件大小" onclick="AddUrl(\'' . $Echo['md5'] . '\',false)">' . changeFileSize($Echo['filesize']) . '</span>'; } else { echo changeFileSize($Echo['filesize']); } ?> </td> <td><input name="statis" class="edit" type="text" value="<?php echo $Set['statis']; ?> " size="3" /></td> <td><?php echo date('Y-m-d H:i', $Echo['addtime']); ?> </td> <td><span class="imganMe <?php echo $Onsel; ?> " title="<?php echo $OnseR[$Onsel]; ?> "></span></td> <td class="operate"> <a href="javascript:FileMove('<?php echo $Echo['md5']; ?> ');" class="imganMe global" title="移动"></a> <a href="<?php echo $Echo['filepath']; ?> " target="_blank" class="imganMe vlog" title="下载"></a> <a href="javascript:FileActMe('Switch','<?php echo $Echo['md5']; ?> ');" class="imganMe <?php echo $Show; ?> " title="暂停/开启"></a> <a href="javascript:FileActMe('Dell','<?php echo $Echo['md5']; ?> ');" class="imganMe dell" title="删除"></a> </td> </tr> <?php } if ($ListNum <= 0) { ?> <tr> <td width="20"></td> <td colspan="6" style="color:red;"> G_G"… 没有找到!。。。</td> </tr> <?php } ?> </tbody> </table> </div> <?php } ?> </div> <input name="reset" type="reset" style="display:none;" /> </form> <div class="PageMe"> <?php if ($ActMe != "gov") { ?> <div class="an"> <a href="javascript:checkMe(true);">全选</a> <a href="javascript:checkMe(false);">反选</a> <a class="EditMe" href="javascript:FileActMe('Edit');">修改</a> <a class="ResetMe" href="javascript:FileActMe('Reset');">重置</a> <a href="javascript:FileActMe('Switch');">暂停/开启下载</a> <a href="javascript:FileActMe('Dell');">删除选中</a> </div> <?php echo $PageMe; ?> <?php } else { ?> <div class="an"> <a href="javascript:FileActMe('Gov');">修改</a> <a class="ResetMe" href="javascript:FileActMe('Reset');">重置</a> </div> <?php } ?> </div> </div> <?php }
function DownloadMe_NewUp($Gid, $Da = false) { $DB = MySql::getInstance(); $DownData = DownloadMe_Ret(); $Data = $DownData['File'][$Gid]; if (!empty($Data)) { $Aid = $Data['aid']; $Lid = $Data['blogid']; $Edit = unserialize($Data['download']); $Edit['statis'] = intval($Edit['statis']) + 1; $editIF = $DB->query("UPDATE " . DB_PREFIX . "attachment SET download='" . serialize($Edit) . "' WHERE aid={$Aid} AND blogid={$Lid}"); DownloadMe_Up(); if ($Da === false) { return true; } global $CACHE; $Da[$Gid][] = getIp() . '#' . time(); $CACHE->cacheWrite(serialize($Da), DOWNLOAD_CACHE_NAME . "_Gip"); } return false; }
<div class="content-box"> <!-- Start Content Box --> <div class="content-box-header"> <h3 style="cursor: s-resize; ">特征列表</h3> <div class="clear"></div> </div> <!-- End .content-box-header --> <div class="content-box-content"> <div class="tab-content default-tab" id="tab1" style="display: block; "> <!-- This is the target div. id must match the href of this div's tab --> <?php require_once 'define.php'; require_once 'mysql.php'; require_once 'FunctionBase.php'; $mysql = MySql::getInstance(); $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; if ($action == 'del' && isset($_REQUEST['id'])) { $id = $_REQUEST['id']; $mysql->query("delete from ErrFeature where id='" . $id . "';"); emDirect("FeatureList.php?active_del=true"); } $rq = $mysql->query('select * from ErrFeature'); ?> <table> <thead> <tr> <th>ID</th> <th>类型</th> <th>特征表达式</th> <th>提示信息</th>
/** * 通过登录名查询管理员信息 * * @param string $userLogin User's username * @return bool|object False on failure, User DB row object */ public static function getUserDataByLogin($userLogin) { $DB = MySql::getInstance(); if (empty($userLogin)) { return false; } $userData = false; if (!($userData = $DB->once_fetch_array("SELECT * FROM " . DB_PREFIX . "user WHERE username = '******'"))) { return false; } $userData['nickname'] = htmlspecialchars($userData['nickname']); $userData['username'] = htmlspecialchars($userData['username']); return $userData; }
/** * 生成日历 */ static function generate() { $DB = MySql::getInstance(); $timezone = Option::get('timezone'); $timestamp = time() + $timezone * 3600; //建立文章时间写入数组 $query = $DB->query("SELECT date FROM " . DB_PREFIX . "blog WHERE hide='n' and checked='y' and type='blog'"); while ($date = $DB->fetch_array($query)) { $logdate[] = gmdate("Ymd", $date['date'] + $timezone * 3600); } //获取当前日期 $n_year = gmdate("Y", $timestamp); $n_year2 = gmdate("Y", $timestamp); $n_month = gmdate("m", $timestamp); $n_day = gmdate("d", $timestamp); $time = gmdate("Ymd", $timestamp); $year_month = gmdate("Ym", $timestamp); if (isset($_GET['record'])) { $n_year = substr(intval($_GET['record']), 0, 4); $n_year2 = substr(intval($_GET['record']), 0, 4); $n_month = substr(intval($_GET['record']), 4, 2); $year_month = substr(intval($_GET['record']), 0, 6); } //年月跳转连接 $m = $n_month - 1; $mj = $n_month + 1; $m = $m < 10 ? '0' . $m : $m; $mj = $mj < 10 ? '0' . $mj : $mj; $year_up = $n_year; $year_down = $n_year; if ($mj > 12) { $mj = '01'; $year_up = $n_year + 1; } if ($m < 1) { $m = '12'; $year_down = $n_year - 1; } $url = DYNAMIC_BLOGURL . '?action=cal&record=' . ($n_year - 1) . $n_month; //上一年份 $url2 = DYNAMIC_BLOGURL . '?action=cal&record=' . ($n_year + 1) . $n_month; //下一年份 $url3 = DYNAMIC_BLOGURL . '?action=cal&record=' . $year_down . $m; //上一月份 $url4 = DYNAMIC_BLOGURL . '?action=cal&record=' . $year_up . $mj; //下一月份 $calendar = "<table class=\"calendartop\" cellspacing=\"0\"><tr>\n\t\t<td><a href=\"javascript:void(0);\" onclick=\"sendinfo('{$url}','calendar');\"> « </a>{$n_year2}<a href=\"javascript:void(0);\" onclick=\"sendinfo('{$url2}','calendar');\"> » </a></td>\n\t\t<td><a href=\"javascript:void(0);\" onclick=\"sendinfo('{$url3}','calendar');\"> « </a>{$n_month}<a href=\"javascript:void(0);\" onclick=\"sendinfo('{$url4}','calendar');\"> » </a></td>\n\t\t</tr></table>\n\t\t<table class=\"calendar\" cellspacing=\"0\">\n\t\t<tr><td class=\"week\">一</td><td class=\"week\">二</td><td class=\"week\">三</td><td class=\"week\">四</td><td class=\"week\">五</td><td class=\"week\">六</td><td class=\"sun\">日</td></tr>"; //获取给定年月的第一天是星期几 $week = @gmdate("w", gmmktime(0, 0, 0, $n_month, 1, $n_year)); //获取给定年月的天数 $lastday = @gmdate("t", gmmktime(0, 0, 0, $n_month, 1, $n_year)); //获取给定年月的最后一天是星期几 $lastweek = @gmdate("w", gmmktime(0, 0, 0, $n_month, $lastday, $n_year)); if ($week == 0) { $week = 7; } $j = 1; $w = 7; $isend = false; //外循环生成行 for ($i = 1; $i <= 6; $i++) { if ($isend || $i == 6 && $lastweek == 0) { break; } $calendar .= '<tr>'; //内循环生成列 for ($j; $j <= $w; $j++) { if ($j < $week) { $calendar .= '<td> </td>'; } elseif ($j <= 7) { $r = $j - $week + 1; //如果该日有文章就显示url样式 $n_time = $n_year . $n_month . '0' . $r; //有文章且为当天 if (@in_array($n_time, $logdate) && $n_time == $time) { $calendar .= '<td class="day"><a href="' . Url::record($n_time) . '">' . $r . '</a></td>'; } elseif (@in_array($n_time, $logdate)) { $calendar .= '<td class="day2"><a href="' . Url::record($n_time) . '">' . $r . '</a></td>'; } elseif ($n_time == $time) { $calendar .= '<td class="day">' . $r . '</td>'; } else { $calendar .= '<td>' . $r . '</td>'; } } else { $t = $j - ($week - 1); if ($t > $lastday) { $isend = true; $calendar .= '<td> </td>'; } else { //如果该日有文章就显示url样式 $t < 10 ? $n_time = $n_year . $n_month . '0' . $t : ($n_time = $n_year . $n_month . $t); if (@in_array($n_time, $logdate) && $n_time == $time) { $calendar .= '<td class="day"><a href="' . Url::record($n_time) . '">' . $t . '</a></td>'; } elseif (@in_array($n_time, $logdate)) { $calendar .= '<td class="day2"><a href="' . Url::record($n_time) . '">' . $t . '</a></td>'; } elseif ($n_time == $time) { $calendar .= '<td class="day">' . $t . '</td>'; } else { $calendar .= '<td>' . $t . '</td>'; } } } } //内循环结束 $calendar .= '</tr>'; $w += 7; } //外循环结束 $calendar .= '</table>'; echo $calendar; }
function __construct() { $this->db = MySql::getInstance(); }
function escape(&$array) { if (!is_array($array)) { return MySql::getInstance()->escape_string($array); } else { foreach ((array) $array as $k => $v) { if (is_array($v)) { escape($array[$k]); } else { if (is_object($v)) { // skip } else { $array[$k] = MySql::getInstance()->escape_string($v); } } } } }
function blog_cover($blogid, &$cover_img, $w, $h) { $db = MySql::getInstance(); $sql = "SELECT b.filepath,a.title,a.gid FROM " . DB_PREFIX . "blog as a, " . DB_PREFIX . "attachment as b where a.gid={$blogid} and b.blogid=a.gid ORDER BY b.addtime asc, thumfor DESC "; $ret = $db->query($sql); $row = $db->fetch_array($ret); if (!empty($row)) { $row['filepath'] = $row['filepath'] ? BLOG_URL . substr($row['filepath'], 3) : TEMPLATE_URL . 'image/logo.png'; $row['title'] = htmlspecialchars($row['title']); $row['logurl'] = Url::log(intval($row['gid'])); $cover_img = $row['filepath']; ?> <a href="<?php echo $row['logurl']; ?> " target="_blank"><img width="<?php echo $w; ?> " height="<?php echo $h; ?> " src="<?php echo $row['filepath']; ?> " alt="<?php echo $row['title']; ?> " /></a> <?php } }
/** * 初始化数据库连接 */ public function inintLink() { require './MySql.class.php'; $params = array('host' => '127.0.0.1', 'port' => '3306', 'user' => 'root', 'pass' => 'root', 'charset' => 'utf8', 'dbname' => 'match'); $this->db = MySql::getInstance(array('dbname' => 'match')); }
/** * @des 获取指定logid的附图 方法体内部自动实现查询、缓存 提升系统执行效率 * @des 注意:本方法额外添加了一个logimageatt缓存字段 方法体外部不宜调用该字段 * CACHE structure:: * array{ * log_id => array('url'=>log_att_image_url,'time'=>unixtimestamp); * } * @param $logid 日志id * @return string => log attachement image url(include blog_url) */ function getLogImageAtt($logid) { global $CACHE; /*缓存文件不存在,建立空值缓存文件先*/ if (!is_file(EMLOG_ROOT . '/content/cache/logimageatt.php')) { $CACHE->cacheWrite(serialize(array(0 => array('url' => TEMPLATE_URL . 'images/noImg.png', 'time' => time()))), 'logimageatt'); } $logImageAtt = $CACHE->readCache('logimageatt'); if (!empty($logImageAtt) && !empty($logImageAtt[$logid])) { //12小时候重建缓存以处理可能要替换文章附图的情况 默认不重建 if (_g('up_cache')) { if ($logImageAtt[$logid]['time'] + 12 * 3600 > time()) { return $logImageAtt[$logid]['url']; } } else { return $logImageAtt[$logid]['url']; } } //缓存中不存在 建立缓存并返回数据 $Db = MySql::getInstance(); $query = $Db->query("SELECT * FROM " . DB_PREFIX . "attachment WHERE `blogid`=" . $logid . " ORDER BY `aid` DESC"); $_attcache = TEMPLATE_URL . 'images/noImg.png'; //待裁剪图片数据 优先使用已有220px*150px的附图 $_imageArr = array('rdir' => '', 'cdir' => '', 'width' => 0, 'height' => 0); while ($row = $Db->fetch_array($query)) { if ($row['width'] == 220 && $row['height'] == 150) { $_attcache = BLOG_URL . ltrim(ltrim($row['filepath'], '.'), '/'); break; } $fileAbsoluteDir = '.' . ltrim($row['filepath'], '.'); //图片目录相对于入口文件的路径 $suffix = strtolower(getFileSuffix($row['filepath'])); /*兼容老系统产生的无宽度、高度的图片尺寸*/ if (is_file($fileAbsoluteDir) && in_array($suffix, array('jpg', 'png', 'jpeg', 'gif')) && $row['width'] == 0 && $row['height'] == 0) { $size = @getimagesize($fileAbsoluteDir); //读取图片尺寸情况 //方法getimagesize存在异常 返回false和错误信息 抑制并退出 if (false === $size) { break; } if ($size[0] == 220 && $size[1] == 150) { $_attcache = BLOG_URL . ltrim(ltrim($row['filepath'], '.'), '/'); break; } else { $row['width'] = $size[0]; $row['height'] = $size[1]; } } //缩略图相对路径 强行指定缩略图为jpg后缀格式 $fileCorpDir = '.' . ltrim(pathinfo($fileAbsoluteDir, PATHINFO_DIRNAME), '.') . '/' . $logid . '.jpg'; //依据设置参数进行是否强行重建 if (is_file($fileCorpDir) && !_g('up_cache')) { $_attcache = BLOG_URL . ltrim(ltrim($fileCorpDir, '.'), '/'); break; } //收集尺寸最大的图片进行裁剪 if ($row['width'] > 220 && $row['height'] > 150) { if (is_file($fileAbsoluteDir) && ($row['width'] > $_imageArr['width'] || $row['height'] > $_imageArr['height'])) { $_imageArr = array('rdir' => $fileAbsoluteDir, 'cdir' => $fileCorpDir, 'width' => $row['width'], 'height' => $row['height']); } } } //附图需要进行裁剪 if ($_attcache == TEMPLATE_URL . 'images/noImg.png' && $_imageArr['width'] > 0) { $ret = JcorpImage($_imageArr['rdir'], $_imageArr['cdir'], $_imageArr['width'], $_imageArr['height']); if ($ret) { $_attcache = BLOG_URL . ltrim(ltrim($_imageArr['cdir'], '.'), '/'); } } //是否启用随机默认附图 if ($_attcache == TEMPLATE_URL . 'images/noImg.png' && _g('open_rdm')) { $randomeImage = list_dir_file(EMLOG_ROOT . '/content/templates/J2/images/randoms/'); $max = count($randomeImage) - 1; $rdmKey = rand(0, $max); $_attcache = $randomeImage[$rdmKey]; } //添加新单元数据 $logImageAtt[$logid] = array('url' => $_attcache, 'time' => time()); $CACHE->cacheWrite(serialize($logImageAtt), 'logimageatt'); return $_attcache; }
function widget_hotlog($title) { $index_hotlognum = Option::get('index_hotlognum'); if ($title == "by_miem") { ?> <ul class="tab-panel tab-con2"> <?php $db = MySql::getInstance(); $db = MySql::getInstance(); $time = time(); $sql = $db->query("SELECT * FROM " . DB_PREFIX . "blog inner join " . DB_PREFIX . "sort WHERE hide='n' AND type='blog' AND date > {$time} - 30*24*60*60 AND top='n' AND sortid=sid order by `views` DESC limit 0,{$index_hotlognum}"); while ($row = $db->fetch_array($sql)) { $logpost = !empty($row['excerpt']) ? $row['excerpt'] : '' . $row['content'] . ''; if (!empty($row['excerpt'])) { preg_match_all("/\\<img.*?src\\=\"(.*?)\"[^>]*>/i", $row['excerpt'], $match); if (empty($match[1][0])) { preg_match_all("/\\<img.*?src\\=\"(.*?)\"[^>]*>/i", $row['content'], $match); } } else { preg_match_all("/\\<img.*?src\\=\"(.*?)\"[^>]*>/i", $row['content'], $match); } $img = isset($match[0][0]) ? $match[0][0] : '<img src="图片地址" />'; //无图片时显示 $date = gmdate('Y-m-d', $row['date']); $content = strip_tags($logpost, ''); $content = mb_substr($content, 0, 100, 'utf-8'); //摘要字数修改本代码中的100这个即可 $comment = $row['comnum'] != 0 ? '' . $row['comnum'] . '' : '0'; $gid = $row['gid']; ?> <li> <div class="content"> <p class="entry-meta"><?php echo $date; ?> <span class="space">•</span> <?php echo $row['views']; ?> Views</p> <h4 class="entry-title"><a rel="bookmark" href="<?php echo Url::log($row['gid']); ?> " title="<?php echo $row['title']; ?> " target="_blank"><?php echo $row['title']; ?> </a></h4> </div> </li> <?php } ?> </ul> <?php } else { } }
<?php /** * emlog密码重置工具 * @copyright (c) Emlog All Rights Reserved */ define('EMLOG_ROOT', dirname(__FILE__)); define('DEL_INSTALLER', 0); require_once EMLOG_ROOT . '/config.php'; require_once EMLOG_ROOT . '/include/lib/function.base.php'; header('Content-Type: text/html; charset=UTF-8'); doStripslashes(); $act = isset($_GET['action']) ? $_GET['action'] : ''; $DB = MySql::getInstance(); $CACHE = Cache::getInstance(); $sql = "SELECT username FROM " . DB_PREFIX . "user WHERE uid=1"; $row = $DB->once_fetch_array($sql); $user_name = $row['username'] ? $row['username'] : ''; if (!$act) { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <style type="text/css"> <!-- body {background-color:#F7F7F7;font-family: Arial;font-size: 14px;line-height:150%;} .main {background-color:#FFFFFF;font-size: 14px;color: #666666;width:750px;margin:30px auto;padding:10px;list-style:none;border:#DFDFDF 1px solid; border-radius: 4px;} .title{text-align:center; font-size: 14px;} .input {border: 1px solid #CCCCCC;font-family: Arial;font-size: 14px;height:20px; width: 150px;background-color:#F7F7F7;color: #666666;} .submit{cursor: pointer;font-size: 12px;padding: 4px 10px;}
function plugin_setting_view() { $DB = MySql::getInstance(); ?> <div class="containertitle2"> <a class="navi<?php echo isset($_GET['advance']) ? 1 : 3; ?> " href="./plugin.php?plugin=anti_spam_comment">基本设置</a> <a class="navi<?php echo isset($_GET['advance']) ? 2 : 4; ?> " href="./plugin.php?plugin=anti_spam_comment&advance=true">高级选项</a> <?php if (isset($_GET['setting'])) { ?> <span class="actived">插件设置完成</span><?php } if (isset($_GET['error'])) { ?> <span class="actived">插件设置失败</span><?php } ?> </div> <?php if (isset($_GET['advance'])) { $act = isset($_GET['act']) ? trim($_GET['act']) : ''; if ($act) { global $CACHE; switch ($act) { case 'shieldname': $id = isset($_GET['id']) ? intval($_GET['id']) : ''; //$DB->query("UPDATE ".DB_PREFIX."comment SET poster='该昵称已屏蔽' WHERE cid={$id}"); $DB->query("UPDATE " . DB_PREFIX . "comment SET comment='该评论已屏蔽',poster='该昵称已屏蔽' WHERE cid={$id}"); $CACHE->updateCache(array('sta', 'comment')); header("Location: ./plugin.php?plugin=anti_spam_comment&advance=true&setting=true"); break; case 'delurl': $id = isset($_GET['id']) ? intval($_GET['id']) : ''; $DB->query("UPDATE " . DB_PREFIX . "comment SET url='' WHERE cid={$id}"); $CACHE->updateCache(array('sta', 'comment')); header("Location: ./plugin.php?plugin=anti_spam_comment&advance=true&setting=true"); break; case 'admin_all_coms': $operate = isset($_POST['operate']) ? $_POST['operate'] : ''; $comments = isset($_POST['com']) ? array_map('intval', $_POST['com']) : array(); $commentsId = '(' . implode(',', $comments) . ')'; switch ($operate) { case 'shieldname': $DB->query("UPDATE " . DB_PREFIX . "comment SET comment='该评论已屏蔽',poster='该昵称已屏蔽' WHERE cid IN{$commentsId}"); $CACHE->updateCache(array('sta', 'comment')); header("Location: ./plugin.php?plugin=anti_spam_comment&advance=true&setting=true"); break; case 'delurl': $DB->query("UPDATE " . DB_PREFIX . "comment SET url='' WHERE cid IN{$commentsId}"); $CACHE->updateCache(array('sta', 'comment')); header("Location: ./plugin.php?plugin=anti_spam_comment&advance=true&setting=true"); break; } break; case 'save': $comname = isset($_POST['comname']) ? addslashes(trim($_POST['comname'])) : ''; $comment = isset($_POST['comment']) ? addslashes(trim($_POST['comment'])) : ''; $commail = isset($_POST['commail']) ? addslashes(trim($_POST['commail'])) : ''; $comurl = isset($_POST['comurl']) ? addslashes(trim($_POST['comurl'])) : ''; if ($comurl && strncasecmp($comurl, 'http://', 7)) { $comurl = 'http://' . $comurl; } $cid = isset($_POST['cid']) ? intval($_POST['cid']) : ''; $DB->query("UPDATE " . DB_PREFIX . "comment SET poster='{$comname}',comment='{$comment}',mail='{$commail}',url='{$comurl}' WHERE cid={$cid}"); $CACHE->updateCache(array('sta', 'comment')); header("Location: ./plugin.php?plugin=anti_spam_comment&advance=true&setting=true"); break; case 'edit': $Comment_Model = new Comment_Model(); $cid = isset($_GET['cid']) ? intval($_GET['cid']) : ''; extract($Comment_Model->getOneComment($cid)); ?> <form action="./plugin.php?plugin=anti_spam_comment&advance=true&act=save" method="post"> <div> <li>昵称</li> <li><input size="40" value="<?php echo $poster; ?> " name="comname" /></li> <li>邮箱</li> <li><input size="40" value="<?php echo $mail; ?> " name="commail" /></li> <li>地址</li> <li><input size="40" value="<?php echo $url; ?> " name="comurl" /></li> <li>内容</li> <li><textarea name="comment" rows="3" cols="45"><?php echo $comment; ?> </textarea></li> <li> <input type="hidden" value="<?php echo $cid; ?> " name="cid" /> <input type="submit" value="保 存" class="submit" /> <input type="button" value="取 消" class="submit" onclick="javascript: window.history.back();" /></li> </div> </form> <?php break; } } else { $blogid = isset($_GET['gid']) ? intval($_GET['gid']) : null; $hide = isset($_GET['hide']) ? addslashes($_GET['hide']) : ''; $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $ip = isset($_GET['ip']) ? addslashes($_GET['ip']) : ''; $poster = isset($_GET['poster']) ? addslashes($_GET['poster']) : ''; $addUrl_1 = $addUrl_2 = $addUrl_3 = $addUrl_4 = ''; if ($blogid) { $addUrl_1 = "gid={$blogid}&"; $blogid = "AND a.gid={$blogid}"; } if ($hide) { $addUrl_2 = "hide={$hide}&"; $hide = "AND a.hide='{$hide}'"; } if ($ip) { $addUrl_3 = "ip={$ip}&"; $ip = "AND a.ip='{$ip}'"; } if ($poster) { $addUrl_4 = "poster={$poster}&"; $poster = "AND a.poster='{$poster}'"; } $addUrl = $addUrl_1 . $addUrl_2 . $addUrl_3 . $addUrl_4; $perpage_num = Option::get('admin_perpage_num'); if ($page) { $startId = ($page - 1) * $perpage_num; $limit = " LIMIT {$startId}, " . $perpage_num; } $sql = "SELECT a.cid,a.hide,a.date,a.comment,a.gid,a.poster,a.ip,a.mail,a.url,b.title FROM " . DB_PREFIX . "comment as a, " . DB_PREFIX . "blog as b where 1=1 {$blogid} {$hide} {$ip} {$poster} AND a.gid=b.gid ORDER BY a.cid DESC"; $query = $DB->query($sql); $cmnum = $DB->num_rows($query); $query = $DB->query($sql . $limit); $pageurl = pagination($cmnum, $perpage_num, $page, "./plugin.php?plugin=anti_spam_comment&advance=true&{$addUrl}page="); $sql = "SELECT a.cid,a.hide,a.date,a.comment,a.gid,a.poster,a.ip,a.mail,a.url,b.title FROM " . DB_PREFIX . "comment as a, " . DB_PREFIX . "blog as b where 1=1 {$blogid} AND a.hide='y' {$ip} AND a.gid=b.gid ORDER BY a.cid DESC"; $hideCommNum = $DB->num_rows($DB->query($sql)); if ($hideCommNum > 0) { $hide_ = $hide_y = $hide_n = ''; $a = "hide_{$hide}"; ${$a} = "class=\"filter\""; ?> <div class="filters"> <span <?php echo $hide_; ?> ><a href="./plugin.php?plugin=anti_spam_comment&advance=true&<?php echo $addUrl_1 . $addUrl_3; ?> ">全部</a></span> <span <?php echo $hide_y; ?> ><a href="./plugin.php?plugin=anti_spam_comment&advance=true&hide=y&<?php echo $addUrl_1 . $addUrl_3; ?> ">待审 <?php $hidecmnum = ROLE == 'admin' ? $sta_cache['hidecomnum'] : $sta_cache[UID]['hidecommentnum']; if ($hidecmnum > 0) { echo '(' . $hidecmnum . ')'; } ?> </a></span> <span <?php echo $hide_n; ?> ><a href="./plugin.php?plugin=anti_spam_comment&advance=true&hide=n&<?php echo $addUrl_1 . $addUrl_3; ?> ">已审</a></span> </div> <?php } elseif ($addUrl) { ?> <div class="filters"> <span><a href="./plugin.php?plugin=anti_spam_comment&advance=true">全部</a></span> </div> <?php } ?> <form action="./plugin.php?plugin=anti_spam_comment&advance=true&act=admin_all_coms" method="post" name="form_com" id="form_com"> <table width="100%" id="adm_comment_list" class="item_list"> <thead> <tr> <th width="19"><input onclick="CheckAll(this.form)" type="checkbox" value="on" name="chkall" /></th> <th width="350"><b>内容</b></th> <th width="300"><b>评论者</b></th> <th width="250"><b>所属日志</b></th> </tr> </thead> <tbody> <?php while ($res = $DB->fetch_array($query)) { $ishide = $res['hide'] == 'y' ? '<font color="red">[待审]</font>' : ''; $mail = !empty($res['mail']) ? "({$res['mail']})" : ''; $ip = !empty($res['ip']) ? "<br />IP:<a href=\"./plugin.php?plugin=anti_spam_comment&advance=true&ip={$res['ip']}\">{$res['ip']}</a>" : ''; $url = !empty($res['url']) ? "({$res['url']})" : ''; $res['content'] = str_replace('<br>', ' ', $res['comment']); $sub_content = subString($res['content'], 0, 50); $res['title'] = subString($res['title'], 0, 42); ?> <tr> <td><input type="checkbox" value="<?php echo $res['cid']; ?> " name="com[]" class="ids" /></td> <td><a href="./plugin.php?plugin=anti_spam_comment&advance=true&act=edit&cid=<?php echo $res['cid']; ?> "><?php echo htmlspecialchars($sub_content); ?> </a> <?php echo $ishide; ?> <br /><?php echo smartDate($res['date']); ?> <span style="display:none; margin-left:8px;"> <a href="javascript: asc_confirm(<?php echo $res['cid']; ?> , 'name');">屏蔽内容</a> <a href="javascript: asc_confirm(<?php echo $res['cid']; ?> , 'url');">删除地址</a> </span> </td> <td><a href="./plugin.php?plugin=anti_spam_comment&advance=true&poster=<?php echo urlencode($res['poster']); ?> "><?php echo htmlspecialchars($res['poster']); ?> </a> <?php echo $url; ?> <?php echo $ip; ?> <?php echo $mail; ?> </td> <td><a href="./plugin.php?plugin=anti_spam_comment&advance=true&gid=<?php echo $res['gid']; ?> "><?php echo $res['title']; ?> </a></td> </tr> <?php } ?> </tbody> </table> <div class="list_footer"> 选中项: <a href="javascript:asc_commentact('shieldname');">屏蔽内容</a> <a href="javascript:asc_commentact('delurl');">删除地址</a> <input name="operate" id="operate" res="" type="hidden" /> </div> <div class="page"><?php echo $pageurl; ?> (有<?php echo $cmnum; ?> 条评论)</div> </form> <script> $(document).ready(function(){ $("#adm_comment_list tbody tr:odd").addClass("tralt_b"); $("#adm_comment_list tbody tr") .mouseover(function(){$(this).addClass("trover");$(this).find("span").show();}) .mouseout(function(){$(this).removeClass("trover");$(this).find("span").hide();}) }); setTimeout(hideActived,2600); function asc_commentact(act){ if (getChecked('ids') == false) { alert('请选择要操作的评论'); return; } if(act == 'shieldname' && !confirm('你确定要屏蔽所选评论的内容吗?')){return;} if(act == 'delurl' && !confirm('你确定要删除所选评论的评论人地址吗?')){return;} $("#operate").val(act); $("#form_com").submit(); } function asc_confirm (id, property) { switch (property){ case 'name': var urlreturn="./plugin.php?plugin=anti_spam_comment&advance=true&act=shieldname&id="+id; var msg = "你确定要屏蔽该评论内容?";break; case 'url': var urlreturn="./plugin.php?plugin=anti_spam_comment&advance=true&act=delurl&id="+id; var msg = "你确定要删除该评论人地址吗?";break; } if(confirm(msg)){window.location = urlreturn;}else {return;} } </script> <?php } } else { $data = asc_read(); extract($data); $blacklist = implode("\n", $blacklist); $url_keywords = implode("\n", $url_keywords); $ex1 = $ex2 = ''; $vari = array(array('英文字母abc…ABC…<font color="red">*</font>:', 'asc_letter'), array('数字0-9:', 'asc_digit'), array('英文字符(包括英文字母、数字和其它英文符号)<font color="red">*</font>:', 'asc_char'), array('星号*:', 'asc_star')); if ($auto_blacklist == 1) { $ex1 = 'checked="checked"'; } if ($need_chinese == 1) { $ex2 = 'checked="checked"'; } ?> <form action="plugin.php?plugin=anti_spam_comment&action=setting" method="post"> <table cellspacing="8" cellpadding="4" width="95%" align="center" border="0"> <tbody> <tr nowrap="nowrap"> <td width="33%" align="right">评论时间间隔(秒):</td> <td width="67%"><input size="10" name="time_limit" type="text" value="<?php echo $time_limit; ?> " /></td> </tr> <tr nowrap="nowrap"> <td width="33%" align="right">必须包含汉字:</td> <td width="67%"><input size="10" name="need_chinese" type="checkbox" value="1" <?php echo $ex2; ?> /></td> </tr> <tr nowrap="nowrap"> <td align="right" valign="top">IP黑名单:<br/><br/> 可封IP段,填入IP开头地址,如162.204 </td> <td><textarea name="blacklist" cols="" rows="4" style="width:300px;height:70px;"><?php echo $blacklist; ?> </textarea></td> </tr> <tr nowrap="nowrap"> <td align="right">将频繁尝试发表评论的IP加入黑名单</td> <td><input name="auto_blacklist" type="checkbox" value="1" <?php echo $ex1; ?> /></td> </tr> <tr nowrap="nowrap"> <td align="right">每分钟允许尝试评论次数:</td> <td><input size="10" name="max_attempt" type="text" value="<?php echo $max_attempt; ?> " />(开启自动黑名单有效)</td> </tr> <tr nowrap="nowrap"> <td align="right" valign="top">屏蔽词汇(以 | 分割):<br /> 可以使用通配符*或者系统<a href="#var">内置变量</a> </td> <td><textarea name="keywords" cols="" rows="4" style="width:300px;height:70px;"><?php echo $keywords; ?> </textarea></td> </tr> <tr nowrap="nowrap"> <td align="right" valign="top">屏蔽昵称(以 | 分割):<br /> 可以使用通配符*或者系统<a href="#var">内置变量</a> </td> <td><textarea name="name_keywords" cols="" rows="4" style="width:300px;height:70px;"><?php echo $name_keywords; ?> </textarea></td> </tr> <tr nowrap="nowrap"> <td align="right" valign="top">屏蔽地址(每行一条):<br/> 可以使用通配符*或者系统<a href="#var">内置变量</a> </td> <td><textarea name="url_keywords" cols="" rows="4" style="width:300px;height:70px;"><?php echo $url_keywords; ?> </textarea></td> </tr> <tr> <td align="center" colspan="2"><input type="submit" value="保存设置" class="button" /></td> </tr> </tbody> </table> </form> <b><a name="var"></a>内置变量</b> <table cellspacing="8" cellpadding="4" width="95%" align="center" border="0"> <tbody> <?php foreach ($vari as $value) { ?> <tr nowrap="nowrap"> <td width="40%" align="right"><?php echo $value[0]; ?> </td> <td width="60%"><b><?php echo $value[1]; ?> </b></td> </tr> <?php } ?> <tr> <td align="center" colspan="2"><font color="red">*注</font>:该项仅当评论全文符合时过滤评论(例如关键字填入asc_letter时,仅过滤纯英文评论)</td> </tr> </tbody> </table> <?php } ?> <script> $("#anti_spam_comment").addClass('sidebarsubmenu1'); </script> <?php }
/** * 更新配置选项 * @param $name * @param $value * @param $isSyntax 更新值是否为一个表达式 */ static function updateOption($name, $value, $isSyntax = false) { $DB = MySql::getInstance(); $value = $isSyntax ? $value : "'{$value}'"; $DB->query('UPDATE ' . DB_PREFIX . "options SET option_value={$value} where option_name='{$name}'"); }
public function __construct($table) { $this->table = $table; $this->db = MySql::getInstance(); }
/** * 构造函数 * @param string $plugin_name 插件名 */ private function __construct($plugin_name) { $this->plugin_name = $plugin_name; $this->db_conn = MySql::getInstance(); }