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


PHP bailOut函数代码示例

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


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

示例1: select

 /**
  * Selects a database using the current class's $this->dbh
  * @param string $db name
  */
 function select($db)
 {
     global $__FM_CONFIG;
     if (!@mysql_select_db($db, $this->dbh)) {
         bailOut(_('The database is not installed. Click \'Start Setup\' to start the installation process.') . '<p class="step"><a href="' . $GLOBALS['RELPATH'] . 'fm-install.php" class="button click_once">' . _('Start Setup') . '</a></p>');
     }
 }
开发者ID:Vringe,项目名称:facileManager,代码行数:11,代码来源:fm-db.php

示例2: bailOut

<?php

/**
 * Copyright (c) 2012 Thomas Tanghus <thomas@tanghus.net>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
function bailOut($msg)
{
    OC_JSON::error(array('data' => array('message' => $msg)));
    OC_Log::write('core', 'ajax/vcategories/edit.php: ' . $msg, OC_Log::DEBUG);
    exit;
}
function debug($msg)
{
    OC_Log::write('core', 'ajax/vcategories/edit.php: ' . $msg, OC_Log::DEBUG);
}
require_once '../../../lib/base.php';
OC_JSON::checkLoggedIn();
$app = isset($_GET['app']) ? $_GET['app'] : null;
if (is_null($app)) {
    bailOut('Application name not provided.');
}
OC_JSON::checkAppEnabled($app);
$tmpl = new OC_TEMPLATE("core", "edit_categories_dialog");
$vcategories = new OC_VCategories($app);
$categories = $vcategories->categories();
debug(print_r($categories, true));
$tmpl->assign('categories', $categories);
$tmpl->printpage();
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:31,代码来源:edit.php

示例3: define

/** Set installation variable */
define('UPGRADE', true);
/** Enforce authentication */
require_once ABSPATH . 'fm-modules/facileManager/classes/class_logins.php';
require_once 'fm-init.php';
ini_set('display_errors', false);
error_reporting(0);
if (!$fm_login->isLoggedIn() || !currentUserCan('do_everything') && getOption('fm_db_version') >= 32) {
    header('Location: ' . dirname($_SERVER['PHP_SELF']));
}
/** Ensure we meet the requirements */
require_once ABSPATH . 'fm-includes/init.php';
require_once ABSPATH . 'fm-includes/version.php';
$app_compat = checkAppVersions(false);
if ($app_compat) {
    bailOut($app_compat);
}
$step = isset($_GET['step']) ? $_GET['step'] : 0;
if (array_key_exists('backup', $_GET)) {
    if (!class_exists('fm_tools')) {
        include ABSPATH . 'fm-modules' . DIRECTORY_SEPARATOR . 'facileManager' . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'class_tools.php';
    }
    $fm_tools->backupDatabase();
    header('Location: ' . $GLOBALS['basename']);
}
$branding_logo = $GLOBALS['RELPATH'] . 'fm-modules/' . $fm_name . '/images/fm.png';
printHeader(_('Upgrade'), 'install');
switch ($step) {
    case 0:
    case 1:
        if (!file_exists(ABSPATH . 'config.inc.php') || !file_get_contents(ABSPATH . 'config.inc.php')) {
开发者ID:Vringe,项目名称:facileManager,代码行数:31,代码来源:fm-upgrade.php

示例4: isset

$fn = isset($_SERVER['HTTP_X_FILE_NAME']) ? $_SERVER['HTTP_X_FILE_NAME'] : false;
if ($fn) {
    if ($view->file_put_contents('/' . $tmpfile, file_get_contents('php://input'))) {
        OCP\JSON::success(array('data' => array('path' => '', 'file' => $tmpfile)));
        exit;
    } else {
        bailOut(OC_Contacts_App::$l10n->t('Error uploading contacts to storage.'));
    }
}
// File input transfers are handled here
if (!isset($_FILES['importfile'])) {
    OCP\Util::writeLog('contacts', 'ajax/uploadphoto.php: No file was uploaded. Unknown error.', OCP\Util::DEBUG);
    OCP\JSON::error(array('data' => array('message' => 'No file was uploaded. Unknown error')));
    exit;
}
$error = $_FILES['importfile']['error'];
if ($error !== UPLOAD_ERR_OK) {
    $errors = array(0 => OC_Contacts_App::$l10n->t("There is no error, the file uploaded with success"), 1 => OC_Contacts_App::$l10n->t("The uploaded file exceeds the upload_max_filesize directive in php.ini") . ini_get('upload_max_filesize'), 2 => OC_Contacts_App::$l10n->t("The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form"), 3 => OC_Contacts_App::$l10n->t("The uploaded file was only partially uploaded"), 4 => OC_Contacts_App::$l10n->t("No file was uploaded"), 6 => OC_Contacts_App::$l10n->t("Missing a temporary folder"));
    bailOut($errors[$error]);
}
$file = $_FILES['importfile'];
$tmpfname = tempnam(get_temp_dir(), "occOrig");
if (file_exists($file['tmp_name'])) {
    if ($view->file_put_contents('/' . $tmpfile, file_get_contents($file['tmp_name']))) {
        OCP\JSON::success(array('data' => array('path' => '', 'file' => $tmpfile)));
    } else {
        bailOut(OC_Contacts_App::$l10n->t('Error uploading contacts to storage.'));
    }
} else {
    bailOut('Temporary file: \'' . $file['tmp_name'] . '\' has gone AWOL?');
}
开发者ID:noci2012,项目名称:owncloud,代码行数:31,代码来源:uploadimport.php

示例5: debug

            debug('Setting string:' . $name . ' ' . $value);
            $vcard->children[$line]->setValue($value);
            break;
        case 'EMAIL':
        case 'TEL':
        case 'ADR':
            // should I delete the property if empty or throw an error?
            debug('Setting element: (EMAIL/TEL/ADR)' . $element);
            $vcard->children[$line]->setValue($value);
            $vcard->children[$line]->parameters = array();
            if (!is_null($parameters)) {
                debug('Setting parameters: ' . $parameters);
                foreach ($parameters as $key => $parameter) {
                    debug('Adding parameter: ' . $key);
                    foreach ($parameter as $val) {
                        debug('Adding parameter: ' . $key . '=>' . $val);
                        $vcard->children[$line]->add(new Sabre_VObject_Parameter($key, strtoupper(strip_tags($val))));
                    }
                }
            }
            break;
    }
    // Do checksum and be happy
    $checksum = md5($vcard->children[$line]->serialize());
}
//debug('New checksum: '.$checksum);
if (!OC_Contacts_VCard::edit($id, $vcard)) {
    bailOut(OC_Contacts_App::$l10n->t('Error updating contact property.'));
    exit;
}
OCP\JSON::success(array('data' => array('line' => $line, 'checksum' => $checksum, 'oldchecksum' => $_POST['checksum'])));
开发者ID:noci2012,项目名称:owncloud,代码行数:31,代码来源:saveproperty.php

