Beispiel #1
0
 /**
  * 运行应用
  * @access private
  */
 private static function start()
 {
     //控制器实例
     $control = control(CONTROL);
     //控制器不存在
     if (!$control) {
         //空控制器
         $control = Control("Empty");
         if (!$control) {
             _404('模块' . CONTROL . '不存在');
         }
     }
     //执行动作
     try {
         $method = new ReflectionMethod($control, METHOD);
         if ($method->isPublic()) {
             $method->invoke($control);
         } else {
             throw new ReflectionException();
         }
     } catch (ReflectionException $e) {
         $method = new ReflectionMethod($control, '__call');
         $method->invokeArgs($control, array(METHOD, ''));
     }
 }
Beispiel #2
0
function _outputTypeFile($matches)
{
    $file = $matches[3];
    $prefix = '';
    $bits = explode("/", $file);
    if (count($bits) > 1) {
        $file = array_pop($bits);
        $prefix = trim(implode("/", $bits), "/") . '/';
    }
    $platform = Kurogo::deviceClassifier()->getPlatform();
    $pagetype = Kurogo::deviceClassifier()->getPagetype();
    $browser = Kurogo::deviceClassifier()->getBrowser();
    $testDirs = array(THEME_DIR, SHARED_THEME_DIR, SITE_APP_DIR, SHARED_APP_DIR, APP_DIR);
    $testFiles = array("{$prefix}{$pagetype}-{$platform}-{$browser}/{$file}", "{$prefix}{$pagetype}-{$platform}/{$file}", "{$prefix}{$pagetype}/{$file}", "{$prefix}{$file}");
    foreach ($testDirs as $dir) {
        //do not assume dirs have value set
        if ($dir) {
            $dir .= '/' . $matches[1] . $matches[2];
            foreach ($testFiles as $file) {
                Kurogo::log(LOG_DEBUG, "Looking for {$dir}/{$file}", 'index');
                if ($file = realpath_exists("{$dir}/{$file}")) {
                    _outputFile($file);
                }
            }
        }
    }
    _404();
}
Beispiel #3
0
 public function index()
 {
     $u = preg_replace('@[^\\w]@', '', Q('u'));
     $pre = C('DB_PREFIX');
     $sql = "SELECT uid,nickname,rname,r.rid,spec_num,credits,regtime,logintime,domain,icon FROM {$pre}user AS u\n                INNER JOIN {$pre}role AS r ON u.rid=r.rid\n                WHERE u.uid='{$u}' OR domain='{$u}'";
     if (!($user = M()->query($sql))) {
         _404('会员不存在');
     }
     $user = $user[0];
     //--------------------------增加空间访问次数
     if (!isset($_SESSION['uid']) or $_SESSION['uid'] != $user['uid']) {
         $sql = "UPDATE {$pre}user SET spec_num=spec_num+1";
         M()->exe($sql);
     }
     //---------------------------获得文章列表
     $where = 'uid=' . $user['uid'] . ' AND content_state=1 ';
     $db = M('content');
     $count = $db->where($where)->count();
     $page = new Page($count, 10);
     $data = $db->where($where)->limit($page->limit())->all();
     $this->data = $data;
     $this->page = $page->show();
     $this->user = $user;
     //------------------------------获得访问数据
     $guest = $this->getGuest($user['uid']);
     $this->assign('guest', $guest);
     $this->display();
 }
Beispiel #4
0
 /**
  * 运行应用
  * @access private
  */
 private static function start()
 {
     //控制器实例
     $control = control(CONTROL);
     //控制器不存在
     if (!$control) {
         //应用组检测
         if (IS_GROUP and !is_dir(GROUP_PATH . GROUP_NAME)) {
             _404('应用组' . GROUP_PATH . GROUP_NAME . '不存在');
         }
         //应用检测
         if (!is_dir(APP_PATH)) {
             _404('应用' . APP . '不存在');
         }
         //空控制器
         $control = Control("Empty");
         if (!$control) {
             _404('模块' . CONTROL . C("CONTROL_FIX") . '不存在');
         }
     }
     //执行动作
     try {
         $method = new ReflectionMethod($control, METHOD);
         if ($method->isPublic()) {
             $method->invoke($control);
         } else {
             throw new ReflectionException();
         }
     } catch (ReflectionException $e) {
         $method = new ReflectionMethod($control, '__call');
         $method->invokeArgs($control, array(METHOD, ''));
     }
 }
