/**
  * 
  * 
  */
 function loadProcessor()
 {
     if ($this->isAuthenticatedPage()) {
         $processingFile = file_exists('config/authenticatedpages/' . $this->page . '.process.php');
         if ($processingFile) {
             ob_start();
             include 'config/authenticatedpages/' . $this->page . '.process.php';
             $processingContent = ob_get_contents();
             ob_end_clean();
         }
     } else {
         $pfile = 'config/pages/' . $this->page . '.process.php';
         $processingFile = file_exists($pfile);
         Inform8Context::getLogger()->log($ALL, 'Processing File: ' . $pfile . ', Exists: ' . $processingFile);
         if ($processingFile) {
             ob_start();
             include $pfile;
             $processingContent = ob_get_contents();
             ob_end_clean();
         }
     }
 }
Exemple #2
0
 function __construct()
 {
     $this->mysqli = Inform8Context::getDbConnection();
     $this->logger = Inform8Context::getLogger();
 }
Exemple #3
0
$joinField = Request::getSafeGetOrPost('joinField');
$otherJoinField = Request::getSafeGetOrPost('otherJoinField');
Inform8Context::getLogger()->log(0, 'jt:' . $joinTable);
Inform8Context::getLogger()->log(0, 'jf:' . $joinField);
Inform8Context::getLogger()->log(0, 'ojf:' . $otherJoinField);
$totalCount = 0;
if ($field == 'ALL' && $value == 'ALL') {
    $objs = $dao->getAll($limit, $start, $sidx, $sord);
    $totalCount = $dao->countAll();
    if ($totalCount > 0) {
        $totalPages = ceil($totalCount / $limit);
    } else {
        $totalPages = 0;
    }
} else {
    Inform8Context::getLogger()->log(0, 'jt:' . $joinTable);
    if ($joinTable != null && $joinTable != '') {
        $reqJoinIql = $joinTable . "IQL";
        $joinobs = IQL::select($joinTable, array('*'))->where(null, $joinField, '=', $value)->start($start)->limit($limit)->get();
        $totalCount = IQL::count($joinTable, '*')->where(null, $joinField, '=', $value)->get();
        if ($totalCount > 0) {
            $totalPages = ceil($totalCount / $limit);
        } else {
            $totalPages = 0;
        }
        $objs = array();
        $accesor = 'get' . $otherJoinField . 'AsObject';
        if ($joinobs != -1) {
            foreach ($joinobs as $join) {
                $objs[] = $join->{$accesor}();
            }
Exemple #4
0
<?php

/**
 * Copyright 2011 - Inform8
 * http://www.inform8.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License")
 * http://www.apache.org/licenses/LICENSE-2.0
 */
$authManager = Session::getInstance()->getAuthenticationManager();
if (Request::getSafeGetOrPost("logout") == 'true') {
    $authManager->reset();
}
if (!$authManager->isAuthenticated()) {
    //attempt login if set
    if (isset($_POST["login"]) && '1' == $_POST["login"]) {
        if ($authManager->performAuthentication()) {
            if ($session->getPostLoginCommand() != NULL) {
                header("Location: /" . $session->getPostLoginCommand() . '.htm');
                die;
            }
        } else {
            $authError = true;
            Inform8Context::getLogger()->log(BaseLogger::$DEBUG, "AuthError: " . json_encode($authManager->getAuthenticationError()));
        }
    }
}
?>
 
Exemple #5
0
 function send()
 {
     $templateRes = $this->parseTemplate();
     $storageSettingsDao = new JackStorageDao();
     $allSettings = $storageSettingsDao->getAll();
     $storageSettings = $allSettings[0];
     $storageFolder = $storageSettings->getStorageFolder();
     $errors = array();
     foreach ($this->to as $sendTo) {
         $mail = new PHPMailer();
         // defaults to using php "mail()"
         $mail->From = $this->getSettings()->getFromEmail();
         $mail->FromName = $this->getSettings()->getFromName();
         $mail->Subject = $templateRes['subject'];
         $mail->AddAddress($sendTo);
         $mail->MsgHTML($templateRes['html']);
         $mail->AltBody = $templateRes['text'];
         if ($this->getSettings()->useSMTP()) {
             $mail->IsSMTP();
             // telling the class to use SMTP
             $mail->SMTPDebug = 0;
             // enables SMTP debug information (for testing)
             $mail->Host = $this->getSettings()->getSmtpServer();
             $mail->Port = $this->getSettings()->getSmtpPort();
             if ($this->getSettings()->isSmtpAuthReqd()) {
                 $mail->SMTPAuth = true;
                 // enable SMTP authentication
                 $mail->Username = $this->getSettings()->getSmtpUsername();
                 // SMTP account username
                 $mail->Password = $this->getSettings()->getSmtpPassword();
                 // SMTP account password
             }
         } else {
             $mail->IsMail();
         }
         $templateFiles = $this->template->getEmbeddableFiles();
         if (isset($templateFiles) && is_array($templateFiles)) {
             foreach ($templateFiles as $afile) {
                 $mail->AddEmbeddedImage(StaticConfig::getStorageLocation() . '/' . $afile->getFileName(), $afile->getName());
             }
         }
         $attachFiles = $this->template->getAttachmentFiles();
         if (isset($attachFiles) && is_array($attachFiles)) {
             foreach ($attachFiles as $afile) {
                 $mail->AddAttachment(StaticConfig::getStorageLocation() . '/' . $afile->getFileName(), $afile->getName());
             }
         }
         if (!$mail->Send()) {
             $errors[] = 'Failed to send email to: ' . $sendTo;
         }
         Inform8Context::getLogger()->log(BaseLogger::$DEBUG, 'Sent email to: ' . $sendTo);
         set_time_limit(30);
     }
     return $errors;
 }