Example #1
0
 function get()
 {
     $this->transObj = DB_DataObject::Factory('core_enum');
     $this->transObj->query('BEGIN');
     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
     $this->modules = $this->modulesList();
     $this->etype();
     $this->defaults();
     foreach ($this->defaults as $k => $v) {
         $enum = DB_DataObject::factory('core_enum');
         $enum->setFrom(array('etype' => $this->etype->name, 'name' => $k, 'active' => 1));
         if ($enum->find(true)) {
             continue;
         }
         $enum->display_name = $v;
         $enum->insert();
     }
     $notify = DB_DataObject::factory('core_notify');
     $notify->selectAdd();
     $notify->selectAdd("\n            DISTINCT(evtype) AS evtype\n        ");
     $types = $notify->fetchAll();
     foreach ($types as $t) {
         $enum = DB_DataObject::factory('core_enum');
         $enum->setFrom(array('etype' => $this->etype->name, 'name' => $t->evtype, 'active' => 1));
         if ($enum->find(true)) {
             continue;
         }
         $enum->display_name = $t->evtype;
         $enum->insert();
     }
     $this->jok('DONE');
 }
Example #2
0
 /**
  * Accepts:
  * logout =
  * 
  * 
  */
 function get()
 {
     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
     //DB_DataObject::DebugLevel(1);
     if (!empty($_REQUEST['logout'])) {
         return $this->logout();
     }
     // general query...
     if (!empty($_REQUEST['getAuthUser'])) {
         //DB_Dataobject::debugLevel(5);
         $this->sendAuthUserDetails();
         exit;
     }
     // might be an idea to disable this?!?
     if (!empty($_REQUEST['username'])) {
         $this->post();
     }
     if (!empty($_REQUEST['switch'])) {
         $this->switchUser($_REQUEST['switch']);
     }
     if (!empty($_REQUEST['loginPublic'])) {
         $this->switchPublicUser($_REQUEST['loginPublic']);
     }
     $this->jerr("INVALID REQUEST");
     exit;
 }
Example #3
0
 /**
  * This function builds the main structure in HTML.
  *
  * @access public
  * @author kalmer:piiskop <*****@*****.**>
  * @param string $parameters['address']
  *        	the address
  * @param string $parameters['blogDate']
  *        	the date of the blog
  * @param string $parameters['blogEntry']
  *        	the blog entry
  * @param Human $parameters['designer']
  *        	the designer
  * @param string $parameters['menu']
  *        	the body
  * @param string $parameters['phoneNumber']
  *        	the phone number
  * @param string $parameters['title']
  *        	the title
  * @param string $parameters['twitter']
  *        	the Twitter-time
  * @return string the parsed HTML-structure
  * @uses BEGINNING_OF_URL for links
  * @uses \pstk\ErrorView for displaying error messages
  * @uses MENU_COMMON for the common menu
  * @uses MENU_SIDE for the menu in sidebar
  */
 public static function buildView($parameters)
 {
     require_once 'HTML/Template/IT.php';
     require_once dirname(__FILE__) . '/../php/ErrorView.php';
     \PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array(new \pstk\ErrorView(), 'raiseError'));
     $tpl = new \HTML_Template_IT(ROOT_FOLDER . 'html');
     $tpl->loadTemplatefile('particle-template.html');
     if (isset($parameters['menus'])) {
         if (isset($parameters['menus'][MENU_COMMON])) {
             $tpl->setCurrentBlock('common-menu');
             $tpl->setVariable(array('COMMON-MENU' => $parameters['menus'][MENU_COMMON]));
             $tpl->parse('common-menu');
         }
         if (isset($parameters['menus'][MENU_SIDE])) {
             $tpl->setCurrentBlock('menu-in-sidebar');
             $tpl->setVariable(array('MENU-IN-SIDEBAR' => $parameters['menus'][MENU_SIDE]));
             $tpl->parse('menu-in-sidebar');
         }
     }
     if (isset($parameters['posts'])) {
         $tpl->setCurrentBlock('posts');
         $tpl->setVariable(array('POSTS' => $parameters['posts']));
         $tpl->parse('posts');
     }
     require_once dirname(__FILE__) . '/Model.php';
     $model = new Model();
     $model->setComplete();
     require_once dirname(__FILE__) . '/../php/CssView.php';
     $tpl->setCurrentBlock('html');
     $tpl->setVariable(array('ACTION' => '', 'BEGINNING-OF-URL' => BEGINNING_OF_URL, 'FOLLOW-ME' => $model->translate(array('property' => 'followMe')), 'HEADING' => $parameters['title'], 'OLDER-POSTS' => $model->translate(array('property' => 'olderPosts')), 'NEWER-POSTS' => $model->translate(array('property' => 'newerPosts')), 'SEARCH' => \pstk\String::translate('search'), 'SUBSCRIBE' => $model->translate(array('property' => 'subscribe')), 'STYLE' => \pstk\CssView::buildCss(array('fileName' => 'particle-template')), 'TITLE' => mb_strtoupper($parameters['title'], 'UTF-8')));
     $tpl->parse('html');
     return $tpl->get('html');
 }
