Esempio n. 1
0
 function parse_parsedinclude($filename)
 {
     // check current level
     if ($this->level > 3) {
         return;
         // max. depth reached (avoid endless loop)
     }
     global $skinid;
     $skin = new SKIN($skinid);
     $file = $this->getIncludeFileName($filename);
     if (!$skin->isValid && !file_exists($file)) {
         return;
     }
     $contents = $skin->getContent($filename);
     if (!$contents) {
         if (!file_exists($file)) {
             return;
         }
         $contents = file_get_contents($file);
         if (empty($contents)) {
             return;
         }
     }
     $this->level = $this->level + 1;
     // parse file contents
     $this->parser->parse($contents);
     $this->level = $this->level - 1;
 }
Esempio n. 2
0
 /**
  * Outputs the XML contents of the export file
  *
  * @param $setHeaders
  *		set to 0 if you don't want to send out headers
  *		(optional, default 1)
  */
 function export($setHeaders = 1)
 {
     if ($setHeaders) {
         // make sure the mimetype is correct, and that the data does not show up
         // in the browser, but gets saved into and XML file (popup download window)
         header('Content-Type: text/xml');
         header('Content-Disposition: attachment; filename="skinbackup.xml"');
         header('Expires: 0');
         header('Pragma: no-cache');
     }
     echo "<nucleusskin>\n";
     // meta
     echo "\t<meta>\n";
     // skins
     foreach ($this->skins as $skinId => $skinName) {
         $skinName = htmlspecialchars($skinName, ENT_QUOTES);
         if (strtoupper(_CHARSET) != 'UTF-8') {
             $skinName = mb_convert_encoding($skinName, 'UTF-8', _CHARSET);
         }
         echo "\t\t" . '<skin name="' . htmlspecialchars($skinName, ENT_QUOTES) . '" />' . "\n";
     }
     // templates
     foreach ($this->templates as $templateId => $templateName) {
         $templateName = htmlspecialchars($templateName, ENT_QUOTES);
         if (strtoupper(_CHARSET) != 'UTF-8') {
             $templateName = mb_convert_encoding($templateName, 'UTF-8', _CHARSET);
         }
         echo "\t\t" . '<template name="' . htmlspecialchars($templateName, ENT_QUOTES) . '" />' . "\n";
     }
     // extra info
     if ($this->info) {
         if (strtoupper(_CHARSET) != 'UTF-8') {
             $skin_info = mb_convert_encoding($this->info, 'UTF-8', _CHARSET);
         } else {
             $skin_info = $this->info;
         }
         echo "\t\t<info><![CDATA[" . $skin_info . "]]></info>\n";
     }
     echo "\t</meta>\n\n\n";
     // contents skins
     foreach ($this->skins as $skinId => $skinName) {
         $skinId = intval($skinId);
         $skinObj = new SKIN($skinId);
         $skinName = htmlspecialchars($skinName, ENT_QUOTES);
         $contentT = htmlspecialchars($skinObj->getContentType(), ENT_QUOTES);
         $incMode = htmlspecialchars($skinObj->getIncludeMode(), ENT_QUOTES);
         $incPrefx = htmlspecialchars($skinObj->getIncludePrefix(), ENT_QUOTES);
         $skinDesc = htmlspecialchars($skinObj->getDescription(), ENT_QUOTES);
         if (strtoupper(_CHARSET) != 'UTF-8') {
             $skinName = mb_convert_encoding($skinName, 'UTF-8', _CHARSET);
             $contentT = mb_convert_encoding($contentT, 'UTF-8', _CHARSET);
             $incMode = mb_convert_encoding($incMode, 'UTF-8', _CHARSET);
             $incPrefx = mb_convert_encoding($incPrefx, 'UTF-8', _CHARSET);
             $skinDesc = mb_convert_encoding($skinDesc, 'UTF-8', _CHARSET);
         }
         echo "\t" . '<skin name="' . $skinName . '" type="' . $contentT . '" includeMode="' . $incMode . '" includePrefix="' . $incPrefx . '">' . "\n";
         echo "\t\t" . '<description>' . $skinDesc . '</description>' . "\n";
         $que = 'SELECT' . '    stype,' . '    scontent ' . 'FROM ' . sql_table('skin') . ' WHERE' . '    sdesc = ' . $skinId;
         $res = sql_query($que);
         while ($partObj = sql_fetch_object($res)) {
             $type = htmlspecialchars($partObj->stype, ENT_QUOTES);
             $cdata = $this->escapeCDATA($partObj->scontent);
             if (strtoupper(_CHARSET) != 'UTF-8') {
                 $type = mb_convert_encoding($type, 'UTF-8', _CHARSET);
                 $cdata = mb_convert_encoding($cdata, 'UTF-8', _CHARSET);
             }
             echo "\t\t" . '<part name="' . $type . '">';
             echo '<![CDATA[' . $cdata . ']]>';
             echo "</part>\n\n";
         }
         echo "\t</skin>\n\n\n";
     }
     // contents templates
     foreach ($this->templates as $templateId => $templateName) {
         $templateId = intval($templateId);
         $templateName = htmlspecialchars($templateName, ENT_QUOTES);
         $templateDesc = htmlspecialchars(TEMPLATE::getDesc($templateId), ENT_QUOTES);
         if (strtoupper(_CHARSET) != 'UTF-8') {
             $templateName = mb_convert_encoding($templateName, 'UTF-8', _CHARSET);
             $templateDesc = mb_convert_encoding($templateDesc, 'UTF-8', _CHARSET);
         }
         echo "\t" . '<template name="' . $templateName . '">' . "\n";
         echo "\t\t" . '<description>' . $templateDesc . "</description>\n";
         $que = 'SELECT' . ' tpartname,' . ' tcontent' . ' FROM ' . sql_table('template') . ' WHERE' . ' tdesc = ' . $templateId;
         $res = sql_query($que);
         while ($partObj = sql_fetch_object($res)) {
             $type = htmlspecialchars($partObj->tpartname, ENT_QUOTES);
             $cdata = $this->escapeCDATA($partObj->tcontent);
             if (strtoupper(_CHARSET) != 'UTF-8') {
                 $type = mb_convert_encoding($type, 'UTF-8', _CHARSET);
                 $cdata = mb_convert_encoding($cdata, 'UTF-8', _CHARSET);
             }
             echo "\t\t" . '<part name="' . $type . '">';
             echo '<![CDATA[' . $cdata . ']]>';
             echo '</part>' . "\n\n";
         }
         echo "\t</template>\n\n\n";
     }
     echo '</nucleusskin>';
 }
