예제 #1
0
 /**
  * 添加或修改项目类型
  */
 function add()
 {
     $this->load->model('proTypeModel');
     if ($_POST) {
         $proTypeId = (int) $this->input->get('proTypeId');
         $data = array('proTypeName' => $this->input->post('proTypeName'), 'statusIs' => (int) $this->input->post('statusIs'));
         if ($proTypeId) {
             if ($this->proTypeModel->edit(array('proTypeId' => $proTypeId), $data)) {
                 $this->proTypeModel->createCache();
                 showSuccess('修改项目类型成功');
             } else {
                 showError('修改项目类型失败');
             }
         } else {
             $data['createTime'] = time();
             if ($this->proTypeModel->add($data)) {
                 $this->proTypeModel->createCache();
                 showSuccess('添加项目类型成功');
             } else {
                 showError('添加项目类型失败');
             }
         }
     } else {
         $proTypeId = (int) $this->input->get('proTypeId');
         if ($proTypeId) {
             $proTypeData = $this->proTypeModel->getData(array('proTypeId' => $proTypeId));
             $this->viewData['proTypeData'] = $proTypeData;
         }
         $this->load->view('AdminProType/add', $this->viewData);
     }
 }
function parse_less($filename, $file)
{
    global $less_file, $is_dev;
    $options = array();
    if ($is_dev) {
        $options['sourceMap'] = true;
        $options['sourceMapWriteTo'] = '../css/' . $file . '.map';
        $options['sourceMapURL'] = '../css/' . $file . '.map';
    } else {
        $options['compress'] = true;
    }
    $options['cache_dir'] = '../css_cache';
    try {
        $parser = new Less_Parser($options);
        $parser->parseFile($less_file, '../css/');
        ob_start();
        echo $parser->getCss();
        $css = ob_get_contents();
        ob_end_clean();
        header("Content-type: text/css");
        @file_put_contents('../css/' . $file . '.css', $css);
        return $css;
    } catch (Exception $e) {
        header("Content-type: text/css");
        echo '/* LESS ERROR : ' . "\n\n" . $e->getMessage() . "\n\n" . '*/';
        showError($file . '.less');
    }
}
예제 #3
0
function exception_handler($exception)
{
    ob_end_clean();
    //logError($exception);
    showError($exception);
    exit;
}
예제 #4
0
function rebuildHistory()
{
    $states = array('open', 'closed');
    foreach ($states as $state) {
        $page = 1;
        $lastPage = $page + 9;
        while ($page <= $lastPage) {
            $file = getSSLPage("https://api.github.com/repos/highslide-software/highcharts.com/issues" . "?page={$page}&state={$state}");
            $issues = json_decode($file);
            if (is_array($issues)) {
                if (sizeof($issues) === 0) {
                    echo "--- No more {$state} issues ---";
                    break;
                }
                echo "\n<h2>Page: {$state} {$page}</h2>\n";
                foreach ($issues as $i => $issue) {
                    echo '#' . $issue->number . ', ';
                }
                file_put_contents("pages/{$state}-{$page}.json", $file);
                $page++;
            } else {
                showError($issues);
                break;
            }
        }
    }
}
예제 #5
0
 public static function executeQuery($sql)
 {
     include 'db.inc';
     include_once 'error.inc';
     // 1. Tao ket noi CSDL
     if (!($connection = mysql_connect($hostName, $username, $password))) {
         die("couldn't connect to localhost");
     }
     if (!mysql_select_db($databaseName, $connection)) {
         showError();
     }
     //2. Thiet lap font Unicode
     if (!mysql_query("set names 'utf8'")) {
         showError();
     }
     // Thuc thi cau truy van
     if (!($result = mysql_query($sql, $connection))) {
         showError();
     }
     // Dong ket noi CSDL
     if (!mysql_close($connection)) {
         showError();
     }
     return $result;
 }