Beispiel #5
0
 public function category()
 {
     $mid = Q('mid', 0, 'intval');
     $cid = Q('cid', 0, 'intval');
     $cache = cache('category');
     if (!$mid || !$cid || !isset($cache[$cid])) {
         _404();
     }
     $cachetime = C('CACHE_CATEGORY') >= 1 ? C('CACHE_CATEGORY') : null;
     if (!$this->isCache()) {
         $category = $cache[$cid];
         //外部链接,直接跳转
         if ($category['cattype'] == 3) {
             go($category['cat_redirecturl']);
         } else {
             $Model = ContentViewModel::getInstance($category['mid']);
             $catid = getCategory($category['cid']);
             $category['content_num'] = $Model->join()->where("cid IN(" . implode(',', $catid) . ")")->count();
             $category['comment_num'] = intval(M('comment')->where("cid IN(" . implode(',', $catid) . ")")->count());
             $this->assign("hdcms", $category);
             $this->display($category['template'], $cachetime);
         }
     } else {
         $this->display(null, $cachetime);
     }
 }
 public function check_rem()
 {
     //判断密码是否修改
     if (!IS_AJAX) {
         _404("页面错误");
     }
     if (!($wish = M("dm_user")->where(array('username' => $_COOKIE["username"], 'password' => $_COOKIE["password"]))->find())) {
         //密码验证不成功,删除cookie
         // setcookie("username",'',time()-3600,'/');
         setcookie("password", '', time() - 3600, '/');
         setcookie("niker", '', time() - 3600, '/');
         $this->ajaxReturn(array('status' => 2), 'json');
     } else {
         //登录成功,存储session
         M("dm_user")->where("id=" . $wish["id"])->setField("loginip", get_client_ip());
         M("dm_user")->where("id=" . $wish["id"])->setField("logintime", time());
         $_SESSION["username"] = $wish["username"];
         $_SESSION["user_id"] = $wish["id"];
         $_SESSION["niker"] = $wish["niker"];
         $_SESSION["password"] = $wish["password"];
         // 	$this->ajaxReturn(array(
         // 'status'=>1,
         // 'username'=>$_COOKIE["username"],
         // 'password'=>$_COOKIE["password"],
         // 'niker'=>$_COOKIE["niker"],
         // ),'json');
     }
 }
Beispiel #7
0
 function show()
 {
     $docs = _class('docs');
     $dir = $docs->docs_dir;
     $dir_len = strlen($dir);
     $ext = '.stpl';
     $ext_len = strlen($ext);
     $name = preg_replace('~[^a-z0-9/_-]+~ims', '', $_GET['id']);
     if (strlen($name)) {
         $dev_path = YF_PATH . '.dev/samples/classes/';
         $dev_class_path = $dev_path . $name . '.class.php';
         if (file_exists($dev_class_path)) {
             return _class($name, $dev_path)->show();
         }
         $f = $dir . $name . '.stpl';
         if (!file_exists($f)) {
             return _404('Not found');
         }
         return '<section class="page-contents">' . tpl()->parse_string(file_get_contents($f), $replace, 'doc_' . $name) . '</section>';
     }
     $url = rtrim(url('/@object/@action/')) . '/';
     $data = [];
     foreach ((array) $this->_get_misc_docs($dir) as $name) {
         $data[$name] = ['name' => $name, 'link' => $url . urlencode($name)];
     }
     ksort($data);
     return html()->li($data);
 }
