Example #1
0
 /**
  * Instanciate the specified module
  */
 function &createInstanceOf($bundleId, $options = array(), $initArgs = array())
 {
     global $xoops;
     XOS::import('xoops_kernel_Module');
     // @TODO: This is lame and limited, whatever, should be arranged later
     if (!empty($bundleId)) {
         // Module ID specified: get its location from the registry
         if (!XOS::import($bundleId)) {
             trigger_error("Cannot instanciate unknown module " . $bundleId, E_USER_WARNING);
             return false;
         }
         $root = $xoops->path(XOS::classVar($bundleId, 'xoBundleRoot')) . '/';
     } else {
         $root = '';
     }
     $moduleInfo = @(include $root . 'xo-info.php');
     unset($moduleInfo['xoServices']);
     $options = array_merge($moduleInfo, $options);
     if (isset($moduleInfo['xoClassPath'])) {
         XOS::import($moduleInfo['xoBundleIdentifier']);
         $inst =& XOS::createInstanceOf($moduleInfo['xoBundleIdentifier'], $options);
     } else {
         $inst =& XOS::createInstanceOf('xoops_kernel_Module', $options);
     }
     $inst->xoBundleIdentifier = $moduleInfo['xoBundleIdentifier'];
     $inst->xoBundleRoot = XOS::classVar($inst->xoBundleIdentifier, 'xoBundleRoot');
     // If we are instanciating the "current" module, find the current location
     if ($inst && empty($bundleId)) {
         $moduleRoot = substr($inst->xoBundleRoot, 4);
         $scriptFile = substr(strstr($_SERVER['SCRIPT_NAME'], $moduleRoot), strlen($moduleRoot));
         $inst->currentLocation = $inst->findLocationName($scriptFile);
     }
     return $inst;
 }
 function sendResponse()
 {
     if ($this->currentView) {
         $form = XOS::create('xoops_pyro_Form', array('instances' => array('preferences' => &$this->preferencesBag), 'submissions' => array('save-prefs' => array($_SERVER['REQUEST_URI'], 'urlencoded-post')), 'renderAsHtml' => true));
         $this->viewVars['form'] = $form;
         $this->viewVars['prefs'] = $this->preferencesBag;
     }
     return parent::sendResponse();
 }
Example #3
0
 /**
  * Initializes the accessor instance
  */
 function xoInit($options = array())
 {
     // If no db specified, automatically connect to the system db
     if (!$this->db) {
         $this->db =& XOS::create('xoops_db_Database');
     }
     if (isset($this->tables[0])) {
         $this->tables = array_combine($this->tables, array_map(array(&$this->db, 'prefix'), $this->tables));
     }
     return true;
 }
Example #4
0
 /**
  * Initialize the specified object as a save handler
  *
  * @param mixed $handler Object to attach (or bundleIdentifier of the handler to instanciate)
  * @return boolean true on success, false otherwise
  */
 function attachHandler($handler)
 {
     if (!is_object($handler)) {
         if (!($handler = XOS::create($handler))) {
             trigger_error("Failed to initialize the session save handler.", E_USER_WARNING);
             return false;
         }
     }
     session_set_save_handler(array(&$handler, 'open'), array(&$handler, 'close'), array(&$handler, 'read'), array(&$handler, 'write'), array(&$handler, 'destroy'), array(&$handler, 'gc'));
     $this->saveHandler =& $handler;
     return true;
 }
Example #5
0
 function checkCredentials($login, $password, $hash = '')
 {
     if (empty($hash)) {
         $password = md5($password);
     }
     $db =& XOS::create('xoops_db_Database');
     $table = $db->prefix('users');
     $stmt = $db->prepare("SELECT COUNT(*) FROM `{$table}` WHERE `uname`=:login AND `pass`=:password");
     $stmt->bindValue(':login', $login, PDO_PARAM_STR);
     $stmt->bindValue(':password', $password, PDO_PARAM_STR);
     if ($stmt->execute()) {
         list($count) = $stmt->fetch(PDO_FETCH_NUM);
         $stmt->closeCursor();
     }
     return @$count ? true : false;
 }
