當前位置: 首頁>>代碼示例>>PHP>>正文


PHP H類代碼示例

本文整理匯總了PHP中H的典型用法代碼示例。如果您正苦於以下問題:PHP H類的具體用法?PHP H怎麽用?PHP H使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了H類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: software

 /**
  * Update The Lobby Core (Software)
  */
 public static function software()
 {
     if (\Lobby\Modules::exists("admin")) {
         $admin_previously_installed = true;
     }
     $latest_version = getOption("lobby_latest_version");
     $url = \Lobby\Server::download("lobby", $latest_version);
     $zipFile = L_DIR . "/contents/update/" . $latest_version . ".zip";
     self::zipFile($url, $zipFile);
     // Make the Zip Object
     $zip = new \ZipArchive();
     if ($zip->open($zipFile) != "true") {
         \Lobby::log("Unable to open downloaded Zip File.");
         ser("Error", "Unable to open Zip File.  <a href='update.php'>Try again</a>");
     }
     \Lobby::log("Upgrading Lobby Software From {$zipFile}");
     /**
      * Extract New Version
      */
     $zip->extractTo(L_DIR);
     $zip->close();
     \Lobby\FS::remove($zipFile);
     self::finish_software_update(isset($admin_previously_installed));
     return L_URL . "/admin/about.php?updated=1&oldver={$oldVer}" . \H::csrf("g");
 }
開發者ID:saviobosco,項目名稱:lobby,代碼行數:28,代碼來源:Update.php

示例2: remove_slide_action

 public function remove_slide_action()
 {
     if (!$this->model('slide')->remove_slide($_POST['id'])) {
         H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('刪除幻燈片失敗')));
     }
     H::ajax_json_output(AWS_APP::RSM(null, 1, null));
 }
開發者ID:egogg,項目名稱:wecenter-dev,代碼行數:7,代碼來源:slide.php

示例3: binding_callback_action

 function binding_callback_action()
 {
     $oauth = new Services_Weibo_WeiboOAuth(get_setting('sina_akey'), get_setting('sina_skey'));
     if ($_GET['uid'] and $this->user_info['permission']['is_administortar']) {
         $user_id = intval($_GET['uid']);
         $user_info = $this->model('account')->get_user_info_by_uid($user_id);
         if (empty($user_info)) {
             H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本地用戶不存在,無法綁定')));
         }
         $sina_token = $oauth->getAccessToken('code', array('code' => $_GET['code'], 'redirect_uri' => get_js_url('/account/sina/binding_callback/uid-' . $user_id)));
     } else {
         $user_id = $this->user_id;
         AWS_APP::session()->sina_token = $oauth->getAccessToken('code', array('code' => $_GET['code'], 'redirect_uri' => get_js_url('/account/sina/binding_callback/')));
         $sina_token = AWS_APP::session()->sina_token;
         $redirect = get_js_url('/account/setting/openid/');
     }
     $client = new Services_Weibo_WeiboClient(get_setting('sina_akey'), get_setting('sina_skey'), $sina_token['access_token']);
     $uid_get = $client->get_uid();
     $sina_profile = $client->show_user_by_id($uid_get['uid']);
     if ($sina_profile['error']) {
         H::redirect_msg(AWS_APP::lang()->_t('與微博通信出錯, 錯誤代碼: %s', $sina_profile['error']), "/account/setting/openid/");
     }
     if (!$this->model('integral')->fetch_log($user_id, 'BIND_OPENID')) {
         $this->model('integral')->process($user_id, 'BIND_OPENID', round(get_setting('integral_system_config_profile') * 0.2), '綁定 OPEN ID');
     }
     //$this->model('openid_weibo')->bind_account($sina_profile, get_js_url('/account/setting/openid/'), $user_id, $last_key['oauth_token'], $last_key['oauth_token_secret'], $sina_token);
     $this->model('openid_weibo')->bind_account($sina_profile, $redirect, $user_id, $sina_token);
 }
開發者ID:chenruixuan,項目名稱:wecenter,代碼行數:28,代碼來源:sina.php