Beispiel #8
0
 /**
  * 运行应用
  * @access private
  */
 private static function start()
 {
     //控制器实例
     $controller = controller(CONTROLLER);
     //控制器不存在
     if (!$controller) {
         //模块检测
         if (!is_dir(MODULE_PATH)) {
             _404('模块' . MODULE . '不存在');
         }
         //空控制器
         $controller = Controller("Empty");
         if (!$controller) {
             _404('控制器' . CONTROLLER . C("CONTROLLER_FIX") . '不存在');
         }
     }
     //执行动作
     try {
         $action = new ReflectionMethod($controller, ACTION);
         if ($action->isPublic()) {
             $action->invoke($controller);
         } else {
             throw new ReflectionException();
         }
     } catch (ReflectionException $e) {
         $action = new ReflectionMethod($controller, '__call');
         $action->invokeArgs($controller, array(ACTION, ''));
     }
 }
Beispiel #9
0
 public function login()
 {
     if (!IS_POST) {
         _404('页面不存在');
     }
     /*if(I('code', '', 'md5') != session('verify')){
     			$this->error('验证码错误');
     		}*/
     $username = I('username');
     $pwd = I('password', '', 'md5');
     $user = M('user')->where(array('username' => $username))->find();
     if (!$user || $user['password'] != $pwd) {
         $this->error('账号或密码错误');
     } else {
         if ($user['lock']) {
             $this->error('用户被锁定');
         }
     }
     //更新数据库
     $data = array('id' => $user['id'], 'loginTime' => time(), 'loginIp' => get_client_ip());
     M('user')->save($data);
     //读取权限
     session(C('USER_AUTH_KEY'), $user['id']);
     session('username', $user['username']);
     session('loginTime', date('y-m-d H:i:s'), $user['loginTime']);
     session('loginIp', $user['loginIp']);
     if ($user['username'] == C('RBAC_SUPERADMIN')) {
         session(C('ADMIN_AUTH_KEY'), true);
     }
     import('ORG.Util.RBAC');
     RBAC::saveAccessList();
     //P($_SESSION);
     //die();
     $this->redirect('Admin/Index/index');
 }
Beispiel #10
0
 public function __init()
 {
     $this->_db = K("Comment");
     $this->_mid = Q('mid', null, 'intval');
     $this->_cid = Q('cid', null, 'intval');
     $this->_aid = Q('aid', null, 'intval');
     //栏目与文章aid必须存在
     if (!$this->_cid || !$this->_aid) {
         _404('参数错误');
     }
 }
Beispiel #11
0
 public function _empty()
 {
     $a = ACTION_NAME;
     $id = intval($_REQUEST['id']);
     $m = MODULE_NAME;
     $bae = new BaseAction();
     if (!method_exists($bae, $a)) {
         _404('404');
     }
     $bae->{$a}($id, $m);
 }
 public function handle()
 {
     if (!IS_POST) {
         _404('非法操作,请重试', U('index'));
     }
     $data = array('username' => I('username', '', 'htmlspecialchars'), 'content' => I('content', '', 'htmlspecialchars'), 'time' => time());
     if (M('wish')->data($data)->add()) {
         $this->success('恭喜你提交成功', U('index'));
     } else {
         $this->error('提交失败,请重试。');
     }
 }
