private static function pushNotification($userKey, $message, $title = null, $url = null, $urltitle = null)
 {
     Notifications::addLog('Pushover[pushNotification' . ']; $userKey=[' . $userKey . ']; $message=[' . $message . ']; $title=[' . $title . ']; $url=[' . $url . ']; $urltitle=[' . $urltitle . ']', 'MESSAGING');
     $notification = new Pushover();
     $token = Config::get('applicationToken', 'msg_pushover');
     if (is_null($token)) {
         throw new Exception("Pushover - Application token not specified", 500);
     }
     if (is_null($userKey)) {
         throw new Exception("Pushover - User key not specified", 500);
     }
     $notification->setToken($token);
     $notification->setUser($userKey);
     $notification->setMessage($message);
     if (!is_null($title)) {
         $notification->setTitle($title);
     }
     $notification->setHtml(1);
     $notification->setUrl($url);
     $notification->setUrlTitle($urltitle);
     if (!$notification->send()) {
         Notifications::addError("Pushover - Error in sending a notification to '{$userKey}'");
     } else {
         Notifications::addSuccess('Pushover message sent.');
     }
 }
示例#2
0
 /**
  * @url POST file
  * @param array $roleIds
  */
 public function fileUpload($roleIds = null)
 {
     try {
         $session = Session::singleton();
         $session->activateRoles($roleIds);
         // TODO: Check if upload is allowed in interface
         if (is_uploaded_file($_FILES['file']['tmp_name'])) {
             $tmp_name = $_FILES['file']['tmp_name'];
             $new_name = time() . '_' . $_FILES['file']['name'];
             $target = Config::get('uploadPath') . '/' . $new_name;
             $result = move_uploaded_file($tmp_name, $target);
             if ($result) {
                 Notifications::addSuccess("File '" . $new_name . "' uploaded");
             } else {
                 Notifications::addError("Error in file upload");
             }
         } else {
             Notifications::addError('No file uploaded');
         }
         $newAtom = $session->database->addAtomToConcept(Concept::createNewAtom('Upload'), 'Upload');
         $session->database->editUpdate('fileName', false, $newAtom, 'Upload', $new_name, 'FileName');
         $session->database->editUpdate('originalFileName', false, $newAtom, 'Upload', $_FILES['file']['name'], 'FileName');
         $session->database->commitTransaction();
         $result = array('notifications' => Notifications::getAll(), 'files' => $_FILES, 'uploadId' => $newAtom);
         return $result;
     } catch (Exception $e) {
         throw new RestException($e->getCode(), $e->getMessage());
     }
 }
 /**
  * @url POST import
  */
 public function post()
 {
     try {
         $session = Session::singleton();
         $allowedRoles = (array) Config::get('allowedRolesForExcelImport', 'excelImport');
         if (Config::get('loginEnabled') && !is_null($allowedRoles)) {
             $ok = false;
             $sessionRoles = Role::getAllSessionRoles();
             foreach ($sessionRoles as $role) {
                 if (in_array($role->label, $allowedRoles)) {
                     $ok = true;
                 }
             }
             if (!$ok) {
                 throw new Exception("You do not have access to import excel files", 401);
             }
         }
         if (is_uploaded_file($_FILES['file']['tmp_name'])) {
             // Parse:
             $parser = new ImportExcel($_FILES['file']['tmp_name']);
             $result = $parser->ParseFile();
             unlink($_FILES['file']['tmp_name']);
         } else {
             Notifications::addError('No file uploaded');
         }
         $result = array('notifications' => $result, 'files' => $_FILES);
         return $result;
     } catch (Exception $e) {
         throw new RestException($e->getCode(), $e->getMessage());
     }
 }
示例#4
0
 private function setError($error = array(0, 0, ''))
 {
     $this->_error = $error;
     if (Config::get('debug/debug')) {
         Notifications::addError($this->error());
     }
     $this->_results = array();
     $this->_count = 0;
 }
 private static function pushNotification($userKey, $message, $title = null, $url = null, $urltitle = null)
 {
     Notifications::addLog('Pushalot - $userKey=[' . $userKey . ']; $message=[' . $message . ']; $title=[' . $title . ']; $url=[' . $url . ']; $urltitle=[' . $urltitle . ']', 'MESSAGING');
     if (is_null($userKey)) {
         throw new Exception("Pushalot - User/API key not specified", 500);
     }
     $notification = new Pushalot($userKey);
     //$pushalot->setProxy('http://localhost:12345','user:pass');
     $success = $notification->sendMessage(array('Title' => $title, 'Body' => $message, 'IsImportant' => true, 'IsSilent' => false, 'Image' => 'http://wiki.tarski.nl/skins/common/images/AmpersandLogo.png', 'Source' => 'Ampersand prototype'));
     if (!$success) {
         Notifications::addError("Pushalot error '{$notification->getError}()' sending notification to '{$userKey}'");
     } else {
         Notifications::addSuccess('Pushalot message sent.');
     }
 }