예제 #6
0
function IAUTH_auth($appid, $uid, $rightStr, $state = '', $faile_t = '2036-12-31 23:59:59')
{
    Check($appid, 'appid');
    Check($uid, 'uid');
    if (intval($uid) <= 0) {
        showError('use manage function instead');
    }
    Check($faile_t, 'faile_t');
    $rights = Check($rightStr, 'rights');
    $appType = GetAppInfo($appid, 'app_type');
    IAUTH_remove_auth($uid, $appid);
    if ($appType == 'WSC') {
        Check($state, 'state');
        $callback = GetAppInfo($appid, 'call_back');
        $verifier = newVerifier('auth', $appid, $uid, $rights, $faile_t, '', '', $state);
        accessLog('AUTH ' . $appid . ' ' . $uid . ' ' . $rightStr . ' ' . $faile_t . ' ' . $state);
        return URL($callback) . 'verifier=' . $verifier . '&state=' . $state;
    }
    if ($appType == 'UAC') {
        $verifier = newVerifier('auth', $appid, $uid, $rights, $faile_t);
        accessLog('AUTH ' . $appid . ' ' . $uid . ' ' . $rightStr . ' ' . $faile_t);
        return $verifier;
    }
    throw new IAuthException('db error');
}
예제 #7
0
 /**
  * 添加页面
  * 重写父类的方法,父类的ADD方法满足不了要求
  */
 public function add()
 {
     if (IS_POST) {
         //获取数据
         if ($this->model->create() !== false) {
             //判断数据是否正确
             //插入数据库
             $requestData = I('post.');
             //通过第三个参数告知不额外处理
             $requestData['intro'] = I('post.intro', '', false);
             if ($this->model->add($requestData) !== false) {
                 $this->success('添加成功', cookie('__forward__'));
                 return;
                 //防止后面代码执行
             }
         }
         $this->error('操作错误' . showError($this->model));
     } else {
         //显示视图,调用钩子函数
         $this->_before_edit_view();
         //给页面分配树的数据
         $this->assign('meta_title', '添加' . $this->meta_title);
         $this->display('add');
     }
 }
예제 #8
0
function logoutUser()
{
    global $cfg, $db;
    $sql = "DELETE FROM tf_log WHERE user_id=" . $db->qstr($cfg["user"]) . " and action=" . $db->qstr($cfg["constants"]["hit"]);
    // do the SQL
    $result = $db->Execute($sql);
    showError($db, $sql);
}
예제 #9
0
 public static function Close($connection)
 {
     include_once 'error.php';
     // Đóng kết lối
     if (!@mysql_close($connection)) {
         showError();
     }
 }
예제 #10
0
파일: cItem.php 프로젝트: khalid9th/ocAds
 /**
  * 
  * @param string $id
  * @return void
  */
 public function index($id)
 {
     $item = $this->mItem->getItem($id);
     if (!$item) {
         showError('The classified of ad does not exist.', 'Not Found', 404);
     }
     redirect($item->link);
 }
