本文整理汇总了PHP中quit函数的典型用法代码示例。如果您正苦于以下问题:PHP quit函数的具体用法?PHP quit怎么用?PHP quit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了quit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: syscore_autoload
/**
* Affichage de page
* Cette fonction autoload (qui attrappe plusieurs pages) permet d'afficher
* des pages d'erreur type des erreurs les plus souvent rencontré dans le
* fonctionnement de FrameTool.
* @global type $tpl
* @param type $page
*/
function syscore_autoload($page)
{
global $tpl;
switch ($page) {
case 'forbidden':
$tpl->assign('msg', 'Vous n\'avez pas le niveau d\'accès nécessaire pour cette action.');
break;
case 'nomod':
$tpl->assign('msg', 'Module introuvable.');
break;
case 'moderror':
$tpl->assign('msg', 'Le module n\'a pas terminé correctement.');
break;
case 'nopage':
$tpl->assign('msg', 'Le module n\'a pas executer cette page.');
break;
case 'invcall':
$tpl->assign('msg', 'Un paramètre est incorrect et empêche l\'exécution.');
break;
case 'custom':
$tpl->assign('msg', $_GET['error']);
break;
default:
$tpl->assign('msg', 'Erreur inconnu : ' . $page);
break;
}
$tpl->display('syscore_error.tpl');
quit();
}
示例2: admin_index
/**
* Controleur page d'index admin
* Permet l'affichage de la page d'administration des droits d'accès.
*/
function admin_index()
{
global $pdo, $tpl;
$sql = $pdo->prepare('SELECT * FROM acces WHERE acl_action != "index" AND acl_action != "admin" ORDER BY acl_action ASC, acl_page ASC');
$sql->execute();
$conf = array();
while ($line = $sql->fetch()) {
if (!isset($conf[$line['acl_action']])) {
$conf[$line['acl_action']] = array();
}
$conf[$line['acl_action']][] = $line;
}
$groups = new Modele('sections');
$groups->find();
while ($groups->next()) {
$tpl->append('grps', $groups->toArray());
}
$aclGrps = new Modele('access_groups');
$aclGrps->find();
$aclGrpsRslt = array();
while ($aclGrps->next()) {
if (!isset($aclGrpsRslt[$aclGrps->raw_ag_access])) {
$aclGrpsRslt[$aclGrps->raw_ag_access] = array();
}
$aclGrpsRslt[$aclGrps->raw_ag_access][] = $aclGrps->raw_ag_group;
}
$tpl->assign('aclGrps', $aclGrpsRslt);
$tpl->assign('acls', $conf);
$tpl->display('admin_index.tpl');
quit();
}
示例3: getAccessToken
function getAccessToken(&$fb, $bucket, $tokenFile)
{
// Read file from Google Storage
$client = getClient();
$storage = getStorageService($client);
$tokensStr = getTokens($client, $storage, $bucket, $tokenFile);
if (empty($tokensStr)) {
quit("No more FB access tokens in storage -- login to app ASAP to generate a token");
} else {
$tokens = json_decode($tokensStr, true);
// 'true' will turn this into associative array instead of object
// Validate the token before use. User may have logged off facebook, or deauthorized this app.
// shuffle the array to get random order of iteration
shuffle($tokens);
//var_dump($tokens);
foreach ($tokens as $token) {
$response = $fb->get('/me', $token);
if (!$response->isError()) {
// access_token is valid token
return $token;
}
}
quit("None of the tokens are valid");
}
}
示例4: check
function check($name, $value, $method)
{
//easy to add
$var = trim($value);
$var = addslashes($var);
$tmpvar = strtolower($var);
if (strpos($tmpvar, "'") == false && strpos($tmpvar, "*") == false && strpos($tmpvar, "--") == false) {
$var = stripslashes($var);
} else {
quit("SQL Statements in input detected!", $method);
$var = NULL;
}
if (strpos($tmpvar, "<script>") == false && strpos($tmpvar, "\"") == false && strpos($tmpvar, "prompt(") == false && strpos($tmpvar, "alert(") == false) {
$var = stripslashes($var);
} else {
quit("XSS statements in input detected!", $method);
$var = NULL;
}
if (strpos($tmpvar, "/./") == false && strpos($tmpvar, "etc/passwd") == false && strpos($tmpvar, "/..") == false && strpos($tmpvar, "/../") == false) {
$var = stripslashes($var);
} else {
quit("Path Traversal injection found!", $method);
$var = NULL;
}
}
示例5: bulletin_viewbulletin
function bulletin_viewbulletin()
{
global $pdo, $root;
$mdl = new Modele("bulletin_user");
$mdl->fetch($_GET['id']);
require $root . 'libs' . DS . 'bulletins' . DS . $mdl->bu_period->period_generator . DS . 'bulletin.php';
bulletin_view_user($_GET['id']);
quit();
}
示例6: twofactors_getQR
function twofactors_getQR()
{
global $srcdir;
require_once $srcdir . '/libs/phpqrcode/phpqrcode.php';
$text = sprintf("otpauth://totp/%s@%s?secret=%s&issuer=LATEB", $_SESSION['user']['user_name'], $_SERVER['HTTP_HOST'], $_SESSION['user']['GoogleAuthenticator']);
$qrcode = new QRcode();
$qrcode->png($text, false, QR_ECLEVEL_M, 5);
quit();
}
示例7: verifyQuestion
function verifyQuestion($creds)
{
include $creds;
if (!isset($_POST['question'])) {
quit('Question not set');
}
if (strlen($_POST['question']) < 10 || strlen($_POST['question']) > 255) {
quit('Question length error');
} else {
if (substr($_POST['question'], -1) != '?') {
quit("Question missing '?'");
}
}
}
示例8: ecole_add
/**
* Ajout d'une école
* Controleur utilisé pour ajouter une nouvelle école.
*/
function ecole_add()
{
global $pdo, $tpl;
$tpl->assign('error', false);
$tpl->assign('succes', false);
if (isset($_POST['ut_name'])) {
if (autoInsert('user_types', 'ut_')) {
$tpl->assign('succes', true);
} else {
$tpl->assign('error', true);
}
}
$tpl->display('ecole_add.tpl');
quit();
}
示例9: beer_add
/**
* Ajoute une bière
* Des fois c'est bien de pouvoir rajouter un utilisateur depuis le panneau d'admin pour l'ajout des nouveaux adhérents.
*/
function beer_add()
{
global $pdo, $tpl;
$tpl->assign('error', false);
$tpl->assign('succes', false);
if (isset($_POST['beer_name'])) {
if (autoInsert('beers', 'beer_')) {
$tpl->assign('succes', true);
} else {
$tpl->assign('error', true);
}
}
$sql = $pdo->prepare('SELECT * FROM beer_types');
$sql->execute();
while ($type = $sql->fetch()) {
$tpl->append('types', $type);
}
$tpl->display('user_add.tpl');
quit();
}
示例10: mandate_index
function mandate_index()
{
global $tpl, $pdo;
$table = mdle_need_desc('mandate');
foreach ($table['fields'] as $key => $f) {
if (!isset($f['label'])) {
$f['label'] = $key;
}
$f['name'] = $key;
$tpl->append('fields', $f);
}
$tpl->assign('mandate', $table);
$sql = $pdo->query("SELECT * FROM `mandate`");
$tpl->assign('insts', $sql->fetchAll());
if ($tpl->getTemplateVars('result') == null) {
$tpl->assign('result', '');
}
$tpl->display('mandate_index.tpl');
quit();
}
示例11: sendRequest
public function sendRequest()
{
$details = new Details();
$details->setShipping(0)->setTax(0)->setSubtotal($this->totalAmount);
$amount = new Amount();
$amount->setCurrency($this->currencyCode)->setTotal($this->totalAmount)->setDetails($details);
$transaction = new Transaction();
$transaction->setAmount($amount)->setItemList($this->itemList)->setDescription("Payment description")->setInvoiceNumber(uniqid());
$baseUrl = 'http://localhost/';
$redirectUrls = new RedirectUrls();
$redirectUrls->setReturnUrl("{$baseUrl}/ExecutePayment.php?success=true")->setCancelUrl("{$baseUrl}/ExecutePayment.php?success=false");
$payment = new Payment();
$payment->setIntent("sale")->setPayer($this->payer)->setRedirectUrls($redirectUrls)->setTransactions(array($transaction));
try {
$payment->create($this->apiContext);
} catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
var_dump($ex);
exit(1);
}
$approvalUrl = $payment->getApprovalLink();
header('Location: ' . $approvalUrl);
quit();
}
示例12: cards_download
function cards_download()
{
global $tmpdir;
$bdl = new Modele('cardbundle');
$bdl->fetch($_GET['bundle']);
$bdl->cbundle_status = 'WAIT';
$crd = new Modele('card');
$crd->find(array('card_bundle' => $bdl->cbundle_id));
$zipfile = tempnam($tmpdir, 'zip');
$zip = new ZipArchive();
$zip->open($zipfile, ZipArchive::CREATE);
$zip->setArchiveComment("Automade zip archive from EPITANIME intra software. Bundle " . $bdl->cbundle_date);
while ($crd->next()) {
$zip->addFile($crd->card_picture, "card{$crd->card_id}.png");
$crd->card_status = 'PRINT';
}
$zip->close();
header('Content-Type: application/zip');
header('Content-Disposition: attachment; filename="bundle_' . $bdl->cbundle_date . '.zip"');
readfile($zipfile);
unlink($zipfile);
quit();
}
示例13: api_userinfo
function api_userinfo()
{
$usr = _api_getUser();
if ($usr === null) {
return;
}
$infos = array('sub' => $usr->user_id, 'name' => $usr->user_name, 'given_name' => $usr->user_firstname, 'family_name' => $usr->user_lastname, 'nickname' => $usr->user_name, 'email' => $usr->user_email, 'email_verified' => false, 'gender' => $usr->user_sexe == 'GIRL' ? 'female' : 'male', 'birthdate' => $usr->user_born, 'phone_number' => $usr->user_phone, 'phone_number_verified' => false, 'acl' => $usr->raw_user_role, 'groups' => array());
$sections = new Modele('user_sections');
$sections->find(array('us_user' => $usr->getKey()));
while ($sections->next()) {
$infos['groups'][] = array('gid' => $sections->us_section->section_id, 'name' => $sections->us_section->section_name, 'role' => $sections->raw_us_type);
}
echo json_encode($infos);
quit();
}
示例14: index_securimage_show
function index_securimage_show()
{
global $srcdir;
require_once $srcdir . '/libs/securimage/securimage_show.php';
quit();
}
示例15: route
function route($method = '@', $path = '', $callback = null)
{
static $routes = array();
if ($method == '@') {
$request = request();
if (empty($routes[$request['method']])) {
trigger(404);
quit(404);
}
foreach ($routes[$request['method']] as $pattern => $route) {
if (preg_match('#^/' . $pattern . '/?$#', $request['uri'], $captures)) {
array_shift($captures);
trigger('route.before', $route, $captures);
response('start');
$results = call_user_func_array($route['callback'], $captures);
response('stop');
if (is_array($results) || is_object($results)) {
response('delete');
response('header', 'Content-Type', 'application/json');
response('append', json_encode($results, JSON_NUMERIC_CHECK));
} else {
echo $results;
}
trigger('route.after', $route);
return;
}
}
trigger(404) or quit(404);
} else {
if ($path) {
$method = strtolower(trim($method));
$path = preg_replace_callback('#(:\\w+)#', function ($m) {
return '([^/]+)';
}, str_replace('.', '\\.', trim($path, '/')));
$routes[$method][$path] = array('callback' => $callback ?: function () {
});
}
}
}