示例#6
0
function createPage($smarty)
{
    if (Users::loggedIn()) {
        Redirect::to('?page=profile');
    }
    if (Input::exists()) {
        if (Input::get('action') === 'register') {
            $validation = new Validate();
            $validation->check($_POST, array_merge(Config::get('validation/register_info'), Config::get('validation/set_password')));
            if ($validation->passed()) {
                try {
                    Users::create(array('student_id' => Input::get('sid'), 'password' => Hash::hashPassword(Input::get('password')), 'permission_group' => 1, 'name' => Input::get('name'), 'email' => Input::get('email'), 'umail' => Input::get('sid') . '@umail.leidenuniv.nl', 'phone' => Phone::formatNumber(Input::get('phone')), 'joined' => DateFormat::sql()));
                    Users::login(Input::get('sid'), Input::get('password'));
                    Notifications::addSuccess('You have been succesfully registered!');
                    Redirect::to('?page=profile');
                } catch (Exception $e) {
                    Notifications::addError($e->getMessage());
                }
            } else {
                Notifications::addValidationFail($validation->getErrors());
            }
        }
        if (Input::get('action') === 'login') {
            $validation = new Validate();
            $validation->check($_POST, Config::get('validation/login'));
            if ($validation->passed()) {
                $login = Users::login(Input::get('sid'), Input::get('password'), Input::getAsBool('remember'));
                if ($login) {
                    Notifications::addSuccess('You have been logged in!');
                    Redirect::to('?page=profile');
                } else {
                    Notifications::addValidationFail('Invalid student number or password.');
                }
            } else {
                Notifications::addValidationFail($validation->getErrors());
            }
        }
    }
    $smarty->assign('remember', Input::getAsBool('remember'));
    $smarty->assign('name', Input::get('name'));
    $smarty->assign('sid', Input::get('sid'));
    $smarty->assign('email', Input::get('email'));
    $smarty->assign('phone', Input::get('phone'));
    return $smarty;
}
示例#7
0
function SendEmail($to, $subject, $message)
{
    // adapted from http://phpmailer.worxware.com/?pg=examplebgmail
    $config = Config::get('sendEmailConfig', 'execEngine');
    $from = $config['from'];
    $username = $config['username'];
    $password = $config['password'];
    Notifications::addLog('Username = '******'ExecEngine');
    $mail = new PHPMailer();
    $mail->IsSMTP();
    // Set mailer to use SMTP
    // $mail->SMTPDebug = 1;
    $mail->Host = 'smtp.gmail.com';
    // Specify main and backup server
    $mail->SMTPSecure = 'tls';
    // Enable encryption, 'ssl' also accepted
    $mail->Port = 587;
    $mail->SMTPAuth = true;
    // Enable SMTP authentication
    $mail->Username = $username;
    // SMTP username (for GMAIL)
    $mail->Password = $password;
    // SMTP password
    $mail->From = $from;
    $mail->FromName = 'Ampersand Prototype';
    $mail->AddAddress($to);
    // Add a recipient, e.g. $to = '*****@*****.**', 'Rieks Joosten'
    $mail->Subject = $subject;
    $mail->Body = $message;
    $mail->WordWrap = 50;
    // Set word wrap to 50 characters
    if (!$mail->Send()) {
        Notifications::addError('Mailer Error: ' . $mail->ErrorInfo);
    } else {
        Notifications::addSuccess('Email message sent.');
    }
}
示例#8
0
 public function closeTransaction($succesMessage = 'Updated', $checkAllConjucts = true, $databaseCommit = false, $setNewContent = true)
 {
     $session = Session::singleton();
     Hooks::callHooks('preDatabaseCloseTransaction', get_defined_vars());
     Notifications::addLog('========================= CLOSING TRANSACTION =========================', 'DATABASE');
     if ($checkAllConjucts) {
         Notifications::addLog("Check all conjuncts", 'DATABASE');
         // Evaluate all invariant conjuncts. Conjuncts are cached.
         $invariantRulesHold = RuleEngine::checkInvariantRules();
         // Evaluate all signal conjuncts. Conjuncts are cached
         RuleEngine::checkProcessRules();
     } else {
         Notifications::addLog("Check all affected conjuncts", 'DATABASE');
         // Evaluate all affected invariant conjuncts. Conjuncts are cached.
         $invariantRulesHold = RuleEngine::checkInvariantRules(RuleEngine::getAffectedInvConjuncts($this->affectedConcepts, $this->affectedRelations), true);
         // Evaluate all affected signal conjuncts. Conjuncts are cached
         RuleEngine::checkConjuncts(RuleEngine::getAffectedSigConjuncts($this->affectedConcepts, $this->affectedRelations), true);
         // Check only those process rules that are relevant for the activate roles
         RuleEngine::checkProcessRules($session);
     }
     unset($this->affectedConcepts, $this->affectedRelations);
     $this->affectedConcepts = array();
     $this->affectedRelations = array();
     if ($setNewContent && isset($session->atom)) {
         $session->atom->setNewContent($session->interface);
     }
     // e.g. not needed in Atom::delete() function
     if ($invariantRulesHold && $databaseCommit) {
         $this->commitTransaction();
         // commit database transaction
         Notifications::addSuccess($succesMessage);
     } elseif (Config::get('ignoreInvariantViolations', 'transactions') && COMMIT_INV_VIOLATIONS) {
         $this->commitTransaction();
         Notifications::addError("Transaction committed with invariant violations");
     } elseif ($invariantRulesHold) {
         $this->rollbackTransaction();
         // rollback database transaction
         Notifications::addInfo($succesMessage);
     } else {
         $this->rollbackTransaction();
         // rollback database transaction
     }
     Hooks::callHooks('postDatabaseCloseTransaction', get_defined_vars());
     return $invariantRulesHold;
 }
