/** * Constructor * * @param $table string the name of the database table * * @param $keycolumn mixed string with name of key column, or array of * strings if the table has a primary key of more than one column * * @param $dbh object database connection object * * @param $validator mixed function or method used to validate * each new value, called with three parameters: the name of the * field/column that is changing, a reference to the new value and * a reference to this object * */ function __construct($table, $keycolumn, &$dbh, $validator = null) { parent::__construct('DB_Error'); $this->_table = $table; $this->_keycolumn = $keycolumn; $this->_dbh = $dbh; $this->_readonly = false; $this->_validator = $validator; }
/** * * * @version 02/11/22 * @author Wolfram Kriesing <*****@*****.**> * @return void * @access public */ function I18N_Format($locale) { parent::__construct(); $this->_locale = $locale; //FIXXME catch locales that we dont have a class for yet, and use default class, which // translates using google or something ... if (include_once "I18N/Common/{$locale}.php") { $class = "I18N_Common_{$locale}"; $this->_localeObj = new $class(); } }
/** * * @param string Name of container class * @param array Array with container class options */ function Cache($container, $container_options = '') { parent::__construct(); $container = strtolower($container); $container_class = 'Cache_Container_' . $container; $container_classfile = 'Cache/Container/' . $container . '.php'; include_once $container_classfile; $this->container = new $container_class($container_options); }
/** * PEAR_Command_Common constructor. * * @access public */ function PEAR_Command_Common(&$ui, &$config) { parent::__construct(); $this->config =& $config; $this->ui =& $ui; }
/** * PEAR_Registry constructor. * * @param string (optional) PEAR install directory (for .php files) * @param PEAR_ChannelFile PEAR_ChannelFile object representing the PEAR channel, if * default values are not desired. Only used the very first time a PEAR * repository is initialized * @param PEAR_ChannelFile PEAR_ChannelFile object representing the PECL channel, if * default values are not desired. Only used the very first time a PEAR * repository is initialized * * @access public */ function __construct($pear_install_dir = PEAR_INSTALL_DIR, $pear_channel = false, $pecl_channel = false, $pear_metadata_dir = '') { parent::__construct(); $this->setInstallDir($pear_install_dir, $pear_metadata_dir); $this->_pearChannel = $pear_channel; $this->_peclChannel = $pecl_channel; $this->_config = false; }
/** * Constructor. * * @param string file to read user-defined options from * @param string file to read system-wide defaults from * @param bool determines whether a registry object "follows" * the value of php_dir (is automatically created * and moved when php_dir is changed) * @param bool if true, fails if configuration files cannot be loaded * * @access public * * @see PEAR_Config::singleton */ function __construct($user_file = '', $system_file = '', $ftp_file = false, $strict = true) { parent::__construct(); PEAR_Installer_Role::initializeConfig($this); $sl = DIRECTORY_SEPARATOR; if (empty($user_file)) { if (OS_WINDOWS) { $user_file = PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.ini'; } else { $user_file = getenv('HOME') . $sl . '.pearrc'; } } if (empty($system_file)) { if (OS_WINDOWS) { $system_file = PEAR_CONFIG_SYSCONFDIR . $sl . 'pearsys.ini'; } else { $system_file = PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.conf'; } } $this->layers = array_keys($this->configuration); $this->files['user'] = $user_file; $this->files['system'] = $system_file; if ($user_file && file_exists($user_file)) { $this->pushErrorHandling(PEAR_ERROR_RETURN); $this->readConfigFile($user_file, 'user', $strict); $this->popErrorHandling(); if ($this->_errorsFound > 0) { return; } } if ($system_file && file_exists($system_file)) { $this->mergeConfigFile($system_file, false, 'system', $strict); if ($this->_errorsFound > 0) { return; } } if (!$ftp_file) { $ftp_file = $this->get('remote_config'); } if ($ftp_file && defined('PEAR_REMOTEINSTALL_OK')) { $this->readFTPConfigFile($ftp_file); } foreach ($this->configuration_info as $key => $info) { $this->configuration['default'][$key] = $info['default']; } $this->_registry['default'] = new PEAR_Registry($this->configuration['default']['php_dir']); $this->_registry['default']->setConfig($this); $this->_regInitialized['default'] = false; //$GLOBALS['_PEAR_Config_instance'] = &$this; }
/** * Constructs a new Net_Whois object * * @access public */ function Net_Whois() { parent::__construct(); $this->setPort(); $this->setAuthoritative(); $this->setTimeout(); }
function __construct(&$config) { parent::__construct(); $this->config =& $config; $this->_registry =& $this->config->getRegistry(); }
/** * Net_LDAP2 constructor * * Sets the config array * * Please note that the usual way of getting Net_LDAP2 to work is * to call something like: * <code>$ldap = Net_LDAP2::connect($ldap_config);</code> * * @param array $config Configuration array * * @access protected * @return void * @see $_config */ public function __construct($config = array()) { parent::__construct('Net_LDAP2_Error'); $this->setConfig($config); }
/** * Constructor. * * @param boolean $auto Automatically start timer * * @access public */ function Benchmark_Timer($auto = false) { $this->auto = $auto; if ($this->auto) { $this->start(); } parent::__construct(); }
/** * Constructor * * @param mixed $options array containing options for the serialization * * @access public */ function XML_Serializer($options = null) { parent::__construct(); if (is_array($options)) { $this->options = array_merge($this->_defaultOptions, $options); } else { $this->options = $this->_defaultOptions; } }
/** * Constructor. * * @param boolean $auto * @access public */ public function __construct($auto = FALSE) { $this->auto = $auto; if ($this->auto) { $this->start(); } parent::__construct(); }
/** * Constructor * * @param resource $search Search result identifier * @param Net_LDAP2|resource $ldap Net_LDAP2 object or just a LDAP-Link resource * @param array $attributes (optional) Array with searched attribute names. (see {@link $_searchedAttrs}) * * @access public */ public function __construct($search, $ldap, $attributes = array()) { parent::__construct('Net_LDAP2_Error'); $this->setSearch($search); if ($ldap instanceof Net_LDAP2) { $this->_ldap = $ldap; $this->setLink($this->_ldap->getLink()); } else { $this->setLink($ldap); } $this->_errorCode = @ldap_errno($this->_link); if (is_array($attributes) && !empty($attributes)) { $this->_searchedAttrs = $attributes; } }
/** * Archive_Tar Class constructor. This flavour of the constructor only * declare a new Archive_Tar object, identifying it by the name of the * tar file. * If the compress argument is set the tar will be read or created as a * gzip or bz2 compressed TAR file. * * @param string $p_tarname The name of the tar archive to create * @param string $p_compress can be null, 'gz', 'bz2' or 'lzma2'. This * parameter indicates if gzip, bz2 or lzma2 compression * is required. For compatibility reason the * boolean value 'true' means 'gz'. * * @return bool */ public function __construct($p_tarname, $p_compress = null) { parent::__construct(); $this->_compress = false; $this->_compress_type = 'none'; if ($p_compress === null || $p_compress == '') { if (@file_exists($p_tarname)) { if ($fp = @fopen($p_tarname, "rb")) { // look for gzip magic cookie $data = fread($fp, 2); fclose($fp); if ($data == "‹") { $this->_compress = true; $this->_compress_type = 'gz'; // No sure it's enought for a magic code .... } elseif ($data == "BZ") { $this->_compress = true; $this->_compress_type = 'bz2'; } elseif (file_get_contents($p_tarname, false, null, 1, 4) == '7zXZ') { $this->_compress = true; $this->_compress_type = 'lzma2'; } } } else { // probably a remote file or some file accessible // through a stream interface if (substr($p_tarname, -2) == 'gz') { $this->_compress = true; $this->_compress_type = 'gz'; } elseif (substr($p_tarname, -3) == 'bz2' || substr($p_tarname, -2) == 'bz') { $this->_compress = true; $this->_compress_type = 'bz2'; } else { if (substr($p_tarname, -2) == 'xz') { $this->_compress = true; $this->_compress_type = 'lzma2'; } } } } else { if ($p_compress === true || $p_compress == 'gz') { $this->_compress = true; $this->_compress_type = 'gz'; } else { if ($p_compress == 'bz2') { $this->_compress = true; $this->_compress_type = 'bz2'; } else { if ($p_compress == 'lzma2') { $this->_compress = true; $this->_compress_type = 'lzma2'; } else { $this->_error("Unsupported compression type '{$p_compress}'\n" . "Supported types are 'gz', 'bz2' and 'lzma2'.\n"); return false; } } } } $this->_tarname = $p_tarname; if ($this->_compress) { // assert zlib or bz2 or xz extension support if ($this->_compress_type == 'gz') { $extname = 'zlib'; } else { if ($this->_compress_type == 'bz2') { $extname = 'bz2'; } else { if ($this->_compress_type == 'lzma2') { $extname = 'xz'; } } } if (!extension_loaded($extname)) { PEAR::loadExtension($extname); } if (!extension_loaded($extname)) { $this->_error("The extension '{$extname}' couldn't be found.\n" . "Please make sure your version of PHP was built " . "with '{$extname}' support.\n"); return false; } } }
/** * Constructor * * @access public */ public function __construct() { // Init PEAR. parent::__construct(); }
/** * PEAR_Command_Common constructor. * * @access public */ function __construct(&$ui, &$config) { parent::__construct(); $this->config =& $config; $this->ui =& $ui; }
/** * This constructor calls <kbd>$this->PEAR('DB_Error')</kbd> * * @return void */ function __construct() { parent::__construct('DB_Error'); }
/** * Constructor * * Generates a random challenge * @return void */ public function __construct() { parent::__construct(); $this->generateChallenge(); }
/** * PEAR_Common constructor * * @access public */ function __construct() { parent::__construct(); $this->config =& PEAR_Config::singleton(); $this->debug = $this->config->get('verbose'); }
/** * Constructor */ public function __construct($db_object) { $this->db_object = $db_object; parent::__construct('DB_Error'); $this->db_object->setOption('seqcol_name', 'id'); $this->db_object->setOption('result_wrap_class', 'DB_result'); $this->phptype = $this->db_object->phptype; $this->connection = $this->db_object->getConnection(); $this->dsn = $this->db_object->getDSN(); }
/** * PEAR_Registry constructor. * * @param string (optional) PEAR install directory (for .php files) * @param PEAR_ChannelFile PEAR_ChannelFile object representing the PEAR channel, if * default values are not desired. Only used the very first time a PEAR * repository is initialized * @param PEAR_ChannelFile PEAR_ChannelFile object representing the PECL channel, if * default values are not desired. Only used the very first time a PEAR * repository is initialized * * @access public */ function __construct($pear_install_dir = PEAR_INSTALL_DIR, $pear_channel = false, $pecl_channel = false) { parent::__construct(); $ds = DIRECTORY_SEPARATOR; $this->install_dir = $pear_install_dir; $this->channelsdir = $pear_install_dir . $ds . '.channels'; $this->statedir = $pear_install_dir . $ds . '.registry'; $this->filemap = $pear_install_dir . $ds . '.filemap'; $this->lockfile = $pear_install_dir . $ds . '.lock'; $this->_pearChannel = $pear_channel; $this->_peclChannel = $pecl_channel; $this->_config = false; }
/** * PEAR_Registry constructor. * * @param string (optional) PEAR install directory (for .php files) * @param PEAR_ChannelFile PEAR_ChannelFile object representing the PEAR channel, if * default values are not desired. Only used the very first time a PEAR * repository is initialized * @param PEAR_ChannelFile PEAR_ChannelFile object representing the PECL channel, if * default values are not desired. Only used the very first time a PEAR * repository is initialized * * @access public */ function PEAR_Registry($pear_install_dir = PEAR_INSTALL_DIR, $pear_channel = false, $pecl_channel = false) { parent::__construct(); $this->setInstallDir($pear_install_dir); $this->_pearChannel = $pear_channel; $this->_peclChannel = $pecl_channel; $this->_config = false; }
/** * Internal Constructor * * Constructor of the entry. Sets up the distinguished name and the entries * attributes. * You should not call this method manually! Use {@link Net_LDAP2_Entry::createFresh()} * or {@link Net_LDAP2_Entry::createConnected()} instead! * * @param Net_LDAP2|ressource|array $ldap Net_LDAP2 object, ldap-link ressource or array of attributes * @param string|ressource $entry Either a DN or a LDAP-Entry ressource * * @access protected * @return none */ public function __construct($ldap, $entry = null) { parent::__construct('Net_LDAP2_Error'); // set up entry resource or DN if (is_resource($entry)) { $this->_entry = $entry; } else { $this->_dn = $entry; } // set up LDAP link if ($ldap instanceof Net_LDAP2) { $this->_ldap = $ldap; $this->_link = $ldap->getLink(); } elseif (is_resource($ldap)) { $this->_link = $ldap; } elseif (is_array($ldap)) { // Special case: here $ldap is an array of attributes, // this means, we have no link. This is a "virtual" entry. // We just set up the attributes so one can work with the object // as expected, but an update() fails unless setLDAP() is called. $this->setAttributes($ldap); } // if this is an entry existing in the directory, // then set up as old and fetch attrs if (is_resource($this->_entry) && is_resource($this->_link)) { $this->_new = false; $this->_dn = @ldap_get_dn($this->_link, $this->_entry); $this->setAttributes(); // fetch attributes from server } }
/** * Open LDIF file for reading or for writing * * new (FILE): * Open the file read-only. FILE may be the name of a file * or an already open filehandle. * If the file doesn't exist, it will be created if in write mode. * * new (FILE, MODE, OPTIONS): * Open the file with the given MODE (see PHPs fopen()), eg "w" or "a". * FILE may be the name of a file or an already open filehandle. * PERLs Net_LDAP2 "FILE|" mode does not work curently. * * OPTIONS is an associative array and may contain: * encode => 'none' | 'canonical' | 'base64' * Some DN values in LDIF cannot be written verbatim and have to be encoded in some way: * 'none' No encoding. * 'canonical' See "canonical_dn()" in Net::LDAP::Util. * 'base64' Use base64. (default, this differs from the Perl interface. * The perl default is "none"!) * * onerror => 'die' | 'warn' | NULL * Specify what happens when an error is detected. * 'die' Net_LDAP2_LDIF will croak with an appropriate message. * 'warn' Net_LDAP2_LDIF will warn (echo) with an appropriate message. * NULL Net_LDAP2_LDIF will not warn (default), use error(). * * change => 1 * Write entry changes to the LDIF file instead of the entries itself. I.e. write LDAP * operations acting on the entries to the file instead of the entries contents. * This writes the changes usually carried out by an update() to the LDIF file. * * lowercase => 1 * Convert attribute names to lowercase when writing. * * sort => 1 * Sort attribute names when writing entries according to the rule: * objectclass first then all other attributes alphabetically sorted by attribute name * * version => '1' * Set the LDIF version to write to the resulting LDIF file. * According to RFC 2849 currently the only legal value for this option is 1. * When this option is set Net_LDAP2_LDIF tries to adhere more strictly to * the LDIF specification in RFC2489 in a few places. * The default is NULL meaning no version information is written to the LDIF file. * * wrap => 78 * Number of columns where output line wrapping shall occur. * Default is 78. Setting it to 40 or lower inhibits wrapping. * * raw => REGEX * Use REGEX to denote the names of attributes that are to be * considered binary in search results if writing entries. * Example: raw => "/(?i:^jpegPhoto|;binary)/i" * * @param string|ressource $file Filename or filehandle * @param string $mode Mode to open filename * @param array $options Options like described above */ public function __construct($file, $mode = 'r', $options = array()) { parent::__construct('Net_LDAP2_Error'); // default error class // First, parse options // todo: maybe implement further checks on possible values foreach ($options as $option => $value) { if (!array_key_exists($option, $this->_options)) { $this->dropError('Net_LDAP2_LDIF error: option ' . $option . ' not known!'); return; } else { $this->_options[$option] = strtolower($value); } } // setup LDIF class $this->version($this->_options['version']); // setup file mode if (!preg_match('/^[rwa]\\+?$/', $mode)) { $this->dropError('Net_LDAP2_LDIF error: file mode ' . $mode . ' not supported!'); } else { $this->_mode = $mode; // setup filehandle if (is_resource($file)) { // TODO: checks on mode possible? $this->_FH =& $file; } else { $imode = substr($this->_mode, 0, 1); if ($imode == 'r') { if (!file_exists($file)) { $this->dropError('Unable to open ' . $file . ' for read: file not found'); $this->_mode = false; } if (!is_readable($file)) { $this->dropError('Unable to open ' . $file . ' for read: permission denied'); $this->_mode = false; } } if ($imode == 'w' || $imode == 'a') { if (file_exists($file)) { if (!is_writable($file)) { $this->dropError('Unable to open ' . $file . ' for write: permission denied'); $this->_mode = false; } } else { if (!@touch($file)) { $this->dropError('Unable to create ' . $file . ' for write: permission denied'); $this->_mode = false; } } } if ($this->_mode) { $this->_FH = @fopen($file, $this->_mode); if (false === $this->_FH) { // Fallback; should never be reached if tests above are good enough! $this->dropError('Net_LDAP2_LDIF error: Could not open file ' . $file); } else { $this->_FH_opened = true; } } } } }
function __construct() { parent::__construct(); if (OS_WINDOWS) { $this->configPrompt['php_bin'] = 'Path to CLI php.exe'; $this->config[] = 'php_bin'; $this->prefix = getcwd(); if (!@is_dir($this->prefix)) { if (@is_dir('c:\\php5')) { $this->prefix = 'c:\\php5'; } elseif (@is_dir('c:\\php4')) { $this->prefix = 'c:\\php4'; } elseif (@is_dir('c:\\php')) { $this->prefix = 'c:\\php'; } } $slash = "\\"; if (strrpos($this->prefix, '\\') === strlen($this->prefix) - 1) { $slash = ''; } $this->localInstall = false; $this->bin_dir = '$prefix'; $this->temp_dir = '$prefix' . $slash . 'tmp'; $this->download_dir = '$prefix' . $slash . 'tmp'; $this->php_dir = '$prefix' . $slash . 'pear'; $this->doc_dir = '$prefix' . $slash . 'docs'; $this->data_dir = '$prefix' . $slash . 'data'; $this->test_dir = '$prefix' . $slash . 'tests'; $this->www_dir = '$prefix' . $slash . 'www'; $this->man_dir = '$prefix' . $slash . 'man'; $this->cfg_dir = '$prefix' . $slash . 'cfg'; $this->pear_conf = PEAR_CONFIG_SYSCONFDIR . '\\pear.ini'; /* * Detects php.exe */ $this->validPHPBin = true; if ($t = $this->safeGetenv('PHP_PEAR_PHP_BIN')) { $this->php_bin = dirname($t); } elseif ($t = $this->safeGetenv('PHP_BIN')) { $this->php_bin = dirname($t); } elseif ($t = System::which('php')) { $this->php_bin = dirname($t); } elseif (is_file($this->prefix . '\\cli\\php.exe')) { $this->php_bin = $this->prefix . '\\cli'; } elseif (is_file($this->prefix . '\\php.exe')) { $this->php_bin = $this->prefix; } $phpexe = OS_WINDOWS ? '\\php.exe' : '/php'; if ($this->php_bin && !is_file($this->php_bin . $phpexe)) { $this->php_bin = ''; } else { if (strpos($this->php_bin, ':') === 0) { $this->php_bin = getcwd() . DIRECTORY_SEPARATOR . $this->php_bin; } } if (!is_file($this->php_bin . $phpexe)) { if (is_file('c:/php/cli/php.exe')) { $this->php_bin = 'c"\\php\\cli'; } elseif (is_file('c:/php5/php.exe')) { $this->php_bin = 'c:\\php5'; } elseif (is_file('c:/php4/cli/php.exe')) { $this->php_bin = 'c:\\php4\\cli'; } else { $this->validPHPBin = false; } } } else { $this->prefix = dirname(PHP_BINDIR); $this->pear_conf = PEAR_CONFIG_SYSCONFDIR . '/pear.conf'; if ($this->getCurrentUser() != 'root') { $this->prefix = $this->safeGetenv('HOME') . '/pear'; $this->pear_conf = $this->safeGetenv('HOME') . '.pearrc'; } $this->bin_dir = '$prefix/bin'; $this->php_dir = '$prefix/share/pear'; $this->temp_dir = '/tmp/pear/install'; $this->download_dir = '/tmp/pear/install'; $this->doc_dir = '$prefix/docs'; $this->www_dir = '$prefix/www'; $this->cfg_dir = '$prefix/cfg'; $this->data_dir = '$prefix/data'; $this->test_dir = '$prefix/tests'; $this->man_dir = '$prefix/man'; // check if the user has installed PHP with PHP or GNU layout if (@is_dir("{$this->prefix}/lib/php/.registry")) { $this->php_dir = '$prefix/lib/php'; } elseif (@is_dir("{$this->prefix}/share/pear/lib/.registry")) { $this->php_dir = '$prefix/share/pear/lib'; $this->doc_dir = '$prefix/share/pear/docs'; $this->data_dir = '$prefix/share/pear/data'; $this->test_dir = '$prefix/share/pear/tests'; } elseif (@is_dir("{$this->prefix}/share/php/.registry")) { $this->php_dir = '$prefix/share/php'; } } }
/** * PHP5 constructor * * @param string $srcenc source charset encoding, use NULL (default) to use * whatever the document specifies * @param string $mode how this parser object should work, "event" for * startelement/endelement-type events, "func" * to have it call functions named after elements * @param string $tgtenc a valid target encoding */ function __construct($srcenc = null, $mode = 'event', $tgtenc = null) { parent::__construct('XML_Parser_Error'); $this->mode = $mode; $this->srcenc = $srcenc; $this->tgtenc = $tgtenc; }
/** * Mail_Queue constructor * * @param array $container_options Mail_Queue container options * @param array $mail_options How send mails. * * @return Mail_Queue * * @access public * @deprecated */ function Mail_Queue($container_options, $mail_options) { parent::__construct(); if (isset($mail_options['pearErrorMode'])) { $this->pearErrorMode = $mail_options['pearErrorMode']; // ugly hack to propagate 'pearErrorMode' $container_options['pearErrorMode'] = $mail_options['pearErrorMode']; } if (!is_array($mail_options) || !isset($mail_options['driver'])) { array_push($this->_initErrors, new Mail_Queue_Error(MAILQUEUE_ERROR_NO_DRIVER, $this->pearErrorMode, E_USER_ERROR, __FILE__, __LINE__)); } $this->mail_options = $mail_options; if (!is_array($container_options) || !isset($container_options['type'])) { array_push($this->_initErrors, new Mail_Queue_Error(MAILQUEUE_ERROR_NO_CONTAINER, $this->pearErrorMode, E_USER_ERROR, __FILE__, __LINE__)); } $container_type = strtolower($container_options['type']); $container_class = 'Mail_Queue_Container_' . $container_type; $container_classfile = $container_type . '.php'; // Attempt to include a custom version of the named class, but don't treat // a failure as fatal. The caller may have already included their own // version of the named class. if (!class_exists($container_class)) { include_once 'Mail/Queue/Container/' . $container_classfile; } if (!class_exists($container_class)) { array_push($this->_initErrors, new Mail_Queue_Error(MAILQUEUE_ERROR_UNKNOWN_CONTAINER, $this->pearErrorMode, E_USER_ERROR, __FILE__, __LINE__)); } else { unset($container_options['type']); $this->container = new $container_class($container_options); if (PEAR::isError($this->container)) { array_push($this->_initErrors, new Mail_Queue_Error(MAILQUEUE_ERROR_CANNOT_INITIALIZE, $this->pearErrorMode, E_USER_ERROR, __FILE__, __LINE__)); } } }
/** * Constructor of the class * * @access protected */ public function __construct() { parent::__construct('Net_LDAP2_Error'); // default error class }
/** * Call parent::PEAR() for destuctor to be called, and initialize vars * * @return: void * @access: public */ function I18N_Common() { parent::__construct(); $this->_codes = array(); }