/** Function to get company quotes from external site
 * @param $var -- var:: Type string(company trickersymbol)
 * @returns $quote_data -- quote_data:: Type string array
 *
 */
function getQuoteData($var)
{
    $url = "http://finance.yahoo.com/q?s=" . $var;
    $h = new http();
    $h->dir = "class_http_dir/";
    if (!$h->fetch($url, 2)) {
        echo "<h2>There is a problem with the http request!</h2>";
        echo $h->log;
        exit;
    }
    $res_arr = array();
    $quote_data = http::table_into_array($h->body, 'Delayed quote data', 0, null);
    if (is_array($quote_data)) {
        array_shift($quote_data);
        array_shift($quote_data);
        if ($quote_data[0][0] != 'Last Trade:') {
            array_shift($quote_data);
        }
    } else {
        die;
    }
    for ($i = 0; $i < 16; $i++) {
        if ($quote_data != '') {
            $res_arr[] = $quote_data[$i];
        }
    }
    return $res_arr;
}
Example #2
0
 public function __construct($id)
 {
     $server = Servers::model()->findByPK($id);
     $http = new http();
     $http->setTimeout(10);
     $this->moment = new moment($http, array('server_ip' => $server->ip, 'server_port' => $server->s_port, 'web_port' => $server->w_port));
 }
Example #3
0
 static function act_message()
 {
     if (post('message_submit', 'isset')) {
         //检查验证码
         $check_code = post('code', 'post');
         if ($check_code != session('message_code', true)) {
             http::json(array('error' => 2, 'info' => 'check_code error'));
         }
         //接收、过滤数据
         $data['user_name'] = post('name', 'title');
         $data['tel'] = post('contact_tel', 'number');
         $data['phone'] = post('contact_phone', 'account');
         $data['email'] = post('email', 'account');
         $data['message'] = post('message_content', 'info');
         //验证数据
         $data['tel'] = safe::reg($data['tel'], 'tel') ? $data['tel'] : null;
         $data['phone'] = safe::reg($data['phone'], 'phone') ? $data['phone'] : null;
         $data['email'] = safe::reg($data['email'], 'email') ? $data['email'] : null;
         if ($data['message']) {
             $add_result = db::add('message', $data);
             //将数据写入留言表
             if ($add_result) {
                 http::json(array('error' => 0, 'info' => 'add message succeed'));
             }
         }
     }
     //以json格式返回给浏览器
     http::json(array('error' => 1, 'info' => 'add message failed'));
 }
 public function processform()
 {
     if (!isset($_POST['contactvalue'])) {
         return '';
     }
     $time = substr($_POST['contactvalue'], strlen('_contactform'));
     if (time() > $time) {
         return $this->errmesg;
     }
     $email = trim($_POST['email']);
     if (!tcontentfilter::ValidateEmail($email)) {
         return sprintf('<p><strong>%s</strong></p>', tlocal::get('comment', 'invalidemail'));
     }
     $url = trim($_POST['site']);
     if (empty($url) || strbegin($url, litepublisher::$site->url)) {
         return $this->errmesg;
     }
     if ($s = http::get($url)) {
         if (!strpos($s, '<meta name="generator" content="Lite Publisher')) {
             return $this->errmesg;
         }
     } else {
         return $this->errmesg;
     }
     $content = trim($_POST['content']);
     if (strlen($content) <= 15) {
         return sprintf('<p><strong>%s</strong></p>', tlocal::get('comment', 'emptycontent'));
     }
     $content = "{$url}\n" . $_POST['sitetitle'] . "\n\n" . $content;
     tmailer::sendmail('', $email, '', litepublisher::$options->email, $this->subject, $content);
     return $this->success;
 }