Esempio n. 3
0
 /**
  * @todo document this
  */
 function action_skinclone()
 {
     global $member;
     $skinid = intRequestVar('skinid');
     $member->isAdmin() or $this->disallow();
     // 1. read skin to clone
     $skin =& new SKIN($skinid);
     $name = "clone_" . $skin->getName();
     // if a skin with that name already exists:
     if (SKIN::exists($name)) {
         $i = 1;
         while (SKIN::exists($name . $i)) {
             $i++;
         }
         $name .= $i;
     }
     // 2. create skin desc
     $newid = SKIN::createNew($name, $skin->getDescription(), $skin->getContentType(), $skin->getIncludeMode(), $skin->getIncludePrefix());
     // 3. clone
     /*
     $this->skinclonetype($skin, $newid, 'index');
     $this->skinclonetype($skin, $newid, 'item');
     $this->skinclonetype($skin, $newid, 'archivelist');
     $this->skinclonetype($skin, $newid, 'archive');
     $this->skinclonetype($skin, $newid, 'search');
     $this->skinclonetype($skin, $newid, 'error');
     $this->skinclonetype($skin, $newid, 'member');
     $this->skinclonetype($skin, $newid, 'imagepopup');
     */
     $query = "SELECT stype FROM " . sql_table('skin') . " WHERE sdesc = " . $skinid;
     $res = sql_query($query);
     while ($row = sql_fetch_assoc($res)) {
         $this->skinclonetype($skin, $newid, $row['stype']);
     }
     $this->action_skinoverview();
 }