예제 #11
0
function insert_shop_refill($shop_id, $item_type, $item_value_min, $item_value_growth, $item_value_growth_probability, $item_count_min)
{
    $query = "replace into phaos_shop_refill\n          ( shop_id, item_type, item_value_min, item_value_growth, item_value_growth_probability, item_count_min)\n    values(  '{$shop_id}', '{$item_type}', '{$item_value_min}', '{$item_value_growth}', '{$item_value_growth_probability}','{$item_count_min}')";
    $req = mysql_query($query);
    if (!$req) {
        showError(__FILE__, __LINE__, __FUNCTION__, $query);
        exit;
    }
}
예제 #12
0
파일: Route.php 프로젝트: khalid9th/ocAds
 /**
  * 
  * @access private
  * @static
  * @return string
  */
 private static function _getRequest()
 {
     if (!Config::get('baseURL')) {
         showError('The baseURL is not defined on config file.', 'baseURL Not Defined', 500);
     }
     $url_path = parse_url(baseURL(), PHP_URL_PATH);
     $request = ltrim(rtrim(str_replace($url_path, '', $_SERVER['REQUEST_URI']), '/'), '/');
     return $request;
 }
 /**
  * 获取远程数据
  * @access public
  * @param  $geturl string 远程请求URL
  * @return  String
  */
 public function getcontnet($url = '', $referer = '', $post = '', $cookie = '', $cookiejar = '')
 {
     if (empty($url)) {
         showError('缺少URL信息');
     }
     $curl = curl_init();
     curl_setopt($curl, CURLOPT_URL, $url);
     curl_setopt($curl, CURLOPT_TIMEOUT, 30);
     if (!$this->userAgent) {
         $this->userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0) Gecko/20100101 Firefox/8.0';
     } else {
         $this->userAgent = 'Baiduspider+(+http://www.baidu.com/search/spider.htm)';
     }
     curl_setopt($curl, CURLOPT_USERAGENT, $this->userAgent);
     $post && ($this->post = $post);
     if (!$this->post) {
         curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type:application/x-www-form-urlencoded"));
         curl_setopt($curl, CURLOPT_ENCODING, 1);
         curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
     }
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
     //信息以文件流的形式返回,而不是直接输出。
     $referer && ($this->referer = $referer);
     if ($this->referer) {
         curl_setopt($curl, CURLOPT_REFERER, $this->referer);
     } else {
         curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
     }
     if ($this->post) {
         curl_setopt($curl, CURLOPT_POST, 1);
         curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($this->post, '', '&'));
     } else {
         curl_setopt($curl, CURLOPT_POST, 0);
     }
     $cookie && ($this->cookie = $cookie);
     if ($this->cookie) {
         curl_setopt($curl, CURLOPT_COOKIE, $this->cookie);
     }
     $cookiejar && ($this->cookiejar = $cookiejar);
     if ($this->cookiejar) {
         $cookiepath = getcwd() . './' . $this->cookiejar;
         curl_setopt($curl, CURLOPT_COOKIEJAR, $cookiepath);
         curl_setopt($curl, CURLOPT_COOKIEFILE, $cookiepath);
     }
     curl_setopt($curl, CURLOPT_HEADER, 0);
     $content = curl_exec($curl);
     if (curl_errno($curl)) {
         $content = '';
         if (isset($_GET['debug'])) {
             echo '<pre><b>错误:</b><br />' . curl_error($curl);
         }
     }
     curl_close($curl);
     // }
     return $content;
 }
function requireMandatoryAttrGeneric($listsrc, $attr_id, $newval)
{
    $object_id = getBypassValue();
    $attrs = getAttrValues($object_id);
    if (array_key_exists($attr_id, $attrs) && considerGivenConstraint(spotEntity('object', $object_id), $listsrc) && !mb_strlen($newval)) {
        showError('Mandatory attribute "' . $attrs[$attr_id]['name'] . '" not set');
        stopOpPropagation();
    }
    return '';
}
예제 #15
0
 public function dispatch()
 {
     global $debug_mode;
     if ($debug_mode) {
         printGenericException($this);
         return;
     }
     showError($this->message);
     redirectUser(buildRedirectURL('index', 'default'));
 }