示例6: bailOut

}
if (!isset($_GET['path'])) {
    bailOut(OC_Contacts_App::$l10n->t('No photo path was submitted.'));
}
$localpath = OC_Filesystem::getLocalFile($_GET['path']);
$tmpfname = tempnam(get_temp_dir(), "occOrig");
if (!file_exists($localpath)) {
    bailOut(OC_Contacts_App::$l10n->t('File doesn\'t exist:') . $localpath);
}
file_put_contents($tmpfname, file_get_contents($localpath));
$image = new OC_Image();
if (!$image) {
    bailOut(OC_Contacts_App::$l10n->t('Error loading image.'));
}
if (!$image->loadFromFile($tmpfname)) {
    bailOut(OC_Contacts_App::$l10n->t('Error loading image.'));
}
if ($image->width() > 400 || $image->height() > 400) {
    $image->resize(400);
    // Prettier resizing than with browser and saves bandwidth.
}
if (!$image->fixOrientation()) {
    // No fatal error so we don't bail out.
    debug('Couldn\'t save correct image orientation: ' . $tmpfname);
}
if ($image->save($tmpfname)) {
    OCP\JSON::success(array('data' => array('id' => $_GET['id'], 'tmp' => $tmpfname)));
    exit;
} else {
    bailOut('Couldn\'t save temporary image: ' . $tmpfname);
}
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:31,代码来源:oc_photo.php

