mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 12:48:26 +02:00
sitelinks handler - php warnings
This commit is contained in:
@@ -8,10 +8,8 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/sitelinks_class.php,v $
|
* $URL$
|
||||||
* $Revision$
|
* $Id$
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT')) { exit; }
|
||||||
@@ -24,14 +22,14 @@ class sitelinks
|
|||||||
var $eLinkList = array();
|
var $eLinkList = array();
|
||||||
|
|
||||||
function getlinks($cat=1)
|
function getlinks($cat=1)
|
||||||
{
|
{
|
||||||
$this->eLinkList = array(); // clear the array in case getlinks is called 2x on the same page.
|
$this->eLinkList = array(); // clear the array in case getlinks is called 2x on the same page.
|
||||||
|
|
||||||
$sql = e107::getDb('sqlSiteLinks');
|
$sql = e107::getDb('sqlSiteLinks');
|
||||||
|
|
||||||
$query = "SELECT * FROM #links WHERE link_category = ".intval($cat)." and link_class IN (".USERCLASS_LIST.") ORDER BY link_order ASC";
|
$query = "SELECT * FROM #links WHERE link_category = ".intval($cat)." and link_class IN (".USERCLASS_LIST.") ORDER BY link_order ASC";
|
||||||
if($sql->db_Select_gen($query))
|
if($sql->db_Select_gen($query))
|
||||||
{
|
{
|
||||||
while ($row = $sql->db_Fetch())
|
while ($row = $sql->db_Fetch())
|
||||||
{
|
{
|
||||||
// if (substr($row['link_name'], 0, 8) == 'submenu.'){
|
// if (substr($row['link_name'], 0, 8) == 'submenu.'){
|
||||||
@@ -40,43 +38,43 @@ class sitelinks
|
|||||||
if (isset($row['link_parent']) && $row['link_parent'] != 0)
|
if (isset($row['link_parent']) && $row['link_parent'] != 0)
|
||||||
{
|
{
|
||||||
$this->eLinkList['sub_'.$row['link_parent']][]=$row;
|
$this->eLinkList['sub_'.$row['link_parent']][]=$row;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->eLinkList['head_menu'][] = $row;
|
$this->eLinkList['head_menu'][] = $row;
|
||||||
if(vartrue($row['link_function']))
|
if(vartrue($row['link_function']))
|
||||||
{
|
{
|
||||||
list($path,$method) = explode("::",$row['link_function']);
|
list($path,$method) = explode("::",$row['link_function']);
|
||||||
if(include_once(e_PLUGIN.$path."/e_sitelink.php"))
|
if(include_once(e_PLUGIN.$path."/e_sitelink.php"))
|
||||||
{
|
{
|
||||||
$class = $path."_sitelinks";
|
$class = $path."_sitelinks";
|
||||||
$sublinkArray = e107::callMethod($class,$method); //TODO Cache it.
|
$sublinkArray = e107::callMethod($class,$method); //TODO Cache it.
|
||||||
if(vartrue($sublinkArray))
|
if(vartrue($sublinkArray))
|
||||||
{
|
{
|
||||||
$this->eLinkList['sub_'.$row['link_id']] = $sublinkArray;
|
$this->eLinkList['sub_'.$row['link_id']] = $sublinkArray;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLinkArray()
|
function getLinkArray()
|
||||||
{
|
{
|
||||||
return $this->eLinkList;
|
return $this->eLinkList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function get($cat=1, $style='', $css_class = false)
|
function get($cat=1, $style='', $css_class = false)
|
||||||
{
|
{
|
||||||
global $pref, $ns, $e107cache, $linkstyle;
|
global $pref, $ns, $e107cache, $linkstyle;
|
||||||
$usecache = ((trim(defset('LINKSTART_HILITE')) != "" || trim(defset('LINKCLASS_HILITE')) != "") ? false : true);
|
$usecache = ((trim(defset('LINKSTART_HILITE')) != "" || trim(defset('LINKCLASS_HILITE')) != "") ? false : true);
|
||||||
|
|
||||||
if ($usecache && !strpos(e_SELF, e_ADMIN) && ($data = $e107cache->retrieve('sitelinks_'.$cat.md5($linkstyle.e_PAGE.e_QUERY))))
|
if ($usecache && !strpos(e_SELF, e_ADMIN) && ($data = $e107cache->retrieve('sitelinks_'.$cat.md5($linkstyle.e_PAGE.e_QUERY))))
|
||||||
{
|
{
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
@@ -128,6 +126,12 @@ class sitelinks
|
|||||||
|
|
||||||
$text = "\n\n\n<!-- Sitelinks ($cat) -->\n\n\n".$style['prelink'];
|
$text = "\n\n\n<!-- Sitelinks ($cat) -->\n\n\n".$style['prelink'];
|
||||||
|
|
||||||
|
// php warnings
|
||||||
|
if(!vartrue($this->eLinkList['head_menu']))
|
||||||
|
{
|
||||||
|
$this->eLinkList['head_menu'] = array();
|
||||||
|
}
|
||||||
|
|
||||||
if ($style['linkdisplay'] != 3) {
|
if ($style['linkdisplay'] != 3) {
|
||||||
foreach ($this->eLinkList['head_menu'] as $key => $link){
|
foreach ($this->eLinkList['head_menu'] as $key => $link){
|
||||||
$main_linkid = "sub_".$link['link_id'];
|
$main_linkid = "sub_".$link['link_id'];
|
||||||
@@ -207,7 +211,7 @@ class sitelinks
|
|||||||
// Start with an empty link
|
// Start with an empty link
|
||||||
$linkstart = $indent = $linkadd = $screentip = $href = $link_append = '';
|
$linkstart = $indent = $linkadd = $screentip = $href = $link_append = '';
|
||||||
$highlighted = FALSE;
|
$highlighted = FALSE;
|
||||||
|
|
||||||
// If submenu: Fix Name, Add Indentation.
|
// If submenu: Fix Name, Add Indentation.
|
||||||
if ($submenu == TRUE) {
|
if ($submenu == TRUE) {
|
||||||
if(substr($linkInfo['link_name'],0,8) == "submenu."){
|
if(substr($linkInfo['link_name'],0,8) == "submenu."){
|
||||||
@@ -237,7 +241,7 @@ class sitelinks
|
|||||||
if (isset($linkInfo['link_expand']) && $linkInfo['link_expand'])
|
if (isset($linkInfo['link_expand']) && $linkInfo['link_expand'])
|
||||||
{
|
{
|
||||||
$href = " href=\"javascript:expandit('sub_".$linkInfo['link_id']."')\"";
|
$href = " href=\"javascript:expandit('sub_".$linkInfo['link_id']."')\"";
|
||||||
}
|
}
|
||||||
elseif ($linkInfo['link_url'])
|
elseif ($linkInfo['link_url'])
|
||||||
{
|
{
|
||||||
// Only add the e_BASE if it actually has an URL.
|
// Only add the e_BASE if it actually has an URL.
|
||||||
@@ -257,8 +261,8 @@ class sitelinks
|
|||||||
{
|
{
|
||||||
$dimen = ($linkInfo['link_open'] == 4) ? "600,400" : "800,600";
|
$dimen = ($linkInfo['link_open'] == 4) ? "600,400" : "800,600";
|
||||||
$href = " href=\"javascript:open_window('".$linkInfo['link_url']."',{$dimen})\"";
|
$href = " href=\"javascript:open_window('".$linkInfo['link_url']."',{$dimen})\"";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$href = " href='".$linkInfo['link_url']."'";
|
$href = " href='".$linkInfo['link_url']."'";
|
||||||
}
|
}
|
||||||
@@ -292,9 +296,9 @@ class sitelinks
|
|||||||
}
|
}
|
||||||
|
|
||||||
$_link = $linkstart.$indent.$_link;
|
$_link = $linkstart.$indent.$_link;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
global $SITELINKSTYLE;
|
global $SITELINKSTYLE;
|
||||||
if(!$SITELINKSTYLE)
|
if(!$SITELINKSTYLE)
|
||||||
{
|
{
|
||||||
@@ -333,7 +337,7 @@ function hilite($link,$enabled = FALSE)
|
|||||||
$link_slf = (isset($tmp[0])) ? $tmp[0] : '';
|
$link_slf = (isset($tmp[0])) ? $tmp[0] : '';
|
||||||
$link_pge = basename($link_slf);
|
$link_pge = basename($link_slf);
|
||||||
$link_match = (empty($tmp[0])) ? "": strpos(e_SELF,$tmp[0]); // e_SELF is the actual displayed page
|
$link_match = (empty($tmp[0])) ? "": strpos(e_SELF,$tmp[0]); // e_SELF is the actual displayed page
|
||||||
|
|
||||||
if(e_MENU == "debug" && getperms('0'))
|
if(e_MENU == "debug" && getperms('0'))
|
||||||
{
|
{
|
||||||
echo "<br />link= ".$link;
|
echo "<br />link= ".$link;
|
||||||
|
Reference in New Issue
Block a user