Ejemplo n.º 1
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();
 }
Ejemplo n.º 2
0
 /**
  * returns an array of all the skin nameclashes (empty array when no name clashes)
  */
 function checkSkinNameClashes()
 {
     $clashes = array();
     foreach ($this->skins as $skinName => $data) {
         if (SKIN::exists($skinName)) {
             array_push($clashes, $skinName);
         }
     }
     return $clashes;
 }
Ejemplo n.º 3
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 */
 }
Ejemplo n.º 5
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 event_InitSkinParse(&$data)
 {
     global $blogid;
     if (!$this->testlogin($data)) {
         if (intrequestvar('iteration') < $this->getBlogOption($blogid, 'login_iteration')) {
             $skinName = trim($this->getBlogOption($blogid, 'sub_skin'));
             if (SKIN::exists($skinName)) {
                 $skin =& SKIN::createFromName($skinName);
                 // copied from NP_SkinSwitcher.php
                 $data['skin']->SKIN($skin->getID());
             }
         } else {
             $this->doError = TRUE;
             $this->errorMessage = _ACCSSCNTRL_INVALID_USERPASS;
             return;
         }
     }
     if (!$this->testblog($data)) {
         $this->doError = TRUE;
         $this->errorMessage = _ACCSSCNTRL_CONTENTS_PROHIBIT;
     }
 }
 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;
 }