Example #1
0
 function __construct($ser = NULL, $user = NULL)
 {
     parent::__construct();
     //echo ( "<br>function LoadPrefs ( $ser=NULL, $user=NULL ) {" );
     $this->prefs = new Preferences();
     // Make sure that we have the correct server
     $server = $ser == NULL ? Cfg::get("server") : $ser;
     // Load up thi s domain information from
     // the user information If there is no information
     // in the user, check the alternate domain
     $sql = "SELECT * FROM tblUser WHERE ";
     if ($user != NULL) {
         $sql .= "fldUser='******'";
     } else {
         if ($server != NULL) {
             $sql .= "'{$server}' LIKE fldDomain";
         }
     }
     $sql .= " LIMIT 1";
     if ($this->_loadUserTable($sql)) {
         $this->_loadGroupTable();
     } else {
         $sql = "SELECT * FROM tblUser WHERE '{$server}' LIKE fldAltDomain LIMIT 1";
         if ($this->_loadUserTable($sql)) {
             // If it is in the alternate domain the
             // use these preferences
             $server = $this->prefs->userPrefs["fldDomain"];
             Cfg::set('server', $server);
             $this->_loadGroupTable();
         }
     }
 }
Example #2
0
 public function __construct($classDirectory = null)
 {
     parent::__construct();
     $this->classesDir = $classDirectory;
     $this->locatorFile = PHPExt::getTempDir() . '/ClassLocator' . md5(var_export($classDirectory, true)) . '.ser';
     self::$log->trace("Locator File: {$this->locatorFile}");
 }
Example #3
0
 public function __construct(&$dataSource, $type = self::STRING)
 {
     parent::__construct();
     $this->dataSource = $dataSource;
     $this->type = $type;
     $this->log = Log4PHP::logFactory(__CLASS__);
 }
Example #4
0
 /**
  *
  * @param string $l_key Key to use for encryption
  */
 public function __construct($l_key = null)
 {
     parent::__construct();
     if (self::$encryptionOff) {
         return;
     }
     $plainTextKey = $l_key == null ? self::$randKey : $l_key;
     $keySize = mcrypt_get_key_size(self::$algortithm, MCRYPT_MODE_ECB);
     while (strlen($plainTextKey) < $keySize) {
         $plainTextKey .= $plainTextKey;
     }
     $plainTextKey = substr($plainTextKey, 0, $keySize);
     $this->blockLength = mcrypt_get_block_size(self::$algortithm, MCRYPT_MODE_ECB);
     $this->td = mcrypt_module_open(self::$algortithm, '', MCRYPT_MODE_ECB, '');
     $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($this->td), MCRYPT_RAND);
     mcrypt_generic_init($this->td, $plainTextKey, $iv);
 }
Example #5
0
 /**
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     if (Cfg::get('jb_audit_tables', true)) {
         $this->auditTable();
     }
     if (!isset($this->orm[0])) {
         $this->orm[0] = $this->primaryKey;
     }
     if (!isset($this->orm['id'])) {
         $this->orm['id'] = $this->primaryKey;
     }
     if (!isset($this->titles[$this->primaryKey])) {
         $this->titles[$this->primaryKey] = 'ID';
     }
     // Could automatically populate the titles based on the column names
     // But at this stage it is "YAGNI" reference CRUD::jbCol2Title
 }
Example #6
0
 /**
  * Construct a table in memory.
  *
  * @param object $resultSet Pass n result set from PDO query.
  *
  * @since 1.0
  */
 public function __construct($dbh, $qry, $params = null, $fetch = DB::FETCH_BOTH)
 {
     parent::__construct();
     $this->fetch = $fetch;
     if (is_object($dbh)) {
         $this->table = $dbh->fetchAll($fetch);
     } else {
         $cacheKey = $dbh . ' ' . $qry . ' ' . serialize($params);
         if (($cacheValue = self::$dataCache->get($cacheKey)) !== false) {
             $this->table = $cacheValue;
         } else {
             if (($resultSet = DB::query($dbh, $qry, $params)) === false) {
                 return;
             }
             $this->table = $resultSet->fetchAll($fetch);
             self::$dataCache->set($cacheKey, $this->table);
         }
     }
 }
