47 public function getName($showFullName=
false)
50 return $this->FullName .
"(" . $this->Order .
")";
71 function MenuPage($Page, $TotalPage, $Uri =
'')
73 $V =
"<font class='text'><center>";
77 $Uri = preg_replace(
"/&page=[^&]*/",
"", $Uri);
82 $V.=
"<a href='$Uri&page=0'>[$text]</a> ";
83 $V.=
"<a href='$Uri&page=" . ($Page - 1) .
"'>[$text1]</a> ";
89 for ($i = $Page - 9;$i < $Page;$i++) {
91 $V.=
"<a href='$Uri&page=$i'>" . ($i + 1) .
"</a> ";
95 $V.=
"<b>" . ($Page + 1) .
"</b>";
97 for ($i = $Page + 1;($i <= $TotalPage) && ($i < $Page + 9);$i++) {
98 $V.=
" <a href='$Uri&page=$i'>" . ($i + 1) .
"</a>";
100 if ($Page < $TotalPage) {
101 if ($Page < $TotalPage - 9) {
106 $V.=
" <a href='$Uri&page=" . ($Page + 1) .
"'>[$text]</a>";
107 $V.=
" <a href='$Uri&page=" . ($TotalPage) .
"'>[$text1]</a>";
109 $V.=
"</center></font>";
124 $V =
"<font class='text'><center>";
128 $Uri = preg_replace(
"/&page=[^&]*/",
"", $Uri);
133 $V.=
"<a href='$Uri&page=0'>[$text]</a> ";
134 $V.=
"<a href='$Uri&page=" . ($Page - 1) .
"'>[$text1]</a> ";
140 for ($i = $Page - 9;$i < $Page;$i++) {
142 $V.=
"<a href='$Uri&page=$i'>" . ($i + 1) .
"</a> ";
146 $V.=
"<b>" . ($Page + 1) .
"</b>";
151 $V.=
" <a href='$Uri&page=$i'>" . ($i + 1) .
"</a>";
152 $V.=
" ... <a href='$Uri&page=$i'>[$text]</a>";
154 $V.=
"</center></font>";
170 if ($a->Order > $b->Order) {
173 if ($a->Order < $b->Order) {
176 $rc = strcmp($a->Name, $b->Name);
177 return (strcmp($a->Name, $b->Name));
201 $pathElement = count($splitPath) > 0 ? $splitPath[0] : null;
202 $pathRemainder = count($splitPath) > 1 ? $splitPath[1] : null;
203 $hasPathComponent = $pathElement !== null && $pathElement !==
"";
205 if (!$hasPathComponent) {
209 $isLeaf = $pathRemainder === null;
210 $menuItemsExist = isset($menuItems) && is_array($menuItems);
212 $currentMenuItem = NULL;
213 if ($menuItemsExist) {
214 foreach ($menuItems as &$menuItem) {
216 if (!strcmp($menuItem->Name, $pathElement) && strcmp($menuItem->Name,
MENU_BREAK)) {
217 $currentMenuItem = $menuItem;
219 }
else if (!strcmp($menuItem->Name,
MENU_BREAK) && ($menuItem->Order == $LastOrder)) {
220 $currentMenuItem = $menuItem;
226 $path[] = $pathElement;
230 $currentItemIsMissing = empty($currentMenuItem);
231 if ($currentItemIsMissing) {
232 $currentMenuItem =
new menu;
233 $currentMenuItem->Name = $pathElement;
236 if (! $menuItemsExist) {
237 $menuItems = array();
239 array_push($menuItems, $currentMenuItem);
245 if ($LastOrder != 0) {
246 if ($currentMenuItem->Order != $LastOrder) {
249 $currentMenuItem->Order = $LastOrder;
251 $currentMenuItem->Target =
$Target;
252 $currentMenuItem->URI =
$URI;
253 $currentMenuItem->HTML =
$HTML;
254 $currentMenuItem->Title = $Title;
257 $currentMenuItem->MaxDepth =
max ($currentMenuItem->MaxDepth, $Depth + 1);
261 usort($menuItems,
'menu_cmp');
265 return ($currentMenuItem->MaxDepth);
311 $PathParts = explode(
'::',
$Name, 2);
312 foreach ($Menu as $Val) {
313 if ($Val->Name == $PathParts[0]) {
314 if (empty($PathParts[1])) {
316 return ($Val->SubMenu);
340 function menu_to_1html($Menu, $ShowRefresh = 1, $ShowTraceback = 0, $ShowAll = 1)
342 $showFullName = isset($_SESSION) && array_key_exists(
'fullmenudebug', $_SESSION) && $_SESSION[
'fullmenudebug'] == 1;
347 if ($ShowTraceback) {
349 $Refresh = & $Plugins[plugin_find_id(
"refresh") ];
350 if (!empty($Refresh)) {
351 $text = _(
"Traceback");
353 $Std.=
"<a href='$URL' target='_top'>$text</a>";
360 $text = _(
"Refresh");
361 $Std.=
"<a href='" .
Traceback() .
"'>$text</a>";
365 foreach ($Menu as $Val) {
368 $V .=
" •";
372 $V .=
" ";
375 }
else if (!empty($Val->HTML)) {
382 }
else if (!empty($Val->URI)) {
386 $V.=
"<a href='" .
Traceback_uri() .
"?mod=" . $Val->URI .
"'";
387 if (!empty($Val->Title)) {
388 $V.=
" title='" . htmlentities($Val->Title, ENT_QUOTES) .
"'";
398 }
else if ($ShowAll) {
413 $V.=
" • ";
418 $menu_to_1html_counter++;
419 return (
"<div id='menu1html-$menu_to_1html_counter' align='right' style='padding:0px 5px 0px 5px'><small>$V</small></div>");
429 return "(" . $menu->Order .
")";
448 function menu_to_1list($Menu, &$Parm, $Pre =
"", $Post =
"", $ShowAll = 1, $upload_id =
"")
454 $showFullName = isset($_SESSION) && array_key_exists(
'fullmenudebug', $_SESSION) && $_SESSION[
'fullmenudebug'] == 1;
457 foreach ($Menu as $Val) {
458 if (!empty($Val->HTML)) {
460 }
else if (!empty($Val->URI)) {
461 if (!empty($upload_id) &&
"tag" == $Val->URI) {
462 $tagstatus = TagStatus($upload_id);
463 if (0 == $tagstatus) {
468 $entry =
"[<a href='" .
Traceback_uri() .
"?mod=" . $Val->URI .
"&" . $Parm .
"'";
469 if (!empty($Val->Title)) {
470 $entry .=
" title='" . htmlentities($Val->Title, ENT_QUOTES) .
"'";
473 $entry .= $Val->getName($showFullName);
475 }
else if ($ShowAll) {
476 $entry =
"[" . $Val->getName($showFullName) .
"]";
480 $V .= $Pre . $entry . $Post;
499 foreach ($Menu as $Val) {
500 for ($i = 0;$i < $Indent;$i++) {
503 print
"$Val->Name ($Val->Order,$Val->URI)\n";
548 foreach ($Menu as $MenuObj) {
549 if ($MenuObj->Name != $RmName) {
550 $NewArray[] = $MenuObj;
Traceback_uri()
Get the URI without query to this location.
FUNCTION int max(int permGroup, int permPublic)
Get the maximum group privilege.
Traceback_dir()
Get the directory of the URI without query.
Traceback()
Get the URI + query to this location.