public function getleftmenu()
 {
     if (IS_AJAX) {
         $gid = I('post.gid');
         $controllermod = DD('AdminAuthController');
         $controllerlist = $controllermod->selbygid($gid);
         $ctl_arr = array();
         foreach ($controllerlist as $key => $li) {
             $ctl_arr[$li['id']] = $li;
         }
         $actionmod = DD('AdminAuthAction');
         $actionlist = $actionmod->selbygid($gid, 1);
         $ac_arr = array();
         foreach ($actionlist as $key => $ac) {
             $ac['url'] = URL($ac['group'] . '/' . $ac['controller'] . '/' . $ac['action'], '', $ac['app']);
             $ac_arr[$ac['cid']][] = $ac;
         }
         $menu = array();
         foreach ($ctl_arr as $key => $ca) {
             $ca['child'] = $ac_arr[$key];
             $menu[] = $ca;
         }
         echo json_encode($menu);
     }
 }
 public function del()
 {
     $data = I('get.');
     $gb = DD('Guestbook');
     $result = $gb->del($data['id']);
     $this->redirect('index');
 }
Exemplo n.º 3
0
 public function update()
 {
     $id = I('get.id');
     $FriendLink = DD('FriendLink');
     $link = $FriendLink->selectbyid($id);
     if (IS_POST) {
         $data = I('post.');
         if ($_FILES) {
             if ($_FILES['image']['error'] == 0) {
                 $upload = new \Think\Upload();
                 $upload->maxSize = 3292200;
                 $upload->allowExts = explode(',', 'jpg,gif,png,jpeg');
                 $upload->savePath = 'link/';
                 $info = $upload->upload();
                 if (!$info) {
                     $this->error($upload->getError());
                 } else {
                     $up_root = str_replace('./', '', $upload->rootPath);
                     $data['image_url'] = $up_root . $info['image']['savepath'] . $info['image']['savename'];
                     @unlink($result['image_url']);
                 }
             }
         }
         $result = $FriendLink->update($id, $data);
         if ($result) {
             $this->success('修改成功');
         } else {
             $this->error('发生错误,请重试');
         }
     } else {
         $this->assign('link', $link);
         $this->display();
     }
 }
Exemplo n.º 4
0
 public function allcate()
 {
     $Category = DD('Category');
     $catelist = $Category->select();
     $Category_arr = \Org\Helper\Unlimitedclass::cateresult($catelist);
     $this->assign('Category_arr', $Category_arr);
     $this->display('Widget:allcate');
 }
 public function page()
 {
     $cateinfo = $this->_getcate();
     $pagemod = DD('Page');
     $pageinfo = $pagemod->findbycid(I('get.cid'));
     $this->_assign($pageinfo);
     $this->display($cateinfo['pagetmpl']);
 }
Exemplo n.º 6
0
 public static function getcate()
 {
     $Category = DD('Category');
     $result = $Category->selectall($_COOKIE['langid']);
     Vendor('Unlimitedclass.Unlimitedclass', '', '.class.php');
     $unlimitedclass = new \Unlimitedclass();
     $Category_arr = $unlimitedclass->cateresult($result);
 }
 private function _getModelname($data)
 {
     $model = DD('Model');
     $modelinfo = $model->findByID($data['mid']);
     if (in_array($data['type'], $this->text_arr)) {
         return C('DB_PREFIX') . $modelinfo['table'] . '_data';
     }
     return C('DB_PREFIX') . $modelinfo['table'];
 }
Exemplo n.º 8
0
 public function allcate()
 {
     $Category = DD('Category');
     $catelist = $Category->select();
     Vendor('Unlimitedclass.Unlimitedclass', '', '.class.php');
     $unlimitedclass = new \Unlimitedclass();
     $Category_arr = $unlimitedclass->cateresult($catelist);
     $this->assign('Category_arr', $Category_arr);
     $this->display('Widget:allcate');
 }
 private function _nowpermissions()
 {
     $actionmod = DD('AdminAuthAction');
     $actioninfo = $actionmod->findbyGMA(MODULE_NAME, CONTROLLER_NAME, ACTION_NAME);
     if ($actioninfo) {
         $this->assign('group_id', $actioninfo['gid']);
         $this->assign('controller_id', $actioninfo['cid']);
         $this->assign('action_id', $actioninfo['id']);
     }
 }