示例#9
0
 public static function checkConjunct($conjunctId, $cacheConjuncts = true)
 {
     Notifications::addLog("Checking conjunct '" . $conjunctId . "' cache:" . var_export($cacheConjuncts, true), 'RuleEngine');
     try {
         // If conjunct is already evaluated and conjunctCach may be used -> return violations
         if (array_key_exists($conjunctId, self::$conjunctViolations) && $cacheConjuncts) {
             Notifications::addLog("Conjunct is already evaluated, getting violations from cache", 'RuleEngine');
             return self::$conjunctViolations[$conjunctId];
             // Otherwise evaluate conjunct, cache and return violations
         } else {
             $db = Database::singleton();
             $violations = array();
             // Evaluate conjunct
             $conjunct = RuleEngine::getConjunct($conjunctId);
             $violations = (array) $db->Exe($conjunct['violationsSQL']);
             // Cache violations
             if ($cacheConjuncts) {
                 self::$conjunctViolations[$conjunctId] = $violations;
             }
             if (count($violations) == 0) {
                 Notifications::addLog("Conjunct '" . $conjunctId . "' holds", 'RuleEngine');
                 // Remove "old" conjunct violations from database
                 $query = "DELETE FROM `__all_signals__` WHERE `conjId` = '{$conjunctId}'";
                 $db->Exe($query);
             } elseif ($cacheConjuncts) {
                 Notifications::addLog("Conjunct '" . $conjunctId . "' broken, caching violations in database", 'RuleEngine');
                 // Remove "old" conjunct violations from database
                 $query = "DELETE FROM `__all_signals__` WHERE `conjId` = '{$conjunctId}'";
                 $db->Exe($query);
                 // Add new conjunct violation to database table __all_signals__
                 $query = "INSERT IGNORE INTO `__all_signals__` (`conjId`, `src`, `tgt`) VALUES ";
                 foreach ($violations as $violation) {
                     $values[] = "('" . $conjunctId . "', '" . $violation['src'] . "', '" . $violation['tgt'] . "')";
                 }
                 $query .= implode(',', $values);
                 $db->Exe($query);
             } else {
                 Notifications::addLog("Conjunct '" . $conjunctId . "' broken", 'RuleEngine');
             }
             return $violations;
         }
     } catch (Exception $e) {
         Notifications::addError("While checking conjunct '" . $conjunctId . "': " . $e->getMessage());
     }
 }
