[ Index ] |
|
Code source de e107 0.7.8 |
1 <?php 2 3 if (!defined('e107_INIT')) { exit; } 4 5 if(!$content_install = $sql -> db_Select("plugin", "*", "plugin_path = 'content' AND plugin_installflag = '1' ")){ 6 return; 7 } 8 9 require_once(e_PLUGIN."content/handlers/content_class.php"); 10 $aa = new content; 11 12 $datequery = " AND content_datestamp < ".time()." AND (content_enddate=0 || content_enddate>".time().") "; 13 14 global $contentmode; 15 //contentmode : content_144 (content_ + idvalue) 16 if($contentmode){ 17 $headingquery = " AND content_id = '".substr($contentmode,8)."' "; 18 }else{ 19 $headingquery = ""; 20 } 21 22 //get main parent types 23 $sqlm = new db; 24 if(!$mainparents = $sqlm -> db_Select("pcontent", "*", "content_class REGEXP '".e_CLASS_REGEXP."' AND content_parent = '0' ".$datequery." ".$headingquery." ORDER BY content_heading")){ 25 $LIST_DATA = "no valid content category"; 26 }else{ 27 while($rowm = $sqlm -> db_Fetch()){ 28 $ICON = ""; 29 $HEADING = ""; 30 $AUTHOR = ""; 31 $CATEGORY = ""; 32 $DATE = ""; 33 $INFO = ""; 34 $LIST_CAPTION = $rowm['content_heading']; 35 36 //global var for this main parent 37 $mainparent = $rowm['content_id']; 38 39 //get path variables 40 $content_recent_pref = $aa -> getContentPref($mainparent); 41 $content_recent_pref["content_icon_path"] = ($content_recent_pref["content_icon_path"] ? $content_recent_pref["content_icon_path"] : "{e_PLUGIN}content/images/icon/" ); 42 $content_icon_path = $tp -> replaceConstants($content_recent_pref["content_icon_path"]); 43 44 //prepare query string 45 $array = $aa -> getCategoryTree("", $mainparent, TRUE); 46 $validparent = implode(",", array_keys($array)); 47 $qry = " content_refer !='sa' AND content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' AND content_class REGEXP '".e_CLASS_REGEXP."' "; 48 49 //check so only the preferences from the correct content_type (article, content, review etc) are used and rendered 50 if(substr($contentmode,8) == $rowm['content_id']){ 51 52 if($mode == "new_page" || $mode == "new_menu" ){ 53 $lvisit = $this -> getlvisit(); 54 $qry = $qry." AND content_datestamp>".$lvisit; 55 }else{ 56 $qry = $qry." ".$datequery; 57 } 58 $qry .= " ORDER BY content_datestamp DESC LIMIT 0,".intval($arr[7]); 59 60 //get recent content for each main parent 61 $sqli = new db; 62 if(!$resultitem = $sqli -> db_Select("pcontent", "*", $qry)){ 63 $LIST_DATA = "no items in ".$rowm['content_heading']; 64 }else{ 65 $LIST_DISPLAYSTYLE = ($arr[2] ? "" : "none"); 66 67 while($rowi = $sqli -> db_Fetch()){ 68 $rowheading = $this -> parse_heading($rowi['content_heading'], $mode); 69 $HEADING = "<a href='".e_PLUGIN."content/content.php?content.".$rowi['content_id']."' title='".$rowi['content_heading']."'>".$rowheading."</a>"; 70 //category 71 if($arr[4]){ 72 $crumb = ""; 73 if(array_key_exists($rowi['content_parent'], $array)){ 74 $newarr = $array[$rowi['content_parent']]; 75 $newarr = array_reverse($newarr); 76 $CATEGORY = "<a href='".e_PLUGIN."content/content.php?cat.".$newarr[1]."'>".$newarr[0]."</a>"; 77 } 78 } 79 80 $DATE = ($arr[5] ? $this -> getListDate($rowi['content_datestamp'], $mode) : ""); 81 //$ICON = $this -> getBullet($arr[6], $mode); 82 83 $image_link_append = "<a href='".e_PLUGIN."content/content.php?content.".$rowi['content_id']."'>"; 84 if($rowi['content_icon'] && file_exists(e_PLUGIN."content/images/icon/".$rowi['content_icon'])){ 85 $ICON = $image_link_append."<img src='".e_PLUGIN."content/images/icon/".$rowi['content_icon']."' style='width:50px; border:1px solid #000;' alt='' /></a>"; 86 }else{ 87 $ICON = ""; 88 } 89 90 //get author details 91 if($arr[3]){ 92 $authordetails = $aa -> getAuthor($rowi['content_author']); 93 if(USER && is_numeric($authordetails[0]) && $authordetails[0] != "0"){ 94 $AUTHOR = "<a href='".e_BASE."user.php?id.".$authordetails[0]."' >".$authordetails[1]."</a>"; 95 }else{ 96 $AUTHOR = $authordetails[1]; 97 } 98 }else{ 99 $AUTHOR = ""; 100 } 101 $INFO = ""; 102 103 $LIST_DATA[$mode][] = array( $ICON, $HEADING, $AUTHOR, $CATEGORY, $DATE, $INFO ); 104 } 105 } 106 } 107 } 108 } 109 110 111 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Apr 1 01:23:32 2007 | par Balluche grâce à PHPXref 0.7 |