示例4: index_action

 public function index_action()
 {
     if (is_digits($_GET['id'])) {
         $feature_info = $this->model('feature')->get_feature_by_id($_GET['id']);
     } else {
         $feature_info = $this->model('feature')->get_feature_by_url_token($_GET['id']);
     }
     if (!$feature_info) {
         header('HTTP/1.1 404 Not Found');
         H::redirect_msg(AWS_APP::lang()->_t('專題不存在'), '/');
     }
     if (!$feature_info['enabled']) {
         H::redirect_msg(AWS_APP::lang()->_t('專題未啟用'), '/');
     }
     if ($feature_info['url_token'] != $_GET['id'] and !$_GET['sort_type'] and !$_GET['is_recommend']) {
         HTTP::redirect('/feature/' . $feature_info['url_token']);
     }
     if (!($topic_list = $this->model('topic')->get_topics_by_ids($this->model('feature')->get_topics_by_feature_id($feature_info['id'])))) {
         H::redirect_msg(AWS_APP::lang()->_t('專題下必須包含一個以上話題'), '/');
     }
     if ($feature_info['seo_title']) {
         TPL::assign('page_title', $feature_info['seo_title']);
     } else {
         $this->crumb($feature_info['title'], '/feature/' . $feature_info['url_token']);
     }
     TPL::assign('sidebar_hot_topics', $topic_list);
     TPL::assign('feature_info', $feature_info);
     TPL::import_js('js/app/feature.js');
     TPL::output('feature/detail');
 }
開發者ID:Gradven,項目名稱:what3.1.7,代碼行數:30,代碼來源:main.php

示例5: _filterWord

 public function _filterWord($data, $htmlspecialchars = true)
 {
     if ($htmlspecialchars) {
         $data = H::htmlspecialchars($data);
     }
     return $data;
 }
開發者ID:jackycgq,項目名稱:advanced,代碼行數:7,代碼來源:SFM.php

示例6: send_action

 public function send_action()
 {
     if (trim($_POST['message']) == '') {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('請輸入私信內容')));
     }
     if (!($recipient_user = $this->model('account')->get_user_info_by_username($_POST['recipient']))) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('接收私信的用戶不存在')));
     }
     if ($recipient_user['uid'] == $this->user_id) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('不能給自己發私信')));
     }
     if ($recipient_user['inbox_recv']) {
         if (!$this->model('message')->check_permission($recipient_user['uid'], $this->user_id)) {
             H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('對方設置了隻有 Ta 關注的人才能給 Ta 發送私信')));
         }
     }
     // !注: 來路檢測後麵不能再放報錯提示
     if (!valid_post_hash($_POST['post_hash'])) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('頁麵停留時間過長,或內容已提交,請刷新頁麵')));
     }
     $this->model('message')->send_message($this->user_id, $recipient_user['uid'], $_POST['message']);
     if ($_POST['return_url']) {
         $rsm = array('url' => get_js_url(strip_tags($_POST['return_url'])));
     } else {
         $rsm = array('url' => get_js_url('/inbox/'));
     }
     H::ajax_json_output(AWS_APP::RSM($rsm, 1, null));
 }
開發者ID:wenyinos,項目名稱:wecenter,代碼行數:28,代碼來源:ajax.php

示例7: apply_action

 public function apply_action()
 {
     $site_name = $_POST['site_name'];
     $site_url = $_POST['site_url'];
     //此處就是控製器(C)指派模型(M)的過程,表示調用models\link.php中的is_exist_url()
     //用於判斷該網站地址是否已經存在
     //對提交的參數進行簡單的判斷
     if ($this->model('link')->is_exist_url1($site_name, $site_url)) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('郵件已發送,請勿重複發送!')));
     }
     if (trim($site_name) == '') {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('請輸入客戶郵箱!')));
     }
     if (!$this->model('link')->checkEmail($site_name)) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('請輸入正確的郵箱!')));
     }
     if (trim($site_url) == '') {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('請輸入郵件內容!')));
     }
     //表示調用models\link.php中的apply(),將申請數據插入數據庫中
     if (!$this->model('link')->apply($site_name, $site_url)) {
         $this->model('link')->sendEmail($site_name, $site_url);
     }
     H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('發送成功,請關閉對話框!')));
 }
開發者ID:andeydong,項目名稱:test,代碼行數:25,代碼來源:ajax.php

