private function Atualizar(Cliente $cliete) { $conexao = new MySql(); $objCliente = new Cliente(); //Seleciona endereço na base $sql = "set @nome='{$cliete->getNome}; \r\n set @cpf='{$cliete->getCpf}';\r\n set @data_nascimento='{$cliete->getDataNasc}()';\r\n set @telefone='{$cliete->getTelefone}()';\r\n set @celular='{$cliete->getCelular}()';\r\n set @email='{$cliete->getEmail}()';\r\n set @cep='{$cliete->getCep}()';\r\n set @endereco='{$cliete->getEndereco}()'; \r\n set @numero='{$cliete->getNumero}()';\r\n set @complemento='{$cliete->getComplemento}()';\r\n set @bairro='{$cliete->getBairro}()';\r\n set @cidade='{$cliete->getCidade}()';\r\n set @uf='{$uf->getUf}()';\r\n call USP_MANTER_CLIENTES(@nome,@cpf,@data_nasc,\r\n @telefone,@celular,@email,@cep,@endereco,@numero,\r\n @complemento,@bairro,@cidade,@uf,NULL,NULL,0);"; $retorno = $conexao->execSP($sql); }
/** * @test */ public function canRemoveEntity() { $expectedConditions = array('id' => 1); $this->storage->expects($this->once())->method('deleteWhere')->with($expectedConditions)->will($this->returnValue(1)); $entity = $this->createEntity(); $entity->setId(1); $this->repository->remove($entity); $this->assertEquals(null, $entity->getId()); }
public function exportContacts() { require_once dirname(__FILE__) . "/mysql.php"; $pDB = new MySql(); $pDB->Query("SELECT `phonebook`.`Name`, `phonebook`.`Phone` FROM `phonebook` ORDER BY `phonebook`.`Name` ASC"); header("Content-Disposition: attachment; filename=\"smsys_" . date("Y-m-d_His") . ".vcf"); header("Content-Type: application/force-download"); while ($arContact = $pDB->FetchAssoc()) { echo "BEGIN:VCARD\nVERSION:2.1\nN:;" . $arContact['Name'] . ";;;\nFN:" . $arContact['Name'] . "\nTEL;CELL;PREF:" . $arContact['Phone'] . "\nEND:VCARD\n"; } $pDB->Log("Export contacts list"); }
public static function initDb() { self::$defaultLink = self::connect(DB_SERVERNAME, DB_USERNAME, DB_PASS); self::select_db(DB_NAME); $sql = 'SET NAMES "utf8"'; self::query($sql); }
/** * 供外界获取实例 * @return MySql */ public static function getIns() { if (self::$ins == false) { self::$ins = new self(); } return self::$ins; }
/** * @desc get mysql instance by using singleton pattern */ public static function getInstance() { if (!isset(self::$_instance) || self::$_instance instanceof self) { self::$_instance = new self(); } return self::$_instance; }
public static function getInstance() { if (FALSE == self::$_instance instanceof self) { self::$_instance = new self(self::$config); } return self::$_instance; }
/** * 静态方法,返回数据库连接实例 */ public static function getInstance() { if (self::$instance == null) { self::$instance = new MySql(); } return self::$instance; }
/** * Get instance returns the currently instantiated object of this DB class. * This forces only one connection to the MySQL server * @return DB object */ public static function Instance() { global $config; if (!self::$instance) { self::$instance = new self($config['database']); } return self::$instance; }
/** * @test */ public function findAllByReturnsCollection() { $params = array('foo' => 'bar'); $resultSet = array(array('name' => 'foo', 'value' => 'bar')); $this->storage->expects($this->once())->method('findAllBy')->with($params)->will($this->returnValue($resultSet)); $entities = $this->repository->findAllBy($params); $this->assertEquals(array($this->createEntity()), $entities); }
static function Get($key = '') { if (count(self::$_settings) == 0) { self::$_settings = MySql::Instance()->QuickArray("SELECT * FROM settings"); } if (self::$_settings[$key] != null) { return self::$_settings[$key]; } return self::$_settings; }
function updateUnicode() { $db = new MySql(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DB); $sql = "SELECT\r\n `id`,\r\n `character`\r\n FROM\r\n `tomoe_character`\r\n WHERE\r\n `unicode` = 0\r\n LIMIT 0,5000;"; $result = $db->query($sql); $num_before = $db->num_rows; if ($num_before > 0) { $usc_4 = 0; foreach ($result as $r) { $usc_4 = utf8ToUnicode($r->character); $sql = " UPDATE\r\n tomoe_character\r\n SET\r\n unicode = {$usc_4['0']}\r\n WHERE id = {$r->id};"; //echo $sql; $db->update($sql); } echo "请刷新页面。" . time(); } else { echo "Unicode字段更新完毕"; } }
/** Get Api Key * @param $login string * @param $password string * @param $coin string * @return bool|mysqli_result */ public static function networkCoins($login, $password, $coin) { $link = MySql::connect(); $resultArray = null; mysqli_query($link, "SET character_set_results = 'utf8'"); $query = sprintf("SELECT coins.%s as apikey FROM coins,users WHERE users.Email='%s' AND users.Password='******'", mysqli_real_escape_string($link, trim($coin)), mysqli_real_escape_string($link, trim($login)), mysqli_real_escape_string($link, trim($password))); $result = mysqli_query($link, $query); $row = mysqli_fetch_array($result); $result = $row['apikey']; return $result; }
public static function getInstance() { switch (Option::DEFAULT_MYSQLCONN) { case 'mysqli': return MySqlii::getInstance(); break; case 'mysql': default: return MySql::getInstance(); break; } }
/** * 获取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; }
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数据库'); } } }
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 getValue() { require "mysql_util.php"; if (isset($operandValue)) { return $operandValue; } $mysqli = MySql::getConnection(); $questionID = trim($operandString, "[]"); $mysql_value = $mysqli->query("SELECT `Response` FROM Questions WHERE `ID` = '{$questionID}'"); if (!$mysql_value) { throw new Exception("There was a MySQL error: {$mysqli->error}"); return false; } $mysql_value = mysqli_fetch_assoc($mysql_value); return $mysql_value['Response']; }
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; }
public function create($objArr) { $cols = []; $vals = []; foreach ($objArr as $col => $val) { $cols[] = $col; if (is_string($val)) { $vals[] = "'" . $val . "'"; } else { $vals[] = $val; } } $cols = implode(',', $cols); $vals = implode(',', $vals); if (!MySql::run("INSERT INTO {$this->table} ({$cols}) VALUES ({$vals})")) { return MySql::getError(); } return false; }
/** * @param $login string * @param $password string */ public static function login($login, $password) { if (MySQL::isUser($login, $password)) { echo "Login is successful"; $table = "users"; $user = MySql::resultArray($login, $password, $table); $user = $user[0]; $_SESSION['login'] = $login; $_SESSION['password'] = $password; $_SESSION['pin'] = $user[3]; $_SESSION['isLoggedIn'] = true; } else { echo "Invalid username or password"; $_SESSION['userId'] = ""; $_SESSION['userLogin'] = ""; $_SESSION['isLoggedIn'] = false; $_SESSION['apiKey'] = ""; } }
function get_jsonconfig($config_name, $file) { $table = str_replace('site', '', $file); $file = CACHE_PATH . "config/{$file}" . CACHE_EXT; $data = Cache::BEGIN_CACHE($file); if (!$data) { $arr = MySql::dbselect('config_name,config_content', "{$table}", "config_name != ''"); for ($i = 0; $i < count($arr); $i++) { $_config_name = $arr[$i][0]; $_config_content = $arr[$i][1]; $data[$_config_name] = $_config_content; } $data = json_encode($data); Cache::END_CACHE($data, $file); } $html = json_decode($data); $rs = $html->{$config_name}; return $rs; }
public static function AddLog($type, $text) { if (!IS_LOGIN) { $arr = 'user'; } else { if ($_SESSION["RK_Support"]) { $arr = 'err'; } else { $userid = $_SESSION["RK_Userid"]; $type = intval($type); $content = RemoveHack($text); $user = MySql::dbselect("username", "user", "id = '{$userid}'"); $username = $user[0][0]; if ($type == '1') { $type = 'Báo lỗi phim'; } else { if ($type == '2') { $type = 'Báo lỗi video'; } else { if ($type == '3') { $type = 'Báo lỗi hệ thống'; } else { if ($type == '4') { $type = 'Yêu cầu chức năng'; } else { if ($type == '5') { $type = 'Lỗi Khác'; } } } } } $title = $type . " | Gửi từ {$username}"; MySql::dbinsert("log", "title,content", "'{$title}','{$content}'"); $_SESSION["RK_Support"] = 1; $arr = 'done'; } } return $arr; }
/** * @param $file * @return null */ public function performSql($file) { if ($sql = file($file)) { $query = ''; foreach ($sql as $line) { $tsl = trim($line); if ($sql != '' && substr($tsl, 0, 2) != "--" && substr($tsl, 0, 1) != '#') { $query .= $line; if (preg_match('/;\\s*$/', $line)) { $query = str_replace("`ac_", "`" . DB_PREFIX, $query); $result = $this->_query($query); if (!$result) { $err = $this->driver->getDBError(); $this->error = $err['error_text']; return null; } $query = ''; } } } } }
/** * 获取文章信息 * * @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; }
public function exportSMS() { require_once dirname(__FILE__) . "/mysql.php"; $pDB = new MySql(); header("Content-Disposition: attachment; filename=\"smsys_" . date("Y-m-d_His") . ".xml"); header("Content-Type: application/force-download"); echo "<?xml version='1.0' encoding='UTF-8'?>\n<channel>\n\t<title>Export :: SMSYS</title>\n\t<pubDate>" . date("D, j M Y G:i:s T") . "</pubDate>\n"; echo "\t<inbox>\n"; $pDB->Query("SELECT * FROM sms_inbox ORDER BY `Date` DESC"); while ($arSMS = $pDB->FetchAssoc()) { echo "\t\t<item>\n\t\t\t<datetime>" . date("Y-m-d H:i:s", strtotime($arSMS['Date'])) . "</datetime>\n\t\t\t<number>" . $arSMS['Sender'] . "</number>\n\t\t\t<content>" . $arSMS['Content'] . "</content>\n\t\t</item>\n"; } echo "\t</inbox>\n"; echo "\t<outbox>\n"; $pDB->Query("SELECT * FROM sms_outbox ORDER BY `Date` DESC"); while ($arSMS = $pDB->FetchAssoc()) { echo "\t\t<item>\n\t\t\t<datetime>" . date("Y-m-d H:i:s", strtotime($arSMS['Date'])) . "</datetime>\n\t\t\t<number>" . $arSMS['Recipient'] . "</number>\n\t\t\t<content>" . $arSMS['Content'] . "</content>\n\t\t</item>\n"; } echo "\t</outbox>\n"; echo "</channel>"; $pDB->Log("Export inbox SMSs"); }
public function __construct($table) { $this->table = $table; $this->db = MySql::getInstance(); }
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 }
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 } }