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


PHP NotFoundException函数代码示例

本文整理汇总了PHP中NotFoundException函数的典型用法代码示例。如果您正苦于以下问题:PHP NotFoundException函数的具体用法?PHP NotFoundException怎么用?PHP NotFoundException使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: BuildCategorySiteMap

 public function BuildCategorySiteMap($UrlCode, &$Urls)
 {
     $Category = CategoryModel::Categories($UrlCode);
     if (!$Category) {
         throw NotFoundException();
     }
     // Get the min/max dates for the sitemap.
     $Row = Gdn::SQL()->Select('DateInserted', 'min', 'MinDate')->Select('DateInserted', 'max', 'MaxDate')->From('Discussion')->Where('CategoryID', $Category['CategoryID'])->Get()->FirstRow(DATASET_TYPE_ARRAY);
     if ($Row) {
         $From = strtotime('first day of this month 00:00:00', strtotime($Row['MaxDate']));
         $To = strtotime('first day of this month 00:00:00', strtotime($Row['MinDate']));
         if (!$From || !$To) {
             $From = -1;
             $To = 0;
         }
     } else {
         $From = -1;
         $To = 0;
     }
     $Now = time();
     for ($i = $From; $i >= $To; $i = strtotime('-1 month', $i)) {
         $Url = array('Loc' => Url('/categories/archives/' . rawurlencode($Category['UrlCode'] ? $Category['UrlCode'] : $Category['CategoryID']) . '/' . gmdate('Y-m', $i), TRUE), 'LastMod' => '', 'ChangeFreq' => '');
         $LastMod = strtotime('last day of this month', $i);
         if ($LastMod > $Now) {
             $LastMod = $Now;
         }
         $Url['LastMod'] = gmdate('c', $LastMod);
         $Urls[] = $Url;
     }
     // If there are no links then just link to the category.
     if (count($Urls) === 0) {
         $Url = array('Loc' => CategoryUrl($Category), 'LastMode' => '', 'ChangeFreq' => '');
         $Urls[] = $Url;
     }
 }
开发者ID:SatiricMan,项目名称:addons,代码行数:35,代码来源:class.sitemaps.plugin.php

示例2: Page

 public function Page($Reference)
 {
     $PageModel = new PageModel();
     $Page = $PageModel->GetFullID($Reference);
     if (!$Page) {
         throw NotFoundException();
     }
     $this->Page = $Page;
     if ($this->Head) {
         SetMetaTags($Page, $this);
         if ($Page->CustomCss) {
             $CustomCss = "\n" . $Page->CustomCss;
             if (!StringBeginsWith(trim($CustomCss), '<style', True)) {
                 $CustomCss = Wrap($CustomCss, 'style', array('type' => 'text/css'));
             }
             $this->Head->AddString($CustomCss);
         }
         if ($Page->CustomJs) {
             $CustomJs = $Page->CustomJs;
             if (!StringBeginsWith(trim($CustomJs), '<script', True)) {
                 $CustomJs = Wrap($CustomJs, 'script', array('type' => 'text/javascript'));
             }
             $this->Head->AddString($CustomJs);
         }
     }
     if ($Page->SectionID) {
         $this->Section = BuildNode($Page, 'Section');
         $this->SectionID = $Page->SectionID;
         CandyHooks::AddModules($this, $this->Section);
     }
     $this->FireEvent('ContentPage');
     if ($Page->View) {
         $this->View = $this->FetchViewLocation($this->View, False, False, False);
     }
     if (!$this->View) {
         $this->View = $this->FetchViewLocation('view', 'page', '', False);
         if (!$this->View) {
             $this->View = 'default';
         }
     }
     $this->Title($Page->Title);
     $this->SetData('Content', $Page, True);
     $this->EventArguments['Format'] =& $Page->Format;
     $this->EventArguments['Body'] =& $Page->Body;
     $this->FireEvent('BeforeBodyFormat');
     $this->ContentBodyHtml = Gdn_Format::To($Page->Body, $Page->Format);
     $Doc = PqDocument($this->ContentBodyHtml);
     $Header = $Doc->Find('h1');
     $CountH1 = count($Header);
     if ($CountH1 == 0) {
         $this->SetData('Headline', Gdn_Format::Text($Page->Title));
     } elseif ($CountH1 == 1) {
         $this->SetData('Headline', $Header->Text());
         $Header->Remove();
         $this->ContentBodyHtml = $Doc->Html();
     }
     //
     $this->AddModule('PageInfoModule');
     $this->Render();
 }
