Ejemplo n.º 1
0
 public function AssertURL($http_response_code = 301, $currentOnly = true)
 {
     if (!$currentOnly || get_class($this) == utopia::GetCurrentModule()) {
         $url = $this->GetURL($_GET);
         $checkurl = $_SERVER['REQUEST_URI'];
         if ($this->isSecurePage && !utopia::IsRequestSecure() || $checkurl !== $url) {
             $abs = '';
             if ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') != $this->isSecurePage) {
                 $layer = 'http';
                 if ($this->isSecurePage) {
                     $layer .= 's';
                 }
                 $abs = $layer . '://' . utopia::GetDomainName();
             }
             header('Cache-Control: no-store, no-cache, must-revalidate');
             // don't cache redirects
             header('Location: ' . $abs . $url, true, $http_response_code);
             die;
         }
     }
 }
Ejemplo n.º 2
0
 public function ProcessDomDocument($o, $e, $doc)
 {
     $head = $doc->getElementsByTagName('head')->item(0);
     // add OG protocol
     if (isset($_GET['news_id'])) {
         $rec = $this->LookupRecord($_GET['news_id']);
         $img = 'http://' . utopia::GetDomainName() . uBlob::GetLink(get_class($this), 'image', $rec['news_id']);
         $meta = $doc->createElement('meta');
         $meta->setAttribute('property', 'og:title');
         $meta->setAttribute('content', $rec['heading']);
         $head->appendChild($meta);
         $meta = $doc->createElement('meta');
         $meta->setAttribute('property', 'og:type');
         $meta->setAttribute('content', 'article');
         $head->appendChild($meta);
         $meta = $doc->createElement('meta');
         $meta->setAttribute('property', 'og:url');
         $meta->setAttribute('content', 'http://' . utopia::GetDomainName() . $_SERVER['REQUEST_URI']);
         $head->appendChild($meta);
         if ($rec['image']) {
             // image exists?
             $meta = $doc->createElement('meta');
             $meta->setAttribute('property', 'og:image');
             $meta->setAttribute('content', $img);
             $head->appendChild($meta);
         }
         $meta = $doc->createElement('meta');
         $meta->setAttribute('property', 'og:site_name');
         $meta->setAttribute('content', modOpts::GetOption('site_name'));
         $head->appendChild($meta);
         $meta = $doc->createElement('meta');
         $meta->setAttribute('property', 'og:description');
         $meta->setAttribute('content', $rec['description']);
         $head->appendChild($meta);
     }
     // add RSS link
     $rssobj = utopia::GetInstance('module_NewsRSS');
     $link = $doc->createElement('link');
     $link->setAttribute('rel', 'alternate');
     $link->setAttribute('type', 'application/atom+xml');
     $link->setAttribute('title', modOpts::GetOption('site_name') . ' News Feed');
     $link->setAttribute('href', $rssobj->GetURL());
     $head->appendChild($link);
 }
Ejemplo n.º 3
0
 function GetTitle()
 {
     return (isset($_GET['q']) ? $_GET['q'] . ' - ' : '') . utopia::GetDomainName() . ' search';
 }
Ejemplo n.º 4
0
 static function InitSitemap()
 {
     $o = utopia::GetInstance(__CLASS__);
     $rows = self::fetchAll();
     foreach ($rows as $row) {
         if ($row['noindex']) {
             continue;
         }
         // is published
         if ($row['content_time'] == '0000-00-00 00:00:00' && !$row['is_published']) {
             continue;
         }
         if (!$row['is_published']) {
             continue;
         }
         $title = $row['nav_text'] ? $row['nav_text'] : $row['title'];
         $url = $o->GetURL($row['cms_id']);
         // add to menu
         if (!$row['hide']) {
             uMenu::AddItem($row['cms_id'], $title, $url, $row['parent'], array('class' => strtolower($row['cms_id'])), $row['position']);
         }
         // add to sitemap
         $additional = array();
         if ($row['is_home']) {
             $additional['priority'] = 1;
         }
         uSitemap::AddItem('http://' . utopia::GetDomainName() . $url, $additional);
     }
 }