Exemplo n.º 10
0
 private function update($keyvalue, $value)
 {
     $set = DD('WebConfig');
     foreach ($keyvalue as $key => $k) {
         $condition = array();
         $condition['code'] = $k;
         $data = array();
         $data['value'] = $value[$key];
         $result = $set->update($condition, $data);
     }
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     try {
         /** @var \Illuminate\Http\Response $response */
         $response = $next($request);
     } catch (\Exception $e) {
         //literally no idea what to do here (or if even needed / appropriate etc)
         DD($e->getMessage());
     }
     return $this->injectBubble($request, $response);
 }
 public function del()
 {
     $p = DD('Position');
     $id = I('get.id', 'intval');
     $res = $p->del($id);
     if ($res) {
         $this->success("删除成功");
     } else {
         $this->error('删除失败');
     }
 }
Exemplo n.º 13
0
 public function articleinfo($id = '')
 {
     if (!$id) {
         $id = I('get.id');
     }
     $info = S('info_' . $id);
     if (!$info) {
         $articlemod = DD('Article');
         $info = $articlemod->selectbyid($id);
         S('info_' . $id, $info);
     }
     return $info;
 }
 public function index()
 {
     if (IS_POST) {
         $guestbookmod = DD('Guestbook');
         $t = $guestbookmod->addguest();
         if ($t) {
             $this->success('留言成功');
         } else {
             $this->error('发生错误 ' . $guestbookmod->getError());
         }
     } else {
         $this->display();
     }
 }
Exemplo n.º 15
0
 public function Photoinfo($id = '')
 {
     if (!$id) {
         $id = I('get.id');
     }
     $info = S('info_' . $id);
     if (!$info) {
         $Photomod = DD('Photo');
         $PhotoData = DD('PhotoData');
         $info = $Photomod->findbyid($id);
         $info['photodata'] = $PhotoData->selectbypid($id);
         S('info_' . $id, $info);
     }
     return $info;
 }
Exemplo n.º 16
0
 public static function menu()
 {
     $authgroup = DD('AdminAuthGroup');
     $AuthController = DD('AdminAuthController');
     $Authaction = DD('AdminAuthAction');
     $menu = array();
     $authgrouplist = $authgroup->order('sort')->select();
     foreach ($authgrouplist as $key => $g) {
         $menu[$key] = $g;
         $Clist = $AuthController->selbygid($g['id']);
         $menu[$key]['clist'] = $Clist;
         foreach ($Clist as $ck => $c) {
             $alist = $Authaction->selbycid($c['id'], 1);
             $menu[$key]['clist'][$ck]['alist'] = $alist;
         }
     }
     return $menu;
 }
Exemplo n.º 17
0
 public function login()
 {
     if (IS_POST) {
         $verify = new \Think\Verify();
         if (!$verify->check(I('post.code'))) {
             $this->error(L('VERIFY_ERR'));
         }
         $pwd = I('post.pwd');
         $adminModel = DD('Admin');
         $admininfo = $adminModel->findbyname();
         if (!$admininfo) {
             $this->error(L('ACCOUNT_FAILE'));
         }
         if ($admininfo['pwd'] == \cusMd5($pwd, C('PWD_TOKEN'))) {
             unset($admininfo['pwd']);
             session('Dream_admin', $admininfo);
             $this->redirect('Index/Index/index');
         } else {
             $this->error(L('ACCOUNT_FAILE'));
         }
     } else {
         $this->display();
     }
 }
Exemplo n.º 18
0
 /**
  * modulelist id做键值
  * @return type
  */
 public static function modulelist()
 {
     $modulelist = S('modulelist');
     if (!$modulelist) {
         $mod = DD('Module');
         $modulelist = $mod->selectall();
         $newmodlist = array();
         foreach ($modulelist as $key => $val) {
             $newmodlist[$val['id']] = $val;
         }
         S('modulelist', $newmodlist);
     }
     return $modulelist;
 }