Example #4
0
function R3AppInitDB()
{
    global $mdb2;
    global $dsn;
    require_once 'MDB2.php';
    if (!isset($dsn) || $dsn == '') {
        throw new Exception('Missing $dsn');
    }
    $txtDsn = $dsn['dbtype'] . '://' . $dsn['dbuser'] . ':' . $dsn['dbpass'] . '@' . $dsn['dbhost'] . '/' . $dsn['dbname'];
    $db = ezcDbFactory::create($txtDsn);
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION);
    $mdb2 = MDB2::singleton($txtDsn);
    // Needed by user manager and import/export
    ezcDbInstance::set($db);
    if (isset($dsn['charset'])) {
        $db->exec("SET client_encoding TO '{$dsn['charset']}'");
        $mdb2->exec("SET client_encoding TO '{$dsn['charset']}'");
    }
    if (isset($dsn['search_path'])) {
        $db->exec("SET search_path TO {$dsn['search_path']}, public");
        $mdb2->exec("SET search_path TO {$dsn['search_path']}, public");
    }
    $db->exec("SET datestyle TO ISO");
    $mdb2->exec("SET datestyle TO ISO");
}
Example #5
0
 function get($args, $opts = array())
 {
     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
     $this->checkSystem();
     HTML_FlexyFramework::get()->generateDataobjectsCache(true);
     $ff = HTML_FlexyFramework::get();
     if (!empty($ff->Core_Notify)) {
         //            require_once 'Pman/Core/NotifySmtpCheck.php';
         //            $x = new Pman_Core_NotifySmtpCheck();
         //            $x->check();
     }
     $this->disabled = explode(',', $ff->disable);
     //$this->fixSequencesPgsql();exit;
     $this->opts = $opts;
     // ask all the modules to verify the opts
     $this->checkOpts($opts);
     // do this first, so the innodb change + utf8 fixes column max sizes
     // this will trigger errors about freetext indexes - we will have to remove them manually.?
     // otherwise we need to do an sql query to find them, then remove them (not really worth it as it only affects really old code..)
     $this->runExtensions();
     if (empty($opts['data-only'])) {
         $this->importSQL();
     }
     if (!empty($opts['only-module-sql'])) {
         return;
     }
     $this->runUpdateModulesData();
     if (!empty($opts['add-company']) && !in_array('Core', $this->disabled)) {
         // make sure we have a good cache...?
         DB_DataObject::factory('core_company')->initCompanies($this, $opts);
     }
     $this->runExtensions();
 }
function civicrm_init()
{
    $config =& CRM_Core_Config::singleton();
    CRM_Core_DAO::init($config->dsn, $config->daoDebug);
    $factoryClass = 'CRM_Contact_DAO_Factory';
    CRM_Core_DAO::setFactory(new $factoryClass());
    // set error handling
    PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array('CRM_Core_Error', 'handle'));
}
Example #7
0
 function __construct($server, $serverenc, $serverport, $user, $pass)
 {
     $error = '';
     $this->_server = $server;
     $this->_serverenc = $serverenc;
     $this->_serverport = $serverport;
     $this->_user = $user;
     $this->_pass = $pass;
     # Set pear error handling to be used by exceptions
     PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION);
     $this->_nntp = new Net_NNTP_Client();
 }
Example #8
0
 function __construct($server)
 {
     $error = '';
     $this->_connected = false;
     $this->_server = $server['host'];
     $this->_serverenc = $server['enc'];
     $this->_serverport = $server['port'];
     $this->_user = $server['user'];
     $this->_pass = $server['pass'];
     # Set pear error handling to be used by exceptions
     PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION);
     $this->_nntp = new Net_NNTP_Client();
 }
