本文整理汇总了PHP中Abort函数的典型用法代码示例。如果您正苦于以下问题:PHP Abort函数的具体用法?PHP Abort怎么用?PHP Abort使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Abort函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ThumbShoeHandleDelete
function ThumbShoeHandleDelete($pagename, $auth = 'delete')
{
global $WikiLibDirs, $WikiDir, $LastModFile;
$page = RetrieveAuthPage($pagename, $auth, true, READPAGE_CURRENT);
if (!$page) {
Abort("?cannot delete {$pagename}");
return;
}
$deleted = false;
foreach ((array) $WikiLibDirs as $dir) {
if ($dir->exists($pagename) and $dir->iswrite) {
$dir->delete($pagename);
$deleted = true;
break;
}
}
if (!$deleted) {
// look in the default WikiDir
if ($WikiDir->exists($pagename)) {
$WikiDir->delete($pagename);
$deleted = true;
}
}
if ($deleted && $LastModFile) {
touch($LastModFile);
fixperms($LastModFile);
}
Redirect($pagename);
exit;
}
示例2: HandleRecipeCheck
function HandleRecipeCheck($pagename, $auth = 'admin')
{
global $RecipeListUrl, $Version, $RecipeInfo, $RecipeCheckFmt, $PageStartFmt, $PageEndFmt;
$page = RetrieveAuthPage($pagename, $auth, true, READPAGE_CURRENT);
if (!$page) {
Abort('?admin access required');
}
$cvinfo = GetRecipeList($RecipeListUrl);
if (!$cvinfo) {
$msg = "Unable to retrieve cookbook data from {$RecipeListUrl}\n";
$allow_url_fopen = ini_get('allow_url_fopen');
if (!$allow_url_fopen) {
$msg .= "\n <br /><br />It appears that your PHP environment isn't allowing\n the recipelist to be downloaded from pmwiki.org \n (allow_url_fopen = {$allow_url_fopen}).";
}
Abort($msg);
}
$rinfo['PmWiki:Upgrades'] = $Version;
ScanRecipeInfo('cookbook', $cvinfo);
foreach ((array) $RecipeInfo as $r => $v) {
if (!@$v['Version']) {
continue;
}
$r = preg_replace('/^(?!PmWiki:)(Cookbook[.:])?/', 'Cookbook:', $r);
$rinfo[$r] = $v['Version'];
}
$markup = "!!Recipe status for {\$PageUrl}\n" . RecipeTable($rinfo, $cvinfo);
$html = MarkupToHTML($pagename, $markup);
SDV($RecipeCheckFmt, array(&$PageStartFmt, $html, &$PageEndFmt));
PrintFmt($pagename, $RecipeCheckFmt);
}
示例3: HandleThumbShoePostRename
function HandleThumbShoePostRename($pagename, $auth = 'edit')
{
global $WikiLibDirs;
global $ThumbShoePageSep;
global $HandleAuth, $UploadFileFmt, $LastModFile, $TimeFmt;
$newname = $_REQUEST['newname'];
if ($newname == '') {
Abort("?no new image name");
}
$newname = str_replace('.', '_', $newname);
$newpage = $_REQUEST['newpage'];
if ($newpage == '') {
Abort("?no new image page");
}
$newimgpage = $newpage . $ThumbShoePageSep . $newname;
$tsdir = '';
foreach ((array) $WikiLibDirs as $dir) {
if ($dir->exists($pagename) and $dir->iswrite) {
$tsdir = $dir;
break;
}
}
if (!$tsdir) {
Abort("Cannot rename {$pagename} to {$newimgpage}; cannot find page");
return;
}
## check authorization
if (!RetrieveAuthPage($newimgpage, $auth, TRUE, READPAGE_CURRENT)) {
Abort("?cannot rename image page from {$pagename} to {$newimgpage}");
}
$newnewpage = @$tsdir->rename($pagename, $newimgpage);
if ($newnewpage) {
Redirect($newnewpage);
}
}
示例4: getIndex
/**
* This method show the user's dashboard
* @return \Illuminate\View\View
*/
public function getIndex()
{
//We get the user information and remove the password and token from the response
$user_profile = User::findBy(['_id' => Auth::user()->_id], ['password' => false, 'token' => false, 'token' => false]);
if (!$user_profile) {
Abort(404);
}
return view('user.dashboard', ['user_profile' => $user_profile]);
}
示例5: getIndex
/**
* This method show the user's profile
* @return \Illuminate\View\View
*/
public function getIndex($username)
{
//We get the user information and remove the password and token from the response
$user_profile = User::findBy(['username' => $username], ['password' => false, 'token' => false, 'token' => false]);
if (!$user_profile) {
Abort(404);
}
//var_dump($user_profile);
return view('user.profile', ['user_profile' => $user_profile]);
}
示例6: HandleGuestDelete
function HandleGuestDelete($pagename, $auth)
{
global $WikiDir, $LastModFile;
$page = RetrieveAuthPage($pagename, $auth, true, READPAGE_CURRENT);
if (!$page) {
Abort("?cannot delete {$pagename}");
return;
}
$WikiDir->delete($pagename);
if ($LastModFile) {
touch($LastModFile);
fixperms($LastModFile);
}
Redirect(substr($pagename, 0, strlen($pagename) - 22));
}
示例7: ThumbShoeMakeThumb
function ThumbShoeMakeThumb($pagename, $picpath, $w = 128, $h = 128)
{
global $ThumbShoeThumbBg, $ThumbShoeThumbPrefix;
global $UploadDir;
$uploaddir = PageVar($pagename, '$TSAttachDir');
$name = PageVar($pagename, '$Name');
$thumbpath = "{$uploaddir}/{$ThumbShoeThumbPrefix}{$name}.png";
if (!file_exists($picpath)) {
return;
}
// if the thumbnail has already been created
// and it is newer than the original image, return.
if (file_exists($thumbpath) && filemtime($thumbpath) > filemtime($picpath)) {
return;
}
if (!file_exists($uploaddir)) {
mkdirp($uploaddir);
}
$bg = $ThumbShoeThumbBg;
$tmp1 = "{$uploaddir}/{$name}_tmp.png";
$area = $w * $h;
# Need to use the following conversion because of
# ImageMagick version earlier than 6.3
$cmdfmt = 'convert -thumbnail \'%dx%d>\' -bordercolor %s -background %s -border 50 -gravity center -crop %dx%d+0+0 +repage %s %s';
$cl = sprintf($cmdfmt, $w, $h, $bg, $bg, $w, $h, $picpath, $tmp1);
$r = exec($cl, $o, $status);
if (intval($status) != 0) {
Abort("convert returned <pre>{$r}\n" . print_r($o, true) . "'</pre> with a status '{$status}'.<br/> Command line was '{$cl}'.");
}
if (!file_exists($tmp1)) {
Abort("Failed to create '{$tmp1}';<br/> Command line was '{$cl}'.");
}
// fluff
$cmdfmt = 'convert -mattecolor %s -frame 6x6+3+0 %s %s';
$cl = sprintf($cmdfmt, $bg, $tmp1, $thumbpath);
$r = exec($cl, $o, $status);
if (intval($status) != 0) {
Abort("convert returned <pre>{$r}\n" . print_r($o, true) . "'</pre> with a status '{$status}'.<br/> Command line was '{$cl}'.");
}
unlink($tmp1);
}
示例8: captchaListener
static function captchaListener()
{
if (isset($_GET['qgcaptcha'])) {
$ticket = $_GET['qgcaptcha'];
$text = randString(5, "abcdefghijkmnpqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ23456789");
$_SESSION['qg_rTicket'][$ticket]['captcha'] = $text;
header('Content-type: image/png');
$img = ImageCreateFromPNG(sysPATH . 'core/util/rTicket/captchabg.png');
//Backgroundimage
$color = ImageColorAllocate($img, 0, 0, 0);
//Farbe
$ttf = sysPATH . 'core/util/rTicket/xfiles.ttf';
//Schriftart
$ttfsize = 13;
//Schriftgrösse
$angle = rand(0, 7);
$t_x = rand(5, 20);
$t_y = 23;
imagettftext($img, $ttfsize, $angle, $t_x, $t_y, $color, $ttf, $text);
imagepng($img);
imagedestroy($img);
Abort();
}
}
示例9: __construct
public function __construct()
{
$this->objLoggedInUser = \Auth::User();
if (!$this->objLoggedInUser || !$this->objLoggedInUser->HasPermission('Admin/View')) {
Abort('404');
}
View::share('objLoggedInUser', $this->objLoggedInUser);
View::share('ActiveClass', static::ACTIVE_CLASS);
$FormResponse = Session::get('FormResponse') ? Session::get('FormResponse') : [];
View::share('FormResponse', $FormResponse);
$NewOrderCount = \App\Invoice::perminvoices($this->objLoggedInUser)->new()->count();
$AssignedOrderCount = \App\Invoice::perminvoices($this->objLoggedInUser)->assigned($this->objLoggedInUser)->count();
$FinalizedOrderCount = \App\Invoice::perminvoices($this->objLoggedInUser)->finalized()->count();
$TotalOrderCount = \App\Invoice::perminvoices($this->objLoggedInUser)->count();
$ContactUsCount = \App\Invoice::perminvoices($this->objLoggedInUser)->contact()->new()->count();
$ReviewedCount = \App\Invoice::perminvoices($this->objLoggedInUser)->reviewed()->count();
View::share('ReviewedCount', $ReviewedCount);
View::share('ContactUsCount', $ContactUsCount);
View::share('NewOrderCount', $NewOrderCount);
View::share('AssignedOrderCount', $AssignedOrderCount);
View::share('FinalizedOrderCount', $FinalizedOrderCount);
View::share('TotalOrderCount', $TotalOrderCount);
// No parent constructor. All is well.
}
示例10: HandleApprove
function HandleApprove($pagename, $auth = 'edit')
{
global $ApproveUrlPattern, $WhiteUrlPatterns, $ApprovedUrlPagesFmt, $action;
Lock(2);
$page = ReadPage($pagename);
$text = preg_replace('/[()]/', '', $page['text']);
preg_match_all("/{$ApproveUrlPattern}/", $text, $match);
ReadApprovedUrls($pagename);
$addpat = array();
foreach ($match[0] as $a) {
if ($action == 'approvesites') {
$a = preg_replace("!^([^:]+://[^/]+).*\$!", '$1', $a);
}
$addpat[] = $a;
}
if (count($addpat) > 0) {
$aname = FmtPageName($ApprovedUrlPagesFmt[0], $pagename);
$apage = RetrieveAuthPage($aname, $auth);
if (!$apage) {
Abort("?cannot edit {$aname}");
}
$new = $apage;
if (substr($new['text'], -1, 1) != "\n") {
$new['text'] .= "\n";
}
foreach ($addpat as $a) {
foreach ((array) $WhiteUrlPatterns as $pat) {
if (preg_match("!^{$pat}(/|\$)!i", $a)) {
continue 2;
}
}
$urlp = preg_quote($a, '!');
$WhiteUrlPatterns[] = $urlp;
$new['text'] .= " {$a}\n";
}
$_POST['post'] = 'y';
PostPage($aname, $apage, $new);
}
Redirect($pagename);
}
示例11: HandlePostUpload
function HandlePostUpload($pagename, $auth = 'upload') {
global $UploadVerifyFunction, $UploadFileFmt, $LastModFile,
$EnableUploadVersions, $Now, $RecentUploadsFmt, $FmtV,
$NotifyItemUploadFmt, $NotifyItemFmt, $IsUploadPosted,
$UploadRedirectFunction;
UploadAuth($pagename, $auth);
$uploadfile = $_FILES['uploadfile'];
$upname = $_REQUEST['upname'];
if ($upname=='') $upname=$uploadfile['name'];
$upname = MakeUploadName($pagename,$upname);
if (!function_exists($UploadVerifyFunction))
Abort('?no UploadVerifyFunction available');
$filepath = FmtPageName("$UploadFileFmt/$upname",$pagename);
$result = $UploadVerifyFunction($pagename,$uploadfile,$filepath);
if ($result=='') {
$filedir = preg_replace('#/[^/]*$#','',$filepath);
mkdirp($filedir);
if (IsEnabled($EnableUploadVersions, 0))
@rename($filepath, "$filepath,$Now");
if (!move_uploaded_file($uploadfile['tmp_name'],$filepath))
{ Abort("?cannot move uploaded file to $filepath"); return; }
fixperms($filepath,0444);
if ($LastModFile) { touch($LastModFile); fixperms($LastModFile); }
$result = "upresult=success";
$FmtV['$upname'] = $upname;
$FmtV['$upsize'] = $uploadfile['size'];
if (IsEnabled($RecentUploadsFmt, 0)) {
PostRecentChanges($pagename, '', '', $RecentUploadsFmt);
}
if (IsEnabled($NotifyItemUploadFmt, 0) && function_exists('NotifyUpdate')) {
$NotifyItemFmt = $NotifyItemUploadFmt;
$IsUploadPosted = 1;
register_shutdown_function('NotifyUpdate', $pagename, getcwd());
}
}
SDV($UploadRedirectFunction, 'Redirect');
$UploadRedirectFunction($pagename,"{\$PageUrl}?action=upload&uprname=$upname&$result");
}
示例12: Abort
<?php
if (!defined('PmWiki')) {
exit;
}
/* Copyright 2007 Patrick R. Michaud (pmichaud@pobox.com)
This file is pmform.php; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
*/
$RecipeInfo['PmForm']['Version'] = '2007-06-12';
if ($VersionNum < 2001946) {
Abort("pmform requires pmwiki-2.2.0-beta46 or later (currently {$Version})");
}
if (@$_REQUEST['pmform']) {
$MessagesFmt[] = "<div class='wikimessage'>\$[Post successful]</div>";
}
SDV($PmFormRedirectFunction, 'Redirect');
SDV($FmtPV['$CurrentTime'], "\$GLOBALS['CurrentTime']");
SDV($PmFormTemplatesFmt, array('{$SiteGroup}.LocalTemplates', '{$SiteGroup}.PmFormTemplates'));
SDV($PmFormPostPatterns, array('/\\(:/' => '( :', '/:\\)/' => ': )', '/\\$:/' => '$ :'));
SDVA($InputTags['pmform'], array(':fn' => 'InputActionForm', ':args' => array('target'), ':html' => "<form action='{\$PageUrl}' \$InputFormArgs><input type='hidden' name='n' value='{\$FullName}' /><input type='hidden' name='action' value='pmform' />", 'method' => 'post'));
Markup('pmform', '<input', '/\\(:pmform *([-\\w]+)( .*?)?:\\)/e', "PmFormMarkup(\$pagename, '\$1', PSS('\$2'))");
Markup('ptv:', 'block', '/^(\\w[-\\w]+)\\s*:.*$/', "<:block,0><div class='property-\$1'>\$0</div>");
SDV($HandleActions['pmform'], 'HandlePmForm');
SDV($HandleAuth['pmform'], 'read');
function PmFormConfig($pagename, $target)
{
global $PmForm, $PmFormPageFmt;
示例13: HandlePostUpload
function HandlePostUpload($pagename)
{
global $UploadVerifyFunction, $UploadFileFmt, $LastModFile;
$page = RetrieveAuthPage($pagename, 'upload');
if (!$page) {
Abort("?cannot upload to {$pagename}");
}
$uploadfile = $_FILES['uploadfile'];
$upname = $_REQUEST['upname'];
if ($upname == '') {
$upname = $uploadfile['name'];
}
$upname = MakeUploadName($pagename, $upname);
if (!function_exists($UploadVerifyFunction)) {
Abort('?no UploadVerifyFunction available');
}
$filepath = FmtPageName("{$UploadFileFmt}/{$upname}", $pagename);
$result = $UploadVerifyFunction($pagename, $uploadfile, $filepath);
if ($result == '') {
$filedir = preg_replace('#/[^/]*$#', '', $filepath);
mkdirp($filedir);
if (!move_uploaded_file($uploadfile['tmp_name'], $filepath)) {
Abort("?cannot move uploaded file to {$filepath}");
return;
}
fixperms($filepath);
if ($LastModFile) {
touch($LastModFile);
fixperms($LastModFile);
}
$result = "upresult=success";
}
Redirect($pagename, "\$PageUrl?action=upload&upname={$upname}&{$result}");
}
示例14: AuthUserLDAP
function AuthUserLDAP($pagename, $id, $pw, $pwlist) {
global $AuthLDAPBindDN, $AuthLDAPBindPassword;
if (!$pw) return false;
if (!function_exists('ldap_connect'))
Abort('authuser: LDAP authentication requires PHP ldap functions','ldapfn');
foreach ((array)$pwlist as $ldap) {
if (!preg_match('!(ldaps?://[^/]+)/(.*)$!', $ldap, $match))
continue;
## connect to the LDAP server
list($z, $url, $path) = $match;
$ds = ldap_connect($url);
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
## For Active Directory, don't specify a path and we simply
## attempt to bind with the username and password directly
if (!$path && @ldap_bind($ds, $id, $pw)) { ldap_close($ds); return true; }
## Otherwise, we use Apache-style urls for LDAP authentication
## Split the path into its search components
list($basedn, $attr, $sub, $filter) = explode('?', $path);
if (!$attr) $attr = 'uid';
if (!$sub) $sub = 'one';
if (!$filter) $filter = '(objectClass=*)';
$binddn = @$AuthLDAPBindDN;
$bindpw = @$AuthLDAPBindPassword;
if (ldap_bind($ds, $binddn, $bindpw)) {
## Search for the appropriate uid
$fn = ($sub == 'sub') ? 'ldap_search' : 'ldap_list';
$sr = $fn($ds, $basedn, "(&$filter($attr=$id))", array($attr));
$x = ldap_get_entries($ds, $sr);
## If we find a unique id, bind to it for success
if ($x['count'] == 1) {
$dn = $x[0]['dn'];
if (@ldap_bind($ds, $dn, $pw)) { ldap_close($ds); return true; }
}
}
ldap_close($ds);
}
return false;
}
示例15: HandlePostDrawing_draw
/**
* Handle the .draw file format
*/
function HandlePostDrawing_draw($pagename)
{
global $UploadVerifyFunction, $UploadFileFmt, $LastModFile, $Now;
global $RecentChangesFmt, $IsPagePosted, $EnableDrawingRecentChanges;
$page = RetrieveAuthPage($pagename, 'upload');
if (!$page) {
Abort("?cannot upload to {$pagename}");
}
$uploadImage = $_FILES['uploadImage'];
$uploadDrawing = $_FILES['uploadDrawing'];
$uploadMap = $_FILES['uploadMap'];
$drawingBaseTime = $_POST['drawingbasetime'];
// The time the user began editing this drawing.
$imageupname = $uploadImage['name'];
$drawingupname = $uploadDrawing['name'];
$mapupname = $uploadMap['name'];
$imageupname = MakeUploadName($pagename, $imageupname);
$drawingupname = MakeUploadName($pagename, $drawingupname);
$mapupname = MakeUploadName($pagename, $mapupname);
$imageFilePath = FmtPageName("{$UploadFileFmt}/{$imageupname}", $pagename);
$drawingFilePath = FmtPageName("{$UploadFileFmt}/{$drawingupname}", $pagename);
$mapFilePath = FmtPageName("{$UploadFileFmt}/{$mapupname}", $pagename);
if (file_exists($drawingFilePath)) {
// Only worth checking timestamps if a drawing actually currently exists!
if (filemtime($drawingFilePath) > $drawingBaseTime) {
// Assign a new timestamp to the client... hopefully this time they'll be ok...
header("PmWikiDraw-DrawingChanged: {$Now}");
exit;
}
}
// If we've got to here then we can assume its safe to overwrite the current file
// Note: we should do the history archival/recent changes stuff here.
if ($EnableDrawingRecentChanges == true && isset($_POST['drawingname'])) {
$imageModified = $_POST['drawingname'];
$RecentChangesFmt = array('Main.AllRecentChanges' => '* [[$Group/$Name]] Drawing - ' . $imageModified . ' modified . . . $CurrentTime', '$Group.RecentChanges' => '* [[$Group/$Name]] Drawing - ' . $imageModified . ' modified . . . $CurrentTime');
$IsPagePosted = true;
$x = "";
$y = "";
PostRecentChanges($pagename, $x, $y);
$IsPagePosted = false;
}
$filedir = preg_replace('#/[^/]*$#', '', $imageFilePath);
mkdirp($filedir);
if (!move_uploaded_file($uploadImage['tmp_name'], $imageFilePath)) {
Abort("?cannot move uploaded image to {$imageFilePath}");
return;
}
fixperms($imageFilePath, 0444);
if ($LastModFile) {
touch($LastModFile);
fixperms($LastModFile);
}
$filedir = preg_replace('#/[^/]*$#', '', $drawingFilePath);
mkdirp($filedir);
if (!move_uploaded_file($uploadDrawing['tmp_name'], $drawingFilePath)) {
Abort("?cannot move uploaded drawing to {$drawingFilePath}");
return;
}
fixperms($drawingFilePath, 0444);
if ($LastModFile) {
touch($LastModFile);
fixperms($LastModFile);
}
$filedir = preg_replace('#/[^/]*$#', '', $mapFilePath);
mkdirp($filedir);
if (!move_uploaded_file($uploadMap['tmp_name'], $mapFilePath)) {
Abort("?cannot move uploaded map to {$mapFilePath}");
return;
}
fixperms($mapFilePath, 0444);
if ($LastModFile) {
touch($LastModFile);
fixperms($LastModFile);
}
// Sets the drawingBaseTime header for incremental save support.
header("PmWikiDraw-DrawingBaseTime: " . filemtime($drawingFilePath));
exit;
}