本文整理汇总了PHP中Utility::isErrorX方法的典型用法代码示例。如果您正苦于以下问题:PHP Utility::isErrorX方法的具体用法?PHP Utility::isErrorX怎么用?PHP Utility::isErrorX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utility
的用法示例。
在下文中一共展示了Utility::isErrorX方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$lastname = $_REQUEST["lastname"];
$from = $_REQUEST["from"];
$verif_box = $_REQUEST["verif_box"];
// check to see if verificaton code was correct
// if verification code was correct send the message and show this page
$fullname = $name . " " . $lastname;
$vals = array('UserID' => $from, 'Real_name' => $fullname, 'First_name' => $name, 'Last_name' => $lastname, 'Pending_approval' => 'Y', 'Email' => $from);
// check email address' uniqueness
$result = $DB->pselectOne("SELECT COUNT(*) FROM users WHERE Email = :VEmail", array('VEmail' => $from));
if (Utility::isErrorX($result)) {
return PEAR::raiseError("DB Error: " . $result->getMessage());
}
if ($result == 0) {
// insert into db only if email address if it doesnt exist
$success = $DB->insert('users', $vals);
if (Utility::isErrorX($success)) {
return PEAR::raiseError("DB Error: " . $success->getMessage());
}
}
unset($_SESSION['tntcon']);
//redirect to a new page
header("Location: thank-you.html", true, 301);
exit;
}
}
/**
* Check that the user input for a field meets minimum length requirements
*
* @param string $str The request parameter to check
* @param integer $len The minimum length for the parameter
*
示例2: set_include_path
* @package Main
* @author Justin Kat <justinkat@gmail.com>
* @license Loris license
* @link https://www.github.com/Jkat/Loris-Trunk/
*/
set_include_path(get_include_path() . ":../../project/libraries:../../php/libraries:");
require_once "NDB_Client.class.inc";
$client = new NDB_Client();
$client->initialize("../../project/config.xml");
// create Database object
$DB =& Database::singleton();
if (Utility::isErrorX($DB)) {
print "Could not connect to database: " . $DB->getMessage() . "<br>\n";
die;
}
if (get_magic_quotes_gpc()) {
// Magic quotes adds \ to description, get rid of it.
$comments = stripslashes($_REQUEST['comments']);
} else {
// Magic quotes is off, so we can just directly use the description
// since insert() will use a prepared statement.
$comments = $_REQUEST['comments'];
}
$user =& User::singleton();
if (Utility::isErrorX($user)) {
return PEAR::raiseError("User Error: " . $user->getMessage());
}
//if user has document repository permission
if ($user->hasPermission('document_repository_view') || $user->hasPermission('document_repository_delete')) {
$DB->update('document_repository_categories', array('comments' => $comments), array('id' => $_REQUEST['id']));
}
示例3: header
* page via AJAX to update the email template with the current page
*
* PHP Version 5
*
* @category Survey
* @package Loris
* @author Dave MacFarlane <driusan@bic.mni.mcgill.ca>
* @license Loris license
* @link https://www.github.com/aces/Loris-Trunk/
*/
$user =& User::singleton();
if (!$user->hasPermission('user_accounts')) {
header("HTTP/1.1 403 Forbidden");
exit;
}
set_include_path(get_include_path() . ":../project/libraries:../php/libraries:");
ini_set('default_charset', 'utf-8');
require_once "Database.class.inc";
require_once 'NDB_Config.class.inc';
require_once 'NDB_Client.class.inc';
$config =& NDB_Config::singleton();
$client = new NDB_Client();
$client->makeCommandLine();
$client->initialize();
$DB = Database::singleton();
$result = $DB->pselectOne("SELECT DefaultEmail FROM participant_emails WHERE Test_name=:TN", array('TN' => $_REQUEST['test_name']));
if (Utility::isErrorX($result) || empty($result)) {
print "";
} else {
print $result;
}
示例4: set_include_path
}
set_include_path(get_include_path() . ":../../project/libraries:../../php/libraries:");
require_once "NDB_Client.class.inc";
require_once "NDB_Config.class.inc";
require_once "Email.class.inc";
$client = new NDB_Client();
$client->initialize("../../project/config.xml");
$config = NDB_Config::singleton();
// create Database object
$DB =& Database::singleton();
if (Utility::isErrorX($DB)) {
print "Could not connect to database: " . $DB->getMessage() . "<br>\n";
die;
}
$action = $_POST['action'];
if (Utility::isErrorX($userSingleton)) {
return PEAR::raiseError("User Error: " . $userSingleton->getMessage());
}
//if user has document repository permission
if ($userSingleton->hasPermission('document_repository_view') || $userSingleton->hasPermission('document_repository_delete')) {
if ($action == 'upload') {
$user = $_POST['user'];
$category = $_POST['category'];
$site = $_POST['site'];
$instrument = $_POST['instrument'];
$pscid = $_POST['pscid'];
$visit = $_POST['visit'];
$comments = $_POST['comments'];
$version = $_POST['version'];
$fileSize = $_FILES["file"]["size"];
$fileName = $_FILES["file"]["name"];
示例5: elseif
$Fields[$field_name['SourceField']] = $field_name['SourceField'];
}
$tpl_data['FieldNames'] = $Fields;
}
}
/*
* create feedback object
*/
if (!empty($_REQUEST['commentID'])) {
$feedback = NDB_BVL_Feedback::singleton($user->getUsername(), null, null, $_REQUEST['commentID']);
} elseif (!empty($_REQUEST['sessionID'])) {
$feedback = NDB_BVL_Feedback::singleton($user->getUsername(), null, $_REQUEST['sessionID']);
} elseif (!empty($_REQUEST['candID'])) {
$feedback = NDB_BVL_Feedback::singleton($user->getUsername(), $_REQUEST['candID']);
}
if (isset($feedback) && Utility::isErrorX($feedback)) {
// if feedback object return an error
$tpl_data['error_message'][] = $feedback->getMessage();
} elseif (isset($feedback) && !is_object($feedback)) {
} elseif (isset($feedback)) {
// define feedback level
$tpl_data['feedbackLevel'] = $feedback->getFeedbackLevel();
// get list of types
$feedbackTypes = NDB_BVL_Feedback::getFeedbackTypes();
if (PEAR::isError($feedbackTypes)) {
$tpl_data['error_message'][] = $feedbackTypes->getMessage();
} else {
$z = 0;
foreach ($feedbackTypes as $val) {
// Following are used for the "Add Feedback" Form
$tpl_data['threadTypes'][$z]['Type'] = $val['Type'];
示例6: set_include_path
* @category Main
* @package Loris
* @author Rathi Sekaran <sekaranrathi@gmail.com>
* @license Loris license
* @link https://www.github.com/aces/Loris-Trunk/
*/
set_include_path(get_include_path() . ":../project/libraries:../php/libraries:");
ini_set('default_charset', 'utf-8');
ob_start('ob_gzhandler');
require_once "NDB_Client.class.inc";
$client = new NDB_Client();
$client->initialize();
require_once "HelpFile.class.inc";
// create DB object
$DB =& Database::singleton();
if (Utility::isErrorX($DB)) {
return PEAR::raiseError("Could not connect to database: " . $DB->getMessage());
}
// store some request information
if (!empty($_REQUEST['helpID'])) {
$helpID = $_REQUEST['helpID'];
} else {
if (!empty($_REQUEST['test_name'])) {
$helpID = HelpFile::hashToID(md5($_REQUEST['test_name']));
}
if (!empty($_REQUEST['test_name']) && !empty($_REQUEST['subtest'])) {
$helpID = HelpFile::hashToID(md5($_REQUEST['subtest']));
}
}
$help_file = HelpFile::factory($helpID);
$data = $help_file->toArray();
示例7: updateStatus
/**
* Updates the status of the current key
*
* @param string $status The status to be updated to
*
* @return True on success, false on failure
*/
function updateStatus($status)
{
$DB = Database::singleton();
$currentStatus = $DB->pselectOne('SELECT Status FROM participant_accounts
WHERE OneTimePassword=:key', array('key' => $this->key));
if (Utility::isErrorX($currentStatus)) {
return false;
}
if ($currentStatus === 'Complete') {
// Already completed, don't want to accidentally change it back to
// started or some other status..
return false;
}
$DB->update("participant_accounts", array('Status' => $status), array('OneTimePassword' => $this->key));
return true;
}
示例8: array
}
/**
* Get cmd-line arguments
*/
// get $action argument
$action = $argv[1];
$ddeInstruments = $config->getSetting('DoubleDataEntryInstruments');
if ($action == 'all') {
$allInstruments = Utility::getAllInstruments();
} else {
$allInstruments = array($action => $action);
}
// clear the unresolved conflicts for all the instruments
foreach ($allInstruments as $instrument => $Full_name) {
$clear_conflicts = $db->pselect("SELECT CommentID, Test_name,\n CONCAT('DDE_', CommentID)\n AS DDECommentID\n FROM flag\n JOIN session s ON (s.ID=flag.SessionID)\n JOIN candidate c ON (c.CandID=s.CandID)\n WHERE Test_name=:testname AND CommentID\n NOT LIKE 'DDE%' AND s.Active='Y'\n AND c.Active='Y'", array('testname' => $instrument));
if (Utility::isErrorX($clear_conflicts)) {
return PEAR::raiseError("Error, failed to clear conflicts: " . $clear_conflicts->getMessage());
}
foreach ($clear_conflicts as $conflict) {
ConflictDetector::clearConflictsForInstance($conflict['CommentID']);
}
}
foreach ($ddeInstruments as $test) {
$instruments = $db->pselect("SELECT CommentID, Test_name, CONCAT('DDE_',\n CommentID) AS DDECommentID\n FROM flag sde\n JOIN session s ON (s.ID=sde.SessionID)\n JOIN candidate c ON (c.CandID=s.CandID)\n WHERE sde.Test_name=:testname AND sde.CommentID\n NOT LIKE 'DDE%' AND sde.Data_entry='Complete'\n AND s.Active='Y' AND c.Active='Y'\n AND EXISTS (SELECT 'x' FROM flag dde WHERE\n dde.CommentID=CONCAT('DDE_',sde.CommentID)\n AND Data_entry='Complete')", array('testname' => $test));
foreach ($instruments as $instrument) {
// If the instrument requires double data entry, check that DDE is also done
if (in_array($instrument['Test_name'], $ddeInstruments)) {
print "Recreating conflicts for " . $instrument['Test_name'] . ':' . $instrument['CommentID'] . "\n";
$diff = ConflictDetector::detectConflictsForCommentIds($instrument['Test_name'], $instrument['CommentID'], $instrument['DDECommentID']);
ConflictDetector::recordUnresolvedConflicts($diff);
}