开发者ID:unlight,项目名称:Candy,代码行数:60,代码来源:class.contentcontroller.php

示例3: UserController_TempBan_Create

 public function UserController_TempBan_Create($Sender, $Args)
 {
     $Sender->Permission('Garden.Moderation.Manage');
     $UserID = (int) GetValue('0', $Args);
     $Unban = (bool) GetValue('1', $Args);
     $User = Gdn::UserModel()->GetID($UserID, DATASET_TYPE_ARRAY);
     if (!$User) {
         throw NotFoundException($User);
     }
     $UserModel = Gdn::UserModel();
     if ($Sender->Form->AuthenticatedPostBack()) {
         if ($Unban) {
             $UserModel->Unban($UserID, array('RestoreContent' => $Sender->Form->GetFormValue('RestoreContent')));
         } else {
             $Minutes = $Sender->Form->GetValue('TempBanPeriodMinutes');
             $Hours = $Sender->Form->GetValue('TempBanPeriodHours');
             $Days = $Sender->Form->GetValue('TempBanPeriodDays');
             $Months = $Sender->Form->GetValue('TempBanPeriodMonths');
             $Years = $Sender->Form->GetValue('TempBanPeriodYears');
             if (!(empty($Minutes) && empty($Hours) && empty($Days) && empty($Months) && empty($Years))) {
                 $AutoExpirePeriod = Gdn_Format::ToDateTime(strtotime("+{$Years} years {$Months} months {$Days} days {$Hours} hours {$Minutes} minutes"));
             } else {
                 $Sender->Form->AddError('ValidateRequired', 'Ban Period');
             }
             if (!ValidateRequired($Sender->Form->GetFormValue('Reason'))) {
                 $Sender->Form->AddError('ValidateRequired', 'Reason');
             }
             if ($Sender->Form->GetFormValue('Reason') == 'Other' && !ValidateRequired($Sender->Form->GetFormValue('ReasonText'))) {
                 $Sender->Form->AddError('ValidateRequired', 'Reason Text');
             }
             if ($Sender->Form->ErrorCount() == 0) {
                 if ($Sender->Form->GetFormValue('Reason') == 'Other') {
                     $Reason = $Sender->Form->GetFormValue('ReasonText');
                 } else {
                     $Reason = $Sender->Form->GetFormValue('Reason');
                 }
                 Gdn::Locale()->SetTranslation('HeadlineFormat.Ban', FormatString('{RegardingUserID,You} banned {ActivityUserID,you} until {BanExpire, date}.', array('BanExpire' => $AutoExpirePeriod)));
                 $UserModel->Ban($UserID, array('Reason' => $Reason));
                 $UserModel->SetField($UserID, 'BanExpire', $AutoExpirePeriod);
             }
         }
         if ($Sender->Form->ErrorCount() == 0) {
             // Redirect after a successful save.
             if ($Sender->Request->Get('Target')) {
                 $Sender->RedirectUrl = $Sender->Request->Get('Target');
             } else {
                 $Sender->RedirectUrl = Url(UserUrl($User));
             }
         }
     }
     $Sender->SetData('User', $User);
     $Sender->AddSideMenu();
     $Sender->Title($Unban ? T('Unban User') : T('Temporary Ban User'));
     if ($Unban) {
         $Sender->View = 'Unban';
     } else {
         $Sender->View = $this->ThemeView('tempban');
     }
     $Sender->Render();
 }
开发者ID:pawigor,项目名称:TempBan-Vanilla-Plugin,代码行数:60,代码来源:default.php