示例#10
0
function createPage($smarty)
{
    if (!Users::loggedIn()) {
        Redirect::to('?page=login');
    }
    if (Input::exists()) {
        if (Input::get('action') === 'logout') {
            if (Users::loggedIn()) {
                Users::logout();
                Notifications::addSuccess('You have been logged out!');
                Redirect::to('?page=login');
            }
        }
        if (Input::get('action') === 'update_info') {
            $validation = new Validate();
            $validation->check($_POST, Config::get('validation/user_info'));
            if ($validation->passed()) {
                $data = array('name' => Input::get('name'), 'student_id' => Input::get('sid'), 'email' => Input::get('email'), 'phone' => Phone::formatNumber(Input::get('phone')));
                if (Users::currentUser()->update($data)) {
                    Notifications::addSuccess('User information updated!');
                } else {
                    Notifications::addError('Could not update user information.');
                }
            } else {
                Notifications::addValidationFail($validation->getErrors());
            }
        }
        if (Input::get('action') === 'update_pass') {
            $validation = new Validate();
            $validation->check($_POST, array_merge(Config::get('validation/set_password'), array('password_current' => array('name' => 'Current Password', 'required' => true, 'max' => 72))));
            if ($validation->passed()) {
                if (Hash::checkPassword(Input::get('password_current'), Users::currentData()->password)) {
                    if (Users::currentUser()->update(array('password' => Hash::hashPassword(Input::get('password'))))) {
                        Notifications::addSuccess('Password changed!');
                    } else {
                        Notifications::addError('Could not change password.');
                    }
                } else {
                    Notifications::addValidationFail('Invalid current password.');
                }
            } else {
                Notifications::addValidationFail($validation->getErrors());
            }
        }
        if (Input::get('action') === 'update_googleAuth') {
            $validation = new Validate();
            $validation->check($_POST, array('authcode' => array('name' => 'Authorisation Code', 'required' => true)));
            if ($validation->passed()) {
                if (Calendar::setCredentials(Input::get('authcode'))) {
                    Notifications::addSuccess('Google Calendar API authorized!');
                } else {
                    Notifications::addValidationFail('Could not authorize Google Calendar API.');
                }
            } else {
                Notifications::addValidationFail($validation->getErrors());
            }
        }
        if (Input::get('action') === 'update_calendarAssignmentsId') {
            $validation = new Validate();
            $validation->check($_POST, array('calid-ass' => array('name' => 'Assignments Calendar ID', 'required' => false), 'calid-ex' => array('name' => 'Exams Calendar ID', 'required' => false)));
            if ($validation->passed()) {
                $data = array('calendar_assignments' => Input::get('calid-ass'), 'calendar_exams' => Input::get('calid-ex'));
                if (Users::currentUser()->update($data)) {
                    Notifications::addSuccess('Calendar ID\'s updated!');
                } else {
                    Notifications::addValidationFail('Could not update calendar ID\'s.');
                }
            } else {
                Notifications::addValidationFail($validation->getErrors());
            }
        }
        if (Input::get('action') === 'delete_googleAuth') {
            Calendar::deleteCredentials();
        }
        if (Input::get('action') === 'update_calendarAssignments' && Users::isEditor()) {
            $assignments = DB::instance()->get(Users::safeSid() . "_assignments")->results();
            foreach ($assignments as $assignment) {
                Calendar::updateAssignment($assignment->id);
            }
        }
        if (Input::get('action') === 'create_database') {
            if (!UserTables::hasTables()) {
                UserTables::createTables();
                if (Users::isGuest()) {
                    Users::currentUser()->update(array('permission_group' => '2'));
                }
            }
        }
    }
    if (!Calendar::isReady()) {
        $smarty->assign('authUrl', Calendar::getAuthUrl());
    }
    $smarty->assign('authCode', Input::get('authcode'));
    $smarty->assign('calid_ass', Users::currentData()->calendar_assignments);
    $smarty->assign('calid_ex', Users::currentData()->calendar_exams);
    $smarty->assign('name', Users::currentData()->name);
    $smarty->assign('sid', Users::currentData()->student_id);
    $smarty->assign('email', Users::currentData()->email);
    $smarty->assign('phone', Users::currentData()->phone);
    return $smarty;
}
示例#11
0
 public static function checkAddressSyntax($CEPAddress)
 {
     Notifications::addLog('Email checkAddressSyntax for [' . $CEPAddress . ']', 'MESSAGING');
     if (!filter_var($CEPAddress, FILTER_VALIDATE_EMAIL) === false) {
         Notifications::addLog('Email address is syntactically correct.', 'MESSAGING');
         return $CEPAddress;
     }
     $message = 'Email adress [' . $CEPAddress . '] is syntactically incorrect';
     Notifications::addError($message);
     Notifications::addLog($message, 'MESSAGING');
     return $message;
 }
