当前位置: 首页>>代码示例>>PHP>>正文


PHP App::error方法代码示例

本文整理汇总了PHP中App::error方法的典型用法代码示例。如果您正苦于以下问题:PHP App::error方法的具体用法?PHP App::error怎么用?PHP App::error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在App的用法示例。


在下文中一共展示了App::error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct()
 {
     $this->userdata = $this->checkUserdata();
     // apply authorization filter
     $this->beforeFilter(function () {
         if (!$this->userdata && Request::segment(1) !== 'login') {
             return Redirect::to('/login');
         }
     });
     // templates for app errors
     App::missing(function ($exception) {
         return Response::view('errors.404_cms', array(), 404);
     });
     App::error(function (Exception $exception, $code) {
         Log::error($exception);
         if ($code == 403) {
             return Response::view('/errors/error_403', array(), 403);
         }
     });
     // shared assets
     Orchestra\Asset::add("bootstrap-css", "assets/css/bootstrap.min.css");
     Orchestra\Asset::add("bootstrap-theme", "assets/css/bootstrap-theme.min.css");
     Orchestra\Asset::add("font-awesome", "assets/css/font-awesome.min.css");
     Orchestra\Asset::add("cms-css", "assets/css/cms.css");
     Orchestra\Asset::add("jquery", "assets/js/jquery.js");
     Orchestra\Asset::add("bootstrap-js", "assets/js/bootstrap.min.js");
     Orchestra\Asset::add("handlers-js", "assets/js/handlers.js");
     // shared views
     View::share("active_menu_id", 1);
     View::share("userdata", $this->userdata);
     // configuration
     Config::set("view.pagination", "common/pagination");
 }
开发者ID:nix222,项目名称:crm-system,代码行数:33,代码来源:BaseController.php

示例2: init

 function init()
 {
     if (argc() > 1) {
         $which = argv(1);
     } else {
         notice(t('Requested profile is not available.') . EOL);
         \App::$error = 404;
         return;
     }
     $profile = '';
     $channel = \App::get_channel();
     if (local_channel() && argc() > 2 && argv(2) === 'view') {
         $which = $channel['channel_address'];
         $profile = argv(1);
         $r = q("select profile_guid from profile where id = %d and uid = %d limit 1", intval($profile), intval(local_channel()));
         if (!$r) {
             $profile = '';
         }
         $profile = $r[0]['profile_guid'];
     }
     \App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . z_root() . '/feed/' . $which . '" />' . "\r\n";
     if (!$profile) {
         $x = q("select channel_id as profile_uid from channel where channel_address = '%s' limit 1", dbesc(argv(1)));
         if ($x) {
             \App::$profile = $x[0];
         }
     }
     profile_load($a, $which, $profile);
 }
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:29,代码来源:Profile.php

示例3: query

 /**
  * Query database
  *
  * @param   string        $sql          SQL Query
  * @param   array|string  $replacement  Replacement
  * @return  mixed
  */
 public function query()
 {
     $args = func_get_args();
     $sql = array_shift($args);
     // Menerapkan $replacement ke pernyataan $sql
     if (!empty($args)) {
         $sql = vsprintf($sql, $args);
     }
     try {
         // Return 'false' kalo belum ada koneksi
         if (!$this->_db) {
             $this->connect();
         }
         $this->_sql = $sql;
         // Eksekusi SQL Query
         if ($results = $this->_db->query($sql)) {
             if (is_bool($results)) {
                 return $results;
             }
             $this->_results = $results;
             $this->_num_rows = $this->_results->num_rows;
             return $this;
         } else {
             App::error($this->_db->error . '<br>' . $this->_sql);
         }
     } catch (Exception $e) {
         setAlert('error', $e->getMessage());
         return false;
     }
 }
开发者ID:tommyputranto,项目名称:tokonlen,代码行数:37,代码来源:Db.php

示例4: viewsrc_content