Example #5
0
function eqphp_autoload($class)
{
    if (isset($_SERVER['REQUEST_URI'])) {
        $root = current(explode('/', trim($_SERVER['REQUEST_URI'], '/')));
    }
    //optimize: $config save memcache or redis
    $group = config('group.list');
    $path = isset($root) && is_array($group) && in_array($root, $group) ? $root . '/' : '';
    $module = array('a' => $path . 'action', 'm' => $path . 'model', 'p' => $path . 'plugin', 's' => 'server');
    $prefix = substr($class, 0, strpos($class, '_'));
    $dir_name = in_array($prefix, array('a', 'm', 's', 'p')) ? $module[$prefix] : 'class';
    $execute_file = $dir_name . '/' . $class . '.php';
    if (file_exists($execute_file)) {
        return include PATH_ROOT . $execute_file;
    }
    //通用加载
    if (config('state.common_load') && in_array($prefix, array('a', 'm'), true)) {
        $common_option = array('a' => 'action/', 'm' => 'model/');
        $execute_file = PATH_ROOT . $common_option[$prefix] . $class . '.php';
        if (file_exists($execute_file)) {
            return include $execute_file;
        }
    }
    //贪婪加载
    if (config('state.greedy_load')) {
        $execute_file = file::search(PATH_ROOT . $dir_name, $class, $file_list, true);
        if ($execute_file) {
            return include $execute_file;
        }
    }
    if ($prefix === 'a') {
        logger::notice('class [' . $class . '] not found');
        http::send(404);
    }
}
 public static function parse($url)
 {
     if ($s = http::get($url)) {
         $backuper = tbackuper::i();
         $archtype = $backuper->getarchtype($url);
         if ($files = $backuper->unpack($s, $archtype)) {
             list($filename, $content) = each($files);
             if ($about = self::getabout($files)) {
                 $item = new tdownloaditem();
                 $item->type = strbegin($filename, 'plugins/') ? 'plugin' : 'theme';
                 $item->title = $about['name'];
                 $item->downloadurl = $url;
                 $item->authorurl = $about['url'];
                 $item->authorname = $about['author'];
                 $item->rawcontent = $about['description'];
                 $item->version = $about['version'];
                 $item->tagnames = empty($about['tags']) ? '' : trim($about['tags']);
                 if ($screenshot = self::getfile($files, 'screenshot.png')) {
                     $media = tmediaparser::i();
                     $idscreenshot = $media->uploadthumbnail($about['name'] . '.png', $screenshot);
                     $item->files = array($idscreenshot);
                 }
                 return $item;
             }
         }
     }
     return false;
 }
 public function processform()
 {
     $plugin = tsourcefiles::i();
     if (isset($_POST['download'])) {
         set_time_limit(300);
         $version = litepublisher::$options->version;
         if (!(($s = http::get("http://litepublisher.googlecode.com/files/litepublisher.{$version}.tar.gz")) || ($s = http::get("http://litepublisher.com/download/litepublisher.{$version}.tar.gz")))) {
             return 'Error download';
         }
         tbackuper::include_tar();
         $tar = new tar();
         $tar->loadfromstring($s);
         if (!is_array($tar->files)) {
             unset($tar);
             return 'Invalid file archive';
         }
         tfiler::delete($plugin->root, true, false);
         foreach ($tar->files as $item) {
             $filename = $plugin->root . $item['name'];
             $dir = dirname($filename);
             if (!is_dir($dir)) {
                 $this->mkdir($dir);
             }
             file_put_contents($filename, $item['file']);
             @chmod($filename, 0666);
         }
         unset($tar);
         $plugin->reread();
     } elseif (isset($_POST['reread'])) {
         $plugin->reread();
     } else {
         $plugin->root = $_POST['root'];
         $plugin->save();
     }
 }
Example #8
0
 public function fileadded($id)
 {
     $files = tfiles::i();
     $item = $files->getitem($id);
     if ('image' != $item['media']) {
         return;
     }
     $fileurl = $files->geturl($id);
     if ($s = http::get('http://www.smushit.com/ysmush.it/ws.php?img=' . urlencode($fileurl))) {
         $json = json_decode($s);
         if (isset($json->error) || -1 === (int) $json->dest_size || !$json->dest) {
             return;
         }
         $div = $item['size'] - (int) $json->dest_size;
         if ($div / ($item['size'] / 100) < 3) {
             return;
         }
         $dest = urldecode($json->dest);
         if (!strbegin($dest, 'http')) {
             $dest = 'http://www.smushit.com/' . $dest;
         }
         if ($content = http::get($dest)) {
             return $files->setcontent($id, $content);
         }
     }
 }
