some changes for proper code documentation

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8783 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2008-08-23 17:23:40 +00:00
parent d7fa3f83ce
commit 4d7b9b76fa
6 changed files with 68 additions and 67 deletions

View file

@ -685,7 +685,7 @@ inherit_from = {INHERIT_FROM}
{ {
trigger_error($user->lang['EDITOR_DISABLED'] . adm_back_link($this->u_action)); trigger_error($user->lang['EDITOR_DISABLED'] . adm_back_link($this->u_action));
} }
$this->page_title = 'EDIT_TEMPLATE'; $this->page_title = 'EDIT_TEMPLATE';
$filelist = $filelist_cats = array(); $filelist = $filelist_cats = array();
@ -698,7 +698,7 @@ inherit_from = {INHERIT_FROM}
// make sure template_file path doesn't go upwards // make sure template_file path doesn't go upwards
$template_file = str_replace('..', '.', $template_file); $template_file = str_replace('..', '.', $template_file);
// Retrieve some information about the template // Retrieve some information about the template
$sql = 'SELECT template_storedb, template_path, template_name $sql = 'SELECT template_storedb, template_path, template_name
FROM ' . STYLES_TEMPLATE_TABLE . " FROM ' . STYLES_TEMPLATE_TABLE . "
@ -711,7 +711,7 @@ inherit_from = {INHERIT_FROM}
{ {
trigger_error($user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING); trigger_error($user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING);
} }
if ($save_changes && !check_form_key('acp_styles')) if ($save_changes && !check_form_key('acp_styles'))
{ {
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
@ -998,17 +998,17 @@ inherit_from = {INHERIT_FROM}
$ids[] = $template_row['template_inherits_id']; $ids[] = $template_row['template_inherits_id'];
} }
$ids[] = $template_row['template_id']; $ids[] = $template_row['template_id'];
$filemtime = array(); $filemtime = array();
$file_template_db = array(); $file_template_db = array();
foreach ($ids as $id) foreach ($ids as $id)
{ {
$sql = 'SELECT template_filename, template_mtime $sql = 'SELECT template_filename, template_mtime
FROM ' . STYLES_TEMPLATE_DATA_TABLE . " FROM ' . STYLES_TEMPLATE_DATA_TABLE . "
WHERE template_id = $id"; WHERE template_id = $id";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
$filemtime[$row['template_filename']] = $row['template_mtime']; $filemtime[$row['template_filename']] = $row['template_mtime'];
@ -1024,22 +1024,22 @@ inherit_from = {INHERIT_FROM}
foreach ($file_ary as $file) foreach ($file_ary as $file)
{ {
$file = str_replace('/', '.', $file); $file = str_replace('/', '.', $file);
// perform some dirty guessing to get the path right. // perform some dirty guessing to get the path right.
// We assume that three dots in a row were '../' // We assume that three dots in a row were '../'
$tpl_file = str_replace('.', '/', $file); $tpl_file = str_replace('.', '/', $file);
$tpl_file = str_replace('///', '../', $tpl_file); $tpl_file = str_replace('///', '../', $tpl_file);
$filename = "{$cache_prefix}_$file.html.$phpEx"; $filename = "{$cache_prefix}_$file.html.$phpEx";
if (!file_exists("{$phpbb_root_path}cache/$filename")) if (!file_exists("{$phpbb_root_path}cache/$filename"))
{ {
continue; continue;
} }
$file_tpl = "{$phpbb_root_path}styles/{$template_row['template_path']}/template/$tpl_file.html"; $file_tpl = "{$phpbb_root_path}styles/{$template_row['template_path']}/template/$tpl_file.html";
$inherited = false; $inherited = false;
if (isset($template_row['template_inherits_id']) && $template_row['template_inherits_id']) if (isset($template_row['template_inherits_id']) && $template_row['template_inherits_id'])
{ {
if (!$template_row['template_storedb']) if (!$template_row['template_storedb'])
@ -1059,7 +1059,7 @@ inherit_from = {INHERIT_FROM}
} }
} }
} }
$template->assign_block_vars('file', array( $template->assign_block_vars('file', array(
'U_VIEWSOURCE' => $this->u_action . "&action=cache&id=$template_id&source=$file", 'U_VIEWSOURCE' => $this->u_action . "&action=cache&id=$template_id&source=$file",
@ -1103,7 +1103,7 @@ inherit_from = {INHERIT_FROM}
// make sure theme_file path doesn't go upwards // make sure theme_file path doesn't go upwards
$theme_file = str_replace('..', '.', $theme_file); $theme_file = str_replace('..', '.', $theme_file);
// Retrieve some information about the theme // Retrieve some information about the theme
$sql = 'SELECT theme_storedb, theme_path, theme_name, theme_data $sql = 'SELECT theme_storedb, theme_path, theme_name, theme_data
FROM ' . STYLES_THEME_TABLE . " FROM ' . STYLES_THEME_TABLE . "
@ -1284,7 +1284,7 @@ inherit_from = {INHERIT_FROM}
$imgsize = request_var('imgsize', false); $imgsize = request_var('imgsize', false);
$imgwidth = request_var('imgwidth', 0); $imgwidth = request_var('imgwidth', 0);
$imgheight = request_var('imgheight', 0); $imgheight = request_var('imgheight', 0);
$imgname = preg_replace('#[^a-z0-9\-+_]#i', '', $imgname); $imgname = preg_replace('#[^a-z0-9\-+_]#i', '', $imgname);
$imgpath = str_replace('..', '.', $imgpath); $imgpath = str_replace('..', '.', $imgpath);
@ -1580,7 +1580,7 @@ inherit_from = {INHERIT_FROM}
{ {
$msg .= '<br />' . $values['template_name']; $msg .= '<br />' . $values['template_name'];
} }
trigger_error($msg . adm_back_link($this->u_action), E_USER_WARNING); trigger_error($msg . adm_back_link($this->u_action), E_USER_WARNING);
} }
@ -2162,14 +2162,14 @@ inherit_from = {INHERIT_FROM}
$style_default = request_var('style_default', 0); $style_default = request_var('style_default', 0);
$store_db = request_var('store_db', 0); $store_db = request_var('store_db', 0);
$sql = "SELECT {$mode}_id $sql = "SELECT {$mode}_id
FROM $sql_from FROM $sql_from
WHERE {$mode}_id <> $style_id WHERE {$mode}_id <> $style_id
AND {$mode}_name = '" . $db->sql_escape(strtolower($name)) . "'"; AND {$mode}_name = '" . $db->sql_escape(strtolower($name)) . "'";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$conflict = $db->sql_fetchrow($result); $conflict = $db->sql_fetchrow($result);
$db->sql_freeresult($result); $db->sql_freeresult($result);
if ($mode == 'style' && (!$template_id || !$theme_id || !$imageset_id)) if ($mode == 'style' && (!$template_id || !$theme_id || !$imageset_id))
{ {
$error[] = $user->lang['STYLE_ERR_NO_IDS']; $error[] = $user->lang['STYLE_ERR_NO_IDS'];
@ -2207,7 +2207,7 @@ inherit_from = {INHERIT_FROM}
} }
} }
} }
if (!sizeof($error)) if (!sizeof($error))
{ {
// Check length settings // Check length settings
@ -2374,8 +2374,8 @@ inherit_from = {INHERIT_FROM}
$db->sql_freeresult($result); $db->sql_freeresult($result);
} }
} }
if ($mode == 'template') if ($mode == 'template')
{ {
$super = array(); $super = array();
@ -3116,7 +3116,7 @@ inherit_from = {INHERIT_FROM}
// we parse the cfg here (again) // we parse the cfg here (again)
$cfg_data = parse_cfg_file("$root_path$mode/$mode.cfg"); $cfg_data = parse_cfg_file("$root_path$mode/$mode.cfg");
switch ($mode) switch ($mode)
{ {
case 'template': case 'template':
@ -3157,7 +3157,7 @@ inherit_from = {INHERIT_FROM}
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result); $row = $db->sql_fetchrow($result);
$db->sql_freeresult($result); $db->sql_freeresult($result);
if ($row) if ($row)
{ {
@ -3197,7 +3197,7 @@ inherit_from = {INHERIT_FROM}
$inherit_id = 0; $inherit_id = 0;
$inherit_path = ''; $inherit_path = '';
} }
if (sizeof($error)) if (sizeof($error))
{ {
@ -3378,11 +3378,11 @@ inherit_from = {INHERIT_FROM}
// Return store_db in case it had to be altered // Return store_db in case it had to be altered
return $store_db; return $store_db;
} }
/** /**
* Checks downwards dependencies * Checks downwards dependencies
* *
* @visibility public * @access public
* @param string $mode The element type to check - only template is supported * @param string $mode The element type to check - only template is supported
* @param int $id The template id * @param int $id The template id
* @returns false if no component inherits, array with name, path and id for each subtemplate otherwise * @returns false if no component inherits, array with name, path and id for each subtemplate otherwise
@ -3390,7 +3390,7 @@ inherit_from = {INHERIT_FROM}
function check_inheritance($mode, $id) function check_inheritance($mode, $id)
{ {
global $db; global $db;
$l_type = strtoupper($mode); $l_type = strtoupper($mode);
switch ($mode) switch ($mode)
@ -3413,10 +3413,10 @@ inherit_from = {INHERIT_FROM}
WHERE {$mode}_inherits_id = " . (int) $id; WHERE {$mode}_inherits_id = " . (int) $id;
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$names = array(); $names = array();
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
$names[$row["{$mode}_id"]] = array( $names[$row["{$mode}_id"]] = array(
"{$mode}_id" => $row["{$mode}_id"], "{$mode}_id" => $row["{$mode}_id"],
"{$mode}_name" => $row["{$mode}_name"], "{$mode}_name" => $row["{$mode}_name"],
@ -3434,11 +3434,11 @@ inherit_from = {INHERIT_FROM}
return false; return false;
} }
} }
/** /**
* Checks upwards dependencies * Checks upwards dependencies
* *
* @visibility public * @access public
* @param string $mode The element type to check - only template is supported * @param string $mode The element type to check - only template is supported
* @param int $id The template id * @param int $id The template id
* @returns false if the component does not inherit, array with name, path and id otherwise * @returns false if the component does not inherit, array with name, path and id otherwise
@ -3446,7 +3446,7 @@ inherit_from = {INHERIT_FROM}
function get_super($mode, $id) function get_super($mode, $id)
{ {
global $db; global $db;
$l_type = strtoupper($mode); $l_type = strtoupper($mode);
switch ($mode) switch ($mode)
@ -3463,13 +3463,13 @@ inherit_from = {INHERIT_FROM}
$sql_from = STYLES_IMAGESET_TABLE; $sql_from = STYLES_IMAGESET_TABLE;
break; break;
} }
$sql = "SELECT {$mode}_inherits_id $sql = "SELECT {$mode}_inherits_id
FROM $sql_from FROM $sql_from
WHERE {$mode}_id = " . (int) $id; WHERE {$mode}_id = " . (int) $id;
$result = $db->sql_query_limit($sql, 1); $result = $db->sql_query_limit($sql, 1);
if ($row = $db->sql_fetchrow($result)) if ($row = $db->sql_fetchrow($result))
{ {
$db->sql_freeresult($result); $db->sql_freeresult($result);
@ -3478,10 +3478,10 @@ inherit_from = {INHERIT_FROM}
{ {
return false; return false;
} }
$super_id = $row["{$mode}_inherits_id"]; $super_id = $row["{$mode}_inherits_id"];
$sql = "SELECT {$mode}_id, {$mode}_name, {$mode}_path $sql = "SELECT {$mode}_id, {$mode}_name, {$mode}_path
FROM $sql_from FROM $sql_from
WHERE {$mode}_id = " . (int) $super_id; WHERE {$mode}_id = " . (int) $super_id;
@ -3491,21 +3491,21 @@ inherit_from = {INHERIT_FROM}
$db->sql_freeresult($result); $db->sql_freeresult($result);
return $row; return $row;
} }
return false; return false;
} }
/** /**
* Moves a template set and its subtemplates to the database * Moves a template set and its subtemplates to the database
* *
* @visibility public * @access public
* @param string $mode The component to move - only template is supported * @param string $mode The component to move - only template is supported
* @param int $id The template id * @param int $id The template id
*/ */
function store_in_db($mode, $id) function store_in_db($mode, $id)
{ {
global $db, $user; global $db, $user;
$error = array(); $error = array();
$l_type = strtoupper($mode); $l_type = strtoupper($mode);
if ($super = $this->get_super($mode, $id)) if ($super = $this->get_super($mode, $id))
@ -3513,9 +3513,9 @@ inherit_from = {INHERIT_FROM}
$error[] = (sprintf($user->lang["{$l_type}_INHERITS"], $super['template_name'])); $error[] = (sprintf($user->lang["{$l_type}_INHERITS"], $super['template_name']));
return $error; return $error;
} }
$sql = "SELECT {$mode}_id, {$mode}_name, {$mode}_path $sql = "SELECT {$mode}_id, {$mode}_name, {$mode}_path
FROM " . STYLES_TEMPLATE_TABLE . ' FROM " . STYLES_TEMPLATE_TABLE . '
WHERE template_id = ' . (int) $id; WHERE template_id = ' . (int) $id;
$result = $db->sql_query_limit($sql, 1); $result = $db->sql_query_limit($sql, 1);
@ -3540,14 +3540,14 @@ inherit_from = {INHERIT_FROM}
{ {
return $error; return $error;
} }
return false; return false;
} }
/** /**
* Moves a template set to the database * Moves a template set to the database
* *
* @visibility private * @access private
* @param string $mode The component to move - only template is supported * @param string $mode The component to move - only template is supported
* @param int $id The template id * @param int $id The template id
* @param string $path TThe path to the template files * @param string $path TThe path to the template files
@ -3555,28 +3555,28 @@ inherit_from = {INHERIT_FROM}
function _store_in_db($mode, $id, $path) function _store_in_db($mode, $id, $path)
{ {
global $phpbb_root_path, $db; global $phpbb_root_path, $db;
$filelist = filelist("{$phpbb_root_path}styles/{$path}/template", '', 'html'); $filelist = filelist("{$phpbb_root_path}styles/{$path}/template", '', 'html');
$this->store_templates('insert', $id, $path, $filelist); $this->store_templates('insert', $id, $path, $filelist);
// Okay, we do the query here -shouldn't be triggered often. // Okay, we do the query here -shouldn't be triggered often.
$sql = 'UPDATE ' . STYLES_TEMPLATE_TABLE . ' $sql = 'UPDATE ' . STYLES_TEMPLATE_TABLE . '
SET template_storedb = 1 SET template_storedb = 1
WHERE template_id = ' . $id; WHERE template_id = ' . $id;
$db->sql_query($sql); $db->sql_query($sql);
} }
/** /**
* Moves a template set and its subtemplates to the filesystem * Moves a template set and its subtemplates to the filesystem
* *
* @visibility public * @access public
* @param string $mode The component to move - only template is supported * @param string $mode The component to move - only template is supported
* @param int $id The template id * @param int $id The template id
*/ */
function store_in_fs($mode, $id) function store_in_fs($mode, $id)
{ {
global $db, $user; global $db, $user;
$error = array(); $error = array();
$l_type = strtoupper($mode); $l_type = strtoupper($mode);
if ($super = $this->get_super($mode, $id)) if ($super = $this->get_super($mode, $id))
@ -3584,7 +3584,7 @@ inherit_from = {INHERIT_FROM}
$error[] = (sprintf($user->lang["{$l_type}_INHERITS"], $super['template_name'])); $error[] = (sprintf($user->lang["{$l_type}_INHERITS"], $super['template_name']));
return($error); return($error);
} }
$sql = "SELECT {$mode}_id, {$mode}_name, {$mode}_path $sql = "SELECT {$mode}_id, {$mode}_name, {$mode}_path
FROM " . STYLES_TEMPLATE_TABLE . ' FROM " . STYLES_TEMPLATE_TABLE . '
WHERE template_id = ' . (int) $id; WHERE template_id = ' . (int) $id;
@ -3596,9 +3596,9 @@ inherit_from = {INHERIT_FROM}
if (!sizeof($error)) if (!sizeof($error))
{ {
$subs = $this->check_inheritance($mode, $id); $subs = $this->check_inheritance($mode, $id);
$this->_store_in_fs($mode, $id, $row["{$mode}_path"]); $this->_store_in_fs($mode, $id, $row["{$mode}_path"]);
if ($subs && sizeof($subs)) if ($subs && sizeof($subs))
{ {
foreach ($subs as $sub_id => $sub) foreach ($subs as $sub_id => $sub)
@ -3615,11 +3615,11 @@ inherit_from = {INHERIT_FROM}
} }
return false; return false;
} }
/** /**
* Moves a template set to the filesystem * Moves a template set to the filesystem
* *
* @visibility private * @access private
* @param string $mode The component to move - only template is supported * @param string $mode The component to move - only template is supported
* @param int $id The template id * @param int $id The template id
* @param string $path The path to the template * @param string $path The path to the template
@ -3627,7 +3627,7 @@ inherit_from = {INHERIT_FROM}
function _store_in_fs($mode, $id, $path) function _store_in_fs($mode, $id, $path)
{ {
global $phpbb_root_path, $db, $user, $safe_mode; global $phpbb_root_path, $db, $user, $safe_mode;
$store_db = 0; $store_db = 0;
$error = array(); $error = array();
if (!$safe_mode && @is_writable("{$phpbb_root_path}styles/{$path}/template")) if (!$safe_mode && @is_writable("{$phpbb_root_path}styles/{$path}/template"))
@ -3666,7 +3666,7 @@ inherit_from = {INHERIT_FROM}
SET template_storedb = 0 SET template_storedb = 0
WHERE template_id = ' . $id; WHERE template_id = ' . $id;
$db->sql_query($sql); $db->sql_query($sql);
return false; return false;
} }

View file

@ -593,7 +593,7 @@ class phpbb_db_tools
/** /**
* Private method for performing sql statements (either execute them or return them) * Private method for performing sql statements (either execute them or return them)
* @private * @access private
*/ */
function _sql_run_sql($statements) function _sql_run_sql($statements)
{ {
@ -624,7 +624,7 @@ class phpbb_db_tools
/** /**
* Function to prepare some column information for better usage * Function to prepare some column information for better usage
* @private * @access private
*/ */
function sql_prepare_column_data($table_name, $column_name, $column_data) function sql_prepare_column_data($table_name, $column_name, $column_data)
{ {

View file

@ -2228,7 +2228,7 @@ function generate_link_hash($link_name)
/** /**
* checks a link hash - for GET requests * checks a link hash - for GET requests
* @param string $token the submitted token * @param string $token the submitted token
* @param string $link_name The name of the link * @param string $link_name The name of the link
* @return boolean true if all is fine * @return boolean true if all is fine
*/ */

View file

@ -263,7 +263,8 @@ class filespec
* *
* @param string $destination_path Destination path, for example $config['avatar_path'] * @param string $destination_path Destination path, for example $config['avatar_path']
* @param bool $overwrite If set to true, an already existing file will be overwritten * @param bool $overwrite If set to true, an already existing file will be overwritten
* @param string $chmod Permission mask for chmodding the file after a successful move. The mode entered here reflects the mode of {@inline phpbb_chmod()} * @param string $chmod Permission mask for chmodding the file after a successful move. The mode entered here reflects the mode defined by {@link phpbb_chmod()}
*
* @access public * @access public
*/ */
function move_file($destination, $overwrite = false, $skip_image_check = false, $chmod = false) function move_file($destination, $overwrite = false, $skip_image_check = false, $chmod = false)

View file

@ -147,7 +147,7 @@ function user_update_name($old_name, $new_name)
* *
* @param mixed $user_row An array containing the following keys (and the appropriate values): username, group_id (the group to place the user in), user_email and the user_type(usually 0). Additional entries not overridden by defaults will be forwarded. * @param mixed $user_row An array containing the following keys (and the appropriate values): username, group_id (the group to place the user in), user_email and the user_type(usually 0). Additional entries not overridden by defaults will be forwarded.
* @param string $cp_data custom profile fields, see custom_profile::build_insert_sql_array * @param string $cp_data custom profile fields, see custom_profile::build_insert_sql_array
* @return: the new user's ID. * @return the new user's ID.
*/ */
function user_add($user_row, $cp_data = false) function user_add($user_row, $cp_data = false)
{ {
@ -2314,7 +2314,7 @@ function avatar_process_user(&$error, $custom_userdata = false)
} }
} }
} }
$sql = 'UPDATE ' . USERS_TABLE . ' $sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . (($custom_userdata === false) ? $user->data['user_id'] : $custom_userdata['user_id']); WHERE user_id = ' . (($custom_userdata === false) ? $user->data['user_id'] : $custom_userdata['user_id']);
@ -3087,7 +3087,7 @@ function group_validate_groupname($group_id, $group_name)
/** /**
* Set users default group * Set users default group
* *
* @private * @access private
*/ */
function group_set_user_default($group_id, $user_id_ary, $group_attributes = false, $update_listing = false) function group_set_user_default($group_id, $user_id_ary, $group_attributes = false, $update_listing = false)
{ {

View file

@ -391,7 +391,7 @@ class bbcode_firstpass extends bbcode
/** /**
* Parse code text from code tag * Parse code text from code tag
* @private * @access private
*/ */
function bbcode_parse_code($stx, &$code) function bbcode_parse_code($stx, &$code)
{ {