示例7: isset

require_once __DIR__ . '/../loghandler.php';
$categories = isset($_POST['categories']) ? $_POST['categories'] : null;
$fromobjects = isset($_POST['fromobjects']) && ($_POST['fromobjects'] === 'true' || $_POST['fromobjects'] === '1') ? true : false;
if (is_null($categories)) {
    bailOut(OCA\Contacts\App::$l10n->t('No categories selected for deletion.'));
}
debug(print_r($categories, true));
if ($fromobjects) {
    $addressbooks = OCA\Contacts\Addressbook::all(OCP\USER::getUser());
    if (count($addressbooks) == 0) {
        bailOut(OCA\Contacts\App::$l10n->t('No address books found.'));
    }
    $addressbookids = array();
    foreach ($addressbooks as $addressbook) {
        $addressbookids[] = $addressbook['id'];
    }
    $contacts = OCA\Contacts\VCard::all($addressbookids);
    if (count($contacts) == 0) {
        bailOut(OCA\Contacts\App::$l10n->t('No contacts found.'));
    }
    $cards = array();
    foreach ($contacts as $contact) {
        $cards[] = array($contact['id'], $contact['carddata']);
    }
}
$catman = new OC_VCategories('contact');
$catman->delete($categories, $cards);
if ($fromobjects) {
    OCA\Contacts\VCard::updateDataByID($cards);
}
OCP\JSON::success();
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:31,代码来源:delete.php

示例8: bailOut

// Firefox and Konqueror tries to download application/json for me.  --Arthur
OCP\JSON::setContentTypeHeader('text/plain');
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
require_once 'loghandler.php';
if (!isset($_GET['id'])) {
    bailOut(OCA\Contacts\App::$l10n->t('No contact ID was submitted.'));
}
$contact = OCA\Contacts\App::getContactVCard($_GET['id']);
// invalid vcard
if (is_null($contact)) {
    bailOut(OCA\Contacts\App::$l10n->t('Error reading contact photo.'));
} else {
    $image = new OC_Image();
    if (!isset($contact->PHOTO) || !$image->loadFromBase64((string) $contact->PHOTO)) {
        if (isset($contact->LOGO)) {
            $image->loadFromBase64((string) $contact->LOGO);
        }
    }
    if ($image->valid()) {
        $tmpkey = 'contact-photo-' . $contact->UID;
        if (OC_Cache::set($tmpkey, $image->data(), 600)) {
            OCP\JSON::success(array('data' => array('id' => $_GET['id'], 'tmp' => $tmpkey)));
            exit;
        } else {
            bailOut(OCA\Contacts\App::$l10n->t('Error saving temporary file.'));
        }
    } else {
        bailOut(OCA\Contacts\App::$l10n->t('The loading photo is not valid.'));
    }
}
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:31,代码来源:currentphoto.php

示例9: bailOut

<?php