Beispiel #13
0
    function show()
    {
        $docs = _class('docs');
        $dir = $docs->demo_dir;
        $dir_len = strlen($dir);
        $ext = '.php';
        $ext_len = strlen($ext);
        $names = $this->_get_demos($dir);
        ksort($names);
        $name = preg_replace('~[^a-z0-9/_-]+~ims', '', $_GET['id']);
        if (strlen($name)) {
            $f = $dir . $name . '.php';
            if (!file_exists($f)) {
                return _404('Not found');
            }
            $body = (include $f);
            if (is_callable($body)) {
                $self_source = _class('core_api')->get_function_source($body);
                $body = $body();
            } else {
                $self_source = ['name' => $name, 'file' => $f, 'line_start' => 1, 'source' => $body];
            }
            $prev = '';
            $next = '';
            $i = 0;
            foreach ((array) $names as $_name) {
                if ($name !== $_name) {
                    $prev = $_name;
                } elseif ($name === $_name) {
                    $next = current(array_slice($names, $i + 1, 1));
                    break;
                }
                $i++;
            }
            $name_html = preg_replace('~[^0-9a-z_-]~ims', '', $name);
            $header = '<div id="head_' . $name_html . '" class="panel">
	                <div class="panel-heading">
						<h1 class="panel-title">
							<a href="' . url('/@object/@action/' . urlencode($name)) . '">' . $name . '</a>
							<div class="pull-right">' . _class('core_api')->_github_link_btn($self_source) . '<button class="btn btn-primary btn-xs" data-toggle="collapse" data-target="#func_self_source_' . $name_html . '"><i class="fa fa-file-text-o"></i> source</button> ' . ($prev ? '<a href="' . url('/@object/@action/' . urlencode($prev)) . '" class="btn btn-primary btn-xs">&lt;</a> ' : '') . ($next ? '<a href="' . url('/@object/@action/' . urlencode($next)) . '" class="btn btn-primary btn-xs">&gt;</a> ' : '') . '</div>
						</h1>
					</div>
					<div id="func_self_source_' . $name_html . '" class="panel-body collapse out"><pre class="prettyprint lang-php"><code>' . _prepare_html($self_source['source']) . '</code></pre></div> ' . ($target_source['source'] ? '<div id="func_target_source_' . $name_html . '" class="panel-body collapse out"><pre class="prettyprint lang-php"><code>' . _prepare_html($target_source['source']) . '</code></pre></div> ' : '') . '</div>';
            return implode(PHP_EOL, [$header, '<section class="page-contents">' . tpl()->parse_string($body, $replace, 'demo_' . $name) . '</section>']);
        }
        $url = rtrim(url('/@object/@action/')) . '/';
        $data = [];
        foreach ((array) $names as $name) {
            $data[$name] = ['name' => $name, 'link' => $url . urlencode($name)];
        }
        ksort($data);
        return html()->li($data);
    }
Beispiel #14
0
 /**
  */
 function edit()
 {
     $a = $this->_get_info();
     if (!$a) {
         return _404();
     }
     $a['back_link'] = url('/@object');
     $_this = $this;
     return form((array) $_POST + (array) $a)->validate(['__before__' => 'trim', 'name' => 'required', 'text' => 'required'])->update_if_ok(self::table, ['name', 'text', 'active', 'locale'])->on_before_update(function () use($a, $_this) {
         module_safe('manage_revisions')->add(['object_name' => $_this::table, 'object_id' => $a['id'], 'old' => $a, 'new' => $_POST, 'action' => 'update']);
     })->container($this->_get_lang_links($a['locale'], $a['name'], 'edit'))->text('name')->textarea('text', ['id' => 'text', 'cols' => 200, 'rows' => 10, 'ckeditor' => ['config' => _class('admin_methods')->_get_cke_config()]])->active_box()->save_and_back();
 }
Beispiel #15
0
function _outputFileLoaderFile($matches) {
  $fullPath = FileLoader::load($matches[1]);
  
  if ($fullPath) {
    CacheHeaders($fullPath);    
    header('Content-type: '.mime_type($fullPath));
    echo file_get_contents($fullPath);
    exit;
  }

  _404();
}
 public function eventHandle()
 {
     if (!IS_POST) {
         _404('页面不存在', U('index'));
     }
     $data = array("eventType" => $_POST["eventType"], "ecid" => session("ecid"));
     if (M("company_event_response")->where($data)->find()) {
         $this->updateEvent();
     } else {
         $this->addEvent();
     }
 }
    public function password()
    {
        if (!IS_POST) {
            _404("页面不存在");
        }
        $email = I('username', '', 'htmlspecialchars');
        if (I("verify", "", "md5") != session("verify")) {
            //验证码错误;
            $this->ajaxReturn(array('status' => 2));
            return 0;
        } else {
            // $this->ajaxReturn(array('status'=>1));//发送成功!
            import('Class.smtp', APP_PATH);
            date_default_timezone_set('Asia/Shanghai');
            $time = time();
            $appy_time = date('Y-m-d H:i', $time);
            $data = M();
            $sql = "select id from dm_user where username= '******'";
            $result = $data->query("select id from dm_user where username= '******'");
            $reset = $data->query("update dm_user set resettime={$time} where username ='******'");
            $id = base64_encode($result[0]['id']);
            //使用base64对数据加密
            $url = U('index/Password/reset?time=' . $time . '&yxs=' . $id . '&mail=' . $email);
            $MailServer = 'smtp.163.com';
            //SMTP 服务器
            $MailPort = '25';
            //SMTP服务器端口号 默认25
            $MailId = '*****@*****.**';
            //服务器邮箱帐号
            $MailPw = 'checent.com';
            //服务器邮箱密码
            $Title = '呆萌网找回登陆密码!';
            //邮件标题
            $Content = '呆萌网在 ' . $appy_time . ' 收到了邮箱 ' . $email . ' 的密码重置申请。请点击以下的链接修改密码:
				</br>
				http://' . $_SERVER['HTTP_HOST'] . $url . '
				</br>
				如果邮箱中不能打开链接,您也可以将它复制到浏览器地址栏中打开。';
            //邮件内容
            $email = $email;
            //接收者邮箱
            $smtp = new smtp($MailServer, $MailPort, true, $MailId, $MailPw);
            $smtp->debug = false;
            if ($smtp->sendmail($email, $MailId, $Title, $Content, "HTML")) {
                $this->ajaxReturn(array('status' => 1));
                //发送成功!
            } else {
                $this->ajaxReturn(array('status' => 3));
                //请重新发送
            }
        }
    }
