コード例 #1
0
ファイル: sms.php プロジェクト: djqhuan/CSCMS-v4.0-UTF8
 public function lists()
 {
     $page = intval($this->input->get('page', TRUE));
     if ($page == 0) {
         $page = 1;
     }
     $strs = $this->smstel->lists(12, $page);
     if (!empty($strs)) {
         $arr = unarraystring($strs);
         $data['lists'] = $arr['lists'];
         $data['pagejs'] = $arr['pagejs'];
         $data['nums'] = $arr['nums'];
         $data['page'] = $page;
         $data['pages'] = get_admin_page(site_url('sms/lists') . '?', $arr['pagejs'], $page);
     } else {
         $data['lists'] = array();
         $data['pagejs'] = 0;
         $data['nums'] = 0;
         $data['page'] = $page;
         $data['pages'] = 0;
     }
     $this->load->view('sms_list.html', $data);
 }
コード例 #2
0
ファイル: collect.php プロジェクト: djqhuan/CSCMS-v4.0-UTF8
 public function ruku_add()
 {
     $ac = $this->input->get('ac', true);
     $id = $this->input->get_post('id', true);
     if ($ac == 'no') {
         //入库全部未入库数据
         $query = $this->db->query("SELECT * FROM " . CS_SqlPrefix . "cjdata where zid=0 order by id desc limit 50");
         if ($query->num_rows() == 0) {
             admin_msg(L('plub_27'), site_url('collect/ruku'), 'ok');
             //操作成功
         }
         echo '<!doctype html><html><head><meta charset=utf-8><link type="text/css" rel="stylesheet" href="' . Web_Path . 'packs/admin/css/style.css" /></head><body><div class="rightinfo"><table class="tablelist"><thead><tr><th>' . L('plub_28') . '</th></tr></thead><tbody>';
         foreach ($query->result() as $row) {
             //判断板块数据表是否存在
             if ($row && $this->db->table_exists(CS_SqlPrefix . $row->dir)) {
                 $strs = '';
                 //判断标题字段
                 if ($this->db->field_exists('name', CS_SqlPrefix . $row->dir)) {
                     $add['name'] = $row->name;
                     $strs .= "and name='" . $row->name . "' ";
                 }
                 //判断图片字段
                 if ($this->db->field_exists('pic', CS_SqlPrefix . $row->dir)) {
                     $add['pic'] = $row->pic;
                     $strs .= "and pic='" . $row->pic . "' ";
                 }
                 //判断时间字段
                 if ($this->db->field_exists('addtime', CS_SqlPrefix . $row->dir)) {
                     $add['addtime'] = time();
                 }
                 //判断自定义字段
                 if (!empty($row->zdy)) {
                     $zdy = unarraystring($row->zdy);
                     for ($i = 0; $i < count($zdy['name']); $i++) {
                         $add[$zdy['zd'][$i]] = $zdy['text'][$i];
                         if (strlen($zdy['text'][$i]) < 200) {
                             $strs .= "and " . $zdy['zd'][$i] . "='" . $zdy['text'][$i] . "' ";
                         }
                     }
                 }
                 $strs = substr($strs, 3);
                 $rowk = $this->db->query("SELECT id FROM " . CS_SqlPrefix . $row->dir . " where " . $strs . "")->row();
                 if ($rowk) {
                     if ($row->cfid == 2) {
                         //覆盖
                         $title = L('plub_21');
                         $this->CsdjDB->get_update($row->dir, $rowk->id, $add);
                     } elseif ($row->cfid == 1) {
                         //新增
                         $this->CsdjDB->get_insert($row->dir, $add);
                         $title = L('plub_20');
                     } else {
                         $title = L('plub_22');
                     }
                 } else {
                     $this->CsdjDB->get_insert($row->dir, $add);
                     $title = L('plub_20');
                 }
                 //修改入库状态
                 $edit['zid'] = 1;
                 $this->CsdjDB->get_update('cjdata', $row->id, $edit);
                 echo '<tr><td><font color=#2222ff>' . L('plub_29') . ':' . $row->id . '-->' . $row->name . '-->' . $title . '~!</font></td></tr>';
                 ob_flush();
                 flush();
             }
         }
         echo "<tr><td><font color=red><b>" . L('plub_30') . "</b></font><script>setTimeout('ReadGo();',3000);function ReadGo(){window.location='?ac=no'}</script></td></tr>";
         echo '</tbody></table></div></body></html>';
     } else {
         //入库所选
         if (empty($id)) {
             admin_msg(L('plub_31'), 'javascript:history.back();', 'no');
         }
         //未选择数据
         if (is_array($id)) {
             //多记录
             foreach ($id as $ids) {
                 $row = $this->db->query("SELECT * FROM " . CS_SqlPrefix . "cjdata where id=" . intval($ids) . " and zid=0")->row();
                 //判断板块数据表是否存在
                 if ($row && $this->db->table_exists(CS_SqlPrefix . $row->dir)) {
                     $strs = '';
                     //判断标题字段
                     if ($this->db->field_exists('name', CS_SqlPrefix . $row->dir)) {
                         $add['name'] = $row->name;
                         $strs .= "and name='" . $row->name . "' ";
                     }
                     //判断图片字段
                     if ($this->db->field_exists('pic', CS_SqlPrefix . $row->dir)) {
                         $add['pic'] = $row->pic;
                         $strs .= "and pic='" . $row->pic . "' ";
                     }
                     //判断时间字段
                     if ($this->db->field_exists('addtime', CS_SqlPrefix . $row->dir)) {
                         $add['addtime'] = time();
                     }
                     //判断自定义字段
                     if (!empty($row->zdy)) {
                         $zdy = unarraystring($row->zdy);
                         for ($i = 0; $i < count($zdy['name']); $i++) {
                             $add[$zdy['zd'][$i]] = $zdy['text'][$i];
                             if (strlen($zdy['text'][$i]) < 200) {
                                 $strs .= "and " . $zdy['zd'][$i] . "='" . $zdy['text'][$i] . "' ";
                             }
                         }
                     }
                     $strs = substr($strs, 3);
                     $rowk = $this->db->query("SELECT id FROM " . CS_SqlPrefix . $row->dir . " where " . $strs . "")->row();
                     if ($rowk) {
                         if ($row->cfid == 2) {
                             //覆盖
                             $title = L('plub_21');
                             $this->CsdjDB->get_update($row->dir, $rowk->id, $add);
                         } elseif ($row->cfid == 1) {
                             //新增
                             $this->CsdjDB->get_insert($row->dir, $add);
                             $title = L('plub_20');
                         } else {
                             $title = L('plub_22');
                         }
                     } else {
                         $this->CsdjDB->get_insert($row->dir, $add);
                         $title = L('plub_20');
                     }
                     //修改入库状态
                     $edit['zid'] = 1;
                     $this->CsdjDB->get_update('cjdata', $row->id, $edit);
                 }
             }
         }
         admin_msg(L('plub_27'), site_url('collect/ruku'), 'ok');
         //操作成功
     }
 }
