(GPLv2) or write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA02110-1301, USA. ********************************************************************************/ if (!defined("_LOAD_PAGE_")) { die("
Error: This file cannot be opened directly!
"); } //------ //whr: 2 //------ $op = (isset($_GET['op'])) ? inCode($_GET['op']) : "" ; if (isset($_GET['id'])) { $id = intval($_GET['id']); $title = ""; } else { $title = (isset($_GET['title'])) ? mem_urldecode(inCode($_GET['title'])) : "" ; $id = ""; } if (isset($_GET['gid'])) { $gid = intval($_GET['gid']); } else { $gid = 0; } if (isset($_GET['ok'])) { $ok = inCode($_GET['ok']); } else { $ok = false; } if (isset($_GET['rank'])) { $rank = inCode($_GET['rank']); } else { $rank = ""; } if (isset($_GET['pg'])) { $pg = intval($_GET['pg']); } else { $pg = 1; } $ofsppg = 60; //Items per page $ofsbgn = ($pg*$ofsppg)-$ofsppg; function guideList() { global $dblink,$siteConfig; openTable(); if ($result = $dblink->get_list("SELECT * FROM memht_argomenti ORDER BY nome")) { foreach ($result as $row) { $ida = intval($row['id']); $inome = outCode($row['nome']); if ($dblink->get_num("SELECT id FROM memht_guide WHERE argomento=$ida AND enabled=1")>0) { echo "
Bullet $inome
\n"; $result = $dblink->get_list("SELECT *,DATE_FORMAT(data, '".$siteConfig['timestamp']."') as data FROM memht_guide WHERE argomento=$ida AND enabled=1 ORDER BY id DESC LIMIT 20"); foreach ($result as $row) { $id = intval($row['id']); $nome = outCode($row['nome']); $autore = outCode($row['autore']); $data = $row['data']; $hits = intval($row['hits']); echo "
  - $nome
\n"; } echo "
  .. "._COMPLETE_LIST_."
\n"; echo "

"; } } } else { echo "
"._NOARGS_."
"; } closeTable(); } function viewArgument($id,$title,$ofsbgn,$ofsppg,$pg) { global $dblink,$siteConfig; if ($title!="") { $row = $dblink->get_row("SELECT id,nome FROM memht_argomenti WHERE nome='$title'"); $ida = intval($row['id']); $inome = outCode($row['nome']); } else { $ida = intval($id); $row = $dblink->get_row("SELECT nome FROM memht_argomenti WHERE id=$ida"); $inome = outCode($row['nome']); } openTable(); echo "
Bullet $inome
\n"; if ($result = $dblink->get_list("SELECT *,DATE_FORMAT(data, '".$siteConfig['timestamp']."') as data FROM memht_guide WHERE argomento=$ida AND enabled=1 ORDER BY id DESC LIMIT $ofsbgn,$ofsppg")) { foreach ($result as $row) { $id = intval($row['id']); $nome = outCode($row['nome']); $autore = outCode($row['autore']); $data = $row['data']; $hits = intval($row['hits']); echo "
  - $nome
\n"; } //Pages include_once("inc/class/paginationSystem.class.php"); $ps = new paginationSystem(); $ps->items = $ofsppg; $ps->actpg = $pg; $ps->query = "SELECT id FROM memht_guide WHERE argomento=$ida"; $ps->url = "index.php?page=guide&op=arg&id=$ida&title=".mem_urlencode($title)."&pg={{N}}"; $ps->show(); } else { echo "
"._NOGUIDESINSEC_."
\n"; } closeTable(); } function viewGuide($id,$title,$pg=1) { global $dblink,$siteConfig,$admin,$user,$visitorInfo,$tzNOW; $idg = intval($id); $ipg = $pg - 1; if ($row = $dblink->get_row("SELECT g.*,(SELECT ROUND(SUM(r.vote)/COUNT(r.id)) AS irank FROM memht_ratings AS r WHERE whr=2 AND r.wid=g.id) AS rank,DATE_FORMAT(g.data, '".$siteConfig['timestamp']."') as data,g.language AS languageid,l.language AS languagetxt FROM memht_guide AS g LEFT JOIN memht_content_languages AS l ON g.language = l.id WHERE g.id=$idg OR g.nome='$title' AND g.enabled=1")) { // Aqui vamos criar uma rotina para apagar os ips da tabela com mais de 60 minutos $dblink->query("DELETE FROM memht_guide_apoio WHERE (data + INTERVAL 4 MINUTE) < $tzNOW"); // Aqui vamos verificar se já existe o ip na tabela if($dblink->get_num("SELECT ip FROM memht_guide_apoio WHERE ip='".$visitorInfo['ip']."' AND id='$idg'")==0) { // Como verificamos o ip não existe então vamos adicionar, assim como o id da guide e data e hora. $dblink->query("INSERT INTO memht_guide_apoio VALUES ($idg,'".$visitorInfo['ip']."',$tzNOW)"); // Aqui como o homem não está tentando enganar, vamos lá contar o hit lol $dblink->query("UPDATE memht_guide SET hits=hits+1 WHERE id=$id OR nome='$title'"); } $id = intval($row['id']); $argomento = intval($row['argomento']); $nome = outCode($row['nome']); $descrizione = outCode($row['descrizione']); $testo = outCode($row['testo']); $autore = outCode($row['autore']); $data = $row['data']; $hits = intval($row['hits']); $usecomments = intval($row['usecomments']); $rank = intval($row['rank']); $languageid = intval($row['languageid']); $languagetxt = outCode($row['languagetxt']); if ($languageid==0) { $languagetxt = _GLOBAL_; } if ($descrizione!="") { $testo = "
$descrizione

$testo"; } $testo = explode("[-pagebreak-]",$testo); $mytext = trim($testo[$ipg]); if (memRunHooks('ViewGuide',array($id,$argomento,$nome,$descrizione,$mytext,$autore,$data,$hits,$rank))) { openTable(); //Content head include_once("inc/class/conthead.class.php"); $ch = new conthead(); $ch->title = $nome; $ch->cdate = $data; $ch->author = $autore; $ch->hits = $hits; $ch->langid = $languageid; $ch->langtxt = $languagetxt; $ch->prnt_url = "pages/guide/print.php?id=$id"; $ch->pdf_url = "pages/guide/pdf.php?id=$id"; $ch->rss_url = "rss.php?page=guide&topic=$argomento"; $ch->url = $siteConfig['site_url']."/index.php?page=guide&op=readGuide&id=$id&title=".mem_urlencode($nome); $ch->show(); echo "
$mytext
\n"; //Rating include_once("inc/class/rating.class.php"); $rt = new rating(); $rt->whr = 2; $rt->wid = $id; $rt->rank = $rank; $rt->show(); //Tags include_once("inc/class/tags.class.php"); $tg = new tags(); $tg->whr = 2; $tg->wid = $id; $tg->show(); closeTable(); memRunHooks('ViewGuideEnd',array($id,$argomento,$nome,$descrizione,$mytext,$autore,$data,$hits,$rank)); } if (sizeof($testo)>1) { openTable(); //Pages include_once("inc/class/paginationSystem.class.php"); $ps = new paginationSystem(); $ps->items = 1; $ps->actpg = $pg; $ps->override_query = true; $ps->tot_items = sizeof($testo); $ps->url = "index.php?page=guide&op=readGuide&id=$id&title=".mem_urlencode($nome)."&pg={{N}}"; $ps->show(); echo "
"; showBanner(5); echo "
"; closeTable(); } if ($siteConfig['usecomments']==1 AND $usecomments==1) { openTable(); //Comments include_once("inc/class/comments.class.php"); $cc = new comments(); $cc->whr = 2; $cc->wid = $id; $cc->show(); closeTable(); } } else { openTable(); echo "
"._GUIDONOTEXISTS_."
"; closeTable(); } } switch($op) { case "arg": viewArgument($id,$title,$ofsbgn,$ofsppg,$pg); break; case "readGuide": viewGuide($id,$title,$pg); break; default: guideList(); break; } ?>