public static function createHanlder() { if (preg_match('/\\/api\\//', \Request::url())) { return new ApiExceptionHandler(); } return new WebExceptionHandler(); }
/** * Sign in as another user. * @param $args array ($userId) */ function signInAsUser($args) { $this->addCheck(new HandlerValidatorJournal($this)); // only managers and admins have permission $this->addCheck(new HandlerValidatorRoles($this, true, null, null, array(ROLE_ID_SITE_ADMIN, ROLE_ID_JOURNAL_MANAGER))); $this->validate(); if (isset($args[0]) && !empty($args[0])) { $userId = (int) $args[0]; $journal =& Request::getJournal(); if (!Validation::canAdminister($journal->getId(), $userId)) { $this->setupTemplate(); // We don't have administrative rights // over this user. Display an error. $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('pageTitle', 'manager.people'); $templateMgr->assign('errorMsg', 'manager.people.noAdministrativeRights'); $templateMgr->assign('backLink', Request::url(null, null, 'people', 'all')); $templateMgr->assign('backLinkLabel', 'manager.people.allUsers'); return $templateMgr->display('common/error.tpl'); } $userDao =& DAORegistry::getDAO('UserDAO'); $newUser =& $userDao->getUser($userId); $session =& Request::getSession(); // FIXME Support "stack" of signed-in-as user IDs? if (isset($newUser) && $session->getUserId() != $newUser->getId()) { $session->setSessionVar('signedInAs', $session->getUserId()); $session->setSessionVar('userId', $userId); $session->setUserId($userId); $session->setSessionVar('username', $newUser->getUsername()); Request::redirect(null, 'user'); } } Request::redirect(null, Request::getRequestedPage()); }
function setupTemplate() { parent::setupTemplate(); $templateMgr =& TemplateManager::getManager(); $pageHierarchy = array(array(Request::url(null, 'referral', 'index'), 'plugins.generic.referral.referrals')); $templateMgr->assign('pageHierarchy', $pageHierarchy); }
public static function createFilter() { if (preg_match('/\\/api\\//', \Request::url())) { return new ApiFilters(); } return new WebFilters(); }
/** * Render an exception into an HTTP response. * * @param \Illuminate\Http\Request $request * @param \Exception $e * @return \Illuminate\Http\Response */ public function render($request, Exception $e) { if ($e instanceof TokenMismatchException) { //redirect to form an example of how I handle minedd return redirect()->to('/')->with('message', "Opps! Seems you couldn't submit form for a longtime. Please try again"); } if ($this->isHttpException($e)) { switch ($e->getStatusCode()) { case 404: $url = explode('/', \Request::url()); $referidos = User::where('type', '=', 'referrer')->get(); foreach ($referidos as $referido) { if ($referido->code_referrer == $url[3]) { return redirect()->route('site.singUp', [$referido->code_referrer]); } } return redirect()->to('/404'); break; // internal error // internal error case '500': return redirect()->guest('/500'); break; default: return $this->renderHttpException($e); break; } } else { return parent::render($request, $e); } }
public function create() { if (\Request::ajax()) { return response()->json(['url' => \Request::url(), 'title' => 'Contact | Jonas Vanderhaegen', 'path' => \Request::path(), 'view' => view('pages.messages.create')->render()]); } return view('pages.messages.create'); }
public static function before() { if (Request::get('lang')) { $langList = array_map(function ($a) { return $a['iso']; }, Language::getList()); $lang = strtolower(Request::get('lang')); if (in_array($lang, $langList)) { Request::cookie(self::$langKeyCookie, $lang); } Request::redirect(Request::url(array('lang' => ''))); } if (Request::get('confirm_email')) { connectionUserModel::create()->confirmationEmailLink(Request::get('confirm_email')); Request::get('email_confirm', true); } if (ConnectionHelper::isLogin() && Request::get('status') && Request::get('status') == connectionUserModel::STATUS_MODERATE) { $userLogin = ConnectionHelper::userLogin(); connectionUserModel::create()->changeStatus($userLogin['id'], connectionUserModel::STATUS_MODERATE, 'Пользователь отправил профиль на проверку.'); Request::redirect('/profile/'); } if (Request::get('auth') && !ConnectionHelper::isLogin()) { Request::redirect('/login/'); } if (ConnectionHelper::isLogin()) { ConnectionHelper::updateUserActive(); } }
/** * Show the application registration form. * * @return \Illuminate\Http\Response */ public function getRegister() { if (\Request::ajax()) { return response()->json(['locale' => session()->get('locale', 'nl'), 'url' => \Request::url(), 'title' => 'Register | De Sessie', 'type' => 'pageload', 'path' => \Request::path(), 'view' => view('auth.register')->render()]); } return view('auth.register'); }
/** * @see MetadataDataObjectAdapter::extractMetadataFromDataObject() * @param $monograph Monograph * @return MetadataDescription */ function extractMetadataFromDataObject($monograph) { assert(is_a($monograph, 'Monograph')); AppLocale::requireComponents(LOCALE_COMPONENT_APP_COMMON); // Retrieve data that belongs to the publication format. $oaiDao = DAORegistry::getDAO('OAIDAO'); /* @var $oaiDao OAIDAO */ $publishedMonographDao = DAORegistry::getDAO('PublishedMonographDAO'); $chapterDao = DAORegistry::getDAO('ChapterDAO'); $monograph = $publishedMonographDao->getById($monograph->getId()); $press = $oaiDao->getPress($monograph->getPressId()); $description = $this->instantiateMetadataDescription(); // Update status // Is communicated via an attribute, so property value is empty $description->addStatement('administrative_data/delivery/update_status[@type="urn_new"]', ""); $urn = ""; $scheme = ""; $pubIdPlugins = PluginRegistry::loadCategory('pubIds'); if (isset($pubIdPlugins) && array_key_exists('URNDNBPubIdPlugin', $pubIdPlugins) && $pubIdPlugins['URNDNBPubIdPlugin']->getEnabled() == true) { $urn = $pubIdPlugins['URNDNBPubIdPlugin']->getPubId($monograph); $namespaces = explode(':', $urn); $numberOfNamespaces = min(sizeof($namespaces), 3); $scheme = implode(":", array_slice($namespaces, 0, $numberOfNamespaces)); } // URN $description->addStatement('record/identifier', $urn . ' [@scheme="' . $scheme . '"]'); // URL $url = Request::url($press->getPath(), 'catalog', 'book', array($monograph->getId())); $description->addStatement('record/resource/identifier[@scheme="url", @type="frontpage", @role="primary"]', $url); // URL Mime type $description->addStatement('record/resource/format[@scheme="imt"]', "text/html"); return $description; }
/** * Save changes to program settings. */ function saveProgramSettings() { $this->validate(); $this->setupTemplate(true); $schedConf =& Request::getSchedConf(); if (!$schedConf) { Request::redirect(null, null, 'index'); } import('classes.manager.form.ProgramSettingsForm'); $settingsForm = new ProgramSettingsForm(); $settingsForm->readInputData(); $formLocale = $settingsForm->getFormLocale(); $programTitle = Request::getUserVar('programFileTitle'); $editData = false; if (Request::getUserVar('uploadProgramFile')) { if (!$settingsForm->uploadProgram('programFile', $formLocale)) { $settingsForm->addError('programFile', Locale::translate('common.uploadFailed')); } $editData = true; } elseif (Request::getUserVar('deleteProgramFile')) { $settingsForm->deleteProgram('programFile', $formLocale); $editData = true; } if (!$editData && $settingsForm->validate()) { $settingsForm->execute(); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign(array('currentUrl' => Request::url(null, null, null, 'program'), 'pageTitle' => 'schedConf.program', 'message' => 'common.changesSaved', 'backLink' => Request::url(null, null, Request::getRequestedPage()), 'backLinkLabel' => 'manager.conferenceSiteManagement')); $templateMgr->display('common/message.tpl'); } else { $settingsForm->display(); } }
function thankYou($args) { $templateMgr =& TemplateManager::getManager(); $journal =& Request::getJournal(); $templateMgr->assign(array('currentUrl' => Request::url(null, null, 'donations'), 'pageTitle' => 'donations.thankYou', 'journalName' => $journal->getJournalTitle(), 'message' => 'donations.thankYouMessage')); $templateMgr->display('common/message.tpl'); }
/** * Setup common template variables. * @param $subclass boolean set to true if caller is below this handler in the hierarchy */ function setupTemplate($subclass = false) { parent::setupTemplate(); $templateMgr =& TemplateManager::getManager(); $templateMgr->setCacheability(CACHEABILITY_PUBLIC); $templateMgr->assign('pageHierachy', array(array(Request::url(null, null, 'announcements'), 'announcement.announcements'))); }
/** * Setup common template variables. * @param $subclass boolean set to true if caller is below this handler in the hierarchy */ function setupTemplate($subclass = false) { parent::setupTemplate(); AppLocale::requireComponents(LOCALE_COMPONENT_PKP_ADMIN, LOCALE_COMPONENT_OJS_ADMIN, LOCALE_COMPONENT_OJS_MANAGER); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('pageHierarchy', $subclass ? array(array(Request::url(null, 'user'), 'navigation.user'), array(Request::url(null, 'admin'), 'admin.siteAdmin')) : array(array(Request::url(null, 'user'), 'navigation.user'))); }
public function __construct() { $this->userIp = class_exists('\\Illuminate\\Support\\Facades\\Request') ? \Request::getClientIp() : $_SERVER['REMOTE_ADDR']; $this->userAgent = class_exists('\\Illuminate\\Support\\Facades\\Request') ? \Request::server('HTTP_USER_AGENT') : $_SERVER['HTTP_USER_AGENT']; $this->referrer = class_exists('\\Illuminate\\Support\\Facades\\URL') ? \URL::previous() : $_SERVER['HTTP_REFERER']; $this->permalink = class_exists('\\Illuminate\\Support\\Facades\\Request') ? \Request::url() : $_SERVER['REQUEST_URI']; }
/** * @param \Exception $exception * @return \Illuminate\Http\JsonResponse */ public function format($exception) { // Define the response $result = ['errors' => trans('messages.sorry')]; // Default response of 400 $statusCode = 400; $addDebugData = $this->isDebugEnabled(); switch (true) { case $exception instanceof HttpException: $statusCode = $exception->getStatusCode(); $result['errors'] = $exception->getMessage(); break; case $exception instanceof ValidationException: $result['errors'] = $exception->errors(); $addDebugData = false; break; } // Prepare response $response = ['success' => false, 'result' => $result, 'meta' => ['version' => config('app.version.api'), 'request' => \Request::method() . ' ' . \Request::url(), 'debug' => $this->isDebugEnabled()]]; // If the app is in debug mode && not Validation exception if ($addDebugData) { $response['debug'] = ['exception' => get_class($exception), 'message' => $exception->getMessage(), 'file' => $exception->getFile(), 'line' => $exception->getLine(), 'trace' => $exception->getTrace()]; } // Return a JSON response with the response array and status code return response()->json($response, $statusCode); }
function sendNotification($users, $journal, $issue) { if ($users->getCount() != 0) { import('lib.pkp.classes.mail.MailTemplate'); $email = new MailTemplate('OPEN_ACCESS_NOTIFY', $journal->getPrimaryLocale()); $email->setSubject($email->getSubject($journal->getPrimaryLocale())); $email->setReplyTo(null); $email->addRecipient($journal->getSetting('contactEmail'), $journal->getSetting('contactName')); $paramArray = array('journalName' => $journal->getLocalizedName(), 'journalUrl' => Request::url($journal->getPath()), 'editorialContactSignature' => $journal->getSetting('contactName') . "\n" . $journal->getLocalizedName()); $email->assignParams($paramArray); $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO'); $publishedArticles = $publishedArticleDao->getPublishedArticlesInSections($issue->getId()); $mimeBoundary = '==boundary_' . md5(microtime()); $templateMgr = TemplateManager::getManager(); $templateMgr->assign('body', $email->getBody($journal->getPrimaryLocale())); $templateMgr->assign('templateSignature', $journal->getSetting('emailSignature')); $templateMgr->assign('mimeBoundary', $mimeBoundary); $templateMgr->assign('issue', $issue); $templateMgr->assign('publishedArticles', $publishedArticles); $email->addHeader('MIME-Version', '1.0'); $email->setContentType('multipart/alternative; boundary="' . $mimeBoundary . '"'); $email->setBody($templateMgr->fetch('subscription/openAccessNotifyEmail.tpl')); while ($user = $users->next()) { $email->addBcc($user->getEmail(), $user->getFullName()); } $email->send(); } }
public function getHome() { $result = @json_decode(file_get_contents(Config::get('app.server_url') . 'check?access_token=' . Cookie::get('access_token'))); $url = Request::url(); $state = md5(uniqid(rand(), TRUE)); $error = Session::get('error'); switch ($url) { case 'http://app1.dev': $redirect = Config::get('app.server_url') . 'oauth?client_id=1&redirect_uri=http://app1.dev/login/1&response_type=code&scope=user&state=' . $state; break; case 'http://app2.dev': $redirect = Config::get('app.server_url') . 'oauth?client_id=2&redirect_uri=http://app2.dev/login/2&response_type=code&scope=user&state=' . $state; break; case 'http://app3.dev': //No redirect start $redirect = null; break; default: $redirect = null; break; } //If button click denied no auto-redirect if ($error == 'access_denied') { $redirect = null; } if (isset($result->status) && $result->status == 1) { return View::make('client.home', array("url" => $url)); } else { if ($redirect) { return Redirect::to($redirect); } else { return View::make('client.login', array("url" => $url, "state" => $state)); } } }
public function __construct(array $comments) { $this->nodes = new CommentBranch(); $lookup_table = array(); foreach ($comments as $i) { $i->children = array(); if ($i->parent_id == 0) { $this->nodes->children[$i->id] = $i; $lookup_table[$i->id] = $i->id; } else { if (isset($lookup_table[$i->parent_id])) { $path = explode('_', $lookup_table[$i->parent_id]); $tmp = $this->nodes; foreach ($path as $v) { $tmp = $tmp->children[$v]; } /* $tmp = F::reduce_left($path, function($v, $i, $c, $r) { return $r->children[$v]; }, $this->nodes);*/ $tmp->children[$i->id] = $i; $lookup_table[$i->id] = $lookup_table[$i->parent_id] . '_' . $i->id; } else { throw new LogicException("comment system bugged, called from: " . Request::url()); } } } }
/** * Get the base URL to the scheduled conference. * @return string */ function getUrl() { // This is potentially abusable, since there's no guarantee the conference // component of the URL hasn't been changed. However, there's nothing to // gain by doing so. return Request::url(null, $this->getPath()); }
function sort_table_by($sortBy, $text, $url = null) { $currentDirection = Request::get('sort_direction'); $currentSortBy = Request::get('sort_by'); $iconDirection = "fa-sort"; $sortDirection = $currentDirection == 'asc' ? 'desc' : 'asc'; // changes the little icon for us if ($currentSortBy == $sortBy) { $iconDirection = $currentDirection == 'asc' ? "fa-sort-up" : "fa-sort-down"; } $url = $url ?: Request::url() . "?sort_direction={$sortDirection}&sort_by={$sortBy}"; // we want to keep additional query parameters on the string // so we loop through and build query below foreach (Request::query() as $queryName => $queryValue) { if (!in_array($queryName, array('sort_by', 'sort_direction'))) { if (is_array($queryValue)) { foreach ($queryValue as $value) { $url .= "&{$queryName}[]={$value}"; } } else { $url .= "&{$queryName}={$queryValue}"; } } } return "\n <a class=\"table-sorter-link {$sortBy}\" href=\"{$url}\">\n {$text}\n <i class=\"fa {$iconDirection} pull-right\"></i>\n </a>"; }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { // dd(\Request::url()); $url = explode("/", \Request::url()); $url = end($url); $publicidad = \App\publicidad::where('activo', '=', 1)->where('seccion', '=', 0)->orderBy('posicion')->get(); $publiSlider = \App\publicidad::where('activo', '=', 1)->limit(6)->where('seccion', '=', -1)->orderBy('posicion')->get(); $total = 12 - $publicidad->count(); $galeria = \App\galeria::select(\DB::raw('DISTINCT galeria.id_galeria as id'), \DB::raw('DATE(galeria.fecha_subida) as fecha'), 'galeria.portada', 'galeria.nombre', 'galeria.descripcion', 'galeria.activo', 'galeria.step', 'v.cantidad as cantidad_video', 'i.cantidad as cantidad_imagen', 'galeria.id_tipo_galeria as id_tipo')->leftJoin(\DB::raw('(SELECT id_galeria,COUNT(id_elemento) as cantidad FROM elemento WHERE tipo_elemento = 2 GROUP BY id_galeria) as v'), 'v.id_galeria', '=', 'galeria.id_galeria')->leftJoin(\DB::raw('(SELECT id_galeria,COUNT(id_elemento) as cantidad FROM elemento WHERE tipo_elemento = 1 GROUP BY id_galeria) as i'), 'i.id_galeria', '=', 'galeria.id_galeria')->join('tipo_galeria as tg', 'tg.id_tipo_galeria', '=', 'galeria.id_tipo_galeria')->where('tg.activo', '=', 1)->orderBy('galeria.activo', 'desc')->orderBy('galeria.fecha_subida', 'desc')->paginate(12); $datos = array(); foreach ($galeria as $val) { $datos[] = $val->id_tipo; } $data = array('categorias' => \DB::table('tipo_galeria')->select('id_tipo_galeria as id', 'nombre')->where('activo', '=', 1)->whereIn('tipo_galeria.id_tipo_galeria', $datos)->get(), 'galeria' => $galeria, 'publiSlider' => $publiSlider); // dd($data); switch ($url) { case 'index.html': $data['publicidad'] = $publicidad; return view('inicio', $data); break; case 'galerias.html': return view('public.galerias', $data); } // }
/** * Determine whether this navigation item is active or not. * This implementation tries to guess it based on the request * URL and query parameters. * * @return boolean true if item is active, false otherwise */ public function isActive() { if (isset($this->active)) { return $this->active; } $url = $this->getURL(); // if URL is set, try to guess whether active or not if (isset($url)) { list($request_path, $query) = explode('?', Request::path()); list($request_url, $query) = explode('?', Request::url()); list($url, $query) = explode('?', $url); if (!preg_match('%^[a-z]+:%', $url) && $url[0] !== '/') { $url = $GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP'] . $url; } if ($url === $request_path || $url === $request_url) { $this->active = true; if (isset($this->params)) { foreach ($this->params as $key => $val) { if (Request::get($key) != $val) { $this->active = false; } } } if ($this->active) { return true; } } } return $this->active = (bool) $this->activeSubNavigation(); }
function sendReminder($reviewAssignment, $article, $journal) { $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); $userDao =& DAORegistry::getDAO('UserDAO'); $reviewId = $reviewAssignment->getReviewId(); $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId()); if (!isset($reviewer)) { return false; } import('mail.ArticleMailTemplate'); $reviewerAccessKeysEnabled = $journal->getSetting('reviewerAccessKeysEnabled'); $email =& new ArticleMailTemplate($article, $reviewerAccessKeysEnabled ? 'REVIEW_REMIND_AUTO_ONECLICK' : 'REVIEW_REMIND_AUTO', null, false, $journal); $email->setJournal($journal); $email->setFrom($journal->getSetting('contactEmail'), $journal->getSetting('contactName')); $email->addRecipient($reviewer->getEmail(), $reviewer->getFullName()); $email->setAssoc(ARTICLE_EMAIL_REVIEW_REMIND, ARTICLE_EMAIL_TYPE_REVIEW, $reviewId); $email->setSubject($email->getSubject($journal->getPrimaryLocale())); $email->setBody($email->getBody($journal->getPrimaryLocale())); $urlParams = array(); if ($reviewerAccessKeysEnabled) { import('security.AccessKeyManager'); $accessKeyManager =& new AccessKeyManager(); // Key lifetime is the typical review period plus four weeks $keyLifetime = ($journal->getSetting('numWeeksPerReview') + 4) * 7; $urlParams['key'] = $accessKeyManager->createKey('ReviewerContext', $reviewer->getUserId(), $reviewId, $keyLifetime); } $submissionReviewUrl = Request::url($journal->getPath(), 'reviewer', 'submission', $reviewId, $urlParams); $paramArray = array('reviewerName' => $reviewer->getFullName(), 'reviewerUsername' => $reviewer->getUsername(), 'journalUrl' => $journal->getUrl(), 'reviewerPassword' => $reviewer->getPassword(), 'reviewDueDate' => strftime(Config::getVar('general', 'date_format_short'), strtotime($reviewAssignment->getDateDue())), 'editorialContactSignature' => $journal->getSetting('contactName') . "\n" . $journal->getJournalTitle(), 'passwordResetUrl' => Request::url($journal->getPath(), 'login', 'resetPassword', $reviewer->getUsername(), array('confirm' => Validation::generatePasswordResetHash($reviewer->getUserId()))), 'submissionReviewUrl' => $submissionReviewUrl); $email->assignParams($paramArray); $email->send(); $reviewAssignment->setDateReminded(Core::getCurrentDate()); $reviewAssignment->setReminderWasAutomatic(1); $reviewAssignmentDao->updateReviewAssignment($reviewAssignment); }
/** * Update language settings. */ function saveLanguageSettings() { $this->validate(); $this->setupTemplate(true); $site =& Request::getSite(); $primaryLocale = Request::getUserVar('primaryLocale'); $supportedLocales = Request::getUserVar('supportedLocales'); if (Locale::isLocaleValid($primaryLocale)) { $site->setPrimaryLocale($primaryLocale); } $newSupportedLocales = array(); if (isset($supportedLocales) && is_array($supportedLocales)) { foreach ($supportedLocales as $locale) { if (Locale::isLocaleValid($locale)) { array_push($newSupportedLocales, $locale); } } } if (!in_array($primaryLocale, $newSupportedLocales)) { array_push($newSupportedLocales, $primaryLocale); } $site->setSupportedLocales($newSupportedLocales); $siteDao =& DAORegistry::getDAO('SiteDAO'); $siteDao->updateObject($site); AdminLanguagesHandler::removeLocalesFromConferences(); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign(array('currentUrl' => Request::url(null, null, null, 'languages'), 'pageTitle' => 'common.languages', 'message' => 'common.changesSaved', 'backLink' => Request::url(null, null, ROLE_PATH_SITE_ADMIN), 'backLinkLabel' => 'admin.siteAdmin')); $templateMgr->display('common/message.tpl'); }
public function getError($exception, $code) { // for local testing and getting error emails just make not sign remove, i.e: if(Config::get('app.debug')) if (!Config::get('app.debug')) { // From where user is coming $previous_url = URL::previous(); //The above one is for Laravel, you can use this also in PHP projects $previous_url = $_SERVER['HTTP_REFERER']; //User IP address $ip = Request::getClientIp(); //The above one is for Laravel, you can use this also in PHP projects $ip = $_SERVER['REMOTE_ADDR']; // Get requested URL, Date and Time. $url = Request::url(); $now = new DateTime(); $errorDate = date_format($now, 'l, d-M-Y => H:i:s T'); // Getting browser Info from models/Error404 class. $browserInfo = Error404::getBrowser(); $browserName = $browserInfo['name']; $browserVersion = $browserInfo['version']; $platform = $browserInfo['platform']; // Getting Location Info passing the ip address to the function in models/Error404 class. $ipInfo = Error404::getIp($ip); $country = $ipInfo['country']; $state = $ipInfo['state']; $town = $ipInfo['town']; //generate more Info in mail-subject, for example for multiple web sites you can change MY Web to the name of your web $subject = 'My Web Error : '; // Log the info if you want to... Log::info("###### My Web ERROR ######"); Log::info("IP: {$ip}"); Log::info("URL: {$url}"); Log::info("Date and Time: {$errorDate}"); Log::info("Browser Name/Version: {$browserName} / {$browserVersion}"); Log::info("Visitor's Country, State and City: {$country}, {$state}, {$town}"); Log::info("Visitor coming from: {$previous_url}"); Log::info("###### !ERROR ######\n"); //Creating the final message to send via E-mail to web-admin $message = "###### ERROR ###### <br/>\n Error Code: <b>{$code}</b> <br/>\n IP: {$ip} <br/>\n URL: {$url} <br/>\n Date and Time: {$errorDate} <br/>\n Browser Name/Version: {$browserName} / {$browserVersion} <br/>\n Operating System: {$platform} <br/>\n Visitor's Country, State and City: {$country}, {$state}, {$town} .<br/>\n Visitor coming from: {$previous_url} <br/>"; if ($code != 404) { $message .= "Exeption:<br/>{$exception}<br/>"; $subject .= " php_error : {$code}"; } else { $subject .= ' Route missing'; } $message .= "###### !ERROR ######"; // Sending Error Report via E-mail -> Please edit this and enter your email receiving and sending e-mail address try { Mail::send('emails.error_email', array('var' => $message), function ($message) use($subject) { $message->to('*****@*****.**')->from('*****@*****.**')->subject("{$subject}"); }); } catch (Exception $e) { Log::info("{$e}\n"); } $headline = "OOPS! YOU DON'T WANT TO BE HERE"; // $headline is the line you want to display on the page. // Finally after reciving error email and loging the information show the HTML page to user you created for end-user. return View::make('view/error')->withCode($code)->withHeadline($headline); } //Closing of if(app.debug) }
/** * @covers Request::url */ public function testUrl() { $this->assertEquals('http://phpixie.com/test/', $this->object->url()); $this->assertEquals('http://phpixie.com/test/?test=test', $this->object->url(true)); $this->object = new \PHPixie\Request($this->pixie, $this->object->route, 'GET', array(), array(), array(), array('HTTPS' => 'on', 'HTTP_HOST' => 'phpixie.com', 'REQUEST_URI' => '/test/?test=test')); $this->assertEquals('https://phpixie.com/test/', $this->object->url()); $this->assertEquals('https://phpixie.com/test/?test=test', $this->object->url(true)); }
/** * Setup common template variables. * @param $subclass boolean set to true if caller is below this handler in the hierarchy */ function setupTemplate($subclass = false) { parent::setupTemplate(); $templateMgr =& TemplateManager::getManager(); if ($subclass) { $templateMgr->assign('pageHierarchy', array(array(Request::url('admin'), 'admin.siteAdmin'))); } }
/** * Send JSON error message * * @return string */ protected function _errorResponse($msg) { if (Request::isAjax()) { Response::jsonError($msg); } else { Response::redirect(Request::url(array('index'), true)); } }
public function getTwitterUrl() { $url = \Request::url() . "#comment-" . $this->getId(); $message = $this->isTranslated() ? $this->getMessageTranslation() : $this->getMessage(); $username = $this->getUser()->getUsername(); $twitterParams = array("url" => $url, "text" => "{$message} -- {$username}"); return "http://twitter.com/share?" . http_build_query($twitterParams); }
/** * Initialize form data. */ function initData() { $PagSeguroPlugin =& $this->PagSeguroPlugin; $user =& Request::getUser(); $userId = $user ? $user->getUserId() : null; $queuedPayment =& $this->queuedPayment; $this->_data = array('email_cobranca' => '*****@*****.**', 'item_name' => $queuedPayment->getDescription(), 'a3' => $queuedPayment->getAmount($args), 'quantity' => 1, 'no_note' => 1, 'no_shipping' => 1, 'currency_code' => $queuedPayment->getCurrencyCode(), 'lc' => String::substr(Locale::getLocale(), 3), 'custom' => $this->key, 'notify_url' => Request::url(null, null, 'payment', 'ipn', array($queuedPayment->getQueuedPaymentId())), 'return' => Request::url(null, null, 'payment', 'return', array($queuedPayment->getQueuedPaymentId())), 'cancel_return' => Request::url(null, null, 'payment', 'cancel', array($queuedPayment->getQueuedPaymentId())), 'first_name' => $user ? $user->getFirstName() : '', 'last_name' => $user ? $user->getLastname() : '', 'city' => '', 'zip' => '', 'item_number' => 1); }