function viewsrc_content(&$a)
{
    $o = '';
    $sys = get_sys_channel();
    $item_id = argc() > 1 ? intval(argv(1)) : 0;
    $json = argc() > 2 && argv(2) === 'json' ? true : false;
    if (!local_channel()) {
        notice(t('Permission denied.') . EOL);
    }
    if (!$item_id) {
        App::$error = 404;
        notice(t('Item not found.') . EOL);
    }
    $item_normal = item_normal();
    if (local_channel() && $item_id) {
        $r = q("select id, item_flags, item_obscured, body from item where uid in (%d , %d) and id = %d {$item_normal} limit 1", intval(local_channel()), intval($sys['channel_id']), intval($item_id));
        if ($r) {
            if (intval($r[0]['item_obscured'])) {
                $r[0]['body'] = crypto_unencapsulate(json_decode($r[0]['body'], true), get_config('system', 'prvkey'));
            }
            $o = $json ? json_encode($r[0]['body']) : str_replace("\n", '<br />', $r[0]['body']);
        }
    }
    if (is_ajax()) {
        print '<div><i class="icon-pencil"> ' . t('Source of Item') . ' ' . $r[0]['id'] . '</i></div>';
        echo $o;
        killme();
    }
    return $o;
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:30,代码来源:viewsrc.php

示例5: get

 function get()
 {
     if (!\App::$profile) {
         notice(t('Requested profile is not available.') . EOL);
         \App::$error = 404;
         return;
     }
     $which = argv(1);
     $uid = local_channel();
     $owner = 0;
     $channel = null;
     $observer = \App::get_observer();
     $channel = \App::get_channel();
     if (\App::$is_sys && is_site_admin()) {
         $sys = get_sys_channel();
         if ($sys && intval($sys['channel_id'])) {
             $uid = $owner = intval($sys['channel_id']);
             $channel = $sys;
             $observer = $sys;
         }
     }
     if (!$owner) {
         // Figure out who the page owner is.
         $r = q("select channel_id from channel where channel_address = '%s'", dbesc($which));
         if ($r) {
             $owner = intval($r[0]['channel_id']);
         }
     }
     $ob_hash = $observer ? $observer['xchan_hash'] : '';
     if (!perm_is_allowed($owner, $ob_hash, 'write_pages')) {
         notice(t('Permission denied.') . EOL);
         return;
     }
     $is_owner = $uid && $uid == $owner ? true : false;
     $o = '';
     // Figure out which post we're editing
     $post_id = argc() > 2 ? intval(argv(2)) : 0;
     if (!$post_id) {
         notice(t('Item not found') . EOL);
         return;
     }
     // Now we've got a post and an owner, let's find out if we're allowed to edit it
     $ob_hash = $observer ? $observer['xchan_hash'] : '';
     $perms = get_all_perms($owner, $ob_hash);
     if (!$perms['write_pages']) {
         notice(t('Permission denied.') . EOL);
         return;
     }
     $itm = q("SELECT * FROM `item` WHERE `id` = %d and uid = %s LIMIT 1", intval($post_id), intval($owner));
     $item_id = q("select * from item_id where service = 'PDL' and iid = %d limit 1", intval($itm[0]['id']));
     if ($item_id) {
         $layout_title = $item_id[0]['sid'];
     }
     $rp = 'layouts/' . $which;
     $x = array('webpage' => ITEM_TYPE_PDL, 'nickname' => $channel['channel_address'], 'editor_autocomplete' => true, 'bbco_autocomplete' => 'comanche', 'return_path' => $rp, 'button' => t('Edit'), 'hide_voting' => true, 'hide_future' => true, 'hide_expire' => true, 'hide_location' => true, 'hide_weblink' => true, 'hide_attach' => true, 'hide_preview' => true, 'ptyp' => $itm[0]['obj_type'], 'body' => undo_post_tagging($itm[0]['body']), 'post_id' => $post_id, 'title' => htmlspecialchars($itm[0]['title'], ENT_COMPAT, 'UTF-8'), 'pagetitle' => $layout_title, 'ptlabel' => t('Layout Name'), 'placeholdertitle' => t('Layout Description (Optional)'), 'showacl' => false, 'profile_uid' => intval($owner));
     $editor = status_editor($a, $x);
     $o .= replace_macros(get_markup_template('edpost_head.tpl'), array('$title' => t('Edit Layout'), '$delete' => $itm[0]['author_xchan'] === $ob_hash || $itm[0]['owner_xchan'] === $ob_hash ? t('Delete') : false, '$id' => $itm[0]['id'], '$editor' => $editor));
     return $o;
 }
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:59,代码来源:Editlayout.php

示例6: get

 function get()
 {
     if (!\App::$profile) {
         notice(t('Requested profile is not available.') . EOL);
         \App::$error = 404;
         return;
     }
     $which = argv(1);
     $uid = local_channel();
     $owner = 0;
     $channel = null;
     $observer = \App::get_observer();
     $channel = \App::get_channel();
     if (\App::$is_sys && is_site_admin()) {
         $sys = get_sys_channel();
         if ($sys && intval($sys['channel_id'])) {
             $uid = $owner = intval($sys['channel_id']);
             $channel = $sys;
             $observer = $sys;
         }
     }
     if (!$owner) {
         // Figure out who the page owner is.
         $r = q("select channel_id from channel where channel_address = '%s'", dbesc($which));
         if ($r) {
             $owner = intval($r[0]['channel_id']);
         }
     }
     $ob_hash = $observer ? $observer['xchan_hash'] : '';
     if (!perm_is_allowed($owner, $ob_hash, 'write_pages')) {
         notice(t('Permission denied.') . EOL);
         return;
     }
     $is_owner = $uid && $uid == $owner ? true : false;
     $o = '';
     // Figure out which post we're editing
     $post_id = argc() > 2 ? intval(argv(2)) : 0;
     if (!($post_id && $owner)) {
         notice(t('Item not found') . EOL);
         return;
     }
     $itm = q("SELECT * FROM `item` WHERE `id` = %d and uid = %s LIMIT 1", intval($post_id), intval($owner));
     if ($itm) {
         $item_id = q("select * from item_id where service = 'BUILDBLOCK' and iid = %d limit 1", intval($itm[0]['id']));
         if ($item_id) {
             $block_title = $item_id[0]['sid'];
         }
     } else {
         notice(t('Item not found') . EOL);
         return;
     }
     $mimetype = $itm[0]['mimetype'];
     $rp = 'blocks/' . $channel['channel_address'];
     $x = array('nickname' => $channel['channel_address'], 'bbco_autocomplete' => $mimetype == 'text/bbcode' ? 'bbcode' : 'comanche-block', 'return_path' => $rp, 'webpage' => ITEM_TYPE_BLOCK, 'ptlabel' => t('Block Name'), 'button' => t('Edit'), 'writefiles' => $mimetype == 'text/bbcode' ? perm_is_allowed($owner, get_observer_hash(), 'write_storage') : false, 'weblink' => $mimetype == 'text/bbcode' ? t('Insert web link') : false, 'hide_voting' => true, 'hide_future' => true, 'hide_location' => true, 'hide_expire' => true, 'showacl' => false, 'ptyp' => $itm[0]['type'], 'mimeselect' => true, 'mimetype' => $itm[0]['mimetype'], 'body' => undo_post_tagging($itm[0]['body']), 'post_id' => $post_id, 'visitor' => true, 'title' => htmlspecialchars($itm[0]['title'], ENT_COMPAT, 'UTF-8'), 'placeholdertitle' => t('Title (optional)'), 'pagetitle' => $block_title, 'profile_uid' => intval($channel['channel_id']), 'bbcode' => $mimetype == 'text/bbcode' ? true : false);
     $editor = status_editor($a, $x);
     $o .= replace_macros(get_markup_template('edpost_head.tpl'), array('$title' => t('Edit Block'), '$delete' => $itm[0]['author_xchan'] === $ob_hash || $itm[0]['owner_xchan'] === $ob_hash ? t('Delete') : false, '$id' => $itm[0]['id'], '$editor' => $editor));
     return $o;
 }
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:58,代码来源:Editblock.php

示例7: boot

 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->package('jlem/forms');
     require __DIR__ . '/../../config/macros.php';
     require __DIR__ . '/../../config/validators.php';
     \App::error(function (FormValidationException $Exception, $code) {
         return \Redirect::back()->withErrors($Exception->getErrors())->withInput();
     });
 }
