public static function uninstall() { global $db, $setting, $admin_cat, $mystep; $info = self::info(); $db->delete($setting['db']['pre'] . "admin_cat", array("file", "=", "xcode.php")); $db->delete($setting['db']['pre'] . "plugin", array("idx", "=", $info['idx'])); deleteCache("admin_cat"); deleteCache("plugin"); $err = array(); if ($db->GetError($err)) { showInfo($setting['language']['plugin_err_uninstall'] . "\r\n\t\t\t<br />\r\n\t\t\t<pre>\r\n\t\t\t" . join("\n------------------------\n", $err) . "\r\n\t\t\t</pre>\r\n\t\t\t"); } else { $mydb = $mystep->getInstance("MyDB", "code", dirname(__FILE__)); $record = $mydb->queryAll(); for ($i = 0; $i < count($record); $i++) { unlink(dirname(__FILE__) . "/code/" . $record[$i]['idx'] . ".php"); } $mydb->emptyTBL(); unset($mydb); includeCache("admin_cat"); $admin_cat = toJson($admin_cat, $setting['gen']['charset']); echo <<<mystep <script language="javascript"> parent.admin_cat = {$admin_cat}; parent.setNav(); </script> mystep; buildParaList("plugin"); echo showInfo($setting['language']['plugin_uninstall_done'], false); } }
function ModulePage() { global $PIO; if (!isset($_GET['res'])) { if (!file_exists('./.userrepair') || isset($_GET['force'])) { touch('./.userrepair'); $PIO->dbMaintanence('repair', $PIO->dbMaintanence('repair')); updatelog(); // 重導向到靜態快取 unlink('./.userrepair'); header('HTTP/1.1 302 Moved Temporarily'); header('Location: ' . fullURL() . PHP_SELF2 . '?' . time()); } else { error('已經有其他人在修復中。<p>[<a href="' . $this->SELF . '&force=1">強制執行</a>]</p>'); } } else { if (!file_exists('./.userrepair') || isset($_GET['force'])) { touch('./.userrepair'); $no = intval($_GET['res']); deleteCache(array($no)); unlink('./.userrepair'); header('HTTP/1.1 302 Moved Temporarily'); header('Location: ' . fullURL() . PHP_SELF . '?res=' . $no); } else { error('已經有其他人在修復中。<p>[<a href="' . $this->SELF . '&res=' . $_GET['res'] . '&force=1">強制執行</a>]</p>'); } } }
public static function uninstall() { global $db, $setting, $admin_cat; $info = self::info(); $db->delete($setting['db']['pre'] . "survey"); $db->exec("drop", "table", $setting['db']['pre'] . "survey"); $db->delete($setting['db']['pre'] . "admin_cat", array("file", "like", "survey.php%")); $db->delete($setting['db']['pre'] . "plugin", array("idx", "=", $info['idx'])); deleteCache("admin_cat"); deleteCache("plugin"); $err = array(); if ($db->GetError($err)) { showInfo($setting['language']['plugin_err_uninstall'] . "\r\n\t\t\t<br />\r\n\t\t\t<pre>\r\n\t\t\t" . join("\n------------------------\n", $err) . "\r\n\t\t\t</pre>\r\n\t\t\t"); } else { includeCache("admin_cat"); $admin_cat = toJson($admin_cat, $setting['gen']['charset']); echo <<<mystep <script language="javascript"> parent.admin_cat = {$admin_cat}; parent.setNav(); </script> mystep; MultiDel(ROOT_PATH . "/" . $setting['path']['cache'] . "/plugin/survey/"); MultiDel(dirname(__FILE__) . "/data/"); MakeDir(dirname(__FILE__) . "/data/"); buildParaList("plugin"); echo showInfo($setting['language']['plugin_uninstall_done'], false); } }
public static function uninstall() { global $db, $setting, $admin_cat; $info = self::info(); $db->delete($setting['db']['pre'] . "news_mark"); $db->exec("drop", "table", $setting['db']['pre'] . "news_mark"); $db->delete($setting['db']['pre'] . "admin_cat", array("file", "=", "news_mark.php")); $db->delete($setting['db']['pre'] . "plugin", array("idx", "=", $info['idx'])); deleteCache("admin_cat"); deleteCache("plugin"); $err = array(); if ($db->GetError($err)) { showInfo($setting['language']['plugin_err_uninstall'] . "\r\n\t\t\t<br />\r\n\t\t\t<pre>\r\n\t\t\t" . join("\n------------------------\n", $err) . "\r\n\t\t\t</pre>\r\n\t\t\t"); } else { includeCache("admin_cat"); $admin_cat = toJson($admin_cat, $setting['gen']['charset']); echo <<<mystep <script language="javascript"> parent.admin_cat = {$admin_cat}; parent.setNav(); </script> mystep; buildParaList("plugin"); echo showInfo($setting['language']['plugin_uninstall_done'], false); } }
function snatchGetInfo($url, $para = array()) { global $db, $setting; $date = isset($para['date']) ? $para['date'] : date("Ymd"); $url = "http://news.sohu.com/_scroll_newslist/" . $date . "/news.inc"; $info = array(); $info['page_count'] = 1; $header = array(); if (isset($para['header'])) { $header = $para['header']; } $info['header'] = $header; if ($content = GetRemoteContent($url, $header)) { $content = preg_replace("/^.+?(\\{.+\\}).*\$/", '\\1', $content); $content = json_decode_js($content, true); $info['catList'] = $content['category']; $info['newList'] = $content['item']; unset($content); $info['cat_main'] = $db->result($setting['db']['pre'] . "news_cat", "cat_id", array("cat_name", "=", "新闻资讯")); if (empty($info['cat_main'])) { $db->insert($setting['db']['pre'] . "news_cat", array(0, $para['web_id'], 0, '新闻资讯', '国内,国际,社会,财经,军事,体育,娱乐,文化,汽车', '国内资讯,国际资讯,社会资讯,财经资讯,军事资讯,体育资讯,娱乐资讯,文化资讯,汽车资讯', 'news', '', '', 1, 0, '', 1, 255, 0, '')); $info['cat_main'] = $db->GetInsertId(); } for ($i = 0, $m = count($info['catList']); $i < $m; $i++) { $info['catList'][$i][0] = chg_charset($info['catList'][$i][0], "utf-8", $setting['gen']['charset']); $cat_id = $db->result($setting['db']['pre'] . "news_cat", "cat_id", array("cat_name", "=", $info['catList'][$i][0])); if (empty($cat_id)) { $keyword = ""; $descripiton = ""; if ($content = GetRemoteContent($info['catList'][$i][1], $header)) { if (preg_match("/<meta name=\"keywords\" content=\"(.+?)\">/i", $content, $matches)) { $keyword = str_replace(" ", ",", $matches[1]); unset($matches); } if (preg_match("/<meta name=\"description\" content=\"(.+?)\">/i", $content, $matches)) { $descripiton = str_replace(" ", ",", $matches[1]); unset($matches); } } $db->insert($setting['db']['pre'] . "news_cat", array(0, $para['web_id'], $info['cat_main'], $info['catList'][$i][0], $keyword, $descripiton, $info['catList'][$i][0], '', '', 1, 0, '', 2, 255, 0, '')); $cat_id = $db->GetInsertId(); } $info['catList'][$i][] = $cat_id; } deleteCache("news_cat"); for ($i = 0, $m = count($info['newList']); $i < $m; $i++) { $info['newList'][$i][1] = chg_charset($info['newList'][$i][1], "utf-8", $setting['gen']['charset']); $info['newList'][$i][] = $info['catList'][$info['newList'][$i][0]][2]; } } else { return false; } return $info; }
public static function uninstall() { global $db, $setting, $admin_cat; $info = self::info(); $db->select($setting['db']['pre'] . "custom_form", "mid"); $sql_list = array(); while ($record = $db->GetRS()) { $sql_list[] = "truncate table " . $setting['db']['pre'] . "custom_form_" . $record['mid']; $sql_list[] = "drop table " . $setting['db']['pre'] . "custom_form_" . $record['mid']; unlink(dirname(__FILE__) . "/setting/{$record['mid']}_cf_submit_cn.tpl"); unlink(dirname(__FILE__) . "/setting/{$record['mid']}_cf_submit_en.tpl"); unlink(dirname(__FILE__) . "/setting/{$record['mid']}_cf_list_cn.tpl"); unlink(dirname(__FILE__) . "/setting/{$record['mid']}_cf_list_en.tpl"); unlink(dirname(__FILE__) . "/setting/{$record['mid']}_block_cf_list_cn.tpl"); unlink(dirname(__FILE__) . "/setting/{$record['mid']}_block_cf_list_en.tpl"); unlink(dirname(__FILE__) . "/setting/{$record['mid']}_mail_cn.tpl"); unlink(dirname(__FILE__) . "/setting/{$record['mid']}_mail_en.tpl"); unlink(dirname(__FILE__) . "/setting/{$record['mid']}_edit_data.tpl"); unlink(dirname(__FILE__) . "/setting/{$record['mid']}_list_data.tpl"); unlink(dirname(__FILE__) . "/setting/{$record['mid']}_ext_script.php"); unlink(dirname(__FILE__) . "/setting/{$record['mid']}.php"); } $db->Free(); $db->BatchExec($sql_list); include "config.php"; if (isset($catid) && $catid != 0) { $db->delete($setting['db']['pre'] . "admin_cat", array("pid", "n=", $catid)); } $db->delete($setting['db']['pre'] . "custom_form"); $db->exec("drop", "table", $setting['db']['pre'] . "custom_form"); $db->delete($setting['db']['pre'] . "admin_cat", array("file", "like", "custom_form.php")); $db->delete($setting['db']['pre'] . "plugin", array("idx", "=", $info['idx'])); deleteCache("admin_cat"); deleteCache("plugin"); $err = array(); if ($db->GetError($err)) { showInfo($setting['language']['plugin_err_uninstall'] . "\r\n\t\t\t<br />\r\n\t\t\t<pre>\r\n\t\t\t" . join("\n------------------------\n", $err) . "\r\n\t\t\t</pre>\r\n\t\t\t"); } else { includeCache("admin_cat"); $admin_cat = toJson($admin_cat, $setting['gen']['charset']); echo <<<mystep <script language="javascript"> parent.admin_cat = {$admin_cat}; parent.setNav(); </script> mystep; buildParaList("plugin"); WriteFile(dirname(__FILE__) . "/config.php", '<?php $catid = 0; ?>', "wb"); echo showInfo($setting['language']['plugin_uninstall_done'], false); } }
public static function uninstall() { global $db, $setting, $admin_cat; $info = self::info(); $db->delete($setting['db']['pre'] . "plugin", array("idx", "=", $info['idx'])); deleteCache("plugin"); $err = array(); if ($db->GetError($err)) { showInfo($setting['language']['plugin_err_uninstall'] . "\r\n\t\t\t<br />\r\n\t\t\t<pre>\r\n\t\t\t" . join("\n------------------------\n", $err) . "\r\n\t\t\t</pre>\r\n\t\t\t"); } else { buildParaList("plugin"); echo showInfo($setting['language']['plugin_uninstall_done'], false); } }
public function update() { $name = $this->getActionName(); $model = D($name); if (false === ($data = $model->create())) { $this->error($model->getError()); } // 更新数据 $list = $model->save(); $id = $data[$model->getPk()]; if (false !== $list) { vendor("common"); $share_id = $model->where("goods_id = '{$id}'")->getField('share_id'); deleteCache('share/' . getDirsById($share_id) . '/imgs'); deleteCache('share/' . getDirsById($share_id) . '/detail'); $this->saveLog(1, $id); //$this->assign ( 'jumpUrl', Cookie::get ( '_currentUrl_' ) ); $this->success(L('EDIT_SUCCESS')); } else { //错误提示 $this->saveLog(0, $id); $this->error(L('EDIT_ERROR')); } }
$format_org = $_POST['format_org']; unset($_POST['idx_org'], $_POST['format_org']); $log_info = $method == "add_ok" ? $setting['language']['admin_user_power_add'] : $setting['language']['admin_user_power_edit']; $db->replace($setting['db']['pre'] . "user_power", $_POST); if ($method == "add_ok") { $db->exec("alter", "table", $setting['db']['pre'] . "user_type", "add", "`" . $_POST['idx'] . "` " . $theFormat); $db->update($setting['db']['pre'] . "user_type", array($_POST['idx'] => $_POST['value'])); } else { if ($idx_org != $_POST['idx']) { $db->Query("alter", "table", $setting['db']['pre'] . "user_type", "change", "`" . $idx_org . "` `" . $_POST['idx'] . "` " . $theFormat); } elseif ($format_org != $_POST['format']) { $db->Query("alter", "table", $setting['db']['pre'] . "user_type", "modify", "`" . $_POST['idx'] . "` " . $theFormat); } } deleteCache("user_type"); deleteCache("user_power"); } break; default: build_page("list"); } if (!empty($log_info)) { write_log($log_info, "power_id=" . $power_id); $goto_url = $setting['info']['self']; } $mystep->pageEnd(false); function build_page($method) { global $mystep, $req, $db, $tpl, $power_id, $tpl_info, $setting; $tpl_info['idx'] = "user_power_" . ($method == "list" ? "list" : "input"); $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
function admindel() { $PIO = PMCLibrary::getPIOInstance(); $FileIO = PMCLibrary::getFileIOInstance(); $PMS = PMCLibrary::getPMSInstance(); $pass = isset($_POST['pass']) ? $_POST['pass'] : ''; // 管理者密碼 $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 0; // 切換頁數 $onlyimgdel = isset($_POST['onlyimgdel']) ? $_POST['onlyimgdel'] : ''; // 只刪圖 $modFunc = ''; $delno = $thsno = array(); $delflag = isset($_POST['func']) && $_POST['func'] == 'delete' && isset($_POST['clist']); // 是否有「刪除」勾選 $thsflag = isset($_POST['stop']); // 是否有「停止」勾選 $is_modified = false; // 是否改寫檔案 $message = ''; // 操作後顯示訊息 if (isset($_POST['func']) && isset($_POST['clist'])) { $PMS->useModuleMethods('AdminFunction', array('run', &$_POST['clist'], $_POST['func'], &$message)); } // "AdminFunction" Hook Point // 刪除文章區塊 if ($delflag) { $delno = array_merge($delno, $_POST['clist']); if ($onlyimgdel != 'on') { $PMS->useModuleMethods('PostOnDeletion', array($delno, 'backend')); } // "PostOnDeletion" Hook Point $files = $onlyimgdel != 'on' ? $PIO->removePosts($delno) : $PIO->removeAttachments($delno); $FileIO->updateStorageSize(-$FileIO->deleteImage($files)); deleteCache($delno); $is_modified = true; } // 討論串停止區塊 if ($thsflag) { $thsno = array_merge($thsno, $_POST['stop']); $threads = $PIO->fetchPosts($thsno); // 取得文章 foreach ($threads as $th) { $flgh = $PIO->getPostStatus($th['status']); $flgh->toggle('TS'); $PIO->setPostStatus($th['no'], $flgh->toString()); } $is_modified = true; } if (($delflag || $thsflag) && $is_modified) { $PIO->dbCommit(); } // 無論如何都有檔案操作,回寫檔案 $line = $PIO->fetchPostList(0, $page * ADMIN_PAGE_DEF, ADMIN_PAGE_DEF); // 分頁過的文章列表 $posts_count = count($line); // 迴圈次數 $posts = $PIO->fetchPosts($line); // 文章內容陣列 echo '<input type="hidden" name="mode" value="admin" /> <input type="hidden" name="admin" value="del" /> <div style="text-align: left;">' . _T('admin_notices') . '</div> <div>' . $message . '</div> <style type="text/css" scoped="scoped"> .html5Table {border-collapse:collapse; border-spacing: 1; margin: 0px auto;} .html5Table TD {border:2px solid gray } </style> <table class="html5Table" > <tr style="background-color: #6080f6;">' . _T('admin_list_header') . '</tr> '; for ($j = 0; $j < $posts_count; $j++) { $bg = $j % 2 ? 'ListRow1_bg' : 'ListRow2_bg'; // 背景顏色 extract($posts[$j]); // 修改欄位樣式 $now = preg_replace('/.{2}\\/(.{5})\\(.+?\\)(.{5}).*/', '$1 $2', $now); $name = htmlspecialchars(str_cut(html_entity_decode(strip_tags($name)), 8)); $sub = htmlspecialchars(str_cut(html_entity_decode($sub), 8)); if ($email) { $name = "<a href=\"mailto:{$email}\">{$name}</a>"; } $com = str_replace('<br />', ' ', $com); $com = htmlspecialchars(str_cut(html_entity_decode($com), 20)); // 討論串首篇停止勾選框 及 模組功能 $modFunc = $THstop = ' '; $PMS->useModuleMethods('AdminList', array(&$modFunc, $posts[$j], $resto)); // "AdminList" Hook Point if ($resto == 0) { // $resto = 0 (即討論串首篇) $flgh = $PIO->getPostStatus($status); $THstop = '<input type="checkbox" name="stop[]" value="' . $no . '" />' . ($flgh->exists('TS') ? _T('admin_stop_btn') : ''); } // 從記錄抽出附加圖檔使用量並生成連結 if ($ext && $FileIO->imageExists($tim . $ext)) { $clip = '<a href="' . $FileIO->getImageURL($tim . $ext) . '" target="_blank">' . $tim . $ext . '</a>'; $size = $FileIO->getImageFilesize($tim . $ext); $thumbName = $FileIO->resolveThumbName($tim); if ($thumbName != false) { $size += $FileIO->getImageFilesize($thumbName); } } else { $clip = $md5chksum = '--'; $size = 0; } // 印出介面 echo <<<_ADMINEOF_ <tr class="{$bg}" align="left"> <th style="text-align:center">{$modFunc}</th><th style="text-align:center">{$THstop}</th><th><input type="checkbox" name="clist[]" value="{$no}" />{$no}</th><td><small>{$now}</small></td><td>{$sub}</td><td><b>{$name}</b></td><td><small>{$com}</small></td><td>{$host}</td><td style="text-align:center">{$clip} ({$size})<br />{$md5chksum}</td> </tr> _ADMINEOF_; } echo '</table> <p> <select name="func"><option value="delete">' . _T('admin_delete') . '</option>'; $funclist = array(); $dummy = ''; $PMS->useModuleMethods('AdminFunction', array('add', &$funclist, null, &$dummy)); // "AdminFunction" Hook Point foreach ($funclist as $f) { echo '<option value="' . $f[0] . '">' . $f[1] . '</option>'; } echo '</select> <input type="submit" value="' . _T('admin_submit_btn') . '" /> <input type="reset" value="' . _T('admin_reset_btn') . '" /> [<input type="checkbox" name="onlyimgdel" id="onlyimgdel" value="on" /><label for="onlyimgdel">' . _T('del_img_only') . '</label>]</p> <p>' . _T('admin_totalsize', $FileIO->getCurrentStorageSize()) . '</p> </div> </form> <hr /> '; $countline = $PIO->postCount(); // 總文章數 $page_max = ceil($countline / ADMIN_PAGE_DEF) - 1; // 總頁數 echo '<style type="text/css" scoped="scoped"> .html5Table {border-collapse:collapse; border-spacing: 1; margin: 0px auto; text-align: left;} .html5Table TD {border:2px solid gray } </style> <table class="html5Table" ><tr>'; if ($page) { echo '<td><a href="' . PHP_SELF . '?mode=admin&admin=del&page=' . ($page - 1) . '">' . _T('prev_page') . '</a></td>'; } else { echo '<td style="white-space: nowrap;">' . _T('first_page') . '</td>'; } echo '<td>'; for ($i = 0; $i <= $page_max; $i++) { if ($i == $page) { echo '[<b>' . $i . '</b>] '; } else { echo '[<a href="' . PHP_SELF . '?mode=admin&admin=del&page=' . $i . '">' . $i . '</a>] '; } } echo '</td>'; if ($page < $page_max) { echo '<td><a href="' . PHP_SELF . '?mode=admin&admin=del&page=' . ($page + 1) . '">' . _T('next_page') . '</a></td>'; } else { echo '<td style="white-space: nowrap;">' . _T('last_page') . '</td>'; } die('</tr></table><br/><br/> </body> </html>'); }
public function updateTopicCache($tid) { $key = 'topic/thread/' . getDirsById($tid) . '/detail'; deleteCache($key); }
public function deleteShareIds($uid) { deleteCache('user/' . getDirsById($uid) . '/shares'); }
public function ModulePage() { $PIO = PMCLibrary::getPIOInstance(); if (!isset($_GET['no'])) { die('[Error] not enough parameter.'); } if (isset($_GET['action'])) { if (adminAuthenticate('check')) { $pushcount = ''; $puststart = 0; $post = $PIO->fetchPosts($_GET['no']); if (!count($post)) { die('[Error] Post does not exist.'); } // 被推之文章不存在 extract($post[0]); if ($status != '') { $f = $PIO->getPostStatus($status); $pushcount = $f->value('mppCnt'); // 被推次數 } if (($puststart = strpos($com, $this->PUSHPOST_SEPARATOR . '<br />')) === false) { die('[Error] No pushpost.'); } $ocom = substr($com, 0, $puststart); $pushpost = explode('<br />', substr($com, $puststart + strlen($this->PUSHPOST_SEPARATOR . '<br />'))); $com = $ocom; if ($_GET['action'] == 'del') { // list $p_count = 1; $com .= '<div class="pushpost">'; foreach ($pushpost as $p) { $com .= '<input type="checkbox" name="' . $p_count++ . '" value="delete" />' . $p . '<br />'; } $com .= '</div>'; $dat = ''; head($dat); $dat .= '<div class="bar_reply">' . $this->_T('deletepush') . '</div>'; $dat .= '<form action="' . $this->getModulePageURL(array('action' => 'delpush', 'no' => $_GET['no'])) . '" method="post">'; $dat .= PMCLibrary::getPTEInstance()->ParseBlock('SEARCHRESULT', array('{$NO}' => $no, '{$SUB}' => $sub, '{$NAME}' => $name, '{$NOW}' => $now, '{$COM}' => $com, '{$CATEGORY}' => $category, '{$NAME_TEXT}' => _T('post_name'), '{$CATEGORY_TEXT}' => _T('post_category'))); echo $dat, '<input type="submit" value="' . _T('del_btn') . '" /></form></body></html>'; return; } else { if ($_GET['action'] == 'delpush') { // delete $delno = array(); reset($_POST); while ($item = each($_POST)) { if ($item[1] == 'delete' && $item[0] != 'func') { array_push($delno, $item[0]); } } if (count($delno)) { foreach ($delno as $d) { if (isset($pushpost[$d - 1])) { unset($pushpost[$d - 1]); } } } $pushcount = count($pushpost); if ($pushcount) { $f->update('mppCnt', $pushcount); // 更新推文次數 $com = $ocom . $this->PUSHPOST_SEPARATOR . '<br />' . implode('<br />', $pushpost); } else { $f->remove('mppCnt'); // 刪除推文次數 $com = $ocom; } $PIO->updatePost($_GET['no'], array('com' => $com, 'status' => $f->toString())); // 更新推文 $PIO->dbCommit(); header('HTTP/1.1 302 Moved Temporarily'); header('Location: ' . fullURL() . PHP_SELF . '?page_num=0'); return; } else { die('[Error] unknown action.'); } } } else { die('[Error] unauthenticated action.'); } } // 非 AJAX 推文,產出表單供填寫 if (!isset($_POST['comm'])) { echo $this->printStaticForm(intval($_GET['no'])); } else { // 處理推文 // 傳送方法不正確 if ($_SERVER['REQUEST_METHOD'] != 'POST') { die(_T('regist_notpost')); } // 查IP $baninfo = ''; $ip = getREMOTE_ADDR(); $host = gethostbyaddr($ip); if (BanIPHostDNSBLCheck($ip, $host, $baninfo)) { die(_T('regist_ipfiltered', $baninfo)); } $name = CleanStr($_POST['name']); $comm = CleanStr($_POST['comm']); if (strlen($name) > 30) { die($this->_T('maxlength')); } // 名稱太長 if (strlen($comm) > 160) { die($this->_T('maxlength')); } // 太多字 if (strlen($comm) == 0) { die($this->_T('nocomment')); } // 沒打字 $name = str_replace(array(_T('trip_pre'), _T('admin'), _T('deletor')), array(_T('trip_pre_fake'), '"' . _T('admin') . '"', '"' . _T('deletor') . '"'), $name); // 生成ID, Trip 等識別資訊 $pushID = $this->getID(); $pushtime = gmdate('y/m/d H:i', time() + intval(TIME_ZONE) * 3600); if (preg_match('/(.*?)[##](.*)/u', $name, $regs)) { $cap = strtr($regs[2], array('&' => '&')); $salt = strtr(preg_replace('/[^\\.-z]/', '.', substr($cap . 'H.', 1, 2)), ':;<=>?@[\\]^_`', 'ABCDEFGabcdef'); $name = $regs[1] . _T('trip_pre') . substr(crypt($cap, $salt), -10); } if (!$name || preg_match("/^[ | |]*\$/", $name)) { if (ALLOW_NONAME) { $name = DEFAULT_NONAME; } else { die(_T('regist_withoutname')); } // 不接受匿名 } if (ALLOW_NONAME == 2) { // 強制砍名 $name = preg_match('/(\\' . _T('trip_pre') . '.{10})/', $name, $matches) ? $matches[1] . ':' : DEFAULT_NONAME . ':'; } else { $name .= ':'; } $pushpost = "{$name} {$comm} ({$pushID} {$pushtime})"; // 推文主體 $post = $PIO->fetchPosts($_GET['no']); if (!count($post)) { die('[Error] Post does not exist.'); } // 被推之文章不存在 $parentNo = $post[0]['resto'] ? $post[0]['resto'] : $post[0]['no']; $threads = array_flip($PIO->fetchThreadList()); $threadPage = floor($threads[$parentNo] / PAGE_DEF); $p = $parentNo == $post[0]['no'] ? $post : $PIO->fetchPosts($parentNo); // 取出首篇 $flgh = $PIO->getPostStatus($p[0]['status']); if ($flgh->exists('TS')) { die('[Error] ' . _T('regist_threadlocked')); } // 首篇禁止回應/同時表示禁止推文 $post[0]['com'] .= (strpos($post[0]['com'], $this->PUSHPOST_SEPARATOR . '<br />') === false ? '<br />' . $this->PUSHPOST_SEPARATOR : '') . '<br /> ' . $pushpost; $flgh2 = $PIO->getPostStatus($post[0]['status']); $flgh2->plus('mppCnt'); // 推文次數+1 $PIO->updatePost($_GET['no'], array('com' => $post[0]['com'], 'status' => $flgh2->toString())); // 更新推文 $PIO->dbCommit(); // mod_audit logcat $this->callCHP('mod_audit_logcat', array(sprintf('[%s] No.%d %s (%s)', __CLASS__, $_GET['no'], $comm, $pushID))); if (STATIC_HTML_UNTIL == -1 || $threadPage <= STATIC_HTML_UNTIL) { // 僅更新討論串出現那頁 updatelog(0, $threadPage, true); } deleteCache(array($parentNo)); // 刪除討論串舊快取 if (isset($_POST['ajaxmode'])) { echo '+OK ', $pushpost; } else { header('HTTP/1.1 302 Moved Temporarily'); header('Location: ' . fullURL() . PHP_SELF2 . '?' . time()); } } }
} deleteCache("admin_cat"); break; case "add_ok": case "edit_ok": if (count($_POST) == 0) { $goto_url = $setting['info']['self']; } else { if ($method == "add_ok") { $log_info = $setting['language']['plugin_admin_cat_add']; $db->insert($setting['db']['pre'] . "admin_cat", $_POST, true); } else { $log_info = $setting['language']['plugin_admin_cat_edit']; $db->update($setting['db']['pre'] . "admin_cat", $_POST, array("id", "n=", $id)); } deleteCache("admin_cat"); } break; default: $goto_url = $setting['info']['self']; } if (!empty($log_info)) { write_log($log_info, "id=" . $id); includeCache("admin_cat"); $admin_cat = json_encode(chg_charset($admin_cat, $setting['gen']['charset'], "utf-8")); echo <<<mystep <script language="javascript"> try{ \tparent.admin_cat = {$admin_cat}; \tparent.setNav(); } catch(e){}
function db_delete_post($mod_delete_post_xid, $db_query) { $mod_delete_post_xid_quoted = "'" . mysql_real_escape_string($mod_delete_post_xid, $db_query) . "'"; $db = databaseConnect('fotos_root_usr', 'fotos_root_pass', 'fotos'); // averiguamos el true id $delete_post_stmt = "SELECT id FROM posts WHERE xid={$mod_delete_post_xid_quoted} AND is_deleted='0'"; // print $delete_post_stmt . "<br>\n"; $delete_rs = executeQuery(Bnumber(), $db, $delete_post_stmt, "canBeZero"); if ($delete_rs === FALSE) { gotoHomeIf(NULL, NULL, 'redirect'); } $delete_row = mysql_fetch_row($delete_rs); $mod_delete_post_id = $delete_row[0]; // seleccionamos las fotos, y las borramos una a una $delete_pic_stmt = "SELECT pic_id FROM posts_pics pp WHERE pp.post_id = '{$mod_delete_post_id}' AND pp.is_deleted='0'"; //print $delete_pic_stmt . "<br>\n"; $pics_rs = executeQuery(Bnumber(), $db, $delete_pic_stmt, "canBeZero"); if ($pics_rs) { while ($pic_row = mysql_fetch_row($pics_rs)) { //print $pic_row[0] . "<br>\n"; db_delete_pic($mod_delete_post_xid, "000000000", $db, $mod_delete_post_id, $pic_row[0]); } mysql_free_result($pics_rs); } // quitamos las asociaciones a tags $delete_tags_stmt = "SELECT tp.tag_id FROM tags_posts tp WHERE tp.post_id = '{$mod_delete_post_id}' AND tp.is_deleted='0'"; //print $delete_tags_stmt . "<br>\n"; $tags_rs = executeQuery(Bnumber(), $db, $delete_tags_stmt, "canBeZero"); if ($tags_rs) { while ($tag_row = mysql_fetch_row($tags_rs)) { //print "tag: " . $tag_row[0] . "<br>\n"; db_delete_tag($tag_row[0], $mod_delete_post_id, $db); } } // marcamos los tags como borrados si no apuntan a nadie mas // lo ultimo es marcar el post como borrado, para poder repetir en caso de error $delete_post_stmt = "UPDATE posts SET is_deleted='1',delete_date=now() WHERE id='{$mod_delete_post_id}' AND is_deleted='0'"; //print $delete_post_stmt . "<br>\n"; executeNonQuery(Bnumber(), $db, $delete_post_stmt); //$link = substr($_SERVER['HTTP_REFERER'], strlen("http://" . $_SERVER['HTTP_HOST']), strlen($_SERVER['HTTP_REFERER']) - strlen("http://" . $_SERVER['HTTP_HOST'])); deleteCache(DIR_HOME . "/cache/{$mod_delete_post_xid}"); // header("Refresh: 0; URL=" URL_HOME . "/a/display/$mod_delete_post_xid"); gotoHomeIf(NULL, NULL, 'redirect'); // exit; }
if ($id_list[$i]['new'] == 0) { break; } $db->select($pre_org . "news_detail", "*", array("news_id", "n=", $id_list[$i]['old']), array("order" => "news_id asc, page asc")); while ($record = $db->GetRS()) { $record['id'] = 0; $record['news_id'] = $id_list[$i]['new']; $db2->insert($pre_dst . "news_detail", $record, true); } $db->delete($pre_org . "news_show", array("news_id", "n=", $id_list[$i]['old'])); $db->delete($pre_org . "news_detail", array("news_id", "n=", $id_list[$i]['old'])); } } } } deleteCache("news_cat"); break; default: build_page(); } if (!empty($log_info)) { write_log($log_info, "cat_id={$cat_id}"); $goto_url = $req->getServer("PHP_SELF"); } $mystep->pageEnd(false); function build_page() { global $mystep, $req, $db, $setting; $tpl_info = array("idx" => "trans", "style" => "../plugin/" . basename(realpath(dirname(__FILE__))) . "/tpl/", "path" => ROOT_PATH . "/" . $setting['path']['template']); $tpl = $mystep->getInstance("MyTpl", $tpl_info); $max_count = count($GLOBALS['website']);
if (count($_POST) == 0) { $goto_url = $setting['info']['self']; } else { $log_info = $setting['language']['admin_web_plugin_setup']; if (isset($_POST['subweb'])) { if ($_POST['subweb'][0] == "all") { $subweb = ""; } else { $subweb = "," . join($_POST['subweb'], ",") . ","; } } else { $subweb = ","; } $db->update($setting['db']['pre'] . "plugin", array("subweb" => $subweb), array("idx", "=", $idx)); MultiDel(ROOT_PATH . "/" . $setting['path']['cache'] . "/plugin/"); deleteCache("plugin"); MultiDel(ROOT_PATH . "/" . $setting['path']['cache'] . "/plugin/"); if (isset($_POST['plugin_setting'])) { include $plugin_path . $idx . "/config.php"; foreach ($_POST['plugin_setting'][$idx] as $key => $value) { if (is_array($value)) { $_POST['plugin_setting'][$idx][$key] = implode(",", $value); } if (isset($_POST['plugin_setting'][$idx][$key . "_r"])) { if (empty($_POST['plugin_setting'][$idx][$key])) { $_POST['plugin_setting'][$idx][$key] = $plugin_setting[$idx][$key]; } unset($_POST['plugin_setting'][$idx][$key . "_r"]); } } $result = <<<mystep
$db->delete($setting['db']['pre'] . "links", array("id", "n=", $id)); deleteCache("link"); break; case "add_ok": case "edit_ok": if (count($_POST) == 0) { $goto_url = $setting['info']['self']; } else { if ($method == "add_ok") { $log_info = $setting['language']['admin_func_link_add']; $db->insert($setting['db']['pre'] . "links", $_POST, true); } else { $log_info = $setting['language']['admin_func_link_edit']; $db->update($setting['db']['pre'] . "links", $_POST, array("id", "n=", $id)); } deleteCache("link"); } break; default: break; } if (!empty($log_info)) { write_log($log_info, "id={$id}"); $goto_url = basename($req->getServer($method == "delete" ? "HTTP_REFERER" : "PHP_SELF")); } $mystep->pageEnd(false); function build_page($method) { global $mystep, $req, $db, $tpl, $tpl_info, $setting, $id, $idx, $web_id; $tpl_info['idx'] = "func_link_" . ($method == "list" ? "list" : "input"); $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
public function removeGoods() { $goods_id = intval($_REQUEST['goods_id']); $goods_data = D("ShareGoods")->where("goods_id=" . $goods_id)->find(); D("ShareGoods")->where("goods_id=" . $goods_id)->delete(); //开始同步data $this->init_share_data($goods_data['share_id']); $err = D()->getDbError(); if ($err) { $result['isErr'] = 1; $result['content'] = $err; } else { Vendor('common'); if ($goods_data['base_id'] == 0) { $count = D("ShareGoods")->where("base_id=" . $goods_id)->count(); if ($count == 0) { deleteShareImg(FANWE_ROOT . $goods_data['img']); } } $share_id = $goods_data['share_id']; deleteCache('share/' . getDirsById($share_id) . '/imgs'); deleteCache('share/' . getDirsById($share_id) . '/detail'); FS('Share')->updateShareCache($share_id, 'imgs'); $result['isErr'] = 0; } die(json_encode($result)); }
} else { $_POST['power_func'] = join($_POST['power_func'], ","); } if ($_POST['power_cat'][0] == "all") { $_POST['power_cat'] = "all"; } else { $_POST['power_cat'] = join($_POST['power_cat'], ","); } if ($_POST['power_web'][0] == "all") { $_POST['power_web'] = "all"; } else { $_POST['power_web'] = join($_POST['power_web'], ","); } $log_info = $method == "add_ok" ? $setting['language']['admin_user_group_add'] : $setting['language']['admin_user_group_edit']; $db->replace($setting['db']['pre'] . "user_group", $_POST); deleteCache("user_group"); } break; default: build_page("list"); } if (!empty($log_info)) { write_log($log_info, "group_id=" . $group_id); $goto_url = $setting['info']['self']; } $mystep->pageEnd(false); function build_page($method) { global $mystep, $req, $db, $tpl, $group_id, $tpl_info, $admin_cat, $admin_cat_plat, $news_cat, $website, $setting; $tpl_info['idx'] = "user_group_" . ($method == "list" ? "list" : "input"); $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
case "delete": $log_info = $setting['language']['admin_user_type_delete']; if ($type_id > 3) { $db->update($setting['db']['pre'] . "users", array("type_id" => 2), array("type_id", "n=", $type_id)); $db->delete($setting['db']['pre'] . "users", array("type_id", "n=", $type_id)); deleteCache("user_type"); } break; case "add_ok": case "edit_ok": if (count($_POST) == 0) { $goto_url = $setting['info']['self']; } else { $log_info = $method == "add_ok" ? $setting['language']['admin_user_type_add'] : $setting['language']['admin_user_type_edit']; $db->replace($setting['db']['pre'] . "user_type", $_POST); deleteCache("user_type"); } break; default: build_page("list"); } if (!empty($log_info)) { write_log($log_info, "type_id=" . $type_id); $goto_url = $setting['info']['self']; } $mystep->pageEnd(false); function build_page($method) { global $mystep, $req, $db, $tpl, $type_id, $tpl_info, $setting, $user_power; $tpl_info['idx'] = "user_type_" . ($method == "list" ? "list" : "input"); $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
unlinkUWTempFiles(); logThis('Cleaning up the session. Goodbye.'); resetUwSession(); // flag to say upgrade has completed $_SESSION['upgrade_complete'] = true; //Clear any third party caches sugar_cache_reset_full(); //add the clean vardefs here if (!class_exists('VardefManager')) { } VardefManager::clearVardef(); require_once 'include/TemplateHandler/TemplateHandler.php'; TemplateHandler::clearAll(); //also add the cache cleaning here. if (function_exists('deleteCache')) { deleteCache(); } global $mod_strings; global $current_language; if (!isset($current_language) || $current_language == null) { $current_language = 'en_us'; } if (isset($GLOBALS['current_language']) && $GLOBALS['current_language'] != null) { $current_language = $GLOBALS['current_language']; } $mod_strings = return_module_language($current_language, 'UpgradeWizard'); $stop = false; $httpHost = $_SERVER['HTTP_HOST']; // cn: 8472 - HTTP_HOST includes port in some cases if ($colon = strpos($httpHost, ':')) { $httpHost = substr($httpHost, 0, $colon);
function ModulePage() { global $PIO, $FileIO, $PMS, $language, $BAD_STRING, $BAD_FILEMD5, $BAD_IPADDR, $LIMIT_SENSOR; if (!isset($_GET['no'])) { die('[Error] not enough parameter.'); } if (!isset($_POST['mode'])) { // 顯示表單 if (!$this->shown_in_page && !adminAuthenticate('check')) { die('[Error] Access Denied.'); } $post = $PIO->fetchPosts($_GET['no']); if (!count($post)) { die('[Error] Post does not exist.'); } extract($post[0]); $PMS->loadModules('mod_bbcode'); //嘗試載入mod_bbcode if ($bbcode = $PMS->getModuleInstance('mod_bbcode')) { $bbcode->_html2bb($com); } $name = preg_replace('|<span.*?>(.*?)</span>|', '\\1', $name); $dat = ''; head($dat); $PMS->hookModuleMethod('PostInfo', array($this, '_EditPostInfo')); form($dat, $resto, false, $this->mypage . '&no=' . $_GET['no'], $name, $email, $sub, str_replace('<br />', "\n", $com), substr(str_replace(',', ',', $category), 1, -1), 'edit'); foot($dat); echo $dat; } else { // 儲存 if ($_SERVER['REQUEST_METHOD'] != 'POST') { error(_T('regist_notpost')); } // 非正規POST方式 $post = $PIO->fetchPosts($_GET['no']); $newValues = array(); if (!count($post)) { die('[Error] Post does not exist.'); } $name = isset($_POST[FT_NAME]) ? $_POST[FT_NAME] : ''; $email = isset($_POST[FT_EMAIL]) ? $_POST[FT_EMAIL] : ''; $sub = isset($_POST[FT_SUBJECT]) ? $_POST[FT_SUBJECT] : ''; $com = isset($_POST[FT_COMMENT]) ? $_POST[FT_COMMENT] : ''; $pwd = isset($_POST['pwd']) ? $_POST['pwd'] : ''; $category = isset($_POST['category']) ? $_POST['category'] : ''; $resto = isset($_POST['resto']) ? $_POST['resto'] : 0; $upfile = ''; $upfile_path = ''; $upfile_name = false; $upfile_status = 4; $pwdc = isset($_COOKIE['pwdc']) ? $_COOKIE['pwdc'] : ''; if ($resto && !$PIO->isThread($resto)) { die('[Error] Thread was deleted.'); } $is_admin = $haveperm = $pwd == ADMIN_PASS || adminAuthenticate('check'); $PMS->useModuleMethods('Authenticate', array($pwd, 'useredit', &$haveperm)); if ($pwd == '' && $pwdc != '') { $pwd = $pwdc; } $pwd_md5 = substr(md5($pwd), 2, 8); $host = gethostbyaddr(getREMOTE_ADDR()); if (!($pwd_md5 == $post[0]['pwd'] || $host == $post[0]['host'] || $haveperm)) { die('[Error] Access denied.'); } // 欄位陷阱 $FTname = isset($_POST['name']) ? $_POST['name'] : ''; $FTemail = isset($_POST['email']) ? $_POST['email'] : ''; $FTsub = isset($_POST['sub']) ? $_POST['sub'] : ''; $FTcom = isset($_POST['com']) ? $_POST['com'] : ''; $FTreply = isset($_POST['reply']) ? $_POST['reply'] : ''; if ($FTname != 'spammer' || $FTemail != '*****@*****.**' || $FTsub != 'DO NOT FIX THIS' || $FTcom != 'EID OG SMAPS' || $FTreply != '') { error(_T('regist_nospam')); } // 封鎖:IP/Hostname/DNSBL 檢查機能 $ip = getREMOTE_ADDR(); $host = gethostbyaddr($ip); $baninfo = ''; if (BanIPHostDNSBLCheck($ip, $host, $baninfo)) { error(_T('regist_ipfiltered', $baninfo)); } // 封鎖:限制出現之文字 foreach ($BAD_STRING as $value) { if (strpos($com, $value) !== false || strpos($sub, $value) !== false || strpos($name, $value) !== false || strpos($email, $value) !== false) { error(_T('regist_wordfiltered')); } } $PMS->useModuleMethods('RegistBegin', array(&$name, &$email, &$sub, &$com, array('file' => &$upfile, 'path' => &$upfile_path, 'name' => &$upfile_name, 'status' => &$upfile_status), array('ip' => $ip, 'host' => $host))); // "RegistBegin" Hook Point // 檢查是否輸入櫻花日文假名 $chkanti = array($name, $email, $sub, $com); foreach ($chkanti as $anti) { if (anti_sakura($anti)) { error(_T('regist_sakuradetected')); } } // 檢查表單欄位內容並修整 if (strlen($name) > 100) { error(_T('regist_nametoolong')); } if (strlen($email) > 100) { error(_T('regist_emailtoolong')); } if (strlen($sub) > 100) { error(_T('regist_topictoolong')); } if (strlen($resto) > 10) { error(_T('regist_longthreadnum')); } $email = CleanStr($email); $email = str_replace("\r\n", '', $email); $sub = CleanStr($sub); $sub = str_replace("\r\n", '', $sub); $resto = CleanStr($resto); $resto = str_replace("\r\n", '', $resto); // 名稱修整 $name = CleanStr($name); $name = str_replace(_T('trip_pre'), _T('trip_pre_fake'), $name); // 防止トリップ偽造 $name = str_replace(CAP_SUFFIX, _T('cap_char_fake'), $name); // 防止管理員キャップ偽造 $name = str_replace("\r\n", '', $name); $nameOri = $name; // 名稱 if (preg_match('/(.*?)[##](.*)/u', $name, $regs)) { // トリップ(Trip)機能 $name = $nameOri = $regs[1]; $cap = strtr($regs[2], array('&' => '&')); $salt = preg_replace('/[^\\.-z]/', '.', substr($cap . 'H.', 1, 2)); $salt = strtr($salt, ':;<=>?@[\\]^_`', 'ABCDEFGabcdef'); $name = $name . _T('trip_pre') . substr(crypt($cap, $salt), -10); } if (CAP_ENABLE && preg_match('/(.*?)[##](.*)/', $email, $aregs)) { // 管理員キャップ(Cap)機能 $acap_name = $nameOri; $acap_pwd = strtr($aregs[2], array('&' => '&')); if ($acap_name == CAP_NAME && $acap_pwd == CAP_PASS) { $name = '<span class="admin_cap">' . $name . CAP_SUFFIX . '</span>'; $is_admin = true; $email = $aregs[1]; // 去除 #xx 密碼 } } if (!$is_admin) { // 非管理員 $name = str_replace(_T('admin'), '"' . _T('admin') . '"', $name); $name = str_replace(_T('deletor'), '"' . _T('deletor') . '"', $name); } $name = str_replace('&◆', '&◆', $name); // 避免 &#xxxx; 後面被視為 Trip 留下 & 造成解析錯誤 // 內文修整 if (strlen($com) > COMM_MAX && !$is_admin) { error(_T('regist_commenttoolong')); } $com = CleanStr($com, $is_admin); // 引入$is_admin參數是因為當管理員キャップ啟動時,允許管理員依config設定是否使用HTML $com = str_replace("\r\n", "\n", $com); $com = str_replace("\r", "\n", $com); $com = ereg_replace("\n(( | )*\n){3,}", "\n", $com); if (!BR_CHECK || substr_count($com, "\n") < BR_CHECK) { $com = nl2br($com); } // 換行字元用<br />代替 $com = str_replace("\n", '', $com); // 若還有\n換行字元則取消換行 if ($category && USE_CATEGORY) { // 修整標籤樣式 $category = explode(',', $category); // 把標籤拆成陣列 $category = ',' . implode(',', array_map('trim', $category)) . ','; // 去空白再合併為單一字串 (左右含,便可以直接以,XX,形式搜尋) } else { $category = ''; } $age = false; $dest = ''; $W = $post[0]['tw']; $H = $post[0]['th']; $imgW = $post[0]['imgw']; $imgH = $post[0]['imgh']; $status = $post[0]['status']; $PMS->useModuleMethods('RegistBeforeCommit', array(&$name, &$email, &$sub, &$com, &$category, &$age, $dest, $resto, array($W, $H, $imgW, $imgH), &$status)); // "RegistBeforeCommit" Hook Point if ($name != $post[0]['name'] && $_POST[FT_NAME]) { $newValues['name'] = $name; } if ($email != $post[0]['email'] && $_POST[FT_EMAIL]) { $newValues['email'] = $email; } if ($sub != $post[0]['sub'] && $_POST[FT_SUBJECT]) { $newValues['sub'] = $sub; } if ($com != $post[0]['com'] && $_POST[FT_COMMENT]) { $newValues['com'] = $com; } if ($category != $post[0]['category'] && $_POST['category']) { $newValues['category'] = $category; } $PIO->updatePost($_GET['no'], $newValues); $PIO->dbCommit(); $parentNo = $post[0]['resto'] ? $post[0]['resto'] : $post[0]['no']; $threads = array_flip($PIO->fetchThreadList()); $threadPage = floor($threads[$parentNo] / PAGE_DEF); if (STATIC_HTML_UNTIL == -1 || $threadPage <= STATIC_HTML_UNTIL) { updatelog(0, $threadPage, true); } // 僅更新討論串出現那頁 deleteCache(array($parentNo)); // 刪除討論串舊快取 header('HTTP/1.1 302 Moved Temporarily'); header('Location: ' . fullURL() . PHP_SELF2 . '?' . time()); } }
function ModulePage() { global $PIO, $PTE; if (!isset($_GET['do'])) { // 沒有 "do" 指令,舊的 tag 連接 if (!isset($_GET['no'])) { die('[Error] not enough parameter.'); } if (!isset($_POST['tag'])) { $post = $PIO->fetchPosts($_GET['no']); if (!count($post)) { die('[Error] Post does not exist.'); } $pte_vals = array('{$TITLE}' => TITLE, '{$RESTO}' => ''); $dat = $PTE->ParseBlock('HEADER', $pte_vals); $dat .= '</head><body id="main">'; $dat .= '<form action="' . $this->mypage . '&no=' . $_GET['no'] . '" method="POST">Tag: <input type="text" name="tag" value="' . htmlentities(substr(str_replace(',', ',', $post[0]['category']), 1, -1), ENT_QUOTES, 'UTF-8') . '" size="28" /><input type="submit" name="submit" value="Tag!" /></form>'; echo $dat . "</body></html>"; } else { $Tag = CleanStr($_POST['tag']); if ($_SERVER['REQUEST_METHOD'] != 'POST') { error(_T('regist_notpost')); } // 非正規POST方式 $post = $PIO->fetchPosts($_GET['no']); $parentNo = $post[0]['resto'] ? $post[0]['resto'] : $post[0]['no']; $threads = array_flip($PIO->fetchThreadList()); $threadPage = floor($threads[$parentNo] / PAGE_DEF); if (!count($post)) { die('[Error] Post does not exist.'); } $ss = method_exists($PIO, '_replaceComma') ? ',' : ','; // Dirty implement $category = explode(',', $Tag); // 把標籤拆成陣列 $category = $ss . implode($ss, array_map('trim', $category)) . $ss; // 去空白再合併為單一字串 (左右含,便可以直接以,XX,形式搜尋) $PIO->updatePost($_GET['no'], array('category' => $category)); $PIO->dbCommit(); if (STATIC_HTML_UNTIL == -1 || $threadPage <= STATIC_HTML_UNTIL) { updatelog(0, $threadPage, true); } // 僅更新討論串出現那頁 deleteCache(array($parentNo)); // 刪除討論串舊快取 if (isset($_POST['ajaxmode'])) { echo $Tag; } else { header('HTTP/1.1 302 Moved Temporarily'); header('Location: ' . fullURL() . PHP_SELF2 . '?' . time()); } } } else { // 有 "do" 指令,查看下一步 if ($_GET['do'] == "search") { // 搜尋符合標籤的主題 global $PTE, $PIO, $PMS, $FileIO, $language; $category = isset($_GET['c']) ? strtolower(strip_tags(trim($_GET['c']))) : ''; // 搜尋之類別標籤 if (!$category) { error(_T('category_nokeyword')); } $category_enc = urlencode($category); $category_md5 = md5($category); $page = isset($_GET['p']) ? @intval($_GET['p']) : 1; if ($page < 1) { $page = 1; } // 目前瀏覽頁數 $isrecache = isset($_GET['recache']); // 是否強制重新生成快取 // 利用Session快取類別標籤出現篇別以減少負擔 session_start(); // 啟動Session if (!isset($_SESSION['loglist_' . $category_md5]) || $isrecache) { $loglist = $PIO->searchCategory($category); $_SESSION['loglist_' . $category_md5] = serialize($loglist); } else { $loglist = unserialize($_SESSION['loglist_' . $category_md5]); } $loglist_count = count($loglist); if (!$loglist_count) { error(_T('category_notfound')); } $page_max = ceil($loglist_count / PAGE_DEF); if ($page > $page_max) { $page = $page_max; } // 總頁數 // 分割陣列取出適當範圍作分頁之用 $loglist_cut = array_slice($loglist, PAGE_DEF * ($page - 1), PAGE_DEF); // 取出特定範圍文章 $loglist_cut_count = count($loglist_cut); $dat = ''; head($dat); $links = '[<a href="' . PHP_SELF2 . '?' . time() . '">' . _T('return') . '</a>][<a href="' . PHP_SELF . '?mode=module&load=mod_tag&do=search&c=' . $category_enc . '&recache=1">' . _T('category_recache') . '</a>]'; $PMS->useModuleMethods('LinksAboveBar', array(&$links, 'category')); $dat .= "<div>{$links}</div>\n"; for ($i = 0; $i < $loglist_cut_count; $i++) { $tID = $loglist_cut[$i]; $tree_count = $PIO->postCount($tID) - 1; // 討論串回應個數 $RES_start = $tree_count - RE_DEF + 1; if ($RES_start < 1) { $RES_start = 1; } // 開始 $RES_amount = RE_DEF; // 取幾個 $hiddenReply = $RES_start - 1; // 被隱藏回應 // $RES_start, $RES_amount 拿去算新討論串結構 (分頁後, 部分回應隱藏) $tree = $PIO->fetchPostList($tID); // 整個討論串樹狀結構 $tree_cut = array_slice($tree, $RES_start, $RES_amount); array_unshift($tree_cut, $tID); // 取出特定範圍回應 $posts = $PIO->fetchPosts($tree_cut); // 取得文章架構內容 $dat .= arrangeThread($PTE, $tree, $tree_cut, $posts, $hiddenReply, 0, array(), array(), false, false, false); } $dat .= '<table border="1"><tr>'; if ($page > 1) { $dat .= '<td><form action="' . PHP_SELF . '?mode=module&load=mod_tag&do=search&c=' . $category_enc . '&p=' . ($page - 1) . '" method="post"><div><input type="submit" value="' . _T('prev_page') . '" /></div></form></td>'; } else { $dat .= '<td style="white-space: nowrap;">' . _T('first_page') . '</td>'; } $dat .= '<td>'; for ($i = 1; $i <= $page_max; $i++) { if ($i == $page) { $dat .= "[<b>" . $i . "</b>] "; } else { $dat .= '[<a href="' . PHP_SELF . '?mode=module&load=mod_tag&do=search&c=' . $category_enc . '&p=' . $i . '">' . $i . '</a>] '; } } $dat .= '</td>'; if ($page < $page_max) { $dat .= '<td><form action="' . PHP_SELF . '?mode=module&load=mod_tag&do=search&c=' . $category_enc . '&p=' . ($page + 1) . '" method="post"><div><input type="submit" value="' . _T('next_page') . '" /></div></form></td>'; } else { $dat .= '<td style="white-space: nowrap;">' . _T('last_page') . '</td>'; } $dat .= '</tr></table>' . "\n"; foot($dat); echo $dat; } else { if ($_GET['do'] == "cloud") { // 建立 tag cloud? // blah blah blah } else { // 不知道該如何處理的 "do" 指令 echo "スクリプトはTranslation Server Errorに免費の午餐を食べています!<br />"; echo "...你想表達什麼?"; } } } }
function ModulePage() { global $PIO, $PTE; if (isset($_GET['action'])) { // 標籤雲 require './module/wordcloud.class.php'; $pte_vals = array('{$TITLE}' => TITLE, '{$RESTO}' => ''); $dat = $PTE->ParseBlock('HEADER', $pte_vals); $dat .= '<style type="text/css"> .word { padding: 4px 4px 4px 4px; letter-spacing: 3px; text-decoration: none; font-weight: normal; } .size9 { color: #000 !important; font-size: 200%; } .size8 { color: #111 !important; font-size: 170%; } .size7 { color: #222 !important; font-size: 150%; } .size6 { color: #333 !important; font-size: 120%; } .size5 { color: #444 !important; font-size: 110%; } .size4 { color: #555 !important; font-size: 100%; } .size3 { color: #666 !important; font-size: 90%; } .size2 { color: #777 !important; font-size: 80%; } .size1 { color: #888 !important; font-size: 70%; } .size0 { color: #999 !important; font-size: 60%; } </style> </head> <body id="main">'; $p = $PIO->fetchPosts($PIO->fetchPostList()); $cloud = new wordCloud(); foreach ($p as $pp) { if ($pp['category']) { $pp['category'] = substr(str_replace(array(',', ','), ' ', $pp['category']), 1, -1); $cloud->addString($pp['category']); } } $myCloud = $cloud->showCloud('array'); if (is_array($myCloud)) { foreach ($myCloud as $key => $value) { $dat .= '<a href="./pixmicat.php?mode=category&c=' . urlencode($value['word']) . '" class="word size' . $value['range'] . '">' . $value['word'] . '</a>' . "\n"; } } echo $dat . "</body></html>"; return; } if (!isset($_GET['no'])) { die('[Error] not enough parameter.'); } if (!isset($_POST['tag'])) { $post = $PIO->fetchPosts($_GET['no']); if (!count($post)) { die('[Error] Post does not exist.'); } $pte_vals = array('{$TITLE}' => TITLE, '{$RESTO}' => ''); $dat = $PTE->ParseBlock('HEADER', $pte_vals); $dat .= '</head><body id="main">'; $dat .= '<form action="' . $this->mypage . '&no=' . $_GET['no'] . '" method="POST">Tag: <input type="text" name="tag" value="' . htmlentities(substr(str_replace(',', ',', $post[0]['category']), 1, -1), ENT_QUOTES, 'UTF-8') . '" size="28" /><input type="submit" name="submit" value="Tag!" /></form>'; echo $dat . "</body></html>"; } else { $Tag = CleanStr($_POST['tag']); if ($_SERVER['REQUEST_METHOD'] != 'POST') { error(_T('regist_notpost')); } // 非正規POST方式 $post = $PIO->fetchPosts($_GET['no']); $parentNo = $post[0]['resto'] ? $post[0]['resto'] : $post[0]['no']; $threads = array_flip($PIO->fetchThreadList()); $threadPage = floor($threads[$parentNo] / PAGE_DEF); if (!count($post)) { die('[Error] Post does not exist.'); } if (USE_CATEGORY && $Tag) { // 修整標籤樣式 $ss = method_exists($PIO, '_replaceComma') ? ',' : ','; // Dirty implement $category = explode(',', $Tag); // 把標籤拆成陣列 $category = $ss . implode($ss, array_map('trim', $category)) . $ss; // 去空白再合併為單一字串 (左右含,便可以直接以,XX,形式搜尋) } else { $category = ''; } $PIO->updatePost($_GET['no'], array('category' => $category)); $PIO->dbCommit(); if (STATIC_HTML_UNTIL == -1 || $threadPage <= STATIC_HTML_UNTIL) { updatelog(0, $threadPage, true); } // 僅更新討論串出現那頁 deleteCache(array($parentNo)); // 刪除討論串舊快取 if (isset($_POST['ajaxmode'])) { echo $Tag; } else { header('HTTP/1.1 302 Moved Temporarily'); header('Location: ' . fullURL() . PHP_SELF2 . '?' . time()); } } }
<?php \$setting_sub = array(); /*--settings--*/ ?> mystep; $result = str_replace("/*--settings--*/", makeVarsCode($new_setting, '$setting_sub'), $result); if ($method == "add_ok" && ($setting['db']['name'] != $new_setting['db']['name'] || $setting['db']['pre'] != $new_setting['db']['pre'])) { $strFind = array("{db_name}", "{pre}", "{charset}", "{host}", "{idx}"); $strReplace = array($new_setting['db']['name'], $new_setting['db']['pre'], $setting['db']['charset'], $_POST['host'], $_POST['idx']); $info = $db->ExeSqlFile("subweb.sql", $strFind, $strReplace); } $db->SelectDB($setting['db']['name']); WriteFile(ROOT_PATH . "/include/config_" . $_POST['idx'] . ".php", $result, "w"); $db->replace($setting['db']['pre'] . "website", $_POST); deleteCache("website"); } break; default: build_page("list"); } if (!empty($log_info)) { write_log($log_info, "web_id={$web_id}"); $goto_url = $setting['info']['self']; } $mystep->pageEnd(false); function build_page($method) { global $mystep, $req, $db, $tpl, $web_id, $tpl_info, $website, $setting; $tpl_info['idx'] = "web_subweb_" . ($method == "list" ? "list" : "input"); $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);