function generatePage(&$tpl, &$session, &$account) { //BUT: Démarrer un template propre à cette page $dbMgr = DbManager::getInstance(); //Instancier le gestionnaire $db = $dbMgr->getConn('game'); //Demander la connexion existante //Aller chercher les notices de pré-inscription $query = 'SELECT db_param' . ' FROM ' . DB_PREFIX . 'item_db' . ' WHERE db_id=:livre_id;'; //8 = NOTICES $prep = $db->prepare($query); $prep->bindValue(':livre_id', 8, PDO::PARAM_INT); $prep->executePlus($db, __FILE__, __LINE__); $arr = $prep->fetch(); if ($arr === false) { return fctErrorMSG('Les notices de pré-inscription sont introuvables.'); } $tpl->set('NOTICES', BBCodes(stripslashes($arr['db_param']))); //Aller chercher les règles HJ $query = 'SELECT db_param FROM ' . DB_PREFIX . 'item_db WHERE db_id=:livre_id;'; //6 = Règles HJ $prep = $db->prepare($query); $prep->bindValue(':livre_id', 6, PDO::PARAM_INT); $prep->executePlus($db, __FILE__, __LINE__); $arr = $prep->fetch(); if ($arr === false) { return fctErrorMSG('Texte des règles HJ introuvable.'); } $tpl->set('REGLES', BBCodes(stripslashes($arr['db_param']))); //Retourner le template complété/rempli return $tpl->fetch($account->getSkinRemotePhysicalPath() . 'html/Visitor/inscription.htm', __FILE__, __LINE__); }
public static function generatePage(&$tpl, &$session, &$account) { $dbMgr = DbManager::getInstance(); //Instancier le gestionnaire $db = $dbMgr->getConn('game'); //Demander la connexion existante //Afficher un message critique sur la page principale. if (defined('WARNING_MESSAGE') && WARNING_MESSAGE !== NULL) { $tpl->set('WARNING_MESSAGE', WARNING_MESSAGE); } //Générer le contenu de la page $query = 'SELECT db_param' . ' FROM ' . DB_PREFIX . 'item_db' . ' WHERE db_id=:livreId' . ' LIMIT 1;'; //4 = Texte page d'intro $prep = $db->prepare($query); $prep->bindValue(':livreId', 4, PDO::PARAM_INT); $prep->executePlus($db, __FILE__, __LINE__); $content = $prep->fetch(); if ($content === false) { return fctErrorMSG('Texte non-trouvé :('); } //Placer le contenu de la page dans le template $tpl->set('PAGE_CONTENU', BBCodes(stripslashes($content[0]))); //Retourner le template complété/rempli return $tpl->fetch($account->getSkinRemotePhysicalPath() . 'html/Visitor/main.htm', __FILE__, __LINE__); }
function __construct(&$perso, &$arr, $bbcode = true) { $this->msg = stripslashes($arr['msg']); //Par défaut, interpréter le BBCode if ($bbcode) { $this->msg = BBCodes($this->msg); } /* $this->date = mktime( date("H", $arr['date']), date("i", $arr['date']), date("s", $arr['date']), date("d", $arr['date']), date("m", $arr['date']), date("Y", $arr['date']) ); */ $this->date = $arr['date']; $this->id = $arr['hid']; $this->style = isset($arr['style']) ? $arr['style'] : ''; $this->type = $arr['type']; $this->from = array(); $this->to = array(); //Ajouter les FROM/TO $this->addFromTo($perso, $arr); }
public static function generatePage(&$tpl, &$session, &$account) { $dbMgr = DbManager::getInstance(); //Instancier le gestionnaire $db = $dbMgr->getConn('game'); //Demander la connexion existante //Définir la page à afficher ( par défaut: resume ) if (!isset($_GET['p'])) { $p = "resume"; } elseif (is_numeric($_GET['p'])) { $p = (int) $_GET['p']; } else { return fctErrorMSG('page introuvable'); } //Validation de la page if ($p != "resume" && !is_numeric($p)) { return fctBugReport("Format invalide", $p, __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, true, true, true); } if (is_numeric($p) && ($p < 1 || $p > 9)) { return fctBugReport("Range invalide", $p, __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, true, true, true); } //Fetcher le contenu adéquat $pageContenu = $tpl->fetch($account->getSkinRemotePhysicalPath() . '../_common/background/bg_' . $p . '.htm', __FILE__, __LINE__); $pageMenu = $tpl->fetch($account->getSkinRemotePhysicalPath() . '../_common/background/bg_menu.htm', __FILE__, __LINE__); //Placer le contenu de la page dans le template et appliquer les BBCodes si nécéssaires $tpl->set('PAGE_MENU', $pageMenu); $tpl->set('PAGE_CONTENU', BBCodes($pageContenu, false, false)); //Ne pas remplacer les sauts de lignes //Retourner le template complété/rempli return $tpl->fetch($account->getSkinRemotePhysicalPath() . 'html/Visitor/background.htm', __FILE__, __LINE__); }
public static function getAllMessage($mediaType, $canalId) { $dbMgr = DbManager::getInstance(); //Instancier le gestionnaire $db = $dbMgr->getConn('game'); //Demander la connexion existante $titreEmission = Member_MediaFactory::getAllEmissionName($mediaType, $canalId); $result = array(); $query = 'SELECT *' . ' FROM `' . DB_PREFIX . 'media`' . ' WHERE `mediaType` = :mediaType' . ' AND `canalId` = :canalId' . ' AND `titre` = :titre' . ' ORDER BY `date` DESC;'; $prep = $db->prepare($query); $prep->bindValue(':mediaType', $mediaType, PDO::PARAM_STR); $prep->bindValue(':canalId', $canalId, PDO::PARAM_INT); foreach ($titreEmission as $titre) { $prep->bindValue(':titre', $titre['titre'], PDO::PARAM_STR); $prep->execute($db, __FILE__, __LINE__); $arrAll = $prep->fetchAll(); foreach ($arrAll as $arr) { $arr['date'] = fctToGameTime($arr['date']); $arr['message'] = BBCodes($arr['message'], false, true, true); $result[] = $arr; } } $prep->closeCursor(); $prep = NULL; return $result; }
public static function generatePage(&$tpl, &$session, &$account, &$perso) { $dbMgr = DbManager::getInstance(); //Instancier le gestionnaire $db = $dbMgr->getConn('game'); //Demander la connexion existante if (!isset($_POST['id'])) { return fctErrorMSG('Paramètre requis manquant.'); } $id = explode('_', $_POST['id']); if (count($id) != 3) { return fctErrorMSG('Paramètre malformé.'); } $msgId = $id[1]; $persoId = $id[2]; //Todo: Valider si le perso qui demande à avoir une description // possède le message en question. $query = 'SELECT d.description, p.imgurl, s.expiration, p.id' . ' FROM ' . DB_PREFIX . 'he_fromto as ft' . ' LEFT JOIN ' . DB_PREFIX . 'he_description as d ON (d.id = ft.id_description)' . ' LEFT JOIN ' . DB_PREFIX . 'perso as p ON (p.id = ft.persoid)' . ' LEFT JOIN ' . DB_PREFIX . 'session as s ON (s.userId = p.userId)' . ' WHERE ft.msgid =:msgId' . ' AND ft.persoid =:persoId' . ' LIMIT 1;'; $prep = $db->prepare($query); $prep->bindValue(':msgId', $msgId, PDO::PARAM_INT); $prep->bindValue(':persoId', $persoId, PDO::PARAM_INT); $prep->execute($db, __FILE__, __LINE__); $arr = $prep->fetch(); $prep->closeCursor(); $prep = NULL; if (empty($arr['description'])) { $arr['description'] = '<i> - Description non disponible - </i>'; } else { $arr['description'] = BBCodes(self::getShortDescription($arr['description'])); } if (is_numeric($arr['id'])) { $arr['expiration'] = $arr['expiration'] === NULL ? 'déconnecté' : 'récente'; } else { $arr['expiration'] = 'Ce personnage à été supprimé.'; } if (!empty($arr['imgurl'])) { $imgurl = str_replace(' ', '%20', $arr['imgurl']); if (substr($imgurl, 0, 4) !== 'http') { $imgurl = SITEPATH_ROOT . 'images/perso/' . $imgurl; } $arr['imgurl'] = $imgurl; } $tpl->set('PERSO_INFO', $arr); echo $tpl->fetch($account->getSkinRemotePhysicalPath() . '/html/Member/he_persoBulle.htm'); die; }
public static function generatePage(&$tpl, &$session, &$account) { $dbMgr = DbManager::getInstance(); //Instancier le gestionnaire $db = $dbMgr->getConn('game'); //Demander la connexion existante //Aller chercher les instructions de création d'un perso $query = 'SELECT db_param' . ' FROM ' . DB_PREFIX . 'item_db' . ' WHERE db_id=:livreId' . ' LIMIT 1;'; $prep = $db->prepare($query); $prep->bindValue(':livreId', 7, PDO::PARAM_INT); $prep->executePlus($db, __FILE__, __LINE__); $arr = $prep->fetch(); $prep->closeCursor(); $prep = NULL; if ($arr === false) { return fctErrorMSG('Les instruction de création d\'un personnage sont introuvables.'); } $tpl->set('INSTRUCTIONS', BBCodes(stripslashes($arr['db_param']))); //Retourner le template complété/rempli return $tpl->fetch($account->getSkinRemotePhysicalPath() . 'html/Member/creerPerso.htm', __FILE__, __LINE__); }
public static function generatePage(&$tpl, &$session, &$account, &$mj) { $dbMgr = DbManager::getInstance(); //Instancier le gestionnaire $db = $dbMgr->getConn('game'); //Demander la connexion existante if (!isset($_GET['id'])) { return fctErrorMSG('Données requises manquantes.'); } //Trouver les PPA associé au MJ $query = 'SELECT m.*, p.nom as perso' . ' FROM ' . DB_PREFIX . 'ppa as m' . ' LEFT JOIN ' . DB_PREFIX . 'perso as p ON (p.id = m.persoid) ' . ' WHERE m.id=:id' . ' LIMIT 1'; $prep = $db->prepare($query); $prep->bindValue(':id', $_GET['id'], PDO::PARAM_INT); $prep->execute($db, __FILE__, __LINE__); $arr = $prep->fetch(); $prep->closeCursor(); $prep = NULL; if ($arr === false) { return fctErrorMSG('PPA innexistant ou attribué à un autre MJ.'); } $PPA = array(); $i = 0; //Afficher le message de base (Le PPA) $PPA[$i] = $arr; $PPA[$i]['msg'] = BBCodes(stripslashes($PPA[$i]['msg'])); $PPA[$i]['notemj'] = stripslashes($PPA[$i]['notemj']); $PPA[$i]['datetxt'] = fctToGameTime($arr['date']); $i++; // (( Non-Attribué, ou soi-même ) && Ouvert(non-fermé)) $CanReply = ($PPA[0]['mjid'] == 0 || $PPA[0]['mjid'] == $mj->getId()) && $PPA[0]['statut'] == 'ouvert'; //Sauvegarder le commentaire de base du Ppa if (isset($_POST['save_comment'])) { $query = 'UPDATE ' . DB_PREFIX . 'ppa' . ' SET notemj=:noteMj' . ' WHERE id =:id;'; $prep = $db->prepare($query); $prep->bindValue(':noteMj', htmlspecialchars($_POST['notemjbase']), PDO::PARAM_STR); $prep->bindValue(':id', $_GET['id'], PDO::PARAM_INT); $prep->execute($db, __FILE__, __LINE__); $prep->closeCursor(); $prep = NULL; echo "<script type=\"text/javascript\">location.href='?mj=Perso_Ppa&id=" . $_GET['id'] . "';</script>"; die; } //Sauvegarder l'attribution du PPA if (isset($_POST['save_saisi'])) { $query = 'UPDATE ' . DB_PREFIX . 'ppa' . ' SET mjid=:mjId' . ' WHERE id =:id;'; $prep = $db->prepare($query); $prep->bindValue(':mjId', $_POST['mj'], PDO::PARAM_INT); $prep->bindValue(':id', $_GET['id'], PDO::PARAM_INT); $prep->execute($db, __FILE__, __LINE__); $prep->closeCursor(); $prep = NULL; echo "<script type=\"text/javascript\">location.href='?mj=Perso_Ppa&id=" . $_GET['id'] . "';</script>"; die; } //Ajout d'une réponse ? if (isset($_POST['reply']) && $CanReply) { $query = 'INSERT INTO ' . DB_PREFIX . 'ppa_reponses' . ' (`sujetid`, `mjid`, `date`, `msg`, `notemj`)' . ' VALUES' . ' (:sujetId, :mjId, UNIX_TIMESTAMP(), :msg, :noteMj);'; $prep = $db->prepare($query); $prep->bindValue(':sujetId', $_GET['id'], PDO::PARAM_INT); $prep->bindValue(':mjId', $mj->getId(), PDO::PARAM_INT); $prep->bindValue(':msg', htmlspecialchars($_POST['msg']), PDO::PARAM_STR); $prep->bindValue(':noteMj', htmlspecialchars($_POST['notemj']), PDO::PARAM_STR); $prep->execute($db, __FILE__, __LINE__); $prep->closeCursor(); $prep = NULL; Member_He::add($mj->getNom(), $PPA[0]['persoid'], 'ppa', $_POST['msg']); } //Afficher les réponses $query = 'SELECT p.*, mj.nom as mjnom' . ' FROM ' . DB_PREFIX . 'ppa_reponses as p' . ' LEFT JOIN ' . DB_PREFIX . 'mj as mj ON (mj.id = p.mjid)' . ' WHERE p.sujetid=:id' . ' ORDER BY p.`date` ASC;'; $prep = $db->prepare($query); $prep->bindValue(':id', $_GET['id'], PDO::PARAM_INT); $prep->execute($db, __FILE__, __LINE__); $arrAll = $prep->fetchAll(); $prep->closeCursor(); $prep = NULL; if (count($arrAll) > 0) { foreach ($arrAll as &$arr) { $PPA[$i] = $arr; $PPA[$i]['msg'] = BBCodes(stripslashes($PPA[$i]['msg'])); if (empty($PPA[$i]['notemj'])) { $PPA[$i]['notemj'] = "<i>- aucune note -</i>"; } else { $PPA[$i]['notemj'] = BBCodes(stripslashes($PPA[$i]['notemj'])); } $PPA[$i]['datetxt'] = fctToGameTime($arr['date']); if (empty($arr['mjnom'])) { if ($arr['mjid'] == 0) { $PPA[$i]['mjnom'] = $PPA[0]['perso']; } else { $PPA[$i]['mjnom'] = 'MJ Inconnu'; } } else { $PPA[$i]['mjnom'] = stripslashes($arr['mjnom']); } $i++; } } //Si PPA attribué, vérifier s'il traine (en attente) depuis plus de 3 jours //if($CanReply) //{ $canClose = false; if ($CanReply && $PPA[$i - 1]['date'] <= mktime(0, 0, 0, date('m'), date('d') - 3, date('Y'))) { //$canReply = true; $canClose = true; } //Fermer le PPA si le MJ est autorisé à y répondre if ($canClose && isset($_POST['close'])) { $query = 'UPDATE ' . DB_PREFIX . 'ppa' . ' SET statut="ferme"' . ' WHERE id=:sujetId' . ' LIMIT 1;'; $prep = $db->prepare($query); $prep->bindValue(':sujetId', $_GET['id'], PDO::PARAM_INT); $prep->execute($db, __FILE__, __LINE__); $prep->closeCursor(); $prep = NULL; header('location:?mj=Perso_Ppa&id=' . (int) $_GET['id']); die; } //} $query = 'SELECT id, nom' . ' FROM ' . DB_PREFIX . 'mj;'; $prep = $db->prepare($query); $prep->execute($db, __FILE__, __LINE__); $MJ = $prep->fetchAll(); $prep->closeCursor(); $prep = NULL; $tpl->set("MJID", $mj->getId()); $tpl->set("MJ", $MJ); $tpl->set("PPA", $PPA); $tpl->set("CAN_REPLY", $CanReply); $tpl->set("CAN_CLOSE", $canClose); return $tpl->fetch($account->getSkinRemotePhysicalPath() . '/html/Mj/Perso/ppa.htm'); }
function __construct(&$arr, $persoId) { $this->msg = BBCodes(stripslashes($arr['msg'])); $this->date = mktime(date('H', $arr['date']), date('i', $arr['date']), date('s', $arr['date']), date('m', $arr['date']), date('d', $arr['date']), date('Y', $arr['date']) + GAMETIME_DECAL); $this->id = $arr['hid']; $this->style = isset($arr['style']) ? $arr['style'] : ''; $this->show = $arr['show']; $this->from = array(); $this->to = array(); //Ajouter les FROM/TO $this->addFromTo($arr); }
/** Retourne le contenu du livre avec les saut de ligne en <br> (insertion direct dans une page) * @return int */ public function getContenuHTML() { return BBCodes($this->contenu, false, true, true); }
public static function generatePage(&$tpl, &$session, &$account, &$perso) { $dbMgr = DbManager::getInstance(); //Instancier le gestionnaire $db = $dbMgr->getConn('game'); //Demander la connexion existante if (!isset($_GET['id']) || !is_numeric($_GET['id'])) { return fctErrorMSG('Données requises manquantes.'); } //Ajouter un message au PPA if (isset($_POST['form_action']) && ($_POST['form_action'] == 'reply' || $_POST['form_action'] == 'del' && !empty($_POST['msg']))) { $query = 'INSERT INTO ' . DB_PREFIX . 'ppa_reponses' . ' (`sujetid`, `mjid`, `date`, `msg`)' . ' VALUES' . ' (:sujetId, 0, UNIX_TIMESTAMP(), :msg);'; $prep = $db->prepare($query); $prep->bindValue(':sujetId', $_GET['id'], PDO::PARAM_INT); $prep->bindValue(':msg', fctScriptProtect($_POST['msg']), PDO::PARAM_STR); $prep->execute($db, __FILE__, __LINE__); //Copier le message dans les HE Member_He::add($perso->getId(), 'MJ', 'ppa', $_POST['msg']); } //Fermer le PPA if (isset($_POST['form_action']) && $_POST['form_action'] == 'del') { $query = 'UPDATE ' . DB_PREFIX . 'ppa' . ' SET statut="ferme"' . ' WHERE id=:sujetId' . ' LIMIT 1;'; $prep = $db->prepare($query); $prep->bindValue(':sujetId', $_GET['id'], PDO::PARAM_INT); $prep->execute($db, __FILE__, __LINE__); $tpl->set('PAGE', '?popup=1&m=ContactMj'); return $tpl->fetch($account->getSkinRemotePhysicalPath() . 'html/Member/action_redirect.htm', __FILE__, __LINE__); } //Trouver les PPA demandé $query = 'SELECT m.id, m.msg, m.`date`, m.statut, mj.nom as mjnom' . ' FROM ' . DB_PREFIX . 'ppa as m' . ' LEFT JOIN ' . DB_PREFIX . 'mj as mj ON (mj.id = m.mjid) ' . ' WHERE m.id=:sujetId' . ' AND persoid=:persoId' . ' LIMIT 1'; $prep = $db->prepare($query); $prep->bindValue(':sujetId', $_GET['id'], PDO::PARAM_INT); $prep->bindValue(':persoId', $perso->getId(), PDO::PARAM_INT); $prep->execute($db, __FILE__, __LINE__); $arr = $prep->fetch(); if ($arr === false) { return fctErrorMSG('Ppa innexistant.'); } $PPA = array(); $i = 0; //Afficher le message de base (Le PPA) $PPA[$i] = $arr; $PPA[$i]['msg'] = BBCodes(stripslashes($PPA[$i]['msg'])); $PPA[$i]['date'] = fctToGameTime($arr['date']); $PPA[$i]['de'] = $perso->getNom(); $i++; //Afficher les réponses $query = 'SELECT p.*, mj.nom as mjnom' . ' FROM ' . DB_PREFIX . 'ppa_reponses as p' . ' LEFT JOIN ' . DB_PREFIX . 'mj as mj ON (mj.id = p.mjid)' . ' WHERE p.sujetid=:sujetId' . ' ORDER BY p.`date` ASC;'; $prep = $db->prepare($query); $prep->bindValue(':sujetId', $_GET['id'], PDO::PARAM_INT); $prep->execute($db, __FILE__, __LINE__); $arrM = $prep->fetchAll(); if (count($arrM) != 0) { foreach ($arrM as $arr) { $PPA[$i] = $arr; $PPA[$i]['msg'] = BBCodes(stripslashes($PPA[$i]['msg'])); $PPA[$i]['date'] = fctToGameTime($arr['date']); if (empty($arr['mjnom'])) { $PPA[$i]['de'] = $perso->getNom(); } else { $PPA[$i]['de'] = stripslashes($arr['mjnom']); } $i++; } } $tpl->set('PPA', $PPA); return $tpl->fetch($account->getSkinRemotePhysicalPath() . 'html/Member/contactMjMod.htm', __FILE__, __LINE__); }
/** Retourne le contenu HTML de la page (avec les BBCodes convertis en HTML). * @return string */ public function getContentHTML() { if (!$this->allowHTML) { $this->contentHTML = preg_replace(array('/</', '/>/'), array('«', '»'), $this->contentHTML); } if (empty($this->contentHTML)) { $this->contentHTML = BBCodes($this->contentRaw, true); } return $this->contentHTML; }
/** * Récupère l'historique des transactions de la boutique du lieu. * L'historique est sous forme de tableau de transactions. Chaque transaction * est représentée par son "id" et son "details". * * Fonctionne pour le lieu actuel. * * @return mixed|null retourne l'historique ou null si aucun historique */ public function getBoutiqueHistorique() { $dbMgr = DbManager::getInstance(); //Instancier le gestionnaire $db = $dbMgr->getConn('game'); //Demander la connexion existante $transactionType = array('ACH' => 'achat', 'VEN' => 'vente', 'DEP' => 'depot', 'RET' => 'retrait'); $query = 'SELECT * FROM `' . DB_PREFIX . 'boutiques_historiques`' . ' WHERE `boutiqueid` = :boutiqueid' . ' ORDER BY `date` DESC;'; $prep = $db->prepare($query); $prep->bindValue(':boutiqueid', $this->id, PDO::PARAM_INT); $prep->executePlus($db, __FILE__, __LINE__); $arrAll = $prep->fetchAll(); $prep->closeCursor(); $prep = NULL; if (count($arrAll) != 0) { $result = array(); $i = 0; foreach ($arrAll as $arr) { $result[$i]['id'] = $arr['id']; $result[$i]['details'] = fctToGameTime($arr['date'], true) . ' ' . $transactionType[$arr['transactiontype']] . ' de '; if ($arr['transactiontype'] == 'ACH' || $arr['transactiontype'] == 'VEN') { $result[$i]['details'] .= $arr['itemlist']; if ($arr['marchandage']) { $result[$i]['details'] .= ' avec un rabais'; } else { $result[$i]['details'] .= ' à prix régulier'; } $result[$i]['details'] .= ' : '; if ($arr['moyenpaiement']) { $result[$i]['details'] .= ' par carte bancaire '; } else { $result[$i]['details'] .= ' comptant '; } $result[$i]['details'] .= ' : '; } $result[$i]['details'] .= $arr['prixtotal'] . ' ' . GAME_DEVISE . '.'; $result[$i]['details'] = BBCodes($result[$i]['details']); $i++; } return $result; } return null; }
function guestbook_list($params = array()) { global $template, $tpl, $twig, $userROW, $ip, $config, $mysql, $SYSTEM_FLAGS, $TemplateCache, $CurrentHandler, $lang; $SYSTEM_FLAGS['info']['title']['group'] = $lang['guestbook']['title']; require_once root . "/plugins/guestbook/lib/recaptchalib.php"; $publickey = pluginGetVariable('guestbook', 'public_key'); $privatekey = pluginGetVariable('guestbook', 'private_key'); // ADD notication if (isset($params['act']) && $params['act'] == 'add' || isset($_REQUEST['add']) && $_REQUEST['add']) { $success_add[] = pluginGetVariable('guestbook', 'approve_msg') ? $lang['guestbook']['success_add_wo_approve'] : $lang['guestbook']['success_add']; } // EDIT notication if (isset($params['act']) && $params['act'] == 'upd' || isset($_REQUEST['upd']) && $_REQUEST['upd']) { $success_add[] = $lang['guestbook']['success_edit']; } // DELETE notication if (isset($params['act']) && $params['act'] == 'del' || isset($_REQUEST['del']) && $_REQUEST['del']) { $success_add[] = $lang['guestbook']['success_delete']; } // pagination $perpage = intval(pluginGetVariable('guestbook', 'perpage')); if ($perpage < 1 or $perpage > 5000) { $perpage = 10; } $page = intval(isset($CurrentHandler['params']['page']) ? $CurrentHandler['params']['page'] : (isset($_REQUEST['page']) ? $_REQUEST['page'] : 0)); if ($page < 1) { $page = 1; } if (!$start) { $start = ($page - 1) * $perpage; } $total_count = $mysql->result("SELECT COUNT(*) AS num FROM " . prefix . "_guestbook WHERE status = 1"); $PagesCount = ceil($total_count / $perpage); $paginationParams = checkLinkAvailable('guestbook', '') ? array('pluginName' => 'guestbook', 'pluginHandler' => '', 'params' => array(), 'xparams' => array(), 'paginator' => array('page', 0, false)) : array('pluginName' => 'core', 'pluginHandler' => 'plugin', 'params' => array('plugin' => 'guestbook'), 'xparams' => array(), 'paginator' => array('page', 1, false)); $tpath = locatePluginTemplates(array(':'), 'guestbook', pluginGetVariable('guestbook', 'localsource')); $navigations = parse_ini_file($tpath[':'] . '/variables.ini', true); $order = pluginGetVariable('guestbook', 'order'); // get fields $fields = $mysql->select("select * from " . prefix . "_guestbook_fields"); $tEntries = array(); foreach ($fields as $fNum => $fRow) { $tEntry = array('id' => $fRow['id'], 'name' => $fRow['name'], 'placeholder' => $fRow['placeholder'], 'default_value' => $fRow['default_value'], 'required' => intval($fRow['required'])); $tEntries[$fRow['id']] = $tEntry; } $tVars = array('entries' => _guestbook_records($order, $start, $perpage), 'pages' => generatePagination($page, 1, $PagesCount, 10, $paginationParams, $navigations), 'total_count' => $total_count, 'perpage' => $perpage, 'errors' => $errors, 'success' => $success_add, 'ip' => $ip, 'smilies' => pluginGetVariable('guestbook', 'usmilies') ? InsertSmilies('', 10) : "", 'bbcodes' => pluginGetVariable('guestbook', 'ubbcodes') ? BBCodes() : "", 'use_captcha' => pluginGetVariable('guestbook', 'ecaptcha'), 'captcha' => pluginGetVariable('guestbook', 'ecaptcha') && !is_array($userROW) ? recaptcha_get_html($publickey) : '', 'use_guests' => !is_array($userROW) && !pluginGetVariable('guestbook', 'guests'), 'fields' => $tEntries); $tpath = locatePluginTemplates(array('guestbook.list'), 'guestbook', pluginGetVariable('guestbook', 'localsource')); $xt = $twig->loadTemplate($tpath['guestbook.list'] . 'guestbook.list.tpl'); $template['vars']['mainblock'] = $xt->render($tVars); }