function area($level, $is_json = 0) { if (isset($_REQUEST['pid'])) { $pid = intval($_REQUEST['pid']); } if ($level == 1) { $province = Module('area')->province(); if ($is_json) { echo json_encode($province); exit; } } elseif ($level == 2) { $city = Module('area')->city($pid); if ($is_json) { echo json_encode($city); exit; } } elseif ($level == 3) { $district = Module('area')->district($pid); if ($is_json) { echo json_encode($district); exit; } } }
function area($level) { if (isset($_REQUEST['pid'])) { $pid = intval($_REQUEST['pid']); } if ($level == 1) { echo Module('area')->province(); exit; } elseif ($level == 2) { echo Module('area')->city($pid); exit; } elseif ($level == 3) { echo Module('area')->district($pid); } }
_paging($_pid, 2); $_tpl->assign('page_num', $page_num); $_tpl->assign('article_list', $_article); $_tpl->assign('article', $_article[0]); if (isset($_GET['d']) && is_numeric($_GET['d'])) { $pos = _query("SELECT id,pid,title FROM tg_article where pid=" . $_pid); $pos_arr = array(); $_all_id = array(); while (!!($_rows = _fetch_list($pos))) { array_push($pos_arr, $_rows); array_push($_all_id, $_rows['id']); } $_index = array_keys($_all_id, $_GET['d']); $_index = $_index[0]; $str = "m=" . $_mid . '&p=' . $_pid; if (count($_all_id) > 1) { if ($_index == 0) { $other = "<h3>下一篇:<a href='article.php?" . $str . "&d=" . $pos_arr[$_index + 1]['id'] . "'>" . $pos_arr[$_index + 1]['title'] . "</a></h3>"; } else { if ($_index == count($_all_id) - 1) { $other = "<h3>上一篇:<a href='article.php?" . $str . "&d=" . $pos_arr[$_index - 1]['id'] . "'>" . $pos_arr[$_index - 1]['title'] . "</a></h3>"; } else { $other = "<h3>上一篇:<a href='article.php?" . $str . "&d=" . $pos_arr[$_index - 1]['id'] . "'>" . $pos_arr[$_index - 1]['title'] . "</a></h3>"; $other .= "<h3>下一篇:<a href='article.php?" . $str . "&d=" . $pos_arr[$_index + 1]['id'] . "'>" . $pos_arr[$_index + 1]['title'] . "</a></h3>"; } } } $_tpl->assign('other', $other); } Module();
public function content($method) { if ($method == 'manage') { if (!isset($_REQUEST['cid'])) { $this->chose_category('manage'); } else { $category = model('category')->where('cid', intval($_GET['cid']))->getOne(); if (empty($category)) { $var = array('error', '你选择的栏目不存在', '页面正在返回中,请稍后。。。', array('Content/content/manage' => '返回选择栏目'), 'Content/content/manage'); redirect(Router::url('Content/content/manage'), 2); controller('Admin', 'show_message', $var); exit; } else { Module('content')->showManage($_GET['cid']); } } } else { if ($method == 'add') { $cid = isset($_REQUEST['cid']) ? $_REQUEST['cid'] : 0; if ($cid > 0) { $this->add_content($_REQUEST['cid']); } else { $this->chose_category('add'); } } else { if ($method == 'edit') { $cid = isset($_REQUEST['cid']) ? intval($_REQUEST['cid']) : false; $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : false; if ($cid && $id) { $this->edit_content($cid, $id); } else { exit('请求参数不完整!'); } } else { if ($method == 'editListorder') { if (isset($_POST['cid']) && isset($_POST['id']) && isset($_POST['listorder'])) { $category = model('category')->where('cid', intval($_POST['cid']))->getOne('contable'); if (model($category['contable'])->where('id', intval($_POST['id']))->update(array('listorder' => intval($_POST['listorder'])))) { $status = array('status' => true, 'msg' => '修改成功!'); } else { $status = array('status' => false, 'msg' => '出现未知错误!'); } } else { $status = array('status' => false, 'msg' => '传入的参数不完整!'); } echo json_encode($status); exit; } else { if ($method == 'del') { if (isset($_POST['cid']) && isset($_POST['id'])) { $aid = explode(',', $_POST['id']); if ($aid[0] == '') { $status = array('status' => false, 'msg' => '没有选择内容,请选择后再删除!'); echo json_encode($status); exit; } foreach ($aid as $id) { if (!empty($id)) { $id = intval($id); $category = model('category')->where('cid', intval($_POST['cid']))->getOne('contable'); if (model($category['contable'])->where('id', $id)->delete()) { $status = array('status' => true, 'msg' => '删除成功!'); } else { $status = array('status' => false, 'msg' => '出现未知错误!'); break; } } } } else { $status = array('status' => false, 'msg' => '传入的参数不完整!'); } echo json_encode($status); exit; } } } } } }
public function content($method = 'category', $cid = false, $id = false) { $data['SEO'] = $this->load->template()->var['SEO']; if ($method == 'category' || $method == 'page') { if ($cid == false) { header('HTTP/1.1 404 Not Found'); header("status: 404 Not Found"); echo '<script type="text/javascript" src="http://www.qq.com/404/search_children.js" charset="utf-8" homePageUrl="/index.php" homePageName="回到' . $this->setting['title'] . '"></script>'; exit; } else { $category = module('content')->category($cid); if (!$category) { header('HTTP/1.1 404 Not Found'); header("status: 404 Not Found"); echo '<script type="text/javascript" src="http://www.qq.com/404/search_children.js" charset="utf-8" homePageUrl="/index.php" homePageName="回到' . $this->setting['title'] . '"></script>'; exit; } $data['SEO']['title'] = $category['catname'] . '_' . $this->load->template()->var['SEO']['title']; if (isset($category['keywords'])) { $data['SEO']['keywords'] = $category['keywords'] . ',' . $this->load->template()->var['SEO']['keywords']; } $data['category'] = $category; $data['cid'] = $category['cid']; foreach ($category as $key => $value) { $data[$key] = $value; } //----开始编译并且设置缓存 //echo $this->cacheKey?$cid.$this->cacheKey:$this->cacheKey; if ($this->cacheKey) { view($category['view'], $data, Config::cms('view_cache_time'), $cid . $this->cacheKey); } else { view($category['view'], $data); } } } elseif ($method == 'show') { if ($cid == false || $id == false) { header('HTTP/1.1 404 Not Found'); header("status: 404 Not Found"); exit; } else { $category = module('content')->category($cid); $content = module('content')->content($cid, $id); if (!$category || !$content) { header('HTTP/1.1 404 Not Found'); header("status: 404 Not Found"); echo '<script type="text/javascript" src="http://www.qq.com/404/search_children.js" charset="utf-8" homePageUrl="/index.php" homePageName="回到' . $this->setting['title'] . '"></script>'; exit; } $data['SEO']['title'] = $content['title'] . '-' . $category['catname'] . '_' . $this->load->template()->var['SEO']['title']; if (isset($content['keywords'])) { $data['SEO']['keywords'] = $content['keywords'] . ',' . $this->load->template()->var['SEO']['keywords']; } $data['category'] = $category; foreach ($content as $key => $value) { $data[$key] = $value; } $data['id'] = $content['id']; $data['cid'] = $category['cid']; $data['previous'] = Module('content')->previousContent($cid, $id); $data['next'] = Module('content')->nextContent($cid, $id); //----开始编译并且设置缓存 if ($this->cacheKey) { view($content['template'], $data, Config::cms('view_cache_time'), $cid . '-' . $id . $this->cacheKey); } else { view($content['template'], $data); } } } else { header('HTTP/1.1 404 Not Found'); header("status: 404 Not Found"); echo '<script type="text/javascript" src="http://www.qq.com/404/search_children.js" charset="utf-8" homePageUrl="/index.php" homePageName="回到我的主页"></script>'; exit; } }
public function manage($action = false, $method = false) { if ($action == 'field' && isset($_GET['mid']) && !empty($_GET['mid'])) { $module = model('model')->where('modelid', intval($_GET['mid']))->select()->query(); if (empty($module)) { exit; } $data['module'] = $module[0]; if ($method == 'add' || $method == 'edit') { if (isset($_POST['name'])) { if ($method == 'add') { module('admin')->addField(intval($_GET['mid']), $_POST); } if ($method == 'edit') { module('admin')->editField(intval($_GET['fid']), $_POST); } } else { $regexp = model('regexp')->select()->query(); $data['regexp'] = $regexp; if (isset($_GET['fid'])) { $field = model('model_field')->where('fieldid', intval($_GET['fid']))->getOne(); $data['field'] = model('model_field')->parseSetting($field); $data['field'] = model()->addslashes($data['field']); //print_r($data); } $data['method'] = $method; view('Module/field_add', $data); } } elseif ($method == 'del') { //echo 'aaa'; if (isset($_POST['id'])) { Module('admin')->delField($_POST['id']); } } else { //$field=model('model_field')->where('modelid',intval($_GET['mid']))->select()->query(); //$data['field']=$field; //print_r($data); view('Module/field_manage', $data); } return; } if (isset($_POST) && !empty($_POST)) { if ($action == 'add') { if (isset($_POST['tablename']) && isset($_POST['name'])) { module('admin')->addModule($_POST); } } elseif ($action == 'del') { if (isset($_POST['id'])) { module('admin')->delModule($_POST['id']); } } elseif ($action == 'edit') { if (isset($_POST['id'])) { module('admin')->editModule($_POST); } } } else { $module = model('model')->select()->query(); $data['module'] = $module; view('Module/manage', $data); } }
/** * 退出登录 * 会调用模板 Member/logout */ public function logout() { if ($this->data['user'] != false) { Module('member')->logout(); } $message = array('title' => '退出成功', 'content' => '退出成功了,正在跳回首页,请稍等。。。'); show_message($message, 'success', $_SERVER['SCRIPT_NAME']); }
?> "></a> </div> <?php } } ?> <div class="clear"></div> </div> </div> <div class="quick5"> <div class="head" style="border-bottom: 2px solid #ed589c;padding-bottom:6px;"><img src="<?php echo $this->var['view_vars']['img_path']; ?> jmxx.png" alt=""><b><a href="<?php $cat = Module('content')->category(23); if (!empty($cat)) { echo $cat['url']; } unset($cat); ?> ">加盟信息</a> </b> Quick Navgation</div> <div class="con"> <ul> <?php $data = CLBC(23, 4); ?> <?php if (is_array($data)) { foreach ($data as $con) { ?>
/** * Deletes a particular model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id the ID of the model to be deleted */ public function actionDelete($id) { if (Yii::app()->request->isPostRequest) { // we only allow deletion via POST request if (($id = $this->get('id', null)) !== null) { $ids = is_numeric($id) ? array($id) : explode(',', $id); // delete one or multiple objects given the list of object IDs $result = $this->api('Admin.Module.delete', array('ids' => $ids)); if (errorHandler()->getException() == null) { // only redirect user to the admin page if it is not an AJAX request if (!Yii::app()->request->isAjaxRequest) { $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin')); } else { echo CJavaScript::encode(array('msg' => Yii::t('Xpress.Common', 'Items are deleted successfully.'))); } } else { // redirecting with error carried to the redirected page if (!Yii::app()->request->isAjaxRequest) { Module()->setFlashErrors(errorHander()->getErrors()); $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin')); } else { echo errorHandler()->getException()->message; } } } else { throw new CHttpException(400, Yii::t('Xpress.Common', 'Cannot delete item with the given ID.')); } } else { throw new CHttpException(400, Yii::t('Xpress.Common', 'Invalid request. Please do not repeat this request again.')); } }
/** * 按栏目搜索内容 * @param int $cid 栏目ID * @param string $keywords 要搜索的关键字 * @param int $num 每页展示的条数 * @param int $page 当前页面的页数 * @param bool $reutrnpage 展示的分页结构类型 * @return array 返回获取到的内容数据 */ function SCBC($cid, $keywords = '', $num = 10, $page = 1, $reutrnpage = false, $field = array()) { return Module('content')->SearchByCategory($cid, $keywords, $num, $page, $reutrnpage, $field); }