Beispiel #18
0
 public function handle()
 {
     if (!IS_POST) {
         _404("页面不存在");
     }
     // halt("页面不存在");
     $data = array('username' => I('username', '', 'htmlspecialchars'), 'content' => I('content', '', 'htmlspecialchars'), time => time());
     // M('user')->where('id>0')->delete();
     if (M('user')->data($data)->add()) {
         $this->success('发布成功', U('index'));
     }
     $this->error('发布失败');
 }
 public function register()
 {
     if (!IS_AJAX) {
         //非ajax提交
         _404("页面不存在");
     }
     if ($_SESSION["verify"] != md5(strtolower(I("verify")))) {
         //验证码错误
         $this->ajaxReturn(array('verify' => 0));
         return 0;
     }
     $user["username"] = I("username");
     $user['password'] = I('password', '', 'md5');
     $user['loginip'] = get_client_ip();
     $user['logintime'] = time();
     $user['email'] = $user["username"];
     $user["niker"] = $user["username"];
     $judge = M('dm_user')->add($user);
     //插入user_info表的默认值
     $user_info['nickname'] = $user["username"];
     $moren_user_name = rand(1, 107);
     $user_info["img"] = $moren_user_name . ".jpg";
     //默认的个人图片
     $user_info["name"] = "小萌";
     //默认的姓名
     $user_info["sex"] = "";
     //默认的性别为空
     $user_info["bird"] = "暂无";
     //默认的出生日期
     $user_info["address"] = "暂无描述";
     //默认的出生地址
     $user_info["person_description"] = "暂无描述";
     //默认的个人描述
     $user_info["last_change_time"] = time();
     //默认的登陆时间
     // var_dump($user_info);
     $judge2 = M('dm_user_info')->add($user_info);
     if ($judge && $judge2) {
         $_SESSION["username"] = I("username");
         $_SESSION["user_id"] = $judge;
         $_SESSION["niker"] = $user["username"];
         $this->ajaxReturn(array('verify' => 1), 'json');
         //数据库插入成功
         return 0;
     } else {
         // var_dump($judge2);
         $this->ajaxReturn(array('verify' => 2), '');
         //数据库插入失败
         return 0;
     }
 }
 public function login()
 {
     if (!IS_POST) {
         _404('页面不存在!');
     }
     $username = I('username');
     $password = I('password', '', 'md5');
     $manager = M('manager')->where(array('username' => $username))->find();
     if (!$manager || $manager['password'] != $password) {
         $this->error('账号或密码错误!');
     }
     session('managerid', $manager['id']);
     session('managerusername', $manager['username']);
     redirect(__GROUP__);
 }
