Exemplo n.º 1
0
<?php

include 'app.php';
// import php files
$authUser = new AuthUser();
// get auth user
$authUser->Authenticate('Admin');
Utilities::SetLanguage($authUser->Language);
// set language
?>
<!DOCTYPE html>
<html lang="<?php 
print str_replace('_', '-', $authUser->Language);
?>
">

<head>
	
<title><?php 
print _("Account");
?>
&mdash;<?php 
print $authUser->SiteName;
?>
</title>

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta http-equiv="content-type" content="text/html; charset=utf-8">

<!-- include css -->
<?php 
Exemplo n.º 2
0
<?php

include 'app.php';
// set language to preferred language (HTTP_ACCEPT_LANGUAGE)
$supported = Utilities::GetSupportedLanguages('');
$language = Utilities::GetPreferredLanguage($supported);
Utilities::SetLanguage($language);
?>
<!DOCTYPE html>
<html lang="<?php 
print str_replace('_', '-', $language);
?>
">

<head>
	
<title><?php 
print _("Login");
?>
&mdash;<?php 
print BRAND;
?>
</title>

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta http-equiv="content-type" content="text/html; charset=utf-8">

<!-- include styles -->
<?php 
include 'modules/css.php';
?>
Exemplo n.º 3
0
 public static function BuildSearchIndex($site, $page, $language, $isDefaultLanguage, $content, $root = '../')
 {
     $html = str_get_html($content, true, true, DEFAULT_TARGET_CHARSET, false, DEFAULT_BR_TEXT);
     $url = $page['FriendlyId'];
     $isSecure = 0;
     $image = $page['Image'];
     if ($page['PageTypeId'] != -1) {
         $pageType = PageType::GetByPageTypeId($page['PageTypeId']);
         $url = $pageType['FriendlyId'] . '/' . $page['FriendlyId'];
         if ($pageType['IsSecure'] == 1) {
             $isSecure = 1;
         }
     }
     if ($isDefaultLanguage == false) {
         // set language to the domain for the site
         $domain = $root . 'sites/' . $site['FriendlyId'] . '/locale';
         // set the language
         Utilities::SetLanguage($language, $domain);
     }
     $name = $page['Name'];
     $text = '';
     $h1s = '';
     $h2s = '';
     $h3s = '';
     $description = $page['Description'];
     if ($isDefaultLanguage == false) {
         $name = _($name);
         // get translated version
         $description = _($description);
     }
     if ($html == null) {
         return '';
     }
     // setup gettext blockquote, h1, h2, h3, p, td, th, li, meta tags for multi-lingual support
     foreach ($html->find('blockquote') as $el) {
         if ($isDefaultLanguage == false) {
             $text .= _($el->innertext) . ' ';
             // get translated version
         } else {
             $text .= $el->innertext . ' ';
         }
     }
     foreach ($html->find('h1') as $el) {
         if ($isDefaultLanguage == false) {
             $h1s .= _($el->innertext) . ' ';
             // get translated version
         } else {
             $h1s .= $el->innertext . ' ';
         }
     }
     foreach ($html->find('h2') as $el) {
         if ($isDefaultLanguage == false) {
             $h2s .= _($el->innertext) . ' ';
             // get translated version
         } else {
             $h2s .= $el->innertext . ' ';
         }
     }
     foreach ($html->find('h3') as $el) {
         if ($isDefaultLanguage == false) {
             $h3s .= _($el->innertext) . ' ';
             // get translated version
         } else {
             $h3s .= $el->innertext . ' ';
         }
     }
     foreach ($html->find('p') as $el) {
         if ($isDefaultLanguage == false) {
             $text .= _($el->innertext) . ' ';
             // get translated version
         } else {
             $text .= $el->innertext . ' ';
         }
     }
     foreach ($html->find('td') as $el) {
         if ($isDefaultLanguage == false) {
             $text .= _($el->innertext) . ' ';
             // get translated version
         } else {
             $text .= $el->innertext . ' ';
         }
     }
     foreach ($html->find('th') as $el) {
         if ($isDefaultLanguage == false) {
             $text .= _($el->innertext) . ' ';
             // get translated version
         } else {
             $text .= $el->innertext . ' ';
         }
     }
     foreach ($html->find('li') as $el) {
         if ($isDefaultLanguage == false) {
             $text .= _($el->innertext) . ' ';
             // get translated version
         } else {
             $text .= $el->innertext . ' ';
         }
     }
     foreach ($html->find('meta[name=description]') as $el) {
         if ($isDefaultLanguage == false) {
             $description = _($el->innertext);
             // get translated version
         } else {
             $description = $el->innertext;
         }
     }
     // strip any html
     $h1s = strip_tags($h1s);
     $h2s = strip_tags($h2s);
     $h3s = strip_tags($h3s);
     $description = strip_tags($description);
     $text = strip_tags($text);
     // add to search index
     SearchIndex::Add($page['PageUniqId'], $site['SiteUniqId'], $language, $url, $name, $image, $isSecure, $h1s, $h2s, $h3s, $description, $text);
 }
