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;
 }
Exemple #2
0
 /**
  * @todo document this
  */
 function action_plugindown()
 {
     global $member, $manager, $CONF;
     // check if allowed
     $member->isAdmin() or $this->disallow();
     $plugid = intGetVar('plugid');
     if (!$manager->pidInstalled($plugid)) {
         $this->error(_ERROR_NOSUCHPLUGIN);
     }
     // 1. get old order number
     $res = sql_query('SELECT porder FROM ' . sql_table('plugin') . ' WHERE pid=' . $plugid);
     $o = sql_fetch_object($res);
     $oldOrder = $o->porder;
     $res = sql_query('SELECT * FROM ' . sql_table('plugin'));
     $maxOrder = sql_num_rows($res);
     // 2. calculate new order number
     $newOrder = $oldOrder < $maxOrder ? $oldOrder + 1 : $maxOrder;
     // 3. update plug numbers
     sql_query('UPDATE ' . sql_table('plugin') . ' SET porder=' . $oldOrder . ' WHERE porder=' . $newOrder);
     sql_query('UPDATE ' . sql_table('plugin') . ' SET porder=' . $newOrder . ' WHERE pid=' . $plugid);
     //$this->action_pluginlist();
     // To avoid showing ticket in the URL, redirect to pluginlist, instead.
     redirect($CONF['AdminURL'] . '?action=pluginlist');
 }
