+++ /dev/null
-<?php
-
-if (!function_exists('htmlspecialchars_decode')) {
- function htmlspecialchars_decode($text)
- {
- return strtr($text, array_flip(get_html_translation_table(HTML_SPECIALCHARS)));
- }
-}
-
-if (!defined('_CUSTOMURL_TABLE_DEFINED')) {
- define('_CUSTOMURL_TABLE_DEFINED', 1);
- define('_CUSTOMURL_TABLE', sql_table('plug_customurl'));
- define('_C_SUBCAT_TABLE', sql_table('plug_multiple_categories_sub'));
-}
-
-class NP_CustomURL extends NucleusPlugin
-{
-
- function getMinNucleusVersion()
- {
- return '322';
- }
-
- function getName()
- {
- return 'Customized URL';
- }
-
- function getAuthor()
- {
- return 'shizuki';
- }
-
- function getURL()
- {
- return 'http://japan.nucleuscms.org/wiki/plugins:customurl';
- }
-
- function getVersion()
- {
- return '0.3.6b';
- }
-
- function getDescription()
- {
- return _DESCRIPTION;
- }
-
- function supportsFeature($what)
- {
- switch ($what) {
- case 'SqlTablePrefix':
- return 1;
- case 'HelpPage':
- return 1;
- default:
- return 0;
- }
- }
-
- function hasAdminArea()
- {
- return 1;
- }
-
- function event_QuickMenu(&$data)
- {
- global $member;
- $quickLink = ($this->getOption( 'customurl_quicklink') == 'yes');
- $memberCheck = ($member->isLoggedIn() && $member->isAdmin());
- if (!$quickLink || !$memberCheck) {
- return;
- }
- array_push(
- $data['options'],
- array(
- 'title' => _ADMIN_TITLE,
- 'url' => $this->getAdminURL(),
- 'tooltip' => _QUICK_TIPS
- )
- );
- }
-
- function getTableList()
- {
- return array(
- _CUSTOMURL_TABLE
- );
- }
-
- function getEventList()
- {
- return array(
- 'QuickMenu',
- 'ParseURL',
- 'GenerateURL',
- 'PostAddBlog',
- 'PostAddItem',
- 'PostUpdateItem',
- 'PostRegister',
- 'PostAddCategory',
- 'PostDeleteBlog',
- 'PostDeleteItem',
- 'PostDeleteMember',
- 'PostDeleteCategory',
- 'PrePluginOptionsUpdate',
- 'PreItem',
- 'PostItem',
- 'PreSkinParse',
- 'AddItemFormExtras',
- 'EditItemFormExtras',
- 'PostMoveCategory',
- 'PostMoveItem',
- 'InitSkinParse',
- );
- }
-
- function install()
- {
-
-// Can't install when faster requier Nucleus Core Version
- $ver_min = (getNucleusVersion() < $this->getMinNucleusVersion());
- $pat_min = ((getNucleusVersion() == $this->getMinNucleusVersion()) &&
- (getNucleusPatchLevel() < $this->getMinNucleusPatchLevel()));
- if ($ver_min || $pat_min) {
- global $DIR_LIBS;
- // uninstall plugin again...
- include_once($DIR_LIBS . 'ADMIN.php');
- $admin = new ADMIN();
- $admin->deleteOnePlugin($this->getID());
-
- // ...and show error
- $admin->error(_ERROR_NUCLEUSVERSIONREQ .
- $this->getMinNucleusVersion() . ' patch ' .
- $this->getMinNucleusPatchLevel());
- }
-
- global $manager, $CONF;
-// Keys initialize
- if (empty($CONF['ArchiveKey'])) {
- $CONF['ArchiveKey'] = 'archive';
- }
- if (empty($CONF['ArchivesKey'])) {
- $CONF['ArchivesKey'] = 'archives';
- }
- if (empty($CONF['MemberKey'])) {
- $CONF['MemberKey'] = 'member';
- }
- if (empty($CONF['ItemKey'])) {
- $CONF['ItemKey'] = 'item';
- }
- if (empty($CONF['CategoryKey'])) {
- $CONF['CategoryKey'] = 'category';
- }
-
-//Plugins sort
- $plugTable = sql_table('plugin');
- $myid = intval($this->getID());
- $res = sql_query('SELECT pid, porder FROM ' . $plugTable);
- while ($p = mysql_fetch_array($res)) {
- $updateQuery = 'UPDATE %s '
- . 'SET porder = %d '
- . 'WHERE pid = %d';
- if (($pid = intval($p['pid'])) == $myid) {
- $q = sprintf($updateQuery, $plugTable, 1, $myid);
- sql_query($q);
- } else {
- $porder = intval($p['porder']);
- $q = sprintf($updateQuery, $plugTable, $porder + 1, $pid);
- sql_query($q);
- }
- }
-
-//create plugin's options and set default value
- $this->createOption('customurl_archive', _OP_ARCHIVE_DIR_NAME,
- 'text', $CONF['ArchiveKey']);
- $this->createOption('customurl_archives', _OP_ARCHIVES_DIR_NAME,
- 'text', $CONF['ArchivesKey']);
- $this->createOption('customurl_member', _OP_MEMBER_DIR_NAME,
- 'text', $CONF['MemberKey']);
- $this->createOption('customurl_dfitem', _OP_DEF_ITEM_KEY,
- 'text', $CONF['ItemKey']);
- $this->createOption('customurl_dfcat', _OP_DEF_CAT_KEY,
- 'text', $CONF['CategoryKey']);
- $this->createOption('customurl_dfscat', _OP_DEF_SCAT_KEY,
- 'text', 'subcategory');
- $this->createOption('customurl_incbname', _OP_INCLUDE_CBNAME,
- 'yesno', 'no');
- $this->createOption('customurl_tabledel', _OP_TABLE_DELETE,
- 'yesno', 'no');
- $this->createOption('customurl_quicklink', _OP_QUICK_LINK,
- 'yesno', 'yes');
- $this->createOption('customurl_notfound', _OP_NOT_FOUND,
- 'select', '404',
- '404 Not Found|404|303 See Other|303');
- $this->createBlogOption( 'use_customurl', _OP_USE_CURL,
- 'yesno', 'yes');
- $this->createBlogOption( 'redirect_normal', _OP_RED_NORM,
- 'yesno', 'yes');
- $this->createBlogOption( 'redirect_search', _OP_RED_SEARCH,
- 'yesno', 'yes');
- $this->createBlogOption( 'customurl_bname', _OP_BLOG_PATH,
- 'text');
-// $this->createItemOption( 'customurl_iname', _OP_ITEM_PATH,
-// 'text', $CONF['ItemKey']);
- $this->createMemberOption( 'customurl_mname', _OP_MEMBER_PATH,
- 'text');
- $this->createCategoryOption('customurl_cname', _OP_CATEGORY_PATH,
- 'text');
-
- //default archive directory name
- $this->setOption('customurl_archive', $CONF['ArchiveKey']);
- //default archives directory name
- $this->setOption('customurl_archives', $CONF['ArchivesKey']);
- //default member directory name
- $this->setOption('customurl_member', $CONF['MemberKey']);
- //default itemkey_template
- $this->setOption('customurl_dfitem', $CONF['ItemKey']);
- //default categorykey_template
- $this->setOption('customurl_dfcat', $CONF['CategoryKey']);
- //default subcategorykey_template
- $this->setOption('customurl_dfscat', 'subcategory');
-
-//create data table
- $sql = 'CREATE TABLE IF NOT EXISTS ' . _CUSTOMURL_TABLE . ' ('
- . ' `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, '
- . ' `obj_param` VARCHAR(15) NOT NULL, '
- . ' `obj_name` VARCHAR(128) NOT NULL, '
- . ' `obj_id` INT(11) NOT NULL, '
- . ' `obj_bid` INT(11) NOT NULL,'
- . ' INDEX (`obj_name`)'
- . ' )';
- sql_query($sql);
-
-//setting default aliases
- $this->_createNewPath('blog', 'blog', 'bnumber', 'bshortname');
- $this->_createNewPath('item', 'item', 'inumber', 'iblog');
- $this->_createNewPath('category', 'category', 'catid', 'cblog');
- $this->_createNewPath('member', 'member', 'mnumber', 'mname');
-
- if ($this->pluginCheck('MultipleCategories')) {
- $scatTableName = 'plug_multiple_categories_sub';
- $this->_createNewPath('subcategory', $scatTableName, 'scatid', 'catid');
- }
-
- }
-
- function _createNewPath($type, $n_table, $id, $bids)
- {
- $tmpTable = sql_table('plug_customurl_temp');
- $createQuery = 'CREATE TABLE %s '
- . 'SELECT obj_id, obj_param '
- . 'FROM %s '
- . 'WHERE obj_param = "%s"';
- sql_query(sprintf($createQuery, $tmpTable, _CUSTOMURL_TABLE, $type));
- $TmpQuery = 'SELECT %s, %s '
- . 'FROM %s as ttb '
- . 'LEFT JOIN %s as tcu '
- . 'ON ttb.%s = tcu.obj_id '
- . 'WHERE tcu.obj_id is null';
- $table = sql_table($n_table);
- $TmpQuery = sprintf($TmpQuery, $id, $bids, $table, $tmpTable, $id);
- $temp = sql_query($TmpQuery);
- if ($temp) {
- while ($row = mysql_fetch_array($temp)) {
- switch ($type) {
- case 'blog':
- //set access by BlogshortName/
- $newPath = $row[$bids];
- $blgid = 0;
- break;
- case 'item':
- //set access by (itemkey_template)_itemid.html
- $tque = 'SELECT '
- . 'itime as result '
- . 'FROM %s '
- . 'WHERE inumber = %d';
- $tque = sprintf($tque, $table, intval($row[$id]));
- $itime = quickQuery($tque);
- list($y, $m, $d, $trush) = sscanf($itime, '%d-%d-%d %s');
- $param['year'] = sprintf('%04d', $y);
- $param['month'] = sprintf('%02d', $m);
- $param['day'] = sprintf('%02d', $d);
- $itplt = $this->getOption('customurl_dfitem');
- $ikey = TEMPLATE::fill($itplt, $param);
- $newPath = $ikey . '_' . $row[$id] . '.html';
- $blgid = $row[$bids];
- break;
- case 'category':
- //set access by (categorykey_template)_categoryid/
- $newPath = $this->getOption('customurl_dfcat') . '_' . $row[$id];
- $blgid = $row[$bids];
- break;
- case 'member':
- //set access by loginName.html
- $newPath = $row[$bids] . '.html';
- $blgid = 0;
- break;
- case 'subcategory':
- //set access by (subcategorykey_template)_subcategoryid/
- $newPath = $this->getOption('customurl_dfscat') . '_' . $row[$id];
- $blgid = $row[$bids];
- break;
- default:
- break;
- }
- $insertQuery = 'INSERT INTO %s '
- . '(obj_param, obj_id, obj_name, obj_bid) '
- . 'VALUES ("%s", %d, "%s", %d)';
- $row[$id] = intval($row[$id]);
- $blgid = intval($blgid);
- sql_query(sprintf($insertQuery, _CUSTOMURL_TABLE, $type, $row[$id], $newPath, $blgid));
- }
- }
- $query = 'SELECT obj_id, obj_name '
- . 'FROM %s '
- . 'WHERE obj_param = "%s"';
- $temp = sql_query(sprintf($query, _CUSTOMURL_TABLE, $type));
- while ($row = mysql_fetch_array($temp)) {
- $name = $row['obj_name'];
- $id = intval($row['obj_id']);
- switch ($type) {
- case 'blog':
- $this->setBlogOption($id, 'customurl_bname', $name);
- break;
- case 'category':
- $this->setCategoryOption($id, 'customurl_cname', $name);
- break;
- case 'member':
- $obj_name = substr($name, 0, -5);
- $this->setMemberOption($id, 'customurl_mname', $obj_name);
- break;
- default:
- break;
- }
- }
-
- sql_query('DROP TABLE IF EXISTS ' . $tmpTable);
- }
-
- function init()
- {
- global $admin;
- $language = ereg_replace( '[\\|/]', '', getLanguageName());
- if (file_exists($this->getDirectory() . 'language/' . $language . '.php')) {
- include_once($this->getDirectory() . 'language/' . $language . '.php');
- } else {
- include_once($this->getDirectory() . 'language/english.php');
- }
- }
-
- function pluginCheck($pluginName)
- {
- global $manager;
- if (!$manager->pluginInstalled('NP_' . $pluginName)) {
- return;
- }
- $plugin =& $manager->getPlugin('NP_' . $pluginName);
- return $plugin;
- }
-
- function unInstall()
- {
- if ($this->getOption('customurl_tabledel') == 'yes') {
- sql_query("DROP TABLE "._CUSTOMURL_TABLE);
- }
- $this->deleteOption('customurl_archive');
- $this->deleteOption('customurl_archives');
- $this->deleteOption('customurl_member');
- $this->deleteOption('customurl_dfitem');
- $this->deleteOption('customurl_dfcat');
- $this->deleteOption('customurl_dfscat');
- $this->deleteOption('customurl_notfound');
- $this->deleteOption('customurl_tabledel');
- $this->deleteOption('customurl_quicklink');
- $this->deleteBlogOption('use_customurl');
- $this->deleteBlogOption('redirect_normal');
- $this->deleteBlogOption('redirect_search');
- $this->deleteBlogOption('customurl_bname');
-// $this->deleteItemOption('customurl_iname');
- $this->deleteMemberOption('customurl_mname');
- $this->deleteCategoryOption('customurl_cname');
- }
-
- 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) {
- $mcategories->event_PreSkinParse(array());
- 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);
- } else {
- $blogid = $CONF['DefaultBlog'];
- }
- } 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 {
- return;
- }
- }
-
-// 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'));
- if (strpos($uri, $plug_url) === 0 || $u_plugAction) {
- $UsingPlugAdmin = TRUE;
- }
-
-// 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 = htmlspecialchars($que_str);
- if (extension_loaded('mbstring')) {
- $que_str = mb_eregi_replace('/', 'ssslllaaassshhh', $que_str);
- $que_str = mb_eregi_replace("'", 'qqquuuooottt', $que_str);
- $que_str = mb_eregi_replace('&', 'aaammmppp', $que_str);
- } else {
- $que_str = eregi_replace('/', 'ssslllaaassshhh', $que_str);
- $que_str = eregi_replace("'", 'qqquuuooottt', $que_str);
- $que_str = eregi_replace('&', 'aaammmppp', $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;
- }
- }
- 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;
- 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;
- }
- $i = 1;
- 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
- 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
- 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
- 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
- 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
- case $CONF['ArchiveKey']:
- case $this->getOption('customurl_archive'):
- $y = $m = $d = '';
- $ar = $i + 1;
- if (isset($v_path[$i])) {
- $darc = (ereg('([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})', $v_path[$i]));
- $marc = (ereg('([0-9]{4})-([0-9]{1,2})', $v_path[$i]));
- $yarc = (ereg('([0-9]{4})', $v_path[$i]));
- $adarc = (ereg('([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})', $v_path[$ar]));
- $amarc = (ereg('([0-9]{4})-([0-9]{1,2})', $v_path[$ar]));
- $ayarc = (ereg('([0-9]{4})', $v_path[$ar]));
- $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
- 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
- case 'tag':
-// if (isset($v_path[$i]) && is_string($v_path[$i])) {
-// $_REQUEST['tag'] = $v_path[$i];
- $exLink = TRUE;
-// }
- break;
- // for ExtraSkinJP
- case 'extra':
- $ExtraSkinJP = $this->pluginCheck('ExtraSkinJP');
- if ($ExtraSkinJP) {
- // under v3.2 needs this
- if ($CONF['DisableSite'] && !$member->isAdmin()) {
- header('Location: ' . $CONF['DisableSiteURL']);
- exit;
- }
- $extraParams = explode("/", serverVar('PATH_INFO'));
- array_shift ($extraParams);
-
- if (isset($extraParams[1]) && preg_match("/^([1-9]+[0-9]*)(\?.*)?$/", $extraParams[1], $matches)) {
- $extraParams[1] = $matches[1];
- }
-
- $ExtraSkinJP->extra_selector($extraParams);
- exit;
- }
- break;
- // 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 = mb_eregi_replace('ssslllaaassshhh', '/', $que_str);
- $que_str = mb_eregi_replace('qqquuuooottt', "'", $que_str);
- $que_str = mb_eregi_replace('aaammmppp', '&', $que_str);
- } else {
- $que_str = eregi_replace('ssslllaaassshhh', '/', $que_str);
- $que_str = eregi_replace('qqquuuooottt', "'", $que_str);
- $que_str = eregi_replace('aaammmppp', '&', $que_str);
- }
- $que_str = htmlspecialchars_decode($que_str);
- $_GET['query'] = $que_str;
- $query = $que_str;
- $exLink = TRUE;
- }
- break;
- // for pageswitch
- case 'page':
-// if (isset($v_path[$i]) && is_numeric($v_path[$i])) {
-// $_GET['page'] = intval($v_path[$i]);
- $exLink = TRUE;
-// }
- break;
- // 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':
- if (isset($v_path[$i]) && is_string($v_path[$i])) {
- $_REQUEST['special'] = $v_path[$i];
- $exLink = TRUE;
- }
- break;
- // 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
- default:
- // initialyze
- $linkObj = array (
- 'bid' => $blogid,
- 'name' => $pathName
- );
- $comp = FALSE;
- $isItem = (substr($pathName, -5) == '.html');
- // category ?
- if (!$comp && !$cLink && !$iLink && !$isItem) {
- $linkObj['linkparam'] = 'category';
- $cat_id = $this->getRequestPathInfo($linkObj);
- if (!empty($cat_id)) {
- $catid = intval($cat_id);
- $cLink = TURE;
- $comp = TRUE;
- }
- }
- // subcategory ?
- if (!$comp && $cLink && !$iLink && $mcategories && !$isItem) {
- $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++;
- }
-
-// 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);
- }
- $tempQueryString = '?' . $tempQueryString;
- 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;
- }
- }
- }
-
-// decode 'path name' to 'id'
- function getRequestPathInfo($linkObj)
- {
- $query = 'SELECT obj_id as result'
- . ' FROM %s'
- . ' WHERE obj_name = "%s"'
- . ' AND obj_bid = %d'
- . ' AND obj_param = "%s"';
- $name = $this->quote_smart($linkObj['name']);
- $bid = $this->quote_smart($linkObj['bid']);
- $linkparam = $this->quote_smart($linkObj['linkparam']);
- $query = sprintf($query, _CUSTOMURL_TABLE, $name, $bid, $linkparam);
- $ObjID = quickQuery($query);
- if (!$ObjID) {
- return;
- } else {
- return intval($ObjID);
- }
- }
-
-// Receive TrackBack ping
- function _trackback($bid, $path)
- {
- $blog_id = intval($bid);
- $TrackBack = $this->pluginCheck('TrackBack');
- if ($TrackBack) {
- if (substr($path, -5, 5) == '.html') {
- $linkObj = array (
- 'linkparam' => 'item',
- 'bid' => $blog_id,
- 'name' => $path
- );
- $item_id = $this->getRequestPathInfo($linkObj);
- if ($item_id) {
- $tb_id = intval($item_id);
- } else {
- doError(_NO_SUCH_URI);
- }
- } else {
- $tb_id = intval($path);
- }
-
- $errorMsg = $TrackBack->handlePing($tb_id);
- if ($errorMsg != '') {
- $TrackBack->xmlResponse($errorMsg);
- } else {
- $TrackBack->xmlResponse();
- }
- }
- exit;
- }
-
- function event_GenerateURL($data)
- {
- global $CONF, $manager, $blogid;
- if ($data['completed']) {
- return;
- }
- if (is_numeric($blogid)) {
- $blogid = intval($blogid);
- } else {
- $blogid = intval(getBlogIDFromName($blogid));
- }
- $mcategories = $this->pluginCheck('MultipleCategories');
- if ($mcategories) {
- if (method_exists($mcategories, 'getRequestName')) {
- $mcategories->event_PreSkinParse(array());
- global $subcatid;
- $subrequest = $mcategories->getRequestName();
- }
- }
- if ($subcatid) {
- $subcatid = intval($subcatid);
- }
- $OP_ArchiveKey = $this->getOption('customurl_archive');
- $OP_ArchivesKey = $this->getOption('customurl_archives');
- $OP_MemberKey = $this->getOption('customurl_member');
- $params = $data['params'];
- $catParam = $params['extra']['catid'];
- $subcatParam = $params['extra'][$subrequest];
- $useCustomURL = $this->getAllBlogOptions('use_customurl');
- switch ($data['type']) {
- case 'item':
- if (!is_numeric($params['itemid'])) {
- return;
- }
- $item_id = intval($params['itemid']);
- $bid = intval(getBlogIDFromItemID($item_id));
- if ($useCustomURL[$bid] == 'no') {
- return;
- }
- $query = 'SELECT obj_name as result '
- . 'FROM %s '
- . 'WHERE obj_param = "item" '
- . 'AND obj_id = %d';
- $path = quickQuery(sprintf($query, _CUSTOMURL_TABLE, $item_id));
- if ($path) {
- $objPath = $path;
- } else {
- if (!$this->_isValid(array('item', 'inumber', $item_id))) {
- $objPath = _NOT_VALID_ITEM;
- } else {
- $y = $m = $d = $temp = '';
- $table = sql_table('item');
- $tque = 'SELECT itime as result '
- . 'FROM %s '
- . 'WHERE inumber = %d';
- $itime = quickQuery(sprintf($tque ,$table, $item_id));
- sscanf($itime,'%d-%d-%d %s', $y, $m, $d, $temp);
- $defItem = $this->getOption('customurl_dfitem');
- $tempParam = array(
- 'year' => $Y,
- 'month' => $m,
- 'day' => $d
- );
- $ikey = TEMPLATE::fill($defItem, $tempParam);
- $ipath = $ikey . '_' . $item_id;
- $query = 'SELECT ititle as result '
- . 'FROM %s '
- . 'WHERE inumber = %d';
- $query = sprintf($query, $table, $item_id);
- $iname = quickQuery($query);
- $this->RegistPath($item_id, $ipath, $bid, 'item', $iname, TRUE);
- $objPath = $ipath . '.html';
- }
- }
- if ($bid != $blogid) {
- $burl = $this->_generateBlogLink($bid);
- } else {
- $burl = $this->_generateBlogLink($blogid);
- }
- break;
- case 'member':
- if (!is_numeric($params['memberid']) || $useCustomURL[$blogid] =='no') {
- return;
- }
- $memberID = intval($params['memberid']);
- $path = $this->getMemberOption($memberID, 'customurl_mname');
- if ($path) {
- $data['url'] = $this->_generateBlogLink($blogid) . '/'
- . $OP_MemberKey . '/' . $path . '.html';
- $data['completed'] = TRUE;
- return;
- } else {
- if (!$this->_isValid(array('member', 'mnumber', $memberID))) {
- $data['url'] = $this->_generateBlogLink($blogid) . '/'
- . _NOT_VALID_MEMBER;
- $data['completed'] = TRUE;
- return;
- } else {
- $query = 'SELECT mname as result FROM %s'
- . ' WHERE mnumber = %d';
- $table = sql_table('member');
- $mname = quickQuery(sprintf($query, $table, $memberID));
- $this->RegistPath($memberID, $mname, 0, 'member', $mname, TRUE);
- $data['url'] = $this->_generateBlogLink($blogid) . '/'
- . $OP_MemberKey . '/' . $mname . '.html';
- $data['completed'] = TRUE;
- return;
- }
- }
- break;
- case 'category':
- if (!is_numeric($params['catid'])) {
- return;
- }
- $cat_id = intval($params['catid']);
- $bid = intval(getBlogidFromCatID($cat_id));
- if ($useCustomURL[$bid] == 'no') {
- return;
- }
- $objPath = $this->_generateCategoryLink($cat_id);
- if ($bid != $blogid) {
- $burl = $this->_generateBlogLink($bid);
- }
- break;
- case 'archivelist':
- if ($useCustomURL[$blogid] == 'no') {
- return;
- }
- $objPath = $OP_ArchivesKey . '/';;
- $bid = intval($params['blogid']);
- $burl = $this->_generateBlogLink($bid);
- break;
- case 'archive':
- if ($useCustomURL[$blogid] == 'no') {
- return;
- }
- sscanf($params['archive'], '%d-%d-%d', $y, $m, $d);
- if ($d) {
- $arc = sprintf('%04d-%02d-%02d', $y, $m, $d);
- } elseif ($m) {
- $arc = sprintf('%04d-%02d', $y, $m);
- } else {
- $arc = sprintf('%04d', $y);
- }
- $objPath = $OP_ArchiveKey . '/' . $arc . '/';;
- $bid = intval($params['blogid']);
- $burl = $this->_generateBlogLink($bid);
- break;
- case 'blog':
- if (!is_numeric($params['blogid'])) {
- return;
- }
- $bid = intval($params['blogid']);
- $burl = $this->_generateBlogLink($bid);
- break;
- default:
- return;
- }
- if (!$burl) {
- $burl = $this->_generateBlogLink($blogid);
- }
-/*
- //NP_Analyze AdminArea check
- $aplugin = $this->pluginCheck('Analyze');
- if ($aplugin) {
- $aadmin = str_replace('/', '\/', $aplugin->getAdminURL());
- $p_arr = explode('/', serverVar('SCRIPT_NAME'));
- $tmp = array_pop($p_arr);
- $p_info = implode('\/', $p_arr);
- }
- if ($p_info) {
- if (strpos($aadmin, $p_info)) {
- $CONF['UsingAdminArea'] = TRUE;
- }
- }
- //NP_Analyze AdminArea check end
-
- if (getVar('virtualpath')) {
- $info = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', getVar('virtualpath'));
- } elseif (serverVar('PATH_INFO')) {
- $info = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', serverVar('PATH_INFO'));
- }
- $v_path = explode('/', $info);
-
- $feedurl = array();
- $SiteMapP = $this->pluginCheck('GoogleSitemap');
- if ($SiteMapP) {
- $PcSitemaps = $SiteMapP->getAllBlogOptions('PcSitemap');
- foreach ($PcSitemaps as $PCsitemap) {
- if ($PCsitemap) {
- $feedurl[] = $PCsitemap;
- }
- }
- $MobSitemaps = $SiteMapP->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);
-*/
-
- $denyPlugins = array(
- 'np_analyze',
- 'np_googlesitemap',
- );
- $tempdeb=debug_backtrace();
- foreach($tempdeb as $k => $v){
- $analyzePlugin = (strtolower($v['class']) == 'np_analyze');
- $sitemapPlugin = (strtolower($v['class']) == 'np_googlesitemap' ||
- strtolower($v['class']) == 'np_seositemaps');
- if ($analyzePlugin || $sitemapPlugin) {
- $denyPlugin = TRUE;
- }
- }
-
-// if (!$feeds && $bid != $blogid && !$CONF['UsingAdminArea']) {
- if (!$denyPlugin && $bid != $blogid) {
- $params['extra'] = array();
- }
- if ($objPath || $data['type'] == 'blog') {
- $LinkURI = $this->_addLinkParams($objPath, $params['extra']);
- if ($LinkURI) {
- $data['url'] = $burl . '/' . $LinkURI;
- } else {
- $data['url'] = $burl;
- }
- $arcTmp = (preg_match('/' . $OP_ArchivesKey . '/', $data['url']));
- $arcsTmp = (preg_match('/' . $OP_ArchiveKey . '/', $data['url']));
- $isArchives = ($arcTmp || $arcsTmp);
- $isItem = (substr($data['url'], -5, 5) == '.html');
- $isDirectory = (substr($data['url'], -1) == '/');
- $puri = parse_url($data['url']);
-// if (($isArchives && !$puri['query']) || (!$isItem && !$isDirectory && !$puri['query'])) {
- if (!$isItem && !$isDirectory && !$puri['query']) {
- $data['url'] .= '/';
- }
- $data['completed'] = TRUE;
- if (strstr ($data['url'], '//')) {
- $link = preg_replace("/([^:])\/\//", "$1/", $data['url']);
- }
- //$tempdeb=debug_backtrace();
- foreach($tempdeb as $k => $v){
- if (strtolower($v['class']) == 'np_trackback' && strtolower($v['function']) == 'gettrackbackurl') {
- $tb = 1;
- }
- }
- if ($tb == 1 && $data['type'] == 'item' && $isItem) {
- $data['url'] = substr($data['url'], 0, -5);
- }
- return $data;
- }
- }
-
- function _createSubCategoryLink($scid)
- {
- $scids = $this->getParents(intval($scid));
- $subcatids = explode('/', $scids);
- $eachPath = array();
- foreach ($subcatids as $sid) {
- $subcat_id = intval($sid);
- $query = 'SELECT obj_name as result'
- . ' FROM %s'
- . ' WHERE obj_id = %d'
- . ' AND obj_param = "%s"';
- $query = sprintf($query, _CUSTOMURL_TABLE, $subcat_id, 'subcategory');
- $path = quickQuery($query);
- if ($path) {
- $eachPath[] = $path;
- } else {
- $tempParam = array(
- 'plug_multiple_categories_sub',
- 'scatid',
- $subcat_id
- );
- if (!$this->_isValid($tempParam)) {
- return $url = _NOT_VALID_SUBCAT;
- } else {
- $scpath = $this->getOption('customurl_dfscat') . '_' . $subcat_id;
- $query = 'SELECT catid as result FROM %s WHERE scatid = %d';
- $query = sprintf($query, _C_SUBCAT_TABLE, $subcat_id);
- $cid = quickQuery($query);
- if (!$cid) {
- return 'no_such_subcat=' . $subcat_id . '/';
- }
- $this->RegistPath($subcat_id, $scpath, $cid, 'subcategory', 'subcat_' . $subcat_id, TRUE);
- $eachPath[] = $scpath;
- }
- }
- }
- $subcatPath = @implode('/', $eachPath);
- return $subcatPath . '/';
- }
-
- function getParents($subid)
- {
- $mcatPlugin = $this->pluginCheck('MultipleCategories');
- $mcatVarsion = $mcatPlugin->getVersion() * 100;
- if (intval($mcatVarsion) < 40) {
- return intval($subid);
- }
- $subcat_id = intval($subid);
- $query = 'SELECT '
- . 'scatid, '
- . 'parentid '
- . 'FROM %s '
- . 'WHERE scatid = %d';
- $query = sprintf($query, _C_SUBCAT_TABLE, $subcat_id);
- $res = sql_query($query);
- list($sid, $parent) = mysql_fetch_row($res);
- if ($parent != 0) {
- $r = $this->getParents($parent) . '/' . $sid;
- } else {
- $r = $sid;
- }
- return $r;
- }
-
- function _generateCategoryLink($cid)
- {
- global $CONF;
- $cat_id = intval($cid);
- $path = $this->getCategoryOption($cat_id, 'customurl_cname');
- if ($path) {
- return $path . '/';
- } else {
- $catData = array(
- 'category',
- 'catid',
- $cat_id
- );
- if (!$this->_isValid($catData)) {
- return $url = _NOT_VALID_CAT;
- } else {
- $cpath = $this->getOption('customurl_dfcat') . '_' . $cat_id;
- $blog_id = intval(getBlogIDFromCatID($cat_id));
- $catname = 'catid_' . $cat_id;
- $this->RegistPath($cat_id, $cpath, $blog_id, 'category', $catname, TRUE);
- return $cpath . '/';
- }
- }
- }
-
- function _generateBlogLink($bid)
- {
- global $manager, $CONF;
- $blog_id = intval($bid);
-/*
- if ($this->getBlogOption($blog_id, 'use_customurl') == 'no') {
- $b =& $manager->getBlog($blog_id);
- $burl = $b->getURL();
- } else {
- if ($blog_id == $CONF['DefaultBlog']) {
- $burl = trim($CONF['IndexURL'], '/');
- } else {
- $query = 'SELECT burl as result '
- . 'FROM %s '
- . 'WHERE bnumber = %d';
- $query = sprintf($query, sql_table('blog'), $blog_id);
- $burl = quickQuery($query);
- if ($burl) {
- if (substr($burl, -4, 4) == '.php') {
- $path = $this->getBlogOption($blog_id, 'customurl_bname');
- if ($path) {
- $burl = $CONF['IndexURL'] . $path;
- } else {
- $query = 'SELECT bshortname as result'
- . ' FROM %s'
- . ' WHERE bnumber = %d';
- $query = sprintf($query, sql_table('blog'), $blog_id);
- $bpath = quickQuery($query);
- $this->RegistPath($blog_id, $bpath, 0, 'blog', $bpath, TRUE);
- $burl = $CONF['IndexURL'] . $bpath;
- }
- $burl_update = 'UPDATE %s '
- . 'SET burl = "%s" '
- . 'WHERE bnumber = %d';
- $burl = $this->quote_smart($burl);
- $bTable = sql_table('blog');
- sql_query(sprintf($burl_update, $bTable, $burl, $blog_id));
- }
- } else {
- $burl = _NOT_VALID_BLOG;
- }
- }
- }
-//*/
- $param = array(
- 'blog',
- 'bnumber',
- $blog_id
- );
- if (!$this->_isValid($param)) {
- return _NOT_VALID_BLOG;
- }
- $b =& $manager->getBlog($blog_id);
- $burl = $b->getURL();
- if ($this->getBlogOption($blog_id, 'use_customurl') == 'yes') {
- if ($blog_id == $CONF['DefaultBlog'] && $this->getOption('customurl_incbname') == 'no') {
- if (empty($burl)) {
- $this->_updateBlogURL($CONF['IndexURL'], $blog_id);
- }
- $burl = $CONF['IndexURL'];
- } else {
- if (empty($burl)) {
- $burl = $CONF['IndexURL'];
- }
- if (substr($burl, -4) == '.php' || $burl == $CONF['IndexURL']) {
- $path = $this->getBlogOption($blog_id, 'customurl_bname');
- if ($path) {
- $burl = $CONF['IndexURL'] . $path;
- } else {
- $query = 'SELECT bshortname as result'
- . ' FROM %s'
- . ' WHERE bnumber = %d';
- $query = sprintf($query, sql_table('blog'), $blog_id);
- $bpath = quickQuery($query);
- $this->RegistPath($blog_id, $bpath, 0, 'blog', $bpath, TRUE);
- $burl = $CONF['IndexURL'] . $bpath . '/';
- }
-// $burl_update = 'UPDATE %s '
-// . 'SET burl = "%s" '
-// . 'WHERE bnumber = %d';
-// $burl = $this->quote_smart($burl);
-// $bTable = sql_table('blog');
-// sql_query(sprintf($burl_update, $bTable, $burl, $blog_id));
- $this->_updateBlogURL($burl, $blog_id);
- }
- }
- }
-
- return trim($burl, '/');
- }
-
- function _updateBlogURL($burl, $blogid)
- {
- $blogid = intval($blogid);
- $burl_update = 'UPDATE %s '
- . 'SET burl = "%s" '
- . 'WHERE bnumber = %d';
- $burl = $this->quote_smart($burl);
- $bTable = sql_table('blog');
- sql_query(sprintf($burl_update, $bTable, $burl, $blogid));
- }
-
- function _addLinkParams($link, $params)
- {
- global $CONF, $manager, $catid;
- $arcTmp = (preg_match('/' . $this->getOption('customurl_archives') . '/', $link));
- $arcsTmp = (preg_match('/' . $this->getOption('customurl_archive') . '/', $link));
- $isArchives = ($arcTmp || $arcsTmp);
- $mcategories = $this->pluginCheck('MultipleCategories');
- if ($mcategories) {
- $mcategories->event_PreSkinParse(array());
- global $subcatid;
- if (method_exists($mcategories, 'getRequestName')) {
- $subrequest = $mcategories->getRequestName();
- } else {
- $subrequest = 'subcatid';
- }
- }
- if (is_array($params)) {
- if ($params['archives']) {
- $linkExtra = $this->getOption('customurl_archives') . '/';
- unset($params['archives']);
- } elseif ($params['archivelist']) {
- $linkExtra = $this->getOption('customurl_archives') . '/';
- unset($params['archivelist']);
- } elseif ($params['archive']) {
- sscanf($params['archive'], '%d-%d-%d', $y, $m, $d);
- if ($d) {
- $arc = sprintf('%04d-%02d-%02d', $y, $m, $d);
- } elseif ($m) {
- $arc = sprintf('%04d-%02d', $y, $m);
- } else {
- $arc = sprintf('%04d', $y);
- }
- $linkExtra = $this->getOption('customurl_archive') . '/' . $arc;
- unset($params['archive']);
- }
- if ($params['blogid']) {
- unset($params['blogid']);
- }
- $paramlink = array();
- foreach ($params as $param => $value) {
- switch ($param) {
- case 'catid':
- case $CONF['CategoryKey']:
- $cid = intval($value);
- $paramlink[] = $this->_generateCategoryLink($cid);
- break;
- case $subrequest:
- if ($mcategories) {
- $sid = intval($value);
- $paramlink[] = $this->_createSubCategoryLink($sid);
- }
- break;
- default:
- $paramlink[] = $param . '/' . $value . '/';
- break;
- }
- }
- if (substr($link, -5, 5) == '.html' || $isArchives) {
- $link = implode('', $paramlink) . $link;
- } else {
- $link .= implode('', $paramlink);
- }
- }
- if ($linkExtra) {
- $link .= $linkExtra;
- }
- if (requestVar('skinid')) {
- $skinid = htmlspecialchars(requestVar('skinid'), ENT_QUOTES, _CHARSET);
- if (!$link) {
- $link = '?skinid=' . $skinid;
- } elseif (strpos('?', $link)) {
- $link .= '&skinid=' . $skinid;
- } else {
- if (substr($link, -1) != '/' && !empty($link)) {
- $link .= '/?skinid=' . $skinid;
- } else {
- $link .= '?skinid=' . $skinid;
- }
- }
- }
- if (strstr ($link, '//')) {
- $link = preg_replace("/([^:])\/\//", "$1/", $link);
- }
- return $link;
- }
-
- function doSkinVar($skinType, $link_type = '', $target = '', $title = '')
- {
- global $blogid;
- if ($skinType == 'item' && $link_type == 'trackback') {
- global $itemid, $CONF;
- if ($this->getBlogOption($blogid, 'use_customurl') == 'yes') {
- $que = 'SELECT obj_name as result '
- . 'FROM %s '
- . 'WHERE obj_param = "item" '
- . 'AND obj_id = %d';
- $itempath = quickQuery(sprintf($que, _CUSTOMURL_TABLE, $itemid));
- if ($target != 'ext') {
- $uri = $CONF['BlogURL'] . '/trackback/' . $itempath;
- } elseif ($target == 'ext') {
-// /item_123.trackback
- $itempath = substr($itempath, 0, -5) . '.trackback';
- $uri = $CONF['BlogURL'] . '/' . $itempath;
- }
- } else {
- $uri = $CONF['ActionURL']
- . '?action=plugin&name=TrackBack&tb_id=' . $itemid;
- }
- echo $uri;
- return;
- }
- // $data == type / id || name / 'i'd || 'n'ame
- // ex. => [(b)log / blogid [|| shortname / 'i'd || 'n'ame]]
- // (c)at / catid [|| cname / 'i'd || 'n'ame]
- // (s)cat / subcatid [|| sname / 'i'd || 'n'ame]
- // [(i)tem /] itemid [/ 'path']
- // (m)ember / mnumber [|| mname / 'i'd || 'n'ame]
- //
- // if second param is null, third param is id
- // if param is null, generate blog link
- if (!$link_type) {
- $link_params = '0, b/' . intval($blogid) . '/i,'
- . $target . ',' . $title;
- } else {
- $l_params = explode("/", $link_type);
- if (count($l_params) == 1) {
- $link_params = array(0, 'b/' . intval($link_type) . '/i,'
- . $target . ',' . $title);
- } else {
- $link_params = array(0,
- $link_type . ',' . $target . ',' . $title);
- }
- }
- echo $this->URL_Callback($link_params);
- }
-
- function doTemplateVar(&$item, $link_type = '', $target = '', $title = '')
- {
- $item_id = intval($item->itemid);
- if ($link_type == 'trackback') {
- global $CONF;
- $blog_id = intval(getBlogIDFromItemID($item_id));
- if ($this->getBlogOption($blog_id, 'use_customurl') == 'yes') {
- $que = 'SELECT obj_name as result '
- . 'FROM %s '
- . 'WHERE obj_param = "item" '
- . 'AND obj_id = %d';
- $itempath = quickQuery(sprintf($que, _CUSTOMURL_TABLE, $item_id));
- if ($target != 'ext') {
- $uri = $CONF['BlogURL'] . '/trackback/' . $itempath;
- } elseif ($target == 'ext') {
-// /item_123.trackback
- $itempath = substr($itempath, 0, -5) . '.trackback';
- $uri = $CONF['BlogURL'] . '/' . $itempath;
- }
- } else {
- $uri = $CONF['ActionURL']
- . '?action=plugin&name=TrackBack&tb_id=' . $item_id;
- }
- echo $uri;
- return;
- }
- if (!$link_type || $link_type == 'subcategory') {
- $link_params = array(0,
- 'i/' . $item_id . '/i,' . $target . ',' . $title);
- } elseif ($link_type == 'path') {
- $link_params = array(0,
- 'i/' . $item_id . '/path,' . $target . ',' . $title);
- } else {
- $link_params = array(0,
- $link_type . ',' . $target . ',' . $title);
- }
- if ($link_type == 'subcategory') {
- echo $this->URL_Callback($link_params, 'scat');
- } else {
- echo $this->URL_Callback($link_params);
- }
- }
-
- function URL_Callback($data, $scatFlag = '')
- {
- $l_data = explode(",", $data[1]);
- $l_type = $l_data[0];
- $target = $l_data[1];
- $title = $l_data[2];
- $item_id = intval($this->currentItem->itemid);
- if (!$l_type) {
- $link_params = array (
- 'i',
- $item_id,
- 'i'
- );
- } else {
- $link_data = explode("/", $l_type);
- if (count($link_data) == 1) {
- $link_params = array (
- 'i',
- intval($l_type),
- 'i'
- );
- } elseif (count($link_data) == 2) {
- if ($link_data[1] == 'path') {
- $link_params = array (
- 'i',
- $link_data[0],
- 'path'
- );
- } else {
- $link_params = array (
- $link_data[0],
- intval($link_data[1]),
- 'i'
- );
- }
- } else {
- $link_params = array (
- $link_data[0],
- $link_data[1],
- $link_data[2]
- );
- }
- }
- $url = $this->_genarateObjectLink($link_params, $scatFlag);
- if ($target) {
- if ($title) {
- $ObjLink = '<a href="' . htmlspecialchars($url) . '" '
- . 'title="' . htmlspecialchars($title) . '">'
- . htmlspecialchars($target) . '</a>';
- } else {
- $ObjLink = '<a href="' . htmlspecialchars($url) . '" '
- . 'title="' . htmlspecialchars($target) . '">'
- . htmlspecialchars($target) . '</a>';
- }
- } else {
- $ObjLink = htmlspecialchars($url);
- }
- return $ObjLink;
- }
-
- function _isValid($data)
- {
- $query = 'SELECT * FROM %s WHERE %s = %d';
- $data[2] = $this->quote_smart($data[2]);
- $query = sprintf($query, sql_table($data[0]), $data[1], $data[2]);
- $res = sql_query($query);
- return (mysql_num_rows($res) != 0);
- }
-
- function _genarateObjectLink($data, $scatFlag = '')
- {
- global $CONF, $manager, $blog;
- $ext = substr(serverVar('REQUEST_URI'), -4);
- if ($ext == '.rdf' || $ext == '.xml') {
- $CONF['URLMode'] = 'pathinfo';
- }
- if ($CONF['URLMode'] != 'pathinfo') {
- return;
- }
- $query = 'SELECT %s as result FROM %s WHERE %s = "%s"';
- switch ($data[0]) {
- case 'b':
- if ($data[2] == 'n') {
- $bid = getBlogIDFromName($data[1]);
- } else {
- $bid = $data[1];
- }
- $blog_id = intval($bid);
- $param = array(
- 'blog',
- 'bnumber',
- $blog_id
- );
- if (!$this->_isValid($param)) {
- $url = _NOT_VALID_BLOG;
- } else {
- $url = $this->_generateBlogLink($blog_id) . '/';
- }
- break;
- case 'c':
- if ($data[2] == 'n') {
- $cid = getCatIDFromName($data[1]);
- } else {
- $cid = $data[1];
- }
- $cat_id = intval($cid);
- $param = array(
- 'category',
- 'catid',
- $cat_id
- );
- if (!$this->_isValid($param)) {
- $url = _NOT_VALID_CAT;
- } else {
- $url = createCategoryLink($cat_id);
- }
- break;
- case 's':
- $mcategories = $this->pluginCheck('MultipleCategories');
- if ($mcategories) {
- if ($data[2] == 'n') {
- $temp = $this->quote_smart($data[1]);
- $sque = sprintf($query, 'scatid', _C_SUBCAT_TABLE, 'sname', $temp);
- $scid = quickQuery($sque);
- } else {
- $scid = $data[1];
- }
- $sub_id = intval($scid);
- $param = array(
- 'plug_multiple_categories_sub',
- 'scatid',
- $sub_id
- );
- if (!$this->_isValid($param)) {
- $url = _NOT_VALID_SUBCAT;
- } else {
- $cqe = sprintf($query, 'catid', _C_SUBCAT_TABLE, 'scatid', $sub_id);
- $cid = quickQuery($cqe);
- $cid = intval($cid);
- if (method_exists($mcategories, "getRequestName")) {
- $subrequest = $mcategories->getRequestName();
- }
- if (!$subrequest) {
- $subrequest = 'subcatid';
- }
- $linkParam = array(
- $subrequest => $sub_id
- );
- $url = createCategoryLink($cid, $linkParam);
- }
- }
- break;
- case 'i':
- $param = array(
- 'item',
- 'inumber',
- intval($data[1])
- );
- if (!$this->_isValid($param)) {
- $url = _NOT_VALID_ITEM;
- } else {
- if ($scatFlag) {
- global $catid, $subcatid;
- if (!empty($catid)) {
- $linkparams['catid'] = intval($catid);
- }
- if (!empty($subcatid)) {
- $mcategories = $this->pluginCheck('MultipleCategories');
- if ($mcategories) {
- if (method_exists($mcategories, 'getRequestName')) {
- $subrequest = $mcategories->getRequestName();
- } else {
- $subrequest = 'subcatid';
- }
- }
- $linkparams[$subrequest] = intval($subcatid);
- }
- $url = createItemLink(intval($data[1]), $linkparams);
- } else {
- $blink = $this->_generateBlogLink(getBlogIDFromItemID(intval($data[1])));
- $i_query = 'SELECT obj_name as result '
- . 'FROM %s '
- . 'WHERE obj_param = "item" '
- . 'AND obj_id = %d';
- $i_query = sprintf($i_query, _CUSTOMURL_TABLE, intval($data[1]));
- $path = quickQuery($i_query);
- if ($path) {
- if ($data[2] == 'path') {
- $url = $path;
- } else {
- $url = $blink . '/' . $path;
- }
- } else {
- if ($data[2] == 'path') {
- $url = $CONF['ItemKey'] . '/'
- . intval($data[1]);
- } else {
- $url = $blink . '/' . $CONF['ItemKey'] . '/'
- . intval($data[1]);
- }
- }
- }
- }
- break;
- case 'm':
- if ($data[2] == 'n') {
- $data[1] = $this->quote_smart($data[1]);
- $mque = sprintf($query, 'mnumber', sql_table('member'), 'mname', $data[1]);
- $mid = quickQuery($mque);
- } else {
- $mid = $data[1];
- }
- $member_id = intval($mid);
- $param = array(
- 'member',
- 'mnumber',
- $member_id
- );
- if (!$this->_isValid($param)) {
- $url = _NOT_VALID_MEMBER;
- } else {
- $url = createMemberLink($member_id);
- }
- break;
- }
- return $url;
- }
-
- 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);
- }
- header('Content-Type: application/xml');
- 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 htmlspecialchars($CONF['SiteName'], ENT_QUOTES)?></title>
- <link><?php echo htmlspecialchars($CONF['IndexURL'], ENT_QUOTES)?></link>
- <description></description>
- <docs>http://backend.userland.com/rss</docs>
- </channel>
-</rss>
-<?php
- }
- }
- exit;
- }
- }
-
- function getSkinContent($pageType, $skinID)
- {
- $skinID = intval($skinID);
- $pageType = addslashes($pageType);
- $query = 'SELECT scontent '
- . 'FROM %s '
- . 'WHERE sdesc = %d '
- . 'AND stype = %d';
- $query = sprintf($query, sql_table('skin'), $skinID, $pageType);
- $res = sql_query($query);
-
- if (mysql_num_rows($res) == 0) {
- return '';
- } else {
- return mysql_result($res, 0, 0);
- }
- }
-
-
-// merge NP_RightURL
- function event_PreSkinParse($data)
- {
- global $CONF, $manager, $blog, $catid, $itemid, $subcatid;
- global $memberid;
- if (!$blog) {
- $b =& $manager->getBlog($CONF['DefaultBlog']);
- } else {
- $b =& $blog;
- }
- $blogurl = $b->getURL();
-
- if (!$blogurl) {
- if($blog) {
- $b_tmp =& $manager->getBlog($CONF['DefaultBlog']);
- $blogurl = $b_tmp->getURL();
- }
- if (!$blogurl) {
- $blogurl = $CONF['IndexURL'];
- if ($CONF['URLMode'] != 'pathinfo'){
- if ($data['type'] == 'pageparser') {
- $blogurl .= 'index.php';
- } else {
- $blogurl = $CONF['Self'];
- }
- }
- }
- }
- if ($CONF['URLMode'] == 'pathinfo'){
- if (substr($blogurl, -1) == '/') {
- $blogurl = substr($blogurl, 0, -1);
- }
- }
- $CONF['BlogURL'] = $blogurl;
- $CONF['ItemURL'] = $blogurl;
- $CONF['CategoryURL'] = $blogurl;
- $CONF['ArchiveURL'] = $blogurl;
- $CONF['ArchiveListURL'] = $blogurl;
- $CONF['SearchURL'] = $blogurl;
-// $CONF['MemberURL'] = $blogurl;
- }
-
- function event_PreItem($data)
- {
- global $CONF, $manager;
-
- $this->currentItem = &$data['item'];
- $pattern = '/<%CustomURL\((.*)\)%>/';
- $data['item']->body = preg_replace_callback($pattern, array(&$this, 'URL_Callback'), $data['item']->body);
- if ($data['item']->more) {
- $data['item']->more = preg_replace_callback($pattern, array(&$this, 'URL_Callback'), $data['item']->more);
- }
-
- $itemid = intval($data['item']->itemid);
- $itemblog =& $manager->getBlog(getBlogIDFromItemID($itemid));
- $blogurl = $itemblog->getURL();
- if (!$blogurl) {
- $b =& $manager->getBlog($CONF['DefaultBlog']);
- if (!($blogurl = $b->getURL())) {
- $blogurl = $CONF['IndexURL'];
- if ($CONF['URLMode'] != 'pathinfo'){
- if ($data['type'] == 'pageparser') {
- $blogurl .= 'index.php';
- } else {
- $blogurl = $CONF['Self'];
- }
- }
- }
- }
- if ($CONF['URLMode'] == 'pathinfo'){
- if (substr($blogurl, -1) == '/') {
- $blogurl = substr($blogurl, 0, -1);
- }
- }
- $CONF['BlogURL'] = $blogurl;
- $CONF['ItemURL'] = $blogurl;
- $CONF['CategoryURL'] = $blogurl;
- $CONF['ArchiveURL'] = $blogurl;
- $CONF['ArchiveListURL'] = $blogurl;
-// $CONF['MemberURL'] = $blogurl;
- }
-
- function event_PostItem($data)
- {
- global $CONF, $manager, $blog;
- if (!$blog) {
- $b =& $manager->getBlog($CONF['DefaultBlog']);
- } else {
- $b =& $blog;
- }
- $blogurl = $b->getURL();
- if (!$blogurl) {
- if($blog) {
- $b_tmp =& $manager->getBlog($CONF['DefaultBlog']);
- $blogurl = $b_tmp->getURL();
- }
- if (!$blogurl) {
- $blogurl = $CONF['IndexURL'];
- if ($CONF['URLMode'] != 'pathinfo'){
- if ($data['type'] == 'pageparser') {
- $blogurl .= 'index.php';
- } else {
- $blogurl = $CONF['Self'];
- }
- }
- }
- }
- if ($CONF['URLMode'] == 'pathinfo'){
- if (substr($blogurl, -1) == '/') {
- $blogurl = substr($blogurl, 0, -1);
- }
- }
- $CONF['BlogURL'] = $blogurl;
- $CONF['ItemURL'] = $blogurl;
- $CONF['CategoryURL'] = $blogurl;
- $CONF['ArchiveURL'] = $blogurl;
- $CONF['ArchiveListURL'] = $blogurl;
-// $CONF['MemberURL'] = $CONF['Self'];
- }
-// merge NP_RightURL end
-
- function event_PostDeleteBlog ($data)
- {
- $query = 'DELETE FROM %s WHERE obj_id = %d AND obj_param = "%s"';
- $pquery = 'DELETE FROM %s WHERE obj_bid = %d AND obj_param= "%s"';
- $blogid = intval($data['blogid']);
- sql_query(sprintf($query, _CUSTOMURL_TABLE, $blogid, 'blog'));
- sql_query(sprintf($pquery, _CUSTOMURL_TABLE, $blogid, 'item'));
- $cnmquery = 'SELECT catid FROM %s WHERE cblog = %d';
- $table = sql_table('category');
- $cnm = sql_query(sprintf($cnmquery, $table, $blogid));
- while ($c = mysql_fetch_object($cnm)) {
- $catid = intval($c->catid);
- sql_query(sprintf($pquery, _CUSTOMURL_TABLE, $catid, 'subcategory'));
- sql_query(sprintf($query, _CUSTOMURL_TABLE, $catid, 'category'));
- }
- }
-
- function event_PostDeleteCategory ($data)
- {
- $query = 'DELETE FROM %s WHERE obj_id = %d AND obj_param = "%s"';
- $squery = 'DELETE FROM %s WHERE obj_bid = %d AND obj_param = "%s"';
- $catid = intval($data['catid']);
- sql_query(sprintf($query, _CUSTOMURL_TABLE, $catid, 'category'));
- sql_query(sprintf($squery, _CUSTOMURL_TABLE, $catid, 'subcategory'));
- }
-
- function event_PostDeleteItem ($data)
- {
- $query = 'DELETE FROM %s WHERE obj_id = %d AND obj_param = "%s"';
- $itemid = intval($data['itemid']);
- sql_query(sprintf($query, _CUSTOMURL_TABLE, $itemid, 'item'));
- }
-
- function event_PostDeleteMember ($data)
- {
- $query = 'DELETE FROM %s WHERE obj_id = %d AND obj_param = "%s"';
- $memberid = intval($data['member']->id);
- sql_query(sprintf($query, _CUSTOMURL_TABLE, $memberid, 'member'));
- }
-
- function event_PostAddBlog ($data)
- {
- $blog_id = intval($data['blog']->blogid);
- $bshortname = $data['blog']->settings['bshortname'];
- $this->RegistPath($blog_id, $bshortname, 0, 'blog', $bshortname, TRUE);
- $this->setBlogOption($blog_id, 'customurl_bname', $bshortname);
- }
-
- function event_PostAddCategory ($data)
- {
- global $CONF;
- $cat_id = intval($data['catid']);
- if (!$data['blog']->blogid) {
- $query = 'SELECT cblog as result FROM %s WHERE catid = %d';
- $bid = quickQuery(sprintf($query, sql_table('category'), $cat_id));
- } else {
- $bid = $data['blog']->blogid;
- }
- if (!$data['name']) {
- $query = 'SELECT cname as result FROM %s WHERE catid = %d';
- $name = quickQuery(sprintf($query, sql_table('category'), $cat_id));
- } else {
- $name = $data['name'];
- }
- $bid = intval($bid);
- $dfcat = $this->getOption('customurl_dfcat');
- $catpsth = $dfcat . '_' . $cat_id;
- $this->RegistPath($cat_id, $catpsth, $bid, 'category', $name, TRUE);
- $this->setCategoryOption($cat_id, 'customurl_cname', $catpsth);
- }
-
- function event_PostAddItem ($data)
- {
- $item_id = intval($data['itemid']);
- $tpath = requestVar('plug_custom_url_path');
- $tque = 'SELECT itime as result FROM %s WHERE inumber = %d';
- $itime = quickQuery(sprintf($tque, sql_table('item'), $item_id));
- list($y, $m, $d, $trush) = sscanf($itime, '%d-%d-%d %s');
- $param['year'] = sprintf('%04d', $y);
- $param['month'] = sprintf('%02d', $m);
- $param['day'] = sprintf('%02d', $d);
- $ipath = TEMPLATE::fill($tpath, $param);
- $query = 'SELECT ititle as result FROM %s WHERE inumber = %d';
- $iname = quickQuery(sprintf($query, sql_table('item'), $item_id));
- $blog_id = intval(getBlogIDFromItemID($item_id));
- $this->RegistPath($item_id, $ipath, $blog_id, 'item', $iname, TRUE);
- if ($this->pluginCheck('TrackBack')) {
- $this->convertLocalTrackbackURL($data);
- }
- }
-
- function event_PostRegister ($data)
- {
- $memberID = intval($data['member']->id);
- $dispName = $data['member']->displayname;
- $this->RegistPath($memberID, $dispName, 0, 'member', $dispName, TRUE);
- $this->setMemberOption($memberID, 'customurl_mname', $dispName);
- }
-
- function event_AddItemFormExtras(&$data)
- {
- $this->createItemForm();
- }
-
- function event_EditItemFormExtras(&$data)
- {
- $this->createItemForm(intval($data['itemid']));
- }
-
- function event_PostUpdateItem($data)
- {
- $tpath = requestVar('plug_custom_url_path');
- $item_id = intval($data['itemid']);
- $tque = 'SELECT itime as result FROM %s WHERE inumber = %d';
- $itime = quickQuery(sprintf($tque ,sql_table('item'), $item_id));
- list($y, $m, $d, $trush) = sscanf($itime, '%d-%d-%d %s');
- $param['year'] = sprintf('%04d', $y);
- $param['month'] = sprintf('%02d', $m);
- $param['day'] = sprintf('%02d', $d);
- $ipath = TEMPLATE::fill($tpath, $param);
- $query = 'SELECT ititle as result FROM %s WHERE inumber = %d';
- $iname = quickQuery(sprintf($query, sql_table('item'), $item_id));
- $blog_id = intval(getBlogIDFromItemID($item_id));
- $this->RegistPath($item_id, $ipath, $blog_id, 'item', $iname);
- if ($this->pluginCheck('TrackBack')) {
- $this->convertLocalTrackbackURL($data);
- }
- }
-
- function createItemForm($item_id = 0)
- {
- global $CONF;
- if ($item_id) {
- $query = 'SELECT obj_name as result'
- . ' FROM %s'
- . ' WHERE obj_param = "item"'
- . ' AND obj_id = %d';
- $item_id = intval($item_id);
- $res = quickQuery(sprintf($query, _CUSTOMURL_TABLE, $item_id));
- $ipath = substr($res, 0, strlen($res)-5);
- } else {
- $ipath = $this->getOption('customurl_dfitem');
- }
- echo <<<OUTPUT
-<h3>Custom URL</h3>
-<p>
-<label for="plug_custom_url">Custom Path:</label>
-<input id="plug_custom_url" name="plug_custom_url_path" value="{$ipath}" />
-</p>
-OUTPUT;
- }
-
- function event_PrePluginOptionsUpdate($data)
- {
- $blog_option = ($data['optionname'] == 'customurl_bname');
- $cate_option = ($data['optionname'] == 'customurl_cname');
- $memb_option = ($data['optionname'] == 'customurl_mname');
- $arch_option = ($data['optionname'] == 'customurl_archive');
- $arvs_option = ($data['optionname'] == 'customurl_archives');
- $memd_option = ($data['optionname'] == 'customurl_member');
- $contextid = intval($data['contextid']);
- $context = $data['context'];
- if ($blog_option || $cate_option || $memb_option) {
- if ($context == 'member' ) {
- $blogid = 0;
- $query = 'SELECT mname as result FROM %s WHERE mnumber = %d';
- $table = sql_table('member');
- $name = quickQuery(sprintf($query, $table, $contextid));
- } elseif (context == 'category') {
- $blogid = getBlogIDFromCatID($contextid);
- $query = 'SELECT cname as result FROM %s WHERE catid = %d';
- $table = sql_table('category');
- $name = quickQuery(sprintf($query, $table, $contextid));
- } else {
- $blogid = 0;
- $query = 'SELECT bname as result FROM %s WHERE bnumber = %d';
- $table = sql_table('blog');
- $name = quickQuery(sprintf($query, $table, $contextid));
- }
- $blogid = intval($blogid);
- $msg = $this->RegistPath($contextid, $data['value'], $blogid, $context, $name);
- if ($msg) {
- $this->error($msg);
- exit;
- }
- } elseif ($arch_option || $arvs_option || $memd_option) {
- if (!ereg("^[-_a-zA-Z0-9]+$", $data['value'])) {
- $name = substr($data['optionname'], 8);
- $msg = array (1, _INVALID_ERROR, $name, _INVALID_MSG);
- $this->error($msg);
- exit;
- } else {
- return;
- }
- }
- return;
- }
-
- function event_PostMoveItem($data)
- {
- $query = 'UPDATE %s SET obj_bid = %d'
- . ' WHERE obj_param = "%s" AND obj_id = %d';
- $destblogid = intval($data['destblogid']);
- $item_id = intval($data['itemid']);
- sql_query(sprintf($query, _CUSTOMURL_TABLE, $destblogid, 'item', $item_id));
- }
-
- function event_PostMoveCategory($data)
- {
- $query = 'UPDATE %s SET obj_bid = %d'
- . ' WHERE obj_param = "%s" AND obj_id = %d';
- $destblogid = intval($data['destblog']->blogid);
- $cat_id = intval($data['catid']);
- sql_query(sprintf($query, _CUSTOMURL_TABLE, $destblogid, 'category', $cat_id));
- $query = 'SELECT inumber FROM %s WHERE icat = %d';
- $query = sprintf($query, sql_table('item'), $cat_id);
- $items = sql_query($query);
- while ($oItem = mysql_fetch_object($items)) {
- $odata = array(
- 'destblogid' => $destblogid,
- 'itemid' => $oItem->inumber
- );
- $this->event_PostMoveItem($odata);
- }
- }
-
- function RegistPath($objID, $path, $bid, $oParam, $name, $new = FALSE )
- {
- global $CONF;
- switch($oParam) {
- case 'item':
- case 'member':
- if (preg_match('/.html$/', $path))
- $path = substr($path, 0, -5);
- break;
- case 'blog':
- case 'category':
- case 'subcategory':
- break;
- default :
- return;
- break;
- }
- $bid = intval($bid);
- $objID = intval($objID);
- $name = rawurlencode($name);
-
- if ($new && $oParam == 'item') {
- $tque = 'SELECT itime as result FROM %s WHERE inumber = %d';
- $itime = quickQuery(sprintf($tque ,sql_table('item'), $objID));
- list($y, $m, $d, $trush) = sscanf($itime, '%d-%d-%d %s');
- $param['year'] = sprintf('%04d', $y);
- $param['month'] = sprintf('%02d', $m);
- $param['day'] = sprintf('%02d', $d);
- $ikey = TEMPLATE::fill($template, $param);
- if ($path == $ikey) {
- $path = $ikey . '_' . $objID;
- }
- } elseif (!$new && strlen($path) == 0) {
- $del_que = 'DELETE FROM %s WHERE obj_id = %d AND obj_param = "%s"';
- sql_query(sprintf($del_que, _CUSTOMURL_TABLE, $objID, $oParam));
- $msg = array (0, _DELETE_PATH, $name, _DELETE_MSG);
- return $msg;
- exit;
- }
-
- $dotslash = array ('.', '/');
- $path = str_replace ($dotslash, '_', $path);
- if (!ereg("^[-_a-zA-Z0-9]+$", $path)) {
- $msg = array (1, _INVALID_ERROR, $name, _INVALID_MSG);
- return $msg;
- exit;
- }
-
- $tempPath = $path;
- if ($oParam == 'item' || $oParam == 'member') $tempPath .= '.html';
- $conf_que = 'SELECT obj_id FROM %s'
- . ' WHERE obj_name = "%s"'
- . ' AND obj_bid = %d'
- . ' AND obj_param = "%s"'
- . ' AND obj_id != %d';
- $res = sql_query(sprintf($conf_que, _CUSTOMURL_TABLE, $tempPath, $bid, $oParam, $objID));
- if ($res && mysql_num_rows($res)) {
- $msg = array (0, _CONFLICT_ERROR, $name, _CONFLICT_MSG);
- $path .= '_'.$objID;
- }
- if ($oParam == 'category' && !$msg) {
- $conf_cat = 'SELECT obj_id FROM %s WHERE obj_name = "%s"'
- . ' AND obj_param = "blog"';
- $res = sql_query(sprintf($conf_cat, _CUSTOMURL_TABLE, $tempPath));
- if ($res && mysql_num_rows($res)) {
- $msg = array (0, _CONFLICT_ERROR, $name, _CONFLICT_MSG);
- $path .= '_'.$objID;
- }
- }
- if ($oParam == 'blog' && !$msg) {
- $conf_blg = 'SELECT obj_id FROM %s WHERE obj_name = "%s"'
- . ' AND obj_param = "category"';
- $res = sql_query(sprintf($conf_blg, _CUSTOMURL_TABLE, $tempPath));
- if ($res && mysql_num_rows($res)) {
- $msg = array (0, _CONFLICT_ERROR, $name, _CONFLICT_MSG);
- $path .= '_'.$objID;
- }
- }
-
- $newPath = $path;
- if ($oParam == 'item' || $oParam == 'member') $newPath .= '.html';
- $query = 'SELECT * FROM %s WHERE obj_id = %d AND obj_param = "%s"';
- $res = sql_query(sprintf($query, _CUSTOMURL_TABLE, $objID, $oParam));
- $row = mysql_fetch_object($res);
- $pathID = $row->id;
- if ($pathID) {
- $query = 'UPDATE %s SET obj_name = "%s" WHERE id = %d';
- sql_query(sprintf($query, _CUSTOMURL_TABLE, $newPath, $pathID));
- } else {
- $query = 'INSERT INTO %s (obj_param, obj_name, obj_id, obj_bid)'
- . ' VALUES ("%s", "%s", %d, %d)';
- sql_query(sprintf($query, _CUSTOMURL_TABLE, $oParam, $newPath, $objID, $bid));
- }
- switch($oParam) {
- case 'blog':
- $this->setBlogOption($objID, 'customurl_bname', $path);
- break;
- case 'category':
- $this->setCategoryOption($objID, 'customurl_cname', $path);
- break;
- case 'member':
- $this->setMemberOption($objID, 'customurl_mname', $path);
- break;
- default :
- break;
- }
- return $msg;
- }
-
- function error($msg = '')
- {
- global $admin;
-
- $admin->pagehead();
- echo $msg[1].' : '.$msg[2].'<br />';
- echo $msg[3].'<br />';
- echo '<a href="index.php" onclick="history.back()">'._BACK.'</a>';
- $admin->pagefoot();
- return;
- }
-
- function quote_smart($value)
- {
- if (get_magic_quotes_gpc()) $value = stripslashes($value);
- if (!is_numeric($value)) {
- $value = mysql_real_escape_string($value);
- } elseif (is_numeric($value)) {
- $value = intval($value);
- }
- return $value;
- }
-
- function convertLocalTrackbackURL($data)
- {
- global $manager, $CONF;
- $ping_urls_count = 0;
- $ping_urls = array();
- $localflag = array();
- $ping_url = requestVar('trackback_ping_url');
- if (trim($ping_url)) {
- $ping_urlsTemp = array();
- $ping_urlsTemp = preg_split("/[\s,]+/", trim($ping_url));
- for ($i = 0; $i < count($ping_urlsTemp); $i++) {
- $ping_urls[] = trim($ping_urlsTemp[$i]);
- $ping_urls_count++;
- }
- }
- $tb_url_amount = intRequestVar('tb_url_amount');
- for ($i=0; $i < $tb_url_amount; $i++) {
- $tb_temp_url = requestVar('tb_url_' . $i);
- if ($tb_temp_url) {
- $ping_urls[$ping_urls_count] = $tb_temp_url;
- $localflag[$ping_urls_count] = (requestVar('tb_url_' . $i . '_local') == 'on') ? 1 : 0;
- $ping_urls_count++;
- }
- }
- if ($ping_urls_count <= 0) {
- return;
- }
- $blog_id = getBlogidFromItemID(intval($data['itemid']));
- for ($i=0; $i < count($ping_urls); $i++) {
- if($localflag[$i]) {
- $tmp_url = parse_url($ping_urls[$i]);
- $tmp_url['path'] = trim($tmp_url['path'], '/');
- $path_arr = explode("/", $tmp_url['path']);
- $tail = end($path_arr);
- $linkObj = array (
- 'linkparam' => 'item',
- 'bid' => $blog_id,
- );
- if (substr($tail, -10) == '.trackback') {
- $pathName = substr($tail, 0, -10);
- if (substr($pathName, -5) == '.html') {
- $linkObj['name'] = $pathName;
- } else {
- $linkObj['name'] = $pathName . '.html';
- }
- } else {
- $linkObj['name'] = $tail;
- }
- $item_id = $this->getRequestPathInfo($linkObj);
- if ($item_id) {
- $ping_urls[$i] = $CONF['ActionURL']
- . '?action=plugin&name=TrackBack&tb_id=' . $item_id;
- }
- }
- }
- $_REQUEST['trackback_ping_url'] = implode ("\n", $ping_urls);
- }
-
-}
+++ /dev/null
-<h3>Outline of plug-in</h3>
-
-<div>
-
-It is a plug-in that replaces dynamic URL generated with NucleusCMS with static URL of a free name.<br />
-<em style="color:#cc0000;">Operation only in FancyURL mode and required 'mod-rewrite'.</em><br />
-Categories, the Sub-Categories, Archive list, etc. are considered to be a directory respectively.When narrowing it by the category, it becomes an image that refers to the index file that exists in the directory of a category concerned.<br />
-<ul style="margin:0 0 25px 12px;"><li>ex.</li>
-<li>Image of access to Categories:
-<ul><li>http://example.jp/nucleuscms/</li></ul></li>
-<li>Image of access to Sub-Categories:
-<ul><li>http://example.jp/nucleuscms/plugins/</li></ul></li>
-<li>Image of access to Archives:
-<ul><li>http://example.jp/archives/</li><li>http://example.jp/archives/nucleuscms/</li></ul></li>
-</ul>
-Member's detailed page and individual item page become images accessed a file concerned html file.<br />
-<ul style="margin:0 0 25px 12px;"><li>ex.</li>
-<li>http://example.jp/nucleuscms/plugins/NP_CustomURL.html</li>
-<li>http://example.jp/new_nucleus_comming_soon.html</li>
-<li>http://example.jp/member/Hiroyuki.html</li>
-</ul>
-
-</div>
-
-<h3>Installation and operation beginning procedure</h3>
-
-<div>
-
-<ol style="margin:0 0 25px 12px;">
-<li>After up-loading the "NP_CustomURL.php" file and the "customurl" directory that can be done by developing the downloaded compression file to the "plugins" directory of the server.It installs it from the management area.</li>
-<li>First of all, "URL mode" is changed to "Fancy" on "Global setting" page of the management screen.</li>
-<li>"fancyurls.config.php" is copied to a top directory according to the procedure of FancyURLs and it edits it.<br />At this time, copying it should not copy the following file with "fancyurls.config.php" file alone.</li>
-<li>Next, "index.php" is edited."<code>$CONF['Self']</code>" and the line that is are rewritten as "<code>$CONF['Self'] = '.'</code>" and One line is written "<code>$curl_blogid = 1;</code>" and it adds. ("1" is ID of Brog accessed by "index.php".)
-<blockquote><pre style="overflow:auto;"><?php
-// This file will generate and return the main page of the site
-$CONF = array();
-$CONF['Self'] = '.';
-$curl_blogid = 1;
-
-include('./config.php');
-include('./fancyurls.config.php');
-
-selector();
-
-?>
-</pre></blockquote>
-</li>
-<li>Next, <code>.htaccess</code> is edited.<ul>
- <li>The content is here.<blockquote><pre style="overflow:auto;">RewriteEngine on
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
-RewriteRule ^(.*)$ index.php?curl=$1 [L,QSA]
-</pre></blockquote>
-Even if nothing is written now by these four lines alone, it is safe.</li></ul></li>
-</ol>
-It is preparation completion by this.<br />
-<br />
-Note:Please delete or save operation in another directory the file for FancyURLs with FancyURLs now.It is not necessary because everything has been received by this plug-in.<br />
-</div>
-
-<h3>How to use.</h3>
-
-<div>
-
-<ul>
-<li style="margin-top:3px;">The option is additional to Brog item category member's edit page respectively, and apply a favorite name, please.</li>
-<li style="margin-top:3px;">These edit displays do not go out when new addition of the member and new addition of the category on a "setting of Brog" page, and edit it respectively, please after it adds it.</li>
-<li style="margin-top:3px;">The name of the default when newly adding it,Blog as [shortname],Categories as [category_(catid)],Sub-Categories as [subcategory_(scatid)],Item as [item_(itemid)],Member as [login-name].<br />
- Path has been generated to all the subBrog item category category members who existed in Brog when the plug-in is installed with the automatic operation.</li>
-<li style="margin-top:3px;">The name in the same key in Brog the same cannot overlap and take care, please.<br />
- When path that tried to be registered overlaps, each ID is added in the form of '_ id'.<br />
- Even if it is same Brog, the category, the subcategory, and the item can apply the same name.<br />
- In a word, "http://example.jp/nucleuscms/nucleuscms/nucleuscms.html" becomes effective path.</li>
-<li style="margin-top:3px;">".html" is automatically added to path of the member and the item.</li>
-<li style="margin-top:3px;">"Member directory", "Archive directory", and "Archive list directory" are revokable in the edit display of the plug-in.An initial value is a value of each "<code>$CONF['***Key']</code>".</li>
-<li style="margin-top:3px;">The character that can be used as a directory name and a file name is only a-z,A-Z,0-9,-,_.<br />
- "/" and "." included in the specified character string are automatically converted into "_".<br />
- When URL is generated, capital letters and small letters of the alphabet are distinguished.However, when accessing it, it doesn't distinguish.</li>
-<li style="margin-top:3px;">The directory name for the Sub-Categories can be edited only on the management screen now.<br />
- The data base has been updated about the subcategory newly added in the timing of the link generation.</li>
-<li style="margin-top:3px;">When the directory name is made a blank by the management screen and the edit display, the name is deleted from the data base, and URL becomes past FancyURLs.</li>
-<li style="margin-top:3px;">The same name cannot be applied to path for Brog and path for the category.</li>
-<li style="margin-top:3px;">The access with URL is possible even after this plug-in is installed so far.</li>
-<li style="margin-top:3px;">It can be selected whether to change URI of each Brog by the option.</li>
-</ul>
-
-</div>
-
-<h3>Skin/Template variable</h3>
-
-<div>
-It is possible to fill it in skin, the template, and in the article.<br />
-Useage:<code><%CustomURL(link ahead, link text, title text)%></code><br />
-<ul>
-<li>link ahead:kind link ahead/id or name/specified type
- <ul>
- <li>Paragraph 1:One of i, c, s, b, and m.Each initial of item, category, subcategory, blog, and member.</li>
- <li>Paragraph 2:Id or name link ahead.The name is not a path name but is "Category name" and "Shortname of Brog", etc.When the item is selected the link ahead, specifying it for here becomes only id.</li>
- <li>Paragraph 3:"i" and filling in when id, "n" and filling in when name is specified by paragraph 2.</li>
- </ul>
-</li>
-<li>link text:Character string placed between a tag.Only URL is generated when omitted.</li>
-<li>title text:It is set to the "title" attribute of a tag.If the link text exists, it is set to the change when omitted.Even if only the title is specified without specifying the link text, the link tag is not generated.</li>
-<li>It can be written <%CustomURL%> by omitting all parameters.In this case, URI of default is written by the filling in place.
- <ul>
- <li>skin:URI to the top page of present "Brog" is written.</li>
- <li>template:URI to the written item is written.(Replacement of <%itemlink%>)</li>
- <li>article:URI to oneself is written.</li>
- </ul>
-</li>
-</ul>
-Filling in example:
-<ul>
- <li>When id links with the item of 123:<a href="<%CustomURL(i/123/i)%>">'Here is freely written.'</a><br />
- Written character string:<a href="http://blog.example.jp/item_123.html">'Here is freely written.'</a></li>
- <li>When the category name writes URI of the category of "Diary":<%CustomURL(c/Diary/n)%><br />
- Written character string(When id of "Diary" category is 12)\81Fhttp://blog.example.jp/category_12/</li>
- <li>When you set the link of Brog to shortening name "bibouroku" to the link from the character string "This Brog":<%CustomURL(c/bibouroku/n, This Blog)%><br />
- Written character string:<a href="http://blog.example.jp/">This Blog</a></li>
-</ul>
-When only id is filled in like skin template article both "<%CustomURL(123)%>", URI to the item with the id is written.<br />
-Moreover, passing set to the item with the id like item_123 can be written by writing "<%CustomURL(123/path)%>" only for the item.<br />
-</div>
-
-<h3>Operation report and bug report</h3>
-
-<p>...following URL.. I hope the comment or the track back the operation report and bug report.<br />
-<a href="http://shizuki.kinezumi.net/NucleusCMS/Plugins/NP_CustomURL/NP_CustomURL.html">
-http://shizuki.kinezumi.net/NucleusCMS/Plugins/NP_CustomURL/NP_CustomURL.html</a></p>
-
-<h3>Version history</h3>
-
-<ul>
-<li>Version 0.2.1:
- <ul>
- <li>Making of Sub-Categories multistep URL</li>
- <li>Trouble not to be able to delete the data of the subcategory when the category and Brog are deleted is corrected.</li>
- <li>Other correction.</li>
- </ul>
-</li>
-<li>Version 0.1.9:
- <ul>
- <li>It corresponds to the movement between Brog of the category and the item.</li>
- </ul>
-</li>
-<li>Version 0.1.8a:
- <ul>
- <li>Correction according to timing change in passing registration of new Sub-Categories.</li>
- <li>To select whether to use customized URI of each Brog, the option is added.</li>
- <li>Correction of Help file.</li>
- </ul>
-</li>
-<li>Version 0.1.8:
- <ul>
- <li>It corresponds to trouble that URI to 'General' category made by the automatic operation when Brog is newly made doesn't operate normally.</li>
- <li>It corresponds to trouble that URI of "Category", "Subcategory", and "Item" that belongs to deleted Brog remained in the table when Brog is deleted.</li>
- <li>When the link is generated, the timing of the registration of passing of new Sub-Category is changed.(When URI has been set on the management screen before the link is generated, set URI is used.)</li>
- <li>It is corrected that item URI was not normally displayed on the management page.</li>
- </ul>
-</li>
-<li>Version 0.1.7:
- <ul>
- <li>It rewrites it almost completely.</li>
- <li>When the track back is transmitted when a new item is added, trouble not to be able to transmit URL in the track back origin correctly is corrected.</li>
- <li>When passing the subcategory is edited from the management screen, trouble to which the list is not displayed is corrected.</li>
- </ul>
-</li>
-<li>Version 0.1.5: Version of opening to the public.</li>
-<li>Version 0.01: First version(Remodeling version of NP_Path)</li>
-</ul>
+++ /dev/null
-<script language="JavaScript" src="./plugins/customurl/help.php"></script>
\ No newline at end of file
+++ /dev/null
-<?php
- include('../../../config.php');
- $language = ereg_replace( '[\\|/]', '', getLanguageName());
- $url = './'.$language.'_help.html';
- if(file_exists($url)){
- $message=file($url);
- }
- else{
- $message=file('./default_help.html');
- }
- $linenumber=sizeof($message);
- $i=0;
- while($i<$linenumber){
- $message[$i] = trim($message[$i], "\n\0\r");
- $message[$i] = mb_ereg_replace("'", "\\'", $message[$i]);
- $message[$i] = mb_ereg_replace('&', '\\&', $message[$i]);
- $message[$i] = mb_ereg_replace('"', '\\"', $message[$i]);
- $message[$i] = mb_ereg_replace('/', '\\/', $message[$i]);
- $message[$i] = mb_ereg_replace(' ', '\\ \\ \\ \\ ', $message[$i]);
- print ("document.write('{$message[$i]}\\n');");
- $i++;
- }
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-//
-// URL configuration plugin "NP_CustomURL" ADMIN page
-//
-
- // if your 'plugin' directory is not in the default location,
- // edit this variable to point to your site directory
- // (where config.php is)
- $strRel = '../../../';
-
- include($strRel . 'config.php');
- include($DIR_LIBS . 'PLUGINADMIN.php');
-
- // create the admin area page
- $oPluginAdmin = new PluginAdmin('CustomURL');
- $language = ereg_replace( '[\\|/]', '', getLanguageName());
- if (file_exists($oPluginAdmin->plugin->getDirectory() . 'language/' . $language . '.php')) {
- include_once($oPluginAdmin->plugin->getDirectory() . 'language/' . $language . '.php');
- } else {
- include_once($oPluginAdmin->plugin->getDirectory() . 'language/english.php');
- }
-
- if (!($member->isLoggedIn() && $member->isAdmin())) {
- ACTIONLOG::add(WARNING, _ACTIONLOG_DISALLOWED . serverVar('REQUEST_URI'));
- $myAdmin->error(_ERROR_DISALLOWED);
- }
-
-class CustomURL_ADMIN
-{
-
- function CustomURL_ADMIN()
- {
- global $manager, $CONF, $oPluginAdmin;
- $this->plugin =& $oPluginAdmin->plugin;
- $this->name = $this->plugin->getName();
- $this->pluginid = $this->plugin->getID();
- $this->adminurl = $this->plugin->getAdminURL();
- $this->editurl = $CONF['adminURL'];
- $this->pediturl = $CONF['adminURL']
- . 'index.php?action=pluginoptions&plugid='
- . $this->pluginid;
- $this->table = sql_table('plug_customurl');
- $this->uScat = ($manager->pluginInstalled('NP_MultipleCategories') == TRUE);
- if ($manager->pluginInstalled('NP_MultipleCategories')) {
- $mplugin =& $manager->getPlugin('NP_MultipleCategories');
- if (method_exists($mplugin, 'getRequestName')) {
- $this->mcadmin = $mplugin->getAdminURL();
- global $subcatid;
- }
- }
-
- }
-
- function action($action)
- {
- global $manager;
- $methodName = 'action_' . $action;
- $this->actions = strtolower($action);
- $aActionsNotToCheck = array(
- 'blogview',
- 'categoryview',
- 'memberview',
- 'itemview',
- 'pathupdate',
- );
- if (!in_array($this->actions, $aActionsNotToCheck)) {
- if (!$manager->checkTicket()) {
- $this->error(_ERROR_BADTICKET);
- }
- }
-
- if (method_exists($this, $methodName)) {
- call_user_func(array(&$this, $methodName));
- } else {
- $this->error(_BADACTION . " ($action)");
- }
- }
-
- function disallow()
- {
-
- ACTIONLOG::add(WARNING, _ACTIONLOG_DISALLOWED . serverVar('REQUEST_URI'));
- $msg = array (0, _ERROR_DISALLOWED, '***', _DISALLOWED_MSG);
- $this->error($msg);
- }
-
- function error($msg = '')
- {
- global $oPluginAdmin;
-
- $oPluginAdmin->start();
- $printData = $msg[1] . 'name : ' . $msg[2] . '<br />'
- . $msg[3] . '<br />'
- . '<a href="' . $this->adminurl . 'index.php" onclick="history.back()">'
- . _BACK . '</a>';
- echo $printData;
- $oPluginAdmin->end();
- unset($printData);
- exit;
- }
-
- function action_blogview($msg = '')
- {
- global $CONF, $oPluginAdmin;
-
- $oPluginAdmin->start();
- $printData = '<h2><a id="pagetop">'._ADMIN_AREA_TITLE.'</a></h2>'
- . '<ul style="list-style:none;">'
- . ' <li>'
- . ' <a href="' . $this->pediturl . '">'
- . _OPTION_SETTING
- . ' </a>'
- . ' </li>'
- . ' <li>'
- . ' <a href="' . $this->adminurl . 'index.php?action=memberview">'
- . _FOR_MEMBER_SETTING
- . ' </a>'
- . ' </li>'
- . '</ul>'
- . '<p>' . $this->_hsc($msg);
- echo $printData;
- unset($printData);
- $this->print_tablehead(_BLOG_LIST_TITLE, _LISTS_ACTIONS);
- $query = 'SELECT %s,%s,%s FROM %s';
- $query = sprintf($query, bname, bnumber, bshortname, sql_table('blog'));
- $res = sql_query($query);
- while ($b = mysql_fetch_object($res)) {
-// $forCatURI = $this->adminurl . 'index.php?action=goCategory&blogid=' . $b->bnumber;
- $forCatURI = $this->adminurl . 'index.php?action=categoryview&blogid=' . $b->bnumber;
-// $forItemURI = $this->adminurl . 'index.php?action=goItem&blogid=' . $b->bnumber;
- $forItemURI = $this->adminurl . 'index.php?action=itemview&blogid=' . $b->bnumber;
- $bPath = $this->_hsc($this->plugin->getBlogOption($b->bnumber, 'customurl_bname'));
- $data = array (
- 'oid' => intval($b->bnumber),
- 'obd' => 0,
- 'opr' => 'blog',
- 'name' => $this->_hsc($b->bname),
- 'ret' => 'blogview',
- 'ed_URL' => $this->editurl . 'index.php?action=blogsettings'
- . '&blogid=' . intval($b->bnumber),
- 'desc' => '[<a href="' . $forItemURI . '" style="font-size:x-small;">'
- . _FOR_ITEMS_SETTING
- . '</a>]'
- . ' '
- . '[<a href="' . $forCatURI . '" style="font-size:x-small;">'
- . _FOR_CATEGORY_SETTING
- . '</a>]',
- 'path' => $bPath,
- 'setting_text' => _BLOG_SETTING
- );
- $this->print_tablerow($data);
- }
- echo '</tbody></table>';
- echo '</p>';
- unset($query);
- $oPluginAdmin->end();
- }
-
- function action_categoryview($bid = '', $msg = '')
- {
- global $CONF, $oPluginAdmin;
- if (empty($bid)) {
- if (getVar('blogid')) {
- $bid = intGetVar('blogid');
- } else {
- $bid = intval($CONF['DefaultBlog']);
- }
- } else {
- $bid = intval($bid);
- }
- $bname = $this->_hsc(getBlognameFromID($bid));
-
- $oPluginAdmin->start();
- $printData = '<h2><a id="pagetop">'._ADMIN_AREA_TITLE.'</a></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=goItem&blogid=' . $bid . '">'
- . ' <a href="' . $this->adminurl . 'index.php?action=itemview&blogid=' . $bid . '">'
- ._FOR_ITEMS_SETTING
- . ' </a>'
- . ' </li>'
- . ' <li>'
- . ' <a href="' . $this->adminurl . 'index.php?action=memberview">'
- . _FOR_MEMBER_SETTING
- . ' </a>'
- . ' </li>'
- . '</ul>'
- . '<p>' . $this->_hsc($msg)
- . '<h3 style="padding-left: 0px">' . $bname . '</h3>';
- echo $printData;
- unset($printData);
- $this->print_tablehead(_LISTS_CAT_NAME, _LISTS_DESC);
- $query = 'SELECT catid, cname, cdesc FROM %s WHERE cblog = %d';
- $query = sprintf($query, sql_table('category'), $bid);
- $cnm = sql_query($query);
- while ($c = mysql_fetch_object($cnm)) {
- $cPath = $this->_hsc($this->plugin->getCategoryOption($c->catid, 'customurl_cname'));
- $data = array (
- 'oid' => intval($c->catid),
- 'obd' => $bid,
- 'opr' => 'category',
- 'name' => $this->_hsc($c->cname),
- 'ret' => 'catoverview',
- 'ed_URL' => $this->editurl
- . 'index.php?action=categoryedit'
- . '&blogid=' . $bid
- . '&catid=' . intval($c->catid),
- 'desc' => $this->_hsc($c->cdesc),
- 'path' => $cPath
- );
- $this->print_tablerow($data);
- if ($this->uScat) {
- $query = 'SELECT scatid, sname, sdesc FROM %s WHERE catid = %d';
- $query = sprintf($query, sql_table('plug_multiple_categories_sub'), intval($c->catid));
- $scnm = sql_query($query);
- while ($sc = mysql_fetch_object($scnm)) {
- $query = 'SELECT obj_name '
- . 'FROM %s '
- . 'WHERE obj_param = "subcategory" '
- . 'AND obj_bid = %d '
- . 'AND obj_id = %d';
- $query = sprintf($query, $this->table, intval($c->catid), intval($sc->scatid));
- $scpt = sql_query($query);
- $scp = mysql_fetch_object($scpt);
- $data = array (
- 'oid' => intval($sc->scatid),
- 'obd' => intval($c->catid),
- 'opr' => 'subcategory',
- 'name' => '»' . $this->_hsc($sc->sname),
- 'ret' => 'catoverview',
- 'ed_URL' => $this->mcadmin
- . 'index.php?action=scatedit'
- . '&catid=' . intval($c->catid)
- . '&scatid=' . intval($sc->scatid),
- 'desc' => $this->_hsc($sc->sdesc),
- 'path' => $this->_hsc($scp->obj_name)
- );
- $this->print_tablerow($data);
- }
- }
- }
- echo '</tbody></table>';
- echo '<a href="' . $this->adminurl . 'index.php" onclick="history.back()">' . _BACK . '</a>';
- echo '</p>';
- unset($query);
- $oPluginAdmin->end();
- }
-
- function action_memberview($msg = '')
- {
- global $CONF, $oPluginAdmin;
-
- $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>'
- . '</ul>'
- . '<p>' . $this->_hsc($msg);
- echo $printData;
- unset($printData);
- $this->print_tablehead(_LOGIN_NAME, _MEMBERS_REALNAME);
- $query = 'SELECT %s,%s,%s FROM %s';
- $query = sprintf($query, mname, mnumber, mrealname, sql_table('member'));
- $res = sql_query($query);
- while ($m = mysql_fetch_object($res)) {
- $mPpath = $this->_hsc($this->plugin->getMemberOption($m->mnumber, 'customurl_mname'));
- $data = array (
- 'oid' => intval($m->mnumber),
- 'obd' => 0,
- 'opr' => 'member',
- 'name' => $this->_hsc($m->mname),
- 'ret' => 'memberview',
- 'ed_URL' => $this->editurl
- . 'index.php?action=memberedit'
- . '&memberid=' . intval($m->mnumber),
- 'desc' => $this->_hsc($m->mrealname),
- 'path' => $mPath
- );
- $this->print_tablerow($data);
- }
- echo '</tbody></table></p>';
- unset($query);
- $oPluginAdmin->end();
- }
-
- 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=goCategory&blogid=' . $bid . '">'
- . ' <a href="' . $this->adminurl . 'index.php?action=categoryview&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'
- . '&itemid=' . intval($i->inumber),
-// 'desc' => $this->_hsc(mb_substr(strip_tags($i->ibody), 0, 80)),
- '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 print_tablehead($o_name, $o_desc)
- {
- global $oPluginAdmin;
-
- $NAME = $o_name;
- $DESC = $o_desc;
- $PATH = _LISTS_PATH;
- $ACTION = _LISTS_ACTIONS;
-echo <<< TABLE_HEAD
- <table>
- <thead>
- <tr>
- <th>{$NAME}</th>
- <th>{$DESC}</th>
- <th style="width:180px;">{$PATH}</th>
- <th style="width:80px;">{$ACTION}</th>
- </tr>
- </thead>
- <tbody>
-TABLE_HEAD;
- }
-
- function print_tablerow($data)
- {
- global $oPluginAdmin, $manager;
-
- $updateText = _SETTINGS_UPDATE_BTN;
- $edit = _EDIT;
-echo <<< TBODY
- <tr onmouseover="focusRow(this);" onmouseout="blurRow(this);">
- <form method="post" action="{$this->adminurl}index.php" />
- <input type="hidden" name="action" value="pathupdate" />
- <input type="hidden" name="oid" value="{$data['oid']}" />
- <input type="hidden" name="obd" value="{$data['obd']}" />
- <input type="hidden" name="opr" value="{$data['opr']}" />
- <input type="hidden" name="name" value="{$data['name']}" />
- <input type="hidden" name="ret" value="{$data['ret']}" />
-TBODY;
- $manager->addTicketHidden();
-echo <<< TBODY
- <td>{$data['name']}
- <a href="{$data['ed_URL']}" style="font-size:xx-small;">[{$edit}]</a>
- </td>
- <td>{$data['desc']}</td>
- <td><input type="text" name="path" size="32" value="{$data['path']}"/></td>
- <td><input type="submit" name="update" value="{$updateText}" /></td>
- </form>
- </tr>
-TBODY;
- }
-
- function action_pathupdate() {
- global $oPluginAdmin;
-
- $o_oid = intRequestVar('oid');
- $o_bid = intRequestVar('obd');
- $o_param = requestVar('opr');
- $o_name = requestVar('name');
- $newPath = requestVar('path');
- $action = requestVar('ret');
-
- $msg = $this->plugin->RegistPath($o_oid, $newPath, $o_bid, $o_param, $o_name);
- if ($msg) {
- $this->error($msg);
- if ($msg[0] != 0) {
- return;
- exit;
- }
- }
- $mesage = _UPDATE_SUCCESS;
- switch($action) {
- case 'catoverview':
- if ($o_param == 'subcategory') {
- $bid = getBlogIDFromCatID($o_bid);
- } else {
- $bid = $o_bid;
- }
- $this->action_categoryview($bid, _UPDATE_SUCCESS);
- break;
- case 'memberview':
- $this->action_memberview(_UPDATE_SUCCESS);
- break;
- case 'blogview':
- $this->action_blogview(_UPDATE_SUCCESS);
- break;
- case 'itemview':
- $this->action_itemview($o_bid, _UPDATE_SUCCESS);
- break;
- default:
- echo _UPDATE_SUCCESS;
- break;
- }
- return;
- }
-
- function action_goItem() {
- global $oPluginAdmin;
-
- $bid = getVar('blogid');
- $this->action_itemview($bid);
- }
-
- function action_goCategory() {
- global $oPluginAdmin;
-
- $bid = getVar('blogid');
- $this->action_categoryview($bid);
- }
-
- function _hsc($str)
- {
- return htmlspecialchars($str, ENT_QUOTES, _CHARSET);
- }
-
-}
-
-$myAdmin = new CustomURL_ADMIN();
-
-if (requestVar('action')) {
- $myAdmin->action(requestVar('action'));
-} else {
- $myAdmin->action('blogview');
-}
-
+++ /dev/null
-<h3>プラグインの概要</h3>
-
-<div>
-
-NucleusCMSで作成したwebサイトのアイテム・カテゴリに好きな名前をつけて、静的URLとしてリンクを生成します。<br />
-<em style="color:#cc0000;">FancyURLモードでのみの動作、及びmod_Rewrite必須です</em><br />
-カテゴリ、サブカテゴリ、アーカイブリスト等を、それぞれディレクトリとみなし、カテゴリで絞り込んだ時は当該カテゴリのディレクトリにあるindexファイルを参照するイメージになります<br />
-<ul style="margin:0 0 25px 12px;"><li>ex.</li>
-<li>カテゴリへのアクセスのイメージ:
-<ul><li>http://example.jp/nucleuscms/</li></ul></li>
-<li>サブカテゴリへのアクセスのイメージ:
-<ul><li>http://example.jp/nucleuscms/plugins/</li></ul></li>
-<li>アーカイブへのアクセスのイメージ:
-<ul><li>http://example.jp/archives/</li><li>http://example.jp/archives/nucleuscms/</li></ul></li>
-</ul>
-メンバーの詳細ページと個別アイテムページは、当該htmlファイルにアクセスするイメージになります<br />
-<ul style="margin:0 0 25px 12px;"><li>ex.</li>
-<li>http://example.jp/nucleuscms/plugins/NP_CustomURL.html</li>
-<li>http://example.jp/new_nucleus_comming_soon.html</li>
-<li>http://example.jp/member/Hiroyuki.html</li>
-</ul>
-
-</div>
-
-<h3>インストール・動作開始手順</h3>
-
-<div>
-
-<ol style="margin:0 0 25px 12px;">
-<li>ダウンロードしたファイルを解凍して出来た「NP_CustomURL.php」ファイルと「customurl」ディレクトリをサーバの plugins ディレクトリにアップロード後、「プラグインの管理」ページで「CustomURL」を選択して「プラグインのインストール」ボタンをクリックします<br />
-(この文章を読んでいるということは、ここまでは出来ていると思います)</li>
-<li>まず始めに、管理画面の「グローバル設定」ページで「URL モード」を「Fancy」に変更します</li>
-<li>通常の「extra」ディレクトリの「fancyurls.config.php」を、FancyURLsの手順通りトップディレクトリへコピーして編集します<br />このときコピーするのは「fancyurls.config.php」ファイルだけで、後のファイルはコピーする必要がありません</li>
-<li>次に「index.php」を編集しますの <code>$CONF['Self']</code> の行を <code>$CONF['Self'] = '.'</code> に書き換え、 <code>$curl_blogid = 1;</code>("1"は「index.php」でアクセスするブログのID) と一行書き加えます
-<blockquote><pre style="overflow:auto;"><?php
-// This file will generate and return the main page of the site
-$CONF = array();
-$CONF['Self'] = '.';
-$curl_blogid = 1;
-
-include('./config.php');
-include('./fancyurls.config.php');
-
-selector();
-
-?>
-</pre></blockquote>
-</li>
-<li>次に<code>.htaccess</code>を編集します<ul>
- <li>内容はこちら<blockquote><pre style="overflow:auto;">RewriteEngine on
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
-RewriteRule ^(.*)$ index.php?curl=$1 [L,QSA]
-</pre></blockquote>
-この4行だけで、後は何も書かなくても大丈夫です</li></ul></li>
-</ol>
-これで準備完了です<br />
-<br />
-注1:現在 FancyURLs で運用されている方は、Fancy 用のファイルを削除するか別ディレクトリへ退避してください。すべてこのプラグインで受けているので必要ありません<br />
-また、下記プラグイン用のFancyファイルは組み込み済みですので不要です
-<ul>
-<li>各ページスイッチ用「page」ファイル</li>
-<li>タグ用「tag」ファイル(「NP_TagEX」「NP_MultiTags」両方対応。「NP_MultiTags」の「タグクエリー 」の変更にも対応しています)</li>
-<li>「NP_Trackback」のトラックバック受信専用「trackback」ファイル</li>
-</ul>
-</div>
-
-<h3>使い方</h3>
-
-<div>
-
-<ul>
-<li style="margin-top:3px;">ブログ・アイテム・カテゴリ・メンバーの編集ページにそれぞれオプションが追加してありますので、好きな名前をつけてください</li>
-<li style="margin-top:3px;">メンバーの新規追加、及び「ブログの設定の編集」ページからのカテゴリの新規追加の時にはこれらの編集画面が出ませんので、追加したあとにそれぞれ編集してください</li>
-<li style="margin-top:3px;">新規追加時のデフォルトの名前は、ブログは[ショートネーム]カテゴリーは[category_(catid)]、アイテムは[item.html]、メンバーは[ログインネーム.html]がそれぞれ設定されます<br />
- なお、プラグインのインストール時にブログに存在した全てのブログ・アイテム・カテゴリ・メンバーには自動でパスを生成済みです</li>
-<li style="margin-top:3px;">同一ブログ内、同一キーでの名前は重複できませんので気をつけてください<br />
- 登録しようとしたパスが重複していた場合は、末尾にそれぞれのIDが'_id'の形で追加されます<br />
- 同一ブログであっても、カテゴリーとサブカテゴリー、アイテムは同じ名前をつけることが出来ます<br />
- つまり、http://example.jp/nucleuscms/nucleuscms/nucleuscms.htmlは有効なパスとなります</li>
-<li style="margin-top:3px;">メンバー、及びアイテムのパスには、末尾に自動的に[.html]が付加されるので、編集時に[.html]をつけないように気をつけてください<br />
- うっかり付けてしまうと、[item_html.html]というような、なんだかよく解らないファイル名が出来上がってしまいます</li>
-<li style="margin-top:3px;">メンバーディレクトリ、アーカイブディレクトリ、アーカイブリストディレクトリはプラグインの編集画面で変更できます。初期値はそれぞれの<code>$CONF['***Key']</code>の値になっています</li>
-<li style="margin-top:3px;">ディレクトリ名、及びファイル名として使用できる文字は半角英数字(a-z,A-Z,0-9)と半角ハイフン(-)と半角アンダーバー(_)のみです<br />
- なお、指定された文字列の中に含まれている '/'(スラッシュ)や'.'(ピリオド)は、自動的に '_'(半角アンダーバー)に変換されますが、それ以外のときはエラーを返します<br />
- URL生成のときはアルファベットの大文字小文字の区別はしますが、アクセスのときはURLの使用上区別できません<br />
- 通常のHTMLリンク同様、 http://example.jp/NucleusCMS/ と表示してあるリンクに対し、ブラウザのアドレス欄に http://example.jp/nucleuscms/ でアクセス可能です</li>
-<li style="margin-top:3px;">サブカテゴリ用のディレクトリ名は、現在管理画面でのみ編集可能です<br />
- 新しく追加されたサブカテゴリについてはリンク生成のタイミングでデータベースを更新しているので、実用上問題ないと思います<br />
- デフォルトのサブカテゴリ用ディレクトリ名は[subcatid_(subid)]です</li>
-<li style="margin-top:3px;">管理画面、編集画面でディレクトリ名を空白にした場合は、データベースからその名前が削除され、URLは従来のFancyURLsのものになります<br />
- (但しサブカテゴリーについては、追加・削除のタイミングがプラグイン側で判断できないため、「空白文字列 = デフォルト名」になります)</li>
-<li style="margin-top:3px;">ブログアクセス用パスとカテゴリーアクセス用パスには同じ名前をつけることが出来ません<br />
- これは <code>hostname</code> の次に来るパス名がカテゴリのものであるのかブログのものであるのかを見分ける有効な手段が見つからないための制限です</li>
-<li style="margin-top:3px;">トップディレクトリ直下に実在するディレクトリ名やファイル名をパスとして登録することは出来ますが、httpサーバは実在するものの方を返すので、このパスは事実上無効となります</li>
-<li style="margin-top:3px;">このプラグインのインストール後でも、従来のクエリ式のURL(ex. http://example.jp/index.php?catid=123)やFancyURLs式のURL(ex. http://example.jp/category/12/item/34)でのアクセスは可能です</li>
-<li style="margin-top:3px;">各ブログ毎にオプションで URI を変更する・しないを選択することが出来ます。このオプションを「使用しない」にした場合は、通常のFancyURLs(ex. http://example.jp/category/12/item/34)になります<br />
- また「使用しない」にした場合でも、生成される URI が FancyURLs になるだけで、カスタマイズされた URI でリクエストがあった場合のリンクは成立しますので、このプラグインの使用をやめる場合などは外部からのリンクの書き換えが全て終わるまで、このオプションで「使用しない」を選択した状態での運用によってスムーズに移行できると思います</li>
-<li style="margin-top:3px;">デフォルトで生成されるURIの接頭語はオプション画面で変更できます</li>
-<li style="margin-top:3px;">アイテムの接頭語のみ、<%year%>、<%month%>、<%day%>の各変数が使用できます<br />この値を<%month%>-<%day%>とした場合、アイテムの投稿時に自動で作成されるURIは「08-21_(id)」のようになります</li>
-</ul>
-
-</div>
-
-<h3>スキン・テンプレート変数</h3>
-
-<div>
-スキン・テンプレート、及び記事中に記入することが出来ます<br />
-記入方法:<code><%CustomURL(リンク先, リンク文字列, リンクタイトル)%></code><br />
-<ul>
-<li>リンク先:リンク先の種類/id または名前/指定種別
- <ul>
- <li>第一パラグラフ:i、c、s、b、m のいずれか。それぞれ、item、category、subcategory、blog、member の頭文字</li>
- <li>第二パラグラフ:リンク先の id、もしくは名前。名前はパス名ではなく、「カテゴリー名」「ブログの短縮名」等になります。リンク先にアイテムを選択した場合は、ここに指定できるのは id のみになります</li>
- <li>第三パラグラフ:第二パラグラフに id を指定した場合は 'i' 、名前を指定した場合は 'n' と記入してください</li>
- </ul>
-</li>
-<li>リンク文字列:a タグに挟まれる文字列。省略された場合は url のみが生成されます</li>
-<li>リンクタイトル:a タグの「title」属性に設定されます。省略された場合は、リンク文字列が存在すれば変わりに設定されます。リンク文字列を指定せずにタイトルのみを指定してもリンクタグは生成されません</li>
-<li>全てのパラメータを省略して<%CustomURL%>と書くことも出来ます。この場合は記入場所によってデフォルトの URI が書き出されます
- <ul>
- <li>スキン :選択中の「ブログ」のトップページへの URI が書き出されますす</li>
- <li>テンプレート:書き出されるアイテムへの URI が書き出されます(<%itemlink%>の置き換え)</li>
- <li>記事中 :自分自身への URI が書き出されます</li>
- </ul>
-</li>
-</ul>
-記入例:
-<ul>
- <li>id が123のアイテムにリンクする場合:<a href="<%CustomURL(i/123/i)%>">'ここは自由に書き込んでください'</a><br />
- 書き出される文字列:<a href="http://blog.example.jp/item_123.html">'ここは自由に書き込んでください'</a></li>
- <li>カテゴリー名が「日記」のカテゴリーの URI を書き出す場合:<%CustomURL(c/日記/n)%><br />
- 書き出される文字列(「日記」カテゴリーのidが12の場合):http://blog.example.jp/category_12/</li>
- <li>ブログの短縮名「bibouroku」へのリンクを「このブログ」という文字列からのリンクに設定する場合:<%CustomURL(c/bibouroku/n, このブログ)%><br />
- 書き出される文字列:<a href="http://blog.example.jp/">このブログ</a></li>
-</ul>
-スキン・テンプレート・記事共に、<%CustomURL(123)%>のように id のみを記入した場合は、その id を持つアイテムへの URI が書き出されます<br />
-またアイテムの場合のみ、<%CustomURL(123/path)%>と書くことで、item_123 のようにその id を持つアイテムに設定したパスを書き出すことが出来ます<br />
-</div>
-
-<h3>動作報告・バグレポート</h3>
-
-<p>動作報告・バグレポートは、以下のURLにコメント・トラックバックをお願いします<br />
-<a href="http://shizuki.kinezumi.net/NucleusCMS/Plugins/NP_CustomURL/NP_CustomURL.html">
-http://shizuki.kinezumi.net/NucleusCMS/Plugins/NP_CustomURL/NP_CustomURL.html</a></p>
-
-<h3>バージョン履歴</h3>
-
-<ul>
-<li>Version 0.2.3: 不具合修正・機能追加
- <ul>
- <li>リダイレクト周りにバグがあったので修正</li>
- <li>「カスタマイズされたURLを使用する」を「はい」にしている時、旧来のFancuURLでアクセスしてきたクライアントに301を返してリダイレクトするように変更</li>
- </ul>
-</li>
-<li>Version 0.2.2a: 不具合修正
- <ul>
- <li>SQLインジェクションを引き起こす可能性がある脆弱性に対処</li>
- </ul>
-</li>
-<li>Version 0.2.2: 不具合修正・機能追加
- <ul>
- <li>バグフィックス</li>
- <li>アイテム・カテゴリー・サブカテゴリーの新規作成時のデフォルトの接頭語のオプションでの変更に対応<br />
- アイテムの接頭語のみテンプレート化</li>
- </ul>
-</li>
-<li>Version 0.2.1a: 不具合修正
- <ul>
- <li>バグフィックス</li>
- </ul>
-</li>
-<li>Version 0.2.1: 機能追加
- <ul>
- <li>サブカテゴリの多段URL化</li>
- <li>カテゴリ・ブログの削除時にサブカテゴリのデータが消去できていなかった不具合を修正</li>
- <li>その他修正</li>
- </ul>
-</li>
-<li>Version 0.1.9: 機能追加
- <ul>
- <li>カテゴリ及びアイテムのブログ間移動に対応</li>
- </ul>
-</li>
-<li>Version 0.1.8a: 不具合修正・機能追加
- <ul>
- <li>新規サブカテゴリのパス登録のタイミング変更に伴う修正</li>
- <li>ブログ毎にカスタマイズした URI を使用する・しないを選択できるようにオプションを追加</li>
- <li>ヘルプファイルの修正</li>
- </ul>
-</li>
-<li>Version 0.1.8: 不具合修正
- <ul>
- <li>新規ブログ作成時に自動で作成される'General'カテゴリーに対するURIが正常に動作しなかった不具合に対応</li>
- <li>ブログを削除した時に、削除したブログに属する「カテゴリー」「サブカテゴリー」「アイテム」のURIがテーブルに残ったままになっていた不具合に対応</li>
- <li>新規サブカテゴリーのパスの登録のタイミングをリンクが生成される時に変更(リンク生成前に管理画面でURIを設定していた場合は設定したURIが使用されます)</li>
- <li>管理ページでアイテムURIがおかしくなっていたのを修正</li>
- </ul>
-</li>
-<li>Version 0.1.7: 不具合修正
- <ul>
- <li>ほぼ全面的に書き直し</li>
- <li>新規アイテム追加時にトラックバックを送信した時に、トラックバック元のURLが正しく送信できなかった</li>
- <li>管理画面からサブカテゴリのパスを編集したときに、リストが表示されなかった</li>
- </ul>
-</li>
-<li>Version 0.1.5: 公開バージョン</li>
-<li>Version 0.01: 初期バージョン(NP_Pathの改造バージョン)</li>
-</ul>
-
-<h3>謝辞</h3>
-<p>
-本プラグインの英語版ランゲージファイル、及びヘルプファイル作成に当たりまして、多大なるご協力をいただきましたTucker氏に心より感謝申し上げます
-</p>
-
-<h3>プラグイン改造情報</h3>
-
-<div>
-
-「NP_TagEX」と「NP_ContentsList」で 「http://example.jp/nucleuscms/plugins/tag/NP_CustomURL」 形式のリンクを表示させる方法<br />
-<br />
-「NP_TagEX」の場合<br />
-・一番最後のファンクション<code>creatTagLink()</code>の最後の<code>return addLinkParams($link, $linkparams);</code>の直前に、次のコードを挿入します<br />
-<blockquote><pre style="overflow:auto;">global $manager;
-if ($manager->pluginInstalled('NP_CustomURL')) {
- $customurls = $manager->getPlugin('NP_CustomURL');
- $link = 'tag/' . $ready.$sep.$this->_rawencode($tag);
- return $CONF['BlogURL'] . '/' . $customurls->_addLinkParams($link, $linkparams) . '/';
-}
-</pre></blockquote>
-これでタグがURLの一番最後になります<br />
-<br />
-「NP_ContentsList」の場合<br />
-・<code>doSkinVar()</code>の467行目付近、<code>$catdata['catlink']</code>の生成が終了したところでサブカテゴリのリンクを生成する直前、
-<blockquote><pre style="overflow:auto;">// sub category ---
-if ($subcat && (!$subcurrent || $catid == $catdata['catid']) && !$subnoOpen) {
-</pre></blockquote>
-の前の行に
-<blockquote><pre style="overflow:auto;">if ($CONF['URLMode'] == 'pathinfo' && $manager->pluginInstalled('NP_CustomURL')) {
- $catdata['catlink'] = createCategoryLink($catdata['catid']);
-}
-</pre></blockquote>の一行を追加して、カテゴリのリンクを上書きします<br />
-さらにそこからもう少し下の
-<blockquote><pre style="overflow:auto;">$subdata['sublink'] = addLinkParams($catdata['catlink'], array($subrequest => $subdata['subcatid']));
-</pre></blockquote>
-となっている行の下に
-<blockquote><pre style="overflow:auto;">global $manager;
-if ($CONF['URLMode'] == 'pathinfo' && $manager->pluginInstalled('NP_CustomURL')) {
- $customurls = $manager->getPlugin('NP_CustomURL');
- $subdata['sublink'] = $customurls->_addLinkParams($catdata['catlink'], array($subrequest => $subdata['subcatid']));
-}
-</pre></blockquote>
-と追加、350行目付近の<code>$data['self'] = $data['blogurl'];</code>の前に
-<blockquote><pre style="overflow:auto;">if ($CONF['URLMode'] == 'pathinfo' && $manager->pluginInstalled('NP_CustomURL')) {
- $data['blogurl'] = createBlogidLink($data['blogid']);
-}
-</pre></blockquote>
-を追加して終了です
-
-</div>
+++ /dev/null
-<h3>プラグインの概要</h3>
-
-<div>
-
-NucleusCMSで作成したwebサイトのアイテム・カテゴリに好きな名前をつけて、静的URLとしてリンクを生成します。<br />
-<em style="color:#cc0000;">FancyURLモードでのみの動作、及びmod_Rewrite必須です</em><br />
-カテゴリ、サブカテゴリ、アーカイブリスト等を、それぞれディレクトリとみなし、カテゴリで絞り込んだ時は当該カテゴリのディレクトリにあるindexファイルを参照するイメージになります<br />
-<ul style="margin:0 0 25px 12px;"><li>ex.</li>
-<li>カテゴリへのアクセスのイメージ:
-<ul><li>http://example.jp/nucleuscms/</li></ul></li>
-<li>サブカテゴリへのアクセスのイメージ:
-<ul><li>http://example.jp/nucleuscms/plugins/</li></ul></li>
-<li>アーカイブへのアクセスのイメージ:
-<ul><li>http://example.jp/archives/</li><li>http://example.jp/archives/nucleuscms/</li></ul></li>
-</ul>
-メンバーの詳細ページと個別アイテムページは、当該htmlファイルにアクセスするイメージになります<br />
-<ul style="margin:0 0 25px 12px;"><li>ex.</li>
-<li>http://example.jp/nucleuscms/plugins/NP_CustomURL.html</li>
-<li>http://example.jp/new_nucleus_comming_soon.html</li>
-<li>http://example.jp/member/Hiroyuki.html</li>
-</ul>
-
-</div>
-
-<h3>インストール・動作開始手順</h3>
-
-<div>
-
-<ol style="margin:0 0 25px 12px;">
-<li>ダウンロードしたファイルを解凍して出来た「NP_CustomURL.php」ファイルと「customurl」ディレクトリをサーバの plugins ディレクトリにアップロード後、「プラグインの管理」ページで「CustomURL」を選択して「プラグインのインストール」ボタンをクリックします<br />
-(この文章を読んでいるということは、ここまでは出来ていると思います)</li>
-<li>まず始めに、管理画面の「グローバル設定」ページで「URL モード」を「Fancy」に変更します</li>
-<li>通常の「extra」ディレクトリの「fancyurls.config.php」を、FancyURLsの手順通りトップディレクトリへコピーして編集します<br />このときコピーするのは「fancyurls.config.php」ファイルだけで、後のファイルはコピーする必要がありません</li>
-<li>次に「index.php」を編集しますの <code>$CONF['Self']</code> の行を <code>$CONF['Self'] = '.'</code> に書き換え、 <code>$curl_blogid = 1;</code>("1"は「index.php」でアクセスするブログのID) と一行書き加えます
-<blockquote><pre style="overflow:auto;"><?php
-// This file will generate and return the main page of the site
-$CONF = array();
-$CONF['Self'] = '.';
-$curl_blogid = 1;
-
-include('./config.php');
-include('./fancyurls.config.php');
-
-selector();
-
-?>
-</pre></blockquote>
-</li>
-<li>次に<code>.htaccess</code>を編集します<ul>
- <li>内容はこちら<blockquote><pre style="overflow:auto;">RewriteEngine on
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
-RewriteRule ^(.*)$ index.php?curl=$1 [L,QSA]
-</pre></blockquote>
-この4行だけで、後は何も書かなくても大丈夫です</li></ul></li>
-</ol>
-これで準備完了です<br />
-<br />
-注1:現在 FancyURLs で運用されている方は、Fancy 用のファイルを削除するか別ディレクトリへ退避してください。すべてこのプラグインで受けているので必要ありません<br />
-また、下記プラグイン用のFancyファイルは組み込み済みですので不要です
-<ul>
-<li>各ページスイッチ用「page」ファイル</li>
-<li>タグ用「tag」ファイル(「NP_TagEX」「NP_MultiTags」両方対応。「NP_MultiTags」の「タグクエリー 」の変更にも対応しています)</li>
-<li>「NP_Trackback」のトラックバック受信専用「trackback」ファイル</li>
-</ul>
-</div>
-
-<h3>使い方</h3>
-
-<div>
-
-<ul>
-<li style="margin-top:3px;">ブログ・アイテム・カテゴリ・メンバーの編集ページにそれぞれオプションが追加してありますので、好きな名前をつけてください</li>
-<li style="margin-top:3px;">メンバーの新規追加、及び「ブログの設定の編集」ページからのカテゴリの新規追加の時にはこれらの編集画面が出ませんので、追加したあとにそれぞれ編集してください</li>
-<li style="margin-top:3px;">新規追加時のデフォルトの名前は、ブログは[ショートネーム]カテゴリーは[category_(catid)]、アイテムは[item.html]、メンバーは[ログインネーム.html]がそれぞれ設定されます<br />
- なお、プラグインのインストール時にブログに存在した全てのブログ・アイテム・カテゴリ・メンバーには自動でパスを生成済みです</li>
-<li style="margin-top:3px;">同一ブログ内、同一キーでの名前は重複できませんので気をつけてください<br />
- 登録しようとしたパスが重複していた場合は、末尾にそれぞれのIDが'_id'の形で追加されます<br />
- 同一ブログであっても、カテゴリーとサブカテゴリー、アイテムは同じ名前をつけることが出来ます<br />
- つまり、http://example.jp/nucleuscms/nucleuscms/nucleuscms.htmlは有効なパスとなります</li>
-<li style="margin-top:3px;">メンバー、及びアイテムのパスには、末尾に自動的に[.html]が付加されるので、編集時に[.html]をつけないように気をつけてください<br />
- うっかり付けてしまうと、[item_html.html]というような、なんだかよく解らないファイル名が出来上がってしまいます</li>
-<li style="margin-top:3px;">メンバーディレクトリ、アーカイブディレクトリ、アーカイブリストディレクトリはプラグインの編集画面で変更できます。初期値はそれぞれの<code>$CONF['***Key']</code>の値になっています</li>
-<li style="margin-top:3px;">ディレクトリ名、及びファイル名として使用できる文字は半角英数字(a-z,A-Z,0-9)と半角ハイフン(-)と半角アンダーバー(_)のみです<br />
- なお、指定された文字列の中に含まれている '/'(スラッシュ)や'.'(ピリオド)は、自動的に '_'(半角アンダーバー)に変換されますが、それ以外のときはエラーを返します<br />
- URL生成のときはアルファベットの大文字小文字の区別はしますが、アクセスのときはURLの使用上区別できません<br />
- 通常のHTMLリンク同様、 http://example.jp/NucleusCMS/ と表示してあるリンクに対し、ブラウザのアドレス欄に http://example.jp/nucleuscms/ でアクセス可能です</li>
-<li style="margin-top:3px;">サブカテゴリ用のディレクトリ名は、現在管理画面でのみ編集可能です<br />
- 新しく追加されたサブカテゴリについてはリンク生成のタイミングでデータベースを更新しているので、実用上問題ないと思います<br />
- デフォルトのサブカテゴリ用ディレクトリ名は[subcatid_(subid)]です</li>
-<li style="margin-top:3px;">管理画面、編集画面でディレクトリ名を空白にした場合は、データベースからその名前が削除され、URLは従来のFancyURLsのものになります<br />
- (但しサブカテゴリーについては、追加・削除のタイミングがプラグイン側で判断できないため、「空白文字列 = デフォルト名」になります)</li>
-<li style="margin-top:3px;">ブログアクセス用パスとカテゴリーアクセス用パスには同じ名前をつけることが出来ません<br />
- これは <code>hostname</code> の次に来るパス名がカテゴリのものであるのかブログのものであるのかを見分ける有効な手段が見つからないための制限です</li>
-<li style="margin-top:3px;">トップディレクトリ直下に実在するディレクトリ名やファイル名をパスとして登録することは出来ますが、httpサーバは実在するものの方を返すので、このパスは事実上無効となります</li>
-<li style="margin-top:3px;">このプラグインのインストール後でも、従来のクエリ式のURL(ex. http://example.jp/index.php?catid=123)やFancyURLs式のURL(ex. http://example.jp/category/12/item/34)でのアクセスは可能です</li>
-<li style="margin-top:3px;">各ブログ毎にオプションで URI を変更する・しないを選択することが出来ます。このオプションを「使用しない」にした場合は、通常のFancyURLs(ex. http://example.jp/category/12/item/34)になります<br />
- また「使用しない」にした場合でも、生成される URI が FancyURLs になるだけで、カスタマイズされた URI でリクエストがあった場合のリンクは成立しますので、このプラグインの使用をやめる場合などは外部からのリンクの書き換えが全て終わるまで、このオプションで「使用しない」を選択した状態での運用によってスムーズに移行できると思います</li>
-<li style="margin-top:3px;">デフォルトで生成されるURIの接頭語はオプション画面で変更できます</li>
-<li style="margin-top:3px;">アイテムの接頭語のみ、<%year%>、<%month%>、<%day%>の各変数が使用できます<br />この値を<%month%>-<%day%>とした場合、アイテムの投稿時に自動で作成されるURIは「08-21_(id)」のようになります</li>
-</ul>
-
-</div>
-
-<h3>スキン・テンプレート変数</h3>
-
-<div>
-スキン・テンプレート、及び記事中に記入することが出来ます<br />
-記入方法:<code><%CustomURL(リンク先, リンク文字列, リンクタイトル)%></code><br />
-<ul>
-<li>リンク先:リンク先の種類/id または名前/指定種別
- <ul>
- <li>第一パラグラフ:i、c、s、b、m のいずれか。それぞれ、item、category、subcategory、blog、member の頭文字</li>
- <li>第二パラグラフ:リンク先の id、もしくは名前。名前はパス名ではなく、「カテゴリー名」「ブログの短縮名」等になります。リンク先にアイテムを選択した場合は、ここに指定できるのは id のみになります</li>
- <li>第三パラグラフ:第二パラグラフに id を指定した場合は 'i' 、名前を指定した場合は 'n' と記入してください</li>
- </ul>
-</li>
-<li>リンク文字列:a タグに挟まれる文字列。省略された場合は url のみが生成されます</li>
-<li>リンクタイトル:a タグの「title」属性に設定されます。省略された場合は、リンク文字列が存在すれば変わりに設定されます。リンク文字列を指定せずにタイトルのみを指定してもリンクタグは生成されません</li>
-<li>全てのパラメータを省略して<%CustomURL%>と書くことも出来ます。この場合は記入場所によってデフォルトの URI が書き出されます
- <ul>
- <li>スキン :選択中の「ブログ」のトップページへの URI が書き出されますす</li>
- <li>テンプレート:書き出されるアイテムへの URI が書き出されます(<%itemlink%>の置き換え)</li>
- <li>記事中 :自分自身への URI が書き出されます</li>
- </ul>
-</li>
-</ul>
-記入例:
-<ul>
- <li>id が123のアイテムにリンクする場合:<a href="<%CustomURL(i/123/i)%>">'ここは自由に書き込んでください'</a><br />
- 書き出される文字列:<a href="http://blog.example.jp/item_123.html">'ここは自由に書き込んでください'</a></li>
- <li>カテゴリー名が「日記」のカテゴリーの URI を書き出す場合:<%CustomURL(c/日記/n)%><br />
- 書き出される文字列(「日記」カテゴリーのidが12の場合):http://blog.example.jp/category_12/</li>
- <li>ブログの短縮名「bibouroku」へのリンクを「このブログ」という文字列からのリンクに設定する場合:<%CustomURL(c/bibouroku/n, このブログ)%><br />
- 書き出される文字列:<a href="http://blog.example.jp/">このブログ</a></li>
-</ul>
-スキン・テンプレート・記事共に、<%CustomURL(123)%>のように id のみを記入した場合は、その id を持つアイテムへの URI が書き出されます<br />
-またアイテムの場合のみ、<%CustomURL(123/path)%>と書くことで、item_123 のようにその id を持つアイテムに設定したパスを書き出すことが出来ます<br />
-</div>
-
-<h3>動作報告・バグレポート</h3>
-
-<p>動作報告・バグレポートは、以下のURLにコメント・トラックバックをお願いします<br />
-<a href="http://shizuki.kinezumi.net/NucleusCMS/Plugins/NP_CustomURL/NP_CustomURL.html">
-http://shizuki.kinezumi.net/NucleusCMS/Plugins/NP_CustomURL/NP_CustomURL.html</a></p>
-
-<h3>バージョン履歴</h3>
-
-<ul>
-<li>Version 0.2.3: 不具合修正・機能追加
- <ul>
- <li>リダイレクト周りにバグがあったので修正</li>
- <li>「カスタマイズされたURLを使用する」を「はい」にしている時、旧来のFancuURLでアクセスしてきたクライアントに301を返してリダイレクトするように変更</li>
- </ul>
-</li>
-<li>Version 0.2.2a: 不具合修正
- <ul>
- <li>SQLインジェクションを引き起こす可能性がある脆弱性に対処</li>
- </ul>
-</li>
-<li>Version 0.2.2: 不具合修正・機能追加
- <ul>
- <li>バグフィックス</li>
- <li>アイテム・カテゴリー・サブカテゴリーの新規作成時のデフォルトの接頭語のオプションでの変更に対応<br />
- アイテムの接頭語のみテンプレート化</li>
- </ul>
-</li>
-<li>Version 0.2.1a: 不具合修正
- <ul>
- <li>バグフィックス</li>
- </ul>
-</li>
-<li>Version 0.2.1: 機能追加
- <ul>
- <li>サブカテゴリの多段URL化</li>
- <li>カテゴリ・ブログの削除時にサブカテゴリのデータが消去できていなかった不具合を修正</li>
- <li>その他修正</li>
- </ul>
-</li>
-<li>Version 0.1.9: 機能追加
- <ul>
- <li>カテゴリ及びアイテムのブログ間移動に対応</li>
- </ul>
-</li>
-<li>Version 0.1.8a: 不具合修正・機能追加
- <ul>
- <li>新規サブカテゴリのパス登録のタイミング変更に伴う修正</li>
- <li>ブログ毎にカスタマイズした URI を使用する・しないを選択できるようにオプションを追加</li>
- <li>ヘルプファイルの修正</li>
- </ul>
-</li>
-<li>Version 0.1.8: 不具合修正
- <ul>
- <li>新規ブログ作成時に自動で作成される'General'カテゴリーに対するURIが正常に動作しなかった不具合に対応</li>
- <li>ブログを削除した時に、削除したブログに属する「カテゴリー」「サブカテゴリー」「アイテム」のURIがテーブルに残ったままになっていた不具合に対応</li>
- <li>新規サブカテゴリーのパスの登録のタイミングをリンクが生成される時に変更(リンク生成前に管理画面でURIを設定していた場合は設定したURIが使用されます)</li>
- <li>管理ページでアイテムURIがおかしくなっていたのを修正</li>
- </ul>
-</li>
-<li>Version 0.1.7: 不具合修正
- <ul>
- <li>ほぼ全面的に書き直し</li>
- <li>新規アイテム追加時にトラックバックを送信した時に、トラックバック元のURLが正しく送信できなかった</li>
- <li>管理画面からサブカテゴリのパスを編集したときに、リストが表示されなかった</li>
- </ul>
-</li>
-<li>Version 0.1.5: 公開バージョン</li>
-<li>Version 0.01: 初期バージョン(NP_Pathの改造バージョン)</li>
-</ul>
-
-<h3>謝辞</h3>
-<p>
-本プラグインの英語版ランゲージファイル、及びヘルプファイル作成に当たりまして、多大なるご協力をいただきましたTucker氏に心より感謝申し上げます
-</p>
-
-<h3>プラグイン改造情報</h3>
-
-<div>
-
-「NP_TagEX」と「NP_ContentsList」で 「http://example.jp/nucleuscms/plugins/tag/NP_CustomURL」 形式のリンクを表示させる方法<br />
-<br />
-「NP_TagEX」の場合<br />
-・一番最後のファンクション<code>creatTagLink()</code>の最後の<code>return addLinkParams($link, $linkparams);</code>の直前に、次のコードを挿入します<br />
-<blockquote><pre style="overflow:auto;">global $manager;
-if ($manager->pluginInstalled('NP_CustomURL')) {
- $customurls = $manager->getPlugin('NP_CustomURL');
- $link = 'tag/' . $ready.$sep.$this->_rawencode($tag);
- return $CONF['BlogURL'] . '/' . $customurls->_addLinkParams($link, $linkparams) . '/';
-}
-</pre></blockquote>
-これでタグがURLの一番最後になります<br />
-<br />
-「NP_ContentsList」の場合<br />
-・<code>doSkinVar()</code>の467行目付近、<code>$catdata['catlink']</code>の生成が終了したところでサブカテゴリのリンクを生成する直前、
-<blockquote><pre style="overflow:auto;">// sub category ---
-if ($subcat && (!$subcurrent || $catid == $catdata['catid']) && !$subnoOpen) {
-</pre></blockquote>
-の前の行に
-<blockquote><pre style="overflow:auto;">if ($CONF['URLMode'] == 'pathinfo' && $manager->pluginInstalled('NP_CustomURL')) {
- $catdata['catlink'] = createCategoryLink($catdata['catid']);
-}
-</pre></blockquote>の一行を追加して、カテゴリのリンクを上書きします<br />
-さらにそこからもう少し下の
-<blockquote><pre style="overflow:auto;">$subdata['sublink'] = addLinkParams($catdata['catlink'], array($subrequest => $subdata['subcatid']));
-</pre></blockquote>
-となっている行の下に
-<blockquote><pre style="overflow:auto;">global $manager;
-if ($CONF['URLMode'] == 'pathinfo' && $manager->pluginInstalled('NP_CustomURL')) {
- $customurls = $manager->getPlugin('NP_CustomURL');
- $subdata['sublink'] = $customurls->_addLinkParams($catdata['catlink'], array($subrequest => $subdata['subcatid']));
-}
-</pre></blockquote>
-と追加、350行目付近の<code>$data['self'] = $data['blogurl'];</code>の前に
-<blockquote><pre style="overflow:auto;">if ($CONF['URLMode'] == 'pathinfo' && $manager->pluginInstalled('NP_CustomURL')) {
- $data['blogurl'] = createBlogidLink($data['blogid']);
-}
-</pre></blockquote>
-を追加して終了です
-
-</div>
+++ /dev/null
-<?php
-
-// PLUGIN MESSAGES
-
-// Plugin description
- define('_DESCRIPTION', 'This plugin generates the static link from website URL created by NucleusCMS.');
-
-// Plugin Options
-// Global
- define('_OP_ARCHIVE_DIR_NAME', 'Archive directory request URI');
- define('_OP_ARCHIVES_DIR_NAME', 'Archives directory request URI');
- define('_OP_MEMBER_DIR_NAME', 'Member directory request URI');
- define('_OP_DEF_ITEM_KEY', 'Default prefix of Item request URI');
- define('_OP_DEF_CAT_KEY', 'Default prefix of Categories request URI');
- define('_OP_DEF_SCAT_KEY', 'Default prefix of Subcategories request URI');
- define('_OP_INCLUDE_CBNAME', 'Add BlogShortcut to Default Blog');
- define('_OP_NOT_FOUND', 'Behavior when there were not data to fall under');
- define('_OP_TABLE_DELETE', 'Drop tables on uninstall ?');
- define('_OP_QUICK_LINK', 'Show in Quick Menu ?');
-// Blog
- define('_OP_USE_CURL', 'Use URI alias in this weblog');
- define('_OP_BLOG_PATH', 'Weblog request URI');
- define('_OP_RED_NORM', 'Redirect when nomal URI (/index.php?itemid=123 to /item_123.html)');
- define('_OP_RED_SEARCH', 'Redirect when search (/index.php?query=word to /search/word)');
-// Item
- define('_OP_ITEM_PATH', 'Plugin request URI');
-// Category
- define('_OP_CATEGORY_PATH', 'Category request URI');
-// Member
- define('_OP_MEMBER_PATH', 'Member request URI');
-
-// Error messages
- define('_NO_SUCH_URI', 'Unable to connect requested URI.<br /> Please check URI and try again.<br />');
- define('_INVALID_ERROR', '<h2>Invalid path</h2>');
- define('_INVALID_MSG', 'Invalid caracter is included.<br /> Available characters are only [A-Za-z0-9/-(hyphen)/_(underscore)]<br />And also extention is not allowed like [.html]');
- define('_CONFLICT_ERROR', '<h2>Specified URI already exists.</h2>');
- define('_CONFLICT_MSG', 'Special id is automatically added at the end of URI because specified URI already exists in this weblog.<br /> Please edit again if you want to chage URI.');
- define('_DELETE_PATH', '<h2>Alias was successfully deleted.</h2>');
- define('_DELETE_MSG', 'Drop registered URI because of empty setting.<br /> Nomal FancyURL is applied for the link URI.');
-// define('_NOT_VALID_BLOG', 'Specified weblog does not exist.');
-// define('_NOT_VALID_ITEM', 'Specified item does not exist.');
-// define('_NOT_VALID_CAT', 'Specified category does not exist.');
-// define('_NOT_VALID_SUBCAT', 'Specified subcategory does not exist.');
-// define('_NOT_VALID_MEMBER', 'Specified member does not exist.');
- define('_NOT_VALID_BLOG', '');
- define('_NOT_VALID_ITEM', '');
- define('_NOT_VALID_CAT', '');
- define('_NOT_VALID_SUBCAT', '');
- define('_NOT_VALID_MEMBER', '');
-
-// Admin area
- define('_ADMIN_TITLE', 'URL CUSTOMIZE');
- define('_QUICK_TIPS', 'Manage link URI');
- define('_ERROR_DISALLOWED', 'Access denied.');
- define('_DISALLOWED_MSG', 'You do not log in or have the permission.');
- define('_ADMIN_AREA_TITLE', 'Manage link URI');
- define('_OPTION_SETTING', 'Back to option setting');
- define('_FOR_ITEMS_SETTING', 'Manage item URI');
- define('_FOR_MEMBER_SETTING', 'Manage member URI');
- define('_FOR_CATEGORY_SETTING', 'Manage category URI');
- define('_FOR_BLOG_SETTING', 'Manage weblog URI');
- define('_EDIT', 'Edit');
- define('_BLOG_LIST_TITLE', 'Weblog name');
- define('_BLOG_URI_SETTING', 'Manage weblog access path');
- define('_BLOG_URI_NAME', 'Weblog access path');
- define('_BLOG_SETTING', 'Edit weblogs');
- define('_ITEM_SETTING', 'Edit items');
- define('_CATEGORY_SETTING', 'Edit categories');
- define('_SUBCATEGORY_SETTING', 'Edit subcategories');
- define('_MEMBER_SETTING', 'Edit members');
- define('_LISTS_CAT_NAME', 'Category name/Subcategory name');
- define('_LISTS_ITEM_DESC', 'Description');
- define('_LISTS_PATH', 'Access path');
- define('_UPDATE_SUCCESS', 'Alias was successfully updated.');
-
-?>
+++ /dev/null
-<?php
-
-// PLUGIN MESSAGES
-
-// Plugin description
- define('_DESCRIPTION', 'NucleusCMS¤ÇºîÀ®¤·¤¿web¥µ¥¤¥È¤ÎURL¤òÀÅŪ¥ê¥ó¥¯¤È¤·¤ÆÀ¸À®¤·¤Þ¤¹<br />¾Ü¤·¤¯¤Ï¥Ø¥ë¥×¥Ú¡¼¥¸¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤');
-
-// Plugin Options
-// Global
- define('_OP_ARCHIVE_DIR_NAME', '¥¢¡¼¥«¥¤¥Ö¥Ç¥£¥ì¥¯¥È¥ê¤Ø¤Î Path ¤Î̾Á°');
- define('_OP_ARCHIVES_DIR_NAME', '¥¢¡¼¥«¥¤¥Ö¥ê¥¹¥È¥Ç¥£¥ì¥¯¥È¥ê¤Ø¤Î Path ¤Î̾Á°');
- define('_OP_MEMBER_DIR_NAME', '¥á¥ó¥Ð¡¼¥Ç¥£¥ì¥¯¥È¥ê¤Ø¤Î Path ¤Î̾Á°');
- define('_OP_DEF_ITEM_KEY', '¿·µ¬ºîÀ®»þ¤Î¥¢¥¤¥Æ¥à¤ÎURI¤ÎÀÜƬ¸ì');
- define('_OP_DEF_CAT_KEY', '¿·µ¬ºîÀ®»þ¤Î¥«¥Æ¥´¥ê¡¼¤ÎURI¤ÎÀÜƬ¸ì');
- define('_OP_DEF_SCAT_KEY', '¿·µ¬ºîÀ®»þ¤Î¥µ¥Ö¥«¥Æ¥´¥ê¡¼¤ÎURI¤ÎÀÜƬ¸ì');
- define('_OP_INCLUDE_CBNAME', '¥Ç¥Õ¥©¥ë¥È¤Î¥Ö¥í¥°¤Î URL ¤Ë¤â¥Ö¥í¥°¤Îû½Ì̾¤òÄɲ乤ë');
- define('_OP_NOT_FOUND', 'URI ¤Ë³ºÅö¤¹¤ë¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Ê¤«¤Ã¤¿¾ì¹ç¤ÎµóÆ°');
- define('_OP_TABLE_DELETE', '¥¢¥ó¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë¤È¤¤Ë¥Æ¡¼¥Ö¥ë¤òºï½ü¤·¤Þ¤¹¤«¡©');
- define('_OP_QUICK_LINK', '¥¯¥¤¥Ã¥¯¥á¥Ë¥å¡¼¤Ë¥·¥ç¡¼¥È¥«¥Ã¥È¤òÄɲä·¤Þ¤¹¤«¡©');
-// Blog
- define('_OP_USE_CURL', '¤³¤Î¥Ö¥í¥°¤Ç URI ¤ÎÊÌ̾¤ò»ÈÍѤ¹¤ë');
- define('_OP_BLOG_PATH', '¤³¤Î¥Ö¥í¥°¤Î¥ê¥¯¥¨¥¹¥È URI');
- define('_OP_RED_NORM', '¥Î¡¼¥Þ¥ë¤Î URL ¤Ç¥¢¥¯¥»¥¹¤¬¤¢¤Ã¤¿»þ¤Ë¥ê¥À¥¤¥ì¥¯¥È¤·¤Þ¤¹¤«¡©');
- define('_OP_RED_SEARCH', '¸¡º÷¤Î»þ¤Î URL ¤ò ¡Ö/search/¸¡º÷¸ì¡×¤Ë¥ê¥À¥¤¥ì¥¯¥È¤·¤Þ¤¹¤«¡©');
-// Item
- define('_OP_ITEM_PATH', '¤³¤Î¥¢¥¤¥Æ¥à¤Î¥ê¥¯¥¨¥¹¥È URI');
-// Category
- define('_OP_CATEGORY_PATH', '¤³¤Î¥«¥Æ¥´¥ê¡¼¤Î¥ê¥¯¥¨¥¹¥È URI');
-// Member
- define('_OP_MEMBER_PATH', '¤³¤Î¥á¥ó¥Ð¡¼¤Î¥ê¥¯¥¨¥¹¥È URI');
-
-// Error messages
- define('_NO_SUCH_URI', '¥ê¥¯¥¨¥¹¥È¤µ¤ì¤¿ URI ¤Ë¥¢¥¯¥»¥¹¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿<br />¤â¤¦°ìÅÙ URI ¤ò¤è¤¯³Î¤«¤á¤Æ¤¯¤À¤µ¤¤<br />');
- define('_INVALID_ERROR', '<h2>¥Ñ¥¹¤¬ÉÔÀµ¤Ç¤¹</h2>');
- define('_INVALID_MSG', '¥Ñ¥¹¤ËÉÔÀµ¤Êʸ»úÎ󤬻ØÄꤵ¤ì¤Þ¤·¤¿<br />»ÈÍѤǤ¤ëʸ»ú¤Ï¡¢[¥¢¥ë¥Õ¥¡¥Ù¥Ã¥È/¿ô»ú/-(¥Ï¥¤¥Õ¥ó)/_(¥¢¥ó¥À¡¼¥Ð¡¼)]¤Î¤ß(¤¹¤Ù¤ÆȾ³Ñ)¤Ç¤¹<br />¤Þ¤¿¡¢ËöÈø¤Ë[.html]Åù¤Î³ÈÄ¥»Ò¤ò¤Ä¤±¤ë¤³¤È¤Ï½ÐÍè¤Þ¤»¤ó');
- define('_CONFLICT_ERROR', '<h2>¥Ñ¥¹¤¬½ÅÊ£¤·¤Æ¤¤¤Þ¤¹</h2>');
- define('_CONFLICT_MSG', 'Ʊ°ì¥Ö¥í¥°Æâ¤Ë¤¹¤Ç¤Ë¸ºß¤¹¤ë¥Ñ¥¹¤¬»ØÄꤵ¤ì¤¿¤Î¤Ç¡¢¥Ñ¥¹¤ÎËöÈø¤Ë ID ¤¬Éղ䵤ì¤Þ¤·¤¿<br />¥Ñ¥¹¤òÊѹ¹¤¹¤ë¾ì¹ç¤Ï¡¢ºÆÅÙÊÔ½¸¤·¤Æ¤¯¤À¤µ¤¤');
- define('_DELETE_PATH', '<h2>¥¨¥¤¥ê¥¢¥¹Ì¾¤òºï½ü¤·¤Þ¤·¤¿</h2>');
- define('_DELETE_MSG', '¥Ñ¥¹¤È¤·¤Æ¶õÇò¤¬»ØÄꤵ¤ì¤¿¤¿¤á¡¢ÅÐÏ¿ºÑ¤ß¤Î¥Ñ¥¹¤òºï½ü¤·¤Þ¤·¤¿<br />¥ê¥ó¥¯ URI ¤Ë¤ÏÄ̾ï¤Î FancyURLs ¤Î¤â¤Î¤¬Å¬ÍѤµ¤ì¤Þ¤¹');
-// define('_NOT_VALID_BLOG', '»ØÄꤵ¤ì¤¿¥Ö¥í¥°¤Ï¸ºß¤·¤Þ¤»¤ó');
-// define('_NOT_VALID_ITEM', '»ØÄꤵ¤ì¤¿¥¢¥¤¥Æ¥à¤Ï¸ºß¤·¤Þ¤»¤ó');
-// define('_NOT_VALID_CAT', '»ØÄꤵ¤ì¤¿¥«¥Æ¥´¥ê¡¼¤Ï¸ºß¤·¤Þ¤»¤ó');
-// define('_NOT_VALID_SUBCAT', '»ØÄꤵ¤ì¤¿¥µ¥Ö¥«¥Æ¥´¥ê¡¼¤Ï¸ºß¤·¤Þ¤»¤ó');
-// define('_NOT_VALID_MEMBER', '»ØÄꤵ¤ì¤¿¥á¥ó¥Ð¡¼¤Ï¸ºß¤·¤Þ¤»¤ó');
- define('_NOT_VALID_BLOG', '');
- define('_NOT_VALID_ITEM', '');
- define('_NOT_VALID_CAT', '');
- define('_NOT_VALID_SUBCAT', '');
- define('_NOT_VALID_MEMBER', '');
-
-// Admin area
- define('_ADMIN_TITLE', 'URL CUSTOMIZE');
- define('_QUICK_TIPS', '¥ê¥ó¥¯É½¼¨ÍÑ URI ¤Î´ÉÍý');
- define('_ERROR_DISALLOWED', '¥¢¥¯¥»¥¹¤Ç¤¤Þ¤»¤ó');
- define('_DISALLOWED_MSG', '¥í¥°¥¤¥ó¤·¤Æ¤¤¤Ê¤¤¤«¡¢¤Þ¤¿¤Ï´ÉÍý¼Ô¸¢¸Â¤¬¤¢¤ê¤Þ¤»¤ó');
- define('_ADMIN_AREA_TITLE', '¥ê¥ó¥¯É½¼¨ÍÑ URI ¤Î´ÉÍý¥Ú¡¼¥¸');
- define('_OPTION_SETTING', '¤³¤Î¥×¥é¥°¥¤¥ó¤Î¥ª¥×¥·¥ç¥óÀßÄê¥Ú¡¼¥¸¤Ø°ÜÆ°');
- define('_FOR_ITEMS_SETTING', '¥¢¥¤¥Æ¥àÍÑ URI ´ÉÍý¥Ú¡¼¥¸¤Ø');
- define('_FOR_MEMBER_SETTING', '¥á¥ó¥Ð¡¼ÍÑ URI ´ÉÍý¥Ú¡¼¥¸¤Ø');
- define('_FOR_CATEGORY_SETTING', '¥«¥Æ¥´¥ê¡¼ÍÑ URI ´ÉÍý¥Ú¡¼¥¸¤Ø');
- define('_FOR_BLOG_SETTING', '¥Ö¥í¥°ÍÑ URI ´ÉÍý¥Ú¡¼¥¸¤Ø');
- define('_EDIT', 'ÊÔ½¸');
- define('_BLOG_LIST_TITLE', '¥Ö¥í¥°Ì¾');
- define('_BLOG_URI_SETTING', '¥Ö¥í¥°ÍÑ¥¢¥¯¥»¥¹¥Ñ¥¹´ÉÍý');
- define('_BLOG_URI_NAME', '¥Ö¥í¥°ÍÑ¥¢¥¯¥»¥¹¥Ñ¥¹');
- define('_BLOG_SETTING', '¥Ö¥í¥°¤ÎÀßÄê¤ÎÊÔ½¸');
- define('_ITEM_SETTING', '¥¢¥¤¥Æ¥à¤ÎÀßÄê¤ÎÊÔ½¸');
- define('_CATEGORY_SETTING', '¥«¥Æ¥´¥ê¡¼¤ÎÀßÄê¤ÎÊÔ½¸');
- define('_SUBCATEGORY_SETTING', '¥µ¥Ö¥«¥Æ¥´¥ê¡¼¤ÎÀßÄê¤ÎÊÔ½¸');
- define('_MEMBER_SETTING', '¥á¥ó¥Ð¡¼¤ÎÀßÄê¤ÎÊÔ½¸');
- define('_LISTS_CAT_NAME', '¥«¥Æ¥´¥ê̾/¥µ¥Ö¥«¥Æ¥´¥ê̾');
- define('_LISTS_ITEM_DESC', 'ËÜʸ¤ÎËÁƬ');
- define('_LISTS_PATH', '¥¢¥¯¥»¥¹ ¥Ñ¥¹');
- define('_UPDATE_SUCCESS', '¥¨¥¤¥ê¥¢¥¹Ì¾¤ò¹¹¿·¤·¤Þ¤·¤¿');
-
-?>
+++ /dev/null
-<?php
-
-// PLUGIN MESSAGES
-
-// Plugin description
- define('_DESCRIPTION', 'NucleusCMSで作成したwebサイトのURLを静的リンクとして生成します<br />詳しくはヘルプページを参照してください');
-
-// Plugin Options
-// Global
- define('_OP_ARCHIVE_DIR_NAME', 'アーカイブディレクトリへの Path の名前');
- define('_OP_ARCHIVES_DIR_NAME', 'アーカイブリストディレクトリへの Path の名前');
- define('_OP_MEMBER_DIR_NAME', 'メンバーディレクトリへの Path の名前');
- define('_OP_DEF_ITEM_KEY', '新規作成時のアイテムのURIの接頭語');
- define('_OP_DEF_CAT_KEY', '新規作成時のカテゴリーのURIの接頭語');
- define('_OP_DEF_SCAT_KEY', '新規作成時のサブカテゴリーのURIの接頭語');
- define('_OP_INCLUDE_CBNAME', 'デフォルトのブログの URL にもブログの短縮名を追加する');
- define('_OP_NOT_FOUND', 'URI に該当するデータが存在しなかった場合の挙動');
- define('_OP_TABLE_DELETE', 'アンインストールするときにテーブルを削除しますか?');
- define('_OP_QUICK_LINK', 'クイックメニューにショートカットを追加しますか?');
-// Blog
- define('_OP_USE_CURL', 'このブログで URI の別名を使用する');
- define('_OP_BLOG_PATH', 'このブログのリクエスト URI');
- define('_OP_RED_NORM', 'ノーマルの URL でアクセスがあった時にリダイレクトしますか?');
- define('_OP_RED_SEARCH', '検索の時の URL を 「/search/検索語」にリダイレクトしますか?');
-// Item
- define('_OP_ITEM_PATH', 'このアイテムのリクエスト URI');
-// Category
- define('_OP_CATEGORY_PATH', 'このカテゴリーのリクエスト URI');
-// Member
- define('_OP_MEMBER_PATH', 'このメンバーのリクエスト URI');
-
-// Error messages
- define('_NO_SUCH_URI', 'リクエストされた URI にアクセスできませんでした<br />もう一度 URI をよく確かめてください<br />');
- define('_INVALID_ERROR', '<h2>パスが不正です</h2>');
- define('_INVALID_MSG', 'パスに不正な文字列が指定されました<br />使用できる文字は、[アルファベット/数字/-(ハイフン)/_(アンダーバー)]のみ(すべて半角)です<br />また、末尾に[.html]等の拡張子をつけることは出来ません');
- define('_CONFLICT_ERROR', '<h2>パスが重複しています</h2>');
- define('_CONFLICT_MSG', '同一ブログ内にすでに存在するパスが指定されたので、パスの末尾に ID が付加されました<br />パスを変更する場合は、再度編集してください');
- define('_DELETE_PATH', '<h2>エイリアス名を削除しました</h2>');
- define('_DELETE_MSG', 'パスとして空白が指定されたため、登録済みのパスを削除しました<br />リンク URI には通常の FancyURLs のものが適用されます');
-// define('_NOT_VALID_BLOG', '指定されたブログは存在しません');
-// define('_NOT_VALID_ITEM', '指定されたアイテムは存在しません');
-// define('_NOT_VALID_CAT', '指定されたカテゴリーは存在しません');
-// define('_NOT_VALID_SUBCAT', '指定されたサブカテゴリーは存在しません');
-// define('_NOT_VALID_MEMBER', '指定されたメンバーは存在しません');
- define('_NOT_VALID_BLOG', '');
- define('_NOT_VALID_ITEM', '');
- define('_NOT_VALID_CAT', '');
- define('_NOT_VALID_SUBCAT', '');
- define('_NOT_VALID_MEMBER', '');
-
-// Admin area
- define('_ADMIN_TITLE', 'URL CUSTOMIZE');
- define('_QUICK_TIPS', 'リンク表示用 URI の管理');
- define('_ERROR_DISALLOWED', 'アクセスできません');
- define('_DISALLOWED_MSG', 'ログインしていないか、または管理者権限がありません');
- define('_ADMIN_AREA_TITLE', 'リンク表示用 URI の管理ページ');
- define('_OPTION_SETTING', 'このプラグインのオプション設定ページへ移動');
- define('_FOR_ITEMS_SETTING', 'アイテム用 URI 管理ページへ');
- define('_FOR_MEMBER_SETTING', 'メンバー用 URI 管理ページへ');
- define('_FOR_CATEGORY_SETTING', 'カテゴリー用 URI 管理ページへ');
- define('_FOR_BLOG_SETTING', 'ブログ用 URI 管理ページへ');
- define('_EDIT', '編集');
- define('_BLOG_LIST_TITLE', 'ブログ名');
- define('_BLOG_URI_SETTING', 'ブログ用アクセスパス管理');
- define('_BLOG_URI_NAME', 'ブログ用アクセスパス');
- define('_BLOG_SETTING', 'ブログの設定の編集');
- define('_ITEM_SETTING', 'アイテムの設定の編集');
- define('_CATEGORY_SETTING', 'カテゴリーの設定の編集');
- define('_SUBCATEGORY_SETTING', 'サブカテゴリーの設定の編集');
- define('_MEMBER_SETTING', 'メンバーの設定の編集');
- define('_LISTS_CAT_NAME', 'カテゴリ名/サブカテゴリ名');
- define('_LISTS_ITEM_DESC', '本文の冒頭');
- define('_LISTS_PATH', 'アクセス パス');
- define('_UPDATE_SUCCESS', 'エイリアス名を更新しました');
-
-?>
+++ /dev/null
-<?php
-/**
- *
- * 0.94 bug fix
- * add language files
- * configuration by option
- * 0.93 sec fix
- * subcategory link bug fix
- *
- */
-
-class NP_Dtree extends NucleusPlugin
-{
-
- function getName()
- {
- return 'Navigation Tree';
- }
-
- function getAuthor()
- {
- return 'nakahara21 + shizuki';
- }
-
- function getURL()
- {
- return 'http://nakahara21.com/';
- }
-
- function getVersion()
- {
- return '0.94';
- }
-
- function getDescription()
- {
- return _DTREE_DESCRIPTION; //'Show Navigation Tree. Usage: <%Dtree()%>';
- }
-
- function supportsFeature($what)
- {
- switch($what){
- case 'SqlTablePrefix':
- return 1;
- default:
- return 0;
- }
- }
-
- function install()
- {
- $this->createOption('folderLinks', _DTREE_DIR_LINK, 'yesno', 'yes');
- $this->createOption('useSelection', _DTREE_SELECTION, 'yesno', 'no');
- $this->createOption('useCookies', _DTREE_COOKIE, 'yesno', 'no');
- $this->createOption('useLines', _DTREE_LINE, 'yesno', 'yes');
- $this->createOption('useIcons', _DTREE_ICON, 'yesno', 'yes');
- $this->createOption('useStatusText', _DTREE_ST_TEXT, 'yesno', 'no');
- $this->createOption('closeSameLevel', _DTREE_CL_SLEVEL, 'yesno', 'no');
- $this->createOption('inOrder', _DTREE_IN_ORDER, 'yesno', 'no');
- }
-
- function init()
- {
- global $admin;
- $language = ereg_replace( '[\\|/]', '', getLanguageName());
- if (file_exists($this->getDirectory().'language/'.$language.'.php')) {
- include_once($this->getDirectory().'language/'.$language.'.php');
- }else {
- include_once($this->getDirectory().'language/english.php');
- }
- }
-
- function doSkinVar($skinType, $itemid = 0)
- {
- global $blogid, $catid, $subcatid;
- $adminURL = htmlspecialchars($this->getAdminURL(), ENT_QUOTES, _CHARSET);
- if (is_numeric($blogid)) {
- $blogid = intval($blogid);
- } else {
- $id = getBlogIDFromName($blogid);
- $blogid = intval($id);
- }
- $itemid = intval($itemid);
- $catid = intval($catid);
- $subcatid = intval($subcatid);
-
-// $randomID = 'tree' . uniqid(rand());
- $randomID = 'tree' . preg_replace('|[^0-9a-f]|i', '', uniqid(rand()));
-
- echo '<script type="text/javascript" src="' . $adminURL . 'dtree.php"></script>' . "\n";
-
- if ($skinType == 'template') {
- $data = '<script type="text/javascript"' . ' src="' . $adminURL
- . 'dtreedata.php?'
- . 'o=' . $randomID . 'a'
- . '&'
- . 'bid=' . $blogid
- . '&'
- . 'id=' . $itemid
- . '"></script>' . "\n";
- echo $data;
- $data = '<a href="javascript: ' . $randomID . 'a.openAll();">' . _DTREE_OPENALL . '</a>' . "\n"
- . ' | ' . "\n"
- . '<a href="javascript: ' . $randomID . 'a.closeAll();">' . _DTREE_CLOSEALL . '</a>' . "\n";
- echo $data;
- return;
- }
-
- $eq = '';
- if (!empty($catid)) {
- } $eq .= '&cid=' . $catid;
- if (!empty($subcatid)) {
- $eq .= '&sid=' . $subcatid;
- }
-
- $data = '<script type="text/javascript" src="' . $adminURL
- . 'dtreedata.php?'
- . 'o=' . $randomID . 'd'
- . '&'
- . 'bid=' . $blogid . $eq . '">'
- . '</script>';
- echo $data;
- $data = '<a href="javascript: ' . $randomID . 'd.openAll();">' . _DTREE_OPENALL . '</a>' . "\n"
- . ' | ' . "\n"
- . '<a href="javascript: ' . $randomID . 'd.closeAll();">' . _DTREE_CLOSEALL . '</a>' . "\n";
- echo $data;
-/* if (!(intRequestVar('page') > 0) !$catid && !$subcatid) {
- echo '<script type="text/javascript">' . $randomID . 'd.openAll();</script>';
- }*/
-
- }
-
- function doTemplateVar(&$item)
- {
- $this->doSkinVar('template', $item->itemid);
- }
-
-}
-?>
\ No newline at end of file
+++ /dev/null
-/*--------------------------------------------------|
-| dTree 2.05 | www.destroydrop.com/javascript/tree/ |
-|---------------------------------------------------|
-| Copyright (c) 2002-2003 Geir Landr\e$B!&\e(B |
-| |
-| This script can be used freely as long as all |
-| copyright messages are intact. |
-| |
-| Updated: 17.04.2003 |
-|--------------------------------------------------*/
-
-
-<?php
- $strRel = '../../../';
- include($strRel . 'config.php');
- include($DIR_LIBS . 'PLUGINADMIN.php');
- $oPluginAdmin = new PluginAdmin('Dtree');
- $plug =& $oPluginAdmin->plugin;
- $imgpath = $plug->getAdminURL();
-// $imgpath = 'nucleus/plugins/dtree/';
-
- if ($plug->getOption('folderLinks') == 'yes') {
- $folderLinks = 'true,';
- } else {
- $folderLinks = 'false,';
- }
- if ($plug->getOption('useSelection') == 'yes') {
- $useSelection = 'true,';
- } else {
- $useSelection = 'false,';
- }
- if ($plug->getOption('useCookies') == 'yes') {
- $useCookies = 'true,';
- } else {
- $useCookies = 'false,';
- }
- if ($plug->getOption('useLines') == 'yes') {
- $useLines = 'true,';
- } else {
- $useLines = 'false,';
- }
- if ($plug->getOption('useIcons') == 'yes') {
- $useIcons = 'true,';
- } else {
- $useIcons = 'false,';
- }
- if ($plug->getOption('useStatusText') == 'yes') {
- $useStatusText = 'true,';
- } else {
- $useStatusText = 'false,';
- }
- if ($plug->getOption('closeSameLevel') == 'yes') {
- $closeSameLevel = 'true,';
- } else {
- $closeSameLevel = 'false,';
- }
- if ($plug->getOption('inOrder') == 'yes') {
- $inOrder = 'true';
- } else {
- $inOrder = 'false';
- }
-
-?>
-// Node object
-
-var imgpath = "<?php echo $imgpath;?>";
-
-function Node(id, pid, name, url, title, target, icon, iconOpen, open) {
-
- this.id = id;
-
- this.pid = pid;
-
- this.name = name;
-
- this.url = url;
-
- this.title = title;
-
- this.target = target;
-
- this.icon = icon;
-
- this.iconOpen = iconOpen;
-
- this._io = open || false;
-
- this._is = false;
-
- this._ls = false;
-
- this._hc = false;
-
- this._ai = 0;
-
- this._p;
-
-};
-
-// Tree object
-
-function dTree(objName) {
-
- this.config = {
- target : null,
-
- folderLinks : <?php echo $folderLinks ?>
- useSelection : <?php echo $useSelection ?>
- useCookies : <?php echo $useCookies ?>
- useLines : <?php echo $useLines ?>
- useIcons : <?php echo $useIcons ?>
- useStatusText : <?php echo $useStatusText ?>
- closeSameLevel : <?php echo $closeSameLevel ?>
- inOrder : <?php echo $inOrder ?>
-
-// folderLinks : true,
-// useSelection : false,
-// useCookies : false,
-// useLines : false,
-// useIcons : false,
-// useStatusText : true,
-// closeSameLevel : true,
-// inOrder : false
- }
-
- this.icon = {
-
- root : imgpath + 'img/base.gif',
- folder : imgpath + 'img/folder.gif',
- folderOpen : imgpath + 'img/folderopen.gif',
-// node : imgpath + 'img/page.gif',
- node : imgpath + 'img/folder.gif',
- empty : imgpath + 'img/empty.gif',
- line : imgpath + 'img/line.gif',
- join : imgpath + 'img/join.gif',
- joinBottom : imgpath + 'img/joinbottom.gif',
- plus : imgpath + 'img/plus.gif',
- plusBottom : imgpath + 'img/plusbottom.gif',
- minus : imgpath + 'img/minus.gif',
- minusBottom : imgpath + 'img/minusbottom.gif',
- nlPlus : imgpath + 'img/nolines_plus.gif',
- nlMinus : imgpath + 'img/nolines_minus.gif'
-
- };
-
- this.obj = objName;
-
- this.aNodes = [];
-
- this.aIndent = [];
-
- this.root = new Node(-1);
-
- this.selectedNode = null;
-
- this.selectedFound = false;
-
- this.completed = false;
-
-};
-
-
-
-// Adds a new node to the node array
-
-dTree.prototype.add = function(id, pid, name, url, title, target, icon, iconOpen, open) {
-
- this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, title, target, icon, iconOpen, open);
-
-};
-
-
-
-// Open/close all nodes
-
-dTree.prototype.openAll = function() {
-
- this.oAll(true);
-
-};
-
-dTree.prototype.closeAll = function() {
-
- this.oAll(false);
-
-};
-
-
-
-// Outputs the tree to the page
-
-dTree.prototype.toString = function() {
-
- var str = '<div class="dtree">\n';
-
- if (document.getElementById) {
-
- if (this.config.useCookies) this.selectedNode = this.getSelected();
-
- str += this.addNode(this.root);
-
- } else str += 'Browser not supported.';
-
- str += '</div>';
-
- if (!this.selectedFound) this.selectedNode = null;
-
- this.completed = true;
-
- return str;
-
-};
-
-
-
-// Creates the tree structure
-
-dTree.prototype.addNode = function(pNode) {
-
- var str = '';
-
- var n=0;
-
- if (this.config.inOrder) n = pNode._ai;
-
- for (n; n<this.aNodes.length; n++) {
-
- if (this.aNodes[n].pid == pNode.id) {
-
- var cn = this.aNodes[n];
-
- cn._p = pNode;
-
- cn._ai = n;
-
- this.setCS(cn);
-
- if (!cn.target && this.config.target) cn.target = this.config.target;
-
- if (cn._hc && !cn._io && this.config.useCookies) cn._io = this.isOpen(cn.id);
-
- if (!this.config.folderLinks && cn._hc) cn.url = null;
-
- if (this.config.useSelection && cn.id == this.selectedNode && !this.selectedFound) {
-
- cn._is = true;
-
- this.selectedNode = n;
-
- this.selectedFound = true;
-
- }
-
- str += this.node(cn, n);
-
- if (cn._ls) break;
-
- }
-
- }
-
- return str;
-
-};
-
-
-
-// Creates the node icon, url and text
-
-dTree.prototype.node = function(node, nodeId) {
-
- var str = '<div class="dTreeNode">' + this.indent(node, nodeId);
-
- if (this.config.useIcons) {
-
- if (!node.icon) node.icon = (this.root.id == node.pid) ? this.icon.root : ((node._hc) ? this.icon.folder : this.icon.node);
-
- if (!node.iconOpen) node.iconOpen = (node._hc) ? this.icon.folderOpen : this.icon.node;
-
- if (this.root.id == node.pid) {
-
- node.icon = this.icon.root;
-
- node.iconOpen = this.icon.root;
-
- }
-
- str += '\n<img id="i' + this.obj + nodeId + '" src="' + ((node._io) ? node.iconOpen : node.icon) + '" alt="" />\n';
-
- }
-
- if (node.url) {
-
- str += '<a id="s' + this.obj + nodeId + '" class="' + ((this.config.useSelection) ? ((node._is ? 'nodeSel' : 'node')) : 'node') + '" href="' + node.url + '"';
-
- if (node.title) str += ' title="' + node.title + '"';
-
- if (node.target) str += ' target="' + node.target + '"';
-
- if (this.config.useStatusText) str += ' onmouseover="window.status=\'' + node.name + '\';return true;" onmouseout="window.status=\'\';return true;" ';
-
- if (this.config.useSelection && ((node._hc && this.config.folderLinks) || !node._hc))
-
- str += ' onclick="javascript: ' + this.obj + '.s(' + nodeId + ');"';
-
- str += '>\n';
-
- }
-
- else if ((!this.config.folderLinks || !node.url) && node._hc && node.pid != this.root.id)
-
- str += '<a href="javascript: ' + this.obj + '.o(' + nodeId + ');" class="node">';
-
- str += node.name;
-
- if (node.url || ((!this.config.folderLinks || !node.url) && node._hc)) str += '</a>\n';
-
- str += '</div>\n';
-
- if (node._hc) {
-
- str += '<div id="d' + this.obj + nodeId + '" class="clip" style="display:' + ((this.root.id == node.pid || node._io) ? 'block' : 'none') + ';">\n';
-
- str += this.addNode(node);
-
- str += '</div>\n';
-
- }
-
- this.aIndent.pop();
-
- return str;
-
-};
-
-
-
-// Adds the empty and line icons
-
-dTree.prototype.indent = function(node, nodeId) {
-
- var str = '';
-
- if (this.root.id != node.pid) {
-
- for (var n=0; n<this.aIndent.length; n++)
-
- str += '\n<img src="' + ( (this.aIndent[n] == 1 && this.config.useLines) ? this.icon.line : this.icon.empty ) + '" alt="" />';
-
- (node._ls) ? this.aIndent.push(0) : this.aIndent.push(1);
-
- if (node._hc) {
-
- str += '<a href="javascript: ' + this.obj + '.o(' + nodeId + ');"><img id="j' + this.obj + nodeId + '" src="';
-
- if (!this.config.useLines) str += (node._io) ? this.icon.nlMinus : this.icon.nlPlus;
-
- else str += ( (node._io) ? ((node._ls && this.config.useLines) ? this.icon.minusBottom : this.icon.minus) : ((node._ls && this.config.useLines) ? this.icon.plusBottom : this.icon.plus ) );
-
- str += '" alt="" /></a>\n';
-
- } else str += '<img src="' + ( (this.config.useLines) ? ((node._ls) ? this.icon.joinBottom : this.icon.join ) : this.icon.empty) + '" alt="" />\n';
-
- }
-
- return str;
-
-};
-
-
-
-// Checks if a node has any children and if it is the last sibling
-
-dTree.prototype.setCS = function(node) {
-
- var lastId;
-
- for (var n=0; n<this.aNodes.length; n++) {
-
- if (this.aNodes[n].pid == node.id) node._hc = true;
-
- if (this.aNodes[n].pid == node.pid) lastId = this.aNodes[n].id;
-
- }
-
- if (lastId==node.id) node._ls = true;
-
-};
-
-
-
-// Returns the selected node
-
-dTree.prototype.getSelected = function() {
-
- var sn = this.getCookie('cs' + this.obj);
-
- return (sn) ? sn : null;
-
-};
-
-
-
-// Highlights the selected node
-
-dTree.prototype.s = function(id) {
-
- if (!this.config.useSelection) return;
-
- var cn = this.aNodes[id];
-
- if (cn._hc && !this.config.folderLinks) return;
-
- if (this.selectedNode != id) {
-
- if (this.selectedNode || this.selectedNode==0) {
-
- eOld = document.getElementById("s" + this.obj + this.selectedNode);
-
- eOld.className = "node";
-
- }
-
- eNew = document.getElementById("s" + this.obj + id);
-
- eNew.className = "nodeSel";
-
- this.selectedNode = id;
-
- if (this.config.useCookies) this.setCookie('cs' + this.obj, cn.id);
-
- }
-
-};
-
-
-
-// Toggle Open or close
-
-dTree.prototype.o = function(id) {
-
- var cn = this.aNodes[id];
-
- this.nodeStatus(!cn._io, id, cn._ls);
-
- cn._io = !cn._io;
-
- if (this.config.closeSameLevel) this.closeLevel(cn);
-
- if (this.config.useCookies) this.updateCookie();
-
-};
-
-
-
-// Open or close all nodes
-
-dTree.prototype.oAll = function(status) {
-
- for (var n=0; n<this.aNodes.length; n++) {
-
- if (this.aNodes[n]._hc && this.aNodes[n].pid != this.root.id) {
-
- this.nodeStatus(status, n, this.aNodes[n]._ls)
-
- this.aNodes[n]._io = status;
-
- }
-
- }
-
- if (this.config.useCookies) this.updateCookie();
-
-};
-
-
-
-// Opens the tree to a specific node
-
-dTree.prototype.openTo = function(nId, bSelect, bFirst) {
-
- if (!bFirst) {
-
- for (var n=0; n<this.aNodes.length; n++) {
-
- if (this.aNodes[n].id == nId) {
-
- nId=n;
-
- break;
-
- }
-
- }
-
- }
-
- var cn=this.aNodes[nId];
-
- if (cn.pid==this.root.id || !cn._p) return;
-
- cn._io = true;
-
- cn._is = bSelect;
-
- if (this.completed && cn._hc) this.nodeStatus(true, cn._ai, cn._ls);
-
- if (this.completed && bSelect) this.s(cn._ai);
-
- else if (bSelect) this._sn=cn._ai;
-
- this.openTo(cn._p._ai, false, true);
-
-};
-
-
-
-// Closes all nodes on the same level as certain node
-
-dTree.prototype.closeLevel = function(node) {
-
- for (var n=0; n<this.aNodes.length; n++) {
-
- if (this.aNodes[n].pid == node.pid && this.aNodes[n].id != node.id && this.aNodes[n]._hc) {
-
- this.nodeStatus(false, n, this.aNodes[n]._ls);
-
- this.aNodes[n]._io = false;
-
- this.closeAllChildren(this.aNodes[n]);
-
- }
-
- }
-
-}
-
-
-
-// Closes all children of a node
-
-dTree.prototype.closeAllChildren = function(node) {
-
- for (var n=0; n<this.aNodes.length; n++) {
-
- if (this.aNodes[n].pid == node.id && this.aNodes[n]._hc) {
-
- if (this.aNodes[n]._io) this.nodeStatus(false, n, this.aNodes[n]._ls);
-
- this.aNodes[n]._io = false;
-
- this.closeAllChildren(this.aNodes[n]);
-
- }
-
- }
-
-}
-
-
-
-// Change the status of a node(open or closed)
-
-dTree.prototype.nodeStatus = function(status, id, bottom) {
-
- eDiv = document.getElementById('d' + this.obj + id);
-
- eJoin = document.getElementById('j' + this.obj + id);
-
- if (this.config.useIcons) {
-
- eIcon = document.getElementById('i' + this.obj + id);
-
- eIcon.src = (status) ? this.aNodes[id].iconOpen : this.aNodes[id].icon;
-
- }
-
- eJoin.src = (this.config.useLines)?
-
- ((status)?((bottom)?this.icon.minusBottom:this.icon.minus):((bottom)?this.icon.plusBottom:this.icon.plus)):
-
- ((status)?this.icon.nlMinus:this.icon.nlPlus);
-
- eDiv.style.display = (status) ? 'block': 'none';
-
-};
-
-
-
-
-
-// [Cookie] Clears a cookie
-
-dTree.prototype.clearCookie = function() {
-
- var now = new Date();
-
- var yesterday = new Date(now.getTime() - 1000 * 60 * 60 * 24);
-
- this.setCookie('co'+this.obj, 'cookieValue', yesterday);
-
- this.setCookie('cs'+this.obj, 'cookieValue', yesterday);
-
-};
-
-
-
-// [Cookie] Sets value in a cookie
-
-dTree.prototype.setCookie = function(cookieName, cookieValue, expires, path, domain, secure) {
-
- document.cookie =
-
- escape(cookieName) + '=' + escape(cookieValue)
-
- + (expires ? '; expires=' + expires.toGMTString() : '')
-
- + (path ? '; path=' + path : '')
-
- + (domain ? '; domain=' + domain : '')
-
- + (secure ? '; secure' : '');
-
-};
-
-
-
-// [Cookie] Gets a value from a cookie
-
-dTree.prototype.getCookie = function(cookieName) {
-
- var cookieValue = '';
-
- var posName = document.cookie.indexOf(escape(cookieName) + '=');
-
- if (posName != -1) {
-
- var posValue = posName + (escape(cookieName) + '=').length;
-
- var endPos = document.cookie.indexOf(';', posValue);
-
- if (endPos != -1) cookieValue = unescape(document.cookie.substring(posValue, endPos));
-
- else cookieValue = unescape(document.cookie.substring(posValue));
-
- }
-
- return (cookieValue);
-
-};
-
-
-
-// [Cookie] Returns ids of open nodes as a string
-
-dTree.prototype.updateCookie = function() {
-
- var str = '';
-
- for (var n=0; n<this.aNodes.length; n++) {
-
- if (this.aNodes[n]._io && this.aNodes[n].pid != this.root.id) {
-
- if (str) str += '.';
-
- str += this.aNodes[n].id;
-
- }
-
- }
-
- this.setCookie('co' + this.obj, str);
-
-};
-
-
-
-// [Cookie] Checks if a node id is in a cookie
-
-dTree.prototype.isOpen = function(id) {
-
- var aOpen = this.getCookie('co' + this.obj).split('.');
-
- for (var n=0; n<aOpen.length; n++)
-
- if (aOpen[n] == id) return true;
-
- return false;
-
-};
-
-
-
-// If Push and pop is not implemented by the browser
-
-if (!Array.prototype.push) {
-
- Array.prototype.push = function array_push() {
-
- for(var i=0;i<arguments.length;i++)
-
- this[this.length]=arguments[i];
-
- return this.length;
-
- }
-
-};
-
-if (!Array.prototype.pop) {
-
- Array.prototype.pop = function array_pop() {
-
- lastElement = this[this.length-1];
-
- this.length = Math.max(this.length-1,0);
-
- return lastElement;
-
- }
-
-};
\ No newline at end of file
+++ /dev/null
-<?php
-global $CONF, $manager;
- $strRel = '../../../';
- include($strRel . 'config.php');
-
- $usePathInfo = ($CONF['URLMode'] == 'pathinfo');
-
-// $objectId = requestVar('o');
- $objectId = 'tree' . preg_replace('|[^0-9a-f]|i', '', substr(requestVar('o'), 4));
- $blogid = intRequestVar('bid');
- if (empty($blogid)) {
- $blogid = intval($CONF['DefaultBlog']);
- }
- $blogname = getBlogNameFromID($blogid);
-
- $b =& $manager->getBlog($blogid);
- $blogurl = $b->getURL();
- if (!$blogurl) {
- if($blog) {
- $b_tmp =& $manager->getBlog($blogid);
- $blogurl = $b_tmp->getURL();
- }
- if (!$blogurl) {
- $blogurl = $CONF['IndexURL'];
- if (!$usePathInfo) {
- if ($data['type'] == 'pageparser') {
- $blogurl .= 'index.php';
- } else {
- $blogurl = $CONF['Self'];
- }
- }
- }
- }
-
- if ($usePathInfo) {
- if (substr($blogurl, -1) == '/') {
- $blogurl = substr($blogurl, 0, -1);
- }
- }
-
- $CONF['BlogURL'] = $blogurl;
- $CONF['ItemURL'] = $blogurl;
- $CONF['CategoryURL'] = $blogurl;
- $CONF['ArchiveURL'] = $blogurl;
- $CONF['ArchiveListURL'] = $blogurl;
- $CONF['SearchURL'] = $blogurl;
-
- $printData = $objectId . "=new dTree('" . $objectId . "');\n"
- . $objectId . ".add(0,-1,'"
- . htmlspecialchars($blogname, ENT_QUOTES, _CHARSET)
- . "');\n";
- echo $printData;
- unset($printData);
-
- $resq = 'SELECT * FROM %s WHERE cblog = %d';
- $res = sql_query(sprintf($resq, sql_table('category'), $blogid));
- $n = 1;
- while ($o = mysql_fetch_object($res)) {
- $catid = intval($o->catid);
- $nodeArray['cat'][$catid] = $n;
- $url = createCategoryLink($catid);
- $printData = $objectId
- . ".add"
- . "("
- . $n . ","
- . "0,"
- . "'" . htmlspecialchars($o->cname, ENT_QUOTES, _CHARSET) . "',"
-// . "'" . htmlspecialchars($url, ENT_QUOTES, _CHARSET) . "',"
- . "'" . $url . "',"
- . "'" . htmlspecialchars($o->cdesc, ENT_QUOTES, _CHARSET). "'"
- . ");\n";
- echo $printData;
- $catFilter[] = $catid;
- $n++;
- unset($printData);
- }
-
- if (!$manager->pluginInstalled('NP_MultipleCategories')) {
- echo 'document.write(' . $objectId . ');';
- if ($itemid = intRequestVar('id')) {
- $que = 'SELECT icat as result FROM %s WHERE inumber = %d';
- $catid = quickQuery(sprintf($que, sql_table('item'), $itemid));
- $catid = intval($catid);
- $nodeId = 's' . $objectId . $nodeArray['cat'][$catid];
- $printData = "document.getElementById('"
- . htmlspecialchars($nodeId, ENT_QUOTES, _CHARSET)
- . "').className = 'selectedNode';";
- echo $printData;
- unset($printData);
- }
- return;
- }
-
-/* if ($catFilter[1]) {
- $catFilter = implode(', ', $catFilter);
- $catFilter = ' IN (' . $catFilter . ')';
- } else {
- $catFilter = ' = ' . $catFilter;
- } //original*/
-
- if (count($catFilter) == 1) {
- $catFilter = ' = ' . $catFilter[0];
- } elseif (count($catFilter) > 1) {
- $catFilter = implode(', ', $catFilter);
- $catFilter = ' IN (' . $catFilter . ')';
- } else {
- $catFilter = '';
- } // test
-
- $scatTable = sql_table('plug_multiple_categories_sub');
- $mcategories =& $manager->getPlugin('NP_MultipleCategories');
- if (method_exists($mcategories, 'getRequestName')) {
- $subrequest = $mcategories->getRequestName();
- } else {
- $subrequest = 'subcatid';
- }
-// $query = 'SELECT * FROM %s WHERE catid%s';
- $query = 'SELECT * FROM %s WHERE catid%s ORDER BY parentid, catid, ordid';
- $query = sprintf($query, $scatTable, $catFilter);
- $res = sql_query($query);
- while ($o = mysql_fetch_object($res)) {
- $scatid = intval($o->scatid);
- $nodeArray['subcat'][$scatid] = $n;
- $n++;
-// }
-
-// $query = 'SELECT * FROM %s WHERE catid%s';
-// $query = sprintf($query, $scatTable, $catFilter);
-// $res = sql_query($query);
-// while ($u = mysql_fetch_object($res)) {
-//$u = $o;
-// $scatid = intval($o->scatid);
- $parent_id = intval($o->parentid);
- $cat_id = intval($o->catid);
- $linkParam = array(
- $subrequest => $scatid
- );
- $url = createCategoryLink($cat_id, $linkParam);
-
- if (!empty($parent_id)) {
- $pnode = intval($nodeArray['subcat'][$parent_id]);
- } else {
- $pnode = intval($nodeArray['cat'][$cat_id]);
- }
- $printData = $objectId
- . ".add"
- . "("
- . intval($nodeArray['subcat'][$scatid]) . ","
- . $pnode . ","
- . "'" . htmlspecialchars($o->sname, ENT_QUOTES, _CHARSET) . "',"
-// . "'" . htmlspecialchars($url, ENT_QUOTES, _CHARSET) . "',"
- . "'" . $url . "',"
- . "'" . htmlspecialchars($o->sdesc, ENT_QUOTES, _CHARSET) . "'"
- . ");\n";
- echo $printData;
- unset($printData);
- }
-
- echo "document.write(" . $objectId . ");\n";
-
- if ($sid = intRequestVar('sid')) {
- $nodeId = 's' . $objectId . intval($nodeArray['subcat'][$sid]);
- $printData = "document.getElementById('" . $nodeId . "')"
- . ".className='urlselected';\n"
- . $objectId
- . ".openTo(" . intval($nodeArray['subcat'][$sid]) . ",true);\n";
- echo $printData;
- unset($printData);
- } elseif ($cid = intRequestVar('cid')) {
- $nodeId = 's' . $objectId . intval($nodeArray['cat'][$cid]);
- $printData = "document.getElementById('" . $nodeId . "')."
- . "className='urlselected';\n"
- . $objectId
- . ".openTo(" . intval($nodeArray['cat'][$cid]) . ",true);\n";
- }
-
- if ($itemid = intRequestVar('id')) {
- $que = 'SELECT icat as result FROM %s WHERE inumber = %d';
- $catid = quickQuery($que, sql_table('item'), $itemid);
- $catid = intval($catid);
- $nodeId = 's' . $objectId . intval($nodeArray['cat'][$catid]);
- $printData = "document.getElementById('" . $nodeId . "')"
- . ".className='selectedNode';\n";
- echo $printData;
- unset($printData);
-
- //multi catid
- $que = 'SELECT categories as result FROM %s WHERE item_id = %d';
- $que = sprintf($que, sql_table('plug_multiple_categories'), $itemid);
- $catids = quickQuery($que);
- if ($catids) {
- $catids = explode(',', $catids);
- $cCount = count($catids);
- for ($i=0; $i < $cCount; $i++) {
- $catidTemp = intval($catids[$i]);
- if ($catidTemp != $catid) {
- $nodeId = 's' . $objectId . intval($nodeArray['cat'][$catidTemp]);
- $prntData = "document.getElementById('" . $nodeId . "')"
- . ".className='selectedCatNode';\n";
- echo $printData;
- unset($printData);
- }
- }
- }
-
- //(multi) subcatid
- $que = 'SELECT subcategories as result FROM %s WHERE item_id = %d';
- $que = sprintf($que, sql_table('plug_multiple_categories'), $itemid);
- $scatids = quickQuery($que);
- if ($scatids) {
- $scatids = explode(',', $scatids);
- $scatCnt = count($scatids);
- for ($i=0; $i < $scatCnt; $i++) {
- $scatid = intval($scatids[$i]);
- $nodeId = 's' . $objectId . intval($nodeArray['subcat'][$scatid]);
- $printData = "document.getElementById('" . $nodeId . "')"
- . ".className='selectedScatNode';\n"
- . $objectId
- . ".openTo(" . intval($nodeArray['subcat'][$scatid]) . ",true);\n";
- echo $printData;
- unset($printData);
- }
- }
- }
+++ /dev/null
- d = new dTree('d');
-
-<?php
- $strRel = '../../../';
- include($strRel . 'config.php');
-
- $blogid = requestVar('bid');
- $blogname = getBlogNameFromID($blogid);
- echo "d.add(0,-1,'".$blogname."');\n";
-
- $res = sql_query("SELECT * FROM ".sql_table('category')." WHERE cblog= ".$blogid);
- $n = 1;
- while($o = mysql_fetch_object($res)){
- $catid = $o->catid;
- $nodeArray[cat][$catid] = $n;
- $url = createBlogidLink($blogid, array('catid'=>$catid));
- echo "d.add(".$n.",0,'".$o->cname."','".$url."');\n";
- $catFilter[] = $catid;
- $n++;
- }
-
- global $manager;
- if (!$manager->pluginInstalled('NP_MultipleCategories')){
- echo 'document.write(d);';
- return;
- }
-
- if($catFilter[1]){
- $catFilter = @join(',',$catFilter);
- $catFilter = ' IN ('.$catFilter.')';
- }else{
- $catFilter = '='.$catFilter;
- }
-
- $query = "SELECT * FROM ".sql_table('plug_multiple_categories_sub')." WHERE catid".$catFilter;
- $res = sql_query($query);
- while($o = mysql_fetch_object($res)){
- $scatid = $o->scatid;
- $nodeArray[subcat][$scatid] = $n;
- $n++;
- }
- $query = "SELECT * FROM ".sql_table('plug_multiple_categories_sub')." WHERE catid".$catFilter;
- $res = sql_query($query);
- while($u = mysql_fetch_object($res)){
- $scatid = $u->scatid;
- $url = createBlogidLink($blogid, array('catid'=>$u->catid, 'subcatid'=>$scatid));
- $pnode = ($u->parentid)? $nodeArray[subcat][$u->parentid]: $nodeArray[cat][$u->catid];
- echo "d.add(".$nodeArray[subcat][$u->scatid].",".$pnode.",'".$u->sname."','".$url."');\n";
- }
-
-?>
-
- document.write(d);
- d.openTo(7, true);
- document.getElementById('sd7').className = 'selectedNode';
- d.openTo(15, true);
- document.getElementById('sd15').className = 'selectedNode';
+++ /dev/null
-<?php
- define('_DTREE_DESCRIPTION', 'Show Navigation Tree. Usage: <%Dtree()%>');
- define('_DTREE_DIR_LINK', 'Should folders be links.');
- define('_DTREE_SELECTION', 'Nodes can be selected(highlighted).');
- define('_DTREE_COOKIE', 'The tree uses cookies to rember it\'s state.');
- define('_DTREE_LINE', 'Tree is drawn with lines.');
- define('_DTREE_ICON', 'Tree is drawn with icons.');
- define('_DTREE_ST_TEXT', 'Displays node names in the statusbar instead of the url.');
- define('_DTREE_CL_SLEVEL', 'Only one node within a parent can be expanded at the same time. [Open All] and [Close All] functions do not work when this is enabled.');
- define('_DTREE_IN_ORDER', 'If parent nodes are always added before children, setting this to true speeds up the tree.');
- define('_DTREE_OPENALL', 'Open All');
- define('_DTREE_CLOSEALL', 'Close All');
-?>
\ No newline at end of file
+++ /dev/null
-<?php
- define('_DTREE_DESCRIPTION', '¥Ä¥ê¡¼É½¼¨¤Î¥«¥Æ¥´¥ê¡¦¥µ¥Ö¥«¥Æ¥´¥ê¥á¥Ë¥å¡¼<br />¥¹¥¥ó¡¢¤Þ¤¿¤Ï¥Æ¥ó¥×¥ì¡¼¥È¤Ë[<%Dtree()%>]¤Èµ½Ò');
- define('_DTREE_DIR_LINK', '¥Õ¥©¥ë¥À¡¼¤Î¥ê¥ó¥¯¤ò͸ú¤Ë¤·¤Þ¤¹¤«¡©');
- define('_DTREE_SELECTION', 'ÁªÂòÃæ¤Î¥«¥Æ¥´¥ê¡¦¥µ¥Ö¥«¥Æ¥´¥ê¤ò¥Ï¥¤¥é¥¤¥È¤·¤Þ¤¹¤«¡©');
- define('_DTREE_COOKIE', '¥¯¥Ã¥¡¼¤ò»ÈÍѤ·¤Æ¥Ä¥ê¡¼¤Î¾õÂÖ¤òÊݸ¤·¤Þ¤¹¤«¡©');
- define('_DTREE_LINE', '¥Ä¥ê¡¼¤Î¥é¥¤¥ó¤òɽ¼¨¤·¤Þ¤¹¤«¡©');
- define('_DTREE_ICON', '¥¢¥¤¥³¥ó¤ò»ÈÍѤ·¤Þ¤¹¤«¡©');
- define('_DTREE_ST_TEXT', 'URL¤ÎÂå¤ï¤ê¤Ë¥«¥Æ¥´¥ê¡¦¥µ¥Ö¥«¥Æ¥´¥ê̾¤ò¥¹¥Æ¡¼¥¿¥¹¥Ð¡¼¤Ëɽ¼¨¤·¤Þ¤¹¤«¡©');
- define('_DTREE_CL_SLEVEL', 'Æó¤Ä°Ê¾å¤Î»Þ¤òƱ»þ¤ËŸ³«¤·¤Ê¤¤¤è¤¦¤Ë¤·¤Þ¤¹¤«¡©(\8e¢Á´¤Æ³«¤¯\8e£\8e¢Á´¤ÆÊĤ¸¤ë\8e£¤Ï¤³¤ÎÀßÄê¤Ë±Æ¶Á¤µ¤ì¤Þ¤»¤ó)');
- define('_DTREE_IN_ORDER', 'If parent nodes are always added before children, setting this to true speeds up the tree.');
- define('_DTREE_OPENALL', 'Á´¤Æ³«¤¯');
- define('_DTREE_CLOSEALL', 'Á´¤ÆÊĤ¸¤ë');
-?>
\ No newline at end of file
+++ /dev/null
-<?php
- define('_DTREE_DESCRIPTION', 'ツリー表示のカテゴリ・サブカテゴリメニュー<br />スキン、またはテンプレートに[<%Dtree()%>]と記述');
- define('_DTREE_DIR_LINK', 'フォルダーのリンクを有効にしますか?');
- define('_DTREE_SELECTION', '選択中のカテゴリ・サブカテゴリをハイライトしますか?');
- define('_DTREE_COOKIE', 'クッキーを使用してツリーの状態を保存しますか?');
- define('_DTREE_LINE', 'ツリーのラインを表示しますか?');
- define('_DTREE_ICON', 'アイコンを使用しますか?');
- define('_DTREE_ST_TEXT', 'URLの代わりにカテゴリ・サブカテゴリ名をステータスバーに表示しますか?');
- define('_DTREE_CL_SLEVEL', '二つ以上の枝を同時に展開しないようにしますか?(「全て開く」「全て閉じる」はこの設定に影響されません)');
- define('_DTREE_IN_ORDER', 'If parent nodes are always added before children, setting this to true speeds up the tree.');
- define('_DTREE_OPENALL', '全て開く');
- define('_DTREE_CLOSEALL', '全て閉じる');
-?>
\ No newline at end of file
+++ /dev/null
-<?php\r
-/**\r
- * SHOW Comment Form/List PLUG-IN FOR NucleusCMS\r
- * PHP versions 5\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- *\r
- * @author shizuki\r
- * @copyright 2008 shizuki\r
- * @license http://www.gnu.org/licenses/gpl.txt GNU GENERAL PUBLIC LICENSE Version 2, June 1991\r
- * @version $Date: 2008-07-11 06:36:17 $ $Revision: 1.13 $\r
- * @link http://japan.nucleuscms.org/wiki/plugins:ezcomment2\r
- * @since File available since Release 1.0\r
- */\r
-\r
-/**\r
- * version history\r
- *\r
- * $Log: not supported by cvs2svn $\r
- * Revision 1.12 2008/07/09 03:54:07 shizuki\r
- * *** empty log message ***\r
- *\r
- * Revision 1.11 2008/07/09 03:54:04 shizuki\r
- * *Fix header info URL:showblogs -> ezcomment2\r
- *\r
- * * Revision 1.10 2008/07/08 16:14:57 shizuki\r
- * *Bug fix event_PreComment\r
- * *Correspondence preparations of NP_LatestWritebacks\r
- *\r
- * Revision 1.9 2008/07/08 15:14:27 shizuki\r
- * * Corresponds to event_PreComment.\r
- * * Fix typo.\r
- * * RC2\r
- *\r
- * Revision 1.8 2008/07/07 15:42:54 shizuki\r
- * * The experimental society PHP Version: 5.2.6/MySQL Server Version (client): (5.1.25-rc-log 5.1.25-rc).\r
- * * The normal movement is confirmed.\r
- * * The SQL correction/behavior when installing, is changed a little.\r
- * * event_PostDeleteCommnent addition * It's corrected when being off login time and secret mode-lessly, so as not to take out a check box.\r
- * * NP_OpenId is indispensable in the present.\r
- * * NP_znSpecialTemplateParts is indispensable.\r
- * * It's expected to add the setting which will establish a password at the time of contribution without NP_OpenId and make it hidden from now on.\r
- * * It's RC edition, so please cooperate in the one with the environment.\r
- *\r
- * Revision 1.7 2008/07/07 10:24:00 shizuki\r
- * * Still, the human sacrifice test version.\r
- * * A template was separated for for index pages and item page.\r
- * * Subdivision of the showComment() function.\r
- * * It's changed so as not to fly to an indication part for indication in case of and OpenID of anything but the first item of an index page.\r
- * * A profile change part besides the first item of an index page is being adjusted.\r
- */\r
-\r
-class NP_EzComment2 extends NucleusPlugin\r
-{\r
- // {{{ properties\r
-\r
- /**\r
- * The calling number of times by the index page.\r
- *\r
- * @var integer\r
- */\r
- var $numcalled;\r
-\r
- /**\r
- * OpenID authentication module.\r
- *\r
- * @var object\r
- */\r
- var $authOpenID;\r
-\r
- /**\r
- * Flag of the case that one is invoker.\r
- *\r
- * @var boolean\r
- */\r
- var $callFlg;\r
-\r
- // }}}\r
- // {{{ getName()\r
-\r
- /**\r
- * Plugin Name\r
- *\r
- * @return string\r
- */\r
- function getName()\r
- {\r
- return 'Ez Comment II';\r
- }\r
-\r
- // }}}\r
- // {{{ getAuthor()\r
-\r
- /**\r
- * Author Name\r
- *\r
- * @return string\r
- */\r
- function getAuthor()\r
- {\r
- return 'shizuki';\r
- }\r
-\r
- // }}}\r
- // {{{ getURL()\r
-\r
- /**\r
- * I get a plug-in, the address of the possible site or author's mail address.\r
- *\r
- * @return string\r
- */\r
- function getURL()\r
- {\r
- return 'http://japan.nucleuscms.org/wiki/plugins:ezcomment2';\r
- }\r
-\r
- // }}}\r
- // {{{ getPluginDep()\r
-\r
- /**\r
- * Plugin Dependency.\r
- *\r
- * @return array\r
- */\r
- function getPluginDep()\r
- {\r
- return array(\r
- 'NP_OpenId',\r
- 'NP_znSpecialTemplateParts',\r
- );\r
- }\r
-\r
- // }}}\r
- // {{{ getVersion()\r
-\r
- /**\r
- * Plugin Version.\r
- *\r
- * @return string\r
- */\r
- function getVersion()\r
- {\r
- return '$Date: 2008-07-11 06:36:17 $ $Revision: 1.13 $';\r
- }\r
-\r
- // }}}\r
- // {{{ getDescription()\r
-\r
- /**\r
- * Plugin Description\r
- *\r
- * @return string\r
- */\r
- function getDescription()\r
- {\r
- return _NP_EZCOMMENT2_DESC;\r
- }\r
-\r
- // }}}\r
- // {{{ supportsFeature($what)\r
-\r
- /**\r
- * Supports Nucleus Feature\r
- *\r
- * @param string\r
- * @return boolean\r
- */\r
- function supportsFeature($what)\r
- {\r
- switch ($what) {\r
- case 'SqlTablePrefix':\r
- return 1;\r
- default:\r
- return 0;\r
- }\r
- }\r
-\r
- // }}}\r
- // {{{ getEventList()\r
-\r
- /**\r
- * List of feature event\r
- *\r
- * @return array\r
- */\r
- function getEventList()\r
- {\r
- global $manager;\r
- return array(\r
- 'FormExtra',\r
- 'PostAddComment',\r
- 'PostDeleteComment',\r
- 'PreComment',\r
- );\r
- }\r
-\r
- // }}}\r
- // {{{ getTableList()\r
-\r
- /**\r
- * Database tables for plugin used\r
- *\r
- * @return array\r
- **/\r
- function getTableList()\r
- {\r
- return array(\r
- sql_table('plug_ezcomment2'),\r
- );\r
- }\r
-\r
- // }}}\r
- // {{{ install()\r
-\r
- /**\r
- * Install function\r
- *\r
- * @return void.\r
- */\r
- function install()\r
- {\r
- if (!TEMPLATE::exists('EzCommentTemplate')) {\r
- global $DIR_LIBS;\r
- include_once($DIR_LIBS . 'skinie.php');\r
- $importer = new SKINIMPORT();\r
- $importer->reset();\r
- $template = $this->getDirectory() . 'skinbackup.xml';\r
- if (!@file_exists($template)) {\r
- $aErrors[] = 'Unable to import ' . $template . ' : file does not exist';\r
- continue;\r
- }\r
- $error = $importer->readFile($template);\r
- if ($error) {\r
- $aErrors[] = 'Unable to import ' . $template . ' : ' . $error;\r
- continue;\r
- }\r
- $error = $importer->writeToDatabase(1);\r
- if ($error) {\r
- $aErrors[] = 'Unable to import ' . $template . ' : ' . $error;\r
- continue;\r
- }\r
- if ($aErrors) {\r
- $message = implode("<br />\n", $aErrors);\r
- doError($message);\r
- }\r
- }\r
- $this->createBlogOption('secret', _NP_EZCOMMENT2_OP_SECRETMODE, 'yesno', 'yes');\r
- $this->createBlogOption('secComment', _NP_EZCOMMENT2_OP_SUBSTIUTION, 'text', _NP_EZCOMMENT2_OP_SUBSTIUTION_VAL);\r
- $this->createBlogOption('secLabel', _NP_EZCOMMENT2_OP_CHECKLABEL, 'text', _NP_EZCOMMENT2_OP_CHECKLABEL_VAL);\r
- $this->createOption('tabledel', _NP_EZCOMMENT2_OP_DROPTABLE, 'yesno', 'yes');\r
- $sql = 'CREATE TABLE IF NOT EXISTS %s ('\r
- . '`comid` int(11) NOT NULL, '\r
- . '`secflg` tinyint(1) NULL, '\r
- . '`module` varchar(15) NULL, '\r
- . '`userID` varchar(255) NULL, '\r
- . 'PRIMARY KEY(`comid`) );';\r
- sql_query(sprintf($sql, sql_table('plug_ezcomment2')));\r
- $this->updateTable();\r
- }\r
-\r
- // }}}\r
- // {{{ uninstall()\r
-\r
- /**\r
- * Un Install function\r
- *\r
- * @return void.\r
- */\r
- function uninstall()\r
- {\r
- if ($this->getOption('tabledel') == 'yes')\r
- sql_query('DROP TABLE '.sql_table('plug_ezcomment2'));\r
- }\r
-\r
- // }}}\r
- // {{{ init()\r
-\r
- /**\r
- * Initialize\r
- *\r
- * @return void.\r
- */\r
- function init()\r
- {\r
- $this->languageInclude();\r
- $this->numcalled = 0;\r
- $this->callFlg = false;\r
- global $manager;\r
- if ($manager->pluginInstalled('NP_OpenId') && !$this->authOpenID) {\r
- $this->authOpenID = $manager->getPlugin('NP_OpenId');\r
- }\r
- }\r
-\r
- // }}}\r
- // {{{ event_PostAddComment($data)\r
-\r
- /**\r
- * After adding a comment to the database.\r
- *\r
- * @param array\r
- * commentid integer\r
- * comment array\r
- * spamcheck array\r
- * @return void.\r
- */\r
- function event_PostAddComment($data)\r
- {\r
- global $member;\r
- switch (true) {\r
- case $member->isLoggedin():\r
- $userID = '"' . $member->getID() . '"';\r
- $module = '"Nucleus"';\r
- break;\r
- case ($this->authOpenID && $this->authOpenID->isLoggedin()):\r
- $userID = '"' . $this->authOpenID->loggedinUser['identity'] . '"';\r
- $module = '"OpenID"';\r
- break;\r
- default:\r
- $userID = 'NULL';\r
- $module = 'NULL';\r
- break;\r
- }\r
- if (postVar('EzComment2_Secret')) {\r
- $secCheck = 1;\r
- } else {\r
- $secCheck = 'NULL';\r
- }\r
- $sql = 'INSERT INTO ' . sql_table('plug_ezcomment2')\r
- . ' (`comid`, `secflg`, `module`, `userID`) VALUES (%d, %d, %s, %s)';\r
- sql_query(sprintf($sql, $data['commentid'], $secCheck, $module, $userID));\r
- }\r
-\r
- // }}}\r
- // {{{ event_PostDeleteComment($data)\r
-\r
- /**\r
- * After a comment has been deleted from the database.\r
- *\r
- * @param array\r
- * commentid integer\r
- * @return void.\r
- */\r
- function event_PostDeleteComment($data)\r
- {\r
- $sql = 'DELETE FROM ' . sql_table('plug_ezcomment2')\r
- . ' WHERE `comid` = %d LIMIT 1';\r
- sql_query(sprintf($sql, $data['commentid']));\r
- }\r
-\r
- // }}}\r
- // {{{ event_FormExtra(&$data)\r
-\r
- /**\r
- * Inside one of the comment, membermail or account activation forms.\r
- *\r
- * @param array\r
- * type string\r
- * @return void.\r
- */\r
- function event_FormExtra(&$data)\r
- {\r
- global $member, $blogid;\r
- $this->numcalled++;\r
- if ($blogid && $this->getBlogOption($blogid, 'secret') == 'yes' &&\r
- ($member->isLoggedin() || ($this->authOpenID && $this->authOpenID->isLoggedin()))) {\r
- echo '<br /><input type="checkbox" value="1" name="EzComment2_Secret" id="EzComment2_Secret_' . $this->numcalled . '" />';\r
- echo '<label for="EzComment2_Secret_' . $this->numcalled . '">'.$this->getBlogOption($bid, 'secLabel').'</label><br />';\r
- }\r
- if ($this->authOpenID) {\r
- $this->plugOpenIDdoSkinVar($this->commentSkinType, $this->commentItemId);\r
- }\r
- }\r
-\r
- // }}}\r
- // {{{ event_PreComment(&$data)\r
-\r
- /**\r
- * Inside one of the comment, membermail or account activation forms.\r
- *\r
- * @param array\r
- * comment array\r
- * @return void.\r
- */\r
- function event_PreComment(&$data)\r
- {\r
- if ($this->callFlg) return;\r
- $sql = 'SELECT secflg, userID FROM ' . sql_table('plug_ezcomment2')\r
- . ' WHERE comid = ' . intval($data['comment']['commentid']);\r
- $res = sql_query($sql);\r
- $flg = mysql_fetch_assoc($res);\r
- if (!$flg['secflg']) return;\r
- $data['comment']['identity'] = $flg['userID'];\r
- global $manager, $member;\r
- $bid = intval($data['comment']['blogid']);\r
- $b = $manager->getBlog($bid);\r
- $judge = $this->setSecretJudge($bid, $member, $b);\r
- $data['comment'] = $this->JudgementCommentSecrets($data['comment'], $judge);\r
-// print_r($data);\r
- }\r
-\r
- // }}}\r
- // {{{ doTemplateVar()\r
-\r
- /**\r
- * Basically the same as doSkinVar,\r
- * but this time for calls of the <%plugin(...)%>-var in templates (item header/body/footer and dateheader/footer).\r
- *\r
- * @param object item object(refarence)\r
- * @param string\r
- * @param string\r
- * @param string\r
- * @param string\r
- * @param string\r
- * @return void.\r
- */\r
- function doTemplateVar(&$item,\r
- $showType = '',\r
- $showMode = '5/1/1',\r
- $destinationurl = '',\r
- $formTemplate = 'EzCommentTemplate',\r
- $listTemplate = 'EzCommentTemplate')\r
- {\r
- $this->doSkinVar('template', $showType, $showMode, $destinationurl, $formTemplate, $listTemplate, $item);\r
- }\r
-\r
- // }}}\r
- // {{{ doSkinVar()\r
-\r
- /**\r
- * When plugins are called using the <%plugin(...)%>-skinvar, this method will be called. \r
- *\r
- * @param string\r
- * @param string\r
- * @param string\r
- * @param string\r
- * @param string\r
- * @param string\r
- * @param object item object(refarence)\r
- * @return void.\r
- */\r
- function doSkinVar($skinType,\r
- $showType = '',\r
- $showMode = '5/1/1',\r
- $destinationurl = '',\r
- $formTemplate = 'EzCommentTemplate',\r
- $listTemplate = 'EzCommentTemplate',\r
- &$commentItem = '')\r
- {\r
- if ($skinType != 'item' && $skinType != 'template') return;\r
- global $manager, $member, $itemid;\r
- if (!$commentItem && $itemid) {\r
- $commentItem = $manager->getItem($itemid, 0, 0);\r
- if (is_array($commentItem)) {\r
- $commentItem = (object)$commentItem;\r
- }\r
- }\r
- if (!$commentItem || $commentItem->closed) {\r
- echo _ERROR_ITEMCLOSED;\r
- return 0;\r
- }\r
-\r
- if (is_numeric($showType) || strpos($showType, '/') !== false) $showMode = $showType;\r
- if ($showType != 'list' && $showType != 'form') {\r
- $showType = '';\r
- }\r
- if (!$showMode) {\r
- $showMode = '5/1/1';\r
- }\r
- list($maxToShow, $sortOrder, $commentOrder) = explode('/', $showMode);\r
- if (!$maxToShow) $maxToShow = 5;\r
- if (!$sortOrder) $sortOrder = 1;\r
- if ($commentOrder > 0) {\r
- $commentOrder = true;\r
- } else {\r
- $commentOrder = false;\r
- }\r
- if (!$formTemplate) $formTemplate = 'EzCommentTemplate';\r
- if (!$listTemplate) $listTemplate = 'EzCommentTemplate';\r
-\r
- switch ($showType) {\r
- case 'list':\r
- $listTemplate = TEMPLATE::read($listTemplate);\r
- $this->showComment($commentItem, $listTemplate, $maxToShow, $commentOrder, $skinType);\r
- break;\r
- case 'form':\r
- $formTemplate = TEMPLATE::read($formTemplate);\r
- $this->showForm($commentItem, $formTemplate, $destinationurl, $skinType);\r
- break;\r
- default:\r
- $listTemplate = TEMPLATE::read($listTemplate);\r
- $formTemplate = TEMPLATE::read($formTemplate);\r
- if ($sortOrder) {\r
- $this->showComment($commentItem, $listTemplate, $maxToShow, $commentOrder, $skinType);\r
- $this->showForm($commentItem, $formTemplate, $destinationurl, $skinType);\r
- } else {\r
- $this->showForm($commentItem, $formTemplate, $destinationurl, $skinType);\r
- $this->showComment($commentItem, $listTemplate, $maxToShow, $commentOrder, $skinType);\r
- }\r
- break;\r
- }\r
- }\r
-\r
- // }}}\r
- // {{{ languageInclude()\r
-\r
- /**\r
- * Include language file\r
- *\r
- * @return void.\r
- */\r
- function languageInclude()\r
- {\r
- $language = ereg_replace( '[\\|/]', '', getLanguageName());\r
- if (file_exists($this->getDirectory() . 'language/' . $language . '.php')) {\r
- include_once($this->getDirectory() . 'language/' . $language . '.php');\r
- } else {\r
- include_once($this->getDirectory() . 'language/english.php');\r
- }\r
- }\r
-\r
- // }}}\r
- // {{{ updateTable()\r
-\r
- /**\r
- * Update database table\r
- *\r
- * @return void.\r
- */\r
- function updateTable()\r
- {\r
- $sql = 'SELECT c.cnumber as cid FROM ' . sql_table('comment') . ' as c '\r
- . 'LEFT JOIN ' . sql_table('plug_ezcomment2') . ' as s '\r
- . 'ON c.cnumber=s.comid WHERE s.comid IS NULL';\r
- $res = sql_query($sql);\r
- $sql = 'INSERT INTO ' . sql_table('plug_ezcomment2') . '(`comid`) VALUES (%d)';\r
- while ($cid = mysql_fetch_assoc($res)) {\r
- sql_query(sprintf($sql, $cid['cid']));\r
- }\r
- }\r
-\r
- // }}}\r
- // {{{ plugOpenIDdoSkinVar()\r
-\r
- /**\r
- * Overwride NP_OpenId's doSkinVar()\r
- * \r
- * @param string\r
- * @param integer\r
- * @return void.\r
- */\r
- function plugOpenIDdoSkinVar($skinType, $iid = 0)\r
- {\r
- global $CONF, $manager, $member;\r
- if ($member->isLoggedIn()) return;\r
- $authOpenID = $this->authOpenID;\r
- if (!$authOpenID) return;\r
- $externalauth = array ( 'source' => $authOpenID->getName() );\r
- $manager->notify('ExternalAuth', array ('externalauth' => &$externalauth));\r
- if (isset($externalauth['result']) && $externalauth['result'] == true) return;\r
- $templateEngine = $authOpenID->_getTemplateEngine();\r
- $aVars = array();\r
- $aVars['PluginURL'] = $CONF['PluginURL'];\r
- if ($authOpenID->isLoggedin()) {\r
- // Loggedin\r
- if ($skinType == 'template') {\r
- require_once 'cles/Template.php';\r
- $templateDirectory = rtrim($this->getDirectory(), '/');\r
- $templateEngine =& new cles_Template($templateDirectory);\r
- $templateEngine->defaultLang = 'english';\r
- $aVars['itemid'] = intval($iid);\r
- }\r
- $nowURL = 'http://' . serverVar("HTTP_HOST")\r
- . serverVar("REQUEST_URI");\r
- $aVars['url'] = $authOpenID->getAdminURL() . 'rd.php?action=rd'\r
- . '&url=' . urlencode($nowURL);\r
- $aVars['nick'] = $authOpenID->loggedinUser['nick'];\r
- $aVars['email'] = $authOpenID->loggedinUser['email'];\r
- $aVars['ts'] = $authOpenID->loggedinUser['ts'];\r
- $aVars['identity'] = $authOpenID->loggedinUser['identity'];\r
- $aVars['visible'] = $aVars['nick'] ? 'false' : 'true' ;\r
- $actionUrl = parse_url($CONF['ActionURL']);\r
- $aVars['updateUrl'] = $actionUrl['path'];\r
- if ($skinType == 'item' || ($skinType == 'template' && $this->numcalled == 0)) {\r
- echo $templateEngine->fetchAndFill('yui', $aVars, 'np_openid');\r
- echo $templateEngine->fetchAndFill('form', $aVars, 'np_openid');\r
- }\r
- echo $templateEngine->fetchAndFill('loggedin', $aVars, 'np_openid');\r
- } elseif (!$authOpenID->isLoggedin()) {\r
- // Not loggedin\r
- $aVars['url'] = $authOpenID->getAdminURL() . 'rd.php?action=doauth'\r
- . '&return_url=' . urlencode(createItemLink(intval($iid)));\r
- echo $templateEngine->fetchAndFill('notloggedin', $aVars, 'np_openid');\r
- }\r
- }\r
-\r
- // }}}\r
- // {{{ checkDestinationurl($destinationurl)\r
-\r
- /**\r
- * Destinationurl check\r
- *\r
- * @param string\r
- * @return string\r
- */\r
- function checkDestinationurl($destinationurl, $iid, $cid = 0, $scid = 0)\r
- {\r
- if (stristr($destinationurl, 'action.php') || empty($destinationurl)) {\r
- if (stristr($destinationurl, 'action.php')) {\r
- $logMessage = 'actionurl is not longer a parameter on commentform skinvars.'\r
- . ' Moved to be a global setting instead.';\r
- ACTIONLOG::add(WARNING, $logMessage);\r
- }\r
- if ($cid) {\r
- $linkparams['catid'] = intval($cid);\r
- }\r
- global $manager;\r
- if ($manager->pluginInstalled('NP_MultipleCategories') && $scid) {\r
- $linkparams['subcatid'] = intval($scid);\r
- }\r
- $destinationurl = createItemLink(intval($iid), $linkparams);\r
- } else {\r
- $destinationurl = preg_replace('|[^a-z0-9-~+_.?#=&;,/:@%]|i', '', $destinationurl);\r
- }\r
- return $destinationurl;\r
- }\r
-\r
- // }}}\r
- // {{{ getCommentatorInfo()\r
-\r
- /**\r
- * Get commentator info.\r
- *\r
- * @return array\r
- */\r
- function getCommentatorInfo()\r
- {\r
- global $CONF;\r
- $user = cookieVar($CONF['CookiePrefix'] .'comment_user');\r
- if (!$user) {\r
- $user = postVar('user');\r
- }\r
- $userid = cookieVar($CONF['CookiePrefix'] .'comment_userid');\r
- if (!$userid) {\r
- $userid = postVar('userid');\r
- }\r
- $email = cookieVar($CONF['CookiePrefix'] .'comment_email');\r
- if (!$email) {\r
- $email = postVar('email');\r
- }\r
- $body = postVar('body');\r
- return array(\r
- $user,\r
- $userid,\r
- $email,\r
- $body\r
- );\r
- }\r
- // {{{ showForm()\r
-\r
- /**\r
- * Show comment form\r
- *\r
- * @param object\r
- * @param string\r
- * @param string\r
- * @param string\r
- * @return void.\r
- */\r
- function showForm($commentItem, $template, $destinationurl, $skinType)\r
- {\r
- global $CONF, $manager, $member, $catid, $subcatid;\r
- $bid = getBlogIDFromItemID($commentItem->itemid);\r
- $b =& $manager->getBlog($bid);\r
- $b->readSettings();\r
- if (!$member->isLoggedIn() && !$b->commentsEnabled()) {\r
- return;\r
- }\r
- $destinationurl = $this->checkDestinationurl($destinationurl, $commentItem->itemid, $catid, $subcatid);\r
- list($user, $userid, $email, $body) = $this->getCommentatorInfo();\r
-\r
- $checked = cookieVar($CONF['CookiePrefix'] .'comment_user') ? 'checked="checked" ' : '';\r
-\r
- $formdata = array(\r
- 'self' => $this->_hsc(serverVar('REQUEST_URI')),\r
- 'destinationurl' => $this->_hsc($destinationurl),\r
- 'actionurl' => $this->_hsc($CONF['ActionURL']),\r
- 'itemid' => intval($commentItem->itemid),\r
- 'user' => $this->_hsc($user),\r
- 'userid' => $this->_hsc($userid),\r
- 'email' => $this->_hsc($email),\r
- 'body' => $this->_hsc($body),\r
-// 'membername' => $this->_hsc($membername),\r
- 'rememberchecked' => $checked\r
- );\r
- if ($skinType == 'item') {\r
- $formFlg = '_ITM';\r
- } else {\r
- $formFlg = '_IDX';\r
- }\r
- if ($member && $member->isLoggedIn()) {\r
- $formType = 'FORM_LOGGEDIN' . $formFlg;\r
- $loginMember = $member->createFromID($member->getID());\r
- $formdata['membername'] = $this->_hsc($loginMember->getDisplayName());\r
- } else {\r
- $formType = 'FORM_NOTLOGGEDIN' . $formFlg;\r
- }\r
- if ($this->authOpenID && ($skinType == 'item' || $this->numcalled == 0)) {\r
- $this->plugOpenIDdoSkinVar($skinType, intval($commentItem->itemid));\r
- }\r
- $this->commentItemId = intval($commentItem->itemid);\r
- $this->commentSkinType = $skinType;\r
- $contents = $template[$formType];\r
- include_once($this->getDirectory() . 'EzCommentActions.php');\r
- $formAction =& new EzCommentFormActions($commentItem, $formdata, $loginMember);\r
- $parser =& new PARSER($formAction->getAllowedActions(), $formAction);\r
- $parser->parse(&$contents);\r
- }\r
-\r
- // }}}\r
- // {{{ showComment()\r
-\r
- /**\r
- * Show comments\r
- *\r
- * @param object\r
- * @param string\r
- * @param string\r
- * @param string\r
- * @param string\r
- * @return void.\r
- */\r
- function showComment($commentItem, $template, $maxToShow, $commentOrder, $skinType)\r
- {\r
- global $manager, $member;\r
- $bid = getBlogIDFromItemID($commentItem->itemid);\r
- $b =& $manager->getBlog($bid);\r
- if (!$b->commentsEnabled()) return;\r
- if (!$maxToShow) {\r
- $maxToShow = $b->getMaxComments();\r
- }\r
- $itemActions =& new ITEMACTIONS($b);\r
- $itemActions->setCurrentItem($commentItem);\r
- $commentObj =& new COMMENTS($commentItem->itemid);\r
- $commentObj->setItemActions($itemActions);\r
- $commentObj->commentcount = $commentObj->amountComments();\r
- // create parser object & action handler\r
- include_once($this->getDirectory() . 'EzCommentActions.php');\r
- $actions =& new EzCommentActions($commentObj);\r
- $parser =& new PARSER($actions->getAllowedActions(), $actions);\r
- $actions->setTemplate($template);\r
- $actions->setParser($parser);\r
- if ($commentObj->commentcount == 0) {\r
- $parser->parse($template['COMMENTS_NONE']);\r
- return 0;\r
- }\r
- $actions->setPostnum($commentObj->commentcount);\r
- if ($maxToShow && $maxToShow < $commentObj->commentcount && $commentOrder) {\r
- $startnum = $commentObj->commentcount - $maxToShow;\r
- } else {\r
- $startnum = 0;\r
- }\r
- $comments = $this->getComments($commentOrder, intval($commentItem->itemid), $maxToShow, $startnum);\r
- $viewnum = mysql_num_rows($comments);\r
- $actions->setViewnum($viewnum);\r
- if ($this->getBlogOption($bid, 'secret') == 'yes') {\r
- $judge = $this->setSecretJudge($bid, $member, $b);\r
- }\r
-\r
- $templateType = '';\r
- if ($skinType == 'template') $templateType = '_IDX';\r
- $blogURL = $b->getURL();\r
- $substitution = $this->getBlogOption($bid, 'secComment');\r
- $this->callFlg = true;\r
- $parser->parse($template['COMMENTS_HEADER' . $templateType]);\r
-\r
- while ($comment = mysql_fetch_assoc($comments)) {\r
- $comment['timestamp'] = strtotime($comment['ctime']);\r
- if ($judge && $comment['secret']) {\r
- $comment = $this->JudgementCommentSecrets($comment, $judge);\r
- }\r
- $actions->setCurrentComment($comment);\r
- $manager->notify('PreComment', array('comment' => &$comment));\r
- $parser->parse($template['COMMENTS_BODY' . $templateType]);\r
- $manager->notify('PostComment', array('comment' => &$comment));\r
- }\r
-\r
- $parser->parse($template['COMMENTS_FOOTER' . $templateType]);\r
-\r
- mysql_free_result($comments);\r
-\r
- }\r
-\r
- // }}}\r
- // {{{ setSecretJudge($bid)\r
-\r
- /**\r
- * Setting for judgment of whether it's a comment of a secret.\r
- *\r
- * @param intgre\r
- * @param object\r
- * @param object\r
- * @return array\r
- */\r
- function setSecretJudge($bid, $member, $b)\r
- {\r
- $memberLoggedin = $member->isLoggedin();\r
- $loginUser = $member->getID();\r
- $blogAdmin = $member->blogAdminRights($bid);\r
- $blogURL = $b->getURL();\r
- $substitution = $this->getBlogOption($bid, 'secComment');\r
- if ($this->authOpenID) {\r
- $openIDLoggedin = $this->authOpenID->isLoggedin();\r
- $openIDUser = $this->authOpenID->loggedinUser['identity'];\r
- }\r
- return array(\r
- 'memberLoggedin' => $memberLoggedin,\r
- 'loginUser' => $loginUser,\r
- 'blogAdmin' => $blogAdmin,\r
- 'blogURL' => $blogURL,\r
- 'substitution' => $substitution,\r
- 'openIDLoggedin' => $openIDLoggedin,\r
- 'openIDUser' => $openIDUser,\r
- );\r
- }\r
-\r
- // }}}\r
- // {{{ JudgementCommentSecrets($comment, $judge)\r
-\r
- /**\r
- * Comment is secret ?\r
- *\r
- * @param array\r
- * @param array\r
- * @param string\r
- * @param string\r
- * @return array\r
- */\r
- function JudgementCommentSecrets($comment, $judge)\r
- {\r
-/* if ($judge['memberLoggedin']) {\r
- echo 'member';\r
- if ($judge['loginUser'] == intval($comment['identity'])) {\r
- echo 'commentator';\r
- } elseif ($judge['blogAdmin']) {\r
- echo 'admin';\r
- }\r
- } elseif ($judge['openIDLoggedin']) {\r
-// echo 'openid / ';\r
- echo $judge['openIDUser'].' / ';\r
- echo $comment['identity'].' / ';\r
- echo "honnnin";\r
- }*/\r
- if (!(($judge['memberLoggedin'] && ($judge['loginUser'] == intval($comment['identity']) || $judge['blogAdmin'])) ||\r
- ($judge['openIDLoggedin'] && $judge['openIDUser'] == $comment['identity']))) {\r
- $this->changeCommentSet($comment, $judge);\r
- }\r
- return $comment;\r
- }\r
-\r
- // }}}\r
- // {{{ changeCommentSet($comment, $blogURL, $substitution)\r
-\r
- /**\r
- * Change secret comment contents\r
- *\r
- * @param array\r
- * @param string\r
- * @param string\r
- * @return array\r
- */\r
- function changeCommentSet(&$comment, $judge)\r
- {\r
- global $manager;\r
- $comment['body'] = $judge['substitution'];\r
- $comment['short'] = $judge['substitution'];\r
- $comment['excerpt'] = $judge['substitution'];\r
- $comment['userid'] = $judge['blogURL'];\r
- $comment['memberid'] = 0;\r
- $comment['user'] = '#';\r
- $comment['useremail'] = '#';\r
- $comment['userwebsite'] = '#';\r
- $comment['email'] = '#';\r
- $comment['userlinkraw'] = '#';\r
- $comment['userlink'] = '#';\r
- $comment['host'] = '127.0.0.1';\r
- $comment['ip'] = '127.0.0.1';\r
- if ($manager->pluginInstalled('NP_LatestWritebacks')) {\r
- $comment['commentbody'] = $judge['substitution'];\r
- $comment['commentator'] = '#';\r
- }\r
- return $comment;\r
- }\r
- // {{{ getComments($comment, $judge)\r
-\r
- /**\r
- * Change in the comment contents.\r
- *\r
- * @param boolean\r
- * @param integre\r
- * @param integre\r
- * @param integre\r
- * @return resouce\r
- */\r
- function getComments($commentOrder, $iid, $maxToShow, $startnum)\r
- {\r
- $order = ($commentOrder) ? "DESC" : "ASC";\r
- $query = 'SELECT '\r
- . 'c.citem as itemid, '\r
- . 'c.cnumber as commentid, '\r
- . 'c.cbody as body, '\r
- . 'c.cuser as user, '\r
- . 'c.cmail as userid, '\r
- . 'c.cemail as email, '\r
- . 'c.cmember as memberid, '\r
- . 'c.ctime, '\r
- . 'c.chost as host, '\r
- . 'c.cip as ip, '\r
- . 'c.cblog as blogid, '\r
- . 's.comid as cid, '\r
- . 's.secflg as secret, '\r
- . 's.module as modname, '\r
- . 's.userID as identity '\r
- . ' FROM ' . sql_table('comment') . ' as c '\r
- . ' LEFT OUTER JOIN ' . sql_table('plug_ezcomment2') . ' as s '\r
- . ' ON c.cnumber = s.comid '\r
- . ' WHERE c.citem = ' . intval($iid)\r
- . ' ORDER BY c.ctime '\r
- . $order;\r
- if ($maxToShow) {\r
- if ($order == "DESC") {\r
- $query .=' LIMIT ' . intval($maxToShow);\r
- } else {\r
- $query .=' LIMIT ' . intval($startnum) . ',' . intval($maxToShow);\r
- }\r
- }\r
- return sql_query($query);\r
- \r
- }\r
-\r
- // }}}\r
- // {{{ getTemplateParts()\r
-\r
- /**\r
- * Comment form/list template via NP_znSpecialTemplateParts\r
- *\r
- * @return array\r
- */\r
- function getTemplateParts()\r
- {\r
- $this->languageInclude();\r
- return array(\r
- 'FORM_LOGGEDIN_IDX' => _NP_EZCOMMENT2_FORM_LOGGEDIN_IDX, \r
- 'FORM_NOTLOGGEDIN_IDX' => _NP_EZCOMMENT2_FORM_NOTLOGGEDIN_IDX, \r
- 'FORM_LOGGEDIN_ITM' => _NP_EZCOMMENT2_FORM_LOGGEDIN_ITM,\r
- 'FORM_NOTLOGGEDIN_ITM' => _NP_EZCOMMENT2_FORM_NOTLOGGEDIN_ITM, \r
- 'COMMENTS_BODY_IDX' => _NP_EZCOMMENT2_COMMENTS_BODY_IDX, \r
- 'COMMENTS_FOOTER_IDX' => _NP_EZCOMMENT2_COMMENTS_FOOTER_IDX, \r
- 'COMMENTS_HEADER_IDX' => _NP_EZCOMMENT2_COMMENTS_HEADER_IDX,\r
- );\r
- }\r
-\r
- // }}}\r
- // {{{ _hsc()\r
-\r
- /**\r
- * HTML entity\r
- *\r
- * @param string\r
- * @return string\r
- */\r
- function _hsc($str)\r
- {\r
- return htmlspecialchars($str, ENT_QUOTES, _CHARSET);\r
- }\r
- // }}}\r
- \r
-}\r
-\r
-\r
-\r
+++ /dev/null
-<?php
-
-class EzCommentFormActions extends ACTIONS
-{
-
-var $commentItem;
-
-var $loginMember;
-
- function EzCommentFormActions(&$item, $formdata, $member)
- {
- $this->ACTIONS('item');
- $this->commentItem =& $item;
- $this->formdata = $formdata;
- $this->loginMember = $member;
- }
-
- function getAllowedActions()
- {
- return array(
- 'text',
- 'self',
- 'formdata',
- 'callback',
- 'errordiv',
- 'ticket',
- 'itemid',
- 'itemlink',
- 'itemtitle',
- 'membername',
- 'memberurl',
- );
- }
-
- function parse_itemid() {
- echo $this->commentItem->itemid;
- }
-
- function parse_itemlink($linktext = '') {
- global $itemid;
- $this->_itemlink($this->commentItem->itemid, $linktext);
- }
-
- function parse_itemtitle($format = '') {
- switch ($format) {
- case 'xml':
- echo stringToXML ($this->commentItem->itemtitle);
- break;
- case 'attribute':
- echo stringToAttribute ($this->commentItem->itemtitle);
- break;
- case 'raw':
- echo $this->commentItem->itemtitle;
- break;
- default:
- echo $this->_hsc(strip_tags($this->commentItem->itemtitle));
- break;
- }
- }
-
- function parse_membername($mode='')
- {
- if ($mode == 'realname') {
- echo $this->_hsc($this->loginMember->getRealName());
- } else {
- echo $this->_hsc($this->loginMember->getDisplayName());
- }
- }
-
- function parse_memberurl()
- {
- echo $this->_hsc($this->loginMember->getURL());
- }
-
- function _hsc($str)
- {
- return htmlspecialchars($str, ENT_QUOTES, _CHARSET);
- }
-
-}
-
-class EzCommentActions extends COMMENTACTIONS
-{
-
-var $viewnum;
-
-var $postnum;
-
- function EzCommentActions(&$comments)
- {
- $this->COMMENTACTIONS($comments);
- }
-
- function getAllowedActions()
- {
- $allowedActions = $this->getDefinedActions();
- $allowedActions[] = 'viewnum';
- $allowedActions[] = 'postnum';
- $allowedActions[] = 'viewparpost';
- return $allowedActions;
- }
-
- function setPostnum($postnum)
- {
- $this->postnum = $postnum;
- }
-
- function setViewnum($viewnum)
- {
- $this->viewnum = $viewnum;
- }
-
- function parse_viewnum()
- {
- echo intval($this->viewnum);
- }
-
- function parse_postnum()
- {
- echo intval($this->postnum);
- }
-
- function parse_viewparpost()
- {
- echo intval($this->viewnum) . ' ';
- if ($this->postnum > $this->viewnum) {
- echo '/ ' . $this->postnum . ' ';
- }
- $this->parse_commentword();
- }
-
-}
-
+++ /dev/null
-/*
- * jQuery 1.2.6 - New Wave Javascript
- *
- * Copyright (c) 2008 John Resig (jquery.com)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * $Date: 2008-07-07 10:23:59 $
- * $Rev: 5685 $
- */
-eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(H(){J w=1b.4M,3m$=1b.$;J D=1b.4M=1b.$=H(a,b){I 2B D.17.5j(a,b)};J u=/^[^<]*(<(.|\\s)+>)[^>]*$|^#(\\w+)$/,62=/^.[^:#\\[\\.]*$/,12;D.17=D.44={5j:H(d,b){d=d||S;G(d.16){7[0]=d;7.K=1;I 7}G(1j d=="23"){J c=u.2D(d);G(c&&(c[1]||!b)){G(c[1])d=D.4h([c[1]],b);N{J a=S.61(c[3]);G(a){G(a.2v!=c[3])I D().2q(d);I D(a)}d=[]}}N I D(b).2q(d)}N G(D.1D(d))I D(S)[D.17.27?"27":"43"](d);I 7.6Y(D.2d(d))},5w:"1.2.6",8G:H(){I 7.K},K:0,3p:H(a){I a==12?D.2d(7):7[a]},2I:H(b){J a=D(b);a.5n=7;I a},6Y:H(a){7.K=0;2p.44.1p.1w(7,a);I 7},P:H(a,b){I D.P(7,a,b)},5i:H(b){J a=-1;I D.2L(b&&b.5w?b[0]:b,7)},1K:H(c,a,b){J d=c;G(c.1q==56)G(a===12)I 7[0]&&D[b||"1K"](7[0],c);N{d={};d[c]=a}I 7.P(H(i){R(c 1n d)D.1K(b?7.V:7,c,D.1i(7,d[c],b,i,c))})},1g:H(b,a){G((b==\'2h\'||b==\'1Z\')&&3d(a)<0)a=12;I 7.1K(b,a,"2a")},1r:H(b){G(1j b!="49"&&b!=U)I 7.4E().3v((7[0]&&7[0].2z||S).5F(b));J a="";D.P(b||7,H(){D.P(7.3t,H(){G(7.16!=8)a+=7.16!=1?7.76:D.17.1r([7])})});I a},5z:H(b){G(7[0])D(b,7[0].2z).5y().39(7[0]).2l(H(){J a=7;1B(a.1x)a=a.1x;I a}).3v(7);I 7},8Y:H(a){I 7.P(H(){D(7).6Q().5z(a)})},8R:H(a){I 7.P(H(){D(7).5z(a)})},3v:H(){I 7.3W(19,M,Q,H(a){G(7.16==1)7.3U(a)})},6F:H(){I 7.3W(19,M,M,H(a){G(7.16==1)7.39(a,7.1x)})},6E:H(){I 7.3W(19,Q,Q,H(a){7.1d.39(a,7)})},5q:H(){I 7.3W(19,Q,M,H(a){7.1d.39(a,7.2H)})},3l:H(){I 7.5n||D([])},2q:H(b){J c=D.2l(7,H(a){I D.2q(b,a)});I 7.2I(/[^+>] [^+>]/.11(b)||b.1h("..")>-1?D.4r(c):c)},5y:H(e){J f=7.2l(H(){G(D.14.1f&&!D.4n(7)){J a=7.6o(M),5h=S.3h("1v");5h.3U(a);I D.4h([5h.4H])[0]}N I 7.6o(M)});J d=f.2q("*").5c().P(H(){G(7[E]!=12)7[E]=U});G(e===M)7.2q("*").5c().P(H(i){G(7.16==3)I;J c=D.L(7,"3w");R(J a 1n c)R(J b 1n c[a])D.W.1e(d[i],a,c[a][b],c[a][b].L)});I f},1E:H(b){I 7.2I(D.1D(b)&&D.3C(7,H(a,i){I b.1k(a,i)})||D.3g(b,7))},4Y:H(b){G(b.1q==56)G(62.11(b))I 7.2I(D.3g(b,7,M));N b=D.3g(b,7);J a=b.K&&b[b.K-1]!==12&&!b.16;I 7.1E(H(){I a?D.2L(7,b)<0:7!=b})},1e:H(a){I 7.2I(D.4r(D.2R(7.3p(),1j a==\'23\'?D(a):D.2d(a))))},3F:H(a){I!!a&&D.3g(a,7).K>0},7T:H(a){I 7.3F("."+a)},6e:H(b){G(b==12){G(7.K){J c=7[0];G(D.Y(c,"2A")){J e=c.64,63=[],15=c.15,2V=c.O=="2A-2V";G(e<0)I U;R(J i=2V?e:0,2f=2V?e+1:15.K;i<2f;i++){J d=15[i];G(d.2W){b=D.14.1f&&!d.at.2x.an?d.1r:d.2x;G(2V)I b;63.1p(b)}}I 63}N I(7[0].2x||"").1o(/\\r/g,"")}I 12}G(b.1q==4L)b+=\'\';I 7.P(H(){G(7.16!=1)I;G(b.1q==2p&&/5O|5L/.11(7.O))7.4J=(D.2L(7.2x,b)>=0||D.2L(7.34,b)>=0);N G(D.Y(7,"2A")){J a=D.2d(b);D("9R",7).P(H(){7.2W=(D.2L(7.2x,a)>=0||D.2L(7.1r,a)>=0)});G(!a.K)7.64=-1}N 7.2x=b})},2K:H(a){I a==12?(7[0]?7[0].4H:U):7.4E().3v(a)},7b:H(a){I 7.5q(a).21()},79:H(i){I 7.3s(i,i+1)},3s:H(){I 7.2I(2p.44.3s.1w(7,19))},2l:H(b){I 7.2I(D.2l(7,H(a,i){I b.1k(a,i,a)}))},5c:H(){I 7.1e(7.5n)},L:H(d,b){J a=d.1R(".");a[1]=a[1]?"."+a[1]:"";G(b===12){J c=7.5C("9z"+a[1]+"!",[a[0]]);G(c===12&&7.K)c=D.L(7[0],d);I c===12&&a[1]?7.L(a[0]):c}N I 7.1P("9u"+a[1]+"!",[a[0],b]).P(H(){D.L(7,d,b)})},3b:H(a){I 7.P(H(){D.3b(7,a)})},3W:H(g,f,h,d){J e=7.K>1,3x;I 7.P(H(){G(!3x){3x=D.4h(g,7.2z);G(h)3x.9o()}J b=7;G(f&&D.Y(7,"1T")&&D.Y(3x[0],"4F"))b=7.3H("22")[0]||7.3U(7.2z.3h("22"));J c=D([]);D.P(3x,H(){J a=e?D(7).5y(M)[0]:7;G(D.Y(a,"1m"))c=c.1e(a);N{G(a.16==1)c=c.1e(D("1m",a).21());d.1k(b,a)}});c.P(6T)})}};D.17.5j.44=D.17;H 6T(i,a){G(a.4d)D.3Y({1a:a.4d,31:Q,1O:"1m"});N D.5u(a.1r||a.6O||a.4H||"");G(a.1d)a.1d.37(a)}H 1z(){I+2B 8J}D.1l=D.17.1l=H(){J b=19[0]||{},i=1,K=19.K,4x=Q,15;G(b.1q==8I){4x=b;b=19[1]||{};i=2}G(1j b!="49"&&1j b!="H")b={};G(K==i){b=7;--i}R(;i<K;i++)G((15=19[i])!=U)R(J c 1n 15){J a=b[c],2w=15[c];G(b===2w)6M;G(4x&&2w&&1j 2w=="49"&&!2w.16)b[c]=D.1l(4x,a||(2w.K!=U?[]:{}),2w);N G(2w!==12)b[c]=2w}I b};J E="4M"+1z(),6K=0,5r={},6G=/z-?5i|8B-?8A|1y|6B|8v-?1Z/i,3P=S.3P||{};D.1l({8u:H(a){1b.$=3m$;G(a)1b.4M=w;I D},1D:H(a){I!!a&&1j a!="23"&&!a.Y&&a.1q!=2p&&/^[\\s[]?H/.11(a+"")},4n:H(a){I a.1C&&!a.1c||a.2j&&a.2z&&!a.2z.1c},5u:H(a){a=D.3k(a);G(a){J b=S.3H("6w")[0]||S.1C,1m=S.3h("1m");1m.O="1r/4t";G(D.14.1f)1m.1r=a;N 1m.3U(S.5F(a));b.39(1m,b.1x);b.37(1m)}},Y:H(b,a){I b.Y&&b.Y.2r()==a.2r()},1Y:{},L:H(c,d,b){c=c==1b?5r:c;J a=c[E];G(!a)a=c[E]=++6K;G(d&&!D.1Y[a])D.1Y[a]={};G(b!==12)D.1Y[a][d]=b;I d?D.1Y[a][d]:a},3b:H(c,b){c=c==1b?5r:c;J a=c[E];G(b){G(D.1Y[a]){2U D.1Y[a][b];b="";R(b 1n D.1Y[a])1X;G(!b)D.3b(c)}}N{1U{2U c[E]}1V(e){G(c.5l)c.5l(E)}2U D.1Y[a]}},P:H(d,a,c){J e,i=0,K=d.K;G(c){G(K==12){R(e 1n d)G(a.1w(d[e],c)===Q)1X}N R(;i<K;)G(a.1w(d[i++],c)===Q)1X}N{G(K==12){R(e 1n d)G(a.1k(d[e],e,d[e])===Q)1X}N R(J b=d[0];i<K&&a.1k(b,i,b)!==Q;b=d[++i]){}}I d},1i:H(b,a,c,i,d){G(D.1D(a))a=a.1k(b,i);I a&&a.1q==4L&&c=="2a"&&!6G.11(d)?a+"2X":a},1F:{1e:H(c,b){D.P((b||"").1R(/\\s+/),H(i,a){G(c.16==1&&!D.1F.3T(c.1F,a))c.1F+=(c.1F?" ":"")+a})},21:H(c,b){G(c.16==1)c.1F=b!=12?D.3C(c.1F.1R(/\\s+/),H(a){I!D.1F.3T(b,a)}).6s(" "):""},3T:H(b,a){I D.2L(a,(b.1F||b).6r().1R(/\\s+/))>-1}},6q:H(b,c,a){J e={};R(J d 1n c){e[d]=b.V[d];b.V[d]=c[d]}a.1k(b);R(J d 1n c)b.V[d]=e[d]},1g:H(d,e,c){G(e=="2h"||e=="1Z"){J b,3X={30:"5x",5g:"1G",18:"3I"},35=e=="2h"?["5e","6k"]:["5G","6i"];H 5b(){b=e=="2h"?d.8f:d.8c;J a=0,2C=0;D.P(35,H(){a+=3d(D.2a(d,"57"+7,M))||0;2C+=3d(D.2a(d,"2C"+7+"4b",M))||0});b-=29.83(a+2C)}G(D(d).3F(":4j"))5b();N D.6q(d,3X,5b);I 29.2f(0,b)}I D.2a(d,e,c)},2a:H(f,l,k){J e,V=f.V;H 3E(b){G(!D.14.2k)I Q;J a=3P.54(b,U);I!a||a.52("3E")==""}G(l=="1y"&&D.14.1f){e=D.1K(V,"1y");I e==""?"1":e}G(D.14.2G&&l=="18"){J d=V.50;V.50="0 7Y 7W";V.50=d}G(l.1I(/4i/i))l=y;G(!k&&V&&V[l])e=V[l];N G(3P.54){G(l.1I(/4i/i))l="4i";l=l.1o(/([A-Z])/g,"-$1").3y();J c=3P.54(f,U);G(c&&!3E(f))e=c.52(l);N{J g=[],2E=[],a=f,i=0;R(;a&&3E(a);a=a.1d)2E.6h(a);R(;i<2E.K;i++)G(3E(2E[i])){g[i]=2E[i].V.18;2E[i].V.18="3I"}e=l=="18"&&g[2E.K-1]!=U?"2F":(c&&c.52(l))||"";R(i=0;i<g.K;i++)G(g[i]!=U)2E[i].V.18=g[i]}G(l=="1y"&&e=="")e="1"}N G(f.4g){J h=l.1o(/\\-(\\w)/g,H(a,b){I b.2r()});e=f.4g[l]||f.4g[h];G(!/^\\d+(2X)?$/i.11(e)&&/^\\d/.11(e)){J j=V.1A,66=f.65.1A;f.65.1A=f.4g.1A;V.1A=e||0;e=V.aM+"2X";V.1A=j;f.65.1A=66}}I e},4h:H(l,h){J k=[];h=h||S;G(1j h.3h==\'12\')h=h.2z||h[0]&&h[0].2z||S;D.P(l,H(i,d){G(!d)I;G(d.1q==4L)d+=\'\';G(1j d=="23"){d=d.1o(/(<(\\w+)[^>]*?)\\/>/g,H(b,a,c){I c.1I(/^(aK|4f|7E|aG|4T|7A|aB|3n|az|ay|av)$/i)?b:a+"></"+c+">"});J f=D.3k(d).3y(),1v=h.3h("1v");J e=!f.1h("<au")&&[1,"<2A 7w=\'7w\'>","</2A>"]||!f.1h("<ar")&&[1,"<7v>","</7v>"]||f.1I(/^<(aq|22|am|ak|ai)/)&&[1,"<1T>","</1T>"]||!f.1h("<4F")&&[2,"<1T><22>","</22></1T>"]||(!f.1h("<af")||!f.1h("<ad"))&&[3,"<1T><22><4F>","</4F></22></1T>"]||!f.1h("<7E")&&[2,"<1T><22></22><7q>","</7q></1T>"]||D.14.1f&&[1,"1v<1v>","</1v>"]||[0,"",""];1v.4H=e[1]+d+e[2];1B(e[0]--)1v=1v.5T;G(D.14.1f){J g=!f.1h("<1T")&&f.1h("<22")<0?1v.1x&&1v.1x.3t:e[1]=="<1T>"&&f.1h("<22")<0?1v.3t:[];R(J j=g.K-1;j>=0;--j)G(D.Y(g[j],"22")&&!g[j].3t.K)g[j].1d.37(g[j]);G(/^\\s/.11(d))1v.39(h.5F(d.1I(/^\\s*/)[0]),1v.1x)}d=D.2d(1v.3t)}G(d.K===0&&(!D.Y(d,"3V")&&!D.Y(d,"2A")))I;G(d[0]==12||D.Y(d,"3V")||d.15)k.1p(d);N k=D.2R(k,d)});I k},1K:H(d,f,c){G(!d||d.16==3||d.16==8)I 12;J e=!D.4n(d),40=c!==12,1f=D.14.1f;f=e&&D.3X[f]||f;G(d.2j){J g=/5Q|4d|V/.11(f);G(f=="2W"&&D.14.2k)d.1d.64;G(f 1n d&&e&&!g){G(40){G(f=="O"&&D.Y(d,"4T")&&d.1d)7p"O a3 a1\'t 9V 9U";d[f]=c}G(D.Y(d,"3V")&&d.7i(f))I d.7i(f).76;I d[f]}G(1f&&e&&f=="V")I D.1K(d.V,"9T",c);G(40)d.9Q(f,""+c);J h=1f&&e&&g?d.4G(f,2):d.4G(f);I h===U?12:h}G(1f&&f=="1y"){G(40){d.6B=1;d.1E=(d.1E||"").1o(/7f\\([^)]*\\)/,"")+(3r(c)+\'\'=="9L"?"":"7f(1y="+c*7a+")")}I d.1E&&d.1E.1h("1y=")>=0?(3d(d.1E.1I(/1y=([^)]*)/)[1])/7a)+\'\':""}f=f.1o(/-([a-z])/9H,H(a,b){I b.2r()});G(40)d[f]=c;I d[f]},3k:H(a){I(a||"").1o(/^\\s+|\\s+$/g,"")},2d:H(b){J a=[];G(b!=U){J i=b.K;G(i==U||b.1R||b.4I||b.1k)a[0]=b;N 1B(i)a[--i]=b[i]}I a},2L:H(b,a){R(J i=0,K=a.K;i<K;i++)G(a[i]===b)I i;I-1},2R:H(a,b){J i=0,T,2S=a.K;G(D.14.1f){1B(T=b[i++])G(T.16!=8)a[2S++]=T}N 1B(T=b[i++])a[2S++]=T;I a},4r:H(a){J c=[],2o={};1U{R(J i=0,K=a.K;i<K;i++){J b=D.L(a[i]);G(!2o[b]){2o[b]=M;c.1p(a[i])}}}1V(e){c=a}I c},3C:H(c,a,d){J b=[];R(J i=0,K=c.K;i<K;i++)G(!d!=!a(c[i],i))b.1p(c[i]);I b},2l:H(d,a){J c=[];R(J i=0,K=d.K;i<K;i++){J b=a(d[i],i);G(b!=U)c[c.K]=b}I c.7d.1w([],c)}});J v=9B.9A.3y();D.14={5B:(v.1I(/.+(?:9y|9x|9w|9v)[\\/: ]([\\d.]+)/)||[])[1],2k:/75/.11(v),2G:/2G/.11(v),1f:/1f/.11(v)&&!/2G/.11(v),42:/42/.11(v)&&!/(9s|75)/.11(v)};J y=D.14.1f?"7o":"72";D.1l({71:!D.14.1f||S.70=="6Z",3X:{"R":"9n","9k":"1F","4i":y,72:y,7o:y,9h:"9f",9e:"9d",9b:"99"}});D.P({6W:H(a){I a.1d},97:H(a){I D.4S(a,"1d")},95:H(a){I D.3a(a,2,"2H")},91:H(a){I D.3a(a,2,"4l")},8Z:H(a){I D.4S(a,"2H")},8X:H(a){I D.4S(a,"4l")},8W:H(a){I D.5v(a.1d.1x,a)},8V:H(a){I D.5v(a.1x)},6Q:H(a){I D.Y(a,"8U")?a.8T||a.8S.S:D.2d(a.3t)}},H(c,d){D.17[c]=H(b){J a=D.2l(7,d);G(b&&1j b=="23")a=D.3g(b,a);I 7.2I(D.4r(a))}});D.P({6P:"3v",8Q:"6F",39:"6E",8P:"5q",8O:"7b"},H(c,b){D.17[c]=H(){J a=19;I 7.P(H(){R(J i=0,K=a.K;i<K;i++)D(a[i])[b](7)})}});D.P({8N:H(a){D.1K(7,a,"");G(7.16==1)7.5l(a)},8M:H(a){D.1F.1e(7,a)},8L:H(a){D.1F.21(7,a)},8K:H(a){D.1F[D.1F.3T(7,a)?"21":"1e"](7,a)},21:H(a){G(!a||D.1E(a,[7]).r.K){D("*",7).1e(7).P(H(){D.W.21(7);D.3b(7)});G(7.1d)7.1d.37(7)}},4E:H(){D(">*",7).21();1B(7.1x)7.37(7.1x)}},H(a,b){D.17[a]=H(){I 7.P(b,19)}});D.P(["6N","4b"],H(i,c){J b=c.3y();D.17[b]=H(a){I 7[0]==1b?D.14.2G&&S.1c["5t"+c]||D.14.2k&&1b["5s"+c]||S.70=="6Z"&&S.1C["5t"+c]||S.1c["5t"+c]:7[0]==S?29.2f(29.2f(S.1c["4y"+c],S.1C["4y"+c]),29.2f(S.1c["2i"+c],S.1C["2i"+c])):a==12?(7.K?D.1g(7[0],b):U):7.1g(b,a.1q==56?a:a+"2X")}});H 25(a,b){I a[0]&&3r(D.2a(a[0],b,M),10)||0}J C=D.14.2k&&3r(D.14.5B)<8H?"(?:[\\\\w*3m-]|\\\\\\\\.)":"(?:[\\\\w\\8F-\\8E*3m-]|\\\\\\\\.)",6L=2B 4v("^>\\\\s*("+C+"+)"),6J=2B 4v("^("+C+"+)(#)("+C+"+)"),6I=2B 4v("^([#.]?)("+C+"*)");D.1l({6H:{"":H(a,i,m){I m[2]=="*"||D.Y(a,m[2])},"#":H(a,i,m){I a.4G("2v")==m[2]},":":{8D:H(a,i,m){I i<m[3]-0},8C:H(a,i,m){I i>m[3]-0},3a:H(a,i,m){I m[3]-0==i},79:H(a,i,m){I m[3]-0==i},3o:H(a,i){I i==0},3S:H(a,i,m,r){I i==r.K-1},6D:H(a,i){I i%2==0},6C:H(a,i){I i%2},"3o-4u":H(a){I a.1d.3H("*")[0]==a},"3S-4u":H(a){I D.3a(a.1d.5T,1,"4l")==a},"8z-4u":H(a){I!D.3a(a.1d.5T,2,"4l")},6W:H(a){I a.1x},4E:H(a){I!a.1x},8y:H(a,i,m){I(a.6O||a.8x||D(a).1r()||"").1h(m[3])>=0},4j:H(a){I"1G"!=a.O&&D.1g(a,"18")!="2F"&&D.1g(a,"5g")!="1G"},1G:H(a){I"1G"==a.O||D.1g(a,"18")=="2F"||D.1g(a,"5g")=="1G"},8w:H(a){I!a.3R},3R:H(a){I a.3R},4J:H(a){I a.4J},2W:H(a){I a.2W||D.1K(a,"2W")},1r:H(a){I"1r"==a.O},5O:H(a){I"5O"==a.O},5L:H(a){I"5L"==a.O},5p:H(a){I"5p"==a.O},3Q:H(a){I"3Q"==a.O},5o:H(a){I"5o"==a.O},6A:H(a){I"6A"==a.O},6z:H(a){I"6z"==a.O},2s:H(a){I"2s"==a.O||D.Y(a,"2s")},4T:H(a){I/4T|2A|6y|2s/i.11(a.Y)},3T:H(a,i,m){I D.2q(m[3],a).K},8t:H(a){I/h\\d/i.11(a.Y)},8s:H(a){I D.3C(D.3O,H(b){I a==b.T}).K}}},6x:[/^(\\[) *@?([\\w-]+) *([!*$^~=]*) *(\'?"?)(.*?)\\4 *\\]/,/^(:)([\\w-]+)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/,2B 4v("^([:.#]*)("+C+"+)")],3g:H(a,c,b){J d,1t=[];1B(a&&a!=d){d=a;J f=D.1E(a,c,b);a=f.t.1o(/^\\s*,\\s*/,"");1t=b?c=f.r:D.2R(1t,f.r)}I 1t},2q:H(t,o){G(1j t!="23")I[t];G(o&&o.16!=1&&o.16!=9)I[];o=o||S;J d=[o],2o=[],3S,Y;1B(t&&3S!=t){J r=[];3S=t;t=D.3k(t);J l=Q,3j=6L,m=3j.2D(t);G(m){Y=m[1].2r();R(J i=0;d[i];i++)R(J c=d[i].1x;c;c=c.2H)G(c.16==1&&(Y=="*"||c.Y.2r()==Y))r.1p(c);d=r;t=t.1o(3j,"");G(t.1h(" ")==0)6M;l=M}N{3j=/^([>+~])\\s*(\\w*)/i;G((m=3j.2D(t))!=U){r=[];J k={};Y=m[2].2r();m=m[1];R(J j=0,3i=d.K;j<3i;j++){J n=m=="~"||m=="+"?d[j].2H:d[j].1x;R(;n;n=n.2H)G(n.16==1){J g=D.L(n);G(m=="~"&&k[g])1X;G(!Y||n.Y.2r()==Y){G(m=="~")k[g]=M;r.1p(n)}G(m=="+")1X}}d=r;t=D.3k(t.1o(3j,""));l=M}}G(t&&!l){G(!t.1h(",")){G(o==d[0])d.4s();2o=D.2R(2o,d);r=d=[o];t=" "+t.6v(1,t.K)}N{J h=6J;J m=h.2D(t);G(m){m=[0,m[2],m[3],m[1]]}N{h=6I;m=h.2D(t)}m[2]=m[2].1o(/\\\\/g,"");J f=d[d.K-1];G(m[1]=="#"&&f&&f.61&&!D.4n(f)){J p=f.61(m[2]);G((D.14.1f||D.14.2G)&&p&&1j p.2v=="23"&&p.2v!=m[2])p=D(\'[@2v="\'+m[2]+\'"]\',f)[0];d=r=p&&(!m[3]||D.Y(p,m[3]))?[p]:[]}N{R(J i=0;d[i];i++){J a=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];G(a=="*"&&d[i].Y.3y()=="49")a="3n";r=D.2R(r,d[i].3H(a))}G(m[1]==".")r=D.5m(r,m[2]);G(m[1]=="#"){J e=[];R(J i=0;r[i];i++)G(r[i].4G("2v")==m[2]){e=[r[i]];1X}r=e}d=r}t=t.1o(h,"")}}G(t){J b=D.1E(t,r);d=r=b.r;t=D.3k(b.t)}}G(t)d=[];G(d&&o==d[0])d.4s();2o=D.2R(2o,d);I 2o},5m:H(r,m,a){m=" "+m+" ";J c=[];R(J i=0;r[i];i++){J b=(" "+r[i].1F+" ").1h(m)>=0;G(!a&&b||a&&!b)c.1p(r[i])}I c},1E:H(t,r,h){J d;1B(t&&t!=d){d=t;J p=D.6x,m;R(J i=0;p[i];i++){m=p[i].2D(t);G(m){t=t.8r(m[0].K);m[2]=m[2].1o(/\\\\/g,"");1X}}G(!m)1X;G(m[1]==":"&&m[2]=="4Y")r=62.11(m[3])?D.1E(m[3],r,M).r:D(r).4Y(m[3]);N G(m[1]==".")r=D.5m(r,m[2],h);N G(m[1]=="["){J g=[],O=m[3];R(J i=0,3i=r.K;i<3i;i++){J a=r[i],z=a[D.3X[m[2]]||m[2]];G(z==U||/5Q|4d|2W/.11(m[2]))z=D.1K(a,m[2])||\'\';G((O==""&&!!z||O=="="&&z==m[5]||O=="!="&&z!=m[5]||O=="^="&&z&&!z.1h(m[5])||O=="$="&&z.6v(z.K-m[5].K)==m[5]||(O=="*="||O=="~=")&&z.1h(m[5])>=0)^h)g.1p(a)}r=g}N G(m[1]==":"&&m[2]=="3a-4u"){J e={},g=[],11=/(-?)(\\d*)n((?:\\+|-)?\\d*)/.2D(m[3]=="6D"&&"2n"||m[3]=="6C"&&"2n+1"||!/\\D/.11(m[3])&&"8q+"+m[3]||m[3]),3o=(11[1]+(11[2]||1))-0,d=11[3]-0;R(J i=0,3i=r.K;i<3i;i++){J j=r[i],1d=j.1d,2v=D.L(1d);G(!e[2v]){J c=1;R(J n=1d.1x;n;n=n.2H)G(n.16==1)n.4q=c++;e[2v]=M}J b=Q;G(3o==0){G(j.4q==d)b=M}N G((j.4q-d)%3o==0&&(j.4q-d)/3o>=0)b=M;G(b^h)g.1p(j)}r=g}N{J f=D.6H[m[1]];G(1j f=="49")f=f[m[2]];G(1j f=="23")f=6u("Q||H(a,i){I "+f+";}");r=D.3C(r,H(a,i){I f(a,i,m,r)},h)}}I{r:r,t:t}},4S:H(b,c){J a=[],1t=b[c];1B(1t&&1t!=S){G(1t.16==1)a.1p(1t);1t=1t[c]}I a},3a:H(a,e,c,b){e=e||1;J d=0;R(;a;a=a[c])G(a.16==1&&++d==e)1X;I a},5v:H(n,a){J r=[];R(;n;n=n.2H){G(n.16==1&&n!=a)r.1p(n)}I r}});D.W={1e:H(f,i,g,e){G(f.16==3||f.16==8)I;G(D.14.1f&&f.4I)f=1b;G(!g.24)g.24=7.24++;G(e!=12){J h=g;g=7.3M(h,H(){I h.1w(7,19)});g.L=e}J j=D.L(f,"3w")||D.L(f,"3w",{}),1H=D.L(f,"1H")||D.L(f,"1H",H(){G(1j D!="12"&&!D.W.5k)I D.W.1H.1w(19.3L.T,19)});1H.T=f;D.P(i.1R(/\\s+/),H(c,b){J a=b.1R(".");b=a[0];g.O=a[1];J d=j[b];G(!d){d=j[b]={};G(!D.W.2t[b]||D.W.2t[b].4p.1k(f)===Q){G(f.3K)f.3K(b,1H,Q);N G(f.6t)f.6t("4o"+b,1H)}}d[g.24]=g;D.W.26[b]=M});f=U},24:1,26:{},21:H(e,h,f){G(e.16==3||e.16==8)I;J i=D.L(e,"3w"),1L,5i;G(i){G(h==12||(1j h=="23"&&h.8p(0)=="."))R(J g 1n i)7.21(e,g+(h||""));N{G(h.O){f=h.2y;h=h.O}D.P(h.1R(/\\s+/),H(b,a){J c=a.1R(".");a=c[0];G(i[a]){G(f)2U i[a][f.24];N R(f 1n i[a])G(!c[1]||i[a][f].O==c[1])2U i[a][f];R(1L 1n i[a])1X;G(!1L){G(!D.W.2t[a]||D.W.2t[a].4A.1k(e)===Q){G(e.6p)e.6p(a,D.L(e,"1H"),Q);N G(e.6n)e.6n("4o"+a,D.L(e,"1H"))}1L=U;2U i[a]}}})}R(1L 1n i)1X;G(!1L){J d=D.L(e,"1H");G(d)d.T=U;D.3b(e,"3w");D.3b(e,"1H")}}},1P:H(h,c,f,g,i){c=D.2d(c);G(h.1h("!")>=0){h=h.3s(0,-1);J a=M}G(!f){G(7.26[h])D("*").1e([1b,S]).1P(h,c)}N{G(f.16==3||f.16==8)I 12;J b,1L,17=D.1D(f[h]||U),W=!c[0]||!c[0].32;G(W){c.6h({O:h,2J:f,32:H(){},3J:H(){},4C:1z()});c[0][E]=M}c[0].O=h;G(a)c[0].6m=M;J d=D.L(f,"1H");G(d)b=d.1w(f,c);G((!17||(D.Y(f,\'a\')&&h=="4V"))&&f["4o"+h]&&f["4o"+h].1w(f,c)===Q)b=Q;G(W)c.4s();G(i&&D.1D(i)){1L=i.1w(f,b==U?c:c.7d(b));G(1L!==12)b=1L}G(17&&g!==Q&&b!==Q&&!(D.Y(f,\'a\')&&h=="4V")){7.5k=M;1U{f[h]()}1V(e){}}7.5k=Q}I b},1H:H(b){J a,1L,38,5f,4m;b=19[0]=D.W.6l(b||1b.W);38=b.O.1R(".");b.O=38[0];38=38[1];5f=!38&&!b.6m;4m=(D.L(7,"3w")||{})[b.O];R(J j 1n 4m){J c=4m[j];G(5f||c.O==38){b.2y=c;b.L=c.L;1L=c.1w(7,19);G(a!==Q)a=1L;G(1L===Q){b.32();b.3J()}}}I a},6l:H(b){G(b[E]==M)I b;J d=b;b={8o:d};J c="8n 8m 8l 8k 2s 8j 47 5d 6j 5E 8i L 8h 8g 4K 2y 5a 59 8e 8b 58 6f 8a 88 4k 87 86 84 6d 2J 4C 6c O 82 81 35".1R(" ");R(J i=c.K;i;i--)b[c[i]]=d[c[i]];b[E]=M;b.32=H(){G(d.32)d.32();d.80=Q};b.3J=H(){G(d.3J)d.3J();d.7Z=M};b.4C=b.4C||1z();G(!b.2J)b.2J=b.6d||S;G(b.2J.16==3)b.2J=b.2J.1d;G(!b.4k&&b.4K)b.4k=b.4K==b.2J?b.6c:b.4K;G(b.58==U&&b.5d!=U){J a=S.1C,1c=S.1c;b.58=b.5d+(a&&a.2e||1c&&1c.2e||0)-(a.6b||0);b.6f=b.6j+(a&&a.2c||1c&&1c.2c||0)-(a.6a||0)}G(!b.35&&((b.47||b.47===0)?b.47:b.5a))b.35=b.47||b.5a;G(!b.59&&b.5E)b.59=b.5E;G(!b.35&&b.2s)b.35=(b.2s&1?1:(b.2s&2?3:(b.2s&4?2:0)));I b},3M:H(a,b){b.24=a.24=a.24||b.24||7.24++;I b},2t:{27:{4p:H(){55();I},4A:H(){I}},3D:{4p:H(){G(D.14.1f)I Q;D(7).2O("53",D.W.2t.3D.2y);I M},4A:H(){G(D.14.1f)I Q;D(7).4e("53",D.W.2t.3D.2y);I M},2y:H(a){G(F(a,7))I M;a.O="3D";I D.W.1H.1w(7,19)}},3N:{4p:H(){G(D.14.1f)I Q;D(7).2O("51",D.W.2t.3N.2y);I M},4A:H(){G(D.14.1f)I Q;D(7).4e("51",D.W.2t.3N.2y);I M},2y:H(a){G(F(a,7))I M;a.O="3N";I D.W.1H.1w(7,19)}}}};D.17.1l({2O:H(c,a,b){I c=="4X"?7.2V(c,a,b):7.P(H(){D.W.1e(7,c,b||a,b&&a)})},2V:H(d,b,c){J e=D.W.3M(c||b,H(a){D(7).4e(a,e);I(c||b).1w(7,19)});I 7.P(H(){D.W.1e(7,d,e,c&&b)})},4e:H(a,b){I 7.P(H(){D.W.21(7,a,b)})},1P:H(c,a,b){I 7.P(H(){D.W.1P(c,a,7,M,b)})},5C:H(c,a,b){I 7[0]&&D.W.1P(c,a,7[0],Q,b)},2m:H(b){J c=19,i=1;1B(i<c.K)D.W.3M(b,c[i++]);I 7.4V(D.W.3M(b,H(a){7.4Z=(7.4Z||0)%i;a.32();I c[7.4Z++].1w(7,19)||Q}))},7X:H(a,b){I 7.2O(\'3D\',a).2O(\'3N\',b)},27:H(a){55();G(D.2Q)a.1k(S,D);N D.3A.1p(H(){I a.1k(7,D)});I 7}});D.1l({2Q:Q,3A:[],27:H(){G(!D.2Q){D.2Q=M;G(D.3A){D.P(D.3A,H(){7.1k(S)});D.3A=U}D(S).5C("27")}}});J x=Q;H 55(){G(x)I;x=M;G(S.3K&&!D.14.2G)S.3K("69",D.27,Q);G(D.14.1f&&1b==1S)(H(){G(D.2Q)I;1U{S.1C.7V("1A")}1V(3e){3B(19.3L,0);I}D.27()})();G(D.14.2G)S.3K("69",H(){G(D.2Q)I;R(J i=0;i<S.4W.K;i++)G(S.4W[i].3R){3B(19.3L,0);I}D.27()},Q);G(D.14.2k){J a;(H(){G(D.2Q)I;G(S.3f!="68"&&S.3f!="1J"){3B(19.3L,0);I}G(a===12)a=D("V, 7A[7U=7S]").K;G(S.4W.K!=a){3B(19.3L,0);I}D.27()})()}D.W.1e(1b,"43",D.27)}D.P(("7R,7Q,43,85,4y,4X,4V,7P,"+"7O,7N,89,53,51,7M,2A,"+"5o,7L,7K,8d,3e").1R(","),H(i,b){D.17[b]=H(a){I a?7.2O(b,a):7.1P(b)}});J F=H(a,c){J b=a.4k;1B(b&&b!=c)1U{b=b.1d}1V(3e){b=c}I b==c};D(1b).2O("4X",H(){D("*").1e(S).4e()});D.17.1l({67:D.17.43,43:H(g,d,c){G(1j g!=\'23\')I 7.67(g);J e=g.1h(" ");G(e>=0){J i=g.3s(e,g.K);g=g.3s(0,e)}c=c||H(){};J f="2P";G(d)G(D.1D(d)){c=d;d=U}N{d=D.3n(d);f="6g"}J h=7;D.3Y({1a:g,O:f,1O:"2K",L:d,1J:H(a,b){G(b=="1W"||b=="7J")h.2K(i?D("<1v/>").3v(a.4U.1o(/<1m(.|\\s)*?\\/1m>/g,"")).2q(i):a.4U);h.P(c,[a.4U,b,a])}});I 7},aL:H(){I D.3n(7.7I())},7I:H(){I 7.2l(H(){I D.Y(7,"3V")?D.2d(7.aH):7}).1E(H(){I 7.34&&!7.3R&&(7.4J||/2A|6y/i.11(7.Y)||/1r|1G|3Q/i.11(7.O))}).2l(H(i,c){J b=D(7).6e();I b==U?U:b.1q==2p?D.2l(b,H(a,i){I{34:c.34,2x:a}}):{34:c.34,2x:b}}).3p()}});D.P("7H,7G,7F,7D,7C,7B".1R(","),H(i,o){D.17[o]=H(f){I 7.2O(o,f)}});J B=1z();D.1l({3p:H(d,b,a,c){G(D.1D(b)){a=b;b=U}I D.3Y({O:"2P",1a:d,L:b,1W:a,1O:c})},aE:H(b,a){I D.3p(b,U,a,"1m")},aD:H(c,b,a){I D.3p(c,b,a,"3z")},aC:H(d,b,a,c){G(D.1D(b)){a=b;b={}}I D.3Y({O:"6g",1a:d,L:b,1W:a,1O:c})},aA:H(a){D.1l(D.60,a)},60:{1a:5Z.5Q,26:M,O:"2P",2T:0,7z:"4R/x-ax-3V-aw",7x:M,31:M,L:U,5Y:U,3Q:U,4Q:{2N:"4R/2N, 1r/2N",2K:"1r/2K",1m:"1r/4t, 4R/4t",3z:"4R/3z, 1r/4t",1r:"1r/as",4w:"*/*"}},4z:{},3Y:H(s){s=D.1l(M,s,D.1l(M,{},D.60,s));J g,2Z=/=\\?(&|$)/g,1u,L,O=s.O.2r();G(s.L&&s.7x&&1j s.L!="23")s.L=D.3n(s.L);G(s.1O=="4P"){G(O=="2P"){G(!s.1a.1I(2Z))s.1a+=(s.1a.1I(/\\?/)?"&":"?")+(s.4P||"7u")+"=?"}N G(!s.L||!s.L.1I(2Z))s.L=(s.L?s.L+"&":"")+(s.4P||"7u")+"=?";s.1O="3z"}G(s.1O=="3z"&&(s.L&&s.L.1I(2Z)||s.1a.1I(2Z))){g="4P"+B++;G(s.L)s.L=(s.L+"").1o(2Z,"="+g+"$1");s.1a=s.1a.1o(2Z,"="+g+"$1");s.1O="1m";1b[g]=H(a){L=a;1W();1J();1b[g]=12;1U{2U 1b[g]}1V(e){}G(i)i.37(h)}}G(s.1O=="1m"&&s.1Y==U)s.1Y=Q;G(s.1Y===Q&&O=="2P"){J j=1z();J k=s.1a.1o(/(\\?|&)3m=.*?(&|$)/,"$ap="+j+"$2");s.1a=k+((k==s.1a)?(s.1a.1I(/\\?/)?"&":"?")+"3m="+j:"")}G(s.L&&O=="2P"){s.1a+=(s.1a.1I(/\\?/)?"&":"?")+s.L;s.L=U}G(s.26&&!D.4O++)D.W.1P("7H");J n=/^(?:\\w+:)?\\/\\/([^\\/?#]+)/;G(s.1O=="1m"&&O=="2P"&&n.11(s.1a)&&n.2D(s.1a)[1]!=5Z.al){J i=S.3H("6w")[0];J h=S.3h("1m");h.4d=s.1a;G(s.7t)h.aj=s.7t;G(!g){J l=Q;h.ah=h.ag=H(){G(!l&&(!7.3f||7.3f=="68"||7.3f=="1J")){l=M;1W();1J();i.37(h)}}}i.3U(h);I 12}J m=Q;J c=1b.7s?2B 7s("ae.ac"):2B 7r();G(s.5Y)c.6R(O,s.1a,s.31,s.5Y,s.3Q);N c.6R(O,s.1a,s.31);1U{G(s.L)c.4B("ab-aa",s.7z);G(s.5S)c.4B("a9-5R-a8",D.4z[s.1a]||"a7, a6 a5 a4 5N:5N:5N a2");c.4B("X-9Z-9Y","7r");c.4B("9W",s.1O&&s.4Q[s.1O]?s.4Q[s.1O]+", */*":s.4Q.4w)}1V(e){}G(s.7m&&s.7m(c,s)===Q){s.26&&D.4O--;c.7l();I Q}G(s.26)D.W.1P("7B",[c,s]);J d=H(a){G(!m&&c&&(c.3f==4||a=="2T")){m=M;G(f){7k(f);f=U}1u=a=="2T"&&"2T"||!D.7j(c)&&"3e"||s.5S&&D.7h(c,s.1a)&&"7J"||"1W";G(1u=="1W"){1U{L=D.6X(c,s.1O,s.9S)}1V(e){1u="5J"}}G(1u=="1W"){J b;1U{b=c.5I("7g-5R")}1V(e){}G(s.5S&&b)D.4z[s.1a]=b;G(!g)1W()}N D.5H(s,c,1u);1J();G(s.31)c=U}};G(s.31){J f=4I(d,13);G(s.2T>0)3B(H(){G(c){c.7l();G(!m)d("2T")}},s.2T)}1U{c.9P(s.L)}1V(e){D.5H(s,c,U,e)}G(!s.31)d();H 1W(){G(s.1W)s.1W(L,1u);G(s.26)D.W.1P("7C",[c,s])}H 1J(){G(s.1J)s.1J(c,1u);G(s.26)D.W.1P("7F",[c,s]);G(s.26&&!--D.4O)D.W.1P("7G")}I c},5H:H(s,a,b,e){G(s.3e)s.3e(a,b,e);G(s.26)D.W.1P("7D",[a,s,e])},4O:0,7j:H(a){1U{I!a.1u&&5Z.9O=="5p:"||(a.1u>=7e&&a.1u<9N)||a.1u==7c||a.1u==9K||D.14.2k&&a.1u==12}1V(e){}I Q},7h:H(a,c){1U{J b=a.5I("7g-5R");I a.1u==7c||b==D.4z[c]||D.14.2k&&a.1u==12}1V(e){}I Q},6X:H(a,c,b){J d=a.5I("9J-O"),2N=c=="2N"||!c&&d&&d.1h("2N")>=0,L=2N?a.9I:a.4U;G(2N&&L.1C.2j=="5J")7p"5J";G(b)L=b(L,c);G(c=="1m")D.5u(L);G(c=="3z")L=6u("("+L+")");I L},3n:H(a){J s=[];G(a.1q==2p||a.5w)D.P(a,H(){s.1p(3u(7.34)+"="+3u(7.2x))});N R(J j 1n a)G(a[j]&&a[j].1q==2p)D.P(a[j],H(){s.1p(3u(j)+"="+3u(7))});N s.1p(3u(j)+"="+3u(D.1D(a[j])?a[j]():a[j]));I s.6s("&").1o(/%20/g,"+")}});D.17.1l({1N:H(c,b){I c?7.2g({1Z:"1N",2h:"1N",1y:"1N"},c,b):7.1E(":1G").P(H(){7.V.18=7.5D||"";G(D.1g(7,"18")=="2F"){J a=D("<"+7.2j+" />").6P("1c");7.V.18=a.1g("18");G(7.V.18=="2F")7.V.18="3I";a.21()}}).3l()},1M:H(b,a){I b?7.2g({1Z:"1M",2h:"1M",1y:"1M"},b,a):7.1E(":4j").P(H(){7.5D=7.5D||D.1g(7,"18");7.V.18="2F"}).3l()},78:D.17.2m,2m:H(a,b){I D.1D(a)&&D.1D(b)?7.78.1w(7,19):a?7.2g({1Z:"2m",2h:"2m",1y:"2m"},a,b):7.P(H(){D(7)[D(7).3F(":1G")?"1N":"1M"]()})},9G:H(b,a){I 7.2g({1Z:"1N"},b,a)},9F:H(b,a){I 7.2g({1Z:"1M"},b,a)},9E:H(b,a){I 7.2g({1Z:"2m"},b,a)},9D:H(b,a){I 7.2g({1y:"1N"},b,a)},9M:H(b,a){I 7.2g({1y:"1M"},b,a)},9C:H(c,a,b){I 7.2g({1y:a},c,b)},2g:H(k,j,i,g){J h=D.77(j,i,g);I 7[h.36===Q?"P":"36"](H(){G(7.16!=1)I Q;J f=D.1l({},h),p,1G=D(7).3F(":1G"),46=7;R(p 1n k){G(k[p]=="1M"&&1G||k[p]=="1N"&&!1G)I f.1J.1k(7);G(p=="1Z"||p=="2h"){f.18=D.1g(7,"18");f.33=7.V.33}}G(f.33!=U)7.V.33="1G";f.45=D.1l({},k);D.P(k,H(c,a){J e=2B D.28(46,f,c);G(/2m|1N|1M/.11(a))e[a=="2m"?1G?"1N":"1M":a](k);N{J b=a.6r().1I(/^([+-]=)?([\\d+-.]+)(.*)$/),2b=e.1t(M)||0;G(b){J d=3d(b[2]),2M=b[3]||"2X";G(2M!="2X"){46.V[c]=(d||1)+2M;2b=((d||1)/e.1t(M))*2b;46.V[c]=2b+2M}G(b[1])d=((b[1]=="-="?-1:1)*d)+2b;e.3G(2b,d,2M)}N e.3G(2b,a,"")}});I M})},36:H(a,b){G(D.1D(a)||(a&&a.1q==2p)){b=a;a="28"}G(!a||(1j a=="23"&&!b))I A(7[0],a);I 7.P(H(){G(b.1q==2p)A(7,a,b);N{A(7,a).1p(b);G(A(7,a).K==1)b.1k(7)}})},9X:H(b,c){J a=D.3O;G(b)7.36([]);7.P(H(){R(J i=a.K-1;i>=0;i--)G(a[i].T==7){G(c)a[i](M);a.7n(i,1)}});G(!c)7.5A();I 7}});J A=H(b,c,a){G(b){c=c||"28";J q=D.L(b,c+"36");G(!q||a)q=D.L(b,c+"36",D.2d(a))}I q};D.17.5A=H(a){a=a||"28";I 7.P(H(){J q=A(7,a);q.4s();G(q.K)q[0].1k(7)})};D.1l({77:H(b,a,c){J d=b&&b.1q==a0?b:{1J:c||!c&&a||D.1D(b)&&b,2u:b,41:c&&a||a&&a.1q!=9t&&a};d.2u=(d.2u&&d.2u.1q==4L?d.2u:D.28.5K[d.2u])||D.28.5K.74;d.5M=d.1J;d.1J=H(){G(d.36!==Q)D(7).5A();G(D.1D(d.5M))d.5M.1k(7)};I d},41:{73:H(p,n,b,a){I b+a*p},5P:H(p,n,b,a){I((-29.9r(p*29.9q)/2)+0.5)*a+b}},3O:[],48:U,28:H(b,c,a){7.15=c;7.T=b;7.1i=a;G(!c.3Z)c.3Z={}}});D.28.44={4D:H(){G(7.15.2Y)7.15.2Y.1k(7.T,7.1z,7);(D.28.2Y[7.1i]||D.28.2Y.4w)(7);G(7.1i=="1Z"||7.1i=="2h")7.T.V.18="3I"},1t:H(a){G(7.T[7.1i]!=U&&7.T.V[7.1i]==U)I 7.T[7.1i];J r=3d(D.1g(7.T,7.1i,a));I r&&r>-9p?r:3d(D.2a(7.T,7.1i))||0},3G:H(c,b,d){7.5V=1z();7.2b=c;7.3l=b;7.2M=d||7.2M||"2X";7.1z=7.2b;7.2S=7.4N=0;7.4D();J e=7;H t(a){I e.2Y(a)}t.T=7.T;D.3O.1p(t);G(D.48==U){D.48=4I(H(){J a=D.3O;R(J i=0;i<a.K;i++)G(!a[i]())a.7n(i--,1);G(!a.K){7k(D.48);D.48=U}},13)}},1N:H(){7.15.3Z[7.1i]=D.1K(7.T.V,7.1i);7.15.1N=M;7.3G(0,7.1t());G(7.1i=="2h"||7.1i=="1Z")7.T.V[7.1i]="9m";D(7.T).1N()},1M:H(){7.15.3Z[7.1i]=D.1K(7.T.V,7.1i);7.15.1M=M;7.3G(7.1t(),0)},2Y:H(a){J t=1z();G(a||t>7.15.2u+7.5V){7.1z=7.3l;7.2S=7.4N=1;7.4D();7.15.45[7.1i]=M;J b=M;R(J i 1n 7.15.45)G(7.15.45[i]!==M)b=Q;G(b){G(7.15.18!=U){7.T.V.33=7.15.33;7.T.V.18=7.15.18;G(D.1g(7.T,"18")=="2F")7.T.V.18="3I"}G(7.15.1M)7.T.V.18="2F";G(7.15.1M||7.15.1N)R(J p 1n 7.15.45)D.1K(7.T.V,p,7.15.3Z[p])}G(b)7.15.1J.1k(7.T);I Q}N{J n=t-7.5V;7.4N=n/7.15.2u;7.2S=D.41[7.15.41||(D.41.5P?"5P":"73")](7.4N,n,0,1,7.15.2u);7.1z=7.2b+((7.3l-7.2b)*7.2S);7.4D()}I M}};D.1l(D.28,{5K:{9l:9j,9i:7e,74:9g},2Y:{2e:H(a){a.T.2e=a.1z},2c:H(a){a.T.2c=a.1z},1y:H(a){D.1K(a.T.V,"1y",a.1z)},4w:H(a){a.T.V[a.1i]=a.1z+a.2M}}});D.17.2i=H(){J b=0,1S=0,T=7[0],3q;G(T)ao(D.14){J d=T.1d,4a=T,1s=T.1s,1Q=T.2z,5U=2k&&3r(5B)<9c&&!/9a/i.11(v),1g=D.2a,3c=1g(T,"30")=="3c";G(T.7y){J c=T.7y();1e(c.1A+29.2f(1Q.1C.2e,1Q.1c.2e),c.1S+29.2f(1Q.1C.2c,1Q.1c.2c));1e(-1Q.1C.6b,-1Q.1C.6a)}N{1e(T.5X,T.5W);1B(1s){1e(1s.5X,1s.5W);G(42&&!/^t(98|d|h)$/i.11(1s.2j)||2k&&!5U)2C(1s);G(!3c&&1g(1s,"30")=="3c")3c=M;4a=/^1c$/i.11(1s.2j)?4a:1s;1s=1s.1s}1B(d&&d.2j&&!/^1c|2K$/i.11(d.2j)){G(!/^96|1T.*$/i.11(1g(d,"18")))1e(-d.2e,-d.2c);G(42&&1g(d,"33")!="4j")2C(d);d=d.1d}G((5U&&(3c||1g(4a,"30")=="5x"))||(42&&1g(4a,"30")!="5x"))1e(-1Q.1c.5X,-1Q.1c.5W);G(3c)1e(29.2f(1Q.1C.2e,1Q.1c.2e),29.2f(1Q.1C.2c,1Q.1c.2c))}3q={1S:1S,1A:b}}H 2C(a){1e(D.2a(a,"6V",M),D.2a(a,"6U",M))}H 1e(l,t){b+=3r(l,10)||0;1S+=3r(t,10)||0}I 3q};D.17.1l({30:H(){J a=0,1S=0,3q;G(7[0]){J b=7.1s(),2i=7.2i(),4c=/^1c|2K$/i.11(b[0].2j)?{1S:0,1A:0}:b.2i();2i.1S-=25(7,\'94\');2i.1A-=25(7,\'aF\');4c.1S+=25(b,\'6U\');4c.1A+=25(b,\'6V\');3q={1S:2i.1S-4c.1S,1A:2i.1A-4c.1A}}I 3q},1s:H(){J a=7[0].1s;1B(a&&(!/^1c|2K$/i.11(a.2j)&&D.1g(a,\'30\')==\'93\'))a=a.1s;I D(a)}});D.P([\'5e\',\'5G\'],H(i,b){J c=\'4y\'+b;D.17[c]=H(a){G(!7[0])I;I a!=12?7.P(H(){7==1b||7==S?1b.92(!i?a:D(1b).2e(),i?a:D(1b).2c()):7[c]=a}):7[0]==1b||7[0]==S?46[i?\'aI\':\'aJ\']||D.71&&S.1C[c]||S.1c[c]:7[0][c]}});D.P(["6N","4b"],H(i,b){J c=i?"5e":"5G",4f=i?"6k":"6i";D.17["5s"+b]=H(){I 7[b.3y()]()+25(7,"57"+c)+25(7,"57"+4f)};D.17["90"+b]=H(a){I 7["5s"+b]()+25(7,"2C"+c+"4b")+25(7,"2C"+4f+"4b")+(a?25(7,"6S"+c)+25(7,"6S"+4f):0)}})})();',62,669,'|||||||this|||||||||||||||||||||||||||||||||||if|function|return|var|length|data|true|else|type|each|false|for|document|elem|null|style|event||nodeName|||test|undefined||browser|options|nodeType|fn|display|arguments|url|window|body|parentNode|add|msie|css|indexOf|prop|typeof|call|extend|script|in|replace|push|constructor|text|offsetParent|cur|status|div|apply|firstChild|opacity|now|left|while|documentElement|isFunction|filter|className|hidden|handle|match|complete|attr|ret|hide|show|dataType|trigger|doc|split|top|table|try|catch|success|break|cache|height||remove|tbody|string|guid|num|global|ready|fx|Math|curCSS|start|scrollTop|makeArray|scrollLeft|max|animate|width|offset|tagName|safari|map|toggle||done|Array|find|toUpperCase|button|special|duration|id|copy|value|handler|ownerDocument|select|new|border|exec|stack|none|opera|nextSibling|pushStack|target|html|inArray|unit|xml|bind|GET|isReady|merge|pos|timeout|delete|one|selected|px|step|jsre|position|async|preventDefault|overflow|name|which|queue|removeChild|namespace|insertBefore|nth|removeData|fixed|parseFloat|error|readyState|multiFilter|createElement|rl|re|trim|end|_|param|first|get|results|parseInt|slice|childNodes|encodeURIComponent|append|events|elems|toLowerCase|json|readyList|setTimeout|grep|mouseenter|color|is|custom|getElementsByTagName|block|stopPropagation|addEventListener|callee|proxy|mouseleave|timers|defaultView|password|disabled|last|has|appendChild|form|domManip|props|ajax|orig|set|easing|mozilla|load|prototype|curAnim|self|charCode|timerId|object|offsetChild|Width|parentOffset|src|unbind|br|currentStyle|clean|float|visible|relatedTarget|previousSibling|handlers|isXMLDoc|on|setup|nodeIndex|unique|shift|javascript|child|RegExp|_default|deep|scroll|lastModified|teardown|setRequestHeader|timeStamp|update|empty|tr|getAttribute|innerHTML|setInterval|checked|fromElement|Number|jQuery|state|active|jsonp|accepts|application|dir|input|responseText|click|styleSheets|unload|not|lastToggle|outline|mouseout|getPropertyValue|mouseover|getComputedStyle|bindReady|String|padding|pageX|metaKey|keyCode|getWH|andSelf|clientX|Left|all|visibility|container|index|init|triggered|removeAttribute|classFilter|prevObject|submit|file|after|windowData|inner|client|globalEval|sibling|jquery|absolute|clone|wrapAll|dequeue|version|triggerHandler|oldblock|ctrlKey|createTextNode|Top|handleError|getResponseHeader|parsererror|speeds|checkbox|old|00|radio|swing|href|Modified|ifModified|lastChild|safari2|startTime|offsetTop|offsetLeft|username|location|ajaxSettings|getElementById|isSimple|values|selectedIndex|runtimeStyle|rsLeft|_load|loaded|DOMContentLoaded|clientTop|clientLeft|toElement|srcElement|val|pageY|POST|unshift|Bottom|clientY|Right|fix|exclusive|detachEvent|cloneNode|removeEventListener|swap|toString|join|attachEvent|eval|substr|head|parse|textarea|reset|image|zoom|odd|even|before|prepend|exclude|expr|quickClass|quickID|uuid|quickChild|continue|Height|textContent|appendTo|contents|open|margin|evalScript|borderTopWidth|borderLeftWidth|parent|httpData|setArray|CSS1Compat|compatMode|boxModel|cssFloat|linear|def|webkit|nodeValue|speed|_toggle|eq|100|replaceWith|304|concat|200|alpha|Last|httpNotModified|getAttributeNode|httpSuccess|clearInterval|abort|beforeSend|splice|styleFloat|throw|colgroup|XMLHttpRequest|ActiveXObject|scriptCharset|callback|fieldset|multiple|processData|getBoundingClientRect|contentType|link|ajaxSend|ajaxSuccess|ajaxError|col|ajaxComplete|ajaxStop|ajaxStart|serializeArray|notmodified|keypress|keydown|change|mouseup|mousedown|dblclick|focus|blur|stylesheet|hasClass|rel|doScroll|black|hover|solid|cancelBubble|returnValue|wheelDelta|view|round|shiftKey|resize|screenY|screenX|relatedNode|mousemove|prevValue|originalTarget|offsetHeight|keyup|newValue|offsetWidth|eventPhase|detail|currentTarget|cancelable|bubbles|attrName|attrChange|altKey|originalEvent|charAt|0n|substring|animated|header|noConflict|line|enabled|innerText|contains|only|weight|font|gt|lt|uFFFF|u0128|size|417|Boolean|Date|toggleClass|removeClass|addClass|removeAttr|replaceAll|insertAfter|prependTo|wrap|contentWindow|contentDocument|iframe|children|siblings|prevAll|wrapInner|nextAll|outer|prev|scrollTo|static|marginTop|next|inline|parents|able|cellSpacing|adobeair|cellspacing|522|maxLength|maxlength|readOnly|400|readonly|fast|600|class|slow|1px|htmlFor|reverse|10000|PI|cos|compatible|Function|setData|ie|ra|it|rv|getData|userAgent|navigator|fadeTo|fadeIn|slideToggle|slideUp|slideDown|ig|responseXML|content|1223|NaN|fadeOut|300|protocol|send|setAttribute|option|dataFilter|cssText|changed|be|Accept|stop|With|Requested|Object|can|GMT|property|1970|Jan|01|Thu|Since|If|Type|Content|XMLHTTP|th|Microsoft|td|onreadystatechange|onload|cap|charset|colg|host|tfoot|specified|with|1_|thead|leg|plain|attributes|opt|embed|urlencoded|www|area|hr|ajaxSetup|meta|post|getJSON|getScript|marginLeft|img|elements|pageYOffset|pageXOffset|abbr|serialize|pixelLeft'.split('|'),0,{}))
\ No newline at end of file
+++ /dev/null
-<?php
-define('_NP_EZCOMMENT2_DESC', 'Insert a comment form and a list of comments.'
- . 'Usage : <%EzComment2(mode, amount/list order/show order, destinationurl, Form Template, ListTemplate)%>'
- . ' on your ITEM skin or template.'
- . 'When "list order" is made more than 1, a comment equals descending order in the date and time.'
- . 'When "show order" is made more than 1, a comment is indicated first. When it\'s made 0, the form is indicated first.');
-
-define('_NP_EZCOMMENT2_FORM_TEMPLATES', 'NP_EzComment2 CommentForm Template');
-define('_NP_EZCOMMENT2_FORM_LOGGEDIN_IDX', 'Comment form for loggedin(for idex page)');
-define('_NP_EZCOMMENT2_FORM_NOTLOGGEDIN_IDX', 'Comment form for not loggedin(for idex page)');
-define('_NP_EZCOMMENT2_FORM_LOGGEDIN_ITM', 'Comment form for loggedin(for item page)');
-define('_NP_EZCOMMENT2_FORM_NOTLOGGEDIN_ITM', 'Comment form for not loggedin(for item page)');
-define('_NP_EZCOMMENT2_COMMENTS_BODY_IDX', 'Comments body(for idex page)');
-define('_NP_EZCOMMENT2_COMMENTS_HEADER_IDX', 'Comments header(for idex page)');
-define('_NP_EZCOMMENT2_COMMENTS_FOOTER_IDX', 'Comments footer(for idex page)');
-
-define('_NP_EZCOMMENT2_OP_SECRETMODE', 'Is the secret mode made effective ?');
-define('_NP_EZCOMMENT2_OP_SUBSTIUTION', 'Substitution seacret comment.');
-define('_NP_EZCOMMENT2_OP_CHECKLABEL', 'Label in a check box.');
-define('_NP_EZCOMMENT2_OP_DROPTABLE', 'When uninstalling, is a table eliminated ?');
-define('_NP_EZCOMMENT2_OP_SUBSTIUTION_VAL', 'Only an administrator can read this comment.');
-define('_NP_EZCOMMENT2_OP_CHECKLABEL_VAL', 'Indication is permitted only an administrator.');
+++ /dev/null
-<?php
-define('_NP_EZCOMMENT2_DESC', '¥³¥á¥ó¥È¥ê¥¹¥È¤È¥³¥á¥ó¥È¥Õ¥©¡¼¥à¤òɽ¼¨¤·¤Þ¤¹.<br />'
- . '¡Ø¸ÄÊÌ¥¢¥¤¥Æ¥à¥Ú¡¼¥¸¡Ù¤Î¥¹¥¥ó¡¢¤Þ¤¿¤Ï¥Æ¥ó¥×¥ì¡¼¥È¤Ë<br />'
- . '<%EzComment2(mode, amount/list order/show order, destinationurl, Form Template, ListTemplate)%><br />'
- . '¤Èµ½Ò¤·¤Þ¤¹.');
-
-define('_NP_EZCOMMENT2_FORM_TEMPLATES', 'NP_EzComment2ÍÑ¥³¥á¥ó¥È¥Õ¥©¡¼¥à¤Î¥Æ¥ó¥×¥ì¡¼¥È');
-define('_NP_EZCOMMENT2_FORM_LOGGEDIN_IDX', '¥á¥ó¥Ð¡¼¤¬¥í¥°¥¤¥ó¤·¤Æ¤¤¤ë¤È¤¤Ëɽ¼¨¤µ¤ì¤ë¥Õ¥©¡¼¥à(¡Ø¥á¥¤¥ó¤ÎÌܼ¡¥Ú¡¼¥¸¡ÙÍÑ)');
-define('_NP_EZCOMMENT2_FORM_NOTLOGGEDIN_IDX', '¥í¥°¥¤¥ó¤·¤Æ¤¤¤Ê¤¤¥á¥ó¥Ð¡¼¡¢¤Þ¤¿¤Ï¥²¥¹¥È¤Ëɽ¼¨¤µ¤ì¤ë¥Õ¥©¡¼¥à(¡Ø¥á¥¤¥ó¤ÎÌܼ¡¥Ú¡¼¥¸¡ÙÍÑ)');
-define('_NP_EZCOMMENT2_FORM_LOGGEDIN_ITM', '¥á¥ó¥Ð¡¼¤¬¥í¥°¥¤¥ó¤·¤Æ¤¤¤ë¤È¤¤Ëɽ¼¨¤µ¤ì¤ë¥Õ¥©¡¼¥à(¡Ø¸ÄÊÌ¥¢¥¤¥Æ¥à¥Ú¡¼¥¸¡ÙÍÑ)');
-define('_NP_EZCOMMENT2_FORM_NOTLOGGEDIN_ITM', '¥í¥°¥¤¥ó¤·¤Æ¤¤¤Ê¤¤¥á¥ó¥Ð¡¼¡¢¤Þ¤¿¤Ï¥²¥¹¥È¤Ëɽ¼¨¤µ¤ì¤ë¥Õ¥©¡¼¥à(¡Ø¸ÄÊÌ¥¢¥¤¥Æ¥à¥Ú¡¼¥¸¡ÙÍÑ)');
-define('_NP_EZCOMMENT2_COMMENTS_BODY_IDX', '¥³¥á¥ó¥È¤ÎËÜÂÎ(¡Ø¥á¥¤¥ó¤ÎÌܼ¡¥Ú¡¼¥¸¡ÙÍÑ)');
-define('_NP_EZCOMMENT2_COMMENTS_HEADER_IDX', '¥³¥á¥ó¥È¤Î¥Ø¥Ã¥À¡¼(¡Ø¥á¥¤¥ó¤ÎÌܼ¡¥Ú¡¼¥¸¡ÙÍÑ)');
-define('_NP_EZCOMMENT2_COMMENTS_FOOTER_IDX', '¥³¥á¥ó¥È¤Î¥Õ¥Ã¥¿¡¼(¡Ø¥á¥¤¥ó¤ÎÌܼ¡¥Ú¡¼¥¸¡ÙÍÑ)');
-
-define('_NP_EZCOMMENT2_OP_SECRETMODE', '\8e¢¥Ê¥¤¥·¥ç¥³¥á¥ó¥È\8e£¤ò͸ú¤Ë¤·¤Þ¤¹¤«¡©');
-define('_NP_EZCOMMENT2_OP_SUBSTIUTION', '\8e¢¥Ê¥¤¥·¥ç¥³¥á¥ó¥È\8e£¤ÎÂåÂØ¥³¥á¥ó¥È');
-define('_NP_EZCOMMENT2_OP_CHECKLABEL', '¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤Î¥é¥Ù¥ë');
-define('_NP_EZCOMMENT2_OP_DROPTABLE', '¥¢¥ó¥¤¥ó¥¹¥È¡¼¥ë¤Î»þ¤Ë¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤é¥Æ¡¼¥Ö¥ë¤òºï½ü¤·¤Þ¤¹¤«¡©');
-define('_NP_EZCOMMENT2_OP_SUBSTIUTION_VAL', '¤³¤Î¥³¥á¥ó¥È¤Ï´ÉÍý¼Ô¤Î¤ß±ÜÍ÷¤Ç¤¤Þ¤¹');
-define('_NP_EZCOMMENT2_OP_CHECKLABEL_VAL', '´ÉÍý¼Ô¤Ë¤À¤±É½¼¨¤òµö²Ä¤¹¤ë');
+++ /dev/null
-<?php
-define('_NP_EZCOMMENT2_DESC', 'コメントリストとコメントフォームを表示します.<br />'
- . '『個別アイテムページ』のスキン、またはテンプレートに<br />'
- . '<%EzComment2(mode, amount/list order/show order, destinationurl, Form Template, ListTemplate)%><br />'
- . 'と記述します.');
-
-define('_NP_EZCOMMENT2_FORM_TEMPLATES', 'NP_EzComment2用コメントフォームのテンプレート');
-define('_NP_EZCOMMENT2_FORM_LOGGEDIN_IDX', 'メンバーがログインしているときに表示されるフォーム(『メインの目次ページ』用)');
-define('_NP_EZCOMMENT2_FORM_NOTLOGGEDIN_IDX', 'ログインしていないメンバー、またはゲストに表示されるフォーム(『メインの目次ページ』用)');
-define('_NP_EZCOMMENT2_FORM_LOGGEDIN_ITM', 'メンバーがログインしているときに表示されるフォーム(『個別アイテムページ』用)');
-define('_NP_EZCOMMENT2_FORM_NOTLOGGEDIN_ITM', 'ログインしていないメンバー、またはゲストに表示されるフォーム(『個別アイテムページ』用)');
-define('_NP_EZCOMMENT2_COMMENTS_BODY_IDX', 'コメントの本体(『メインの目次ページ』用)');
-define('_NP_EZCOMMENT2_COMMENTS_HEADER_IDX', 'コメントのヘッダー(『メインの目次ページ』用)');
-define('_NP_EZCOMMENT2_COMMENTS_FOOTER_IDX', 'コメントのフッター(『メインの目次ページ』用)');
-
-define('_NP_EZCOMMENT2_OP_SECRETMODE', '「ナイショコメント」を有効にしますか?');
-define('_NP_EZCOMMENT2_OP_SUBSTIUTION', '「ナイショコメント」の代替コメント');
-define('_NP_EZCOMMENT2_OP_CHECKLABEL', 'チェックボックスのラベル');
-define('_NP_EZCOMMENT2_OP_DROPTABLE', 'アンインストールの時にデータベースからテーブルを削除しますか?');
-define('_NP_EZCOMMENT2_OP_SUBSTIUTION_VAL', 'このコメントは管理者のみ閲覧できます');
-define('_NP_EZCOMMENT2_OP_CHECKLABEL_VAL', '管理者にだけ表示を許可する');
+++ /dev/null
-<!-- Dialog -->
-<div class="yui-skin-sam">
- <div id="profile">
- <div class="hd">Please enter your profile</div>
- <div class="bd">
- <form method="POST" action="{{updateUrl}}?action=plugin">
- <label for="nick">Nickname:</label><input type="text" name="nick" value="{{nick}}" />
- <div class="clear"></div>
- <label for="email">E-mail:</label><input type="text" name="email" value="{{email}}"/>
- <div class="clear"></div>
- <input type="hidden" name="name" value="OpenId">
- <input type="hidden" name="type" value="updateProfile">
- </form>
- </div>
- </div>
-</div>
-
-<!-- response -->
-<div id="resp"></div>
+++ /dev/null
-<!-- Dialog -->
-<div class="yui-skin-sam">
-<div id="profile">
- <div class="hd">プロフィール更新</div>
- <div class="bd">
- <form method="POST" action="{{updateUrl}}?action=plugin">
- <label for="nick">お名前:</label><input type="text" name="nick" value="{{nick}}" />
- <div class="clear"></div>
- <label for="email">E-mail:</label><input type="text" name="email" value="{{email}}"/>
- <div class="clear"></div>
- <input type="hidden" name="name" value="OpenId">
- <input type="hidden" name="type" value="updateProfile">
- </form>
- </div>
-</div>
-</div>
-
-<!-- response -->
-<div id="resp"></div>
+++ /dev/null
-<!-- Dialog -->
-<div class="yui-skin-sam">
-<div id="profile">
- <div class="hd">プロフィール更新</div>
- <div class="bd">
- <form method="POST" action="{{updateUrl}}?action=plugin">
- <label for="nick">お名前:</label><input type="text" name="nick" value="{{nick}}" />
- <div class="clear"></div>
- <label for="email">E-mail:</label><input type="text" name="email" value="{{email}}"/>
- <div class="clear"></div>
- <input type="hidden" name="name" value="OpenId">
- <input type="hidden" name="type" value="updateProfile">
- </form>
- </div>
-</div>
-</div>
-
-<!-- response -->
-<div id="resp"></div>
+++ /dev/null
-<p>Thanks for signing in. Now you can comment or send mail. (<a href="{{url|}}" rel="nofollow">Sign out</a>)<br />
-Your OpenID identity: <img src="{{PluginURL}}openid/openid.png" /><strong>{{identity|}}</strong> <button id="show">Update Profile</button></p>
\ No newline at end of file
+++ /dev/null
-<p>OpenIDでログイン中です。(<a href="{{url|}}" rel="nofollow">ログアウト</a>)<br />
-OpenID identity: <img src="{{PluginURL}}openid/openid.png" /><strong>{{identity|}}</strong> <button id="show">プロフィール更新</button><br />
-もし、名前やemailの欄が空欄の場合にはプロフィール更新から変更してください。</p>
\ No newline at end of file
+++ /dev/null
-<p>OpenIDでログイン中です。(<a href="{{url|}}" rel="nofollow">ログアウト</a>)<br />
-OpenID identity: <img src="{{PluginURL}}openid/openid.png" /><strong>{{identity|}}</strong> <button id="show">プロフィール更新</button><br />
-もし、名前やemailの欄が空欄の場合にはプロフィール更新から変更してください。</p>
\ No newline at end of file
+++ /dev/null
-<!-- css -->
-<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.5.2/build/fonts/fonts-min.css" />
-<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.5.2/build/button/assets/skins/sam/button.css" />
-<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.5.2/build/container/assets/skins/sam/container.css" />
-
-<!-- js -->
-<script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/utilities/utilities.js"></script>
-<script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/button/button-min.js"></script>
-<script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/container/container-min.js"></script>
-<script type="text/javascript" src="{{PluginURL}}ezcomment2/jquery-1.2.6.pack.js"></script>
-
-<script type="text/javascript">
-YAHOO.namespace("openid.container");
-
-function init() {
- // Define various event handlers for Dialog
- var handleSubmit = function() {
- $("#resp").html('');
- this.submit();
- };
- var handleCancel = function() {
- $("#resp").html('');
- this.cancel();
- };
- var handleSuccess = function(o) {
- var param = eval( "(" + o.responseText + ")" );
- if( param['result'] == 'succeeded'){
- $('.nucleus_cf_name').val(param['nick'] + ' [OpenID]');
- $('.nucleus_cf_email').val(param['email']);
- $("#resp").html(param['message']);
- } else {
- $("#resp").html(param['message']);
- }
- };
- var handleFailure = function(o) {
- $("#resp").html("Error: " + o.status);
- };
-
- // Instantiate the Dialog
- YAHOO.openid.container.profile = new YAHOO.widget.Dialog("profile",
- { width : "30em",
- fixedcenter : true,
- visible : {{visible}},
- constraintoviewport : true,
- buttons : [ { text:"Submit", handler:handleSubmit, isDefault:true },
- { text:"Cancel", handler:handleCancel } ]
- });
-
- // Validate the entries in the form to require that both first and last name are entered
- YAHOO.openid.container.profile.validate = function() {
- var data = this.getData();
- if ( data.nick == "" ) {
- alert("Please enter your nickname.");
- return false;
- } else {
- return true;
- }
- };
-
- // Wire up the success and failure handlers
- YAHOO.openid.container.profile.callback = { success: handleSuccess,
- failure: handleFailure };
-
- // Render the Dialog
- YAHOO.openid.container.profile.render();
-
- YAHOO.util.Event.addListener("show", "click", YAHOO.openid.container.profile.show, YAHOO.openid.container.profile, true);
-}
-YAHOO.util.Event.onDOMReady(init);
-
-(function(){
- var onload_org = window.onload;
- window.onload = function(){
- if(onload_org) onload_org();
- var openidbox = $('.nucleus_cf_name,.nucleus_cf_email');
- $('.nucleus_cf_name').val('{{nick}} [OpenID]');
- $('.nucleus_cf_email').val('{{email}}');
- openidbox.css('background', '#FFC');
- openidbox.attr('readOnly', 'readOnly');
- }
-})()
-</script>
\ No newline at end of file
+++ /dev/null
-<nucleusskin>
- <meta>
- <template name="EzCommentTemplate" />
- <info><![CDATA[Comment list/form template for NP_EzComment2]]></info>
- </meta>
-
-
- <template name="EzCommentTemplate">
- <description>Default EzComment Template</description>
- <part name="FORM_LOGGEDIN_IDX"><![CDATA[<a class="nucleus_cf" id="nucleus_cf<%itemid%>"></a>
-<form method="post" action="#nucleus_cf<%itemid%>">
- <div class="commentform">
- <input type="hidden" name="action" value="addcomment" />
- <input type="hidden" name="url" value="<%formdata(destinationurl)%>" />
- <input type="hidden" name="itemid" value="<%itemid%>" />
- <%errordiv()%>
- <label for="nucleus_cf_body<%itemid%>"><%text(_COMMENTFORM_COMMENT)%></label>
- <textarea name="body" class="formfield" cols="40" rows="10" id="nucleus_cf_body<%itemid%>"><%formdata(body)%></textarea>
- <%text(_COMMENTFORM_YOUARE)%> <%formdata(membername)%>
- <small>(<a href="<%self()%>?action=logout" title="<%text(_LOGOUT)%>"><%text(_LOGOUT)%></a>)</small>
- <input type="submit" alt="<%text(_COMMENTFORM_SUBMIT)%>" value="<%text(_COMMENTFORM_SUBMIT)%>" class="formbutton" />
- <%callback(FormExtra,commentform-loggedin)%>
- </div>
-</form>
-]]></part>
-
- <part name="FORM_NOTLOGGEDIN_IDX"><![CDATA[<a class="nucleus_cf" id="nucleus_cf<%itemid%>"></a>
-<form method="post" action="#nucleus_cf<%itemid%>">
- <div class="commentform">
- <input type="hidden" name="action" value="addcomment" />
- <input type="hidden" name="url" value="<%formdata(destinationurl)%>" />
- <input type="hidden" name="itemid" value="<%itemid%>" /> <%errordiv()%>
- <label for="nucleus_cf_body<%itemid%>"><%text(_COMMENTFORM_COMMENT)%></label>
- <textarea name="body" class="formfield nucleus_cf_body" cols="40" rows="10" id="nucleus_cf_body<%itemid%>"><%formdata(body)%></textarea>
- <label for="nucleus_cf_name<%itemid%>"><%text(_COMMENTFORM_NAME)%></label>
- <input name="user" size="40" maxlength="40" value="<%formdata(user)%>" class="formfield nucleus_cf_name" id="nucleus_cf_name<%itemid%>" />
- <label for="nucleus_cf_mail<%itemid%>"><%text(_COMMENTFORM_MAIL)%></label>
- <input name="userid" size="40" maxlength="60" value="<%formdata(userid)%>" class="formfield nucleus_cf_mail" id="nucleus_cf_mail<%itemid%>" />
- <label for="nucleus_cf_email<%itemid%>"><%text(_COMMENTFORM_EMAIL)%></label>
- <input name="email" size="40" maxlength="100" value="<%formdata(email)%>" class="formfield nucleus_cf_email" id="nucleus_cf_email<%itemid%>" />
- <%callback(FormExtra,commentform-notloggedin)%>
- <input type="checkbox" value="1" name="remember" id="nucleus_cf_remember<%itemid%>" <%formdata(rememberchecked)%> />
- <label for="nucleus_cf_remember<%itemid%>"><%text(_COMMENTFORM_REMEMBER)%></label>
- <input type="submit" alt="<%text(_COMMENTFORM_SUBMIT)%>" value="<%text(_COMMENTFORM_SUBMIT)%>" class="formbutton" />
- </div>
-</form>
-]]></part>
-
- <part name="FORM_LOGGEDIN_ITM"><![CDATA[<a id="nucleus_cf"></a>
-<form method="post" action="#nucleus_cf">
- <div class="commentform">
- <input type="hidden" name="action" value="addcomment" />
- <input type="hidden" name="url" value="<%formdata(destinationurl)%>" />
- <input type="hidden" name="itemid" value="<%itemid%>" />
- <%errordiv()%>
- <label for="nucleus_cf_body"><%text(_COMMENTFORM_COMMENT)%></label>
- <textarea name="body" class="formfield" cols="40" rows="10" id="nucleus_cf_body"><%formdata(body)%></textarea>
- <%text(_COMMENTFORM_YOUARE)%> <%formdata(membername)%>
- <small>(<a href="<%self()%>?action=logout" title="<%text(_LOGOUT)%>"><%text(_LOGOUT)%></a>)</small>
- <input type="submit" alt="<%text(_COMMENTFORM_SUBMIT)%>" value="<%text(_COMMENTFORM_SUBMIT)%>" class="formbutton" />
- <%callback(FormExtra,commentform-loggedin)%>
- </div>
-</form>
-]]></part>
-
- <part name="FORM_NOTLOGGEDIN_ITM"><![CDATA[<a id="nucleus_cf"></a>
-<form method="post" action="#nucleus_cf">
- <div class="commentform">
- <input type="hidden" name="action" value="addcomment" />
- <input type="hidden" name="url" value="<%formdata(destinationurl)%>" />
- <input type="hidden" name="itemid" value="<%itemid%>" /> <%errordiv()%>
- <label for="nucleus_cf_body"><%text(_COMMENTFORM_COMMENT)%></label>
- <textarea name="body" class="formfield" cols="40" rows="10" id="nucleus_cf_body"><%formdata(body)%></textarea>
- <label for="nucleus_cf_name"><%text(_COMMENTFORM_NAME)%></label>
- <input name="user" size="40" maxlength="40" value="<%formdata(user)%>" class="formfield" id="nucleus_cf_name" />
- <label for="nucleus_cf_mail"><%text(_COMMENTFORM_MAIL)%></label>
- <input name="userid" size="40" maxlength="60" value="<%formdata(userid)%>" class="formfield" id="nucleus_cf_mail" />
- <label for="nucleus_cf_email"><%text(_COMMENTFORM_EMAIL)%></label>
- <input name="email" size="40" maxlength="100" value="<%formdata(email)%>" class="formfield" id="nucleus_cf_email" />
- <%callback(FormExtra,commentform-notloggedin)%>
- <input type="checkbox" value="1" name="remember" id="nucleus_cf_remember" <%formdata(rememberchecked)%> />
- <label for="nucleus_cf_remember"><%text(_COMMENTFORM_REMEMBER)%></label>
- <input type="submit" alt="<%text(_COMMENTFORM_SUBMIT)%>" value="<%text(_COMMENTFORM_SUBMIT)%>" class="formbutton" />
- </div>
-</form>
-]]></part>
-
- <part name="COMMENTS_HEADER_IDX"><![CDATA[<div class="commentlist">
---- <%viewparpost%> [ <a href="<%itemlink%>#comment">Show while sentence</a> ] ---
-<ul>]]></part>
-
- <part name="COMMENTS_BODY_IDX"><![CDATA[<li><a href="<%itemlink%>#c<%commentid%>"><%user(realname)%> : <%excerpt%></a></li>
-]]></part>
-
- <part name="COMMENTS_FOOTER_IDX"><![CDATA[</ul>
-</div>]]></part>
-
- <part name="COMMENTS_BODY"><![CDATA[<div class="itemcomment id<%memberid%>">
- <h3>
- <a href="<%userlinkraw%>" title="<%ip%> | Click to visit <%user%>'s website or send an email">
- <%user%>
- </a> wrote:
- </h3>
- <div class="commentbody">
- <%body%>
- </div>
- <div class="commentinfo">
- <%date%> <%time%>
- </div>
-</div>
-]]></part>
-
- <part name="COMMENTS_MANY"><![CDATA[Comments]]></part>
-
- <part name="COMMENTS_NONE"><![CDATA[No Comments yet.]]></part>
-
- <part name="COMMENTS_ONE"><![CDATA[Comment]]></part>
-
- <part name="STP_PLUGINNAME"><![CDATA[NP_EzComment2]]></part>
-
- </template>
-
-
-</nucleusskin>
\ No newline at end of file
+++ /dev/null
-<?php
-
-/** ============================================================================
- * GoogleSitemap for Nucleus
- *
- * Copyright 2005 by Niels Leenheer
- * ============================================================================
- * This program is free software and open source software; you can redistribute
- * it and/or modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the License,
- * or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit
- * http://www.gnu.org/licenses/gpl.html
- * ============================================================================
- **/
-
-/**
- * History
- * 0.7 modified release by shizuki
- * Generate URL modified from
- * 'http://example.com/action.php?action=plugin&name=Sitemap' to
- * 'http://example.com/sitemap.xml' and,or
- * 'http://example.com/index.php?virtualpath=sitemap.xml'
- * Add 'lastmod' attribute
- * 0.9 SitemapProtocol updated release
- * SitemapProtocol ver.0.9 as common for Google, Yahoo! and MSN(Live! Search)
- * 1.0 Add Sitemap type and chage 'lastmod' generate
- * Add 'ROR Sitemap' format
- * For details about the ROR format, go to www.rorweb.com
- * Modify 'lastmod' attribute
- * item posted time or comment posted time or item update time
- * item update time generate by NP_UpdateTime
- **/
-
-class NP_GoogleSitemap extends NucleusPlugin
-{
-
- function getName()
- {
- return 'GoogleSitemap';
- }
-
- function getAuthor()
- {
- return 'Niels Leenheer + shizuki';
- }
-
- function getURL()
- {
- return 'http://japan.nucleuscms.org/wiki/plugins:googlesitemap';
- }
-
- function getVersion()
- {
- return '1.0';
- }
-
- function getDescription()
- {
- return _G_SITEMAP_DESC;
- }
-
- function getEventList()
- {
- return array(
- 'PostAddItem',
- 'PreSendContentType'
- );
- }
-
- function supportsFeature($feature)
- {
- switch($feature) {
- case 'SqlTablePrefix':
- return 1;
- default:
- return 0;
- }
- }
-
- function event_PreSendContentType($data)
- {
- global $CONF, $manager, $blogid;
-
- $mcategories = $this->pluginCheck('MultipleCategories');
- if ($mcategories) {
- if (method_exists($mcategories, 'getRequestName')) {
- $subReq = $mcategories->getRequestName();
- } else {
- $subReq = 'subcatid';
- }
- }
- $npUpdateTime = $this->pluginCheck('UpdateTime');
-
- if (!$blogid) {
- $blogid = $CONF['DefaultBlog'];
- } else {
- if (is_numeric($blogid)) {
- $blogid = intval($blogid);
- } else {
- $blogid = intval(getBlogIDFromName($blogid));
- }
- }
-
- $b =& $manager->getBlog($blogid);
- $BlogURL = $b->getURL();
-
- if ( substr($BlogURL, -1) != '/'
- && substr($BlogURL, -4) != '.php') {
- $BlogURL .= '/';
- }
-
- if (getVar('virtualpath')) {
- $info = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', getVar('virtualpath'));
- } elseif (serverVar('PATH_INFO')) {
- $info = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', serverVar('PATH_INFO'));
- } else {
- return;
- }
-
- $path_arr = explode('/', $info);
- $PcMap = $this->getBlogOption($blogid, 'PcSitemap');
- $MobileMap = $this->getBlogOption($blogid, 'MobileSitemap');
- if ( end($path_arr) == $PcMap
- || end($path_arr) == 'ror.xml'
- || (!empty($MobileMap) && end($path_arr) == $MobileMap) ) {
- $sitemap = array();
- if ( $this->getOption('AllBlogMap') == 'yes'
- && $blogid == $CONF['DefaultBlog']) {
- $blogQuery = 'SELECT * '
- . 'FROM %s '
- . 'ORDER BY bnumber';
- $blogQuery = sprintf($blogQuery, sql_table('blog'));
- $blogResult = sql_query($blogQuery);
- } else {
- $blogQuery = 'SELECT * '
- . 'FROM %s '
- . 'WHERE bnumber = %d';
- $blogQuery = sprintf($blogQuery, sql_table('blog'), $blogid);
- $blogResult = sql_query($blogQuery);
- $currentBlog = TRUE;
- }
- while ($blogs = mysql_fetch_array($blogResult)) {
- $blog_id = intval($blogs['bnumber']);
- if ( $this->getBlogOption($blog_id, 'IncludeSitemap') == 'yes'
- || !empty($currentBlog)) {
- $temp_b =& $manager->getBlog($blog_id);
- $TempURL = $temp_b->getURL();
- $SelfURL = $TempURL;
-
- $URLMode = $CONF['URLMode'];
- if (substr($TempURL, -4) == '.php') {
- $CONF['URLMode'] = 'normal';
- }
-
- $usePathInfo = ($CONF['URLMode'] == 'pathinfo');
-
- if (substr($SelfURL, -1) == '/') {
-
- if ($usePathInfo) {
- $SelfURL = substr($SelfURL, 0, -1);
- } else {
- $SelfURL = $SelfURL . 'index.php';
- }
-
- } elseif (substr($SelfURL, -4) != '.php') {
-
- if ($usePathInfo) {
- $SelfURL = $SelfURL;
- } else {
- $SelfURL = $SelfURL . '/index.php';
- }
-
- }
-
- $CONF['ItemURL'] = $SelfURL;
- $CONF['CategoryURL'] = $SelfURL;
-
- if ( substr($TempURL, -1) != '/'
- && substr($TempURL, -4) != '.php') {
- $TempURL .= '/';
- }
-
- $patternURL = '/^' . preg_replace('/\//', '\/', $BlogURL) . '/';
-
- if (preg_match($patternURL, $TempURL)) {
-
- if (end($path_arr) == 'ror.xml') {
- $rorTitleURL = $this->_prepareLink($SelfURL, $TempURL);
- $rooTitleURL = htmlspecialchars($rooTitleURL, ENT_QUOTES, _CHARSET);
- $sitemapTitle = " <title>ROR Sitemap for " . $rorTitleURL . "</title>\n"
- . " <link>" . $rorTitleURL . "</link>\n"
- . " <item>\n"
- . " <title>ROR Sitemap for " . $rorTitleURL . "</title>\n"
- . " <link>" . $rorTitleURL . "</link>\n"
- . " <ror:about>sitemap</ror:about>\n"
- . " <ror:type>SiteMap</ror:type>\n"
- . " </item>\n";
- } else {
- $sitemap[] = array(
- 'loc' => $this->_prepareLink($SelfURL, $TempURL),
- 'priority' => '1.0',
- 'changefreq' => 'daily'
- );
- }
-
- $catQuery = 'SELECT * '
- . 'FROM %s '
- . 'WHERE cblog = %d '
- . 'ORDER BY catid';
- $catTable = sql_table('category');
- $catQuery = sprintf($catQuery, $catTable, $blog_id);
- $catResult = sql_query($catQuery);
-
- while ($cat = mysql_fetch_array($catResult)) {
-
- $cat_id = intval($cat['catid']);
- $Link = createCategoryLink($cat_id);
- $catLoc =$this->_prepareLink($SelfURL, $Link);
-
- if (end($path_arr) != 'ror.xml') {
- $sitemap[] = array(
- 'loc' => $catLoc,
- 'priority' => '1.0',
- 'changefreq' => 'daily'
- );
- }
-
- if ($mcategories) {
- $scatQuery = 'SELECT * '
- . 'FROM %s '
- . 'WHERE catid = %d '
-// . 'ORDER BY scatid';
- . 'ORDER BY ordid';
- $scatTable = sql_table('plug_multiple_categories_sub');
- $scatQuery = sprintf($scatQuery, $scatTable, $cat_id);
- $scatResult = sql_query($scatQuery);
-
- while ($scat = mysql_fetch_array($scatResult)) {
-
- $scat_id = intval($scat['scatid']);
- $params = array($subReq => $scat_id);
- $Link = createCategoryLink($cat_id, $params);
- $scatLoc = $this->_prepareLink($SelfURL, $Link);
-
- if (end($path_arr) != 'ror.xml') {
- $sitemap[] = array(
- 'loc' => $scatLoc,
- 'priority' => '1.0',
- 'changefreq' => 'daily'
- );
- }
-
- }
-
- }
-
- }
-
- $itemQuery = 'SELECT *, '
- . ' UNIX_TIMESTAMP(itime) AS timestamp '
- . 'FROM %s '
- . 'WHERE iblog = %d '
- . 'AND idraft = 0 '
- . 'ORDER BY itime DESC';
- $itemTable = sql_table('item');
- $itemQuery = sprintf($itemQuery, $itemTable, $blog_id);
- $itemResult = sql_query($itemQuery);
- while ($item = mysql_fetch_array($itemResult)) {
-
- $item_id = intval($item['inumber']);
- $Link = createItemLink($item_id);
- $tz = date('O', $item['timestamp']);
- $tz = substr($tz, 0, 3) . ':' . substr($tz, 3, 2);
- $itemLoc = $this->_prepareLink($SelfURL, $Link);
-
- $mdQuery = 'SELECT'
- . ' UNIX_TIMESTAMP(ctime) AS timestamp'
- . ' FROM '
- . sql_table('comment')
- . ' WHERE'
- . ' citem = ' . $item_id
- . ' ORDER BY'
- . ' ctime DESC'
- . ' LIMIT'
- . ' 1';
- $modTime = sql_query($mdQuery);
- if (mysql_num_rows($modTime) > 0) {
- $lastMod = mysql_fetch_object($modTime);
- $itemTime = $lastMod->timestamp;
- } elseif ($npUpdateTime) { // NP_UpdateTime exists
- $mdQuery = 'SELECT'
- . ' UNIX_TIMESTAMP(ctime) AS timestamp'
- . ' FROM '
- . sql_table('plugin_rectime')
- . ' WHERE'
- . ' up_id = ' . $item_id;
- $modTime = sql_query($mdQuery);
- if (mysql_num_rows($modTime) > 0) {
- $lastMod = mysql_fetch_object($modTime);
- $itemTime = $lastMod->timestamp;
- }
- } else {
- $itemTime = $item['timestamp'];
- }
-
-/* if (time() - $itemTime < 86400 * 2) {
- $fq = 'hourly';
- } elseif (time() - $itemTime < 86400 * 14) {
- $fq = 'daily';
- } elseif (time() - $itemTime < 86400 * 62) {
- $fq = 'weekly';
- } else {
- $fq = 'monthly';
- }*/
- if ($itemTime < strtotime('-1 month')) {
- $fq = 'monthly';
- } elseif ($itemTime < strtotime('-1 week')) {
- $fq = 'weekly';
- } elseif ($itemTime < strtotime('-1 day')) {
- $fq = 'daily';
- } else {
- $fq = 'hourly';
- }
- $lastmod = gmdate('Y-m-d\TH:i:s', $itemTime) . $tz;
-
- if (end($path_arr) != 'ror.xml') {
- $sitemap[] = array(
- 'loc' => $itemLoc,
- 'lastmod' => $lastmod,
- 'priority' => '1.0',
- 'changefreq' => $fq
- );
- } else {
- $iTitle = $item['ititle'];
- if (_CHARSET != 'UTF-8') {
- $iTitle = mb_conbert_encoding($iTitle, 'UTF-8', _CHARSET);
- }
- $sitemap[] = array(
- 'title' => $iTitle,
- 'link' => $itemLoc,
- 'ror:updated' => $lastmod,
- 'ror:updatePeriod' => 'day',
- 'ror:sortOrder' => '0',
- 'ror:resourceOf' => 'sitemap',
- );
- }
-
- }
-
- }
-
- }
-
- if ($CONF['URLMode'] != $URLMode) {
- $CONF['URLMode'] = $URLMode;
- }
-
- }
-
- $manager->notify('SiteMap', array ('sitemap' => & $sitemap));
-
- header ("Content-type: application/xml");
-
- if (end($path_arr) == 'ror.xml') {
-
- // ror sitemap feed
- $sitemapHeader ="<" . "?xml version='1.0' encoding='UTF-8'?" . ">\n\n"
- . "<!-- This file is a ROR Sitemap for describing this website to the search engines. "
- . "For details about the ROR format, go to www.rorweb.com. -->\n"
- . '<rss version="2.0" xmlns:ror="http://rorweb.com/0.1/" >' . "\n"
- . "<channel>\n";
-
- } else {
-
- // old Google sitemap protocol ver.0.84
-// $sitemapHeader = "<" . "?xml version='1.0' encoding='UTF-8'?" . ">\n\n";
-// . "\t<urlset" . ' xmlns="http://www.google.com/schemas/sitemap/0.84"' . "\n";
-// . "\t" . 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . "\n";
-// . "\t" . 'xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84' . "\n";
-// . "\t" . ' http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">' . "\n";
-
- // new sitemap common protocol ver 0.9
- $sitemapHeader = "<" . "?xml version='1.0' encoding='UTF-8'?" . ">\n\n"
- . '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . "\n"
- . ' xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9' . "\n"
- . ' http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"' . "\n"
- . ' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"';
- // uncomment and edit next line when you need "example_schema"
-// $sitemapHeader .= ' xmlns:example="http://www.example.com/schemas/example_schema"';
- $sitemapHeader .= '>';
-
- }
-
- echo $sitemapHeader;
- if (end($path_arr) == 'ror.xml') {
- echo $sitemapTitle;
- }
-
- while (list(, $url) = each($sitemap)) {
-
- if (end($path_arr) == 'ror.xml') {
- echo "\t<item>\n";
- } else {
- echo "\t<url>\n";
- }
-
- while (list($key, $value) = each($url)) {
- if ($key == 'loc') {
- $value = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', $value);
- $data = "\t\t<" . $key . ">"
- . htmlspecialchars($value, ENT_QUOTES, _CHARSET)
- . "</" . $key . ">\n";
- } else {
- $data = "\t\t<" . $key . ">"
- . htmlspecialchars($value, ENT_QUOTES, _CHARSET)
- . "</" . $key . ">\n";
- }
- echo $data;
- }
-
- if (end($path_arr) == 'ror.xml') {
- echo "\t</item>\n";
- } else {
- echo "\t</url>\n";
- }
-
- }
-
- if (end($path_arr) == 'ror.xml') {
- echo "</channel>\n</rss>\n";
- } else {
- echo "</urlset>\n";
- }
-// echo "</urlset>\n";
- exit;
-
- }
- }
-
- function pluginCheck($pluginName)
- {
- global $manager;
- if (!$manager->pluginInstalled('NP_' . $pluginName)) {
- return;
- } else {
- $plugin =& $manager->getPlugin('NP_' . $pluginName);
- return $plugin;
- }
- }
-
- function _prepareLink($base, $url) {
- if (substr($url, 0, 7) == 'http://') {
- return $url;
- } else {
- return $base . $url;
- }
- }
-
- function event_PostAddItem(&$data)
- {
- global $manager, $CONF;
-
- $item_id = intval($data['itemid']);
- $blog_id = intval(getBlogIDFromItemID($item_id));
-
- if ($this->getBlogOption($blog_id, 'PingGoogle') == 'yes') {
-
- $b =& $manager->getBlog($blog_id);
- $b_url = $b->getURL();
-
- if (substr($b_url, -4) == '.php') $CONF['URLMode'] = 'normal';
- $usePathInfo = ($CONF['URLMode'] == 'pathinfo');
-
- if (substr($b_url, -1) == '/') {
- if (!$usePathInfo) {
- $b_url .= 'index.php?virtualpath=';
- }
- } elseif (substr($b_url, -4) == '.php') {
- $b_url .= '?virtualpath=';
- } else {
- if ($usePathInfo) {
- $b_url = $b_url . '/';
- } else {
- $b_url = $b_url . '/index.php?virtualpath=';
- }
- }
-
- $siteMap = $this->getBlogOption($blog_id, 'PcSitemap');
- $url = 'http://www.google.com/webmasters/sitemaps/ping?sitemap='
- . urlencode($b_url . $siteMap);
- $url = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', $url);
- $fp = @fopen($url, 'r');
- @fclose($fp);
- $MobileMap = $this->getBlogOption($blog_id, 'MobileSitemap');
- if (!empty($MobileMap)) {
- $url = 'http://www.google.com/webmasters/sitemaps/ping?sitemap='
- . urlencode($b_url . $MobileMap);
- $url = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', $url);
- $fp = @fopen($url, 'r');
- @fclose($fp);
- }
- }
- }
-
- function init()
- {
- global $admin;
- $language = ereg_replace( '[\\|/]', '', getLanguageName());
- if (file_exists($this->getDirectory() . $language.'.php')) {
- include_once($this->getDirectory() . $language.'.php');
- }else {
- include_once($this->getDirectory() . 'english.php');
- }
- }
-
- function install()
- {
- $this->createOption('AllBlogMap', _G_SITEMAP_ALLB, 'yesno', 'yes');
- $this->createBlogOption('PingGoogle', _G_SITEMAP_PING, 'yesno', 'yes');
- $this->createBlogOption('IncludeSitemap', _G_SITEMAP_INC, 'yesno', 'yes');
- $this->createBlogOption('PcSitemap', _G_SITEMAP_PCSM, 'text', 'sitemap.xml');
- $this->createBlogOption('MobileSitemap', _G_SITEMAP_MBSM, 'text', '');
- }
-}
+++ /dev/null
-<?php
- define('_G_SITEMAP_DESC', "This plugin provides a Google sitemap for your website.<br />" .
- "Sitemap URL: http://example.cm/sitemap.xml");
- define('_G_SITEMAP_ALLB', "Generate All Blog's Google Sitemap");
- define('_G_SITEMAP_PING', "Ping Google after adding a new item");
- define('_G_SITEMAP_INC', "Include this blog in Google Sitemap when All Blog mode");
- define('_G_SITEMAP_PCSM', "Virtual file name for PC Sitemap");
- define('_G_SITEMAP_MBSM', "Virtual file name for Mobile Sitemap");
-?>
\ No newline at end of file
+++ /dev/null
-<?php
- define('_G_SITEMAP_DESC', "¡ÖGoogle¥¦¥§¥Ö¥Þ¥¹¥¿¡¼¥Ä¡¼¥ë¡×ÍѤΥµ¥¤¥È¥Þ¥Ã¥×¤òºîÀ®¤·¤Þ¤¹<br />" .
- "Sitemap URL: http://example.cm/sitemap.xml");
- define('_G_SITEMAP_ALLB', "AllBlog ¥â¡¼¥É¤Ç¥µ¥¤¥È¥Þ¥Ã¥×¤òºîÀ®¤¹¤ë(¥µ¥Ö/¥Þ¥ë¥Á¥É¥á¥¤¥ó¤Ï½ü³°)");
- define('_G_SITEMAP_PING', "¥¢¥¤¥Æ¥àÄɲûþ¤Ë Google ¤Ë¹¹¿·¤òÄÌÃΤ¹¤ë");
- define('_G_SITEMAP_INC', "AllBlog ¥â¡¼¥É¤Î¤È¤¤Ë¤³¤Î¥Ö¥í¥°¤ò´Þ¤á¤ë");
- define('_G_SITEMAP_PCSM', "PC ÍÑ¥µ¥¤¥È¥Þ¥Ã¥×¥Õ¥¡¥¤¥ë¤Î²¾ÁÛ¥Õ¥¡¥¤¥ë̾");
- define('_G_SITEMAP_MBSM', "¥â¥Ð¥¤¥ëÍÑ¥µ¥¤¥È¥Þ¥Ã¥×¥Õ¥¡¥¤¥ë¤Î²¾ÁÛ¥Õ¥¡¥¤¥ë̾");
-?>
\ No newline at end of file
+++ /dev/null
-<?php
- define('_G_SITEMAP_DESC', "「Googleウェブマスターツール」用のサイトマップを作成します<br />" .
- "Sitemap URL: http://example.cm/sitemap.xml");
- define('_G_SITEMAP_ALLB', "AllBlog モードでサイトマップを作成する(サブ/マルチドメインは除外)");
- define('_G_SITEMAP_PING', "アイテム追加時に Google に更新を通知する");
- define('_G_SITEMAP_INC', "AllBlog モードのときにこのブログを含める");
- define('_G_SITEMAP_PCSM', "PC 用サイトマップファイルの仮想ファイル名");
- define('_G_SITEMAP_MBSM', "モバイル用サイトマップファイルの仮想ファイル名");
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-/**
- *
- * BreadCrumbsList PLUG-IN FOR NucleusCMS
- * PHP versions 4 and 5
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * (see nucleus/documentation/index.html#license for more info)
- *
- * @author Original Author nakahara21
- * @copyright 2005-2006 nakahara21
- * @license http://www.gnu.org/licenses/gpl.txt GNU GENERAL PUBLIC LICENSE Version 2, June 1991
- * @version 0.992
- * @link http://japan.nucleuscms.org/wiki/plugins:itemnaviex
- *
- * 0.993 Henceforth to template
- * 0.992 display mode '0' fix
- * 0.991 add sub-blog home mode
- * 0.99 sec fix
- *
- **************************************************************************
- *
- * THESE PLUG-INS ARE DEDICATED TO ALL THOSE NucleusCMS USERS
- * WHO FIGHT CORRUPTION AND IRRATIONAL IN EVERY DAY OF THEIR LIVES.
- *
- **************************************************************************/
-
-class NP_ItemNaviEX extends NucleusPlugin
-{
- function getName()
- {
- return 'Navigation Bar';
- }
-
- function getAuthor()
- {
- return 'nakahara21 + shizuki';
- }
-
- function getURL()
- {
- return 'http://japan.nucleuscms.org/wiki/plugins:itemnaviex';
- }
-
- function getVersion()
- {
- return '0.993';
- }
-
- function getDescription()
- {
- // include language file for this plugin
- $language = ereg_replace( '[\\|/]', '', getLanguageName());
- if (file_exists($this->getDirectory() . $language . '.php')) {
- include_once($this->getDirectory() . $language . '.php');
- } else {
- include_once($this->getDirectory() . 'english.php');
- }
- $description = _NP_INEX_DESC;
-// $description = 'Add link to prev item and next item. '
-// . 'Usage: <%ItemNaviEX%> or <%ItemNaviEX(0)%>'
-// . ' or <%ItemNaviEX(1)%> or <%ItemNaviEX(2)%>';
- return $description;
- }
-
- function supportsFeature($what)
- {
- switch ($what) {
- case 'SqlTablePrefix':
- return 1;
- default:
- return 0;
- }
- }
-
- function scanEndKey($array)
- {
- $keys = array_keys($array);
- rsort($keys);
- return $keys[0];
- }
-
- function createNaviLink($unitArray)
- {
- if ($unitArray[1]) {
- $tempLink = '<a href="' . htmlspecialchars($unitArray[1], ENT_QUOTES, _CHARSET) . '">'
- . htmlspecialchars($unitArray[0], ENT_QUOTES, _CHARSET) . '</a>';
- } else {
- $tempLink = htmlspecialchars($unitArray[0], ENT_QUOTES, _CHARSET);
- }
- return $tempLink;
- }
-
- function checkParent()
- {
- global $manager;
-// if ($manager->pluginInstalled('NP_MultipleCategories')) {
-// $mplugin =& $manager->getPlugin('NP_MultipleCategories');
-// if (method_exists($mplugin,"getRequestName")) {
- $query = 'SHOW FIELDS FROM ' . sql_table('plug_multiple_categories_sub');
- $res = sql_query($query);
- while ($co = mysql_fetch_assoc($res)) {
- if ($co['Field'] == 'parentid') {
- return TRUE;
- }
- }
-// }
-// }
- }
-
- function doSkinVar($skinType, $showHome = 1)
- {
- global $manager, $CONF, $blog, $itemid, $itemidprev, $itemidnext;
- global $catid, $subcatid, $archive, $archiveprev, $archivenext, $param;
-
-// sanitize
- $y = $m = $d = '';
- $itemid = intval($itemid);
- $catid = intval($catid);
- $subcatid = intval($subcatid);
- $itemidprev = intval($itemidprev);
- $itemidnext = intval($itemidnext);
- if (isset($archive)) {
- sscanf($archive,'%d-%d-%d', $y, $m, $d);
- if ($y && $m && !empty($d)) {
- $archive = sprintf('%04d-%02d-%02d', $y, $m, $d);
- } elseif ($y && $m && empty($d)) {
- $archive = sprintf('%04d-%02d', $y, $m);
- }
- }
- if (isset($archiveprev)) {
- sscanf($archiveprev,'%d-%d-%d', $y, $m, $d);
- if ($y && $m && !empty($d)) {
- $archiveprev = sprintf('%04d-%02d-%02d', $y, $m, $d);
- } elseif ($y && $m && empty($d)) {
- $archiveprev = sprintf('%04d-%02d', $y, $m);
- }
- }
- if (isset($archiveprev)) {
- sscanf($archiveprev,'%d-%d-%d', $y, $m, $d);
- if ($y && $m && !empty($d)) {
- $archiveprev = sprintf('%04d-%02d-%02d', $y, $m, $d);
- } elseif ($y && $m && empty($d)) {
- $archiveprev = sprintf('%04d-%02d', $y, $m);
- }
- }
- if ($showHome == '') {
- $showHome = 1;
- } else {
- $showHome = intval($showHome);
- }
-
- if ($catid) {
- $blogid = getBlogIDFromCatID($catid);
- $b =& $manager->getBlog($blogid);
- } elseif ($blog) {
- $b =& $blog;
- } else {
- $b =& $manager->getBlog($CONF['DefaultBlog']);
- }
- $blogid = intval($b->getID());
-
- $abuf = '';
- $mtable = '';
- $where .= ' and i.iblog=' . $blogid;
- if (!empty($catid)) {
- if ($manager->pluginInstalled('NP_MultipleCategories')) {
- $where .= ' and ((i.inumber = p.item_id'
- . ' and (p.categories REGEXP "(^|,)' . $catid . '(,|$)"'
- . ' or i.icat = ' . $catid . '))'
- . ' or (i.icat = ' . $catid
- . ' and p.item_id IS NULL))';
- $mtable = ' LEFT JOIN ' . sql_table('plug_multiple_categories') . ' as p'
- . ' ON i.inumber = p.item_id';
- $mplugin =& $manager->getPlugin('NP_MultipleCategories');
- if ($subcatid && method_exists($mplugin, 'getRequestName')) {
-//family
- if ($this->checkParent()) {
- $Children = array();
- $Children = explode('/', $subcatid . $this->getChildren($subcatid));
- }
- if ($Children[1]) {
- for ($i=0;$i<count($Children);$i++) {
- $temp_whr[] = ' p.subcategories REGEXP "(^|,)' . intval($Children[$i]) . '(,|$)" ';
- }
- $where .= ' and ';
- $where .= ' ( ';
- $where .= join(' or ', $temp_whr);
- $where .= ' )';
- }else{
- $where .= ' and p.subcategories REGEXP "(^|,)' . $subcatid . '(,|$)"';
- }
-//family end
- }
- } else {
- $where .= ' and i.icat=' . $catid;
- }
- }
- $naviUnit = array();
- $subNaviUnit = array();
- $this->linkparams = array();
- $nextLabel = $this->getOption('PNNextLabel');
- $prevLabel = $this->getOption('PNPrevLabel');
-//store Home =====================================
-//*// comment out this block when HOME is sub-blog top
- if ($showHome == 1) {
-// $defBlogid =intval($CONF['DefaultBlog']);
- $tempBlog =& $manager->getBlog(intval($CONF['DefaultBlog']));
- $naviUnit[] = array(
- 0 => 'Home',
-// 1 => createBlogidLink($defBlogid),
- 1 => $tempBlog->getURL(),
- 2 => createArchiveListLink($blogid)
- );
- }
-//*/
-//store Blog =====================================
- if ($showHome == 1 && ($blogid <> $CONF['DefaultBlog'])) {
- $naviUnit[] = array(
- 0 => getBlogNameFromID($blogid),
- 1 => createBlogidLink($blogid),
- 2 => createArchiveListLink($blogid)
- );
- } elseif ($showHome >= 2 || ($showHome == 0 && ($catid || $itemid))) {
- $naviUnit[] = array(
- 0 => 'Home', // when HOME is sub-blog top
- 1 => createBlogidLink($blogid), // when HOME is sub-blog top
- 2 => createArchiveListLink($blogid)
- );
- }
-
-//store Category =====================================
- if (!empty($catid)) {
- $this->linkparams['catid'] = $catid;
- $naviUnit[] = array(
- 0 => $b->getCategoryName($catid),
- 1 => createCategoryLink($catid),
-// 1 => createBlogidLink($blogid, $this->linkparams),
- 2 => createArchiveListLink($blogid, $this->linkparams)
- );
- }
-
-//store subCategory =====================================
- if (!empty($subcatid)) {
- if ($manager->pluginInstalled('NP_MultipleCategories')) {
- $mplugin =& $manager->getPlugin('NP_MultipleCategories');
- if (method_exists($mplugin, 'getRequestName')) {
- $subrequest = $mplugin->getRequestName(array());
- $this->linkparams[$subrequest] = $subcatid;
- if ($this->checkParent()) {
- $tog = $this->getParenta($subcatid, $blogid);
- for ($i=0; $i<count($this->r); $i++) {
- $naviUnit[] = $this->r[$i];
- }
- $naviUnit[] = $tog;
- } else {
- $naviUnit[] = array(
- 0 => $mplugin->_getScatNameFromID($subcatid),
- 1 => createCategoryLink($catid, array($subrequest => $subcatid)),
-// 1 => createCategoryLink($catid, array('subcatid' => $subcatid)),
-// 1 => createBlogidLink($blogid, $this->linkparams),
- 2 => createArchiveListLink($blogid, $this->linkparams)
- );
- }
- }
- }
- }
-
-//store Page ===================================== todo How to get PageNo. ? ...cookie...
- if (intRequestVar('page') != 0) {
- $naviUnit[] = array(
- 0 => 'Page.' . intRequestVar('page'),
- 2 => createArchiveListLink($blogid, $this->linkparams)
- );
- }
-
-//store Item =====================================
- if ($skinType == 'item') {
- $item =& $manager->getItem($itemid, 0, 0);
- $naviUnit[] = array(
- 0 => $item['title']
- );
-
- $query = 'SELECT i.ititle, i.inumber'
- . ' FROM ' . sql_table('item') . ' as i' . $mtable
- . ' WHERE i.idraft = 0'
- . " and i.itime < '" . $item['itime'] . "' " . $where
- . ' ORDER BY i.itime DESC';
- $res = sql_query($query);
- if ($ares = mysql_fetch_row($res)) {
- $alink = createItemLink($ares[1], $this->linkparams);
- $subNaviUnit[1] = '<a href="'
- . htmlspecialchars($alink, ENT_QUOTES, _CHARSET)
- . '" rel="prev"> ' . $prevLabel . ' '
- . shorten($ares[0], 14, '...')
- . '</a>';
- }
-
- $query = 'SELECT i.ititle, i.inumber'
- . ' FROM ' . sql_table('item') . ' as i' . $mtable
- . ' WHERE i.idraft = 0'
- . " and i.itime > '" . $item['itime'] . "' " . $where
- . ' ORDER BY i.itime ASC';
- $res = sql_query($query);
- if ($ares = mysql_fetch_row($res)) {
- $alink = createItemLink($ares[1], $this->linkparams);
- $subNaviUnit[2] = '<a href="'
- . htmlspecialchars($alink, ENT_QUOTES, _CHARSET)
- . '" rel="next"> '
- . shorten($ares[0], 14, '...')
- . ' ' . $nextLabel . '</a>';
- }
-
- }
-
-//store ArchiveList =====================================
- if ($skinType == 'archivelist' || $skinType == 'archive') {
- $naviUnit[] = array(
- 0 => $this->getOption('archivelinkLabel'),
-// 0 => 'ArchiveList',
- 1 => createArchiveListLink($blogid, $this->linkparams)
- );
- }
-
- if ($skinType == 'archive') {
- sscanf($archive,'%d-%d-%d', $y, $m, $d);
-//store ArchiveMonth
- $archiveMonth = $y . '-' . $m;
- $naviUnit[] = array(
- 0 => $archiveMonth,
- 1 => createArchiveLink($blogid, $archiveMonth, $this->linkparams)
- );
- if (empty($d)) {
- $timestamp_start = mktime(0, 0, 0, $m, 1, $y);
- $timestamp_end = mktime(0, 0, 0, $m+1, 1, $y);
- $date_str = 'SUBSTRING(i.itime, 1, 7)';
- } else {
- $timestamp_start = mktime(0, 0, 0, $m, $d, $y);
- $timestamp_end = mktime(0, 0, 0, $m, $d+1, $y);
- $date_str = 'SUBSTRING(i.itime, 1, 10)';
-//store ArchiveDay
- $naviUnit[] = array(
- 0 => $y . '-' . $m . '-' . $d,
- 1 => createArchiveLink($blogid, $archive, $this->linkparams)
- );
- }
-
-//=============================
- $query = 'SELECT ' . $date_str . ' as Date'
- . ' FROM ' . sql_table('item') . ' as i' . $mtable
- . ' WHERE i.idraft = 0'
- . ' and i.itime < ' . mysqldate($timestamp_start) . $where
- . ' GROUP BY Date'
- . ' ORDER BY i.itime DESC';
- $res = sql_query($query);
- if ($ares = mysql_fetch_row($res)) {
-// $prev_date = $ares[0];
- sscanf($ares[0], '%d-%d-%d', $y, $m, $d);
- if (empty($d)) {
- $prev_date = sprintf('%04d-%02d', $y, $m);
- } else {
- $prev_date = sprintf('%04d-%02d-%02d', $y, $m, $d);
- }
- $prev_alink = createArchiveLink($blogid, $prev_date, $this->linkparams);
- $subNaviUnit[1] = '<a href="'
- . htmlspecialchars($prev_alink, ENT_QUOTES, _CHARSET)
- . '" class="prevlink" rel="prev">'
- . ' ' . $prevLabel . ' '
- . htmlspecialchars($prev_date, ENT_QUOTES, _CHARSET)
- . '</a>';
-// $abuf .= '<a href="'.$prev_alink.'" class="prevlink" rel="prev">'.$prev_date.'</a>';
-// } else {
-// $today_link = createBlogidLink($b->getID(), $this->linkparams);
-// $abuf .= ' ( <a href="'.$today_link.'">Today</a> )';
- }
- $abuf .= ' | <strong>' . htmlspecialchars($archive, ENT_QUOTES, _CHARSET) . '</strong> ';
-//=============================
- $query = 'SELECT ' . $date_str . ' as Date'
- . ' FROM ' . sql_table('item') . ' as i' . $mtable
- . ' WHERE i.idraft = 0'
- . ' and i.itime < ' . mysqldate($b->getCorrectTime())
- . ' and i.itime >= ' . mysqldate($timestamp_end) . $where
- . ' GROUP BY Date'
- . ' ORDER BY i.itime ASC';
- $res = sql_query($query);
- if ($ares = mysql_fetch_row($res)) {
-// $next_date = $ares[0];
- sscanf($ares[0],'%d-%d-%d', $y, $m, $d);
- if (empty($d)) {
- $next_date = sprintf('%04d-%02d', $y, $m);
- } else {
- $next_date = sprintf('%04d-%02d-%02d', $y, $m, $d);
- }
- $next_alink = createArchiveLink($blogid, $next_date, $this->linkparams);
- $subNaviUnit[2] = '<a href="'
- . htmlspecialchars($next_alink, ENT_QUOTES, _CHARSET)
- . '" class="nextlink" rel="next">'
- . htmlspecialchars($next_date, ENT_QUOTES, _CHARSET)
- . ' ' . $nextLabel . '</a>';
-// $a2buf = ' | <a href="'.$next_alink.'" class="nextlink" rel="next">'.$next_date.'</a>';
-// } else {
-// $today_link = createBlogidLink($b->getID(), $this->linkparams);
-// $a2buf .= ' | ( <a href="'.$today_link.'">Today</a> )';
- }
- }
-//============================= // end of archive(s)
-
-// Print subNavi
-// todo Henceforth to template
-// echo ' <div style="text-align: center;">';
-// echo ' <span style="text-align:right;">';
-// echo ' <span class="prevnextnavi">';
- $endKey = $this->scanEndKey($naviUnit);
-// if ($skinType != 'archivelist' && $skinType != 'archive' && $skinType != 'item') {
-// echo '<a href="' . $naviUnit[$endKey][2] . '">» ArchiveList</a>';
-// }
-// echo @join(' :: ', $subNaviUnit);
-// echo '</div>';
-// echo '</span>';
-///
-
-/*
-<%subnavi%> --> prev. and next link
-<%archivedata%> --> ArchiveList link
-*/
-
- $subNaviData['subnavi'] = implode($this->getOption('PNSeparator'), $subNaviUnit);
- if ($skinType != 'archivelist' && $skinType != 'archive' && $skinType != 'item') {
- if (!empty($naviUnit)) {
- $subNaviData['archivedata'] .= '<a href="'
- . $naviUnit[$endKey][2]
- . '">' . $this->getOption('archivelinkLabel') . '</a>';
- }
- }
- $subnaviTemplate = $this->getOption('subnaviTemplate');
- $navigateData['subnaviblock'] = TEMPLATE::fill($subnaviTemplate, $subNaviData);
-// echo TEMPLATE::fill($subnaviTemplate, $subNaviData);
-//*/
-// Print mainNavi
- unset($naviUnit[$endKey][1]);
- $naviVar = array_map(array(&$this, 'createNaviLink'), $naviUnit);
-
-// echo '<span class="breadcrumbslist">', @join(' > ', $naviVar);
-
- $topicPathData['topicpath'] = implode($this->getOption('topicPathSeparator'), $naviVar);
-
-//add Taginfo =====================================
-// display selected TAGs whith link mod by shizuki
- if ($manager->pluginInstalled('NP_TagEX')) {
-// if (requestVar('tag')) {
- $tagPlugin =& $manager->getPlugin('NP_TagEX');
- $requestT = $tagPlugin->getNoDecodeQuery('tag');
- if (!empty($requestT)) {
- $requestTarray = $tagPlugin->splitRequestTags($requestT);
- $reqAND = array_map(array(&$tagPlugin, "_rawdecode"), $requestTarray['and']);
- if ($requestTarray['or']) {
- $reqOR = array_map(array(&$tagPlugin, "_rawdecode"), $requestTarray['or']);
- }
- if ($reqOR) {
- $reqTags = array_merge($reqAND, $reqOR);
- } else {
- $reqTags = $reqAND;
- }
- for ($i=0;$i<count($reqTags);$i++) {
- $tag = trim($reqTags[$i]);
- $taglist[$i] = '<a href="' . $tagPlugin->creatTagLink($tag, 0) . '">'
- . htmlspecialchars($tag, ENT_QUOTES, _CHARSET) . '</a>';
- }
-// echo ' <small style="font-family:Tahoma;">';
-// echo ' (Tag for "'.$tagPlugin->_rawdecode(requestVar('tag')).'")';
-// echo ' (Tag for "' . @join(' / ', $taglist) . '")';
-// echo '</small>';
-/*
-<%tags%> --> selected TAGs with own link
-*/
- $tagsData['tags'] = implode(' / ', $taglist);
- $tagListTemplate = $this->getOption('tagListTemplate');
- $topicPathData['taglist'] = TEMPLATE::fill($tagListTemplate, $tagsData);
-//*/
- }
- }
-/*
-<%topicpath%> --> topicpath
-<%taglist%> --> selected TAG list
-*/
- $topicPathTemplate = $this->getOption('topicPathTemplate');
- $navigateData['topicpathblock'] = TEMPLATE::fill($topicPathTemplate, $topicPathData);
-// echo TEMPLATE::fill($topicPathTemplate, $topicPathData);
- $navigateBlockTemplate = $this->getOption('ItemNaviTemplate');
-/*
-<%subnaviblock%>
-<%topicpathblock%>
-*/
- echo TEMPLATE::fill($navigateBlockTemplate, $navigateData);
-//*/
-// echo '</span>';
-
- }
-
- function getParenta($subcat_id, $blogid=0)
- {
- $subcat_id = intval($subcat_id);
- $blogid = intval($blogid);
- $r = array();
- $que = 'SELECT scatid, parentid, sname, catid FROM %s WHERE scatid = %d';
- $que = sprintf($que, sql_table('plug_multiple_categories_sub'), $subcat_id);
- $res = sql_query($que);
- list ($sid, $parent, $sname, $cat_id) = mysql_fetch_row($res);
- if (intval($parent) != 0) {
- $this->r[] = $this->getParenta(intval($parent), $blogid);
- $this->linkparams[subcatid] = $sid;
- $r = array(
- 0 => $sname,
- 1 => createBlogidLink($blogid, $this->linkparams),
- 2 => createArchiveListLink($blogid, $this->linkparams)
- );
- } else {
- $this->linkparams[subcatid] = $sid;
- $r = array(
- 0 => $sname,
- 1 => createBlogidLink($blogid, $this->linkparams),
- 2 => createArchiveListLink($blogid, $this->linkparams)
- );
- }
- return $r;
- }
-
- function getParent($subcat_id)
- {
- $subcat_id = intval($subcat_id);
- $que = 'SELECT scatid, parentid, sname FROM %s WHERE scatid = %d';
- $que = sprintf($que, sql_table('plug_multiple_categories_sub'), $subcat_id);
- $res = sql_query($que);
- list ($sid, $parent, $sname) = mysql_fetch_row($res);
- if (intval($parent) != 0) {
- $r = $this->getParent(intval($parent)) . " -> <a href=$subcat_id>$sname</a>";
- } else {
- $r = "<a href=$subcat_id>" . htmlspecialchars($sname) . "</a>";
- }
- return $r;
- }
-
- function getChildren($subcat_id)
- {
- $subcat_id = intval($subcat_id);
- $que = 'SELECT scatid, parentid, sname FROM %s WHERE parentid = %d';
- $que = sprintf($que, sql_table('plug_multiple_categories_sub'), $subcat_id);
- $res = sql_query($que);
- while ($so = mysql_fetch_object($res)) {
- $r .= $this->getChildren($so->scatid) . '/' . intval($so->scatid);
- }
- return $r;
- }
-
- function install()
- {
- // include language file for this plugin
- $language = ereg_replace( '[\\|/]', '', getLanguageName());
- if (file_exists($this->getDirectory() . $language . '.php')) {
- include_once($this->getDirectory() . $language . '.php');
- } else {
- include_once($this->getDirectory() . 'english.php');
- }
- $sub = '<div style="text-align:right;"><%archivedata%><%subnavi%></div>';
- $path = '<div style="text-align:left;"><%topicpath%><%taglist%></div>';
- $tags = ' (Selected TAG(s) : <small style="font-family:Tahoma;"><%tags%></small>)';
- $navi = '<div class="itemnaviex"><%subnaviblock%><%topicpathblock%></div>';
- $this->createOption('subnaviTemplate', _INEXOP_SUB, 'text', $sub);
- $this->createOption('PNSeparator', _INEXOP_PNSP, 'tect', ' :: ');
- $this->createOption('PNNextLabel', _INEXOP_PNNX, 'tect', '»');
- $this->createOption('PNPrevLabel', _INEXOP_PNPR, 'tect', '«');
- $this->createOption('topicPathTemplate', _INEXOP_PATH, 'text', $path);
- $this->createOption('topicPathSeparator', _INEXOP_PSEP, 'text', ' > ');
- $this->createOption('tagListTemplate', _INEXOP_TAGS, 'text', $tags);
- $this->createOption('ItemNaviTemplate', _INEXOP_NAVI, 'text', $navi);
- $this->createOption('archivelinkLabel', _INEXOP_ALBL, 'text', '» ArchiveList');
- }
-
-}
+++ /dev/null
-<?php
-class NP_LatestWritebacks extends NucleusPlugin
-{
-
- function supportsFeature($what)
- {
- switch ($what) {
- case 'SqlTablePrefix':
- return 1;
- default:
- return 0;
- }
- }
-
-// function getEventList()
-// {
-// return array();
-// }
-
- function getName()
- {
- return 'Latest Writebacks';
- }
-
- function getAuthor()
- {
- return 'nakahara21 + Fujisaki + kimitake + shizuki';
- }
-
- function getURL()
- {
- return 'http://nakahara21.com/';
- }
-
- function getVersion()
- {
- return '1.6';
- }
-
- function getDescription()
- {
- // include language file for this plugin
- $language = ereg_replace( '[\\|/]', '', getLanguageName());
- if (file_exists($this->getDirectory() . $language . '.php')) {
- include_once($this->getDirectory() . $language . '.php');
- } else {
- include_once($this->getDirectory() . 'english.php');
- }
- $description = _NP_LRWITEBACKS_DESC;
-// $description = 'This plugin can be used to display the last few comments'
-// . 'and Trackbacks.<br />'
-// . 'Usage:<%LatestWritebacks(10,current,all)%>';
- return $description;
- }
-
- function install()
- {
- // include language file for this plugin
- $language = ereg_replace( '[\\|/]', '', getLanguageName());
- if (file_exists($this->getDirectory() . $language . '.php')) {
- include_once($this->getDirectory() . $language . '.php');
- } else {
- include_once($this->getDirectory() . 'english.php');
- }
- $this->createOption('timelocale', _NP_LRWITEBACKS_TZLOC, 'text', 'ja_JP.' . _CHARSET);
- $this->createOption('cmdateformat', _NP_LRWITEBACKS_CDFMT, 'text', '%Y-%m-%d %H:%M:%S');
- $this->createOption('tbdateformat', _NP_LRWITEBACKS_TEFMT, 'text', '%m-%d');
- $this->createOption('cmlisthead', _NP_LRWITEBACKS_CHEAD, 'textarea', '<ul class="nobullets">');
- $this->createOption('cmttemplate', _NP_LRWITEBACKS_CBODY, 'textarea',
- '<li>♣<a href="<%itemlink%>#c<%commentid%>"><%commentdate%>|<%commentator%>><%commentbody%></a></li>');
- $this->createOption('cmlistfoot', _NP_LRWITEBACKS_CFOOT, 'textarea', '</ul>');
- $this->createOption('tblisthead', _NP_LRWITEBACKS_THEAD, 'textarea', '<ul class="nobullets">');
- $this->createOption('tbktemplate', _NP_LRWITEBACKS_TBODY, 'textarea',
- '<li>…<a href="<%itemlink%>#trackback"><%tbdate%>|<%blogname%> ping: "<%entrytitle%>"</a></li>');
- $this->createOption('tblistfoot', _NP_LRWITEBACKS_TFOOT, 'textarea', '</ul>');
-/*
-Comment list template sample
- Header
- <ol class="recent-comment">
- Body
- <li><a href="<%itemlink%>#c<%commentid%>" title="<%commentbody%>"><%commentator%>(<%commentday%>)</a></li>
- Footer
- </ol>
-
-TrackBack list template sample
- Header
- <ol class="recent-trackback">
- Body
- <li><a href="<%itemlink%>#tb<%tbid%>" title="<%expect%>"><%blogname%> : <%entrytitle%>(<%tbday%>)</a></li>
- Footer
- </ol>
-*/
- }
-
- function pluginCheck($pluginName)
- {
- global $manager;
- if (!$manager->pluginInstalled('NP_' . $pluginName)) {
- return false;
- }
- $plugin =& $manager->getPlugin('NP_' . $pluginName);
- return $plugin;
- }
-
- function doSkinVar($skinType,
- $numberOfWritebacks = 5,
- $filter = '',
- $TBorCm = 'all',
- $numberOfCharacters = 60,
- $numberOfTitleCharacters = 40,
- $toadd = "...")
- {
- global $manager, $CONF, $blog;
-
- if (!is_numeric($numberOfWritebacks)) {
- $filter = $numberOfWritebacks;
- $numberOfWritebacks = 5; // defaults to 5
- }
- $b =& $manager->getBlog($CONF['DefaultBlog']);
- $this->defaultblogurl = $b->getURL() ;
- if (!$this->defaultblogurl)
- $this->defaultblogurl = $CONF['IndexURL'] ;
- if ($blog) {
- $b =& $blog;
- }
- $blogid = $b->getID(); //for select
-
- $filter = trim($filter);
- if($filter == 'current'){
- $filter = 'cblog = ' . $blogid;
- } elseif (strstr($filter, '=')) {
- $filter = str_replace('=', '', $filter);
- $filter = ' cblog IN(' . str_replace('/', ',', $filter) . ')';
- } elseif (strstr($filter, '<>')) {
- $filter = str_replace('<>', '', $filter);
- $filter = ' cblog <> ' . str_replace('/', ' AND cblog <> ', $filter);
- }
-
- setlocale(LC_TIME, $this->getOption('timelocale'));
- $arr_res = array();
-
- if ($TBorCm != 't') {
- $join = '';
- $query = 'SELECT'
- . ' c.cnumber as commentid,'
- . ' c.cuser as commentator,'
- . ' c.cbody as commentbody,'
- . ' c.citem as itemid,'
- . ' c.cmember as memberid,'
-// . ' c.ctime as commentdate,'
- . ' SUBSTRING(c.ctime, 6, 5) as commentday,'
- . ' UNIX_TIMESTAMP(c.ctime) as ctimest';
- if ($EzComment2 = $this->pluginCheck('EzComment2')) {
- if (method_exists($EzComment2, 'getTemplateParts')) {
- $query .= ', s.comid as cid, '
- . 's.secflg as secret, '
- . 's.module as modname, '
- . 's.userID as identity ';
- $join = ' LEFT OUTER JOIN ' . sql_table('plug_ezcomment2') . ' as s '
- . ' ON c.cnumber = s.comid ';
- }
- }
- // select
- $query .= ' FROM ' . sql_table('comment') .' as c ' . $join;
- if ($filter) {
- $query .= ' WHERE ' . $filter;
- }
- $query .= ' ORDER by c.ctime DESC LIMIT 0, ' . $numberOfWritebacks;
-
- $comments = sql_query($query);
-
- if (mysql_num_rows($comments)) {
- while ($row = mysql_fetch_object($comments)) {
- $content = (array)$row;
- $tempBody = strip_tags($content['commentbody']);
- $tempBody = htmlspecialchars($tempBody, ENT_QUOTES);
- $tempBody = shorten($tempBody, $numberOfCharacters, $toadd);
- $tempBody = htmlspecialchars(htmlspecialchars_decode($tempBody), ENT_QUOTES);
- $tempBody = str_replace("\r\n", ' ', $tempBody);
- $content['commentdate'] = strftime($this->getOption('cmdateformat'), $content['ctimest']);
- $content['commentbody'] = str_replace("&amp;", '&', $tempBody);
- if (!empty($row->memberid)) {
- $mem = new MEMBER;
- $mem->readFromID(intval($row->memberid));
- $content['commentator'] = $mem->getRealName();
- }
- if ($EzComment2) {
- $bid = intval(getBlogIDFromItemID(intval($comment['itemid'])));
- if ($EzComment2->getBlogOption($bid, 'secret') == 'yes') {
- $b = $manager->getBlog($bid);
- global $member;
- $judge = $EzComment2->setSecretJudge($bid, $member, $b);
- }
- }
- if ($judge && $content['secret']) {
- $content = $EzComment2->JudgementCommentSecrets($content, $judge);
- }
-
-/* $cid = $row->cnumber;
- $ct = $row->ctimest;
- $ctst = date("y-m-d H:i",$ct);
- $text = strip_tags($row->cbody);
- $text = htmlspecialchars($text, ENT_QUOTES);
- $ctext = shorten($text,$numberOfCharacters,$toadd);
-
- if (!$row->cmember) $myname = $row->cuser;
- else {
- $mem = new MEMBER;
- $mem->readFromID(intval($row->cmember));
- $myname = $mem->getRealName();
- }*/
-
-// $itemlink = $this->_createItemLink($row->citem, '');
-// $arr_res[$ct] = "<li>♣<a href=\"".$itemlink."#c".$cid."\">$ctst|".$myname.">".$ctext."</a></li>" ;
- $itemlink = $this->_createItemLink($content['itemid']);
- $content['itemlink'] = $itemlink;
- $arr_res[$content['ctimest']] = TEMPLATE::fill($this->getOption('cmttemplate'), $content);
- }
- }
- }
-
-//=========================
-
- if ($manager->pluginInstalled('NP_TrackBack') && $TBorCm != 'c') {
- $query = 'SELECT'
- . ' t.id as tbid,'
- . ' t.title as entrytitle,'
- . ' t.excerpt as expect,'
- . ' t.url as tburl,'
- . ' t.tb_id as trackbackid,'
- . ' t.blog_name as blogname,'
- . ' t.timestamp as tbdate,'
- . ' SUBSTRING(t.timestamp, 6, 5) as tbday,'
- . ' UNIX_TIMESTAMP(t.timestamp) as ttimest'
- . ' FROM ' . sql_table('plugin_tb') . ' t,'
- . sql_table('item') . ' i'
- . ' WHERE t.tb_id = i.inumber';
- if ($this->checkTBVersion()) {
- $query .= ' and t.block = 0';
- }
- if ($filter) {
- $tfilter = str_replace('cblog', 'i.iblog', $filter);
- $query .= ' and ' . $tfilter;
- }
- $query .= ' ORDER by t.timestamp DESC LIMIT 0, ' . $numberOfWritebacks;
-
- $comments = mysql_query($query);
-
- if (mysql_num_rows($comments)) {
- while ($row = mysql_fetch_object($comments)) {
- $content = (array)$row;
- $entrytitle = strip_tags($content['entrytitle']);
- $entrytitle = htmlspecialchars($entrytitle, ENT_QUOTES);
- $entrytitle = shorten($entrytitle, $numberOfCharacters, $toadd);
- $entrytitle = htmlspecialchars($entrytitle, ENT_QUOTES);
- $content['entrytitle'] = $entrytitle;
- $content['expect'] = str_replace("\r\n", ' ', $content['expect']);
- $blogname = htmlspecialchars($content['blogname'], ENT_QUOTES);
- $content['blogname'] = $blogname;
- $content['tbdate'] = strftime($this->getOption('tbdateformat'), $content['ttimest']);
-
-/* $title = strip_tags($row->title);
- $title = htmlspecialchars($title, ENT_QUOTES);
- $ctitle = shorten($title,$numberOfCharacters,$toadd);
- $blogname = htmlspecialchars($row->blog_name, ENT_QUOTES);
- $tbtime = $row->ttimest;
- $ttst = date("y-m-d H:i",$tbtime);*/
-
-// $itemlink = $this->_createItemLink($row->tb_id, '');
-// $arr_res[$tbtime] = '<li>…<a href="'.$itemlink.'#trackback">'.$ttst.'|'.$blogname.' ping: "'.$ctitle.'"</a></li>';
- $itemlink = $this->_createItemLink($content['trackbackid']);
- $content['itemlink'] = $itemlink;
- $arr_res[$content['ttimest']] = TEMPLATE::fill($this->getOption('tbktemplate'), $content);
- }
- }
- }
-//=========================
- krsort ($arr_res);
- $ress = array_values($arr_res);
- $show_rescnt = min(intval($numberOfWritebacks), count($arr_res));
-
- switch ($TBorCm) {
- case 'c':
- $head = $this->getOption('cmlisthead');
- $foot = $this->getOption('cmlistfoot');
- break;
- case 't':
- $head = $this->getOption('tblisthead');
- $foot = $this->getOption('tblistfoot');
- break;
- default:
- $head = ' <ul class="nobullets"> ';
- $foot = ' </ul> ';
- break;
- }
-// echo ' <ul class="nobullets"> ';
- echo $head;
- for ($j=0; $j < $show_rescnt; $j++) {
- echo $ress[$j] . "\n";
- }
- echo $foot;
-// echo " </ul> ";
- }
-
- function checkTBVersion()
- {
- $res = sql_query('SHOW FIELDS FROM ' . sql_table('plugin_tb') );
- $fieldnames = array();
- while ($co = mysql_fetch_assoc($res)) {
- $fieldnames[] = $co['Field'];
- }
- if (in_array('block', $fieldnames)) {
- return TRUE;
- } else {
- return FALSE;
- }
- }
-
- function _createItemLink($itemid)
- {
- global $CONF, $manager, $blog;
-
- $blogid = getBlogIDFromItemID($itemid);
- $b =& $manager->getBlog($blogid);
- $blogurl = $b->getURL();
-
- if (!$blogurl) {
- if ($blog) {
- $b_tmp =& $manager->getBlog($CONF['DefaultBlog']);
- $blogurl = $b_tmp->getURL();
- }
- if (!$blogurl) {
- $blogurl = $CONF['IndexURL'];
- if ($CONF['URLMode'] != 'pathinfo') {
- $blogurl = $CONF['Self'];
- }
- }
- }
- if ($CONF['URLMode'] == 'pathinfo') {
- $blogurl = preg_replace('/\/$/', '', $blogurl);
- }
- $CONF['ItemURL'] = $blogurl;
-
- return createItemLink($itemid);
- }
-
-}
+++ /dev/null
-<?php
-
- define('_NP_LRWITEBACKS_DESC', 'This plugin can be used to display the last few comments and Trackbacks. '
- . 'Usage:<%LatestWritebacks(10,current,all)%>');
- define('_NP_LRWITEBACKS_TZLOC', 'Locale');
- define('_NP_LRWITEBACKS_CDFMT', 'Date format(for Comments)');
- define('_NP_LRWITEBACKS_TEFMT', 'Date format(for Trackbacks)');
- define('_NP_LRWITEBACKS_CHEAD', '[Comment list]Header');
- define('_NP_LRWITEBACKS_CBODY', '[Comment list]Body');
- define('_NP_LRWITEBACKS_CFOOT', '[Comment list]Footer');
- define('_NP_LRWITEBACKS_THEAD', '[Trackback list]Header');
- define('_NP_LRWITEBACKS_TBODY', '[Trackback list]Body');
- define('_NP_LRWITEBACKS_TFOOT', '[Trackback list]Footer');
+++ /dev/null
-<?php
-
- define('_NP_LRWITEBACKS_DESC', 'ºÇ¿·¤Î¥³¥á¥ó¥È/¥È¥é¥Ã¥¯¥Ð¥Ã¥¯¤ò¡¢¥Ñ¥é¥á¡¼¥¿¡¼¤Ç»ØÄꤷ¤¿¿ô¤À¤±É½¼¨¤·¤Þ¤¹<br />'
- . '½ñ¼°¡§<%LatestWritebacks(10,current,all)%>');
- define('_NP_LRWITEBACKS_TZLOC', '¥¿¥¤¥à¥¾¡¼¥ó¤Î¥í¥±¡¼¥ë');
- define('_NP_LRWITEBACKS_CDFMT', '»þ´Ö¤ÈÆüÉդΥե©¡¼¥Þ¥Ã¥È(¥³¥á¥ó¥ÈÍÑ)');
- define('_NP_LRWITEBACKS_TEFMT', '»þ´Ö¤ÈÆüÉդΥե©¡¼¥Þ¥Ã¥È(¥È¥é¥Ã¥¯¥Ð¥Ã¥¯ÍÑ)');
- define('_NP_LRWITEBACKS_CHEAD', '¥³¥á¥ó¥È¥ê¥¹¥È¤Î¥Ø¥Ã¥À');
- define('_NP_LRWITEBACKS_CBODY', '¥³¥á¥ó¥È¥ê¥¹¥È¤ÎËÜÂÎ');
- define('_NP_LRWITEBACKS_CFOOT', '¥³¥á¥ó¥È¥ê¥¹¥È¤Î¥Õ¥Ã¥¿');
- define('_NP_LRWITEBACKS_THEAD', '¥È¥é¥Ã¥¯¥Ð¥Ã¥¯¥ê¥¹¥È¤Î¥Ø¥Ã¥À');
- define('_NP_LRWITEBACKS_TBODY', '¥È¥é¥Ã¥¯¥Ð¥Ã¥¯¥ê¥¹¥È¤ÎËÜÂÎ');
- define('_NP_LRWITEBACKS_TFOOT', '¥È¥é¥Ã¥¯¥Ð¥Ã¥¯¥ê¥¹¥È¤Î¥Õ¥Ã¥¿');
+++ /dev/null
-<?php
-
- define('_NP_LRWITEBACKS_DESC', '最新のコメント/トラックバックを、パラメーターで指定した数だけ表示します<br />'
- . '書式:<%LatestWritebacks(10,current,all)%>');
- define('_NP_LRWITEBACKS_TZLOC', 'タイムゾーンのロケール');
- define('_NP_LRWITEBACKS_CDFMT', '時間と日付のフォーマット(コメント用)');
- define('_NP_LRWITEBACKS_TEFMT', '時間と日付のフォーマット(トラックバック用)');
- define('_NP_LRWITEBACKS_CHEAD', 'コメントリストのヘッダ');
- define('_NP_LRWITEBACKS_CBODY', 'コメントリストの本体');
- define('_NP_LRWITEBACKS_CFOOT', 'コメントリストのフッタ');
- define('_NP_LRWITEBACKS_THEAD', 'トラックバックリストのヘッダ');
- define('_NP_LRWITEBACKS_TBODY', 'トラックバックリストの本体');
- define('_NP_LRWITEBACKS_TFOOT', 'トラックバックリストのフッタ');
+++ /dev/null
-<?php
-/**
- *
- * Send weblog updates ping
- * plugin for NucleusCMS(version 3.31 or lator)
- * Note: based on NP_Ping v1.5
- * PHP versions 4 and 5
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * (see nucleus/documentation/index.html#license for more info)
- *
- * @author shizuki
- * @copyright 2007 shizuki
- * @license http://www.gnu.org/licenses/gpl.txt GNU GENERAL PUBLIC LICENSE Version 2, June 1991
- * @version 1.66
- * @link http://shizuki.kinezumi.net/
- *
- * History of NP_Ping
- * v1.0 - Initial version
- * v1.1 - Add JustPosted event support
- * v1.2 - JustPosted event handling in background
- * v1.3 - pinged variable support
- * v1.4 - language file support
- * v1.5 - remove arg1 in exec() call
- *
- * History of NP_PingJP
- * v1.6 - Modified NP_Ping v1.5
- * merge NP_SendPing(by Tokitake) code
- * v1.61 - Merge Asynchronous request code(by hsur)
- * v1.62 - Add background mode
- * v1.63 - The server which has finished giving the service is eliminated.
- * v1.64 - Bug fix
- * v1.65 - Add Live BG mode setting
- * v1.66 - Typo fix
- * v1.67 - Bug fix
- * v1.68 - Debug development
- *
- * NP_PingJP.php ($Revision: 1.16 $)
- * $Id: NP_PingJP.php,v 1.16 2008-07-16 13:24:37 shizuki Exp $
- */
-
-
-/**
- * Require files for Asynchronous request
- */
-require_once(dirname(__FILE__).'/sharedlibs/sharedlibs.php');
-require_once("cles/AsyncHTTP/RawPost.php");
-
-class NP_PingJP extends NucleusPlugin
-{
-
-var $ahttp;
-var $debug = false;
-var $bgping = false;
-var $servers;
-var $faltMessageSet;
-
- // {{{ function getName()
-
- /**
- * Name of the plugin
- *
- * @return string
- * The name easy to understand for man of the plugin
- */
- function getName()
- {
- return 'Ping for Japanese';
- }
-
- // }}}
- // {{{ function getAuthor()
-
- /**
- * Author of the plugin
- *
- * @return string
- * The name of the plugin author
- */
- function getAuthor()
- {
- return 'admun (Edmond Hui)+ Tokitake + hsur + shizuki';
- }
-
- // }}}
- // {{{ function getURL()
-
- /**
- * URL of the site which can download a plugin
- *
- * @return string
- * URL of the site which can download a plugin
- */
- function getURL()
- {
- return 'http://shizuki.kinezumi.net/';
- }
-
- // }}}
- // {{{ function getVersion()
-
- /**
- * Version of the plugin
- *
- * @return string
- * Version of the plugin
- */
- function getVersion()
- {
- return '1.68';
- }
-
- // }}}
- // {{{ function getMinNucleusVersion()
-
- /**
- * Requier NucleusCMS version of the plugin
- *
- * @return string
- * Requier NucleusCMS version of a plugin
- */
- function getMinNucleusVersion()
- {
- return '331';
- }
-
- // }}}
- // {{{ function getDescription()
-
- /**
- * Description of the plugin
- *
- * @return string
- * Description of a plugin
- */
- function getDescription()
- {
- return _PINGJP_DESC;
- }
-
- // }}}
- // {{{ function supportsFeature($what)
-
- /**
- * Check whether the feature is being supported.
- *
- * @param string
- * Feature name
- * @return boolean
- */
- function supportsFeature($what)
- {
- switch($what) {
- case 'SqlTablePrefix':
- return 1;
- default:
- return 0;
- }
- }
-
- // }}}
- // {{{ function install()
-
- /**
- * Plugin installing action
- *
- * @return void
- */
- function install()
- {
- // Default, http://pingomatic.com
- $this->createBlogOption('pingjp_pingomatic', _PINGJP_PINGOM, 'yesno', 'yes');
- // http://weblogs.com
- $this->createBlogOption('pingjp_weblogs', _PINGJP_WEBLOGS, 'yesno', 'no');
- // http://www.technorati.com
- $this->createBlogOption('pingjp_technorati', _PINGJP_TECHNOR, 'yesno', 'no');
- // http://www.blogrolling.com
- $this->createBlogOption('pingjp_blogrolling', _PINGJP_BLOGR, 'yesno', 'no');
- // http://www.google.com
- $this->createBlogOption('pingjp_google', _PINGJP_GOOGLE, 'yesno', 'yes');
- // http://www.yahoo.co.jp
- $this->createBlogOption('pingjp_yahoo', _PINGJP_YAHOO, 'yesno', 'yes');
- // http://www.goo.ne.jp
- $this->createBlogOption('pingjp_goo', _PINGJP_GOO, 'yesno', 'no');
- // http://ask.jp
- $this->createBlogOption('pingjp_ask', _PINGJP_ASK, 'yesno', 'no');
- // http://pingoo.jp
- $this->createBlogOption('pingjp_pingoo', _PINGJP_PINGOO, 'yesno', 'no');
- // http://blo.gs
- $this->createBlogOption('pingjp_blogs', _PINGJP_BLOGS, 'yesno', 'no');
- // other ping server
- $this->createBlogOption('pingjp_otherurl', _PINGJP_OTHER, 'textarea', '');
- // background ?
- $this->createBlogOption('pingjp_background', _PINGJP_BG, 'yesno', 'yes');
- // Your blog URL
- $this->createBlogOption('pingjp_updateurl', _PINGJP_UPDURL, 'text', '');
- // Your RSS URL
- $this->createBlogOption('pingjp_feedurl', _PINGJP_UPDFEED, 'text', '');
- }
-
- // }}}
- // {{{ function init()
-
- /**
- * Plugin initialize action
- *
- * @return void
- */
- function init()
- {
- $language = ereg_replace( '[\\|/]', '', getLanguageName());
- if (file_exists($this->getDirectory() . 'language/' . $language . '.php')) {
- include_once($this->getDirectory() . 'language/' . $language . '.php');
- } else {
- include_once($this->getDirectory() . 'language/english.php');
- }
- $this->servers = array(
- array(
- 'server' => 'pingomatic',
- 'name' => _PINGJP_PINGOM,
- 'addr' => 'http://rpc.pingomatic.com/',
- 'method' => 'weblogUpdates.ping',
- ),
- array(
- 'server' => 'weblogs',
- 'name' => _PINGJP_WEBLOGS,
- 'addr' => 'http://rpc.weblogs.com/rpc2',
- 'method' => 'weblogUpdates.extendedPing',
- ),
- array(
- 'server' => 'technorati',
- 'name' => _PINGJP_TECHNOR,
- 'addr' => 'http://rpc.technorati.com/rpc/ping',
- 'method' => 'weblogUpdates.ping',
- ),
- array(
- 'server' => 'blogrolling',
- 'name' => _PINGJP_BLOGR,
- 'addr' => 'http://rpc.blogrolling.com/pinger/',
- 'method' => 'weblogUpdates.ping',
- ),
- array(
- 'server' => 'google',
- 'name' => _PINGJP_GOOGLE,
- 'addr' => 'http://blogsearch.google.co.jp/ping/RPC2',
- 'method' => 'weblogUpdates.extendedPing',
- ),
- array(
- 'server' => 'yahoo',
- 'name' => _PINGJP_YAHOO,
- 'addr' => 'http://api.my.yahoo.co.jp/RPC2',
- 'method' => 'weblogUpdates.ping',
- ),
- array(
- 'server' => 'goo',
- 'name' => _PINGJP_GOO,
- 'addr' => 'http://blog.goo.ne.jp/XMLRPC',
- 'method' => 'weblogUpdates.ping',
- ),
- array(
- 'server' => 'ask',
- 'name' => _PINGJP_ASK,
- 'addr' => 'http://ping.ask.jp/xmlrpc.m',
- 'method' => 'weblogUpdates.ping',
- ),
- array(
- 'server' => 'pingoo',
- 'name' => _PINGJP_PINGOO,
- 'addr' => 'http://pingoo.jp/ping/',
- 'method' => 'weblogUpdates.ping',
- ),
- array(
- 'server' => 'blogs',
- 'name' => _PINGJP_BLOGS,
- 'addr' => 'http://ping.blo.gs/',
- 'method' => 'weblogUpdates.extendedPing',
- ),
- );
- }
-
- // }}}
- // {{{ function getEventList()
-
- /**
- * Event list plugin exist
- *
- * @return array
- * exist events
- */
- function getEventList()
- {
- return array(
- 'SendPing',
- 'JustPosted',
- );
- }
-
- // }}}
- // {{{ function event_JustPosted($data)
-
- /**
- * Event ITEM timstamp as now send update ping or etc.
- *
- * @param array
- * blogid : value intger
- * blog ID
- * pinged : reference boolean
- * Update ping completed as true
- * @return void
- */
- function event_JustPosted($data)
- {
- if ($data['pinged'] == true) {
- return;
- }
- if ($this->getBlogOption($data['blogid'], 'pingjp_background') == "yes") {
-// $directory = $this->getDirectory();
-// // TODO: Check
-// if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
-// system("start /b php " . $directory . "ping.php " . $data['blogid'] . " > nul" );
-// } else {
-// exec("php " . $directory . "ping.php " . $data['blogid'] . " > /dev/null &");
-// }
- register_shutdown_function(array($this, 'SendPingBackground'), $data['blogid'], 2);
- } else {
- $this->sendPings($data['blogid'], 1);
- }
- $data['pinged'] = true;
- }
-
- // }}}
- // {{{ function event_SendPing($data)
-
- /**
- * Event send weblog updates ping when add ITEM
- *
- * @param array
- * blogid : value intger
- * blog ID
- * @return void
- */
- function event_SendPing($data)
- {
- if ($this->bgping)
- register_shutdown_function(array($this, 'SendPingBackground'), $data['blogid']);
- else
- $this->sendPing($data['blogid']);
- }
-
- // }}}
- // {{{ function SendPingBackground($bid)
-
- /**
- * Send weblog update ping on background
- *
- * @param intger
- * blog ID
- * @return void
- */
- function SendPingBackground($bid)
- {
- while( @ob_end_flush() ) ;
- sql_connect();
- $this->sendPing($bid ,2);
- }
-
- // }}}
- // {{{ function sendPing($myBlogId, $background = 0)
-
- /**
- * Setting ping servers
- *
- * @param intger
- * blog ID
- * @param intger
- * Send ping mode
- * 0 : display mode
- * 1 : non display mode
- * 2 : background mode
- * @return void
- */
- function sendPing($bid, $background = 0)
- {
- $targets = $this->getPingingServers($bid);
-
- $this->ahttp = new cles_AsyncHTTP_RawPost();
- $this->ahttp->userAgent = "Nucleus(NP_PingJP Plugin)";
- $this->ahttp->timeout = 15;
-
- $header = "Accept-Charset: UTF-8\r\nContent-Type: text/xml\r\n";
- $messages = array();
- $logMsg = 'NP_PingJP: Send Ping';
- if ($background == 1) {
- $logMsg = 'NP_PingJP: ' . _PINGJP_NON_DISPLAY;
- } elseif ($background == 2) {
- $logMsg = 'NP_PingJP: ' . _PINGJP_BACKGROUND;
- }
- ACTIONLOG::add(INFO, $logMsg);
- foreach ($targets as $target) {
- $res = $this->sendUpdatePing($bid, $target, $header);
- if ($background == 0) {
- echo _PINGJP_PINGING . $target['name'] . ':<br />';
- }
- $messages[$res[0]] =& $res[1];
- }
- $responses = $this->ahttp->getResponses();
- foreach ($messages as $id => $message) {
- $target = $targets[$id]['name'];
- if (isset($responses[$id])) {
- $response = $message->parseResponse($responses[$id]);
- $results = $this->processPingResult($response);
- } else {
- $message = $this->ahttp->getErrorNo($id);
- $errorId = $this->ahttp->getError($id);
- $response = $this->ahttp->_responses[$id];
- if ($errorId == 110) {
- $results['message'] = "Connection timeout($errorId)";
- } elseif (strpos($message, 'HTTP Error') !== false) {
- preg_match("/.*\[([0-9]{3})\] \(.*\) (.*)$/", $message, $matchies);
- if ($matchies[1]) {
- $rescode = $matchies[1];
- $rescstr = $matchies[2];
- $results['message'] = "HTTP Error: $target $rescode $rescstr";
- } else {
- $results['message'] = "HTTP Error: $target Response Null";
- }
- } else {
- $results['message'] = "Unknown Error: $errorId: $message, $response";
- }
- $results['error'] = true;
- }
- $logMsg = $target . ' : ' . $results['message'];
- if ($results['error']) {
- ACTIONLOG::add(WARNING, 'NP_PingJP Error: ' . $logMsg);
- } elseif ($this->debug || $background) {
- ACTIONLOG::add(INFO, 'NP_PingJP Pinged: ' . $logMsg);
- }
- if ($background == 0) {
- echo $logMsg . "<br />\n";
- if ($results['error'] && $response->errno == 2 && $this->debug) {
- $resultXML = $response->raw_data;
- echo '-------------------- ' . $target . ' receive data --------------------<br />';
- echo '<pre>' . htmlspecialchars($resultXML, ENT_NOQUOTES, _CHARSET, false) . '</pre>';
- echo '-------------------- ' . $target . ' receive data --------------------<br />';
- }
- }
- }
- if ($GLOBALS['xmlrpc_internalencoding'] != $this->xmlrpc_internalencoding_org) {
- $GLOBALS['xmlrpc_internalencoding'] = $this->xmlrpc_internalencoding_org;
- }
- $this->faltMessageSet = false;
- }
-
- // }}}
- // {{{ function sendUpdatePing($myBlogId, $pingServer, $header)
-
- /**
- * Setting ping message
- *
- * @param intger
- * blog ID
- * @param array
- * ping server settigs
- * name : name of ping server
- * host : URI of ping server
- * meth : method of ping server accept
- * @param string
- * http request header
- * @return void
- */
- function sendUpdatePing($bid, $server, $header)
- {
- global $manager;
- if (!class_exists('xmlrpcmsg')) {
- global $DIR_LIBS;
- include_once($DIR_LIBS . 'xmlrpc.inc.php');
- }
- if ($GLOBALS['xmlrpc_internalencoding'] != 'UTF-8') {
- $this->xmlrpc_internalencoding_org = $GLOBALS['xmlrpc_internalencoding'];
- $GLOBALS['xmlrpc_internalencoding'] = 'UTF-8';
- }
-
- if (!$this->faltMessageSet) {
- $GLOBALS['xmlrpcstr']['unknown_method'] = _PINGJP_XMLRPCFAULT_UNKNOWN_METHOD;
- $GLOBALS['xmlrpcstr']['invalid_return'] = _PINGJP_XMLRPCFAULT_INVALID_RETURN;
- $GLOBALS['xmlrpcstr']['incorrect_params'] = _PINGJP_XMLRPCFAULT_INCORRECT_PARAMS;
- $GLOBALS['xmlrpcstr']['introspect_unknown'] = _PINGJP_XMLRPCFAULT_INTROSPECT_UNKNOWN;
- $GLOBALS['xmlrpcstr']['http_error'] = _PINGJP_XMLRPCFAULT_HTTP_ERROR;
- $GLOBALS['xmlrpcstr']['no_data'] = _PINGJP_XMLRPCFAULT_NO_DATA;
- $GLOBALS['xmlrpcstr']['no_ssl'] = _PINGJP_XMLRPCFAULT_NO_SSL;
- $GLOBALS['xmlrpcstr']['curl_fail'] = _PINGJP_XMLRPCFAULT_CURL_FAIL;
- $GLOBALS['xmlrpcstr']['invalid_request'] = _PINGJP_XMLRPCFAULT_INVALID_REQUEST;
- $GLOBALS['xmlrpcstr']['no_curl'] = _PINGJP_XMLRPCFAULT_NO_CURL;
- $GLOBALS['xmlrpcstr']['server_error'] = _PINGJP_XMLRPCFAULT_SERVER_ERROR;
- $GLOBALS['xmlrpcstr']['multicall_error'] = _PINGJP_XMLRPCFAULT_MULTICALL_ERROR;
-
- $GLOBALS['xmlrpcstr']['multicall_notstruct'] = _PINGJP_XMLRPCFAULT_MULTICALL_NOTSTRUCT;
- $GLOBALS['xmlrpcstr']['multicall_nomethod'] = _PINGJP_XMLRPCFAULT_MULTICALL_NOMETHOD;
- $GLOBALS['xmlrpcstr']['multicall_notstring'] = _PINGJP_XMLRPCFAULT_MULTICALL_NOTSTRING;
- $GLOBALS['xmlrpcstr']['multicall_recursion'] = _PINGJP_XMLRPCFAULT_MULTICALL_RECURSION;
- $GLOBALS['xmlrpcstr']['multicall_noparams'] = _PINGJP_XMLRPCFAULT_MULTICALL_NOPARAMS;
- $GLOBALS['xmlrpcstr']['multicall_notarray'] = _PINGJP_XMLRPCFAULT_MULTICALL_NOTARRAY;
-
- $GLOBALS['xmlrpcstr']['cannot_decompress'] = _PINGJP_XMLRPCFAULT_CANNOT_DECOMPRESS;
- $GLOBALS['xmlrpcstr']['decompress_fail'] = _PINGJP_XMLRPCFAULT_DECOMPRESS_FAIL;
- $GLOBALS['xmlrpcstr']['dechunk_fail'] = _PINGJP_XMLRPCFAULT_DECHUNK_FAIL;
- $GLOBALS['xmlrpcstr']['server_cannot_decompress'] = _PINGJP_XMLRPCFAULT_SERVER_CANNOT_DECOMPRESS;
- $GLOBALS['xmlrpcstr']['server_decompress_fail'] = _PINGJP_XMLRPCFAULT_SERVER_DECOMPRESS_FAIL;
-
- $this->faltMessageSet = true;
- }
-
- $b =& $manager->getBlog($bid);
- $name = $b->getName();
- $burl = $this->getBlogOption($bid, 'pingjp_updateurl');
- if (!$burl) {
- $burl = $b->getURL();
- }
- $data = array();
- if (_CHARSET != 'UTF-8') {
- mb_convert_encoding($name, 'UTF-8', _CHARSET);
- }
- $data[] = new xmlrpcval($name, 'string');
- $data[] = new xmlrpcval($burl, 'string');
- if ($server['method'] == 'weblogUpdates.extendedPing') {
- $feedURL = $this->getBlogOption($myBlogid, 'pingjp_feedurl');
- if (!$feedURL) {
- global $CONF;
- $feedURL = $CONF['IndexURL'] . 'xml-rss2.php?blogid=' . $bid;
- }
- $data[] = new xmlrpcval($burl, 'string');
- $data[] = new xmlrpcval($feedURL, 'string');
- }
- $message = new xmlrpcmsg($server['method'], $data);
- if ($this->debug) {
- $requestXML = htmlspecialchars(mb_convert_encoding($message->serialize('UTF-8'), _CHARSET, 'UTF-8'), ENT_NOQUOTES, _CHARSET, false);
- echo '-------------------- ' . $server['name'] . ' send data --------------------<br />';
- echo '<pre>' . $requestXML . '</pre>';
- echo '-------------------- ' . $server['name'] . ' send data --------------------<br />';
- }
- $reqestId = $this->ahttp->setRequest($server['addr'], 'POST', $header, $message->serialize('UTF-8'));
- return array($reqestId, &$message);
- }
-
- // }}}
- // {{{ function processPingResult($response)
-
- /**
- * Process pinging result
- *
- * @param object
- * weblog updates ping response
- * @return array
- * error : boolean
- * ping response status
- * message : string
- * ping response messages
- */
- function processPingResult($response)
- {
- global $php_errormsg;
- if (($response == 0) && ($response->errno || $response->errstring)) {
- $ret['error'] = true;
- $ret['message'] = _PINGJP_ERROR
- . ' ' . $response->errno
- . ' : ' . $response->errstring;
- } elseif (($response == 0) && ($php_errormsg)) {
- $ret['error'] = true;
- $ret['message'] = _PINGJP_PHP_ERROR . ' ' . $php_errormsg;
- } elseif ($response == 0) {
- $ret['error'] = true;
- $ret['message'] = _PINGJP_PHP_PING_ERROR;
- } elseif ($response->faultCode() != 0) {
- $ret['error'] = true;
- $ret['message'] = _PINGJP_ERROR . ' : ' . $response->faultString();
- } else {
- $struct = $response->value(); // get response struct
- // get values
- $flerror = $struct->structmem('flerror');
- $flerror = $flerror->scalarval();
- $message = $struct->structmem('message');
- $message = $message->scalarval();
- if ($flerror != 0) {
- $ret['error'] = true;
- $ret['message'] = _PINGJP_ERROR . ' (flerror=1): ' . $message;
- } else {
- $ret['error'] = false;
- $ret['message'] = _PINGJP_SUCCESS . ' : ' . $message;
- }
- }
- return $ret;
- }
-
- // }}}
- // {{{ function getPingingServers($bid)
-
- /**
- * Process pinging result
- *
- * @param intger
- * blog ID
- * @return array
- * targets : array
- * server : string
- * ping server
- * name : string
- * ping server name
- * host : string
- * server host addr.
- * method : string
- * update ping method
- */
- function getPingingServers($bid)
- {
- $servers = $this->servers;
- $targets = array();
- foreach ($servers as $key => $server) {
- $serverName = 'pingjp_' . $server['server'];
- $info = $this->getBlogOption(intval($bid), $serverName);
- if ($info == 'yes') {
- $targets[] = $server;
- }
- }
- $others = $this->getBlogOption($bid, 'pingjp_otherurl');
- if ($others != '') {
- $servers = preg_split("/[\s,]+/", $others);
- foreach ($servers as $server) {
- if (strpos($server, ',')) {
- list($url, $method) = explode(',', $server);
- $parsed = parse_url($url);
- if ($method == 'ex') {
- $method = 'weblogUpdates.extendedPing';
- }
- } else {
- $parsed = parse_url($server);
- $method = 'weblogUpdates.ping';
- }
- $target['server'] = $parsed['host'];
- $target['name'] = $parsed['host'];
- $target['addr'] = $server;
- $target['method'] = $method;
- $targets[] = $target;
- }
- }
-// print_r($targets);
- return $targets;
- }
-}
+++ /dev/null
-<?php
- define('_PINGJP_DESC', 'This plugin can be used to ping many blog tracking services. - Don\'t forget to enable the option \'Ping weblog listing service on update\' in your blog settings!');
- define('_PINGJP_PINGOM', 'Ping-o-matic');
- define('_PINGJP_WEBLOGS', 'weblogs.com');
- define('_PINGJP_TECHNOR', 'Technorati');
- define('_PINGJP_GOOGLE', 'Google Japan');
- define('_PINGJP_YAHOO', 'Yahoo! Japan');
- define('_PINGJP_PINGOO', 'Pingoo! (need registration)');
- define('_PINGJP_GOO', 'Goo');
- define('_PINGJP_BLOG360', 'Blog360');
- define('_PINGJP_ASK', 'ask');
- define('_PINGJP_BLOGR', 'Blogrolling.com');
- define('_PINGJP_BLOGS', 'Blo.gs (no longer works?)');
- define('_PINGJP_WEBLOGUES', 'Weblogues (no longer works?)');
- define('_PINGJP_BLOGGDE', 'Blogg.de (not working??)');
- define('_PINGJP_BG', 'Ping from background when a future post first appears');
- define('_PINGJP_UPDURL', 'Blog URI send to ping servers');
- define('_PINGJP_UPDFEED', 'Feed URI send to ping servers(Ex:http://example.com/xml-rss2.php?blogid=2)');
- define('_PINGJP_PINGING', 'Pinging ');
- define('_PINGJP_ERROR', 'Error');
- define('_PINGJP_UNKNOWN_ERROR', 'Unknown Error');
- define('_PINGJP_PHP_ERROR', 'PHP Error: ');
- define('_PINGJP_PHP_PING_ERROR', 'Error while trying to send ping. Sorry about that.');
- define('_PINGJP_SUCCESS', 'Success');
- define('_PINGJP_FORMEXTRA', 'Send ping when you edit ITEM ?');
- define('_PINGJP_NON_DISPLAY', 'Sending WeblogsUpdatePing at non display mode.');
- define('_PINGJP_BACKGROUND', 'Sending WeblogsUpdatePing at non background mode.');
-
-
- define('_PINGJP_XMLRPCFAULT_UNKNOWN_METHOD', 'Unknown method');
- define('_PINGJP_XMLRPCFAULT_INVALID_RETURN', 'Invalid return payload: enable debugging to examine incoming payload');
- define('_PINGJP_XMLRPCFAULT_INCORRECT_PARAMS', 'Incorrect parameters passed to method');
- define('_PINGJP_XMLRPCFAULT_INTROSPECT_UNKNOWN', "Can't introspect: method unknown");
- define('_PINGJP_XMLRPCFAULT_HTTP_ERROR', "Didn't receive 200 OK from remote server.");
- define('_PINGJP_XMLRPCFAULT_NO_DATA', 'No data received from server.');
- define('_PINGJP_XMLRPCFAULT_NO_SSL', 'No SSL support compiled in.');
- define('_PINGJP_XMLRPCFAULT_CURL_FAIL', 'CURL error');
- define('_PINGJP_XMLRPCFAULT_INVALID_REQUEST', 'Invalid request payload');
- define('_PINGJP_XMLRPCFAULT_NO_CURL', 'No CURL support compiled in.');
- define('_PINGJP_XMLRPCFAULT_SERVER_ERROR', 'Internal server error');
- define('_PINGJP_XMLRPCFAULT_MULTICALL_ERROR', 'Received from server invalid multicall response');
-
- define('_PINGJP_XMLRPCFAULT_MULTICALL_NOTSTRUCT', 'system.multicall expected struct');
- define('_PINGJP_XMLRPCFAULT_MULTICALL_NOMETHOD', 'missing methodName');
- define('_PINGJP_XMLRPCFAULT_MULTICALL_NOTSTRING', 'methodName is not a string');
- define('_PINGJP_XMLRPCFAULT_MULTICALL_RECURSION', 'recursive system.multicall forbidden');
- define('_PINGJP_XMLRPCFAULT_MULTICALL_NOPARAMS', 'missing params');
- define('_PINGJP_XMLRPCFAULT_MULTICALL_NOTARRAY', 'params is not an array');
-
- define('_PINGJP_XMLRPCFAULT_CANNOT_DECOMPRESS', 'Received from server compressed HTTP and cannot decompress');
- define('_PINGJP_XMLRPCFAULT_DECOMPRESS_FAIL', 'Received from server invalid compressed HTTP');
- define('_PINGJP_XMLRPCFAULT_DECHUNK_FAIL', 'Received from server invalid chunked HTTP');
- define('_PINGJP_XMLRPCFAULT_SERVER_CANNOT_DECOMPRESS', 'Received from client compressed HTTP request and cannot decompress');
- define('_PINGJP_XMLRPCFAULT_SERVER_DECOMPRESS_FAIL', 'Received from client invalid compressed HTTP request');
+++ /dev/null
-<?php
- define('_PINGJP_DESC', '¤³¤Î¥×¥é¥°¥¤¥ó¤Ï°ìÅ٤˿¤¯¤Î¥Ö¥í¥°¥È¥é¥Ã¥¥ó¥°¥·¥¹¥Æ¥à¤Ë ping ¤òÁ÷¿®¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£<br />'
- . '- ¥Ö¥í¥°ÀßÄê¤Ç¡Ö¹¹¿·»þ¤Ëweblogs¥¢¥Ã¥×¥Ç¡¼¥ÈÄÌÃÎ¥µ¡¼¥Ó¥¹¤ØPing¤òÁ÷¤ê¤Þ¤¹¤«?¡×¤Î¥ª¥×¥·¥ç¥ó¤ò¡Ö¤Ï¤¤¡×¤Ë¤¹¤ë¤³¤È¤ò˺¤ì¤Ê¤¤¤è¤¦¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£');
- define('_PINGJP_PINGOM', 'Ping-o-matic (Í×ÅÐÏ¿)');
- define('_PINGJP_WEBLOGS', 'weblogs.com');
- define('_PINGJP_TECHNOR', 'Technorati');
- define('_PINGJP_GOOGLE', 'Google Japan');
- define('_PINGJP_YAHOO', 'Yahoo! Japan');
- define('_PINGJP_PINGOO', 'Pingoo! (Í×ÅÐÏ¿)');
- define('_PINGJP_GOO', 'Goo');
- define('_PINGJP_ASK', 'ask');
- define('_PINGJP_BLOGR', 'Blogrolling.com');
- define('_PINGJP_BLOGS', 'Blo.gs (¥µ¡¼¥Ó¥¹½ªÎ»¡©)');
- define('_PINGJP_OTHER', '¤½¤Î¾¤Î¹¹¿·Ping¼õÉÕ¥µ¡¼¥Ð');
- define('_PINGJP_BG', '̤Íè¤ÎÆüÉդε»ö¤¬Í¸ú¤Ë¤Ê¤Ã¤¿¤È¤¥Ð¥Ã¥¯¥°¥é¥ó¥É¤Ç ping ¤òÁ÷¿®¤¹¤ë');
- define('_PINGJP_UPDURL', 'Ping¥µ¡¼¥Ð¤ËÁ÷¿®¤¹¤ë¥Ö¥í¥°¤ÎURL');
- define('_PINGJP_UPDFEED', 'Ping¥µ¡¼¥Ð¤ËÁ÷¿®¤¹¤ëRSSÅù¤ÎURL(Îã:http://example.com/xml-rss2.php?blogid=2)');
- define('_PINGJP_PINGING', 'Ping Á÷¿®Ãæ ');
- define('_PINGJP_ERROR', '¥¨¥é¡¼');
- define('_PINGJP_UNKNOWN_ERROR', 'ÉÔÌÀ¤Ê¥¨¥é¡¼');
- define('_PINGJP_PHP_ERROR', 'PHP ¥¨¥é¡¼: ');
- define('_PINGJP_PHP_PING_ERROR', '¿½¤·Ìõ¤¢¤ê¤Þ¤»¤ó¡£ping ¤òÁ÷¿®Ãæ¤Ë¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£');
- define('_PINGJP_SUCCESS', 'À®¸ù');
- define('_PINGJP_FORMEXTRA', '¹¹¿·¸å ping Á÷¿®¤·¤Þ¤¹¤«¡©');
- define('_PINGJP_NON_DISPLAY', 'Èóɽ¼¨¥â¡¼¥É¤Ç ping ¤òÁ÷¿®¤·¤Þ¤·¤¿¡£');
- define('_PINGJP_BACKGROUND', '¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¥â¡¼¥É¤Ç ping ¤òÁ÷¿®¤·¤Þ¤·¤¿¡£');
-
-
- define('_PINGJP_XMLRPCFAULT_UNKNOWN_METHOD', '¥á¥½¥Ã¥É¤¬ÉÔÌÀ¤Ç¤¹');
- define('_PINGJP_XMLRPCFAULT_INVALID_RETURN', '¥µ¡¼¥Ð¤«¤é¤Î¥ì¥¹¥Ý¥ó¥¹¤¬ÉÔÀµ¤Ç¤¹: ¥Ç¥Ð¥Ã¥°¥â¡¼¥É¤ò͸ú¤Ë¤·¤Æ¡¢¼õ¿®¥Ç¡¼¥¿¤ò¸¡¾Ú¤·¤Æ¤¯¤À¤µ¤¤');
- define('_PINGJP_XMLRPCFAULT_INCORRECT_PARAMS', '¥á¥½¥Ã¥É¤Ë¸í¤Ã¤¿¥Ñ¥é¥á¡¼¥¿¤¬ÅϤµ¤ì¤Þ¤·¤¿');
- define('_PINGJP_XMLRPCFAULT_INTROSPECT_UNKNOWN', '²òÀÏÉÔǽ: ¥á¥½¥Ã¥É¤¬ÉÔÌÀ¤Ç¤¹');
- define('_PINGJP_XMLRPCFAULT_HTTP_ERROR', '¥ê¥â¡¼¥È¥µ¡¼¥Ð¤«¤é\8e¢200 OK\8e£¤ò¼õ¿®¤·¤Þ¤»¤ó¤Ç¤·¤¿');
- define('_PINGJP_XMLRPCFAULT_NO_DATA', '¥µ¡¼¥Ð¤«¤é¥Ç¡¼¥¿¤ò¼õ¿®¤·¤Þ¤»¤ó¤Ç¤·¤¿');
- define('_PINGJP_XMLRPCFAULT_NO_SSL', 'SSL¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Þ¤»¤ó');
- define('_PINGJP_XMLRPCFAULT_CURL_FAIL', 'CURL¤Î¥¨¥é¡¼¤Ç¤¹');
- define('_PINGJP_XMLRPCFAULT_INVALID_REQUEST', 'ÉÔÀµ¤Ê¥ê¥¯¥¨¥¹¥È¤Ç¤¹');
- define('_PINGJP_XMLRPCFAULT_NO_CURL', 'CURL¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Þ¤»¤ó');
- define('_PINGJP_XMLRPCFAULT_SERVER_ERROR', '¥µ¡¼¥ÐÆâÉô¤Ç¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿');
- define('_PINGJP_XMLRPCFAULT_MULTICALL_ERROR', '¥µ¡¼¥Ð¤«¤éÉÔÀµ¤Ê¥Þ¥ë¥Á¥³¡¼¥ë¥ì¥¹¥Ý¥ó¥¹¤ò¼õ¿®¤·¤Þ¤·¤¿');
-
- define('_PINGJP_XMLRPCFAULT_MULTICALL_NOTSTRUCT', 'system.multicall expected struct');
- define('_PINGJP_XMLRPCFAULT_MULTICALL_NOMETHOD', '¥á¥½¥Ã¥É̾¤¬¤¢¤ê¤Þ¤»¤ó');
- define('_PINGJP_XMLRPCFAULT_MULTICALL_NOTSTRING', '¥á¥½¥Ã¥É̾¤¬Ê¸»úÎó¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó');
- define('_PINGJP_XMLRPCFAULT_MULTICALL_RECURSION', 'µ¢Ç¼Åªsystem.multicall¤Ï¶Ø¤¸¤é¤ì¤Æ¤¤¤Þ¤¹');
- define('_PINGJP_XMLRPCFAULT_MULTICALL_NOPARAMS', '¥Ñ¥é¥á¡¼¥¿¤¬¤¢¤ê¤Þ¤»¤ó');
- define('_PINGJP_XMLRPCFAULT_MULTICALL_NOTARRAY', '¥Ñ¥é¥á¡¼¥¿¤¬ÇÛÎó¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó');
-
- define('_PINGJP_XMLRPCFAULT_CANNOT_DECOMPRESS', '¥µ¡¼¥Ð¤«¤é°µ½Ì¤µ¤ì¤¿¥Ç¡¼¥¿¤ò¼õ¿®¤·¤Þ¤·¤¿¤¬¡¢Å¸³«¤¹¤ë»ö¤¬½ÐÍè¤Þ¤»¤ó');
- define('_PINGJP_XMLRPCFAULT_DECOMPRESS_FAIL', '¼õ¿®¤·¤¿°µ½Ì¥Ç¡¼¥¿¤¬ÉÔÀµ¤Ç¤¹');
- define('_PINGJP_XMLRPCFAULT_DECHUNK_FAIL', '¼õ¿®¤·¤¿¥Ç¡¼¥¿¤¬ÉÔÀµ¤Ç¤¹');
- define('_PINGJP_XMLRPCFAULT_SERVER_CANNOT_DECOMPRESS', '¥¯¥é¥¤¥¢¥ó¥È¤«¤é¥ê¥¯¥¨¥¹¥È¤È¤·¤Æ°µ½Ì¤µ¤ì¤¿¥Ç¡¼¥¿¤ò¼õ¿®¤·¤Þ¤·¤¿¤¬¡¢Å¸³«¤¹¤ë»ö¤¬½ÐÍè¤Þ¤»¤ó');
- define('_PINGJP_XMLRPCFAULT_SERVER_DECOMPRESS_FAIL', '¥¯¥é¥¤¥¢¥ó¥È¤«¤é¥ê¥¯¥¨¥¹¥È¤È¤·¤Æ¼õ¿®¤·¤¿°µ½Ì¥Ç¡¼¥¿¤¬ÉÔÀµ¤Ç¤¹');
-
-
-
-
+++ /dev/null
-<?php
- define('_PINGJP_DESC', 'このプラグインは一度に多くのブログトラッキングシステムに ping を送信することができます。<br />'
- . '- ブログ設定で「更新時にweblogsアップデート通知サービスへPingを送りますか?」のオプションを「はい」にすることを忘れないようにしてください。');
- define('_PINGJP_PINGOM', 'Ping-o-matic (要登録)');
- define('_PINGJP_WEBLOGS', 'weblogs.com');
- define('_PINGJP_TECHNOR', 'Technorati');
- define('_PINGJP_GOOGLE', 'Google Japan');
- define('_PINGJP_YAHOO', 'Yahoo! Japan');
- define('_PINGJP_PINGOO', 'Pingoo! (要登録)');
- define('_PINGJP_GOO', 'Goo');
- define('_PINGJP_ASK', 'ask');
- define('_PINGJP_BLOGR', 'Blogrolling.com');
- define('_PINGJP_BLOGS', 'Blo.gs (サービス終了?)');
- define('_PINGJP_OTHER', 'その他の更新Ping受付サーバ');
- define('_PINGJP_BG', '未来の日付の記事が有効になったときバックグランドで ping を送信する');
- define('_PINGJP_UPDURL', 'Pingサーバに送信するブログのURL');
- define('_PINGJP_UPDFEED', 'Pingサーバに送信するRSS等のURL(例:http://example.com/xml-rss2.php?blogid=2)');
- define('_PINGJP_PINGING', 'Ping 送信中 ');
- define('_PINGJP_ERROR', 'エラー');
- define('_PINGJP_UNKNOWN_ERROR', '不明なエラー');
- define('_PINGJP_PHP_ERROR', 'PHP エラー: ');
- define('_PINGJP_PHP_PING_ERROR', '申し訳ありません。ping を送信中にエラーが発生しました。');
- define('_PINGJP_SUCCESS', '成功');
- define('_PINGJP_FORMEXTRA', '更新後 ping 送信しますか?');
- define('_PINGJP_NON_DISPLAY', '非表示モードで ping を送信しました。');
- define('_PINGJP_BACKGROUND', 'バックグラウンドモードで ping を送信しました。');
-
-
- define('_PINGJP_XMLRPCFAULT_UNKNOWN_METHOD', 'メソッドが不明です');
- define('_PINGJP_XMLRPCFAULT_INVALID_RETURN', 'サーバからのレスポンスが不正です: デバッグモードを有効にして、受信データを検証してください');
- define('_PINGJP_XMLRPCFAULT_INCORRECT_PARAMS', 'メソッドに誤ったパラメータが渡されました');
- define('_PINGJP_XMLRPCFAULT_INTROSPECT_UNKNOWN', '解析不能: メソッドが不明です');
- define('_PINGJP_XMLRPCFAULT_HTTP_ERROR', 'リモートサーバから「200 OK」を受信しませんでした');
- define('_PINGJP_XMLRPCFAULT_NO_DATA', 'サーバからデータを受信しませんでした');
- define('_PINGJP_XMLRPCFAULT_NO_SSL', 'SSLはサポートされていません');
- define('_PINGJP_XMLRPCFAULT_CURL_FAIL', 'CURLのエラーです');
- define('_PINGJP_XMLRPCFAULT_INVALID_REQUEST', '不正なリクエストです');
- define('_PINGJP_XMLRPCFAULT_NO_CURL', 'CURLはサポートされていません');
- define('_PINGJP_XMLRPCFAULT_SERVER_ERROR', 'サーバ内部でエラーが発生しました');
- define('_PINGJP_XMLRPCFAULT_MULTICALL_ERROR', 'サーバから不正なマルチコールレスポンスを受信しました');
-
- define('_PINGJP_XMLRPCFAULT_MULTICALL_NOTSTRUCT', 'system.multicall expected struct');
- define('_PINGJP_XMLRPCFAULT_MULTICALL_NOMETHOD', 'メソッド名がありません');
- define('_PINGJP_XMLRPCFAULT_MULTICALL_NOTSTRING', 'メソッド名が文字列ではありません');
- define('_PINGJP_XMLRPCFAULT_MULTICALL_RECURSION', '帰納的system.multicallは禁じられています');
- define('_PINGJP_XMLRPCFAULT_MULTICALL_NOPARAMS', 'パラメータがありません');
- define('_PINGJP_XMLRPCFAULT_MULTICALL_NOTARRAY', 'パラメータが配列ではありません');
-
- define('_PINGJP_XMLRPCFAULT_CANNOT_DECOMPRESS', 'サーバから圧縮されたデータを受信しましたが、展開する事が出来ません');
- define('_PINGJP_XMLRPCFAULT_DECOMPRESS_FAIL', '受信した圧縮データが不正です');
- define('_PINGJP_XMLRPCFAULT_DECHUNK_FAIL', '受信したデータが不正です');
- define('_PINGJP_XMLRPCFAULT_SERVER_CANNOT_DECOMPRESS', 'クライアントからリクエストとして圧縮されたデータを受信しましたが、展開する事が出来ません');
- define('_PINGJP_XMLRPCFAULT_SERVER_DECOMPRESS_FAIL', 'クライアントからリクエストとして受信した圧縮データが不正です');
-
-
-
-
+++ /dev/null
-<?php
-require(dirname(__FILE__).'/../../../config.php');
-
-include($DIR_LIBS . 'PLUGINADMIN.php');
-
-// create a object of the plugin via Plugin Admin
-$oPluginAdmin = new PluginAdmin('Ping');
-
-$blogid = intval($argv[1]);
-if ($blogid > 0) {
- $oPluginAdmin->plugin->sendPings($blogid, 2);
-} else {
- ACTIONLOG::add(WARNING, 'NP_Ping: invalid blogid, background ping abort');
-}
\ No newline at end of file
+++ /dev/null
-<?php
-// vim: tabstop=2:shiftwidth=2
-
-/**
- * AsyncHTTP.php ($Revision: 1.1 $)
- *
- * by hsur ( http://blog.cles.jp/np_cles )
- * $Id: AsyncHTTP.php,v 1.1 2007-10-28 15:57:41 shizuki Exp $
- */
-
-/*
- * Copyright (C) 2007 CLES. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives
- * permission to link the code of this program with those files in the PEAR
- * library that are licensed under the PHP License (or with modified versions
- * of those files that use the same license as those files), and distribute
- * linked combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than those files in
- * the PEAR library that are licensed under the PHP License. If you modify
- * this file, you may extend this exception to your version of the file,
- * but you are not obligated to do so. If you do not wish to do so, delete
- * this exception statement from your version.
- */
-
-/* Examples
- *
- * $ahttp = new cles_AsyncHTTP();
- *
- * $reqestId[] = $http->setRequest('http://example.com/url1','GET');
- * $reqestId[] = $http->setRequest('http://example.com/url2','GET');
- *
- * $response = $http->getResponses();
- */
-
-define('CLES_ASYNCHTTP_GETBYTES', 8192);
-define('CLES_ASYNCHTTP_INPROGRESS', 115);
-define('CLES_ASYNCHTTP_TIMEOUT', 110);
-
-class cles_AsyncHTTP {
- var $asyncMode;
- var $timeout = 120;
- var $userAgent = 'CLES AsyncHTTP Lib';
-
- var $_requests;
- var $_sockets;
- var $_responses;
- var $_errornos;
- var $_errorstrs;
-
- var $_debug = false;
- var $_debugMsg = '';
-
- function _getTimeStamp(){
- list($usec, $sec) = explode(" ", microtime());
- return $timestamp = date('Y/m/d H:i:s').substr($usec,1);
- }
-
- function _log($msg){
- $m = $this->_getTimeStamp().':'.$msg."\n";
- $this->_debugMsg .= $m;
-// echo $msg;
- }
-
- function cles_AsyncHTTP(){
- $this->init();
- }
-
- function init() {
- $this->_requests = array();
- $this->_sockets = array();
- $this->_responses = array();
- $this->_errornos = array();
- $this->_errorstrs = array();
-
- $this->asyncMode = function_exists('socket_create') ? true : false;
- }
-
- function setRequest($url, $method = "", $headers = "", $post = array ("")){
- $this->_requests[] = func_get_args();
- return count($this->_requests) - 1;
- }
-
- function getResponses(){
- $this->_startedTimestamp = $this->_getTimeStamp();
-
- if( $this->asyncMode )
- $this->_sendAsync();
- else
- $this->_sendSync();
-
- foreach( $this->_responses as $id => $response){
- if( $this->_errornos[$id] !== 0 ){
- unset($this->_responses[$id]);
- continue;
- }
-
- list($header, $body) = split("\r\n\r\n", $response, 2);
- preg_match("/HTTP\/1\.[0-1] ([0-9]+) ([^\r\n]*)\r?\n/", $header, $httpresp);
- $respCd = $httpresp[1];
- $respMsg = $httpresp[2];
-
- if( $respCd != '200' ){
- $this->_errornos[$id] = -1;
- $this->_errorstrs[$id] = 'HTTP Error: '."[$respCd] (".$this->_requests[$id][0].") $respMsg";
- unset($this->_responses[$id]);
- } else {
- $this->_responses[$id] = $body;
- }
- }
-
- $this->_finishedTimestamp = $this->_getTimeStamp();
- return $this->_responses;
- }
-
- function isError($id){
- if( $this->_errornos[$id] === 0 )
- return false;
- else
- return true;
- }
-
- function getErrorNo($id){
- return $this->_errornos[$id];
- }
-
- function getError($id){
- return $this->_errorstrs[$id];
- }
-
- function _sendAsync(){
- $this->_debug && $this->_log('Using async mode.');
- $expired = time() + $this->timeout;
-
- // connect
- foreach ($this->_requests as $id => $request) {
- $url = parse_url($request[0]);
- $port = ($url['port'] ? $url['port'] : 80);
-
- $this->_debug && $this->_log('Open async connection (id:'.$id.')');
- if (phpversion() >= '5.0.0') {
- $s = stream_socket_client($url['host'].":".$port, $this->_errornos[$id], $this->_errorstrs[$id], $this->timeout, STREAM_CLIENT_ASYNC_CONNECT);
- } else {
- $s = $this->_async_connect($url['host'], $port, $this->_errornos[$id], $this->_errorstrs[$id], $this->timeout);
- }
- if ($s) {
- $this->_sockets[$id] = $s;
- $this->_responses[$id] = '';
- } else {
- $this->_errornos[$id] = -1;
- $this->_errorstrs[$id] = 'Connection Failed '.__LINE__;
- }
- }
-
- // send and recieve
- while (count($this->_sockets)) {
- $read = $write = $this->_sockets;
- $e = null;
-
- $timeout = $expired - time();
- $timeout = ($timeout < 0 ) ? 0 : $timeout;
-
- $this->_debug && $this->_log('socket_select (timeout:'.$timeout.')');
- if (phpversion() >= '5.0.0') {
- $n = stream_select($read, $write, $e, $timeout );
- } else {
- $n = socket_select($read, $write, $e, $timeout );
- }
-
- if( $n ){
- foreach ($write as $w) {
- $id = array_search($w, $this->_sockets);
- $this->_debug && $this->_log('Request send (id:'.$id.')');
- if (phpversion() >= '5.0.0') {
- fwrite($w, $this->_makePayload($id));
-// stream_socket_shutdown($w, 1);
- } else {
- socket_write($w, $this->_makePayload($id));
- socket_shutdown($w, 1);
- }
- }
- foreach ($read as $r) {
- $id = array_search($r, $this->_sockets);
- if (phpversion() >= '5.0.0') {
- $data = fread($r, CLES_ASYNCHTTP_GETBYTES);
- } else {
- $data = socket_read($r, CLES_ASYNCHTTP_GETBYTES);
- }
- $this->_debug && $this->_log('Response recieved (id:'.$id.', length:'.strlen($data).')');
- if (strlen($data) == 0) {
- if ($this->_errornos[$id] == CLES_ASYNCHTTP_INPROGRESS) {
- $this->_errornos[$id] = -1;
- $this->_errorstrs[$id] = 'Connection Failed'.__LINE__;
- }
- if (phpversion() >= '5.0.0') {
- fclose($r);
- } else {
- socket_close($r);
- }
- unset($this->_sockets[$id]);
- $this->_debug && $this->_log('Connection closed (id:'.$id.')');
- } else {
- $this->_errornos[$id] = 0;
- $this->_errorstrs[$id] = '';
- $this->_responses[$id] .= $data;
- }
- }
- } else {
- foreach ($this->_sockets as $id => $s) {
- $this->_debug && $this->_log('Timeout (id:'.$id.')');
- $this->_errornos[$id] = CLES_ASYNCHTTP_TIMEOUT;
- $this->_errorstrs[$id] = socket_strerror(CLES_ASYNCHTTP_TIMEOUT);
- if (phpversion() >= '5.0.0') {
- fclose($s);
- } else {
- socket_close($s);
- }
- unset($this->_sockets[$id]);
- }
- break;
- }
- }
- }
-
- function _sendSync(){
- $this->_debug && $this->_log('Using sync mode.');
- $expired = time() + $this->timeout;
-
- foreach ($this->_requests as $id => $request) {
- $url = parse_url($request[0]);
- $port = ($url['port'] ? $url['port'] : 80);
-
- $timeout = $expired - time();
- $timeout = ($timeout < 1 ) ? 1 : $timeout;
- $s = fsockopen($url['host'], $port, $this->_errornos[$id], $this->_errorstrs[$id], $timeout);
- stream_set_timeout($s, $timeout);
- if ($s) {
- $this->_responses[$id] = '';
- $this->_debug && $this->_log('Request send (id:'.$id.')');
- fputs($s, $this->_makePayload($id));
- while (!feof($s)) {
- $data = fgets($s, CLES_ASYNCHTTP_GETBYTES);
- $this->_debug && $this->_log('Response recieved (id:'.$id.', length:'.strlen($data).')');
- $this->_responses[$id] .= $data;
- }
- $this->_debug && $this->_log('Connection closed (id:'.$id.')');
- fclose($s);
- } else {
- $this->_errornos[$id] = -1;
- $this->_errorstrs[$id] = 'Connection Failed '.__LINE__;
- }
- }
- }
-
- function _makePayload($id){
- $params = $this->_requests[$id];
- $url = $params[0];
- $method = (strtoupper($params[1]) == 'POST') ? 'POST' : 'GET';
- $headers = $params[2];
- $post = $params[3];
-
- $url = parse_url($url);
- if (isset ($url['query'])) {
- $url['query'] = "?".$url['query'];
- } else {
- $url['query'] = "";
- }
-
- if (!isset ($url['port']))
- $url['port'] = 80;
-
- $request = $method.' '.$url['path'].$url['query']." HTTP/1.0\r\n";
- $request .= ( $url['port'] == 80 )?
- "Host: " . $url['host'] . "\r\n" :
- "Host: " . $url['host'] . ':' . $url['port'] . "\r\n";
- $request .= 'User-Agent: '.$this->userAgent."\r\n";
- if (isset ($url['user']) && isset ($url['pass'])) {
- $request .= "Authorization: Basic ".base64_encode($url['user'].":".$url['pass'])."\r\n";
- }
- $request .= $headers;
-
- if( $method == "POST" ){
- $postdata = array();
- while (list ($name, $value) = each($post)) {
- $postdata[] = $name."=".urlencode($value);
- }
- $postdata = implode("&", $postdata);
- $request .= "Connection: Close\r\n";
- $request .= "Content-Type: application/x-www-form-urlencoded\r\n";
- $request .= "Content-Length: ".strlen($postdata)."\r\n";
- $request .= "\r\n";
- $request .= $postdata;
- } else {
- $request .= "\r\n";
- }
-
- return $request;
- }
-
- function _async_connect($host, $port, &$errno, &$errstr, $timeout) {
- $ip = gethostbyname($host);
- $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
- if (socket_set_nonblock($socket)) {
- $r = @socket_connect($socket, $ip, $port);
- if ($r || socket_last_error() == CLES_ASYNCHTTP_INPROGRESS) {
- return $socket;
- }
- }
-
- $errno = socket_last_error($socket);
- $errstr = socket_strerror($errno);
- socket_close($socket);
- return false;
- }
-}
+++ /dev/null
-<?php
-// vim: tabstop=2:shiftwidth=2
-
-/**
- * AsyncHTTP.php ($Revision: 1.1 $)
- *
- * by hsur ( http://blog.cles.jp/np_cles )
- * $Id: RawPost.php,v 1.1 2007-10-28 15:57:41 shizuki Exp $
- */
-
-/*
- * Copyright (C) 2007 CLES. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives
- * permission to link the code of this program with those files in the PEAR
- * library that are licensed under the PHP License (or with modified versions
- * of those files that use the same license as those files), and distribute
- * linked combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than those files in
- * the PEAR library that are licensed under the PHP License. If you modify
- * this file, you may extend this exception to your version of the file,
- * but you are not obligated to do so. If you do not wish to do so, delete
- * this exception statement from your version.
- */
-
-require_once 'cles/AsyncHTTP.php';
-
-class cles_AsyncHTTP_RawPost extends cles_AsyncHTTP {
- var $userAgent = 'CLES AsyncHTTP(RawPost) Lib';
-
- function cles_AsyncHTTP_RawPost(){
- $this->init();
- }
-
- function _makePayload($id){
- $params = $this->_requests[$id];
- $url = $params[0];
- $method = 'POST';
- $headers = $params[2];
- $rawpost = $params[3];
-
- $url = parse_url($url);
- if (isset ($url['query'])) {
- $url['query'] = "?".$url['query'];
- } else {
- $url['query'] = "";
- }
-
- if (!isset ($url['port']))
- $url['port'] = 80;
-
- $request = $method.' '.$url['path'].$url['query']." HTTP/1.1\r\n";
- $request .= ( $url['port'] == 80 )?
- "Host: " . $url['host'] . "\r\n" :
- "Host: " . $url['host'] . ':' . $url['port'] . "\r\n";
- $request .= "Connection: Close\r\n";
- $request .= 'User-Agent: '.$this->userAgent."\r\n";
- if (isset ($url['user']) && isset ($url['pass'])) {
- $request .= "Authorization: Basic ".base64_encode($url['user'].":".$url['pass'])."\r\n";
- }
- $request .= $headers;
-
- $request .= "Content-Length: ".strlen($rawpost)."\r\n";
- $request .= "\r\n";
- $request .= $rawpost;
-
- return $request;
- }
-}
\ No newline at end of file
+++ /dev/null
-<?php
-// vim: tabstop=2:shiftwidth=2
-
-/**
- * sharedlibs.php ($Revision: 1.1 $)
- *
- * by hsur ( http://blog.cles.jp/np_cles )
- * $Id: sharedlibs.php,v 1.1 2007-10-28 15:57:41 shizuki Exp $
-*/
-
-/*
- * Copyright (C) 2006 CLES. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives
- * permission to link the code of this program with those files in the PEAR
- * library that are licensed under the PHP License (or with modified versions
- * of those files that use the same license as those files), and distribute
- * linked combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than those files in
- * the PEAR library that are licensed under the PHP License. If you modify
- * this file, you may extend this exception to your version of the file,
- * but you are not obligated to do so. If you do not wish to do so, delete
- * this exception statement from your version.
-*/
-
-if (!defined('NP_SHAREDLIBS_LOADED')) {
- if (!defined('PATH_SEPARATOR')) {
- if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
- define('PATH_SEPARATOR', ';');
- } else {
- define('PATH_SEPARATOR', ':');
- }
- }
- ini_set('include_path', dirname(__FILE__).PATH_SEPARATOR.ini_get('include_path'));
-
- define('NP_SHAREDLIBS_LOADED', true);
-}
+++ /dev/null
-<?php
-
-/**
- * REJECT 'ONLY ASCII' COMMENT AND TRACKBACK PLUGIN FOR NucleusCMS
- * PHP versions 4 and 5
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * (see nucleus/documentation/index.html#license for more info)
- *
- *
- * @author shizuki
- * @copyright 2006-2007 shizuki
- * @license http://www.gnu.org/licenses/gpl.txt
- * GNU GENERAL PUBLIC LICENSE Version 2, June 1991
- * @version 0.3
- * @link http://shizuki.kinezumi.net
- *
- * 0.3 Release version
- * 0.2 supports SpamCheck API 2
- * supports NP_TrackBack
- * 0.1 initial
- *
- **/
-
-class NP_RejectASCIIComment extends NucleusPlugin
-{
-
- // name of plugin
- function getName()
- {
- $retData = 'Reject ASCII Comment and TrackBack';
- return $retData;
- }
-
- // author of plugin
- function getAuthor()
- {
- $retData = 'shizuki';
- return $retData;
- }
-
- // an URL to the plugin website
- function getURL()
- {
- $retData = 'http://shizuki.kinezumi.net';
- return $retData;
- }
-
- // version of the plugin
- function getVersion()
- {
- $retData = '0.3';
- return $retData;
- }
-
- // a description to be shown on the installed plugins listing
- function getDescription()
- {
- $retData = _REJECT_ASCII_DESCRIPTION;
- if (_CHARSET != 'UTF-8') {
- mb_convert_encoding($retData, _CHARSET, 'UTF-8');
- }
- return $retData;
- }
-
- function getEventList()
- {
- return array(
- 'SpamCheck',
- 'ValidateForm'
- );
- }
-
- function install()
- {
- $optionData = _REJECT_ASCII_HOOK;
- if (_CHARSET != 'UTF-8') {
- mb_convert_encoding($optionData, _CHARSET, 'UTF-8');
- }
- $this->createBlogOption('hook', $optionData, 'yesno', 'no');
- $optionData = _REJECT_ASCII_DELTB;
- if (_CHARSET != 'UTF-8') {
- mb_convert_encoding($optionData, _CHARSET, 'UTF-8');
- }
- $this->createBlogOption('deltb', $optionData, 'yesno', 'no');
- }
-
- function supportsFeature ($what)
- {
- switch ($what)
- {
- case 'SqlTablePrefix':
- return 1;
- default:
- return 0;
- }
- }
-
- function init()
- {
- global $admin;
- $langFile = $this->getDirectory() . 'japanese.php';
- if (file_exists($langFile)) {
- include_once($langFile);
- }
- }
-
- function event_SpamCheck(&$data)
- {
- global $DIR_PLUGINS, $member;
-
- $spamCheck = $data['spamcheck'];
- if ($spamCheck['result'] == TRUE) {
- return FALSE;
- }
-
- if ($member->isLoggedIn()) {
- return FALSE;
- }
-
- $type = (!empty($spamCheck['type'])) ? $spamCheck['type'] : 'post';
- $encoding = $this->_detect_encoding($excerpt);
- switch ($type) {
- case 'comment':
- $checkData = $spamCheck['body'];
- $item_id = intval($spamCheck['id']);
- break;
- case 'trackback':
- $checkData = $spamCheck['excerpt'] . $spamCheck['title'] . $spamCheck['blogname'];
- $item_id = intval($spamCheck['id']);
- break;
- default:
- }
- $bid = intval(getBlogIDFromItemID($item_id));
- $bname = getBlogNameFromID($bid);
- $inque = 'SELECT ititle as result FROM %s WHERE inumber = %d';
- $inque = sprintf($inque, sql_table('item'), $item_id);
- $iname = quickQuery($inque);
- $checkData = str_replace($bname, '', $checkData);
- $checkData = str_replace($iname, '', $checkData);
- $checkData = ereg_replace("\r|\n","",$checkData);
- $checkData = mb_convert_encoding($checkData, 'UTF-8', $encoding);
- if ($checkData && !preg_match('/[\x80-\xff]/', $checkData)) {
- $checkType = array(
- 'comment' => _REJECT_ASCII_COMMENT,
- 'trackback' => _REJECT_ASCII_TRACKBACK,
- );
- $info = _REJECT_ASCII_INFOHEAD . $item_id . $checkType[$type];
- if (_CHARSET != 'UTF-8') {
- mb_convert_encoding($info, _CHARSET, 'UTF-8');
- }
-// ACTIONLOG :: add(INFO, 'RejectASCII: ' . $info . shorten(strip_tags($checkData), 50, '...') . ')');
- $data['spamcheck']['result'] = TRUE;
- if ($type == 'trackback' && $this->getBlogOption($bid, 'deltb') == 'yes') {
- header("Location: " . createItemLink($item_id));
- exit();
- }
- return TRUE;
- } else {
- return FALSE;
- }
- }
-
- function event_ValidateForm(&$data) {
- global $DIR_PLUGINS, $member;
- if (getNucleusVersion() >= '330' || $data['type'] != 'comment') {
- return TRUE;
- }
- $item_id = intval($data['comment']['itemid']);
- $blog_id = intval(getBlogIDFromItemID($item_id));
-
- if ($this->getBlogOption($blog_id, 'hook') == 'no') {
- return TRUE;
- }
-
- if ($member->isLoggedIn()) {
- return TRUE;
- }
-
- $spamcheck = array(
- 'type' => 'comment',
- 'id' => $item_id,
- 'user' => $data['comment']['user'],
- 'body' => $data['comment']['body'],
- );
-
- $param = array(
- 'spamcheck' => &$spamcheck
- );
- $this->event_SpamCheck($param);
-
- if (isset($spamcheck['result']) && $spamcheck['result'] == TRUE) {
- $data['error'] = -1;
- header("Location: " . createItemLink($item_id));
- exit();
- }
-
- return true;
- }
-
- function _detect_encoding($string)
- {
- if (preg_match("/;\s*charset=([^\n]+)/is", serverVar("CONTENT_TYPE"), $regs)) {
- $encoding = strtoupper(trim($regs[1]));
- } else {
- $encoding = '';
- }
- $mbstrInput = strtolower(ini_get("mbstring.http_input"));
- if (!empty($encoding) && (mb_http_input('P') == '' || $mbstrInput == 'pass')) {
- return $encoding;
- } else {
- if (_CHARSET == 'UTF-8') {
- $encChars = 'UTF-8,EUC-JP,SJIS,ISO-8859-1,ASCII,JIS';
- } else {
- $encChars = 'EUC-JP,UTF-8,SJIS,ISO-8859-1,ASCII,JIS';
- }
- $encoding = mb_detect_encoding($string, $encChars);
- }
- return ($encoding) ? $encoding : 'ISO-8859-1';
- }
-
-}
-
+++ /dev/null
-<?php
- define('_REJECT_ASCII_DESCRIPTION', "日本語を含まないコメント・トラックバックをスパムとして処理します");
- define('_REJECT_ASCII_HOOK', "日本語を含まないコメント・トラックバックをスパムとして処理しますか?");
- define('_REJECT_ASCII_DELTB', "日本語を含まないトラックバックをデータベースに登録せずに破棄しますか?");
- define('_REJECT_ASCII_COMMENT', "への コメント をスパムとして処理しました 内容(");
- define('_REJECT_ASCII_TRACKBACK', "への トラックバック をスパムとして処理しました 内容(");
- define('_REJECT_ASCII_INFOHEAD', "アイテムID ");
+++ /dev/null
-<?php
-
-/** ============================================================================
- * GoogleSitemap for Nucleus
- *
- * Copyright 2005 by Niels Leenheer
- * ============================================================================
- * This program is free software and open source software; you can redistribute
- * it and/or modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the License,
- * or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit
- * http://www.gnu.org/licenses/gpl.html
- * ============================================================================
- **/
-
-/**
- * History
- * 0.7 modified release by shizuki
- * Generate URL modified from
- * 'http://example.com/action.php?action=plugin&name=Sitemap' to
- * 'http://example.com/sitemap.xml' and,or
- * 'http://example.com/index.php?virtualpath=sitemap.xml'
- * Add 'lastmod' attribute
- * 0.9 SitemapProtocol updated release
- * SitemapProtocol ver.0.9 as common for Google, Yahoo! and MSN(Live! Search)
- * 1.0 Add Sitemap type and chage 'lastmod' generate
- * Add 'ROR Sitemap' format
- * For details about the ROR format, go to www.rorweb.com
- * Modify 'lastmod' attribute
- * item posted time or comment posted time or item update time
- * item update time generate by NP_UpdateTime
- * 1.1 Send Sitemaps to Yahoo!
- * 1.2 Send Sitemaps to Live! Search
- * Cahge sitemap notification URI to yahoo.com No appid required
- * Add priority setting options
- **/
-
-class NP_SEOSitemaps extends NucleusPlugin
-{
-
- function getName()
- {
- return 'SearchenginesSitemapsGenerator';
- }
-
- function getAuthor()
- {
- return 'Niels Leenheer + shizuki';
- }
-
- function getURL()
- {
- return 'http://japan.nucleuscms.org/wiki/plugins:seositemaps';
- }
-
- function getVersion()
- {
- return '1.2';
- }
-
- function getDescription()
- {
- return _G_SITEMAP_DESC;
- }
-
- function getEventList()
- {
- return array(
- 'PostAddItem',
- 'PreSendContentType'
- );
- }
-
- function supportsFeature($feature)
- {
- switch($feature) {
- case 'SqlTablePrefix':
- return 1;
- default:
- return 0;
- }
- }
-
- function event_PreSendContentType($data)
- {
- global $CONF, $manager, $blogid;
-
- $mcategories = $this->pluginCheck('MultipleCategories');
- if ($mcategories) {
- if (method_exists($mcategories, 'getRequestName')) {
- $subReq = $mcategories->getRequestName();
- } else {
- $subReq = 'subcatid';
- }
- }
- $npUpdateTime = $this->pluginCheck('UpdateTime');
-
- if (!$blogid) {
- $blogid = $CONF['DefaultBlog'];
- } else {
- if (is_numeric($blogid)) {
- $blogid = intval($blogid);
- } else {
- $blogid = intval(getBlogIDFromName($blogid));
- }
- }
-
- $b =& $manager->getBlog($blogid);
- $BlogURL = $b->getURL();
- if (!$BlogURL) {
- $BlogURL = $CONF['IndexURL'];
- }
-
- if ( substr($BlogURL, -1) != '/'
- && substr($BlogURL, -4) != '.php') {
- $BlogURL .= '/';
- }
-
- if (getVar('virtualpath')) {
- $info = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', getVar('virtualpath'));
- } elseif (serverVar('PATH_INFO')) {
- $info = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', serverVar('PATH_INFO'));
- } else {
- return;
- }
-
- $path_arr = explode('/', $info);
- $PcMap = $this->getBlogOption($blogid, 'PcSitemap');
- $MobileMap = $this->getBlogOption($blogid, 'MobileSitemap');
- if ( end($path_arr) == $PcMap
- || end($path_arr) == 'ror.xml'
- || (!empty($MobileMap) && end($path_arr) == $MobileMap) ) {
- $sitemap = array();
- if ( $this->getOption('AllBlogMap') == 'yes'
- && $blogid == $CONF['DefaultBlog']) {
- $blogQuery = 'SELECT * '
- . 'FROM %s '
- . 'ORDER BY bnumber';
- $blogQuery = sprintf($blogQuery, sql_table('blog'));
- $blogResult = sql_query($blogQuery);
- } else {
- $blogQuery = 'SELECT * '
- . 'FROM %s '
- . 'WHERE bnumber = %d';
- $blogQuery = sprintf($blogQuery, sql_table('blog'), $blogid);
- $blogResult = sql_query($blogQuery);
- $currentBlog = TRUE;
- }
- while ($blogs = mysql_fetch_array($blogResult)) {
- $blog_id = intval($blogs['bnumber']);
- if ( $this->getBlogOption($blog_id, 'IncludeSitemap') == 'yes'
- || !empty($currentBlog)) {
- $temp_b =& $manager->getBlog($blog_id);
- $TempURL = $temp_b->getURL();
- $SelfURL = $TempURL;
-
- $URLMode = $CONF['URLMode'];
- if (substr($TempURL, -4) == '.php') {
- $CONF['URLMode'] = 'normal';
- }
-
- $usePathInfo = ($CONF['URLMode'] == 'pathinfo');
-
- if (substr($SelfURL, -1) == '/') {
-
- if ($usePathInfo) {
- $SelfURL = substr($SelfURL, 0, -1);
- } else {
- $SelfURL = $SelfURL . 'index.php';
- }
-
- } elseif (substr($SelfURL, -4) != '.php') {
-
- if ($usePathInfo) {
- $SelfURL = $SelfURL;
- } else {
- $SelfURL = $SelfURL . '/index.php';
- }
-
- }
-
- $CONF['ItemURL'] = $SelfURL;
- $CONF['CategoryURL'] = $SelfURL;
-
- if ( substr($TempURL, -1) != '/'
- && substr($TempURL, -4) != '.php') {
- $TempURL .= '/';
- }
-
- $patternURL = '/^' . preg_replace('/\//', '\/', $BlogURL) . '/';
-
- if (preg_match($patternURL, $TempURL)) {
-
- if (end($path_arr) == 'ror.xml') {
- $rorTitleURL = $this->_prepareLink($SelfURL, $TempURL);
- $rooTitleURL = htmlspecialchars($rooTitleURL, ENT_QUOTES, _CHARSET);
- $sitemapTitle = " <title>ROR Sitemap for " . $rorTitleURL . "</title>\n"
- . " <link>" . $rorTitleURL . "</link>\n"
- . " <item>\n"
- . " <title>ROR Sitemap for " . $rorTitleURL . "</title>\n"
- . " <link>" . $rorTitleURL . "</link>\n"
- . " <ror:about>sitemap</ror:about>\n"
- . " <ror:type>SiteMap</ror:type>\n"
- . " </item>\n";
- } else {
- $bPriority = intval($this->getBlogOption($blog_id, 'blogPriority'));
- if ($bPriority > 10) $bPriority = 10;
- $bPriority = $bPriority / 10;
- $sitemap[] = array(
- 'loc' => $this->_prepareLink($SelfURL, $TempURL),
- 'priority' => number_format($bPriority ,1),
- 'changefreq' => 'daily'
- );
- }
-
- $catQuery = 'SELECT * '
- . 'FROM %s '
- . 'WHERE cblog = %d '
- . 'ORDER BY catid';
- $catTable = sql_table('category');
- $catQuery = sprintf($catQuery, $catTable, $blog_id);
- $catResult = sql_query($catQuery);
-
- while ($cat = mysql_fetch_array($catResult)) {
-
- $cat_id = intval($cat['catid']);
- $Link = createCategoryLink($cat_id);
- $catLoc =$this->_prepareLink($SelfURL, $Link);
-
- if (end($path_arr) != 'ror.xml') {
- $cPriority = intval($this->getCategoryOption($cat_id, 'catPriority'));
- if ($cPriority > 10) $priority = 10;
- $sPriority = ($cPriority - 1) / 10;
- $cPriority = $cPriority / 10;
- $sitemap[] = array(
- 'loc' => $catLoc,
- 'priority' => number_format($cPriority, 1),
- 'changefreq' => 'daily'
- );
- }
-
- if ($mcategories) {
- $scatQuery = 'SELECT * '
- . 'FROM %s '
- . 'WHERE catid = %d '
-// . 'ORDER BY scatid';
- . 'ORDER BY ordid';
- $scatTable = sql_table('plug_multiple_categories_sub');
- $scatQuery = sprintf($scatQuery, $scatTable, $cat_id);
- $scatResult = sql_query($scatQuery);
-
- while ($scat = mysql_fetch_array($scatResult)) {
-
- $scat_id = intval($scat['scatid']);
- $params = array($subReq => $scat_id);
- $Link = createCategoryLink($cat_id, $params);
- $scatLoc = $this->_prepareLink($SelfURL, $Link);
-
- if (end($path_arr) != 'ror.xml') {
- $sitemap[] = array(
- 'loc' => $scatLoc,
- 'priority' => number_format($sPriority, 1),
- 'changefreq' => 'daily'
- );
- }
-
- }
-
- }
-
- }
-
- $itemQuery = 'SELECT *, '
- . ' UNIX_TIMESTAMP(itime) AS timestamp '
- . 'FROM %s '
- . 'WHERE iblog = %d '
- . 'AND idraft = 0 '
- . 'ORDER BY itime DESC';
- $itemTable = sql_table('item');
- $itemQuery = sprintf($itemQuery, $itemTable, $blog_id);
- $itemResult = sql_query($itemQuery);
- while ($item = mysql_fetch_array($itemResult)) {
-
- $item_id = intval($item['inumber']);
- $Link = createItemLink($item_id);
- $tz = date('O', $item['timestamp']);
- $tz = substr($tz, 0, 3) . ':' . substr($tz, 3, 2);
- $itemLoc = $this->_prepareLink($SelfURL, $Link);
-
- $mdQuery = 'SELECT'
- . ' UNIX_TIMESTAMP(ctime) AS timestamp'
- . ' FROM '
- . sql_table('comment')
- . ' WHERE'
- . ' citem = ' . $item_id
- . ' ORDER BY'
- . ' ctime DESC'
- . ' LIMIT'
- . ' 1';
- $modTime = sql_query($mdQuery);
- $itemTime = $item['timestamp'];
- if (mysql_num_rows($modTime) > 0) {
- $lastMod = mysql_fetch_object($modTime);
- $itemTime = $lastMod->timestamp;
- } elseif ($npUpdateTime) { // NP_UpdateTime exists
- $mdQuery = 'SELECT'
- . ' UNIX_TIMESTAMP(updatetime) AS timestamp'
- . ' FROM '
- . sql_table('plugin_rectime')
- . ' WHERE'
- . ' up_id = ' . $item_id;
- $modTime = sql_query($mdQuery);
- if (mysql_num_rows($modTime) > 0) {
- $lastMod = mysql_fetch_object($modTime);
- $itemTime = $lastMod->timestamp;
- }
- }
-
-/* if (time() - $itemTime < 86400 * 2) {
- $fq = 'hourly';
- } elseif (time() - $itemTime < 86400 * 14) {
- $fq = 'daily';
- } elseif (time() - $itemTime < 86400 * 62) {
- $fq = 'weekly';
- } else {
- $fq = 'monthly';
- }*/
- if ($itemTime < strtotime('-1 month')) {
- $fq = 'monthly';
- } elseif ($itemTime < strtotime('-1 week')) {
- $fq = 'weekly';
- } elseif ($itemTime < strtotime('-1 day')) {
- $fq = 'daily';
- } else {
- $fq = 'hourly';
- }
- $lastmod = gmdate('Y-m-d\TH:i:s', $itemTime) . $tz;
-
- if (end($path_arr) != 'ror.xml') {
- $iPriority = intval($this->getItemOption($item_id, 'itemPriority'));
- if ($iPriority > 10) $iPriority = 10;
- $iPriority = $iPriority / 10;
- $sitemap[] = array(
- 'loc' => $itemLoc,
- 'lastmod' => $lastmod,
- 'priority' => number_format($iPriority, 1),
- 'changefreq' => $fq
- );
- } else {
- $iTitle = $item['ititle'];
- if (_CHARSET != 'UTF-8') {
- $iTitle = mb_conbert_encoding($iTitle, 'UTF-8', _CHARSET);
- }
- $sitemap[] = array(
- 'title' => $iTitle,
- 'link' => $itemLoc,
- 'ror:updated' => $lastmod,
- 'ror:updatePeriod' => 'day',
- 'ror:sortOrder' => '0',
- 'ror:resourceOf' => 'sitemap',
- );
- }
-
- }
-
- }
-
- }
-
- if ($CONF['URLMode'] != $URLMode) {
- $CONF['URLMode'] = $URLMode;
- }
-
- }
-
- $manager->notify('SiteMap', array ('sitemap' => & $sitemap));
-
- header ("Content-type: application/xml");
-
- if (end($path_arr) == 'ror.xml') {
-
- // ror sitemap feed
- $sitemapHeader ="<" . "?xml version='1.0' encoding='UTF-8'?" . ">\n\n"
- . "<!-- This file is a ROR Sitemap for describing this website to the search engines. "
- . "For details about the ROR format, go to www.rorweb.com. -->\n"
- . '<rss version="2.0" xmlns:ror="http://rorweb.com/0.1/" >' . "\n"
- . "<channel>\n";
-
- } else {
-
- // old Google sitemap protocol ver.0.84
-// $sitemapHeader = "<" . "?xml version='1.0' encoding='UTF-8'?" . ">\n\n";
-// . "\t<urlset" . ' xmlns="http://www.google.com/schemas/sitemap/0.84"' . "\n";
-// . "\t" . 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . "\n";
-// . "\t" . 'xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84' . "\n";
-// . "\t" . ' http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">' . "\n";
-
- // new sitemap common protocol ver 0.9
- $sitemapHeader = "<" . "?xml version='1.0' encoding='UTF-8'?" . ">\n\n"
- . '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . "\n"
- . ' xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9' . "\n"
- . ' http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"' . "\n"
- . ' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"';
- // uncomment and edit next line when you need "example_schema"
-// $sitemapHeader .= ' xmlns:example="http://www.example.com/schemas/example_schema"';
- $sitemapHeader .= '>';
-
- }
-
- echo $sitemapHeader;
- if (end($path_arr) == 'ror.xml') {
- echo $sitemapTitle;
- }
-
- while (list(, $url) = each($sitemap)) {
-
- if (end($path_arr) == 'ror.xml') {
- echo "\t<item>\n";
- } else {
- echo "\t<url>\n";
- }
-
- while (list($key, $value) = each($url)) {
- if ($key == 'loc') {
- $value = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', $value);
- $data = "\t\t<" . $key . ">"
- . htmlspecialchars($value, ENT_QUOTES, _CHARSET)
- . "</" . $key . ">\n";
- } else {
- $data = "\t\t<" . $key . ">"
- . htmlspecialchars($value, ENT_QUOTES, _CHARSET)
- . "</" . $key . ">\n";
- }
- echo $data;
- }
-
- if (end($path_arr) == 'ror.xml') {
- echo "\t</item>\n";
- } else {
- echo "\t</url>\n";
- }
-
- }
-
- if (end($path_arr) == 'ror.xml') {
- echo "</channel>\n</rss>\n";
- } else {
- echo "</urlset>\n";
- }
-// echo "</urlset>\n";
- exit;
-
- }
- }
-
- function pluginCheck($pluginName)
- {
- global $manager;
- if (!$manager->pluginInstalled('NP_' . $pluginName)) {
- return;
- } else {
- $plugin =& $manager->getPlugin('NP_' . $pluginName);
- return $plugin;
- }
- }
-
- function _prepareLink($base, $url) {
- if (substr($url, 0, 7) == 'http://') {
- return $url;
- } else {
- return $base . $url;
- }
- }
-
- function event_PostAddItem(&$data)
- {
- global $manager, $CONF;
-
- $item_id = intval($data['itemid']);
- $blog_id = intval(getBlogIDFromItemID($item_id));
- $b =& $manager->getBlog($blog_id);
- $b_url = $b->getURL();
-
- if (substr($b_url, -4) == '.php') $CONF['URLMode'] = 'normal';
- $usePathInfo = ($CONF['URLMode'] == 'pathinfo');
-
- if (substr($b_url, -1) == '/') {
- if (!$usePathInfo) {
- $b_url .= 'index.php?virtualpath=';
- }
- } elseif (substr($b_url, -4) == '.php') {
- $b_url .= '?virtualpath=';
- } else {
- if ($usePathInfo) {
- $b_url = $b_url . '/';
- } else {
- $b_url = $b_url . '/index.php?virtualpath=';
- }
- }
- $siteMap = $this->getBlogOption($blog_id, 'PcSitemap');
-
- if ($this->getBlogOption($blog_id, 'PingGoogle') == 'yes') {
- $baseURL = 'http://www.google.com/webmasters/sitemaps/ping?sitemap=';
- $utl = $baseURL . urlencode($b_url . $siteMap);
- $url = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', $url);
- $fp = @fopen($url, 'r');
- @fclose($fp);
- $MobileMap = $this->getBlogOption($blog_id, 'MobileSitemap');
- if (!empty($MobileMap)) {
- $url = $baseURL . urlencode($b_url . $MobileMap);
- $url = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', $url);
- $fp = @fopen($url, 'r');
- @fclose($fp);
- }
- }
-
- if ($this->getBlogOption($blog_id, 'PingYahoo') == 'yes') { // &&
-// $this->getBlogOption($blog_id, 'YahooAPID') != '') {
-// $baseURL = 'http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid='
-// . $this->getBlogOption($blog_id, 'YahooAPID')
-// . '&url=';
- $baseURL = 'http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=';
- $url = $baseURL . urlencode($b_url . $siteMap);
- $url = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', $url);
- $fp = @fopen($url, 'r');
- @fclose($fp);
- $MobileMap = $this->getBlogOption($blog_id, 'MobileSitemap');
- if (!empty($MobileMap)) {
- $url = $baseURL . urlencode($b_url . $MobileMap);
- $url = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', $url);
- $fp = @fopen($url, 'r');
- @fclose($fp);
- }
- }
-
- if ($this->getBlogOption($blog_id, 'PingLive') == 'yes') {
- $baseURL = 'http://webmaster.live.com/webmaster/ping.aspx?siteMap=';
- $utl = $baseURL . urlencode($b_url . $siteMap);
- $url = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', $url);
- $fp = @fopen($url, 'r');
- @fclose($fp);
- $MobileMap = $this->getBlogOption($blog_id, 'MobileSitemap');
- if (!empty($MobileMap)) {
- $url = $baseURL . urlencode($b_url . $MobileMap);
- $url = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', $url);
- $fp = @fopen($url, 'r');
- @fclose($fp);
- }
- }
-
- }
-
- function init()
- {
- global $admin;
- $language = ereg_replace( '[\\|/]', '', getLanguageName());
- if (file_exists($this->getDirectory() . $language.'.php')) {
- include_once($this->getDirectory() . $language.'.php');
- }else {
- include_once($this->getDirectory() . 'english.php');
- }
- }
-
- function install()
- {
- $this->createOption('AllBlogMap', _G_SITEMAP_ALLB, 'yesno', 'yes');
- $this->createBlogOption('IncludeSitemap', _G_SITEMAP_INC, 'yesno', 'no');
- $this->createBlogOption('PingGoogle', _G_SITEMAP_PING_G, 'yesno', 'yes');
- $this->createBlogOption('PingYahoo', _G_SITEMAP_PING_Y, 'yesno', 'yes');
- $this->createBlogOption('PingLive', _G_SITEMAP_PING_L, 'yesno', 'yes');
-// $this->createBlogOption('YahooAPID', _G_SITEMAP_YAPID, 'text', '');
- $this->createBlogOption('PcSitemap', _G_SITEMAP_PCSM, 'text', 'sitemap.xml');
- $this->createBlogOption('MobileSitemap', _G_SITEMAP_MBSM, 'text', 'msitemap.xml');
- $this->createBlogOption('blogPriority', _G_SITEMAP_BPRI, 'text', '10', 'datatype=numerical');
- $this->createCategoryOption('catPriority', _G_SITEMAP_CPRI, 'text', '9', 'datatype=numerical');
- $this->createItemOption('itemPriority', _G_SITEMAP_IPRI, 'text', '10', 'datatype=numerical');
- }
-}
+++ /dev/null
-<?php
- define('_G_SITEMAP_DESC', "This plugin provides a Google sitemap for your website." .
- "Sitemap URL: http://example.cm/sitemap.xml");
- define('_G_SITEMAP_ALLB', "Generate All Blog's Google Sitemap");
- define('_G_SITEMAP_PING_G', "Ping Google after adding a new item");
- define('_G_SITEMAP_PING_Y', "Ping Yahoo! after adding a new item");
- define('_G_SITEMAP_PING_L', "Ping Live Search after adding a new item");
-// define('_G_SITEMAP_YAPID', "Yahoo! Application ID");
- define('_G_SITEMAP_INC', "Include this blog in Google Sitemap when All Blog mode");
- define('_G_SITEMAP_PCSM', "Virtual file name for PC Sitemap");
- define('_G_SITEMAP_MBSM', "Virtual file name for Mobile Sitemap");
- define('_G_SITEMAP_BPRI', "Priority of BLOG");
- define('_G_SITEMAP_CPRI', "Priority of CATEGORY");
- define('_G_SITEMAP_IPRI', "Priority of ITEM");
+++ /dev/null
-<?php
- define('_G_SITEMAP_DESC', "¡ÖGoogle¥¦¥§¥Ö¥Þ¥¹¥¿¡¼¥Ä¡¼¥ë¡×ÍѤΥµ¥¤¥È¥Þ¥Ã¥×¤òºîÀ®¤·¤Þ¤¹<br />" .
- "Sitemap URL: http://example.cm/sitemap.xml");
- define('_G_SITEMAP_ALLB', "AllBlog ¥â¡¼¥É¤Ç¥µ¥¤¥È¥Þ¥Ã¥×¤òºîÀ®¤¹¤ë(¥µ¥Ö/¥Þ¥ë¥Á¥É¥á¥¤¥ó¤Ï½ü³°)");
- define('_G_SITEMAP_PING_G', "¥¢¥¤¥Æ¥àÄɲûþ¤Ë Google ¤Ë¹¹¿·¤òÄÌÃΤ¹¤ë");
- define('_G_SITEMAP_PING_Y', "¥¢¥¤¥Æ¥àÄɲûþ¤Ë Yahoo! ¤Ë¹¹¿·¤òÄÌÃΤ¹¤ë");
- define('_G_SITEMAP_PING_L', "¥¢¥¤¥Æ¥àÄɲûþ¤Ë Live Search ¤Ë¹¹¿·¤òÄÌÃΤ¹¤ë");
-// define('_G_SITEMAP_YAPID', "Yahoo! Application ID");
- define('_G_SITEMAP_INC', "AllBlog ¥â¡¼¥É¤Î¤È¤¤Ë¤³¤Î¥Ö¥í¥°¤ò´Þ¤á¤ë");
- define('_G_SITEMAP_PCSM', "PC ÍÑ¥µ¥¤¥È¥Þ¥Ã¥×¥Õ¥¡¥¤¥ë¤Î²¾ÁÛ¥Õ¥¡¥¤¥ë̾");
- define('_G_SITEMAP_MBSM', "¥â¥Ð¥¤¥ëÍÑ¥µ¥¤¥È¥Þ¥Ã¥×¥Õ¥¡¥¤¥ë¤Î²¾ÁÛ¥Õ¥¡¥¤¥ë̾");
- define('_G_SITEMAP_BPRI', "¥Ö¥í¥°¤Î Priority ÃÍ");
- define('_G_SITEMAP_CPRI', "¥«¥Æ¥´¥ê¡¼¤Î Priority ÃÍ");
- define('_G_SITEMAP_IPRI', "¥¢¥¤¥Æ¥à¤Î Priority ÃÍ");
+++ /dev/null
-<?php
- define('_G_SITEMAP_DESC', "「Googleウェブマスターツール」用のサイトマップを作成します<br />" .
- "Sitemap URL: http://example.cm/sitemap.xml");
- define('_G_SITEMAP_ALLB', "AllBlog モードでサイトマップを作成する(サブ/マルチドメインは除外)");
- define('_G_SITEMAP_PING_G', "アイテム追加時に Google に更新を通知する");
- define('_G_SITEMAP_PING_Y', "アイテム追加時に Yahoo! に更新を通知する");
- define('_G_SITEMAP_PING_L', "アイテム追加時に Live Search に更新を通知する");
-// define('_G_SITEMAP_YAPID', "Yahoo! Application ID");
- define('_G_SITEMAP_INC', "AllBlog モードのときにこのブログを含める");
- define('_G_SITEMAP_PCSM', "PC 用サイトマップファイルの仮想ファイル名");
- define('_G_SITEMAP_MBSM', "モバイル用サイトマップファイルの仮想ファイル名");
- define('_G_SITEMAP_BPRI', "ブログの Priority 値");
- define('_G_SITEMAP_CPRI', "カテゴリーの Priority 値");
- define('_G_SITEMAP_IPRI', "アイテムの Priority 値");
+++ /dev/null
-<?php
-class NP_SearchResultsEX extends NucleusPlugin
-{
- function getName()
- {
- return 'SearchResults EX';
- }
-
- function getAuthor()
- {
- return 'Taka + nakahara21 + Andy + shizuki';
- }
-
- function getURL()
- {
- $url = 'http://shizuki.kinezumi.net/'
- . 'NucleusCMS/Plugins/SearchResultsEX/';
- return $url;
- }
-
- function getVersion()
- {
- return '0.08';
- }
-
- function getDescription()
- {
- $desc = 'This plugin replace <%searchresults()%> '
- . 'with page switch<br />'
- . 'Usage: <%SearchResultsEX(Template,15,,2,500)%><br />'
- . 'Requered NP_ExtensibleSearch for Extensible searchresults.';
- return $desc;
- }
-
- function getEventList()
- {
- global $manager;
- $event_arr = array(
- 'InitSkinParse'
- );
- if ($manager->pluginInstalled('NP_ExtensibleSearch')) {
- $event_arr[] = 'PreSearchResults';
- }
- return $event_arr;
- }
-
-// function getPluginDep()
-// {
-// return array('NP_ExtensibleSearch');
-// }
-
- function supportsFeature($what)
- {
- switch ($what) {
- case 'SqlTablePrefix':
- return 1;
- default:
- return 0;
- }
- }
-
- function install()
- {
- $this->createOption("commentsearch",
- "Comments are included in a search target",
-// . "(Need 'NP_ExtensibleSearch').",
- "yesno",
- "yes");
- $this->createOption("trackbacksearch",
- "TrackBacks are included in a search target",
-// . "(Need 'NP_ExtensibleSearch').",
- "yesno",
- "yes");
- $this->createOption("tagsearch",
- "Tags are included in a search target",
-// . "(Need 'NP_ExtensibleSearch').",
- "yesno",
- "no");
- $this->createOption("srex_ads1",
- "[Ads code 1] "
- . "Ads code where it's caught between "
- . "1st and 2nd entry and shown",
- "textarea",
- "");
- $this->createOption("srex_ads2",
- "[Ads code 1] "
- . "Ads code where it's caught between "
- . "2nd and 3rd entry and shown",
- "textarea",
- "");
- }
-
- function event_PreSearchResults(&$data)
- { // Orign NP_CommentSearch by Andy
- global $blog, $manager;
- $blogs = $data['blogs'];
- $query = $data['query'];
- $items =& $data['items'];
- $searchclass =& new SEARCH($query);
-
- $sqlquery = 'SELECT i.inumber as itemid FROM ';
- $tables = sql_table('item') . ' as i ';
- $where_str = '';
- if ($this->getOption('commentsearch') == 'yes') {
- $tables .= ' left join ' . sql_table('comment') . ' as cm'
- . ' on i.inumber = cm.citem ';
- $where_str .= 'xxx.cm.cbody';
- }
-
- if ($this->getOption('tagsearch') == 'yes' &&
- $manager->pluginInstalled('NP_TagEX')) {
- $tables .= ' left join ' . sql_table('plug_tagex') . ' as tag'
- . ' on i.inumber = tag.inum';
- $where_str .= ',xxx.tag.itags';
- }
- if ($this->getOption('trackbacksearch') == 'yes' &&
- $manager->pluginInstalled('NP_TrackBack')) {
- $tables .= ' left join ' . sql_table('plugin_tb') . ' as t'
- . ' on i.inumber = t.tb_id';
- $where_str .= ',xxx.t.title,xxx.t.excerpt';
- }
- $sqlquery .= $tables;
- $where = $searchclass->boolean_sql_where($where_str);
- $where = strtr($where, array('i.xxx.' => ''));
- $sqlquery .= ' WHERE i.idraft = 0'
- . ' and i.itime <= ' . mysqldate($blog -> getCorrectTime())
- . ' and i.iblog in (' . implode(',', $blogs) . ') '
- . ' and ' . $where;
- $res = sql_query($sqlquery);
- $array = array();
- while ($itemid = mysql_fetch_row($res)) {
- array_push($array, $itemid[0]);
- }
- $data['items'] = array_unique(array_merge($items,$array));
- }
-
- function doSkinVar($skinType,
- $template = 'default/index', // display template
- $p_amount = 10, // amount par page
- $type = 1, // page switch type
- $bmode = 'all', // blog mode
- $maxresults = '') // max results
- {
- global $manager, $CONF, $blog, $query, $amount;
- if (!$template) {
- $template = 'default/index';
- }
- if (!$p_amount) {
- $p_amount = 10;
- }
- if (!$type) {
- $type = 1;
- }
- if (!$bmode) {
- $bmode = 'all';
- }
- $this->maxamount = ($maxresults) ? $maxresults : 0;
- $type = floatval($type);
- $typeExp = intval(($type - floor($type))*10); //0 or 1 or 9
- list($pageamount, $offset) = sscanf($p_amount, '%d(%d)');
- if (!$pageamount) $pageamount = 10;
- if (preg_match("/^(<>)?([0-9\/]+)$/", $bmode, $matches)) {
- if ($matches[1]) {
- $hide = explode("/", $matches[2]);
- $show = array();
- } else {
- $hide = array();
- $show = explode("/", $matches[2]);
- }
- $bmode = 'all';
- }
-
- if ($blog) {
- $b =& $blog;
- } else {
- $b =& $manager->getBlog($CONF['DefaultBlog']);
- }
- $nowbid = intval($b->getID());
-
- if ($template == 'form') {
- $q = getVar('query');
- $search_form = '<form '
- . 'method="get" '
- . 'action="' . createBlogidLink($nowbid) . '" '
- . ">\n"
- . "\t" . '<div class="searchform">' . "\n"
- . "\t\t<input "
- . 'name="query" '
- . 'class="formfield" '
- . 'size="10" '
- . 'maxlength="60" '
- . 'accesskey="4" '
- . 'value="' . $q . '" '
- . "/>\n\t\t<br />\n"
- . "\t\t<input "
- . 'type="submit" '
- . 'value="' . _SEARCHFORM_SUBMIT . '" '
- . 'class="formbutton" '
- . "/>\n"
- . "\t</div>\n"
- . "</form>\n";
- echo $search_form;
- return;
- }
-
- $s_blogs = '';
- if ($bmode != 'all') {
- $s_blogs .= ' and i.iblog = ' . $nowbid;
- } elseif ($hide[0] && $bmode=='all') {
- foreach ($hide as $val) {
- if (intval($val) < 1) {
- $val = getBlogIDFromName($val);
- }
- $s_blogs .= ' and i.iblog != ' . intval($val);
- }
- } elseif ($show[0] && $bmode=='all') {
- foreach ($show as $val) {
- if(intval($val) < 1){
- $val = getBlogIDFromName($val);
- }
- $w[] = intval($val);
- }
- $s_blogs .= ' and i.iblog in (' . implode(",", $w) . ')';
- }
- $manager->notify('PreBlogContent',array('blog' => &$b, 'type' => 'searchresults'));
-// Origin NP_ExtensibleSearch by Andy
- $highlight = '';
- $query = $this->_hsc($query);
- if ($manager->pluginInstalled('NP_ExtensibleSearch')) {
- $explugin =& $manager->getPlugin('NP_ExtensibleSearch');
- $sqlquery = $explugin->getSqlQuery($query, $amount, $highlight);
- } else {
-// $sqlquery = $b->getSqlSearch($query, $amount, $highlight);
- $sqlquery = $this->getSqlQuery($b, $query, $amount, $highlight);
- }
- $que_arr = explode(' ORDER BY', $sqlquery, 2);
- $sqlquery = implode($s_blogs . ' ORDER BY', $que_arr);
- if (!$sqlquery) {
- // no query -> show everything
- $exQuery = '';
- $amfound = $b->readLogAmount($template, $maxresults, $exQuery, $query, 1, 1);
- } else {
- $entries = $this->getArray($sqlquery);
- $allAmount = count($entries);
- if ($allAmount > 0) {
- $switchParam = array (
- $type,
- $pageamount,
- $offset,
- $entries,
- $b
- );
- $page_switch = $this->PageSwitch($switchParam);
- if ($typeExp != 9) {
- echo $page_switch['buf'];
-// print_r($page_switch);
- }
- $showParams = array (
- $template,
- $sqlquery,
- $highlight,
- $page_switch['startpos'],
- $pageamount,
- $b
- );
- $this->_showUsingQuery($showParams);
- if ($type >= 1 && $typeExp != 1) {
- echo $page_switch['buf'];
- }
- } else {
- $template =& $manager->getTemplate($template);
- $vars = array(
- 'query' => $query,
- 'blogid' => $nowbid
- );
- echo TEMPLATE::fill($template['SEARCH_NOTHINGFOUND'], $vars);
- }
- }
- $manager->notify('PostBlogContent',array('blog' => &$b, 'type' => 'searchresults'));
- }
-
-//*
- function getSqlQuery($b, $query, $amountMonths = 0, &$highlight, $mode = '')
- {
- $searchclass =& new SEARCH($query);
- $highlight = $searchclass->inclusive;
- if ($searchclass->inclusive == '') {
- return '';
- }
- $select = $searchclass->boolean_sql_select('ititle,ibody,imore');
- $blogs = $searchclass->blogs;
- $blogs[] = $b->getID();
- $blogs = array_unique($blogs);
-
- $sqlquery = $b->getSqlSearch($query, $amount, $highlight);
- if (preg_match('/^(SELECT COUNT\(\*\) as result)/', $sqlquery)) {
- $mode = 1;
- }
- $items = $this->getArray($sqlquery);
- $sqldata = array(
- 'blogs' => &$blogs,
- 'items' => &$items,
- 'query' => $query
- );
- $this->event_PreSearchResults($sqldata);
-
- if ($mode == '') {
- $sqlquery = 'SELECT '
- . ' i.inumber as itemid, '
- . ' i.ititle as title, '
- . ' i.ibody as body, '
- . ' m.mname as author, '
- . ' m.mrealname as authorname, '
- . ' i.itime, '
- . ' i.imore as more, '
- . ' m.mnumber as authorid, '
- . ' m.memail as authormail, '
- . ' m.murl as authorurl, '
- . ' c.cname as category, '
- . ' i.icat as catid, '
- . ' i.iclosed as closed '
- . 'FROM '
- . sql_table('item') . ' as i, '
- . sql_table('member') . ' as m, '
- . sql_table('category') . ' as c '
- . 'WHERE '
- . ' i.iauthor = m.mnumber '
- . ' and i.icat = c.catid';
- if ($items) {
- $sqlquery .= ' and i.inumber in (' . implode(',', $items) . ')';
- } else {
- $sqlquery .= ' and 1=2 ';
- }
- if ($select) {
- $sqlquery .= ' ORDER BY score DESC';
- } else {
- $sqlquery .= ' ORDER BY i.itime DESC ';
- }
- } else {
- $sqlquery = 'SELECT COUNT(*) FROM ' . sql_table('item') . ' as i WHERE ';
- if ($items) {
- $sqlquery .= ' and i.inumber in (' . implode(',', $items) . ')';
- } else {
- $sqlquery .= ' and 1=2 ';
- }
- }
- return $sqlquery;
- }
-//*/
-
- function getArray($query) {
- $res = sql_query($query);
- $array = array();
- while ($itemid = mysql_fetch_row($res)) {
- array_push($array, $itemid[0]);
- }
- return $array;
- }
-
- function _showUsingQuery($showParams)
- {
- $template = $showParams[0];
- $showQuery = $showParams[1];
- $highlight = $showParams[2];
- $q_startpos = $showParams[3];
- $q_amount = $showParams[4];
- $b = $showParams[5];
- $onlyone_query = $showQuery
- . ' LIMIT '
- . intval($q_startpos)
- . ', 1';
- $b->showUsingQuery($template, $onlyone_query, intval($highlight), 1, 1);
- echo $this->getOption('srex_ads1');
-
- $q_startpos++;
- $q_amount--;
- if ($q_amount <= 0) {
- return;
- }
- $onlyone_query = $showQuery
- . ' LIMIT '
- . intval($q_startpos)
- . ', 1';
- $b->showUsingQuery($template, $onlyone_query, intval($highlight), 1, 1);
- if (mysql_num_rows(sql_query($onlyone_query))) {
- echo $this->getOption('srex_ads2');
- }
-
- $q_startpos++;
- $q_amount--;
- if ($q_amount < 0) {
- return;
- }
- $second_query = $showQuery
- . ' LIMIT '
- . intval($q_startpos) . ','
- . intval($q_amount);
- $b->showUsingQuery($template, $second_query, intval($highlight), 1, 1);
- }
-
- function event_InitSkinParse($data)
- {
- global $CONF, $manager;
- $this->skinType = $data['type'];
- $usePathInfo = ($CONF['URLMode'] == 'pathinfo');
- if (serverVar('REQUEST_URI') == '') {
- $uri = (serverVar('QUERY_STRING')) ?
- serverVar('SCRIPT_NAME') . serverVar('QUERY_STRING') :
- serverVar('SCRIPT_NAME');
- } else {
- $uri = serverVar('REQUEST_URI');
- }
- $page_str = ($usePathInfo) ? 'page/' : 'page=';
- if ( $manager->pluginInstalled('NP_CustomURL') ||
- $manager->pluginInstalled('NP_Magical') ||
- $manager->pluginInstalled('NP_MagicalURL2') ) {
- $page_str = 'page_';
- }
- if (strpos($uri, 'page/')) {
- list($org_uri, $currPage) = explode('page/', $uri, 2);
- } elseif (strpos($uri, 'page_')) {
- list($org_uri, $currPage) = explode('page_', $uri, 2);
- }
-// list($org_uri, $currPage) = explode($page_str, $uri, 2);
- if (getVar('page')) {
- $currPage = intGetVar('page');
- }
- $_GET['page'] = intval($currPage);
- $this->currPage = intval($currPage);
- $this->pagestr = $page_str;
- }
-
- function PageSwitch($switchParam)
- {
- global $CONF, $manager, $query;
-// initialize
- extract($switchParam);
- $type = intval($switchParam[0]);
- $pageamount = intval($switchParam[1]);
- $offset = intval($switchParam[2]);
- $entries = $switchParam[3];
- $b = $switchParam[4];
- $startpos = 0;
- $nowblogid = $b->getID();
- $usePathInfo = ($CONF['URLMode'] == 'pathinfo');
- $page_str = $this->pagestr;
- $currentpage = $this->currPage;
- $useCustomURL = ($manager->pluginInstalled('NP_CustomURL'));
- $useMagicalURL = ($manager->pluginInstalled('NP_Magical') || $manager->pluginInstalled('NP_MagicalURL2'));
- if ($useCustomURL) {
- $plugCustomURL =& $manager->getPlugin('NP_CustomURL');
- $customFlag = ($plugCustomURL->getBlogOption(intval($nowblogid), 'use_customurl') == 'yes');
- $redirectSFlag = ($plugCustomURL->getBlogOption(intval($nowblogid), 'redirect_search') == 'yes');
- }
-
-// createBaseURL
- $pagelink = createBlogidLink($nowblogid);
- if ($useCustomURL && $customFlag && $redirectSFlag) {
- $que_str = $query;
- $que_str = $this->_hsc($que_str);
- $que_str = mb_eregi_replace('/', 'ssslllaaassshhh', $que_str);
- $que_str = mb_eregi_replace("'", 'qqquuuooottt', $que_str);
- $que_str = mb_eregi_replace('&', 'aaammmppp', $que_str);
- $que_str = urlencode($que_str);
- $search_str = 'search/' . $que_str . '/';
- } else {
- if ($useMagicalURL && substr($pagelink, -5) == '.html') {
- $pagelink = substr($pagelink, 0, -5) . '_';
- }
- $search_str = '?query=' . $query;
- if (is_numeric(getVar('amount')) && intGetVar('amount') >= 0) {
- $search_str .= '&amount=' . intGetVar('amount');
- }
- if (strpos($pagelink, 'blogid=' . $nowblogid) === FALSE) {
- $search_str .= '&blogid=' . $nowblogid;
- }
- }
- $uri = parse_url($pagelink);
- if (!$usePathInfo) {
- if ($pagelink == $CONF['BlogURL']) { // add
- $pagelink .= '?';
- } elseif ($uri['query']) {
- $pagelink .= '&';
- }
- $pagelink = str_replace('&&', '&', $pagelink);
- } elseif ($usePathInfo && substr($pagelink, -1) != '/') {
- if ($uri['query']) {
- $pagelink .= '&';
- $page_str = 'page=';
- } else {
- if ($useMagicalURL && substr($pagelink, -1) == '_') {
- $pagelink = $pagelink;
- } else {
- $pagelink .= '/';
- }
- }
- }
- if (strstr ($pagelink, '//')) {
- $pagelink = preg_replace("/([^:])\/\//", "$1/", $pagelink);
- }
- if (strpos($pagelink, '?')) {
- $search_str = str_replace('?', '&', $search_str);
- }
-
-// Process pages
- if ($currentpage > 0) {
- $startpos = ($currentpage - 1) * $pageamount;
- } else {
- $currentpage = 1;
- }
- $totalamount = 0;
- if (is_array($entries)) {
- $totalamount = count($entries);
- }
- if (!empty($this->maxamount) && $this->maxamount < $totalamount) {
- $totalamount = intval($this->maxamount);
- }
- $totalamount = intval($totalamount);
- if ($offset) {
- $startpos += $offset;
- $totalamount -= $offset;
- }
- $totalpages = ceil($totalamount / $pageamount);
- $totalpages = intval($totalpages);
- if ($startpos > $totalamount) {
- $currentpage = $totalpages;
- $startpos = $totalamount - $pageamount;
- }
-
-// Create pageswitch
- $prevpage = ($currentpage > 1) ? intval($currentpage) - 1 : 0;
- $nextpage = intval($currentpage) + 1;
- if ($useCustomURL && $customFlag && $redirectSFlag) {
- $lastpagelink = $pagelink . $search_str . $page_str . '1.html';
- } elseif (($useMagicalURL && substr($pagelink, -1) == '_') || $useCustomURL) {
- $lastpagelink = $pagelink . $page_str . '1.html' . $search_str;
- } else {
- $lastpagelink = $pagelink . $page_str . '1' . $search_str;
- }
- if ($useCustomURL && $customFlag && $redirectSFlag) {
- $lastpagelink = $pagelink . $search_str . $page_str . $totalpages . '.html';
- } elseif (($useMagicalURL && substr($pagelink, -1) == '_') || $useCustomURL) {
- $lastpagelink = $pagelink . $page_str . $totalpages . '.html' . $search_str;
- } else {
- $lastpagelink = $pagelink . $page_str . $totalpages . $search_str;
- }
-
- if ($type >= 1) {
- $buf .= '<div class="pageswitch">' . "\n";
-// $buf .= "<a rel=\"first\" title=\"first page\" href=\"{$firstpagelink}\"><TOP></a> | \n";
- if (!empty($prevpage)) {
- if ($useCustomURL && $customFlag && $redirectSFlag) {
- $prevpagelink = $pagelink . $search_str . $page_str . $prevpage . '.html';
- } elseif (($useMagicalURL && substr($pagelink, -1) == '_') || $useCustomURL) {
- $prevpagelink = $pagelink . $page_str . $prevpage . '.html' . $search_str;
- } else {
- $prevpagelink = $pagelink . $page_str . $prevpage . $search_str;
- }
- $buf .= '<a href="' . $prevpagelink . '" title="Previous page" rel="Prev">«Prev</a> |';
- } elseif ($type >= 2) {
- $buf .= "«Prev |";
- }
- if (intval($type) == 1) {
- $buf .= "\n";
- }
- if (intval($type) == 2) {
- $sepstr = '·';
- $buf .= "|";
- for ($i=1; $i<=$totalpages; $i++) {
- if ($useCustomURL && $customFlag && $redirectSFlag) {
- $i_pagelink = $pagelink . $search_str . $page_str . $i . '.html';
- } elseif (($useMagicalURL && substr($pagelink, -1) == '_') || $useCustomURL) {
- $i_pagelink = $pagelink . $page_str . $i . '.html' . $search_str;
- } else {
- $i_pagelink = $pagelink . $page_str . $i . $search_str;
- }
- if ($i == $currentpage) {
- $buf .= ' <strong>' . $i . '</strong> |' . "\n";
- } elseif ($totalpages<10 || $i<4 || $i>$totalpages-3) {
- $buf .= ' <a href="' . $i_pagelink . '" title="Page No.' . $i . '">'
- . $i . '</a> |' . "\n";
- } else {
- if ($i<$currentpage-1 || $i>$currentpage+1) {
- if (($i == 4 && ($currentpage > 5 || $currentpage == 1)) || $i == $currentpage + 2) {
- $buf = rtrim($buf);
- $buf .= "...|\n";
- }
- } else {
- $buf .= ' <a href="' . $i_pagelink . '" title="Page No.' . $i . '">'
- . $i . '</a> |' . "\n";
- }
- }
- }
- $buf = rtrim($buf);
- }
- if (intval($type) == 3) {
- $buf .= '|';
- $sepstr = '·';
- for ($i = 1; $i <= $totalpages; $i++) {
- if ($useCustomURL && $customFlag && $redirectSFlag) {
- $i_pagelink = $pagelink . $search_str . $page_str . $i . '.html';
- } elseif (($useMagicalURL && substr($pagelink, -1) == '_') || $useCustomURL) {
- $i_pagelink = $pagelink . $page_str . $i . '.html' . $search_str;
- } else {
- $i_pagelink = $pagelink . $page_str . $i . $search_str;
- }
- $paging = 5;
- if ($i == $currentpage) {
- $buf .= ' <strong>' . $i . '</strong> ' . $sepstr . "\n";
- } elseif ($totalpages < 10 || ($i < ($currentpage + $paging) && ($currentpage - $paging) < $i)) {
- $buf .= ' <a href="' . $i_pagelink . '" title="Page No.' . $i . '">'
- . $i . '</a> ' . $sepstr . "\n";
- } elseif ($currentpage - $paging == $i) {
- $buf = rtrim($buf);
- $buf .= ' ...'."\n";
- } elseif ($currentpage + $paging == $i) {
- $buf = rtrim($buf);
- $buf = preg_replace('/$sepstr$/', '', $buf);
- $buf .= "... |\n";
- }
- }
- }
- if ($totalpages >= $nextpage) {
- if ($useCustomURL && $customFlag && $redirectSFlag) {
- $nextpagelink = $pagelink . $search_str . $page_str . $nextpage . '.html';
- } elseif (($useMagicalURL && substr($pagelink, -1) == '_') || $useCustomURL) {
- $nextpagelink = $pagelink . $page_str . $nextpage . '.html' . $search_str;
- } else {
- $nextpagelink = $pagelink . $page_str . $nextpage . $search_str;
- }
- $buf .= '| <a href="' . $nextpagelink . '" title="Next page" rel="Next">Next»</a>' . "\n";
-
- } elseif ($type >= 2) {
- $buf .= "| Next»\n";
- }
-// $buf .= " | <a rel=\"last\" title=\"Last page\" href=\"{$lastpagelink}\"><LAST></a>\n";
- $buf .= "</div>\n";
- return array('buf' => $buf, 'startpos' => intval($startpos));
- }
- }
-
- function doTemplateVar(&$item, $maxLength = 250, $addHighlight = 1)
- { // Orign NP_ChoppedDisc.php by nakahara21
- global $CONF, $manager, $member, $catid;
-
-// Paese setting
- $item_id = intval($item->itemid);
- $resultQuery = 'SELECT '
- . ' %s as result '
- . 'FROM '
- . ' %s '
- . 'WHERE '
- . ' %s = ' . $item_id;
-
-// Parse item
- $results['Item'] = strip_tags($item->body).strip_tags($item->more);
-
-// Parse commets
- if ($this->getOption("commentsearch")) {
- $cmntQuery = sprintf($resultQuery, cbody, sql_table('comment'), 'citem');
- $response = sql_query($cmntQuery);
- while ($cmnt = mysql_fetch_object($response)) {
- $results['comment'] .= strip_tags($cmnt->result);
- }
- }
-
-// Parse trackback
- if ($this->getOption("trackbacksearch") &&
- $manager->pluginInstalled('NP_TrackBack')) {
-// $titlQuery = sprintf($resultQuery, title, sql_table('plugin_tb'), 'tb_id');
-// $response = quickQuery($titlQuery);
-// $results['Trackback_title'] = strip_tags($response);
-
- $trbkQuery =sprintf($resultQuery, excerpt, sql_table('plugin_tb'), 'tb_id');
- $response = sql_query($trbkQuery);
- while ($tb = mysql_fetch_object($response)) {
- $results['Trackback'] .= strip_tags($tb->result);
- }
- }
- $queryStrings = $this->getQueryStrings();
- foreach($results as $resKey => $resValue) {
- $strCount = 1;
- foreach($queryStrings as $queryValue) {
- if (!(mb_substr_count($resValue, $this->_hsc($queryValue)))) {
- $strCount++;
- }
- }
- if ($strCount > count($queryStrings)) {
- $resValue = '';
- }
- if ($resValue) {
- if ($addHighlight) {
- $i = 0;
- foreach($queryStrings as $queryValue) {
- mb_regex_encoding(_CHARSET);
- $pattern = "<span class='highlight_{$i}'>{$queryValue}</span>";
- $resValue = mb_eregi_replace($this->_hsc($queryValue), $pattern, $resValue);
- $i++;
- if ($i == 10) {
- $i = 0;
- }
- }
- $str_array = mb_split('</span>', $resValue);
- $num = count($str_array);
- $lastKey = $num +(-1);
- $resWidth = 0;
- $check = FALSE;
- foreach($str_array as $key => $value) {
- $tmpStr = mb_split("<span class='highlight", $value);
- $tmpStr[0] = mb_eregi_replace('<', '<', $tmpStr[0]);
- $tmpStr[0] = mb_eregi_replace('>', '>', $tmpStr[0]);
- $tmpStr[0] = mb_eregi_replace('&', '&', $tmpStr[0]);
-// $tmpStr[0] = mb_eregi_replace(' ', ' ', $tmpStr[0]);
- $lastp = mb_strwidth($tmpStr[0], _CHARSET);
- if ($key == 0) {
- if ($lastp > 20) {
- $temp_s = '...'
- . mb_substr($tmpStr[0], -20, 20, _CHARSET);
- } else {
- $temp_s = $tmpStr[0];
- }
- $resWidth += 20;
- } elseif ($key > 0 && $key < $lastKey) {
- if ($lastp > 30) {
- $temp_s = mb_substr($tmpStr[0], 0, 10, _CHARSET)
- . '...'
- . mb_substr($tmpStr[0], -10, 10, _CHARSET);
- } else {
- $temp_s = $tmpStr[0];
- }
- $resWidth += 30;
- } elseif ($key == $lastKey) {
- if ($lastp > 20) {
- $temp_s = mb_substr($tmpStr[0], 0, 20, _CHARSET)
- . '...';
- } else {
- $temp_s = $tmpStr[0];
- }
- $resWidth += 20;
- }
- if ($key != $lastKey) {
- $str_array[$key] = $this->_hsc($temp_s)
- . "<span class='highlight"
- . $tmpStr[1];
- } else {
- $str_array[$key] = $this->_hsc($temp_s);
- }
- if ($maxLength < $resWidth && !$check) {
- $strKey = $key;
- $check = TRUE;
- }
- }
- if ($strKey > 0) {
- $str_array = array_slice($str_array, 0, $strKey);
- $str_array[$strKey] = $str_array[$strKey] . '...';
- }
- $resValue = '<span class="queryPosition">in '
- . $this->_hsc($resKey)
- . '</span>'
- . '<div class="queryResults">'
- . @implode('</span>', $str_array)
- . '</div>';
- } else {
- $tmpValue = '<span class="queryPosition">in '
- . $this->_hsc($resKey)
- . '</span>'
- . '<div class="queryResults">'
- . $this->_hsc(shorten($resValue, $maxLength, '...'))
- . '</div>';
- $resValue = $tmpValue;
- }
- echo $resValue;
- }
- }
- }
-
- function getQueryStrings()
- {
- global $query;
-// if (requestVar('query')) {
- $q = 'query';
-// $urlq = serverVar("QUERY_STRING");
- if(_CHERSET != 'UTF-8') {
- $query = mb_convert_encoding($query, "UTF-8", _CHARSET);
- }
- $urlq = urlencode($query);
- $urlq = preg_replace('|[^a-zA-Z0-9-~+_.#=&;,:@%]|i', '', $urlq);
-// $urlq = str_replace('?', '', $urlq);
-// $urlq = str_replace('or+', '', $urlq);
- $SQ = str_replace('or+', '', $urlq);
- /*$urlq = explode('&', $urlq);
- foreach ($urlq as $v) {
- $tmpq = explode('=', $v);
- if ($tmpq[0] == $q) $SQ = $tmpq[1];
- }*/
- $SQarray = explode('+', $SQ);
- return array_map(array(&$this, '_rawdecode'), $SQarray);
-// }
- }
-
- function _rawdecode($str)
- {
- $str = rawurldecode($str);
- if(_CHERSET != 'UTF-8') {
- $str = mb_convert_encoding($str, _CHARSET, "UTF-8");
- }
- return $str;
- }
-
- function _hsc($str)
- {
- return htmlspecialchars($str, ENT_QUOTES, _CHARSET);
- }
-
-}
-
+++ /dev/null
-<?php
-
-class NP_ItemBname extends NucleusPlugin {
-
- function getName() { return 'ItemBname'; }
- function getAuthor() { return ''; }
- function getURL() { return '../../index.html'; }
- function getVersion() { return '1.0'; }
- function getDescription() { return 'Usage:<%ItemBname%> in template'; }
-
- function doTemplateVar($item) {
- global $CONF;
- $thisblogid = getBlogIDFromItemID($item->itemid);
- $thisblogname = getBlogNameFromID($thisblogid);
- echo '<a href="'.createBlogIDLink($thisblogid).'">'.$thisblogname.'</a>';
- }
-
- function supportsFeature ($what)
- {
- switch ($what)
- {
- case 'SqlTablePrefix':
- return 1;
- default:
- return 0;
- }
- }
-
-}
-?>
+++ /dev/null
-.highlight_0 {
- color: #000;
- background-color: rgb(255, 255, 102);
- line-height : 1.2em;
- font-size : 1.1em;
- font-style : italic;
- font-weight : bold;
-}
-
-.highlight_1 {
- color: #000;
- background-color: rgb(160, 255, 255);
- line-height : 1.2em;
- font-size : 1.1em;
- font-style : italic;
- font-weight : bold;
-}
-
-.highlight_2 {
- color: #000;
- background-color: rgb(153, 255, 153);
- line-height : 1.2em;
- font-size : 1.1em;
- font-style : italic;
- font-weight : bold;
-}
-
-.highlight_3 {
- color: #000;
- background-color: rgb(255, 153, 153);
- line-height : 1.2em;
- font-size : 1.1em;
- font-style : italic;
- font-weight : bold;
-}
-.highlight_4 {
- color: #000;
- background-color: rgb(255, 102, 255);
- line-height : 1.2em;
- font-size : 1.1em;
- font-style : italic;
- font-weight : bold;
-}
-
-.highlight_5 {
- color: #fff;
- background-color: rgb(136, 0, 0);
- line-height : 1.2em;
- font-size : 1.1em;
- font-style : italic;
- font-weight : bold;
-}
-
-.highlight_6 {
- color: #fff;
- background-color: rgb(0, 170, 0);
- line-height : 1.2em;
- font-size : 1.1em;
- font-style : italic;
- font-weight : bold;
-}
-
-.highlight_7 {
- color: #fff;
- background-color: rgb(136, 104, 0);
- line-height : 1.2em;
- font-size : 1.1em;
- font-style : italic;
- font-weight : bold;
-}
-
-.highlight_8 {
- color: #fff;
- background-color: rgb(0, 70, 153);
- line-height : 1.2em;
- font-size : 1.1em;
- font-style : italic;
- font-weight : bold;
-}
-
-.highlight_9 {
- color: #fff;
- background-color: rgb(153, 0, 153);
- line-height : 1.2em;
- font-size : 1.1em;
- font-style : italic;
- font-weight : bold;
-}
+++ /dev/null
-<h2 class="e_title"><a href="<%itemlink%>" title="<%title%> \82ð\93Ç\82Þ"><%syndicate_title(25)%></a></h2>
-<p class="e_body"><%SearchResultsEX(250,1)%></p>
-<div class="searchT"><%TagEX()%></div>
-<span class="pageURL"><a href="<%itemlink%>"><%itemlink%></a></span>
-<span class="opt">( [<%ItemBname%>] <%date%> <%time%> <%edit%> )</span>
\ No newline at end of file
+++ /dev/null
-<?php
-
-/** ============================================================================
- * GoogleSitemap for Nucleus
- *
- * Copyright 2005 by Niels Leenheer
- * ============================================================================
- * This program is free software and open source software; you can redistribute
- * it and/or modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the License,
- * or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit
- * http://www.gnu.org/licenses/gpl.html
- * ============================================================================
- **/
-
-/**
- * History
- * 0.7 modified release by shizuki
- * Generate URL modified from
- * 'http://example.com/action.php?action=plugin&name=Sitemap' to
- * 'http://example.com/sitemap.xml' and,or
- * 'http://example.com/index.php?virtualpath=sitemap.xml'
- * Add 'lastmod' attribute
- * 0.9 SitemapProtocol updated release
- * SitemapProtocol ver.0.9 as common for Google, Yahoo! and MSN(Live! Search)
- * 1.0 Add Sitemap type and chage 'lastmod' generate
- * Add 'ROR Sitemap' format
- * For details about the ROR format, go to www.rorweb.com
- * Modify 'lastmod' attribute
- * item posted time or comment posted time or item update time
- * item update time generate by NP_UpdateTime
- * 1.1 Send Sitemaps to Yahoo!
- **/
-
-class NP_SearchenginesSitemapsGenerator extends NucleusPlugin
-{
-
- function getName()
- {
- return 'SearchenginesSitemapsGenerator';
- }
-
- function getAuthor()
- {
- return 'Niels Leenheer + shizuki';
- }
-
- function getURL()
- {
- return 'http://japan.nucleuscms.org/wiki/plugins:searchenginesitemapgenerator';
- }
-
- function getVersion()
- {
- return '1.1';
- }
-
- function getDescription()
- {
- return _G_SITEMAP_DESC;
- }
-
- function getEventList()
- {
- return array(
- 'PostAddItem',
- 'PreSendContentType'
- );
- }
-
- function supportsFeature($feature)
- {
- switch($feature) {
- case 'SqlTablePrefix':
- return 1;
- default:
- return 0;
- }
- }
-
- function event_PreSendContentType($data)
- {
- global $CONF, $manager, $blogid;
-
- $mcategories = $this->pluginCheck('MultipleCategories');
- if ($mcategories) {
- if (method_exists($mcategories, 'getRequestName')) {
- $subReq = $mcategories->getRequestName();
- } else {
- $subReq = 'subcatid';
- }
- }
- $npUpdateTime = $this->pluginCheck('UpdateTime');
-
- if (!$blogid) {
- $blogid = $CONF['DefaultBlog'];
- } else {
- if (is_numeric($blogid)) {
- $blogid = intval($blogid);
- } else {
- $blogid = intval(getBlogIDFromName($blogid));
- }
- }
-
- $b =& $manager->getBlog($blogid);
- $BlogURL = $b->getURL();
- if (!$BlogURL) {
- $BlogURL = $CONF['IndexURL'];
- }
-
- if ( substr($BlogURL, -1) != '/'
- && substr($BlogURL, -4) != '.php') {
- $BlogURL .= '/';
- }
-
- if (getVar('virtualpath')) {
- $info = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', getVar('virtualpath'));
- } elseif (serverVar('PATH_INFO')) {
- $info = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', serverVar('PATH_INFO'));
- } else {
- return;
- }
-
- $path_arr = explode('/', $info);
- $PcMap = $this->getBlogOption($blogid, 'PcSitemap');
- $MobileMap = $this->getBlogOption($blogid, 'MobileSitemap');
- if ( end($path_arr) == $PcMap
- || end($path_arr) == 'ror.xml'
- || (!empty($MobileMap) && end($path_arr) == $MobileMap) ) {
- $sitemap = array();
- if ( $this->getOption('AllBlogMap') == 'yes'
- && $blogid == $CONF['DefaultBlog']) {
- $blogQuery = 'SELECT * '
- . 'FROM %s '
- . 'ORDER BY bnumber';
- $blogQuery = sprintf($blogQuery, sql_table('blog'));
- $blogResult = sql_query($blogQuery);
- } else {
- $blogQuery = 'SELECT * '
- . 'FROM %s '
- . 'WHERE bnumber = %d';
- $blogQuery = sprintf($blogQuery, sql_table('blog'), $blogid);
- $blogResult = sql_query($blogQuery);
- $currentBlog = TRUE;
- }
- while ($blogs = mysql_fetch_array($blogResult)) {
- $blog_id = intval($blogs['bnumber']);
- if ( $this->getBlogOption($blog_id, 'IncludeSitemap') == 'yes'
- || !empty($currentBlog)) {
- $temp_b =& $manager->getBlog($blog_id);
- $TempURL = $temp_b->getURL();
- $SelfURL = $TempURL;
-
- $URLMode = $CONF['URLMode'];
- if (substr($TempURL, -4) == '.php') {
- $CONF['URLMode'] = 'normal';
- }
-
- $usePathInfo = ($CONF['URLMode'] == 'pathinfo');
-
- if (substr($SelfURL, -1) == '/') {
-
- if ($usePathInfo) {
- $SelfURL = substr($SelfURL, 0, -1);
- } else {
- $SelfURL = $SelfURL . 'index.php';
- }
-
- } elseif (substr($SelfURL, -4) != '.php') {
-
- if ($usePathInfo) {
- $SelfURL = $SelfURL;
- } else {
- $SelfURL = $SelfURL . '/index.php';
- }
-
- }
-
- $CONF['ItemURL'] = $SelfURL;
- $CONF['CategoryURL'] = $SelfURL;
-
- if ( substr($TempURL, -1) != '/'
- && substr($TempURL, -4) != '.php') {
- $TempURL .= '/';
- }
-
- $patternURL = '/^' . preg_replace('/\//', '\/', $BlogURL) . '/';
-
- if (preg_match($patternURL, $TempURL)) {
-
- if (end($path_arr) == 'ror.xml') {
- $rorTitleURL = $this->_prepareLink($SelfURL, $TempURL);
- $rooTitleURL = htmlspecialchars($rooTitleURL, ENT_QUOTES, _CHARSET);
- $sitemapTitle = " <title>ROR Sitemap for " . $rorTitleURL . "</title>\n"
- . " <link>" . $rorTitleURL . "</link>\n"
- . " <item>\n"
- . " <title>ROR Sitemap for " . $rorTitleURL . "</title>\n"
- . " <link>" . $rorTitleURL . "</link>\n"
- . " <ror:about>sitemap</ror:about>\n"
- . " <ror:type>SiteMap</ror:type>\n"
- . " </item>\n";
- } else {
- $sitemap[] = array(
- 'loc' => $this->_prepareLink($SelfURL, $TempURL),
- 'priority' => '1.0',
- 'changefreq' => 'daily'
- );
- }
-
- $catQuery = 'SELECT * '
- . 'FROM %s '
- . 'WHERE cblog = %d '
- . 'ORDER BY catid';
- $catTable = sql_table('category');
- $catQuery = sprintf($catQuery, $catTable, $blog_id);
- $catResult = sql_query($catQuery);
-
- while ($cat = mysql_fetch_array($catResult)) {
-
- $cat_id = intval($cat['catid']);
- $Link = createCategoryLink($cat_id);
- $catLoc =$this->_prepareLink($SelfURL, $Link);
-
- if (end($path_arr) != 'ror.xml') {
- $sitemap[] = array(
- 'loc' => $catLoc,
- 'priority' => '1.0',
- 'changefreq' => 'daily'
- );
- }
-
- if ($mcategories) {
- $scatQuery = 'SELECT * '
- . 'FROM %s '
- . 'WHERE catid = %d '
-// . 'ORDER BY scatid';
- . 'ORDER BY ordid';
- $scatTable = sql_table('plug_multiple_categories_sub');
- $scatQuery = sprintf($scatQuery, $scatTable, $cat_id);
- $scatResult = sql_query($scatQuery);
-
- while ($scat = mysql_fetch_array($scatResult)) {
-
- $scat_id = intval($scat['scatid']);
- $params = array($subReq => $scat_id);
- $Link = createCategoryLink($cat_id, $params);
- $scatLoc = $this->_prepareLink($SelfURL, $Link);
-
- if (end($path_arr) != 'ror.xml') {
- $sitemap[] = array(
- 'loc' => $scatLoc,
- 'priority' => '1.0',
- 'changefreq' => 'daily'
- );
- }
-
- }
-
- }
-
- }
-
- $itemQuery = 'SELECT *, '
- . ' UNIX_TIMESTAMP(itime) AS timestamp '
- . 'FROM %s '
- . 'WHERE iblog = %d '
- . 'AND idraft = 0 '
- . 'ORDER BY itime DESC';
- $itemTable = sql_table('item');
- $itemQuery = sprintf($itemQuery, $itemTable, $blog_id);
- $itemResult = sql_query($itemQuery);
- while ($item = mysql_fetch_array($itemResult)) {
-
- $item_id = intval($item['inumber']);
- $Link = createItemLink($item_id);
- $tz = date('O', $item['timestamp']);
- $tz = substr($tz, 0, 3) . ':' . substr($tz, 3, 2);
- $itemLoc = $this->_prepareLink($SelfURL, $Link);
-
- $mdQuery = 'SELECT'
- . ' UNIX_TIMESTAMP(ctime) AS timestamp'
- . ' FROM '
- . sql_table('comment')
- . ' WHERE'
- . ' citem = ' . $item_id
- . ' ORDER BY'
- . ' ctime DESC'
- . ' LIMIT'
- . ' 1';
- $modTime = sql_query($mdQuery);
- $itemTime = $item['timestamp'];
- if (mysql_num_rows($modTime) > 0) {
- $lastMod = mysql_fetch_object($modTime);
- $itemTime = $lastMod->timestamp;
- } elseif ($npUpdateTime) { // NP_UpdateTime exists
- $mdQuery = 'SELECT'
- . ' UNIX_TIMESTAMP(updatetime) AS timestamp'
- . ' FROM '
- . sql_table('plugin_rectime')
- . ' WHERE'
- . ' up_id = ' . $item_id;
- $modTime = sql_query($mdQuery);
- if (mysql_num_rows($modTime) > 0) {
- $lastMod = mysql_fetch_object($modTime);
- $itemTime = $lastMod->timestamp;
- }
- }
-
-/* if (time() - $itemTime < 86400 * 2) {
- $fq = 'hourly';
- } elseif (time() - $itemTime < 86400 * 14) {
- $fq = 'daily';
- } elseif (time() - $itemTime < 86400 * 62) {
- $fq = 'weekly';
- } else {
- $fq = 'monthly';
- }*/
- if ($itemTime < strtotime('-1 month')) {
- $fq = 'monthly';
- } elseif ($itemTime < strtotime('-1 week')) {
- $fq = 'weekly';
- } elseif ($itemTime < strtotime('-1 day')) {
- $fq = 'daily';
- } else {
- $fq = 'hourly';
- }
- $lastmod = gmdate('Y-m-d\TH:i:s', $itemTime) . $tz;
-
- if (end($path_arr) != 'ror.xml') {
- $sitemap[] = array(
- 'loc' => $itemLoc,
- 'lastmod' => $lastmod,
- 'priority' => '1.0',
- 'changefreq' => $fq
- );
- } else {
- $iTitle = $item['ititle'];
- if (_CHARSET != 'UTF-8') {
- $iTitle = mb_conbert_encoding($iTitle, 'UTF-8', _CHARSET);
- }
- $sitemap[] = array(
- 'title' => $iTitle,
- 'link' => $itemLoc,
- 'ror:updated' => $lastmod,
- 'ror:updatePeriod' => 'day',
- 'ror:sortOrder' => '0',
- 'ror:resourceOf' => 'sitemap',
- );
- }
-
- }
-
- }
-
- }
-
- if ($CONF['URLMode'] != $URLMode) {
- $CONF['URLMode'] = $URLMode;
- }
-
- }
-
- $manager->notify('SiteMap', array ('sitemap' => & $sitemap));
-
- header ("Content-type: application/xml");
-
- if (end($path_arr) == 'ror.xml') {
-
- // ror sitemap feed
- $sitemapHeader ="<" . "?xml version='1.0' encoding='UTF-8'?" . ">\n\n"
- . "<!-- This file is a ROR Sitemap for describing this website to the search engines. "
- . "For details about the ROR format, go to www.rorweb.com. -->\n"
- . '<rss version="2.0" xmlns:ror="http://rorweb.com/0.1/" >' . "\n"
- . "<channel>\n";
-
- } else {
-
- // old Google sitemap protocol ver.0.84
-// $sitemapHeader = "<" . "?xml version='1.0' encoding='UTF-8'?" . ">\n\n";
-// . "\t<urlset" . ' xmlns="http://www.google.com/schemas/sitemap/0.84"' . "\n";
-// . "\t" . 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . "\n";
-// . "\t" . 'xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84' . "\n";
-// . "\t" . ' http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">' . "\n";
-
- // new sitemap common protocol ver 0.9
- $sitemapHeader = "<" . "?xml version='1.0' encoding='UTF-8'?" . ">\n\n"
- . '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . "\n"
- . ' xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9' . "\n"
- . ' http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"' . "\n"
- . ' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"';
- // uncomment and edit next line when you need "example_schema"
-// $sitemapHeader .= ' xmlns:example="http://www.example.com/schemas/example_schema"';
- $sitemapHeader .= '>';
-
- }
-
- echo $sitemapHeader;
- if (end($path_arr) == 'ror.xml') {
- echo $sitemapTitle;
- }
-
- while (list(, $url) = each($sitemap)) {
-
- if (end($path_arr) == 'ror.xml') {
- echo "\t<item>\n";
- } else {
- echo "\t<url>\n";
- }
-
- while (list($key, $value) = each($url)) {
- if ($key == 'loc') {
- $value = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', $value);
- $data = "\t\t<" . $key . ">"
- . htmlspecialchars($value, ENT_QUOTES, _CHARSET)
- . "</" . $key . ">\n";
- } else {
- $data = "\t\t<" . $key . ">"
- . htmlspecialchars($value, ENT_QUOTES, _CHARSET)
- . "</" . $key . ">\n";
- }
- echo $data;
- }
-
- if (end($path_arr) == 'ror.xml') {
- echo "\t</item>\n";
- } else {
- echo "\t</url>\n";
- }
-
- }
-
- if (end($path_arr) == 'ror.xml') {
- echo "</channel>\n</rss>\n";
- } else {
- echo "</urlset>\n";
- }
-// echo "</urlset>\n";
- exit;
-
- }
- }
-
- function pluginCheck($pluginName)
- {
- global $manager;
- if (!$manager->pluginInstalled('NP_' . $pluginName)) {
- return;
- } else {
- $plugin =& $manager->getPlugin('NP_' . $pluginName);
- return $plugin;
- }
- }
-
- function _prepareLink($base, $url) {
- if (substr($url, 0, 7) == 'http://') {
- return $url;
- } else {
- return $base . $url;
- }
- }
-
- function event_PostAddItem(&$data)
- {
- global $manager, $CONF;
-
- $item_id = intval($data['itemid']);
- $blog_id = intval(getBlogIDFromItemID($item_id));
- $b =& $manager->getBlog($blog_id);
- $b_url = $b->getURL();
-
- if (substr($b_url, -4) == '.php') $CONF['URLMode'] = 'normal';
- $usePathInfo = ($CONF['URLMode'] == 'pathinfo');
-
- if (substr($b_url, -1) == '/') {
- if (!$usePathInfo) {
- $b_url .= 'index.php?virtualpath=';
- }
- } elseif (substr($b_url, -4) == '.php') {
- $b_url .= '?virtualpath=';
- } else {
- if ($usePathInfo) {
- $b_url = $b_url . '/';
- } else {
- $b_url = $b_url . '/index.php?virtualpath=';
- }
- }
- $siteMap = $this->getBlogOption($blog_id, 'PcSitemap');
-
- if ($this->getBlogOption($blog_id, 'PingGoogle') == 'yes') {
- $baseURL = 'http://www.google.com/webmasters/sitemaps/ping?sitemap=';
- $utl = $baseURL . urlencode($b_url . $siteMap);
- $url = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', $url);
- $fp = @fopen($url, 'r');
- @fclose($fp);
- $MobileMap = $this->getBlogOption($blog_id, 'MobileSitemap');
- if (!empty($MobileMap)) {
- $url = $baseURL . urlencode($b_url . $MobileMap);
- $url = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', $url);
- $fp = @fopen($url, 'r');
- @fclose($fp);
- }
- }
-
- if ($this->getBlogOption($blog_id, 'PingYahoo') == 'yes' &&
- $this->getBlogOption($blog_id, 'YahooAPID') != '') {
- $baseURL = 'http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid='
- . $this->getBlogOption($blog_id, 'YahooAPID')
- . '&url=';
- $utl = $baseURL . urlencode($b_url . $siteMap);
- $url = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', $url);
- $fp = @fopen($url, 'r');
- @fclose($fp);
- $MobileMap = $this->getBlogOption($blog_id, 'MobileSitemap');
- if (!empty($MobileMap)) {
- $url = $baseURL . urlencode($b_url . $MobileMap);
- $url = preg_replace('|[^a-zA-Z0-9-~+_.?#=&;,/:@%]|i', '', $url);
- $fp = @fopen($url, 'r');
- @fclose($fp);
- }
- }
-
- }
-
- function init()
- {
- global $admin;
- $language = ereg_replace( '[\\|/]', '', getLanguageName());
- if (file_exists($this->getDirectory() . $language.'.php')) {
- include_once($this->getDirectory() . $language.'.php');
- }else {
- include_once($this->getDirectory() . 'english.php');
- }
- }
-
- function install()
- {
- $this->createOption('AllBlogMap', _G_SITEMAP_ALLB, 'yesno', 'yes');
- $this->createBlogOption('IncludeSitemap', _G_SITEMAP_INC, 'yesno', 'yes');
- $this->createBlogOption('PingGoogle', _G_SITEMAP_PING_G, 'yesno', 'yes');
- $this->createBlogOption('PingYahoo', _G_SITEMAP_PING_Y, 'yesno', 'no');
- $this->createBlogOption('YahooAPID', _G_SITEMAP_YAPID, 'text', '');
- $this->createBlogOption('PcSitemap', _G_SITEMAP_PCSM, 'text', 'sitemap.xml');
- $this->createBlogOption('MobileSitemap', _G_SITEMAP_MBSM, 'text', '');
- }
-}
+++ /dev/null
-<?php
- define('_G_SITEMAP_DESC', "This plugin provides a Google sitemap for your website.<br />" .
- "Sitemap URL: http://example.cm/sitemap.xml");
- define('_G_SITEMAP_ALLB', "Generate All Blog's Google Sitemap");
- define('_G_SITEMAP_PING_G', "Ping Google after adding a new item");
- define('_G_SITEMAP_PING_Y', "Ping Yahoo! after adding a new item");
- define('_G_SITEMAP_YAPID', "Yahoo! Application ID");
- define('_G_SITEMAP_INC', "Include this blog in Google Sitemap when All Blog mode");
- define('_G_SITEMAP_PCSM', "Virtual file name for PC Sitemap");
- define('_G_SITEMAP_MBSM', "Virtual file name for Mobile Sitemap");
+++ /dev/null
-<?php
- define('_G_SITEMAP_DESC', "¡ÖGoogle¥¦¥§¥Ö¥Þ¥¹¥¿¡¼¥Ä¡¼¥ë¡×ÍѤΥµ¥¤¥È¥Þ¥Ã¥×¤òºîÀ®¤·¤Þ¤¹<br />" .
- "Sitemap URL: http://example.cm/sitemap.xml");
- define('_G_SITEMAP_ALLB', "AllBlog ¥â¡¼¥É¤Ç¥µ¥¤¥È¥Þ¥Ã¥×¤òºîÀ®¤¹¤ë(¥µ¥Ö/¥Þ¥ë¥Á¥É¥á¥¤¥ó¤Ï½ü³°)");
- define('_G_SITEMAP_PING_G', "¥¢¥¤¥Æ¥àÄɲûþ¤Ë Google ¤Ë¹¹¿·¤òÄÌÃΤ¹¤ë");
- define('_G_SITEMAP_PING_Y', "¥¢¥¤¥Æ¥àÄɲûþ¤Ë Yahoo! ¤Ë¹¹¿·¤òÄÌÃΤ¹¤ë");
- define('_G_SITEMAP_YAPID', "Yahoo! Application ID");
- define('_G_SITEMAP_INC', "AllBlog ¥â¡¼¥É¤Î¤È¤¤Ë¤³¤Î¥Ö¥í¥°¤ò´Þ¤á¤ë");
- define('_G_SITEMAP_PCSM', "PC ÍÑ¥µ¥¤¥È¥Þ¥Ã¥×¥Õ¥¡¥¤¥ë¤Î²¾ÁÛ¥Õ¥¡¥¤¥ë̾");
- define('_G_SITEMAP_MBSM', "¥â¥Ð¥¤¥ëÍÑ¥µ¥¤¥È¥Þ¥Ã¥×¥Õ¥¡¥¤¥ë¤Î²¾ÁÛ¥Õ¥¡¥¤¥ë̾");
+++ /dev/null
-<?php
- define('_G_SITEMAP_DESC', "「Googleウェブマスターツール」用のサイトマップを作成します<br />" .
- "Sitemap URL: http://example.cm/sitemap.xml");
- define('_G_SITEMAP_ALLB', "AllBlog モードでサイトマップを作成する(サブ/マルチドメインは除外)");
- define('_G_SITEMAP_PING_G', "アイテム追加時に Google に更新を通知する");
- define('_G_SITEMAP_PING_Y', "アイテム追加時に Yahoo! に更新を通知する");
- define('_G_SITEMAP_YAPID', "Yahoo! Application ID");
- define('_G_SITEMAP_INC', "AllBlog モードのときにこのブログを含める");
- define('_G_SITEMAP_PCSM', "PC 用サイトマップファイルの仮想ファイル名");
- define('_G_SITEMAP_MBSM', "モバイル用サイトマップファイルの仮想ファイル名");
+++ /dev/null
-<?php
-/**
- *
- * SHOWING BLOGS PLUG-IN FOR NucleusCMS
- * PHP versions 4 and 5
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * (see nucleus/documentation/index.html#license for more info)
- *
- * @author Original Author nakahara21
- * @copyright 2005-2006 nakahara21
- * @license http://www.gnu.org/licenses/gpl.txt GNU GENERAL PUBLIC LICENSE Version 2, June 1991
- * @version 2.71
- * @link http://japan.nucleuscms.org/wiki/plugins:showblogs
- *
- * 2.71 fix typo
- * 2.7 add doIf function requier Nucleus version 3.3 or later
- * ex. <%ifnot(ShowBlogs,page)%>top page contents<%else%>other pages contents<%endif%>
- * ex. <%if(ShowBlogs,cstik|bmode|stick|amont|tmplt,1|all|23|5|myTemplate)%><%endif%>
- * is <%ShowBlogs(myTemplate,5,all,,,23,,,,1)%>
- * 2.66.4.1 cahnge prev/next pagelink label class <span class="npsb_prevlink"></span>
- * and page label to BlogOption
- * 2.66.4 fix catformat
- * 2.66.3 fix display offset
- * 2.66.2 fix display Item when $q_amount=0
- * 2.66.1 fix sticky mode
- * 2.66 default argument bug fix
- * 2.65 add AD code control
- * add Category mode
- * fix stickies bug
- * 2.64 fix page switch URL generate
- * 2.62 security fix and tag related
- * 2.61 security fix
- * 2.6 security fix
- *
- ****************************************************************************
- *
- * THESE PLUG-INS ARE DEDICATED TO ALL THOSE NucleusCMS USERS
- * WHO FIGHT CORRUPTION AND IRRATIONAL IN EVERY DAY OF THEIR LIVES.
- *
- ****************************************************************************/
-
-class NP_ShowBlogs extends NucleusPlugin
-{
-
- function getName()
- {
- return 'Show Blogs';
- }
-
- function getMinNucleusVersion()
- {
- return '322';
- }
-
- function getAuthor()
- {
- return 'Taka + nakahara21 + kimitake + shizuki';
- }
-
- function getURL()
- {
- return 'http://japan.nucleuscms.org/wiki/plugins:showblogs';
- }
-
- function getVersion()
- {
- return '2.7';
- }
-
- function getDescription()
- {
- return _SHOWB_DESC;
- }
-
- function supportsFeature($what)
- {
- switch($what){
- case 'SqlTablePrefix':
- return 1;
- default:
- return 0;
- }
- }
-
- function getEventList()
- {
- return array(
- 'InitSkinParse'
- );
- }
-
- function init()
- {
- $language = ereg_replace( '[\\|/]', '', getLanguageName());
- if (file_exists($this->getDirectory() . $language . '.php')) {
- include_once($this->getDirectory() . $language . '.php');
- }else {
- include_once($this->getDirectory() . 'english.php');
- }
- }
-
- function install()
- {
- $this->createOption('catformat', _CAT_FORMAT, 'text', '<%category%> on <%blogname%>');
- $this->createOption('stickmode', _STICKMODE, 'select', '1', _STICKSELECT);
- $this->createOption('ads', _ADCODE_1, 'textarea', '' . "\n");
- $this->createOption('ads2', _ADCODE_2, 'textarea', '' . "\n");
- $this->createOption('tagMode', _TAG_MODE, 'select', '2', _TAG_SELECT);
- $this->createBlogOption('nextLabel', _SB_NEXTL, 'text', 'Next»');
- $this->createBlogOption('prevLabel', _SB_PREVL, 'text', '«Prev');
-/* todo can't install ? only warning ?
- * douyatte 'desc' ni keikoku wo daseba iinoka wakaranai desu
- $ver_min = (getNucleusVersion() < $this->getMinNucleusVersion());
- $pat_min = ((getNucleusVersion() == $this->getMinNucleusVersion()) &&
- (getNucleusPatchLevel() < $this->getMinNucleusPatchLevel()));
- if ($ver_min) { // || $pat_min) {
- global $DIR_LIBS;
- // uninstall plugin again...
- include_once($DIR_LIBS . 'ADMIN.php');
- $admin = new ADMIN();
- $admin->deleteOnePlugin($this->getID());
-
- // ...and show error
- $admin->error(_ERROR_NUCLEUSVERSIONREQ .
- $this->getMinNucleusVersion() . ' patch ' .
- $this->getMinNucleusPatchLevel());
- }
-*/
-// </mod by shizuki>
- }
-
- function doSkinVar($skinType,
- $template = 'default/index',
- $amount = 10, // amount/page
- $bmode = '', // show or hide Blogs
- $type = 1, // pagw switch type
- $sort = 'DESC', // item sort mode (DESC or ASC)
- $sticky = '', // sticky item id
- $sticktemplate = '',
- $catmode = 'all', // show or hide categories
- $showAdCode = 1, // AdCode switch
- $catStick = 0 // show sticky item when category selected ?
- )
- {
- global $manager;
- if ($skinType == 'item' && !$manager->pluginInstalled('NP_TagEX')) {
- return;
- }
- global $CONF, $blog, $blogid, $catid, $itemid, $archive, $subcatid;
-
- if (!$template) {
- $template = 'default/index';
- }
-
-// initialize hide blogID
- $hide = array();
-// initialize show blogID
- $show = array();
-// limit number of pages(months)
- $pagelimit = 0;
- $monthlimit = 0;
- $catformat = $this->getOption('catformat');
-
- $params = func_get_args();
- switch ($amount) {
- case '0':
- $type = $amount;
- break;
- case 'all':
- $bmode = $amount;
- if (is_numeric($params[3]) ||is_float($params[3])) {
- $type = $params[3];
- }
- break;
- }
- if (preg_match("/^(<>)?([0-9\/]+)$/", $bmode, $matches)) {
- if ($matches[1]) {
- $hide = explode("/", $matches[2]);
- $show = array();
- } else {
- $hide = array();
- $show = explode("/", $matches[2]);
- }
- $bmode = 'all';
- }
-
- $type = (float) $type;
- $typeExp = intval(($type - floor($type))*10); //0 or 1 or 9
- $this->showAdCode = $showAdCode;
-
- list ($pageamount, $offset) = sscanf($amount, '%d(%d)');
- if (!$pageamount) {
- $pageamount = 10;
- }
-
- if ($sort != 'ASC') {
- $sort = 'DESC';
- }
-
-/* if ($sort != 'ASC' && $sort != 'DESC') {
- $sticktemplate = $sticky;
- $sticky = $sort;
- $sort = 'DESC';
- }*/
-
- if (!empty($sticky) && empty($sticktemplate)) {
- $sticktemplate = $template;
- }
-
- if (preg_match("/^(<>)?([0-9\/]+)$/", $catmode, $matches)) {
- if ($matches[1]) {
- $hideCat = explode("/", $matches[2]);
- $showCat = array();
- } else {
- $hideCat = array();
- $showCat = explode("/", $matches[2]);
- }
- $catmode = 'all';
- }
-
- if (!$template) {
- $template = 'default/index';
- }
- if (!$amount) {
- $amount = 10;
- }
- if (!isset($type)) {
- $type = 1;
- }
- if (!$sort) {
- $sort = 'DESC';
- }
- if (!$showAdCode) {
- $showAdCode = 1;
- }
- if (!$catStick) {
- $catStick = 0;
- }
-
- if ($blog) {
- $b =& $blog;
- } else {
- $b =& $manager->getBlog($CONF['DefaultBlog']);
- }
- $this->nowbid = $nowbid = intval($b->getID());
-
- $where = '';
- $catblogname = 0;
-
- if ($bmode != 'all') {
- $where .= ' AND i.iblog = ' . $nowbid;
- } elseif (isset($hide[0]) && $bmode == 'all') {
- foreach ($hide as $val) {
- if (!is_numeric($val)) {
- $val = getBlogIDFromName($val);
- }
- $where .= ' AND i.iblog != ' . intval($val);
- }
- } elseif (isset($show[0]) && $bmode == 'all') {
- foreach ($show as $val) {
- if (!is_numeric($val)) {
- $val = getBlogIDFromName($val);
- }
- $w[] = intval($val);
- }
- $where .= (count($w) > 0) ? ' AND i.iblog in (' . implode(',', $w) . ')' : '';
- }
-
- if (isset($hideCat[0]) && $catmode == 'all') {
- foreach($hideCat as $val){
- if(is_numeric($val)){
- $where .= ' AND i.icat != ' . intval($val);
- }
- }
- } elseif (isset($showCat[0]) && $catmode == 'all') {
- foreach ($showCat as $val) {
- if (is_numeric($val)) {
- $w[] = intval($val);
- }
- }
- $where .= (count($w) > 0) ? ' AND i.icat in (' . implode(',', $w) . ')' : '';
- $mcats = $w;
- }
- if ($bmode == 'all') {
- $catblogname = 1;
- }
-// echo $bmode;
-
- if ($skinType == 'item' || $skinType == 'index' || $skinType == 'archive') {
- $catformat = '"' . addslashes($catformat) . '"';
- $nArr = array(
- '",c.cname,"',
- '",b.bname,"',
- '",c.cdesc,"'
- );
- $fArr = array(
- '/<%category%>/',
- '/<%blogname%>/',
- '/<%catdesc%>/'
- );
- $catformat = preg_replace($fArr, $nArr, $catformat);
- $mtable = "";
- if ($manager->pluginInstalled('NP_TagEX')) {
- $t_where = $this->_getTagsInum($where, $skinType, $bmode, $amount);
- $where .= $t_where['where'];
- }
-
- if ($skinType == 'item') {
- $where .= ' and i.inumber != ' . intval($itemid);
- } else {
-
- $sticCatFlag = (!$catid || (!empty($catStick) && $sticktemplate != ''));
-// if (!$catid && $sticky != '') {
- if ($sticCatFlag && $sticky != '') {
- $stickys = explode('/', $sticky);
- foreach ($stickys as $stickynumber) {
- $where .= ' AND i.inumber <> ' . intval($stickynumber);
- }
- }
-
-// $hidden = '';
- $temp = $y = $m = $d = '';
- if ($archive) {
- sscanf($archive, '%d-%d-%d', $y, $m, $d);
- if ($d) {
- $timestamp_start = mktime(0, 0, 0, $m, $d, $y);
- $timestamp_end = mktime(0, 0, 0, $m, $d+1, $y);
- $date_str = 'SUBSTRING(i.itime, 1, 10)';
- } else {
- $timestamp_start = mktime(0, 0, 0, $m, 1, $y);
- $timestamp_end = mktime(0, 0, 0, $m+1, 1, $y);
- $date_str = 'SUBSTRING(i.itime,1,7)';
- }
- $where .= ' AND i.itime >= ' . mysqldate($timestamp_start)
- . ' AND i.itime < ' . mysqldate($timestamp_end);
- } elseif (!empty($monthlimit)) {
- $timestamp_end = mysqldate($b->getCorrectTime());
- sscanf($timestamp_end, '"%d-%d-%d %s"', $y, $m, $d, $temp);
- $timestamp_start = mktime(0, 0, 0, $m-$monthlimit, $d, $y);
- $where .= ' AND i.itime >= ' . mysqldate($timestamp_start)
- . ' AND i.itime <= ' . $timestamp_end;
- } else {
- $where .= ' AND i.itime <= ' . mysqldate($b->getCorrectTime());
- }
-
- if (!empty($catid)) {
- if ($manager->pluginInstalled('NP_MultipleCategories')) {
- $mcat_query = $this->_getSubcategoriesWhere($catid);
- $mtable = $mcat_query['m'];
- $where .= $mcat_query['w'];
- } else {
- $where .= ' AND i.icat=' . intval($catid);
- }
- $linkparams['catid'] = $todayparams['catid'] = intval($catid);
- }
-
- if ($type >= 1) {
- $page_switch = $this->PageSwitch($type, $pageamount, $offset, $where, $sort, $mtable);
- if ($typeExp != 9 && $skinType != 'item') {
- echo $page_switch['buf'];
- }
- }
- }
-
- $sh_query = 'SELECT '
- . 'i.inumber as itemid, '
- . 'i.ititle as title, '
- . 'i.ibody as body, '
- . 'm.mname as author, '
- . 'm.mrealname as authorname, '
- . 'UNIX_TIMESTAMP(i.itime) as timestamp, '
- . 'i.itime, '
- . 'i.imore as more, '
- . 'm.mnumber as authorid,';
- if (!$catblogname) {
- $sh_query .= ' c.cname as category,';
- } else {
- $sh_query .= ' concat(' . $catformat . ') as category,';
- }
- $sh_query .= ' i.icat as catid,'
- . ' i.iclosed as closed'
- . ' FROM '
- . sql_table('member') . ' as m, '
- . sql_table('category') . ' as c, '
- . sql_table('item') . ' as i'
- . $mtable;
- if ($bmode == 'all') {
- $sh_query .= ', ' . sql_table('blog') . ' as b ';
- }
- $sh_query .= ' WHERE i.iauthor = m.mnumber'
- . ' AND i.icat = c.catid';
- if ($bmode == 'all') {
- $sh_query .= ' AND b.bnumber = c.cblog';
- }
-
-// if ($page_switch['startpos'] == 0 && !$catid && $sticky != '' && $skinType != 'item' && !$this->tagSelected) {
- $ads = 0;
- $sticCatFlag = ($page_switch['startpos'] == 0 && (!$catid || (!empty($catStick) && $sticktemplate != '')));
- if ($sticCatFlag && $sticky != '' && $skinType != 'item' && !$this->tagSelected) {
- foreach ($stickys as $stickynumber) {
- $sticky_query = $sh_query;
- $tempblogid = getBlogIDFromItemID($stickynumber);
- if ($bmode != 'all' && $this->getOption('stickmode') == 1) {
- $sticky_query .= ' AND i.iblog = ' . $nowbid;
- }
- $sticky_query .= ' AND i.inumber = ' . intval($stickynumber)
- . ' AND i.itime <= ' . mysqldate($b->getCorrectTime())
- . ' AND i.idraft = 0';
- if ($catid) {
- $sticky_query .= ' AND i.icat = ' . intval($catid);
- }
- if ($subcatid) {
- $sticky_query .= ' AND p.subcategories = ' . intval($subcatid);
- }
-/* $sticky_query .= $stickWhere;
- if ($bmode == 'all') {
- $b->showUsingQuery($sticktemplate, $sticky_query, 0, 1, 0);
- } elseif ($this->getOption('stickmode') == 1 && intval($nowbid) == $tempblogid) {
- $b->showUsingQuery($sticktemplate, $sticky_query, 0, 1, 0);
- } elseif (!$this->getOption('stickmode')) {
- $b->showUsingQuery($sticktemplate, $sticky_query, 0, 1, 0);
- }*/
-
- if (
- ($bmode == 'all') ||
- ($this->getOption('stickmode') == 1 && intval($nowbid) == $tempblogid) ||
- (!$this->getOption('stickmode'))
- ) {
- $b->showUsingQuery($sticktemplate, $sticky_query, 0, 1, 0);
- }
-
- //echo $stickynumber;
- if ($showAdCode > 0 && mysql_num_rows(sql_query($sticky_query))) {
- if ($ads == 0) {
- echo $this->getOption('ads');
- } elseif ($ads == 1) {
- echo $this->getOption('ads2');
- } elseif ($ads >= 2) {
- }
- $ads++;
- }
- }
- }
-
- $sh_query .= ' AND i.idraft = 0' . $where;
-
- if ($skinType == 'item') {
- $sh_query .= ' ORDER BY FIND_IN_SET(i.inumber,\'' . @join(',', $t_where['inumsres']) . '\')';
- } else {
- $sh_query .= ' ORDER BY i.itime ' . $sort;
- }
-
- if ($skinType != 'item') {
- $pStartPos = $page_switch['startpos'];
- if ($offset && $type < 1) {
- $pStartPos += intval($offset);
- }
- $this->_showUsingQuery($template, $sh_query, $pStartPos, $pageamount, $b, $ads);
- if ($type >= 1 && $typeExp != 1) echo $page_switch['buf'];
- } elseif ($skinType == 'item') {
- $sh_query .= ' LIMIT 0, ' . $pageamount;
- $b->showUsingQuery($template, $sh_query, 0, 1, 1);
- }
- }
- }
-
- function _showUsingQuery($template, $showQuery, $q_startpos, $q_amount, $b, $ads)
- {
- global $catid;
- $onlyone_query = $showQuery . ' LIMIT ' . intval($q_startpos) .', 1';
- $b->showUsingQuery($template, $onlyone_query, 0, 1, 1);
- if (intval($ads) == 0 && $this->showAdCode > 0) {
- echo $this->getOption('ads');
-// }
-//------------SECOND AD CODE-------------
- } elseif (intval($ads) == 1 && $this->showAdCode > 0) {
- echo $this->getOption('ads2');
- }
- $q_startpos++;
- $q_amount--;
- if ($q_amount <= 0) return;
- $onlyone_query = $showQuery . ' LIMIT ' . intval($q_startpos) . ', 1';
- $b->showUsingQuery($template, $onlyone_query, 0, 1, 1);
- if (mysql_num_rows(sql_query($onlyone_query)) && empty($ads) && $this->showAdCode > 0) {
- echo $this->getOption('ads2');
- }
-//------------SECOND AD CODE END-------------
- $q_startpos++;
- $q_amount--;
- if ($q_amount <= 0) return;
- $second_query = $showQuery . ' LIMIT ' . intval($q_startpos) . ',' . intval($q_amount);
- $b->showUsingQuery($template, $second_query, 0, 1, 1);
- }
-
- function event_InitSkinParse($data)
- {
- global $CONF, $manager;
- $this->skintype = $data['type'];
- $usePathInfo = ($CONF['URLMode'] == 'pathinfo');
- if (serverVar('REQUEST_URI') == '') {
- $uri = (serverVar('QUERY_STRING')) ?
- serverVar('SCRIPT_NAME') . serverVar('QUERY_STRING') : serverVar('SCRIPT_NAME');
- } else {
- $uri = serverVar('REQUEST_URI');
- }
- $page_str = ($usePathInfo) ? 'page/' : 'page=';
- if ( $manager->pluginInstalled('NP_CustomURL') ||
- $manager->pluginInstalled('NP_Magical') ||
- $manager->pluginInstalled('NP_MagicalURL2') ) {
- $page_str = 'page_';
- }
- if (strpos($uri, 'page/')) {
- list($org_uri, $currPage) = explode('page/', $uri, 2);
- } elseif (strpos($uri, 'page_')) {
- list($org_uri, $currPage) = explode('page_', $uri, 2);
- }
-// list($org_uri, $currPage) = explode($page_str, $uri, 2);
- if (getVar('page')) {
- $currPage = intGetVar('page');
- }
- $_GET['page'] = intval($currPage);
- $this->currPage = intval($currPage);
- $this->pagestr = $page_str;
- }
-
- function PageSwitch($type, $pageamount, $offset, $where, $sort, $mtable = '')
- {
- global $CONF, $manager, $archive, $catid, $subcatid;
-
-// initialize
- $startpos = 0;
- $catid = intval($catid);
- $subcatid = intval($subcatid);
- $usePathInfo = ($CONF['URLMode'] == 'pathinfo');
- $pageamount = intval($pageamount);
- $offset = intval($offset);
- if ($archive) {
- $y = $m = $d = '';
- sscanf($archive, '%d-%d-%d', $y, $m, $d);
- if (!empty($d)) {
- $archive = sprintf('%04d-%02d-%02d', $y, $m, $d);
- } else {
- $archive = sprintf('%04d-%02d', $y, $m);
- }
- }
-
- $page_str = $this->pagestr;
- $currentpage = $this->currPage;
-
-// createBaseURL
- if (!empty($catid)) {
- $catrequest = ($usePathInfo) ? $CONF['CategoryKey'] : 'catid';
- if (!empty($subcatid)) {
- $mplugin =& $manager->getPlugin('NP_MultipleCategories');
- $subrequest = $mplugin->getRequestName(array());
- if (!empty($archive)) {
- $linkParam = array(
- $catrequest => $catid,
- $subrequest => $subcatid
- );
- $pagelink = createArchiveLink($archive, $linkParam);
- } else {
- $linkParam = array(
- $subrequest => $subcatid
- );
- $pagelink = createCategoryLink($catid, $linkParam);
- }
- } else {
- if (!empty($archive)) {
- $linkParam = array(
- $catrequest => $catid,
- );
- $pagelink = createArchiveLink($archive, $linkParam);
- } else {
- $pagelink = createCategoryLink($catid);
- }
- }
- } else {
- if (!empty($archive)) {
- $pagelink = createArchiveLink($this->nowbid, $archive);
- } else {
- $pagelink = createBlogidLink($this->nowbid);
- }
- }
- if ($manager->pluginInstalled('NP_TagEX')) {
- $tplugin =& $manager->getPlugin('NP_TagEX');
- $requestTag = $tplugin->getNoDecodeQuery('tag');
- if (!empty($requestTag)) {
- $requestTarray = $tplugin->splitRequestTags($requestTag);
- $tag = array_shift($requestTarray['and']);
- $tag = $tplugin->_rawdecode($tag);
- if (!empty($requestTarray['and'])) {
- $requestT = implode('+', $requestTarray['and']);
- }
- if (!empty($requestTarray['or'])) {
- $requestTor = implode(':', $requestTarray['or']);
- }
- if (!empty($requestT)) {
- if (!empty($requestTor)) {
- $reqtags = $requestT . ':' . $requestTor;
- $pagelink = $tplugin->creatTagLink($tag, $this->getOption('tagMode'), $reqtags, '+');
- } else {
- $pagelink = $tplugin->creatTagLink($tag, $this->getOption('tagMode'), $requestT, '+');
- }
- } elseif (empty($requestT) && !empty($requestTor)) {
- $pagelink = $tplugin->creatTagLink($tag, $this->getOption('tagMode'), $requestTor, ':');
- } else {
- $pagelink = $tplugin->creatTagLink($tag, $this->getOption('tagMode'));
- }
- }
- }
-
- $uri = parse_url($pagelink);
- if (!$usePathInfo) {
- if ($pagelink == $CONF['BlogURL']) { // add
- $pagelink .= '?';
- } elseif ($uri['query']) {
- $pagelink .= '&';
- }
- $pagelink = str_replace('&&', '&', $pagelink);
- } elseif ($usePathInfo && substr($pagelink, -1) != '/') {
- if ($uri['query']) {
- $pagelink .= '&';
- $page_str = 'page=';
- } else {
- $pagelink .= '/';
- }
- }
- if (strstr ($pagelink, '//')) {
- $pagelink = preg_replace("/([^:])\/\//", "$1/", $pagelink);
- }
- if (substr($pagelink, -5) == '.html') {
- $pagelink = substr($pagelink, 0, -5) . '_';
- }
-
- if ($currentpage > 0) {
- $startpos = ($currentpage - 1) * $pageamount;
- } else {
- $currentpage = 1;
- }
-
- $totalamount = 0;
- if (is_numeric($where)) {
- $totalamount = $where;
- } elseif (is_array($where)) {
- $totalamount = count($where);
- } else {
- $p_query = 'SELECT COUNT(i.inumber) FROM %s as i%s WHERE i.idraft = 0%s';
- $p_query = sprintf($p_query, sql_table('item'), $mtable, $where);
-// $p_query = 'SELECT COUNT(i.inumber) FROM ' . sql_table('item') . ' as i' . $mtable . ' WHERE i.idraft=0' . $where;
- $entries = sql_query($p_query);
- if ($row = mysql_fetch_row($entries)) {
- $totalamount = $row[0];
- }
- }
- $totalamount = intval($totalamount);
- if (!$archive && !empty($pagelimit) && ($pagelimit * $pageamount < $totalamount)) {
- $totalamount = intval($pagelimit) * $pageamount;
- }
- if ($offset) {
- $startpos += $offset;
- $totalamount -= $offset;
- }
- if ($this->maxamount && $this->maxamount < $totalamount) {
- $totalamount = intval($this->maxamount);
- }
- $totalpages = ceil($totalamount / $pageamount);
- $totalpages = intval($totalpages);
- if ($startpos > $totalamount) {
- $currentpage = $totalpages;
- $startpos = $totalamount - $pageamount;
- }
- $prevpage = ($currentpage > 1) ? $currentpage - 1 : 0;
- $nextpage = $currentpage + 1;
- $firstpagelink = $pagelink . $page_str . '1';
- if ($page_str == 'page_') {
- $firstpagelink .= '.html';
- }
- $lastpagelink = $pagelink . $page_str . $totalpages;
- if ($page_str == 'page_') {
- $lastpagelink .= '.html';
- }
- $nextLinkLabel = $this->getBlogOption($this->nowbid, 'nextLabel') ? $this->getBlogOption($this->nowbid, 'nextLabel') : 'Next»';
- $prevLinkLabel = $this->getBlogOption($this->nowbid, 'prevLabel') ? $this->getBlogOption($this->nowbid, 'prevLabel') : '«Prev';
-
- if ($type >= 1) {
- $buf .= '<div class="pageswitch">' . "\n";
-// $buf .= "<a rel=\"first\" title=\"first page\" href=\"{$firstpagelink}\"><TOP></a> | \n";
- if (!empty($prevpage)) {
- $prevpagelink = $pagelink . $page_str . $prevpage;
- if ($page_str == 'page_') {
- $prevpagelink .= '.html';
- }
- $buf .= '<a href="' . $prevpagelink . '" title="Previous page" rel="Prev">'
- . '<span class="npsb_prevlink">' . $prevLinkLabel . '</span></a> |';
- } elseif ($type >= 2) {
- $buf .= $prevLinkLabel . " |";
- }
- if (intval($type) == 1) {
- $buf .= "\n";
- }
- if (intval($type) == 2) {
- $sepstr = '·';
- $buf .= "|";
- for ($i=1; $i<=$totalpages; $i++) {
- $i_pagelink = $pagelink . $page_str . $i;
- if ($page_str == 'page_') {
- $i_pagelink .= '.html';
- }
- if ($i == $currentpage) {
- $buf .= ' <strong>' . $i . '</strong> |' . "\n";
- } elseif ($totalpages<10 || $i<4 || $i>$totalpages-3) {
- $buf .= ' <a href="' . $i_pagelink . '" title="Page No.' . $i . '">'
- . $i . '</a> |' . "\n";
- } else {
- if ($i<$currentpage-1 || $i>$currentpage+1) {
- if (($i == 4 && ($currentpage > 5 || $currentpage == 1)) || $i == $currentpage + 2) {
- $buf = rtrim($buf);
- $buf .= "...|\n";
- }
- } else {
- $buf .= ' <a href="' . $i_pagelink . '" title="Page No.' . $i . '">'
- . $i . '</a> |' . "\n";
- }
- }
- }
- $buf = rtrim($buf);
- }
- if (intval($type) == 3) {
- $buf .= '|';
- $sepstr = '·';
- for ($i = 1; $i <= $totalpages; $i++) {
- $i_pagelink = $pagelink . $page_str . $i;
- if ($page_str == 'page_') {
- $i_pagelink .= '.html';
- }
- $paging = 5;
- if ($i == $currentpage) {
- $buf .= ' <strong>' . $i . '</strong> ' . $sepstr . "\n";
- } elseif ($totalpages < 10 || ($i < ($currentpage + $paging) && ($currentpage - $paging) < $i)) {
- $buf .= ' <a href="' . $i_pagelink . '" title="Page No.' . $i . '">'
- . $i . '</a> ' . $sepstr . "\n";
- } elseif ($currentpage - $paging == $i) {
- $buf = rtrim($buf);
- $buf .= ' ...'."\n";
- } elseif ($currentpage + $paging == $i) {
- $buf = rtrim($buf);
- $buf = preg_replace('/$sepstr$/', '', $buf);
- $buf .= "... |\n";
- }
- }
- }
- if ($totalpages >= $nextpage) {
- $nextpagelink = $pagelink . $page_str . $nextpage;
- if ($page_str == 'page_') {
- $nextpagelink .= '.html';
- }
- $buf .= '| <a href="' . $nextpagelink . '" title="Next page" rel="Next">'
- . '<span class="npsb_nextlink">' . $nextLinkLabel . '</span></a>' . "\n";
- } elseif ($type >= 2) {
- $buf .= "| " . $nextLinkLabel . "\n";
- }
-// $buf .= " | <a rel=\"last\" title=\"Last page\" href=\"{$lastpagelink}\"><LAST></a>\n";
- $buf .= "</div>\n";
- return array('buf' => $buf, 'startpos' => intval($startpos));
- }
- }
-
- function _getSubcategoriesWhere($catid)
- {
- global $manager;
- $subcatTable = sql_table('plug_multiple_categories_sub');
- $mwhere = '';
- $mwhere = ' AND ((i.inumber = p.item_id'
- . ' AND (p.categories REGEXP "(^|,)' . intval($catid) . '(,|$)"'
- . ' OR i.icat = ' . intval($catid) . '))'
- . ' OR (i.icat = ' . intval($catid)
- . ' AND p.item_id IS NULL))';
- $mtable = ' LEFT JOIN ' . sql_table('plug_multiple_categories') . ' as p'
- . ' ON i.inumber = p.item_id';
- $mplugin =& $manager->getPlugin('NP_MultipleCategories');
- if (method_exists($mplugin, 'getRequestName')) {
- $mplugin->event_PreSkinParse(array());
- global $subcatid;
- if ($subcatid) {
- $subcatid = intval($subcatid);
-
- $mque = 'SELECT * FROM %s WHERE scatid = %d';
- $tres = sql_query(sprintf($mque, $subcatTable, $subcatid));
-// $tres = sql_query('SELECT * FROM ' . sql_table('plug_multiple_categories_sub') .
-// ' WHERE scatid = ' . intval($subcatid));
- $ra = mysql_fetch_array($tres, MYSQL_ASSOC);
- if (array_key_exists('parentid', $ra)) {
- $Children = array();
- $Children = explode('/', $subcatid . $this->getChildren($subcatid));
- }
- if ($Children[1]) {
- for ($i=0;$i<count($Children);$i++) {
- $temp_whr[] = ' p.subcategories REGEXP "(^|,)' . intval($Children[$i]) . '(,|$)" ';
- }
- $mwhere .= ' AND ( ';
- $mwhere .= implode(' OR ', $temp_whr);
- $mwhere .= ' )';
- } else {
- $mwhere .= ' AND p.subcategories REGEXP "(^|,)' . $subcatid . '(,|$)"';
- }
- }
- }
- return array(
- 'w' => $mwhere,
- 'm' => $mtable
- );
- }
-
- function getParents($subcat_id)
- {
- $subcatTable = sql_table('plug_multiple_categories_sub');
- $que = 'SELECT scatid, parentid, sname FROM %s WHERE scatid = %d';
- $que = sprintf($que, $subcatTable, intval($subcat_id));
- $res = sql_query($que);
- list($sid, $parent, $sname) = mysql_fetch_row($res);
- if ($parent != 0) {
- $r = $this->getParent(intval($parent)) . '/' . intval($sid);
- } else {
- $r = intval($sid);
- }
- return $r;
- }
-
- function getChildren($subcat_id)
- {
- $subcatTable = sql_table('plug_multiple_categories_sub');
- $que = 'SELECT scatid, parentid, sname FROM %s WHERE parentid = %d';
- $que = sprintf($que, $subcatTable, intval($subcat_id));
- $res = sql_query($que);
- while ($so = mysql_fetch_object($res)) {
- $r .= $this->getChildren(intval($so->scatid)) . '/' . intval($so->scatid);
- }
- return $r;
- }
-
- function _getTagsInum($where, $skin_type, $bmode, $p_amount)
- {
- global $manager, $itemid;
- $tagTable = sql_table('plug_tagex');
- $tplugin =& $manager->getPlugin('NP_TagEX');
- $requestTag = $tplugin->getNoDecodeQuery('tag');
- if (!empty($requestTag) || $skin_type == 'item') {
- $this->tagSelected = TRUE;
- if ($bmode=='all') {
- $allTags = $tplugin->scanExistTags(0);
- } else {
- $allTags = $tplugin->scanExistTags(2);
- }
- $arr = $tplugin->splitRequestTags($requestTag);
- if ($skin_type == 'item') {
- $item =& $manager->getItem(intval($itemid), 0, 0);
- $q = 'SELECT * FROM %s WHERE inum = %d';
- $res = sql_query(sprintf($q, $tagTable, intval($itemid)));
- while ($o = mysql_fetch_object($res)) {
- $temp_tags_array = preg_split('/[\n,]+/', trim($o->itags));
- for ($i=0; $i < count($temp_tags_array); $i++) {
- $arr['or'][] = trim($temp_tags_array[$i]);
- }
- }
- }
- if ($skin_type != 'item') {
- for ($i=0; $i < count($arr['and']); $i++) {
- $deTag = $tplugin->_rawdecode($arr['and'][$i]);
- if ($allTags[$deTag]) {
- if (empty($inumsand)) {
- $inumsand = $allTags[$deTag];
- } else {
- $inumsand = array_intersect($inumsand, $allTags[$deTag]);
- }
- } else {
- $inumsand = array();
- }
- if (empty($inumsand)) {
- break;
- }
- }
- if (!empty($inumsand)) {
- $inumsres = array_values($inumsand);
- unset($inumsand);
- }
- }
- $inumsor = array();
- for ($i=0; $i < count($arr['or']); $i++) {
- if ($skin_type == 'item') {
- $deTag = $arr['or'][$i];
- } else {
- $deTag = $tplugin->_rawdecode($arr['or'][$i]);
- }
- if ($allTags[$deTag]) {
- $inumsor = array_merge($inumsor, $allTags[$deTag]);
- }
- }
- if ($inumsres && $inumsor) {
- $inumsres = array_merge($inumsres, $inumsor);
- $inumsres = array_unique($inumsres);
- } elseif (!$inumsres && $inumsor) {
- $inumsres = array_unique($inumsor);
- }
- if ($inumsres) {
- if ($skin_type == 'item') {
- foreach ($inumsres as $resinum) {
- $iTags = array();
- $q = 'SELECT itags FROM %s WHERE inum = %d';
- $q = sprintf($q, $tagTable, intval($resinum));
- $res = sql_query($q);
- while ($o = mysql_fetch_object($res)) {
- $resTags = preg_split("/[\n,]+/", trim($o->itags));
- for ($i=0; $i < count($resTags); $i++) {
- $iTags[] = trim($resTags[$i]);
- }
- }
- $relatedTags = array_intersect($arr['or'], $iTags);
- $tagCount[$resinum] = count($relatedTags);
- }
- asort($tagCount);
- $inumsres = array();
- foreach ($tagCount as $resinum => $val) {
- $relatedInums[] = intval($resinum);
- }
- for ($i=0; $i <= $p_amount; $i++) {
- $inumsres[$i] = array_pop($relatedInums);
- }
- }
- $where .= ' and i.inumber IN ('. @join(',', $inumsres) . ')';
- } else {
- $where .= ' and i.inumber=0';
- }
- }
- $retArray = array(
- 'where' => $where,
- 'inumsres' => $inumsres
- );
- return $retArray;
- }
-
- function doIf($key, $val = '')
- {
- if (strpos($key, '|') && strpos($val, '|')) {
- $keys = explode('|', $key);
- $vals = explode('|', $val);
- if (count($keys) <> count($vals)) {
- return;
- }
- $sbArgs = array();
- for ($i = 0; count($keys) > $i; $i++) {
- $sbArgs[$keys[$i]] = $vals[$i];
- }
- $tmplt = $sbArgs['tmplt'] ? $sbArgs['tmplt'] : 'default/index'; // template
- $amont = $sbArgs['amont'] ? $sbArgs['amont'] : 10; // amount/page
- $bmode = $sbArgs['bmode'] ? $sbArgs['bmode'] : ''; // show or hide Blogs
- $type = $sbArgs['type'] ? $sbArgs['type'] : 1; // pagw switch type
- $sort = $sbArgs['sort'] ? $sbArgs['sort'] : 'DESC'; // item sort mode (DESC or ASC)
- $stick = $sbArgs['stick'] ? $sbArgs['stick'] : ''; // sticky item id
- $stplt = $sbArgs['stplt'] ? $sbArgs['stplt'] : ''; // sticky template
- $cmode = $sbArgs['cmode'] ? $sbArgs['cmode'] : 'all'; // show or hide categories
- $acode = $sbArgs['acode'] ? $sbArgs['acode'] : 1; // AdCode switch
- $cstik = $sbArgs['cstik'] ? $sbArgs['cstik'] : 0; // show sticky item when category selected ?
- $this->doSkinVar($this->skintype, $tmplt, $amont, $bmode, $type, $sort, $stick, $stplt, $cmode, $acode, $cstik);
- return TRUE;
- } elseif ($key == 'page') {
- if ($value) {
- if ($this->currPage == intval($value)) {
- return TRUE;
- } else {
- return FALSE;
- }
- } elseif ($this->currPage > 1) {
- return TRUE;
- } else {
- return FALSE;
- }
- }
-
- }
-
-}
-
+++ /dev/null
-<?php
- define('_SHOWB_DESC', 'This plugin displays items of ALL or EACH blogs, and the link to other pages. <br />'
- . '"MultipleCategories" supported! (NP_MultipleCategories v0.15 is required.)<br />'
- . 'Usage: <%ShowBlogs(default/index, 15, all, 2, DESC, 6/15/56/186, default/stick)%>');
- define('_CAT_FORMAT', 'category name disp format');
-// define('_CATNAME_SHOW', '[allblog mode only] category name to show (0:catname on blogname, 1:catname only, 2:blogname only)');
-// define('_STICKMODE', '[currentblog mode only] 0:show all stickyID, 1:show current blog stickyID only');
- define('_STICKMODE', '[currentblog mode only] sticky mode');
- define('_ADCODE_1', '[Ads code_1] code displayed under first and second item of the page');
- define('_ADCODE_2', '[Ads code_2] code displayed under second and third item of the page');
- define('_TAG_MODE', 'TagEX narrow mode on page-switch');
- define('_SB_NEXTL', 'Link text for NextPage');
- define('_SB_PREVL', 'Link text for PrevPage');
- define('_TAG_SELECT', 'all blogs|0|currentblog only|1|narrowed with catid/subcatid|2');
- define('_STICKSELECT', 'show all stickyID|0|show current blog stickyID only|1');
-?>
\ No newline at end of file
+++ /dev/null
-<?php
- define('_SHOWB_DESC', '<%blog%>¡¢<%archive%>¤òÃÖ¤´¹¤¨¤ë¥×¥é¥°¥¤¥ó¤Ç¤¹¡£<br />'
- . 'Á´¥Ö¥í¥°¡¢¤Þ¤¿¤ÏǤ°Õ¤Î¥Ö¥í¥°¤ò¥Ú¡¼¥¸¥¹¥¤¥Ã¥Á¤Ä¤¤Çɽ¼¨¤·¤Þ¤¹<br />'
- . 'NP_MultipleCategories v0.15 °Ê¹ß¤Î¥Þ¥ë¥Á¥«¥Æ¥´¥ê¡¢¤ª¤è¤ÓNP_TagEX ¤ËÂбþ¤·¤Æ¤¤¤Þ¤¹<br />'
- . 'Usage: <%ShowBlogs(default/index, 15, all, 2, DESC, 6/15/56/186, default/stick)%>');
- define('_CAT_FORMAT', '¥«¥Æ¥´¥ê¡¼Ì¾¤Îɽ¼¨·Á¼°');
-// define('_CATNAME_SHOW', '¥ª¡¼¥ë¥Ö¥í¥°¥â¡¼¥É¤Î»þ¤Î¥«¥Æ¥´¥ê¡¼Ì¾¤Îɽ¼¨·Á¼°'
-// . '(0:\8e¢¥«¥Æ¥´¥ê̾ on ¥Ö¥í¥°Ì¾\8e£, 1:¥«¥Æ¥´¥ê̾¤Î¤ß, 2:¥Ö¥í¥°Ì¾¤Î¤ß)');
- define('_STICKMODE', '¥«¥ì¥ó¥È¥Ö¥í¥°¥â¡¼¥É¤Î»þ¤Ëɽ¼¨¤¹¤ë¸ÇÄêɽ¼¨¥¢¥¤¥Æ¥à');
-// define('_STICKMODE', '¥«¥ì¥ó¥È¥Ö¥í¥°¥â¡¼¥É¤Î»þ¤Ëɽ¼¨¤¹¤ë¸ÇÄêɽ¼¨¥¢¥¤¥Æ¥à'
-// . '(0:Á´¤Æɽ¼¨¤¹¤ë, 1:ɽ¼¨Ãæ¤Î¥Ö¥í¥°¤Ë½ê°¤¹¤ë¤â¤Î¤Î¤ß)');
- define('_ADCODE_1', '1ÈÖÌܤÈ2ÈÖÌܤËɽ¼¨¤µ¤ì¤ë¥¢¥¤¥Æ¥à¤Î´Ö¤Ëɽ¼¨¤¹¤ë¹¹ð¤Î¥³¡¼¥É');
- define('_ADCODE_2', '2ÈÖÌܤÈ3ÈÖÌܤËɽ¼¨¤µ¤ì¤ë¥¢¥¤¥Æ¥à¤Î´Ö¤Ëɽ¼¨¤¹¤ë¹¹ð¤Î¥³¡¼¥É');
- define('_TAG_MODE', 'NP_TagEX »ÈÍÑ»þ¤Î¥Ú¡¼¥¸¥¹¥¤¥Ã¥Á¤Î¥â¡¼¥É');
- define('_SB_NEXTL', '¼¡¤Î¥Ú¡¼¥¸¤Ø¤Î¥ê¥ó¥¯¥Æ¥¥¹¥È');
- define('_SB_PREVL', 'Á°¤Î¥Ú¡¼¥¸¤Ø¤Î¥ê¥ó¥¯¥Æ¥¥¹¥È');
- define('_TAG_SELECT', 'Á´¥Ö¥í¥°¤Î tag ¤òɽ¼¨|0|'
- . 'ɽ¼¨Ãæ¤Î¥Ö¥í¥°¤Ë°¤¹¤ë tag ¤Î¤ßɽ¼¨|1|'
- . 'ɽ¼¨Ãæ¤Î¥«¥Æ¥´¥ê¡¦¥µ¥Ö¥«¥Æ¥´¥ê¤Ë°¤¹¤ë tag ¤Î¤ßɽ¼¨|2');
- define('_STICKSELECT', 'ɽ¼¨Ãæ¤Î¥Ö¥í¥°¤Ë¤«¤«¤ï¤é¤ºÁ´¤Æɽ¼¨|0|'
- . 'ɽ¼¨Ãæ¤Î¥Ö¥í¥°¤Ë°¤¹¤ë¸ÇÄꥢ¥¤¥Æ¥à¤Î¤ßɽ¼¨|1|');
-?>
\ No newline at end of file
+++ /dev/null
-<?php
- define('_SHOWB_DESC', '<%blog%>、<%archive%>を置き換えるプラグインです。<br />'
- . '全ブログ、または任意のブログをページスイッチつきで表示します<br />'
- . 'NP_MultipleCategories v0.15 以降のマルチカテゴリ、およびNP_TagEX に対応しています<br />'
- . 'Usage: <%ShowBlogs(default/index, 15, all, 2, DESC, 6/15/56/186, default/stick)%>');
- define('_CAT_FORMAT', 'カテゴリー名の表示形式');
-// define('_CATNAME_SHOW', 'オールブログモードの時のカテゴリー名の表示形式'
-// . '(0:「カテゴリ名 on ブログ名」, 1:カテゴリ名のみ, 2:ブログ名のみ)');
- define('_STICKMODE', 'カレントブログモードの時に表示する固定表示アイテム');
-// define('_STICKMODE', 'カレントブログモードの時に表示する固定表示アイテム'
-// . '(0:全て表示する, 1:表示中のブログに所属するもののみ)');
- define('_ADCODE_1', '1番目と2番目に表示されるアイテムの間に表示する広告のコード');
- define('_ADCODE_2', '2番目と3番目に表示されるアイテムの間に表示する広告のコード');
- define('_TAG_MODE', 'NP_TagEX 使用時のページスイッチのモード');
- define('_SB_NEXTL', '次のページへのリンクテキスト');
- define('_SB_PREVL', '前のページへのリンクテキスト');
- define('_TAG_SELECT', '全ブログの tag を表示|0|'
- . '表示中のブログに属する tag のみ表示|1|'
- . '表示中のカテゴリ・サブカテゴリに属する tag のみ表示|2');
- define('_STICKSELECT', '表示中のブログにかかわらず全て表示|0|'
- . '表示中のブログに属する固定アイテムのみ表示|1|');
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-/**
- *
- * TAGGING PLUG-IN FOR NucleusCMS
- * PHP versions 4 and 5
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * (see nucleus/documentation/index.html#license for more info)
- *
- *
- * @author Original Author nakahara21
- * @copyright 2005-2006 nakahara21
- * @license http://www.gnu.org/licenses/gpl.txt
- * GNU GENERAL PUBLIC LICENSE Version 2, June 1991
- * @version 0.41
- * @link http://nakahara21.com
- *
- * 0.65 clean up
- * 0.64 modified createTagLink function
- * 0.63 fix Magical code
- * 0.62 add function doIf() for NucleusCMS version3.3
- * 0.6 fix delete tags when item update(425)
- * mod scanExistTags function
- * mod get tagLink title
- * 0.51 typo fix
- * 0.5 TAG sort modified
- * 0.43 fix URL generate
- * 0.42 add URL selected tag check
- * 0.41 security fix and add some trick
- * 0.4 fixed bug: numlic only
- * 0.3 fixed bug: delete action
- * 0.2 supports and/or query
- *
- *
- * THESE PLUG-INS ARE DEDICATED TO ALL THOSE NucleusCMS USERS
- * WHO FIGHT CORRUPTION AND IRRATIONAL IN EVERY DAY OF THEIR LIVES.
- *
- **/
-
-if (!defined('_TAGEX_TABLE_DEFINED')) {
- define('_TAGEX_TABLE_DEFINED', 1);
- define('_TAGEX_TABLE', sql_table('plug_tagex'));
- define('_TAGEX_KLIST_TABLE', sql_table('plug_tagex_klist'));
-}
-
-class NP_TagEX extends NucleusPlugin
-{
-
- function getName()
- {
- return 'Tags Extension';
- }
- function getAuthor()
- {
- return 'nakahara21 + shizuki';
- }
- function getURL()
- {
- return 'http://nakahara21.com';
- }
- function getVersion()
- {
- return '0.65';
- }
- function getDescription()
- {
- return 'Tags Extension (for Japanese users)';
- }
-
- function supportsFeature($what)
- {
- switch ($what) {
- case 'SqlTablePrefix':
- return 1;
- default:
- return 0;
- }
- }
-
- function install()
- {
- $this->createOption('flg_erase', 'Erase data on uninstall.', 'yesno', 'no');
-// <editable template mod by shizuki>
- $this->createOption('editTagOrder', 'editform tag order', 'select',
- '1', 'amount(desc)|1|amount(asc)|2|tag\'s order|3|random|4');
- $this->createOption('and', 'template for \'and\'', 'textarea',
- '<span style="font-family:tahoma;font-size:smaller;"> '
- . ' <a href="<%andurl%>" title="narrow">&</a>.');
- $this->createOption('or', 'template for \'or\'', 'textarea',
- '<a href="<%orurl%>" title="expand">or</a> </span>');
- $this->createOption('tagIndex', 'template for \'tagIndex\'', 'textarea',
- '<%and%><%or%><span style="font-size:<%fontlevel%>em" '
- . 'title="<%tagamount%> post(s)! <%tagitems%>"><a href="<%taglinkurl%>"><%tag%></a></span>');
- $this->createOption('tagItemHeader', 'template for \'tagItemHeader\'', 'textarea',
- '');
- $this->createOption('tagItem', 'template for \'tagItem\'', 'textarea',
- '<%itemid%>:<%itemtitle%>');//<%
- $this->createOption('tagItemSeparator', 'template for \'tagItemSeparator\'', 'text',
- ' , ');
- $this->createOption('tagItemFooter', 'template for \'tagItemFooter\'', 'textarea',
- '');
- $this->createOption('tagIndexSeparator', 'template for \'tagIndexSeparator\'', 'text',
- ' | ');
- $this->createOption('tagsonlycurrent', 'show tags only current blog have', 'yesno',
- 'no');
- $this->createOption('colorfulhighlight', 'colorful highlight mode ?', 'yesno',
- 'no');
- $this->createOption('highlight', 'template for normal highlightmode', 'text',
- '<span class="highlight">\0</span>');
-//</mod by shizuki>*/
- $table_q = 'CREATE TABLE IF NOT EXISTS ' . _TAGEX_TABLE . ' ('
- . ' `inum` INT(9) NOT NULL default "0" PRIMARY KEY, '
- . ' `itags` TEXT NOT NULL, '
- . ' `itagreg` TIMESTAMP(14) NOT NULL'
- . ' )';
- sql_query($table_q);
- $table_q = 'CREATE TABLE IF NOT EXISTS ' . _TAGEX_KLIST_TABLE . ' ('
- . ' `listid` INT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY, '
- . ' `tag` VARCHAR(255) default NULL, '
- . ' `inums` TEXT NOT NULL, '
- . ' `inums_count` INT(11) NOT NULL default "0", '
- . ' `ireg` TIMESTAMP(14) NOT NULL'
- . ' )';
- sql_query($table_q);
- }
-
- function uninstall()
- {
- if ($this->getOption('flg_erase') == 'yes') {
- sql_query('DROP TABLE IF EXISTS ' . _TAGEX_TABLE);
- sql_query('DROP TABLE IF EXISTS ' . _TAGEX_KLIST_TABLE);
- }
- }
-
- function getTableList()
- {
- return array(
- _TAGEX_TABLE,
- _TAGEX_KLIST_TABLE
- );
- }
-
- function getEventList()
- {
- return array(
- 'PostAddItem',
- 'AddItemFormExtras',
- 'PreUpdateItem',
- 'EditItemFormExtras',
- 'PreItem',
- 'PreDeleteItem'
- );
- }
-
-/**
- *
- * Nucleus event functions
- *
- */
- function quote_smart($value)
- {
-// Escape SQL query strings
- if (is_array($value)) {
- if (get_magic_quotes_gpc()) {
- $value = array_map("stripslashes", $value);
- }
- if (!array_map("is_numeric",$value)) {
- if (version_compare(phpversion(),"4.3.0") == "-1") {
- $value = array_map("mysql_escape_string", $value);
- } else {
- $value = array_map("mysql_real_escape_string", $value);
- }
- } else {
- $value = intval($value);
- }
- } else {
- if (get_magic_quotes_gpc()) {
- $value = stripslashes($value);
- }
- if (!is_numeric($value)) {
- if (version_compare(phpversion(), "4.3.0") == "-1") {
- $value = "'" . mysql_escape_string($value) . "'";
- } else {
- $value = "'" . mysql_real_escape_string($value) . "'";
- }
- } else {
- $value = intval($value);
- }
- }
- return $value;
- }
-
- function event_PreItem($data)
- {
-// Hightlight tags
- global $currentTemplateName;
- $currTemplateName = $this->quote_smart($currentTemplateName);
- $templateDescTable = sql_table('template_desc');
- $q_query = 'SELECT tddesc as result '
- . 'FROM %s '
- . 'WHERE tdname = %s';
- $q_query = sprintf($q_query, $templateDescTable, $currTemplateName);
- $currentTemplateDesc = quickQuery($q_query);
- if (eregi('<highlightTagsAll>', $currentTemplateDesc)) {
- $tags = $this->scanExistTags(0, 99999999);
- if (empty($tags)) {
- return;
- } else {
- $highlightKeys = array_keys($tags);
- }
- } elseif (eregi('<highlightTags>', $currentTemplateDesc)) {
- $requestT = $this->getNoDecodeQuery('tag');
- if (empty($requestT)) {
- return;
- }
- $requestTarray = $this->splitRequestTags($requestT);
- $reqAND = array_map(array(&$this, "_rawdecode"), $requestTarray['and']);
- if ($requestTarray['or']) {
- $reqOR = array_map(array(&$this, "_rawdecode"), $requestTarray['or']);
- }
- if (isset($reqOR)) {
- $highlightKeys = array_merge($reqAND, $reqOR);
- } else {
- $highlightKeys = $reqAND;
- }
- } else {
- return;
- }
- $template['highlight'] = $this->getOption('highlight');
- $curItem =& $data['item'];
- if ($this->getOption('colorfulhighlight') == 'no') {// original mode
- $curItem->body = highlight($curItem->body, $highlightKeys, $template['highlight']);
- $curItem->more = highlight($curItem->more, $highlightKeys, $template['highlight']);
- } else {
-/**
- *
- * use other color for each tags
- * mod by shizuki
- *
- */
- $sh = 0;
- foreach ($highlightKeys as $qValue) {
- $pattern = '<span class=\'highlight_' . $sh . '\'>\0</span>';
- $curItem->body = highlight($curItem->body, $qValue, $pattern);
- $sh++;
- if ($sh == 10) {
- $sh = 0;
- }
- }
- if ($curItem->more) {
- $sh = 0;
- foreach ($highlightKeys as $qValue) {
- $pattern = '<span class=\'highlight_' . $sh . '\'>\0</span>';
- $curItem->more = highlight($curItem->more, $qValue, $pattern);
- $sh++;
- if ($sh == 10) {
- $sh = 0;
- }
- }
- }
- }
- }
-
-/**
- *
- * extra forms function
- * mod by shizuki
- *
- */
-/**
- *
- * TAG list
- * Add or Edit Item
- * TAGs only current blog
- * written by shizuki
- * From http://blog.uribou.net/
- *
- */
- function _ItemFormExtras($oldforj = '', $itags = '', $tagrows, $tagcols, $blogid = 0)
- {
- $blogid = intval($blogid);
-// Exstra form for add or update Item
- if (strstr(serverVar('HTTP_USER_AGENT'), 'Gecko')) {
- $divStyles = 'height: 24em;'
- . 'overflow: auto;'
- . 'border:1px solid lightblue;'
- . 'margin-top:3.8em;'
- . 'padding-left:0.5em;'
- . '-moz-column-count: 3;'
- . '-moz-column-gap: 0.5em;';
- $txAStyles = 'width:10em;'
- . 'height: 200px;'
- . 'width: 120px;';
- } else {
- $divStyles = 'height: 200px;'
- . 'overflow: auto;';
- $txAStyles = 'width:60%;';
- }
- $printData = "\t\t"
- . "<h3>TagEX</h3>\n\t\t"
- . '<p style="float:left">' . "\n\t\t\t"
- . '<label for="tagex">Tag(s):</label>' . "\n\t\t\t"
- . '<a href="javascript:resetOlder'
- . "('" . $oldforj . "')"
- . '">[Reset]</a><br />' . "\n\t\t\t"
- . '<textarea id="tagex" name="itags" rows="' . intval($tagrows)
- . '" cols="' . intval($tagcols) . '" style="' . $txAStyles . '"'
- . ' class="tagex">'
- . htmlspecialchars($itags) . '</textarea>' . "\n\t\t"
- . '</p>'
- . '<script language="JavaScript" type="text/javascript">' . "\n"
- . '<!--' . "\n"
- . 'function insertag(tag){' . "\n\t"
- . "if(document.getElementById('tagex').value != '')\n\t\t"
- . 'tag = "\n" + tag;' . "\n\t"
- . "document.getElementById('tagex').value += tag;\n"
- . "}\n"
- . "function resetOlder(old){\n\t"
- . "document.getElementById('tagex').value = old;\n"
- . "}\n//-->\n"
- . "</script>\n"
- . '<div style="' . $divStyles . '" class="tagex">' . "\n";
- echo $printData;
- $tagOrder = intval($this->getOption('editTagOrder'));
- if ($this->getOption('tagsonlycurrent') == no) {
- $existTags = $this->scanExistTags(0, 99999999, $tagOrder);
- } else {
- $existTags = $this->scanExistTags(1, 99999999, $tagOrder, $blogid);
- }
- if ($existTags) {
- $existTags = array_keys($existTags);
- }
- for ($i=0; $i < count($existTags); $i++) {
- $exTags = htmlspecialchars($existTags[$i]);
- $printData = '<li><a href="javascript:insertag'
- . "('" . $exTags . "')" . '">'
- . $exTags . '</a></li>' . "\n";
- echo $printData;
- }
- echo '</div><br style="clear:all;" />' . "\n";
- }
-
- function event_AddItemFormExtras($data)
- {
- global $CONF, $blogid;
- if (is_numeric($blogid)) {
- $blogid = intval($blogid);
- } else {
- $blogid = intval(getBlogIDFromName($blogid));
- }
- if (empty($blogid)) {
- $blogid = intval($CONF['DefaultBlog']);
- }
-// Call exstra form
- $oldforj = $itags = '';
- $this->_ItemFormExtras($oldforj, $itags, 3, 40, $blogid);// <current blog only />
- }
-
- function event_EditItemFormExtras($data)
- {
-// Initialize tags when it have
- $item_id = intval($data['variables']['itemid']);
- $query = 'SELECT itags FROM %s WHERE inum = %d';
- $result = sql_query(sprintf($query, _TAGEX_TABLE, $item_id));
- if (mysql_num_rows($result) > 0) {
- $itags = mysql_result($result,0,0);
- }
- $oldforj = str_replace("\n", '\n', htmlspecialchars($itags));
- $blogid = getBlogIDFromItemID($item_id);
- $blogid = intval($blogid);
-// Call exstra form
-// current blog onry mode
- $this->_ItemFormExtras($oldforj, $itags, 5, 20, $blogid);
- }
-
- function event_PostAddItem($data)
- {
-// Add tags when it add for Item
- $itags = trim(requestVar('itags'));
- if (!$itags) {
- return;
- }
- $inum = intval($data['itemid']);
- $query = 'INSERT INTO %s (inum, itags) VALUES (%d, %s)';
- $query = sprintf($query, _TAGEX_TABLE, $inum, $this->quote_smart($itags));
- sql_query($query);
- $temp_tags_array = preg_split("/[\r\n,]+/", $itags);
- for ($i=0; $i < count($temp_tags_array); $i++) {
- $this->mergeTags(trim($temp_tags_array[$i]), $inum);
- }
- }
-
- function event_PreUpdateItem($data)
- {
-// Add tags when it add for Item
- $itags = trim(requestVar('itags'));
- $inum = intval($data['itemid']);
- $query = 'SELECT itags as result FROM %s WHERE inum = %d';
- $oldTags = quickQuery(sprintf($query, _TAGEX_TABLE, $inum));
- if ($itags == $oldTags) {
- return;
- }
- $query = 'DELETE FROM %s WHERE inum = %d';
- sql_query(sprintf($query, _TAGEX_TABLE, $inum));
- if (!empty($itags)) {
- $query = 'INSERT INTO %s (inum, itags) VALUES (%d, %s)';
- $query = sprintf($query, _TAGEX_TABLE, $inum, $this->quote_smart($itags));
- sql_query($query);
- }
- $old_tags_array = $this->getTags($oldTags);
- $new_tags_array = $this->getTags($itags);
- $deleteTags = $this->array_minus_array($old_tags_array, $new_tags_array);
- for ($i=0; $i < count($deleteTags); $i++) {
- $this->deleteTags($deleteTags[$i], $inum);
- }
- $addTags = $this->array_minus_array($new_tags_array, $old_tags_array);
- for ($i=0; $i < count($addTags); $i++) {
- $this->mergeTags($addTags[$i], $inum);
- }
-
- }
-
- function event_PreDeleteItem($data)
- {
-// Delete tags when it for deleted Item
-// or delete Itemid from TAG table
- $inum = intval($data['itemid']);
- $query = 'SELECT itags as result FROM %s WHERE inum = %d';
- $oldTags = quickQuery(sprintf($query, _TAGEX_TABLE, $inum));
- if (empty($oldTags)) {
- return;
- } else {
- $query = 'DELETE FROM %s WHERE inum = %d';
- sql_query(sprintf($query, _TAGEX_TABLE, $inum));
- $deleteTags = $this->getTags($oldTags);
- for ($i=0; $i < count($deleteTags); $i++) {
- $this->deleteTags($deleteTags[$i], $inum);
- }
- }
- }
-
-//------------------------------------------------------
-
- function getTags($str)
- {
-// extract Item's TAG for array
- $tempArray = preg_split("/[\r\n,]+/", $str);
- $returnArray = array_map('trim', $tempArray);
- return array_unique($returnArray);
- }
-
- function array_minus_array($a, $b)
- {
-// update Item's TAGs
- $c = array_diff($a,$b);
- $c = array_intersect($c, $a);
- return array_values($c);
- }
-
- function deleteTags($tag, $inum)
- {
-// Delete TAGs and TAG's Item
- $inum = intval($inum);
- $tag = $this->quote_smart($tag);
- $f_query = "SELECT inums FROM " . _TAGEX_KLIST_TABLE
- . " WHERE tag = " . $tag
- . ' AND inums REGEXP "(^|,)' . $inum . '(,|$)"'
- . ' ORDER BY ireg DESC';
- $findres = sql_query($f_query);
- if (mysql_num_rows($findres) == 0) {
- return;
- }
- $temp_inums = mysql_result($findres, 0, 0);
- if ($temp_inums == $inum) {
- $query = 'DELETE FROM %s WHERE tag = %s';
- sql_query(sprintf($query, _TAGEX_KLIST_TABLE, $tag));
- return;
- }
- $inums_array = array();
- $inums_array = explode(',', $temp_inums);
- $trans = array_flip($inums_array);
- unset($trans[$inum]);
- $inums_array = array_flip($trans);
- $inums_count = count($inums_array);
-// $inums = @implode(",", $inums_array);
- $inums = implode(",", $inums_array);
- if (!empty($inums)) {
- $update_query = 'UPDATE %s '
- . 'SET inums = %s, '
- . 'inums_count = %d '
- . 'WHERE tag = %s';
- $iCount = intval($inums_count);
- $quoteInums = $this->quote_smart($inums);
- sql_query(sprintf($update_query, _TAGEX_KLIST_TABLE, $quoteInums, $iCount, $tag));
- }
- }
-
- function mergeTags($tag, $inum)
- {
-// Add TAG's Item
- if (empty($tag)) {
- return;
- }
-
- $inums_array = array();
-
- $inum = intval($inum);
- $tag = $this->quote_smart($tag);
- $f_query = 'SELECT inums'
- . ' FROM ' . _TAGEX_KLIST_TABLE
- . ' WHERE tag = ' . $tag
- . ' ORDER BY ireg DESC';
- $findres = sql_query($f_query);
- if (mysql_num_rows($findres) > 0) {
- $temp_inums = mysql_result($findres, 0, 0);
- $inums_array = explode(',', $temp_inums);
- if (!in_array($inum, $inums_array)) {
- $inums = $temp_inums . ',' . $inum;
- $inums_count = count($inums_array) + 1;
- }
- } else {
- $q_query = 'INSERT INTO %s '
- . '(tag, inums, inums_count) '
- . 'VALUES (%s, %d, 1)';
- sql_query(sprintf($q_query, _TAGEX_KLIST_TABLE, $tag, intval($inum)));
- }
-
- if (!empty($inums)) {
- $q_query = 'UPDATE %s SET inums = %s, inums_count = %d WHERE tag = %s';
- $iCount = intval($inums_count);
- $quoteInums = $this->quote_smart($inums);
- sql_query(sprintf($q_query, _TAGEX_KLIST_TABLE, $quoteInums, $iCount, $tag));
- }
- }
-
- function scanExistItem($narrowMode = 0, $blogid = 0)
- {
-/// Select Items when Categories or Sub-categories or Archive selected
- global $manager, $CONF, $blog, $catid, $archive;
- if (!$narrowMode) {
- return;
- }
- if ($blogid > 0) {
- $b =& $manager->getBlog($blogid);
- } elseif ($blog) {
- $b =& $blog;
- } else {
- $b =& $manager->getBlog($CONF['DefaultBlog']);
- }
- $where = '';
- if ($narrowMode > 0) {
- $where .= ' and i.iblog = ' . intval($b->getID());
- }
- if ($catid && $narrowMode > 1) {
- $catid = intval($catid);
- if ($manager->pluginInstalled('NP_MultipleCategories')) {
- $where .= ' and ((i.inumber = p.item_id'
- . ' and (p.categories REGEXP "(^|,)' . $catid . '(,|$)"'
- . ' or i.icat = ' . $catid . '))'
- . ' or (i.icat = ' . $catid
- . ' and p.item_id IS NULL))';
- $mtable = ' LEFT JOIN '
- . sql_table('plug_multiple_categories') . ' as p'
- . ' ON i.inumber = p.item_id';
- $mplugin =& $manager->getPlugin('NP_MultipleCategories');
- global $subcatid;
- if ($subcatid && method_exists($mplugin, 'getRequestName')) {
-//family
- $subcatid = intval($subcatid);
- $scatTable = sql_table('plug_multiple_categories_sub');
- $tres_query = 'SELECT * FROM %s WHERE scatid = %d';
- $tres_query = sprintf($tres_query, $scatTable, $subcatid);
- $tres = sql_query($tres_query);
- $ra = mysql_fetch_array($tres, MYSQL_ASSOC);
- if (array_key_exists('parentid', $ra)) {
- $Children = array();
- $Children = explode('/', $subcatid . $this->getChildren($subcatid));
- }
- if ($loop = count($Children) >= 2) {
- for ($i=0; $i < $loop; $i++) {
- $chidID = intval($Children[$i]);
- $temp_whr[] = ' p.subcategories REGEXP "(^|,)' . $chidID . '(,|$)" ';
- }
- $where .= ' and ( '
- . implode (' or ', $temp_whr)
- . ' )';
- } else {
- $where .= ' and p.subcategories REGEXP "(^|,)' . $subcatid . '(,|$)"';
- }
-//family end
- }
- } else {
- $where .= ' and i.icat = ' . $catid;
- }
- }
-
- if ($archive) {
- $y = $m = $d = '';
- sscanf($archive, '%d-%d-%d', $y, $m, $d);
- if ($d) {
- $timestamp_start = mktime(0, 0, 0, $m, $d, $y);
- $timestamp_end = mktime(0, 0, 0, $m, $d+1, $y);
- } elseif ($m) {
- $timestamp_start = mktime(0, 0, 0, $m, 1, $y);
- $timestamp_end = mktime(0, 0, 0, $m+1, 1, $y);
- } else {
- $timestamp_start = mktime(0, 0, 0, 1, 1, $y);
- $timestamp_end = mktime(0, 0, 0, 1, 1, $y+1);
- }
- $where .= ' and i.itime >= ' . mysqldate($timestamp_start)
- . ' and i.itime < ' . mysqldate($timestamp_end);
- } else {
- $where .= ' and i.itime <= ' . mysqldate($b->getCorrectTime());
- }
-
- $iquery = 'SELECT i.inumber '
- . 'FROM %s as i'
- . $mtable
- . ' WHERE i.idraft = 0'
- . $where;
- $res = sql_query(sprintf($iquery, sql_table('item')));
- while ($row = mysql_fetch_row($res)) {
- $existInums[] = $row[0];
- }
- return $existInums;
- }
-
-/**
- *
- * TAG list sort
- * add TAG's order and Random sort
- * written by shizuki
- * From http://blog.uribou.net/
- *
- */
- function sortTags($tags, $sortMode = 0)
- {
- // sortMode 0:none
- // sortMode 1:max first
- // sortMode 2:min first
- // sortMode 3:tag's order
- // sortMode 4:random
- $sortMode = intval($sortMode);
- if (!$tags || $sortMode == 0) {
- return $tags;
- }
- foreach ($tags as $tag => $inums) {
- $tagCount[$tag] = count($inums);
- }
- switch ($sortMode) {
- case 1:
- arsort($tagCount);
- break;
- case 2:
- asort($tagCount);
- break;
- case 3:
- uksort($tagCount, array(&$this, 'sortTagOrder'));
- break;
- case 4:
- srand ((float) microtime() * 10000000);
- $tmp_key = array_rand($tagCount, count($tagCount));
- unset($tagCount);
- $tagCount = array();
- foreach ($tmp_key as $k => $v) {
- $tagCount[$v] = 0;
- }
- break;
- default:
- break;
- }
- foreach ($tagCount as $k => $v) {
- $r[$k] = $tags[$k];
- }
- return $r;
- }
-
- function sortTagOrder($a, $b)
- {
- return strcasecmp($a, $b);
- }
-
- function scanExistTags($narrowMode = 0, $amount = 99999999, $sortmode = 0, $blogid = 0)
- {
-// Select TAG's Item
- // $narrowMode = 0: all blogs
- // $narrowMode = 1: currentblog only
- // $narrowMode = 2: narrowed with catid/subcatid
- $narrowMode = intval($narrowMode);
- $amount = intval($amount);
- $sortmode = intval($sortmode);
-// <mod by shizuki />
- if (is_numeric($blogid)) {
- $blogid = intval($blogid);
- } else {
- $blogid = intval(getBlogIDFromName($blogid));
- }
- $existInums = array();
- $existInums = $this->scanExistItem($narrowMode, $blogid);
- $res = sql_query(sprintf('SELECT * FROM %s', _TAGEX_KLIST_TABLE));
- while ($o = mysql_fetch_object($res)) {
- $tagsk[$o->tag] = explode(',', $o->inums);
- if ($existInums) {
- $tagsk[$o->tag] = array_intersect($tagsk[$o->tag], $existInums);
- $tagsk[$o->tag] = array_values($tagsk[$o->tag]);
- }
- if (empty($tagsk[$o->tag])) {
- unset($tagsk[$o->tag]);
- }
- }
- $tagsk = $this->sortTags($tagsk, $sortmode);
- if (count($tagsk) > $amount) {
- $tagsk = array_slice($tagsk, 0, $amount);
- }
- return $tagsk;
- }
-
- function scanCount($tags)
- {
-// ? count TAGs have Item ?
- $max = $min = 1;
- foreach ($tags as $tag) {
- $tempCount = count($tag);
- $max = max($max, $tempCount);
- $min = min($min, $tempCount);
- }
- return array($max, $min);
- }
-
- function getNoDecodeQuery($q)
- {
-// Get urlencoded TAGs
- global $CONF, $manager;
-// FancyURL
- if ($CONF['URLMode'] == 'pathinfo') {
- $urlq = serverVar('REQUEST_URI');
- $tempq = explode($q . '/', $urlq, 2);
- if ($manager->pluginInstalled('NP_MagicalURL2') || $manager->pluginInstalled('NP_Magical')) {
- $tempq = explode($q . '_', $urlq, 2);
- }
-// if ($tempq[1]) {
- if (!empty($tempq[1])) {
- $tagq = explode('/', $tempq[1]);
- if ($manager->pluginInstalled('NP_MagicalURL2') || $manager->pluginInstalled('NP_Magical')) {
- $tagq = explode('_', $tempq[1]);
- }
- $str = preg_replace('|[^a-z0-9-~+_.#;,:@%]|i', '', $tagq[0]);
- return $str;
- }
- } else {
-// NormalURL
- $urlq = serverVar('QUERY_STRING');
- $urlq = str_replace('?', '', $urlq);
- $urlq = explode('&', $urlq);
- $qCnt = count($urlq);
- for ($i=0; $i<$qCnt; $i++) {
- $tempq = explode('=', $urlq[$i]);
- if ($tempq[0] == $q) {
- $str = preg_replace('|[^a-z0-9-~+_.#;,:@%]|i', '', $tempq[1]);
- return $str;
- }
- }
- }
- return FALSE;
- }
-
- function splitRequestTags($q)
- {
-// extract TAGs to array
- if (!strpos($q, '+') && !strpos($q, ':')) {
- $res['and'][0] = $q;
- return $res;
- }
- $res = array(
- 'and' => array(),
- 'or' => array(),
- );
- $tempAnd = explode('+', $q);
- $andCnt = count($tempAnd);
- for ($i=0; $i < $andCnt; $i++) {
- $temp = explode(':', $tempAnd[$i]);
- $res['and'][] = array_shift($temp);
- if ($temp != array()) {
- $res['or'] = array_merge($res['or'], $temp);
- }
- }
- return $res;
- }
-
- function doIf($key, $value)
- {
- if ($key != 'tag') {
- return false;
- }
- $reqTags = $this->getNoDecodeQuery('tag');
- if (!empty($reqTags)) {
- $reqTagsArr = $this->splitRequestTags($reqTags);
- $reqAND = array_map(array(&$this, "_rawdecode"), $reqTagsArr['and']);
- if ($requestTarray['or']) {
- $reqOR = array_map(array(&$this, "_rawdecode"), $reqTagsArr['or']);
- }
- } else {
- return false;
- }
- if (empty($value)) {
- return true;
- } else {
- $tagsArray = ($reqOR) ? array_merge($reqAND, $reqOR) : $reqAND;
- return in_array($value, $tagsArray);
- }
- }
-
- function doSkinVar($skinType, $type='list20/1/0/1/4')
- {
- // type[0]: type ( + amount (int))
- // type[1]: $narrowMode (0/1/2)
- // type[2]: sortMode (1/2/3/4)
- // type[3]: Minimum font-sizem(em) 0.5/1/1.5/2...
- // type[4]: Maximum font-sizem(em)
-// default
- if (empty($type)) {
- $type = 'list20/2/1/1/4';
- }
- $type = explode('/', $type);
- if (eregi('list', $type[0])) {
- $amount = eregi_replace("list", "", $type[0]);
- $type[0] = 'list';
-// keywords="TAG"
- } elseif (eregi('meta', $type[0])) {
- $amount = eregi_replace("meta", "", $type[0]);
- $type[0] = 'meta';
- }
-// default amount
- $amount = (!empty($amount)) ? intval($amount): 99999999;
-
- $defaultType = array('list', '1', '0', '1', '4');
- $type = $type + $defaultType;
- $requestT = $this->getNoDecodeQuery('tag');
- if (!empty($requestT)) {
- $requestTarray = $this->splitRequestTags($requestT);
- $reqAND = array_map(array(&$this, "_rawdecode"), $requestTarray['and']);
- if ($requestTarray['or']) {
- $reqOR = array_map(array(&$this, "_rawdecode"), $requestTarray['or']);
- }
- }
- switch($type[0]){
-
- case 'tag':
- if ($requestTarray) {
- $reqAndLink = array();
- foreach ($reqAND as $val) {
- $reqAndLink[] = '<a href="'
- . $this->creatTagLink($val)
- . '" title="' . $val . '">'
- . $val . '</a>';
- }
- $reqANDp = implode('" + "', $reqAndLink);
- if ($reqOR) {
- $reqOrLink = array();
- foreach ($reqOR as $val) {
- $reqOrLink[] = '<a href="'
- . $this->creatTagLink($val)
- . '" title="' . $val . '">'
- . $val . '</a>';
- }
- $reqORp = '"</u> or <u>"'
- . implode('"</u> or <u>"', $reqOrLink);
- }
- echo '<h1> Tag for <u>"' . $reqANDp . $reqORp . '"</u></h1>';
- }
- break;
-
-// meta keywords="TAG"
-// and AWS keywords
- case 'meta':
- global $manager, $itemid;
- $itemid = intval($itemid);
- if ($type[3] != 'ad') {
- echo '<meta name="keywords" content="';
- $sep = ' ';
- } elseif ($type[3] == 'ad') {
- $sep = ' ';
- }
- if ($skinType == 'item') {
- $q = 'SELECT * FROM %s WHERE inum = %d';
- $res = sql_query(sprintf($q, _TAGEX_TABLE, $itemid));
- while ($o = mysql_fetch_object($res)) {
- $temp_tags_array = preg_split("/[\n,]+/", trim($o->itags));
- $temp_tags_count = count($temp_tags_array);
- for ($i=0; $i < $temp_tags_count; $i++) {
- $tag = trim($temp_tags_array[$i]);
- $taglist[$i] = htmlspecialchars($tag, ENT_QUOTES, _CHARSET);
- }
- }
- if ($taglist)
- echo implode(' ', $taglist);
- } else {
- if ($tags = $this->scanExistTags(intval($type[1]), $amount, intval($type[2]))) {
- $eachTag = array();
- $t = 0;
- foreach ($tags as $tag => $inums) {
- $eachTag[$t] = htmlspecialchars($tag, ENT_QUOTES, _CHARSET);
- $t++;
- }
- if ($type[3] != 'ad') {
- echo implode($sep, $eachTag);
- } elseif ($type[3] == 'ad') {
- $tag_str = implode($sep, $eachTag);
- }
- }
- }
- if ($type[3] != 'ad') {
- echo '" />';
- } elseif ($type[3] == 'ad') {
-// $tag_str = mb_convert_encoding($tag_str, 'UTF-8', 'UTF-8');
- $tag_str = urlencode($tag_str);
- echo $tag_str;
- }
- break;
-// TAG list(tag cloud)
- case 'list':
- $template['and'] = $this->getOption('and');
- $template['or'] = $this->getOption('or');
- $template['tagIndex'] = $this->getOption('tagIndex');
- $template['tagItemHeader'] = $this->getOption('tagItemHeader');
- $template['tagItem'] = $this->getOption('tagItem');
- $template['tagItemSeparator'] = $this->getOption('tagItemSeparator');
- $template['tagItemFooter'] = $this->getOption('tagItemFooter');
- $template['tagIndexSeparator'] = $this->getOption('tagIndexSeparator');
- if ($tags = $this->scanExistTags($type[1])) {
- if ($type[3] != $type[4]) {
- $minFontSize = min((float)$type[3], (float)$type[4]) - 0.5;
- $maxFontSize = max((float)$type[3], (float)$type[4]);
- $levelsum = ($maxFontSize - $minFontSize) / 0.5;
- list($maxCount, $minCount) = $this->scanCount($tags);
- $eachCount = ceil(($maxCount - $minCount) / $levelsum);
- }
- $select = array();
- if ($reqAND) {
- $req = ($reqOR) ? array_merge($reqAND, $reqOR) : $reqAND;
- foreach ($req as $tag) {
- if (array_key_exists($tag, $tags)) {
- $select = array_merge($select, $tags[$tag]);
- $selected = array_unique($select);
- }
- }
- }
- foreach ($tags as $tag => $inums) {
- if ($selected) {
- if (!in_array($tag, $req)) {
-// shiborikomi
-// if (!in_array($tag, $req) && !array_diff($tags[$tag], $selected)) {
- $tagCount[$tag] = count($inums);
- }
- } else {
- $tagCount[$tag] = count($inums);
- }
- }
- if ($tagCount) {
- arsort($tagCount);
- foreach ($tagCount as $k => $v) {
- $r[$k] = $tags[$k];
- }
- unset($tags);
- if (count($r) > $amount) {
- $r = array_slice($r, 0, $amount);
- }
- $tags = array();
- if (count($r) == 1) {
- $tags = $r;
- } else {
- $tags = $this->sortTags($r, intval($type[2]));
- }
- } else {
- echo 'No Tags';
- return;
- }
- $eachTag = array();
- $t = 0;
- foreach ($tags as $tag => $inums) {
- $tagitems = array();
- $tagAmount = count($inums);
- if ($eachCount) {
- $fontlevel = ceil($tagAmount / $eachCount) * 0.5 + $minFontSize;
- } else {
- $fontlevel = 1;
- }
-
-/// Item's name had TAGs
- $iids = array_slice($inums, 0, 4);
- sort($iids);
- $qQuery = ' SELECT '
- . ' SUBSTRING(ititle, 1, 12) as short_title'
- . ' FROM '
- . sql_table('item')
- . ' WHERE '
- . ' inumber in (' . implode(',', $iids) . ') '
- . 'ORDER BY '
- . ' inumber';
- $sTitles = sql_query($qQuery);
- $i = 0;
- while ($sTitle = mysql_fetch_assoc($sTitles)) {
- $shortTitle = mb_convert_encoding($sTitle['short_title'], _CHARSET, _CHARSET);
- $shortTitle = htmlspecialchars($shortTitle, ENT_QUOTES, _CHARSET);
- $printData['tagItem']
- = array(
- 'itemid' => intval($iids[$i]),
- 'itemtitle' => $shortTitle . '..',
- );
- $i++;
- $tagitems[] = TEMPLATE::fill($template['tagItem'], $printData['tagItem']);
- }
- $tagitem = implode($template['tagItemSeparator'], $tagitems) . '...etc.';
-
-// Generate URL link to TAGs
- $and = $or = '';
-/*********************
- * comment out this line when nodisplay selected TAGs */
-// $req = ($reqOR) ? array_merge($reqAND, $reqOR) : $reqAND;
-/*********************/
- if ($req && !in_array($tag, $req)) {
- $printData['and'] = array(
- 'andurl' => $this->creatTagLink($tag, $type[1], $requestT, '+') //AND link
- );
- $printData['or'] = array(
- 'orurl' => $this->creatTagLink($tag, $type[1], $requestT, ':') //OR link
- );
- $and = TEMPLATE::fill($template['and'], $printData['and']); // insert URL to template
- $or = TEMPLATE::fill($template['or'], $printData['or']);
- }
-
-// insert data to template
- $printData['tagIndex'] = array(
- 'and' => $and,
- 'or' => $or,
- 'tag' => htmlspecialchars($tag, ENT_QUOTES, _CHARSET),
- 'tagamount' => $tagAmount,
- 'fontlevel' => $fontlevel,
- 'taglinkurl' => $this->creatTagLink($tag, intval($type[1])),
- 'tagitems' => $tagitem
- );
- $eachTag[$t] = TEMPLATE::fill($template['tagIndex'], $printData['tagIndex']);
-
-// format outputdata and data output
- $eachTag[$t] .= $template['tagItemHeader'];
- if (!ereg('<%tagitems%>', $template['tagIndex'])) {//<%
- $eachTag[$t] .= $tagitem;
- }
- $eachTag[$t] .= $template['tagItemFooter'];
- $t++;
- }
- echo implode($template['tagIndexSeparator'], $eachTag);
- }
- break;
-
-// show selected TAGs for <title></title>
- case 'title':
- if ($reqAND) {
- $req = ($reqOR) ? array_merge($reqAND, $reqOR) : $reqAND;
- $data = htmlspecialchars(implode('|', $req), ENT_QUOTES, _CHARSET);
- echo ' : Selected Tag(s) » "' . $data . '"';
- }
- break;
- default:
- break;
- }
-// end of switch(type)
- }
-
- function doTemplateVar(&$item, $type = '')
- {
-// <highlight selected TAGs mod by shizuki>
- $requestT = $this->getNoDecodeQuery('tag');
- if (!empty($requestT)) {
- $requestTarray = $this->splitRequestTags($requestT);
- $reqAND = array_map(array(&$this, "_rawdecode"), $requestTarray['and']);
- if($requestTarray['or']) {
- $reqOR = array_map(array(&$this, "_rawdecode"), $requestTarray['or']);
- }
- $words = ($reqOR)? array_merge($reqAND, $reqOR): $reqAND;
- } else {
- $words = array();
- }
- $iid = intval($item->itemid);
- $q = 'SELECT * FROM %s WHERE inum = %d';
- $res = sql_query(sprintf($q, _TAGEX_TABLE, $iid));
- while ($o = mysql_fetch_object($res)) {
- $temp_tags_array = preg_split("/[\n,]+/", trim($o->itags));
- $temp_tags_count = count($temp_tags_array);
- for ($i=0; $i < $temp_tags_count; $i++) {
- $tag = trim($temp_tags_array[$i]);
- $taglink = $this->creatTagLink($tag, 0);
-// highlight selected TAGs
- $key = array_search($tag, $words);
- if ($key >= 10) {
- $key = $key - 10;
- }
- if (in_array($tag, $words)) {
- $taglist[$i] = '<a href="'
- . $this->creatTagLink($tag, 0)
- . '" class="highlight_0" rel="tag">'
- . htmlspecialchars($tag, ENT_QUOTES, _CHARSET) . '</a>';
- } else {
- $taglist[$i] = '<a href="'
- . $this->creatTagLink($tag, 0)
- . '" rel="tag">'
- . htmlspecialchars($tag, ENT_QUOTES, _CHARSET) . '</a>';
- }
- }
- }
- if ($taglist) {
-// echo 'Tag: ' . implode(' / ', $taglist);
- echo implode(' / ', $taglist);
- }
- }
-
- function _rawencode($str)
- {
-
- if (_CHERSET != 'UTF-8') {
- $str = mb_convert_encoding($str, "UTF-8", _CHARSET);
- }
- $str = rawurlencode($str);
- $str = preg_replace('|[^a-z0-9-~+_.?#=&;,/:@%]|i', '', $str);
- return $str;
- }
-
- function _rawdecode($str)
- {
- $str = rawurldecode($str);
- if (_CHERSET != 'UTF-8') {
- $str = mb_convert_encoding($str, _CHARSET, "UTF-8");
- }
- $str = htmlspecialchars($str);
- return $str;
- }
-
- function getChildren($subcat_id)
- {
- $subcat_id = intval($subcat_id);
- $que = 'SELECT'
- . ' scatid,'
- . ' parentid,'
- . ' sname '
- . 'FROM'
- . ' %s '
- . 'WHERE'
- . ' parentid = %d';
- $mcatTable = sql_table('plug_multiple_categories_sub');
- $que = sprintf($que, $mcatTable, $subcat_id);
- $res = sql_query($que);
- while ($so = mysql_fetch_object($res)) {
- $r .= $this->getChildren($so->scatid)
- . '/'
- . $so->scatid;
- }
- return $r;
- }
-
- function creatTagLink($tag, $narrowMode = 0, $ready = '', $sep = '')
- {
- global $manager, $CONF, $blogid, $catid; //, $subcatid;
- $linkparams = array();
- if (is_numeric($blogid)) {
- $blogid = intval($blogid);
- } else {
- $blogid = intval(getBlogIDFromName($blogid));
- }
- if (!$blogid) {
- $blogid = $CONF['DefaultBlog'];
- }
- $b =& $manager->getBlog($blogid);
- if ($narrowMode == 2) {
- if ($catid) {
- $linkparams['catid'] = intval($catid);
- }
- if ($manager->pluginInstalled('NP_MultipleCategories')) {
- $mcategories =& $manager->getPlugin('NP_MultipleCategories');
- if (method_exists($mcategories, 'getRequestName')) {
- $subrequest = $mcategories->getRequestName();
- } else {
- $subrequest = 'subcatid';
- }
- $mcategories->event_PreSkinParse(array());
- global $subcatid;
- if ($subcatid) {
- $linkparams[$subrequest] = intval($subcatid);
- }
- }
- }
-
- if (!empty($ready)) {
- $requestTagsArray = $this->splitRequestTags($ready);
- foreach ($requestTagsArray['and'] as $key => $val) {
- if (!$this->_isValidTag($val)) {
- $trush = array_splice($requestTagsArray['and'], $key, 1);
- }
- }
- $reqAnd = implode('+', $requestTagsArray['and']);
- if (!empty($requestTagsArray['or'])) {
- foreach ($requestTagsArray['or'] as $key => $val) {
- if (!$this->_isValidTag($val)) {
- $trush = array_splice($requestTagsArray['and'], $key, 1);
- }
- }
- $reqOr = ':' . implode(':', $requestTagsArray['or']);
- }
- $ready = $reqAnd . $reqOr;
- }
-
- if (!$ready) {
- $sep = '';
- }
-// <mod by shizuki>
-/*// <Original URL Generate code>
-// if ($CONF['URLMode'] == 'pathinfo')
-// $link = $CONF['IndexURL'] . '/tag/' . $ready . $sep . $this->_rawencode($tag);
-// else
-// $link = $CONF['IndexURL'] . '?tag=' . $ready . $sep . $this->_rawencode($tag);
- $link = $b->getURL();
- if (substr($link, -1) != '/') {
- if (substr($link, -4) != '.php') {
- $link .= '/';
- }
- }
- if ($CONF['URLMode'] == 'pathinfo') {
- $link .= 'tag/' . $ready . $sep . $this->_rawencode($tag);
- } else {
- $link .= '?tag=' . $ready . $sep . $this->_rawencode($tag);
- }
-// </ Original URL Generate code> */
-
-/*// <test code>
- $CONF['BlogURL'] = $b->getURL();
- $linkparams['tag'] = $ready . $sep . $this->_rawencode($tag);
- $uri = createBlogidLink($blogid, $linkparams);
- if (strstr ($uri, '//')) {
- $uri = preg_replace("/([^:])\/\//", "$1/", $uri);
- }
- return $uri;
-// </test code>*/
-
-// </mod by shizuki>*/
-
-// <mod by shizuki>
-// if ($manager->pluginInstalled('NP_CustomURL')) {
- $linkparams['tag'] = $ready . $sep . $this->_rawencode($tag);
- $uri = createBlogidLink($blogid, $linkparams);
- if (strstr ($uri, '//')) {
- $uri = preg_replace("/([^:])\/\//", "$1/", $uri);
- }
- return $uri;
-/* } elseif ($manager->pluginInstalled('NP_MagicalURL2') || $manager->pluginInstalled('NP_Magical')) {
- $uri = createBlogidLink($blogid, $linkparams);
- if (strstr ($uri, '//')) {
- $uri = preg_replace("/([^:])\/\//", "$1/", $uri);
- }
- $uri = substr($uri, 0, -5) . '_tag' . $ready . $sep . $this->_rawencode($tag);
- return $uri;
- }
-// </mod by shizuki>*/
-
-// return addLinkParams($link, $linkparams);
- }
-
-/**
- * function Tag valid
- * add by shizuki
- */
- function _isValidTag($encodedTag)
- {
- $encodedTag = rawurldecode($encodedTag);
- if (_CHERSET != 'UTF-8') {
- $str = mb_convert_encoding($encodedTag, _CHARSET, "UTF-8");
- }
- $str = $this->quote_smart($str);
- $q = 'SELECT listid as result FROM %s WHERE tag = %s';
- $Vali = quickQuery(sprintf($q, _TAGEX_KLIST_TABLE, $str));
- if (!empty($Vali)) {
- return TRUE;
- } else {
- return FALSE;
- }
- }
-
-}
+++ /dev/null
-.highlight_0 {
- color: #000;
- background-color: rgb(255, 255, 102);
- line-height : 1.2em;
- font-size : 1.1em;
- font-style : italic;
- font-weight : bold;
-}
-
-.highlight_1 {
- color: #000;
- background-color: rgb(160, 255, 255);
- line-height : 1.2em;
- font-size : 1.1em;
- font-style : italic;
- font-weight : bold;
-}
-
-.highlight_2 {
- color: #000;
- background-color: rgb(153, 255, 153);
- line-height : 1.2em;
- font-size : 1.1em;
- font-style : italic;
- font-weight : bold;
-}
-
-.highlight_3 {
- color: #000;
- background-color: rgb(255, 153, 153);
- line-height : 1.2em;
- font-size : 1.1em;
- font-style : italic;
- font-weight : bold;
-}
-
-.highlight_4 {
- color: #000;
- background-color: rgb(255, 102, 255);
- line-height : 1.2em;
- font-size : 1.1em;
- font-style : italic;
- font-weight : bold;
-}
-
-.highlight_5 {
- color: #fff;
- background-color: rgb(136, 0, 0);
- line-height : 1.2em;
- font-size : 1.1em;
- font-style : italic;
- font-weight : bold;
-}
-
-.highlight_6 {
- color: #fff;
- background-color: rgb(0, 170, 0);
- line-height : 1.2em;
- font-size : 1.1em;
- font-style : italic;
- font-weight : bold;
-}
-
-.highlight_7 {
- color: #fff;
- background-color: rgb(136, 104, 0);
- line-height : 1.2em;
- font-size : 1.1em;
- font-style : italic;
- font-weight : bold;
-}
-
-.highlight_8 {
- color: #fff;
- background-color: rgb(0, 70, 153);
- line-height : 1.2em;
- font-size : 1.1em;
- font-style : italic;
- font-weight : bold;
-}
-
-.highlight_9 {
- color: #fff;
- background-color: rgb(153, 0, 153);
- line-height : 1.2em;
- font-size : 1.1em;
- font-style : italic;
- font-weight : bold;
-}
+++ /dev/null
-<?php
-class NP_tDiarySkin extends NucleusPlugin
-{
- function getName()
- {
- return 'tDiarySkin specified';
- }
-
- function getAuthor()
- {
- return 'shizuki';
- }
-
- function getURL()
- {
- return 'http://shizuki.kinezumi.net/NusleusCMS/Skins/tDiary.html';
- }
-
- function getVersion()
- {
- return '1.0';
- }
-
- function getDescription()
- {
- $deac = 'tDiarySkin 表示用プラグイン<br />';
- return $deac;
- }
-
- function supportsFeature($what)
- {
- switch($what) {
- case 'SqlTablePrefix':
- return 1;
- default:
- return 0;
- }
- }
-
- function getEventList()
- {
- return array('InitSkinParse');
- }
-
- function install()
- {
- $this->createOption('monthlimit', 'カテゴリ一覧で表示する期間(初期値)',
- 'select', '2', '一月|1|四半期|2|半年|3|1年|4');
- }
-
- function _dataCleaning($data)
- {
- $y = $m = $d = '';
- sscanf($data, '%d-%d-%d', $y, $m, $d);
- if (!empty($d)) {
- $data = sprintf('%04d-%02d-%02d', $y, $m, $d);
- } elseif (!empty($m)) {
- $data = sprintf('%04d-%02d', $y, $m);
- } else {
- $data = sprintf('%04d', $y);
- }
- return $data;
- }
-
- function _createDiaryLink($linkDate, $blogid)
- {
- sscanf($linkDate, '%d-%d-%d', $y, $m, $d);
- $linkDate = sprintf('%02d-%02d', $m, $d);
- $link = createBlogidLink(intval($blogid), array('tdiarydate' => $linkDate));
- return $link;
- }
-
- function _createItemLinkByDate($itemdate, $mtable = '')
- {
- $inumber = 'SELECT min(i.inumber) as result'
- . ' FROM ' . sql_table('item') . ' as i'
- . $mtable
- . ' WHERE i.idraft = 0'
- . $this->getDateQuery($itemdate)
- . ' ORDER BY SUBSTRING(i.itime, 1, 10) DESC,'
- . ' i.itime DESC';
- $itemID = intval(quickQuery($inumber));
- $data = array('link' => createItemLink($itemID),
- 'id' => $itemID);
- return $data;
- }
-
- function _createCategoryIDLink($catid, $skinType, $subrequest = '')
- {
- global $archive;
- if (!empty($archive)) {
- $archive = $this->_dataCleaning($archive);
- }
- if (intGetVar('monthlimit') > 1) {
- $linkParams['monthlimit'] = intGetVar('monthlimit');
- }
-// $linkParams['catid'] = $catid;
- if ($subrequest) {
- $temp = explode('/', $subrequest);
- $linkParams[$temp[0]] = intval($temp[1]);
- }
- if ($skinType == 'archive') {
- $linkParams['archive'] = $archive;
- $catlink = createCategoryLink($catid, $linkParams);
-// $catlink = createArchiveLink($this->nowbid, $archive, $linkParams);
- } elseif ($skinType == 'archivelist') {
- $linkParams['archives'] = $this->nowbid;
- $catlink = createCategoryLink($catid, $linkParams);
-// $catlink = createArchiveListLink($this->nowbid, $linkParams);
- } else {
- if ($subrequest) {
- $catlink = createCategoryLink($catid, array($temp[0] => $temp[1]));
- } else {
- $catlink = createCategoryLink($catid);
- }
- }
- return $catlink;
- }
-
- function _createBasePageLink($catid, $subcatid, $archive)
- {
- global $CONF, $manager;
- $catid = intval($catid);
- $subcatid = intval($subcatid);
- $page_str = $this->pagestr;
- $usePathInfo = ($CONF['URLMode'] == 'pathinfo');
- if (!empty($archive)) {
- $archive = $this->_dataCleaning($archive);
- }
- if (!empty($catid)) {
- $linkParam['catid'] = $catid;
- if (!empty($subcatid)) {
- $mcategories =& $manager->getPlugin('NP_MultipleCategories');
- if (method_exists($mcategories, 'getRequestName')) {
- $subrequest = $mcategories->getRequestName();
- } else {
- $subrequest = 'subcatid';
- }
- $linkParam[$subrequest] = $subcatid;
- }
- if (!empty($archive)) {
- $pagelink = createArchiveLink($this->nowbid, $archive, $linkParam);
- } else {
- $pagelink = createCategoryLink($catid, $linkParam);
- }
- } elseif (!empty($archive)) {
- $pagelink = createArchiveLink($this->nowbid, $archive);
- } else {
- $pagelink = createBlogidLink($this->nowbid);
- }
- $uri = parse_url($pagelink);
- if (!$usePathInfo) {
- if ($pagelink == $CONF['BlogURL']) {
- $pSeparator = '?';
- } elseif ($uri['query']) {
- $pSeparator = '&';
- }
- $pagelink = str_replace('&&', '&', $pagelink);
- } elseif ($usePathInfo && substr($pagelink, -1) != '/') {
- if ($uri['query']) {
- $pSeparator = '&';
- $page_str = 'page=';
- } else {
- $pagelink .= '/';
- $pSeparator = '';
- }
- }
- if (strstr ($pagelink, '//')) {
- $pagelink = preg_replace("/([^:])\/\//", "$1/", $pagelink);
- }
- return array('pagelink' => $pagelink,
- 'separator' => $pSeparator,
- 'pageString' => $page_str);
- }
-
- function _createDatePageLink($datedata, $catid, $subcatid, $archive)
- {
- $y = $m = $d = '';
- sscanf($datedata, '%d-%d-%d', $y, $m, $d);
- if (!empty($d)) {
- $datedata = sprintf('%04d%02d%02d', $y, $m, $d);
- } else {
- $datedata = sprintf('%04d%02d', $y, $m);
- }
- if (!empty($archive)) {
- $archive = $this->_dataCleaning($archive);
- }
- $pLink = $this->_createBasePageLink($catid, $subcatid, $archive);
- $pagelink = $pLink['pagelink'];
- $pSeparator = $pLink['separator'];
- $pagestr = $pLink['pageString'];
- $this->pagestr = $pagestr;
- return $pagelink . $pSeparator . $pagestr . $datedata;
- }
-
- function _createArchivePageLink($linkdate, $catid = 0)
- {
- if ($catid) {
- $linkParams['catid'] = intval($catid);
- }
- if (intGetVar('categorylist') > 0) {
- $linkParams['categorylist'] = intGetVar('categorylist');
- }
- if (intGetVar('monthlimit') > 1) {
- $linkParams['monthlimit'] = intGetVar('monthlimit');
- }
- return createArchiveLink($this->nowbid, $linkdate, $linkParams);
- }
-
- function _createPageSwitch($where, $mtable = '', $amount, $skinType = 'index', $b)
- {
- global $CONF, $manager, $itemid, $catid, $subcatid;
- global $archive, $archiveprev, $archivenext;
-// initialize
- $nextstr = $prevstr = '';
- $query = 'SELECT SUBSTRING(i.itime, 1, 10) as Date'
- . ' FROM ' . sql_table('item') . ' as i' . $mtable
- . ' WHERE i.idraft = 0';
- if (!empty($archive)) {
- $monthlimit = (intGetVar('monthlimit') > 0) ? intGetVar('monthlimit') : 1;
- if ($monthlimit > 1) {
- sscanf($archive, '%d-%d-%d', $y, $m, $d);
- $prevmonth = mktime(0, 0, 0, $m-intGetVar('monthlimit'), 1, $y);
- $prevarchive = strftime('%Y-%m', $prevmonth);
- $nextmonth = mktime(0, 0, 0, $m+intGetVar('monthlimit'), 1, $y);
- $nextarchive = strftime('%Y-%m', $nextmonth);
- } else {
- $prevarchive = $archiveprev;
- $nextarchive = $archivenext;
- }
- $prevarchive = substr($prevarchive, 0, strlen($archive));
- $nextarchive = substr($nextarchive, 0, strlen($archive));
- $nextArcQ = $query . $this->getDateQuery($nextarchive, $monthlimit);
- $nextManth = mysql_num_rows(sql_query($nextArcQ));
- $prevArcQ = $query . $this->getDateQuery($prevarchive, $monthlimit);
- $prevManth = mysql_num_rows(sql_query($prevArcQ));
- }
- $startpos = 0;
- $pLink = $this->_createBasePageLink($catid, $subcatid, $archive);
- $pagelink = $pLink['pagelink'];
-
- $dresq = $query . $where
- . ' GROUP BY Date'
- . ' ORDER BY i.itime DESC';
- $res = sql_query($dresq);
- while ($dres = mysql_fetch_row($res)) {
- $daylist[] = $dres[0];
- }
- $currentpage = 0;
- $totalamount = 0;
- if (!empty($itemid)) {
- $dateq = $query
- . ' AND i.inumber = ' . intval($itemid);
- $temp = sql_query($dateq);
- $itemdate = mysql_fetch_object($temp);
- $this->currPage = $itemdate->Date;
- }
- if (isset($daylist)) {
- $temp = array_search($this->currPage, $daylist);
- $totalamount = count($daylist);
- if (!empty($temp)) {
- $currentpage = $temp / $amount;
- } elseif ($skinType == 'item' && $temp !== FALSE) {
- $currentpage = $temp;
- }
- }
- $startpos = ($currentpage > 0) ? $currentpage * $amount : 0;
- $totalamount = intval($totalamount);
- $totalpages = ceil($totalamount / $amount);
- if ($startpos > $totalamount) {
- $currentpage = $totalpages;
- $startpos = $totalamount - $amount;
- }
- $nextpos = $startpos - $amount;
- $prevpos = $startpos + $amount;
- $nextpage = $currentpage - 1;
- $prevpage = $currentpage + 1;
-
- $buf .= '<div class="adminmenu">' . "\n";
- if (($totalpages >= $prevpage || $prevManth > 0) && $skinType != 'archivelist') {
- if ($skinType == 'item') {
- $templink = $this->_createItemLinkByDate($daylist[$prevpos], $mtable);
- $prevlink = $templink['link'];
- $prevstr = '前日の日記';
- } elseif ($skinType == 'archive' && !$catid && !intGetVar('categorylist')) {
- $prevlink = $this->_createArchivePageLink($prevarchive, $catid);
- if ($monthlimit > 1) {
- $prevstr = $this->getArchivePageString($prevarchive, $monthlimit);
- } elseif (strlen($archive) == 4) {
- $nextstr = '前の年';
- } else {
- $prevstr = '前の月';
- }
- } elseif ($skinType == 'index') {
- $prevlink = $this->_createDatePageLink($daylist[$prevpos], $catid, $subcatid, $archive);
- $prevstr = '前'. $amount . '日分';
- if ($this->pagestr == 'page_') {
- $prevlink .= '.html';
- }
- }
- if (!empty($prevstr)) {
- $buf .= '<span class="adminmenu">'
- . '<a href="' . $prevlink . '" title="Previous page" rel="Prev">'
- . '«' . $prevstr
- . '</a></span>' . "\n";
- }
- }
- $buf .= '<span class="adminmenu">'
- . ' <a href="'
- . createBlogidLink($this->nowbid)
- . '" title="new" rel="Start">最新</a></span>'
- . "\n";
- if (($nextpage >= 0 || $nextManth > 0) && $skinType != 'archivelist') {
- if ($skinType == 'item') {
- $templink = $this->_createItemLinkByDate($daylist[$nextpage], $mtable);
- $nextlink = $templink['link'];
- $nextstr = '翌日の日記';
- } elseif ($skinType == 'archive' && !$catid && !intGetVar('categorylist')) {
- $nextlink = $this->_createArchivePageLink($nextarchive, $catid);
- if ($monthlimit > 1) {
- $nextstr = $this->getArchivePageString($nextarchive, $monthlimit);
- } elseif (strlen($archive) == 4) {
- $nextstr = '次の年';
- } else {
- $nextstr = '次の月';
- }
- } elseif ($skinType == 'index') {
- $nextlink = $this->_createDatePageLink($daylist[$nextpos], $catid, $subcatid, $archive);
- $nextstr = '次'. $amount . '日分';
- if ($this->pagestr == 'page_') {
- $nextlink .= '.html';
- }
- }
- if (!empty($nextstr)) {
- $buf .= '<span class="adminmenu">'
- . '<a href="' . $nextlink . '" title="Next page" rel="Next">'
- . $nextstr . '»</a>'
- . '</span>'
- . "\n";
- }
- }
- $buf .= "</div>\n";
-
- $catlist = ($skinType == 'archive' && ($catid || intGetVar('categorylist')));
- if ($skinType == 'archivelist' || $catlist) {
- $catID = ($catid) ? $catid : 0;
- $idData = array('catid' => $catID,
- 'bid' => $this->nowbid);
- $datearr = array('pdate' => $prevarchive,
- 'ndate' => $nextarchive,
- 'pmonth' => $prevManth,
- 'nmonth' => $nextManth);
- if ($skinType == 'archive') {
- $datearr['cdate'] = $archive;
- } else {
- $datearr['cdate'] = substr(mysqldate($b->getCorrectTime()), 1, 7);
- }
- $buf .= $this->generateArchivePageSwitch($skinType, $mtable, $datearr, $idData);
- }
-
- $pageParams = array('pageLink' => $buf,
- 'startpos' => intval($startpos),
- 'daysList' => $daylist);
- return $pageParams;
- }
-
- function getArchivePageString($datedata, $limit)
- {
- sscanf($datedata, '%d-%d-%d', $y, $m, $d);
- if ($limit == 6) {
- if ($m == 1) {
- $buf = $y . '年の上半期';
- } else {
- $buf = $y . '年の下半期';
- }
- } elseif ($limit == 3) {
- if ($m == 1) {
- $buf = $y . '年の第一四半期';
- } elseif ($m == 4) {
- $buf = $y . '年の第二四半期';
- } elseif ($m == 7) {
- $buf = $y . '年の第三四半期';
- } else {
- $buf = $y . '年の第四四半期';
- }
- }
- return $buf;
- }
-
- function generateArchivePageSwitch($skinType, $mtable, $datearr, $id)
- {
-// initialize
- $catID = $id['catid'];
- $bid = $id['bid'];
- $cdate = $datearr['cdate'];
- $prevarchive = $datearr['pdate'];
- $nextarchive = $datearr['ndate'];
- $prevManth = $datearr['pmonth'];
- $nextManth = $datearr['nmonth'];
- $monthlimit = (intGetVar('monthlimit') > 0) ? intGetVar('monthlimit') : 1;
- $data = '<div class="adminmenu">' . "\n"
- . "<p>\n";
- if ($skinType == 'archive') {
- if ($catID > 0) {
- $param['catid'] = $catID;
- }
- if ($prevManth > 0) {
- $prevlink = $this->_createArchivePageLink($prevarchive, $catID);
- if ($monthlimit > 1) {
- $prevstr = $this->getArchivePageString($prevarchive, $monthlimit);
- } elseif (strlen($cdate) == 4) {
- $prevstr = '前の年';
- } else {
- $prevstr = '前の月';
- }
- $data .= '<span class="adminmenu">'
- . '<a href="' . $prevlink . '" title="Previous page" rel="Prev">'
- . '«' . $prevstr
- . '</a></span>' . "\n";
- }
- if ($nextManth > 0) {
- $nextlink = $this->_createArchivePageLink($nextarchive, $catID);
- if ($monthlimit > 1) {
- $nextstr = $this->getArchivePageString($nextarchive, $monthlimit);
- } elseif (strlen($cdate) == 4) {
- $nextstr = '次の年';
- } else {
- $nextstr = '次の月';
- }
- $data .= '<span class="adminmenu">'
- . '<a href="' . $nextlink . '" title="Next page" rel="Next">'
- . $nextstr . '»</a>'
- . '</span>'
- . "\n";
- }
- unset($param);
- }
- if ($skinType == 'archive') {
- if ($catID > 0) {
- $param['catid'] = $catID;
- }
- $data .= '<span class="adminmenu"><a href="'
- . createArchiveListLink($bid, $param)
- . '">全期間</a></span>' . "\n"
- . '<span class="adminmenu"><a href="'
- . createArchiveListLink($bid)
- . '">全期間/全カテゴリ</a></span>' . "\n";
- unset($param);
- } elseif ($skinType == 'archivelist') {
- if ($catID > 0) {
- $param['catid'] = $catID;
- }
- $param['categorylist'] = 1;
- $data .= '<span class="adminmenu"><a href="'
- . createArchiveLink($bid, substr($cdate, 0, 4), $param)
- . '">年</a></span>' . "\n";
- $param['monthlimit'] = 6;
- $data .= '<span class="adminmenu"><a href="'
- . createArchiveLink($bid, $cdate, $param)
- . '">半年</a></span>' . "\n";
- $param['monthlimit'] = 3;
- $data .= '<span class="adminmenu"><a href="'
- . createArchiveLink($bid, $cdate, $param)
- . '">四半期</a></span>' . "\n";
- unset($param['monthlimit']);
- $data .= '<span class="adminmenu"><a href="'
- . createArchiveLink($bid, $cdate, $param)
- . '">月</a></span>' . "\n";
- unset($param);
- }
- if ($catID > 0) {
- $data .= '<span class="adminmenu"><a href="';
- if ($skinType == 'archive') {
- $param = array('categorylist' => 1,
- 'monthlimit' => $monthlimit);
- $data .= createArchiveLink($wbid, $cdate, $param);
- } elseif ($skinType == 'archivelist') {
- $data .= createArchiveListLink($bid);
- }
- $data .= '">全カテゴリ</a></span>' . "\n";
- unset($param);
- }
- $data .= "</p>\n</div>\n";
- return $data;
- }
-
- function _getTrackBackURL($id)
- {
- global $manager;
- $id = intval($id);
- if ($manager->pluginInstalled('NP_CustomURL')) {
- $query = 'SELECT inumber as itemid FROM %s WHERE inumber = %d';
- $query = sprintf($query, sql_table('item'), $id);
- $res = sql_query($query);
- $iData = mysql_fetch_object($res);
- $customURL =& $manager->getPlugin('NP_CustomURL');
- ob_start();
- $customURL->doTemplateVar($iData, 'trackback');
- $tbURL = ob_get_contents();
- ob_end_clean();
- } else {
- $tbPlugin =& $manager->getPlugin('NP_TrackBack');
- $tbURL = $tbPlugin->getTrackBackUrl($id);
- }
- return $tbURL;
- }
-
- function getChildren($subcat_id)
- {
- $que = 'SELECT scatid, parentid, sname FROM %s WHERE parentid = %d';
- $res = sql_query(sprintf($que, sql_table('plug_multiple_categories_sub'), intval($subcat_id)));
- while ($so = mysql_fetch_object($res)) {
- $r .= $this->getChildren(intval($so->scatid)) . '/' . intval($so->scatid);
- }
- return $r;
- }
-
- function getSearchQuery()
- {
- global $query, $blog, $CONF, $manager;
- $hlight = '';
- $exsearch = $manager->getPlugin('NP_ExtensibleSearch');
- if ($exsearch) {
- $sqlquery = $exsearch->getSqlQuery($query, $months, $hlight);
- } else {
- if ($blog) {
- $b =& $blog;
- } else {
- $b =& $manager->getBlog($CONF['DefaultBlog']);
- }
- $sqlquery = $b->getSqlQuery($query, $months, $hlight);
- }
- $retQuery = explode(' ORDER BY', $sqlquery, 2);
- return $retQuery[0];
- }
-
- function getDateQuery($datedata, $limit = '1')
- {
- $datedata = $this->_dataCleaning($datedata);
- sscanf($datedata, '%d-%d-%d', $y, $m, $d);
- if (!empty($d)) {
- $timestamp_start = mktime(0, 0, 0, $m, $d, $y );
- $timestamp_end = mktime(0, 0, 0, $m, $d+1, $y );
- } elseif (!empty($m)) {
- $timestamp_start = mktime(0, 0, 0, $m, 1, $y );
- $timestamp_end = mktime(0, 0, 0, $m+$limit, 1, $y );
- } else {
- $timestamp_start = mktime(0, 0, 0, 1, 1, $y );
- $timestamp_end = mktime(0, 0, 0, 1, 1, $y+1);
- }
- $where = ' and i.itime >= ' . mysqldate($timestamp_start)
- . ' and i.itime < ' . mysqldate($timestamp_end);
- return $where;
- }
-
- function getMulticategoriesQuery($catid, $subcatid = 0)
- {
- global $manager;
- $mwhere = '';
- $mtable = '';
- $mwhere = ' AND ((i.inumber = p.item_id'
- . ' AND (p.categories REGEXP "(^|,)' . intval($catid) . '(,|$)"'
- . ' OR i.icat = ' . intval($catid) . '))'
- . ' OR (i.icat = ' . intval($catid)
- . ' AND p.item_id IS NULL))';
- $mtable = ' LEFT JOIN ' . sql_table('plug_multiple_categories') . ' as p'
- . ' ON i.inumber = p.item_id';
- $mplugin =& $manager->getPlugin('NP_MultipleCategories');
- if (method_exists($mplugin, 'getRequestName')) {
- $mplugin->event_PreSkinParse(array());
- if ($subcatid) {
-
- $mque = 'SELECT * FROM %s WHERE scatid = %d';
- $tres = sql_query(sprintf($mque, sql_table('plug_multiple_categories_sub'), intval($subcatid)));
- $ra = mysql_fetch_array($tres, MYSQL_ASSOC);
- if (array_key_exists('parentid', $ra)) {
- $Children = array();
- $Children = explode('/', intval($subcatid) . $this->getChildren(intval($subcatid)));
- }
- if ($Children[1]) {
- for ($i=0;$i<count($Children);$i++) {
- $temp_whr[] = ' p.subcategories REGEXP "(^|,)' . intval($Children[$i]) . '(,|$)" ';
- }
- $mwhere .= ' AND ( ';
- $mwhere .= join(' OR ', $temp_whr);
- $mwhere .= ' )';
- } else {
- $mwhere .= ' AND p.subcategories REGEXP "(^|,)' . intval($subcatid) . '(,|$)"';
- }
- }
- }
- return array('mtable' => $mtable,
- 'where' => $mwhere);
- }
-
- function showComment($itemid, $itemuri, $skinType)
- {
- $q = 'SELECT COUNT(*) as result'
- . ' FROM ' . sql_table('comment') . ' as c'
- . ' WHERE c.citem = ' . intval($itemid);
- $postnum = quickQuery($q);
- if ($postnum > 5) {
- $startnum = $postnum - 5;
- } else {
- $startnum = 0;
- }
- $query = 'SELECT c.cnumber, c.cbody, c.cuser, c.cmember,'
- . ' UNIX_TIMESTAMP(c.ctime) as ctimestamp'
- . ' FROM ' . sql_table('comment') . ' as c'
- . ' WHERE c.citem = ' . intval($itemid)
- . ' ORDER BY c.ctime ASC'
- . ' LIMIT ' . intval($startnum) . ', 5';
-
- $comments = sql_query($query);
- $viewnum = mysql_num_rows($comments);
- $youbi = array('日', '月', '火', '水', '木', '金', '土');
- $commentData = '<div class="comment">' . "\n"
- . '<div class="caption">';
- if ($postnum) {
- $commentData .= '本日のツッコミ(全' . $postnum . '件)';
- }
- $commentData .= '[<a href="' . $itemuri . '#c">ツッコミを入れる</a>]</div>' . "\n";
- if ($postnum) {
- if ($skinType == 'index') {
- $commentData .= '<div class="commentshort">' . "\n";
- } else {
- $commentData .= '<div class="commentbody">' . "\n";
- }
- while ($row = mysql_fetch_object($comments)) {
- $uri = $itemuri . '#c' . $row->cnumber;
- if (!($myname = $row->cuser)) {
- $mem = new MEMBER;
- $mem->readFromID($row->cmember);
- $myname = $mem->getRealName();
- }
- if ($skinType != 'item') {
- $body = strip_tags($row->cbody);
- $body = str_replace("\r\n", "\r", $body);
- $body = str_replace("\r", "\n", $body);
- $body = str_replace("\n",' ',$body);
- $body = shorten($body, 180, "...");
- $body = htmlspecialchars($body);
- $commentData .= '<p><a href="' .$uri. '"><span class="canchor">_</span></a>' . "\n"
- . '<span class="commentator">' . htmlspecialchars($myname) . '</span>'
- . ' [' . $body . ']</p>' . "\n";
- } elseif ($skinType == 'item') {
- $body = $row->cbody;
- $commentData .= '<div class="commentator">'
- . "\t" . '<a name="c' . $row->cnumber . '" id="c' . $row->cnumber . '" '
- . 'href="' .$uri. '"><span class="canchor">_</span></a>' . "\n\t"
- . '<span class="commentator">' . htmlspecialchars($myname) . '</span>' . "\n\t"
- . '<span class="commenttime">(' . strftime('%Y年%m月%d日', $row->ctimestamp)
- . '(' . $youbi[strftime('%w', $row->ctimestamp)] . ')'
- . strftime('%H:%M', $row->ctimestamp) . ')'
- . "</span>\n</div>"
- . '<p>' . $body . "</p>\n";
- }
- }
- $commentData .= '</div>' . "\n";
- mysql_free_result($comments);
- }
- $commentData .= '</div>' . "\n";
- return $commentData;
- }
-
- function showForm($itemid, $itemuri)
- {
- global $manager, $CONF, $member;
- $actionphp = $CONF['ActionURL'];
- $membername = $member->getRealName();
-
- if ($membername) {
- $nameArea = 'お名前: ' . $membername . ' (<a href="'
- . createItemLink($itemid)
- . '/?action=logout">ログアウト</a>)';
- $mailArea = ' ';
- $checkBox = '';
- $type = 'commentform-loggedin';
- } else {
- if (cookieVar('comment_user')) {
- $username = htmlspecialchars(cookieVar('comment_user'));
- } else {
- $username = '';
- }
- if (cookieVar('comment_userid')) {
- $userid = htmlspecialchars(cookieVar('comment_userid'));
- } else {
- $userid = '';
- }
- cookieVar('comment_user') ? $check = 'checked="checked" ' : $check = '';
- $nameArea = 'お名前: <input name="user" value="' . $username . '" class="field" />';
- $mailArea = 'E-Mail: <input name="userid" value="' . $userid . '" class="field" />';
-// $checkBox = '<input type="checkbox" value="1" name="remember" ' . $check . '/>情報を記憶しておく ';
- $type = 'commentform-notloggedin';
- }
-echo <<<___COMMENTFORM__
-<div class="form">
- <div class="caption"><a name="c" id="c">ツッコミ・コメントがあればどうぞ! </a></div>
- <form method="post" action="{$actionphp}">
- <div>
- <input type="hidden" name="action" value="addcomment" />
- <input type="hidden" name="url" value="{$itemuri}" />
- <input type="hidden" name="itemid" value="{$itemid}" />
- <div class="field name">
- {$nameArea}
- </div>
- <div class="field mail">
- {$mailArea}
- </div>
- <div class="textarea">
- コメント: <textarea name="body" cols="60" rows="5" class="formfield"></textarea><br />
- </div>
-___COMMENTFORM__;
- $manager->notify('FormExtra', array('type' => $type));
-echo <<<___COMMENTFORM__
- <div class="button">
- <input type="submit" value="投稿" class="formbutton" />
- </div>
- </div>
- </form>
-</div>
-___COMMENTFORM__;
- }
-
- function showCategoryList($skinType, $query, $mtable = '', $where, $catwhere = '', $catID, $b)
- {
- global $manager, $archive, $subcatid;
- $minstalled = $manager->pluginInstalled('NP_MultipleCategories');
- if ($minstalled) {
- $subcatTable = sql_table('plug_multiple_categories_sub');
- $mplugin =& $manager->getPlugin('NP_MultipleCategories');
- if (method_exists($mplugin, 'getRequestName')) {
- $subrequest = $mplugin->getRequestName();
- } else {
- $subrequest = 'subcatid';
- }
- }
- $sType = $skinType;
- $monthlimit = (intGetVar('monthlimit') > 0) ? intGetVar('monthlimit') : 1;
- $bid = intval($this->nowbid);
- $catque = 'SELECT c.catid as catid,'
- . ' c.cname as catname'
- . ' FROM ' . sql_table('category') . ' as c'
- . ' WHERE c.cblog = ' . $bid;
- $catres = sql_query($catque);
- echo '<p>Categories |';
- while ($catdata = mysql_fetch_object($catres)) {
- $cid = intval($catdata->catid);
- $catlink = $this->_createCategoryIDLink($cid, $sType);
- echo 'cat<a href="' . $catlink . '">' . $catdata->catname . "</a> | \n";
- if ($minstalled) {
- $subcats = $mplugin->_getScatIDs($cid);
- if (!empty($subcats)) {
- foreach ($subcats as $subcat) {
- $scatque = 'SELECT sname as result'
- . ' FROM ' . $subcatTable
- . ' WHERE scatid = ' . intval($subcat);
- $subname = quickQuery($scatque);
- $sbprm = $subrequest . '/' . intval($subcat);
- $sblnk = $this->_createCategoryIDLink($cid, $sType, $sbprm);
- echo 'scat<a href="' . $sblnk . '">' . $subname . "</a> | \n";
- }
- }
- }
- }
- echo '</p>';
- echo '<hr class="sep" />' . "\n";
- if (!empty($catID)) {
- $catque .= ' and catid = ' . intval($catID);
- }
- $catres = sql_query($catque);
- while ($catdata = mysql_fetch_object($catres)) {
- $cid = intval($catdata->catid);
- if ($minstalled && !$mtable) {
- $tempq = $this->getMulticategoriesQuery($cid);
- $shQuery = $query . $tempq['mtable'] . $where . $tempq['where'];
- } else {
- $shQuery = $query . $mtable . $where . $catwhere;
- }
-
- if ($skinType == 'archive') {
- $shQuery .= $this->getDateQuery($archive, $monthlimit);
- }
- $shQuery .= ' ORDER BY SUBSTRING(i.itime, 1, 10) DESC, i.itime DESC';
- if (mysql_num_rows(sql_query($shQuery)) && !$subcatid) {
- $catlink = $this->_createCategoryIDLink($cid, $sType);
- $headData = '<div class="conf day">' . "\n"
- . '<h2><span class="title"><a href="' . $catlink . '">'
- . $catdata->catname . "</a></span></h2>\n"
- . '<div class="body">' . "\n"
- . "<p>\n";
- echo $headData;
- $b->showUsingQuery('tDiary/archive', $shQuery, 0, 1, 1);
- echo "</p>\n</div>\n</div>\n";
- }
-
- if ($minstalled && !$subcatid && $catID) {
- $subcats = $mplugin->_getScatIDs($cid);
- if (!empty($subcats)) {
- sort($subcats);
- foreach ($subcats as $subcat) {
- $tempq = $this->getMulticategoriesQuery($cid, $subcat);
- $sbQuery = $query . $tempq['mtable'] . $where . $tempq['where'];
- if ($skinType == 'archive') {
- $sbQuery .= $this->getDateQuery($archive, $monthlimit);
- }
- $sbQuery .= ' ORDER BY SUBSTRING(i.itime, 1, 10) DESC,'
- . ' i.itime DESC';
- $this->showSubcatList($cid, $subcat, $sType, $sbQuery, $subrequest);
- }
- }
- } elseif ($subcatid) {
- $tempq = $this->getMulticategoriesQuery($cid, $subcatid);
- $sbQuery = $query . $tempq['mtable'] . $where . $tempq['where'];
- if ($skinType == 'archive') {
- $sbQuery .= $this->getDateQuery($archive, $monthlimit);
- }
- $sbQuery .= ' ORDER BY SUBSTRING(i.itime, 1, 10) DESC, i.itime DESC';
- $this->showSubcatList($cid, $subcatid, $sType, $sbQuery, $subrequest);
- }
- }
- }
-
- function showSubcatList($cid, $sid, $skinType, $sbQuery, $subrequest)
- {
- global $manager;
- $bid = getBlogIDFromCatID($cid);
- $b =& $manager->getBlog($bid);
- $scatque = 'SELECT sname as result'
- . ' FROM ' . sql_table('plug_multiple_categories_sub')
- . ' WHERE scatid = ' . $sid;
- $subname = quickQuery($scatque);
- $subparam = $subrequest . '/' . $sid;
- if (mysql_num_rows(sql_query($sbQuery))) {
- $sublink = $this->_createCategoryIDLink($cid, $skinType, $subparam);
- $headData = '<div class="conf day">' . "\n"
- . '<h2><span class="title"><a href="' . $sublink . '">'
- . $subname . "</a></span></h2>\n"
- . '<div class="body">' . "\n"
- . "<p>\n";
- echo $headData;
- $b->showUsingQuery('tDiary/archive', $sbQuery, 0, 1, 1);
- echo "</p>\n</div>\n</div>\n";
- }
- }
-
- function showDiary($skinType, $query, $startpos, $daylist, $amount, $b)
- {
- global $manager;
- if ($skinType == 'item') {
- $template = 'tDiary/item';
- } else {
- $template = 'tDiary/index';
- }
- if (getVar('tdiarydate')) {
- sscanf(getVar('tdiarydate'), '%d-%d', $m, $d);
- $linkDate = sprintf('%02d-%02d', $m, $d);
- $amount = count($daylist);
- } elseif ($skinType == 'archive') {
- $amount = count($daylist);
- } elseif ($skinType == 'search') {
- $tmpQue = $query
- . ' ORDER BY SUBSTRING(i.itime, 1, 10) DESC,'
- . ' i.itime DESC';
- $res = sql_query($tmpQue);
- $amount = count($daylist);
-// $amount = mysql_num_rows($res);
- }
- $youbiArray = array('日', '月', '火', '水', '木', '金', '土');
- for ($i = 1; $i <= $amount; $i++) {
- $dateData = $daylist[$startpos];
- $itemData = $this->_createItemLinkByDate($dateData, $mtable);
- $itemLink = $itemData['link'];
- $itemID = $itemData['id'];
- $youbi = $youbiArray[strftime("%w", strtotime($dateData))];
- $headData = '<hr class="sep" />' . "\n"
- . '<div class="day">' . "\n"
- . "<h2>\n" . '<span class="date">'
- . '<a href="' . $itemLink . '" title="' . $dateData . '">'
- . $dateData . '(' . $youbi . ')'
- . "</a></span>\n"
- . '<span class="title"></span>' . "\n";
- if (!isset($linkDate)) {
- $headData .= '<span class="nyear">[<a href="'
- . $this->_createDiaryLink($dateData, $this->nowbid)
- . '" title="長年日記">長年日記</a>]</span>'
- . "\n";
- }
- $headData .= "</h2>\n";
- $shQuery = $query;
-// if ($skinType != 'search') {
- $shQuery .= $this->getDateQuery($dateData);
-// }
- $shQuery .= ' ORDER BY SUBSTRING(i.itime, 1, 10) DESC,'
- . ' i.itime DESC';
-// echo mysql_num_rows(sql_query($shQuery));
-// if (mysql_num_rows(sql_query($shQuery)) > 0) {
- if (isset($linkDate)) {
- if (substr($dateData, 5) == $linkDate) {
- echo $headData;
- $b->showUsingQuery($template, $shQuery, 0, 1, 1);
- echo $this->showComment($itemID, $itemLink, $skinType);
- $this->showTBandReferer($skinType, $itemID, $itemLink);
- echo '</div>' . "\n";
- }
- } else {
- echo $headData;
- $b->showUsingQuery($template, $shQuery, 0, 1, 1);
- echo $this->showComment($itemID, $itemLink, $skinType);
- if ($skinType == 'item') {
- $this->showForm($itemID, $itemLink);
- }
- $this->showTBandReferer($skinType, $itemID, $itemLink);
- echo '</div>' . "\n";
- }
- $startpos++;
-// }
- }
- }
-
- function showTBandReferer($skinType, $itemID, $itemLink)
- {
- global $manager;
- $refInstalled = $manager->pluginInstalled('NP_Referer3');
- $tbInstalled = $manager->pluginInstalled('NP_TrackBack');
- if ($refInstalled || $tbInstalled) {
- if ($skinType == 'item') {
- if ($tbInstalled) {
- $tbPlugin =& $manager->getPlugin('NP_TrackBack');
- $tbCount = $tbPlugin->getTrackBackCount($itemID);
- $tbURL = $this->_getTrackBackURL($itemID);
- $printData = "\n\t" . '<div class="comment trackbacks">'
- . "\n\t\t" . '<div class="caption">';
- if ($tbCount > 0) {
- $printData .= "\n\t\t\t"
- . '本日のTrackBacks(全' . $tbCount . '件)';
- }
- $printData .= "\n\t\t\t"
- . '[TrackBack URL: <a href="' . $tbURL . '" name="tb" id="tb">'
- . $tbURL . '</a>]'
- . "\n\t\t</div>";
- echo $printData;
- $this->showTrackBackList($itemID);
- echo "\n\t</div>";
- }
- if ($refInstalled) {
- $refTemplate = "\n\t\t"
- . '<li><a href="<%send%>" rel="nofollow">'
- . '<%extra%></a> × <%senCount%></li>';
- $receive = 'id/item/' . intval($itemID);
- $refQuery = 'SELECT send,'
- . ' extra,'
- . ' receive,'
- . ' COUNT(send) AS senCount'
- . ' FROM ' . sql_table('plug_referer3')
- . ' WHERE receive = "' . $receive . '"'
- . ' GROUP BY send'
- . ' ORDER BY senCount DESC';
- $results = sql_query($refQuery);
- if (mysql_num_rows($results) > 0) {
- $printData = '<div class="refererlist">'
- . "\n\t" . '<div class="caption">本日のリンク元</div>'
- . "\n\t" . '<ul>';
- echo $printData;
- while ($res = mysql_fetch_object($results)) {
- $printData = (array)$res;
- $printData = array_map('htmlspecialchars', $printData);
- echo TEMPLATE::fill($refTemplate, $printData);
- }
- echo "\n\t</ul>\n</div>";
- }
- }
- } else {
- echo '<div class="referer">' . "\n";
- if ($tbInstalled) {
- $tbPlugin =& $manager->getPlugin('NP_TrackBack');
- $tbCount = $tbPlugin->getTrackBackCount($itemID);
- $printData = '<a href="' . $itemLink . '#tb">'
- . 'TrackBack(' . $tbCount . ')'
- . '</a>'
- . '<br />';
- echo $printData;
- }
- if ($refInstalled) {
- $refTemplate = '<a href="<%send%>" title="<%extra%>">'
- . '<%senCount%></a> | ' . "\n";
- $receive = 'id/item/' . intval($itemID);
- $refQuery = 'SELECT send,'
- . ' extra,'
- . ' receive,'
- . ' COUNT(send) AS senCount'
- . ' FROM ' . sql_table('plug_referer3')
- . ' WHERE receive = "' . $receive . '"'
- . ' GROUP BY send'
- . ' ORDER BY senCount DESC';
- $results = sql_query($refQuery);
- if (mysql_num_rows($results) > 0) {
- echo '本日のリンク元 | ';
- while ($res = mysql_fetch_object($results)) {
- $printData = (array)$res;
- $printData = array_map('htmlspecialchars', $printData);
- echo TEMPLATE::fill($refTemplate, $printData);
- }
- }
- echo '</div>';
- }
- }
- }
- }
-
- function showTrackBackList($tb_id)
- {
- global $manager, $blog, $CONF, $member;
- $tbplgin =& $manager->getPlugin('NP_TrackBack');
- $enableHideurl = true;
- $UserAgent = serverVar('HTTP_USER_AGENT');
- if(strstr($UserAgent, 'Hatena Diary Track Forward Agent')
- || strstr($UserAgent, 'NP_TrackBack')
- || strstr($UserAgent, 'TBPingLinkLookup')
- || strstr($UserAgent, 'MT::Plugin::BanNoReferTb')
- || strstr($UserAgent, 'livedoorBlog')) {
- $enableHideurl = false;
- $amount = '-1';
- }
- $tmpHead = "\n\t\t" . '<div class="commentbody trackbackbody">';
- $tmpItem = "\n\t\t\t" . '<div class="commentator trackback">'
- . "\n\t\t\t\t" . '<span class="canchor">#</span>'
- . "\n\t\t\t\t" . '<span class="commentator trackbackblog">'
- . '<a href="<%url%>" name="tb<%id%>" id="tb<%id%>"><%name%> : '
- . '<%title%></a></span>'
- . "\n\t\t\t\t" . '<span class="commenttime trackbacktime">'
- . '<%date%></span>'
- . "\n\t\t\t</div>"
- . "\n\t\t\t<p><%excerpt%></p>";
- $tmpEmpt = '';
- $tmpFoot = "\n\t\t</div>";
-
- $query = 'SELECT'
- . ' id,'
- . ' url,'
- . ' md5(url) AS urlHash,'
- . ' blog_name,'
- . ' excerpt,'
- . ' title,'
- . ' UNIX_TIMESTAMP(timestamp) AS timestamp'
- . ' FROM %s'
- . ' WHERE'
- . ' tb_id = %d'
- . ' AND block = 0'
- . ' ORDER BY timestamp DESC';
- if ($amount == '-1') {
- $query .= ' LIMIT 9999999';
- }
- $query = sprintf($query, sql_table('plugin_tb'), $tb_id);
- $res = sql_query($query);
-
- $gVars = array(
- 'action' => $this->_getTrackBackUrl($tb_id),
- );
-
- if ($member->isLoggedIn() && $member->isAdmin()){
- $gVars['admin'] = '<a href="'
- . $CONF['PluginURL']
- . 'trackback/index.php?action=list&id='
- . $tb_id . '" target="_blank">[admin]</a>';
- $gVars['pingform'] = '<a href="'
- . $CONF['PluginURL']
- . 'trackback/index.php?action=ping&id='
- . $tb_id . '" target="_blank">[pingform]</a>';
- }
- echo TEMPLATE::fill($tmpHead, $gVars);
- while ($row = mysql_fetch_array($res)) {
- $row['blog_name'] = htmlspecialchars($row['blog_name'], ENT_QUOTES);
- $row['title'] = htmlspecialchars($row['title'], ENT_QUOTES);
- $row['excerpt'] = htmlspecialchars($row['excerpt'], ENT_QUOTES);
- if (_CHARSET != 'UTF-8') {
- $row['blog_name'] = $tbplgin->_restore_to_utf8($row['blog_name']);
- $row['title'] = $tbplgin->_restore_to_utf8($row['title']);
- $row['excerpt'] = $tbplgin->_restore_to_utf8($row['excerpt']);
- $row['blog_name'] = mb_convert_encoding($row['blog_name'], _CHARSET, 'UTF-8');
- $row['title'] = mb_convert_encoding($row['title'], _CHARSET, 'UTF-8');
- $row['excerpt'] = mb_convert_encoding($row['excerpt'], _CHARSET, 'UTF-8');
- }
- $tbDate = strftime($tbplgin->getOption('dateFormat'), $row['timestamp']);
- $iVars = array(
- 'action' => $this->_getTrackBackUrl($tb_id),
- 'name' => $row['blog_name'],
- 'title' => $row['title'],
- 'excerpt' => $tbplgin->_cut_string($row['excerpt'], 400),
- 'url' => htmlspecialchars($row['url'], ENT_QUOTES),
- 'date' => htmlspecialchars($tbDate, ENT_QUOTES),
- 'id' => intval($row['id'])
- );
- if ($enableHideurl && $tbplgin->getOption('HideUrl') == 'yes') {
- $iVars['url'] = $CONF['ActionURL']
- . '?action=plugin&name=TrackBack&type=redirect&tb_id='
- . $tb_id . '&urlHash=' . $row['urlHash'];
- } else {
- $iVars['url'] = $row['url'];
- }
- echo TEMPLATE::fill($tmpItem, $iVars);
- }
- if (mysql_num_rows($res) == 0) {
- echo TEMPLATE::fill($tmpEmpt, $gVars);
- }
- mysql_free_result($res);
- echo TEMPLATE::fill($tmpFoot, $gVars);
- }
-
- function doSkinVar($skinType, $mode = 'show', $amount = '5')
- {
- global $manager, $blog, $CONF, $catid, $blogid, $archive, $subcatid;
- if ($archive) {
- $archive = $this->_dataCleaning($archive);
- }
- if ($blog) {
- $b =& $blog;
- } else {
- $b =& $manager->getBlog($CONF['DefaultBlog']);
- }
- $this->nowbid = intval($b->getID());
- $where = ' and i.iblog=' . $this->nowbid;
- $dwhere = $where;
-
- if (!empty($catid)) {
- if ($manager->pluginInstalled('NP_MultipleCategories')) {
- $tempq = $this->getMulticategoriesQuery($catid);
- $mtable = $tempq['mtable'];
- $catwhere = $tempq['where'];
- } else {
- $where .= ' AND i.icat=' . intval($catid);
- }
- }
-
- if ($archive) {
- $monthlimit = (intGetVar('monthlimit') > 0) ? intGetVar('monthlimit') : 1;
- if ($monthlimit > 1) {
- sscanf($archive, '%d-%d-%d', $y, $m, $d);
- if ($monthlimit == 6) {
- if (($m / $monthlimit) > 1) {
- $m = 7;
- } else {
- $m = 1;
- }
- } elseif ($monthlimit == 3) {
- if (($m / $monthlimit) > 3) {
- $m = 10;
- } elseif (($m / $monthlimit) > 2) {
- $m = 7;
- } elseif (($m / $monthlimit) > 1) {
- $m = 4;
- } else {
- $m = 1;
- }
- }
- $archive = sprintf('%4d-%2d', $y, $m);
- }
- $where .= $this->getDateQuery($archive, $monthlimit);
- } else {
- $where .= ' and i.itime <= ' . mysqldate($b->getCorrectTime());
- }
- $pageswitch = $this->_createPageSwitch($where, $mtable, $amount, $skinType, $b);
- $startpos = $pageswitch['startpos'];
- $daylist = $pageswitch['daysList'];
- $query = 'SELECT'
- . ' i.inumber as itemid,'
- . ' i.ititle as title,'
- . ' i.ibody as body,'
- . ' i.itime,'
- . ' i.imore as more,'
- . ' i.iclosed as closed,'
- . ' i.icat as catid,'
- . ' c.cname as category,'
- . ' UNIX_TIMESTAMP(i.itime) as timestamp,'
- . ' m.mrealname as authorname,'
- . ' m.mname as author,'
- . ' m.mnumber as authorid'
- . ' FROM '
- . sql_table('member') . ' as m, '
- . sql_table('category') . ' as c, '
- . sql_table('item') . ' as i';
- $base = ' WHERE i.iauthor = m.mnumber'
- . ' and i.icat = c.catid'
- . ' and i.idraft = 0';
- switch ($mode) {
- case 'pagelink':
- echo $pageswitch['pageLink'];
- return;
- break;
- case 'author':
- $authorquery = 'SELECT mrealname as result FROM %s WHERE mnumber = %d';
- $author = quickQuery(sprintf($authorquery, sql_table('member'), $amount));
- echo $author;
- break;
- case 'authormail':
- $authorquery = 'SELECT memail as result FROM %s WHERE mnumber = %d';
- $authormail = quickQuery(sprintf($authorquery, sql_table('member'), $amount));
- echo $authormail;
- break;
- case 'recent':
- echo '<div id="recent_list"><ul class="recent-list">' . "\n";
- for ($i = 1; $i <= $amount; $i++) {
- $dateData = $daylist[$startpos];
- $itemData = $this->_createItemLinkByDate($dateData, $mtable);
- $itemLink = $itemData['link'];
- echo '<li>' . '<a href="' . $itemLink . '">' . $dateData . "</a>\n"
- . "\t" . '<ul class="recent-list-item">' . "\n";
- $shQuery = $query . $base . $dwhere
- . $this->getDateQuery($dateData)
- . ' ORDER BY SUBSTRING(i.itime, 1, 10) DESC, i.itime DESC';
- $b->showUsingQuery('tDiary/recent', $shQuery, 0, 1, 1);
- echo "\t</ul>\n</li>\n";
- $startpos++;
- }
- echo "</ul>\n</div>\n";
- break;
- case 'show':
- switch ($skinType) {
- case 'index':
- case 'item':
- $showquery = $query . $base . $dwhere;
- $this->showDiary($skinType, $showquery, $startpos, $daylist, $amount, $b);
- break;
- case 'archive':
- if (!$catid && intGetVar('categorylist') > 0) {
- $catID = 0;
- } else {
- $catID = intval($catid);
- }
- if ($catID || intGetVar('categorylist') > 0) {
- $where = $base . $dwhere;
- $this->showCategoryList($skinType, $query, $mtable, $where, $catwhere, $catID, $b);
- } else {
- $showquery = $query . $base . $dwhere;
- $this->showDiary($skinType, $showquery, $startpos, $daylist, $amount, $b);
- }
- break;
- case 'archivelist':
- $where = $base . $dwhere;
- $catID = ($catid) ? intval($catid) : 0;
- $this->showCategoryList($skinType, $query, $mtable, $where, $catwhere, $catID, $b);
- break;
- case 'search':
- unset($daylist);
- $showquery = $this->getSearchQuery()
- . ' AND i.iblog = ' . $this->nowbid;
- $dayQuery = $showquery
- . ' ORDER BY i.itime DESC';
- $daysRes = sql_query($dayQuery);
- while($days = mysql_fetch_object($daysRes)){
- $daylist[] = substr($days->itime, 0, 10);
- }
-// print_r($daylist);
-// exit;
- $this->showDiary($skinType, $showquery, $startpos, $daylist, $amount, $b);
- break;
- default:
- break;
- }
- break;
- case 'catlist':
- $monthlimit = (intGetVar('monthlimit') > 0) ? intGetVar('monthlimit') : 1;
- $bid = intval($this->nowbid);
- $catque = 'SELECT c.catid as catid,'
- . ' c.cname as catname'
- . ' FROM ' . sql_table('category') . ' as c'
- . ' WHERE c.cblog = ' . $bid;
- $catres = sql_query($catque);
- echo '<p>Categories |';
- while ($catdata = mysql_fetch_object($catres)) {
- $catlink = $this->_createCategoryIDLink($catdata->catid, $skinType);
- echo '<a href="' . $catlink . '">' . $catdata->catname . "</a> | \n";
- }
- echo '</p>';
- break;
- }
- }
-
- function doTemplateVar(&$item, $mode = 'itemlink')
- {
- global $manager, $CONF;
- $blogID = intval(getBlogidFromItemID($item->itemid));
- $itemdate = substr($item->itime, 0, 10);
- switch ($mode) {
- case 'itemlink':
- $linkdata = $this->_createItemLinkByDate($itemdate);
- echo $linkdata['link'] . '#' . $item->itemid;
- break;
- case 'catlink':
- sscanf($itemdate, '%d-%d-%d', $y, $m, $d);
- $monthlimit = $this->getOption('monthlimit');
- $catdate = sprintf('%04d-%02d', $y, $m);
- $catparam['catid'] = $item->catid;
- switch ($monthlimit) {
-// case 1:
-// $catparam = array('catid' => $item->catid);
-// $catlink = createArchiveLink($blogID, $catdate, $catparam);
-// break;
- case 2:
-// $catparam = array('catid' => $item->catid,
-// 'monthlimit' => 3);
- $catparam['monthlimit'] = 3;
-// $catlink = createArchiveLink($blogID, $catdate, $catparam);
- break;
- case 3:
-// $catparam = array('catid' => $item->catid,
-// 'monthlimit' => 6);
- $catparam['monthlimit'] = 6;
-// $catlink = createArchiveLink($blogID, $catdate, $catparam);
- break;
- case 4:
-// $catparam = array('catid' => $item->catid);
- $catdate = substr($item->itime, 0, 4);
-// $catlink = createArchiveLink($blogID, $catdate, $catparam);
- break;
- }
- $catlink = createArchiveLink($blogID, $catdate, $catparam);
- echo $catlink;
- break;
- default:
- break;
- }
- }
-
- function event_InitSkinParse($data)
- {
- global $CONF, $manager;
- $usePathInfo = ($CONF['URLMode'] == 'pathinfo');
- if (serverVar('REQUEST_URI') == '') {
- $uri = (serverVar('QUERY_STRING')) ?
- serverVar('SCRIPT_NAME') . serverVar('QUERY_STRING') : serverVar('SCRIPT_NAME');
- } else {
- $uri = serverVar('REQUEST_URI');
- }
- $page_str = ($usePathInfo) ? 'page/' : 'page=';
- if ($manager->pluginInstalled('NP_CustomURL') || $manager->pluginInstalled('NP_Magical')) {
- $page_str = 'page_';
- }
- list($org_uri, $currPage) = explode($page_str, $uri, 2);
- if (getVar('page')) {
- $y = $m = $d = '';
- sscanf(getVar('page'), '%4d%2d%2d%s', $y, $m, $d, $trush);
- if (!empty($d)) {
- $currPage = sprintf('%04d-%02d-%02d', $y, $m, $d);
- } else {
- $currPage = sprintf('%04d-%02d', $y, $m);
- }
- } else {
- sscanf($currPage, '%4d%2d%2d%s', $y, $m, $d, $trush);
- if (!empty($d)) {
- $currPage = sprintf('%04d-%02d-%02d', $y, $m, $d);
- } else {
- $currPage = sprintf('%04d-%02d', $y, $m);
- }
- }
- $_GET['page'] = $currPage;
- $this->currPage = $currPage;
- $this->pagestr = $page_str;
- }
-
-
-}
-
-
-
-
-
-
-
-