Example #9
0
 function post()
 {
     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
     $this->sessionState(0);
     // turn off the session..
     $img = DB_DataObject::Factory('images');
     $img->setFrom(array('onid' => 0, 'ontable' => 'ipshead'));
     $img->onUpload(false);
     require_once 'File/Convert.php';
     $fc = new File_Convert($img->getStoreName(), $img->mimetype);
     $csv = $fc->convert('text/csv');
     $this->importCsv($csv);
 }
Example #10
0
 public static function registerNamespaced()
 {
     try {
         spl_autoload_register(array(self::instance(), 'autoloadNamespaced'));
     } catch (Exception $e) {
         throw new Exception('Error registering autoload<br />' . $e->getMessage(), $e->getCode());
     }
     try {
         PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array(self::instance(), 'error_to_exception'));
     } catch (Exception $e) {
         throw new Exception('Error setting PEAR_ERROR_CALLBACK');
     }
 }
Example #11
0
 /**
  * This function creates a HTML-block for a logo.
  *
  * @access public
  *@author arnold:tserepov <*****@*****.**>
  * @param Logo $parameters['logo']
  *        	the logo
  * @uses BEGINNING_OF_URL the beginning of the URL
  */
 public static function buildLogo($parameters)
 {
     require_once dirname(__FILE__) . '/ErrorView.php';
     ///////////////////////
     \PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array(new ErrorView(), 'raiseError'));
     require_once 'HTML/Template/IT.php';
     $tpl = new \HTML_Template_IT(ROOT_FOLDER . 'tutshtml');
     $tpl->loadTemplatefile('burnstudio2-template.html');
     $tpl->setCurrentBlock('logo');
     $tpl->setVariable(array('ALT-OF-LOGO' => $parameters['logo']->getAlt(), 'BEGINNING-OF-URL' => BEGINNING_OF_URL, 'SRC-OF-LOGO' => $parameters['logo']->getSrc(), 'SIZES-OF-LOGO' => $parameters['logo']->getSizes()));
     $tpl->parse('logo');
     return $tpl->get('logo');
 }
 function setUp()
 {
     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'catchErrorHandlerPEAR');
     $this->dsn = $GLOBALS['dsn'];
     $this->options = $GLOBALS['options'];
     $this->database = $GLOBALS['database'];
     $this->dsn['database'] = $this->database;
     $this->schema =& MDB2_Schema::factory($this->dsn, $this->options);
     if (PEAR::isError($this->schema)) {
         $this->assertTrue(false, 'Could not connect to manager in setUp');
         exit;
     }
 }
Example #13
0
 function post()
 {
     $this->transObj = DB_DataObject::Factory('invhist_transfer');
     $this->transObj->query('BEGIN');
     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
     $img = DB_DataObject::Factory('images');
     $img->setFrom(array('onid' => 0, 'ontable' => 'ipshead'));
     $img->onUpload(false);
     require_once 'File/Convert.php';
     $fc = new File_Convert($img->getStoreName(), $img->mimetype);
     $csv = $fc->convert('text/csv');
     $ret = $this->importCsv($csv);
     $this->jdata($ret['data'], false, isset($ret['extra']) ? $ret['extra'] : array());
 }
Example #14
0
 /**
  * This function builds the main structure in HTML.
  *
  * @access public
  * @author arnold:tserepov <*****@*****.**>
  * @param string $parameters['body']
  *        	the body
  * @param string $parameters['title']
  *        	the title
  * @return string the parsed HTML-structure
  * @uses BEGINNING_OF_URL for links
  *      
  */
 public static function buildView($parameters)
 {
     require_once 'HTML/Template/IT.php';
     // //////////////////////////////////////////////////////
     \PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array(new CalculatorView(), 'raiseError'));
     $tpl = new \HTML_Template_IT(ROOT_FOLDER . 'htmlcalculator');
     // /////////////////////////////
     echo ' 29: ', ROOT_FOLDER;
     $tpl->loadTemplatefile('calculator.html');
     $tpl->setCurrentBlock('html');
     $tpl->setVariable(array('BEGINNING-OF-URL' => BEGINNING_OF_URL, 'SUMMA1' => $parameters['summa1'], 'SUMMA2' => $parameters['summa2'], 'RESULT' => $parameters['result']));
     $tpl->parse('html');
     echo $tpl->get('html');
 }
 function setUp()
 {
     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'catchErrorHandlerPEAR');
     $this->dsn = $GLOBALS['dsn'];
     $this->options = $GLOBALS['options'];
     $this->database = $GLOBALS['database'];
     $this->dsn['database'] = $this->database;
     $this->schema =& MDB2_Schema::factory($this->dsn, $this->options);
     if (PEAR::isError($this->schema)) {
         $this->assertTrue(false, 'Could not connect to manager in setUp');
         exit;
     }
     $this->aSchemas = array(1 => SCHEMA_PATH . 'schema_1_original.xml', 2 => SCHEMA_PATH . 'schema_2_newfield.xml', 3 => SCHEMA_PATH . 'schema_3_primarykey.xml', 4 => SCHEMA_PATH . 'schema_4_idxfieldorder.xml', 5 => SCHEMA_PATH . 'schema_5_fieldtype.xml', 6 => SCHEMA_PATH . 'schema_6_removefield.xml', 7 => SCHEMA_PATH . 'schema_7_removeindex.xml', 8 => SCHEMA_PATH . 'schema_8_addtable.xml', 9 => SCHEMA_PATH . 'schema_9_removetable.xml', 10 => SCHEMA_PATH . 'schema_10_keyfield.xml');
 }
