本文整理汇总了PHP中Core_quit函数的典型用法代码示例。如果您正苦于以下问题:PHP Core_quit函数的具体用法?PHP Core_quit怎么用?PHP Core_quit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Core_quit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SiteCredits_isActive
function SiteCredits_isActive()
{
global $DBVARS;
if (!isset($DBVARS['sitecredits-credits'])) {
$DBVARS['sitecredits-credits'] = 0;
Core_configRewrite();
}
if ($DBVARS['sitecredits-credits'] < -1) {
echo '<p>' . __('Website Administrator attention needed.' . ' Please log into your administration area (and check your email).') . '</p>';
Core_quit();
}
}
示例2: Forms_fileDelete
/**
* delete an uploaded file
*
* @return null
*/
function Forms_fileDelete()
{
$id = @$_REQUEST['id'];
if ($id == '' || strpos('..', $id) !== false) {
Core_quit();
}
$dir = USERBASE . '/f/.files/forms/' . session_id() . '/';
if (!is_dir($dir)) {
Core_quit();
}
$dir .= $id;
@unlink($dir);
}
示例3: Comments_update
/**
* Update the comments table
*
* @return null
*/
function Comments_update()
{
$id = $_REQUEST['id'];
$comment = $_REQUEST['comment'];
$allowed = in_array($id, $_SESSION['comment_ids']);
if (!$allowed) {
die('You do not have permission to do this');
}
if (!is_numeric($id)) {
Core_quit('Invalid id');
}
dbQuery('update comments set comment = "' . addslashes($comment) . '" where id = ' . (int) $id);
Core_cacheClear('comments');
return array('status' => 1, 'id' => $id, 'comment' => $comment);
}
示例4: News_getHeadlinesMonth
function News_getHeadlinesMonth()
{
$y = (int) $_REQUEST['y'];
$m = (int) $_REQUEST['m'];
$p = (int) $_REQUEST['pid'];
if ($y < 1000 || $y > 9999 || $m < 1 || $m > 12) {
Core_quit();
}
$m = sprintf('%02d', $m);
$sql = 'select id from pages where parent=' . $p . ' and associated_date>"' . $y . '-' . $m . '-00" and associated_date<date_add("' . $y . '-' . $m . '-01", interval 1 month) order by associated_date';
$ps = dbAll($sql);
$headlines = array();
foreach ($ps as $p) {
$page = Page::getInstance($p['id']);
$headlines[] = array('url' => $page->getRelativeURL(), 'adate' => $page->associated_date, 'headline' => htmlspecialchars($page->alias));
}
return $headlines;
}
示例5: redirect
}
// }
// { load page data
if ($id) {
$PAGEDATA = Page::getInstance($id)->initValues();
} else {
if ($page != '') {
redirect('/', 'no page id for ' . $page);
}
Core_quit(__('no page loaded. If this is a new site, then please' . ' <a href="/ww.admin/">log into the admin area</a> and create your' . ' first page.', 'core'));
}
$c = Core_trigger('page-object-loaded');
// }
// { if URL includes a plugin override, run that instead of displaying the page
if (isset($_REQUEST['_p']) && isset($PLUGINS[$_REQUEST['_p']]['page-override'])) {
Core_quit($PLUGINS[$_REQUEST['_p']]['page-override']($PAGEDATA));
}
// }
// { main content
// { check if page is protected
$access_allowed = 1;
foreach ($PLUGINS as $p) {
if ($access_allowed && isset($p['frontend']['page_display_test'])) {
$access_allowed = $p['frontend']['page_display_test']($PAGEDATA);
}
}
// }
if (!$access_allowed) {
$c .= '<h2>' . __('Permission Denied', 'core') . '</h2>' . '<p>' . __('This is a protected document.', 'core') . '</p><p>' . isset($_SESSION['userdata']) ? __('You are not in a user-group which has access to this page. If you' . ' think you should be, please contact the site administrator.', 'core') : '<p><strong>' . __('If you have a user account, please <a href="/_r?type=loginpage">' . 'click here</a> to log in.', 'core');
$c .= '</p><p>' . __('If you do not have a user account, but have been supplied with a' . ' password for the page, please enter it here and submit the form:', 'core') . '</p>' . '<form method="post"><input type="password" name="privacy_password" />' . '<input type="submit" /></form>';
} elseif (@$_REQUEST['cmsspecial'] == 'sitemap') {
示例6: Sms_adminSendBulk
/**
* send a load of SMSes
*
* @return array result
*/
function Sms_adminSendBulk()
{
$aid = (int) $_REQUEST['to'];
$msg = $_REQUEST['msg'];
if (!$msg || preg_replace('/a-zA-Z0-9 !_\\-.,:\'"/', '', $msg) != $msg) {
Core_quit();
}
$tos = array();
$to_names = array();
$subs = dbOne('select subscribers from sms_addressbooks where id=' . $aid . ' limit 1', 'subscribers');
$subs = dbAll('select name,phone from sms_subscribers where id in (' . preg_replace('/[^0-9,]/', '', $subs) . ')');
foreach ($subs as $sub) {
$tos[] = $sub['phone'];
$to_names[] = preg_replace('/[^a-zA-Z0-9 \\-.\']/', '', $sub['name']);
}
$ret = SMS_callApi('send-bulk', '&to=' . join(',', $tos) . '&message=' . urlencode($msg) . '&names=' . join(',', $to_names));
return $ret;
}
示例7: ImageGallery_frameGet
/**
* get a frame for images
*
* @return null
*/
function ImageGallery_frameGet()
{
if (isset($_REQUEST['ratio'])) {
$ratio = (double) $_REQUEST['ratio'];
} else {
$ratio = 1;
}
$padding = explode(' ', $_REQUEST['pa']);
$border = explode(' ', $_REQUEST['bo']);
$width = $_REQUEST['w'] + ($padding[1] + $padding[3]) / $ratio;
$height = $_REQUEST['h'] + ($padding[0] + $padding[2]) / $ratio;
$file = USERBASE . '/f/' . $_REQUEST['_remainder'];
if (strpos($file, '/.') !== false) {
Core_quit();
}
if (!file_exists($file)) {
header('Location: /i/blank.gif');
Core_quit();
}
$md5 = md5($_SERVER['REQUEST_URI']);
$frame = USERBASE . '/ww.cache/image-gallery-frames/frame-' . $md5 . '.png';
if (!file_exists($frame)) {
@mkdir(USERBASE . '/ww.cache/image-gallery-frames');
$imgO = imagecreatefrompng($file);
if ($img0 === false) {
// not a PNG
header('Location: /i/blank.gif');
Core_quit();
}
$imgOsize = getimagesize($file);
$imgN = imagecreatetruecolor($width, $height);
$black = imagecolorallocate($imgN, 0, 0, 0);
imagecolortransparent($imgN, $black);
// top left
imagecopyresampled($imgN, $imgO, 0, 0, 0, 0, ceil($border[3] / $ratio), ceil($border[0] / $ratio), $border[3], $border[0]);
// top right
imagecopyresampled($imgN, $imgO, $width - floor($border[1] / $ratio) - 1, 0, $imgOsize[0] - $border[1] - 1, 0, ceil($border[1] / $ratio), ceil($border[0] / $ratio), $border[1], $border[0]);
// bottom left
imagecopyresampled($imgN, $imgO, 0, $height - floor($border[2] / $ratio) - 1, 0, $imgOsize[1] - $border[2] - 1, ceil($border[3] / $ratio), ceil($border[2] / $ratio), $border[3], $border[2]);
// bottom right
imagecopyresampled($imgN, $imgO, $width - floor($border[1] / $ratio) - 1, $height - floor($border[2] / $ratio) - 1, $imgOsize[0] - $border[1] - 1, $imgOsize[1] - $border[2] - 1, ceil($border[1] / $ratio), ceil($border[2] / $ratio), $border[1], $border[2]);
// left
imagecopyresampled($imgN, $imgO, 0, floor($border[0] / $ratio), 0, $border[0], ceil($border[3] / $ratio), $height - floor(($border[2] + $border[0]) / $ratio), $border[3], $imgOsize[1] - $border[2] - $border[0]);
// right
imagecopyresampled($imgN, $imgO, $width - floor($border[1] / $ratio) - 1, floor($border[0] / $ratio), $imgOsize[0] - $border[1] - 1, $border[0], ceil($border[1] / $ratio), $height - floor(($border[2] + $border[0]) / $ratio), $border[3], $imgOsize[1] - $border[2] - $border[0]);
// top
imagecopyresampled($imgN, $imgO, floor($border[3] / $ratio), 0, $border[3], 0, $width - floor(($border[3] + $border[1]) / $ratio), ceil($border[0] / $ratio), $imgOsize[0] - $border[3] - $border[1], $border[0]);
// bottom
imagecopyresampled($imgN, $imgO, floor($border[3] / $ratio), $height - floor($border[2] / $ratio) - 1, $border[3], $imgOsize[1] - $border[2] - 1, $width - floor(($border[3] + $border[1]) / $ratio), ceil($border[2] / $ratio), $imgOsize[0] - $border[3] - $border[1], $border[2]);
}
header('Content-type: image/png');
imagepng($imgN, $frame);
header('Cache-Control: max-age=2592000, public');
header('Expires-Active: On');
header('Expires: Fri, 1 Jan 2500 01:01:01 GMT');
header('Pragma:');
header('Content-Length: ' . filesize($frame));
readfile($frame);
}
示例8: Products_adminTypesGetSampleImport
/**
* download a CSV version of a product type in importable format
*
* @return null
*/
function Products_adminTypesGetSampleImport()
{
$ptypeid = (int) $_REQUEST['ptypeid'];
if ($ptypeid) {
$ptypes = dbAll('select * from products_types where id=' . $ptypeid);
} else {
$ptypes = dbAll('select * from products_types');
}
$are_any_for_sale = 0;
// { get list of data field names
$names = array();
foreach ($ptypes as $p) {
if ($p['is_for_sale']) {
$are_any_for_sale = 1;
}
$dfs = json_decode($p['data_fields']);
foreach ($dfs as $df) {
if (!in_array($df->n, $names)) {
$names[] = $df->n;
}
}
}
// }
header('Content-type: text/csv; Charset=utf-8');
header('Content-Disposition: attachment; filename="product-types-' . $ptypeid . '.csv"');
// { header
$row = array('_stocknumber', '_name', '_ean');
if ($are_any_for_sale) {
$row[] = '_price';
$row[] = '_sale_price';
$row[] = '_bulk_price';
$row[] = '_bulk_amount';
$row[] = '_stockcontrol_total';
}
foreach ($names as $n) {
$row[] = $n;
}
$row[] = '_type';
$row[] = '_categories';
echo Products_arrayToCSV($row);
// }
// { sample rows
foreach ($ptypes as $p) {
$row = array('stock_number', 'name', 'barcode');
if ($are_any_for_sale) {
$row[] = '0.00';
$row[] = '0.00';
$row[] = '0.00';
$row[] = '0';
$row[] = '0';
}
foreach ($names as $n) {
$row[] = '';
}
$row[] = $p['name'];
$row[] = '';
echo Products_arrayToCSV($row);
}
// }
Core_quit();
}
示例9: Core_adminLanguagesExportPo
/**
* export po file
*
* @return status
*/
function Core_adminLanguagesExportPo()
{
$lang = $_REQUEST['lang'];
$strings = array();
$rs = dbAll('select distinct str from languages');
foreach ($rs as $r) {
$strings[$r['str']] = 1;
}
$rs = dbAll('select str,trstr from languages where lang="' . addslashes($lang) . '"' . ' order by str');
header('Content-Type: force/download');
header('Content-Disposition: attachment; filename="' . $lang . '.po"');
echo "msgid \"\"\nmsgstr \"\"\n\"MIME-Version: 1.0\\n\"\n" . "\"Content-Type: text/plain; charset=utf-8\\n\"\n" . "\"Content-Transfer-Encoding: 8bit\\n\"\n" . "\n";
foreach ($rs as $r) {
echo 'msgid "' . $r['str'] . "\"\n";
echo 'msgstr "' . $r['trstr'] . "\"\n\n";
unset($strings[$r['str']]);
}
foreach ($strings as $r => $v) {
echo 'msgid "' . $r . "\"\n";
echo "msgstr \"\"\n\n";
}
Core_quit();
}
示例10: redirect
/**
* redirect the browser to a different URL using a 301 redirect
*
* @param string $addr the address to redirect to
*
* @return null
*/
function redirect($addr, $reason = '')
{
header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . $addr);
if ($reason) {
header('X-Redirect-Reason: ' . $reason);
}
echo '<html><head><script defer="defer" type="text/javascript">' . 'setTimeout(function(){document.location="' . $addr . '";},10);</script>' . '</head><body></body></html>';
Core_quit();
}
示例11: Core_quit
// }
Core_quit('{"ok":1,"message":"' . addslashes($email) . '"}');
}
break;
// }
// }
case 'set-option':
// {
if (SiteCredits_apiVerify($params, $_REQUEST['sha1'])) {
dbQuery('delete from sitecredits_options where name="' . addslashes($_REQUEST['payment-recipient']) . '"');
dbQuery('insert into sitecredits_options set name="' . addslashes($_REQUEST['name']) . '", value="' . addslashes($_REQUEST['value']) . '"');
Core_quit('{"credits":' . (double) @$GLOBALS['DBVARS']['sitecredits-credits'] . '}');
// }
}
case 'set-hosting-fee':
// {
$params = array('action' => 'set-hosting-fee', 'cdate' => $_REQUEST['cdate'], 'credits' => (double) $_REQUEST['credits'], 'time' => $_REQUEST['time']);
if (SiteCredits_apiVerify($params, $_REQUEST['sha1'])) {
dbQuery('delete from sitecredits_recurring where description="hosting"');
dbQuery('insert into sitecredits_recurring set description="hosting"' . ',amt=' . (double) $_REQUEST['credits'] . ',start_date="' . addslashes($_REQUEST['cdate']) . '",period="1 month"' . ',next_payment_date="' . addslashes($_REQUEST['cdate']) . '"');
Core_quit('{"ok":1}');
}
break;
// }
// }
default:
// {
Core_quit('{"error":"unknown action ' . addslashes($_REQUEST['action']) . '"}');
// }
}
echo '{"error":"checksum failed"}';
示例12: Products_showQrCode
/**
* show an image of a QR code leading to a product
*
* @return null
*/
function Products_showQrCode()
{
$pid = (int) $_REQUEST['pid'];
$product = Product::getInstance($pid);
if (!$product) {
redirect('/i/blank.gif');
}
$fname = USERBASE . '/ww.cache/products/qr' . $pid;
if (!file_exists($fname)) {
require_once SCRIPTBASE . '/ww.incs/phpqrcode.php';
@mkdir(USERBASE . '/ww.cache/products');
QRcode::png('http://' . $_SERVER['HTTP_HOST'] . $product->getRelativeUrl(), $fname);
}
header('Content-type: image/png');
header('Cache-Control: max-age=2592000, public');
header('Expires-Active: On');
header('Expires: Fri, 1 Jan 2500 01:01:01 GMT');
header('Pragma:');
header('Content-Length: ' . filesize($fname));
readfile($fname);
Core_quit();
}
示例13: die
<?php
/**
* activate SMS account with textr
*
* PHP version 5.2
*
* @category None
* @package None
* @author Kae Verens <kae@kvsites.ie>
* @license GPL 2.0
* @link http://kvsites.ie/
*/
require $_SERVER['DOCUMENT_ROOT'] . '/ww.incs/basics.php';
if (!Core_isAdmin()) {
die('access denied');
}
$url = 'http://textr.mobi/api.php?a=activate' . '&email=' . urlencode($DBVARS['sms_email']) . '&activation=' . urlencode($_REQUEST['key']);
$res = file_get_contents($url);
if ($res === false) {
Core_quit('{"status":0,"error":"failed to contact textr.mobi. please wait a short' . ' while and try again."}');
}
echo $res;
示例14: Ads_go
/**
* follow an ad
*
* @return null
*/
function Ads_go()
{
$id = (int) $_REQUEST['id'];
$r = dbRow('select * from ads where id=' . $id);
if (!$r) {
return false;
}
dbQuery('insert into ads_track set ad_id=' . $id . ', click=1, cdate=now()');
if (strpos($r['target_url'], 'www.') === 0) {
$r['target_url'] = 'http://' . $r['target_url'];
}
header('Location: ' . $r['target_url']);
Core_quit();
}
示例15: Core_updateUserPasswordUsingToken
/**
* update a password, using a verification code
*
* @return null
*/
function Core_updateUserPasswordUsingToken()
{
$email = $_REQUEST['email'];
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
Core_quit('{"error":"please enter a properly formatted email address"}');
}
$token = addslashes($_REQUEST['token']);
if ($token == '') {
Core_quit('{"error":"no token entered"}');
}
$password = $_REQUEST['password'];
if ($password == '') {
Core_quit('{"error":"no new password entered"}');
}
$u = dbRow("select * from user_accounts where email='{$email}' " . "and verification_hash='{$token}'");
if ($u && count($u)) {
$password = md5($password);
dbQuery("update user_accounts set password='{$password}'," . "verification_hash='' where email='{$email}'");
Core_quit('{"ok":1}');
}
Core_quit('{"error":"user not found, or verification token is out of date"}');
}