Exemplo n.º 19
0
 public function delad()
 {
     $AdList = DD('AdList');
     $res = $AdList->selbyid(I('get.id'));
     $result = $AdList->delad(I('get.id'));
     if ($result) {
         if ($res['img']) {
             @unlink($res['img']);
         }
         $this->redirect('adlist');
     } else {
         $this->error('删除错误');
     }
 }
Exemplo n.º 20
0
 private function _catecommon()
 {
     /* 模型 */
     $Model = DD('Model');
     $Modellist = $Model->select();
     $this->assign('Modellist', $Modellist);
     /* 分类 */
     $Category = DD('Category');
     $result = $Category->select();
     $Category_arr = \Org\Helper\Unlimitedclass::cateresult($result);
     $this->assign('category', $Category_arr);
     /* 模板 */
     $dir = 'Template/Site/' . C('SITE_THEME') . '/Content/Content';
     $listtmpl = array();
     $catetmpl = array();
     $newstmpl = array();
     $pagetmpl = array();
     $files = getfils($dir);
     foreach ($files as $f) {
         if (strpos(strtolower($f), 'category') === 0) {
             $f_arr = explode('.', $f);
             $catetmpl[] = $f_arr[0];
             continue;
         }
         if (strpos(strtolower($f), 'list') === 0) {
             $f_arr = explode('.', $f);
             $listtmpl[] = $f_arr[0];
             continue;
         }
         if (strpos(strtolower($f), 'news') === 0) {
             $f_arr = explode('.', $f);
             $newstmpl[] = $f_arr[0];
             continue;
         }
         if (strpos(strtolower($f), 'page') === 0) {
             $f_arr = explode('.', $f);
             $pagetmpl[] = $f_arr[0];
             continue;
         }
     }
     $this->assign('tmpl', array('catetmpl' => $catetmpl, 'listtmpl' => $listtmpl, 'newstmpl' => $newstmpl, 'pagetmpl' => $pagetmpl));
 }
Exemplo n.º 21
0
 /**
  * 删除管理员
  */
 public function deladmin()
 {
     $id = I('get.id');
     if ($this->LoginAdminInfo['id'] != $id) {
         $adminMod = DD('Admin');
         $b = $adminMod->delById($id);
         if (!b) {
             $this->error(L('OP_ERROR'));
         }
         $this->redirect('Auth/Admin/index');
     }
     $this->error(L('CANNOT_DEL_MY'));
 }
Exemplo n.º 22
0
 /**
  * 删除模型
  */
 public function delmodel()
 {
     $id = I('get.id');
     $mod = DD('Model');
     $fieldmod = DD('ModelField');
     $modinfo = $mod->findByID($id);
     $fields = $fieldmod->selFieldByMid($id);
     if ($modinfo['issys'] != 1) {
         $mod->startTrans();
         //删除字段
         $delfield = $fieldmod->delByMid($id);
         //删除模型数据
         $delmod = $mod->delByID($id);
         //删除表
         $deltable = $mod->dropTbl($modinfo['table']);
         if ($delfield && $delmod && $deltable) {
             //删除语言
             $setLang = new \Org\Helper\SetLang('Content/modelfield', true);
             $lang = array();
             foreach ($fields as $v) {
                 if ($v['issys'] == 1) {
                     continue;
                 }
                 $lang[] = $v['langconf'];
             }
             $setLang->delAllLang($lang);
             $setLang->setLangFilePath('Content/model', true);
             $setLang->delOneLang('MDL_' . strtoupper($modinfo['table']));
             $mod->commit();
             //事务提交
             $this->redirect('Content/Model/index');
         } else {
             $mod->rollback();
             $this->error('OP_ERROR');
         }
     }
 }
Exemplo n.º 23
0
function samechildcate($cid)
{
    $arr = getmenu($cid);
    if (!$arr) {
        $catemod = DD('Category');
        $info = $catemod->selectF($cid);
        $arr = getmenu($info['pid']);
    }
    return $arr;
}
Exemplo n.º 24
0
 public static function getcate()
 {
     $Category = DD('Category');
     $result = $Category->select();
     $Category_arr = \Org\Helper\Unlimitedclass::cateresult($result);
 }