/**
 * Copyright (c) 2012 Thomas Tanghus <thomas@tanghus.net>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
function bailOut($msg)
{
    OC_JSON::error(array('data' => array('message' => $msg)));
    OC_Log::write('core', 'ajax/vcategories/addToFavorites.php: ' . $msg, OC_Log::DEBUG);
    exit;
}
function debug($msg)
{
    OC_Log::write('core', 'ajax/vcategories/addToFavorites.php: ' . $msg, OC_Log::DEBUG);
}
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
$type = isset($_GET['type']) ? $_GET['type'] : null;
if (is_null($type)) {
    $l = OC_L10N::get('core');
    bailOut($l->t('Object type not provided.'));
}
$categories = new OC_VCategories($type);
$ids = $categories->getFavorites($type);
OC_JSON::success(array('ids' => $ids));
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:28,代码来源:favorites.php

示例10: isset

OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
OCP\JSON::callCheck();
require_once __DIR__ . '/../loghandler.php';
$aid = isset($_POST['aid']) ? $_POST['aid'] : null;
if (!$aid) {
    $addressbooks = OCA\Contacts\Addressbook::all(OCP\User::getUser(), true, false);
    if (count($addressbooks) === 0) {
        bailOut(OCA\Contacts\App::$l10n->t('You have no addressbooks.'));
    } else {
        $aid = $addressbooks[0]['id'];
    }
}
$isnew = isset($_POST['isnew']) ? $_POST['isnew'] : false;
$vcard = Sabre\VObject\Component::create('VCARD');
$uid = substr(md5(rand() . time()), 0, 10);
$vcard->add('UID', $uid);
$id = null;
try {
    $id = OCA\Contacts\VCard::add($aid, $vcard, null, $isnew);
} catch (Exception $e) {
    bailOut($e->getMessage());
}
if (!$id) {
    bailOut('There was an error adding the contact.');
}
$lastmodified = OCA\Contacts\App::lastModified($vcard);
if (!$lastmodified) {
    $lastmodified = new DateTime();
}
OCP\JSON::success(array('data' => array('id' => $id, 'aid' => $aid, 'details' => OCA\Contacts\VCard::structureContact($vcard), 'lastmodified' => $lastmodified->format('U'))));
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:31,代码来源:add.php

示例11: bailOut

function bailOut($msg)
{
    OCP\JSON::error(array('data' => array('message' => $msg)));
    OCP\Util::writeLog('contacts', 'ajax/contactdetails.php: ' . $msg, OCP\Util::DEBUG);
    exit;
}
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
$id = isset($_GET['id']) ? $_GET['id'] : null;
if (is_null($id)) {
    bailOut(OC_Contacts_App::$l10n->t('Missing ID'));
}
$vcard = OC_Contacts_App::getContactVCard($id);
if (is_null($vcard)) {
    bailOut(OC_Contacts_App::$l10n->t('Error parsing VCard for ID: "' . $id . '"'));
}
$details = OC_Contacts_VCard::structureContact($vcard);
// Some Google exported files have no FN field.
/*if(!isset($details['FN'])) {
	$fn = '';
	if(isset($details['N'])) {
		$details['FN'] = array(implode(' ', $details['N'][0]['value']));
	} elseif(isset($details['EMAIL'])) {
		$details['FN'] = array('value' => $details['EMAIL'][0]['value']);
	} else {
		$details['FN'] = array('value' => OC_Contacts_App::$l10n->t('Unknown'));
	}
}*/
// Make up for not supporting the 'N' field in earlier version.
if (!isset($details['N'])) {
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:31,代码来源:contactdetails.php

示例12: foreach

 */
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
foreach ($_POST as $key => $element) {
    debug('_POST: ' . $key . '=>' . print_r($element, true));
}
function bailOut($msg)
{
    OCP\JSON::error(array('data' => array('message' => $msg)));
    OCP\Util::writeLog('calendar', 'ajax/categories/rescan.php: ' . $msg, OCP\Util::DEBUG);
    exit;
}
function debug($msg)
{
    OCP\Util::writeLog('calendar', 'ajax/categories/rescan.php: ' . $msg, OCP\Util::DEBUG);
}
$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
if (count($calendars) == 0) {
    bailOut(OC_Calendar_App::$l10n->t('No calendars found.'));
}
$events = array();
foreach ($calendars as $calendar) {
    $calendar_events = OC_Calendar_Object::all($calendar['id']);
    $events = $events + $calendar_events;
}
if (count($events) == 0) {
    bailOut(OC_Calendar_App::$l10n->t('No events found.'));
}
OC_Calendar_App::scanCategories($events);
$categories = OC_Calendar_App::getCategoryOptions();
OCP\JSON::success(array('data' => array('categories' => $categories)));
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:31,代码来源:rescan.php

示例13: isset

<?php

/**
 * Copyright (c) 2011 Thomas Tanghus <thomas@tanghus.net>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
require_once 'loghandler.php';
$tmpl = new OCP\Template("contacts", "part.edit_name_dialog");
$id = isset($_GET['id']) ? $_GET['id'] : '';
if ($id) {
    $vcard = OCA\Contacts\App::getContactVCard($id);
    $name = array('', '', '', '', '');
    if ($vcard->__isset('N')) {
        $property = $vcard->__get('N');
        if ($property) {
            $name = OCA\Contacts\VCard::structureProperty($property);
        }
    }
    $name = array_map('htmlspecialchars', $name['value']);
    $tmpl->assign('name', $name, false);
    $tmpl->assign('id', $id, false);
} else {
    bailOut(OCA\Contacts\App::$l10n->t('Contact ID is missing.'));
}
$page = $tmpl->fetchPage();
OCP\JSON::success(array('data' => array('page' => $page)));
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:30,代码来源:editname.php

示例14: bailOut

 * Copyright (c) 2012 Thomas Tanghus <thomas@tanghus.net>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
function bailOut($msg)
{
    OC_JSON::error(array('data' => array('message' => $msg)));
    OC_Log::write('core', 'ajax/vcategories/addToFavorites.php: ' . $msg, OC_Log::DEBUG);
    exit;
}
function debug($msg)
{
    OC_Log::write('core', 'ajax/vcategories/addToFavorites.php: ' . $msg, OC_Log::DEBUG);
}
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
$l = OC_L10N::get('core');
$id = isset($_POST['id']) ? strip_tags($_POST['id']) : null;
$type = isset($_POST['type']) ? $_POST['type'] : null;
if (is_null($type)) {
    bailOut($l->t('Object type not provided.'));
}
if (is_null($id)) {
    bailOut($l->t('%s ID not provided.', $type));
}
$categories = new OC_VCategories($type);
if (!$categories->addToFavorites($id, $type)) {
    bailOut($l->t('Error adding %s to favorites.', $id));
}
OC_JSON::success();
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:31,代码来源:addToFavorites.php

示例15: bailOut

OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
// foreach ($_POST as $key=>$element) {
// 	OCP\Util::writeLog('contacts','ajax/savecrop.php: '.$key.'=>'.$element, OCP\Util::DEBUG);
// }
function bailOut($msg)
{
    OCP\JSON::error(array('data' => array('message' => $msg)));
    OCP\Util::writeLog('contacts', 'ajax/loadphoto.php: ' . $msg, OCP\Util::DEBUG);
    exit;
}
$image = null;
$id = isset($_GET['id']) ? $_GET['id'] : '';
$refresh = isset($_GET['refresh']) ? true : false;
if ($id == '') {
    bailOut(OC_Contacts_App::$l10n->t('Missing contact id.'));
}
$checksum = '';
$vcard = OC_Contacts_App::getContactVCard($id);
foreach ($vcard->children as $property) {
    if ($property->name == 'PHOTO') {
        $checksum = md5($property->serialize());
        break;
    }
}
$tmpl = new OCP\Template("contacts", "part.contactphoto");
$tmpl->assign('id', $id);
if ($refresh) {
    $tmpl->assign('refresh', 1);
}
$page = $tmpl->fetchPage();
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:31,代码来源:loadphoto.php


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