public function actionInfo()
 {
     //权限
     parent::_acl();
     //处理修改
     $this->_updateData(reqPost('config'));
     $this->render('info', array('config' => XXcache::loadData('_config')));
 }
Exemple #2
0
 public function actionCreateInner()
 {
     parent::_acl();
     //内页主类
     $innerCatalog = Catalog::model()->findAll("`status_is`='Y' AND `parent_id`='2'");
     //        ppr($innerCatalog,1);
     $page_arr = null;
     if (!empty($innerCatalog)) {
         foreach ($innerCatalog as $pageInfo) {
             $page_arr[$pageInfo->id] = array('name' => $pageInfo->catalog_name, 'path' => $pageInfo->path, 'error' => 0);
             try {
                 if (FALSE === strpos($pageInfo->path, 'http:')) {
                     if (empty($pageInfo->path)) {
                         $page_arr[$pageInfo->id]['error'] = '目录名未填写';
                         continue;
                     }
                     preg_match_all("/\\w+/", $pageInfo->path, $re);
                     if (empty($re[0][0])) {
                         $page_arr[$pageInfo->id]['error'] = '目录名只能是字母数字下划线';
                         continue;
                     }
                     $dir = SITE_PATH . substr($this->_conf['path_inside_page'], 1) . '/' . $re[0][0] . '/';
                     if (!is_dir($dir)) {
                         mkdir($dir);
                         if (!is_writable($dir)) {
                             $page_arr[$pageInfo->id]['error'] = '目录写入失败';
                             continue;
                         }
                     }
                     //                        ppr($pageInfo);ppr($this->_getDataPid($pageInfo->id));
                     $links = $this->_getDataPid($pageInfo->id);
                     //                        ppr($links);
                     //统一内页模板
                     $code = $this->render($this->_conf['theme'] . '/inner', array('info' => $pageInfo, 'links' => $links, 'innerCatalog' => $innerCatalog), 1);
                     $filename_html = $dir . 'index.html';
                     $filename_htm = $dir . 'index.htm';
                     file_put_contents($filename_html, $code, LOCK_EX);
                     file_put_contents($filename_htm, $code, LOCK_EX);
                 } else {
                     $page_arr[$pageInfo->id]['error'] = '已设置' . '<a href=' . $pageInfo->path . ' target="blank">外链</a>';
                 }
             } catch (Exception $exc) {
                 continue;
             }
         }
         return $page_arr;
     }
 }
Exemple #3
0
 /**
  * 首页
  *
  */
 public function actionIndex()
 {
     parent::_acl();
     //过期
     $show = reqGet('show', null);
     $catalogId = intval(reqGet('catalogId', 0));
     $catalogList = $catalogListSub = null;
     //顶级分类
     if ($catalogId > 0) {
         $catalogList = XXcache::_doCatalog($catalogId, $this->_catalog);
         foreach ($this->_catalog as $value) {
             if ($value['id'] == $catalogId) {
                 $value['catalog_name'] = '==' . $value['catalog_name'] . '==';
                 if (empty($catalogList)) {
                     $catalogList = array($value);
                 } else {
                     $catalogList = array_merge(array($value), $catalogList);
                 }
             }
         }
         if (!empty($catalogList)) {
             //非last
             foreach ($catalogList as $value) {
                 $catalogListSub[] = $value['id'];
             }
             //                $catalogListSub = implode(',', $catalogListSub);
         }
     } else {
         //全部有效分类
         if (!empty($this->_catalog)) {
             //非last
             foreach ($this->_catalog as $value) {
                 $catalogListSub[] = $value['id'];
             }
         }
     }
     $catalogList = $this->_catalog;
     $model = new Links();
     $criteria = new CDbCriteria();
     $condition = '1';
     $keyword = trim(reqGet('keyword'));
     $search_type = trim(reqGet('search_type'));
     $keyword && $search_type && ($condition .= ' AND ' . $search_type . ' LIKE \'%' . $keyword . '%\'');
     if ($show) {
         $theTime = time();
         //有效但过期
         if ($show == 'past') {
             $condition .= " AND t.status_is = 'Y' AND begin_time>0 AND end_time>0 AND (`begin_time` > '{$theTime}' OR `end_time` < '{$theTime}')";
         }
         //无效
         if ($show == 'status_n') {
             $condition .= " AND t.status_is = 'N' ";
         }
     }
     if (!empty($catalogListSub)) {
         $temp = null;
         foreach ($catalogListSub as $value) {
             $temp[] = "`catalog_id` = '{$value}'";
         }
         $condition .= ' AND (' . implode(' OR ', $temp) . ')';
         //            $condition .= ' AND `catalog_id` IN ('.$catalogListSub.')';
     } else {
         $catalogId && ($condition .= ' AND `catalog_id`= ' . $catalogId);
     }
     $criteria->condition = $condition;
     $criteria->order = 't.catalog_id ASC,t.status_is ASC,t.sort_order ASC';
     $criteria->with = array('catalog', 'user');
     $count = $model->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = 15;
     $pageParams = XUtils::buildCondition($_GET, array('title', 'catalogId', 'search_type', 'keyword', 'show', 'r'));
     $pages->params = is_array($pageParams) ? $pageParams : array();
     $criteria->limit = $pages->pageSize;
     $criteria->offset = $pages->currentPage * $pages->pageSize;
     $result = $model->findAll($criteria);
     //        ppr($result);
     $this->render('index', array('datalist' => $result, 'pagebar' => $pages, 'pagecount' => $count, 'catalogList' => $catalogList, 'catalogId' => $catalogId, 'keyword' => $keyword, 'search_type' => $search_type));
 }
Exemple #4
0
 /**
  * 管理员组删除
  *
  * @param  $id
  */
 public function actionGroupDelete($id)
 {
     parent::_acl();
     //        ppr($_REQUEST,1);
     if (!empty($id)) {
         $id = intval($id);
         $model = Admin::model()->deleteAll('group_id=:gid', array(':gid' => $id));
         //group_id
         $groupInfo = AdminGroup::model()->findByPk($id);
         $name = $groupInfo->group_name;
         $model = AdminGroup::model()->deleteByPk($id);
         //            ppr($groupInfo,1);
         parent::_backendLogger(array('catalog' => 'delete', 'intro' => '删除用户组 ' . $name . '(' . $id . ') 及该用户组所有用户'));
         $result = XXcache::get('_adminGroup');
         XUtils::message('success', '已删除分类 ' . $name . ' 及该分类所有链接');
     }
     $this->redirect(Yii::app()->request->urlReferrer);
 }
 public function actionDelete()
 {
     parent::_acl();
     $catalogId = reqGet('catalogId', null);
     //        ppr($_REQUEST,1);
     if (!empty($catalogId)) {
         $catalogId = intval($catalogId);
         $model = Catalog::model()->findByPk($catalogId);
         $name = $model->catalog_name;
         $model->delete();
         XXcache::refresh('_catalog');
         XXcache::refresh('_catalogAll');
         $model = Links::model()->deleteAll('catalog_id=:cid', array(':cid' => $catalogId));
         parent::_backendLogger(array('catalog' => 'delete', 'intro' => '删除分类 ' . $name . '(' . $catalogId . ') 及该分类所有链接'));
         XUtils::message('success', '已删除分类 ' . $name . ' 及该分类所有链接');
     }
     $this->redirect(Yii::app()->request->urlReferrer);
 }