示例#1
0
function pAppendSites($parentId, $viewall, $sublevel, &$aItems)
{
    global $opt;
    $rs = sql("SELECT `sys_menu`.`id`, \r\n\t                  IF(`sys_menu`.`title`='', \r\n\t                     IFNULL(`ttMenu`.`text`, `sys_menu`.`menustring`), \r\n\t                     IFNULL(`ttTitle`.`text`, `sys_menu`.`title`)) AS `name`, \r\n\t                  `sys_menu`.`href`, \r\n\t                  `sys_menu`.`sitemap` \r\n\t             FROM `sys_menu` \r\n\t        LEFT JOIN `sys_trans` AS `tTitle` ON `sys_menu`.`title_trans_id`=`tTitle`.`id` AND `sys_menu`.`title`=`tTitle`.`text` \r\n\t        LEFT JOIN `sys_trans_text` AS ttTitle ON `tTitle`.`id`=`ttTitle`.`trans_id` AND `ttTitle`.`lang`='&2' \r\n\t        LEFT JOIN `sys_trans` AS `tMenu` ON `sys_menu`.`menustring_trans_id`=`tMenu`.`id` AND `sys_menu`.`menustring`=`tMenu`.`text` \r\n\t        LEFT JOIN `sys_trans_text` AS `ttMenu` ON `tMenu`.`id`=`ttMenu`.`trans_id` AND `ttMenu`.`lang`='&2' \r\n\t            WHERE `sys_menu`.`access`=0 AND `sys_menu`.`parent`='&1' AND (&3=1 OR `sys_menu`.`sitemap`=1)\r\n\t         ORDER BY `sys_menu`.`parent` ASC, `sys_menu`.`position` ASC", $parentId, $opt['template']['locale'], $viewall ? 1 : 0);
    while ($r = sql_fetch_assoc($rs)) {
        $r['sublevel'] = $sublevel;
        $aItems[] = $r;
        pAppendSites($r['id'], $viewall, $sublevel + 1, &$aItems);
    }
    sql_free_result($rs);
}
示例#2
0
function pAppendSites($parentId, $viewall, $sublevel, &$aItems)
{
    global $opt;
    $rs = sql("SELECT `sys_menu`.`id`, \n\t                  IF(`sys_menu`.`title`='', \n\t                     IFNULL(`ttMenu`.`text`, `sys_menu`.`menustring`), \n\t                     IFNULL(`ttTitle`.`text`, `sys_menu`.`title`)) AS `name`, \n\t                  IF(SUBSTR(`sys_menu`.`href`,1,1)='!', SUBSTR(`sys_menu`.`href`,2), `sys_menu`.`href`) AS `href`,\n\t                  SUBSTR(`sys_menu`.`href`,1,1)='!' AS `blanktarget`,\n\t                  `sys_menu`.`sitemap` \n\t             FROM `sys_menu` \n\t        LEFT JOIN `sys_trans` AS `tTitle` ON `sys_menu`.`title_trans_id`=`tTitle`.`id` AND `sys_menu`.`title`=`tTitle`.`text` \n\t        LEFT JOIN `sys_trans_text` AS ttTitle ON `tTitle`.`id`=`ttTitle`.`trans_id` AND `ttTitle`.`lang`='&2' \n\t        LEFT JOIN `sys_trans` AS `tMenu` ON `sys_menu`.`menustring_trans_id`=`tMenu`.`id` AND `sys_menu`.`menustring`=`tMenu`.`text` \n\t        LEFT JOIN `sys_trans_text` AS `ttMenu` ON `tMenu`.`id`=`ttMenu`.`trans_id` AND `ttMenu`.`lang`='&2' \n\t            WHERE `sys_menu`.`access`=0 AND `sys_menu`.`parent`='&1' AND (&3=1 OR `sys_menu`.`sitemap`=1)\n\t         ORDER BY `sys_menu`.`parent` ASC, `sys_menu`.`position` ASC", $parentId, $opt['template']['locale'], $viewall ? 1 : 0);
    while ($r = sql_fetch_assoc($rs)) {
        $r['sublevel'] = $sublevel;
        $aItems[] = $r;
        /*
         * pAppendSites($r['id'], $viewall, $sublevel+1, &$aItems);
         *  
         * http://www.php.net/manual/en/language.references.pass.php
         * As of PHP 5.3.0, you will get a warning saying that "call-time pass-by-reference" is deprecated when you use & in foo(&$a);.
         * And as of PHP 5.4.0, call-time pass-by-reference was removed, so using it will raise a fatal error.
         * 
         */
        pAppendSites($r['id'], $viewall, $sublevel + 1, $aItems);
    }
    sql_free_result($rs);
}