36 public function getName($showFullName=
false)
39 return $this->FullName .
"(" . $this->Order .
")";
60 function MenuPage($Page, $TotalPage, $Uri =
'')
62 $V =
"<ul class='pagination pagination-sm justify-content-center'>";
66 $Uri = preg_replace(
"/&page=[^&]*/",
"", $Uri);
71 $V.=
"<li class='page-item'><a class='page-link' href='$Uri&page=0'>$text</a></li>";
72 $V.=
"<li class='page-item'><a class='page-link' href='$Uri&page=" . ($Page - 1) .
"'>$text1</a></li>";
78 for ($i = $Page - 9;$i < $Page;$i++) {
80 $V.=
"<li class='page-item'><a class='page-link' href='$Uri&page=$i'>" . ($i + 1) .
"</a></li>";
84 $V.=
"<li class='page-item active'><a class='page-link' href='#'>" . ($Page + 1) .
"</a></li>";
86 for ($i = $Page + 1;($i <= $TotalPage) && ($i < $Page + 9);$i++) {
87 $V.=
"<li class='page-item'><a class='page-link' href='$Uri&page=$i'>" . ($i + 1) .
"</a></li>";
89 if ($Page < $TotalPage) {
90 if ($Page < $TotalPage - 9) {
95 $V.=
"<li class='page-item'><a class='page-link' href='$Uri&page=" . ($Page + 1) .
"'>$text</a></li>";
96 $V.=
"<li class='page-item'><a class='page-link' href='$Uri&page=" . ($TotalPage) .
"'>$text1</a></li>";
113 $V =
"<center><ul class='pagination pagination-sm justify-content-center'>";
117 $Uri = preg_replace(
"/&page=[^&]*/",
"", $Uri);
122 $V.=
"<li class='page-item'><a class='page-link' href='$Uri&page=0'>$text</a></li>";
123 $V.=
"<li class='page-item'><a class='page-link' href='$Uri&page=" . ($Page - 1) .
"'>$text1</a></li>";
129 for ($i = $Page - 9;$i < $Page;$i++) {
131 $V.=
"<li class='page-item'><a class='page-link' href='$Uri&page=$i'>" . ($i + 1) .
"</a></li>";
135 $V.=
"<li class='page-item active'><a class='page-link' href='#'>" . ($Page + 1) .
"</a></li>";
140 $V.=
"<li class='page-item'><a class='page-link' href='$Uri&page=$i'>" . ($i + 1) .
"</a></li>";
141 $V.=
"<li class='page-item'><a class='page-link' href='$Uri&page=$i'>$text</a></li>";
143 $V.=
"</ul></center>";
159 if ($a->Order > $b->Order) {
162 if ($a->Order < $b->Order) {
165 $rc = strcmp($a->Name, $b->Name);
166 return (strcmp($a->Name, $b->Name));
187 function menu_insert_r(&$menuItems, $path, $pathRemainder, $LastOrder, $Target, $URI, $HTML, &$Title)
190 $pathElement = count($splitPath) > 0 ? $splitPath[0] :
null;
191 $pathRemainder = count($splitPath) > 1 ? $splitPath[1] :
null;
192 $hasPathComponent = $pathElement !==
null && $pathElement !==
"";
194 if (!$hasPathComponent) {
198 $isLeaf = $pathRemainder ===
null;
199 $menuItemsExist = isset($menuItems) && is_array($menuItems);
201 $currentMenuItem = NULL;
202 if ($menuItemsExist) {
203 foreach ($menuItems as &$menuItem) {
205 if (!strcmp($menuItem->Name, $pathElement) && strcmp($menuItem->Name,
MENU_BREAK)) {
206 $currentMenuItem = $menuItem;
208 }
else if (!strcmp($menuItem->Name,
MENU_BREAK) && ($menuItem->Order == $LastOrder)) {
209 $currentMenuItem = $menuItem;
215 $path[] = $pathElement;
219 $currentItemIsMissing = empty($currentMenuItem);
220 if ($currentItemIsMissing) {
221 $currentMenuItem =
new menu;
222 $currentMenuItem->Name = $pathElement;
223 $currentMenuItem->FullName = $FullName;
225 if (! $menuItemsExist) {
226 $menuItems = array();
228 $menuItems[] = $currentMenuItem;
234 if ($LastOrder != 0) {
235 if ($currentMenuItem->Order != $LastOrder) {
238 $currentMenuItem->Order = $LastOrder;
240 $currentMenuItem->Target = $Target;
241 $currentMenuItem->URI = $URI;
242 $currentMenuItem->HTML = $HTML;
243 $currentMenuItem->Title = $Title;
245 $Depth =
menu_insert_r($currentMenuItem->SubMenu, $path, $pathRemainder, $LastOrder, $Target, $URI, $HTML, $Title);
246 $currentMenuItem->MaxDepth =
max ($currentMenuItem->MaxDepth, $Depth + 1);
250 usort($menuItems,
'menu_cmp');
254 return ($currentMenuItem->MaxDepth);
269 function menu_insert($Path, $LastOrder = 0, $URI = NULL, $Title = NULL, $Target = NULL, $HTML = NULL)
300 $PathParts = explode(
'::', $Name, 2);
301 foreach ($Menu as $Val) {
302 if ($Val->Name == $PathParts[0]) {
303 if (empty($PathParts[1])) {
304 $MaxDepth = $Val->MaxDepth;
305 return ($Val->SubMenu);
307 return (
menu_find($PathParts[1], $MaxDepth, $Val->SubMenu));
329 function menu_to_1html($Menu, $ShowRefresh = 1, $ShowTraceback = 0, $ShowAll = 1)
331 $showFullName = isset($_SESSION) && array_key_exists(
'fullmenudebug', $_SESSION) && $_SESSION[
'fullmenudebug'] == 1;
336 if ($ShowTraceback) {
338 $Refresh = & $Plugins[plugin_find_id(
"refresh") ];
339 if (!empty($Refresh)) {
340 $text = _(
"Traceback");
342 $Std.=
"<a href='$URL' target='_top'>$text</a>";
349 $text = _(
"Refresh");
350 $Std.=
"<a href='" .
Traceback() .
"'>$text</a>";
354 foreach ($Menu as $Val) {
357 $V .=
" •";
361 $V .=
" ";
364 }
else if (!empty($Val->HTML)) {
371 }
else if (!empty($Val->URI)) {
375 $V.=
"<a href='" .
Traceback_uri() .
"?mod=" . $Val->URI .
"'";
376 if (!empty($Val->Title)) {
377 $V.=
" title='" . htmlentities($Val->Title, ENT_QUOTES) .
"'";
387 }
else if ($ShowAll) {
402 $V.=
" • ";
408 return (
"<div id='menu1html-$menu_to_1html_counter' align='right' style='padding:0px 5px 0px 5px'><small>$V</small></div>");
418 return "(" . $menu->Order .
")";
437 function menu_to_1list($Menu, &$Parm, $Pre =
"", $Post =
"", $ShowAll = 1, $upload_id =
"")
443 $showFullName = isset($_SESSION) && array_key_exists(
'fullmenudebug', $_SESSION) && $_SESSION[
'fullmenudebug'] == 1;
446 foreach ($Menu as $Val) {
447 if (!empty($Val->HTML)) {
449 }
else if (!empty($Val->URI)) {
450 if (!empty($upload_id) &&
"tag" == $Val->URI) {
451 $tagstatus = TagStatus($upload_id);
452 if (0 == $tagstatus) {
457 $entry =
"[<a href='" .
Traceback_uri() .
"?mod=" . $Val->URI .
"&" . $Parm .
"'";
458 if (!empty($Val->Title)) {
459 $entry .=
" title='" . htmlentities($Val->Title, ENT_QUOTES) .
"'";
462 $entry .= $Val->getName($showFullName);
464 }
else if ($ShowAll) {
465 $entry =
"[" . $Val->getName($showFullName) .
"]";
469 $V .= $Pre . $entry . $Post;
488 foreach ($Menu as $Val) {
489 for ($i = 0;$i < $Indent;$i++) {
492 print
"$Val->Name ($Val->Order,$Val->URI)\n";
537 foreach ($Menu as $MenuObj) {
538 if ($MenuObj->Name != $RmName) {
539 $NewArray[] = $MenuObj;
Traceback_uri()
Get the URI without query to this location.
Traceback_dir()
Get the directory of the URI without query.
Traceback()
Get the URI + query to this location.
FUNCTION int max(int permGroup, int permPublic)
Get the maximum group privilege.