示例8: sign_in_action

 public function sign_in_action()
 {
     if ($_GET['uid'] != $this->user_id) {
         H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('簽到失敗!')));
     }
     if ($this->model('sign')->is_signed_today($_GET['uid'])) {
         H::ajax_json_output(AWS_APP::RSM(array('is_signed' => true)), 1, null);
     }
     $continous = $this->model('sign')->sign_in($_GET['uid']);
     $integral_every_day = get_setting('sign_integral_every_day');
     $integral_seventh_day = get_setting('sign_integral_seventh_day');
     // 積分操作
     $is_seventh_day = false;
     if ($continous < 0) {
         H::ajax_json_output(AWS_APP::RSM(array('is_signed' => true)), 1, null);
     } else {
         if ($continous == 6) {
             $integral = $integral_seventh_day;
             $integral_message = '連續7天簽到積分';
             $is_seventh_day = true;
         } else {
             $integral = $integral_every_day;
             $integral_message = '每日簽到積分';
         }
     }
     $this->model('integral')->process($_GET['uid'], 'SIGN_IN', $integral, $integral_message, $_GET['uid']);
     H::ajax_json_output(AWS_APP::RSM(array('is_signed' => false, 'continous' => $continous, 'integral_every_day' => $integral_every_day, 'integral_seventh_day' => $integral_seventh_day, 'user_integral' => $this->user_info['integral'] + $integral)), 1, null);
 }
開發者ID:egogg,項目名稱:wecenter-dev,代碼行數:28,代碼來源:ajax.php

示例9: alipay_action

 public function alipay_action()
 {
     $result = $this->model('payment_alipay')->verifyReturn();
     $order = $this->model('payment')->get_order($_GET['out_trade_no']);
     if ($result and $_GET['total_fee'] == $order['amount']) {
         if ($_GET['extra_common_param']) {
             $params = json_decode(base64_decode(urldecode($_GET['extra_common_param'])), TRUE);
         } else {
             if ($order['extra_param']) {
                 $params = unserialize($order['extra_param']);
             }
         }
         if (!$order['terrace_id']) {
             $this->model('payment')->set_order_terrace_id($_GET['trade_no'], $order['order_id']);
             $this->model('payment')->set_payment_id('ALIPAY', $order['order_id']);
             if ($params['pay_to_project_order_id']) {
                 if (!$this->model('payment')->pay_to_project_order_id($order['order_id'], $params['pay_to_project_order_id'])) {
                     H::redirect_msg('訂單處理失敗,如有疑問請聯係客服人員,網站訂單編號:' . $params['pay_to_project_order_id']);
                 }
             }
         }
         if ($params['pay_to_project_order_id']) {
             $this->callback_url = '/project/sponsored/';
         }
         H::redirect_msg('支付成功, 交易金額: ' . $order['amount'], $this->callback_url);
     } else {
         H::redirect_msg('交易失敗,如有疑問請聯係客服人員,支付寶訂單編號:' . $_GET['out_trade_no']);
     }
 }
開發者ID:elelianghh,項目名稱:wecenter,代碼行數:29,代碼來源:callback.php

示例10: generate_sitemap_action

 public function generate_sitemap_action()
 {
     $return_url = '/admin/settings/category-sitemap';
     switch ($this->model('sitemap')->generate_sitemap_all($_GET['reset'])) {
         case sitemap_class::SITEMAP_SUCCESS:
             H::redirect_msg(AWS_APP::lang()->_t('sitemap生成成功,請等待係統自動返回...'), $return_url);
             break;
         case sitemap_class::SITEMAP_DIR_NOT_EXIST:
             H::redirect_msg(AWS_APP::lang()->_t('錯誤:sitemap根目錄不存在'), $return_url);
             break;
         case sitemap_class::SITEMAP_DIR_NOT_WRITABLE:
             H::redirect_msg(AWS_APP::lang()->_t('錯誤:目錄%s不可寫,請聯係後台管理員進行設置', $sitemap_dir), $return_url);
             break;
         case sitemap_class::SITEMAP_DIR_NOT_EXIST_M:
             H::redirect_msg(AWS_APP::lang()->_t('錯誤:sitemap根目錄(移動版)不存在'), $return_url);
             break;
         case sitemap_class::SITEMAP_DIR_NOT_WRITABLE_M:
             H::redirect_msg(AWS_APP::lang()->_t('錯誤:目錄%s不可寫,請聯係後台管理員進行設置', $sitemap_dir_m), $return_url);
             break;
         case sitemap_class::SITEMAP_BASE_URL_NULL:
             H::redirect_msg(AWS_APP::lang()->_t('錯誤:網站根鏈接不能為空'), $return_url);
             break;
         case sitemap_class::SITEMAP_BASE_URL_NULL_M:
             H::redirect_msg(AWS_APP::lang()->_t('錯誤:網站根鏈接(移動版)不能為空'), $return_url);
             break;
         default:
             break;
     }
 }
