Exemplo n.º 1
0
 public function index()
 {
     $this->view->js_link[] = $this->make_link('js', SITE_ASSETS, 'pages/sidebar_search.js');
     $this->view->js_link[] = $this->make_link('js', SITE_ASSETS, 'pages/common.js');
     // alapbeállítások lekérdezése
     $this->view->settings = $this->munkak_model->get_settings();
     // 3 legfrissebb munka
     $this->view->latest_jobs = $this->munkak_model->jobs_query(3);
     $this->view->title = 'Munka diákoknak | Multijob Iskolaszövetkezet.';
     $this->view->description = 'Munka diákoknak a Multijob Iskolaszövetkezetnél. Diákmunka az ország több területén.';
     $this->view->keywords = 'diákmunka, alkalmi munka, multijob';
     // paginator
     include LIBS . '/pagine_class.php';
     // paginátor objektum létrehozása (paraméter neve, limit)
     $pagine = new Paginator('oldal', 9);
     // adatok lekérdezése limittel
     $this->view->jobs_data = $this->munkak_model->jobs_filter_query($pagine->get_limit(), $pagine->get_offset());
     // szűrési feltételeknek megfelelő összes rekord száma
     $filter_count = $this->munkak_model->jobs_filter_count_query();
     $pagine->set_total($filter_count);
     // lapozó linkek
     $this->view->pagine_links = $pagine->page_links($this->registry->uri_path);
     //$this->view->debug(true);
     $this->view->render('munkak/tpl_munkak');
 }
Exemplo n.º 2
0
 public function cat($slug)
 {
     $pages = new Paginator('10', 'page');
     $pages->set_total(count($this->_model->getcatposttotal($slug)));
     $data['posts'] = $this->_model->getcatposts($slug, $pages->get_limit());
     $data['page_links'] = $pages->page_links();
     $data['cats'] = $this->_model->getcats();
     $data['title'] = $data['posts'][0]->catTitle;
     View::rendertemplate('header', $data);
     View::render('blog/cats', $data);
     View::rendertemplate('footer', $data);
 }
Exemplo n.º 3
0
        <table>
        <tr>
		<th>ID</th>
                <th>Pseudo</th>
		<th>PID</th>
                <th>Email</th>
		<th style="text-align: center;">Inscription</th>
                <th style="text-align: center;">Action</th>
        </tr>
        <?php 