Exemplo n.º 25
0
 /**
  * 获取插件配置
  */
 public function getconfigure()
 {
     if (IS_AJAX) {
         //插件编号
         $pid = I('post.pid');
         //获取前台插件
         $PluginListMod = DD('PluginList');
         $siteplugin = $PluginListMod->selByTypePid(1, $pid);
         //前台资源
         foreach ($siteplugin as $k => $sp) {
             $siteplugin[$k]['js'] = explode(',', $sp['js']);
             $siteplugin[$k]['css'] = explode(',', $sp['css']);
         }
         //获取后台插件
         $adminplugin = $PluginListMod->selByTypePid(2, $pid);
         //后台资源
         foreach ($adminplugin as $k => $ap) {
             $adminplugin[$k]['js'] = explode(',', $ap['js']);
             $adminplugin[$k]['css'] = explode(',', $ap['css']);
         }
         //获取视图钩子
         $hooklistMod = DD('HookList');
         $vhooklist = $hooklistMod->selbyPidType($pid, 1);
         foreach ($vhooklist as $k => $vh) {
             $vhooklist[$k]['js'] = explode(',', $vh['js']);
             $vhooklist[$k]['css'] = explode(',', $vh['css']);
         }
         //获取业务钩子
         $bhooklist = $hooklistMod->selbyPidType($pid, 2);
         foreach ($bhooklist as $k => $vh) {
             $bhooklist[$k]['js'] = explode(',', $vh['js']);
             $bhooklist[$k]['css'] = explode(',', $vh['css']);
         }
         $config = array('siteplugin' => $siteplugin, 'adminplugin' => $adminplugin, 'vhooklist' => $vhooklist, 'bhooklist' => $bhooklist);
         echo json_encode($config);
     }
 }
Exemplo n.º 26
0
 public static function cate()
 {
     if (I('get.cid')) {
         $category = DD('Category');
         $cateinfo = $category->findbyid(I('get.cid'));
         return $catefield = '<lable>' . $cateinfo['title'] . '</lable>' . "<input type=hidden name='" . self::$_fieldrow['fieldname'] . "' id='" . self::$_fieldrow['fieldname'] . "' value='" . $cateinfo['id'] . "' />";
     }
 }
 /**
  * 删除内容
  */
 public function delete()
 {
     $cid = I('get.cid');
     $id = I('get.id');
     //栏目
     $catemod = DD('Category');
     $cateinfo = $catemod->find($cid);
     //模型
     $modelMod = DD('Model');
     $modelinfo = $modelMod->findByID($cateinfo['mid']);
     //删除主表
     $contentmod = DD('Content', array($modelinfo['table']));
     $contentmod->startTrans();
     $contentDel = $contentmod->delcontent($id);
     //删除附表
     $contentdatamod = DD('ContentData', array($modelinfo['table'] . '_data'));
     $contentdataDel = $contentdatamod->delcontent($id);
     if ($contentDel && $contentdataDel) {
         $contentmod->commit();
         $this->redirect('Content/Content/contentlist', array('mid' => $cateinfo['mid'], 'cid' => $cid));
     } else {
         $contentmod->rollback();
         $this->success(L('OP_ERROR'));
     }
 }
 private function _catecommon()
 {
     /* 模型 */
     $Model = DD('Model');
     $Modellist = $Model->selectall($this->OpSiteLangInfo['id']);
     $this->assign('Modellist', $Modellist);
     /* 分类 */
     $Category = DD('Category');
     $result = $Category->selectall($this->OpSiteLangInfo['id']);
     Vendor('Unlimitedclass.Unlimitedclass', '', '.class.php');
     $unlimitedclass = new \Unlimitedclass();
     $Category_arr = $unlimitedclass->cateresult($result);
     $this->assign('category', $Category_arr);
     /* 模板 */
     $dir = 'Template/Site/' . $this->OpSiteLangInfo['tmpl'] . '/Content/Content';
     $listtmpl = array();
     $catetmpl = array();
     $newstmpl = array();
     $pagetmpl = array();
     $files = getfils($dir);
     foreach ($files as $f) {
         if (strpos(strtolower($f), 'category') === 0) {
             $f_arr = explode('.', $f);
             $catetmpl[] = $f_arr[0];
             continue;
         }
         if (strpos(strtolower($f), 'list') === 0) {
             $f_arr = explode('.', $f);
             $listtmpl[] = $f_arr[0];
             continue;
         }
         if (strpos(strtolower($f), 'news') === 0) {
             $f_arr = explode('.', $f);
             $newstmpl[] = $f_arr[0];
             continue;
         }
         if (strpos(strtolower($f), 'page') === 0) {
             $f_arr = explode('.', $f);
             $pagetmpl[] = $f_arr[0];
             continue;
         }
     }
     $this->assign('tmpl', array('catetmpl' => $catetmpl, 'listtmpl' => $listtmpl, 'newstmpl' => $newstmpl, 'pagetmpl' => $pagetmpl));
 }