Exemplo n.º 4
0
 /**
  * @method POST
  */
 function get()
 {
     parse_str($this->request->data, $request);
     // parse request
     $siteUniqId = SITE_UNIQ_ID;
     $pageUniqId = $request['pageUniqId'];
     $prefix = $request['prefix'];
     // handle reverse lookup
     if (strpos($pageUniqId, 'lookup:') !== FALSE) {
         $url = str_replace('lookup:', '', $pageUniqId);
         $page = Page::GetByUrl($url, SITE_ID);
         if ($page != NULL) {
             $pageUniqId = $page['PageUniqId'];
         }
     }
     // get language
     $language = 'en';
     if (isset($request['language'])) {
         $language = $request['language'];
     }
     $site = Site::GetBySiteUniqId($siteUniqId);
     // get fragment
     $fragment = '../fragments/render/' . $pageUniqId . '.php';
     if (file_exists($fragment)) {
         // set language to the domain for the site
         $domain = '../locale';
         Utilities::SetLanguage($language, $domain);
         ob_start();
         // start output buffer
         textdomain($domain);
         include $fragment;
         $content = ob_get_contents();
         // get contents of buffer
         ob_end_clean();
         // fix nested, relative URLs if displayed in the root
         if ($prefix == '') {
             $content = str_replace('src="../', 'src="', $content);
             $content = str_replace('href="../', 'href="', $content);
         }
         // update images with sites/[name] to a relative URL
         $content = str_replace('src="sites/' . $site['FriendlyId'] . '/', 'src="' . $prefix, $content);
         // return html response
         $response = new Tonic\Response(Tonic\Response::OK);
         $response->contentType = 'text/html';
         $response->body = $content;
         return $response;
     } else {
         return new Tonic\Response(Tonic\Response::NOTFOUND);
     }
 }
Exemplo n.º 5
0
<?php

// debugging
define('DEBUG', false);
if (DEBUG) {
    error_reporting(E_ALL);
    ini_set('display_errors', '1');
} else {
    error_reporting(E_ERROR | E_PARSE);
}
session_start();
// authenticate secure pages
if ($isSecure == true) {
    $siteAuthUser = new SiteAuthUser($siteFriendlyId, $rootPrefix, $pageUrl);
    // get auth user
    $siteAuthUser->Authenticate($pageTypeUniqId, $rootPrefix, $pageUrl);
}
// get supported language
$supported = Utilities::GetSupportedLanguages($rootPrefix);
// check if multiple languages are supported
if (count($supported) > 1) {
    if (isset($_SESSION[$siteFriendlyId . '.Language'])) {
        $language = $_SESSION[$siteFriendlyId . '.Language'];
    } else {
        // set language as the default language
        $_SESSION[$siteFriendlyId . '.Language'] = $language;
    }
}
Utilities::SetLanguage($language, $rootPrefix . 'locale');