Esempio n. 4
0
File: page.php Progetto: archoo/twfy
    function page_header_mobile()
    {
        // TODO: would be better to set a global switch/env flag to use in page_header(), etc. - oh well this will do for the moment
        global $DATA, $this_page;
        $linkshtml = "";
        $title = '';
        $sitetitle = $DATA->page_metadata($this_page, "sitetitle");
        $keywords_title = '';
        if ($this_page == 'home') {
            $title = $sitetitle . ': ' . $DATA->page_metadata($this_page, "title");
        } else {
            if ($page_subtitle = $DATA->page_metadata($this_page, "subtitle")) {
                $title = $page_subtitle;
            } elseif ($page_title = $DATA->page_metadata($this_page, "title")) {
                $title = $page_title;
            }
            // We'll put this in the meta keywords tag.
            $keywords_title = $title;
            $parent_page = $DATA->page_metadata($this_page, 'parent');
            if ($parent_title = $DATA->page_metadata($parent_page, 'title')) {
                $title .= ": {$parent_title}";
            }
            if ($title == '') {
                $title = $sitetitle;
            } else {
                $title .= ' (' . $sitetitle . ')';
            }
        }
        if (!($metakeywords = $DATA->page_metadata($this_page, "metakeywords"))) {
            $metakeywords = "";
        }
        if (!($metadescription = $DATA->page_metadata($this_page, "metadescription"))) {
            $metadescription = "";
        }
        if ($this_page != "home") {
            $URL = new URL('home');
            $linkshtml = "\t<link rel=\"start\" title=\"Home\" href=\"" . $URL->generate() . "\">\n";
        }
        // Create the next/prev/up links for navigation.
        // Their data is put in the metadata in hansardlist.php
        $nextprev = $DATA->page_metadata($this_page, "nextprev");
        if ($nextprev) {
            // Four different kinds of back/forth links we might build.
            $links = array("first", "prev", "up", "next", "last");
            foreach ($links as $n => $type) {
                if (isset($nextprev[$type]) && isset($nextprev[$type]['listurl'])) {
                    if (isset($nextprev[$type]['body'])) {
                        $linktitle = htmlentities(trim_characters($nextprev[$type]['body'], 0, 40));
                        if (isset($nextprev[$type]['speaker']) && count($nextprev[$type]['speaker']) > 0) {
                            $linktitle = $nextprev[$type]['speaker']['first_name'] . ' ' . $nextprev[$type]['speaker']['last_name'] . ': ' . $linktitle;
                        }
                    } elseif (isset($nextprev[$type]['hdate'])) {
                        $linktitle = format_date($nextprev[$type]['hdate'], SHORTDATEFORMAT);
                    }
                    $linkshtml .= "\t<link rel=\"{$type}\" title=\"{$linktitle}\" href=\"" . $nextprev[$type]['listurl'] . "\">\n";
                }
            }
        }
        // Needs to come before any HTML is output, in case it needs to set a cookie.
        $SKIN = new SKIN();
        $SKIN->set_skin("mobile");
        if (!($keywords = $DATA->page_metadata($this_page, "keywords"))) {
            $keywords = "";
        } else {
            $keywords = "," . $DATA->page_metadata($this_page, "keywords");
        }
        ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	<title><?php 
        echo $title;
        ?>
</title>
	<meta name="description" content="Making parliament easy.">
	<meta name="keywords" content="Parliament, government, House of Representatives, Senate, Senator, MP, Member of Parliament, MPs, Australia, Australian, <?php 
        echo htmlentities($keywords_title) . htmlentities($keywords);
        ?>
">
	<meta name="verify-v1" content="5FBaCDi8kCKdo4s64NEdB5EOJDNc310SwcLLYHmEbgg=">
    <meta name = "viewport" content = "width=device-width; initial-scale=1.0; maximum-scale=1.0" />
	<link rel="author" title="Send feedback" href="mailto:<?php 
        echo str_replace('@', '&#64;', CONTACTEMAIL);
        ?>
">
	<link rel="home" title="Home" href="http://<?php 
        echo DOMAIN;
        ?>
/">
<?php 
        echo $linkshtml;
        $SKIN->output_stylesheets();
        if ($rssurl = $DATA->page_metadata($this_page, 'rss')) {
            // If this page has an RSS feed set.
            ?>
	<link rel="alternate" type="application/rss+xml" title="OpenAustralia RSS" href="http://<?php 
            echo DOMAIN . WEBPATH . $rssurl;
            ?>
">
<?php 
        }
        if (!DEVSITE) {
            ?>

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3107958-3");
pageTracker._initData();
pageTracker._trackPageview();
</script>

<?php 
        }
        ?>

</head>

<?php 
    }