示例4: Index

 /**
  * Creates and renders an instance of a module.
  */
 public function Index($Module, $AppFolder = '')
 {
     $ModuleClassExists = class_exists($Module);
     if ($ModuleClassExists) {
         // Make sure that the class implements Gdn_IModule
         $ReflectionClass = new ReflectionClass($Module);
         if ($ReflectionClass->implementsInterface("Gdn_IModule")) {
             // Set the proper application folder on this controller so that things render properly.
             if ($AppFolder) {
                 $this->ApplicationFolder = $AppFolder;
             } else {
                 $Filename = str_replace('\\', '/', substr($ReflectionClass->getFileName(), strlen(PATH_ROOT)));
                 // Figure our the application folder for the module.
                 $Parts = explode('/', trim($Filename, '/'));
                 if ($Parts[0] == 'applications') {
                     $this->ApplicationFolder = $Parts[1];
                 }
             }
             $ModuleInstance = new $Module($this);
             $this->SetData('_Module', $ModuleInstance);
             $this->Render('Index', FALSE, 'dashboard');
             return;
         }
     }
     throw NotFoundException($Module);
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:29,代码来源:class.modulecontroller.php

示例5: FileNotFound

 /**
  * A standard 404 File Not Found error message is delivered when this action
  * is encountered.
  */
 public function FileNotFound()
 {
     if ($this->DeliveryMethod() == DELIVERY_METHOD_XHTML) {
         $this->Render();
     } else {
         $this->RenderException(NotFoundException());
     }
 }
开发者ID:tautomers,项目名称:knoopvszombies,代码行数:12,代码来源:class.homecontroller.php

示例6: FileNotFound

 /**
  * A standard 404 File Not Found error message is delivered when this action
  * is encountered.
  * 
  * @since 2.0.0
  * @access public
  */
 public function FileNotFound()
 {
     if ($this->DeliveryMethod() == DELIVERY_METHOD_XHTML) {
         header("HTTP/1.0 404", TRUE, 404);
         $this->Render();
     } else {
         $this->RenderException(NotFoundException());
     }
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:16,代码来源:class.homecontroller.php

示例7: DiscussionController_Bump_Create

 /**
  * Handle discussion option menu bump action.
  */
 public function DiscussionController_Bump_Create($Sender, $Args)
 {
     $Sender->Permission('Garden.Moderation.Manage');
     // Get discussion
     $DiscussionID = $Sender->Request->Get('discussionid');
     $Discussion = $Sender->DiscussionModel->GetID($DiscussionID);
     if (!$Discussion) {
         throw NotFoundException('Discussion');
     }
     // Update DateLastComment & redirect
     $Sender->DiscussionModel->SetProperty($DiscussionID, 'DateLastComment', Gdn_Format::ToDateTime());
     Redirect(DiscussionUrl($Discussion));
 }
开发者ID:SatiricMan,项目名称:addons,代码行数:16,代码来源:class.bump.plugin.php

示例8: DiscussionController_NoIndex_Create

 /**
  * Handle discussion option menu NoIndex action (simple toggle).
  */
 public function DiscussionController_NoIndex_Create($Sender, $Args)
 {
     $Sender->Permission(array('Garden.Moderation.Manage', 'Garden.Curation.Manage'), FALSE);
     // Get discussion
     $DiscussionID = $Sender->Request->Get('discussionid');
     $Discussion = $Sender->DiscussionModel->GetID($DiscussionID);
     if (!$Discussion) {
         throw NotFoundException('Discussion');
     }
     // Toggle NoIndex
     $NoIndex = GetValue('NoIndex', $Discussion) ? 0 : 1;
     // Update DateLastComment & redirect
     $Sender->DiscussionModel->SetProperty($DiscussionID, 'NoIndex', $NoIndex);
     Redirect(DiscussionUrl($Discussion));
 }
开发者ID:SatiricMan,项目名称:addons,代码行数:18,代码来源:class.noindex.plugin.php

示例9: FileNotFound

 /**
  * A standard 404 File Not Found error message is delivered when this action
  * is encountered.
  * 
  * @since 2.0.0
  * @access public
  */
 public function FileNotFound()
 {
     $this->RemoveCssFile('admin.css');
     $this->AddCssFile('style.css');
     $this->MasterView = 'default';
     if ($this->Data('ViewPaths')) {
         Trace($this->Data('ViewPaths'), 'View Paths');
     }
     if ($this->DeliveryMethod() == DELIVERY_METHOD_XHTML) {
         header("HTTP/1.0 404", TRUE, 404);
         $this->Render();
     } else {
         $this->RenderException(NotFoundException());
     }
 }
开发者ID:rnovino,项目名称:Garden,代码行数:22,代码来源:class.homecontroller.php

示例10: Detail

 /**
  * Show some facets about a specific badge
  *
  * @param int $BadgeID
  * @param string $Slug
  * @throws NotFoundException
  */
 public function Detail($BadgeID, $Slug = NULL)
 {
     $UserID = Gdn::Session()->UserID;
     $Badge = $this->BadgeModel->GetByID($BadgeID);
     $AwardCount = $this->BadgeAwardModel->GetCount($BadgeID);
     $UserBadgeAward = $this->BadgeAwardModel->Exists($UserID, $BadgeID);
     $RecentAwards = $this->BadgeAwardModel->GetRecent($BadgeID);
     if (!$Badge) {
         throw NotFoundException('Badge');
     }
     $this->SetData('AwardCount', $AwardCount);
     $this->SetData('RecentAwards', $RecentAwards);
     $this->SetData('UserBadgeAward', $UserBadgeAward);
     $this->SetData('Badge', $Badge);
     $this->Title(T('Yaga.Badge.View') . $Badge->Name);
     $this->Render();
 }
开发者ID:hxii,项目名称:Application-Yaga,代码行数:24,代码来源:class.badgescontroller.php

示例11: FileNotFound

 /**
  * A standard 404 File Not Found error message is delivered when this action
  * is encountered.
  *
  * @since 2.0.0
  * @access public
  */
 public function FileNotFound()
 {
     $this->RemoveCssFile('admin.css');
     $this->AddCssFile('style.css');
     $this->MasterView = 'default';
     $this->CssClass = 'SplashMessage NoPanel';
     if ($this->Data('ViewPaths')) {
         Trace($this->Data('ViewPaths'), 'View Paths');
     }
     $this->SetData('_NoMessages', TRUE);
     Gdn_Theme::Section('Error');
     if ($this->DeliveryMethod() == DELIVERY_METHOD_XHTML) {
         safeHeader("HTTP/1.0 404", TRUE, 404);
         $this->Render();
     } else {
         $this->RenderException(NotFoundException());
     }
 }
开发者ID:edward-tsai,项目名称:vanilla4china,代码行数:25,代码来源:class.homecontroller.php

示例12: Enable

 public function Enable($Plugin)
 {
     $this->Permission('Garden.Settings.Manage');
     $Connections = $this->GetConnections();
     if (!array_key_exists($Plugin, $Connections)) {
         throw NotFoundException('SocialConnect Plugin');
     }
     Gdn::PluginManager()->EnablePlugin($Plugin, NULL);
     $Connections = $this->GetConnections();
     $Connection = GetValue($Plugin, $Connections);
     require_once $this->FetchViewLocation('connection_functions');
     ob_start();
     WriteConnection($Connection);
     $Row = ob_get_clean();
     $this->JsonTarget("#Provider_{$Connection['Index']}", $Row);
     $this->InformMessage(T("Plugin enabled."));
     unset($this->Data['Connections']);
     $this->Render('blank', 'utility');
 }
开发者ID:robhazkes,项目名称:Garden,代码行数:19,代码来源:class.socialcontroller.php

示例13: fileNotFound

 /**
  * A standard 404 File Not Found error message is delivered when this action
  * is encountered.
  *
  * @since 2.0.0
  * @access public
  */
 public function fileNotFound()
 {
     $this->removeCssFile('admin.css');
     $this->addCssFile('style.css');
     $this->addCssFile('vanillicon.css', 'static');
     $this->MasterView = 'default';
     $this->CssClass = 'SplashMessage NoPanel';
     if ($this->data('ViewPaths')) {
         trace($this->data('ViewPaths'), 'View Paths');
     }
     $this->setData('_NoMessages', true);
     Gdn_Theme::section('Error');
     if ($this->deliveryMethod() == DELIVERY_METHOD_XHTML) {
         safeHeader("HTTP/1.0 404", true, 404);
         $this->render();
     } else {
         $this->RenderException(NotFoundException());
     }
 }
开发者ID:bryanjamesmiller,项目名称:p4,代码行数:26,代码来源:class.homecontroller.php

示例14: discussionController_author_create

 /**
  * Handle discussion option menu Change Author action.
  */
 public function discussionController_author_create($Sender)
 {
     $DiscussionID = $Sender->Request->get('discussionid');
     $Discussion = $Sender->DiscussionModel->getID($DiscussionID);
     if (!$Discussion) {
         throw NotFoundException('Discussion');
     }
     // Check edit permission
     $Sender->permission('Vanilla.Discussions.Edit', true, 'Category', $Discussion->PermissionCategoryID);
     if ($Sender->Form->authenticatedPostBack()) {
         // Change the author
         $Name = $Sender->Form->getFormValue('Author', '');
         $UserModel = new UserModel();
         if (trim($Name) != '') {
             $User = $UserModel->getByUsername(trim($Name));
             if (is_object($User)) {
                 if ($Discussion->InsertUserID == $User->UserID) {
                     $Sender->Form->addError('That user is already the discussion author.');
                 } else {
                     // Change discussion InsertUserID
                     $Sender->DiscussionModel->setField($DiscussionID, 'InsertUserID', $User->UserID);
                     // Update users' discussion counts
                     $Sender->DiscussionModel->updateUserDiscussionCount($Discussion->InsertUserID);
                     $Sender->DiscussionModel->updateUserDiscussionCount($User->UserID, true);
                     // Increment
                     // Go to the updated discussion
                     redirect(discussionUrl($Discussion));
                 }
             } else {
                 $Sender->Form->addError('No user with that name was found.');
             }
         }
     } else {
         // Form to change the author
         $Sender->setData('Title', $Discussion->Name);
     }
     $Sender->render('changeauthor', '', 'plugins/AuthorSelector');
 }
开发者ID:vanilla,项目名称:addons,代码行数:41,代码来源:class.authorselector.plugin.php

示例15: UserController_Warning_Create

 public function UserController_Warning_Create($Sender, $Args)
 {
     $Sender->Permission('Garden.Moderation.Manage');
     $UserID = (int) GetValue('0', $Args);
     $User = Gdn::UserModel()->GetID($UserID);
     if (!$User) {
         throw NotFoundException($User);
     }
     if ($Sender->Form->AuthenticatedPostBack()) {
         $Type = $Sender->Form->GetValue('Warning');
         $Reason = $Sender->Form->GetValue('Reason');
         if (empty($Type) || !in_array($Type, $this->WarnLevel)) {
             $Sender->Form->AddError('ValidateRequired', 'Warn Level');
         }
         if (empty($Reason)) {
             $Sender->Form->AddError('ValidateRequired', 'Reason');
         }
         if ($Sender->Form->ErrorCount() == 0) {
             Gdn::UserModel()->SetMeta($UserID, array('Warnings.' . time() => Gdn_Format::Serialize(array('Type' => $Type, 'Reason' => $Reason))));
             Gdn::UserModel()->SaveAttribute($UserID, 'WarnLevel', $Type);
             // get those notification sent
             $this->SaveActivity($User, $Type, $Reason);
             // Redirect after a successful save.
             if ($Sender->Request->Get('Target')) {
                 $Sender->RedirectUrl = $Sender->Request->Get('Target');
             } else {
                 $Sender->RedirectUrl = Url(UserUrl($User));
             }
         }
     }
     $Sender->SetData('User', $User);
     $Sender->SetData('WarnLevel', array_combine($this->WarnLevel, array_map(array($this, 'WarnLevelFormat'), $this->WarnLevel)));
     $Sender->AddSideMenu();
     $Sender->Title(T('Warning.Warn', 'Warn'));
     $Sender->View = $this->ThemeView('warning');
     $Sender->Render();
 }
开发者ID:Nordic-T,项目名称:Nordic-T,代码行数:37,代码来源:default.php


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