Exemple #3
0
 function action_itemview($bid = 0, $msg = '')
 {
     global $CONF, $oPluginAdmin;
     if (empty($bid)) {
         if (getVar('blogid')) {
             $bid = intGetVar('blogid');
         } else {
             $bid = intval($CONF['DefaultBlog']);
         }
     } else {
         $bid = intval($bid);
     }
     $oPluginAdmin->start();
     $printData = '<h2>' . _ADMIN_AREA_TITLE . '</h2>' . '<ul style="list-style:none;">' . '  <li>' . '    <a href="' . $this->pediturl . '">' . _OPTION_SETTING . '    </a>' . '  </li>' . '  <li>' . '    <a href="' . $this->adminurl . 'index.php?action=blogview">' . _FOR_BLOG_SETTING . '    </a>' . '  </li>' . '  <li>' . '    <a href="' . $this->adminurl . 'index.php?action=categoryview&amp;blogid=' . $bid . '">' . _FOR_CATEGORY_SETTING . '    </a>' . '  </li>' . '  <li>' . '    <a href="' . $this->adminurl . 'index.php?action=memberview">' . _FOR_MEMBER_SETTING . '    </a>' . '  </li>' . '</ul>' . '<p><h3>' . $this->_hsc($msg) . '</h3>';
     echo $printData;
     unset($printData);
     $this->print_tablehead(_LISTS_TITLE, _LISTS_ITEM_DESC);
     $query = 'SELECT %s,%s,%s FROM %s WHERE iblog = %d ORDER BY itime DESC';
     $query = sprintf($query, ititle, inumber, ibody, sql_table('item'), $bid);
     $res = sql_query($query);
     while ($i = mysql_fetch_object($res)) {
         $query = 'SELECT obj_name as result FROM %s WHERE obj_param = "item" AND obj_id = %d';
         $query = sprintf($query, sql_table('plug_customurl'), intval($i->inumber));
         $temp_res = quickQuery($query);
         $ipath = $this->_hsc(substr($temp_res, 0, -5));
         $data = array('oid' => intval($i->inumber), 'obd' => $bid, 'opr' => 'item', 'name' => $this->_hsc($i->ititle), 'ret' => 'itemview', 'ed_URL' => $this->editurl . 'index.php?action=itemedit' . '&amp;itemid=' . intval($i->inumber), 'path' => $ipath);
         if (extension_loaded('mbstring')) {
             $data['desc'] = $this->_hsc(mb_substr(strip_tags($i->ibody), 0, 80));
         } else {
             $this->_hsc(substr(strip_tags($i->ibody), 0, 80));
         }
         $this->print_tablerow($data);
     }
     echo '</tbody></table></p>';
     unset($query);
     $oPluginAdmin->end();
 }
 function event_ParseURL($data)
 {
     global $CONF, $manager, $curl_blogid, $blogid, $itemid, $catid;
     global $memberid, $archivelist, $archive, $query;
     // initialize
     $info = $data['info'];
     $complete =& $data['complete'];
     if ($complete) {
         return;
     }
     $useCustomURL = $this->getAllBlogOptions('use_customurl');
     // Use NP_MultipleCategories ?
     $mcategories = $this->pluginCheck('MultipleCategories');
     if ($mcategories) {
         $param = array();
         $mcategories->event_PreSkinParse($param);
         global $subcatid;
         if (method_exists($mcategories, 'getRequestName')) {
             $subrequest = $mcategories->getRequestName();
         } else {
             $subrequest = 'subcatid';
         }
     }
     // initialize and sanitize '$blogid'
     if (!$blogid) {
         if (getVar('blogid')) {
             if (is_numeric(getVar('blogid'))) {
                 $blogid = intval(getVar('blogid'));
             } else {
                 $blogid = intval(getBlogIDFromName(getVar('blogid')));
             }
         } elseif ($curl_blogid) {
             $blogid = intval($curl_blogid);
         } elseif ($itemid > 0) {
             //2008-09-19 Cacher
             $blogid = getBlogIDFromItemID($itemid);
         } else {
             $blogid = $CONF['DefaultBlog'];
         }
         //2008-09-19 Cacher
     } else {
         if (is_numeric($blogid)) {
             $blogid = intval($blogid);
         } else {
             $blogid = intval(getBlogIDFromName($blogid));
         }
     }
     if (!$info) {
         if (serverVar('PATH_INFO')) {
             $info = serverVar('PATH_INFO');
         } elseif (getNucleusVersion() < 330) {
             if (getVar('virtualpath')) {
                 $info = getVar('virtualpath');
             }
         } else {
             if (getVar('query')) {
                 $info = serverVar('REQUEST_URI');
             } else {
                 return;
             }
             //by nekonosippo 2008-04-06 http://japan.nucleuscms.org/bb/viewtopic.php?p=22351#22351
         }
     }
     // Sanitize 'PATH_INFO'
     $info = trim($info, '/');
     $v_path = explode("/", $info);
     foreach ($v_path as $key => $value) {
         $value = urlencode($value);
         $value = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', $value);
         $v_path[$key] = $value;
     }
     if (phpversion() >= '4.1.0') {
         $_SERVER['PATH_INFO'] = implode('/', $v_path);
     }
     global $HTTP_SERVER_VARS;
     $HTTP_SERVER_VARS['PATH_INFO'] = implode('/', $v_path);
     // Admin area check
     $tmpURL = sprintf("%s%s%s", "http://", serverVar("HTTP_HOST"), serverVar("SCRIPT_NAME"));
     $uri = str_replace('/', '\\/', $tmpURL);
     $plug_url = str_replace('/', '\\/', $CONF['PluginURL']);
     $u_plugAction = getVar('action') == 'plugin' && getVar('name');
     $UsingPlugAdmin = FALSE;
     if (strpos($uri, $plug_url) === 0 || $u_plugAction) {
         $UsingPlugAdmin = TRUE;
     }
     // get real blogid
     $blink = FALSE;
     if (empty($info)) {
         $bLink = TRUE;
     }
     $linkObj = array('bid' => 0, 'name' => reset($v_path), 'linkparam' => 'blog');
     $blog_id = $this->getRequestPathInfo($linkObj);
     if ($blog_id) {
         $blogid = $blog_id;
         $trush = array_shift($v_path);
         $bLink = TURE;
     }
     if ($useCustomURL[$blogid] == 'no') {
         return;
     }
     // redirect to other URL style
     $useCustomURLyes = $useCustomURL[$blogid] == 'yes';
     if ($useCustomURLyes && !$UsingPlugAdmin && !$CONF['UsingAdminArea']) {
         // Search query redirection
         // 301 permanent ? or 302 temporary ?
         $queryURL = strpos(serverVar('REQUEST_URI'), 'query=') !== FALSE;
         $search_q = getVar('query') || $queryURL;
         $redirectSerch = $this->getBlogOption($blogid, 'redirect_search') == 'yes';
         if ($redirectSerch) {
             if ($search_q) {
                 $que_str = getVar('query');
                 $que_str = $this->hsc($que_str);
                 if (extension_loaded('mbstring')) {
                     $que_str = str_replace('/', md5('/'), $que_str);
                     $que_str = str_replace("'", md5("'"), $que_str);
                     $que_str = str_replace('&', md5('&'), $que_str);
                 } else {
                     $que_str = str_replace('/', md5('/'), $que_str);
                     $que_str = str_replace("'", md5("'"), $que_str);
                     $que_str = str_replace('&', md5('&'), $que_str);
                 }
                 $que_str = urlencode($que_str);
                 $search_path = 'search/' . $que_str;
                 $b_url = createBlogidLink($blogid);
                 $redurl = sprintf("%s%s", $b_url, $search_path);
                 redirect($redurl);
                 // 302 Moved temporary
                 exit;
             }
         }
         $exLink = FALSE;
         if (!$redirectSerch && $search_q) {
             $exLink = TRUE;
         }
         // redirection nomal URL to FancyURL
         $temp_req = explode('?', serverVar('REQUEST_URI'));
         $reqPath = trim(end($temp_req), '/');
         $indexrdf = $reqPath == 'xml-rss1.php';
         $atomfeed = $reqPath == 'atom.php';
         $rss2feed = $reqPath == 'xml-rss2.php';
         $feeds = $indexrdf || $atomfeed || $rss2feed;
         $redirectNormal = $this->getBlogOption($blogid, 'redirect_normal') == 'yes';
         if ($redirectNormal && serverVar('QUERY_STRING') && !$feeds && !$exLink) {
             $temp = explode('&', serverVar('QUERY_STRING'));
             foreach ($temp as $k => $val) {
                 if (preg_match('/^virtualpath/', $val)) {
                     unset($temp[$k]);
                 }
             }
             if (!empty($temp)) {
                 $p_arr = array();
                 foreach ($temp as $key => $value) {
                     $p_key = explode('=', $value);
                     switch (reset($p_key)) {
                         case 'blogid':
                             $p_arr[] = $CONF['BlogKey'] . '/' . intGetVar('blogid');
                             unset($temp[$key]);
                             break;
                         case 'catid':
                             $p_arr[] = $CONF['CategoryKey'] . '/' . intGetVar('catid');
                             unset($temp[$key]);
                             break;
                         case $subrequest:
                             $p_arr[] = $subrequest . '/' . intGetVar($subrequest);
                             unset($temp[$key]);
                             break;
                         case 'itemid':
                             $p_arr[] = $CONF['ItemKey'] . '/' . intGetVar('itemid');
                             unset($temp[$key]);
                             break;
                         case 'memberid':
                             $p_arr[] = $CONF['MemberKey'] . '/' . intGetVar('memberid');
                             unset($temp[$key]);
                             break;
                         case 'archivelist':
                             $p_arr[] = $CONF['ArchivesKey'] . '/' . $blogid;
                             unset($temp[$key]);
                             break;
                         case 'archive':
                             $p_arr[] = $CONF['ArchiveKey'] . '/' . $blogid . '/' . getVar('archive');
                             unset($temp[$key]);
                             break;
                         default:
                             break;
                     }
                 }
                 if (!empty($temp)) {
                     $queryTemp = '/?' . implode('&', $temp);
                 }
                 if (reset($p_arr)) {
                     $b_url = createBlogidLink($blogid);
                     $red_path = '/' . implode('/', $p_arr);
                     if (substr($b_url, -1) == '/') {
                         $b_url = rtrim($b_url, '/');
                     }
                     $redurl = sprintf("%s%s", $b_url, $red_path) . $queryTemp;
                     // HTTP status 301 "Moved Permanentry"
                     header('HTTP/1.1 301 Moved Permanently');
                     header('Location: ' . $redurl);
                     exit;
                 }
             }
         } elseif ($redirectNormal && $feeds) {
             $b_url = rtrim(createBlogidLink($blogid), '/');
             switch ($reqPath) {
                 case 'xml-rss1.php':
                     $feed_code = '/index.rdf';
                     break;
                 case 'xml-rss2.php':
                     $feed_code = '/rss2.xml';
                     break;
                 case 'atom.php':
                     $feed_code = '/atom.xml';
                     break;
                 default:
                     break;
             }
             // HTTP status 301 "Moved Permanentry"
             header('HTTP/1.1 301 Moved Permanently');
             header('Location: ' . $b_url . $feed_code);
             exit;
         }
     }
     // decode path_info
     // decode unofficial Page switch '/page_2.html'
     /*		foreach($v_path as $pathName) {
     			if (preg_match('/^page_/', $pathName)) {
     				$temp_info    = explode('page_', $pathName);
     				$_GET['page'] = intval($temp_info[1]);
     				$page         = array_pop($v_path);
     			}
     		}*/
     // decode TrackBack URL shorten ver.
     $tail = end($v_path);
     if (substr($tail, -10, 10) == '.trackback') {
         $v_pathName = substr($tail, 0, -10);
         if (is_numeric($v_pathName) || substr($v_pathName, -5) == '.html') {
             $this->_trackback($blogid, $v_pathName);
         } else {
             $this->_trackback($blogid, $v_pathName . '.html');
         }
         return;
     }
     // decode other type URL
     //		$bLink = $cLink = $iLink = $exLink = FALSE;
     $cLink = $iLink = $exLink = FALSE;
     $i = 1;
     $NP_ExtraSkinJPFlag = FALSE;
     $redURI = NULL;
     $sc = NULL;
     foreach ($v_path as $pathName) {
         switch ($pathName) {
             // decode FancyURLs and redirection to Customized URL
             // for blogsgetAllBlogOptions($name)
             case $CONF['BlogKey']:
                 if (isset($v_path[$i]) && is_numeric($v_path[$i])) {
                     if ($useCustomURL[intval($v_path[$i])] != 'yes') {
                         $blogid = intval($v_path[$i]);
                         $bLink = TRUE;
                     } else {
                         $redURI = createBlogidLink(intval($v_path[$i]));
                     }
                 }
                 break;
                 // for items
             // for items
             case $CONF['ItemKey']:
                 if (isset($v_path[$i]) && is_numeric($v_path[$i])) {
                     if ($useCustomURL[$blogid] != 'yes') {
                         $itemid = intval($v_path[$i]);
                         $iLink = TRUE;
                     } else {
                         $redURI = createItemLink(intval($v_path[$i]));
                     }
                 }
                 break;
                 // for categories
             // for categories
             case $CONF['CategoryKey']:
             case 'catid':
                 if (isset($v_path[$i]) && is_numeric($v_path[$i])) {
                     if ($useCustomURL[$blogid] != 'yes') {
                         $catid = intval($v_path[$i]);
                         $cLink = TRUE;
                     } else {
                         $redURI = createCategoryLink(intval($v_path[$i]));
                     }
                 }
                 break;
                 // for subcategories
             // for subcategories
             case $subrequest:
                 $c = $i - 2;
                 $subCat = isset($v_path[$i]) && is_numeric($v_path[$i]);
                 if ($mcategories && $subCat && $i >= 3 && is_numeric($v_path[$c])) {
                     if ($useCustomURL[$blogid] != 'yes') {
                         $subcatid = intval($v_path[$i]);
                         $catid = intval($v_path[$c]);
                         $cLink = TRUE;
                     } else {
                         $subcat_id = intval($v_path[$i]);
                         $catid = intval($v_path[$c]);
                         $linkParam = array($subrequest => $subcat_id);
                         $redURI = createCategoryLink($catid, $linkParam);
                     }
                 }
                 break;
                 // for archives
             // for archives
             case $CONF['ArchivesKey']:
             case $this->getOption('customurl_archives'):
                 // FancyURL
                 if (isset($v_path[$i]) && is_numeric($v_path[$i])) {
                     if ($useCustomURL[intval($v_path[$i])] != 'yes') {
                         $archivelist = intval($v_path[$i]);
                         $blogid = $archivelist;
                         $exLink = TRUE;
                     } else {
                         $redURI = createArchiveListLink(intval($v_path[$i]));
                     }
                     // Customized URL
                 } elseif (isset($v_path[$i]) && strpos($v_path[$i], 'page') === FALSE) {
                     $archivelist = $blogid;
                     $redURI = createArchiveListLink($archivelist);
                 } else {
                     $archivelist = $blogid;
                     $exLink = TRUE;
                 }
                 break;
                 // for archive
             // for archive
             case $CONF['ArchiveKey']:
             case $this->getOption('customurl_archive'):
                 $y = $m = $d = '';
                 $ar = $i + 1;
                 if (isset($v_path[$i])) {
                     $darc = preg_match('/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/', $v_path[$i]);
                     $marc = preg_match('/([0-9]{4})-([0-9]{1,2})/', $v_path[$i]);
                     $yarc = preg_match('/([0-9]{4})/', $v_path[$i]);
                     if (isset($v_path[$ar])) {
                         $adarc = preg_match('/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/', $v_path[$ar]);
                         $amarc = preg_match('/([0-9]{4})-([0-9]{1,2})/', $v_path[$ar]);
                         $ayarc = preg_match('/([0-9]{4})/', $v_path[$ar]);
                     } else {
                         $adarc = $amarc = $ayarc = NULL;
                     }
                     $arc = !$darc && !$marc && !$yarc;
                     $aarc = $adarc || $amarc || $ayarc;
                     $carc = $darc || $marc || $yarc;
                     // FancyURL
                     if (is_numeric($v_path[$i]) && $arc && isset($v_path[$ar]) && $aarc) {
                         sscanf($v_path[$ar], '%d-%d-%d', $y, $m, $d);
                         if (!empty($d)) {
                             $archive = sprintf('%04d-%02d-%02d', $y, $m, $d);
                         } elseif (!empty($m)) {
                             $archive = sprintf('%04d-%02d', $y, $m);
                         } else {
                             $archive = sprintf('%04d', $y);
                         }
                         if ($useCustomURL[intval($v_path[$i])] != 'yes') {
                             $blogid = intval($v_path[$i]);
                             $exLink = TRUE;
                         } else {
                             $blogid = intval($v_path[$i]);
                             $redURI = createArchiveLink($blogid, $archive);
                         }
                         // Customized URL
                     } elseif ($carc) {
                         sscanf($v_path[$i], '%d-%d-%d', $y, $m, $d);
                         if (!empty($d)) {
                             $archive = sprintf('%04d-%02d-%02d', $y, $m, $d);
                         } elseif (!empty($m)) {
                             $archive = sprintf('%04d-%02d', $y, $m);
                         } else {
                             $archive = sprintf('%04d', $y);
                         }
                         $exLink = TRUE;
                     } else {
                         $redURI = createArchiveListLink($blogid);
                     }
                 } else {
                     $redURI = createArchiveListLink($blogid);
                 }
                 break;
                 // for member
             // for member
             case $CONF['MemberKey']:
             case $this->getOption('customurl_member'):
                 // Customized URL
                 $customMemberURL = substr($v_path[$i], -5, 5) == '.html';
                 if (isset($v_path[$i]) && $customMemberURL) {
                     $memberInfo = array('linkparam' => 'member', 'bid' => 0, 'name' => $v_path[$i]);
                     $member_id = $this->getRequestPathInfo($memberInfo);
                     $memberid = intval($member_id);
                     $exLink = TRUE;
                     // FancyURL
                 } elseif (isset($v_path[$i]) && is_numeric($v_path[$i])) {
                     if ($useCustomURL[$blogid] != 'yes') {
                         $memberid = intval($v_path[$i]);
                         $exLink = TRUE;
                     } else {
                         $redURI = createMemberLink(intval($v_path[$i]));
                     }
                 } else {
                     $redURI = createBlogidLink($blogid);
                 }
                 break;
                 // for tag
                 // for pageswitch
             // for tag
             // for pageswitch
             case 'tag':
                 //					if ($this->pluginCheck(TagEx)) $exLink = true;
                 if ($this->pluginCheck(TagEX)) {
                     $exLink = true;
                 }
                 break;
                 //2008-07-28 http://japan.nucleuscms.org/bb/viewtopic.php?p=23175#23175
             //2008-07-28 http://japan.nucleuscms.org/bb/viewtopic.php?p=23175#23175
             case 'page':
                 $exLink = TRUE;
                 break;
                 // for ExtraSkinJP
             // for ExtraSkinJP
             case 'extra':
                 $ExtraSkinJP = $this->pluginCheck('ExtraSkinJP');
                 if ($ExtraSkinJP) {
                     $NP_ExtraSkinJPFlag = TRUE;
                 }
                 break;
                 // for search query
             // for search query
             case 'search':
                 $redirectSerch = $this->getBlogOption($blogid, 'redirect_search') == 'yes';
                 if ($redirectSerch) {
                     $que_str = urldecode($v_path[$i]);
                     if (extension_loaded('mbstring')) {
                         $que_str = str_ireplace(md5('/'), '/', $que_str);
                         $que_str = str_ireplace(md5("'"), "'", $que_str);
                         $que_str = str_ireplace(md5('&'), '&', $que_str);
                     } else {
                         $que_str = str_ireplace(md5('/'), '/', $que_str);
                         $que_str = str_ireplace(md5("'"), "'", $que_str);
                         $que_str = str_ireplace(md5('&'), '&', $que_str);
                     }
                     $que_str = htmlspecialchars_decode($que_str);
                     $_GET['query'] = $que_str;
                     $query = $que_str;
                     $exLink = TRUE;
                 }
                 break;
                 // for tDiarySkin
             // for tDiarySkin
             case 'tdiarydate':
             case 'categorylist':
             case 'monthlimit':
                 $tDiaryPlugin = $this->pluginCheck('tDiarySkin');
                 if ($tDiaryPlugin && isset($v_path[$i])) {
                     $_GET[$pathName] = $v_path[$i];
                     $exLink = TRUE;
                 }
                 break;
             case 'special':
             case $CONF['SpecialskinKey']:
                 if (isset($v_path[$i]) && is_string($v_path[$i])) {
                     $_REQUEST['special'] = $v_path[$i];
                     $exLink = TRUE;
                 }
                 break;
                 // for trackback
             // for trackback
             case 'trackback':
                 if (isset($v_path[$i]) && is_string($v_path[$i])) {
                     $this->_trackback($blogid, $v_path[$i]);
                 }
                 return;
                 break;
                 // decode Customized URL
             // decode Customized URL
             default:
                 // initialyze
                 $linkObj = array('bid' => $blogid, 'name' => $pathName);
                 $comp = FALSE;
                 $isItem = substr($pathName, -5) == '.html';
                 // category ?
                 if (!$comp && !$cLink && !$iLink && !$isItem && !$exLink) {
                     //2007-10-06 http://japan.nucleuscms.org/bb/viewtopic.php?p=20641#20641
                     $linkObj['linkparam'] = 'category';
                     $cat_id = $this->getRequestPathInfo($linkObj);
                     if (!empty($cat_id)) {
                         $catid = intval($cat_id);
                         $cLink = TRUE;
                         $comp = TRUE;
                     }
                 }
                 // subcategory ?
                 if (!$comp && $cLink && !$iLink && $mcategories && !$isItem && !$exLink) {
                     //2007-10-06 http://japan.nucleuscms.org/bb/viewtopic.php?p=20641#20641
                     $linkObj['linkparam'] = 'subcategory';
                     $linkObj['bid'] = $catid;
                     $subcat_id = $this->getRequestPathInfo($linkObj);
                     if (!empty($subcat_id)) {
                         $_REQUEST[$subrequest] = intval($subcat_id);
                         $subcatid = intval($subcat_id);
                         $sc = $i;
                         $comp = TRUE;
                     }
                 }
                 // item ?
                 if ($isItem) {
                     $linkObj['linkparam'] = 'item';
                     $item_id = $this->getRequestPathInfo($linkObj);
                     if (!empty($item_id)) {
                         $itemid = intval($item_id);
                         $iLink = TRUE;
                     }
                     if (preg_match('/^page_/', $pathName)) {
                         $iLink = TRUE;
                     }
                     //var_dump($linkObj);
                 }
                 break;
         }
         if (preg_match('/^[0-9page]$/', $pathName)) {
             $exLink = $pathName;
         }
         $i++;
     }
     if ($NP_ExtraSkinJPFlag) {
         $this->goNP_ExtraSkinJP();
     }
     // FancyURL redirect to Customized URL if use it
     // HTTP status 301 "Moved Permanentry"
     if ($redURI) {
         if (strpos(serverVar('REQUEST_URI'), '?') !== FALSE) {
             list($trush, $tempQueryString) = explode('?', serverVar('REQUEST_URI'), 2);
         }
         if ($tempQueryString) {
             $temp = explode('&', $tempQueryString);
             foreach ($temp as $k => $val) {
                 if (preg_match('/^virtualpath/', $val)) {
                     unset($temp[$k]);
                 }
             }
             if (!empty($temp)) {
                 $tempQueryString = '?' . implode('&', $temp);
             }
         }
         header('HTTP/1.1 301 Moved Permanently');
         header('Location: ' . $redURI . $tempQueryString);
         exit;
     }
     $feedurl = array('rss1.xml', 'index.rdf', 'rss2.xml', 'atom.xml');
     $siteMapPlugin = $this->pluginCheck('GoogleSitemap');
     if (!$siteMapPlugin) {
         $siteMapPlugin = $this->pluginCheck('SEOSitemaps');
     }
     if ($siteMapPlugin) {
         $pcSitemaps = $siteMapPlugin->getAllBlogOptions('PcSitemap');
         foreach ($pcSitemaps as $pCsitemap) {
             if ($pCsitemap) {
                 $feedurl[] = $pCsitemap;
             }
         }
         $mobSitemaps = $siteMapPlugin->getAllBlogOptions('MobileSitemap');
         foreach ($mobSitemaps as $mobSitemap) {
             if ($mobSitemap) {
                 $feedurl[] = $mobSitemap;
             }
         }
     }
     $feedurl = array_unique($feedurl);
     $request_path = end($v_path);
     $feeds = in_array($request_path, $feedurl, true);
     // finish decode
     if (!$exLink && !$feeds) {
         // URL Not Found
         if (substr(end($v_path), -5) == '.html' && !$iLink) {
             $notFound = TRUE;
             if (!empty($subcatid)) {
                 $linkParam = array($subrequest => $subcatid);
                 $uri = createCategoryLink($catid, $linkParam);
             } elseif (!empty($catid)) {
                 $uri = createCategoryLink($catid);
             } else {
                 $uri = createBlogidLink($blogid);
             }
         } elseif (count($v_path) > $sc && !empty($subcatid) && !$iLink) {
             $notFound = TRUE;
             $linkParam = array($subrequest => $subcatid);
             $uri = createCategoryLink($catid, $linkParam);
         } elseif (count($v_path) >= 2 && !$subcatid && !$iLink) {
             $notFound = TRUE;
             if (isset($catid)) {
                 $uri = createCategoryLink($catid);
             } else {
                 $uri = createBlogidLink($blogid);
             }
         } elseif (reset($v_path) && !$catid && !$subcatid && !$iLink) {
             $notFound = TRUE;
             $uri = createBlogidLink($blogid);
         } else {
             // Found
             // setting $CONF['Self'] for other plugins
             $uri = createBlogidLink($blogid);
             $CONF['Self'] = rtrim($uri, '/');
             $CONF['BlogURL'] = rtrim($uri, '/');
             $CONF['ItemURL'] = rtrim($uri, '/');
             $CONF['CategoryURL'] = rtrim($uri, '/');
             $CONF['ArchiveURL'] = rtrim($uri, '/');
             $CONF['ArchiveListURL'] = rtrim($uri, '/');
             $complete = TRUE;
             return;
         }
     } else {
         $uri = createBlogidLink($blogid);
         $CONF['Self'] = rtrim($uri, '/');
         $CONF['BlogURL'] = rtrim($uri, '/');
         $CONF['ItemURL'] = rtrim($uri, '/');
         $CONF['CategoryURL'] = rtrim($uri, '/');
         $CONF['ArchiveURL'] = rtrim($uri, '/');
         $CONF['ArchiveListURL'] = rtrim($uri, '/');
         $complete = TRUE;
         return;
     }
     // Behavior Not Found
     if ($notFound) {
         if (substr($uri, -1) != '/') {
             $uri .= '/';
         }
         if ($this->getOption('customurl_notfound') == '404') {
             header('HTTP/1.1 404 Not Found');
             doError(_NO_SUCH_URI);
             exit;
         } else {
             header('HTTP/1.1 303 See Other');
             header('Location: ' . $uri);
             exit;
         }
     }
 }
