public static function GetInstance()
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new Helper();
     }
     return self::$_instance;
 }
 /**
  * Returns an associative Array from The Query
  * @method Get
  * @param  	int 	$Page		The Page to get
  * @param 	int 	$PerPage 	Entrys per Page
  * @return array
  */
 public function Get($Page, $PerPage)
 {
     $PageCount = HelperSingleton::GetInstance()->ExecQuery('SELECT COUNT(*) AS anzahl FROM `w3_blogposts`')[0];
     $_PageData = HelperSingleton::GetInstance()->Pagination($PageCount['anzahl'], $Page, $PerPage);
     $Data = HelperSingleton::GetInstance()->ExecPreparedQuery('SELECT `w3_blogposts`.*, `w3_authors`.`name` as author FROM `w3_blogposts` JOIN `w3_authors` ON `w3_blogposts`.`author_uid` = `w3_authors`.`uid` WHERE `post_public`=? ORDER by `w3_blogposts`.`ts_insert` DESC ' . $_PageData['limit'], array('i', '1'));
     return $Data;
 }
Example #3
0
 /**
  * Load All Authors
  * @method GetAuthors
  * @return array
  */
 public function GetAuthors()
 {
     return HelperSingleton::GetInstance()->ExecQuery('SELECT * FROM `w3_authors`');
 }
Example #4
0
<?php

try {
    if (empty($_GET['page'])) {
        $_GET['page'] = '1';
    }
    // Create Class BlogPostsCollection
    $Collection = new BlogPostsCollection();
    // Return all BlogPost in one Array
    $BlogPosts = $Collection->ToArray($_GET['page'], 5);
    $BlogPostPagination = HelperSingleton::GetInstance()->GetPagination();
    // Create Author Class
    $AuthorsObj = new Authors();
    // Return all Authors
    $AuthorArray = $AuthorsObj->GetAuthors();
} catch (Exception $e) {
    // No Exception Management at this time
}
Example #5
0
 /**
  * Loads one Blog Post by ID
  * @method _Load
  * @param  int $Id ID of the BlogPost
  * @return array     Array of BlogPost Data
  */
 private function _Load($Id)
 {
     return HelperSingleton::GetInstance()->ExecPreparedQuery('SELECT `w3_blogposts`.*, `w3_authors`.`name` as author FROM `w3_blogposts` JOIN `w3_authors` ON `w3_blogposts`.`author_uid` = `w3_authors`.`uid` WHERE `w3_blogposts`.`uid`=?', array('i', filter_var($Id, FILTER_SANITIZE_NUMBER_INT)));
 }
Example #6
0
<?php

// Check if the there is any Data posted
if (!empty($_POST) && $_POST['post_uid'] != "") {
    // Neuen Kommentar einfügen
    try {
        $BlogPostComment = new BlogPost($_POST['post_uid']);
        $BlogPostComment->NewComment($_POST);
        $Notices[] = "Danke für den Kommentar";
    } catch (Exception $e) {
        $Notices[] = $e->getMessage();
    }
}
if (empty($_GET['page'])) {
    $_GET['page'] = '1';
}
// Kommentare laden
try {
    if (!empty($_GET['uid'])) {
        $BlogComment = new BlogPost($_GET['uid']);
        $Comments = $BlogComment->GetComments($_GET['page'], 5);
        $CommentsPagination = HelperSingleton::GetInstance()->GetPagination();
    }
} catch (Exception $e) {
    // No Exception Management at this time
    //$Notices[] = $e->getMessage();
}
Example #7
0
                echo $blogValues['post_image'];
                ?>
" alt="Bild für Beitrag #<?php 
                echo $blogValues['uid'];
                ?>
 <?php 
                echo $blogValues['title'];
                ?>
"/>
									</p>
									<?php 
            }
            ?>
								<p class="blog_text">
									<?php 
            echo HelperSingleton::GetInstance()->TruncateString(htmlspecialchars_decode($blogValues['post_text']), 300);
            ?>
									<a href="showblogpost.php?uid=<?php 
            echo $blogValues['uid'];
            ?>
">mehr...</a>
								</p>
								<div class="comment">
									<button value="<?php 
            echo $blogValues['uid'];
            ?>
">Kommentare anzeigen</button>
									<div class="comment_data"></div>
								</div>
							</div>
							<?php