Example #7
0
 public function __construct()
 {
     parent::__construct();
 }
Example #8
0
 public function __construct(DAO $dao, $data)
 {
     parent::__construct();
     $this->dao = $dao;
     $this->data = $this->dao->objToRel($data);
 }
Example #9
0
 /**
  * Create the CRUD Object.
  * @param string $tableName The name of the table
  * @param array $extraArgs This is the properties that the CRUD will use to display/populate the database.
  * <pre>
  * $props = array ( 'primaryKey' => 'id', // Optional, if not supplied will be calculated.
  *                                        // Need to supply if the primary key is not simple column name
  *                  'db' => 'mydb',       // Optional, Name of the database. If not supplied defaults to DB::DEF
  *                                        // Database must be set up in the configuration
  *                  'where' => array ( 'pid' => 5 ),
  *                                        // Optional, List of conditions for the rows that we are looking for.
  *                                        // This would be used when looking for foreign key. These values will
  *                                        // be automatically inserted in new rows
  *                  'userCols' => array ( 'Mapping' => array ( $this, 'managePrivilegesCallBack' ) ),
  *                                        // This is a list of additional columns that will be added to the CRUD. These
  *                                        // will display the column using the title that you have suggested and
  *                                        // Then call the passed method.
  *                                        // call_user_func_array ( $col, array ( $idx, $row[$this->primaryKey] ) )
  *                                        // Passes back the row number and the primary key for this row
  *                                        // Then displays the html that the call back function generates
  *                  'canDelete' => true,  // Optional default: true. If you do not want user to delete rows set to false
  *                  'canUpdate' => true,  // Optional default: true. If you do not want user to update rows set to false
  *                  'canInsert' => true,  // Optional default: true. If you do not want user to insert rows set to false
  *                  'topPager' => true,   // Optional default: true. If you do not want pagination at top, set to false
  *                  'bottomPager' => true,// Optional default: true. If you do not want pagination at bottom, set to false
  *                  'suffix' => '_1',     // Optional default: current CRUD invocation number.
  *                                        // Useful if you have multiple CRUDs on one page. This is the suffix that
  *                                        // is attached to the form variables
  *                  'formAction' => 'view.php?ID=10',
  *                                        // Optional default to ?. On submirt this will return to the current page
  *                  'insDefaults' => array ( 'timestamp' => time() ),
  *                                        // Optional. If there are dfefaults that you wat inserted when the CRUD
  *                                        // inserts a row then you can list them here
  *                  'displayRows' =>10,   // Optional. Sets the number of rows that can be displayed
  *                  'nullsEmpty'  =>false,  // Optional. If this is true then it will put in nulls if the variable is empty
  *                  'dbType'      =>'mysql',// Optional. Tels the system if this is oracle, sqlite or mysql database
  *
  *                  Sort column
  *                  'colSort'      =>'fldStartTime',// Optional. Sets an initial sort column
  *                  'colSortOrder' =>'DESC',// Optional. Sets the direction of the sort column
  *                );
  * </pre>
  */
 public function __construct($tableName, $extraArgs = [])
 {
     parent::__construct();
     $this->log = Log4PHP::logFactory(__CLASS__);
     $this->tableName = $tableName;
     $this->primaryKey = isset($extraArgs['primaryKey']) ? $extraArgs['primaryKey'] : null;
     $this->db = isset($extraArgs['db']) ? $extraArgs['db'] : DB::DEF;
     $this->where = isset($extraArgs['where']) ? $extraArgs['where'] : [];
     $this->extraCols = isset($extraArgs['userCols']) ? $extraArgs['userCols'] : [];
     $this->canDelete = isset($extraArgs['canDelete']) ? $extraArgs['canDelete'] : true;
     $this->canUpdate = isset($extraArgs['canUpdate']) ? $extraArgs['canUpdate'] : true;
     $this->canInsert = isset($extraArgs['canInsert']) ? $extraArgs['canInsert'] : true;
     $this->topPage = isset($extraArgs['topPager']) ? $extraArgs['topPager'] : true;
     $this->bottomPage = isset($extraArgs['bottomPager']) ? $extraArgs['bottomPager'] : true;
     $this->suffix = isset($extraArgs['suffix']) ? $extraArgs['suffix'] : '_' . Invocation::next();
     $this->formAction = isset($extraArgs['formAction']) ? $extraArgs['formAction'] : '?';
     $this->insDefaults = isset($extraArgs['insDefaults']) ? $extraArgs['insDefaults'] : [];
     $this->nullsEmpty = isset($extraArgs['nullsEmpty']) ? $extraArgs['nullsEmpty'] : false;
     $this->dbType = isset($extraArgs['dbType']) ? $extraArgs['dbType'] : DB::driver($this->db);
     $this->action = self::ACTION . $this->suffix;
     $this->delTag = 'D' . $this->suffix;
     $this->updTag = 'U' . $this->suffix;
     $this->gridTag = 'G' . $this->suffix;
     $this->submitId = 'S' . $this->suffix;
     $pageProps = ['suffix' => self::SUFFIX];
     $this->paginator = new Paginator($pageProps);
     $colProps = ['suffix' => self::SUFFIX];
     if (isset($extraArgs['colSort'])) {
         $colProps['init_column'] = $extraArgs['colSort'];
     }
     if (isset($extraArgs['colSortOrder'])) {
         $colProps['init_order'] = $extraArgs['colSortOrder'];
     }
     $this->columnator = new Columnator($colProps);
     $this->resp = new Response();
     if (isset($extraArgs['displayRows'])) {
         $this->paginator->setPageSize($extraArgs['displayRows']);
     }
     if (!$this->getTableMetaData()) {
         return;
     }
     $this->setupDefaultStyle();
     if ($this->paginator->getRows() <= 0) {
         $this->paginator->setRows($this->getRowCount());
     }
     $this->copyVarsFromRequest(Columnator::navVar(self::SUFFIX));
     $this->copyVarsFromRequest(Paginator::navVar(self::SUFFIX));
     $this->copyVarsFromRequest(WebPage::ACTION);
     $this->ok = true;
 }
