本文整理汇总了PHP中ErrorMessage函数的典型用法代码示例。如果您正苦于以下问题:PHP ErrorMessage函数的具体用法?PHP ErrorMessage怎么用?PHP ErrorMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ErrorMessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetCurrentMP
function GetCurrentMP($mp, $date, $error = true)
{
global $_openSIS;
switch ($mp) {
case 'FY':
$table = 'school_years';
break;
case 'SEM':
$table = 'school_semesters';
break;
case 'QTR':
$table = 'school_quarters';
break;
case 'PRO':
$table = 'school_progress_periods';
break;
}
if (!$_openSIS['GetCurrentMP'][$date][$mp]) {
$_openSIS['GetCurrentMP'][$date][$mp] = DBGet(DBQuery('SELECT MARKING_PERIOD_ID FROM ' . $table . ' WHERE \'' . $date . '\' BETWEEN START_DATE AND END_DATE AND SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\''));
}
if ($_openSIS['GetCurrentMP'][$date][$mp][1]['MARKING_PERIOD_ID']) {
return $_openSIS['GetCurrentMP'][$date][$mp][1]['MARKING_PERIOD_ID'];
} elseif (strpos($_SERVER['PHP_SELF'], 'Side.php') === false && $error == true) {
ErrorMessage(array('' . _("You are not currently in a marking period") . ''));
}
//ShowErr("You are not currently in a marking period");
}
示例2: Add
public function Add($ActivityUserID, $ActivityType, $Story = '', $RegardingUserID = '', $CommentActivityID = '', $Route = '')
{
// Make sure the user is authenticated
// Get the ActivityTypeID & see if this is a notification
$ActivityType = $this->SQL->Select('ActivityTypeID, Notify')->From('ActivityType')->Where('Name', $ActivityType)->Get()->FirstRow();
if ($ActivityType !== FALSE) {
$ActivityTypeID = $ActivityType->ActivityTypeID;
$Notify = $ActivityType->Notify == '1';
} else {
trigger_error(ErrorMessage(sprintf('Activity type could not be found: %s', $ActivityType), 'ActivityModel', 'Add'), E_USER_ERROR);
}
// If this is a notification, increment the regardinguserid's count
if ($Notify) {
$this->SQL->Update('User')->Set('CountNotifications', 'CountNotifications + 1', FALSE)->Where('UserID', $RegardingUserID)->Put();
}
$Fields = array('ActivityTypeID' => $ActivityTypeID, 'ActivityUserID' => $ActivityUserID);
if ($Story != '') {
$Fields['Story'] = $Story;
}
if ($Route != '') {
$Fields['Route'] = $Route;
}
if (is_numeric($RegardingUserID)) {
$Fields['RegardingUserID'] = $RegardingUserID;
}
if (is_numeric($CommentActivityID)) {
$Fields['CommentActivityID'] = $CommentActivityID;
}
$this->AddInsertFields($Fields);
$this->DefineSchema();
return $this->Insert($Fields);
// NOTICE! This will silently fail if there are errors. Developers can figure out what's wrong by dumping the results of $this->ValidationResults();
}
示例3: GetCurrentMP
function GetCurrentMP($mp, $date, $error = true)
{
global $_openSIS;
switch ($mp) {
case 'FY':
$table = 'SCHOOL_YEARS';
break;
case 'SEM':
$table = 'SCHOOL_SEMESTERS';
break;
case 'QTR':
$table = 'SCHOOL_QUARTERS';
break;
case 'PRO':
$table = 'SCHOOL_PROGRESS_PERIODS';
break;
}
if (!$_openSIS['GetCurrentMP'][$date][$mp]) {
$_openSIS['GetCurrentMP'][$date][$mp] = DBGet(DBQuery("SELECT MARKING_PERIOD_ID FROM {$table} WHERE '{$date}' BETWEEN START_DATE AND END_DATE AND SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'"));
}
if ($_openSIS['GetCurrentMP'][$date][$mp][1]['MARKING_PERIOD_ID']) {
return $_openSIS['GetCurrentMP'][$date][$mp][1]['MARKING_PERIOD_ID'];
} elseif (strpos($_SERVER['PHP_SELF'], 'Side.php') === false && $error == true) {
ErrorMessage(array("You are not currently in a marking period"));
}
//ShowErr("You are not currently in a marking period");
}
示例4: RegisterGlobalState
function RegisterGlobalState()
{
/* Deal with user specified session handlers */
if (session_module_name() == "user") {
$phperrorcsession = gettext("PHP ERROR: A custom (user) PHP session have been detected. However, BASE has not been set to explicitly use this custom handler. Set <CODE>use_user_session=1</CODE> in <CODE>base_conf.php</CODE>");
$phperrorcsessioncode = gettext("PHP ERROR: A custom (user) PHP session hander has been configured, but the supplied hander code specified in <CODE>user_session_path</CODE> is invalid.");
$phperrorcsessionvar = gettext("PHP ERROR: A custom (user) PHP session handler has been configured, but the implementation of this handler has not been specified in BASE. If a custom session handler is desired, set the <CODE>user_session_path</CODE> variable in <CODE>base_conf.php</CODE>.");
if ($GLOBALS['use_user_session'] != 1) {
ErrorMessage($phperrorcsession);
die;
} else {
if ($GLOBALS['user_session_path'] != "") {
if (is_file($GLOBALS['user_session_path'])) {
ErrorMessage(_("Custom User PHP session handlers are deprecated in this version of SIEM Events Console"));
die;
//include_once ($GLOBALS['user_session_path']);
//if ($GLOBALS['user_session_function'] != "") $GLOBALS['user_session_function']();
} else {
ErrorMessage($phperrorcsessioncode);
die;
}
} else {
ErrorMessage($phperrorcsessionvar);
die;
}
}
}
//session_start();
//if ($GLOBALS['debug_mode'] > 0) echo '<FONT COLOR="#FF0000">' . gettext("Session Registered") . '</FONT><BR>';
}
示例5: ReverseStatus
function ReverseStatus()
{
TutupScript();
$AplikanID = $_REQUEST['id'];
$StatusMundur = GetaField('aplikan', 'AplikanID', $AplikanID, "StatusMundur");
if ($StatusMundur == 'Y') {
$s = "update `aplikan` set StatusMundur = 'N',\r\n\t\t\t\t\t\t\t\t\t\tLoginMundur = '{$_SESSION['_Login']}',\r\n\t\t\t\t\t\t\t\t\t\tTanggalMundur = now()\r\n\t\t\t\t\t\t\t\t\twhere AplikanID='{$AplikanID}'";
$r = _query($s);
/*$StatusAplikanMhswUpdate = GetaField('statusaplikanmhsw sam left outer join statusaplikan sa',
"sa.Urutan=(select max(Urutan) from statusaplikanmhsw sam2 where sam2.AplikanID='$AplikanID') and sam.AplikanID='$AplikanID' and sam.KodeID",
KodeID,
'StatusAplikanMhswID');
$s = "update statusaplikanmhsw setStatusMundur='N' where StatusAplikanMhswID='$StatusAplikanMhswUpdate'";
*/
echo "<script>ttutup('{$_SESSION['mnux']}');</script>";
} else {
if ($StatusMundur == 'N') {
$s = "update `aplikan` set StatusMundur = 'Y' where AplikanID='{$AplikanID}'";
$r = _query($s);
echo "<script>ttutup('{$_SESSION['mnux']}');</script>";
} else {
echo ErrorMessage("Error", "Status Mundur tidka dikenali. Harap hubungi administrator");
}
}
}
示例6: RegisterGlobalState
function RegisterGlobalState()
{
/* Deal with user specified session handlers */
if (session_module_name() == "user") {
if ($GLOBALS['use_user_session'] != 1) {
ErrorMessage("PHP ERROR: A custom (user) PHP session have been detected. However, ACID has not been " . "set to explicitly use this custom handler. Set <CODE>use_user_session=1</CODE> in " . "<CODE>acid_conf.php</CODE>");
die;
} else {
if ($GLOBALS['user_session_path'] != "") {
if (is_file($GLOBALS['user_session_path'])) {
include_once $GLOBALS['user_session_path'];
if ($GLOBALS['user_session_function'] != "") {
$GLOBALS['user_session_function']();
}
} else {
ErrorMessage("PHP ERROR: A custom (user) PHP session hander has been configured, but the supplied " . "hander code specified in <CODE>user_session_path</CODE> is invalid.");
die;
}
} else {
ErrorMessage("PHP ERROR: A custom (user) PHP session handler has been configured, but the implementation " . "of this handler has not been specified in ACID. If a custom session handler is desired, " . "set the <CODE>user_session_path</CODE> variable in <CODE>acid_conf.php</CODE>.");
die;
}
}
}
session_start();
if ($GLOBALS['debug_mode'] > 0) {
echo '<FONT COLOR="#FF0000">Session Registered</FONT><BR>';
}
}
示例7: get_xmlrpc_error
function get_xmlrpc_error($resp)
{
if (is_array($resp) && xmlrpc_is_fault($resp)) {
$message = 'Moodle Integrator - ' . $resp['faultCode'] . ' - ' . $resp['faultString'];
return ErrorMessage(array($message), 'error');
}
return null;
}
示例8: Add
public function Add($ActivityUserID, $ActivityType, $Story = '', $RegardingUserID = '', $CommentActivityID = '', $Route = '', $SendEmail = '')
{
// Make sure the user is authenticated
// Get the ActivityTypeID & see if this is a notification
$ActivityTypeRow = $this->SQL->Select('ActivityTypeID, Name, Notify')->From('ActivityType')->Where('Name', $ActivityType)->Get()->FirstRow();
if ($ActivityTypeRow !== FALSE) {
$ActivityTypeID = $ActivityTypeRow->ActivityTypeID;
$Notify = $ActivityTypeRow->Notify == '1';
} else {
trigger_error(ErrorMessage(sprintf('Activity type could not be found: %s', $ActivityType), 'ActivityModel', 'Add'), E_USER_ERROR);
}
if ($ActivityTypeRow->Name == 'ActivityComment' && $Story == '') {
$this->Validation->AddValidationResult('Body', 'You must provide a comment.');
return FALSE;
}
// Massage $SendEmail to allow for only sending an email.
$SendEmail = TRUE;
// TODO: Allow just emails.
if ($SendEmail == 'Only') {
$SendEmail = '';
$AddActivity = FALSE;
} else {
$AddActivity = TRUE;
}
// If this is a notification, increment the regardinguserid's count
if ($AddActivity && $Notify) {
$this->SQL->Update('User')->Set('CountNotifications', 'coalesce(CountNotifications) + 1', FALSE)->Where('UserID', $RegardingUserID)->Put();
}
$Fields = array('ActivityTypeID' => $ActivityTypeID, 'ActivityUserID' => $ActivityUserID);
if ($Story != '') {
$Fields['Story'] = $Story;
}
if ($Route != '') {
$Fields['Route'] = $Route;
}
if (is_numeric($RegardingUserID)) {
$Fields['RegardingUserID'] = $RegardingUserID;
}
if (is_numeric($CommentActivityID)) {
$Fields['CommentActivityID'] = $CommentActivityID;
}
// if ($AddActivity) {
$this->AddInsertFields($Fields);
$this->DefineSchema();
$ActivityID = $this->Insert($Fields);
// NOTICE! This will silently fail if there are errors. Developers can figure out what's wrong by dumping the results of $this->ValidationResults();
// }
// If $SendEmail was FALSE or TRUE, let it override the $Notify setting.
if ($SendEmail === FALSE || $SendEmail === TRUE) {
$Notify = $SendEmail;
}
// Otherwise let the decision to email lie with the $Notify setting.
// Send a notification to the user.
if ($Notify) {
$this->SendNotification($ActivityID);
}
return $ActivityID;
}
示例9: CheckForSpam
/**
* Checks to see if the user is spamming. Returns TRUE if the user is spamming.
*/
public function CheckForSpam($Type)
{
$Spam = FALSE;
if (!in_array($Type, array('Comment', 'Discussion'))) {
trigger_error(ErrorMessage(sprintf('Spam check type unknown: %s', $Type), 'VanillaModel', 'CheckForSpam'), E_USER_ERROR);
}
$Session = Gdn::Session();
$CountSpamCheck = $Session->GetAttribute('Count' . $Type . 'SpamCheck', 0);
$DateSpamCheck = $Session->GetAttribute('Date' . $Type . 'SpamCheck', 0);
$SecondsSinceSpamCheck = time() - Format::ToTimestamp($DateSpamCheck);
$SpamCount = Gdn::Config('Vanilla.' . $Type . '.SpamCount');
if (!is_numeric($SpamCount) || $SpamCount < 2) {
$SpamCount = 2;
}
// 2 spam minimum
$SpamTime = Gdn::Config('Vanilla.' . $Type . '.SpamTime');
if (!is_numeric($SpamTime) || $SpamTime < 0) {
$SpamTime = 30;
}
// 30 second minimum spam span
$SpamLock = Gdn::Config('Vanilla.' . $Type . '.SpamLock');
if (!is_numeric($SpamLock) || $SpamLock < 30) {
$SpamLock = 30;
}
// 30 second minimum lockout
// Definition:
// Users cannot post more than $SpamCount comments within $SpamTime
// seconds or their account will be locked for $SpamLock seconds.
// Apply a spam lock if necessary
$Attributes = array();
if ($SecondsSinceSpamCheck < $SpamLock && $CountSpamCheck >= $SpamCount && $DateSpamCheck !== FALSE) {
// TODO: REMOVE DEBUGGING INFO AFTER THIS IS WORKING PROPERLY
/*
echo '<div>SecondsSinceSpamCheck: '.$SecondsSinceSpamCheck.'</div>';
echo '<div>SpamLock: '.$SpamLock.'</div>';
echo '<div>CountSpamCheck: '.$CountSpamCheck.'</div>';
echo '<div>SpamCount: '.$SpamCount.'</div>';
echo '<div>DateSpamCheck: '.$DateSpamCheck.'</div>';
echo '<div>SpamTime: '.$SpamTime.'</div>';
*/
$Spam = TRUE;
$this->Validation->AddValidationResult('Body', sprintf(T('You have posted %1$s times within %2$s seconds. A spam block is now in effect on your account. You must wait at least %3$s seconds before attempting to post again.'), $SpamCount, $SpamTime, $SpamLock));
// Update the 'waiting period' every time they try to post again
$Attributes['Date' . $Type . 'SpamCheck'] = Format::ToDateTime();
} else {
if ($SecondsSinceSpamCheck > $SpamTime) {
$Attributes['Count' . $Type . 'SpamCheck'] = 1;
$Attributes['Date' . $Type . 'SpamCheck'] = Format::ToDateTime();
} else {
$Attributes['Count' . $Type . 'SpamCheck'] = $CountSpamCheck + 1;
}
}
// Update the user profile after every comment
$UserModel = Gdn::UserModel();
$UserModel->SaveAttribute($Session->UserID, $Attributes);
return $Spam;
}
示例10: createDBIndex
function createDBIndex($db, $table, $field, $index_name)
{
$sql = 'CREATE INDEX ' . $index_name . ' ON ' . $table . ' (' . $field . ')';
$db->baseExecute($sql, -1, -1, false);
if ($db->baseErrorMessage() != "") {
ErrorMessage(gettext("Unable to CREATE INDEX for") . " '" . $field . "' : " . $db->baseErrorMessage());
} else {
ErrorMessage(gettext("Successfully created INDEX for") . " '" . $field . "'");
}
}
示例11: PrintPortscanEvents
function PrintPortscanEvents($db, $ip)
{
global $portscan_file;
if (!$portscan_file) {
ErrorMessage(gettext("PORTSCAN EVENT ERROR: ") . gettext("No file was specified in the {$portscan_file} variable."));
return;
}
$fp = fopen($portscan_file, "r");
if (!$fp) {
ErrorMessage(gettext("PORTSCAN EVENT ERROR: ") . gettext("Unable to open Portscan event file") . " '" . $portscan_file . "'");
return;
}
echo '<TABLE border="0" width="100%" cellspacing="0" cellpadding="5" class="table_list">
<TR>
<TD CLASS="headerbasestat">' . gettext("Date/Time") . '</TD>
<TD CLASS="headerbasestat">' . gettext("Source IP") . '</TD>
<TD CLASS="headerbasestat">' . gettext("Source Port") . '</TD>
<TD CLASS="headerbasestat">' . gettext("Destination IP") . '</TD>
<TD CLASS="headerbasestat">' . gettext("Destination Port") . '</TD>
<TD CLASS="headerbasestat">' . gettext("TCP Flags") . '</TD>
</TR>';
$total = 0;
// Patch regex DoS possible vuln
$ip = Util::regex($ip);
while (!feof($fp)) {
$contents = fgets($fp, 255);
if (preg_match($ip, $contents)) {
$total++;
if ($i % 2 == 0) {
$color = "DDDDDD";
} else {
$color = "FFFFFF";
}
$contents = preg_replace("/\\s\\s/", " ", $contents);
$elements = explode(" ", $contents);
echo '<tr bgcolor="' . $color . '"><td align="center">' . $elements[0] . ' ' . $elements[1] . ' ' . $elements[2] . '</td>';
preg_match("/([0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*):([0-9]*)/", $elements[3], $store);
echo '<td align="center">' . $store[1] . '</td>';
echo '<td align="center">' . $store[2] . '</td>';
preg_match("/([0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*):([0-9]*)/", $elements[5], $store);
echo '<td align="center">' . $store[1] . '</td>';
echo '<td align="center">' . $store[2] . '</td>';
echo '<td align="center">' . $elements[7] . '</td></tr>';
}
}
fclose($fp);
echo '<TR>
<TD CLASS="headerbasestat" align="left">' . gettext("Total Hosts Scanned") . '</TD>
<TD CLASS="headerbasestat">' . $total . '</TD>
<TD CLASS="headerbasestat" colspan="4"> </TD>
</TR>
</TABLE>';
}
示例12: GetCurrentMP
function GetCurrentMP($mp, $date, $error = true)
{
global $_ROSARIO;
if (!$_ROSARIO['GetCurrentMP'][$date][$mp]) {
$_ROSARIO['GetCurrentMP'][$date][$mp] = DBGet(DBQuery("SELECT MARKING_PERIOD_ID FROM SCHOOL_MARKING_PERIODS WHERE MP='{$mp}' AND '{$date}' BETWEEN START_DATE AND END_DATE AND SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'"));
}
if ($_ROSARIO['GetCurrentMP'][$date][$mp][1]['MARKING_PERIOD_ID']) {
return $_ROSARIO['GetCurrentMP'][$date][$mp][1]['MARKING_PERIOD_ID'];
} elseif ($error) {
ErrorMessage(array(_('You are not currently in a marking period')), 'fatal');
}
}
示例13: core_calendar_create_calendar_events_response
function core_calendar_create_calendar_events_response($response)
{
//first, gather the necessary variables
global $calendar_event_id, $_REQUEST;
//then, save the ID in the moodlexrosario cross-reference table if no error:
/*
object {
events list of (
//event
object {
id int //event id
name string //event name
description string Optional //Description
format int //description format (1 = HTML, 0 = MOODLE, 2 = PLAIN or 4 = MARKDOWN)
courseid int //course id
groupid int //group id
userid int //user id
repeatid int Optional //repeat id
modulename string Optional //module name
instance int //instance id
eventtype string //Event type
timestart int //timestart
timeduration int //time duration
visible int //visible
uuid string Optional //unique id of ical events
sequence int //sequence
timemodified int //time modified
subscriptionid int Optional //Subscription id
}
)warnings Optional //list of warnings
list of (
//warning
object {
item string Optional //item
itemid int Optional //item id
warningcode string //the warning code can be used by the client app to implement specific behaviour
message string //untranslated english message to explain the warning
}
)}
*/
if (is_array($response['warnings'][0])) {
return ErrorMessage(array('Code: ' . $response['warnings'][0]['warningcode'] . ' - ' . $response['warnings'][0]['message']), 'error');
}
if (empty($calendar_event_id)) {
//case: update event
$calendar_event_id = $_REQUEST['event_id'];
}
DBQuery("INSERT INTO MOODLEXROSARIO (\"column\", rosario_id, moodle_id) VALUES ('calendar_event_id', '" . $calendar_event_id . "', " . $response['events'][0]['id'] . ")");
return null;
}
示例14: VerifyAGID
function VerifyAGID($ag_id, $db)
{
$sql = "SELECT ag_id FROM acid_ag WHERE ag_id='" . $ag_id . "'";
$result = $db->baseExecute($sql);
if ($db->baseErrorMessage() != "") {
ErrorMessage(gettext("Error looking up an AG ID"));
return 0;
} else {
if ($result->baseRecordCount() < 1) {
return 0;
} else {
$result->baseFreeRows();
return 1;
}
}
}
示例15: Index
/**
* The summary of all settings available. The menu items displayed here are
* collected from each application's application controller and all plugin's
* definitions.
*/
public function Index()
{
$this->ApplicationFolder = 'dashboard';
$this->MasterView = 'setup';
// Fatal error if Garden has already been installed.
$Config = Gdn::Factory(Gdn::AliasConfig);
$Installed = Gdn::Config('Garden.Installed') ? TRUE : FALSE;
if ($Installed) {
trigger_error(ErrorMessage('Vanilla has already been installed.', 'SetupController', 'Index'));
}
if (!$this->_CheckPrerequisites()) {
$this->View = 'prerequisites';
} else {
$this->View = 'configure';
$ApplicationManager = new Gdn_ApplicationManager();
$AvailableApplications = $ApplicationManager->AvailableApplications();
// Need to go through all of the setups for each application. Garden,
if ($this->Configure() && $this->Form->IsPostBack()) {
// Step through the available applications, enabling each of them
$AppNames = array_keys($AvailableApplications);
try {
foreach ($AvailableApplications as $AppName => $AppInfo) {
if (strtolower($AppName) != 'dashboard') {
$Validation = new Gdn_Validation();
$ApplicationManager->RegisterPermissions($AppName, $Validation);
$ApplicationManager->EnableApplication($AppName, $Validation);
}
}
} catch (Exception $ex) {
$this->Form->AddError(strip_tags($ex->getMessage()));
}
if ($this->Form->ErrorCount() == 0) {
// Save a variable so that the application knows it has been installed.
// Now that the application is installed, select a more user friendly error page.
SaveToConfig(array('Garden.Installed' => TRUE, 'Garden.Errors.MasterView' => 'error.master.php'));
// Go to the dashboard
Redirect('/settings');
}
}
}
$this->Render();
}