try {
    $pages = new Paginator('10', 'p');
    $stmt = $db->query('SELECT memberID FROM blog_members');
    //pass number of records to
    $pages->set_total($stmt->rowCount());
    $stmt = $db->query('SELECT memberID,username,pid,email,memberDate FROM blog_members ORDER BY memberID DESC ' . $pages->get_limit());
    while ($row = $stmt->fetch()) {
        echo '<tr>';
        echo '<td>' . $row['memberID'] . '</td>';
        echo '<td style="width: 20%;">' . $row['username'] . '</td>';
        echo '<td style="font-size: 10px;">' . $row['pid'] . '</td>';
        echo '<td style="font-size: 11px;">' . $row['email'] . '</td>';
        sscanf($row['memberDate'], "%4s-%2s-%2s %2s:%2s:%2s", $annee, $mois, $jour, $heure, $minute, $seconde);
        echo '<td style="font-size: 10px; text-align: center;">' . $jour . '-' . $mois . '-' . $annee . '</td>';
        ?>

                                <td style="text-align: center;">
                                        <a style="text-decoration: none;" href="edit-user.php?id=<?php 
        echo $row['memberID'];
        ?>
"><input type="button" class="button" value="Edit." /></a>
Exemplo n.º 4
0
		</div>
<h1 id="blogheader">The Jungle Times Blog <small>Posts in "<?php 
echo $row['catTitle'];
?>
"</small></h1>
		<div id="main" class="row">
			<div id="posts" class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
				<div class="row">
            <?php 
try {
    $pages = new Paginator('12', 'p');
    $stmt = $db->prepare('SELECT blog_posts.postID FROM blog_posts, blog_cat_cats WHERE blog_posts.postID = blog_cat_cats.postID AND blog_cat_cats.catID = :catID');
    $stmt->execute(array(':catID' => $row['catID']));
    //pass number of records to
    $pages->set_total($stmt->rowCount());
    $stmt = $db->prepare('SELECT blog_posts.postID, blog_posts.postTitle, blog_posts.postAuthor, blog_posts.postSlug, blog_posts.postImage, blog_posts.postDescription, blog_posts.postDate FROM blog_posts, blog_cat_cats WHERE blog_posts.postID = blog_cat_cats.postID AND blog_cat_cats.catID = :catID ORDER BY postID DESC ' . $pages->get_limit());
    $stmt->execute(array(':catID' => $row['catID']));
    $adCount = 3;
    while ($row = $stmt->fetch()) {
        echo '<div class="postsOuter col-lg-3 col-md-6 col-sm-6 col-xs-12">';
        echo '<div class="posts">';
        echo '<h2><a href="' . $row['postSlug'] . '">' . $row['postTitle'] . '</a></h2>';
        echo '<h4>By <strong>' . $row['postAuthor'] . '</strong> | ' . date('F d, Y', strtotime($row['postDate'])) . ' <br/>';
        $stmt2 = $db->prepare('SELECT catTitle, catSlug	FROM blog_cats, blog_cat_cats WHERE blog_cats.catID = blog_cat_cats.catID AND blog_cat_cats.postID = :postID');
        $stmt2->execute(array(':postID' => $row['postID']));
        $catRow = $stmt2->fetchAll(PDO::FETCH_ASSOC);
        $links = array();
        if (!empty($catRow)) {
            echo 'Tags: ';
        } else {
            echo '&nbsp;';
Exemplo n.º 5
0
<br /><br />

		                        <?php 
try {
    //collect month and year data
    $month = htmlentities($_GET['month']);
    $year = htmlentities($_GET['year']);
    //set from and to dates
    $from = date('Y-m-01 00:00:00', strtotime("{$year}-{$month}"));
    $to = date('Y-m-31 23:59:59', strtotime("{$year}-{$month}"));
    $pages = new Paginator('10', 'p');
    $stmt = $db->prepare('SELECT postID FROM blog_posts_seo WHERE postDate >= :from AND postDate <= :to');
    $stmt->execute(array(':from' => $from, ':to' => $to));
    //pass number of records to
    $pages->set_total($stmt->rowCount());
    $stmt = $db->prepare('SELECT postID, postTitle, postSlug, postDesc, postDate FROM blog_posts_seo WHERE postDate >= :from AND postDate <= :to ORDER BY postID DESC ' . $pages->get_limit());
    $stmt->execute(array(':from' => $from, ':to' => $to));
    while ($row = $stmt->fetch()) {
        echo '<br /><div><fieldset>';
        echo '<span style="font-weight: bold; font-size: 12pt;"><a style="text-decoration: none;" href="' . $row['postSlug'] . '">' . $row['postTitle'] . '</a></span>';
        echo '<br />Posté le ' . date('j M Y', strtotime($row['postDate'])) . ', dans ';
        $stmt2 = $db->prepare('SELECT catTitle, catSlug FROM blog_cats, blog_post_cats WHERE blog_cats.catID = blog_post_cats.catID AND blog_post_cats.postID = :postID');
        $stmt2->execute(array(':postID' => $row['postID']));
        $catRow = $stmt2->fetchAll(PDO::FETCH_ASSOC);
        $links = array();
        foreach ($catRow as $cat) {
            $links[] = "<a href='c-" . $cat['catSlug'] . "'>" . $cat['catTitle'] . "</a>";
        }
        echo implode(", ", $links);
        echo '</div></fieldset>';
    }
    $stmt = $db->prepare('SELECT blog_posts_seo.postID FROM blog_posts_seo, blog_post_cats WHERE blog_posts_seo.postID = blog_post_cats.postID AND blog_post_cats.catID = :catID');
    $stmt->execute(array(':catID' => $row['catID']));
    //pass number of records to
    $pages->set_total($stmt->rowCount());
    $stmt = $db->prepare('
					SELECT 
						blog_posts_seo.postID, blog_posts_seo.postTitle, blog_posts_seo.postSlug, blog_posts_seo.postDesc, blog_posts_seo.postDate 
					FROM 
						blog_posts_seo,
						blog_post_cats
					WHERE
						 blog_posts_seo.postID = blog_post_cats.postID
						 AND blog_post_cats.catID = :catID
					ORDER BY 
						postID DESC
					' . $pages->get_limit());
    $stmt->execute(array(':catID' => $row['catID']));
    while ($row = $stmt->fetch()) {
        echo '<div>';
        echo '<h1><a href="' . $row['postSlug'] . '">' . $row['postTitle'] . '</a></h1>';
        echo '<p>Posted on ' . date('jS M Y H:i:s', strtotime($row['postDate'])) . ' in ';
        $stmt2 = $db->prepare('SELECT catTitle, catSlug	FROM blog_cats, blog_post_cats WHERE blog_cats.catID = blog_post_cats.catID AND blog_post_cats.postID = :postID');
        $stmt2->execute(array(':postID' => $row['postID']));
        $catRow = $stmt2->fetchAll(PDO::FETCH_ASSOC);
        $links = array();
        foreach ($catRow as $cat) {
            $links[] = "<a href='c-" . $cat['catSlug'] . "'>" . $cat['catTitle'] . "</a>";
        }
        echo implode(", ", $links);
        echo '</p>';
        echo '<p>' . $row['postDesc'] . '</p>';
Exemplo n.º 7
0
try {
    // On affiche 15 membres par page
    $pages = new Paginator('10', 'p');
    $stmt = $db->query('SELECT memberID FROM blog_members');
    $pages->set_total($stmt->rowCount());
    if (isset($_GET['tri'])) {
        $tri = htmlentities($_GET['tri']);
    } else {
        $tri = 'memberID';
    }
    if (isset($_GET['ordre'])) {
        $ordre = htmlentities($_GET['ordre']);
    } else {
        $ordre = 'DESC';
    }
    $stmt = $db->query('SELECT * FROM blog_members,xbt_users WHERE blog_members.memberID=xbt_users.uid AND blog_members.username != "visiteur" ORDER BY ' . $tri . ' ' . $ordre . ' ' . $pages->get_limit());
    while ($row = $stmt->fetch()) {
        // On affiche des couleurs de row alternées
        //$tablerow = ++$i % 2 ? 'tableRow1':'tableRow2';
        //$x++;
        //$tablerow = ($x%2 == 0)? 'tableRow1': 'tableRow2';
        //echo '<tr class="'.$tablerow.'">';
        echo '<tr>';
        if (!empty($row['avatar'])) {
            echo '<td style="font-weight: bold; font-size: 14px;"><img src="' . SITEURL . '/images/avatars/' . $row['avatar'] . '" alt="' . $row['username'] . '" style="float: left; margin-right: 5px; width: 30px; height: 30px;" /><a href="admin/profil.php?membre=' . $row['username'] . '">' . $row['username'] . '</a></td>';
        } else {
            echo '<td style="font-weight: bold; font-size: 14px;"><img src="' . SITEURL . '/images/avatars/avatar.png" alt="' . $row['username'] . '" style="float: left; margin-right: 5px; width: 30px; height: 30px;" /><a href="admin/profil.php?membre=' . $row['username'] . '">' . $row['username'] . '</a></td>';
        }
        sscanf($row['memberDate'], "%4s-%2s-%2s %2s:%2s:%2s", $annee, $mois, $jour, $heure, $minute, $seconde);
        echo '<td style="font-size: 12px;">' . $jour . '-' . $mois . '-' . $annee . ' à ' . $heure . ':' . $minute . ':' . $seconde . '</td>';
        echo '<td style="text-align: center;">' . makesize($row['uploaded']) . '</td>';
Exemplo n.º 8
0
    echo '<h3>Catégorie ' . $_GET['action'] . '.</h3>';
}
?>

        <table>
        <tr>
                <th>Titre</th>
                <th>Action</th>
        </tr>
        <?php 
try {
    $pages = new Paginator('10', 'p');
    $stmt = $db->query('SELECT catID FROM blog_cats');
    //pass number of records to
    $pages->set_total($stmt->rowCount());
    $stmt = $db->query('SELECT catID, catTitle, catSlug FROM blog_cats ORDER BY catTitle ASC ' . $pages->get_limit());
    while ($row = $stmt->fetch()) {
        echo '<tr>';
        echo '<td style="width: 80%;">' . $row['catTitle'] . '</td>';
        ?>

                                <td>
                                        <a style="text-decoration: none;" href="edit-category.php?id=<?php 
        echo $row['catID'];
        ?>
"><input type="button" class="button" value="Edit."></a> |
                                        <a style="text-decoration: none;" href="javascript:delcat('<?php 
        echo $row['catID'];
        ?>
','<?php 
        echo $row['catSlug'];
Exemplo n.º 9
0
 function displayView($view, $id = 0)
 {
     $tpl_vars = array();
     switch ($view) {
         case 'about':
             break;
         case 'config':
             $dev_infos = $this->_getPocheVersion('dev');
             $dev = trim($dev_infos[0]);
             $check_time_dev = date('d-M-Y H:i', $dev_infos[1]);
             $prod_infos = $this->_getPocheVersion('prod');
             $prod = trim($prod_infos[0]);
             $check_time_prod = date('d-M-Y H:i', $prod_infos[1]);
             $compare_dev = version_compare(POCHE, $dev);
             $compare_prod = version_compare(POCHE, $prod);
             $themes = $this->tpl->getInstalledThemes();
             $languages = $this->language->getInstalledLanguages();
             $token = $this->user->getConfigValue('token');
             $http_auth = isset($_SERVER['PHP_AUTH_USER']) || isset($_SERVER['REMOTE_USER']) ? true : false;
             $only_user = $this->store->listUsers() > 1 ? false : true;
             $tpl_vars = array('themes' => $themes, 'languages' => $languages, 'dev' => $dev, 'prod' => $prod, 'check_time_dev' => $check_time_dev, 'check_time_prod' => $check_time_prod, 'compare_dev' => $compare_dev, 'compare_prod' => $compare_prod, 'token' => $token, 'user_id' => $this->user->getId(), 'http_auth' => $http_auth, 'only_user' => $only_user);
             Tools::logm('config view');
             break;
         case 'edit-tags':
             # tags
             $entry = $this->store->retrieveOneById($id, $this->user->getId());
             if (!$entry) {
                 $this->messages->add('e', _('Article not found!'));
                 Tools::logm('error : article not found');
                 Tools::redirect();
             }
             $tags = $this->store->retrieveTagsByEntry($id);
             $tpl_vars = array('entry_id' => $id, 'tags' => $tags, 'entry' => $entry);
             break;
         case 'tags':
             $token = $this->user->getConfigValue('token');
             //if term is set - search tags for this term
             $term = Tools::checkVar('term');
             $tags = $this->store->retrieveAllTags($this->user->getId(), $term);
             if (Tools::isAjaxRequest()) {
                 $result = array();
                 foreach ($tags as $tag) {
                     $result[] = $tag['value'];
                 }
                 echo json_encode($result);
                 exit;
             }
             $tpl_vars = array('token' => $token, 'user_id' => $this->user->getId(), 'tags' => $tags);
             break;
         case 'search':
             if (isset($_GET['search'])) {
                 $search = filter_var($_GET['search'], FILTER_SANITIZE_STRING);
                 $tpl_vars['entries'] = $this->store->search($search, $this->user->getId());
                 $count = count($tpl_vars['entries']);
                 $this->pagination->set_total($count);
                 $page_links = str_replace(array('previous', 'next'), array(_('previous'), _('next')), $this->pagination->page_links('?view=' . $view . '?search=' . $search . '&sort=' . $_SESSION['sort'] . '&'));
                 $tpl_vars['page_links'] = $page_links;
                 $tpl_vars['nb_results'] = $count;
                 $tpl_vars['searchterm'] = $search;
             }
             break;
         case 'view':
             $entry = $this->store->retrieveOneById($id, $this->user->getId());
             if ($entry != NULL) {
                 Tools::logm('view link #' . $id);
                 $content = $entry['content'];
                 if (function_exists('tidy_parse_string')) {
                     $tidy = tidy_parse_string($content, array('indent' => true, 'show-body-only' => true), 'UTF8');
                     $tidy->cleanRepair();
                     $content = $tidy->value;
                 }
                 # flattr checking
                 $flattr = NULL;
                 if (FLATTR) {
                     $flattr = new FlattrItem();
                     $flattr->checkItem($entry['url'], $entry['id']);
                 }
                 # tags
                 $tags = $this->store->retrieveTagsByEntry($entry['id']);
                 $tpl_vars = array('entry' => $entry, 'content' => $content, 'flattr' => $flattr, 'tags' => $tags);
             } else {
                 Tools::logm('error in view call : entry is null');
             }
             break;
         default:
             # home, favorites, archive and tag views
             $tpl_vars = array('entries' => '', 'page_links' => '', 'nb_results' => '', 'listmode' => isset($_COOKIE['listmode']) ? true : false);
             //if id is given - we retrieve entries by tag: id is tag id
             if ($id) {
                 $tpl_vars['tag'] = $this->store->retrieveTag($id, $this->user->getId());
                 $tpl_vars['id'] = intval($id);
             }
             $count = $this->store->getEntriesByViewCount($view, $this->user->getId(), $id);
             if ($count > 0) {
                 $this->pagination->set_total($count);
                 $page_links = str_replace(array('previous', 'next'), array(_('previous'), _('next')), $this->pagination->page_links('?view=' . $view . '&sort=' . $_SESSION['sort'] . ($id ? '&id=' . $id : '') . '&'));
                 $tpl_vars['entries'] = $this->store->getEntriesByView($view, $this->user->getId(), $this->pagination->get_limit(), $id);
                 $tpl_vars['page_links'] = $page_links;
                 $tpl_vars['nb_results'] = $count;
             }
             Tools::logm('display ' . $view . ' view');
             break;
     }
     return $tpl_vars;
 }
Exemplo n.º 10
0
        //echo $pages->page_links('?membre='.$row['username'].'&');
        echo $pages->page_links('?membre=' . $row['username'] . '&tri=' . $tri . '&ordre=' . $ordre . '&');
        echo '</div>';
        ?>

<br />


<!-- Messages internes -->
<?php 
        $pages = new Paginator('5', 'm');
        $stmt = $db->prepare('SELECT messages_id FROM blog_messages WHERE messages_id_destinataire = :destinataire');
        $stmt->execute(array(':destinataire' => $row['memberID']));
        $pages->set_total($stmt->rowCount());
        // on prépare une requete SQL cherchant le titre, la date, l'expéditeur des messages pour le membre connecté
        $stmt = $db->prepare('SELECT blog_messages.messages_titre, blog_messages.messages_date, blog_members.username as expediteur, blog_messages.messages_id as id_message FROM blog_messages, blog_members WHERE blog_messages.messages_id_destinataire = :id_destinataire AND blog_messages.messages_id_expediteur = blog_members.memberID ORDER BY blog_messages.messages_date DESC ' . $pages->get_limit());
        $stmt->execute(array(':id_destinataire' => $row['memberID']));
        ?>

<table>
	<tr>
		<td colspan="5">
			<h3 id="messages">Vos messages : 
				<a style="text-decoration: none;" href="<?php 
        echo SITEURL;
        ?>
/messages_envoyer.php"><input type="button" class="button" value="Envoyer un message à un membre" /></a>
			</h3>
		</td>
	</tr>
	<tr>
Exemplo n.º 11
0
		</div>
<?php
}
*/
?>
		
		<br />
		<div><h2>Les derniers torrents</h2></div>

	<?php 
try {
    $pages = new Paginator('7', 'p');
    $stmt = $db->query('SELECT postID FROM blog_posts_seo');
    //pass number of records to
    $pages->set_total($stmt->rowCount());
    $stmt = $db->query('SELECT postID,postTitle,postAuthor,postSlug,postDesc,postDate,postImage,postViews FROM blog_posts_seo ORDER BY postID DESC ' . $pages->get_limit());
    while ($row = $stmt->fetch()) {
        echo '<fieldset>';
        echo '<div style="margin-top: 10px;">';
        echo '<span style="font-size: 17px; font-weight: bold; padding: 5px 0 0 10px;"><a style="text-decoration: none; color: black;" href="' . stripslashes(htmlspecialchars($row['postSlug'])) . '">' . stripslashes(htmlspecialchars($row['postTitle'])) . '</a></span><br />';
        sscanf($row['postDate'], "%4s-%2s-%2s %2s:%2s:%2s", $annee, $mois, $jour, $heure, $minute, $seconde);
        echo '<span style="font-size: 7pt; padding: 5px 0 0 10px;">';
        echo '<img src="images/date.png" style="vertical-align: bottom; margin-top: 5px;" alt="Date" /> ' . $jour . '-' . $mois . '-' . $annee . ' <img src="images/meta-separator.png" style="margin-left: 4px; margin-right: 4px;" alt="" /> <img src="images/author.png" style="vertical-align: bottom;" alt="Auteur" />';
        echo '<a style="text-decoration: none;" href="' . SITEURL . '/admin/profil.php?membre=' . stripslashes(htmlspecialchars($row['postAuthor'])) . '">' . stripslashes(htmlspecialchars($row['postAuthor'])) . '</a>';
        $stmt2 = $db->prepare('SELECT catTitle, catSlug FROM blog_cats, blog_post_cats WHERE blog_cats.catID = blog_post_cats.catID AND blog_post_cats.postID = :postID');
        $stmt2->execute(array(':postID' => $row['postID']));
        $catRow = $stmt2->fetchAll(PDO::FETCH_ASSOC);
        $links = array();
        foreach ($catRow as $cat) {
            $links[] = "<a style=\"text-decoration: none;\" href='c-" . htmlspecialchars($cat['catSlug']) . "'>" . htmlspecialchars($cat['catTitle']) . "</a>";
        }
Exemplo n.º 12
0
 function displayView($view, $id = 0)
 {
     $tpl_vars = array();
     switch ($view) {
         case 'about':
             break;
         case 'config':
             $dev_infos = $this->_getPocheVersion('dev');
             $dev = trim($dev_infos[0]);
             $check_time_dev = date('d-M-Y H:i', $dev_infos[1]);
             $prod_infos = $this->_getPocheVersion('prod');
             $prod = trim($prod_infos[0]);
             $check_time_prod = date('d-M-Y H:i', $prod_infos[1]);
             $compare_dev = version_compare(POCHE, $dev);
             $compare_prod = version_compare(POCHE, $prod);
             $themes = $this->tpl->getInstalledThemes();
             $languages = $this->language->getInstalledLanguages();
             $token = $this->user->getConfigValue('token');
             $http_auth = isset($_SERVER['REMOTE_USER']);
             $only_user = $this->store->listUsers() > 1 ? false : true;
             $https = substr(Tools::getPocheUrl(), 0, 5) == 'https';
             $tpl_vars = array('themes' => $themes, 'languages' => $languages, 'dev' => $dev, 'prod' => $prod, 'check_time_dev' => $check_time_dev, 'check_time_prod' => $check_time_prod, 'compare_dev' => $compare_dev, 'compare_prod' => $compare_prod, 'token' => $token, 'user_id' => $this->user->getId(), 'http_auth' => $http_auth, 'only_user' => $only_user, 'https' => $https);
             Tools::logm('config view');
             break;
         case 'edit-tags':
             # tags
             $entry = $this->store->retrieveOneById($id, $this->user->getId());
             if (!$entry) {
                 $this->messages->add('e', _('Article not found!'));
                 Tools::logm('error : article not found');
                 Tools::redirect();
             }
             $tags = $this->store->retrieveTagsByEntry($id);
             $all_tags = $this->store->retrieveAllTags($this->user->getId());
             $maximus = 0;
             foreach ($all_tags as $eachtag) {
                 // search for the most times a tag is present
                 if ($eachtag["entriescount"] > $maximus) {
                     $maximus = $eachtag["entriescount"];
                 }
             }
             foreach ($all_tags as $key => $eachtag) {
                 // get the percentage of presence of each tag
                 $percent = floor($eachtag["entriescount"] / $maximus * 100);
                 if ($percent < 20) {
                     // assign a css class, depending on the number of entries count
                     $cssclass = 'smallesttag';
                 } elseif ($percent >= 20 and $percent < 40) {
                     $cssclass = 'smalltag';
                 } elseif ($percent >= 40 and $percent < 60) {
                     $cssclass = 'mediumtag';
                 } elseif ($percent >= 60 and $percent < 80) {
                     $cssclass = 'largetag';
                 } else {
                     $cssclass = 'largesttag';
                 }
                 $all_tags[$key]['cssclass'] = $cssclass;
             }
             $tpl_vars = array('entry_id' => $id, 'tags' => $tags, 'alltags' => $all_tags, 'entry' => $entry);
             break;
         case 'tags':
             $token = $this->user->getConfigValue('token');
             //if term is set - search tags for this term
             $term = Tools::checkVar('term');
             $tags = $this->store->retrieveAllTags($this->user->getId(), $term);
             if (Tools::isAjaxRequest()) {
                 $result = array();
                 foreach ($tags as $tag) {
                     $result[] = $tag['value'];
                 }
                 echo json_encode($result);
                 exit;
             }
             $tpl_vars = array('token' => $token, 'user_id' => $this->user->getId(), 'tags' => $tags);
             break;
         case 'search':
             if (isset($_GET['search'])) {
                 $search = filter_var($_GET['search'], FILTER_SANITIZE_STRING);
                 $tpl_vars['entries'] = $this->store->search($search, $this->user->getId());
                 $count = count($tpl_vars['entries']);
                 $this->pagination->set_total($count);
                 $page_links = str_replace(array('previous', 'next'), array(_('previous'), _('next')), $this->pagination->page_links('?view=' . $view . '?search=' . $search . '&sort=' . $_SESSION['sort'] . '&'));
                 $tpl_vars['page_links'] = $page_links;
                 $tpl_vars['nb_results'] = $count;
                 $tpl_vars['searchterm'] = $search;
             }
             break;
         case 'view':
             $entry = $this->store->retrieveOneById($id, $this->user->getId());
             if ($entry != NULL) {
                 Tools::logm('view link #' . $id);
                 $content = $entry['content'];
                 if (function_exists('tidy_parse_string')) {
                     $tidy = tidy_parse_string($content, array('indent' => true, 'show-body-only' => true), 'UTF8');
                     $tidy->cleanRepair();
                     $content = $tidy->value;
                 }
                 # flattr checking
                 $flattr = NULL;
                 if (FLATTR) {
                     $flattr = new FlattrItem();
                     $flattr->checkItem($entry['url'], $entry['id']);
                 }
                 # previous and next
                 $previous = FALSE;
                 $previous_id = $this->store->getPreviousArticle($id, $this->user->getId());
                 $next = FALSE;
                 $next_id = $this->store->getNextArticle($id, $this->user->getId());
                 if ($this->store->retrieveOneById($previous_id, $this->user->getId())) {
                     $previous = TRUE;
                 }
                 if ($this->store->retrieveOneById($next_id, $this->user->getId())) {
                     $next = TRUE;
                 }
                 $navigate = array('previous' => $previous, 'previousid' => $previous_id, 'next' => $next, 'nextid' => $next_id);
                 # tags
                 $tags = $this->store->retrieveTagsByEntry($entry['id']);
                 $tpl_vars = array('entry' => $entry, 'content' => $content, 'flattr' => $flattr, 'tags' => $tags, 'navigate' => $navigate);
             } else {
                 Tools::logm('error in view call : entry is null');
             }
             break;
         default:
             # home, favorites, archive and tag views
             $tpl_vars = array('entries' => '', 'page_links' => '', 'nb_results' => '', 'listmode' => isset($_COOKIE['listmode']) ? true : false, 'view' => $view);
             //if id is given - we retrieve entries by tag: id is tag id
             if ($id) {
                 $tpl_vars['tag'] = $this->store->retrieveTag($id, $this->user->getId());
                 $tpl_vars['id'] = intval($id);
             }
             $count = $this->store->getEntriesByViewCount($view, $this->user->getId(), $id);
             if ($count && $count > 0) {
                 $this->pagination->set_total($count);
                 $page_links = str_replace(array('previous', 'next'), array(_('previous'), _('next')), $this->pagination->page_links('?view=' . $view . '&sort=' . $_SESSION['sort'] . ($id ? '&id=' . $id : '') . '&'));
                 $tpl_vars['entries'] = $this->store->getEntriesByView($view, $this->user->getId(), $this->pagination->get_limit(), $id);
                 $tpl_vars['page_links'] = $page_links;
                 $tpl_vars['nb_results'] = $count;
             }
             Tools::logm('display ' . $view . ' view');
             break;
     }
     return $tpl_vars;
 }
Exemplo n.º 13
0
				</h1>
				<h2>days until Auburn Basketball<br/><em>November 13, 2015 vs UAB</em></h2>
			</div>
		</div>
	</div>
	<div id="wrapper" class="container-fluid">
		<div id="main" class="row">
			<div id="posts-outer" class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
				<div class="row">
			<?php 
try {
    $pages = new Paginator('12', 'p');
    $stmt = $db->query('SELECT postID FROM blog_posts');
    //pass number of records to
    $pages->set_total($stmt->rowCount());
    $stmt = $db->query('SELECT postID, postAuthor, postTitle, postImage, postSlug, postDescription, postDate FROM blog_posts ORDER BY postID DESC ' . $pages->get_limit());
    $adCount = 3;
    while ($row = $stmt->fetch()) {
        echo '<div class="postsOuter col-lg-3 col-md-6 col-sm-6 col-xs-12">';
        echo '<div class="posts">';
        echo '<h2><a href="' . $row['postSlug'] . '">' . $row['postTitle'] . '</a></h2>';
        echo '<h4>By <strong>' . $row['postAuthor'] . '</strong> | ' . date('F d, Y', strtotime($row['postDate'])) . ' <br/>';
        $stmt2 = $db->prepare('SELECT catTitle, catSlug	FROM blog_cats, blog_cat_cats WHERE blog_cats.catID = blog_cat_cats.catID AND blog_cat_cats.postID = :postID');
        $stmt2->execute(array(':postID' => $row['postID']));
        $catRow = $stmt2->fetchAll(PDO::FETCH_ASSOC);
        $links = array();
        if (!empty($catRow)) {
            echo 'Tags: ';
        } else {
            echo '&nbsp;';
        }
Exemplo n.º 14
0
    echo '<h3>Licence ' . $_GET['action'] . '.</h3>';
}
?>

        <table>
        <tr>
                <th>Titre</th>
                <th>Action</th>
        </tr>
        <?php 
try {
    $pages = new Paginator('10', 'p');
    $stmt = $db->query('SELECT licenceID FROM blog_licences');
    //pass number of records to
    $pages->set_total($stmt->rowCount());
    $stmt = $db->query('SELECT licenceID, licenceTitle, licenceSlug FROM blog_licences ORDER BY licenceTitle ASC ' . $pages->get_limit());
    while ($row = $stmt->fetch()) {
        echo '<tr>';
        echo '<td style="width: 80%;">' . $row['licenceTitle'] . '</td>';
        ?>

                                <td>
                                        <a style="text-decoration: none;" href="edit-licence.php?id=<?php 
        echo $row['licenceID'];
        ?>
"><input type="button" class="button" value="Edit."</a> |
                                        <a style="text-decoration: none;" href="javascript:dellicence('<?php 
        echo $row['licenceID'];
        ?>
','<?php 
        echo $row['licenceSlug'];