Example #16
0
 /**
  *  setup PEAR_Config and so on.
  *
  *  @param  string      $target     whether 'master' or 'local'
  *  @param  string|null $app_dir    local application directory.
  *  @param  string|null $channel    channel for the package repository.
  *  @return true|Ethna_Error
  */
 public function init($target, $app_dir = null, $channel = null)
 {
     $true = true;
     if ($target == 'master') {
         $this->target = 'master';
     } else {
         // default target is 'local'.
         $this->target = 'local';
     }
     // setup PEAR_Frontend
     PEAR_Command::setFrontendType('CLI');
     $this->ui = PEAR_Command::getFrontendObject();
     // set PEAR's error handling
     // TODO: if PEAR/Command/Install.php is newer than 1.117, displayError goes well.
     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array(&$this->ui, 'displayFatalError'));
     // set channel
     $master_setting = Ethna_Handle::getMasterSetting('repositry');
     if ($channel !== null) {
         $this->channel = $channel;
     } else {
         if (isset($master_setting["channel_{$target}"])) {
             $this->channel = $master_setting["channel_{$target}"];
         } else {
             $this->channel = 'pear.ethna.jp';
         }
     }
     // set target controller
     if ($target == 'master') {
         $this->target_ctl = Ethna_Handle::getEthnaController();
     } else {
         $this->target_ctl = Ethna_Handle::getAppController($app_dir);
     }
     if (Ethna::isError($this->target_ctl)) {
         return $this->target_ctl;
     }
     // setup PEAR_Config
     if ($target == 'master') {
         $ret = $this->_setMasterConfig();
     } else {
         $ret = $this->_setLocalConfig();
     }
     if (Ethna::isError($ret)) {
         return $ret;
     }
     $this->ui->setConfig($this->config);
     // setup PEAR_Registry
     $this->registry = $this->config->getRegistry();
     return $true;
 }
Example #17
0
 function __construct($server, $use_openssl)
 {
     $error = '';
     $this->_connected = false;
     $this->_server = $server['host'];
     $this->_serverenc = $server['enc'];
     $this->_serverport = $server['port'];
     $this->_user = $server['user'];
     $this->_pass = $server['pass'];
     # Moeten we OpenSSL gebruiken om RSA encryptie te versnellen?
     $this->_use_openssl = $use_openssl;
     # Set pear error handling to be used by exceptions
     PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION);
     $this->_nntp = new Net_NNTP_Client();
 }
Example #18
0
 protected function init($multi_query = false)
 {
     PEAR::setErrorHandling(PEAR_ERROR_RETURN);
     $uri = DB_ENGINE . "://" . DB_USER . ":" . DB_PASSWORD . "@" . DB_HOST . "/" . DB_NAME;
     $this->db =& MDB2::factory($uri);
     if ($this->db instanceof PEAR_Error) {
         trigger_error($this->db->getMessage(), E_USER_ERROR);
     }
     $this->db->setFetchMode(MDB2_FETCHMODE_ASSOC);
     $this->db->loadModule('Extended');
     $this->db->loadModule('Manager');
     $this->db->loadModule('Reverse');
     $this->db->loadModule('Function');
     // Required multi query option for stored procedures
     $this->db->setOption('multi_query', $multi_query);
     // Turn off "portability" option, which stops forcing lowercase keys
     $this->db->setOption('portability', false);
 }