Esempio n. 5
0
    function event_InitSkinParse($data)
    {
        global $blogid, $CONF, $manager;
        $feedurl = array('rss1.xml', 'index.rdf', 'rss2.xml', 'atom.xml');
        $reqPaths = explode('/', serverVar('PATH_INFO'));
        $reqPath = end($reqPaths);
        $feeds = in_array($reqPath, $feedurl, true);
        if (!$feeds) {
            return;
        } else {
            $p_info = trim(serverVar('PATH_INFO'), '/');
            $path_arr = explode('/', $p_info);
            switch (end($path_arr)) {
                case 'rss1.xml':
                case 'index.rdf':
                    $skinName = 'feeds/rss10';
                    break;
                case 'rss2.xml':
                    $skinName = 'feeds/rss20';
                    break;
                case 'atom.xml':
                    $skinName = 'feeds/atom';
                    break;
            }
            if (SKIN::exists($skinName)) {
                $skin =& SKIN::createFromName($skinName);
                $data['skin']->SKIN($skin->getID());
                $skinData =& $data['skin'];
                $pageType = $data['type'];
                if (!$CONF['DisableSite']) {
                    ob_start();
                    $skinID = $skinData->id;
                    $contents = $this->getSkinContent($pageType, $skinID);
                    $actions = SKIN::getAllowedActionsForType($pageType);
                    $dataArray = array('skin' => &$skinData, 'type' => $pageType, 'contents' => &$contents);
                    $manager->notify('PreSkinParse', $dataArray);
                    PARSER::setProperty('IncludeMode', SKIN::getIncludeMode());
                    PARSER::setProperty('IncludePrefix', SKIN::getIncludePrefix());
                    $handler = new ACTIONS($pageType, $skinData);
                    $parser = new PARSER($actions, $handler);
                    $handler->setParser($parser);
                    $handler->setSkin($skinData);
                    $parser->parse($contents);
                    $dataArray = array('skin' => &$skinData, 'type' => $pageType);
                    $manager->notify('PostSkinParse', $dataArray);
                    $feed = ob_get_contents();
                    ob_end_clean();
                    $eTag = '"' . md5($feed) . '"';
                    header('Etag: ' . $eTag);
                    if ($eTag == serverVar('HTTP_IF_NONE_MATCH')) {
                        header('HTTP/1.0 304 Not Modified');
                        header('Content-Length: 0');
                    } else {
                        if (extension_loaded('mbstring')) {
                            $feed = mb_convert_encoding($feed, 'UTF-8', _CHARSET);
                            $charset = 'UTF-8';
                        } else {
                            $charset = _CHARSET;
                        }
                        header('Content-Type: application/xml; charset=' . $charset);
                        header('Generator: Nucleus CMS ' . $nucleus['version']);
                        // dump feed
                        echo $feed;
                    }
                } else {
                    echo '<' . '?xml version="1.0" encoding="ISO-8859-1"?' . '>';
                    ?>
<rss version="2.0">
  <channel>
    <title><?php 
                    echo $this->hsc($CONF['SiteName'], ENT_QUOTES);
                    ?>
</title>
    <link><?php 
                    echo $this->hsc($CONF['IndexURL'], ENT_QUOTES);
                    ?>
</link>
    <description></description>
    <docs>http://backend.userland.com/rss</docs>
  </channel>
</rss>	
<?php 
                }
            }
            exit;
        }
    }
 function event_InitSkinParse(&$data)
 {
     global $skinid;
     $this->checkHTML();
     $this->checkWAP();
     $this->checkDevice();
     /* 
     Device accepts WAP     : $this->acceptWAP == TRUE
     Device accepts HTML : $this->acceptHTML == TRUE
     Device is mobile     : $this->isMobile = TRUE
     */
     if ($this->getOption('MD_wapenabled') == "yes") {
         if ($this->acceptHTML && $this->acceptWAP == 1 && $this->isMobile == 1 && $this->getOption('wapurl') != '') {
             /* Redirect to WAP Compatible version of Blog) */
             $url = 'Location: ' . $this->getOption('wapurl');
             header($url);
             exit;
         } elseif ($this->acceptHTML && $this->acceptWAP == 1 && $this->isMobile == 1 && $this->getOption('wapurl') == '') {
             if (SKIN::exists($this->getOption('wapskin'))) {
                 $newskin = SKIN::createFromName($this->getOption('wapskin'));
                 $newskinid = $newskin->id;
                 $data['skin']->id = $newskin->id;
                 $data['skin']->name = $newskin->name;
                 $data['skin']->description = $newskin->description;
                 $data['skin']->contentType = $newskin->contentType;
                 $data['skin']->includeMode = $newskin->includeMode;
                 $data['skin']->includePrefix = $newskin->includePrefix;
             }
         }
     }
     if ($this->getOption('MD_mobileenabled') == "yes") {
         /* Redirect to HTML Compatible version of Blog optimzed for mobile use) */
         if ($this->acceptHTML == 1 && $this->isMobile == 1 && $this->getOption('mobileurl') != '') {
             $url = 'Location: ' . $this->getOption('mobileurl');
             header($url);
             exit;
         } elseif ($this->acceptHTML == 1 && $this->isMobile == 1 && $this->getOption('mobileurl') == '') {
             if (SKIN::exists($this->getOption('mobileskin'))) {
                 $newskin = SKIN::createFromName($this->getOption('mobileskin'));
                 $newskinid = $newskin->id;
                 $data['skin']->id = $newskin->id;
                 $data['skin']->name = $newskin->name;
                 $data['skin']->description = $newskin->description;
                 $data['skin']->contentType = $newskin->contentType;
                 $data['skin']->includeMode = $newskin->includeMode;
                 $data['skin']->includePrefix = $newskin->includePrefix;
             }
         }
     }
     /* Else just parse the blog as usual */
 }