Example #10
0
 /**
  * Pass in the class name to construct.
  *
  * If the class is not passed in the
  * constructor it will attempt to figure it out. It is not recommended to call the
  * constructor directly. You are better using Log4PHP::logFactory ( $className )
  * This will cache the loggers so that there is only ever one per class.
  *
  * @param string $c Class name.
  *
  * @since 1.0
  */
 public function __construct($c = null)
 {
     parent::__construct();
     if ($c == null) {
         $stack = debug_backtrace();
         $pi = pathinfo($stack[1]['file']);
         $c = $pi['filename'];
     }
     $this->className = $c;
     $this->classErrorLevel = self::$logLevel;
     $this->classOutputDevice = self::$outputDevice;
 }
Example #11
0
 /**
  * Creates the Validation object.
  *
  * Requires the form name.
  *
  * @param string $formName The name of the form that will be validated.
  * @param string $suffix The suffix will give the unique identifier if there are a number of
  * validators on a page. The uniquie suffix is automatically generated based on number of
  * invokations of the form. This does not work on ajax late generated forms
  * so for ajax, supply a unique suffix
  *
  * @since 1.0
  */
 public function __construct($formName, $suffix = '')
 {
     parent::__construct();
     if ($suffix == '') {
         $suffix = Invocation::next();
     }
     $this->formName = $formName;
     $this->id = '_' . $suffix;
     $this->setUpJavaScriptFunctions();
 }
Example #12
0
 public function __construct($msg, $displayStart = true)
 {
     parent::__construct();
     $this->msg = $msg;
     $this->start($displayStart);
 }
Example #13
0
 public function __construct($name, $size = 0)
 {
     parent::__construct();
     $this->maxSize = $size;
     $this->name = $name;
 }