Example #9
0
 public function __call($method, $params = array())
 {
     $params = $params['0'];
     $params['action'] = $method;
     $params['appid'] = $this->appid;
     $params['format'] = 'json';
     $params['datetime'] = $_SERVER['REQUEST_TIME'];
     $params['sign'] = $this->sign($params);
     //自动重试5次 防止失败!
     for ($i = 0; $i < 5; $i++) {
         $data = json_decode(http::get($this->apiurl, $params), true);
         if (is_array($data) && $data['status'] != 0) {
             break;
         }
     }
     if (is_array($data)) {
         if ($data['status'] == 1) {
             return $data['data'];
         } else {
             exit('采集错误!原因:' . $data['msg'] . ' 参数:<pre>' . var_export($params, true) . '</pre>');
         }
     } else {
         exit('采集错误!方法' . $method . ' 参数:<pre>' . var_export($params, true) . '</pre>');
     }
 }
Example #10
0
 function index()
 {
     //验证权限,跳转提示页面
     if (!in_array(parent::visite_access, $this->admin_access)) {
         http::skip('message/login/forbid');
     }
     //接收请求参数
     $category = rq(2);
     //类型(1,已读/0,未读/全部)
     $page = rq(3, 1);
     //页码
     //获取删除和回复权限
     $del_access = in_array(parent::del_access, $this->admin_access);
     $reply_access = in_array(parent::reply_access, $this->admin_access);
     //调用查询模型
     $message = self::message_model($category, $page, 10);
     //处理分页导航
     $page_url = dc_url . 'manage/' . $category . '/';
     $page_nav = s_page::mark($page_url, $message['info'][0], $page, 3);
     //视图赋值
     $tpl = smarty('admin');
     $head['frame'] = '_self';
     $head['title'] = '留言管理_EQPHP案例留言本';
     $tpl->assign('head', $head);
     $tpl->assign('del_access', $del_access);
     $tpl->assign('reply_access', $reply_access);
     $tpl->assign('rs_count', $message['num']);
     $tpl->assign('message', $message['info'][1]);
     $tpl->assign('page_nav', $page_nav);
     //渲染视图模板
     $tpl->display('message/manage');
 }
Example #11
0
function eqphp_autoload($lib_name)
{
    $server_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
    $group = explode(',', config('group|info'));
    $rq_url = explode('/', trim($server_uri, '/'));
    $dir_first = array('a' => 'action', 'm' => 'model');
    $dir_second = array('a' => $rq_url[0] . '/action', 'm' => $rq_url[0] . '/model');
    $dir_arr = in_array($rq_url[0], $group) ? $dir_second : $dir_first;
    $dir_arr = array_merge($dir_arr, array('s' => 'server', 'p' => 'plugin'));
    $prefix = substr($lib_name, 0, strpos($lib_name, '_'));
    $dir_name = in_array($prefix, array_keys($dir_arr)) ? $dir_arr[$prefix] : 'class';
    $execute_file = $dir_name . '/' . $lib_name . '.php';
    if (strtolower($lib_name) == 'smarty') {
        $execute_file = 'data/smarty/Smarty.class.php';
    }
    if (file_exists($execute_file)) {
        return include dc_root . $execute_file;
    }
    if ($prefix == 'a') {
        $tpl_file = dc_root . 'view/' . substr($lib_name, 2) . '.html';
        if (file_exists($tpl_file)) {
            exit(include $tpl_file);
        }
        if ($execute_file != 'action/a_.php') {
            http::send(404, 0);
            http::out('404 Not Found');
        }
    }
    if (strpos(strtolower($execute_file), 'smarty_internal_') === false) {
        echo "class [" . $lib_name . "] is error !<br>";
    }
}
Example #12
0
 /**
  * 组装接口调用参数 并调用接口
  *
  * @param  string $api    微博API
  * @param  array $param   调用API的额外参数
  * @param  string $method HTTP请求方法 默认为GET
  * @param  bool $multi
  * @return string json
  */
 public function call($api, $param = array(), $method = 'GET', $multi = false)
 {
     /* 腾讯QQ调用公共参数 */
     $params = array('access_token' => $this->token);
     $params = array_merge($params, $param);
     $data = http::get($this->apiBase . $api, $params);
     return json_decode($data, true);
 }
Example #13
0
 public function desc($id)
 {
     ControllerTray::instance()->renderLayout = false;
     http::contentType('application/json');
     $this->data->id = $id;
     $this->data->info = new \ROM\BongUserData();
     $this->data->info->load($id . '.usr');
 }
Example #14
0
 /**
  * Get jsticket.
  *
  * @return string
  */
 public function getTicket()
 {
     $key = 'overtrue.wechat.jsapi_ticket.' . $this->appId;
     return $this->cache->get($key, function ($key) {
         $result = $this->http->get(self::API_TICKET);
         $this->cache->set($key, $result['ticket'], $result['expires_in'] - 100);
         return $result['ticket'];
     });
 }
