/** * 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_api($array, $class, $fun, $args = '', $debug = false) { if (empty($class) || empty($fun)) { return $array; } $result = check::getAPI($class, $fun, $args, $debug); return $result; }
/** * 删除数据记录 * @author 肖飞 * @param string $table 表名 * @param string $where SQL语句的where条件 * @version 2007-11-21 * @return Boolean */ public function deleteDataG($table, $where) { try { $strSQL = "DELETE FROM {$table} {$where}"; if ($this->arrGPdoDB['PDO_DEBUG']) { echo $strSQL . '<br><br>'; } if ($result = $this->db->exec($strSQL)) { if ($this->arrGPdoDB['PDO_LOGS']) { check::getAPI('logs', 'addLog', "3^{$table}^{$where}^{$strSQL}"); } return $result; } } catch (PDOException $e) { echo 'Failed: ' . $e->getMessage() . '<br><br>'; } }
exit; } else { $strModuleID = strval($_SESSION['wapmod']); include_once '../' . $strModuleID . '/config/var.inc.php'; $objWebInit->setDBG($arrGPdoDB); $objWebInit->db(); $arrLink[] = 'mod=' . $strModuleID; } if ($_SERVER["REQUEST_METHOD"] == "POST") { $_SESSION['keywords'] = strval($_POST['keywords']); } $arrWhere[] = " title like '%" . $_SESSION['keywords'] . "%'"; $strWhere = implode(' AND ', $arrWhere); $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;
unlink($strOldSFile); } if (is_file($strOldBFile)) { unlink($strOldBFile); } if (is_file($strOldMFile)) { unlink($strOldMFile); } //unset($arrUserinfo['thumbnail']); $arrTemp['thumbnail'] = ''; $arrTemp['user_id'] = $arrUserinfo['user_id']; $objWebInit->updateUser($arrTemp); //同步user表 $arrTemp['recommendflag'] = 0; $strTemp = check::getAPIArray($arrTemp); check::getAPI('user', 'updateUser', $strTemp); check::WindowLocation("?action=edit&id=" . $userid . ""); } else { check::AlertExit('删除失败!', -1); } } $arrTemp = array(); foreach ($arrGMeta as $k => $v) { if ($k != 'index') { $arrTemp[$k]['r'] = $v['name']; $arrTemp[$k]['w'] = '写'; $arrTemp[$k]['d'] = '删'; $arrTemp[$k]['x'] = '执行'; } } $arrTemp['siteset']['r'] = '系统设定';
} 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; } } } } // 输出到模板 $arrMOutput["smarty_assign"]['strNav'] = '数据采集器'; $arrMOutput["smarty_assign"]['arrInfo'] = $arrData; $arrMOutput["template_file"] = "admin.html"; $arrMOutput["smarty_assign"]['MAIN'] = $arrGSmarty['admin_main_dir'] . 'tools/fetch/index.htm'; $objWebInit->output($arrMOutput);
/** * 验证用户信息是否存在 * @author 王巍 * @param array $arrData 会员信息数组 * @return array */ public function checkUserPropertyExist($strWhere, $field = 'user_id,user_name') { $result = check::getAPI('mcenter', 'getUserWhere', "{$strWhere}^{$field}"); return $result; }
$strContents = file_get_contents('http://' . $_SERVER['HTTP_HOST'] . '/' . $val['id'] . '/detail.php?id=' . $intID); } if ($strContents) { header("HTTP/1.1 200 OK"); echo $strContents; } $objCache->cache_end(false); } } } check::AlertExit("网站静态页面已全部重新生成 !", -1); } else { if ($_GET['id'] == 'archives') { $arrInfoList = check::getAPI($_GET['id'], "getInfoList", "where 1^^0^0^id,type_title_english^^0"); } else { $arrInfoList = check::getAPI($_GET['id'], "getInfoList", "where pass=1^^0^0^id^^0"); } if (!empty($arrInfoList)) { foreach ($arrInfoList as $v) { if ($_GET['id'] == 'archives') { if (empty($v['type_title_english'])) { continue; } } $intID = $v['id']; if (empty($intID)) { continue; } include_once '../../' . $_GET['id'] . '/config/var.inc.php'; $intNum = ceil($intID / $arrGCache['cache_filenum']); if ($_SESSION['langset'] == 'zh_tw') {
//smarty参数 $objWebInit->arrGSmarty = $arrGSmarty; $objWebInit->db(); //访问权限检查 if (!$objWebInit->checkPopedomG($_SESSION['user_id'], 'r', 'count')) { check::AlertExit('对不起,您没有权限访问此页', -1); } if (!empty($_GET['host'])) { $where = "where 1=1 and host='{$_GET['host']}' and submit_date>='{$_GET['start']}' and submit_date<='{$_GET['end']}'"; if (!empty($_GET['order_id'])) { $where .= " and order_id like '%{$_GET['order_id']}%'"; } if (!empty($_GET['product_name'])) { $where .= " and product_name like '%{$_GET['product_name']}%'"; } $arrData = check::getAPI("order", "getInfoList", "{$where}^order by submit_date desc^^^*"); $total = 0; foreach ($arrData as $da) { if ($da['status'] != 1 && $da['status'] != 3 && $da['status'] != 5 && $da['status'] != 6) { $total += floatval($da['price']) * $da['product_num']; } } $arrMOutput["smarty_assign"]['strNav'] = $_GET['host'] . ' 广告渠道统计'; $arrMOutput["smarty_assign"]['arrData'] = $arrData; $arrMOutput["smarty_assign"]['start'] = $_GET['start']; $arrMOutput["smarty_assign"]['end'] = $_GET['end']; $arrMOutput["smarty_assign"]['host'] = $_GET['host']; $arrMOutput["smarty_assign"]['total'] = $total; $arrMOutput["smarty_assign"]['product_name'] = $_GET['product_name']; $arrMOutput["smarty_assign"]['order_id'] = $_GET['order_id']; $arrMOutput["template_file"] = "admin.html";
$arrData['sex'] = $_POST['sex']; $arrData['user_group'] = $_POST['user_group']; unset($_POST); $objWebInit->saveInfo($arrData, 1, false); check::AlertExit('修改成功!', $arrGWeb['WEB_ROOT_pre'] . '/mcenter/admin/'); } if ($_GET['action'] == 'edit') { $userid = intval($_GET['id']); if (empty($userid)) { check::AlertExit("Submit Error!(userid empty)", 1); } $arrUserinfo = $objWebInit->getUser($userid, '*', '', false); //mcenter,user两张表共有信息已mcenter为准 $strWhere = ' WHERE user_id =' . $userid; $field = 'user_name,password,real_name'; $arrMcInfo = check::getAPI('mcenter', 'getUserWhere', "{$strWhere}^{$field}"); $arrUserinfo = array_merge($arrUserinfo, $arrMcInfo); $arrTemp = array(); foreach ($arrGMeta as $k => $v) { if ($k != 'index') { $arrTemp[$k] = $v['name']; } } //生日转换:年-月-日 $arrBDTemp = explode('-', $arrUserinfo['birthday']); $arrUserinfo['year'] = $arrBDTemp[0]; $arrUserinfo['month'] = $arrBDTemp[1]; $arrUserinfo['day'] = $arrBDTemp[2]; // 输出到模板 $arrMOutput["smarty_assign"]['get'] = $_GET; $arrMOutput["smarty_assign"]['arrData'] = $arrUserinfo;
} //生日转换 $_POST['birthday'] = date('Y-m-d', strtotime($_POST['year'] . '-' . $_POST['month'] . '-' . $_POST['day'])); unset($_POST['year']); unset($_POST['month']); unset($_POST['day']); //会员密码处理 if (!empty($arrGWeb['user_pass_type'])) { $_POST['password'] = check::strEncryption($_POST['password'], $arrGWeb['jamstr']); } $intID = $objWebInit->saveInfo($_POST, 0, false, true); if ($intID) { $arrData['user_id'] = $intID; $arrData['add_date'] = date('Y-m-d H:i:s'); $strData = check::getAPIArray($arrData); check::getAPI('mcenter', 'updateUser', $strData); } else { check::AlertExit('注册失败', -1); } check::WindowLocation($arrGWeb['WEB_ROOT_pre'] . '/mcenter/admin/index.php'); } $arrTemp = array(); foreach ($arrGMeta as $k => $v) { if ($k != 'index') { $arrTemp[$k] = $v['name']; } } // 输出到模板 $arrMOutput["template_file"] = "admin.html"; $arrMOutput["smarty_assign"]['arrGMeta'] = $arrTemp; $arrMOutput["smarty_assign"]['arrMType'] = $arrMType;
} else { check::AlertExit('未知栏目', -1); exit; } //类别ID $arrWhere = array(); $arrLink = array(); $arrWhere[] = "pass='******'"; if (!empty($_GET['type_id'])) { $intTypeID = intval($_GET['type_id']); $arrWhere[] = "type_roue_id like '%:" . $intTypeID . ":%'"; $arrLink[] = 'type_id=' . $intTypeID; } $strWhere = implode(' AND ', $arrWhere); $strWhere = 'where ' . $strWhere; $arrInfoList = check::getAPI($strModuleID, "getInfoList", "{$strWhere}^ ORDER BY topflag DESC,submit_date DESC^0^{$arrGPage['page_size']}^true^^0"); $strDomain = 'http://' . $_SERVER['HTTP_HOST']; $objRss = new UniversalFeedCreator(); $objRss->useCached(); $objRss->title = $arrGMeta[$strModuleID]['meta']['Title'] . 'RSS订阅 -' . $arrGWeb['name']; $objRss->description = $arrGMeta[$strModuleID]['meta']['Description'] . 'RSS订阅 -' . $arrGWeb['name']; $objRss->descriptionTruncSize = 500; $objRss->descriptionHtmlSyndicated = true; $objRss->link = $strDomain . "/" . $strModuleID . '/'; $objRss->syndicationURL = $strDomain . '/' . $_SERVER["PHP_SELF"]; foreach ($arrInfoList as $key => $val) { $objItem = new FeedItem(); $objItem->title = $val['title']; $strDir = ceil($val['id'] / $arrGCache['cache_filenum']); if ($arrGWeb['URL_static']) { if ($arrGWeb['file_static']) {
$arrRoue = array(); foreach ($arrInfoList as $k => $v) { $arrRoue = $objWebInit->getRoueList($v['type_roue_id'], $tourplaType, true); $arrInfoList[$k]['type_roue'] = $arrRoue[2]; } $strFileNameB = __WEB_ROOT . '/data/task/task_type_b.php'; //后台用带├格式化的缓存 $strFileName = __WEB_ROOT . '/data/task/task_type.php'; //排列后的原始数据缓存 eval(menload_file($strFileNameB, $arrGWeb['MEM_CACHE'])); eval(menload_file($strFileName, $arrGWeb['MEM_CACHE'])); require_once __WEB_ROOT . '/task/config/type.inc.php'; $strOrder = ' ORDER BY begin_date asc'; $strTime = date('Y-m-d', time()); $strWhere = " where pass>0 and pass<3 and begin_date > '" . $strTime . "'"; $arrTaskList = check::getAPI('task', 'getInfoList', "{$strWhere}^{$strOrder}^0^10^*^^false"); $arrTaskRoue = array(); foreach ($arrTaskList as $k => $v) { $arrTaskRoue = $objWebInit->getRoueList($v['type_roue_id'], $arrMType, true); $arrTaskList[$k]['type_roue'] = $arrTaskRoue[2]; } //print_r($arrTaskList); $arrMOutput["smarty_assign"]['arrGWeb']['WEB_ROOT_pre'] = 'http://www.5217u.com'; $arrMOutput["smarty_assign"]['strNav'] = '任务活动邮件'; $arrMOutput["smarty_assign"]['arrMTypeF'] = $arrMTypeF; $arrMOutput["smarty_assign"]['arrMType'] = $arrMType; $arrMOutput["smarty_assign"]['arrInfoList'] = $arrInfoList; $arrMOutput["smarty_assign"]['arrTaskList'] = $arrTaskList; //$arrMOutput["template_file"] = "admin.html"; //$arrMOutput["smarty_assign"]['MAIN'] = $arrGSmarty['admin_main_dir'].'email/dingyue.htm'; $arrMOutput['template_file'] = $arrGSmarty['admin_main_dir'] . 'email/dingyue.htm';
foreach ($arrModuleDirs as $k => $v) { if (!empty($v['cache']) && $v['cache'] == 1) { $arrInfoList[$k] = array('name' => $v['name']); if (is_file('../data/' . $k . '/' . $k . '_type.php')) { @(include '../data/' . $k . '/' . $k . '_type.php'); } if (!empty($arrMType)) { foreach ($arrMType as $key => $val) { if (empty($val['type_link'])) { $arrInfoList[$k]['type'][] = array('type_id' => $val['type_id'], 'name' => $val['type_title']); } } } else { $objWebInit->tablename1 = $arrGPdoDB['db_tablepre'] . $k . '_type'; $arrType = check::getAPI($k, "getTypeList", ""); $strType = check::getAPIArray($arrType); $arrMType = check::getAPI($k, "formatTypeList", "0^{$strType}^0"); if (!empty($arrMType)) { foreach ($arrMType as $key => $val) { if (empty($val['type_link'])) { $arrInfoList[$k]['type'][] = array('type_id' => $val['type_id'], 'name' => $val['type_title']); } } } } } } // 输出到模板 $arrMOutput["smarty_assign"]['arrInfoList'] = $arrInfoList; $arrMOutput["smarty_assign"]['MAIN'] = $arrGSmarty['main_dir'] . 'index.html'; $objWebInit->output($arrMOutput);
function count_referer($isSave = 1, $uid = null) { global $arrGWeb; $objShared = System_SharedMemory::factory(); if (empty($strVarName)) { $strVarName = $arrGWeb['install_date'] . 'referer'; } $arrPayLog = json_decode($objShared->get($strVarName), TRUE); if ($isSave == 1) { $arrPayLog[$uid] = 1; } elseif ($isSave == 0) { if (!empty($arrPayLog) && array_key_exists($_SESSION['user_id'], $arrPayLog)) { $host = empty($_COOKIE['referer_host']) ? "5217u.com" : $_COOKIE['referer_host']; $time = date("Y-m-d"); $referer = check::getAPI("referer", "getInfoWhere", "where host='{$host}' and time='{$time}'^*"); if (empty($referer)) { $arr_referer = array(); $arr_referer['time'] = $time; $arr_referer['host'] = $host; $arr_referer['buy_times'] = 1; $str_referer = check::getAPIArray($arr_referer); check::getAPI("referer", "saveInfo", "{$str_referer}^0^0"); } else { $referer['buy_times'] += 1; $str_referer = check::getAPIArray($referer); check::getAPI("referer", "saveInfo", "{$str_referer}^1^0"); } unset($arrPayLog[$_SESSION['user_id']]); } } $objShared->set($strVarName, json_encode($arrPayLog)); return true; }
$intCPage = intval($_GET['cpage']); } if (!empty($_GET['mod'])) { $strModuleID = strval($_GET['mod']); include_once '../' . $strModuleID . '/config/var.inc.php'; $arrLink[] = 'mod=' . $strModuleID; } else { include_once 'include/title.php'; include_once 'include/head.php'; $myText = new HAW_text($arrGWeb['name'] . '欢迎您!'); $objHaw->add_text($myText); include_once 'include/foot.php'; exit; } $intID = intval($_GET['id']); $arrInfo = check::getAPI($strModuleID, "getInfo", "{$intID}^*^1^1"); include_once 'include/title.php'; include_once 'include/head.php'; $myText = new HAW_text("标题:" . $arrInfo['title']); $objHaw->add_text($myText); if (!empty($arrInfo['thumbnail']) && $intCPage == 1) { $strWapPhoto = $arrGPic['FileSavePath'] . 'wap/' . $arrInfo['thumbnail']; if (!is_file($strWapPhoto)) { //生成压缩图 check::make_dir($strWapPhoto); copy($arrGPic['FileSavePath'] . '/b/' . $arrInfo['thumbnail'], $strWapPhoto); $objGDImage = new GDImage(); if ($objGDImage->makePRThumb($strWapPhoto, 0, $arrMHaw['image_width'], $arrMHaw['image_height'])) { $myImage = new HAW_image("photo.wbmp", $arrGPic['FileCallPath'] . 'wap/' . $arrInfo['thumbnail'], $arrInfo['title']); $myImage->set_br(1); $myImage->set_html_width($arrMHaw['image_width']);