開發者ID:egogg,項目名稱:wecenter-dev,代碼行數:29,代碼來源:sitemap.php

示例11: list_action

 public function list_action()
 {
     if ($this->is_post()) {
         foreach ($_POST as $key => $val) {
             if ($key == 'start_date' or $key == 'end_date') {
                 $val = base64_encode($val);
             }
             if ($key == 'keyword' or $key == 'user_name') {
                 $val = rawurlencode($val);
             }
             $param[] = $key . '-' . $val;
         }
         H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url('/admin/article/list/' . implode('__', $param))), 1, null));
     }
     $where = array();
     if ($_GET['keyword']) {
         $where[] = "(`title` LIKE '%" . $this->model('article')->quote($_GET['keyword']) . "%')";
     }
     if ($_GET['start_date']) {
         $where[] = 'add_time >= ' . strtotime(base64_decode($_GET['start_date']));
     }
     if ($_GET['end_date']) {
         $where[] = 'add_time <= ' . strtotime('+1 day', strtotime(base64_decode($_GET['end_date'])));
     }
     if ($_GET['user_name']) {
         $user_info = $this->model('account')->get_user_info_by_username($_GET['user_name']);
         $where[] = 'uid = ' . intval($user_info['uid']);
     }
     if ($_GET['comment_count_min']) {
         $where[] = 'comments >= ' . intval($_GET['comment_count_min']);
     }
     if ($_GET['answer_count_max']) {
         $where[] = 'comments <= ' . intval($_GET['comment_count_max']);
     }
     if ($articles_list = $this->model('article')->fetch_page('article', implode(' AND ', $where), 'id DESC', $_GET['page'], $this->per_page)) {
         $search_articles_total = $this->model('article')->found_rows();
     }
     if ($articles_list) {
         foreach ($articles_list as $key => $val) {
             $articles_list_uids[$val['uid']] = $val['uid'];
         }
         if ($articles_list_uids) {
             $articles_list_user_infos = $this->model('account')->get_user_info_by_uids($articles_list_uids);
         }
         foreach ($articles_list as $key => $val) {
             $articles_list[$key]['user_info'] = $articles_list_user_infos[$val['uid']];
         }
     }
     $url_param = array();
     foreach ($_GET as $key => $val) {
         if (!in_array($key, array('app', 'c', 'act', 'page'))) {
             $url_param[] = $key . '-' . $val;
         }
     }
     TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/admin/article/list/') . implode('__', $url_param), 'total_rows' => $search_articles_total, 'per_page' => $this->per_page))->create_links());
     $this->crumb(AWS_APP::lang()->_t('文章管理'), 'admin/article/list/');
     TPL::assign('articles_count', $search_articles_total);
     TPL::assign('list', $articles_list);
     TPL::output('admin/article/list');
 }
開發者ID:wenyinos,項目名稱:wecenter,代碼行數:60,代碼來源:article.php

