コード例 #1
0
ファイル: BaseController.php プロジェクト: nix222/crm-system
 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");
 }
コード例 #2
0
 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);
 }
コード例 #3
0
ファイル: Db.php プロジェクト: tommyputranto/tokonlen
 /**
  * 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;
     }
 }
コード例 #4
0
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;
}
コード例 #5
0
 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;
 }
コード例 #6
0
 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;
 }
コード例 #7
0
ファイル: FormsServiceProvider.php プロジェクト: jlem/forms
 /**
  * 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();
     });
 }
コード例 #8
0
 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]);
 }
コード例 #9
0
ファイル: index.php プロジェクト: svlt/front
 /**
  * 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);
     }
 }
コード例 #10
0
ファイル: BaseController.php プロジェクト: andrewchng/cSystem
 /**
  * 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'));
         });
     }
 }
コード例 #11
0
 /**
  * (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);
 }
コード例 #12
0
ファイル: fw.php プロジェクト: deathbeam/fwphp
 /**
  *	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();
 }
コード例 #13
0
 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]);
 }
コード例 #14
0
ファイル: post.php プロジェクト: svlt/back
 /**
  * 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]);
 }
コード例 #15
0
ファイル: Common.php プロジェクト: anmol26s/hubzilla-yunohost
 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);
     }
 }
コード例 #16
0
function connect_init(&$a)
{
    if (argc() > 1) {
        $which = argv(1);
    } else {
        notice(t('Requested profile is not available.') . EOL);
        App::$error = 404;
        return;
    }
    $r = q("select * from channel where channel_address = '%s' limit 1", dbesc($which));
    if ($r) {
        App::$data['channel'] = $r[0];
    }
    profile_load($a, $which, '');
}
コード例 #17
0
ファイル: Id.php プロジェクト: anmol26s/hubzilla-yunohost
 function init()
 {
     logger('id: ' . print_r($_REQUEST, true));
     if (argc() > 1) {
         $which = argv(1);
     } else {
         \App::$error = 404;
         return;
     }
     $profile = '';
     $channel = \App::get_channel();
     profile_load($a, $which, $profile);
     $op = new MysqlProvider();
     $op->server();
 }
コード例 #18
0
 public function getCompanyImage()
 {
     App::error(function (\Symfony\Component\HttpFoundation\File\Exception\FileException $exception) {
         Log::error($exception);
         return 'Sorry! Your Image File is too large!';
     });
     $img = Input::all();
     $valid = Validator::make($img, array('file' => 'max:2048|mimes:jpeg,bmp,png,gif'));
     if ($valid->fails()) {
         return $valid->messages();
     } else {
         return Input::file('file')->move('uploads/', Auth::user()->profile_pic);
         //return "success";
     }
 }
コード例 #19
0
ファイル: App.php プロジェクト: johnnoone/php-routes
 public function run()
 {
     $method = $_SERVER['REQUEST_METHOD'];
     $path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
     $params = array();
     if ($resp = $this->router->resolve($path, $method, $params)) {
         if (is_int($resp)) {
             return App::error($resp);
         }
         list($callback, $params) = $resp;
         $params = $this->params($callback, $params);
         return call_user_func_array($callback, $params);
     }
     return App::error(500);
 }
コード例 #20
0
ファイル: Modules.php プロジェクト: FaddliLWibowo/tokonlen
 public function call($modPath)
 {
     $args = explode(DS, $modPath);
     $class = array_shift($args);
     if (!isset($this->dirs[$class])) {
         App::error($modPath);
     }
     $this->path = $this->dirs[$class];
     $Class = new $class();
     $method = count($args) >= 1 ? array_shift($args) : 'index';
     $path = $class . '/' . $method;
     if (!method_exists($Class, $method)) {
         App::error($modPath);
     }
     return call_user_func_array([$Class, $method], $args);
 }
コード例 #21
0
 public function exceptionMessages()
 {
     \App::error(function ($exception, $code) {
         switch ($code) {
             case 403:
                 return \Response::view('errors.403', array(), 403);
             case 404:
                 return \Response::view('errors.404', array(), 404);
             case 500:
                 // return Exception::getMessage();
                 return \Response::view('power::errors.500', ['message' => ''], 500);
             default:
                 return \Response::view('errors.default', array(), $code);
         }
     });
 }
コード例 #22
0
ファイル: Upload.php プロジェクト: FaddliLWibowo/tokonlen
 public function doUpload()
 {
     if (!is_uploaded_file($this->file['tmp_name'])) {
         App::error('Upload gagal');
     }
     $filename = preg_replace('/\\s+/', '_', $this->file['name']);
     $basename = basename($filename);
     $fileext = pathinfo($filename, PATHINFO_EXTENSION);
     $filename = md5($basename . time()) . '.' . $fileext;
     if (!copy($this->file['tmp_name'], $this->target . $filename)) {
         if (!move_uploaded_file($this->file['tmp_name'], $this->target . $this->file['name'])) {
             App::error('Upload gagal');
         }
     }
     return $filename;
 }
コード例 #23
0
 /**
  * Подключение к серверну мемкэша
  * @return Memcached
  */
 protected static function connect()
 {
     static $Con;
     if (!$Con) {
         $Con = new Memcached();
         $Con->setOption(Memcached::OPT_BINARY_PROTOCOL, config('memcache.binary_protocol'));
         $Con->setOption(Memcached::OPT_COMPRESSION, config('memcache.compression'));
         $Con->setOption(Memcached::OPT_CONNECT_TIMEOUT, config('memcache.connect_timeout'));
         $Con->setOption(Memcached::OPT_RETRY_TIMEOUT, config('memcache.retry_timeout'));
         $Con->setOption(Memcached::OPT_SEND_TIMEOUT, config('memcache.send_timeout'));
         $Con->setOption(Memcached::OPT_RECV_TIMEOUT, config('memcache.recv_timeout'));
         $Con->setOption(Memcached::OPT_POLL_TIMEOUT, config('memcache.poll_timeout'));
         $Con->setOption(Memcached::OPT_PREFIX_KEY, config('memcache.key_prefix'));
         if (!$Con->addServer(config('memcache.host'), config('memcache.port'))) {
             App::error('Ошибка при попытке подключения к серверу кэша в оперативной памяти.');
         }
     }
     return $Con;
 }