Example #19
0
 /**
  * @static
  */
 public static function performInitialisation()
 {
     /**
      * @var $ilErr ilErrorHandling
      */
     global $ilErr;
     define('IL_PHPUNIT_TEST', true);
     session_id('phpunittest');
     $_SESSION = array();
     include 'Services/PHPUnit/config/cfg.phpunit.php';
     include_once 'Services/Context/classes/class.ilContext.php';
     ilContext::init(ilContext::CONTEXT_UNITTEST);
     include_once 'Services/Init/classes/class.ilInitialisation.php';
     ilInitialisation::initILIAS();
     ilInitialisation::initUserAccount();
     $ilUnitUtil = new self();
     $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK, array($ilUnitUtil, 'errorHandler'));
     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ilUnitUtil, 'errorHandler'));
 }
Example #20
0
 /**
  * This function builds the main structure in HTML.
  *
  * @param string $parameteres['menu']
  *        	the body
  * @param string $parameters['title]
  *        	the title
  * @return string the parsed HTML-structure
  * @uses BEGINNING_OF_URL for links
  */
 public static function buildView($parameters)
 {
     require_once 'HTML/Template/IT.php';
     require_once dirname(__FILE__) . '/ErrorView.php';
     \PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array(new ErrorView(), 'raiseError'));
     $tpl = new \HTML_Template_it(ROOT_FOLDER . 'html');
     $tpl->loadTemplatefile('from-design-to-web-template.html');
     ////
     if (isset($parameters['logos'])) {
         $tpl->setCurrentBlock('logos');
         $tpl->setVariable(array('LOGO' => $parameters['logos']));
         $tpl->parse('logos');
     }
     if (isset($parameters['menus'])) {
         if (isset($parameters['menus'][MENU_COMMON])) {
             $tpl->setCurrentBlock('menu-items');
             $tpl->setVariable(array('MENU-ITEMS' => $parameters['menus'][MENU_COMMON]));
             $tpl->parse('menu-items');
             // echo ' 190: ', $tpl->get('menu-items');
         }
         if (isset($parameters['menus'][MENU_OUTER])) {
             $tpl->setCurrentBlock('outer-links');
             $tpl->setVariable(array('OUTER-LINKS' => $parameters['menus'][MENU_OUTER]));
             $tpl->parse('outer-links');
         }
         if (isset($parameters['menus'][MENU_INNER])) {
             $tpl->setCurrentBlock('inner-links');
             $tpl->setVariable(array('INNER-LINK' => $parameters['menus'][MENU_INNER]));
             $tpl->parse('inner-links');
         }
     }
     ////
     if (isset($parameters['services'])) {
         $tpl->setCurrentBlock('services');
         $tpl->setVariable(array('SERVICES' => $parameters['services']));
         $tpl->parse('services');
     }
     $tpl->setCurrentBlock('html');
     $tpl->setVariable(array('CALL-US' => 'Call us', 'NOW' => 'Now', 'QUICK' => 'Quick', 'VIDEOS' => 'Video Tour', 'OUR-WORKS' => 'How we design our works!', 'TWITTER' => 'Twitter', 'FEED' => 'Feed', 'LIKE-US' => 'Like us on', 'FACEBOOK' => 'Facebook', 'ACTION' => '', 'BEGINNING-OF-URL' => BEGINNING_OF_URL, 'HREF-OF-VIDEOS' => 'http://youtube.com', 'PHONE-NUMBER' => '(012) 35 6789', 'TIME' => View::ago(strtotime('2015-11-07 12:13:29')), 'TITLE' => 'Insert title here'));
     $tpl->parse('html');
     return $tpl->get('html');
 }