Esempio n. 7
0
 /**
  * Returns a skin given its shortname
  * @param string $name Skin shortname
  * @return object SKIN
  * @static
  */
 function createFromName($name)
 {
     return new SKIN(SKIN::getIdFromName($name));
 }
Esempio n. 8
0
function _setSkinPart($blogid, $username, $password, $content, $type)
{
    // 1. login
    $mem = new MEMBER();
    if (!$mem->login($username, $password)) {
        return _error(1, "Could not log in");
    }
    // 2. check if allowed
    if (!BLOG::existsID($blogid)) {
        return _error(2, "No such blog ({$blogid})");
    }
    if (!$mem->teamRights($blogid)) {
        return _error(3, "Not a team member");
    }
    // 3. update skin part
    $blog = new BLOG($blogid);
    $skin = new SKIN($blog->getDefaultSkin());
    $skin->update($type, $content);
    return new xmlrpcresp(new xmlrpcval(1, 'boolean'));
}
Esempio n. 9
0
 function event_InitSkinParse(&$data)
 {
     global $CONF;
     if (!$this->isSmartPhone()) {
         return;
     }
     $request_uri = $_SERVER['REQUEST_URI'];
     if (strpos($request_uri, '.php') !== false && strpos($request_uri, 'index.php') === false) {
         return;
     }
     if (isset($_GET['viewmode']) && preg_match('/^[01]{1}$/', $_GET['viewmode'])) {
         $viewmode = intGetVar('viewmode');
     } elseif (isset($_COOKIE['viewmode']) && preg_match('/^[01]{1}$/', $_COOKIE['viewmode'])) {
         $viewmode = intCookieVar('viewmode');
     } else {
         $viewmode = 1;
     }
     if (!isset($_COOKIE['viewmode']) || $_COOKIE['viewmode'] != $viewmode) {
         setcookie('viewmode', $viewmode, 0, $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);
     }
     if ($viewmode == 1) {
         $optionSpskinname = htmlspecialchars($this->getOption('spskinname'), ENT_QUOTES, _CHARSET);
         if (!SKIN::exists($optionSpskinname)) {
             $SkinName = $data['skin']->name;
         } else {
             $SkinName = $optionSpskinname;
         }
     } elseif ($viewmode == 0) {
         $SkinName = $data['skin']->name;
     } else {
         return;
     }
     $SkinId = SKIN::getIdFromName($SkinName);
     if ($SkinId) {
         if (method_exists($data['skin'], "SKIN")) {
             $data['skin']->SKIN($SkinId);
         } else {
             $data['skin']->__construct($SkinId);
         }
     }
     return;
 }
 function testitemcomment($bid, $iid)
 {
     global $blogid, $skinid, $manager, $member;
     if ($this->getBlogOption($bid, 'login_needed') == "memberonly" && (!$member->isLoggedIn() || !$member->isTeamMember($bid))) {
         return FALSE;
     }
     if ($this->getBlogOption($bid, 'login_needed') == "needlogin" && !$member->isLoggedIn()) {
         return FALSE;
     }
     switch ($this->getItemOption($iid, 'restrict_this_item')) {
         case 'nothing':
             break;
         case 'needlogin':
             if (!$member->isLoggedIn()) {
                 return FALSE;
             }
             break;
         case 'memberonly':
             if (!$member->isLoggedIn() || !$member->isTeamMember($bid)) {
                 return FALSE;
             }
             break;
     }
     if ($this->getBlogOption($bid, 'skin_restriction') == "no") {
         return TRUE;
     }
     $blog = $manager->getBlog($bid);
     $defaultskin = $blog->getDefaultSkin();
     if ($skinid == $defaultskin) {
         return TRUE;
     }
     $skinname = SKIN::getNameFromID($skinid);
     $allowedskins = $this->getBlogOption($blogid, 'allowed_skins');
     return !strpos(',' . $allowedskins . ',', ',' . $skinname . ',') === TRUE;
 }
