Line 28 | Line 28 |
---|
var $p_mode; var $p_parent;
|
var $p_mode; var $p_parent;
|
| var $include_path = false;
|
var $active_module = false; var $active_module_row_id = false; var $acl_forum_id = false; var $module_ary = array();
|
var $active_module = false; var $active_module_row_id = false; var $acl_forum_id = false; var $module_ary = array();
|
| /** * Constuctor * Set module include path */ function p_master($include_path = false) { global $phpbb_root_path;
$this->include_path = ($include_path !== false) ? $include_path : $phpbb_root_path . 'includes/';
// Make sure the path ends with / if (substr($this->include_path, -1) !== '/') { $this->include_path .= '/'; } }
/** * Set custom include path for modules * Schema for inclusion is include_path . modulebase * * @param string $include_path include path to be used. * @access public */ function set_custom_include_path($include_path) { $this->include_path = $include_path;
// Make sure the path ends with / if (substr($this->include_path, -1) !== '/') { $this->include_path .= '/'; } }
|
/** * List modules
| /** * List modules
|
Line 309 | Line 345 |
---|
break;
default:
|
break;
default:
|
if (!preg_match('#(?:acl_([a-z_]+)(,\$id)?)|(?:\$id)|(?:aclf_([a-z_]+))|(?:cfg_([a-z_]+))|(?:request_([a-z_]+))#', $token))
| if (!preg_match('#(?:acl_([a-z0-9_]+)(,\$id)?)|(?:\$id)|(?:aclf_([a-z0-9_]+))|(?:cfg_([a-z0-9_]+))|(?:request_([a-zA-Z0-9_]+))#', $token))
|
{ $token = ''; }
| { $token = ''; }
|
Line 325 | Line 361 |
---|
$forum_id = ($forum_id === false) ? $this->acl_forum_id : $forum_id;
$is_auth = false;
|
$forum_id = ($forum_id === false) ? $this->acl_forum_id : $forum_id;
$is_auth = false;
|
eval('$is_auth = (int) (' . preg_replace(array('#acl_([a-z_]+)(,\$id)?#', '#\$id#', '#aclf_([a-z_]+)#', '#cfg_([a-z_]+)#', '#request_([a-z_]+)#'), array('(int) $auth->acl_get(\'\\1\'\\2)', '(int) $forum_id', '(int) $auth->acl_getf_global(\'\\1\')', '(int) $config[\'\\1\']', '!empty($_REQUEST[\'\\1\'])'), $module_auth) . ');');
| 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) . ');');
|
return $is_auth; }
| return $is_auth; }
|
Line 395 | Line 431 |
---|
{ global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user;
|
{ global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user;
|
$module_path = $phpbb_root_path . 'includes/' . $this->p_class;
| $module_path = $this->include_path . $this->p_class;
|
$icat = request_var('icat', '');
if ($this->active_module === false) {
|
$icat = request_var('icat', '');
if ($this->active_module === false) {
|
trigger_error('Module not accessible', E_USER_ERROR);
| trigger_error('MODULE_NOT_ACCESS', E_USER_ERROR);
|
}
if (!class_exists("{$this->p_class}_$this->p_name")) { if (!file_exists("$module_path/{$this->p_class}_$this->p_name.$phpEx")) {
|
}
if (!class_exists("{$this->p_class}_$this->p_name")) { if (!file_exists("$module_path/{$this->p_class}_$this->p_name.$phpEx")) {
|
trigger_error("Cannot find module $module_path/{$this->p_class}_$this->p_name.$phpEx", E_USER_ERROR);
| trigger_error($user->lang('MODULE_NOT_FIND', "$module_path/{$this->p_class}_$this->p_name.$phpEx"), E_USER_ERROR);
|
}
include("$module_path/{$this->p_class}_$this->p_name.$phpEx");
if (!class_exists("{$this->p_class}_$this->p_name")) {
|
}
include("$module_path/{$this->p_class}_$this->p_name.$phpEx");
if (!class_exists("{$this->p_class}_$this->p_name")) {
|
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);
| trigger_error($user->lang('MODULE_FILE_INCORRECT_CLASS', "$module_path/{$this->p_class}_$this->p_name.$phpEx", "{$this->p_class}_$this->p_name"), E_USER_ERROR);
|
}
if (!empty($mode))
| }
if (!empty($mode))
|
Line 677 | Line 713 |
---|
}
// Select first id we can get
|
}
// Select first id we can get
|
if (!$current_id && (in_array($item_ary['id'], array_keys($this->module_cache['parents'])) || $item_ary['id'] == $this->p_id))
| if (!$current_id && (isset($this->module_cache['parents'][$item_ary['id']]) || $item_ary['id'] == $this->p_id))
|
{ $current_id = $item_ary['id']; }
| { $current_id = $item_ary['id']; }
|
Line 710 | Line 746 |
---|
$tpl_ary = array( 'L_TITLE' => $item_ary['lang'],
|
$tpl_ary = array( 'L_TITLE' => $item_ary['lang'],
|
'S_SELECTED' => (in_array($item_ary['id'], array_keys($this->module_cache['parents'])) || $item_ary['id'] == $this->p_id) ? true : false,
| 'S_SELECTED' => (isset($this->module_cache['parents'][$item_ary['id']]) || $item_ary['id'] == $this->p_id) ? true : false,
|
'U_TITLE' => $u_title );
| 'U_TITLE' => $u_title );
|
Line 719 | Line 755 |
---|
$tpl_ary = array( 'L_TITLE' => $item_ary['lang'],
|
$tpl_ary = array( 'L_TITLE' => $item_ary['lang'],
|
'S_SELECTED' => (in_array($item_ary['id'], array_keys($this->module_cache['parents'])) || $item_ary['id'] == $this->p_id) ? true : false,
| 'S_SELECTED' => (isset($this->module_cache['parents'][$item_ary['id']]) || $item_ary['id'] == $this->p_id) ? true : false,
|
'U_TITLE' => $u_title );
| 'U_TITLE' => $u_title );
|
Line 818 | Line 854 |
---|
{ global $user, $phpEx;
|
{ global $user, $phpEx;
|
if (file_exists($user->lang_path . 'mods'))
| if (file_exists($user->lang_path . $user->lang_name . '/mods'))
|
{ $add_files = array();
|
{ $add_files = array();
|
$dir = @opendir($user->lang_path . 'mods');
| $dir = @opendir($user->lang_path . $user->lang_name . '/mods');
|
if ($dir) {
| if ($dir) {
|