📄 classes.php
字号:
function persist()
{
global $mainframe;
$usercookie = mosGetParam( $_COOKIE, 'usercookie', null );
if ($usercookie) {
// Remember me cookie exists. Login with usercookie info.
$mainframe->login( $usercookie['username'], $usercookie['password'] );
}
}
/**
* Legacy Method, use {@link JTable::reorder()} instead
* @deprecated As of 1.5
*/
function updateOrder( $where='' )
{
return $this->reorder( $where );
}
/**
* Legacy Method, use {@link JTable::publish()} instead
* @deprecated As of 1.0.3
*/
function publish_array( $cid=null, $publish=1, $user_id=0 )
{
$this->publish( $cid, $publish, $user_id );
}
/**
* Legacy Method, use {@link JTable::publish()} instead
* @deprecated As of 1.5
*/
function setFromRequest( $key, $varName, $default=null )
{
if (isset( $_REQUEST[$varName] )) {
return $_SESSION[$key] = $_REQUEST[$varName];
} else if (isset( $_SESSION[$key] )) {
return $_SESSION[$key];
} else {
return $_SESSION[$key] = $default;
}
}
}
/**
* Legacy class, use {@link JTableUser} instead
*
* @deprecated As of version 1.5
* @package Joomla.Legacy
* @subpackage 1.5
*/
class mosUser extends JTableUser
{
/**
* Constructor
*/
function __construct(&$db)
{
parent::__construct( $db );
}
function mosUser(&$db)
{
parent::__construct( $db);
}
/**
* Legacy Method, use {@link JTable::reorder()} instead
* @deprecated As of 1.5
*/
function updateOrder( $where='' )
{
return $this->reorder( $where );
}
/**
* Legacy Method, use {@link JTable::publish()} instead
* @deprecated As of 1.0.3
*/
function publish_array( $cid=null, $publish=1, $user_id=0 )
{
$this->publish( $cid, $publish, $user_id );
}
/**
* Returns a complete user list
*
* @return array
* @deprecated As of 1.5
*/
function getUserList()
{
$this->_db->setQuery("SELECT username FROM #__users");
return $this->_db->loadAssocList();
}
/**
* Gets the users from a group
*
* @param string The value for the group
* @param string The name for the group
* @param string If RECURSE, will drill into child groups
* @param string Ordering for the list
* @return array
* @deprecated As of 1.5
*/
function getUserListFromGroup( $value, $name, $recurse='NO_RECURSE', $order='name' )
{
$acl =& JFactory::getACL();
// Change back in
$group_id = $acl->get_group_id( $value, $name, 'ARO');
$objects = $acl->get_group_objects( $group_id, 'ARO', 'RECURSE');
if (isset( $objects['users'] ))
{
$gWhere = '(id =' . implode( ' OR id =', $objects['users'] ) . ')';
$query = 'SELECT id AS value, name AS text'
. ' FROM #__users'
. ' WHERE block = "0"'
. ' AND ' . $gWhere
. ' ORDER BY '. $order
;
$this->_db->setQuery( $query );
$options = $this->_db->loadObjectList();
return $options;
} else {
return array();
}
}
}
/**
* Legacy class, use {@link JDatabase} instead
*
* @deprecated As of version 1.5
* @package Joomla.Legacy
* @subpackage 1.5
*/
class database extends JDatabaseMySQL
{
function __construct ($host='localhost', $user, $password, $database='', $prefix='', $offline = true)
{
$options = array ( 'host' => $host, 'user' => $user, 'password' => $password, 'database' => $database, 'prefix' => $prefix );
parent::__construct( $options );
}
/**
* This global function loads the first row of a query into an object
*
* If an object is passed to this function, the returned row is bound to the existing elements of <var>object</var>.
* If <var>object</var> has a value of null, then all of the returned query fields returned in the object.
*
* @param object The address of variable
*/
function loadObject( &$object )
{
if ($object != null)
{
if (!($cur = $this->query())) {
return false;
}
if ($array = mysql_fetch_assoc( $cur ))
{
mysql_free_result( $cur );
mosBindArrayToObject( $array, $object, null, null, false );
return true;
} else {
return false;
}
}
else
{
$object = parent::loadObject();
return $object;
}
}
/**
* Execute a batch query
*
* @abstract
* @access public
* @return mixed A database resource if successful, FALSE if not.
*/
function query_batch( $abort_on_error=true, $p_transaction_safe = false)
{
return parent::queryBatch( $abort_on_error, $p_transaction_safe);
}
}
/**
* Legacy class, use &{@link JFactory::getCache()} instead
*
* @deprecated As of version 1.5
* @package Joomla.Legacy
* @subpackage 1.5
*/
class mosCache
{
/**
* @return object A function cache object
*/
function &getCache( $group='' )
{
return JFactory::getCache($group);
}
/**
* Cleans the cache
*/
function cleanCache( $group=false )
{
$cache =& JFactory::getCache($group);
$cache->clean($group);
}
}
/**
* Legacy class, use {@link JProfiler} instead
*
* @deprecated As of version 1.5
* @package Joomla.Legacy
* @subpackage 1.5
*/
jimport('joomla.utilities.profiler');
class mosProfiler extends JProfiler
{
/**
* @return object A function cache object
*/
function JProfiler ( $prefix='' )
{
parent::__construct($prefix);
}
}
/**
* Legacy class, use {@link JParameter} instead
*
* @deprecated As of version 1.5
* @package Joomla.Legacy
* @subpackage 1.5
*/
class mosParameters extends JParameter
{
/**
* @param string The raw parms text
* @param string Path to the xml setup file
* @param string The type of setup file
*/
function __construct($text, $path = '', $type = 'component')
{
parent::__construct($text, $path);
}
/**
* Legacy function, use {@link JParameter::toObject() JParameter->toObject()} instead
*
* @deprecated As of version 1.5
*/
function toObject()
{
parent::toObject();
}
/**
* Legacy function, use {@link JParameter::toArray() JParameter->toArray()} instead
*
* @deprecated As of version 1.5
*/
function toArray()
{
parent::toArray();
}
/**
* Parse an .ini string, based on phpDocumentor phpDocumentor_parse_ini_file function
*
* @access public
* @param mixed The ini string or array of lines
* @param boolean add an associative index for each section [in brackets]
* @return object
*/
function parse($txt, $process_sections = false, $asArray = false)
{
$this->loadINI($txt);
if($asArray) {
return $this->toArray();
}
return $this->toObject( );
}
/**
* Special handling for textarea param
*/
function textareaHandling( &$txt )
{
$total = count( $txt );
for( $i=0; $i < $total; $i++ ) {
if ( strstr( $txt[$i], "\n" ) ) {
$txt[$i] = str_replace( "\n", '<br />', $txt[$i] );
}
}
$txt = implode( "\n", $txt );
return $txt;
}
}
/**
* Legacy class, replaced by full MVC implementation. See {@link JController}
*
* @deprecated As of version 1.5
* @package Joomla.Legacy
* @subpackage 1.5
*/
class mosAbstractTasker
{
function mosAbstractTasker()
{
die( 'mosAbstractTasker deprecated, use JController instead' );
}
}
/**
* Legacy class, use {@link JEventDispatcher} instead
*
* @deprecated As of version 1.5
* @package Joomla.Legacy
* @subpackage 1.5
*/
class mosMambotHandler extends JEventDispatcher
{
function __construct()
{
parent::__construct();
}
/**
* Loads all the bot files for a particular group
* @param string The group name, relates to the sub-directory in the plugins directory
*/
function loadBotGroup( $group )
{
return JPluginHelper::importPlugin($group, null, false);
}
/**
* Loads the bot file
* @param string The folder (group)
* @param string The elements (name of file without extension)
* @param int Published state
* @param string The params for the bot
*/
function loadBot( $folder, $element, $published, $params='' )
{
return JPluginHelper::_import($folder, $element, $published, $params='' );
}
/**
* Registers a function to a particular event group
*
* @param string The event name
* @param string The function name
*/
function registerFunction( $event, $function )
{
JApplication::registerEvent( $event, $function );
}
/**
* Deprecated, use {@link JEventDispatcher::trigger() JEventDispatcher->trigger()} instead and handle return values
* in your code
*
* @param string The event name
* @since 1.5
* @deprecated As of 1.5
*/
function call($event)
{
$args = & func_get_args();
array_shift($args);
$retArray = $this->trigger( $event, $args );
return $retArray[0];
}
}
/**
* Legacy class, removed
*
* @deprecated As of version 1.5
* @package Joomla.Legacy
* @subpackage 1.5
*/
class mosEmpty
{
function def( $key, $value='' )
{
return 1;
}
function get( $key, $default='' )
{
return 1;
}
}
/**
* Legacy class, use {@link JHTML} instead
*
* @deprecated As of version 1.5
* @package Joomla.Legacy
* @subpackage 1.5
*/
class mosHTML
{
/**
* Legacy function, use {@link JHTML::_('select.option')} instead
*
* @deprecated As of version 1.5
*/
function makeOption( $value, $text='', $value_name='value', $text_name='text' )
{
return JHTML::_('select.option', $value, $text, $value_name, $text_name);
}
/**
* Legacy function, use {@link JHTML::_('select.genericlist')} instead
*
* @deprecated As of version 1.5
*/
function selectList( &$arr, $tag_name, $tag_attribs, $key, $text, $selected=NULL, $idtag=false, $flag=false )
{
return JHTML::_('select.genericlist', $arr, $tag_name, $tag_attribs, $key, $text, $selected, $idtag, $flag );
}
/**
* Legacy function, use {@link JHTML::_('select.integerlist')} instead
*
* @deprecated As of version 1.5
*/
function integerSelectList( $start, $end, $inc, $tag_name, $tag_attribs, $selected, $format="" )
{
return JHTML::_('select.integerlist', $start, $end, $inc, $tag_name, $tag_attribs, $selected, $format) ;
}
/**
* Legacy function, use {@link JHTML::_('select.radiolist')} instead
*
* @deprecated As of version 1.5
*/
function radioList( &$arr, $tag_name, $tag_attribs, $selected=null, $key='value', $text='text', $idtag=false )
{
return JHTML::_('select.radiolist', $arr, $tag_name, $tag_attribs, $key, $text, $selected, $idtag) ;
}
/**
* Legacy function, use {@link JHTML::_('select.booleanlist')} instead
*
* @deprecated As of version 1.5
*/
function yesnoRadioList( $tag_name, $tag_attribs, $selected, $yes='yes', $no='no', $id=false )
{
return JHTML::_('select.booleanlist', $tag_name, $tag_attribs, $selected, $yes, $no, $id ) ;
}
/**
* Legacy function, deprecated
*
* @deprecated As of version 1.5
*/
function writableCell( $folder, $relative=1, $text='', $visible=1 )
{
$writeable = '<b><font color="green">'. JText::_( 'Writable' ) .'</font></b>';
$unwriteable = '<b><font color="red">'. JText::_( 'Unwritable' ) .'</font></b>';
echo '<tr>';
echo '<td class="item">';
echo $text;
if ( $visible ) {
echo $folder . '/';
}
echo '</td>';
echo '<td >';
if ( $relative ) {
echo is_writable( "../$folder" ) ? $writeable : $unwriteable;
} else {
echo is_writable( "$folder" ) ? $writeable : $unwriteable;
}
echo '</td>';
echo '</tr>';
}
/**
* Legacy function, deprecated
*
* @deprecated As of version 1.5
*/
function monthSelectList( $tag_name, $tag_attribs, $selected )
{
$arr = array(
mosHTML::makeOption( '01', JText::_( 'JAN' ) ),
mosHTML::makeOption( '02', JText::_( 'FEB' ) ),
mosHTML::makeOption( '03', JText::_( 'MAR' ) ),
mosHTML::makeOption( '04', JText::_( 'APR' ) ),
mosHTML::makeOption( '05', JText::_( 'MAY' ) ),
mosHTML::makeOption( '06', JText::_( 'JUN' ) ),
mosHTML::makeOption( '07', JText::_( 'JUL' ) ),
mosHTML::makeOption( '08', JText::_( 'AUG' ) ),
mosHTML::makeOption( '09', JText::_( 'SEP' ) ),
mosHTML::makeOption( '10', JText::_( 'OCT' ) ),
mosHTML::makeOption( '11', JText::_( 'NOV' ) ),
mosHTML::makeOption( '12', JText::_( 'DEC' ) )
);
return mosHTML::selectList( $arr, $tag_name, $tag_attribs, 'value', 'text', $selected );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -