Exemple #1
0
 public function __construct(&$dataSource, $type = self::STRING)
 {
     parent::__construct();
     $this->dataSource = $dataSource;
     $this->type = $type;
     $this->log = Log4PHP::logFactory(__CLASS__);
 }
Exemple #2
0
 /**
  * Initializes the system. This is called by the Autoloader
  * @param string $classDirectory You can pass in the name of the classes folder for the program to scan.
  */
 public static function init($classDirectory = null)
 {
     self::$log = Log4PHP::logFactory(__CLASS__);
     if ($classDirectory == null) {
         $classDirectory = dirname(__FILE__);
     }
     self::$defaultInstance = new ClassLocator($classDirectory);
 }
Exemple #3
0
 /**
  * Set up the statics, sets up the logging level in one place.
  *
  * If you want to change this throughout this class, you can adjust here.
  * @since 1.0
  * @return void
  */
 public static function init()
 {
     self::$log = Log4PHP::logFactory(__CLASS__);
     // Sets up the logging level in one place
     // If you want to change this throughout this class, you can adjust here
     self::$queryLoggingFunction = [self::$log, 'debug'];
     self::$queryLoggingLevel = Log4PHP::DEBUG;
     self::$queryLogFlag = self::$log->isDisplayed(self::$queryLoggingLevel);
     self::$errorLoggingFunction = [self::$log, 'error'];
     self::$errorLoggingLevel = Log4PHP::ERROR;
 }
Exemple #4
0
 public static function init()
 {
     self::$log = Log4PHP::logFactory(__CLASS__);
     self::$encryptionOff = Cfg::get('encrypt_override');
     if (!function_exists('mcrypt_get_key_size')) {
         self::$encryptionOff = true;
     }
     // The IV is session specific. See if the key has been set in the session
     if (isset($_SESSION[G::SESS][G::CRYPTO])) {
         self::$randKey = md5($_SESSION[G::SESS][G::CRYPTO]);
     } else {
         self::$randKey = md5(self::RAND_KEY);
         self::$log->warn('Using the default key for crypto');
     }
     if (!self::$encryptionOff) {
         self::$algortithm = Cfg::get('quercus', false) ? MCRYPT_TRIPLEDES : MCRYPT_RIJNDAEL_256;
     }
     self::$instance = new Cryptography(self::$randKey);
 }
Exemple #5
0
 public static function init()
 {
     self::$log = \Jackbooted\Util\Log4PHP::logFactory(__CLASS__);
 }
Exemple #6
0
 public static function init()
 {
     self::$log = Log4PHP::logFactory(__CLASS__);
 }
Exemple #7
0
 public static function init()
 {
     self::$log = Log4PHP::logFactory(__CLASS__);
     self::$dao = new AlertsDAO();
 }
Exemple #8
0
 public static function init()
 {
     self::$log = Log4PHP::logFactory(__CLASS__);
     self::$crypto = new Cryptography();
 }
Exemple #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;
 }
Exemple #10
0
 /**
  * load set up the static variables of the class
  * (still waiting on static initialisation from PHP)
  * @param string $classesDir
  */
 public static function init()
 {
     spl_autoload_register(__CLASS__ . '::autoload');
     self::$log = Log4PHP::logFactory(__CLASS__);
 }
Exemple #11
0
 public static function init()
 {
     self::$log = Log4PHP::logFactory(__CLASS__);
     self::$knownFields = ['XDEBUG_SESSION_START', 'XDEBUG_PROFILE'];
 }
Exemple #12
0
 private static function setUpLogging()
 {
     $errorLogLocation = ini_get('error_log');
     if (!isset($errorLogLocation) || $errorLogLocation == false) {
         ini_set('error_log', '/dev/stdout');
     }
     $inDevMode = self::get('debug');
     //$inDevMode = true;
     Log4PHP::init($inDevMode ? Log4PHP::DEBUG : Log4PHP::ERROR);
     if (self::get('FireBug') && $inDevMode) {
         FB::setOptions(['useNativeJsonEncode' => false]);
         ob_start();
         Log4PHP::setOutput(Log4PHP::FIREBUG);
     } else {
         if (Cfg::get('quercus', false)) {
             Log4PHP::setOutput(Log4PHP::FILE);
         } else {
             Log4PHP::setOutput(Log4PHP::FILE);
         }
     }
     //Log4PHP::setOutput ( Log4PHP::SCREEN );
     self::$log = Log4PHP::logFactory(__CLASS__);
 }
Exemple #13
0
 /**
  * @return void
  */
 public static function init()
 {
     $className = __CLASS__;
     self::$log = Log4PHP::logFactory($className);
 }