Beispiel #21
0
function _outputTypeFile($matches)
{
    $file = $matches[3];
    $platform = Kurogo::deviceClassifier()->getPlatform();
    $pagetype = Kurogo::deviceClassifier()->getPagetype();
    $testDirs = array(THEME_DIR . '/' . $matches[1] . $matches[2], SITE_APP_DIR . '/' . $matches[1] . $matches[2], APP_DIR . '/' . $matches[1] . $matches[2]);
    $testFiles = array("{$pagetype}-{$platform}/{$file}", "{$pagetype}/{$file}", "{$file}");
    foreach ($testDirs as $dir) {
        foreach ($testFiles as $file) {
            if ($file = realpath_exists("{$dir}/{$file}")) {
                _outputFile($file);
            }
        }
    }
    _404();
}
 public function wishsort()
 {
     if (!IS_AJAX) {
         _404('页面不存在');
     }
     $page = $_POST['page'];
     $begin = 5;
     $sum = 8;
     $sort = $_POST['sort'];
     $total_page = ceil((M('hd_wish')->count() - $begin) / $sum);
     if ($data = M('hd_wish')->limit($begin + ($page - 1) * $sum, $sum)->order($sort . ' desc')->select()) {
         $this->ajaxReturn(array('data1' => $data, 'total_page' => $total_page), 'json');
     } else {
         $this->ajaxReturn($data, 'json');
     }
 }
Beispiel #23
0
 /**
  * 执行不存在的函数时会自动执行的魔术方法
  * 编辑器上传时执行php脚本及ispost或_post等都会执行这个方法
  * @access protected
  * @param string $method 方法名
  * @param mixed $args 方法参数
  * @return mixed
  */
 public function __call($method, $args)
 {
     //调用的方法不存在
     if (strcasecmp($method, METHOD) == 0) {
         //执行插件如uploadify|ueditor|keditor
         if (alias_import($method)) {
             require alias_import($method);
         } elseif (method_exists($this, "__empty")) {
             //执行空方法_empty
             $this->__empty($args);
         } else {
             //方法不存在时抛出404错误页
             _404('模块中不存在方法' . $method);
         }
     }
 }
Beispiel #24
0
 public function handle()
 {
     if (!IS_AJAX) {
         _404('页面不存在!');
     }
     $data = array('username' => I('username'), 'content' => I('content'), 'time' => time());
     if ($id = M('wish')->data($data)->add()) {
         $data['id'] = $id;
         $data['content'] = replace_phiz($data['content']);
         $data['time'] = date('Y-m-d H:i', $data['time']);
         $data['status'] = 1;
         $this->ajaxReturn($data, 'json');
     } else {
         $this->ajaxReturn(array('status' => 0), 'json');
     }
 }
 public function handle_pannel3()
 {
     //判断是否是post提交,如果不是,跳转到Index/index控制器
     if (!IS_POST) {
         _404('页面不存在', U('index'));
     }
     $data_basic3 = array('area' => I('area', ''), 'hardware_inv' => I('hardware_inv', ''), 'hardware_inv2' => I('hardware_inv2', ''), 'sales' => I('sales', ''), 'medical_quantity' => I('medical_quantity', ''), 'staff_ratio' => I('staff_ratio', ''));
     if (M('data3')->data($data_basic3)->add()) {
         //如果填写信息成功
         $this->success('填写成功,请完善其他信息', 'Index/index');
         //发布成功,跳转到Index/index控制器
     } else {
         //发布失败
         $this->error('填写失败,请重试...');
     }
 }
Beispiel #26
0
 /**
  * 执行不存在的函数时会自动执行的魔术方法
  * 编辑器上传时执行php脚本及ispost或_post等都会执行这个方法
  * @param $action 方法名
  * @param $args 方法参数
  */
 public function __call($action, $args)
 {
     //调用的方法不存在
     if (strcasecmp($action, ACTION) == 0) {
         //执行插件如uploadify|ueditor|keditor
         if (alias_import($action)) {
             require alias_import($action);
         } elseif (method_exists($this, "__empty")) {
             //执行空方法_empty
             $this->__empty($args);
         } else {
             //方法不存在时抛出404错误页
             _404('控制器中不存在动作' . $action);
         }
     }
 }
