本文整理汇总了PHP中fatalError函数的典型用法代码示例。如果您正苦于以下问题:PHP fatalError函数的具体用法?PHP fatalError怎么用?PHP fatalError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fatalError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @copydoc Form::execute()
*/
function execute($args, $request)
{
// Retrieve the submission.
$submission = $this->getSubmission();
// Get this form decision actions labels.
$actionLabels = EditorDecisionActionsManager::getActionLabels($this->_getDecisions());
// Record the decision.
$reviewRound = $this->getReviewRound();
$decision = $this->getDecision();
$stageId = $this->getStageId();
import('lib.pkp.classes.submission.action.EditorAction');
$editorAction = new EditorAction();
$editorAction->recordDecision($request, $submission, $decision, $actionLabels, $reviewRound, $stageId);
// Identify email key and status of round.
switch ($decision) {
case SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS:
$emailKey = 'EDITOR_DECISION_REVISIONS';
$status = REVIEW_ROUND_STATUS_REVISIONS_REQUESTED;
break;
case SUBMISSION_EDITOR_DECISION_RESUBMIT:
$emailKey = 'EDITOR_DECISION_RESUBMIT';
$status = REVIEW_ROUND_STATUS_RESUBMITTED;
break;
case SUBMISSION_EDITOR_DECISION_DECLINE:
$emailKey = 'SUBMISSION_UNSUITABLE';
$status = REVIEW_ROUND_STATUS_DECLINED;
break;
default:
fatalError('Unsupported decision!');
}
$this->_updateReviewRoundStatus($submission, $status, $reviewRound);
// Send email to the author.
$this->_sendReviewMailToAuthor($submission, $emailKey, $request);
}
示例2: export
/**
* Export the locale files to the browser as a tarball.
* Requires tar for operation (configured in config.inc.php).
*/
function export($locale)
{
// Construct the tar command
$tarBinary = Config::getVar('cli', 'tar');
if (empty($tarBinary) || !file_exists($tarBinary)) {
// We can use fatalError() here as we already have a user
// friendly way of dealing with the missing tar on the
// index page.
fatalError('The tar binary must be configured in config.inc.php\'s cli section to use the export function of this plugin!');
}
$command = $tarBinary . ' cz';
$localeFilesList = TranslatorAction::getLocaleFiles($locale);
$localeFilesList = array_merge($localeFilesList, TranslatorAction::getMiscLocaleFiles($locale));
$emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO');
$localeFilesList[] = $emailTemplateDao->getMainEmailTemplateDataFilename($locale);
foreach (array_values(TranslatorAction::getEmailFileMap($locale)) as $emailFile) {
}
// Include locale files (main file and plugin files)
foreach ($localeFilesList as $file) {
if (file_exists($file)) {
$command .= ' ' . escapeshellarg($file);
}
}
header('Content-Type: application/x-gtar');
header("Content-Disposition: attachment; filename=\"{$locale}.tar.gz\"");
header('Cache-Control: private');
// Workarounds for IE weirdness
passthru($command);
}
示例3: getFieldValue
/**
* Get the value of a field by symbolic name.
* @var $record object
* @var $name string
* @var $type SORT_ORDER_TYPE_...
* @return mixed
*/
function getFieldValue(&$record, $name, $type)
{
$fieldValue = null;
$parsedContents = $record->getParsedContents();
if (isset($parsedContents[$name])) {
switch ($type) {
case SORT_ORDER_TYPE_STRING:
$fieldValue = join(';', $parsedContents[$name]);
break;
case SORT_ORDER_TYPE_NUMBER:
$fieldValue = (int) array_shift($parsedContents[$name]);
break;
case SORT_ORDER_TYPE_DATE:
$fieldValue = strtotime($thing = array_shift($parsedContents[$name]));
if ($fieldValue === -1 || $fieldValue === false) {
$fieldValue = null;
}
break;
default:
fatalError('UNKNOWN TYPE');
}
}
HookRegistry::call('EtdmsPlugin::getFieldValue', array(&$this, &$fieldValue));
return $fieldValue;
}
示例4: authorize
/**
* @copydoc PKPHandler::authorize()
*/
function authorize($request, &$args, $roleAssignments)
{
import('lib.pkp.classes.security.authorization.ContextAccessPolicy');
$this->addPolicy(new ContextAccessPolicy($request, $roleAssignments));
$operation = $request->getRequestedOp();
$workflowStageRequiredOps = array('assignStage', 'unassignStage');
if (in_array($operation, $workflowStageRequiredOps)) {
import('lib.pkp.classes.security.authorization.internal.WorkflowStageRequiredPolicy');
$this->addPolicy(new WorkflowStageRequiredPolicy($request->getUserVar('stageId')));
}
$userGroupRequiredOps = array_merge($workflowStageRequiredOps, array('editUserGroup', 'updateUserGroup', 'removeUserGroup'));
if (in_array($operation, $userGroupRequiredOps)) {
// Validate the user group object.
$userGroupId = $request->getUserVar('userGroupId');
$userGroupDao = DAORegistry::getDAO('UserGroupDAO');
/* @var $userGroupDao UserGroupDAO */
$userGroup = $userGroupDao->getById($userGroupId);
if (!$userGroup) {
fatalError('Invalid user group id!');
} else {
$this->_userGroup = $userGroup;
}
}
return parent::authorize($request, $args, $roleAssignments);
}
示例5: toXml
/**
* @see OAIMetadataFormat#toXml
*/
function toXml(&$oaiRecord, $format = null)
{
$record =& $oaiRecord->getData('record');
switch ($format) {
case 'oai_dc':
static $xslDoc, $proc;
if (!isset($xslDoc) || !isset($proc)) {
// Cache the XSL
$xslDoc = new DOMDocument();
$xslDoc->load('http://www.loc.gov/standards/marcxml/xslt/MARC21slim2OAIDC.xsl');
$proc = new XSLTProcessor();
$proc->importStylesheet($xslDoc);
}
$xmlDoc = new DOMDocument();
$xmlDoc->loadXML($record->getContents());
$xml = $proc->transformToXML($xmlDoc);
// Cheesy: strip the XML header
if (($pos = strpos($xml, '<oai_dc:dc')) > 0) {
$xml = substr($xml, $pos);
}
return $xml;
case 'oai_marc':
case 'marcxml':
return $record->getContents();
default:
fatalError("Unable to convert MARC to {$format}!\n");
}
}
示例6: updateUserMessageState
/**
* Update the information whether user messages should be
* displayed or not.
* @param $args array
* @param $request PKPRequest
* @return JSONMessage JSON object
*/
function updateUserMessageState($args, $request)
{
// Exit with a fatal error if request parameters are missing.
if (!isset($args['setting-name']) && isset($args['setting-value'])) {
fatalError('Required request parameter "setting-name" or "setting-value" missing!');
}
// Retrieve the user from the session.
$user = $request->getUser();
assert(is_a($user, 'User'));
// Validate the setting.
// FIXME: We don't have to retrieve the setting type (which is always bool
// for user messages) but only whether the setting name is valid and the
// value is boolean.
$settingName = $args['setting-name'];
$settingValue = $args['setting-value'];
$settingType = $this->_settingType($settingName);
switch ($settingType) {
case 'bool':
if (!($settingValue === 'false' || $settingValue === 'true')) {
// Exit with a fatal error when the setting value is invalid.
fatalError('Invalid setting value! Must be "true" or "false".');
}
$settingValue = $settingValue === 'true' ? true : false;
break;
default:
// Exit with a fatal error when an unknown setting is found.
fatalError('Unknown setting!');
}
// Persist the validated setting.
$userSettingsDao = DAORegistry::getDAO('UserSettingsDAO');
$userSettingsDao->updateSetting($user->getId(), $settingName, $settingValue, $settingType);
// Return a success message.
return new JSONMessage(true);
}
示例7: user
public function user()
{
if (!isset($this->user)) {
fatalError('User not set on bid');
}
return $this->user;
}
示例8: fatalError
/**
* Load configuration data from a file.
* The file is assumed to be formatted in php.ini style.
* @return array the configuration data
*/
function &reloadData()
{
if (($configData =& ConfigParser::readConfig(CONFIG_FILE)) === false) {
fatalError(sprintf('Cannot read configuration file %s', CONFIG_FILE));
}
return $configData;
}
示例9: error
/**
* Adds an error log to debug bar and log file
* @static
* @param Integer $errno error level (E_USER_xxx)
* @param String $errstr Error message
* @param String $errfile[optional] name of the file where error occurred - default: unknown
* @param Integer $errline[optional] line number where error thrown - default: unknown
* @return Boolean should always return true
*/
static function error($errno, $errstr, $errfile = "unknown", $errline = "unknown")
{
switch ($errno) {
case E_USER_ERROR:
$error = '';
$error .= '<p>A <b>Fatal Error</b> has occured.</p>';
$error .= '<dl>';
$error .= '<dt>' . $errstr . '</dt>';
$error .= '<dd>' . $errfile . ' (' . $errline . ')</dd>';
$error .= '</dl>';
fatalError($error);
break;
case E_USER_WARNING:
$type = 'warning';
self::$error[] = array('type' => 'warning', 'file' => $errfile, 'line' => $errline, 'str' => $errstr);
break;
case E_USER_NOTICE:
$type = 'notice';
self::$error[] = array('type' => 'notice', 'file' => $errfile, 'line' => $errline, 'str' => $errstr);
break;
default:
$type = $errno;
self::$error[] = array('type' => $type, 'file' => $errfile, 'line' => $errline, 'str' => $errstr);
break;
}
debug("------------- Error : " . $type . "--------------", 'error');
debug("File : " . $errfile, 'error');
debug("Line : " . $errline, 'error');
debug("Message : " . $errstr, 'error');
debug("----------------------------------------", 'error');
return true;
}
示例10: initialize
/**
* @copydoc SetupListbuilderHandler::initialize()
*/
function initialize($request)
{
parent::initialize($request);
AppLocale::requireComponents(LOCALE_COMPONENT_PKP_MANAGER);
$footerCategoryId = (int) $request->getUserVar('footerCategoryId');
$context = $request->getContext();
$footerCategoryDao = DAORegistry::getDAO('FooterCategoryDAO');
$footerCategory = $footerCategoryDao->getById($footerCategoryId, $context->getId());
if ($footerCategoryId && !isset($footerCategory)) {
fatalError('Footer Category does not exist within this context.');
} else {
$this->_footerCategoryId = $footerCategoryId;
}
// Basic configuration
$this->setTitle('grid.content.navigation.footer.FooterLink');
$this->setSourceType(LISTBUILDER_SOURCE_TYPE_TEXT);
$this->setSaveType(LISTBUILDER_SAVE_TYPE_EXTERNAL);
$this->setSaveFieldName('footerLinks');
import('lib.pkp.controllers.listbuilder.content.navigation.FooterLinkListbuilderGridCellProvider');
// Title column
$titleColumn = new MultilingualListbuilderGridColumn($this, 'title', 'common.title', null, null, null, null, array('tabIndex' => 1));
$titleColumn->setCellProvider(new FooterLinkListbuilderGridCellProvider());
$this->addColumn($titleColumn);
// Url column
$urlColumn = new MultilingualListbuilderGridColumn($this, 'url', 'common.url', null, null, null, null, array('tabIndex' => 2));
$urlColumn->setCellProvider(new FooterLinkListbuilderGridCellProvider());
$this->addColumn($urlColumn);
}
示例11: fetchReviewRoundInfo
/**
* Fetch information for the author on the specified review round
* @param $args array
* @param $request Request
* @return JSONMessage JSON object
*/
function fetchReviewRoundInfo($args, $request)
{
$this->setupTemplate($request);
$templateMgr = TemplateManager::getManager($request);
$stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE);
if ($stageId !== WORKFLOW_STAGE_ID_INTERNAL_REVIEW && $stageId !== WORKFLOW_STAGE_ID_EXTERNAL_REVIEW) {
fatalError('Invalid Stage Id');
}
$templateMgr->assign('stageId', $stageId);
$reviewRound = $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ROUND);
$templateMgr->assign('reviewRoundId', $reviewRound->getId());
$submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
$templateMgr->assign('submission', $submission);
// Review round request notification options.
$notificationRequestOptions = array(NOTIFICATION_LEVEL_NORMAL => array(NOTIFICATION_TYPE_REVIEW_ROUND_STATUS => array(ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId())), NOTIFICATION_LEVEL_TRIVIAL => array());
$templateMgr->assign('reviewRoundNotificationRequestOptions', $notificationRequestOptions);
// Editor has taken an action and sent an email; Display the email
import('classes.workflow.EditorDecisionActionsManager');
if (EditorDecisionActionsManager::getEditorTakenActionInReviewRound($reviewRound)) {
$submissionEmailLogDao = DAORegistry::getDAO('SubmissionEmailLogDAO');
$user = $request->getUser();
$submissionEmailFactory = $submissionEmailLogDao->getByEventType($submission->getId(), SUBMISSION_EMAIL_EDITOR_NOTIFY_AUTHOR, $user->getId());
$templateMgr->assign('submissionEmails', $submissionEmailFactory);
$templateMgr->assign('showReviewAttachments', true);
}
return $templateMgr->fetchJson('authorDashboard/reviewRoundInfo.tpl');
}
示例12: initialize
function initialize($request)
{
parent::initialize($request);
// Retrieve the authorized monograph.
$this->setMonograph($this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH));
$representativeId = (int) $request->getUserVar('representativeId');
// set if editing or deleting a representative entry
if ($representativeId != '') {
$representativeDao = DAORegistry::getDAO('RepresentativeDAO');
$representative = $representativeDao->getById($representativeId, $this->getMonograph()->getId());
if (!isset($representative)) {
fatalError('Representative referenced outside of authorized monograph context!');
}
}
// Load submission-specific translations
AppLocale::requireComponents(LOCALE_COMPONENT_APP_SUBMISSION, LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_PKP_USER, LOCALE_COMPONENT_APP_DEFAULT, LOCALE_COMPONENT_PKP_DEFAULT);
// Basic grid configuration
$this->setTitle('grid.catalogEntry.representatives');
// Grid actions
$router = $request->getRouter();
$actionArgs = $this->getRequestArgs();
$this->addAction(new LinkAction('addRepresentative', new AjaxModal($router->url($request, null, null, 'addRepresentative', null, $actionArgs), __('grid.action.addRepresentative'), 'modal_add_item'), __('grid.action.addRepresentative'), 'add_item'));
// Columns
$cellProvider = new RepresentativesGridCellProvider();
$this->addColumn(new GridColumn('name', 'grid.catalogEntry.representativeName', null, null, $cellProvider));
$this->addColumn(new GridColumn('role', 'grid.catalogEntry.representativeRole', null, null, $cellProvider));
}
示例13: saveApproveProof
/**
* Approve a galley submission file.
* @param $args array
* @param $request PKPRequest
*/
function saveApproveProof($args, $request)
{
$submissionFile = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILE);
$submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
// Make sure we only alter files associated with a galley.
if ($submissionFile->getAssocType() !== ASSOC_TYPE_GALLEY) {
fatalError('The requested file is not associated with any galley.');
}
if ($submissionFile->getViewable()) {
// No longer expose the file to readers.
$submissionFile->setViewable(false);
} else {
// Expose the file to readers (e.g. via e-commerce).
$submissionFile->setViewable(true);
// Log the approve proof event.
import('lib.pkp.classes.log.SubmissionLog');
import('classes.log.SubmissionEventLogEntry');
// constants
$user = $request->getUser();
$articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
$galley = $articleGalleyDao->getByBestGalleyId($submissionFile->getAssocId(), $submission->getId());
SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_PROOFS_APPROVED, 'submission.event.proofsApproved', array('formatName' => $galley->getLabel(), 'name' => $user->getFullName(), 'username' => $user->getUsername()));
}
$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
$submissionFileDao->updateObject($submissionFile);
// update the submission's file index
import('classes.search.ArticleSearchIndex');
ArticleSearchIndex::submissionFilesChanged($submission);
return DAO::getDataChangedEvent($submissionFile->getId());
}
示例14: initialize
/**
* @copydoc SetupListbuilderHandler::initialize()
*/
function initialize($request)
{
parent::initialize($request);
$context = $request->getContext();
$this->setTitle('plugins.generic.translator.localeFileContents');
$this->setInstructions('plugins.generic.translator.localeFileContentsDescription');
// Get and validate the locale and filename parameters
$this->locale = $request->getUserVar('locale');
if (!AppLocale::isLocaleValid($this->locale)) {
fatalError('Invalid locale.');
}
$this->filename = $request->getUserVar('filename');
if (!in_array($this->filename, TranslatorAction::getLocaleFiles($this->locale))) {
fatalError('Invalid locale file specified!');
}
// Basic configuration
$this->setSourceType(LISTBUILDER_SOURCE_TYPE_TEXT);
$this->setSaveType(LISTBUILDER_SAVE_TYPE_EXTERNAL);
$this->setSaveFieldName('localeKeys');
self::$plugin->import('controllers.listbuilder.LocaleFileListbuilderGridCellProvider');
$cellProvider = new LocaleFileListbuilderGridCellProvider($this->locale);
// Key column
$this->addColumn(new ListbuilderGridColumn($this, 'key', 'plugins.generic.translator.localeKey', null, self::$plugin->getTemplatePath() . 'localeFileKeyGridCell.tpl', $cellProvider, array('tabIndex' => 1)));
// Value column (custom template displays English text)
$this->addColumn(new ListbuilderGridColumn($this, 'value', 'plugins.generic.translator.localeKeyValue', null, self::$plugin->getTemplatePath() . 'localeFileValueGridCell.tpl', $cellProvider, array('tabIndex' => 2, 'width' => 70, 'alignment' => COLUMN_ALIGNMENT_LEFT)));
}
示例15: fatalError
/**
* Load configuration data from a file.
* The file is assumed to be formatted in php.ini style.
* @return array the configuration data
*/
function &reloadData()
{
if (($configData =& ConfigParser::readConfig(Config::getConfigFileName())) === false) {
fatalError(sprintf('Cannot read configuration file %s', Config::getConfigFileName()));
}
return $configData;
}