Exemplo n.º 1
0
 protected function doInsert(Content $content)
 {
     $now = time();
     $query = "INSERT INTO albums " . "(slug, title, datecreated, datemodified, status, datedisplayed, newsid, eventid, featuredimageid) " . "VALUES " . "('{$content->getSlug()}','{$content->getTitle()}','{$now}','{$now}','{$content->getStatus()}','{$content->getDateDisplayed()}','{$content->getNewsId()}','{$content->getEventId()}','{$content->getFeaturedImageId()}')";
     self::$mysqli->query($query);
     $content->setId(self::$mysqli->insert_id);
 }
Exemplo n.º 2
0
 protected function doInsert(Content $object)
 {
     $now = time();
     $query = "INSERT INTO newsevents " . "(status, slug, title, datecreated, datemodified, text, description, keywords, datedisplayed, type) " . "VALUES " . "('{$object->getStatus()}', '{$object->getSlug()}','{$object->getTitle()}', '{$now}','{$now}','{$object->getText()}','{$object->getDescription()}','{$object->getKeywords()}','{$object->getDateDisplayed()}','{$object->getContentType()}')";
     //echo $query;
     self::$mysqli->query($query);
     $object->setId(self::$mysqli->insert_id);
 }
Exemplo n.º 3
0
/**
 * Returns the title of the current page.
 * 
 * @package Theme
 * @return string The title. 
 */
function title()
{
    return Content::getTitle();
}
Exemplo n.º 4
0
 public function update(Content $image)
 {
     $now = time();
     $query = "UPDATE images SET " . "slug='{$image->getSlug()}', " . "title='{$image->getTitle()}', " . "datemodified='{$now}', " . "albumid='{$image->getAlbumId()}', " . "filename='{$image->getFileName()}', " . "status='" . Content::STATUS_LIVE . "', " . "prospective='{$image->getProspective()}', " . "current='{$image->getCurrent()}', " . "staff='{$image->getStaff()}' " . "WHERE id={$image->getId()}";
     self::$mysqli->query($query);
 }
Exemplo n.º 5
0
    function setContent($content_body)
    {
        $this->content_body = htmlentities("{$content_body}");
    }
    function getContent()
    {
        return $this->content_body;
    }
}
/* Test Id */
$content = new Content();
$content->setID();
$content->setID();
$content->setID();
$content->setID();
$content->setID();
$content->setID() . '<br/>';
$content->setAuthor('Guillermina', 'Gonjon') . '<br/>';
$content->setTitle("this is my title") . '<br/>';
$content->setContent("This is an example of what this page can do.  This is my content for this page.");
echo $content->getAuthor() . '<br/>';
echo $content->getDate() . '<br/>';
echo $content->getTitle() . '<br/>';
echo $content->getContent() . '<br/>';
$theid = $content->content_id;
echo $content->formatID($theid) . '<br/>';
var_dump($content);
//echo $content->formatted_id.'<br/>';
$output = shell_exec('cal 2016 | grep 2016') . '<br/>';
//echo "<pre>$output</pre>";
//echo "<br>".phpversion().'<br/>';
Exemplo n.º 6
0
 /**
  * Double checks a content slug after a potential title change
  *
  * If the title hasn't changed then return. Else generate a new slug
  * This requires requires n runs to the database, where n is the number of duplicate slugs
  * TODO: Optimize this so we need at most one trip to the database, hint: use LIKE '$newSlug%;
  *
  * @param $content Content the content object who's slug we need to update
  */
 protected function updateSlug(Content $content)
 {
     $oldSlug = $content->getSlug();
     $newSlug = $this->generateSlug($content->getTitle());
     if ($oldSlug == $newSlug) {
         return;
     }
     $suffix = '';
     while ($this->findBySlug($newSlug . $suffix) !== null) {
         if ($suffix == '') {
             $suffix = 1;
         }
         $suffix++;
     }
     $content->setSlug($newSlug . $suffix);
 }