function index($id) { $this->load->model(array('events', 'comments')); if (!$this->events->eventExist($id)) { redirect(); } $data['events'] = $this->events->getEventsHome(14); $data['infos'] = $this->events->getEvent($id); $data['view'] = 'viewEvent'; $data['title'] = $data['infos']['name']; $this->load->helper('comments'); $_POST = array('table' => 'events', 'idData' => $id); $data['commentaires'] = displayCommentaires(); $this->load->view('design.php', $data); }
function view($url) { if ($url == 'p350') { redirect('armes-inventaire-final-fantasy-xiii', 'location', 301); } if ($url == 'p470') { redirect('dev-optimal-pour-serah-cristariums-final-fantasy-xiii-2', 'location', 301); } // view un historique if (is_numeric($url)) { $id = $url; $data['history'] = true; } else { $idCreation = $this->contents->getIdCreationByUrl($url); if (!$idCreation) { header("HTTP/1.0 410 Gone"); echo '<script>window.location = "' . base_url() . '"</script>'; exit; } $data['history'] = false; } if ($data['history']) { $data['noIndex'] = true; $infos = $this->contents->getInfosForHistory($id); $idCreation = $infos['idCreation']; $data['contributs'] = $this->contents->getContributs($idCreation, $id); $data['listVersions'] = $this->contents->getListVersions($idCreation); $data['keyCurrentView'] = 0; // version courante qu'on regarde $data['keyCurrentContent'] = 0; // version courante foreach ($data['listVersions'] as $key => $v) { if ($v['id'] == $id) { $data['keyCurrentView'] = $key; } if ($v['isCurrent'] == 1) { $data['keyCurrentContent'] = $key; } } } else { $infos = $this->contents->getInfosForView($idCreation); if (count($infos) == 0) { redirect(); } // var_dump($infos); $data['contributs'] = $this->contents->getContributs($idCreation, $infos['id']); // l'url réél de la page qu'on veut affiché n'est pas la bonne, on redirige vers la bonne if ($infos['url'] != $url) { redirect($infos['url'], 'location', 301); } } if (trim($infos['redirect']) != '') { redirect($infos['redirect']); } $data['headTitle'] = $infos['headTitle']; $title2 = str_replace(' - ', ' <span><</span> ', $infos['title']); $title = str_replace('Final Fantasy ', 'FF', htmlspecialchars($data['headTitle'])); $title = str_replace(' - ', ' <span><</span> ', $title); $title = str_replace($title2, $infos['title'], $title); $data['title'] = $title; $data['description'] = $infos['description']; $data['view'] = 'viewContent'; $data['infos'] = $infos; $data['treeNav'] = $this->contents->getTreeNav(); if (trim($infos['content']) == '' && $infos['type'] == 2) { $data['sommaire'] = $this->contents->getSommaire($idCreation); } // si c'est une actualité ou un article if ($infos['type'] == 1 || $infos['type'] == 3) { $data['lastSide'] = $this->contents->getLastForSide($infos['type']); } if ($infos['type'] != 2) { $this->load->helper('comments'); $_POST = array('table' => 'contents', 'idData' => $infos['idCreation']); $data['commentaires'] = displayCommentaires(); } if ($data['history'] == false && $this->input->is_ajax_request()) { // $array['id'] = ; // $array['title'] = ; // $array['content'] = ; // $array['facebook'] = ; // $array['twitter'] = ; } else { $this->load->view('design.php', $data); } }
public function index($categorie = 'home', $idConvers = 0, $mpTo = '') { $this->load->model('images'); $data['myImages'] = $this->images->getMyLastImages(100); $data['categories'] = $this->contents->getCategories(); $data['sites'] = $this->contents->getSites(); $data['current'] = 'account'; $data['nbImageToIndexed'] = 0; foreach ($data['myImages'] as $img) { if ($img['indexed'] == 0) { $data['nbImageToIndexed']++; } } if ($categorie == 'home') { $data['title'] = 'Mon profil'; $data['colors'] = $this->colors; $data['infos'] = $this->users->getInfosAccount($this->session->userdata('id')); } if ($categorie == 'viewMessaging') { $this->load->model('messaging'); if ($this->session->userdata('id') != 1) { if (!$this->messaging->iAmInConvers($idConvers)) { redirect(); } } $data['idConvers'] = $idConvers; $this->db->set('notif', 0)->where('notif', 1)->where('user', $this->session->userdata('id'))->where('messaging', $idConvers)->update('messaging_users'); $data['title'] = $this->messaging->getTitle($idConvers); $data['usersInConvers'] = $this->messaging->getUsersInConvers($idConvers); $this->load->helper('comments'); $_POST = array('table' => 'messaging', 'idData' => $idConvers); $data['commentaires'] = displayCommentaires(); } if ($categorie == 'messagerie') { $this->db->set('nbMP', 0)->where('id', $this->session->userdata('id'))->update('users'); $data['title'] = 'Ma messagerie'; $this->load->model('messaging'); $data['myConvers'] = $this->messaging->getMyConvers(); $data['mpTo'] = $mpTo; $listId = array(); foreach ($data['myConvers'] as $convers) { $listId[] = $convers['id']; } if (count($listId) != 0) { $data['usernamesMyConvers'] = $this->messaging->getUsernamesMyConvers($listId); } } if ($categorie == 'images') { $data['title'] = 'Mes images'; } if ($categorie == 'trierImages') { $data['title'] = 'Trier mes images'; } if ($categorie == 'ajouterImages') { $data['title'] = 'Ajouter des images'; } if ($categorie == 'contributions') { $data['title'] = 'Mes contributions'; $data['type_contents'] = $this->contents->getContentTypes(); $myContents = $this->contents->getMyContents(); $idCreationContents = array(null); foreach ($myContents as $content) { $idCreationContents[] = $content['idCreation']; } $historyContents = $this->contents->getHistoryByIdCreation($idCreationContents); foreach ($myContents as $key => $content) { $myContents[$key]['history'] = array(); foreach ($historyContents as $history) { if ($history['idCreation'] == $content['idCreation']) { $myContents[$key]['history'][] = $history; } } } $data['myContents'] = $myContents; } if ($categorie == 'gils') { $data['title'] = 'Mes gils'; } $data['categorie'] = $categorie; $data['view'] = 'homeUser'; $this->load->view('design.php', $data); }
function viewTopic($id) { $this->load->model('forums'); if (!$this->forums->topicExist($id)) { redirect(); } $this->input->set_cookie('topic_' . $id, time(), 50000000); $data['infos'] = $this->forums->getTopic($id); if ($data['infos']['sondage'] == 1) { $data['total'] = 0; $data['responses'] = $this->forums->getResponses($id); foreach ($data['responses'] as $rep) { $data['total'] += $rep['nbVote']; } } $data['title'] = $data['infos']['title']; $data['view'] = 'viewTopic'; $this->load->helper('comments'); $_POST = array('table' => 'forum', 'idData' => $id); $data['commentaires'] = displayCommentaires(); $data['topics'] = $this->forums->getLastTopics(9); $this->load->view('design.php', $data); }
function displayComments($page) { $this->load->helper('comments'); displayCommentaires(); }