Example #15
0
function fetch_remote_xml($url, $fetcher = false)
{
    // Create a new instance of Troy Wolf's HTTP class (if a mock one
    // wasn't created during testing)
    if (!is_object($fetcher)) {
        $fetcher = new http();
    }
    // Set the path of the cache
    $fetcher->dir = dirname(__FILE__) . "/cache/";
    // Fetch the data from the URL using a GET request (that's really
    // all we need for this plugin--we're really only fetching gdata here)
    if (!$fetcher->fetch($url, 43200)) {
        return false;
    }
    // Let's return the http class object to the caller function, assuming that we
    // actually received some
    return $fetcher;
}
Example #16
0
 public function execute()
 {
     http::freeze();
     //a Spirit Cannot send any HTTP Header unless It is used as ResponseService
     $this->engine->executeLogic();
     http::release();
     http::contentType('application/json');
     return json_encode($this->engine->xdo());
 }
Example #17
0
 function __construct()
 {
     $this->session = session::getInstance();
     $this->post = post::getInstance();
     $this->get = get::getInstance();
     $this->http = http::getInstance();
     $this->file = file::getInstance();
     $this->cookie = cookie::getInstance();
 }
Example #18
0
 public function execute()
 {
     http::freeze();
     //a Spirit Cannot send any HTTP Header unless It is used as ResponseService
     $this->engine->run();
     http::release();
     http::contentType('text/xml');
     return $this->engine->xdo()->toXML()->saveXML();
 }
Example #19
0
 /**
  * Get jsticket.
  *
  * @return string
  */
 public function ticket()
 {
     $key = self::TICKET_CACHE_PREFIX . $this->appId;
     return $this->cache->get($key, function ($key) {
         $result = $this->http->get(self::API_TICKET);
         $this->cache->set($key, $result['ticket'], $result['expires_in'] - 500);
         return $result['ticket'];
     });
 }
Example #20
0
 function __construct()
 {
     $this->session = session::getInstance();
     $this->post = post::getInstance();
     $this->get = get::getInstance();
     $this->http = http::getInstance();
     $this->file = new file();
     $this->cookie = new cookie(config('cookie'));
 }
Example #21
0
 function thumb($url = '', $source = '', $name = '', $type = -1, $width = 0, $height = 0)
 {
     //如何生成不成功,则返回原url
     global $cms_abs, $cmsurl, $ftp_url, $atm_smallsite;
     if (!$url || !$source || !$name || !$width || !$height) {
         return $url;
     }
     include_once M_ROOT . "./include/upload.cls.php";
     if ($ftp_url && preg_match(u_regcode($ftp_url), $url)) {
         //ftp上的文件
         include_once M_ROOT . "./include/http.cls.php";
         include_once M_ROOT . "./include/ftp.fun.php";
         //下载原图
         $tempfile = M_ROOT . './dynamic/imcache/' . basename($url);
         mmkdir($tempfile, 0, 1);
         $m_http = new http();
         $m_http->savetofile($url, $tempfile);
         unset($m_http);
         //生成缩略图
         $m_upload = new cls_upload();
         $m_upload->image_resize($tempfile, $width, $height, $tempfile . '.s.jpg');
         @unlink($tempfile);
         unset($m_upload);
         //上传缩略图
         $ftpfile = preg_replace(u_regcode($ftp_url), '', $url) . 's/' . $width . '_' . $height . '.jpg';
         //根据url得到缩略上传到的位置
         $tempfile .= '.s.jpg';
         if (ftp_upload($tempfile, $ftpfile)) {
             $this->refresh_record($source, $name, $type, $width, $height);
             //将缩略图规格写入数据库
             return $url . 's/' . $width . '_' . $height . '.jpg';
         } else {
             return $url;
         }
         @unlink($tempfile);
     } else {
         //本地服务器上的文件
         $m_upload = new cls_upload();
         $localfile = local_atm($url);
         $m_upload->image_resize($localfile, $width, $height, $localfile . 's/' . $width . '_' . $height . '.jpg');
         unset($m_upload);
         return $url . 's/' . $width . '_' . $height . '.jpg';
     }
 }
