• 0
  • 0 RepliesReplies
  • 8152 ReadTimes Read
  • 0 PointsPoints

Topic: ayuda con tags

no avatar
Usuario: xpablo315x
Rango: Recién Llegado
Mensajes: 10
Points: 0
Perfil: View Profile
ayuda con tags
July 18, 2011 - 08:44 20:44
hola brothers bueno intale el tagged sytem en mi foro y no me dio ningun error al instalarlo, pero cuando me voy a la parte de arriba donde dice tags me muestra esto

Code: [Select]
Error en la Base de Datos
Invalid use of group function
Archivo: /home/public_html/ultimatezsex.com/Sources/Tags2.php
Línea: 118

y no me mostro ningun error en la instalacion adjunto mi tags2.php para ver si me ayudan muchas gracias
Show content
Code: [Select]
<?php

/*

Tagging System

Version 2.4.1

by:vbgamer45

http://www.smfhacks.com

*/



if (!defined(&#39;SMF&#39;))

die(&#39;Hacking attempt...&#39;);



function TagsMain()

{

// Load the main Tags template

loadtemplate(&#39;Tags2&#39;);



// Load the language files

if (loadlanguage(&#39;Tags&#39;) == false)

loadLanguage(&#39;Tags&#39;,&#39;english&#39;);



// Tags actions

$subActions = array(

&#39;suggest&#39; => &#39;SuggestTag&#39;,

&#39;suggest2&#39; => &#39;SuggestTag2&#39;,

&#39;addtag&#39; => &#39;AddTag&#39;,

&#39;addtag2&#39; => &#39;AddTag2&#39;,

&#39;deletetag&#39; => &#39;DeleteTag&#39;,

&#39;admin&#39; => &#39;TagsSettings&#39;,

&#39;admin2&#39; => &#39;TagsSettings2&#39;,

&#39;cleanup&#39; => &#39;TagCleanUp&#39;,

);





// Follow the sa or just go to main links index.

if (!empty($subActions[@$_GET[&#39;sa&#39;]]))

$subActions[$_GET[&#39;sa&#39;]]();

else

ViewTags();



}



function 
ViewTags()

{

global $context$txt$mbname$scripturl$user_info$smcFunc,  $modSettings;



// Views that tag results and popular tags

if (isset($_REQUEST[&#39;tagid&#39;]))

{

// Show the tag results for that tag

$id = (int) $_REQUEST[&#39;tagid&#39;];



// Find Tag Name

$dbresult $smcFunc[&#39;db_query&#39;](&#39;&#39;, "

SELECT

tag

FROM {db_prefix}tags

WHERE ID_TAG $id LIMIT 1");

$row = $smcFunc[&#39;db_fetch_assoc&#39;]($dbresult);

$smcFunc[&#39;db_free_result&#39;]($dbresult);



$context[&#39;tag_search&#39;] = $row[&#39;tag&#39;];

$context[&#39;page_title&#39;] = $mbname . &#39; - &#39; . $txt[&#39;smftags_resultsfor&#39;] . $context[&#39;tag_search&#39;];

$context[&#39;start&#39;] = (int) $_REQUEST[&#39;start&#39;];



$dbresult = $smcFunc[&#39;db_query&#39;](&#39;&#39;, "

SELECT count(*) as total 

FROM ({db_prefix}tags_log as l, {db_prefix}boards AS b, {db_prefix}topics as t, {db_prefix}messages as m)



WHERE l.ID_TAG $id AND b.ID_BOARD t.ID_BOARD AND l.ID_TOPIC t.id_topic  AND t.approved 

AND t.ID_FIRST_MSG m.ID_MSG AND " . $user_info[&#39;query_see_board&#39;] . " 

");

$totalRow = $smcFunc[&#39;db_fetch_assoc&#39;]($dbresult);

$numofrows = $totalRow[&#39;total&#39;];



// Find Results

$dbresult = $smcFunc[&#39;db_query&#39;](&#39;&#39;, "

SELECT t.num_replies,t.num_views,m.id_member,m.poster_name,m.subject,m.id_topic,m.poster_timet.ID_BOARD

FROM ({db_prefix}tags_log as l, {db_prefix}boards AS b, {db_prefix}topics as t, {db_prefix}messages as m)



WHERE l.ID_TAG $id AND b.ID_BOARD t.ID_BOARD AND l.ID_TOPIC t.id_topic  AND t.approved 

AND t.ID_FIRST_MSG m.ID_MSG AND " . $user_info[&#39;query_see_board&#39;] . " 

ORDER BY m.ID_MSG DESC LIMIT $context[start],25 ");



$context[&#39;tags_topics&#39;] = array();

while (
$row = $smcFunc[&#39;db_fetch_assoc&#39;]($dbresult))

{

$context[&#39;tags_topics&#39;][] = array(

&#39;id_member&#39; => 
$row[&#39;id_member&#39;],

&#39;poster_name&#39; => 
$row[&#39;poster_name&#39;],

&#39;subject&#39; => 
$row[&#39;subject&#39;],

&#39;id_topic&#39; => 
$row[&#39;id_topic&#39;],

&#39;poster_time&#39; => 
$row[&#39;poster_time&#39;],

&#39;num_views&#39; => 
$row[&#39;num_views&#39;],

&#39;num_replies&#39; => 
$row[&#39;num_replies&#39;],



);





}

$smcFunc[&#39;db_free_result&#39;]($dbresult);





$context[&#39;sub_template&#39;]  = &#39;results&#39;;



$context[&#39;page_index&#39;] = constructPageIndex($scripturl . &#39;?action=tags;tagid=&#39; . $id$_REQUEST[&#39;start&#39;], $numofrows, 25);



}

else

{

$context[&#39;page_title&#39;] = $mbname . &#39; - &#39; . $txt[&#39;smftags_popular&#39;];



// Tag cloud from http://www.prism-perfect.net/archive/php-tag-cloud-tutorial/

$result = $smcFunc[&#39;db_query&#39;](&#39;&#39;, "

SELECT 

t.tag AS tagl.ID_TAGCOUNT(l.ID_TAG) AS quantity

 FROM {db_prefix}tags as t, {db_prefix}tags_log as l WHERE t.ID_TAG l.ID_TAG

  GROUP BY l.ID_TAG

  ORDER BY COUNT(l.ID_TAGDESCRAND() LIMIT " .  $modSettings[&#39;smftags_set_cloud_tags_to_show&#39;]);



// here we loop through the results and put them into a simple array:

// 
$tag[&#39;thing1&#39;] = 12;

// 
$tag[&#39;thing2&#39;] = 25;

// etc. so we can use all the nifty array functions

// to calculate the font-size of each tag

$tags = array();



$tags2 = array();



while (
$row = $smcFunc[&#39;db_fetch_assoc&#39;]($result))

{

    
$tags[$row[&#39;tag&#39;]] = $row[&#39;quantity&#39;];

    
$tags2[$row[&#39;tag&#39;]] = $row[&#39;ID_TAG&#39;];

}



if (count(
$tags2) > 0)

{

// change these font sizes if you will

$max_size = $modSettings[&#39;smftags_set_cloud_max_font_size_precent&#39;]; // max font size in %

$min_size = $modSettings[&#39;smftags_set_cloud_min_font_size_precent&#39;]; // min font size in %



// get the largest and smallest array values

$max_qty = max(array_values($tags));

$min_qty = min(array_values($tags));



// find the range of values

$spread = $max_qty - $min_qty;

if (0 == 
$spread)

 { // we don&#39;t want to divide by zero

    
$spread = 1;

}



// determine the font-size increment

// this is the increase per tag quantity (times used)

$step = ($max_size - $min_size)/($spread);



// loop through our tag array

$context[&#39;poptags&#39;] = &#39;&#39;;

$row_count = 0;

foreach (
$tags as $key => $value)

{

$row_count++;

    // calculate CSS font-size

    // find the 
$value in excess of $min_qty

    // multiply by the font-size increment (
$size)

    // and add the 
$min_size set above

    
$size = $min_size + (($value - $min_qty) * $step);

    // uncomment if you want sizes in whole %:

    // 
$size = ceil($size);



    // you&#39;ll need to put the link destination in place of the #

    // (assuming your tag links to some sort of details page)

    
$context[&#39;poptags&#39;] .= &#39;<a href="&#39; . $scripturl . &#39;?action=tags;tagid=&#39; . $tags2[$key] . &#39;" style="font-size: &#39;.$size.&#39;%"&#39;;

    // perhaps adjust this title attribute for the things that are tagged

   $context[&#39;poptags&#39;] .= &#39; title="&#39;.$value.&#39; things tagged with &#39;.$key.&#39;"&#39;;

   $context[&#39;poptags&#39;] .= &#39;>&#39;.$key.&#39;</a> &#39;;

   if ($row_count > ($modSettings[&#39;smftags_set_cloud_tags_per_row&#39;]-1))

   {

    $context[&#39;poptags&#39;] .= &#39;<br />&#39;;

    $row_count =0;

   }

    // notice the space at the end of the link

}

}





// Find Results

$dbresult $smcFunc[&#39;db_query&#39;](&#39;&#39;, "

SELECT DISTINCT l.ID_TOPICt.num_replies,t.num_views,m.id_member,

m.poster_name,m.subject,m.id_topic,m.poster_time

t.id_boardg.tagg.ID_TAG 

 FROM ({db_prefix}tags_log as l, {db_prefix}boards AS b, {db_prefix}topics as t, {db_prefix}messages as m

  LEFT JOIN {db_prefix}tags AS g ON (l.ID_TAG g.ID_TAG)

 WHERE b.ID_BOARD t.id_board AND l.ID_TOPIC t.id_topic AND t.approved AND t.id_first_msg m.id_msg AND " . $user_info[&#39;query_see_board&#39;] . " ORDER BY l.ID DESC LIMIT 20");



$context[&#39;tags_topics&#39;] = array();

while (
$row = $smcFunc[&#39;db_fetch_assoc&#39;]($dbresult))

{

$context[&#39;tags_topics&#39;][] = array(

&#39;id_member&#39; => 
$row[&#39;id_member&#39;],

&#39;poster_name&#39; => 
$row[&#39;poster_name&#39;],

&#39;subject&#39; => 
$row[&#39;subject&#39;],

&#39;id_topic&#39; => 
$row[&#39;id_topic&#39;],

&#39;poster_time&#39; => 
$row[&#39;poster_time&#39;],

&#39;num_views&#39; => 
$row[&#39;num_views&#39;],

&#39;num_replies&#39; => 
$row[&#39;num_replies&#39;],

&#39;ID_TAG&#39; => 
$row[&#39;ID_TAG&#39;],

&#39;tag&#39; => 
$row[&#39;tag&#39;],



);

}

$smcFunc[&#39;db_free_result&#39;]($dbresult);





}





$context[&#39;linktree&#39;][] = array(

&#39;url&#39; => 
$scripturl . &#39;?action=tags&#39;,

&#39;name&#39; => 
$txt[&#39;smftags_menu&#39;]

);



}



function AddTag()

{

global 
$context$txt$mbname$user_info$smcFunc;



isAllowedTo(&#39;smftags_add&#39;);



// Get the Topic

$topic = (int) $_REQUEST[&#39;topic&#39;];



if (empty(
$topic))

fatal_error(
$txt[&#39;smftags_err_notopic&#39;],false);



// Check permission

$a_manage = allowedTo(&#39;smftags_manage&#39;);





$dbresult = $smcFunc[&#39;db_query&#39;](&#39;&#39;, "

SELECT 

m.ID_MEMBER 

FROM {db_prefix}topics as t, {db_prefix}messages as 

WHERE t.ID_FIRST_MSG m.ID_MSG AND t.ID_TOPIC $topic LIMIT 1");



$row = $smcFunc[&#39;db_fetch_assoc&#39;]($dbresult);

$smcFunc[&#39;db_free_result&#39;]($dbresult);



if (
$user_info[&#39;id&#39;] != $row[&#39;ID_MEMBER&#39;] && $a_manage == false)

fatal_error(
$txt[&#39;smftags_err_permaddtags&#39;],false);



$context[&#39;tags_topic&#39;] = $topic;



// Load the subtemplate

$context[&#39;sub_template&#39;]  = &#39;addtag&#39;;





$context[&#39;page_title&#39;] = $mbname . &#39; - &#39; . $txt[&#39;smftags_addtag2&#39;];



/*

require_once(
$sourcedir . &#39;/Subs-Editor.php&#39;);

// Get the sugget box done too.

$suggestOptions = array(

&#39;id&#39; => &#39;tag&#39;,

&#39;search_type&#39; => &#39;tags&#39;,

&#39;width&#39; => &#39;130px&#39;,

&#39;value&#39; => &#39;&#39;,

&#39;button&#39; => 
$txt[&#39;smftags_addtag2&#39;],



);

create_control_autosuggest(
$suggestOptions);

*/



}



function AddTag2()

{

global 
$txt$modSettings$smcFunc$user_info;



isAllowedTo(&#39;smftags_add&#39;);



$topic = (int) $_REQUEST[&#39;topic&#39;];



if (empty(
$topic))

fatal_error(
$txt[&#39;smftags_err_notopic&#39;],false);



// Check Permission

$a_manage = allowedTo(&#39;smftags_manage&#39;);



$dbresult = $smcFunc[&#39;db_query&#39;](&#39;&#39;, "

SELECT

m.ID_MEMBER

FROM {db_prefix}topics as t, {db_prefix}messages as 

WHERE t.ID_FIRST_MSG m.ID_MSG AND t.ID_TOPIC $topic LIMIT 1");



$row = $smcFunc[&#39;db_fetch_assoc&#39;]($dbresult);

$smcFunc[&#39;db_free_result&#39;]($dbresult);



if (
$user_info[&#39;id&#39;] != $row[&#39;ID_MEMBER&#39;] && $a_manage == false)

fatal_error(
$txt[&#39;smftags_err_permaddtags&#39;],false);





// Get how many tags there have been for the topic

$dbresult = $smcFunc[&#39;db_query&#39;](&#39;&#39;, "

SELECT

COUNT(*) as total

FROM {db_prefix}tags_log

WHERE ID_TOPIC " . $topic);



$row = $smcFunc[&#39;db_fetch_assoc&#39;]($dbresult);

$totaltags = $row[&#39;total&#39;];

$smcFunc[&#39;db_free_result&#39;]($dbresult);



if (
$totaltags >= $modSettings[&#39;smftags_set_maxtags&#39;])

fatal_error(
$txt[&#39;smftags_err_toomaxtag&#39;],false);



// Check Tag restrictions

$tag = htmlspecialchars(trim($_REQUEST[&#39;tag&#39;]),ENT_QUOTES);

$tag = strtolower($tag);



if (empty(
$tag))

fatal_error(
$txt[&#39;smftags_err_notag&#39;],false);



$tags = explode(&#39;,&#39;,htmlspecialchars($tag,ENT_QUOTES));







// Check min tag length

foreach(
$tags as $tag)

{

$tag = trim($tag);

if (strlen(
$tag) < $modSettings[&#39;smftags_set_mintaglength&#39;])

continue;

//fatal_error(
$txt[&#39;smftags_err_mintag&#39;] .  $modSettings[&#39;smftags_set_mintaglength&#39;],false);

// Check max tag length

if (strlen(
$tag) > $modSettings[&#39;smftags_set_maxtaglength&#39;])

continue;

//fatal_error(
$txt[&#39;smftags_err_maxtag&#39;] . $modSettings[&#39;smftags_set_maxtaglength&#39;],false);



// Insert The tag

$dbresult = $smcFunc[&#39;db_query&#39;](&#39;&#39;, "

SELECT 

ID_TAG 

FROM {db_prefix}tags 

WHERE tag = &#39;$tag&#39; LIMIT 1");



if ($smcFunc[&#39;db_affected_rows&#39;]() == 0)

{

// Insert into Tags table

$smcFunc[&#39;db_query&#39;](&#39;&#39;, "INSERT INTO {db_prefix}tags

(tagapproved)

VALUES (&#39;$tag&#39;,1)");

$ID_TAG $smcFunc[&#39;db_insert_id&#39;]("{db_prefix}tags",&#39;ID_TAG&#39;);



// Insert into Tags log

$smcFunc[&#39;db_query&#39;](&#39;&#39;, "INSERT INTO {db_prefix}tags_log

(ID_TAG,ID_TOPICID_MEMBER)

VALUES ($ID_TAG,$topic,$user_info[id])");

}

else

{

$row = $smcFunc[&#39;db_fetch_assoc&#39;]($dbresult);

$ID_TAG = $row[&#39;ID_TAG&#39;];

$dbresult2$smcFunc[&#39;db_query&#39;](&#39;&#39;, "

SELECT

ID

FROM {db_prefix}tags_log

WHERE ID_TAG  =  $ID_TAG  AND ID_TOPIC $topic");



if (
$smcFunc[&#39;db_affected_rows&#39;]() != 0)

{

continue;

//fatal_error(
$txt[&#39;smftags_err_alreadyexists&#39;],false);



}

$smcFunc[&#39;db_free_result&#39;]($dbresult2);



// Insert into Tags log

$smcFunc[&#39;db_query&#39;](&#39;&#39;, "INSERT INTO {db_prefix}tags_log

(ID_TAG,ID_TOPICID_MEMBER)

VALUES ($ID_TAG,$topic,$user_info[id])");





}

$smcFunc[&#39;db_free_result&#39;]($dbresult);

}



// Redirect back to the topic

redirectexit(&#39;topic=&#39; . 
$topic);

}



function DeleteTag()

{

global 
$txt$smcFunc$user_info;



isAllowedTo(&#39;smftags_del&#39;);



$id = (int) $_REQUEST[&#39;tagid&#39;];

// Check permission

$a_manage = allowedTo(&#39;smftags_manage&#39;);



$dbresult = $smcFunc[&#39;db_query&#39;](&#39;&#39;, "

SELECT

ID_MEMBERID_TOPICID_TAG

FROM {db_prefix}tags_log 

WHERE ID $id LIMIT 1");



$row = $smcFunc[&#39;db_fetch_assoc&#39;]($dbresult);

$smcFunc[&#39;db_free_result&#39;]($dbresult);



if (
$row[&#39;ID_MEMBER&#39;] != $user_info[&#39;id&#39;] && $a_manage == false)

fatal_error(
$txt[&#39;smftags_err_deletetag&#39;],false);



// Delete the tag for the topic

$smcFunc[&#39;db_query&#39;](&#39;&#39;, "DELETE FROM {db_prefix}tags_log WHERE ID $id LIMIT 1");



// Tag Cleanup

TagCleanUp(
$row[&#39;ID_TAG&#39;]);



// Redirect back to the topic

redirectexit(&#39;topic=&#39; . 
$row[&#39;ID_TOPIC&#39;]);

}



function TagsSettings()

{

global 
$context ,$txt$mbname;



// Check permission

isAllowedTo(&#39;smftags_manage&#39;);



$context[&#39;sub_template&#39;]  = &#39;admin_settings&#39;;

$context[&#39;page_title&#39;] = $mbname . &#39; - &#39; . $txt[&#39;smftags_settings&#39;];





$context[$context[&#39;admin_menu_name&#39;]][&#39;tab_data&#39;] = array(

&#39;title&#39; => 
$txt[&#39;smftags_admin&#39;],

&#39;description&#39; => &#39;&#39;,

&#39;tabs&#39; => array(

&#39;admin&#39; => array(

&#39;description&#39; => &#39;&#39;,

),

),

);



}



function TagsSettings2()

{

// Check permission

isAllowedTo(&#39;smftags_manage&#39;);



// Get the settings

$smftags_set_mintaglength = (int) $_REQUEST[&#39;smftags_set_mintaglength&#39;];

$smftags_set_maxtaglength =  (int) $_REQUEST[&#39;smftags_set_maxtaglength&#39;];

$smftags_set_maxtags =  (int) $_REQUEST[&#39;smftags_set_maxtags&#39;];



$smftags_set_cloud_tags_per_row = (int) $_REQUEST[&#39;smftags_set_cloud_tags_per_row&#39;];

$smftags_set_cloud_tags_to_show = (int) $_REQUEST[&#39;smftags_set_cloud_tags_to_show&#39;];

$smftags_set_cloud_max_font_size_precent = (int) $_REQUEST[&#39;smftags_set_cloud_max_font_size_precent&#39;];

$smftags_set_cloud_min_font_size_precent = (int) $_REQUEST[&#39;smftags_set_cloud_min_font_size_precent&#39;];



// Save the setting information

updateSettings(

array(&#39;smftags_set_maxtags&#39; => 
$smftags_set_maxtags,

&#39;smftags_set_mintaglength&#39; => 
$smftags_set_mintaglength,

&#39;smftags_set_maxtaglength&#39; => 
$smftags_set_maxtaglength,

&#39;smftags_set_cloud_tags_per_row&#39; => 
$smftags_set_cloud_tags_per_row,

&#39;smftags_set_cloud_tags_to_show&#39; => 
$smftags_set_cloud_tags_to_show,

&#39;smftags_set_cloud_max_font_size_precent&#39; => 
$smftags_set_cloud_max_font_size_precent,

&#39;smftags_set_cloud_min_font_size_precent&#39; => 
$smftags_set_cloud_min_font_size_precent,



));





// Redirect to the admin section

redirectexit(&#39;action=admin;area=tags;sa=admin&#39;);

}



function TagCleanUp(
$ID_TAG)

{

global 
$smcFunc;

// Delete Tags that have no tag log entry

//
$dbresult = db_query("SELECT ID_TAG FROM {db_prefix}tags", __FILE__, __LINE__);

//while(
$row = mysql_fetch_assoc($dbresult))

//{

//
$dbresult2 = db_query("SELECT ID FROM {db_prefix}tags_log WHERE ID_TAG " . $row[&#39;ID_TAG&#39;], __FILE__, __LINE__);

$dbresult2 = $smcFunc[&#39;db_query&#39;](&#39;&#39;, "

SELECT

ID

FROM {db_prefix}tags_log

WHERE ID_TAG " . $ID_TAG);



if (
$smcFunc[&#39;db_affected_rows&#39;]() == 0)

{

$smcFunc[&#39;db_query&#39;](&#39;&#39;, "DELETE FROM {db_prefix}tags WHERE ID_TAG " . $ID_TAG);

}

$smcFunc[&#39;db_free_result&#39;]($dbresult2);

//}

//mysql_free_result(
$dbresult);





//Redirect to the admin section

//redirectexit(&#39;action=tags;sa=admin&#39;);

}



function SuggestTag()

{

global 
$context$txt$mbname;

// Check permission

isAllowedTo(&#39;smftags_suggest&#39;);



$context[&#39;sub_template&#39;]  = &#39;suggest&#39;;

$context[&#39;page_title&#39;] = $mbname . &#39; - &#39; . $txt[&#39;smftags_suggest&#39;];

}

function SuggestTag2()

{

// Check permission

isAllowedTo(&#39;smftags_suggest&#39;);

}



?>
 

TAGS



top

Smfsimple.com es un sitio destinado a brindar un servicio de soporte y herramientas para foros realizados con el sistema de foros gratuito simplemachines.org. Contamos con un selecto equipo de desarrolladores y conocedores del sistema, sus foros estaran en buenas manos.
This site is not affiliated with or endorsed by Simple Machines