Home
>
Outdated forums
>
Phorum 3 forums (READ ONLY)
>
Mod Requests and Suggestions (READ ONLY)
>
Topic
Show path with embeded link
Posted by dude
Show path with embeded link October 13, 2002 01:40PM |
IP/Host: 202.145.76.--- Registered: 21 years ago Posts: 24 |
Background
I am using Phorum 3.4dev20021005. My forum folders are hierarchically structured to mimic a file system.
Mod purpose
I intend to modify the codes so that the folder path can be shown in the header.php.
Mod Plan
To achieve the goal, I partitioned my task into two stages:
Stage 1. Show path
Stage 2. Show path with embeded link of each folder
====== working log =======
Stage 1 is not difficult, and its technique refers to the "./ADMIN/PAGES/MANAGEMENU.PHP" file.
Basicly, I just added the following lines in the HEADER.PHP.
<? define("PHORUM_ADMIN", 1);
include "./common.php";
include "./admin/functions.php";
$Title=GetForumPath($num);
echo $Title; ?>
The result is good, and my HEADER.PHP file shows the whole path of my current folder on top of the views that apply this header file.
------------------------------------------
Stage 2 is not very nature to me.
My plan is to create another function similar to the GetForumPath but with link info contained. I decided to use GetForumPath as a template to create this new function.
To implement this plan I decided to create two local variables (i.e., $link_head and $link_tail as shown below) and calls for the global variable $f, then chain them together with the $path variable to make it work.
$link_head="<a href=/"" + $PHORUM + "/index.php?f="
$link_tail="</a>"
Then, I will try to make a new variable $node to work with $path for the effect.
$node = $link_head + $f + "/"" + $PHORUM["ForumName"] + $link_tail;
But, to make sure my idea is valid, I have to be sure that I did not mis-interpret the original codes. Especially, when I merge this code into the new function, will $f changes its value corresponding to the change of the $PATH in the while loop? It is still unknown. It all depends on the better understanding of the original code of GetForumPath function with regard to how this code translates the forum tables to the file structure as described in the Mod Question #2.
Mod Questions
When I look into the original template function GetForumPath(#id) in the "./ADMIN/FUNCTIONS.PHP", two questions come to me.
1. In the MANAGEMENU.PHP file as shown below, it calls the GetForumPath function by passing a global variable #num. I tried to use #num and #f respectively in the new HEADER.PHP file, and they both work.
$Title=GetForumPath($num);
....
<table border="0" cellspacing="0" cellpadding="3" class="box-table">
<tr>
<td align="center" class="table-header"><?php echo $Title; ?></td>
There is no place in the MANAGEMENU.PHP declaring #num as a global variable. I guess it is because this file is included by the "./ADMIN/INDEX.PHP" file indirectly by the $page variable in that file. This "./ADMIN/INDEX.PHP" file then includes the "COMMON.PHP" to have all the variables defined there. Am I correct?
But, when I trace the COMMON.PHP file, variables #num and #f are defined as below:
settype($f, "integer");
settype($num, "integer");
$num = (empty($num)) ? $f : $num;
$f = (empty($f)) ? $num : $f;
Why it is set up like this? Will two variables #num and #f refer to each other be more beneficial then just one variable? Will this cause a reference loop(i.e.,back and forth reference)? Sorry, I am a newbie on programming. Please give advice in a more explicit way.
2. Some variables' definitions in the GetForumPath function are not self-explanatory to me in the "./ADMIN/FUNCTIONS.PHP" file. I still can not figure out how the forum path is arranged by checking the following codes.
function GetForumPath($id){
// don't global $PHORUM here
$file=$GLOBALS["PHORUM"]["settings_dir"]."/$id.php";
$path="";
While(file_exists($file)){
include $file;
$path = (empty($path)) ? $PHORUM["ForumName"] : "$PHORUM[ForumName] : $path";
$file=$GLOBALS["PHORUM"]["settings_dir"]."/$PHORUM[ForumParent].php";
}
As I mentioned in the stage 2 of my plan in the beginning, I want to add html encapsulation of the node names(or folder names) in the chained $path variable. However, two definitions are foreign to me.
a. What is $GLOBALS["PHORUM"]["settings_dir"]."/$id.php??
It does not look like a normal PHP global array such as $GLOBALS["a"] to me but like some kind of chain of global array, what is the implication for this? Does $GLOBALS["PHORUM"]["settings_dir"] refer to the phorum's "admin/settings" directory?
Also, is this "PHORUM" variable equal to the "$PHORUM"? Is ["settings_dir"] the same as ["$settings_dir"], or is it supposed to be the value of the true "admin/settings" directory? Can someone help unravel the mystery? Then what is this "/$id.php trying to do? I know $id will be replaced by $f or $num when it is called.
b. How does the variable $file work to control the "while loop"? It seems like the while loop will keep searching until $file can not find any parent at all(i.e., If empty($path)). But, the Phorum file structure is vague to me. How does it translate the forum tables to directories? If $file will be replaced by a new value(i.e., $PHORUM[ForumParent]), then what does it have anything to do with this "phorum/admin/settings" directory? Why does it need the "php" as an extension name as shown below?
$path = (empty($path)) ? $PHORUM["ForumName"] : "$PHORUM[ForumName] : $path";
$file=$GLOBALS["PHORUM"]["settings_dir"]."/$PHORUM[ForumParent].php";
I believe once how Phorum's file system (or folder system) is translated from the forum tables can be explained. Then, it will be easier for me to accomplish my task.
regards,
Dan Chang
Post Edited (10-14-02 06:08)
I am using Phorum 3.4dev20021005. My forum folders are hierarchically structured to mimic a file system.
Mod purpose
I intend to modify the codes so that the folder path can be shown in the header.php.
Mod Plan
To achieve the goal, I partitioned my task into two stages:
Stage 1. Show path
Stage 2. Show path with embeded link of each folder
====== working log =======
Stage 1 is not difficult, and its technique refers to the "./ADMIN/PAGES/MANAGEMENU.PHP" file.
Basicly, I just added the following lines in the HEADER.PHP.
<? define("PHORUM_ADMIN", 1);
include "./common.php";
include "./admin/functions.php";
$Title=GetForumPath($num);
echo $Title; ?>
The result is good, and my HEADER.PHP file shows the whole path of my current folder on top of the views that apply this header file.
------------------------------------------
Stage 2 is not very nature to me.
My plan is to create another function similar to the GetForumPath but with link info contained. I decided to use GetForumPath as a template to create this new function.
To implement this plan I decided to create two local variables (i.e., $link_head and $link_tail as shown below) and calls for the global variable $f, then chain them together with the $path variable to make it work.
$link_head="<a href=/"" + $PHORUM + "/index.php?f="
$link_tail="</a>"
Then, I will try to make a new variable $node to work with $path for the effect.
$node = $link_head + $f + "/"" + $PHORUM["ForumName"] + $link_tail;
But, to make sure my idea is valid, I have to be sure that I did not mis-interpret the original codes. Especially, when I merge this code into the new function, will $f changes its value corresponding to the change of the $PATH in the while loop? It is still unknown. It all depends on the better understanding of the original code of GetForumPath function with regard to how this code translates the forum tables to the file structure as described in the Mod Question #2.
Mod Questions
When I look into the original template function GetForumPath(#id) in the "./ADMIN/FUNCTIONS.PHP", two questions come to me.
1. In the MANAGEMENU.PHP file as shown below, it calls the GetForumPath function by passing a global variable #num. I tried to use #num and #f respectively in the new HEADER.PHP file, and they both work.
$Title=GetForumPath($num);
....
<table border="0" cellspacing="0" cellpadding="3" class="box-table">
<tr>
<td align="center" class="table-header"><?php echo $Title; ?></td>
There is no place in the MANAGEMENU.PHP declaring #num as a global variable. I guess it is because this file is included by the "./ADMIN/INDEX.PHP" file indirectly by the $page variable in that file. This "./ADMIN/INDEX.PHP" file then includes the "COMMON.PHP" to have all the variables defined there. Am I correct?
But, when I trace the COMMON.PHP file, variables #num and #f are defined as below:
settype($f, "integer");
settype($num, "integer");
$num = (empty($num)) ? $f : $num;
$f = (empty($f)) ? $num : $f;
Why it is set up like this? Will two variables #num and #f refer to each other be more beneficial then just one variable? Will this cause a reference loop(i.e.,back and forth reference)? Sorry, I am a newbie on programming. Please give advice in a more explicit way.
2. Some variables' definitions in the GetForumPath function are not self-explanatory to me in the "./ADMIN/FUNCTIONS.PHP" file. I still can not figure out how the forum path is arranged by checking the following codes.
function GetForumPath($id){
// don't global $PHORUM here
$file=$GLOBALS["PHORUM"]["settings_dir"]."/$id.php";
$path="";
While(file_exists($file)){
include $file;
$path = (empty($path)) ? $PHORUM["ForumName"] : "$PHORUM[ForumName] : $path";
$file=$GLOBALS["PHORUM"]["settings_dir"]."/$PHORUM[ForumParent].php";
}
As I mentioned in the stage 2 of my plan in the beginning, I want to add html encapsulation of the node names(or folder names) in the chained $path variable. However, two definitions are foreign to me.
a. What is $GLOBALS["PHORUM"]["settings_dir"]."/$id.php??
It does not look like a normal PHP global array such as $GLOBALS["a"] to me but like some kind of chain of global array, what is the implication for this? Does $GLOBALS["PHORUM"]["settings_dir"] refer to the phorum's "admin/settings" directory?
Also, is this "PHORUM" variable equal to the "$PHORUM"? Is ["settings_dir"] the same as ["$settings_dir"], or is it supposed to be the value of the true "admin/settings" directory? Can someone help unravel the mystery? Then what is this "/$id.php trying to do? I know $id will be replaced by $f or $num when it is called.
b. How does the variable $file work to control the "while loop"? It seems like the while loop will keep searching until $file can not find any parent at all(i.e., If empty($path)). But, the Phorum file structure is vague to me. How does it translate the forum tables to directories? If $file will be replaced by a new value(i.e., $PHORUM[ForumParent]), then what does it have anything to do with this "phorum/admin/settings" directory? Why does it need the "php" as an extension name as shown below?
$path = (empty($path)) ? $PHORUM["ForumName"] : "$PHORUM[ForumName] : $path";
$file=$GLOBALS["PHORUM"]["settings_dir"]."/$PHORUM[ForumParent].php";
I believe once how Phorum's file system (or folder system) is translated from the forum tables can be explained. Then, it will be easier for me to accomplish my task.
regards,
Dan Chang
Post Edited (10-14-02 06:08)
Get some progress with a trace October 15, 2002 02:54AM |
IP/Host: 202.145.76.--- Registered: 21 years ago Posts: 24 |
I am now able to locate the folder link files such as 1.php, 2.php, 3.php, and etc. They are located in the admin/settings directory.
However, I do not see 0.php, am I supposed to see it?
I made a trace to identify the directory/folder association with the #.php by altering the GetForumPath(#id) as
While(file_exists($file)){
include $file;
$path = (empty($path)) ? $PHORUM["ForumName"] : "$PHORUM[ForumName] : $path";
$file=$GLOBALS["PHORUM"]["settings_dir"]."/$PHORUM[ForumParent].php";
return array ($file,$path); // This is my add on trace line
Then, I capture and display the traced values of this array by adding the following lines in the header.php file.
<? define("PHORUM_ADMIN", 1);
include "./common.php";
include "./admin/functions.php";
list($file_route,$route_path) = GetForumPath($num);
echo $file_route; echo $route_path; ?>
Guess what?
It does reflect the parent folder's "./admin/settings/#.php" association as well as showing the current folder/forum name.
However, there are still something unlinked:
1. I do not see 0.php via ftp in the ./admin/settings directory even though when I look into the top level folder's content, my trace program shows its parent's file association is:
./admin/settings/0.php
Is it normal? Could this 0.php be hidden from the ftp program? I do see a lot of #.php files there.
2. If I want to show the current folder's #.php association instead of parent folder's #php association, what should variable $PHORUM[ForumParent].php be replaced to?
Post Edited (10-15-02 02:11)
However, I do not see 0.php, am I supposed to see it?
I made a trace to identify the directory/folder association with the #.php by altering the GetForumPath(#id) as
While(file_exists($file)){
include $file;
$path = (empty($path)) ? $PHORUM["ForumName"] : "$PHORUM[ForumName] : $path";
$file=$GLOBALS["PHORUM"]["settings_dir"]."/$PHORUM[ForumParent].php";
return array ($file,$path); // This is my add on trace line
Then, I capture and display the traced values of this array by adding the following lines in the header.php file.
<? define("PHORUM_ADMIN", 1);
include "./common.php";
include "./admin/functions.php";
list($file_route,$route_path) = GetForumPath($num);
echo $file_route; echo $route_path; ?>
Guess what?
It does reflect the parent folder's "./admin/settings/#.php" association as well as showing the current folder/forum name.
However, there are still something unlinked:
1. I do not see 0.php via ftp in the ./admin/settings directory even though when I look into the top level folder's content, my trace program shows its parent's file association is:
./admin/settings/0.php
Is it normal? Could this 0.php be hidden from the ftp program? I do see a lot of #.php files there.
2. If I want to show the current folder's #.php association instead of parent folder's #php association, what should variable $PHORUM[ForumParent].php be replaced to?
Post Edited (10-15-02 02:11)
Trace program update October 15, 2002 03:31AM |
IP/Host: 202.145.76.--- Registered: 21 years ago Posts: 24 |
I just found the answer for the second question that I posted earlier.
If someone wants to show the current folder's #.php association instead of parent folder's #.php association. He only needs to replace the
$file=$GLOBALS["PHORUM"]["settings_dir"]."/$PHORUM[ForumParent].php";
to
$file=$GLOBALS["PHORUM"]["settings_dir"]."/$PHORUM[ForumId].php";
In the trace program of my previous message.
However, I am not sure is there supposed to be a 0.php to represent the top level entry?
Post Edited (10-15-02 02:32)
If someone wants to show the current folder's #.php association instead of parent folder's #.php association. He only needs to replace the
$file=$GLOBALS["PHORUM"]["settings_dir"]."/$PHORUM[ForumParent].php";
to
$file=$GLOBALS["PHORUM"]["settings_dir"]."/$PHORUM[ForumId].php";
In the trace program of my previous message.
However, I am not sure is there supposed to be a 0.php to represent the top level entry?
Post Edited (10-15-02 02:32)
Full path with links October 15, 2002 08:15AM |
IP/Host: 202.145.76.--- Registered: 21 years ago Posts: 24 |
The following function will return the full path with embeded links. But, I am still trying to fix a minor glitch to show the root directory.
function GetForumPathLink($id){
// don't global $PHORUM here
$file=$GLOBALS["PHORUM"]["settings_dir"]."/$id.php";
$path="";
$url_head="<a href='";
$url_mid="'>";
$url_tail="</a>";
While(file_exists($file)){
include $file;
$url="./index.php?f=$PHORUM[ForumId]";
$path = (empty($path)) ? $PHORUM["ForumName"] : "$PHORUM[ForumName]";
$link_path= $url_head.$url.$url_mid.$path.$url_tail;
$file=$GLOBALS["PHORUM"]["settings_dir"]."/$PHORUM[ForumParent].php";
$full_path=$link_path.":".$full_path;
}
return $full_path;
}
Post Edited (10-15-02 10:14)
function GetForumPathLink($id){
// don't global $PHORUM here
$file=$GLOBALS["PHORUM"]["settings_dir"]."/$id.php";
$path="";
$url_head="<a href='";
$url_mid="'>";
$url_tail="</a>";
While(file_exists($file)){
include $file;
$url="./index.php?f=$PHORUM[ForumId]";
$path = (empty($path)) ? $PHORUM["ForumName"] : "$PHORUM[ForumName]";
$link_path= $url_head.$url.$url_mid.$path.$url_tail;
$file=$GLOBALS["PHORUM"]["settings_dir"]."/$PHORUM[ForumParent].php";
$full_path=$link_path.":".$full_path;
}
return $full_path;
}
Post Edited (10-15-02 10:14)
Re: Full path with links(release) October 15, 2002 11:54AM |
IP/Host: 202.145.76.--- Registered: 21 years ago Posts: 24 |
Now, it works!
function FullPathWithLink($id){
$file=$GLOBALS["PHORUM"]["settings_dir"]."/$id.php";
$path="";
$url_head="<a href='";
$url_mid="'>";
$url_tail="</a>";
While(file_exists($file)){
include $file;
$url="./index.php?f=$PHORUM[ForumId]";
$path = (empty($path)) ? $PHORUM["ForumName"] : "$PHORUM[ForumName]";
$link_path= $url_head.$url.$url_mid.$path.$url_tail;
$file=$GLOBALS["PHORUM"]["settings_dir"]."/$PHORUM[ForumParent].php";
$full_path=$link_path.">".$full_path;
}
$url="./index.php";
$link_path= $url_head.$url.$url_mid."root".$url_tail;
$full_path=$link_path.">".$full_path;
return $full_path;
}
Let's say you put this function into "./admin/functions.php".
Then, you can call this function to generate a linked full path by adding this php script in the "./include/header.php".
<? include "./common.php";
include "./admin/functions.php";
$full_path=FullPathWithLink($f);
echo $full_path; ?>
Add style on this full path, if you want.
function FullPathWithLink($id){
$file=$GLOBALS["PHORUM"]["settings_dir"]."/$id.php";
$path="";
$url_head="<a href='";
$url_mid="'>";
$url_tail="</a>";
While(file_exists($file)){
include $file;
$url="./index.php?f=$PHORUM[ForumId]";
$path = (empty($path)) ? $PHORUM["ForumName"] : "$PHORUM[ForumName]";
$link_path= $url_head.$url.$url_mid.$path.$url_tail;
$file=$GLOBALS["PHORUM"]["settings_dir"]."/$PHORUM[ForumParent].php";
$full_path=$link_path.">".$full_path;
}
$url="./index.php";
$link_path= $url_head.$url.$url_mid."root".$url_tail;
$full_path=$link_path.">".$full_path;
return $full_path;
}
Let's say you put this function into "./admin/functions.php".
Then, you can call this function to generate a linked full path by adding this php script in the "./include/header.php".
<? include "./common.php";
include "./admin/functions.php";
$full_path=FullPathWithLink($f);
echo $full_path; ?>
Add style on this full path, if you want.
Re: Show path with embeded link March 09, 2004 10:36PM |
IP/Host: ---.itsnpt.com Registered: 18 years ago Posts: 20 |
Hey, I just finished hardening the Server here and i was wondering if someone that knows how to hack webservers can try and hack my server. most likely he won't succeed but i wont to make sure i did a good job. My site is www.parkavebmw.com As i said the site is bullet proof but you can never be too sure.
Sorry, you do not have permission to post/reply in this forum.