| [ Index ] | PHP Cross Reference of Mambo 4.6.5 |
|
| [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Mambo 4 * @author Mambo Foundation Inc see README.php 5 * @copyright (C) 2000 - 2009 Mambo Foundation Inc. 6 * See COPYRIGHT.php for copyright notices and details. 7 * @license GNU/GPL Version 2, see LICENSE.php 8 * 9 * Redistributions of files must retain the above copyright notice. 10 * 11 * Mambo is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU General Public License 13 * as published by the Free Software Foundation; version 2 of the License. 14 */ 15 16 /** ensure this file is being included by a parent file */ 17 defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); 18 19 function getcatids($field, $table, $gid, $db, $_dbprefix){ 20 21 //Get all Story Topics 22 $resultC = mysql_db_query ($db, "SELECT $field FROM ".$_dbprefix."$table WHERE published=1") or $mysql_eval_err = mysql_error(); 23 if ($mysql_eval_err<>'') { 24 return ''; 25 } 26 $c = 0; 27 while ($rowC = mysql_fetch_object($resultC)){ 28 $topic[$c] = $rowC->$field; 29 $c++; 30 } 31 32 //Build CatID query 33 $accquery="("; 34 for ($a=0; $a<count($topic); $a++){ 35 $pos = strrpos($accquery, $topic[$a]); 36 if ($pos === false) { 37 $accquery = $accquery."id=".$topic[$a]." OR "; 38 } 39 } 40 41 //Strip off the final OR 42 if (strlen($accquery)>4) { 43 $accquery = substr($accquery,0,(strlen($accquery)-4)); 44 } 45 $accquery=$accquery.")"; 46 47 //Get all CatIDs 48 $resultD = mysql_db_query ($db, "SELECT id FROM ".$_dbprefix."categories WHERE (access<='$gid' AND published=1 AND ".$accquery.")") or $mysql_eval_err = mysql_error(); 49 if ($mysql_eval_err<>'') { 50 return ''; 51 } 52 $d = 0; 53 while ($rowD = mysql_fetch_object($resultD)){ 54 $cid[$d] = $rowD->id; 55 $d++; 56 } 57 58 //Build TopicID query 59 $topquery="("; 60 for ($a=0; $a<count($cid); $a++){ 61 $pos = strrpos($topquery, $cid[$a]); 62 if ($pos === false) { 63 $topquery = $topquery.$field."=".$cid[$a]." OR "; 64 } 65 } 66 67 //Strip off the final OR 68 if (strlen($topquery)>4) { 69 $topquery = substr($topquery,0,(strlen($topquery)-4)); 70 $topquery = "AND ".$topquery.")"; 71 } else { 72 $topquery = ""; 73 } 74 75 76 return $topquery; 77 } 78 79 80 function getmenuids($field, $table, $gid, $db, $_dbprefix){ 81 82 //Get all Story Topics 83 $resultC = mysql_db_query ($db, "SELECT $field FROM ".$_dbprefix."$table WHERE published=1") or $mysql_eval_err = mysql_error(); 84 if ($mysql_eval_err<>'') { 85 return ''; 86 } 87 $c = 0; 88 while ($rowC = mysql_fetch_object($resultC)){ 89 $topic[$c] = $rowC->$field; 90 $c++; 91 } 92 93 //Build MenuID query 94 $accquery="("; 95 for ($a=0; $a<count($topic); $a++){ 96 $pos = strpos($accquery, $topic[$a]); 97 if ($pos === false) { 98 $accquery = $accquery."id=".$topic[$a]." OR "; 99 } 100 } 101 //Strip off the final OR 102 if (strlen($accquery)>4) { 103 $accquery = substr($accquery,0,(strlen($accquery)-4)); 104 } 105 $accquery=$accquery.")"; 106 107 //Get all MenuIDs 108 $resultD = mysql_db_query ($db, "SELECT id FROM ".$_dbprefix."menu WHERE (access<='$gid' AND published=1 AND ".$accquery.")") or $mysql_eval_err = mysql_error(); 109 if ($mysql_eval_err<>'') { 110 return ''; 111 } 112 $d = 0; 113 while ($rowD = mysql_fetch_object($resultD)){ 114 $cid[$d] = $rowD->id; 115 $d++; 116 } 117 118 //Build MenuContentID query 119 $topquery="("; 120 for ($a=0; $a<count($cid); $a++){ 121 $pos = strpos($topquery, $cid[$a]); 122 if ($pos === false) { 123 $topquery = $topquery."menuid"."=".$cid[$a]." OR "; 124 } 125 } 126 127 //Strip off the final OR 128 if (strlen($topquery)>4) { 129 $topquery = substr($topquery,0,(strlen($topquery)-4)); 130 $topquery = "AND ".$topquery.")"; 131 } else { 132 $topquery = ""; 133 } 134 135 return $topquery; 136 } 137 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Feb 8 00:05:01 2012 | Cross-referenced by PHPXref 0.7 |
| Mambo API: Mambo is Free software released under the GNU/General Public License, Version 2 |