示例#12
0
 private static function pushNotification($SMSAddr, $message, $title = null, $url = null, $urltitle = null)
 {
     Notifications::addLog('UNTESTED !!! SMS[pushNotification' . ']; $SMSAddr=[' . $SMSAddr . ']; $message=[' . $message . ']; $title=[' . $title . ']; $url=[' . $url . ']; $urltitle=[' . $urltitle . ']', 'MESSAGING');
     /* Config params for SendSMS function of ExecEngine (using MessageBird.com)
      * Set the sender, could be a number (16 numbers) or letters (11 characters)
      * 
      */
     // Copy the following line to localSettings.php and provide settings
     // Config::set('sendSMSConfig', 'execEngine', array('username' => '', 'password' => '', 'sender' => ''));
     $config = Config::get('sendSMSConfig', 'msg_SMS');
     $username = $config['username'];
     $password = $config['password'];
     $sender = $config['sender'];
     Notifications::addLog('Username = '******'MESSAGING');
     // Set the Messagebird username and password, and create an instance of the MessageBird class
     $sms = new MessageBird($username, $password);
     // Set the sender, could be a number (16 numbers) or letters (11 characters)
     $sms->setSender($sender);
     // Add the destination mobile number.
     // This method can be called several times to add have more then one recipient for the same message
     $sms->addDestination($SMSAddr);
     //e.g. $sms->addDestination('31600000000');
     // Set an reference, optional
     // $sms->setReference('123456789');
     // Set a schedule date-time, optional
     // $sms->setTimestamp('2014-01-01 10:02');
     // Replace non GSM-7 characters by appropriate valid GSM-7 characters
     // $sms->setReplacechars(false);
     // If you want a dlr notification of the message send to another url then that you have set on the web site, you can use this parameter. Don't forget to set a reference!
     // $sms->setDlrUrl('http://www.example.com/dlr_url.php');
     // If $test is TRUE, then the message is not actually sent or scheduled, and there will be no credits deducted.
     Notifications::addLog("SMS testing is set to TRUE (messages are not actually sent)", 'MESSAGING');
     $sms->setTest(true);
     // Send the message to the destination(s)
     $sms->sendSms($message);
     if ($sms->getResponseCode() == "01") {
         Notifications::addSuccess('SMS message sent.');
     } else {
         Notifications::addError('SMS error: ' . $sms->getResponseMessage());
     }
     Notifications::addLog("SMS Response: " . $sms->getResponseMessage(), 'MESSAGING');
     Notifications::addLog("SMS Balance: " . $sms->getCreditBalance(), 'MESSAGING');
 }
示例#13
0
 private function doPatchRemove($patch, $interface, $before)
 {
     $pathArr = explode('/', $patch['path']);
     $tgtInterface = $interface;
     $tgtAtom = $this->id;
     // init of tgtAtom is this atom itself, will be changed in while statement
     // remove first empty arr element, due to root slash e.g. '/Projects/{atomid}/...'
     if (current($pathArr) == false) {
         array_shift($pathArr);
     }
     // was empty(current($pathArr)), but prior to PHP 5.5, empty() only supports variables, not expressions.
     // find the right subinterface
     while (count($pathArr)) {
         $interfaceId = array_shift($pathArr);
         // if path starts with '@' skip
         if (substr($interfaceId, 0, 1) == '@') {
             return;
         }
         // break function
         if ($interfaceId == '_sortValues_') {
             return;
         }
         // break function
         $tgtInterface = InterfaceObject::getSubinterface($tgtInterface, $interfaceId);
         $srcAtom = $tgtAtom;
         // set srcAtom, before changing tgtAtom
         $tgtAtom = array_shift($pathArr);
         // set tgtAtom
     }
     // Check if interface is editable
     if (!$tgtInterface->editable) {
         Notifications::addError($tgtInterface->label . " is not editable in interface '" . $interface->label . "'");
         return;
     }
     /******* Perform edit *********
      * Properties are always a 'replace', so no dealing with them here
      */
     /* Interface is a relation to an object
      */
     if ($tgtInterface->tgtConceptIsObject) {
         $this->database->editDelete($tgtInterface->relation, $tgtInterface->relationIsFlipped, $srcAtom, $tgtInterface->srcConcept, $tgtAtom, $tgtInterface->tgtConcept);
         /* Interface is a relation to a scalar (i.e. not an object)
          * Two situations:
          * 1) Interface is UNI -> not handled here, this is detected as a replace to ''
          * 2) Interface is not UNI -> $tgtAtom is index of array, so we have to get the corresponding value
          */
     } elseif (!$tgtInterface->tgtConceptIsObject) {
         try {
             $tgtAtom = JsonPatch::get($before, $patch['path']);
         } catch (Exception $e) {
             Notifications::addError($e->getMessage());
         }
         $this->database->editDelete($tgtInterface->relation, $tgtInterface->relationIsFlipped, $srcAtom, $tgtInterface->srcConcept, $tgtAtom, $tgtInterface->tgtConcept);
     }
 }