Beispiel #27
0
 /**
  * Display dynamic|on-the-fly asset content (CSS|JS)
  */
 function asset($type = '')
 {
     session_write_close();
     no_graphics(true);
     $name = strtolower(preg_replace('~[^a-z0-9_-]+~ims', '', trim($_GET['id'])));
     $type = strtolower(preg_replace('~[^a-z0-9_-]+~ims', '', trim($type ?: $_GET['page'])));
     if (!strlen($name) || !strlen($type) || !in_array($type, ['css', 'js', 'jquery', 'ng'])) {
         _404();
         exit;
     }
     $class_assets = _class('assets');
     $content_types = ['js' => 'text/javascript', 'css' => 'text/css'];
     $content_types['jquery'] = $content_types['js'];
     $content_types['ng'] = $content_types['js'];
     if (in_array($type, ['css', 'js'])) {
         $content = $class_assets->get_asset($name, $type);
         foreach ($content as $v) {
             $ctype = $class_assets->detect_content_type($type, $v);
             $_out = '';
             if ($ctype === 'inline') {
                 $_out = $v;
             } elseif ($ctype === 'file') {
                 $_out = file_get_contents($v);
             } elseif ($ctype === 'url') {
                 $_out = file_get_contents($v);
             }
             if (DEBUG_MODE) {
                 $out[] = '/* DEBUG: asset: ' . $name . ', type: ' . $type . ', ctype: ' . $ctype . ', length: ' . strlen($_out) . ', src: ' . $v . ' */';
             }
             $out[] = $_out;
         }
     }
     $out = implode(PHP_EOL . PHP_EOL, $out);
     $now = time();
     $max_age = 3600;
     header('Content-Type: ' . $content_types[$type]);
     header('Content-Length: ' . strlen($out));
     header('Cache-Control: max-age=3600, must-revalidate');
     header('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', $now + $max_age));
     header('Last-Modified: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', $now));
     header('X-Robots-Tag: noindex,nofollow,noarchive,nosnippet');
     header_remove('Pragma');
     header_remove('Set-Cookie');
     print $out;
     exit;
 }
Beispiel #28
0
 /**
  * 执行不存在的函数时会自动执行的魔术方法
  * 编辑器上传时执行php脚本及ispost或_post等都会执行这个方法
  * @param $action 方法名
  * @param $args 方法参数
  */
 public function __call($action, $args)
 {
     /**
      * 控制器方法不存在时
      */
     if (strcasecmp($action, ACTION) == 0) {
         if (method_exists($this, "__empty")) {
             //执行空方法_empty
             $this->__empty($args);
         } else {
             /**
              * 404错误页
              */
             _404('控制器中不存在动作' . $action);
         }
     }
 }
 public function getTXnews()
 {
     if (!IS_AJAX) {
         _404('页面不存在');
     }
     $url = "http://www.cnsphoto.com/";
     $content = file_get_contents($url);
     $preg = '/<li style="height:305px"><a href="(\\/newsphoto\\/detail\\.jsp\\?pid=\\d+)" title="(.*?)" target=_blank><img src="(.*?)" width=549><\\/a><\\/li>/';
     preg_match_all($preg, $content, $matches);
     // p($matches);die;
     if ($matches) {
         $data = array('aurl' => $matches[1], 'title' => $matches[2], 'imgurl' => $matches[3]);
         $this->ajaxReturn($data, 'json');
     } else {
         $this->ajaxReturn(array('status' => 0), 'json');
     }
 }
 public function deleteGroup()
 {
     if (!IS_POST) {
         _404('页面不存在', U('index'));
     }
     $newsid = M("company_" . session("ecid") . "_material_group")->where("id=" . $_POST["id"])->select();
     $newsidArr = explode(",", $newsid[0]["materialID"]);
     for ($i = 0; $i < count($newsidArr); $i++) {
         M("company_" . session("ecid") . "_material")->where("id=" . $newsidArr[$i])->delete();
     }
     if (M("company_" . session("ecid") . "_material_group")->where("id=" . $_POST["id"])->delete()) {
         $result["status"] = Error::SUCCESS_OK;
     } else {
         $result["status"] = Error::ERROR_DELETE_HANDLE_ERR;
         $result["info"] = Error::getErrMsg(Error::ERROR_DELETE_HANDLE_ERR);
     }
     $this->ajaxReturn($result, "JSON");
 }