Example #22
0
 /**
  * \virtual
  * @param string $methodName
  * @param array $args
  */
 public function call($methodName, $args = array())
 {
     $this->spiritEngine->setActiveInstance($this->_activeInstanceId);
     http::freeze();
     //a Spirit Cannot send any HTTP Header unless It is used as ResponseService. as the spirit output is embedded in the app output. so its the app that sends the header. not the spirit
     $this->spiritEngine->run($this->spiritName, $methodName, $args);
     http::release();
     //Engine Automatically Clear's the Active Instance Id So no need to call clear Explecitely
     return $this->spiritEngine->response();
 }
 /**
  * Поиск доступного обновления.
  *
  * @return string номер доступной версии.
  */
 private static function getAvailable()
 {
     $release = mcms::version(mcms::VERSION_RELEASE);
     $content = http::fetch('http://code.google.com/p/molinos-cms' . '/downloads/list?q=label:R' . $release, http::CONTENT);
     if (preg_match($re = "@http://molinos-cms\\.googlecode\\.com/files/molinos-cms-({$release}\\.[0-9]+)\\.zip@", $content, $m)) {
         return $m[1];
     } else {
         return $version;
     }
 }
Example #24
0
 public function gui($url)
 {
     # Create list
     if (!empty($_POST['createlist'])) {
         try {
             $this->defaultWordsList();
             http::redirect($url . '&list=1');
         } catch (Exception $e) {
             $this->okt->error->set($e->getMessage());
         }
     }
     # Adding a word
     if (!empty($_POST['swa'])) {
         try {
             $this->addRule($_POST['swa']);
             http::redirect($url . '&added=1');
         } catch (Exception $e) {
             $okt->error->add($e->getMessage());
         }
     }
     # Removing spamwords
     if (!empty($_POST['swd']) && is_array($_POST['swd'])) {
         try {
             $this->removeRule($_POST['swd']);
             http::redirect($url . '&removed=1');
         } catch (Exception $e) {
             $okt->error->add($e->getMessage());
         }
     }
     /* DISPLAY
     		---------------------------------------------- */
     global $okt;
     $okt->page->messages->success('list', __('m_antispam_Words_successfully_added'));
     $okt->page->messages->success('added', __('m_antispam_Word_successfully_added'));
     $okt->page->messages->success('removed', __('m_antispam_Words_successfully_removed'));
     $res = '';
     $res .= '<form action="' . html::escapeURL($url) . '" method="post">' . '<fieldset><legend>' . __('m_antispam_Add_word') . '</legend>' . '<p>' . form::text('swa', 20, 128) . ' ';
     $res .= adminPage::formtoken() . '<input type="submit" value="' . __('c_c_action_Add') . '"/></p>' . '</fieldset>' . '</form>';
     $rs = $this->getRules();
     if ($rs->isEmpty()) {
         $res .= '<p><strong>' . __('m_antispam_No_word_in_list') . '</strong></p>';
     } else {
         $res .= '<form action="' . html::escapeURL($url) . '" method="post">' . '<fieldset><legend>' . __('m_antispam_List') . '</legend>' . '<div style="' . $this->style_list . '">';
         while ($rs->fetch()) {
             $disabled_word = false;
             $p_style = $this->style_p;
             $res .= '<p style="' . $p_style . '"><label class="classic">' . form::checkbox(array('swd[]'), $rs->rule_id, false) . ' ' . html::escapeHTML($rs->rule_content) . '</label></p>';
         }
         $res .= '</div>' . '<p>' . form::hidden(array('spamwords'), 1) . adminPage::formtoken() . '<input type="submit" value="' . __('m_antispam_Delete_selected_words') . '"/></p>' . '</fieldset></form>';
     }
     $res .= '<form action="' . html::escapeURL($url) . '" method="post">' . '<p><input type="submit" value="' . __('m_antispam_Create_default_wordlist') . '" />' . form::hidden(array('spamwords'), 1) . form::hidden(array('createlist'), 1) . adminPage::formtoken() . '</p>' . '</form>';
     return $res;
 }
Example #25
0
 function __construct()
 {
     $admin = session('admin');
     if ($admin) {
         $this->admin_account = $admin['account'];
         $this->admin_access = explode(',', $admin['access']);
     }
     //若用户未登录,跳转至登录页面
     if (!$this->admin_account) {
         http::skip('message/login');
     }
 }