Example #21
0
 public function __construct()
 {
     // override the PHP error handler with php() function, using the system
     // error reporting level. this means php.ini settings 'display_errors'
     // and 'log_errors' are ignored.
     set_error_handler(array($this, 'php'), error_reporting());
     // same with the PEAR error handler - override with pear() function
     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'pear'));
     // so now an exception will be created for any problem in the system.
     // developers are forced to handle exceptions. if they do not,
     // there will be an uncaught exeception Fatal Error.
     // if developing, show exceptions in browser and not in log file.
     // in production, log them to file, and do not show in browser.
     $mode = Zend_Registry::get('config')->getSectionName();
     if ($mode == 'production') {
         // call this class' uncaught() function if an exception rises all
         // the way to the top of the call stack
         set_exception_handler(array($this, 'uncaught'));
     }
 }
 function setUp()
 {
     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'catchErrorHandlerPEAR');
     $this->dsn = $GLOBALS['dsn'];
     $this->options = $GLOBALS['options'];
     $this->database = $GLOBALS['database'];
     $this->dsn['database'] = $this->database;
     $backup_file = SCHEMA_PATH . $this->driver_input_file . $this->backup_extension;
     if (file_exists($backup_file)) {
         unlink($backup_file);
     }
     $backup_file = SCHEMA_PATH . $this->lob_input_file . $this->backup_extension;
     if (file_exists($backup_file)) {
         unlink($backup_file);
     }
     $this->schema =& MDB2_Schema::factory($this->dsn, $this->options);
     if (PEAR::isError($this->schema)) {
         $this->assertTrue(false, 'Could not connect to manager in setUp');
         exit;
     }
 }
Example #23
0
 function __construct($pPearDsn = NULL, $pPearOptions = NULL)
 {
     global $gDebug;
     parent::__construct();
     if (empty($pPearDsn)) {
         global $gBitDbType, $gBitDbUser, $gBitDbPassword, $gBitDbHost, $gBitDbName;
         $pPearDsn = array('phptype' => $gBitDbType, 'username' => $gBitDbUser, 'password' => $gBitDbPassword, 'database' => $gBitDbHost . '/' . $gBitDbName);
     }
     if (empty($pPearOptions)) {
         $pPearOptions = array('debug' => 2, 'persistent' => false, 'portability' => DB_PORTABILITY_ALL);
     }
     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'bit_pear_login_error');
     $this->mDb = DB::connect($pPearDsn, $pPearOptions);
     if (PEAR::isError($this->mDb)) {
         $this->mErrors['db_connect'] = $this->mDb->getDebugInfo();
     } else {
         $this->mDb->setFetchMode(DB_FETCHMODE_ASSOC);
         // Default to autocommit unless StartTrans is called
         $this->mDb->autoCommit(TRUE);
         $this->mType = $pPearDsn['phptype'];
         $this->mName = $pPearDsn['database'];
     }
     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'bit_pear_error_handler');
 }