function ClearConcept($concept, $atom)
{
    if (func_num_args() != 2) {
        throw new Exception("Wrong number of arguments supplied for function ClearConcept(): " . func_num_args() . " arguments", 500);
    }
    Notifications::addLog("ClearConcept({$concept}, {$atom})", 'ExecEngine');
    try {
        $database = Database::singleton();
        $database->atomClearConcept($concept, $atom);
        return "Atom '{$atom}' removed as member from concept '{$concept}'";
    } catch (Exception $e) {
        Notifications::addError('ClearConcept: ' . $e->getMessage());
    }
}
示例#15
0
 private static function pushNotification($emailAddr, $message, $title = null, $url = null, $urltitle = null)
 {
     Notifications::addLog('Email[pushNotification' . ']; $emailAddr=[' . $emailAddr . ']; $message=[' . $message . ']; $title=[' . $title . ']; $url=[' . $url . ']; $urltitle=[' . $urltitle . ']', 'MESSAGING');
     // adapted from http://phpmailer.worxware.com/?pg=examplebgmail
     $config = Config::get('sendEmailConfig', 'msg_email');
     $from = $config['from'];
     $username = $config['username'];
     $password = $config['password'];
     Notifications::addLog('Email.php - Username = '******'MESSAGING');
     $mail = new PHPMailer();
     $mail->IsSMTP();
     // Set mailer to use SMTP
     // $mail->SMTPDebug = 1;
     $mail->Host = 'smtp.gmail.com';
     // Specify main and backup server
     $mail->SMTPSecure = 'ssl';
     // Enable encryption, 'ssl' also accepted
     $mail->Port = 465;
     $mail->SMTPAuth = true;
     // Enable SMTP authentication
     $mail->Username = $username;
     // SMTP username (for GMAIL)
     $mail->Password = $password;
     // SMTP password
     $mail->From = $from;
     $mail->FromName = 'Ampersand Prototype';
     $mail->AddAddress($emailAddr);
     // Add a recipient, e.g. $to = '*****@*****.**', 'Rieks Joosten'
     $mail->Subject = $title;
     //      $message = $message . 'optional URL';
     if ($url != '_NULL' && $url != '') {
         $mail->IsHTML(true);
         // make sure we send in HTML
         if ($urltitle != '_NULL' && $urltitle != '') {
             $message = '<p>' . $message . '</p><p><a href=' . $url . '>' . $urltitle . '</a></p>';
         } else {
             $message = $message . '<a' . $urltitle . '</a>';
         }
         Notifications::addLog('Email message refactored to: [' . $message . ']', 'MESSAGING');
     }
     $mail->Body = $message;
     $mail->WordWrap = 50;
     // Set word wrap to 50 characters
     if (!$mail->Send()) {
         Notifications::addError('Mailer Error: ' . $mail->ErrorInfo);
     } else {
         Notifications::addSuccess('Email message sent.');
     }
 }
示例#16
0
function datimeGT($gtRelation, $DateConcept, $srcAtom, $tgtAtom)
{
    Notifications::addLog("datimeGT({$gtRelation},{$DateConcept},{$srcAtom},{$tgtAtom})", 'ExecEngine');
    if (($dt1 = strtotime($srcAtom)) === false) {
        Notifications::addError("datimeGT: Illegal date {$dt1} specified in srcAtom (3rd arg): {$srcAtom}");
    }
    if (($dt2 = strtotime($tgtAtom)) === false) {
        Notifications::addError("datimeGT: Illegal date {$dt2} specified in tgtAtom (4th arg): {$tgtAtom}");
    }
    if ($dt1 == $dt2) {
        return;
    }
    if ($dt1 > $dt2) {
        InsPair($gtRelation, $DateConcept, $srcAtom, $DateConcept, $tgtAtom);
    } else {
        InsPair($gtRelation, $DateConcept, $tgtAtom, $DateConcept, $srcAtom);
    }
    return;
}