Esempio n. 11
0
    function page_header()
    {
        global $DATA, $this_page;
        $linkshtml = "";
        $title = '';
        $sitetitle = $DATA->page_metadata($this_page, "sitetitle");
        $keywords_title = '';
        if ($this_page == 'overview') {
            $title = $sitetitle . ': ' . $DATA->page_metadata($this_page, "title");
        } else {
            if ($page_subtitle = $DATA->page_metadata($this_page, "subtitle")) {
                $title = $page_subtitle;
            } elseif ($page_title = $DATA->page_metadata($this_page, "title")) {
                $title = $page_title;
            }
            // We'll put this in the meta keywords tag.
            $keywords_title = $title;
            $parent_page = $DATA->page_metadata($this_page, 'parent');
            if ($parent_title = $DATA->page_metadata($parent_page, 'title')) {
                if ($title) {
                    $title .= ': ';
                }
                $title .= $parent_title;
            }
            if ($title == '') {
                $title = $sitetitle;
            } else {
                $title .= ' (' . $sitetitle . ')';
            }
        }
        if (!($metakeywords = $DATA->page_metadata($this_page, "metakeywords"))) {
            $metakeywords = "";
        }
        if (!($metadescription = $DATA->page_metadata($this_page, "metadescription"))) {
            $metadescription = "";
        }
        if ($this_page != "home") {
            $URL = new URL('home');
            $linkshtml = "\t<link rel=\"start\" title=\"Home\" href=\"" . $URL->generate() . "\">\n";
        }
        // Create the next/prev/up links for navigation.
        // Their data is put in the metadata in hansardlist.php
        $nextprev = $DATA->page_metadata($this_page, "nextprev");
        if ($nextprev) {
            // Four different kinds of back/forth links we might build.
            $links = array("first", "prev", "up", "next", "last");
            foreach ($links as $n => $type) {
                if (isset($nextprev[$type]) && isset($nextprev[$type]['listurl'])) {
                    if (isset($nextprev[$type]['body'])) {
                        $linktitle = htmlentities(trim_characters($nextprev[$type]['body'], 0, 40));
                        if (isset($nextprev[$type]['speaker']) && count($nextprev[$type]['speaker']) > 0) {
                            $linktitle = $nextprev[$type]['speaker']['first_name'] . ' ' . $nextprev[$type]['speaker']['last_name'] . ': ' . $linktitle;
                        }
                    } elseif (isset($nextprev[$type]['hdate'])) {
                        $linktitle = format_date($nextprev[$type]['hdate'], SHORTDATEFORMAT);
                    }
                    $linkshtml .= "\t<link rel=\"{$type}\" title=\"{$linktitle}\" href=\"" . $nextprev[$type]['listurl'] . "\">\n";
                }
            }
        }
        // Needs to come before any HTML is output, in case it needs to set a cookie.
        $SKIN = new SKIN();
        if (!($keywords = $DATA->page_metadata($this_page, "keywords"))) {
            $keywords = "";
        } else {
            $keywords = "," . $DATA->page_metadata($this_page, "keywords");
        }
        $robots = '';
        if ($robots = $DATA->page_metadata($this_page, 'robots')) {
            $robots = '<meta name="robots" content="' . $robots . '">';
        }
        header('Content-Type: text/html; charset=iso-8859-1');
        if ($this_page == 'home') {
            header('Vary: Cookie, X-GeoIP-Country');
            header('Cache-Control: max-age=600');
        }
        ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	<title><?php 
        echo $title;
        ?>
</title>
	<meta name="description" content="Making parliament easy.">
	<meta name="keywords" content="Parliament, government, house of commons, house of lords, MP, Peer, Member of Parliament, MPs, Peers, Lords, Commons, UK, Britain, British, Welsh, Scottish, Wales, Scotland, <?php 
        echo htmlentities($keywords_title) . htmlentities($keywords);
        ?>
">
	<?php 
        echo $robots;
        ?>
	<link rel="author" title="Send feedback" href="mailto:<?php 
        echo str_replace('@', '&#64;', CONTACTEMAIL);
        ?>
">
	<link rel="home" title="Home" href="http://<?php 
        echo DOMAIN;
        ?>
/">
	<script type="text/javascript" src="/js/jquery.js"></script>
	<script type="text/javascript" src="/js/jquery.cookie.js"></script>
	<script type="text/javascript" src="/jslib/share/share.js"></script>
	<script type="text/javascript" src="/js/main.js"></script>	
	<script type="text/javascript" src="/js/bar.js"></script>	
<?php 
        echo $linkshtml;
        $SKIN->output_stylesheets();
        if ($rssurl = $DATA->page_metadata($this_page, 'rss')) {
            // If this page has an RSS feed set.
            echo '<link rel="alternate" type="application/rss+xml" title="TheyWorkForYou RSS" href="http://', DOMAIN, WEBPATH, $rssurl, '">';
        }
        if (!DEVSITE) {
            ?>

<script src="http://www.google-analytics.com/urchin.js"
type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-660910-1";
if (typeof urchinTracker == 'function') urchinTracker();
</script>

<?php 
        }
        echo '</head>';
    }