Example #6
0
 /**
  * Check the validity of the specified user credentials
  * 
  * <p>
  * The authentication service asks every driver configured in the
  * xoops_auth_AuthenticationService::authDrivers property to check the specified
  * credentials, until one positively recognizes the user.
  * </p><p>
  * It returns the XOOPS login of the authenticated user if one is identified, or false otherwise
  * </p>
  *
  * @param string $login User name to provide to auth drivers
  * @param string $password Password to provide to auth drivers
  * @param string $hash Hash function used to encrypt the provided password (if any)
  * @return string XOOPS login of the identified user (false if all drivers failed to authenticate the user)
  */
 function checkCredentials($login, $password, $hash = '')
 {
     // Check each auth
     foreach ($this->authDrivers as $k => $driver) {
         if (!is_object($driver)) {
             if (!($instance = XOS::create($driver))) {
                 trigger_error("Cannot instanciate authentication driver {$driver}", E_USER_WARNING);
                 unset($this->authDrivers[$k]);
                 continue;
             }
             $driver = $this->authDrivers[$k] = $instance;
         }
         if ($xoopsLogin = $driver->checkCredentials($login, $password, $hash)) {
             return $xoopsLogin !== true ? $xoopsLogin : $login;
         }
     }
     return false;
 }
Example #7
0
 /**
  * Creates an instance to represent a connection to the requested database
  * 
  * mysql:host=localhost;dbname=mydb
  * to explicitely specify a xoops driver:
  * xoops.legacy:host=localhost;dbname=mydb
  */
 function &createInstance($options = array(), $initArgs = array())
 {
     if (!isset($options['dsn'])) {
         $options['dsn'] = 'system';
     }
     if (isset($this->instances[$options['dsn']])) {
         return $this->instances[$options['dsn']];
     }
     $inst = false;
     $parsed = explode(':', $dsn = $options['dsn'], 2);
     if (count($parsed) == 1) {
         // An alias name was specified
         if (!isset($this->availableStores[$parsed[0]])) {
             trigger_error("The database alias {$parsed[0]} is invalid.", E_USER_WARNING);
             return $inst;
         }
         $options = array_merge($this->availableStores[$parsed[0]], $options);
     } else {
         // A real DSN was specified
         if (substr($parsed[0], 0, 5) == 'xoops') {
             // Convert the rest of the dsn string to properties
             $parsed = explode(';', $parsed[1]);
             foreach ($parsed as $prop) {
                 list($name, $value) = explode('=', $prop, 2);
                 $options[$name] = $value;
             }
             $options['driverName'] = $parsed[0];
         }
     }
     if (substr($options['driverName'], 0, 5) != 'xoops') {
         trigger_error("Direct PDO drivers access is not implemented yet.", E_USER_WARNING);
         return $inst;
     } else {
         $options['driverName'] = substr($options['driverName'], 6);
         $inst =& XOS::create("xoops_db_Database_{$options['driverName']}", $options);
         $this->instances[$dsn] =& $inst;
     }
     return $inst;
 }
Example #8
0
 *
 * @copyright   The Xoops project http://www.xoops.org/
 * @license     http://www.fsf.org/copyleft/gpl.html GNU public license
 * @since       2.3.0
 * @package		xoops_opal
 * @subpackage	xoops_opal_Smarty
 * @version		$Id$
 * @author		Skalpa Keo <*****@*****.**>
 */
/**
 * This file cannot be requested directly
 */
if (!defined('XOOPS_PATH')) {
    exit;
}
XOS::import('Smarty');
/**
 * Opal framework Smarty implementation
 * @since       2.3.0
 * @package		xoops_opal
 * @subpackage	xoops_opal_Smarty
 */
