Exemplo n.º 1
0
 public function parseData(Website $website, $id)
 {
     $settingsArray = [];
     // Title
     $settingsArray["title"] = trim($website->getRequestString("title_" . $id, ""));
     // Amount
     $settingsArray["amount"] = $website->getRequestInt("amount_" . $id, 5);
     $amount = $settingsArray["amount"];
     if (!Validate::range($amount, self::MIN_COMMENTS, self::MAX_COMMENTS)) {
         $settingsArray["valid"] = false;
         $website->addError($website->t("comments.count") . " " . Validate::getLastError($website));
     }
     return $settingsArray;
 }
Exemplo n.º 2
0
 public function getPageContent(Website $website, Request $request)
 {
     $page = max(0, $website->getRequestInt("id", 0));
     $usersCount = $website->getAuth()->getUserRepository()->getRegisteredUsersCount();
     // Check page id
     if (!$this->check_valid_page_id($website, $page, $usersCount)) {
         return "";
     }
     // Display user count
     $textToDisplay = "<p>" . $website->tReplaced("users.there_are_num_registered_users", $usersCount) . "</p>";
     if ($usersCount == 1) {
         $textToDisplay = "<p>" . $website->t("users.there_is_one_registered_user") . "</p>";
     }
     // Display menu bar
     $textToDisplay .= $this->get_menu_bar($website, $page, $usersCount);
     // Users table
     $start = $page * self::USERS_PER_PAGE;
     $textToDisplay .= $this->get_users_table($website, $start);
     // Link to admin page
     $textToDisplay .= '<p><br /><a class="arrow" href="' . $website->getUrlPage('admin') . '">' . $website->t("main.admin") . '</a></p>';
     return $textToDisplay;
 }
Exemplo n.º 3
0
<?php

namespace Rcms\Core;

use DateTime;
use Rcms\Template\DatePickerTemplate;
use Zend\Diactoros\Stream;
// Setup environment
require __DIR__ . "/environment.php";
$website = new Website();
//JAAR- EN MAANDLIJST
$selectedMonth = $website->getRequestInt("month", date('n'));
//geselecteerd of huidig
$selectedYear = $website->getRequestInt("year", date('Y'));
//geselecteerd of huidig
$dateTime = DateTime::createFromFormat("n Y", $selectedMonth . " " . $selectedYear);
//OBJECTEN
$oArticles = new ArticleRepository($website);
$articles = $oArticles->getArticlesDataCalendarMonth($dateTime);
$calendarTemplate = new DatePickerTemplate($website->getText(), $dateTime, $articles);
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link href="<?php 
echo $website->getUrlActiveTheme();
?>
main.css" rel="stylesheet" type="text/css" />
        <link href="<?php 
echo $website->getUrlMain();
Exemplo n.º 4
0
<?php

namespace Rcms\Core;

use DateTime;
// Correct header
header("Content-type: application/rss+xml");
// Setup environment
require __DIR__ . "/environment.php";
// Objects
$website = new Website();
$oArticles = new ArticleRepository($website);
// Get category
$category_id = $website->getRequestInt("category");
// Get the data
$articles = $oArticles->getArticlesData($category_id, 15);
// Parse it
$textToDisplay = '';
if ($articles) {
    foreach ($articles as $article) {
        $pubdate = $article->getDateCreated()->format(DateTime::RSS);
        $textToDisplay .= "<item>\n";
        $textToDisplay .= "  <title>" . htmlSpecialChars($article->getTitle()) . "</title>\n";
        $textToDisplay .= "  <link>" . $website->getUrlPage('article', $article->getId()) . "</link>\n";
        $textToDisplay .= "  <description>" . htmlSpecialChars($article->getIntro()) . "</description>\n";
        $textToDisplay .= "  <pubDate>" . htmlSpecialChars($pubdate) . "</pubDate>\n";
        $textToDisplay .= "  <author>" . htmlSpecialChars($article->author) . "</author>\n";
        $textToDisplay .= "  <image>" . htmlSpecialChars($article->featuredImage) . "</image>\n";
        $textToDisplay .= "  <category>" . htmlSpecialChars($article->category) . "</category>\n";
        $textToDisplay .= "</item>\n\n";
    }