コード例 #24
0
 /**
  *  Administration 
  */
 public function adminQuery()
 {
     App::error(function (Exception $exception) {
         return View::make('adminQuery', array('error' => $exception->getMessage()));
     });
     if (Request::method() == 'POST') {
         $error = null;
         $result = null;
         $columns = null;
         $info = null;
         $query = strtolower(trim(Input::get('query')));
         Log::info('Query received : ' . $query);
         if ($query != null) {
             if (starts_with($query, array('select', 'show', 'describe'))) {
                 $result = DB::select($query);
                 Log::info('Result size: ' . count($result));
                 $info = "Query executed successfully.";
                 if (count($result) < 1) {
                     $result = null;
                     $info = "Success - Result set is empty.";
                 } else {
                     $columns = array_keys((array) head($result));
                 }
             } else {
                 if (DB::statement($query)) {
                     $info = "Query executed successfully.";
                 } else {
                     $error = "Unknown error executing your query.";
                 }
             }
         } else {
             $error = 'Error : Your query is empty.';
         }
         return View::make('adminQuery', array('error' => $error, 'results' => $result, 'info' => $info, 'columns' => $columns));
     }
     return View::make('adminQuery');
 }
コード例 #25
0
ファイル: global.php プロジェクト: yellowriver/pay
*/
Log::useDailyFiles(storage_path() . '/logs/laravel.log');
/*
|--------------------------------------------------------------------------
| Application Error Handler
|--------------------------------------------------------------------------
|
| Here you may handle any errors that occur in your application, including
| logging them or displaying custom views for specific errors. You may
| even register several error handlers to handle different types of
| exceptions. If nothing is returned, the default error view is
| shown, which includes a detailed stack trace during debug.
|
*/
App::error(function (Exception $exception, $code) {
    Log::error($exception);
});
/*
|--------------------------------------------------------------------------
| Maintenance Mode Handler
|--------------------------------------------------------------------------
|
| The "down" Artisan command gives you the ability to put an application
| into maintenance mode. Here, you will define what is displayed back
| to the user if maintenance mode is in effect for the application.
|
*/
App::down(function () {
    return Response::make("Be right back!", 503);
});
/*
コード例 #26
0
ファイル: routes.php プロジェクト: juanantoniofr/sgr
Route::post('delajaxevent', array('uses' => 'EventoController@del', 'before' => array('auth', 'ajax_check')));
Route::post('finalizaevento', array('uses' => 'EventoController@finalizar', 'before' => array('auth', 'ajax_check')));
Route::post('anulaevento', array('uses' => 'EventoController@anular', 'before' => array('auth', 'ajax_check')));
//***
//Atención de eventos
Route::get('tecnico/getUserEvents', array('uses' => 'EventoController@getUserEvents', 'before' => array('auth', 'capacidad:3-4,msg')));
Route::post('tecnico/saveAtencion', array('uses' => 'EventoController@atender', 'before' => array('auth', 'capacidad:3-4,msg')));
Route::get('print', array('uses' => 'CalendarController@imprime'));
Route::get('report', array('as' => 'report.html', 'uses' => 'AuthController@report'));
App::missing(function ($exception) {
    $pagetitle = Config::get('msg.404pagetitleLogin');
    $paneltitle = Config::get('msg.404paneltitle');
    $msg = Config::get('msg.404msg');
    $alertLevel = 'warning';
    return View::make('message')->with(compact('msg', 'pagetitle', 'paneltitle', 'alertLevel'));
});
App::error(function (ModelNotFoundException $e) {
    $pagetitle = Config::get('msg.objectNoFoundpagetitle');
    $paneltitle = Config::get('msg.objectNoFoundpagetitlepaneltitle');
    $msg = Config::get('msg.objectNoFoundmsg');
    $alertLevel = 'danger';
    return View::make('message')->with(compact('msg', 'pagetitle', 'paneltitle', 'alertLevel'));
});
//**
Route::get('test', array('as' => 'test', function () {
    $recurso = Recurso::findOrFail('115');
    $sgrRecurso = Factoria::getRecursoInstance($recurso);
    echo $sgrRecurso->delEventos();
}));
//Route::get('admin/user.html',array('uses' => 'UsersController@user','before' => array('auth','auth_ajax','capacidad:4,msg'))); //???
//Route::get('admin/adduser.html',array('as' => 'adduser','uses' => 'UsersController@newUser','before' => array('auth','capacidad:4,msg'))); //?
コード例 #27
0
ファイル: global.php プロジェクト: kleitz/bjga-scheduler
});
App::error(function (Exception $exception, $code) {
    Log::error($exception);
    if (App::environment() == 'production' and $code != 404) {
        $emailData = array('user' => "the Scheduler", 'content' => nl2br(Request::instance()->fullUrl() . "\r\n\r\n" . $exception->getMessage() . "\r\n\r\n" . $exception->getFile() . ":" . $exception->getLine() . "\r\n\r\n" . $exception->getTraceAsString()));
        Mail::send('emails.reportProblem', $emailData, function ($msg) {
            $msg->to('*****@*****.**')->subject("[Brian Jacobs Golf] Exception Thrown!");
            if (Auth::check()) {
                $msg->from(Auth::user()->email, Auth::user()->name);
            }
        });
        return View::make('pages.admin.error')->withError("Uh-oh! It looks like you stumbled across an error. We apologize for the issue. The problem has been automatically reported to Brian Jacobs Golf. If you continue to have trouble, email admin@brianjacobsgolf.com for more help.");
    }
});
App::error(function (Scheduler\Exceptions\FormValidationException $exception, $code) {
    return Redirect::back()->withInput()->withErrors($exception->getErrors());
});
/*
|--------------------------------------------------------------------------
| Maintenance Mode Handler
|--------------------------------------------------------------------------
|
| The "down" Artisan command gives you the ability to put an application
| into maintenance mode. Here, you will define what is displayed back
| to the user if maintenace mode is in effect for this application.
|
*/
App::down(function () {
    return Response::make("Be right back!", 503);
});
/*
コード例 #28
0
|
| Here you may handle any errors that occur in your application, including
| logging them or displaying custom views for specific errors. You may
| even register several error handlers to handle different types of
| exceptions. If nothing is returned, the default error view is
| shown, which includes a detailed stack trace during debug.
|
*/
App::error(function (Exception $exception, $code) {
    Log::error($exception);
});
App::error(function (Laracasts\Validation\FormValidationException $exception, $code) {
    return Redirect::back()->withInput()->withErrors($exception->getErrors());
});
App::error(function (Illuminate\Database\Eloquent\ModelNotFoundException $exception) {
    // do whatever here. 404, flash message, etc.
    return Redirect::home();
});
/*
|--------------------------------------------------------------------------
| Maintenance Mode Handler
|--------------------------------------------------------------------------
|
| The "down" Artisan command gives you the ability to put an application
| into maintenance mode. Here, you will define what is displayed back
| to the user if maintenance mode is in effect for the application.
|
*/
App::down(function () {
    return Response::make("Be right back!", 503);
});
/*
コード例 #29
0
if (isset($_GET['id']) && !empty($_GET['id'])) {
    $id = htmlentities($_GET['id']);
    $promotion = Promotion::getPromotionById($id);
    if (isset($_POST['edit'])) {
        if (preg_match("#^([0-9]{1,2}|100)\$#", $_POST['percent'])) {
            PDOConnexion::setParameters('phonedeals', 'root', 'root');
            $db = PDOConnexion::getInstance();
            $sql = "\n\t\t\t\tUPDATE promotion\n\t\t\t\tSET percent = :percent\n\t\t\t\tWHERE id = :id\n\t\t\t";
            $sth = $db->prepare($sql);
            $sth->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Promotion');
            $sth->execute(array(':id' => $id, ':percent' => $_POST['percent']));
            if ($sth) {
                App::success('La promotion a bien été modifiée');
            }
        } else {
            App::error("Les champs ne sont pas valides");
        }
    }
    if ($member) {
        ?>
<div class="col-md-8">
    <div class="page-header">
        <h1>Éditer une promotion</h1>
    </div>

    <form action="index.php?page=admin/promotion-edit&amp;id=<?php 
        echo $id;
        ?>
" method="POST">
        <div class="form-group">
            <label for="phone">Téléphone</label>
コード例 #30
0
ファイル: global.php プロジェクト: alexanderpetrob89/fei.edu
| logging them or displaying custom views for specific errors. You may
| even register several error handlers to handle different types of
| exceptions. If nothing is returned, the default error view is
| shown, which includes a detailed stack trace during debug.
|
*/
App::error(function (Exception $exception, $code) {
    Log::error($exception);
    if (strpos(Request::server('SERVER_NAME'), 'fei.edu') !== false) {
        switch ($code) {
            case 403:
                return Redirect::to('/fei-error/' . $code);
            case 404:
                // return Response::view('errors/error', array(
                //  'exception' => $exception,
                //  'code' => $code
                //  ), 404);
                return Redirect::to('/fei-error/' . $code);
            case 500:
                return Redirect::to('/fei-error/' . $code);
            default:
                return Redirect::to('/fei-error/' . $code);
        }
    }
});
/*
|--------------------------------------------------------------------------
| Maintenance Mode Handler
|--------------------------------------------------------------------------
|
| The "down" Artisan command gives you the ability to put an application