开发者ID:jlem,项目名称:forms,代码行数:14,代码来源:FormsServiceProvider.php

示例8: del

 public function del($id)
 {
     $id = (int) $id;
     App::error(function (ModelNotFoundException $e) {
         return Response::alert("玩家不存在");
     });
     $p = DBWOGPlayer::findOrFail($id);
     $p->delete();
     return Response::json(['reload' => TRUE]);
 }
开发者ID:WeishengChang,项目名称:wogap,代码行数:10,代码来源:PlayerController.php

示例9: registerPost

 /**
  * POST /register
  * @param \Base $fw
  */
 function registerPost(\Base $fw)
 {
     try {
         $token = \Helper\Api\User::register($fw->get('POST'));
         $fw->set('COOKIE.session_token', $token);
         $fw->reroute('/stream');
     } catch (\Exception $e) {
         $fw->set('error', $e->getMessage());
         \App::error(403);
     }
 }
开发者ID:svlt,项目名称:front,代码行数:15,代码来源:index.php

示例10: setupLayout

 /**
  * Setup the layout used by the controller.
  *
  * @return void
  */
 protected function setupLayout()
 {
     if (!is_null($this->layout)) {
         $this->layout = View::make($this->layout);
     }
     if (!Config::get('app.debug')) {
         App::error(function (Exception $exception, $code) {
             $error_response = array('error' => array('message' => '(#' . $code . ') ' . $exception->getMessage(), 'type' => get_class($exception), 'code' => $code));
             return Response::json($error_response, $code)->setCallback(Input::get('callback'));
         });
     }
 }
