mirror of
https://github.com/e107inc/e107.git
synced 2025-07-29 19:00:26 +02:00
content: sql optimization
This commit is contained in:
@@ -12,8 +12,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/content/content.php,v $
|
||||
| $Revision: 1.15 $
|
||||
| $Date: 2007-04-17 21:06:06 $
|
||||
| $Revision: 1.16 $
|
||||
| $Date: 2007-04-18 20:31:16 $
|
||||
| $Author: lisa_ $
|
||||
+---------------------------------------------------------------+
|
||||
*/
|
||||
@@ -745,7 +745,7 @@ function show_content_cat($mode=""){
|
||||
$textparent = $aa->getCrumbPage("cat", $array, $mainparent).$textparent;
|
||||
if( varsettrue($textparent) ){ $ns -> tablerender($caption, $textparent); }
|
||||
|
||||
if($resultitem = $sql -> db_Select($plugintable, "*", $qry )){
|
||||
if($resultitem = $sql -> db_Select($plugintable, "content_heading, content_rate, content_comment", $qry )){
|
||||
$row = $sql -> db_Fetch();
|
||||
if($row['content_comment']){
|
||||
$cachestr = "comment.$plugintable.$qs[1]";
|
||||
|
@@ -21,7 +21,7 @@ if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
//get main parent types
|
||||
$sqlm = new db;
|
||||
if(!$mainparents = $sqlm -> db_Select("pcontent", "*", "content_class REGEXP '".e_CLASS_REGEXP."' AND content_parent = '0' ".$datequery." ".$headingquery." ORDER BY content_heading")){
|
||||
if(!$mainparents = $sqlm -> db_Select("pcontent", "content_id, content_heading", "content_class REGEXP '".e_CLASS_REGEXP."' AND content_parent = '0' ".$datequery." ".$headingquery." ORDER BY content_heading")){
|
||||
$LIST_DATA = "no valid content category";
|
||||
}else{
|
||||
while($rowm = $sqlm -> db_Fetch()){
|
||||
@@ -57,7 +57,7 @@ if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
//get recent content for each main parent
|
||||
$sqli = new db;
|
||||
if(!$resultitem = $sqli -> db_Select("pcontent", "*", $qry)){
|
||||
if(!$resultitem = $sqli -> db_Select("pcontent", "content_id, content_heading, content_parent, content_datestamp, content_icon, content_author", $qry)){
|
||||
$LIST_DATA = "no items in ".$rowm['content_heading'];
|
||||
}else{
|
||||
$LIST_DISPLAYSTYLE = ($arr[2] ? "" : "none");
|
||||
|
@@ -12,8 +12,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/content/handlers/content_class.php,v $
|
||||
| $Revision: 1.19 $
|
||||
| $Date: 2007-04-17 21:06:06 $
|
||||
| $Revision: 1.20 $
|
||||
| $Date: 2007-04-18 20:31:17 $
|
||||
| $Author: lisa_ $
|
||||
+---------------------------------------------------------------+
|
||||
*/
|
||||
@@ -1487,7 +1487,7 @@ class content{
|
||||
$data .= " }\n";
|
||||
$data .= " \$checkid = substr(\$checkid,0,-3);\n";
|
||||
$data .= " if(!is_object(\$sql)){ \$sql = new db; }\n";
|
||||
$data .= " if(\$sql -> db_Select(\$plugintable, \"*\", \" \".\$checkid.\" ORDER BY SUBSTRING_INDEX(content_order, '.', 1)+0 \")){\n";
|
||||
$data .= " if(\$sql -> db_Select(\$plugintable, \"content_id, content_heading, content_icon\", \" \".\$checkid.\" ORDER BY SUBSTRING_INDEX(content_order, '.', 1)+0 \")){\n";
|
||||
$data .= " \$CMT_CATEGORY .= \$tp->parseTemplate(\$CONTENT_MENU_CATEGORY_START,TRUE,\$content_shortcodes);\n";
|
||||
$data .= " while(\$row = \$sql -> db_Fetch()){\n";
|
||||
$data .= " \$CMT_CATEGORY .= \$tp->parseTemplate(\$CONTENT_MENU_CATEGORY_TABLE,TRUE,\$content_shortcodes);\n";
|
||||
@@ -1504,7 +1504,7 @@ class content{
|
||||
$data .= " \$validparent = implode(\",\", array_keys(\$array));\n";
|
||||
$data .= " \$qry = \" content_parent REGEXP '\".\$aa -> CONTENTREGEXP(\$validparent).\"' \";\n";
|
||||
$data .= "\n";
|
||||
$data .= " if(\$resultitem = \$sql -> db_Select(\$plugintable, \"*\", \"content_refer !='sa' AND \".\$qry.\" \".\$datequery.\" AND content_class REGEXP '\".e_CLASS_REGEXP.\"' ORDER BY content_datestamp DESC LIMIT 0,\".\$content_pref[\"content_menu_recent_number\"] )){\n";
|
||||
$data .= " if(\$resultitem = \$sql -> db_Select(\$plugintable, \"content_id, content_heading, content_subheading, content_author, content_icon, content_datestamp\", \"content_refer !='sa' AND \".\$qry.\" \".\$datequery.\" AND content_class REGEXP '\".e_CLASS_REGEXP.\"' ORDER BY content_datestamp DESC LIMIT 0,\".\$content_pref[\"content_menu_recent_number\"] )){\n";
|
||||
$data .= "\n";
|
||||
$data .= " \$CMT_RECENT .= \$tp->parseTemplate(\$CONTENT_MENU_RECENT_START,TRUE,\$content_shortcodes);\n";
|
||||
$data .= " while(\$row = \$sql -> db_Fetch()){\n";
|
||||
|
@@ -12,8 +12,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/content/handlers/content_form_class.php,v $
|
||||
| $Revision: 1.13 $
|
||||
| $Date: 2007-04-17 21:06:06 $
|
||||
| $Revision: 1.14 $
|
||||
| $Date: 2007-04-18 20:31:17 $
|
||||
| $Author: lisa_ $
|
||||
+---------------------------------------------------------------+
|
||||
*/
|
||||
@@ -248,7 +248,7 @@ class contentform{
|
||||
//if inherit is used in the manager, we need to get the preferences from the core plugin table default preferences
|
||||
//and use those preferences in the permissions check.
|
||||
if( varsettrue($manager_pref['content_manager_inherit']) ){
|
||||
$sql -> db_Select("core", "*", "e107_name='$plugintable' ");
|
||||
$sql -> db_Select("core", "e107_value", "e107_name='$plugintable' ");
|
||||
$row = $sql -> db_Fetch();
|
||||
$manager_pref = $eArrayStorage->ReadArray($row['e107_value']);
|
||||
}
|
||||
@@ -270,7 +270,7 @@ class contentform{
|
||||
//if inherit is used in the manager, we need to get the preferences from the core plugin table default preferences
|
||||
//and use those preferences in the permissions check.
|
||||
if( varsettrue($manager_pref['content_manager_inherit']) ){
|
||||
$sql -> db_Select("core", "*", "e107_name='$plugintable' ");
|
||||
$sql -> db_Select("core", "e107_value", "e107_name='$plugintable' ");
|
||||
$row = $sql -> db_Fetch();
|
||||
$manager_pref = $eArrayStorage->ReadArray($row['e107_value']);
|
||||
}
|
||||
@@ -889,7 +889,7 @@ class contentform{
|
||||
//if inherit is used in the manager, we need to get the preferences from the core plugin table default preferences
|
||||
//and use those preferences in the permissions check.
|
||||
if( varsettrue($curpref['content_manager_inherit']) ){
|
||||
$sql2 -> db_Select("core", "*", "e107_name='$plugintable' ");
|
||||
$sql2 -> db_Select("core", "e107_value", "e107_name='$plugintable' ");
|
||||
$row2 = $sql2 -> db_Fetch();
|
||||
$curpref = $eArrayStorage->ReadArray($row2['e107_value']);
|
||||
}
|
||||
@@ -1018,7 +1018,7 @@ class contentform{
|
||||
//if inherit is used in the manager, we need to get the preferences from the core plugin table default preferences
|
||||
//and use those preferences in the permissions check.
|
||||
if( varsettrue($content_pref['content_manager_inherit']) ){
|
||||
$sql -> db_Select("core", "*", "e107_name='$plugintable' ");
|
||||
$sql -> db_Select("core", "e107_value", "e107_name='$plugintable' ");
|
||||
$row = $sql -> db_Fetch();
|
||||
$content_pref = $eArrayStorage->ReadArray($row['e107_value']);
|
||||
}
|
||||
@@ -1078,7 +1078,7 @@ class contentform{
|
||||
|
||||
if(!is_object($sql)){ $sql = new db; }
|
||||
foreach($array as $catid){
|
||||
if(!$category_total = $sql -> db_Select($plugintable, "*", "content_id='".intval($catid)."' ")){
|
||||
if(!$category_total = $sql -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_parent, content_icon, content_author", "content_id='".intval($catid)."' ")){
|
||||
$text .= "<div style='text-align:center;'>".CONTENT_ADMIN_CAT_LAN_9."</div>";
|
||||
}else{
|
||||
$row = $sql -> db_Fetch();
|
||||
@@ -1112,7 +1112,7 @@ class contentform{
|
||||
|
||||
if(!is_object($sql)){ $sql = new db; }
|
||||
foreach($array as $catid){
|
||||
if($category_total = $sql -> db_Select($plugintable, "*", "content_id='".intval($catid)."' ")){
|
||||
if($category_total = $sql -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_parent, content_icon, content_author", "content_id='".intval($catid)."' ")){
|
||||
$row = $sql -> db_Fetch();
|
||||
$content_pref = $aa -> getContentPref($catid, true);
|
||||
$CONTENT_ADMIN_SPACER = ($row['content_parent']==0 ? TRUE : FALSE);
|
||||
@@ -1533,7 +1533,7 @@ class contentform{
|
||||
//if inherit is used in the manager, we need to get the preferences from the core plugin table default preferences
|
||||
//and use those preferences in the permissions check.
|
||||
if( varsettrue($content_pref['content_manager_inherit']) ){
|
||||
$sql2 -> db_Select("core", "*", "e107_name='$plugintable' ");
|
||||
$sql2 -> db_Select("core", "e107_value", "e107_name='$plugintable' ");
|
||||
$row2 = $sql2 -> db_Fetch();
|
||||
$content_pref = $eArrayStorage->ReadArray($row2['e107_value']);
|
||||
}
|
||||
@@ -1576,7 +1576,7 @@ class contentform{
|
||||
|
||||
if(!is_object($sql)){ $sql = new db; }
|
||||
foreach($array as $catid){
|
||||
if(!$category_total = $sql -> db_Select($plugintable, "*", "content_id='".intval($catid)."' ")){
|
||||
if(!$category_total = $sql -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_parent, content_icon, content_author, content_order", "content_id='".intval($catid)."' ")){
|
||||
$text .= "<div style='text-align:center;'>".CONTENT_ADMIN_CAT_LAN_9."</div>";
|
||||
}else{
|
||||
$row = $sql -> db_Fetch();
|
||||
@@ -1712,7 +1712,7 @@ class contentform{
|
||||
|
||||
$content_pref = $aa -> getContentPref(0, true);
|
||||
|
||||
if($category_total = $sql2 -> db_Select($plugintable, "*", "content_parent='0' ")){
|
||||
if($category_total = $sql2 -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_icon, content_author", "content_parent='0' ")){
|
||||
while($row = $sql2 -> db_Fetch()){
|
||||
$content_pref = $aa -> getContentPref($row['content_id'], true);
|
||||
$text .= $tp -> parseTemplate($CONTENT_ADMIN_OPTIONS_TABLE, FALSE, $content_shortcodes);
|
||||
|
Reference in New Issue
Block a user