Esempio n. 12
0
function parseFile($filename, $includeMode = 'normal', $includePrefix = '')
{
    $handler = new ACTIONS('fileparser');
    $parser = new PARSER(SKIN::getAllowedActionsForType('fileparser'), $handler);
    $handler->parser =& $parser;
    // set IncludeMode properties of parser
    PARSER::setProperty('IncludeMode', $includeMode);
    PARSER::setProperty('IncludePrefix', $includePrefix);
    if (!file_exists($filename)) {
        doError(_GFUNCTIONS_PARSEFILE_FILEMISSING);
    }
    $fsize = filesize($filename);
    if ($fsize <= 0) {
        return;
    }
    // read file
    $fd = fopen($filename, 'r');
    $contents = fread($fd, $fsize);
    fclose($fd);
    // parse file contents
    $parser->parse($contents);
}
 function event_InitSkinParse(&$data)
 {
     $DefaultPCSkinName_str = $data['skin']->name;
     $DefaultMobileSkinName_str = $data['skin']->name . "/" . $this->getOption('as2m_mobile_name');
     $DefaultSPSkinName_str = $data['skin']->name . "/" . $this->getOption('as2m_smartphone_name');
     //Mobile
     if ($this->isMobile() && SKIN::exists($DefaultMobileSkinName_str)) {
         $DefaultSkinName = $DefaultMobileSkinName_str;
     } elseif ($this->isMobile() && !SKIN::exists($DefaultMobileSkinName_str)) {
         $DefaultSkinName = $DefaultPCSkinName_str;
     }
     //SmartPhone
     if ($this->isSmartPhone() && !SKIN::exists($DefaultSPSkinName_str)) {
         //1=>SmartPhone > default
         if ($this->getOption('as2m_sp_pri') == 1) {
             $DefaultSkinName = $DefaultPCSkinName_str;
             //2=>SmartPhone > Mobile > default
         } elseif ($this->getOption('as2m_sp_pri') == 2) {
             if (SKIN::exists($DefaultMobileSkinName_str)) {
                 $DefaultSkinName = $DefaultMobileSkinName_str;
             } else {
                 $DefaultSkinName = $DefaultPCSkinName_str;
             }
         }
     } elseif ($this->isSmartPhone() && SKIN::exists($DefaultSPSkinName_str)) {
         $DefaultSkinName = $DefaultSPSkinName_str;
     }
     //other
     if (!$this->isSmartPhone() && !$this->isMobile()) {
         $DefaultSkinName = $DefaultPCSkinName_str;
     }
     if ($this->isDoCoMo()) {
         $CarrierSkinName = $data['skin']->name . "/" . $this->getOption('as2m_docomo_name');
         $this->CarrierName = "docomo";
         $this->CarrierShortName = "d";
     } elseif ($this->isVodafone()) {
         $CarrierSkinName = $data['skin']->name . "/" . $this->getOption('as2m_softbank_name');
         $this->CarrierName = "softbank";
         $this->CarrierShortName = "s";
     } elseif ($this->isEZweb()) {
         $CarrierSkinName = $data['skin']->name . "/" . $this->getOption('as2m_au_name');
         $this->CarrierName = "ezweb";
         $this->CarrierShortName = "e";
     } elseif ($this->isWillcom()) {
         $CarrierSkinName = $data['skin']->name . "/" . $this->getOption('as2m_wilcom_name');
         $this->CarrierName = "willcom";
         $this->CarrierShortName = "w";
     } elseif ($this->isiPhone()) {
         $CarrierSkinName = $data['skin']->name . "/" . $this->getOption('as2m_iphone_name');
         $this->CarrierName = "iphone";
         $this->CarrierShortName = "ip";
     } elseif ($this->isAndroid()) {
         $CarrierSkinName = $data['skin']->name . "/" . $this->getOption('as2m_android_name');
         $this->CarrierName = "android";
         $this->CarrierShortName = "an";
     } else {
         $this->CarrierName = "pc";
     }
     //CarrierSkin > DefaultSkin
     if (SKIN::exists($CarrierSkinName)) {
         $SkinName = $CarrierSkinName;
     } else {
         $SkinName = $DefaultSkinName;
     }
     $skin =& SKIN::createFromName($SkinName);
     $data['skin']->SKIN($skin->getID());
     return;
 }
