/** * Constructeur de bbCodeObject * * @param array $params Param�tres * * @return void * */ function __construct($params = array()) { parent::__construct(); if (!in_array('noPEAR', $params)) { $config = parse_ini_file('BBCodeParser.ini', true); $pear = new PEAR(); $options = $pear->getStaticProperty('HTML_BBCodeParser', '_options'); $options = $config['HTML_BBCodeParser']; $this->parserBB = new HTML_BBCodeParser2($options); } }
/** * ユーザ設定読み込み関数 * * @param void * @return array */ function ic2_loadconfig() { static $ini = null; if (is_null($ini)) { $_conf = $GLOBALS['_conf']; include P2_CONFIG_DIR . '/conf_ic2.inc.php'; $ini = array(); $_ic2conf = preg_grep('/^expack\\.ic2\\.\\w+\\.\\w+$/', array_keys($_conf)); foreach ($_ic2conf as $key) { $p = explode('.', $key); $cat = ucfirst($p[2]); $name = $p[3]; if (!isset($ini[$cat])) { $ini[$cat] = array(); } $ini[$cat][$name] = $_conf[$key]; } // DB_DataObjectの設定 $_dao_options =& PEAR::getStaticProperty('DB_DataObject', 'options'); if (!is_array($_dao_options)) { $_dao_options = array(); } $_dao_options['database'] = $ini['General']['dsn']; $_dao_options['debug'] = false; $_dao_options['quote_identifiers'] = true; $_dao_options['db_driver'] = 'DB'; } return $ini; }
/** * Connect to the database. * * @return void * @access public */ public static function connectToDatabase() { global $configArray; if (!defined('DB_DATAOBJECT_NO_OVERLOAD')) { define('DB_DATAOBJECT_NO_OVERLOAD', 0); } $options =& PEAR::getStaticProperty('DB_DataObject', 'options'); // If we're using PostgreSQL, we need to set up some extra configuration // settings so that unique ID sequences are properly registered: if (substr($configArray['Database']['database'], 0, 5) == 'pgsql') { $tables = array('comments', 'oai_resumption', 'resource', 'resource_tags', 'search', 'session', 'tags', 'user', 'user_list', 'user_resource'); foreach ($tables as $table) { $configArray['Database']['sequence_' . $table] = $table . '_id_seq'; } } $options = $configArray['Database']; if (substr($configArray['Database']['database'], 0, 5) == 'mysql') { // If we're using MySQL, we need to make certain adjustments (ANSI // quotes, pipes as concatenation operator) for proper compatibility // with code built for other database systems like PostgreSQL or Oracle. $obj = new DB_DataObject(); $conn = $obj->getDatabaseConnection(); $conn->query("SET @@SESSION.sql_mode='ANSI_QUOTES,PIPES_AS_CONCAT'"); $conn->query("SET NAMES UTF8"); } else { if (substr($configArray['Database']['database'], 0, 4) == 'oci8') { // If we are using Oracle, set some portability values: $temp_db = new DB_DataObject(); $db =& $temp_db->getDatabaseConnection(); $db->setOption('portability', DB_PORTABILITY_NUMROWS | DB_PORTABILITY_NULL_TO_EMPTY); // Update the date format to fix issues with Oracle being evil $db->query("ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'"); } } }
/** * * Constructor * * @param $module name of the requested module * @param $action name of the requested action * @param $params Optional parameters */ function __construct($module = 'defaut', $action = 'index', $params = null) { $this->module = $module ? $module : 'defaut'; $this->action = $action ? $action : 'index'; $this->params = $params; $this->setConfig(PEAR::getStaticProperty('Dispatcher', 'global')); }
function CachedFeed($uri) { $this->uri = $uri; $config = parse_ini_file(dirname(dirname(__FILE__)) . '/configs/db.ini'); $options =& PEAR::getStaticProperty('DB_DataObject', 'options'); $options = $config; }
public function tree($modules = null) { if (is_null($modules)) { $modules = $this->getOption('modulesToList'); } $officeConfig = PEAR::getStaticProperty('m_office', 'options'); $moduleconf = $officeConfig['modules']; $diff = array_diff(array_keys($_GET), array('module')); $o = array(); foreach ($modules as $id => $module) { if (is_array($module)) { if (!can('tab', $id)) { continue; } $res = array('name' => $id, 'icon' => $moduleconf[$id]['icon']); $res['submodules'] = $this->tree($module); if (in_array($_REQUEST['module'], $module)) { $res['expanded'] = true; } } else { if (!can('tab', $module)) { continue; } $res = array('name' => $module, 'icon' => $moduleconf[$module]['icon'], 'url' => M_Office::URL($module, array(), $diff)); if ($_REQUEST['module'] == $module || $_REQUEST['module'] == $module . 'helper') { $res['active'] = true; } } $o[] = $res; } return $o; }
/** * initialize DataObject.ini * * @access private */ function initialize() { global $dbo_options; include_once 'DB/DataObject.php'; $options =& PEAR::getStaticProperty("DB_DataObject", "options"); $options = $dbo_options; }
function dataObject() { /* Configuración de PEAR */ $options =& PEAR::getStaticProperty('DB_DataObject', 'options'); $options = array('debug' => Moe::$config['DEBUG_PEAR'], 'database' => "mysql://" . Moe::$config['DATABASE']['USER'] . ":" . Moe::$config['DATABASE']['PASSWORD'] . "@" . Moe::$config['DATABASE']['SERVER'] . "/" . Moe::$config['DATABASE']['DBNAME'], 'schema_location' => '../models', 'class_location' => '../models', 'require_prefix' => 'db/', 'class_prefix' => 'DataObjects_', 'db_driver' => 'MDB2', 'generate_links' => true, 'quote_identifiers' => true, 'build_views' => true, 'generator_no_ini' => true); return $options; }
public function &factory($driver = 'SIPS') { $driver = strtoupper($driver); $className = 'Payment_Driver_' . $driver; $options = PEAR::getStaticProperty('Payment_process', 'options'); return new $className($options); }
public function setUp() { // Setup Local Database Connection define('DB_DATAOBJECT_NO_OVERLOAD', 0); $options =& PEAR::getStaticProperty('DB_DataObject', 'options'); $configurationReader = new ConfigurationReader(); $options = $configurationReader->readConfiguration('Database'); }
/** * initialize the DAO object * * @param string $dsn the database connection string * * @return void * @access private */ function init($dsn) { $options =& PEAR::getStaticProperty('DB_DataObject', 'options'); $options['database'] = $dsn; if (defined('CIVICRM_DAO_DEBUG')) { self::DebugLevel(CIVICRM_DAO_DEBUG); } }
/** * Executes statements before the actual array building starts * * This method should be overwritten in a filter if you want to do * something before the parsing process starts. This can be useful to * allow certain short alternative tags which then can be converted into * proper tags with preg_replace() calls. * The main class walks through all the filters and and calls this * method if it exists. The filters should modify their private $_text * variable. * * @return none * @access private * @see $_text * @author Stijn de Reede <*****@*****.**> */ function _preparse() { $options = PEAR::getStaticProperty('HTML_BBCodeParser', '_options'); $o = $options['open']; $c = $options['close']; $oe = $options['open_esc']; $ce = $options['close_esc']; $this->_preparsed = preg_replace("!" . $oe . "img(" . $ce . "|\\s.*" . $ce . ")(.*)" . $oe . "/img" . $ce . "!Ui", $o . "img=\\2\\1" . $o . "/img" . $c, $this->_text); }
/** * Executes statements before the actual array building starts * * This method should be overwritten in a filter if you want to do * something before the parsing process starts. This can be useful to * allow certain short alternative tags which then can be converted into * proper tags with preg_replace() calls. * The main class walks through all the filters and and calls this * method if it exists. The filters should modify their private $_text * variable. * * @return none * @access private * @see $_text * @author Stijn de Reede <*****@*****.**>, Seth Price <*****@*****.**> */ function _preparse() { $options = PEAR::getStaticProperty('HTML_BBCodeParser', '_options'); $o = $options['open']; $c = $options['close']; $oe = $options['open_esc']; $ce = $options['close_esc']; $pattern = array("!" . $oe . "\\*" . $ce . "!", "!" . $oe . "(u?)list=(?-i:A)(\\s*[^" . $ce . "]*)" . $ce . "!i", "!" . $oe . "(u?)list=(?-i:a)(\\s*[^" . $ce . "]*)" . $ce . "!i", "!" . $oe . "(u?)list=(?-i:I)(\\s*[^" . $ce . "]*)" . $ce . "!i", "!" . $oe . "(u?)list=(?-i:i)(\\s*[^" . $ce . "]*)" . $ce . "!i", "!" . $oe . "(u?)list=(?-i:1)(\\s*[^" . $ce . "]*)" . $ce . "!i", "!" . $oe . "(u?)list([^" . $ce . "]*)" . $ce . "!i"); $replace = array($o . "li" . $c, $o . "\$1list=upper-alpha\$2" . $c, $o . "\$1list=lower-alpha\$2" . $c, $o . "\$1list=upper-roman\$2" . $c, $o . "\$1list=lower-roman\$2" . $c, $o . "\$1list=decimal\$2" . $c, $o . "\$1list\$2" . $c); $this->_preparsed = preg_replace($pattern, $replace, $this->_text); }
/** * Executes statements before the actual array building starts * * This method should be overwritten in a filter if you want to do * something before the parsing process starts. This can be useful to * allow certain short alternative tags which then can be converted into * proper tags with preg_replace() calls. * The main class walks through all the filters and and calls this * method if it exists. The filters should modify their private $_text * variable. * * @return none * @access private * @see $_text * @author Stijn de Reede <*****@*****.**> */ function _preparse() { $options = PEAR::getStaticProperty('HTML_BBCodeParser', '_options'); $o = $options['open']; $c = $options['close']; $oe = $options['open_esc']; $ce = $options['close_esc']; $pattern = array("!(^|\\s|\\()((((http(s?)|ftp)://)|www)[-a-z0-9.]+\\.[a-z]{2,4}[^\\s<()]*)!i", "!" . $oe . "url(" . $ce . "|\\s.*" . $ce . ")(.*)" . $oe . "/url" . $ce . "!iU"); $replace = array("\\1" . $o . "url" . $c . "\\2" . $o . "/url" . $c, $o . "url=\\2\\1\\2" . $o . "/url" . $c); $this->_preparsed = preg_replace($pattern, $replace, $this->_text); }
public function __construct($module) { parent::__construct(); $this->assign('__action', 'add'); $tpl = Mreg::get('tpl'); $tpl->concat('adminTitle', ' :: ' . $this->moduloptions['title'] . ' :: ' . __('Add record')); $mopts = PEAR::getStaticProperty('m_office', 'options'); $mopt = $mopts['modules'][$module]; $table = $mopt['table']; $do = M_Office_Util::doForModule($module); $this->append('subActions', '<a href="' . M_Office_Util::getQueryParams(array(), array('record', 'doSingleAction')) . '">' . __('Go to the %s list', array($mopt['title'])) . '</a>'); $formBuilder =& MyFB::create($do); // linkNewValue creates an issue if some linked elements are put in predefgroups // $formBuilder->linkNewValue = true; $form = new MyQuickForm('editRecord', 'POST', M_Office_Util::getQueryParams(array(), array(), false), '_self', null, true); $form->addElement('hidden', 'submittedNewRecord', 1); if (isset($_REQUEST['filterField'])) { $form->addElement('hidden', 'filterField', $_REQUEST['filterField']); $form->addElement('hidden', 'filterValue', $_REQUEST['filterValue']); $do->{$_REQUEST['filterField']} = $_REQUEST['filterValue']; } $links = $do->links(); if (key_exists($_REQUEST['filterField'], $links)) { $linfo = explode(':', $links[$_REQUEST['filterField']]); $form->addElement('static', 'mod', '', __('Add record with %s = %s', array($_REQUEST['filterField'], $_REQUEST['filterValue'])) . '. ' . '<a href="' . M_Office_Util::getQueryParams(array('table' => $linfo[0], 'record' => $_REQUEST['filterValue']), array('addRecord', 'filterField', 'filterValue')) . '">' . __('Back to main record') . '</a>'); } $formBuilder->useForm($form); $formBuilder->getForm(); if ($this->getOption('createAnother', $table)) { $form->addElement('static', ' ', ' '); $form->addElement('checkbox', 'returnHere', __('Create another record')); if (isset($_REQUEST['returnHere']) && $_REQUEST['returnHere']) { $form->setDefaults(array('returnHere' => true)); } } M_Office_Util::addHiddenFields($form); if ($form->validate()) { if (PEAR::isError($ret = $form->process(array(&$formBuilder, 'processForm'), false))) { $this->append('error', __('An error occured while inserting record') . ' : ' . $ret->getMessage()); } else { $pk = DB_DataObject_FormBuilder::_getPrimaryKey($do); $this->say(__('New record was successfully created. Its identifier is : %s', array($do->{$pk}))); if ($this->getOption('createAnother', $table) && isset($_REQUEST['returnHere']) && $_REQUEST['returnHere']) { M_Office_Util::refresh(M_Office_Util::getQueryParams(array('returnHere' => $_REQUEST['returnHere']), array(), false)); } else { $pk = DB_DataObject_FormBuilder::_getPrimaryKey($do); M_Office_Util::refresh(M_Office_Util::getQueryParams(array('record' => $do->{$pk}), array('returnHere', 'addRecord'), false)); } } } elseif ($form->isSubmitted()) { } $this->assign('addForm', $form); $this->assign('do', $do); }
public function setUp() { // Set up the global config array required by the ILS driver: global $configArray; $configArray = parse_ini_file('conf/config.ini', true); // Setup Local Database Connection define('DB_DATAOBJECT_NO_OVERLOAD', 0); $options =& PEAR::getStaticProperty('DB_DataObject', 'options'); $configurationReader = new ConfigurationReader(); $options = $configurationReader->readConfiguration('Database'); }
function generateReaders() { $options =& PEAR::getStaticProperty('DB_DataObject', 'options'); $out = array(); foreach ($this->tables as $this->table) { $this->table = trim($this->table); $out = array_merge($out, $this->_generateReader($this->table)); } //echo '<PRE>';print_r($out);exit; file_put_contents($options["ini_{$this->_database}"] . '.reader', serialize($out)); }
/** Constructeur. * @warning Ne doit jamais être appelé directement, à part par Blogmarks_Marker::singleton() */ function Blogmarks_Marker() { // Initialisation des slots $this->_initSlots(); // Configuration des datatobjects $config = parse_ini_file(dirname(__FILE__) . '/config.ini', TRUE); foreach ($config as $class => $values) { $options =& PEAR::getStaticProperty($class, 'options'); $options = $values; } }
/** * Executes statements before the actual array building starts * * This method should be overwritten in a filter if you want to do * something before the parsing process starts. This can be useful to * allow certain short alternative tags which then can be converted into * proper tags with preg_replace() calls. * The main class walks through all the filters and and calls this * method if it exists. The filters should modify their private $_text * variable. * * @return none * @access private * @see $_text * @author Stijn de Reede <*****@*****.**> */ function _preparse() { $options = PEAR::getStaticProperty('HTML_BBCodeParser', '_options'); $o = $options['open']; $c = $options['close']; $oe = $options['open_esc']; $ce = $options['close_esc']; $pattern = array("!(^|\\s)([-a-z0-9_.]+@[-a-z0-9.]+\\.[a-z]{2,4})!i", "!" . $oe . "email(" . $ce . "|\\s.*" . $ce . ")(.*)" . $oe . "/email" . $ce . "!Ui"); $replace = array("\\1" . $o . "email=\\2" . $c . "\\2" . $o . "/email" . $c, $o . "email=\\2\\1\\2" . $o . "/email" . $c); $this->_preparsed = preg_replace($pattern, $replace, $this->_text); }
public function setUpDatabase() { /** * DB_DataObject configuration * */ $options =& PEAR::getStaticProperty('DB_DataObject', 'options'); $options = array('database' => DB_URI, 'schema_location' => APP_ROOT . 'app/models/', 'class_location' => APP_ROOT . 'app/models/', 'require_prefix' => 'DataObjects/', 'class_prefix' => 'DataObjects_', 'debug' => key_exists('debug', $_GET) ? 1 : 0, 'extends' => 'DB_DataObject_Pluggable', 'extends_location' => 'M/DB/DataObject/Pluggable.php', 'db_driver' => 'MDB2', 'quote_identifiers' => true, 'generator_no_ini' => true); $db_options =& PEAR::getStaticProperty('MDB2', 'options'); $db_options['portability'] = MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_FIX_CASE; }
/** * Executes statements before the actual array building starts * * This method should be overwritten in a filter if you want to do * something before the parsing process starts. This can be useful to * allow certain short alternative tags which then can be converted into * proper tags with preg_replace() calls. * The main class walks through all the filters and and calls this * method if it exists. The filters should modify their private $_text * variable. * * @return none * @access private * @see $_text * @author Stijn de Reede <*****@*****.**> */ function _preparse() { $options = PEAR::getStaticProperty('HTML_BBCodeParser', '_options'); $o = $options['open']; $c = $options['close']; $oe = $options['open_esc']; $ce = $options['close_esc']; $pattern = array("!" . $oe . "\\*" . $ce . "(.*)!i", "!" . $oe . "list" . $ce . "(.+)" . $oe . "/list" . $ce . "!isU"); $replace = array($o . "li" . $c . "\\1" . $o . "/li" . $c, $o . "ulist" . $c . "\\1" . $o . "/ulist" . $c); $this->_preparsed = preg_replace($pattern, $replace, $this->_text); }
public function setup() { M_Office_Util::$mainOptions = PEAR::getStaticProperty('m_office', 'options'); M::addPaths('module', array(APP_ROOT . 'app/_shared/modules/', APP_ROOT . 'app/' . APP_NAME . '/modules/', 'M/Office/modules/')); M::addPaths('template', array(OFFICE_TEMPLATES_FOLDER, APP_ROOT . 'app/_shared/templates/', APP_ROOT . 'app/' . APP_NAME . '/templates/')); if (Config::getPref('theme')) { M::addPaths('template', array(APP_ROOT . 'public/themes/' . Config::getPref('theme') . '/templates/')); } $tpl = new Mtpl(M::getPaths('template')); $tpl->assign('jsdir', SITE_URL . 'js/'); Mreg::set('tpl', $tpl); }
function &singleton($dsn = DSN, $fetchmode = DB_FETCHMODE_ASSOC) { $db =& PEAR::getStaticProperty('SADB', md5($dsn)); if (is_null($db)) { $db =& DB::connect(DSN); if (DB::isError($db)) { PEAR::raiseError($db->getMessage(), $db->getCode(), PEAR_ERROR_DIE); } $db->setFetchMode($fetchmode); } return $db; }
function execute(&$controller, &$request, &$user) { $key = urldecode($request->getParameter('key')); $tmp_member = DB_DataObject::factory('member_temporary'); $member = DB_DataObject::factory('member'); // move temporary member as real member. $tmp_member->get('activate_key', $key); $member->account = $tmp_member->account; $member->password = $tmp_member->password; $member->email = $tmp_member->email; $member->design_id = PLNET_DEFAULT_DESIGN_ID; $member->createdtime = date("Y-m-d H:i:s"); $member_id = $member->insert(); if ($member_id === false) { $error =& PEAR::getStaticProperty('DB_DataObject', 'lastError'); if (PEAR::isError($error)) { trigger_error($error->toString(), E_USER_ERROR); exit; } return VIEW_NONE; } // site $site = DB_DataObject::factory('site'); $site->member_id = $member_id; $site->title = sprintf(msg('default site title'), $member->account); $site->description = msg('default site description'); $site->createdtime = date("Y-m-d H:i:s"); $site_id = $site->insert(); if ($site_id === false) { $error =& PEAR::getStaticProperty('DB_DataObject', 'lastError'); if (PEAR::isError($error)) { trigger_error($error->toString(), E_USER_ERROR); exit; } return VIEW_NONE; } // set authentication. $user->setAuthenticated(true); $user->addPrivilege('member', GLU_NS); $user->setAttribute('member', $member, GLU_NS); // delete temporary member. //TODO: FIXME $tmp_member_id = $tmp_member->delete(); if ($tmp_member_id === false) { $error =& PEAR::getStaticProperty('DB_DataObject', 'lastError'); if (PEAR::isError($error)) { trigger_error($error->toString(), E_USER_ERROR); exit; } return VIEW_NONE; } Controller::redirect(SCRIPT_PATH . 'setting/feed'); return VIEW_NONE; }
function oid_link_user($id, $canonical, $display) { $oid = new User_openid(); $oid->user_id = $id; $oid->canonical = $canonical; $oid->display = $display; $oid->created = DB_DataObject_Cast::dateTime(); if (!$oid->insert()) { $err = PEAR::getStaticProperty('DB_DataObject', 'lastError'); return false; } return true; }
function set_notify(&$user, $notify) { $orig = clone $user; $user->jabbernotify = $notify; $result = $user->update($orig); if (!$result) { $last_error =& PEAR::getStaticProperty('DB_DataObject', 'lastError'); common_log(LOG_ERR, 'Could not set notify flag to ' . $notify . ' for user ' . common_log_objstring($user) . ': ' . $last_error->message); return false; } else { common_log(LOG_INFO, 'User ' . $user->nickname . ' set notify flag to ' . $notify); return true; } }
public function setup() { $options =& PEAR::getStaticProperty('DB_DataObject', 'options'); $options['class_location'] = PEAR_FOLDER . 'M/tests/DO/'; $options['schema_location'] = PEAR_FOLDER . 'M/tests/DO/'; $options['class_prefix'] = 'DataObjects_'; foreach (FileUtils::getAllFiles(PEAR_FOLDER . 'M/tests/DO/') as $file) { unlink($file); } foreach (FileUtils::getAllFiles(PEAR_FOLDER . 'M/tests/DO_dist/') as $file) { copy($file, str_replace('DO_dist', 'DO', $file)); } $this->setUpDatabase('Mfixture.sql', 1); }
protected function _checkForCustomLinks() { $data = PEAR::getStaticProperty('DB_DataObject', 'options'); $folder = $data['class_location']; $files = FileUtils::getAllFiles($folder, 'php'); foreach ($files as $file) { $content = file_get_contents($file); $classname = strtolower(basename($file, '.php')); if (DB_DataObject_Advgenerator::hasCustomLinksMethod($content)) { if ($this->confirm($classname . ' class seems to have dynamic/conditional links.' . "\n" . 'Do you wish to scan all table for link fix (long but recommended) ?', 'y')) { $this->toScan[] = $classname; } } } }
/** * phpBB parser * * @param array $data * @return bool true or false on error */ public function perform($data = FALSE) { /* get options from the ini file */ // $config = parse_ini_file('BBCodeParser.ini', true); $config = parse_ini_file(SMART_BASE_DIR . 'modules/common/includes/PEAR/Text/BBCodeParser_V2.ini', true); $options =& PEAR::getStaticProperty('HTML_BBCodeParser', '_options'); $options = $config['HTML_BBCodeParser']; unset($options); if (!isset($this->model->phpBBParser) || !is_object($this->model->phpBBParser)) { $this->model->phpBBParser = new HTML_BBCodeParser(SMART_BASE_DIR . 'modules/common/includes/PEAR/Text/BBCodeParser_V2.ini'); } $this->model->phpBBParser->setText($data['content']); $this->model->phpBBParser->parse(); $data['content'] = $this->model->phpBBParser->getParsed(); }
/** * Returns a SOAP XML message that can be sent as a server response. * * @return string */ function message($encoding = SOAP_DEFAULT_ENCODING) { $msg = new SOAP_Base(); $params = array(); $params[] = new SOAP_Value('faultcode', 'QName', SOAP_BASE::SOAPENVPrefix() . ':' . $this->code); $params[] = new SOAP_Value('faultstring', 'string', $this->message); $params[] = new SOAP_Value('faultactor', 'anyURI', $this->error_message_prefix); if (PEAR::getStaticProperty('SOAP_Fault', 'backtrace') && isset($this->backtrace)) { $params[] = new SOAP_Value('detail', 'string', $this->backtrace); } else { $params[] = new SOAP_Value('detail', 'string', $this->userinfo); } $methodValue = new SOAP_Value('{' . SOAP_ENVELOP . '}Fault', 'Struct', $params); $headers = null; return $msg->makeEnvelope($methodValue, $headers, $encoding); }