国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

109 řádky
4.2KB

  1. <?php
  2. /**
  3. * 管理菜单函数
  4. *
  5. * @version $Id: inc_menu_func.php 1 10:32 2010年7月21日Z tianya $
  6. * @package DedeCMS.Administrator
  7. * @copyright Copyright (c) 2007 - 2018, DesDev, Inc.
  8. * @copyright Copyright (c) 2020, DedeBIZ.COM
  9. * @license https://www.dedebiz.com/license/v6
  10. * @link https://www.dedebiz.com
  11. */
  12. require_once(dirname(__FILE__)."/../config.php");
  13. require_once(DEDEINC."/dedetag.class.php");
  14. $headTemplet = "<dl class='bitem' id='sunitems~cc~'><dt onClick='showHide(\"items~cc~\")'><b>~channelname~</b></dt>
  15. <dd style='display:~display~' class='sitem' id='items~cc~'>
  16. <ul class='sitemu'>\r\n";
  17. $footTemplet = "</ul>\r\n</dd>\r\n</dl>\r\n";
  18. $itemTemplet = "<li>~link~</li>\r\n";
  19. function GetMenus($userrank,$topos='main')
  20. {
  21. global $openitem,$headTemplet,$footTemplet,$itemTemplet;
  22. if($topos=='main')
  23. {
  24. $openitem = (empty($openitem) ? 1 : $openitem);
  25. $menus = $GLOBALS['menusMain'];
  26. }
  27. else if($topos=='module')
  28. {
  29. $openitem = 100;
  30. $menus = $GLOBALS['menusMoudle'];
  31. }
  32. $dtp = new DedeTagParse();
  33. $dtp->SetNameSpace('m','<','>');
  34. $dtp->LoadSource($menus);
  35. $dtp2 = new DedeTagParse();
  36. $dtp2->SetNameSpace('m','<','>');
  37. $m = 0;
  38. foreach($dtp->CTags as $i=>$ctag)
  39. {
  40. if($ctag->GetName()=='top' && ($ctag->GetAtt('rank')=='' || TestPurview($ctag->GetAtt('rank')) ))
  41. {
  42. if($openitem!=999 && !preg_match("#".$openitem.'_'."#", $ctag->GetAtt('item')) && $openitem!=100) continue;
  43. $m++;
  44. echo "<!-- Item ".($m+1)." Strat -->\r\n";
  45. $htmp = str_replace("~channelname~",$ctag->GetAtt("name"),$headTemplet);
  46. if(empty($openitem) || $openitem==100)
  47. {
  48. if($ctag->GetAtt('notshowall')=='1') continue;
  49. $htmp = str_replace('~display~',$ctag->GetAtt('display'),$htmp);
  50. }
  51. else
  52. {
  53. if($openitem==$ctag->GetAtt('item') || preg_match("#".$openitem.'_'."#", $ctag->GetAtt('item')) || $openitem=='-1')
  54. $htmp = str_replace('~display~','block',$htmp);
  55. else
  56. $htmp = str_replace('~display~','none',$htmp);
  57. }
  58. $htmp = str_replace('~cc~',$m.'_'.$openitem,$htmp);
  59. echo $htmp;
  60. $dtp2->LoadSource($ctag->InnerText);
  61. foreach($dtp2->CTags as $j=>$ctag2)
  62. {
  63. $ischannel = trim($ctag2->GetAtt('ischannel'));
  64. if($ctag2->GetName()=='item' && ($ctag2->GetAtt('rank')=='' || TestPurview($ctag2->GetAtt('rank')) ) )
  65. {
  66. $link = "<a href='".$ctag2->GetAtt('link')."' target='".$ctag2->GetAtt('target')."'>".$ctag2->GetAtt('name')."</a>";
  67. if($ischannel=='1')
  68. {
  69. if($ctag2->GetAtt('addalt')!='') {
  70. $addalt = $ctag2->GetAtt('addalt');
  71. }
  72. else {
  73. $addalt = '录入新内容';
  74. }
  75. if($ctag2->GetAtt('addico')!='') {
  76. $addico = $ctag2->GetAtt('addico');
  77. }
  78. else {
  79. $addico = 'images/gtk-sadd.png';
  80. }
  81. //an add icos , small items use att ischannel='1' addico='ico' addalt='msg' linkadd=''
  82. $link = " <div class='items'>
  83. <div class='fllct'>$link</div>\r\n
  84. <div class='flrct'>
  85. <a href='".$ctag2->GetAtt('linkadd')."' target='".$ctag2->GetAtt('target')."'><img src='$addico' alt='$addalt' title='$addalt'/></a>
  86. </div>
  87. </div>\r\n";
  88. }
  89. else
  90. {
  91. $link .= "\r\n";
  92. }
  93. $itemtmp = str_replace('~link~',$link,$itemTemplet);
  94. echo $itemtmp;
  95. }
  96. }
  97. echo $footTemplet;
  98. echo "<!-- Item ".($m+1)." End -->\r\n";
  99. }
  100. }
  101. }
  102. //End Function