Esempio n. 14
0
function listplug_table_skinlist($template, $type)
{
    global $CONF, $DIR_SKINS, $manager;
    switch ($type) {
        case 'HEAD':
            echo "<th>" . _LISTS_NAME . "</th><th>" . _LISTS_DESC . "</th><th colspan='3'>" . _LISTS_ACTIONS . "</th>";
            break;
        case 'BODY':
            $current = $template['current'];
            echo '<td>';
            // use a special style for the default skin
            if ($current->sdnumber == $CONF['BaseSkin']) {
                echo '<strong>', htmlspecialchars($current->sdname), '</strong>';
            } else {
                echo htmlspecialchars($current->sdname);
            }
            echo '<br /><br />';
            echo _LISTS_TYPE, ': ', htmlspecialchars($current->sdtype);
            echo '<br />', _LIST_SKINS_INCMODE, ' ', $current->sdincmode == 'skindir' ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;
            if ($current->sdincpref) {
                echo '<br />', _LIST_SKINS_INCPREFIX, ' ', htmlspecialchars($current->sdincpref);
            }
            // add preview image when present
            if ($current->sdincpref && @file_exists($DIR_SKINS . $current->sdincpref . 'preview.png')) {
                echo '<br /><br />';
                $hasEnlargement = @file_exists($DIR_SKINS . $current->sdincpref . 'preview-large.png');
                if ($hasEnlargement) {
                    echo '<a href="', $CONF['SkinsURL'], htmlspecialchars($current->sdincpref), 'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . '">';
                }
                $imgAlt = sprintf(_LIST_SKIN_PREVIEW, htmlspecialchars($current->sdname, ENT_QUOTES));
                echo '<img class="skinpreview" src="', $CONF['SkinsURL'], htmlspecialchars($current->sdincpref), 'preview.png" width="100" height="75" alt="' . $imgAlt . '" />';
                if ($hasEnlargement) {
                    echo '</a>';
                }
                if (@file_exists($DIR_SKINS . $current->sdincpref . 'readme.html')) {
                    $url = $CONF['SkinsURL'] . htmlspecialchars($current->sdincpref, ENT_QUOTES) . 'readme.html';
                    $readmeTitle = sprintf(_LIST_SKIN_README, htmlspecialchars($current->sdname, ENT_QUOTES));
                    echo '<br /><a href="' . $url . '" title="' . $readmeTitle . '">' . _LIST_SKIN_README_TXT . '</a>';
                }
            }
            echo "</td>";
            echo '<td class="availableSkinTypes">' . htmlspecialchars($current->sddesc);
            // show list of defined parts
            $r = sql_query('SELECT stype FROM ' . sql_table('skin') . ' WHERE sdesc=' . $current->sdnumber . ' ORDER BY ' . " stype NOT IN ('index', 'item', 'error', 'search', 'archive', 'archivelist', 'imagepopup', 'member') ASC , " . ' stype ASC');
            $types = array();
            while ($o = sql_fetch_object($r)) {
                array_push($types, $o->stype);
            }
            if (sizeof($types) > 0) {
                $friendlyNames = SKIN::getFriendlyNames();
                for ($i = 0; $i < sizeof($types); $i++) {
                    $type = $types[$i];
                    if (in_array($type, array('index', 'item', 'archivelist', 'archive', 'search', 'error', 'member', 'imagepopup'))) {
                        $types[$i] = '<li>' . helpHtml('skinpart' . $type) . ' <a href="index.php?action=skinedittype&amp;skinid=' . $current->sdnumber . '&amp;type=' . $type . '" tabindex="' . $template['tabindex'] . '">' . htmlspecialchars($friendlyNames[$type]) . "</a></li>";
                    } else {
                        $types[$i] = '<li>' . helpHtml('skinpartspecial') . ' <a href="index.php?action=skinedittype&amp;skinid=' . $current->sdnumber . '&amp;type=' . $type . '" tabindex="' . $template['tabindex'] . '">' . htmlspecialchars($friendlyNames[$type]) . "</a></li>";
                    }
                }
                echo '<br /><br />', _LIST_SKINS_DEFINED, ' <ul>', implode($types, ''), '</ul>';
            }
            echo "</td>";
            echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skinedit&amp;skinid={$current->sdnumber}' tabindex='" . $template['tabindex'] . "'>" . _LISTS_EDIT . "</a></td>";
            $url = $manager->addTicketToUrl('index.php?action=skinclone&skinid=' . intval($current->sdnumber));
            echo "<td style=\"white-space:nowrap\"><a href='", htmlspecialchars($url), "' tabindex='" . $template['tabindex'] . "'>" . _LISTS_CLONE . "</a></td>";
            echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skindelete&amp;skinid={$current->sdnumber}' tabindex='" . $template['tabindex'] . "'>" . _LISTS_DELETE . "</a></td>";
            break;
    }
}