Example #1
0
 /**
  * The options are:
  * - debug_level: level of debug if it's not specified it's set by debugObject to DEBUG_DEFAULT_LEVEL
  * - to: an array of mail addresses which are the recipients of the mail. It must be set
  * - from: mail address that sends the mail. If it's not set 'noreplay@$_SERVER['SERVER_NAME']' value will be used
  *
  * @param array $options
  * @throws BadMethodCallException
  * @throws DomainException
  */
 public function __construct($options = null)
 {
     if (!isset($options['to'])) {
         throw new BadMethodCallException('The recipients must be set in order to send the mail', E_USER_ERROR);
     }
     if (!is_array($options['to'])) {
         $options['to'] = array($options['to']);
         trigger_error('Recipients must be a valid array', E_USER_NOTICE);
     }
     for ($i = 0, $tot = count($options['to']); $i < $tot; $i++) {
         $to = $this->_validate_mail($options['to'][$i]);
         if (is_null($to)) {
             unset($options['to'][$i]);
         } else {
             $options['to'][$i] = $to;
         }
     }
     $this->_to = $options['to'];
     if (empty($this->_to)) {
         trigger_error('No recipients is a valid mail address', E_USER_WARNING);
     }
     $this->_from = $this->_validate_mail($options['from']);
     if (is_null($this->_from)) {
         $this->_from = DEBUG_DEFAULT_MAIL_FROM;
     }
     parent::__construct($options);
     $this->_logs = array();
     $this->_extra_headers = 'MIME-Version: 1.0' . PHP_EOL . 'Message-ID: <msg' . md5(time()) . '@' . $_SERVER['SERVER_NAME'] . '>' . PHP_EOL . 'X-Mailer: DebugMail PHP v' . phpversion() . PHP_EOL . 'Date: ' . date('r', time()) . PHP_EOL . 'From: ' . $this->_from . PHP_EOL . 'Content-Type: text/plain; charset=UTF-8' . PHP_EOL;
 }
Example #2
0
 /**
  * The possible options are:
  * - debug_level: level of debug if it's not specified it's set by debugObject to DEBUG_DEFAULT_LEVEL
  * - logfile (string): path to the logging file (Default: './debug.log').
  * - append (bool): if true new debug information are appended at the end of the file;
  *   if it's false the file is deleted and recreated each time (Default: true).
  *
  * @param array $options
  */
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->_logfile = isset($options['logfile']) ? $options['logfile'] : DEBUG_DEFAULT_LOGFILE;
     $this->_append = isset($options['append']) ? filter_var($options['append'], FILTER_VALIDATE_BOOLEAN, array('options' => array('default' => DEBUG_DEFAULT_LOG_APPEND))) : DEBUG_DEFAULT_LOG_APPEND;
     if (!$this->_append) {
         $fd = @fopen($this->_logfile, 'w');
         fclose($fd);
     }
 }
 /**
  * The possible options are:
  * - debug_level: level of debug if it's not specified it's set by debugObject to DEBUG_DEFAULT_LEVEL
  * - max_depth (int): maximum depth to traverse objects and arrays (Default 10).
  * - show_line (bool): include File and Line information in message (Default true).
  *
  * @param array $options
  */
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->_max_depth = isset($options['max_depth']) ? filter_var($options['max_depth'], FILTER_VALIDATE_INT, array('options' => array('default' => 10, 'min_range' => 0))) : 10;
     $this->_show_line = isset($options['show_line']) ? filter_var($options['show_line'], FILTER_VALIDATE_BOOLEAN, array('options' => array('default' => true))) : true;
     $FBoptions = array('maxObjectDepth' => $this->_max_depth, 'maxArrayDepth' => $this->_max_depth, 'maxDepth' => $this->_max_depth, 'useNativeJsonEncode' => true, 'includeLineNumbers' => $this->_show_line);
     FB::setEnabled(true);
     FB::setOptions($FBoptions);
     $this->msg('Debug Console started at ' . date('c', time()) . ' from ' . gethostbyaddr($_SERVER['REMOTE_ADDR']), DEBUG_INFO);
 }