Example #26
0
 protected static function register($plugins = array(), $smarty = null)
 {
     $type = null;
     foreach ($plugins as $plug) {
         $type = count($plug) > 2 ? $plug[2] : 'function';
         if (count($plug) < 2 || !in_array($type, array('function', 'block', 'modifier'))) {
             http::out($plug);
         }
         self::reg($plug[0], $plug[1], $smarty, $type);
     }
     return true;
 }
Example #27
0
 public function main($name = null, $age = null)
 {
     http::contentType('text/html');
     $this->bootStrapJs();
     if (!$this->cached() || $name) {
         $this->xdo->name = $name;
     }
     if (!$this->cached() || $age) {
         $this->xdo->age = $age;
     }
     //$this->switchView('alternateView');
 }
Example #28
0
 public static function displayMenu($class = '', $id = '', $description = '')
 {
     global $core;
     $ret = '';
     if (!(bool) $core->blog->settings->system->simpleMenu_active) {
         return $ret;
     }
     $menu = $GLOBALS['core']->blog->settings->system->get('simpleMenu');
     $menu = @unserialize($menu);
     if (is_array($menu)) {
         // Current relative URL
         $url = $_SERVER['REQUEST_URI'];
         $abs_url = http::getHost() . $url;
         // Home recognition var
         $home_url = html::stripHostURL($GLOBALS['core']->blog->url);
         $home_directory = dirname($home_url);
         if ($home_directory != '/') {
             $home_directory = $home_directory . '/';
         }
         // Menu items loop
         foreach ($menu as $i => $m) {
             # $href = lien de l'item de menu
             $href = $m['url'];
             $href = html::escapeHTML($href);
             # Active item test
             $active = false;
             if ($url == $href || $abs_url == $href || $_SERVER['URL_REQUEST_PART'] == $href || $_SERVER['URL_REQUEST_PART'] == '' && ($href == $home_url || $href == $home_directory)) {
                 $active = true;
             }
             $title = $span = '';
             if ($m['descr']) {
                 if ($description == 'title' || $description == 'both') {
                     $title = ' title="' . html::escapeHTML(__($m['descr'])) . '"';
                 }
                 if ($description == 'span' || $description == 'both') {
                     $span = ' <span>' . html::escapeHTML(__($m['descr'])) . '</span>';
                 }
             }
             $label = html::escapeHTML(__($m['label']));
             $item = new ArrayObject(array('url' => $href, 'label' => $label, 'title' => $title, 'span' => $span, 'active' => $active, 'class' => ''));
             # --BEHAVIOR-- publicSimpleMenuItem
             $core->callBehavior('publicSimpleMenuItem', $i, $item);
             $ret .= '<li class="li' . ($i + 1) . ($item['active'] ? ' active' : '') . ($i == 0 ? ' li-first' : '') . ($i == count($menu) - 1 ? ' li-last' : '') . ($item['class'] ? $item['class'] : '') . '">' . '<a href="' . $href . '"' . $item['title'] . '>' . $item['label'] . $item['span'] . '</a>' . '</li>';
         }
         // Final rendering
         if ($ret) {
             $ret = '<nav role="navigation"><ul ' . ($id ? 'id="' . $id . '"' : '') . ' class="simple-menu' . ($class ? ' ' . $class : '') . '">' . "\n" . $ret . "\n" . '</ul></nav>';
         }
     }
     return $ret;
 }
Example #29
0
 /**
  * 获取openid
  * @return mixed
  * @throws Exception
  */
 public function getOpenId()
 {
     if ($this->openid) {
         return $this->openid;
     }
     $data = http::get($this->apiBase . 'oauth2.0/me', array('access_token' => $this->token));
     $data = json_decode(trim(substr($data, 9), " );\n"), true);
     if (isset($data['openid'])) {
         $this->openid = $data['openid'];
         return $data['openid'];
     } else {
         throw new Exception("获取用户openid出错:{$data['error_description']}");
     }
 }
Example #30
0
 function upload()
 {
     if (isset($_FILES['imgFile'])) {
         try {
             $save_name = $this->user_id . '_' . date("dHis");
             $upload = new s_upload($_FILES['imgFile'], $save_name, 5, 'editor', date('ym') . '/');
             $file_name = $upload->get('file_name');
             http::json(array('error' => 0, 'url' => U_R_L . strstr($file_name, 'file/editor/')));
         } catch (sException $e) {
             $message = config('error.' . $e->error, 'upload');
             http::json(array('error' => 1, 'message' => $message));
         }
     }
     http::json(array('error' => 1, 'message' => 'system busy, please try again later'));
 }