Example #24
0
#!/usr/bin/env php
<?php 
use Phrozn\Autoloader as Loader;
error_reporting(E_ALL & ~E_NOTICE);
// rely on configuration files
require_once dirname(__FILE__) . '/../Phrozn/Autoloader.php';
$loader = Loader::getInstance()->getLoader();
$config = new \Phrozn\Config(dirname(__FILE__) . '/../configs/');
require_once 'PEAR/PackageFileManager2.php';
PEAR::setErrorHandling(PEAR_ERROR_DIE);
$pack = new PEAR_PackageFileManager2();
$outputDir = realpath(dirname(__FILE__) . '/../') . '/';
$inputDir = realpath(dirname(__FILE__) . '/../');
$e = $pack->setOptions(array('baseinstalldir' => '/', 'packagedirectory' => $inputDir, 'ignore' => array('build/', 'tests/', 'extras/', 'plugin/', 'phrozn.png', '*.tgz', 'bin/release', 'tags'), 'outputdirectory' => $outputDir, 'simpleoutput' => true, 'roles' => array('textile' => 'doc'), 'dir_roles' => array('Phrozn' => 'php', 'configs' => 'data', 'skeleton' => 'data', 'tests' => 'test'), 'exceptions' => array('bin/phrozn.php' => 'script', 'bin/phr.php' => 'script', 'LICENSE' => 'doc'), 'installexceptions' => array(), 'clearchangelog' => true));
$pack->setPackage('Phrozn');
$pack->setSummary($config['phrozn']['summary']);
$pack->setDescription($config['phrozn']['description']);
$pack->setChannel('pear.phrozn.info');
$pack->setPackageType('php');
// this is a PEAR-style php script package
$pack->setReleaseVersion($config['phrozn']['version']);
$pack->setAPIVersion($config['phrozn']['version']);
$pack->setReleaseStability($config['phrozn']['stability']);
$pack->setAPIStability($config['phrozn']['stability']);
$pack->setNotes('
    * The first public release of Phrozn
');
$pack->setLicense('Apache License, Version 2.0', 'http://www.apache.org/licenses/LICENSE-2.0');
$pack->addMaintainer('lead', 'victor', 'Victor Farazdagi', '*****@*****.**');
$pack->addRelease();
$pack->addInstallAs('bin/phr.php', 'phr');
                    if (@$d['shortopt'] == $opt) {
                        $opts[$o] = $value;
                    }
                }
            } else {
                if (substr($opt, 0, 2) == '--') {
                    $opts[substr($opt, 2)] = $value;
                }
            }
        }
        $ok = $cmd->run($command, $opts, $params);
        if ($ok === false) {
            PEAR::raiseError("unknown command `{$command}'");
        }
        if (PEAR::isError($ok)) {
            PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ui, "displayFatalError"));
            PEAR::raiseError($ok);
        }
    } while (false);
}
// {{{ usage()
function usage($error = null, $helpsubject = null)
{
    global $progname, $all_commands;
    $stderr = fopen('php://stderr', 'w');
    if (PEAR::isError($error)) {
        fputs($stderr, $error->getMessage() . "\n");
    } elseif ($error !== null) {
        fputs($stderr, "{$error}\n");
    }
    if ($helpsubject != null) {
Example #26
0
define('RCMAIL_START', microtime(true));
if (!defined('INSTALL_PATH')) {
    define('INSTALL_PATH', dirname($_SERVER['SCRIPT_FILENAME']) . '/');
}
if (!defined('RCMAIL_CONFIG_DIR')) {
    define('RCMAIL_CONFIG_DIR', INSTALL_PATH . 'config');
}
// RC include folders MUST be included FIRST to avoid other
// possible not compatible libraries (i.e PEAR) to be included
// instead the ones provided by RC
$include_path = INSTALL_PATH . 'program/lib' . PATH_SEPARATOR;
$include_path .= ini_get('include_path');
if (set_include_path($include_path) === false) {
    die("Fatal error: ini_set/set_include_path does not work.");
}
// increase maximum execution time for php scripts
// (does not work in safe mode)
@set_time_limit(120);
// set internal encoding for mbstring extension
if (extension_loaded('mbstring')) {
    mb_internal_encoding(RCMAIL_CHARSET);
    @mb_regex_encoding(RCMAIL_CHARSET);
}
// include global functions
require_once INSTALL_PATH . 'program/include/rcube_shared.inc';
// Register autoloader
spl_autoload_register('rcube_autoload');
// set PEAR error handling (will also load the PEAR main class)
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'rcube_pear_error');
// backward compatybility (to be removed)
require_once INSTALL_PATH . 'program/include/rcube_bc.inc';
Example #27
0
 /**
  * Pop the last error handler used
  *
  * @return bool Always true
  *
  * @see PEAR::pushErrorHandling
  */
 function popErrorHandling()
 {
     $stack =& $GLOBALS['_PEAR_error_handler_stack'];
     array_pop($stack);
     list($mode, $options) = $stack[sizeof($stack) - 1];
     array_pop($stack);
     if (isset($this) && is_a($this, 'PEAR')) {
         $this->setErrorHandling($mode, $options);
     } else {
         PEAR::setErrorHandling($mode, $options);
     }
     return true;
 }
Example #28
0
        if ($dir != '' && $dir != '.') {
            mkdir($dir, 0700);
        }
        if (in_array($file, $local_dir)) {
            copy($gopear_bundle_dir . '/' . $file, $name);
            echo '(local) ';
        } else {
            download_url($url, $name, $http_proxy);
            echo '(remote) ';
        }
        include_once $name;
        print "ok\n";
    }
}
unset($nobootstrap, $file, $url, $name, $dir);
PEAR::setErrorHandling(PEAR_ERROR_DIE, "\n%s\n");
print "\n" . 'Extracting installer..................' . "\n";
displayHTMLProgress($progress = 20);
// Extract needed ?
$noextract = false;
if (is_dir($php_dir)) {
    $noextract = @(include_once 'PEAR/Registry.php');
    if ($noextract) {
        $registry = new PEAR_Registry($php_dir);
        foreach ($bootstrap_pkgs as $pkg) {
            $noextract &= $registry->packageExists($pkg);
        }
    }
}
if ($noextract) {
    print 'Using previously installed installer ... ';
Example #29
0
<?php

// zu Hause
if ($_SERVER['HTTP_HOST'] == 'localhost' || preg_match('/^hero/', $_SERVER['HTTP_HOST'])) {
    ini_set('include_path', ini_get('include_path') . ';c:\\xampp\\php\\PEAR;c:\\xampp\\htdocs\\' . ROOTDIR);
    $login_file = '\\xampp\\htdocs\\' . ROOTDIR . '\\db\\db_login_pear.php';
} elseif ($_SERVER['HTTP_HOST'] == 'www.nexttext.ch' || $_SERVER['HTTP_HOST'] == 'nexttext.ch') {
    ini_set('include_path', ini_get('include_path'));
    $login_file = '/home/httpd/vhosts/nexttext.ch/httpdocs/' . ROOTDIR . 'db/db_login_pear.php';
} elseif ($_SERVER['HTTP_HOST'] == 'www.publicdev.ch' || $_SERVER['HTTP_HOST'] == 'publicdev.ch') {
    ini_set('include_path', ini_get('include_path'));
    $login_file = '/home/httpd/vhosts/publicdev.ch/httpdocs/' . ROOTDIR . 'db/db_login_pear.php';
}
require_once $login_file;
// Einbinden des PEAR-Paketes MDB2
// gesucht wird im Include-Pfad, der in der php.ini gesetzt ist
require_once 'MDB2.php';
/**
 * Setzen des PEAR_ERROR_CALLBACK auf die funktion handle_pear_error()
 *  (siehe ende skript)
 */
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'bearbeite_pear_fehler');
$dsn = array('phptype' => $dbtype, 'username' => $user, 'password' => $password, 'hostspec' => $host, 'database' => $db);
$options = array('debug' => 2, 'result_buffering' => true);
$db =& MDB2::connect($dsn, $options);
Example #30
0
function php_error_handler($errno, $errstr, $errfile, $errline)
{
    if (error_reporting() && $errno != 2048) {
        $tpl = new HTML_Template_IT();
        $tpl->loadTemplatefile('error-page.tpl.php');
        $tpl->setVariable('error_msg', "<b>{$errfile} ({$errline})</b><br />{$errstr}");
        $tpl->show();
    }
}
set_error_handler('php_error_handler');
function pear_error_handler($err_obj)
{
    $error_string = $err_obj->getMessage() . '<br />' . $err_obj->getUserInfo();
    trigger_error($error_string, E_USER_ERROR);
}
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'pear_error_handler');
// Data Source Name (DSN)
//$dsn = '{dbtype}://{user}:{passwd}@{dbhost}/{dbname}';
$dsn = 'mysql://root:@localhost/liveuser_test_example4';
$db =& MDB2::connect($dsn, true);
$db->setFetchMode(MDB2_FETCHMODE_ASSOC);
$tpl = new HTML_Template_IT();
$LUOptions = array('login' => array('force' => true), 'logout' => array('destroy' => true), 'authContainers' => array(array('type' => 'MDB2', 'expireTime' => 3600, 'idleTime' => 1800, 'storage' => array('dsn' => $dsn, 'alias' => array('auth_user_id' => 'authUserId', 'lastlogin' => 'lastLogin', 'is_active' => 'isActive', 'owner_user_id' => 'owner_user_id', 'owner_group_id' => 'owner_group_id', 'users' => 'peoples'), 'fields' => array('lastlogin' => 'timestamp', 'is_active' => 'boolean', 'owner_user_id' => 'integer', 'owner_group_id' => 'integer'), 'tables' => array('users' => array('fields' => array('lastlogin' => false, 'is_active' => false, 'owner_user_id' => false, 'owner_group_id' => false))))), array('type' => 'XML', 'expireTime' => 3600, 'idleTime' => 1800, 'passwordEncryptionMode' => 'MD5', 'storage' => array('file' => 'Auth_XML.xml', 'alias' => array('auth_user_id' => 'userId', 'passwd' => 'password', 'lastlogin' => 'lastLogin', 'is_active' => 'isActive')))), 'permContainer' => array('type' => 'Complex', 'storage' => array('MDB2' => array('dsn' => $dsn, 'prefix' => 'liveuser_', 'alias' => array('perm_users' => 'perm_peoples')))));
require_once 'LiveUser.php';
function forceLogin(&$notification)
{
    $liveUserObj =& $notification->getNotificationObject();
    $username = array_key_exists('username', $_REQUEST) ? $_REQUEST['username'] : null;
    if ($username) {
        $password = array_key_exists('password', $_REQUEST) ? $_REQUEST['password'] : null;
        $liveUserObj->login($username, $password);