$strWhere = 'where ' . $strWhere; $intStart = ($intPage - 1) * $objWebInit->arrGPage['page_size']; $arrInfoList = check::getAPI($strModuleID, "getInfoList", "{$strWhere}^ ORDER BY topflag DESC,submit_date DESC^{$intStart}^{$arrGPage['page_size']}^id,title,clicktimes"); $intRows = $arrInfoList['COUNT_ROWS']; unset($arrInfoList['COUNT_ROWS']); //翻页跳转 if (!empty($arrLink)) { $strLink = implode('&', $arrLink); } $arrListPage = $objWebInit->makeInfoListPage($intRows, $strLink, $link_type = 2); //print_r($arrListPage); include_once 'include/title.php'; include_once 'include/head.php'; $intRowNum = ($intPage - 1) * $arrGPage['page_size'] + 1; foreach ($arrInfoList as $k => $v) { $v['title'] = check::csubstr($v['title'], 0, $arrMHaw['list_charnum']); $myText = new HAW_text($intRowNum . ":"); $myText->br = 0; $objHaw->add_text($myText); $myLink = new HAW_link($v['title'], "detail.php?id=" . $v['id'] . "&mod=" . $strModuleID . "&page=" . $intPage); $myLink->br = 0; $objHaw->add_link($myLink); $myText = new HAW_text(" (" . $v['clicktimes'] . ")"); $objHaw->add_text($myText); $intRowNum++; } if (!empty($arrListPage['pagedown'])) { $myLink = new HAW_link('下页', "search.php?page=" . $arrListPage['pagedown']); $myLink->set_br(0); $objHaw->add_link($myLink); }
} if (strpos($_POST['type_id'], '|') !== false) { $arrTemp = explode('|', $_POST['type_id']); $_POST['type_id'] = $arrTemp[0]; $_POST['type_roue_id'] = $arrTemp[1]; if (empty($_POST['my_promotion'])) { $_POST['my_promotion'] = ceil($_POST['my_promotion'] * $arrTemp[2]); } if (empty($_POST['qq'])) { $_POST['qq'] = $arrTemp[3]; } } else { $_POST['type_roue_id'] = ':' . $_POST['type_id'] . ':'; } if ($_POST['summary'] == '') { $_POST['summary'] = check::csubstr(trim(str_replace(" ", " ", str_replace("\r\n", "", strip_tags($_POST['intro'])))), 0, $arrGWeb['db_summary_len']); } if ($_POST['title'] != '') { $_POST['title_md5'] = md5($_POST['title']); } if (is_array($_POST['photo'])) { $_POST['thumbnail'] = $_POST['photo'][0]['photo']; } else { $_POST['thumbnail'] = $_POST['photo']; } $_POST['photo'] = array_values($_POST['photo']); $_POST['video'] = array_values($_POST['video']); #自动拆字生成tag if (empty($_POST['tag'])) { $objSP = new SplitWord(); $_POST['tag'] = $objSP->SplitRMM($_POST['title'], false);
/** * Smarty truncate modifier plugin * * Type: modifier<br> * Name: truncate<br> * Purpose: Truncate a string to a certain length if necessary, * optionally splitting in the middle of a word, and * appending the $etc string or inserting $etc into the middle. * @link http://smarty.php.net/manual/en/language.modifier.truncate.php * truncate (Smarty online manual) * @author Monte Ohrt <monte at ohrt dot com> * @param string * @param integer * @param string * @param boolean * @param boolean * @return string */ function smarty_modifier_csubstr($string, $start = 0, $sublen = 12, $ellipsis = '', $code = 'UTF-8') { return check::csubstr($string, $start, $sublen, $ellipsis, $code); }
<?php /** * 首页简介文件 * * @author Arthur(ArthurXF@gmail.com) * @copyright (c) 2006 by bizeway.com * @version $Id$ * @package ArthurXF * @subpackage archives */ if (is_object($objWebInit)) { if (!isset($objarchives)) { include_once __WEB_ROOT . "/archives/class/archives.class.php"; include_once __WEB_ROOT . "/archives/config/var.inc.php"; $objarchives = new archives(); $objarchives->setDBG($arrGPdoDB); if (is_object($objWebInit->db)) { $objarchives->db = $objWebInit->db; } else { $objarchives->db(); } } $arrAbout = $objarchives->getInfo('about'); $arrAbout['intro'] = check::csubstr(trim(str_replace(" ", " ", str_replace("\r\n", "", strip_tags($arrAbout['intro'])))), 0, 500); // 输出到模板 $arrMOutput["smarty_assign"]['arrAbout'] = $arrAbout; }
} //提交新贴 if (!empty($_POST['intro'])) { $strIP = check::getip(); if (!session_is_registered('user_id')) { $_POST['user_name'] = $strIP; } else { $_POST['user_name'] = $_SESSION['real_name']; } $objQQWry =& new QQWry(); $objQQWry->qqwry($strIP); $strZone = iconv('GB2312', 'UTF-8' . '//TRANSLIT', $objQQWry->Country); $_POST['zone'] = $strZone; $_POST['reply'] = array(); if ($_POST['summary'] == '') { $_POST['summary'] = check::csubstr(trim(str_replace(" ", " ", str_replace("\r\n", "", strip_tags($_POST['intro'])))), 0, 100); } if (!array_key_exists('title', $_POST)) { $_POST['title'] = $_POST['titleprefix'] . $_POST['longtitle']; } unset($_POST['titleprefix']); unset($_POST['longtitle']); if ($_POST['title'] != '') { $_POST['title_md5'] = md5($_POST['title']); } //判断文章信息 $arrTemp = $objWebInit->getInfoList("where title_md5='{$_POST['title_md5']}' and user_id = '{$_SESSION['user_id']}' and type_id='{$_POST['type_id']}'", "", 0, 1); if ($arrTemp['COUNT_ROWS'] != 0) { check::AlertExit("错误:相同的信息请不要重复发布!需要刷新排列的话,请登录会员中心使用列表下方“提前”选项!", -1); } $objWebInit->saveInfo($_POST, 0);
} //存入数据库 if ($_GET['action'] == 'fetchall' || $_GET['action'] == 'fetch') { if (empty($arrGFetch[$_GET['id']]['module_id'])) { check::AlertExit('存入栏目必须选择!', -1); } if (in_array($arrGFetch[$_GET['id']]['module_id'], array('mcenter', 'account', 'certification', 'comments', 'friend', 'message', 'payment', 'usermoney', 'logs', 'archives', 'ads', 'links', 'phonelist', 'emaillist', 'keywords', 'user'))) { check::AlertExit('非法栏目!', -1); } echo "<a href='{$val}' target=_blank>{$val}</a> <a href='javascript:history.go(-1);'>返回</a><pre>"; print_r($arrSave); echo "</pre>"; $arrSave['type_id'] = $arrGFetch[$_GET['id']]['type_id']; //if(!empty($arrSave['intro'])) $arrSave['summary'] = check::csubstr(trim(str_replace(" "," ",str_replace("\r\n","",strip_tags($arrSave['intro'])))),0,250); if (!empty($arrSave['intro'])) { $arrSave['summary'] = check::csubstr(check::stripText($arrSave['intro']), 0, 250); } if (!empty($arrGFetch[$_GET['id']]['delimiter_df'])) { foreach ($arrGFetch[$_GET['id']]['delimiter_df'] as $k => $v) { if (!empty($v[0])) { $arrSave[$v[0]] = $v[1]; } } } $strData = check::getAPIArray($arrSave); check::getAPI($arrGFetch[$_GET['id']]['module_id'], 'saveInfo', "{$strData}^0^0"); echo ' <font color="green">采集成功!</font><br />'; if ($_GET['action'] == 'fetch') { exit; } }
/** * 支持utf8按照字数分页 * @author 肖飞 * @param string $str 待处理字符串 * @param int $page 当前页面 * @param int $num 从第几页截断 * @param string $code 字符串编码 * @return string */ static function WordPage($str, $num = 200, $page, $code = 'UTF-8') { $str = str_replace(" ", " ", strip_tags($str)); $PageAll = mb_strlen($str, $code) / $num; $PageAll = ceil($PageAll); if ($page == "") { $page = 1; } $start = ($page - 1) * $num; $str = check::csubstr($str, $start, $num, '', $code); $arrData = array(); $arrData['centent'] = $str; //echo $str.'<br />'; if (1 <= $page && $page <= $PageAll) { if ($page < $PageAll) { $arrData['pagedown'] = $page + 1; } if ($page > 1) { $arrData['pageup'] = $page - 1; } } $arrData['pagenav'] = '第' . $page . '页/共' . $PageAll . '页'; //echo '第'.$page.'页/共'.$PageAll.'页<br />'; return $arrData; }