示例12: read_action

 public function read_action()
 {
     if (!($dialog = $this->model('message')->get_dialog_by_id($_GET['id']))) {
         H::redirect_msg(AWS_APP::lang()->_t('指定的站內信不存在'), '/inbox/');
     }
     if ($dialog['recipient_uid'] != $this->user_id and $dialog['sender_uid'] != $this->user_id) {
         H::redirect_msg(AWS_APP::lang()->_t('指定的站內信不存在'), '/inbox/');
     }
     $this->model('message')->set_message_read($_GET['id'], $this->user_id);
     if ($list = $this->model('message')->get_message_by_dialog_id($_GET['id'])) {
         if ($dialog['sender_uid'] != $this->user_id) {
             $recipient_user = $this->model('account')->get_user_info_by_uid($dialog['sender_uid']);
         } else {
             $recipient_user = $this->model('account')->get_user_info_by_uid($dialog['recipient_uid']);
         }
         foreach ($list as $key => $val) {
             if ($dialog['sender_uid'] == $this->user_id and $val['sender_remove']) {
                 unset($list[$key]);
             } else {
                 if ($dialog['sender_uid'] != $this->user_id and $val['recipient_remove']) {
                     unset($list[$key]);
                 } else {
                     $list[$key]['message'] = FORMAT::parse_links($val['message']);
                     $list[$key]['user_name'] = $recipient_user['user_name'];
                     $list[$key]['url_token'] = $recipient_user['url_token'];
                     $list[$key]['profile_update_time'] = $recipient_user['profile_update_time'];
                 }
             }
         }
     }
     $this->crumb(AWS_APP::lang()->_t('私信對話') . ': ' . $recipient_user['user_name'], '/inbox/read/' . intval($_GET['id']));
     TPL::assign('list', $list);
     TPL::assign('recipient_user', $recipient_user);
     TPL::output('inbox/read');
 }
開發者ID:egogg,項目名稱:wecenter-dev,代碼行數:35,代碼來源:main.php

示例13: setup

 public function setup()
 {
     if (!$this->user_info['permission']['is_administortar']) {
         H::redirect_msg(AWS_APP::lang()->_t('你沒有訪問權限, 請重新登錄'), '/');
     }
     TPL::assign('menu_list', $this->model('admin')->fetch_menu_list(304));
 }
開發者ID:egogg,項目名稱:wecenter-dev,代碼行數:7,代碼來源:feature.php

示例14: index_action

 public function index_action()
 {
     $_GET['per_page'] = $_GET['per_page'] ? intval($_GET['per_page']) : get_setting('contents_per_page');
     $result = $this->model('search')->search(cjk_substr($_GET['q'], 0, 64), $_GET['type'], $_GET['page'], $_GET['per_page'], $_GET['topic_ids'], $_GET['is_recommend']);
     if (!$result) {
         $result = array();
     }
     if ($_GET['is_question_id'] and is_digits($_GET['q'])) {
         $question_info = $this->model('question')->get_question_info_by_id($_GET['q']);
         if ($question_info) {
             $result[] = $this->model('search')->prase_result_info($question_info);
         }
     }
     if ($result) {
         $key_arr = array('type', 'search_id', 'name', 'detail');
         foreach ($result as $key => $val) {
             foreach ($val as $k => $v) {
                 if (!in_array($k, $key_arr)) {
                     unset($result[$key][$k]);
                 }
             }
         }
     }
     H::ajax_json_output(AWS_APP::RSM(array('total_rows' => count($result), 'rows' => $result), 1, null));
 }
開發者ID:nerverwind,項目名稱:wecenter_ios_sdk,代碼行數:25,代碼來源:search.php

示例15: save

 /**
  * 保存日誌
  * @return bool
  */
 public function save()
 {
     $content_arr = $this->getSaveContent();
     if (empty($content_arr)) {
         return false;
     }
     $suffix = '.log';
     $path = H::app()->log_path . '/' . date('Y/m/d');
     if ($this->makeDir($path)) {
         foreach ($content_arr as $file_name => $log_arr) {
             $file_arr = glob($path . '/' . $file_name . '*.log');
             $num = count($file_arr);
             if ($num > 0) {
                 $file_path = $file_arr[$num - 1];
                 $file_size = filesize($file_path) / 1024;
                 if ($file_size >= $this->_max_size) {
                     $num++;
                 }
             } else {
                 $num++;
             }
             $file_path = $path . '/' . $file_name . '_' . $num . $suffix;
             //寫入方式打開,將文件指針指向文件末尾。如果文件不存在則嘗試創建
             $handle = fopen($file_path, 'a');
             if ($handle) {
                 foreach ($log_arr as $content) {
                     fwrite($handle, $content);
                 }
                 fclose($handle);
             }
         }
     }
     $this->_log_arr = array();
     return true;
 }
開發者ID:HWeiXin,項目名稱:wx,代碼行數:39,代碼來源:HLog.php


注:本文中的H類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。