Exemplo n.º 29
0
 public function startcollection()
 {
     //参数
     //采集ID
     $cid = I('get.cid');
     //采集类型 0 采集所有 1 按页数采集
     $ctype = I('get.ctype');
     //开始页数
     $sp = I('get.sp', 1, 'intval');
     //停止页数
     $tp = I('get.tp');
     //当前采集的页数
     $page = I('get.page', 1, 'intval');
     //按页数采集
     $blagStop = false;
     if ($ctype == 1) {
         if ($tp && $tp <= $page) {
             $blagStop = TRUE;
         }
     }
     //开始采集
     //获取采集规则详情
     $PlgCollection = D('PlgCollection');
     $colInfo = $PlgCollection->find($cid);
     $listRule = json_decode($colInfo['listrule']);
     $listurl = str_replace('{$page}', $page, $listRule->listurl);
     $urlInfo = parse_url($listurl);
     //解析列表
     Vendor('phpQuery.phpQuery', '', '.class.php');
     \phpQuery::newDocumentFile($listurl);
     $artlist = pq($listRule->listobj);
     foreach ($artlist as $li) {
         //获取详情页地址
         $pageurl = pq($li)->attr($listRule->listattr);
         if (strpos('http', $pageurl) === FALSE) {
             $pageurl = $urlInfo['scheme'] . '://' . $urlInfo['host'] . $pageurl;
         }
         //采集内容
         \phpQuery::newDocumentFile($pageurl);
         $cateArr = explode(',', $colInfo['cate']);
         $mid = $cateArr[1];
         //模型
         $ModelField = DD('ModelField');
         $fieldlist = $ModelField->selFieldByMid($mid);
         //模型中所有字段
         $pagerule = json_decode($colInfo['pagerule'], true);
         foreach ($fieldlist as $key => $f) {
             if (isset($pagerule[$f['fieldname']])) {
                 $rulePageJson = $pagerule[$f['fieldname']];
                 $rulePageObj = json_decode($rulePageJson);
                 if ($rulePageObj->type == 0) {
                     $artlist = pq($rulePageObj->obj);
                     dump($this->_TxtToUtf8(I('post.langcode'), $artlist->text()));
                     die;
                 }
             }
         }
     }
     if ($blagStop === true) {
         //停止采集
     } else {
         //跳转到下一页开始采集
         $param = array('cid' => $cid, 'ctype' => $ctype, 'sp' => $sp, 'tp' => $tp, 'page' => $page + 1);
         //$this->redirect('Collection/Admin/startcollection', $param);
     }
     $this->display();
 }
Exemplo n.º 30
0
 /**
  * 快速获取单页面内容 只支持一个
  * @param int $cid 分类ID
  * @return array
  */
 public static function SINGLEPAGE($cid, $cache = 3600)
 {
     $info = self::QCREADCACHE('SINGLEPAGE_' . $cid);
     if (!$info) {
         $Page = DD('Page');
         $info = $Page->findbycid($cid);
         self::QCWRITECACHE('SINGLEPAGE_' . $cid, $info);
     }
     return $info;
 }