示例#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;
 }
<?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',
示例#3
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;
    }
示例#4
0
/**
 * xoops_db_Accessor 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
 * @author		Skalpa Keo <*****@*****.**>
 * @since		2.3.0
 * @package		xoops_db
 * @subpackage	xoops_db_Accessor
 * @version		$Id$
 * @devstatus	unstable
 */
XOS::import('xoops_db_Database');
/**
 * Database accessor component
 * 
 * This class provides a standard interface for database accessors (objects meant to perform a
 * defined set of statements).
 * 
 * It may be extended as-is (by low-level components like the tree or preferences management
 * classes), but XOOPS will provide modules developers with higher-level data access mechanisms
 * for retrieving/storing model entities in the future.
 */
class xoops_db_Accessor
{
    /**
     * The database connection that will be used to perform statements
     * @var xoops_db_Database
示例#5
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();
示例#6
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';
示例#7
0
 /**
  * Accept the specified user as the currently logged in user
  *
  * @param string $login Login of the user to accept
  * @param boolean $permanent Whether to accept this user permanently or for the current request only
  * @return boolean
  */
 function acceptUser($login = '', $permanent = false)
 {
     if (!$login) {
         return false;
     }
     // @TODO-2.3: Clean this up later...
     $GLOBALS['xoopsDB'] = $this->loadService('legacydb');
     require_once XOOPS_ROOT_PATH . '/include/functions.php';
     require_once XOOPS_ROOT_PATH . '/kernel/object.php';
     require_once XOOPS_ROOT_PATH . '/class/criteria.php';
     $handler =& xoops_gethandler('member');
     list($user) = $handler->getUsers(new Criteria('uname', $login));
     if (is_object($user)) {
         $GLOBALS['xoopsUser'] = $user;
         XOS::import('xoops_kernel_User');
         $lvl_lookup = array(0 => XO_LEVEL_INACTIVE, 1 => XO_LEVEL_REGISTERED, 5 => XO_LEVEL_ADMIN);
         $this->currentUser = XOS::create('xoops_kernel_User', array('userId' => $user->getVar('uid', 'n'), 'login' => $user->getVar('uname', 'n'), 'email' => $user->getVar('email', 'n'), 'groups' => $user->getGroups(), 'fullName' => $user->getVar('name', 'n'), 'level' => $lvl_lookup[$user->getVar('level', 'n')]));
         if (isset($this->services['http'])) {
             $this->services['http']->addVariation('xo-user', $this->currentUser->userId);
         }
         if ($permanent && $this->services['session']) {
             $this->services['session']->start();
             $_SESSION[$this->xoBundleIdentifier]['currentUser'] = $login;
         }
         return true;
     } else {
         $GLOBALS['xoopsUser'] = '';
         $this->currentUser = XOS::create('xoops_kernel_User');
     }
     return false;
 }
<?php

/**
 * HTTP service configuration panel class definition
 */
XOS::import('xoops_panel_ConfigurationPanel');
/**
 * HTTP service configuration panel
 * 
 * @package xoops_http
 * @subpackage xoops_http_HttpConfigPanel
 */
class xoops_http_HttpConfigPanel extends xoops_panel_ConfigurationPanel
{
    var $views = array('default' => 'xoops_http_HttpConfigPanel#templates/http-main-view.xotpl');
    var $currentView = 'default';
    var $useHostConfiguration = true;
    var $preferencesBag = array();
    /**
     * Host domain the edited preferences apply to (XO_PREFS_ANYHOST or XO_PREFS_CURRENTHOST)
     * @var string
     */
    var $domainHost = '';
    /**
     * User domain the edited preferences apply to (XO_PREFS_ANYUSER or XO_PREFS_CURRENTUSER)
     * @var string
     */
    var $domainUser = 0;
    /**
     * The PreferencesHandler to use to store/retrieve settings
     * @var xoops_core_PreferencesHandler
 *
 * @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 ----------
示例#10
0
 /**
  * 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);
 }
示例#11
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_auth
 * @subpackage	xoops_auth_DatabaseDriver
 * @version		$Id$
 */
/**
 * This file cannot be requested directly
 */
if (!defined('XOOPS_PATH')) {
    exit;
}
XOS::import('xoops_auth_AuthenticationService');
/**
 * xoops_auth_DatabaseDriver authentication driver
 * 
 * This driver checks if the specified user exists in the database
 * @package		xoops_auth
 * @subpackage	xoops_auth_DatabaseDriver
 */
class xoops_auth_DatabaseDriver extends xoops_auth_AuthenticationDriver
{
    var $hashFunctions = array('md5');
    function checkCredentials($login, $password, $hash = '')
    {
        if (empty($hash)) {
            $password = md5($password);
        }
示例#12
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;
}
示例#13
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();
示例#14
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;
示例#15
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;
示例#16
0
 /**
  * Create an object instance
  * 
  * This function will delegate object instanciation to a local factory if one has been
  * specified. It is also able to handle singletons: when a singleton is requested
  * it will check if it has not been already created and return a reference to the already
  * existing instance if it has.
  */
 function &create($id, $options = null, $args = null)
 {
     $me =& $GLOBALS[EXXOS];
     $inst = false;
     if (is_array($id)) {
         @(list($id, $options, $initArgs) = $id);
     }
     if (isset($me->services[$id])) {
         return $me->services[$id];
     }
     XOS::import($id);
     if (isset($me->registry[$id])) {
         if (!isset($me->factories[$id]) && isset($me->registry[$id]['xoFactory'])) {
             $me->factories[$id] =& XOS::create($me->registry[$id]['xoFactory']);
             unset($me->registry[$id]['xoFactory']);
         }
         if (@is_object($me->factories[$id])) {
             if (method_exists($me->factories[$id], 'createInstanceOf')) {
                 $inst =& $me->factories[$id]->createInstanceOf($id, $options);
             } else {
                 $inst =& $me->factories[$id]->createInstance($options);
             }
         } else {
             $inst =& XOS::createInstanceOf($id, $options, $args);
         }
         if (is_object($inst)) {
             if (@$inst->xoSingleton) {
                 $me->services[$id] =& $inst;
                 if (!@empty($options['xoServiceName'])) {
                     $me->services[$options['xoServiceName']] =& $inst;
                 }
             }
         }
     }
     return $inst;
 }
示例#17
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