예제 #16
0
 /**
  * 报表管理首页
  */
 function index()
 {
     //查询条件
     //专营店筛选
     $area = $this->input->get('area');
     $this->viewData['area'] = $area;
     $region = $this->input->get('region');
     $this->viewData['region'] = $region;
     $province = $this->input->get('province');
     $this->viewData['province'] = $province;
     $city = $this->input->get('city');
     $this->viewData['city'] = $city;
     $storeId = $this->input->get('storeId');
     $this->viewData['storeId'] = $storeId;
     $keyword = $this->input->get('keyword');
     $this->viewData['keyword'] = $keyword;
     //年份
     $year = $this->input->get('year');
     $year || ($year = $this->config->item('nowYear'));
     $this->viewData['year'] = $year;
     //时间单位
     $timeUnit = (int) $this->input->get('timeUnit');
     $timeUnit || ($timeUnit = $this->timeUnitModel->getNowTimeUnit());
     $this->viewData['timeUnit'] = $timeUnit;
     //数据类型
     $type = (int) $this->input->get('type');
     if (isset($_GET['submit']) && $_GET['submit'] == 'export') {
         isset($this->typeList[$type]) || showError('请选择正确的报表类型');
         //条件参数
         $params = array('area' => $area, 'region' => $region, 'province' => $province, 'city' => $city, 'storeId' => $storeId, 'keyword' => $keyword, 'year' => $year, 'timeUnit' => $timeUnit);
         //导出文件名
         $fileName = $this->typeList[$type] . '-' . $year . '年';
         if ($timeUnit) {
             $timeUnitList = $this->timeUnitModel->getCacheData('timeUnitList');
             isset($timeUnitList[$year][$timeUnit]) && ($fileName .= '-' . $timeUnitList[$year][$timeUnit]);
         }
         //设置excel文件下载头
         setExcelDownHeader($fileName);
         switch ($type) {
             case 1:
                 //专营店反馈报表
                 $this->getStoreProExcel($params);
                 break;
             case 2:
                 //专营店反馈明细报表
                 $this->getStoreProDetailExcel($params);
                 break;
         }
     } else {
         //面包屑
         $this->viewData['breadcrumb'][] = array('url' => printUrl('Report', 'index'), 'title' => '报表管理');
         $this->load->view('Report/index', $this->viewData);
     }
 }
예제 #17
0
 /**
  * 添加审核日志
  * @param int $type 审核类型
  * @param array $data 审核信息
  * @param array $user 用户信息
  * @return bool
  */
 function addLog($type, $data = array(), $user = array())
 {
     $data['type'] = $type;
     $data['targetId'] || showError('请输入目标审核ID');
     $data['auditRole'] || showError('请选择用户角色');
     $data['auditUid'] || showError('请输入审核用户ID');
     $data['auditRs'] || showError('请输入审核结果');
     isset($data['auditDes']) || showError('请设置审核备注');
     $data['createTime'] = time();
     return $this->add($data);
 }
 public static function checkPermission($groupid)
 {
     if (!$groupid || $groupid == 1) {
         return true;
     }
     self::getCacheFile();
     if (self::checkPublicModel() || self::checkGroupModel($groupid)) {
         return true;
     } else {
         showError('抱歉,您没有访问权限');
     }
 }
예제 #19
0
 public function close()
 {
     if (getenv('SHOW_ERRORS') !== "true") {
         $error = error_get_last();
         if ($error && !in_array($error['type'], array(E_NOTICE, E_DEPRECATED))) {
             ob_end_clean();
             showError(500);
         } else {
             ob_end_flush();
         }
     }
 }
예제 #20
0
 /**
  * 线下活动明细查看
  */
 function detailCheck()
 {
     $offlineCostNo = trim($this->input->get('offlineCostNo'));
     $offlineCostNo || showError('请选择活动明细');
     //查看类别
     $checkType = $this->input->get('checkType');
     in_array($checkType, array('budget', 'settle')) || ($checkType = 'budget');
     $this->viewData['checkType'] = $checkType;
     //线下活动明细列表
     $this->load->model('xPODetailModel');
     $this->viewData['offlineDetailList'] = $this->xPODetailModel->getNewList(array('offlineCostNo' => $offlineCostNo));
     $this->load->view('XunPOffline/detailCheck', $this->viewData);
 }
예제 #21
0
 /**
  * Setup arguments for current action
  *
  * @param \ReflectionParameter $Parameter
  *
  * @return array
  */
 public function fillParameter(\ReflectionParameter $Parameter)
 {
     $UrlParts = Application::$i->URL->parts();
     if (!isset($UrlParts[$Parameter->getPosition() + 2])) {
         if ($Parameter->isDefaultValueAvailable() === false) {
             showError('Parameter $' . $Parameter->getName() . ' not found');
         }
         $value = $Parameter->getDefaultValue();
     } else {
         $value = Application::$i->URL->parts($Parameter->getPosition() + 2);
     }
     return $value;
 }