class xoops_opal_Smarty extends Smarty
{
    var $left_delimiter = '([';
    var $right_delimiter = '])';
    var $template_dir = XOOPS_THEME_PATH;
    var $compile_dir = 'var/Application Support/xoops_template_Smarty';
    var $cache_dir = 'var/Caches/xoops_opal_Smarty';
    var $use_sub_dirs = false;
    var $compiler_class = 'xoops_opal_SmartyCompiler';
Example #9
0
 * XoopsTpl class definition (XOOPS 2.0 compatibility layer)
 *
 * @copyright   The XOOPS project http://www.xoops.org/
 * @license     http://www.fsf.org/copyleft/gpl.html GNU public license
 * @since       2.0
 * @package		mod_xoops20
 * @version		$Id$
 * @author      Kazumi Ono (AKA onokazu)
 */
/**
 * This file cannot be requested directly
 */
if (!defined('XOOPS_PATH')) {
    die;
}
XOS::import('xoops_template_Smarty');
/**
 * Template engine
 *
 * DO NOT USE ANY OF THIS CLASS METHODS !!!! (Access the corresponding public property)
 * 
 * @author		Kazumi Ono 	<*****@*****.**>
 * @copyright	(c) 2000-2003 The Xoops Project - www.xoops.org
 * @deprecated
 */
class XoopsTpl extends xoops_template_Smarty
{
    function XoopsTpl()
    {
        global $xoopsConfig;
        $this->xoops_template_Smarty();
Example #10
0
/**
 * xoops_pyro_FormText main class file
 *
 * See the enclosed file LICENSE for licensing information.
 * If you did not receive this file, get it at http://www.fsf.org/copyleft/gpl.html
 *
 * @copyright   The XOOPS project http://www.xoops.org/
 * @license     http://www.fsf.org/copyleft/gpl.html GNU public license
 * @since       2.3.0
 * @version		$Id$
 * @author		Skalpa Keo <*****@*****.**>
 * @package		xoops_pyro
 * @subpackage 	xoops_pyro_Forms
 */
XOS::import('xoops_pyro_FormElement');
/**
 * Form widget for the XForms 'textarea' element
 * 
 * @package		xoops_pyro
 * @subpackage 	xoops_pyro_Forms
 */
class xoops_pyro_FormTextarea extends xoops_pyro_FormElement
{
    var $tagName = 'textarea';
    function renderControl()
    {
        $attrs = $this->attributes;
        if ($this->renderAsHtml) {
            if ($this->name) {
                $attrs['name'] = $this->name;
Example #11
0
    $xoopsTpl->assign(array('xoops_isuser' => true, 'xoops_userid' => $xoopsUser->getVar('uid'), 'xoops_uname' => $xoopsUser->getVar('uname'), 'xoops_isadmin' => $xoopsUserIsAdmin));
    $groups = $xoopsUser->getGroups();
} else {
    $xoopsTpl->assign(array('xoops_isuser' => false, 'xoops_isadmin' => false));
    $groups = XOOPS_GROUP_ANONYMOUS;
}
if (isset($xoopsModule) && is_object($xoopsModule)) {
    // set page title
    $xoopsTpl->assign('xoops_pagetitle', $xoopsModule->getVar('name'));
    $xoopsTpl->assign('xoops_dirname', $xoopsModule->getVar('dirname'));
} else {
    $xoopsTpl->assign('xoops_pagetitle', htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES));
    $xoopsTpl->assign('xoops_dirname', "system");
}
/////////
$builder =& XOS::create('xoops_logos_PageBuilder');
$builder->retrieveBlocks();
$builder->assignVars($xoops->services['theme']->template);
if (xoops_getenv('REQUEST_METHOD') != 'POST' && !empty($xoopsModule) && !empty($xoopsConfig['module_cache'][$xoopsModule->getVar('mid')])) {
    $xoopsTpl->xoops_setCaching(2);
    $xoopsTpl->xoops_setCacheTime($xoopsConfig['module_cache'][$xoopsModule->getVar('mid')]);
    if (!isset($xoopsOption['template_main'])) {
        $xoopsCachedTemplate = 'db:system_dummy.html';
    } else {
        $xoopsCachedTemplate = 'db:' . $xoopsOption['template_main'];
    }
    // generate safe cache Id
    $xoopsCachedTemplateId = 'mod_' . $xoopsModule->getVar('dirname') . '|' . md5(str_replace(XOOPS_URL, '', $GLOBALS['xoopsRequestUri']));
    if ($xoopsTpl->is_cached($xoopsCachedTemplate, $xoopsCachedTemplateId)) {
        $xoopsLogger->addExtra($xoopsCachedTemplate, sprintf('Cached (regenerates every %d seconds)', $xoopsConfig['module_cache'][$xoopsModule->getVar('mid')]));
        $xoopsTpl->assign('xoops_contents', $xoopsTpl->fetch($xoopsCachedTemplate, $xoopsCachedTemplateId));
Example #12
0
 /**
  * Generates widget insertion code
  *
  * This method generates the widget instanciation code to be inserted in the compiled template.
  * It is called for each <object> tag encountered during compilation of XML templates, or by the xoWidget
  * compiler plug-in.
  * 
  * @param array $args
  * @return string PHP code to be inserted in the compiled template
  */
 function insertWidget($args)
 {
     global $xoops;
     if (isset($args['assign'])) {
         $targetVar = $args['assign'];
         unset($args['assign']);
     } else {
         $targetVar = '';
     }
     $bundleId = $args['bundleId'];
     unset($args['bundleId']);
     $realBundleId = substr($bundleId, 1, strlen($bundleId) - 2);
     $code = "\n";
     // Get this widget stylesheet and javascript properties
     if ($css = XOS::classVar($realBundleId, 'stylesheet')) {
         $css = $realBundleId . '#' . $css;
         $attrs = array('type' => 'text/css', 'href' => $xoops->url($this->template_engine->currentTheme->resourcePath($css)));
         $code .= '$this->currentTheme->setMeta( "stylesheet", "' . $css . '", ' . var_export($attrs, true) . ");\n";
     }
     if ($js = XOS::classVar($realBundleId, 'javascript')) {
         $js = $realBundleId . '#' . $js;
         $attrs = array('type' => 'text/javascript', 'src' => $xoops->url($this->template_engine->currentTheme->resourcePath($js)));
         $code .= '$this->currentTheme->setMeta( "script", "' . $js . '", ' . var_export($attrs, true) . ");\n";
     }
     $create = 'XOS::create( ' . $bundleId;
     if (!empty($args)) {
         $create .= ", array(\n";
         foreach ($args as $prop => $value) {
             $create .= "\t'{$prop}' => " . $value . ",\n";
         }
         $create .= ')';
     }
     $create .= " )";
     if (!$targetVar) {
         $code .= "\$widget = {$create};\n";
         $code .= "echo ( \$widget ? \$widget->render() : \"Failed to instanciate {$bundleId} widget.\" );\n";
     } else {
         $code .= "\$this->_tpl_vars[{$targetVar}] = {$create};\n";
     }
     return $code;
 }
Example #13
0
 function resourcePath($path, $fromDocRoot = true)
 {
     global $xoops;
     if ($path[0] == '/') {
         $path = substr($path, 1);
         $fromDocRoot = false;
     }
     if (file_exists("{$this->path}/{$path}")) {
         return "themes/{$this->folderName}/{$path}";
     }
     if (!empty($this->parentTheme)) {
         if (!is_object($this->parentTheme)) {
             $this->parentTheme =& XOS::create('xoops_pyro_Theme', array('folderName' => $this->parentTheme));
         }
         if (is_object($this->parentTheme)) {
             return $this->parentTheme->resourcePath($path, $fromDocRoot);
         }
     }
     return $fromDocRoot ? "www/{$path}" : "themes/{$this->folderName}/{$path}";
 }
<?php

/**
 * xoops_pyro_TreeWidget component class file
 *
 * @copyright	The Xoops project http://www.xoops.org/
 * @license      http://www.fsf.org/copyleft/gpl.html GNU public license
 * @author       Skalpa Keo <*****@*****.**>
 * @since        2.3.0
 * @version		$Id$
 * @package      xoops_pyro
 * @subpackage   xoops_pyro_TreeWidget
 */
XOS::import('xoops_opal_Widget');
/**
 * Widget rendering hierarchical data as a tree
 *
 * The tree widget renders hierarchical data.
 * The default HTML output will show an expandable/collapsable tree made of UL/LI elements.
 * Its dynamic behavior makes strong use of CSS, and only requires minimal scripting (mainly to
 * assign appropriate CSS classes to elements during initialization).
 * 
 * The data is provided to the tree as an array:
 * <code>
 * $data = array(
 * 	'item1' => array(
 * 		'name' => 'Item 1',
 * 	),
 * 	'item2' => array(
 * 		'name' => 'Item 2 with sub',
 * 		'link' => 'item2.html',
 *
 * @copyright	The Xoops project http://www.xoops.org/
 * @license		http://www.fsf.org/copyleft/gpl.html GNU public license
 * @author		Skalpa Keo <*****@*****.**>
 * @since		2.3
 * @package		xoops_http
 * @subpackage	xoops_http_Session
 * @version		$Id$
 */
/**
 * This file cannot be requested directly
 */
if (!defined('XOOPS_PATH')) {
    exit;
}
XOS::import('xoops_http_SessionService');
/**Only use cookies to propagate session ID*/
define('XO_SID_USE_COOKIE', 1);
/**Only use URI to propagate session ID*/
define('XO_SID_USE_URI', 2);
/**Try cookie and fall back to query string if not supported by the user agent*/
define('XO_SID_USE_ANY', 3);
/**
 * xoops_http_CustomSessionService main class
 * @since		2.3
 * @package		xoops_http
 * @subpackage	xoops_http_Session
 */
class xoops_http_CustomSessionService extends xoops_http_SessionService
{
    // ---------- Session ID options ----------
Example #16
0
 function fetch($mode = null, $orientation = null, $offset = null)
 {
     if (!$this->result) {
         return false;
     }
     if (!$mode) {
         $mode = $this->fetchMode;
     }
     switch ($mode) {
         case PDO_FETCH_ASSOC:
             return mysql_fetch_array($this->result, MYSQL_ASSOC);
         case PDO_FETCH_BOTH:
             return mysql_fetch_array($this->result, MYSQL_BOTH);
         case PDO_FETCH_NUM:
             return mysql_fetch_array($this->result, MYSQL_NUM);
         case PDO_FETCH_LAZY:
         case PDO_FETCH_OBJ:
             if ($props = mysql_fetch_array($this->result, MYSQL_ASSOC)) {
                 $target = new stdClass();
                 XOS::apply($target, $props);
                 return $target;
             }
             return false;
         case PDO_FETCH_INTO:
             if ($props = mysql_fetch_array($this->result, MYSQL_ASSOC)) {
                 XOS::apply($this->fetchTarget, $props);
                 return $this->fetchTarget;
             }
             return false;
         case PDO_FETCH_CLASS:
             if ($props = mysql_fetch_array($this->result, MYSQL_ASSOC)) {
                 return XOS::create($this->fetchTarget, $props);
             }
             return false;
         case PDO_FETCH_CLASS | PDO_FETCH_CLASSTYPE:
             if ($props = mysql_fetch_array($this->result, MYSQL_ASSOC)) {
                 $classType = array_shift($props);
                 return XOS::create($classType, $props);
             }
             return false;
         case PDO_FETCH_BOUND:
             if ($row = mysql_fetch_array($this->result, MYSQL_BOTH)) {
                 foreach ($this->columnBindings as $k => $col) {
                     $col[0] = $this->castValue(is_int($k) ? $row[$k - 1] : $row[$k], $col[1]);
                 }
                 return true;
             }
             return false;
     }
 }
Example #17
0
<?php

/**
 * xoops_panel_ConfigurationPanel component main class file
 *
 * @copyright	The Xoops project http://www.xoops.org/
 * @license     http://www.fsf.org/copyleft/gpl.html GNU public license
 * @author      Skalpa Keo <*****@*****.**>
 * @since       2.3.0
 * @version		$$
 * @package     xoops_panel
 * @subpackage  xoops_panel_ConfigurationPanel
 */
XOS::import('xoops_app_PageController');
/**
 * Base class for configuration panels
 * 
 * The page controller receives a page request, extracts any relevant data,
 * invokes any updates to the model, and if necessary forwards the request to the view.
 */
class xoops_panel_ConfigurationPanel extends xoops_app_PageController
{
    /**
     * Configuration handler instanciated by the container application
     * @var object
     */
    var $configHandler = false;
}
Example #18
0
 * See the enclosed file LICENSE for licensing information.
 * If you did not receive this file, get it at http://www.fsf.org/copyleft/gpl.html
 *
 * @copyright	The XOOPS project http://www.xoops.org/
 * @license		http://www.fsf.org/copyleft/gpl.html GNU public license
 * @author		Kazumi Ono <*****@*****.**>
 * @author		Skalpa Keo <*****@*****.**>
 * @since		2.3.0
 * @package		xoops_db
 * @subpackage	xoops_db_Database_legacy
 * @version		$Id$
 */
if (!defined('XOOPS_PATH')) {
    exit;
}
XOS::import('xoops_db_Database_mysql');
/**
 * Legacy xoops_db_Database driver main class
 * @package		xoops_db
 * @subpackage	xoops_db_Database_legacy
 */
class xoops_db_Database_legacy extends xoops_db_Database_mysql
{
    /**
     * assign a {@link XoopsLogger} object to the database
     * @deprecated (assign the logger public property)
     */
    function setLogger(&$logger)
    {
        $this->logger =& $logger;
    }
Example #19
0
 *
 * @copyright	The XOOPS project http://www.xoops.org/
 * @license		http://www.fsf.org/copyleft/gpl.html GNU public license
 * @author		Skalpa Keo <*****@*****.**>
 * @since		2.3.0
 * @package		xoops_http
 * @subpackage	xoops_http_HttpHandler
 * @version		$Id$
 */
/**
 * This file cannot be requested directly
 */
if (!defined('XOOPS_PATH')) {
    exit;
}
XOS::import('xoops_http');
/**
 * HTTP response customization component
 *
 * The HttpHandler component encapsulates the HTTP response manipulation functions
 * (redirection for now, and more later on)
 * @package		xoops_http
 * @subpackage	xoops_http_HttpHandler
 */
class xoops_http_HttpHandler
{
    /**
     * Whether HTTP redirections are enabled or not
     * @var boolean
     */
    var $enableRedirections = true;
Example #20
0
 * XoopsTpl class definition (XOOPS 2.0 compatibility layer)
 *
 * @copyright   The XOOPS project http://www.xoops.org/
 * @license     http://www.fsf.org/copyleft/gpl.html GNU public license
 * @since       2.0
 * @package		mod_xoops20
 * @version		$Id$
 * @author      Kazumi Ono (AKA onokazu)
 */
/**
 * This file cannot be requested directly
 */
if (!defined('XOOPS_PATH')) {
    die;
}
XOS::import('xoops_opal_Smarty');
/**
 * Template engine
 *
 * DO NOT USE ANY OF THIS CLASS METHODS !!!! (Access the corresponding public property)
 * 
 * @author		Kazumi Ono 	<*****@*****.**>
 * @copyright	(c) 2000-2003 The Xoops Project - www.xoops.org
 * @deprecated
 */
class XoopsTpl extends xoops_opal_Smarty
{
    function XoopsTpl()
    {
        global $xoopsConfig, $xoopsUser;
        $this->xoops_opal_Smarty();
Example #21
0
 function resourcePath($path, $fromDocRoot = true)
 {
     global $xoops;
     $parts = explode('#', $path, 2);
     if (count($parts) > 1) {
         list($bundleId, $resPath) = $parts;
         // This is component resource: modules are in 'modules', and components in 'components'
         $themedRoot = substr($parts[0], 0, 4) == 'mod_' ? 'modules' : 'components';
         if (file_exists("{$this->path}/{$themedRoot}/{$bundleId}/{$resPath}")) {
             return "themes/{$this->folderName}/{$themedRoot}/{$bundleId}/{$resPath}";
         } else {
             return XOS::classVar($bundleId, 'xoBundleRoot') . '/' . $resPath;
         }
     }
     if (substr($path, 0, 1) == '/') {
         $path = substr($path, 1);
         $fromDocRoot = false;
     }
     if (file_exists("{$this->path}/{$path}")) {
         return "themes/{$this->folderName}/{$path}";
     }
     if (!empty($this->parentTheme)) {
         if (!is_object($this->parentTheme)) {
             $this->parentTheme =& XOS::create('xoops_opal_Theme', array('folderName' => $this->parentTheme));
         }
         if (is_object($this->parentTheme)) {
             return $this->parentTheme->resourcePath($path, $fromDocRoot);
         }
     }
     return $fromDocRoot ? "www/{$path}" : "themes/{$this->folderName}/{$path}";
 }
 /**
  * Retrieve the managed preferences for the specified domain from the filesystem
  * @access protected
  */
 function loadPersistentValues($bundleId = '', $host = '')
 {
     global $xoops;
     if ($bundleId && !XOS::import($bundleId)) {
         trigger_error("Cannot load persistant preferences of unknown type {$bundleId}", E_USER_WARNING);
         return false;
     }
     $dummy = 0;
     $this->calculateDomainWeight($bundleId, $dummy, $host);
     $managed = $vars = array('' => array());
     if ($bundleId && class_exists($bundleId)) {
         $vars[''] = array_merge($vars[''], get_class_vars($bundleId));
     }
     if (!$bundleId) {
         $bundleId = 'global';
     }
     if ($fromfile = @(include $xoops->path("/XOOPS/Preferences/{$bundleId}.php"))) {
         if (!is_array($fromfile)) {
             trigger_error("Managed preferences file for {$bundleId} is corrupt", E_USER_WARNING);
         } else {
             $managed[''] = array_merge($managed[''], array_keys($fromfile));
             $vars[''] = array_merge($vars[''], $fromfile);
         }
     }
     if ($host) {
         $managed[$host] = $managed[''];
         $vars[$host] = $vars[''];
         if ($fromfile = @(include $xoops->path("/XOOPS/Preferences/ByHost/{$host}-{$bundleId}.php"))) {
             if (!is_array($fromfile)) {
                 trigger_error("Managed preferences file for {$bundleId} is corrupt", E_USER_WARNING);
             } else {
                 $managed[$host] = array_merge($managed[$host], array_keys($fromfile));
                 $vars[$host] = array_merge($vars[$host], $fromfile);
             }
         }
     }
     return array($vars, $managed);
 }
Example #23
0
 /**
  * Convert a XOOPS path to a physical one
  */
 function path($url, $virtual = false)
 {
     // If the URL begins with protocol:// then remove it
     if ($pos = strpos($url, '://')) {
         $url = substr($url, $pos + 3);
     }
     $parts = explode('#', $url);
     if (count($parts) == 1) {
         if ($parts[0][0] == '/') {
             $parts[0] = substr($parts[0], 1);
         }
         $parts = explode('/', $parts[0], 2);
         if (!$virtual) {
             return !isset($this->paths[$parts[0]]) ? '' : $this->paths[$parts[0]][0] . '/' . $parts[1];
         } else {
             if (!isset($this->paths[$parts[0]][1])) {
                 return false;
             }
             if (empty($this->paths[$parts[0]][1])) {
                 return $this->baseLocation . '/' . $parts[1];
             }
             return $this->baseLocation . '/' . $this->paths[$parts[0]][1] . '/' . $parts[1];
         }
     } else {
         $root = XOS::classVar($parts[0], 'xoBundleRoot');
         return $this->path($root . '/' . $parts[1]);
     }
 }
Example #24
0
 /**
  * Convert a XOOPS path to a physical one
  */
 function path($url, $virtual = false)
 {
     // If the URL begins with protocol:// then remove it
     if ($pos = strpos($url, '://')) {
         $url = substr($url, $pos + 3);
     }
     $parts = explode('#', $url);
     if (count($parts) == 1) {
         if (substr($parts[0], 0, 1) == '/') {
             $parts[0] = substr($parts[0], 1);
         }
         $parts = explode('/', $parts[0], 2);
         if (!$virtual) {
             return !isset($this->paths[$parts[0]]) ? '' : $this->paths[$parts[0]][0] . '/' . $parts[1];
         } else {
             if (!isset($this->paths[$parts[0]][1])) {
                 return false;
             }
             if (empty($this->paths[$parts[0]][1])) {
                 return $this->baseLocation . '/' . $parts[1];
             }
             return $this->baseLocation . '/' . $this->paths[$parts[0]][1] . '/' . $parts[1];
         }
     } else {
         $root = XOS::classVar($parts[0], 'xoBundleRoot');
         @(list($location, $query) = explode('?', $parts[1]));
         if (empty($location) || strpos($location, '/') !== false) {
             return $this->path($root . '/' . $location, $virtual);
         }
         if ($module = $this->loadModule($parts[0])) {
             $uri = $module->xoBundleRoot;
             if (isset($module->moduleLocations[$location])) {
                 $uri .= $module->moduleLocations[$location]['scriptFile'];
             } else {
                 trigger_error("Unknown location {$parts[0]}#{$location}", E_USER_WARNING);
                 return false;
             }
             if (isset($query)) {
                 $uri .= (strpos($uri, '?') ? '&' : '?') . $query;
             }
             return $this->path($uri, $virtual);
         }
     }
     return false;
 }
Example #25
0
 /**
  * Create an instance of the specified class
  * 
  * This method is internally called by 'create' to create classes instances.
  * It can also be used by local factories.
  */
 function &createInstanceOf($class, $options = null, $args = null)
 {
     $inst = false;
     if (!class_exists($class)) {
         trigger_error("Unknown class {$class}", E_USER_WARNING);
         return $inst;
     }
     $inst =& new $class();
     if (is_object($inst)) {
         // Set specified properties values
         XOS::apply($inst, $options);
         XOS::apply($inst, $GLOBALS[EXXOS]->registry[$class]);
         $inst->xoBundleIdentifier = $class;
         // Initialize the component instance
         if (method_exists($inst, 'xoInit')) {
             if (!$inst->xoInit($options)) {
                 return $inst;
             }
         }
         return $inst;
     }
     return $inst;
 }
Example #26
0
 * @copyright	The XOOPS project http://www.xoops.org/
 * @license		http://www.fsf.org/copyleft/gpl.html GNU public license
 * @author		Skalpa Keo <*****@*****.**>
 * @since		2.3.0
 * @package		xoops_opal
 * @subpackage	xoops_opal_PdfMaker
 * @version		$Id$
 */
/**
 * This file cannot be requested directly
 */
if (!defined('XOOPS_PATH')) {
    exit;
}
XOS::import('FPDF');
XOS::import('PDML');
/**
 * Opal PDF generation component (based on {@link http://pdml.sourceforge.net/ PDML}+{@link http://www.fpdf.org/ FPDF})
 *
 * For the moment the PDF maker just provides a dummy implementation of {@link http://pdml.sourceforge.net/ PDML}/
 * {@link http://www.fpdf.org/ FPDF}. It is called by the {@link xoops_opal_Theme theme service} when it is
 * asked to return PDF output (templates are processed normally, and their output sent to this component for
 * post-processing).
 * 
 * Please note that this component is just here for experimentation purposes and that the decision to go for
 * PDML is not yet definitive. If you don't want to take any risk to have to rewrite some of your code,
 * you may prefer to make direct use of the FPDF class.
 * 
 * @package		xoops_opal
 * @subpackage	xoops_opal_PdfMaker
 * @devstatus	unstable