コード例 #3
0
ファイル: Loader.php プロジェクト: djqhuan/CSCMS-v4.0-UTF8
 public function get_templates($dir = NULL, $plubs = 0, $skins = NULL, $ulog = 0)
 {
     if (!defined('IS_ADMIN') && strpos(REQUEST_URI, 'index.php/install/') === FALSE && !file_exists(FCPATH . 'packs/install/plub_install.lock')) {
         msg_txt(L('plub_no_instal'), Web_Path . 'admin.php');
     }
     if (!defined('PLUBPATH') && $plubs == 0) {
         //系统默认视图路径
         $path = str_replace("\\", "/", CSCMS);
         if (!$dir) {
             $dirs = 'tpl/skins/' . Web_Skins;
         } else {
             if ($dir == 'user') {
                 $dirs = 'tpl/' . $dir . '/' . User_Skins;
                 //会员中心默认视图
             } elseif ($dir == 'home') {
                 if (!empty($skins)) {
                     $dirs = 'tpl/' . $dir . '/' . $skins;
                     //会员空间默认视图
                 } else {
                     $dirs = 'tpl/' . $dir . '/' . Home_Skins;
                     //会员空间默认视图
                 }
             } else {
                 $dirs = 'tpl/' . $dir . '/';
                 //系统后台视图
             }
         }
         if (defined('MOBILE') && Mobile_Is == 1) {
             //手机门户视图
             if ($dir == 'user') {
                 $dirs = 'tpl/mobile/' . Mobile_Skins . 'user/';
             } elseif ($dir == 'home') {
                 $dirs = 'tpl/mobile/' . Mobile_Skins . 'home/';
             } elseif ($dir != 'admin') {
                 $dirs = 'tpl/mobile/' . Mobile_Skins;
             }
         }
     } else {
         //版块视图路径
         $path = str_replace("\\", "/", APPPATH);
         $dir_file = APPPATH . 'config/site.php';
         if ($plubs == 1 && !defined('PLUBPATH')) {
             define('PLUBPATH', $dir);
             $path = FCPATH . 'plugins/' . $dir . '/';
             $dir_file = FCPATH . 'plugins/' . $dir . '/config/site.php';
         }
         $ak = getzd('plugins', 'ak', PLUBPATH, 'dir');
         if (empty($ak)) {
             msg_txt(vsprintf(L('plub_key_err1'), array(PLUBPATH)), Web_Path);
         }
         $arrs = unarraystring(sys_auth($ak, 'D'));
         if ($arrs == '' || empty($arrs['md5']) || md5(PLUBPATH . $arrs['key'] . host_ym(1)) != $arrs['md5']) {
             msg_txt(vsprintf(L('plub_key_err2'), array(PLUBPATH)), Web_Path);
         }
         $dirs = 'tpl/skins/default/';
         if (is_file($dir_file)) {
             $plub = (require $dir_file);
             if (is_array($plub)) {
                 //后台视图
                 if (defined('IS_ADMIN') && $plubs < 2) {
                     $dirs = 'tpl/admin/';
                     //手机视图
                 } elseif (!defined('IS_ADMIN') && defined('MOBILE') && $plub['Mobile_Is'] == 1) {
                     $dirs = 'tpl/mobile/' . $plub['Mobile_Dir'];
                     if (defined('HOMEPATH')) {
                         $dirs .= 'home/';
                     }
                     if (defined('USERPATH')) {
                         $dirs .= 'user/';
                     }
                     //前台视图
                 } else {
                     if (defined('HOMEPATH')) {
                         if ($ulog == 1) {
                             $path = str_replace("\\", "/", CSCMS);
                         }
                         if (!empty($skins)) {
                             $dirs = 'tpl/home/' . $skins;
                         } else {
                             $dirs = 'tpl/home/' . Home_Skins;
                         }
                     } elseif (defined('USERPATH')) {
                         $dirs = 'tpl/user/' . $plub['User_Dir'];
                     } else {
                         $dirs = 'tpl/skins/' . $plub['Skins_Dir'];
                     }
                 }
             }
         }
     }
     if (substr($dirs, -1) != '/') {
         $dirs .= '/';
     }
     $this->_ci_view_paths = array($path . $dirs => TRUE);
 }