开发者ID:andrewchng,项目名称:cSystem,代码行数:17,代码来源:BaseController.php

示例11: performUpdate

 /**
  * (non-PHPdoc)
  * @see \Illuminate\Database\Eloquent\Model::performUpdate()
  */
 public function performUpdate(Builder $query, array $options = [])
 {
     if (!Auth::user() instanceof User) {
         App::error(function (InvalidUserException $exception) {
             Log::error($exception);
             return 'Access denid for creating a new ' . get_called_class();
         });
     }
     $this->attributes[self::UPDATED_AT] = new \DateTime('now', new \DateTimeZone(env('APP_TIMEZONE', 'UTC')));
     $this->attributes[self::UPDATED_BY] = Auth::user()->id;
     return parent::performUpdate($query, $options);
 }
开发者ID:tlan16,项目名称:lara-doc,代码行数:16,代码来源:BaseEntityAbstract.php

示例12: execute

 /**
  *	Bootstrap
  *	@return NULL
  **/
 public static function execute()
 {
     if (file_exists('vendor/autoload.php')) {
         require 'vendor/autoload.php';
     }
     $fw = new App();
     if (!file_exists('index.php')) {
         $fw->error(self::E_Index);
     } else {
         require 'index.php';
     }
     $fw->run();
 }
开发者ID:deathbeam,项目名称:fwphp,代码行数:17,代码来源:fw.php

示例13: del

 public function del($id)
 {
     $id = (int) $id;
     App::error(function (ModelNotFoundException $e) {
         return Response::alert("不存在的項目");
     });
     $p = call_user_func(array($this->dbname, 'findOrFail'), $id);
     $p->delete();
     if (method_exists($this, 'teardown')) {
         $this->teardown($data);
     }
     return Response::json(['reload' => TRUE]);
 }
开发者ID:WeishengChang,项目名称:wogap,代码行数:13,代码来源:EditorController.php

示例14: delete

 /**
  * DELETE /post/@id.json
  * Delete a post
  * 
  * @param \Base $fw
  * @param array $params
  */
 public function delete(\Base $fw, array $params)
 {
     $userId = self::_requireAuth();
     $post = \App::model('post')->load($params['id']);
     if (!$post->id) {
         \App::error(404);
     }
     if ($post->user_id != $userId && $post->page_id != $userId) {
         \App::error(403);
     }
     $post->erase();
     $this->_json(["success" => true]);
 }
开发者ID:svlt,项目名称:back,代码行数:20,代码来源:post.php

示例15: init

 function init()
 {
     if (argc() > 1 && intval(argv(1))) {
         $channel_id = intval(argv(1));
     } else {
         notice(t('No channel.') . EOL);
         \App::$error = 404;
         return;
     }
     $x = q("select channel_address from channel where channel_id = %d limit 1", intval($channel_id));
     if ($x) {
         profile_load($a, $x[0]['channel_address'], 0);
     }
 }
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:14,代码来源:Common.php


注:本文中的App::error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。