|
|
f2e824 |
|
|
|
f2e824 |
/**
|
|
|
f2e824 |
*
|
|
|
f2e824 |
* @package phpBB3
|
|
|
f2e824 |
* @version $Id: functions_module.php 9095 2008-11-23 12:42:34Z acydburn $
|
|
|
f2e824 |
* @copyright (c) 2005 phpBB Group
|
|
|
f2e824 |
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
|
f2e824 |
*
|
|
|
f2e824 |
*/
|
|
|
f2e824 |
|
|
|
f2e824 |
/**
|
|
|
f2e824 |
* @ignore
|
|
|
f2e824 |
*/
|
|
|
f2e824 |
if (!defined('IN_PHPBB'))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
exit;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
/**
|
|
|
f2e824 |
* Class handling all types of 'plugins' (a future term)
|
|
|
f2e824 |
* @package phpBB3
|
|
|
f2e824 |
*/
|
|
|
f2e824 |
class p_master
|
|
|
f2e824 |
{
|
|
|
f2e824 |
var $p_id;
|
|
|
f2e824 |
var $p_class;
|
|
|
f2e824 |
var $p_name;
|
|
|
f2e824 |
var $p_mode;
|
|
|
f2e824 |
var $p_parent;
|
|
|
f2e824 |
|
|
|
f2e824 |
var $include_path = false;
|
|
|
f2e824 |
var $active_module = false;
|
|
|
f2e824 |
var $active_module_row_id = false;
|
|
|
f2e824 |
var $acl_forum_id = false;
|
|
|
f2e824 |
var $module_ary = array();
|
|
|
f2e824 |
|
|
|
f2e824 |
/**
|
|
|
f2e824 |
* Constuctor
|
|
|
f2e824 |
* Set module include path
|
|
|
f2e824 |
*/
|
|
|
f2e824 |
function p_master($include_path = false)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
global $phpbb_root_path;
|
|
|
f2e824 |
|
|
|
f2e824 |
$this->include_path = ($include_path !== false) ? $include_path : $phpbb_root_path . 'includes/';
|
|
|
f2e824 |
|
|
|
f2e824 |
// Make sure the path ends with /
|
|
|
f2e824 |
if (substr($this->include_path, -1) !== '/')
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$this->include_path .= '/';
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
/**
|
|
|
f2e824 |
* Set custom include path for modules
|
|
|
f2e824 |
* Schema for inclusion is include_path . modulebase
|
|
|
f2e824 |
*
|
|
|
f2e824 |
* @param string $include_path include path to be used.
|
|
|
f2e824 |
* @access public
|
|
|
f2e824 |
*/
|
|
|
f2e824 |
function set_custom_include_path($include_path)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$this->include_path = $include_path;
|
|
|
f2e824 |
|
|
|
f2e824 |
// Make sure the path ends with /
|
|
|
f2e824 |
if (substr($this->include_path, -1) !== '/')
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$this->include_path .= '/';
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
/**
|
|
|
f2e824 |
* List modules
|
|
|
f2e824 |
*
|
|
|
f2e824 |
* This creates a list, stored in $this->module_ary of all available
|
|
|
f2e824 |
* modules for the given class (ucp, mcp and acp). Additionally
|
|
|
f2e824 |
* $this->module_y_ary is created with indentation information for
|
|
|
f2e824 |
* displaying the module list appropriately. Only modules for which
|
|
|
f2e824 |
* the user has access rights are included in these lists.
|
|
|
f2e824 |
*/
|
|
|
f2e824 |
function list_modules($p_class)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
global $auth, $db, $user, $cache;
|
|
|
f2e824 |
global $config, $phpbb_root_path, $phpEx;
|
|
|
f2e824 |
|
|
|
f2e824 |
// Sanitise for future path use, it's escaped as appropriate for queries
|
|
|
f2e824 |
$this->p_class = str_replace(array('.', '/', '\\'), '', basename($p_class));
|
|
|
f2e824 |
|
|
|
f2e824 |
// Get cached modules
|
|
|
f2e824 |
if (($this->module_cache = $cache->get('_modules_' . $this->p_class)) === false)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
// Get modules
|
|
|
f2e824 |
$sql = 'SELECT *
|
|
|
f2e824 |
FROM ' . MODULES_TABLE . "
|
|
|
f2e824 |
WHERE module_class = '" . $db->sql_escape($this->p_class) . "'
|
|
|
f2e824 |
ORDER BY left_id ASC";
|
|
|
f2e824 |
$result = $db->sql_query($sql);
|
|
|
f2e824 |
|
|
|
f2e824 |
$rows = array();
|
|
|
f2e824 |
while ($row = $db->sql_fetchrow($result))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$rows[$row['module_id']] = $row;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
$db->sql_freeresult($result);
|
|
|
f2e824 |
|
|
|
f2e824 |
$this->module_cache = array();
|
|
|
f2e824 |
foreach ($rows as $module_id => $row)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$this->module_cache['modules'][] = $row;
|
|
|
f2e824 |
$this->module_cache['parents'][$row['module_id']] = $this->get_parents($row['parent_id'], $row['left_id'], $row['right_id'], $rows);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
unset($rows);
|
|
|
f2e824 |
|
|
|
f2e824 |
$cache->put('_modules_' . $this->p_class, $this->module_cache);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
if (empty($this->module_cache))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$this->module_cache = array('modules' => array(), 'parents' => array());
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// We "could" build a true tree with this function - maybe mod authors want to use this...
|
|
|
f2e824 |
// Functions for traversing and manipulating the tree are not available though
|
|
|
f2e824 |
// We might re-structure the module system to use true trees in 3.2.x...
|
|
|
f2e824 |
// $tree = $this->build_tree($this->module_cache['modules'], $this->module_cache['parents']);
|
|
|
f2e824 |
|
|
|
f2e824 |
// Clean up module cache array to only let survive modules the user can access
|
|
|
f2e824 |
$right_id = false;
|
|
|
f2e824 |
foreach ($this->module_cache['modules'] as $key => $row)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
// Not allowed to view module?
|
|
|
f2e824 |
if (!$this->module_auth($row['module_auth']))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
unset($this->module_cache['modules'][$key]);
|
|
|
f2e824 |
continue;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Category with no members, ignore
|
|
|
f2e824 |
if (!$row['module_basename'] && ($row['left_id'] + 1 == $row['right_id']))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
unset($this->module_cache['modules'][$key]);
|
|
|
f2e824 |
continue;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Skip branch
|
|
|
f2e824 |
if ($right_id !== false)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
if ($row['left_id'] < $right_id)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
unset($this->module_cache['modules'][$key]);
|
|
|
f2e824 |
continue;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$right_id = false;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Not enabled?
|
|
|
f2e824 |
if (!$row['module_enabled'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
// If category is disabled then disable every child too
|
|
|
f2e824 |
unset($this->module_cache['modules'][$key]);
|
|
|
f2e824 |
$right_id = $row['right_id'];
|
|
|
f2e824 |
continue;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Re-index (this is needed, else we are not able to array_slice later)
|
|
|
f2e824 |
$this->module_cache['modules'] = array_merge($this->module_cache['modules']);
|
|
|
f2e824 |
|
|
|
f2e824 |
// Include MOD _info files for populating language entries within the menus
|
|
|
f2e824 |
$this->add_mod_info($this->p_class);
|
|
|
f2e824 |
|
|
|
f2e824 |
// Now build the module array, but exclude completely empty categories...
|
|
|
f2e824 |
$right_id = false;
|
|
|
f2e824 |
$names = array();
|
|
|
f2e824 |
|
|
|
f2e824 |
foreach ($this->module_cache['modules'] as $key => $row)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
// Skip branch
|
|
|
f2e824 |
if ($right_id !== false)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
if ($row['left_id'] < $right_id)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
continue;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$right_id = false;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Category with no members on their way down (we have to check every level)
|
|
|
f2e824 |
if (!$row['module_basename'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$empty_category = true;
|
|
|
f2e824 |
|
|
|
f2e824 |
// We go through the branch and look for an activated module
|
|
|
f2e824 |
foreach (array_slice($this->module_cache['modules'], $key + 1) as $temp_row)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
if ($temp_row['left_id'] > $row['left_id'] && $temp_row['left_id'] < $row['right_id'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
// Module there
|
|
|
f2e824 |
if ($temp_row['module_basename'] && $temp_row['module_enabled'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$empty_category = false;
|
|
|
f2e824 |
break;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
continue;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
break;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Skip the branch
|
|
|
f2e824 |
if ($empty_category)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$right_id = $row['right_id'];
|
|
|
f2e824 |
continue;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$depth = sizeof($this->module_cache['parents'][$row['module_id']]);
|
|
|
f2e824 |
|
|
|
f2e824 |
// We need to prefix the functions to not create a naming conflict
|
|
|
f2e824 |
|
|
|
f2e824 |
// Function for building 'url_extra'
|
|
|
f2e824 |
$url_func = '_module_' . $row['module_basename'] . '_url';
|
|
|
f2e824 |
|
|
|
f2e824 |
// Function for building the language name
|
|
|
f2e824 |
$lang_func = '_module_' . $row['module_basename'] . '_lang';
|
|
|
f2e824 |
|
|
|
f2e824 |
// Custom function for calling parameters on module init (for example assigning template variables)
|
|
|
f2e824 |
$custom_func = '_module_' . $row['module_basename'];
|
|
|
f2e824 |
|
|
|
f2e824 |
$names[$row['module_basename'] . '_' . $row['module_mode']][] = true;
|
|
|
f2e824 |
|
|
|
f2e824 |
$module_row = array(
|
|
|
f2e824 |
'depth' => $depth,
|
|
|
f2e824 |
|
|
|
f2e824 |
'id' => (int) $row['module_id'],
|
|
|
f2e824 |
'parent' => (int) $row['parent_id'],
|
|
|
f2e824 |
'cat' => ($row['right_id'] > $row['left_id'] + 1) ? true : false,
|
|
|
f2e824 |
|
|
|
f2e824 |
'is_duplicate' => ($row['module_basename'] && sizeof($names[$row['module_basename'] . '_' . $row['module_mode']]) > 1) ? true : false,
|
|
|
f2e824 |
|
|
|
f2e824 |
'name' => (string) $row['module_basename'],
|
|
|
f2e824 |
'mode' => (string) $row['module_mode'],
|
|
|
f2e824 |
'display' => (int) $row['module_display'],
|
|
|
f2e824 |
|
|
|
f2e824 |
'url_extra' => (function_exists($url_func)) ? $url_func($row['module_mode'], $row) : '',
|
|
|
f2e824 |
|
|
|
f2e824 |
'lang' => ($row['module_basename'] && function_exists($lang_func)) ? $lang_func($row['module_mode'], $row['module_langname']) : ((!empty($user->lang[$row['module_langname']])) ? $user->lang[$row['module_langname']] : $row['module_langname']),
|
|
|
f2e824 |
'langname' => $row['module_langname'],
|
|
|
f2e824 |
|
|
|
f2e824 |
'left' => $row['left_id'],
|
|
|
f2e824 |
'right' => $row['right_id'],
|
|
|
f2e824 |
);
|
|
|
f2e824 |
|
|
|
f2e824 |
if (function_exists($custom_func))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$custom_func($row['module_mode'], $module_row);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$this->module_ary[] = $module_row;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
unset($this->module_cache['modules'], $names);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
/**
|
|
|
f2e824 |
* Check if a certain main module is accessible/loaded
|
|
|
f2e824 |
* By giving the module mode you are able to additionally check for only one mode within the main module
|
|
|
f2e824 |
*
|
|
|
f2e824 |
* @param string $module_basename The module base name, for example logs, reports, main (for the mcp).
|
|
|
f2e824 |
* @param mixed $module_mode The module mode to check. If provided the mode will be checked in addition for presence.
|
|
|
f2e824 |
*
|
|
|
f2e824 |
* @return bool Returns true if module is loaded and accessible, else returns false
|
|
|
f2e824 |
*/
|
|
|
f2e824 |
function loaded($module_basename, $module_mode = false)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
if (empty($this->loaded_cache))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$this->loaded_cache = array();
|
|
|
f2e824 |
|
|
|
f2e824 |
foreach ($this->module_ary as $row)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
if (!$row['name'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
continue;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
if (!isset($this->loaded_cache[$row['name']]))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$this->loaded_cache[$row['name']] = array();
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
if (!$row['mode'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
continue;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$this->loaded_cache[$row['name']][$row['mode']] = true;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
if ($module_mode === false)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
return (isset($this->loaded_cache[$module_basename])) ? true : false;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
return (!empty($this->loaded_cache[$module_basename][$module_mode])) ? true : false;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
/**
|
|
|
f2e824 |
* Check module authorisation
|
|
|
f2e824 |
*/
|
|
|
f2e824 |
function module_auth($module_auth, $forum_id = false)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
global $auth, $config;
|
|
|
f2e824 |
|
|
|
f2e824 |
$module_auth = trim($module_auth);
|
|
|
f2e824 |
|
|
|
f2e824 |
// Generally allowed to access module if module_auth is empty
|
|
|
f2e824 |
if (!$module_auth)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
return true;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// With the code below we make sure only those elements get eval'd we really want to be checked
|
|
|
f2e824 |
preg_match_all('/(?:
|
|
|
f2e824 |
"[^"\\\\]*(?:\\\\.[^"\\\\]*)*" |
|
|
|
f2e824 |
\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\' |
|
|
|
f2e824 |
[(),] |
|
|
|
f2e824 |
[^\s(),]+)/x', $module_auth, $match);
|
|
|
f2e824 |
|
|
|
f2e824 |
$tokens = $match[0];
|
|
|
f2e824 |
for ($i = 0, $size = sizeof($tokens); $i < $size; $i++)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$token = &$tokens[$i];
|
|
|
f2e824 |
|
|
|
f2e824 |
switch ($token)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
case ')':
|
|
|
f2e824 |
case '(':
|
|
|
f2e824 |
case '&&':
|
|
|
f2e824 |
case '||':
|
|
|
f2e824 |
case ',':
|
|
|
f2e824 |
break;
|
|
|
f2e824 |
|
|
|
f2e824 |
default:
|
|
|
f2e824 |
if (!preg_match('#(?:acl_([a-z0-9_]+)(,\$id)?)|(?:\$id)|(?:aclf_([a-z0-9_]+))|(?:cfg_([a-z0-9_]+))|(?:request_([a-zA-Z0-9_]+))#', $token))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$token = '';
|
|
|
f2e824 |
}
|
|
|
f2e824 |
break;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$module_auth = implode(' ', $tokens);
|
|
|
f2e824 |
|
|
|
f2e824 |
// Make sure $id seperation is working fine
|
|
|
f2e824 |
$module_auth = str_replace(' , ', ',', $module_auth);
|
|
|
f2e824 |
|
|
|
f2e824 |
$forum_id = ($forum_id === false) ? $this->acl_forum_id : $forum_id;
|
|
|
f2e824 |
|
|
|
f2e824 |
$is_auth = false;
|
|
|
f2e824 |
eval('$is_auth = (int) (' . preg_replace(array('#acl_([a-z0-9_]+)(,\$id)?#', '#\$id#', '#aclf_([a-z0-9_]+)#', '#cfg_([a-z0-9_]+)#', '#request_([a-zA-Z0-9_]+)#'), array('(int) $auth->acl_get(\'\\1\'\\2)', '(int) $forum_id', '(int) $auth->acl_getf_global(\'\\1\')', '(int) $config[\'\\1\']', '!empty($_REQUEST[\'\\1\'])'), $module_auth) . ');');
|
|
|
f2e824 |
|
|
|
f2e824 |
return $is_auth;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
/**
|
|
|
f2e824 |
* Set active module
|
|
|
f2e824 |
*/
|
|
|
f2e824 |
function set_active($id = false, $mode = false)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$icat = false;
|
|
|
f2e824 |
$this->active_module = false;
|
|
|
f2e824 |
|
|
|
f2e824 |
if (request_var('icat', ''))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$icat = $id;
|
|
|
f2e824 |
$id = request_var('icat', '');
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$category = false;
|
|
|
f2e824 |
foreach ($this->module_ary as $row_id => $item_ary)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
// If this is a module and it's selected, active
|
|
|
f2e824 |
// If this is a category and the module is the first within it, active
|
|
|
f2e824 |
// If this is a module and no mode selected, select first mode
|
|
|
f2e824 |
// If no category or module selected, go active for first module in first category
|
|
|
f2e824 |
if (
|
|
|
f2e824 |
(($item_ary['name'] === $id || $item_ary['id'] === (int) $id) && (($item_ary['mode'] == $mode && !$item_ary['cat']) || ($icat && $item_ary['cat']))) ||
|
|
|
f2e824 |
($item_ary['parent'] === $category && !$item_ary['cat'] && !$icat && $item_ary['display']) ||
|
|
|
f2e824 |
(($item_ary['name'] === $id || $item_ary['id'] === (int) $id) && !$mode && !$item_ary['cat']) ||
|
|
|
f2e824 |
(!$id && !$mode && !$item_ary['cat'] && $item_ary['display'])
|
|
|
f2e824 |
)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
if ($item_ary['cat'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$id = $icat;
|
|
|
f2e824 |
$icat = false;
|
|
|
f2e824 |
|
|
|
f2e824 |
continue;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$this->p_id = $item_ary['id'];
|
|
|
f2e824 |
$this->p_parent = $item_ary['parent'];
|
|
|
f2e824 |
$this->p_name = $item_ary['name'];
|
|
|
f2e824 |
$this->p_mode = $item_ary['mode'];
|
|
|
f2e824 |
$this->p_left = $item_ary['left'];
|
|
|
f2e824 |
$this->p_right = $item_ary['right'];
|
|
|
f2e824 |
|
|
|
f2e824 |
$this->module_cache['parents'] = $this->module_cache['parents'][$this->p_id];
|
|
|
f2e824 |
$this->active_module = $item_ary['id'];
|
|
|
f2e824 |
$this->active_module_row_id = $row_id;
|
|
|
f2e824 |
|
|
|
f2e824 |
break;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
else if (($item_ary['cat'] && $item_ary['id'] === (int) $id) || ($item_ary['parent'] === $category && $item_ary['cat']))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$category = $item_ary['id'];
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
/**
|
|
|
f2e824 |
* Loads currently active module
|
|
|
f2e824 |
*
|
|
|
f2e824 |
* This method loads a given module, passing it the relevant id and mode.
|
|
|
f2e824 |
*/
|
|
|
f2e824 |
function load_active($mode = false, $module_url = false, $execute_module = true)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user;
|
|
|
f2e824 |
|
|
|
f2e824 |
$module_path = $this->include_path . $this->p_class;
|
|
|
f2e824 |
$icat = request_var('icat', '');
|
|
|
f2e824 |
|
|
|
f2e824 |
if ($this->active_module === false)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
trigger_error('Module not accessible', E_USER_ERROR);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
if (!class_exists("{$this->p_class}_$this->p_name"))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
if (!file_exists("$module_path/{$this->p_class}_$this->p_name.$phpEx"))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
trigger_error("Cannot find module $module_path/{$this->p_class}_$this->p_name.$phpEx", E_USER_ERROR);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
include("$module_path/{$this->p_class}_$this->p_name.$phpEx");
|
|
|
f2e824 |
|
|
|
f2e824 |
if (!class_exists("{$this->p_class}_$this->p_name"))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
trigger_error("Module file $module_path/{$this->p_class}_$this->p_name.$phpEx does not contain correct class [{$this->p_class}_$this->p_name]", E_USER_ERROR);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
if (!empty($mode))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$this->p_mode = $mode;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Create a new instance of the desired module ... if it has a
|
|
|
f2e824 |
// constructor it will of course be executed
|
|
|
f2e824 |
$instance = "{$this->p_class}_$this->p_name";
|
|
|
f2e824 |
|
|
|
f2e824 |
$this->module = new $instance($this);
|
|
|
f2e824 |
|
|
|
f2e824 |
// We pre-define the action parameter we are using all over the place
|
|
|
f2e824 |
if (defined('IN_ADMIN'))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
// Is first module automatically enabled a duplicate and the category not passed yet?
|
|
|
f2e824 |
if (!$icat && $this->module_ary[$this->active_module_row_id]['is_duplicate'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$icat = $this->module_ary[$this->active_module_row_id]['parent'];
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Not being able to overwrite ;)
|
|
|
f2e824 |
$this->module->u_action = append_sid("{$phpbb_admin_path}index.$phpEx", "i={$this->p_name}") . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}";
|
|
|
f2e824 |
}
|
|
|
f2e824 |
else
|
|
|
f2e824 |
{
|
|
|
f2e824 |
// If user specified the module url we will use it...
|
|
|
f2e824 |
if ($module_url !== false)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$this->module->u_action = $module_url;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
else
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$this->module->u_action = $phpbb_root_path . (($user->page['page_dir']) ? $user->page['page_dir'] . '/' : '') . $user->page['page_name'];
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$this->module->u_action = append_sid($this->module->u_action, "i={$this->p_name}") . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}";
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Add url_extra parameter to u_action url
|
|
|
f2e824 |
if (!empty($this->module_ary) && $this->active_module !== false && $this->module_ary[$this->active_module_row_id]['url_extra'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$this->module->u_action .= $this->module_ary[$this->active_module_row_id]['url_extra'];
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Assign the module path for re-usage
|
|
|
f2e824 |
$this->module->module_path = $module_path . '/';
|
|
|
f2e824 |
|
|
|
f2e824 |
// Execute the main method for the new instance, we send the module id and mode as parameters
|
|
|
f2e824 |
// Users are able to call the main method after this function to be able to assign additional parameters manually
|
|
|
f2e824 |
if ($execute_module)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$this->module->main($this->p_name, $this->p_mode);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
return;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
/**
|
|
|
f2e824 |
* Appending url parameter to the currently active module.
|
|
|
f2e824 |
*
|
|
|
f2e824 |
* This function is called for adding specific url parameters while executing the current module.
|
|
|
f2e824 |
* It is doing the same as the _module_{name}_url() function, apart from being able to be called after
|
|
|
f2e824 |
* having dynamically parsed specific parameters. This allows more freedom in choosing additional parameters.
|
|
|
f2e824 |
* One example can be seen in /includes/mcp/mcp_notes.php - $this->p_master->adjust_url() call.
|
|
|
f2e824 |
*
|
|
|
f2e824 |
* @param string $url_extra Extra url parameters, e.g.: &u=$user_id
|
|
|
f2e824 |
*
|
|
|
f2e824 |
*/
|
|
|
f2e824 |
function adjust_url($url_extra)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
if (empty($this->module_ary[$this->active_module_row_id]))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
return;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$row = &$this->module_ary[$this->active_module_row_id];
|
|
|
f2e824 |
|
|
|
f2e824 |
// We check for the same url_extra in $row['url_extra'] to overcome doubled additions...
|
|
|
f2e824 |
if (strpos($row['url_extra'], $url_extra) === false)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$row['url_extra'] .= $url_extra;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
/**
|
|
|
f2e824 |
* Check if a module is active
|
|
|
f2e824 |
*/
|
|
|
f2e824 |
function is_active($id, $mode = false)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
// If we find a name by this id and being enabled we have our active one...
|
|
|
f2e824 |
foreach ($this->module_ary as $row_id => $item_ary)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
if (($item_ary['name'] === $id || $item_ary['id'] === (int) $id) && $item_ary['display'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
if ($mode === false || $mode === $item_ary['mode'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
return true;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
return false;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
/**
|
|
|
f2e824 |
* Get parents
|
|
|
f2e824 |
*/
|
|
|
f2e824 |
function get_parents($parent_id, $left_id, $right_id, &$all_parents)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
global $db;
|
|
|
f2e824 |
|
|
|
f2e824 |
$parents = array();
|
|
|
f2e824 |
|
|
|
f2e824 |
if ($parent_id > 0)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
foreach ($all_parents as $module_id => $row)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
if ($row['left_id'] < $left_id && $row['right_id'] > $right_id)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$parents[$module_id] = $row['parent_id'];
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
if ($row['left_id'] > $left_id)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
break;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
return $parents;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
/**
|
|
|
f2e824 |
* Get tree branch
|
|
|
f2e824 |
*/
|
|
|
f2e824 |
function get_branch($left_id, $right_id, $remaining)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$branch = array();
|
|
|
f2e824 |
|
|
|
f2e824 |
foreach ($remaining as $key => $row)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
if ($row['left_id'] > $left_id && $row['left_id'] < $right_id)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$branch[] = $row;
|
|
|
f2e824 |
continue;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
break;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
return $branch;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
/**
|
|
|
f2e824 |
* Build true binary tree from given array
|
|
|
f2e824 |
* Not in use
|
|
|
f2e824 |
*/
|
|
|
f2e824 |
function build_tree(&$modules, &$parents)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$tree = array();
|
|
|
f2e824 |
|
|
|
f2e824 |
foreach ($modules as $row)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$branch = &$tree;
|
|
|
f2e824 |
|
|
|
f2e824 |
if ($row['parent_id'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
// Go through the tree to find our branch
|
|
|
f2e824 |
$parent_tree = $parents[$row['module_id']];
|
|
|
f2e824 |
|
|
|
f2e824 |
foreach ($parent_tree as $id => $value)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
if (!isset($branch[$id]) && isset($branch['child']))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$branch = &$branch['child'];
|
|
|
f2e824 |
}
|
|
|
f2e824 |
$branch = &$branch[$id];
|
|
|
f2e824 |
}
|
|
|
f2e824 |
$branch = &$branch['child'];
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$branch[$row['module_id']] = $row;
|
|
|
f2e824 |
if (!isset($branch[$row['module_id']]['child']))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$branch[$row['module_id']]['child'] = array();
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
return $tree;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
/**
|
|
|
f2e824 |
* Build navigation structure
|
|
|
f2e824 |
*/
|
|
|
f2e824 |
function assign_tpl_vars($module_url)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
global $template;
|
|
|
f2e824 |
|
|
|
f2e824 |
$current_id = $right_id = false;
|
|
|
f2e824 |
|
|
|
f2e824 |
// Make sure the module_url has a question mark set, effectively determining the delimiter to use
|
|
|
f2e824 |
$delim = (strpos($module_url, '?') === false) ? '?' : '&';
|
|
|
f2e824 |
|
|
|
f2e824 |
$current_padding = $current_depth = 0;
|
|
|
f2e824 |
$linear_offset = 'l_block1';
|
|
|
f2e824 |
$tabular_offset = 't_block2';
|
|
|
f2e824 |
|
|
|
f2e824 |
// Generate the list of modules, we'll do this in two ways ...
|
|
|
f2e824 |
// 1) In a linear fashion
|
|
|
f2e824 |
// 2) In a combined tabbed + linear fashion ... tabs for the categories
|
|
|
f2e824 |
// and a linear list for subcategories/items
|
|
|
f2e824 |
foreach ($this->module_ary as $row_id => $item_ary)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
// Skip hidden modules
|
|
|
f2e824 |
if (!$item_ary['display'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
continue;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Skip branch
|
|
|
f2e824 |
if ($right_id !== false)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
if ($item_ary['left'] < $right_id)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
continue;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$right_id = false;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Category with no members on their way down (we have to check every level)
|
|
|
f2e824 |
if (!$item_ary['name'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$empty_category = true;
|
|
|
f2e824 |
|
|
|
f2e824 |
// We go through the branch and look for an activated module
|
|
|
f2e824 |
foreach (array_slice($this->module_ary, $row_id + 1) as $temp_row)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
if ($temp_row['left'] > $item_ary['left'] && $temp_row['left'] < $item_ary['right'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
// Module there and displayed?
|
|
|
f2e824 |
if ($temp_row['name'] && $temp_row['display'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$empty_category = false;
|
|
|
f2e824 |
break;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
continue;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
break;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Skip the branch
|
|
|
f2e824 |
if ($empty_category)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$right_id = $item_ary['right'];
|
|
|
f2e824 |
continue;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
// Select first id we can get
|
|
|
f2e824 |
if (!$current_id && (isset($this->module_cache['parents'][$item_ary['id']]) || $item_ary['id'] == $this->p_id))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$current_id = $item_ary['id'];
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$depth = $item_ary['depth'];
|
|
|
f2e824 |
|
|
|
f2e824 |
if ($depth > $current_depth)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$linear_offset = $linear_offset . '.l_block' . ($depth + 1);
|
|
|
f2e824 |
$tabular_offset = ($depth + 1 > 2) ? $tabular_offset . '.t_block' . ($depth + 1) : $tabular_offset;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
else if ($depth < $current_depth)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
for ($i = $current_depth - $depth; $i > 0; $i--)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$linear_offset = substr($linear_offset, 0, strrpos($linear_offset, '.'));
|
|
|
f2e824 |
$tabular_offset = ($i + $depth > 1) ? substr($tabular_offset, 0, strrpos($tabular_offset, '.')) : $tabular_offset;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$u_title = $module_url . $delim . 'i=' . (($item_ary['cat']) ? $item_ary['id'] : $item_ary['name'] . (($item_ary['is_duplicate']) ? '&icat=' . $current_id : '') . '&mode=' . $item_ary['mode']);
|
|
|
f2e824 |
|
|
|
f2e824 |
// Was not allowed in categories before - /*!$item_ary['cat'] && */
|
|
|
f2e824 |
$u_title .= (isset($item_ary['url_extra'])) ? $item_ary['url_extra'] : '';
|
|
|
f2e824 |
|
|
|
f2e824 |
// Only output a categories items if it's currently selected
|
|
|
f2e824 |
if (!$depth || ($depth && (in_array($item_ary['parent'], array_values($this->module_cache['parents'])) || $item_ary['parent'] == $this->p_parent)))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$use_tabular_offset = (!$depth) ? 't_block1' : $tabular_offset;
|
|
|
f2e824 |
|
|
|
f2e824 |
$tpl_ary = array(
|
|
|
f2e824 |
'L_TITLE' => $item_ary['lang'],
|
|
|
f2e824 |
'S_SELECTED' => (isset($this->module_cache['parents'][$item_ary['id']]) || $item_ary['id'] == $this->p_id) ? true : false,
|
|
|
f2e824 |
'U_TITLE' => $u_title
|
|
|
f2e824 |
);
|
|
|
f2e824 |
|
|
|
f2e824 |
$template->assign_block_vars($use_tabular_offset, array_merge($tpl_ary, array_change_key_case($item_ary, CASE_UPPER)));
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$tpl_ary = array(
|
|
|
f2e824 |
'L_TITLE' => $item_ary['lang'],
|
|
|
f2e824 |
'S_SELECTED' => (isset($this->module_cache['parents'][$item_ary['id']]) || $item_ary['id'] == $this->p_id) ? true : false,
|
|
|
f2e824 |
'U_TITLE' => $u_title
|
|
|
f2e824 |
);
|
|
|
f2e824 |
|
|
|
f2e824 |
$template->assign_block_vars($linear_offset, array_merge($tpl_ary, array_change_key_case($item_ary, CASE_UPPER)));
|
|
|
f2e824 |
|
|
|
f2e824 |
$current_depth = $depth;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
/**
|
|
|
f2e824 |
* Returns desired template name
|
|
|
f2e824 |
*/
|
|
|
f2e824 |
function get_tpl_name()
|
|
|
f2e824 |
{
|
|
|
f2e824 |
return $this->module->tpl_name . '.html';
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
/**
|
|
|
f2e824 |
* Returns the desired page title
|
|
|
f2e824 |
*/
|
|
|
f2e824 |
function get_page_title()
|
|
|
f2e824 |
{
|
|
|
f2e824 |
global $user;
|
|
|
f2e824 |
|
|
|
f2e824 |
if (!isset($this->module->page_title))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
return '';
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
return (isset($user->lang[$this->module->page_title])) ? $user->lang[$this->module->page_title] : $this->module->page_title;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
/**
|
|
|
f2e824 |
* Load module as the current active one without the need for registering it
|
|
|
f2e824 |
*/
|
|
|
f2e824 |
function load($class, $name, $mode = false)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$this->p_class = $class;
|
|
|
f2e824 |
$this->p_name = $name;
|
|
|
f2e824 |
|
|
|
f2e824 |
// Set active module to true instead of using the id
|
|
|
f2e824 |
$this->active_module = true;
|
|
|
f2e824 |
|
|
|
f2e824 |
$this->load_active($mode);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
/**
|
|
|
f2e824 |
* Display module
|
|
|
f2e824 |
*/
|
|
|
f2e824 |
function display($page_title, $display_online_list = true)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
global $template, $user;
|
|
|
f2e824 |
|
|
|
f2e824 |
// Generate the page
|
|
|
f2e824 |
if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
adm_page_header($page_title);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
else
|
|
|
f2e824 |
{
|
|
|
f2e824 |
page_header($page_title, $display_online_list);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$template->set_filenames(array(
|
|
|
f2e824 |
'body' => $this->get_tpl_name())
|
|
|
f2e824 |
);
|
|
|
f2e824 |
|
|
|
f2e824 |
if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin'])
|
|
|
f2e824 |
{
|
|
|
f2e824 |
adm_page_footer();
|
|
|
f2e824 |
}
|
|
|
f2e824 |
else
|
|
|
f2e824 |
{
|
|
|
f2e824 |
page_footer();
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
/**
|
|
|
f2e824 |
* Toggle whether this module will be displayed or not
|
|
|
f2e824 |
*/
|
|
|
f2e824 |
function set_display($id, $mode = false, $display = true)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
foreach ($this->module_ary as $row_id => $item_ary)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
if (($item_ary['name'] === $id || $item_ary['id'] === (int) $id) && (!$mode || $item_ary['mode'] === $mode))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$this->module_ary[$row_id]['display'] = (int) $display;
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
/**
|
|
|
f2e824 |
* Add custom MOD info language file
|
|
|
f2e824 |
*/
|
|
|
f2e824 |
function add_mod_info($module_class)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
global $user, $phpEx;
|
|
|
f2e824 |
|
|
|
f2e824 |
if (file_exists($user->lang_path . $user->lang_name . '/mods'))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$add_files = array();
|
|
|
f2e824 |
|
|
|
f2e824 |
$dir = @opendir($user->lang_path . $user->lang_name . '/mods');
|
|
|
f2e824 |
|
|
|
f2e824 |
if ($dir)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
while (($entry = readdir($dir)) !== false)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
if (strpos($entry, 'info_' . strtolower($module_class) . '_') === 0 && substr(strrchr($entry, '.'), 1) == $phpEx)
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$add_files[] = 'mods/' . substr(basename($entry), 0, -(strlen($phpEx) + 1));
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
closedir($dir);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
if (sizeof($add_files))
|
|
|
f2e824 |
{
|
|
|
f2e824 |
$user->add_lang($add_files);
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
?>
|