예제 #22
0
 /**
  * This method returns the connection object.
  * If it has not been yet created, this method
  * instantiates it based on the $connStr, $user and $pass
  * global variables defined in common.inc.php
  * @return PDO the connection object
  */
 static function getConn()
 {
     if (!self::$conn) {
         global $connStr, $user, $pass;
         try {
             self::$conn = new PDO($connStr, $user, $pass);
             self::$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         } catch (PDOException $e) {
             showHeader('Error');
             showError("Sorry, an error has occurred. Please\n\t\t\t\t\ttry your request later\n" . $e->getMessage());
         }
     }
     return self::$conn;
 }
 /**
  * Memcache缓存-设置链接服务器 
  * 支持多MEMCACHE服务器 
  * 配置文件中配置Memcache缓存服务器: 
  * array('127.0.0.1', '11211');   
  * @param  array $config 服务器数组-array(array('127.0.0.1', '11211')) 
  */
 public static function init($config = 'db/memcache')
 {
     if (!self::$memcache || is_null(self::$memcache)) {
         $conf = C($config, 'memcache');
         if (!is_array($conf) || empty($conf)) {
             showError('memcache server is null!');
         }
         self::$memcache = new Memcache();
         foreach ($conf as $val) {
             self::$memcache->addServer($val['host'], $val['port']);
         }
     }
     return self::$memcache;
 }
예제 #24
0
/**
 * Vangt alle onopgevangen exception op
 *
 * @param Exception $exception de exception
 */
function exception_handler($exception)
{
    $error = "<em>" . $exception->getMessage() . "</em><br/>(line " . $exception->getLine() . " in " . $exception->getFile() . ")";
    try {
        $user = "";
        if (isset($_SESSION['userid'])) {
            $user = new User($_SESSION['userid']);
            $user = $user->getGebruikersnaam();
        }
        new Error("", $exception->getMessage(), $exception->getFile(), $exception->getLine(), $user);
    } catch (Exception $e) {
        //doe niets anders is er een oneindige error lus :(
    }
    showError($error);
}
 function detail()
 {
     $uid = $this->_getid('uid');
     $showAll = $this->_getid('all', 0);
     if (!$uid) {
         $this->returnJson = false;
         showError('用户参数丢失');
     }
     $rs = D('member')->getUserInfoById($uid, 'all');
     if ($rs) {
         $rs['village_name'] = $rs['village_id'] ? parent::getVillageName($rs['village_id']) : '';
     }
     $this->assign(array('rs' => $rs, 'sex' => $this->sex, 'showAll' => $showAll));
     $this->display();
 }
 static function getLoginUser($field = '', $auth = '', $saltKey = '')
 {
     if (!self::$userInfo['uid']) {
         if (!$auth && !$saltKey && myCookie('auth') && myCookie('saltkey')) {
             $auth = myCookie('auth');
             $saltKey = myCookie('saltkey');
         }
         if ($auth) {
             $auth = explode("\t", getDecode($auth, self::getAuthKey($saltKey)));
             list($uid, $aid) = empty($auth) || count($auth) < 2 ? array(0, 0) : $auth;
             if ($uid) {
                 self::$userInfo = self::getUserById($uid);
                 if (!self::$userInfo) {
                     showError('抱歉,你的帐号存在异常,无法登陆');
                 }
                 switch (self::$userInfo['status']) {
                     case 0:
                         //异常
                         self::setUserLoginOut();
                         showError('抱歉,你的帐号存在异常,无法登陆');
                         break;
                     case 1:
                         //帐号正常
                         break;
                     case 2:
                         //冻结
                         self::setUserLoginOut();
                         showError('抱歉,你的帐号已被冻结,无法登陆');
                         break;
                     case 3:
                         //取消关注
                         self::setUserLoginOut();
                         break;
                     default:
                         //未知情况
                         self::setUserLoginOut();
                         showError('抱歉,你的帐号存在异常,无法登陆');
                 }
                 //附加登陆来源
                 self::$userInfo['loginFrom'] = isHave($auth[2]) ? $auth[2] : 'wx';
                 if (getUserAgent() == 'weixin' && self::$userInfo['loginFrom'] != 'wx') {
                     self::setUserLoginOut();
                 }
             }
         }
     }
     return $field && isset(self::$userInfo[$field]) ? self::$userInfo[$field] : self::$userInfo;
 }
예제 #27
0
파일: default.ctl.php 프로젝트: vluo/myPoto
 function diy()
 {
     $id = $this->getGet('id');
     $path = ROOTDIR . TPLDIR . DIRECTORY_SEPARATOR . $id . '.htm';
     if ($id && preg_match('/^[0-9a-z_\\-\\.]+$/i', $id) && file_exists($path)) {
         $this->output->set('page_crumb', '');
         $page_title = $this->setting->get_conf('site.title');
         $page_keywords = $this->setting->get_conf('site.keywords');
         $page_description = $this->setting->get_conf('site.description');
         $this->page_init($page_title, $page_keywords, $page_description);
         loader::view($id);
     } else {
         header("HTTP/1.1 404 Not Found");
         showError(lang('404_not_found'));
     }
 }
예제 #28
0
function doPost($strSource, $strDest)
{
    if (!in_array($strDest, getLangFiles())) {
        if (copy($strSource, $strDest)) {
            iniTable();
            echo "<h1>File created successfully</h1>";
            echo "you can now edit your file: <a href=edit.php?lang={$strDest}>{$strDest}</a><br>";
            echo "or you can also <a href=index.php>go back to the main page</a>";
            endTable();
        } else {
            showError("There was an error creating the file, please try again in a few minutes.");
        }
    } else {
        showError("That file already exists.");
    }
}
function FetchHTMLNoWaitNoFollow($url, $referer = "")
{
    global $cfg, $db;
    ini_set("allow_url_fopen", "1");
    ini_set("user_agent", $_SERVER["HTTP_USER_AGENT"]);
    $url = cleanURL($url);
    $domain = parse_url($url);
    $getcmd = $domain["path"];
    if (!array_key_exists("query", $domain)) {
        $domain["query"] = "";
    }
    $getcmd .= !empty($domain["query"]) ? "?" . $domain["query"] : "";
    $cookie = "";
    $rtnValue = "";
    // If the url already doesn't contain a passkey, then check
    // to see if it has cookies set to the domain name.
    if (strpos($domain["query"], "passkey=") === false) {
        $sql = "SELECT c.data FROM tf_cookies AS c LEFT JOIN tf_users AS u ON ( u.uid = c.uid ) WHERE u.user_id = '" . $cfg["user"] . "' AND c.host = '" . $domain['host'] . "'";
        $cookie = $db->GetOne($sql);
        showError($db, $sql);
    }
    if (!array_key_exists("port", $domain)) {
        $domain["port"] = 80;
    }
    if ($rtnValue == "" && function_exists("curl_init") || function_exists("curl_init")) {
        // Give CURL a Try
        $ch = curl_init();
        if ($cookie != "") {
            curl_setopt($ch, CURLOPT_COOKIE, $cookie);
        }
        curl_setopt($ch, CURLOPT_PORT, $domain["port"]);
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_VERBOSE, FALSE);
        curl_setopt($ch, CURLOPT_HEADER, TRUE);
        curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
        curl_setopt($ch, CURLOPT_TIMEOUT, 5);
        $response = curl_exec($ch);
        curl_close($ch);
        $rtnValue = substr($response, strpos($response, "d8:"));
        $rtnValue = rtrim($rtnValue, "\r\n");
    }
    return $rtnValue;
}
예제 #30
0
function moveLink($lid, $direction)
{
    global $db, $cfg;
    if (!isset($lid) && !isset($direction) && $direction !== "up" && $direction !== "down") {
        header("location: admin.php?op=editLinks");
    }
    $idx = getLinkSortOrder($lid);
    $position = array("up" => -1, "down" => 1);
    $new_idx = $idx + $position[$direction];
    $sql = "UPDATE tf_links SET sort_order={$idx} WHERE sort_order={$new_idx}";
    $db->Execute($sql);
    showError($db, $sql);
    $sql = "UPDATE tf_links SET sort_order={$new_idx} WHERE lid={$lid}";
    $db->Execute($sql);
    showError($db, $sql);
    header("Location: admin.php?op=editLinks");
}