Example #4
0
 /**
  * The options are:
  * - debug_level: level of debug if it's not specified it's set by debugObject to DEBUG_DEFAULT_LEVEL
  * - dsn: the Data Source Name to connect to a database through PEAR::MDB2 {@link http://pear.php.net/manual/en/package.database.mdb2.intro-dsn.php}.
  *   The DSN must be provided as an associative array or as a string.
  *   The array format is preferred, since it doesn't require a further parsing step (see the {@link http://pear.php.net/manual/en/package.database.mdb2.intro-connect.php Connecting
  *   chapter} for an example). The string format of the supplied DSN is in its fullest form:
  *   phptype(dbsyntax)://username:password@protocol+hostspec/database?option=value 
  *   Examples:
  *   $dsn =  'mysqli://*****:*****@localhost/masterdb'
  *   $dsn = array(
  *		'phptype'  => 'mysqli',
  *		'username' => 'themaster',
  *		'password' => 'thepowerofthepower',
  *		'hostspec' => 'localhost',
  *		'database' => 'masterdb'
  *	); 
  * - mdb2_options: can contain runtime configuration settings for the MDB2 package (see the {@link http://pear.php.net/manual/en/package.database.mdb2.intro-connect.php Connecting} for more details).
  * - table: the name of the table where debug logs are stored. 
  *
  * @param array $options
  * @throws BadMethodCallException
  * @throws exceptions
  */
 public function __construct($options = null)
 {
     $this->_dsn = isset($options['dsn']) ? $options['dsn'] : DEBUG_DEFAULT_MYSQL_DSN;
     $this->_table = isset($options['table']) ? $options['table'] : DEBUG_DEFAULT_MYSQL_TABLE;
     $this->_mdb2_options = isset($options['mdb2_options']) ? $options['mdb2_options'] : array();
     parent::__construct($options);
     $this->_mdb2 =& MDB2::factory($this->_dsn, $this->_mdb2_options);
     if (PEAR::isError($this->_mdb2)) {
         throw new exceptions($this->_mdb2->getMessage(), $this->_mdb2->getCode());
     }
 }
Example #5
0
 /**
  * The possible options are:
  * - debug_level: level of debug if it's not specified it's set by debugObject to DEBUG_DEFAULT_LEVEL
  * - logfile (string): path to the logging file (Default: @see debugCsv::DEFAULT_DEBUG_CSV_PATH).
  * - append (bool): if true new debug information are appended at the end of the file;
  *   if it's false the file is deleted and recreated each time (Default: true).
  * - delimiter (char): sets the field delimiter (one character only). Default: @see DEBUG_DEFAULT_CSV_DELIMITER.  
  * - enclosure (char): the optional enclosure parameter sets the field enclosure (one character only). Default: @see DEBUG_DEFAULT_CSV_ENCLOSURE.
  * @param array $options
  */
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->_logfile = !isset($options['logfile']) ? $options['logfile'] : DEBUG_DEFAULT_LOGFILE;
     $this->_append = filter_var($options['append'], FILTER_VALIDATE_BOOLEAN, array('options' => array('default' => DEBUG_DEFAULT_LOG_APPEND)));
     $this->_delimiter = !isset($options['delimiter']) || !is_char($options['delimiter']) ? DEBUG_DEFAULT_CSV_DELIMITER : $options['delimiter'];
     $this->_enclosure = !isset($options['enclosure']) || !is_char($options['enclosure']) ? DEBUG_DEFAULT_CSV_ENCLOSURE : $options['enclosure'];
     if (!$_append) {
         $fd = @fopen($this->_logfile, 'w');
         fclose($fd);
     }
 }
Example #6
0
 /**
  * The possible options are:
  * - debug_level: level of debug if it's not specified it's set by debugObject to DEBUG_DEFAULT_LEVEL
  *
  * @param array $options
  */
 public function __construct($options = null)
 {
     parent::__construct($options);
 }