コード例 #4
0
ファイル: csdjadmin.php プロジェクト: djqhuan/CSCMS-v4.0-UTF8
 function Admin_Login($key = '')
 {
     if (empty($key)) {
         $id = isset($_SESSION['admin_id']) ? intval($_SESSION['admin_id']) : 0;
         $name = isset($_SESSION['admin_name']) ? $_SESSION['admin_name'] : '';
         $pass = isset($_SESSION['admin_pass']) ? $_SESSION['admin_pass'] : '';
     } else {
         $str = unserialize(stripslashes(sys_auth($key, 'D')));
         $id = isset($str['id']) ? intval($str['id']) : 0;
         $name = isset($str['name']) ? $str['name'] : '';
         $pass = isset($str['pass']) ? $str['pass'] : '';
     }
     $type = $this->uri->segment(1) == 'opt' ? 'top' : 'window';
     $admin_id = intval($this->cookie->get_cookie('admin_id'));
     $admin_login = $this->cookie->get_cookie('admin_login');
     if (empty($id) || empty($name) || empty($pass)) {
         $login = FALSE;
         //判断记住登录COOKIE
         if ($admin_id > 0 && !empty($admin_login)) {
             //判断非法COOKIE
             if (!preg_match('/^[0-9a-zA-Z]*$/', $admin_login)) {
                 $adminlogin = '';
             }
             $row = $this->db->query("SELECT id,adminname,adminpass,logip,logtime FROM " . CS_SqlPrefix . "admin where id='{$admin_id}'")->row();
             if ($row && md5($row->adminname . $row->adminpass) == $admin_login) {
                 $_SESSION['admin_name'] = $row->adminname;
                 $_SESSION['admin_id'] = $row->id;
                 $_SESSION['admin_pass'] = md5($row->adminpass);
                 $_SESSION['admin_logtime'] = date('Y-m-d H:i:s', $row->logtime);
                 $_SESSION['admin_logip'] = $row->logip;
                 $login = true;
             }
         }
         if (!$login) {
             die("<script>" . $type . ".location='" . site_url('login/logout') . "';</script>");
         }
     } else {
         $admin = $this->db->query("SELECT * FROM " . CS_SqlPrefix . "admin where id=" . $id . "")->row();
         if ($admin) {
             //密码不对
             if (md5($admin->adminpass) != $pass || $admin->adminname != $name) {
                 die("<script>" . $type . ".location='" . site_url('login/logout') . "';</script>");
             }
             //IP不对
             if (getip() != $admin->logip) {
                 die("<script>" . $type . ".location='" . site_url('login/logout') . "';</script>");
             }
             //判断权限
             if ($admin->sid > 1) {
                 $zu = $this->db->query("SELECT sys,app FROM " . CS_SqlPrefix . "adminzu where id=" . $admin->sid . "")->row();
                 if (!defined('PLUBPATH')) {
                     $quanxian = $zu->sys;
                     //系统默认权限
                 } else {
                     $apparr = unarraystring($zu->app);
                     $quanxian = !empty($apparr[PLUBPATH]) ? $apparr[PLUBPATH] : '';
                     //板块权限
                 }
                 $arr = @parse_url(REQUEST_URI);
                 $re_url = str_replace("/" . SELF . "/", "", $arr['path']);
                 $permarr = explode('/', $re_url);
                 if (count($permarr) < 2 && $re_url != 'index') {
                     $re_url .= '/index';
                 }
                 if ($re_url != 'index' && $re_url != '/index' && $re_url != 'opt/main' && $re_url != 'opt/head' && $re_url != 'opt/error' && $re_url != 'opt/menu' && $re_url != 'opt/bottom') {
                     if (getqx($re_url, $quanxian, 1) != 'ok') {
                         if ($re_url == 'upload/up') {
                             die("<script>alert('" . L('err_03') . "');parent.\$('.webox').css({display:'none'});parent.\$('.background').css({display:'none'});parent.parent.web_box(2);</script>");
                         } else {
                             admin_msg(L('err_03'), 'javascript:history.back();', 'no');
                         }
                     }
                 }
             }
         } else {
             die("<script>" . $type . ".location='" . site_url('login/logout') . "';</script>");
         }
     }
 }
コード例 #5
0
ファイル: plugins.php プロジェクト: djqhuan/CSCMS-v4.0-UTF8
 public function role_save()
 {
     $app = $this->input->post('sys', true);
     $dir = $this->input->post('dir', true);
     $id = intval($this->input->post('id', true));
     if (!empty($app)) {
         $apps = implode(',', $app);
     } else {
         $apps = '';
     }
     $row = $this->db->query("SELECT app FROM " . CS_SqlPrefix . "adminzu where id='" . $id . "'")->row();
     $apparr = unarraystring($row->app);
     $apparr[$dir] = $apps;
     $data['app'] = arraystring($apparr);
     $this->CsdjDB->get_update('adminzu', $id, $data);
     die("<script>alert('" . L('plub_30') . "');parent.\$('.webox').css({display:'none'});parent.\$('.background').css({display:'none'});parent.parent.web_box(2);</script>");
 }