Exemple #5
0
 /**
  * The 'captcha' type action is used to generate the captcha image dynamically.
  * <img src="action.php?action=plugin&name=Captcha&type=captcha&key=xxxxxx">
  */
 function doAction($actionType)
 {
     if ($actionType != 'captcha') {
         return 'invalid action';
     }
     // initialize on first call
     if (!$this->inited) {
         $this->init_captcha();
     }
     $key = getVar('key');
     $width = intGetVar('width');
     $height = intGetVar('height');
     if ($width < 200) {
         $width = -1;
     }
     if ($height < 25) {
         $height = -1;
     }
     $this->generateImage($key, $width, $height);
 }
Exemple #6
0
function bm_doContextMenuCode()
{
    global $CONF;
    ?>
<script type="text/javascript" defer="defer">
doc = external.menuArguments.document;
lt = escape(doc.selection.createRange().text);
loglink = escape(external.menuArguments.location.href);
loglinktitle = escape(doc.title);
wingm = window.open('<?php 
    echo $CONF['AdminURL'];
    ?>
bookmarklet.php?blogid=<?php 
    echo intGetVar('blogid');
    ?>
&logtext=' + lt + '&loglink=' + loglink + '&loglinktitle=' + loglinktitle, 'nucleusbm', 'scrollbars=yes,width=710,height=500,left=10,top=10,status=yes,resizable=yes');
wingm.focus();
</script>
	<?php 
}