From 211b165c0789f79601c146e5f5fe37f12ef321d1 Mon Sep 17 00:00:00 2001
From: shizuki
+
+
+
+
+___FORMEXTRA___;
+ $XMLHttp = $this->getOption('AutoXMLHttp');
+ if ($XMLHttp == 'yes') {
+ echo <<<___FORMEXTRA___
+
' . _ERROR_DISALLOWED . '
'; + $oPluginAdmin->end(); + exit; + } + + // Actions + $action = requestVar('action'); + $aActionsNotToCheck = array( + '', + ); + if (!in_array($action, $aActionsNotToCheck)) { + if (!$manager->checkTicket()) doError(_ERROR_BADTICKET); + } + +//modify start+++++++++ + $plug =& $oPluginAdmin->plugin; + $tableVersion = $plug->checkTableVersion(); + + // include language file for this plugin + $language = ereg_replace( '[\\|/]', '', getLanguageName()); + if (file_exists($plug->getDirectory().'language/'.$language.'.php')) + include_once($plug->getDirectory().'language/'.$language.'.php'); + else + include_once($plug->getDirectory().'language/'.'english.php'); +//modify end+++++++++ + + $oTemplate = new Trackback_Template(); + $oTemplate->set ('CONF', $CONF); + $oTemplate->set ('plugindirurl', $oPluginAdmin->plugin->getAdminURL()); + $oTemplate->set ('ticket', $manager->_generateTicket()); + + $whereClause = ''; + if( ! $member->isAdmin() ){ + // where clause + $res = sql_query('SELECT tblog FROM '.sql_table('team').' WHERE tadmin = 1 AND tmember = '.$member->getID() ); + $adminBlog = array(); + while ($row = mysql_fetch_array($res)){ + $adminBlog[] = $row[0]; + } + if($adminBlog) + $whereClause = ' i.iblog in (' . implode(', ', $adminBlog) . ') '; + + if( $whereClause ) + $whereClause = ' AND ( i.iauthor = '.$member->getID().' OR ' . $whereClause . ' )'; + else + $whereClause = ' AND i.iauthor = '.$member->getID(); + } + + $requiredItemEditRights = array( + 'dodelete', + 'doblock', + 'dounblock', + ); + $safeids = array(); + if (in_array($action, $requiredItemEditRights)) { + $ids = explode(',', requestVar('ids')); + $safeids = array(); + foreach( $ids as $id ){ + $id = trim($id); + if( is_numeric($id) ) + $safeids[] = $id; + } + if( ! $member->isAdmin() ){ + $query = 'SELECT t.id FROM ' . sql_table('plugin_tb') . ' t, ' . sql_table('item') . ' i WHERE t.tb_id = i.inumber AND t.id in ( '. implode(',', $safeids) . ' ) '. $whereClause ; + $res = sql_query($query); + $safeids = array(); + while ($row = mysql_fetch_array($res)){ + $safeids[] = $row[0]; + } + } + } + + // Pages + switch($action) { + + case 'ajax': + $type = requestVar('type') == 'all' ? 'all' : 'blocked' ; + $filter['all'] = ' t.block = 0 '; + $filter['blocked'] = ' t.block = 1 '; + + $start = intRequestVar('offset') ? intRequestVar('offset') : 0; + $amount = intRequestVar('page_size') ? intRequestVar('page_size') : 25; + + $colname = array(); + $colname['date'] = 'timestamp'; + $colname['item'] = 'story_id'; + $colname['title'] = 'title'; + + $sort_col = requestVar('sort_col'); + $sort_col = $colname[$sort_col]; + if( !$sort_col ) $sort_col = $colname['date']; + + $sort_dir = ( requestVar('sort_dir') == 'ASC' ) ? 'ASC' : 'DESC'; + + $rres = sql_query (" + SELECT + count(*) as count + FROM + ".sql_table('plugin_tb')." AS t, + ".sql_table('item')." AS i + WHERE + t.tb_id = i.inumber AND + ".$filter[$type].$whereClause); + $rrow = mysql_fetch_array($rres); + $count = $rrow['count']; + + $rres = sql_query (" + SELECT + i.ititle AS story, + i.inumber AS story_id, + t.id AS id, + t.title AS title, + t.blog_name AS blog_name, + t.excerpt AS excerpt, + t.url AS url, + t.spam AS spam, + UNIX_TIMESTAMP(t.timestamp) AS timestamp + FROM + ".sql_table('plugin_tb')." AS t, + ".sql_table('item')." AS i + WHERE + t.tb_id = i.inumber AND + ".$filter[$type].$whereClause." + ORDER BY + ".$sort_col." ".$sort_dir." + LIMIT + ".$start.",".$amount." + "); + + $items = array(); + + while ($rrow = mysql_fetch_array($rres)) + { + $rrow['title'] = $oPluginAdmin->plugin->_cut_string($rrow['title'], 50); + $rrow['title'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['title']); + $rrow['title'] = htmlspecialchars($rrow['title']); + $rrow['title'] = preg_replace("/-+/","-",$rrow['title']); + + $rrow['blog_name'] = $oPluginAdmin->plugin->_cut_string($rrow['blog_name'], 50); + $rrow['blog_name'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['blog_name']); + $rrow['blog_name'] = htmlspecialchars($rrow['blog_name']); + $rrow['blog_name'] = preg_replace("/-+/","-",$rrow['blog_name']); + + $rrow['excerpt'] = $oPluginAdmin->plugin->_cut_string($rrow['excerpt'], 100); + $rrow['excerpt'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['excerpt']); + $rrow['excerpt'] = htmlspecialchars($rrow['excerpt']); + $rrow['excerpt'] = preg_replace("/-+/","-",$rrow['excerpt']); + + $rrow['url'] = htmlspecialchars($rrow['url'], ENT_QUOTES); + + $blog = & $manager->getBlog(getBlogIDFromItemID($rrow['story_id'])); + $rrow['story_url'] = $oPluginAdmin->plugin->_createItemLink($rrow['story_id'], $blog); + $rrow['story'] = htmlspecialchars(strip_tags($rrow['story']), ENT_QUOTES); + + $items[] = $rrow; + } + + $oTemplate->set ('amount', $amount); + $oTemplate->set ('count', $count); + $oTemplate->set ('start', $start); + $oTemplate->set ('items', $items); + $oTemplate->template('templates/response_'.$type.'.xml'); + break; + + case 'dodelete': + if( count($safeids) > 0 ){ + $safeids = implode(',',$safeids); + + $res = sql_query( + ' DELETE FROM ' + . sql_table('plugin_tb') + . ' WHERE id in (' . $safeids. ')' + ); + $oTemplate->set ('message', $safeids . ' deleted.'); + } else { + $oTemplate->set ('message', 'no rows deleted.'); + } + + $oTemplate->template('templates/response_dodelete.xml'); + break; + + case 'doblock': + if( count($safeids) > 0 ){ + $safeids = implode(',',$safeids); + + $res = sql_query( + ' UPDATE ' + . sql_table('plugin_tb') + .' SET block = 1 ' + . ' WHERE id in (' . $safeids. ')' + ); + $oTemplate->set ('message', $safeids . ' blocked.'); + } else { + $oTemplate->set ('message', 'no rows blocked.'); + } + + $oTemplate->template('templates/response_doblock.xml'); + break; + + case 'dounblock': + if( count($safeids) > 0 ){ + $safeids = implode(',',$safeids); + + $res = sql_query( + ' UPDATE ' + . sql_table('plugin_tb') + .' SET block = 0 ' + . ' WHERE id in (' . $safeids. ')' + ); + $oTemplate->set ('message', $safeids . ' unblocked.'); + } else { + $oTemplate->set ('message', 'no rows unblocked.'); + } + + $oTemplate->template('templates/response_dounblock.xml'); + break; + } + + // Create the admin area page + echo $oTemplate->fetch(); + diff --git a/NP_TrackBack/branches/DOM-branch/trackback/help.html b/NP_TrackBack/branches/DOM-branch/trackback/help.html new file mode 100644 index 0000000..41a60ae --- /dev/null +++ b/NP_TrackBack/branches/DOM-branch/trackback/help.html @@ -0,0 +1,111 @@ +
+ <%TrackBack(list)%>
+
+ Show a list of trackbacks for the current page. Optionally it is also possible to + add an additional parameter, the story id number, which makes it possible to + show a list of trackbacks from a different page. The output of this variable is + fully configurable in the plugin options. +
+ +
+ <%TrackBack(code)%>
+
+ Inserts a small piece of invisible RDF code in the page, which is used by other + weblogs to auto-detect the trackback URL. If you do not include this variable in + your skin for item pages, other weblogs will not be able to auto-detect that your + weblog is able to accept trackbacks. +
+ +
+ <%TrackBack(form)%>
+
+ Insert the URL to a manual ping form. Using this form authors of other weblogs
+ can add trackbacks to your stories, even when their software does not support
+ trackbacks, such as Blogger. A link to this form is included in the footer of
+ the trackback list by default. If you want to place this link somewhere else
+ on your page, simply remove the <%form%>
variable from the
+ Footer field in the plugin settings and add the skinvar somewhere on
+ your webpage.
+
+ <%TrackBack(url)%>
+
+ Insert the Trackback Ping URL. A this URL is also included in the footer of
+ the trackback list by default. If you want to place this link somewhere else
+ on your page, simply remove the <%action%>
variable from the
+ Footer field in the plugin settings and add the skinvar somewhere on
+ your webpage.
+
+ All the skin variables documented above are also available as template variables. +
+ +
+ <%TrackBack(count)%>
+
+ If you want to include an indication of how many trackbacks are present for each + page you can use this variable. By default this variable will show: "No Trackbacks", + "1 Trackback", "2 Trackbacks", etc. This is however also fully configurable in + the plugin options. +
+ + ++ It is possible to fully change the output of this plugin. You can manually change + the XHTML code in the plugin options, but you can also use CSS to style the default + output to your liking. Below you will find an example of what a little snippet of + CSS can do. +
+ +div.tb { + border: 1px solid #000; background: #FFF; +} +div.tb div.head { + padding: 4px; + background: #000; color: #FFF; + font-weight: bold; text-transform: lowercase; letter-spacing: 0.6em; +} +div.tb div.empty { + padding: 4px; + font-size: 95%; +} +div.tb div.item { + padding: 4px; +} +div.tb div.item div.name { + margin-bottom: 8px; + font-size: 120%; font-weight: bold; +} +div.tb div.item div.body { + font-size: 95%; +} +div.tb div.item div.body a { + font-weight: bold; +} +div.tb div.item div.date { + margin-bottom: 8px; + color: #888; + font-size: 85%; text-align: right; +} +div.tb div.info { + padding: 4px; + color: #FFF; background: #888; + font-size: 85%; font-style: italic; +}+ diff --git a/NP_TrackBack/branches/DOM-branch/trackback/index.php b/NP_TrackBack/branches/DOM-branch/trackback/index.php new file mode 100644 index 0000000..ef09755 --- /dev/null +++ b/NP_TrackBack/branches/DOM-branch/trackback/index.php @@ -0,0 +1,496 @@ +isLoggedIn() ) + { + $oPluginAdmin->start(); + echo '
' . _ERROR_DISALLOWED . '
'; + $oPluginAdmin->end(); + exit; + } + + // Actions + $action = requestVar('action'); + $aActionsNotToCheck = array( + '', + 'ping', + ); + if (!in_array($action, $aActionsNotToCheck)) { + if (!$manager->checkTicket()) doError(_ERROR_BADTICKET); + } + + $oPluginAdmin->start(); + +//modify start+++++++++ + $plug =& $oPluginAdmin->plugin; + $tableVersion = $plug->checkTableVersion(); + + // include language file for this plugin + $language = ereg_replace( '[\\|/]', '', getLanguageName()); + if (file_exists($plug->getDirectory().'language/'.$language.'.php')) + include_once($plug->getDirectory().'language/'.$language.'.php'); + else + include_once($plug->getDirectory().'language/'.'english.php'); +//modify end+++++++++ + + $mTemplate = new Trackback_Template(); + $mTemplate->set ('CONF', $CONF); + $mTemplate->set ('plugid', $plug->getID()); + $mTemplate->set ('plugindirurl', $oPluginAdmin->plugin->getAdminURL()); + $mTemplate->template('templates/menu.html'); + echo $mTemplate->fetch(); + + $oTemplate = new Trackback_Template(); + $oTemplate->set ('CONF', $CONF); + $oTemplate->set ('plugindirurl', $oPluginAdmin->plugin->getAdminURL()); + $oTemplate->set ('ticket', $manager->_generateTicket()); + $ajaxEnabled = ($oPluginAdmin->plugin->getOption('ajaxEnabled') == 'yes') ? true : false; + $oTemplate->set ('ajaxEnabled', $ajaxEnabled); + + $whereClause = ''; + if( ! $member->isAdmin() ){ + // where clause + $res = sql_query('SELECT tblog FROM '.sql_table('team').' WHERE tadmin = 1 AND tmember = '.$member->getID() ); + $adminBlog = array(); + while ($row = mysql_fetch_array($res)){ + $adminBlog[] = $row[0]; + } + if($adminBlog) + $whereClause = ' i.iblog in (' . implode(', ', $adminBlog) . ') '; + + if( $whereClause ) + $whereClause = ' AND ( i.iauthor = '.$member->getID().' OR ' . $whereClause . ' )'; + else + $whereClause = ' AND i.iauthor = '.$member->getID(); + } + //echo "Debug: $whereClause
"; + + $requiredAdminRights = array( + 'tableUpgrade', + 'blocked_clear', + 'blocked_spamclear', + ); + if (in_array($action, $requiredAdminRights)) { + if( ! $member->isAdmin() ){ + echo '
' . _ERROR_DISALLOWED . '
'; + echo 'Reason: ' . __LINE__ . '
'; + $oPluginAdmin->end(); + exit; + } + } + + $requiredItemEditRights = array( + 'block', + 'unblock', + 'delete', + ); + if (in_array($action, $requiredItemEditRights)) { + if( ! $member->isAdmin() ){ + $tb = intRequestVar('tb'); + $query = 'SELECT i.inumber FROM ' . sql_table('plugin_tb') . ' t, ' . sql_table('item') . ' i WHERE t.tb_id = i.inumber AND t.id = '. $tb . $whereClause ; + $res = sql_query($query); + if( ! @mysql_num_rows($res) ){ + echo '' . _ERROR_DISALLOWED . '
'; + echo 'Reason: ' . __LINE__ . '
'; + $oPluginAdmin->end(); + exit; + } + } + } + + switch($action) { + +//modify start+++++++++ + case 'tableUpgrade': + sql_query(" + CREATE TABLE IF NOT EXISTS + ".sql_table('plugin_tb_lookup')." + ( + `link` TEXT NOT NULL, + `url` TEXT NOT NULL, + `title` TEXT, + + PRIMARY KEY (`link` (100)) + ) + "); + echo $q = "ALTER TABLE ".sql_table('plugin_tb')." + ADD `block` TINYINT( 4 ) NOT NULL AFTER `url` , + ADD `spam` TINYINT( 4 ) NOT NULL AFTER `block` , + ADD `link` TINYINT( 4 ) NOT NULL AFTER `spam` , + CHANGE `url` `url` TEXT NOT NULL, + CHANGE `title` `title` TEXT NOT NULL, + CHANGE `excerpt` `excerpt` TEXT NOT NULL, + CHANGE `blog_name` `blog_name` TEXT NOT NULL, + DROP PRIMARY KEY, + ADD `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST ;"; + $res = @sql_query($q); + if (!$res){ + echo 'Could not alter table: ' . mysql_error(); + }else{ + $tableVersion = 1; + $oTemplate->template('templates/updatetablefinished.html'); + } + @sql_query('ALTER TABLE `' . sql_table('plugin_tb') . '` ADD INDEX `tb_id_block_timestamp_idx` ( `tb_id`, `block`, `timestamp` DESC )'); + break; +//modify end+++++++++ + + case 'block': + $tb = intRequestVar('tb'); + + $res = sql_query (" + UPDATE + ".sql_table('plugin_tb')." + SET + block = 1 + WHERE + id = '".$tb."' + "); + + $action = requestVar('next'); + break; + + case 'blocked_clear': + $res = sql_query ("DELETE FROM ".sql_table('plugin_tb')." WHERE block = 1"); + $action = requestVar('next'); + break; + + case 'blocked_spamclear': + $res = sql_query ("DELETE FROM ".sql_table('plugin_tb')." WHERE block = 1 and spam = 1"); + $action = requestVar('next'); + break; + + case 'unblock': + $tb = intRequestVar('tb'); + + $res = sql_query (" + UPDATE + ".sql_table('plugin_tb')." + SET + block = 0 + WHERE + id = '".$tb."' + "); + + $action = requestVar('next'); + break; + + case 'delete': + $tb = intRequestVar('tb'); + + $res = sql_query (" + DELETE FROM + ".sql_table('plugin_tb')." + WHERE + id = '".$tb."' + "); + + $action = requestVar('next'); + break; + + case 'sendping': + $title = requestVar('title'); + $url = requestVar('url'); + $excerpt = requestVar('excerpt'); + $blog_name = requestVar('blog_name'); + $ping_url = requestVar('ping_url'); + + // No charset conversion needs to be done here, because + // the charset used to receive the info is used to send + // it... + + if ($ping_url) { + $error = $oPluginAdmin->plugin->sendPing(0, $title, $url, $excerpt, $blog_name, $ping_url); + + if ($error) { + echo 'TrackBack Error:' . $error . ''; + } + } + + $action = requestVar('next'); + break; + + case 'ping': + $id = intRequestVar('id'); + + $usePathInfo = ($CONF['URLMode'] == 'pathinfo'); + if ($usePathInfo) + @ include($strRel . 'fancyurls.config.php'); + + global $manager; + $itemData = $manager->getItem($id, 0, 0); + + if(is_array($itemData)){ + $blog =& $manager->getBlog($itemData['blogid']); + $CONF['ItemURL'] = ($usePathInfo)? preg_replace('/\/$/', '', $blog->getURL()): $blog->getURL(); + $itemData['url'] = createItemLink($id); + $itemData['excerpt'] = shorten(strip_tags($itemData['body'].$itemData['more']), 250, '...'); + $itemData['blogname'] = $blog->getName(); + }else{ + $itemData = array(); + $itemData['url'] = $CONF['IndexURL']; + $itemData['blogname'] = $CONF['SiteName']; + } + $oTemplate->set('item', $itemData); + + $oTemplate->template('templates/ping.html'); + break; + } + + // Pages + switch($action) { + + case 'help': + $oTemplate->template('help.html'); + break; + + case 'ping': + $oTemplate->template('templates/ping.html'); + break; + + case 'blocked': + case 'all': + $rres = sql_query (" + SELECT + COUNT(*) AS count + FROM + ".sql_table('plugin_tb')." AS t, + ".sql_table('item')." AS i + WHERE + t.tb_id = i.inumber AND + t.block = " . (( $action == 'all') ? 0 : 1) . $whereClause ); + + if ($row = mysql_fetch_array($rres)) + $count = $row['count']; + else + $count = 0; + $oTemplate->set('count', $count); + + if($ajaxEnabled){ + if( $action == 'all') + $oTemplate->template('templates/all_ajax.html'); + else + $oTemplate->template('templates/blocked_ajax.html'); + } else { + $start = intRequestVar('start') ? intRequestVar('start') : 0; + $amount = intRequestVar('amount') ? intRequestVar('amount') : 25; + + $rres = sql_query (" + SELECT + i.ititle AS story, + i.inumber AS story_id, + t.id AS id, + t.title AS title, + t.blog_name AS blog_name, + t.excerpt AS excerpt, + t.url AS url, + UNIX_TIMESTAMP(t.timestamp) AS timestamp, + t.spam AS spam, + t.link AS link + FROM + ".sql_table('plugin_tb')." AS t, + ".sql_table('item')." AS i + WHERE + t.tb_id = i.inumber AND + t.block = " . (( $action == 'all') ? 0 : 1) . $whereClause ." + ORDER BY + timestamp DESC + LIMIT + ".$start.",".$amount); + + $items = array(); + + while ($rrow = mysql_fetch_array($rres)){ + $rrow['title'] = $oPluginAdmin->plugin->_cut_string($rrow['title'], 50); + $rrow['title'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['title']); + $rrow['title'] = htmlspecialchars($rrow['title']); + + $rrow['blog_name'] = $oPluginAdmin->plugin->_cut_string($rrow['blog_name'], 50); + $rrow['blog_name'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['blog_name']); + $rrow['blog_name'] = htmlspecialchars($rrow['blog_name']); + + $rrow['excerpt'] = $oPluginAdmin->plugin->_cut_string($rrow['excerpt'], 800); + $rrow['excerpt'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['excerpt']); + $rrow['excerpt'] = htmlspecialchars($rrow['excerpt']); + + $rrow['url'] = htmlspecialchars($rrow['url'], ENT_QUOTES); + $rrow['timestamp'] = htmlspecialchars($rrow['timestamp'], ENT_QUOTES); + + $blog = & $manager->getBlog(getBlogIDFromItemID($item['itemid'])); + $rrow['story_url'] = $oPluginAdmin->plugin->_createItemLink($rrow['story_id'], $blog); + $rrow['story'] = htmlspecialchars(strip_tags($rrow['story']), ENT_QUOTES); + + $items[] = $rrow; + } + + $oTemplate->set('amount', $amount); + $oTemplate->set('start', $start); + $oTemplate->set('items', $items); + + if( $action == 'all') + $oTemplate->template('templates/all.html'); + else + $oTemplate->template('templates/blocked.html'); + } + break; + + case 'list': + $id = requestVar('id'); + $start = intRequestVar('start') ? intRequestVar('start') : 0; + $amount = intRequestVar('amount') ? intRequestVar('amount') : 25; + + $ires = sql_query (" + SELECT + i.ititle, + i.inumber + FROM + ".sql_table('item')." i + WHERE + i.inumber = '".$id."' + ". $whereClause ); + + if ($irow = mysql_fetch_array($ires)) + { + $story['id'] = $id; + $story['title'] = $irow['ititle']; + + $rres = sql_query (" + SELECT + COUNT(*) AS count + FROM + ".sql_table('plugin_tb')." AS t + WHERE + t.tb_id = '".$id."' AND + t.block = 0 + "); + + if ($row = mysql_fetch_array($rres)) + $count = $row['count']; + else + $count = 0; + + $rres = sql_query (" + SELECT + t.id AS id, + t.title AS title, + t.blog_name AS blog_name, + t.excerpt AS excerpt, + t.url AS url, + UNIX_TIMESTAMP(t.timestamp) AS timestamp + FROM + ".sql_table('plugin_tb')." AS t + WHERE + t.tb_id = '".$id."' AND + t.block = 0 + ORDER BY + timestamp DESC + LIMIT + ".$start.",".$amount." + "); + + $items = array(); + + while ($rrow = mysql_fetch_array($rres)) + { + $rrow['title'] = $oPluginAdmin->plugin->_cut_string($rrow['title'], 50); + $rrow['title'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['title']); + $rrow['title'] = htmlspecialchars($rrow['title']); +// $rrow['title'] = _CHARSET == 'UTF-8' ? $rrow['title'] : $oPluginAdmin->plugin->_utf8_to_entities($rrow['title']); + + $rrow['blog_name'] = $oPluginAdmin->plugin->_cut_string($rrow['blog_name'], 50); + $rrow['blog_name'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['blog_name']); + $rrow['blog_name'] = htmlspecialchars($rrow['blog_name']); +// $rrow['blog_name'] = _CHARSET == 'UTF-8' ? $rrow['blog_name'] : $oPluginAdmin->plugin->_utf8_to_entities($rrow['blog_name']); + + $rrow['excerpt'] = $oPluginAdmin->plugin->_cut_string($rrow['excerpt'], 800); + $rrow['excerpt'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['excerpt']); + $rrow['excerpt'] = htmlspecialchars($rrow['excerpt']); +// $rrow['excerpt'] = _CHARSET == 'UTF-8' ? $rrow['excerpt'] : $oPluginAdmin->plugin->_utf8_to_entities($rrow['excerpt']); + + $rrow['url'] = htmlspecialchars($rrow['url'], ENT_QUOTES); + $rrow['story'] = htmlspecialchars(strip_tags($rrow['story']), ENT_QUOTES); + $items[] = $rrow; + } + + $oTemplate->set ('amount', $amount); + $oTemplate->set ('count', $count); + $oTemplate->set ('start', $start); + $oTemplate->set ('items', $items); + $oTemplate->set ('story', $story); + $oTemplate->template('templates/list.html'); + } + + break; + + + case 'index': + $bres = sql_query (" + SELECT + bnumber AS bnumber, + bname AS bname, + burl AS burl + FROM + ".sql_table('blog')." + ORDER BY + bname + "); + + $blogs = array(); + + while ($brow = mysql_fetch_array($bres)) + { + if( !$member->isTeamMember($brow['bnumber']) ) continue; + $ires = sql_query (" + SELECT + i.inumber AS inumber, + i.ititle AS ititle, + COUNT(*) AS total + FROM + ".sql_table('item')." AS i, + ".sql_table('plugin_tb')." AS t + WHERE + i.iblog = ".$brow['bnumber']." AND + t.tb_id = i.inumber AND + t.block = 0 ".$whereClause." + GROUP BY + i.inumber + ORDER BY + i.inumber DESC + "); + + $items = array(); + + while ($irow = mysql_fetch_array($ires)) + { + $items[] = $irow; + } + + $brow['items'] = $items; + $blogs[] = $brow; + } + + $oTemplate->set ('blogs', $blogs); + $oTemplate->template('templates/index.html'); + break; + + default: + //modify start+++++++++ + if(!$tableVersion){ + $oTemplate->template('templates/updatetable.html'); + } + //modify end+++++++++ + break; + } + + // Create the admin area page + echo $oTemplate->fetch(); + + echo '+Nucleus CMS Japan Wiki¤ÎNP_TrackBack¤Î¥Ú¡¼¥¸¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£ +
+ ++ ¥È¥é¥Ã¥¯¥Ð¥Ã¥¯´ØÏ¢¤Îɽ¼¨ÊýË¡¤Ï¥Æ¥ó¥×¥ì¡¼¥È¤òÊÔ½¸¤¹¤ë¤³¤È¤Ë¤è¤Ã¤Æ¥«¥¹¥¿¥Þ¥¤¥º¤Ç¤¤Þ¤¹¤¬¡¢¿§¤ä;Çò¤Ê¤É¤Î¥Ç¥¶¥¤¥ó¤ÏCSS¦¤Ç»ØÄꤹ¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£¥Æ¥ó¥×¥ì¡¼¥ÈÆâ¤ËÆþÎϤ·¤¿¥¯¥é¥¹Ì¾¤Î¥×¥í¥Ñ¥Æ¥£¤Ïcss¤Ç»ØÄꤷ¤Æ¤¯¤À¤µ¤¤¡£¥Ç¥Õ¥©¥ë¥È¤Î¥Æ¥ó¥×¥ì¡¼¥È¤ò¾þ¤ëCSS¥×¥í¥Ñ¥Æ¥£¤ÎÎã¤ò¤¢¤²¤Æ¤ª¤¤Þ¤¹¡£ +
+ +div.tb { + border: 1px solid #000; background: #FFF; +} +div.tb div.head { + padding: 4px; + background: #000; color: #FFF; + font-weight: bold; text-transform: lowercase; letter-spacing: 0.6em; +} +div.tb div.empty { + padding: 4px; + font-size: 95%; +} +div.tb div.item { + padding: 4px; +} +div.tb div.item div.name { + margin-bottom: 8px; + font-size: 120%; font-weight: bold; +} +div.tb div.item div.body { + font-size: 95%; +} +div.tb div.item div.body a { + font-weight: bold; +} +div.tb div.item div.date { + margin-bottom: 8px; + color: #888; + font-size: 85%; text-align: right; +} +div.tb div.info { + padding: 4px; + color: #FFF; background: #888; + font-size: 85%; font-style: italic; +}+ +
+ 0): ?> + + + | ++ + + + | +
Date | +Story | +Title, Blog and Excerpt | +Actions | +|
---|---|---|---|---|
+ + | ++ + | +
+
+
+ () + + |
+ + + | ++ + | +
+ 0): ?> + + + | ++ + + + | +
+ | id | +Date | +Story | +Title, Blog and Excerpt | ++ |
---|
+ 0): ?> + + + | ++ + + + | +
Date | +Story | +Title, Blog and Excerpt | +Actions | +|
---|---|---|---|---|
+ + | ++ + | +
+
+
+ ()
+ ' :
+ '';?>
+ ';?>
+ + + |
+ + + | ++ + | +
+ 0): ?> + + + | ++ + + + | +
+ | id | +Date | +Story | +Title, Blog and Excerpt | ++ |
---|
+ ¥È¥é¥Ã¥¯¥Ð¥Ã¥¯¤ÎÁ÷¿®¤¬´°Î»¤·¤Þ¤·¤¿ +
+ + ++ +
+ + + + + + \ No newline at end of file diff --git a/NP_TrackBack/branches/DOM-branch/trackback/japanese-euc.templates/index.html b/NP_TrackBack/branches/DOM-branch/trackback/japanese-euc.templates/index.html new file mode 100644 index 0000000..a2a00ed --- /dev/null +++ b/NP_TrackBack/branches/DOM-branch/trackback/japanese-euc.templates/index.html @@ -0,0 +1,34 @@ + +Blog: | +Total | +Action | +
---|---|---|
+ + | ++ + | ++ Trackbacks + | +
+ 0): ?> + + + | ++ + + + | +
Date | +Title, Blog and Excerpt | +Actions | +|
---|---|---|---|
+ + | +
+
+
+ () + + |
+ + + | ++ + | +
+ 0): ?> + + + | ++ + + + | +
¥¢¥Ã¥×¥Ç¡¼¥È¤¬É¬ÍפǤ¹:+ diff --git a/NP_TrackBack/branches/DOM-branch/trackback/japanese-euc.templates/updatetablefinished.html b/NP_TrackBack/branches/DOM-branch/trackback/japanese-euc.templates/updatetablefinished.html new file mode 100644 index 0000000..a16df97 --- /dev/null +++ b/NP_TrackBack/branches/DOM-branch/trackback/japanese-euc.templates/updatetablefinished.html @@ -0,0 +1,5 @@ + +
+¤³¤Î¥Ð¡¼¥¸¥ç¥ó¤Ç±¿ÍѤ¹¤ë¤¿¤á¤Ë¤ÏDBÆâ¤Î¥Æ¡¼¥Ö¥ë¤Î¥¢¥Ã¥×¥Ç¡¼¥È¤¬É¬ÍפǤ¹¡£
+º£¤Þ¤Ç¤Î¥Ç¡¼¥¿¤¬ºï½ü¤µ¤ì¤ë¤³¤È¤Ï¤¢¤ê¤Þ¤»¤ó¡£ +²¼¤Î¥¢¥Ã¥×¥Ç¡¼¥È¥Ü¥¿¥ó¤ò²¡¤·¤Æ¤¯¤À¤µ¤¤¡£ + + +
+¥Æ¡¼¥Ö¥ë¤Î¥¢¥Ã¥×¥Ç¡¼¥È¤Ï´°Î»¤·¤Þ¤·¤¿¡£ ++ diff --git a/NP_TrackBack/branches/DOM-branch/trackback/japanese-utf8.help.html b/NP_TrackBack/branches/DOM-branch/trackback/japanese-utf8.help.html new file mode 100644 index 0000000..752f956 --- /dev/null +++ b/NP_TrackBack/branches/DOM-branch/trackback/japanese-utf8.help.html @@ -0,0 +1,116 @@ +
+Nucleus CMS Japan Wikiã®NP_TrackBackã®ãã¼ã¸ãåç §ãã¦ãã ããã +
+ ++ ãã©ãã¯ããã¯é¢é£ã®è¡¨ç¤ºæ¹æ³ã¯ãã³ãã¬ã¼ããç·¨éãããã¨ã«ãã£ã¦ã«ã¹ã¿ãã¤ãºã§ãã¾ãããè²ãä½ç½ãªã©ã®ãã¶ã¤ã³ã¯CSSå´ã§æå®ããå¿ è¦ãããã¾ãããã³ãã¬ã¼ãå ã«å ¥åããã¯ã©ã¹åã®ããããã£ã¯cssã§æå®ãã¦ãã ãããããã©ã«ãã®ãã³ãã¬ã¼ãã飾ãCSSããããã£ã®ä¾ãããã¦ããã¾ãã +
+ +div.tb { + border: 1px solid #000; background: #FFF; +} +div.tb div.head { + padding: 4px; + background: #000; color: #FFF; + font-weight: bold; text-transform: lowercase; letter-spacing: 0.6em; +} +div.tb div.empty { + padding: 4px; + font-size: 95%; +} +div.tb div.item { + padding: 4px; +} +div.tb div.item div.name { + margin-bottom: 8px; + font-size: 120%; font-weight: bold; +} +div.tb div.item div.body { + font-size: 95%; +} +div.tb div.item div.body a { + font-weight: bold; +} +div.tb div.item div.date { + margin-bottom: 8px; + color: #888; + font-size: 85%; text-align: right; +} +div.tb div.info { + padding: 4px; + color: #FFF; background: #888; + font-size: 85%; font-style: italic; +}+ +
+ 0): ?> + + + | ++ + + + | +
Date | +Story | +Title, Blog and Excerpt | +Actions | +|
---|---|---|---|---|
+ + | ++ + | +
+
+
+ () + + |
+ + + | ++ + | +
+ 0): ?> + + + | ++ + + + | +
+ | id | +Date | +Story | +Title, Blog and Excerpt | ++ |
---|
+ 0): ?> + + + | ++ + + + | +
Date | +Story | +Title, Blog and Excerpt | +Actions | +|
---|---|---|---|---|
+ + | ++ + | +
+
+
+ ()
+ ' :
+ '';?>
+ ';?>
+ + + |
+ + + | ++ + | +
+ 0): ?> + + + | ++ + + + | +
+ | id | +Date | +Story | +Title, Blog and Excerpt | ++ |
---|
+ ãã©ãã¯ããã¯ã®éä¿¡ãå®äºãã¾ãã +
+ + ++ +
+ + + + + + \ No newline at end of file diff --git a/NP_TrackBack/branches/DOM-branch/trackback/japanese-utf8.templates/index.html b/NP_TrackBack/branches/DOM-branch/trackback/japanese-utf8.templates/index.html new file mode 100644 index 0000000..15a2ce4 --- /dev/null +++ b/NP_TrackBack/branches/DOM-branch/trackback/japanese-utf8.templates/index.html @@ -0,0 +1,34 @@ + +Blog: | +Total | +Action | +
---|---|---|
+ + | ++ + | ++ Trackbacks + | +
+ 0): ?> + + + | ++ + + + | +
Date | +Title, Blog and Excerpt | +Actions | +|
---|---|---|---|
+ + | +
+
+
+ () + + |
+ + + | ++ + | +
+ 0): ?> + + + | ++ + + + | +
ã¢ãããã¼ããå¿ è¦ã§ã:+ diff --git a/NP_TrackBack/branches/DOM-branch/trackback/japanese-utf8.templates/updatetablefinished.html b/NP_TrackBack/branches/DOM-branch/trackback/japanese-utf8.templates/updatetablefinished.html new file mode 100644 index 0000000..6b1ea94 --- /dev/null +++ b/NP_TrackBack/branches/DOM-branch/trackback/japanese-utf8.templates/updatetablefinished.html @@ -0,0 +1,5 @@ + +
+ãã®ãã¼ã¸ã§ã³ã§éç¨ããããã«ã¯DBå ã®ãã¼ãã«ã®ã¢ãããã¼ããå¿ è¦ã§ãã
+ä»ã¾ã§ã®ãã¼ã¿ãåé¤ããããã¨ã¯ããã¾ããã +ä¸ã®ã¢ãããã¼ããã¿ã³ãæ¼ãã¦ãã ããã + + +
+ãã¼ãã«ã®ã¢ãããã¼ãã¯å®äºãã¾ããã ++ diff --git a/NP_TrackBack/branches/DOM-branch/trackback/js/prototype.js b/NP_TrackBack/branches/DOM-branch/trackback/js/prototype.js new file mode 100644 index 0000000..5d2100f --- /dev/null +++ b/NP_TrackBack/branches/DOM-branch/trackback/js/prototype.js @@ -0,0 +1,3271 @@ +/* Prototype JavaScript framework, version 1.5.1 + * (c) 2005-2007 Sam Stephenson + * + * Prototype is freely distributable under the terms of an MIT-style license. + * For details, see the Prototype web site: http://www.prototypejs.org/ + * +/*--------------------------------------------------------------------------*/ + +var Prototype = { + Version: '1.5.1', + + Browser: { + IE: !!(window.attachEvent && !window.opera), + Opera: !!window.opera, + WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1, + Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1 + }, + + BrowserFeatures: { + XPath: !!document.evaluate, + ElementExtensions: !!window.HTMLElement, + SpecificElementExtensions: + (document.createElement('div').__proto__ !== + document.createElement('form').__proto__) + }, + + ScriptFragment: '', + JSONFilter: /^\/\*-secure-\s*(.*)\s*\*\/\s*$/, + + emptyFunction: function() { }, + K: function(x) { return x } +} + +var Class = { + create: function() { + return function() { + this.initialize.apply(this, arguments); + } + } +} + +var Abstract = new Object(); + +Object.extend = function(destination, source) { + for (var property in source) { + destination[property] = source[property]; + } + return destination; +} + +Object.extend(Object, { + inspect: function(object) { + try { + if (object === undefined) return 'undefined'; + if (object === null) return 'null'; + return object.inspect ? object.inspect() : object.toString(); + } catch (e) { + if (e instanceof RangeError) return '...'; + throw e; + } + }, + + toJSON: function(object) { + var type = typeof object; + switch(type) { + case 'undefined': + case 'function': + case 'unknown': return; + case 'boolean': return object.toString(); + } + if (object === null) return 'null'; + if (object.toJSON) return object.toJSON(); + if (object.ownerDocument === document) return; + var results = []; + for (var property in object) { + var value = Object.toJSON(object[property]); + if (value !== undefined) + results.push(property.toJSON() + ': ' + value); + } + return '{' + results.join(', ') + '}'; + }, + + keys: function(object) { + var keys = []; + for (var property in object) + keys.push(property); + return keys; + }, + + values: function(object) { + var values = []; + for (var property in object) + values.push(object[property]); + return values; + }, + + clone: function(object) { + return Object.extend({}, object); + } +}); + +Function.prototype.bind = function() { + var __method = this, args = $A(arguments), object = args.shift(); + return function() { + return __method.apply(object, args.concat($A(arguments))); + } +} + +Function.prototype.bindAsEventListener = function(object) { + var __method = this, args = $A(arguments), object = args.shift(); + return function(event) { + return __method.apply(object, [event || window.event].concat(args)); + } +} + +Object.extend(Number.prototype, { + toColorPart: function() { + return this.toPaddedString(2, 16); + }, + + succ: function() { + return this + 1; + }, + + times: function(iterator) { + $R(0, this, true).each(iterator); + return this; + }, + + toPaddedString: function(length, radix) { + var string = this.toString(radix || 10); + return '0'.times(length - string.length) + string; + }, + + toJSON: function() { + return isFinite(this) ? this.toString() : 'null'; + } +}); + +Date.prototype.toJSON = function() { + return '"' + this.getFullYear() + '-' + + (this.getMonth() + 1).toPaddedString(2) + '-' + + this.getDate().toPaddedString(2) + 'T' + + this.getHours().toPaddedString(2) + ':' + + this.getMinutes().toPaddedString(2) + ':' + + this.getSeconds().toPaddedString(2) + '"'; +}; + +var Try = { + these: function() { + var returnValue; + + for (var i = 0, length = arguments.length; i < length; i++) { + var lambda = arguments[i]; + try { + returnValue = lambda(); + break; + } catch (e) {} + } + + return returnValue; + } +} + +/*--------------------------------------------------------------------------*/ + +var PeriodicalExecuter = Class.create(); +PeriodicalExecuter.prototype = { + initialize: function(callback, frequency) { + this.callback = callback; + this.frequency = frequency; + this.currentlyExecuting = false; + + this.registerCallback(); + }, + + registerCallback: function() { + this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); + }, + + stop: function() { + if (!this.timer) return; + clearInterval(this.timer); + this.timer = null; + }, + + onTimerEvent: function() { + if (!this.currentlyExecuting) { + try { + this.currentlyExecuting = true; + this.callback(this); + } finally { + this.currentlyExecuting = false; + } + } + } +} +Object.extend(String, { + interpret: function(value) { + return value == null ? '' : String(value); + }, + specialChar: { + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '\\': '\\\\' + } +}); + +Object.extend(String.prototype, { + gsub: function(pattern, replacement) { + var result = '', source = this, match; + replacement = arguments.callee.prepareReplacement(replacement); + + while (source.length > 0) { + if (match = source.match(pattern)) { + result += source.slice(0, match.index); + result += String.interpret(replacement(match)); + source = source.slice(match.index + match[0].length); + } else { + result += source, source = ''; + } + } + return result; + }, + + sub: function(pattern, replacement, count) { + replacement = this.gsub.prepareReplacement(replacement); + count = count === undefined ? 1 : count; + + return this.gsub(pattern, function(match) { + if (--count < 0) return match[0]; + return replacement(match); + }); + }, + + scan: function(pattern, iterator) { + this.gsub(pattern, iterator); + return this; + }, + + truncate: function(length, truncation) { + length = length || 30; + truncation = truncation === undefined ? '...' : truncation; + return this.length > length ? + this.slice(0, length - truncation.length) + truncation : this; + }, + + strip: function() { + return this.replace(/^\s+/, '').replace(/\s+$/, ''); + }, + + stripTags: function() { + return this.replace(/<\/?[^>]+>/gi, ''); + }, + + stripScripts: function() { + return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); + }, + + extractScripts: function() { + var matchAll = new RegExp(Prototype.ScriptFragment, 'img'); + var matchOne = new RegExp(Prototype.ScriptFragment, 'im'); + return (this.match(matchAll) || []).map(function(scriptTag) { + return (scriptTag.match(matchOne) || ['', ''])[1]; + }); + }, + + evalScripts: function() { + return this.extractScripts().map(function(script) { return eval(script) }); + }, + + escapeHTML: function() { + var self = arguments.callee; + self.text.data = this; + return self.div.innerHTML; + }, + + unescapeHTML: function() { + var div = document.createElement('div'); + div.innerHTML = this.stripTags(); + return div.childNodes[0] ? (div.childNodes.length > 1 ? + $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) : + div.childNodes[0].nodeValue) : ''; + }, + + toQueryParams: function(separator) { + var match = this.strip().match(/([^?#]*)(#.*)?$/); + if (!match) return {}; + + return match[1].split(separator || '&').inject({}, function(hash, pair) { + if ((pair = pair.split('='))[0]) { + var key = decodeURIComponent(pair.shift()); + var value = pair.length > 1 ? pair.join('=') : pair[0]; + if (value != undefined) value = decodeURIComponent(value); + + if (key in hash) { + if (hash[key].constructor != Array) hash[key] = [hash[key]]; + hash[key].push(value); + } + else hash[key] = value; + } + return hash; + }); + }, + + toArray: function() { + return this.split(''); + }, + + succ: function() { + return this.slice(0, this.length - 1) + + String.fromCharCode(this.charCodeAt(this.length - 1) + 1); + }, + + times: function(count) { + var result = ''; + for (var i = 0; i < count; i++) result += this; + return result; + }, + + camelize: function() { + var parts = this.split('-'), len = parts.length; + if (len == 1) return parts[0]; + + var camelized = this.charAt(0) == '-' + ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1) + : parts[0]; + + for (var i = 1; i < len; i++) + camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1); + + return camelized; + }, + + capitalize: function() { + return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); + }, + + underscore: function() { + return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase(); + }, + + dasherize: function() { + return this.gsub(/_/,'-'); + }, + + inspect: function(useDoubleQuotes) { + var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) { + var character = String.specialChar[match[0]]; + return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16); + }); + if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"'; + return "'" + escapedString.replace(/'/g, '\\\'') + "'"; + }, + + toJSON: function() { + return this.inspect(true); + }, + + unfilterJSON: function(filter) { + return this.sub(filter || Prototype.JSONFilter, '#{1}'); + }, + + evalJSON: function(sanitize) { + var json = this.unfilterJSON(); + try { + if (!sanitize || (/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(json))) + return eval('(' + json + ')'); + } catch (e) { } + throw new SyntaxError('Badly formed JSON string: ' + this.inspect()); + }, + + include: function(pattern) { + return this.indexOf(pattern) > -1; + }, + + startsWith: function(pattern) { + return this.indexOf(pattern) === 0; + }, + + endsWith: function(pattern) { + var d = this.length - pattern.length; + return d >= 0 && this.lastIndexOf(pattern) === d; + }, + + empty: function() { + return this == ''; + }, + + blank: function() { + return /^\s*$/.test(this); + } +}); + +if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, { + escapeHTML: function() { + return this.replace(/&/g,'&').replace(//g,'>'); + }, + unescapeHTML: function() { + return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); + } +}); + +String.prototype.gsub.prepareReplacement = function(replacement) { + if (typeof replacement == 'function') return replacement; + var template = new Template(replacement); + return function(match) { return template.evaluate(match) }; +} + +String.prototype.parseQuery = String.prototype.toQueryParams; + +Object.extend(String.prototype.escapeHTML, { + div: document.createElement('div'), + text: document.createTextNode('') +}); + +with (String.prototype.escapeHTML) div.appendChild(text); + +var Template = Class.create(); +Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; +Template.prototype = { + initialize: function(template, pattern) { + this.template = template.toString(); + this.pattern = pattern || Template.Pattern; + }, + + evaluate: function(object) { + return this.template.gsub(this.pattern, function(match) { + var before = match[1]; + if (before == '\\') return match[2]; + return before + String.interpret(object[match[3]]); + }); + } +} + +var $break = {}, $continue = new Error('"throw $continue" is deprecated, use "return" instead'); + +var Enumerable = { + each: function(iterator) { + var index = 0; + try { + this._each(function(value) { + iterator(value, index++); + }); + } catch (e) { + if (e != $break) throw e; + } + return this; + }, + + eachSlice: function(number, iterator) { + var index = -number, slices = [], array = this.toArray(); + while ((index += number) < array.length) + slices.push(array.slice(index, index+number)); + return slices.map(iterator); + }, + + all: function(iterator) { + var result = true; + this.each(function(value, index) { + result = result && !!(iterator || Prototype.K)(value, index); + if (!result) throw $break; + }); + return result; + }, + + any: function(iterator) { + var result = false; + this.each(function(value, index) { + if (result = !!(iterator || Prototype.K)(value, index)) + throw $break; + }); + return result; + }, + + collect: function(iterator) { + var results = []; + this.each(function(value, index) { + results.push((iterator || Prototype.K)(value, index)); + }); + return results; + }, + + detect: function(iterator) { + var result; + this.each(function(value, index) { + if (iterator(value, index)) { + result = value; + throw $break; + } + }); + return result; + }, + + findAll: function(iterator) { + var results = []; + this.each(function(value, index) { + if (iterator(value, index)) + results.push(value); + }); + return results; + }, + + grep: function(pattern, iterator) { + var results = []; + this.each(function(value, index) { + var stringValue = value.toString(); + if (stringValue.match(pattern)) + results.push((iterator || Prototype.K)(value, index)); + }) + return results; + }, + + include: function(object) { + var found = false; + this.each(function(value) { + if (value == object) { + found = true; + throw $break; + } + }); + return found; + }, + + inGroupsOf: function(number, fillWith) { + fillWith = fillWith === undefined ? null : fillWith; + return this.eachSlice(number, function(slice) { + while(slice.length < number) slice.push(fillWith); + return slice; + }); + }, + + inject: function(memo, iterator) { + this.each(function(value, index) { + memo = iterator(memo, value, index); + }); + return memo; + }, + + invoke: function(method) { + var args = $A(arguments).slice(1); + return this.map(function(value) { + return value[method].apply(value, args); + }); + }, + + max: function(iterator) { + var result; + this.each(function(value, index) { + value = (iterator || Prototype.K)(value, index); + if (result == undefined || value >= result) + result = value; + }); + return result; + }, + + min: function(iterator) { + var result; + this.each(function(value, index) { + value = (iterator || Prototype.K)(value, index); + if (result == undefined || value < result) + result = value; + }); + return result; + }, + + partition: function(iterator) { + var trues = [], falses = []; + this.each(function(value, index) { + ((iterator || Prototype.K)(value, index) ? + trues : falses).push(value); + }); + return [trues, falses]; + }, + + pluck: function(property) { + var results = []; + this.each(function(value, index) { + results.push(value[property]); + }); + return results; + }, + + reject: function(iterator) { + var results = []; + this.each(function(value, index) { + if (!iterator(value, index)) + results.push(value); + }); + return results; + }, + + sortBy: function(iterator) { + return this.map(function(value, index) { + return {value: value, criteria: iterator(value, index)}; + }).sort(function(left, right) { + var a = left.criteria, b = right.criteria; + return a < b ? -1 : a > b ? 1 : 0; + }).pluck('value'); + }, + + toArray: function() { + return this.map(); + }, + + zip: function() { + var iterator = Prototype.K, args = $A(arguments); + if (typeof args.last() == 'function') + iterator = args.pop(); + + var collections = [this].concat(args).map($A); + return this.map(function(value, index) { + return iterator(collections.pluck(index)); + }); + }, + + size: function() { + return this.toArray().length; + }, + + inspect: function() { + return '#
' + html.stripScripts() + ' |
' + html.stripScripts() + ' |
fmt may contain:
1) this.exportText+=" colspan='"+newSpan+"'"; + this.exportText+=">"+RicoUtil.getInnerText(cell)+" | "; + } + } + this.exportText+=""; + } + + for (var c=0; c
index | "; + tokensHtml += "type | "; + tokensHtml += "subtype | "; + tokensHtml += "token | "; + tokensHtml += "token tree |
" + (this.tokens.index + 1) + " | "; + tokensHtml += "" + token.type + " | "; + tokensHtml += "" + ((token.subtype.length == 0) ? " " : token.subtype) + " | "; + tokensHtml += "" + ((token.value.length == 0) ? " " : token.value).split(" ").join(" ") + " | "; + tokensHtml += "" + indent() + ((token.value.length == 0) ? " " : token.value).split(" ").join(" ") + " | "; + + tokensHtml += "
+ 0): ?> + + + | ++ + + + | +
Date | +Story | +Title, Blog and Excerpt | +Actions | +|
---|---|---|---|---|
+ + | ++ + | +
+
+
+ () + + |
+ + + | ++ + | +
+ 0): ?> + + + | ++ + + + | +
+ | id | +Date | +Story | +Title, Blog and Excerpt | ++ |
---|
+ 0): ?> + + + | ++ + + + | +
Date | +Story | +Title, Blog and Excerpt | +Actions | +|
---|---|---|---|---|
+ + | ++ + | +
+ ">
+
+ ()
+ ' :
+ '';?>
+ ';?>
+ + + |
+ + + | ++ + | +
+ 0): ?> + + + | ++ + + + | +
+ | id | +Date | +Story | +Title, Blog and Excerpt | ++ |
---|
+ Your trackback has been received properly. +
+ + ++ +
+ + + + + + \ No newline at end of file diff --git a/NP_TrackBack/branches/DOM-branch/trackback/templates/index.html b/NP_TrackBack/branches/DOM-branch/trackback/templates/index.html new file mode 100644 index 0000000..15a2ce4 --- /dev/null +++ b/NP_TrackBack/branches/DOM-branch/trackback/templates/index.html @@ -0,0 +1,34 @@ + +Blog: | +Total | +Action | +
---|---|---|
+ + | ++ + | ++ Trackbacks + | +
+ 0): ?> + + + | ++ + + + | +
Date | +Title, Blog and Excerpt | +Actions | +|
---|---|---|---|
+ + | +
+
+
+ () + + |
+ + + | ++ + | +
+ 0): ?> + + + | ++ + + + | +
Table update:+ diff --git a/NP_TrackBack/branches/DOM-branch/trackback/templates/updatetablefinished.html b/NP_TrackBack/branches/DOM-branch/trackback/templates/updatetablefinished.html new file mode 100644 index 0000000..d94969e --- /dev/null +++ b/NP_TrackBack/branches/DOM-branch/trackback/templates/updatetablefinished.html @@ -0,0 +1,5 @@ + +
+ +
+Table update done ! ++ diff --git a/NP_TrackBack/trunk/NP_TrackBack.php b/NP_TrackBack/trunk/NP_TrackBack.php new file mode 100644 index 0000000..83ccb06 --- /dev/null +++ b/NP_TrackBack/trunk/NP_TrackBack.php @@ -0,0 +1,2586 @@ +isError = false; + $this->inTarget = false; + } + + function parse($data){ + $rx = '/(<'.'?xml.*encoding=[\'"])(.*?)([\'"].*?'.'>)/m'; + if (preg_match($rx, $data, $m)) { + $encoding = strtoupper($m[2]); + } else { + $encoding = mb_detect_encoding($data, NP_TRACKBACK_ENCODING_DETECT_ORDER); + } + + if($encoding == "UTF-8" || $encoding == "ISO-8859-1") { + // noting + } else { + $data = @mb_convert_encoding($data, "UTF-8", $encoding); + $data = str_replace ( $m[0], $m[1].'UTF-8'.$m[3], $data); + $encoding = 'UTF-8'; + } + + $this->parser = xml_parser_create($encoding); + xml_set_object($this->parser, $this); + xml_set_element_handler($this->parser, "_open", "_close"); + xml_set_character_data_handler($this->parser, "_cdata"); + xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, 'UTF-8'). + + $this->words = array(); + xml_parse($this->parser, $data); + $errcode = xml_get_error_code($this->parser); + if ( $errcode != XML_ERROR_NONE ) { + $this->isError = true; + $this->message = 'XML Parse Error: ' . xml_error_string($errcode) . ' in '. xml_get_current_line_number($this->parser); + } + return $this->message; + } + + function free(){ + xml_parser_free($this->parser); + } + + function _open($parser, $name, $attribute){ + switch( $name ){ + case 'MESSAGE': + $this->inTarget = 'MESSAGE'; + break; + case 'ERROR': + $this->inTarget = 'ERROR'; + break; + } + } + + function _close($parser, $name){ + if( $name == $this->inTarget ) $this->inTarget = null; + } + + function _cdata($parser, $data){ + switch( $this->inTarget ){ + case 'MESSAGE': + $this->message = trim($data); + break; + case 'ERROR': + $this->isError = ($data ? true : false); + break; + } + } + } + + class NP_TrackBack extends NucleusPlugin { + var $useCurl = 1; // use curl? 2:precheck+read by curl, 1: read by curl 0: fread + +//modify start+++++++++ + function _createItemLink($itemid, $b){ + global $CONF, $manager; + + $itemLink = createItemLink($itemid,''); + if( strpos($itemLink, 'http') === 0 ){ + return $itemLink; + } + + $blogurl = $b->getURL(); + if (!$blogurl) { + $b =& $manager->getBlog($CONF['DefaultBlog']); + $blogurl = $b->getURL(); + if (!$blogurl) { + $blogurl = $CONF['IndexURL']; + } + } + + if(substr($blogurl, -1) == '/') $blogurl = substr($blogurl, 0, -1); + $usePathInfo = ($CONF['URLMode'] == 'pathinfo'); + $itemUrlOrg = $CONF['ItemURL']; + if( ! ($usePathInfo || substr($blogurl, -4) == '.php') ) $blogurl .= '/index.php'; + $CONF['ItemURL'] = $blogurl; + + $itemLink = createItemLink($itemid,''); + $CONF['ItemURL'] = $itemUrlOrg; + + return $itemLink; + } +//modify end+++++++++ + + /************************************************************************************** + * SKIN VARS, TEMPLATE VARS AND ACTIONS + */ + + /* + * TrackBack data can be inserted using skinvars (or templatevars) + */ + function doSkinVar($skinType, $what = '', $tb_id = '', $amount = 'limit-1') { + + global $itemid, $manager, $CONF; + +//modify start+++++++++ + if(preg_match('/limit/i', $tb_id)){ + $amount = $tb_id; + $tb_id = ''; + } + $amount = intval(str_replace('limit', '', $amount)); +//modify end+++++++++ + + if ($tb_id == '') $tb_id = intval($itemid); + +//mod by cles + $isAcceptPing = $this->isAcceptTrackBack($tb_id); + + //if( $skinType == 'template' && (! $isAcceptPing ) ){ + // return; + //} +//mod by cles end + switch ($what) { + + // Insert Auto-discovery RDF code + case 'tbcode': + case 'code': +//mod by cles +// if($skinType == 'item') + + $spamcheck = array ( + 'type' => 'tbcode', + 'id' => -1, + 'title' => '', + 'excerpt' => '', + 'blogname' => '', + 'url' => '', + 'return' => true, + 'live' => true, + + /* Backwards compatibility with SpamCheck API 1*/ + 'data' => '', + 'ipblock' => true, + ); + global $manager; + //$manager->notify('SpamCheck', array ('spamcheck' => & $spamcheck)); + $spam = false; + if (isset($spamcheck['result']) && $spamcheck['result'] == true){ + $spam = true; + } + + if( ($skinType == 'item') && (!$spam) && $isAcceptPing ) +//mod by cles end + $this->insertCode($tb_id); + break; + + // Insert TrackBack URL + case 'tburl': + case 'url': +//mod by cles +// echo $this->getTrackBackUrl($tb_id); + if($isAcceptPing) + echo $this->getTrackBackUrl($tb_id); + else + echo 'Sorry, no trackback pings are accepted.'; +//mod by cles end + break; + + // Insert manual ping URL + case 'form': + case 'manualpingformlink': + echo $this->getManualPingUrl($tb_id); + break; + + case 'sendpinglink': + echo $manager->addTicketToUrl($CONF['PluginURL'] . 'trackback/index.php?action=ping&id=' . intval($tb_id)); + break; + + // Insert TrackBack count + case 'count': + $count = $this->getTrackBackCount($tb_id); + switch ($count) { + case 0: echo TEMPLATE::fill($this->getOption('tplTbNone'), array('number' => $count)); break; + case 1: echo TEMPLATE::fill($this->getOption('tplTbOne'), array('number' => $count)); break; + default: echo TEMPLATE::fill($this->getOption('tplTbMore'), array('number' => $count)); break; + } + break; + + // Shows the TrackBack list + case 'list': + case '': +//modify start+++++++++ +// $this->showList($tb_id); + $this->showList($tb_id, $amount); +//modify end+++++++++ + break; +//mod by cles + // show requred URL + case 'required': + echo $this->getRequiredURL($tb_id); + break; + + // shows the Local list + case 'locallist': + $this->showLocalList($tb_id); + break; +//mod by cles end + + default: + return; + } + } + + /* + * When used in templates, the tb_id will be determined by the itemid there + */ + function doTemplateVar(&$item, $what = '') { + $this->doSkinVar('template', $what, $item->itemid); + } + + function doTemplateCommentsVar(&$item, &$comment, $what = ''){ + $this->doSkinVar('templatecomments', $what, $item->itemid); + } + + /* + * A trackback ping is to be received on the URL + * http://yourdomain.com/item/1234.trackback + * Extra variables to be passed along are url, title, excerpt, blog_name + */ + function event_InitSkinParse(&$data) { + global $CONF, $itemid; + $format = requestVar('format'); + + if ($CONF['URLMode'] == 'pathinfo') { + if (preg_match('/(\/|\.)(trackback)(\/|$)/', serverVar('PATH_INFO'), $matches)) { + $format = $matches[2]; + } + } + + if ($format == 'trackback' && $data['type'] == 'item') + { + $errorMsg = $this->handlePing(intval($itemid)); + + if ($errorMsg != '') + $this->xmlResponse($errorMsg); + else + $this->xmlResponse(); + + exit; + } + } + + /* + * A trackback ping is to be received on the URL + * http://yourdomain.com/action.php?action=plugin&name=TrackBack&tb_id=1234 + * Extra variables to be passed along are url, title, excerpt, blog_name + */ + function doAction($type) + { + global $CONF,$manager; + $aActionsNotToCheck = array( + '', + 'ping', + 'form', + 'redirect', + 'left', + ); + if (!in_array($type, $aActionsNotToCheck)) { + if (!$manager->checkTicket()) return _ERROR_BADTICKET; + } + + switch ($type) { + + // When no action type is given, assume it's a ping + case '': + $errorMsg = $this->handlePing(); + $this->xmlResponse($errorMsg); + break; + + // Manual ping + case 'ping': + $errorMsg = $this->handlePing(); + if ($errorMsg != '') + $this->showManualPingError(intRequestVar('tb_id'), $errorMsg); + else + $this->showManualPingSuccess(intRequestVar('tb_id')); + break; + + // Show manual ping form + case 'form': +//mod by cles +// $this->showManualPingForm(intRequestVar('tb_id')); + $tb_id = intRequestVar('tb_id'); + $isAcceptPing = $this->isAcceptTrackBack($tb_id); + + if( $isAcceptPing ) + $this->showManualPingForm($tb_id); + else + echo 'Sorry, no trackback pings are accepted.'; +//mod by cles end + break; + + // Detect trackback + case 'detect': + list($url, $title) = + $this->getURIfromLink(html_entity_decode(requestVar('tb_link'))); + + $url = addslashes($url); + $url = $this->_utf8_to_javascript($url); + + $title = addslashes($title); + $title = $this->_utf8_to_javascript($title); + + echo "tbDone('" . requestVar('tb_link') . "', '" . $url . "', '" . $title . "');"; + + break; +//mod by cles + // redirect + case 'redirect': + return $this->redirect(intRequestVar('tb_id'), requestVar('urlHash')); + break; +//mod by cles end + case 'left': + echo $this->showLeftList(intRequestVar('tb_id'), intRequestVar('amount')); + break; + + // delete a trackback(local) + case 'deletelc': + $err = $this->deleteLocal(intRequestVar('tb_id'), intRequestVar('from_id')); + if( $err ) + return $err; + header('Location: ' . serverVar('HTTP_REFERER')); + break; + } + + exit; + } + + function doIf($key = '', $value = '') + { + global $itemid; + //echo "key: $key, value: $value"; + + switch( strtolower($key) ){ + case '': + case 'accept': + if( $value == '' ) $value = 'yes'; + $value = ( $value == 'no' || (! $value) ) ? false : true; + + $ret = false; + if( $itemid ) + $ret = $this->isAcceptTrackBack($itemid); + else + $ret = $this->isAcceptTrackBack(); + return ( $value == false ) ? (! $ret) : $ret; + + case 'required': + if( $value == '' ) $value = 'yes'; + $value = ( $value == 'no' || (! $value) ) ? false : true; + + $ret = false; + if( $itemid ) + $ret = $this->isEnableLinkCheck($itemid); + + return ( $value == false ) ? (! $ret) : $ret; + + default: + return false; + } + } + + /************************************************************************************** + * OUTPUT + */ + + /* + * Show a list of left trackbacks for this ID + */ + function showLeftList($tb_id, $offset = 0, $amount = 99999999) { + global $manager, $blog, $CONF; + + $out = array(); + $query = ' + SELECT + url, + md5(url) as urlHash, + blog_name, + excerpt, + title, + UNIX_TIMESTAMP(timestamp) AS timestamp + FROM + '.sql_table('plugin_tb').' + WHERE + tb_id = '.intval($tb_id).' AND + block = 0 + ORDER BY + timestamp DESC + '; + if($offset) + $query .= ' LIMIT '.intval($offset).', ' .intval($amount); + $res = sql_query($query); + 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') { +//modify start+++++++++ + $row['blog_name'] = $this->_restore_to_utf8($row['blog_name']); + $row['title'] = $this->_restore_to_utf8($row['title']); + $row['excerpt'] = $this->_restore_to_utf8($row['excerpt']); +//modify end+++++++++ + $row['blog_name'] = $this->_utf8_to_entities($row['blog_name']); + $row['title'] = $this->_utf8_to_entities($row['title']); + $row['excerpt'] = $this->_utf8_to_entities($row['excerpt']); + } + $iVars = array( + 'action' => $this->getTrackBackUrl($tb_id), + 'form' => $this->getManualPingUrl($tb_id), + 'name' => $row['blog_name'], + 'title' => $row['title'], + 'excerpt' => $this->_cut_string($row['excerpt'], 400), + 'url' => htmlspecialchars($row['url'], ENT_QUOTES), + 'date' => htmlspecialchars(strftime($this->getOption('dateFormat'), $row['timestamp']), ENT_QUOTES) + ); + +//mod by cles + if( $this->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']; +//mod by cles end + + $out[] = TEMPLATE::fill($this->getOption('tplItem'), $iVars); + } + mysql_free_result($res); + + return @join("\n",$out); + } + + /* + * Show a list of all trackbacks for this ID + */ + function showList($tb_id, $amount = 0) { + $tb_id = intval($tb_id); + global $manager, $blog, $CONF, $member; +//mod by cles + $enableHideurl = true; + // for TB LinkLookup + if( + strpos(serverVar('HTTP_USER_AGENT'),'Hatena Diary Track') === false + || strpos(serverVar('HTTP_USER_AGENT'),'NP_TrackBack') === false + || strpos(serverVar('HTTP_USER_AGENT'),'TBPingLinkLookup') === false + || strpos(serverVar('HTTP_USER_AGENT'),'MT::Plugin::BanNoReferTb') === false + || strpos(serverVar('HTTP_USER_AGENT'),'livedoorBlog') === false + ){ + $enableHideurl = false; + $amount = '-1'; + } +//mod by cles end + +/* + $res = sql_query(' + SELECT + url, + md5(url) as urlHash, + blog_name, + excerpt, + title, + UNIX_TIMESTAMP(timestamp) AS timestamp + FROM + '.sql_table('plugin_tb').' + WHERE + tb_id = '.$tb_id .' AND + block = 0 + ORDER BY + timestamp ASC + '); +*/ + $query = ' + SELECT + url, + md5(url) as urlHash, + blog_name, + excerpt, + title, + UNIX_TIMESTAMP(timestamp) AS timestamp + FROM + '.sql_table('plugin_tb').' + WHERE + tb_id = '.intval($tb_id) .' AND + block = 0 + ORDER BY + timestamp DESC + '; + if( $amount == '-1' ) + $query .= ' LIMIT 9999999'; + elseif( $amount ) + $query .= ' LIMIT '.intval($amount); + + if( $amount != 0) + $res = sql_query($query); + + $gVars = array( + 'action' => $this->getTrackBackUrl(intval($tb_id)), + 'form' => $this->getManualPingUrl(intval($tb_id)), + 'required' => $this->getRequiredURL(intval($tb_id)), + ); + + if ( $member->isLoggedIn() ){ + $adminurl = htmlspecialchars($manager->addTicketToUrl($CONF['PluginURL'] . 'trackback/index.php?action=list&id=' . intval($tb_id)), ENT_QUOTES); + $pingformurl = htmlspecialchars($manager->addTicketToUrl($CONF['PluginURL'] . 'trackback/index.php?action=ping&id=' . intval($tb_id)), ENT_QUOTES); + $gVars['admin'] = '[admin]'; + $gVars['pingform'] = '[pingform]'; + } + + echo TEMPLATE::fill($this->getOption('tplHeader'), $gVars); + + + while ($amount != 0 && $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') { +//modify start+++++++++ +/* + $row['blog_name'] = $this->_utf8_to_entities($row['blog_name']); + $row['title'] = $this->_utf8_to_entities($row['title']); + $row['excerpt'] = $this->_utf8_to_entities($row['excerpt']); +*/ + $row['blog_name'] = $this->_restore_to_utf8($row['blog_name']); + $row['title'] = $this->_restore_to_utf8($row['title']); + $row['excerpt'] = $this->_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'); +//modify end+++++++++ + } + +//modify start+++++++++ +/* + $iVars = array( + 'action' => $this->getTrackBackUrl($tb_id), + 'form' => $this->getManualPingUrl($tb_id), + 'name' => $row['blog_name'], + 'title' => $row['title'], + 'excerpt' => $row['excerpt'], + 'url' => htmlspecialchars($row['url'], ENT_QUOTES), + 'date' => htmlspecialchars(strftime($this->getOption('dateFormat'), $row['timestamp'] + ($blog->getTimeOffset() * 3600)), ENT_QUOTES) + ); +*/ + $iVars = array( + 'action' => $this->getTrackBackUrl($tb_id), + 'form' => $this->getManualPingUrl($tb_id), + 'name' => htmlspecialchars($row['blog_name'], ENT_QUOTES), + 'title' => htmlspecialchars($row['title'], ENT_QUOTES), + 'excerpt' => htmlspecialchars($this->_cut_string($row['excerpt'], 400), ENT_QUOTES), + 'url' => htmlspecialchars($row['url'], ENT_QUOTES), + 'date' => htmlspecialchars(strftime($this->getOption('dateFormat'), $row['timestamp']), ENT_QUOTES) + ); + +//mod by cles + if( $enableHideurl && $this->getOption('HideUrl') == 'yes' ) + $iVars['url'] = $CONF['ActionURL'] . '?action=plugin&name=TrackBack&type=redirect&tb_id=' . intval($tb_id) . '&urlHash=' . $row['urlHash']; + else + $iVars['url'] = $row['url']; +//mod by cles end + +//modify end+++++++++ + echo TEMPLATE::fill($this->getOption('tplItem'), $iVars); + + } + +//modify start+++++++++ + $q = ' + SELECT + count(*) + FROM + '.sql_table('plugin_tb').' + WHERE + tb_id = '.intval($tb_id) .' AND + block = 0 + ORDER BY + timestamp DESC + '; + $result = sql_query($q); + $total = mysql_result($result,0,0); + + if($amount != -1 && $total > $amount){ + $leftcount = $total - $amount; + + echo ''; + +?> + + + + + + +getOption('tplEmpty'), $gVars); + } + mysql_free_result($res); + + echo TEMPLATE::fill($this->getOption('tplFooter'), $gVars); + + } + + /* + * Returns the TrackBack count for a TrackBack item + */ + function getTrackBackCount($tb_id) { + return quickQuery('SELECT COUNT(*) as result FROM ' . sql_table('plugin_tb') . ' WHERE tb_id='.intval($tb_id).' AND block = 0'); + } + + /** + * Returns the manual ping URL + */ + function getManualPingUrl($itemid) { + global $CONF; + return $CONF['ActionURL'] . '?action=plugin&name=TrackBack&type=form&tb_id='.$itemid; + } + + /** + * Show the manual ping form + */ + function showManualPingError($itemid, $status = '') { + global $CONF; + + $form = true; $error = true; $success = false; + sendContentType('text/html', 'admin-trackback', _CHARSET); +//modify start+++++++++ +// include ($this->getDirectory() . '/templates/form.html'); + require_once($this->getDirectory() . '/template.php'); + $mTemplate = new Trackback_Template(null, $this->getDirectory()); + $mTemplate->set ('CONF', $CONF); + $mTemplate->set ('itemid', $itemid); + $mTemplate->set ('form', $form); + $mTemplate->set ('error', $error); + $mTemplate->set ('success', $success); + $mTemplate->set ('status', $status); + $mTemplate->template('templates/form.html'); + echo $mTemplate->fetch(); +//modify end+++++++++ + } + + function showManualPingSuccess($itemid, $status = '') { + global $CONF; + + $form = false; $error = false; $success = true; + sendContentType('text/html', 'admin-trackback', _CHARSET); +//modify start+++++++++ + //include ($this->getDirectory() . '/templates/form.html'); + require_once($this->getDirectory() . '/template.php'); + $mTemplate = new Trackback_Template(null, $this->getDirectory()); + $mTemplate->set ('CONF', $CONF); + $mTemplate->set ('itemid', $itemid); + $mTemplate->set ('form', $form); + $mTemplate->set ('error', $error); + $mTemplate->set ('success', $success); + $mTemplate->set ('status', $status); + $mTemplate->template('templates/form.html'); + echo $mTemplate->fetch(); +//modify end+++++++++ + } + + function showManualPingForm($itemid, $text = '') { + global $CONF; + + $form = true; $error = false; $success = false; + + // Check if we are allowed to accept pings + if ( !$this->isAcceptTrackBack($itemid) ) { + $text = 'Sorry, no trackback pings are accepted'; + $form = false; $error = true; + } + + sendContentType('text/html', 'admin-trackback', _CHARSET); +//modify start+++++++++ + //include ($this->getDirectory() . '/templates/form.html'); + require_once($this->getDirectory() . '/template.php'); + $mTemplate = new Trackback_Template(null, $this->getDirectory()); + $mTemplate->set ('CONF', $CONF); + $mTemplate->set ('itemid', $itemid); + $mTemplate->set ('form', $form); + $mTemplate->set ('error', $error); + $mTemplate->set ('success', $success); + $mTemplate->set ('status', $status); + $mTemplate->template('templates/form.html'); + echo $mTemplate->fetch(); +//modify end+++++++++ + } + + /** + * Returns the trackback URL + */ + function getTrackBackUrl($itemid) { + global $CONF, $manager; + return $CONF['ActionURL'] . '?action=plugin&name=TrackBack&tb_id='.$itemid; + } + + /* + * Insert RDF code for item + */ + function insertCode($itemid) { + $itemid = intval($itemid); + global $manager, $CONF; + + $item = & $manager->getItem($itemid, 0, 0); + $blog = & $manager->getBlog(getBlogIDFromItemID($item['itemid'])); + +/* + $CONF['ItemURL'] = preg_replace('/\/$/', '', $blog->getURL()); + $uri = createItemLink($item['itemid'],''); +*/ + $uri = $this->_createItemLink($item['itemid'],$blog); + + $title = strip_tags($item['title']); + $desc = strip_tags($item['body']); + $desc = $this->_cut_string($desc, 200); + $desc = htmlspecialchars($desc, ENT_QUOTES); + + ?> + + getItem($tb_id, 0, 0); + + if($item) + { + $blog =& $manager->getBlog(getBlogIDFromItemID($item['itemid'])); + + $blog_name = $blog->getName(); + $title = $item['title']; + $excerpt = $item['body']; + +//modify start+++++++++ +/* + if (_CHARSET != 'UTF-8') + { + $title = $this->_convert_to_utf8($title, $encoding); + $excerpt = $this->_convert_to_utf8($excerpt, $encoding); + $blog_name = $this->_convert_to_utf8($blog_name, $encoding); + } + + $title = $this->_decode_entities(strip_tags($title)); + $excerpt = $this->_decode_entities(strip_tags($excerpt)); + $blog_name = $this->_decode_entities(strip_tags($blog_name)); +*/ + + $title = $this->_restore_to_utf8($title); + $excerpt = $this->_restore_to_utf8($excerpt); + $blog_name = $this->_restore_to_utf8($blog_name); +//modify end+++++++++ + + $excerpt = $this->_cut_string($excerpt, 200); + + +//modify start+++++++++ +/* + $CONF['ItemURL'] = preg_replace('/\/$/', '', $blog->getURL()); + $url = createItemLink($item['itemid'],''); +*/ + $url = $this->_createItemLink($item['itemid'],$blog); +//modify end+++++++++ + + // Use UTF-8 charset for output + header('Content-Type: text/xml'); + echo "<","?xml version='1.0' encoding='UTF-8'?",">\n"; + + echo "
+
+
+
+
+
+
+
+
+
+ getOption('AutoXMLHttp'))
+ if ($this->getOption('AutoXMLHttp') == 'yes')
+ {
+ ?>
+
+
+
+
+
+ getOption('AutoXMLHttp'))
+ if ($this->getOption('AutoXMLHttp') == 'yes')
+ {
+ ?>
+
+
+
' . _ERROR_DISALLOWED . '
'; + $oPluginAdmin->end(); + exit; + } + + // Actions + $action = requestVar('action'); + $aActionsNotToCheck = array( + '', + ); + if (!in_array($action, $aActionsNotToCheck)) { + if (!$manager->checkTicket()) doError(_ERROR_BADTICKET); + } + +//modify start+++++++++ + $plug =& $oPluginAdmin->plugin; + $tableVersion = $plug->checkTableVersion(); + + // include language file for this plugin + $language = ereg_replace( '[\\|/]', '', getLanguageName()); + if (file_exists($plug->getDirectory().'language/'.$language.'.php')) + include_once($plug->getDirectory().'language/'.$language.'.php'); + else + include_once($plug->getDirectory().'language/'.'english.php'); +//modify end+++++++++ + + $oTemplate = new Trackback_Template(); + $oTemplate->set ('CONF', $CONF); + $oTemplate->set ('plugindirurl', $oPluginAdmin->plugin->getAdminURL()); + $oTemplate->set ('ticket', $manager->_generateTicket()); + + $whereClause = ''; + if( ! $member->isAdmin() ){ + // where clause + $res = sql_query('SELECT tblog FROM '.sql_table('team').' WHERE tadmin = 1 AND tmember = '.$member->getID() ); + $adminBlog = array(); + while ($row = mysql_fetch_array($res)){ + $adminBlog[] = $row[0]; + } + if($adminBlog) + $whereClause = ' i.iblog in (' . implode(', ', $adminBlog) . ') '; + + if( $whereClause ) + $whereClause = ' AND ( i.iauthor = '.$member->getID().' OR ' . $whereClause . ' )'; + else + $whereClause = ' AND i.iauthor = '.$member->getID(); + } + + $requiredItemEditRights = array( + 'dodelete', + 'doblock', + 'dounblock', + ); + $safeids = array(); + if (in_array($action, $requiredItemEditRights)) { + $ids = explode(',', requestVar('ids')); + $safeids = array(); + foreach( $ids as $id ){ + $id = trim($id); + if( is_numeric($id) ) + $safeids[] = $id; + } + if( ! $member->isAdmin() ){ + $query = 'SELECT t.id FROM ' . sql_table('plugin_tb') . ' t, ' . sql_table('item') . ' i WHERE t.tb_id = i.inumber AND t.id in ( '. implode(',', $safeids) . ' ) '. $whereClause ; + $res = sql_query($query); + $safeids = array(); + while ($row = mysql_fetch_array($res)){ + $safeids[] = $row[0]; + } + } + } + + // Pages + switch($action) { + + case 'ajax': + $type = requestVar('type') == 'all' ? 'all' : 'blocked' ; + $filter['all'] = ' t.block = 0 '; + $filter['blocked'] = ' t.block = 1 '; + + $start = intRequestVar('offset') ? intRequestVar('offset') : 0; + $amount = intRequestVar('page_size') ? intRequestVar('page_size') : 25; + + $colname = array(); + $colname['date'] = 'timestamp'; + $colname['item'] = 'story_id'; + $colname['title'] = 'title'; + + $sort_col = requestVar('sort_col'); + $sort_col = $colname[$sort_col]; + if( !$sort_col ) $sort_col = $colname['date']; + + $sort_dir = ( requestVar('sort_dir') == 'ASC' ) ? 'ASC' : 'DESC'; + + $rres = sql_query (" + SELECT + count(*) as count + FROM + ".sql_table('plugin_tb')." AS t, + ".sql_table('item')." AS i + WHERE + t.tb_id = i.inumber AND + ".$filter[$type].$whereClause); + $rrow = mysql_fetch_array($rres); + $count = $rrow['count']; + + $rres = sql_query (" + SELECT + i.ititle AS story, + i.inumber AS story_id, + t.id AS id, + t.title AS title, + t.blog_name AS blog_name, + t.excerpt AS excerpt, + t.url AS url, + t.spam AS spam, + UNIX_TIMESTAMP(t.timestamp) AS timestamp + FROM + ".sql_table('plugin_tb')." AS t, + ".sql_table('item')." AS i + WHERE + t.tb_id = i.inumber AND + ".$filter[$type].$whereClause." + ORDER BY + ".$sort_col." ".$sort_dir." + LIMIT + ".$start.",".$amount." + "); + + $items = array(); + + while ($rrow = mysql_fetch_array($rres)) + { + $rrow['title'] = $oPluginAdmin->plugin->_cut_string($rrow['title'], 50); + $rrow['title'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['title']); + $rrow['title'] = htmlspecialchars($rrow['title']); + $rrow['title'] = preg_replace("/-+/","-",$rrow['title']); + + $rrow['blog_name'] = $oPluginAdmin->plugin->_cut_string($rrow['blog_name'], 50); + $rrow['blog_name'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['blog_name']); + $rrow['blog_name'] = htmlspecialchars($rrow['blog_name']); + $rrow['blog_name'] = preg_replace("/-+/","-",$rrow['blog_name']); + + $rrow['excerpt'] = $oPluginAdmin->plugin->_cut_string($rrow['excerpt'], 100); + $rrow['excerpt'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['excerpt']); + $rrow['excerpt'] = htmlspecialchars($rrow['excerpt']); + $rrow['excerpt'] = preg_replace("/-+/","-",$rrow['excerpt']); + + $rrow['url'] = htmlspecialchars($rrow['url'], ENT_QUOTES); + + $blog = & $manager->getBlog(getBlogIDFromItemID($rrow['story_id'])); + $rrow['story_url'] = $oPluginAdmin->plugin->_createItemLink($rrow['story_id'], $blog); + $rrow['story'] = htmlspecialchars(strip_tags($rrow['story']), ENT_QUOTES); + + $items[] = $rrow; + } + + $oTemplate->set ('amount', $amount); + $oTemplate->set ('count', $count); + $oTemplate->set ('start', $start); + $oTemplate->set ('items', $items); + $oTemplate->template('templates/response_'.$type.'.xml'); + break; + + case 'dodelete': + if( count($safeids) > 0 ){ + $safeids = implode(',',$safeids); + + $res = sql_query( + ' DELETE FROM ' + . sql_table('plugin_tb') + . ' WHERE id in (' . $safeids. ')' + ); + $oTemplate->set ('message', $safeids . ' deleted.'); + } else { + $oTemplate->set ('message', 'no rows deleted.'); + } + + $oTemplate->template('templates/response_dodelete.xml'); + break; + + case 'doblock': + if( count($safeids) > 0 ){ + $safeids = implode(',',$safeids); + + $res = sql_query( + ' UPDATE ' + . sql_table('plugin_tb') + .' SET block = 1 ' + . ' WHERE id in (' . $safeids. ')' + ); + $oTemplate->set ('message', $safeids . ' blocked.'); + } else { + $oTemplate->set ('message', 'no rows blocked.'); + } + + $oTemplate->template('templates/response_doblock.xml'); + break; + + case 'dounblock': + if( count($safeids) > 0 ){ + $safeids = implode(',',$safeids); + + $res = sql_query( + ' UPDATE ' + . sql_table('plugin_tb') + .' SET block = 0 ' + . ' WHERE id in (' . $safeids. ')' + ); + $oTemplate->set ('message', $safeids . ' unblocked.'); + } else { + $oTemplate->set ('message', 'no rows unblocked.'); + } + + $oTemplate->template('templates/response_dounblock.xml'); + break; + } + + // Create the admin area page + echo $oTemplate->fetch(); + diff --git a/NP_TrackBack/trunk/trackback/help.html b/NP_TrackBack/trunk/trackback/help.html new file mode 100644 index 0000000..41a60ae --- /dev/null +++ b/NP_TrackBack/trunk/trackback/help.html @@ -0,0 +1,111 @@ +
+ <%TrackBack(list)%>
+
+ Show a list of trackbacks for the current page. Optionally it is also possible to + add an additional parameter, the story id number, which makes it possible to + show a list of trackbacks from a different page. The output of this variable is + fully configurable in the plugin options. +
+ +
+ <%TrackBack(code)%>
+
+ Inserts a small piece of invisible RDF code in the page, which is used by other + weblogs to auto-detect the trackback URL. If you do not include this variable in + your skin for item pages, other weblogs will not be able to auto-detect that your + weblog is able to accept trackbacks. +
+ +
+ <%TrackBack(form)%>
+
+ Insert the URL to a manual ping form. Using this form authors of other weblogs
+ can add trackbacks to your stories, even when their software does not support
+ trackbacks, such as Blogger. A link to this form is included in the footer of
+ the trackback list by default. If you want to place this link somewhere else
+ on your page, simply remove the <%form%>
variable from the
+ Footer field in the plugin settings and add the skinvar somewhere on
+ your webpage.
+
+ <%TrackBack(url)%>
+
+ Insert the Trackback Ping URL. A this URL is also included in the footer of
+ the trackback list by default. If you want to place this link somewhere else
+ on your page, simply remove the <%action%>
variable from the
+ Footer field in the plugin settings and add the skinvar somewhere on
+ your webpage.
+
+ All the skin variables documented above are also available as template variables. +
+ +
+ <%TrackBack(count)%>
+
+ If you want to include an indication of how many trackbacks are present for each + page you can use this variable. By default this variable will show: "No Trackbacks", + "1 Trackback", "2 Trackbacks", etc. This is however also fully configurable in + the plugin options. +
+ + ++ It is possible to fully change the output of this plugin. You can manually change + the XHTML code in the plugin options, but you can also use CSS to style the default + output to your liking. Below you will find an example of what a little snippet of + CSS can do. +
+ +div.tb { + border: 1px solid #000; background: #FFF; +} +div.tb div.head { + padding: 4px; + background: #000; color: #FFF; + font-weight: bold; text-transform: lowercase; letter-spacing: 0.6em; +} +div.tb div.empty { + padding: 4px; + font-size: 95%; +} +div.tb div.item { + padding: 4px; +} +div.tb div.item div.name { + margin-bottom: 8px; + font-size: 120%; font-weight: bold; +} +div.tb div.item div.body { + font-size: 95%; +} +div.tb div.item div.body a { + font-weight: bold; +} +div.tb div.item div.date { + margin-bottom: 8px; + color: #888; + font-size: 85%; text-align: right; +} +div.tb div.info { + padding: 4px; + color: #FFF; background: #888; + font-size: 85%; font-style: italic; +}+ diff --git a/NP_TrackBack/trunk/trackback/index.php b/NP_TrackBack/trunk/trackback/index.php new file mode 100644 index 0000000..ef09755 --- /dev/null +++ b/NP_TrackBack/trunk/trackback/index.php @@ -0,0 +1,496 @@ +isLoggedIn() ) + { + $oPluginAdmin->start(); + echo '
' . _ERROR_DISALLOWED . '
'; + $oPluginAdmin->end(); + exit; + } + + // Actions + $action = requestVar('action'); + $aActionsNotToCheck = array( + '', + 'ping', + ); + if (!in_array($action, $aActionsNotToCheck)) { + if (!$manager->checkTicket()) doError(_ERROR_BADTICKET); + } + + $oPluginAdmin->start(); + +//modify start+++++++++ + $plug =& $oPluginAdmin->plugin; + $tableVersion = $plug->checkTableVersion(); + + // include language file for this plugin + $language = ereg_replace( '[\\|/]', '', getLanguageName()); + if (file_exists($plug->getDirectory().'language/'.$language.'.php')) + include_once($plug->getDirectory().'language/'.$language.'.php'); + else + include_once($plug->getDirectory().'language/'.'english.php'); +//modify end+++++++++ + + $mTemplate = new Trackback_Template(); + $mTemplate->set ('CONF', $CONF); + $mTemplate->set ('plugid', $plug->getID()); + $mTemplate->set ('plugindirurl', $oPluginAdmin->plugin->getAdminURL()); + $mTemplate->template('templates/menu.html'); + echo $mTemplate->fetch(); + + $oTemplate = new Trackback_Template(); + $oTemplate->set ('CONF', $CONF); + $oTemplate->set ('plugindirurl', $oPluginAdmin->plugin->getAdminURL()); + $oTemplate->set ('ticket', $manager->_generateTicket()); + $ajaxEnabled = ($oPluginAdmin->plugin->getOption('ajaxEnabled') == 'yes') ? true : false; + $oTemplate->set ('ajaxEnabled', $ajaxEnabled); + + $whereClause = ''; + if( ! $member->isAdmin() ){ + // where clause + $res = sql_query('SELECT tblog FROM '.sql_table('team').' WHERE tadmin = 1 AND tmember = '.$member->getID() ); + $adminBlog = array(); + while ($row = mysql_fetch_array($res)){ + $adminBlog[] = $row[0]; + } + if($adminBlog) + $whereClause = ' i.iblog in (' . implode(', ', $adminBlog) . ') '; + + if( $whereClause ) + $whereClause = ' AND ( i.iauthor = '.$member->getID().' OR ' . $whereClause . ' )'; + else + $whereClause = ' AND i.iauthor = '.$member->getID(); + } + //echo "Debug: $whereClause
"; + + $requiredAdminRights = array( + 'tableUpgrade', + 'blocked_clear', + 'blocked_spamclear', + ); + if (in_array($action, $requiredAdminRights)) { + if( ! $member->isAdmin() ){ + echo '
' . _ERROR_DISALLOWED . '
'; + echo 'Reason: ' . __LINE__ . '
'; + $oPluginAdmin->end(); + exit; + } + } + + $requiredItemEditRights = array( + 'block', + 'unblock', + 'delete', + ); + if (in_array($action, $requiredItemEditRights)) { + if( ! $member->isAdmin() ){ + $tb = intRequestVar('tb'); + $query = 'SELECT i.inumber FROM ' . sql_table('plugin_tb') . ' t, ' . sql_table('item') . ' i WHERE t.tb_id = i.inumber AND t.id = '. $tb . $whereClause ; + $res = sql_query($query); + if( ! @mysql_num_rows($res) ){ + echo '' . _ERROR_DISALLOWED . '
'; + echo 'Reason: ' . __LINE__ . '
'; + $oPluginAdmin->end(); + exit; + } + } + } + + switch($action) { + +//modify start+++++++++ + case 'tableUpgrade': + sql_query(" + CREATE TABLE IF NOT EXISTS + ".sql_table('plugin_tb_lookup')." + ( + `link` TEXT NOT NULL, + `url` TEXT NOT NULL, + `title` TEXT, + + PRIMARY KEY (`link` (100)) + ) + "); + echo $q = "ALTER TABLE ".sql_table('plugin_tb')." + ADD `block` TINYINT( 4 ) NOT NULL AFTER `url` , + ADD `spam` TINYINT( 4 ) NOT NULL AFTER `block` , + ADD `link` TINYINT( 4 ) NOT NULL AFTER `spam` , + CHANGE `url` `url` TEXT NOT NULL, + CHANGE `title` `title` TEXT NOT NULL, + CHANGE `excerpt` `excerpt` TEXT NOT NULL, + CHANGE `blog_name` `blog_name` TEXT NOT NULL, + DROP PRIMARY KEY, + ADD `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST ;"; + $res = @sql_query($q); + if (!$res){ + echo 'Could not alter table: ' . mysql_error(); + }else{ + $tableVersion = 1; + $oTemplate->template('templates/updatetablefinished.html'); + } + @sql_query('ALTER TABLE `' . sql_table('plugin_tb') . '` ADD INDEX `tb_id_block_timestamp_idx` ( `tb_id`, `block`, `timestamp` DESC )'); + break; +//modify end+++++++++ + + case 'block': + $tb = intRequestVar('tb'); + + $res = sql_query (" + UPDATE + ".sql_table('plugin_tb')." + SET + block = 1 + WHERE + id = '".$tb."' + "); + + $action = requestVar('next'); + break; + + case 'blocked_clear': + $res = sql_query ("DELETE FROM ".sql_table('plugin_tb')." WHERE block = 1"); + $action = requestVar('next'); + break; + + case 'blocked_spamclear': + $res = sql_query ("DELETE FROM ".sql_table('plugin_tb')." WHERE block = 1 and spam = 1"); + $action = requestVar('next'); + break; + + case 'unblock': + $tb = intRequestVar('tb'); + + $res = sql_query (" + UPDATE + ".sql_table('plugin_tb')." + SET + block = 0 + WHERE + id = '".$tb."' + "); + + $action = requestVar('next'); + break; + + case 'delete': + $tb = intRequestVar('tb'); + + $res = sql_query (" + DELETE FROM + ".sql_table('plugin_tb')." + WHERE + id = '".$tb."' + "); + + $action = requestVar('next'); + break; + + case 'sendping': + $title = requestVar('title'); + $url = requestVar('url'); + $excerpt = requestVar('excerpt'); + $blog_name = requestVar('blog_name'); + $ping_url = requestVar('ping_url'); + + // No charset conversion needs to be done here, because + // the charset used to receive the info is used to send + // it... + + if ($ping_url) { + $error = $oPluginAdmin->plugin->sendPing(0, $title, $url, $excerpt, $blog_name, $ping_url); + + if ($error) { + echo 'TrackBack Error:' . $error . ''; + } + } + + $action = requestVar('next'); + break; + + case 'ping': + $id = intRequestVar('id'); + + $usePathInfo = ($CONF['URLMode'] == 'pathinfo'); + if ($usePathInfo) + @ include($strRel . 'fancyurls.config.php'); + + global $manager; + $itemData = $manager->getItem($id, 0, 0); + + if(is_array($itemData)){ + $blog =& $manager->getBlog($itemData['blogid']); + $CONF['ItemURL'] = ($usePathInfo)? preg_replace('/\/$/', '', $blog->getURL()): $blog->getURL(); + $itemData['url'] = createItemLink($id); + $itemData['excerpt'] = shorten(strip_tags($itemData['body'].$itemData['more']), 250, '...'); + $itemData['blogname'] = $blog->getName(); + }else{ + $itemData = array(); + $itemData['url'] = $CONF['IndexURL']; + $itemData['blogname'] = $CONF['SiteName']; + } + $oTemplate->set('item', $itemData); + + $oTemplate->template('templates/ping.html'); + break; + } + + // Pages + switch($action) { + + case 'help': + $oTemplate->template('help.html'); + break; + + case 'ping': + $oTemplate->template('templates/ping.html'); + break; + + case 'blocked': + case 'all': + $rres = sql_query (" + SELECT + COUNT(*) AS count + FROM + ".sql_table('plugin_tb')." AS t, + ".sql_table('item')." AS i + WHERE + t.tb_id = i.inumber AND + t.block = " . (( $action == 'all') ? 0 : 1) . $whereClause ); + + if ($row = mysql_fetch_array($rres)) + $count = $row['count']; + else + $count = 0; + $oTemplate->set('count', $count); + + if($ajaxEnabled){ + if( $action == 'all') + $oTemplate->template('templates/all_ajax.html'); + else + $oTemplate->template('templates/blocked_ajax.html'); + } else { + $start = intRequestVar('start') ? intRequestVar('start') : 0; + $amount = intRequestVar('amount') ? intRequestVar('amount') : 25; + + $rres = sql_query (" + SELECT + i.ititle AS story, + i.inumber AS story_id, + t.id AS id, + t.title AS title, + t.blog_name AS blog_name, + t.excerpt AS excerpt, + t.url AS url, + UNIX_TIMESTAMP(t.timestamp) AS timestamp, + t.spam AS spam, + t.link AS link + FROM + ".sql_table('plugin_tb')." AS t, + ".sql_table('item')." AS i + WHERE + t.tb_id = i.inumber AND + t.block = " . (( $action == 'all') ? 0 : 1) . $whereClause ." + ORDER BY + timestamp DESC + LIMIT + ".$start.",".$amount); + + $items = array(); + + while ($rrow = mysql_fetch_array($rres)){ + $rrow['title'] = $oPluginAdmin->plugin->_cut_string($rrow['title'], 50); + $rrow['title'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['title']); + $rrow['title'] = htmlspecialchars($rrow['title']); + + $rrow['blog_name'] = $oPluginAdmin->plugin->_cut_string($rrow['blog_name'], 50); + $rrow['blog_name'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['blog_name']); + $rrow['blog_name'] = htmlspecialchars($rrow['blog_name']); + + $rrow['excerpt'] = $oPluginAdmin->plugin->_cut_string($rrow['excerpt'], 800); + $rrow['excerpt'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['excerpt']); + $rrow['excerpt'] = htmlspecialchars($rrow['excerpt']); + + $rrow['url'] = htmlspecialchars($rrow['url'], ENT_QUOTES); + $rrow['timestamp'] = htmlspecialchars($rrow['timestamp'], ENT_QUOTES); + + $blog = & $manager->getBlog(getBlogIDFromItemID($item['itemid'])); + $rrow['story_url'] = $oPluginAdmin->plugin->_createItemLink($rrow['story_id'], $blog); + $rrow['story'] = htmlspecialchars(strip_tags($rrow['story']), ENT_QUOTES); + + $items[] = $rrow; + } + + $oTemplate->set('amount', $amount); + $oTemplate->set('start', $start); + $oTemplate->set('items', $items); + + if( $action == 'all') + $oTemplate->template('templates/all.html'); + else + $oTemplate->template('templates/blocked.html'); + } + break; + + case 'list': + $id = requestVar('id'); + $start = intRequestVar('start') ? intRequestVar('start') : 0; + $amount = intRequestVar('amount') ? intRequestVar('amount') : 25; + + $ires = sql_query (" + SELECT + i.ititle, + i.inumber + FROM + ".sql_table('item')." i + WHERE + i.inumber = '".$id."' + ". $whereClause ); + + if ($irow = mysql_fetch_array($ires)) + { + $story['id'] = $id; + $story['title'] = $irow['ititle']; + + $rres = sql_query (" + SELECT + COUNT(*) AS count + FROM + ".sql_table('plugin_tb')." AS t + WHERE + t.tb_id = '".$id."' AND + t.block = 0 + "); + + if ($row = mysql_fetch_array($rres)) + $count = $row['count']; + else + $count = 0; + + $rres = sql_query (" + SELECT + t.id AS id, + t.title AS title, + t.blog_name AS blog_name, + t.excerpt AS excerpt, + t.url AS url, + UNIX_TIMESTAMP(t.timestamp) AS timestamp + FROM + ".sql_table('plugin_tb')." AS t + WHERE + t.tb_id = '".$id."' AND + t.block = 0 + ORDER BY + timestamp DESC + LIMIT + ".$start.",".$amount." + "); + + $items = array(); + + while ($rrow = mysql_fetch_array($rres)) + { + $rrow['title'] = $oPluginAdmin->plugin->_cut_string($rrow['title'], 50); + $rrow['title'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['title']); + $rrow['title'] = htmlspecialchars($rrow['title']); +// $rrow['title'] = _CHARSET == 'UTF-8' ? $rrow['title'] : $oPluginAdmin->plugin->_utf8_to_entities($rrow['title']); + + $rrow['blog_name'] = $oPluginAdmin->plugin->_cut_string($rrow['blog_name'], 50); + $rrow['blog_name'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['blog_name']); + $rrow['blog_name'] = htmlspecialchars($rrow['blog_name']); +// $rrow['blog_name'] = _CHARSET == 'UTF-8' ? $rrow['blog_name'] : $oPluginAdmin->plugin->_utf8_to_entities($rrow['blog_name']); + + $rrow['excerpt'] = $oPluginAdmin->plugin->_cut_string($rrow['excerpt'], 800); + $rrow['excerpt'] = $oPluginAdmin->plugin->_strip_controlchar($rrow['excerpt']); + $rrow['excerpt'] = htmlspecialchars($rrow['excerpt']); +// $rrow['excerpt'] = _CHARSET == 'UTF-8' ? $rrow['excerpt'] : $oPluginAdmin->plugin->_utf8_to_entities($rrow['excerpt']); + + $rrow['url'] = htmlspecialchars($rrow['url'], ENT_QUOTES); + $rrow['story'] = htmlspecialchars(strip_tags($rrow['story']), ENT_QUOTES); + $items[] = $rrow; + } + + $oTemplate->set ('amount', $amount); + $oTemplate->set ('count', $count); + $oTemplate->set ('start', $start); + $oTemplate->set ('items', $items); + $oTemplate->set ('story', $story); + $oTemplate->template('templates/list.html'); + } + + break; + + + case 'index': + $bres = sql_query (" + SELECT + bnumber AS bnumber, + bname AS bname, + burl AS burl + FROM + ".sql_table('blog')." + ORDER BY + bname + "); + + $blogs = array(); + + while ($brow = mysql_fetch_array($bres)) + { + if( !$member->isTeamMember($brow['bnumber']) ) continue; + $ires = sql_query (" + SELECT + i.inumber AS inumber, + i.ititle AS ititle, + COUNT(*) AS total + FROM + ".sql_table('item')." AS i, + ".sql_table('plugin_tb')." AS t + WHERE + i.iblog = ".$brow['bnumber']." AND + t.tb_id = i.inumber AND + t.block = 0 ".$whereClause." + GROUP BY + i.inumber + ORDER BY + i.inumber DESC + "); + + $items = array(); + + while ($irow = mysql_fetch_array($ires)) + { + $items[] = $irow; + } + + $brow['items'] = $items; + $blogs[] = $brow; + } + + $oTemplate->set ('blogs', $blogs); + $oTemplate->template('templates/index.html'); + break; + + default: + //modify start+++++++++ + if(!$tableVersion){ + $oTemplate->template('templates/updatetable.html'); + } + //modify end+++++++++ + break; + } + + // Create the admin area page + echo $oTemplate->fetch(); + + echo '+Nucleus CMS Japan Wiki¤ÎNP_TrackBack¤Î¥Ú¡¼¥¸¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£ +
+ ++ ¥È¥é¥Ã¥¯¥Ð¥Ã¥¯´ØÏ¢¤Îɽ¼¨ÊýË¡¤Ï¥Æ¥ó¥×¥ì¡¼¥È¤òÊÔ½¸¤¹¤ë¤³¤È¤Ë¤è¤Ã¤Æ¥«¥¹¥¿¥Þ¥¤¥º¤Ç¤¤Þ¤¹¤¬¡¢¿§¤ä;Çò¤Ê¤É¤Î¥Ç¥¶¥¤¥ó¤ÏCSS¦¤Ç»ØÄꤹ¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£¥Æ¥ó¥×¥ì¡¼¥ÈÆâ¤ËÆþÎϤ·¤¿¥¯¥é¥¹Ì¾¤Î¥×¥í¥Ñ¥Æ¥£¤Ïcss¤Ç»ØÄꤷ¤Æ¤¯¤À¤µ¤¤¡£¥Ç¥Õ¥©¥ë¥È¤Î¥Æ¥ó¥×¥ì¡¼¥È¤ò¾þ¤ëCSS¥×¥í¥Ñ¥Æ¥£¤ÎÎã¤ò¤¢¤²¤Æ¤ª¤¤Þ¤¹¡£ +
+ +div.tb { + border: 1px solid #000; background: #FFF; +} +div.tb div.head { + padding: 4px; + background: #000; color: #FFF; + font-weight: bold; text-transform: lowercase; letter-spacing: 0.6em; +} +div.tb div.empty { + padding: 4px; + font-size: 95%; +} +div.tb div.item { + padding: 4px; +} +div.tb div.item div.name { + margin-bottom: 8px; + font-size: 120%; font-weight: bold; +} +div.tb div.item div.body { + font-size: 95%; +} +div.tb div.item div.body a { + font-weight: bold; +} +div.tb div.item div.date { + margin-bottom: 8px; + color: #888; + font-size: 85%; text-align: right; +} +div.tb div.info { + padding: 4px; + color: #FFF; background: #888; + font-size: 85%; font-style: italic; +}+ +
+ 0): ?> + + + | ++ + + + | +
Date | +Story | +Title, Blog and Excerpt | +Actions | +|
---|---|---|---|---|
+ + | ++ + | +
+
+
+ () + + |
+ + + | ++ + | +
+ 0): ?> + + + | ++ + + + | +
+ | id | +Date | +Story | +Title, Blog and Excerpt | ++ |
---|
+ 0): ?> + + + | ++ + + + | +
Date | +Story | +Title, Blog and Excerpt | +Actions | +|
---|---|---|---|---|
+ + | ++ + | +
+
+
+ ()
+ ' :
+ '';?>
+ ';?>
+ + + |
+ + + | ++ + | +
+ 0): ?> + + + | ++ + + + | +
+ | id | +Date | +Story | +Title, Blog and Excerpt | ++ |
---|
+ ¥È¥é¥Ã¥¯¥Ð¥Ã¥¯¤ÎÁ÷¿®¤¬´°Î»¤·¤Þ¤·¤¿ +
+ + ++ +
+ + + + + + \ No newline at end of file diff --git a/NP_TrackBack/trunk/trackback/japanese-euc.templates/index.html b/NP_TrackBack/trunk/trackback/japanese-euc.templates/index.html new file mode 100644 index 0000000..a2a00ed --- /dev/null +++ b/NP_TrackBack/trunk/trackback/japanese-euc.templates/index.html @@ -0,0 +1,34 @@ + +Blog: | +Total | +Action | +
---|---|---|
+ + | ++ + | ++ Trackbacks + | +
+ 0): ?> + + + | ++ + + + | +
Date | +Title, Blog and Excerpt | +Actions | +|
---|---|---|---|
+ + | +
+
+
+ () + + |
+ + + | ++ + | +
+ 0): ?> + + + | ++ + + + | +
¥¢¥Ã¥×¥Ç¡¼¥È¤¬É¬ÍפǤ¹:+ diff --git a/NP_TrackBack/trunk/trackback/japanese-euc.templates/updatetablefinished.html b/NP_TrackBack/trunk/trackback/japanese-euc.templates/updatetablefinished.html new file mode 100644 index 0000000..a16df97 --- /dev/null +++ b/NP_TrackBack/trunk/trackback/japanese-euc.templates/updatetablefinished.html @@ -0,0 +1,5 @@ + +
+¤³¤Î¥Ð¡¼¥¸¥ç¥ó¤Ç±¿ÍѤ¹¤ë¤¿¤á¤Ë¤ÏDBÆâ¤Î¥Æ¡¼¥Ö¥ë¤Î¥¢¥Ã¥×¥Ç¡¼¥È¤¬É¬ÍפǤ¹¡£
+º£¤Þ¤Ç¤Î¥Ç¡¼¥¿¤¬ºï½ü¤µ¤ì¤ë¤³¤È¤Ï¤¢¤ê¤Þ¤»¤ó¡£ +²¼¤Î¥¢¥Ã¥×¥Ç¡¼¥È¥Ü¥¿¥ó¤ò²¡¤·¤Æ¤¯¤À¤µ¤¤¡£ + + +
+¥Æ¡¼¥Ö¥ë¤Î¥¢¥Ã¥×¥Ç¡¼¥È¤Ï´°Î»¤·¤Þ¤·¤¿¡£ ++ diff --git a/NP_TrackBack/trunk/trackback/japanese-utf8.help.html b/NP_TrackBack/trunk/trackback/japanese-utf8.help.html new file mode 100644 index 0000000..752f956 --- /dev/null +++ b/NP_TrackBack/trunk/trackback/japanese-utf8.help.html @@ -0,0 +1,116 @@ +
+Nucleus CMS Japan Wikiã®NP_TrackBackã®ãã¼ã¸ãåç §ãã¦ãã ããã +
+ ++ ãã©ãã¯ããã¯é¢é£ã®è¡¨ç¤ºæ¹æ³ã¯ãã³ãã¬ã¼ããç·¨éãããã¨ã«ãã£ã¦ã«ã¹ã¿ãã¤ãºã§ãã¾ãããè²ãä½ç½ãªã©ã®ãã¶ã¤ã³ã¯CSSå´ã§æå®ããå¿ è¦ãããã¾ãããã³ãã¬ã¼ãå ã«å ¥åããã¯ã©ã¹åã®ããããã£ã¯cssã§æå®ãã¦ãã ãããããã©ã«ãã®ãã³ãã¬ã¼ãã飾ãCSSããããã£ã®ä¾ãããã¦ããã¾ãã +
+ +div.tb { + border: 1px solid #000; background: #FFF; +} +div.tb div.head { + padding: 4px; + background: #000; color: #FFF; + font-weight: bold; text-transform: lowercase; letter-spacing: 0.6em; +} +div.tb div.empty { + padding: 4px; + font-size: 95%; +} +div.tb div.item { + padding: 4px; +} +div.tb div.item div.name { + margin-bottom: 8px; + font-size: 120%; font-weight: bold; +} +div.tb div.item div.body { + font-size: 95%; +} +div.tb div.item div.body a { + font-weight: bold; +} +div.tb div.item div.date { + margin-bottom: 8px; + color: #888; + font-size: 85%; text-align: right; +} +div.tb div.info { + padding: 4px; + color: #FFF; background: #888; + font-size: 85%; font-style: italic; +}+ +
+ 0): ?> + + + | ++ + + + | +
Date | +Story | +Title, Blog and Excerpt | +Actions | +|
---|---|---|---|---|
+ + | ++ + | +
+
+
+ () + + |
+ + + | ++ + | +
+ 0): ?> + + + | ++ + + + | +
+ | id | +Date | +Story | +Title, Blog and Excerpt | ++ |
---|
+ 0): ?> + + + | ++ + + + | +
Date | +Story | +Title, Blog and Excerpt | +Actions | +|
---|---|---|---|---|
+ + | ++ + | +
+
+
+ ()
+ ' :
+ '';?>
+ ';?>
+ + + |
+ + + | ++ + | +
+ 0): ?> + + + | ++ + + + | +
+ | id | +Date | +Story | +Title, Blog and Excerpt | ++ |
---|
+ ãã©ãã¯ããã¯ã®éä¿¡ãå®äºãã¾ãã +
+ + ++ +
+ + + + + + \ No newline at end of file diff --git a/NP_TrackBack/trunk/trackback/japanese-utf8.templates/index.html b/NP_TrackBack/trunk/trackback/japanese-utf8.templates/index.html new file mode 100644 index 0000000..15a2ce4 --- /dev/null +++ b/NP_TrackBack/trunk/trackback/japanese-utf8.templates/index.html @@ -0,0 +1,34 @@ + +Blog: | +Total | +Action | +
---|---|---|
+ + | ++ + | ++ Trackbacks + | +
+ 0): ?> + + + | ++ + + + | +
Date | +Title, Blog and Excerpt | +Actions | +|
---|---|---|---|
+ + | +
+
+
+ () + + |
+ + + | ++ + | +
+ 0): ?> + + + | ++ + + + | +
ã¢ãããã¼ããå¿ è¦ã§ã:+ diff --git a/NP_TrackBack/trunk/trackback/japanese-utf8.templates/updatetablefinished.html b/NP_TrackBack/trunk/trackback/japanese-utf8.templates/updatetablefinished.html new file mode 100644 index 0000000..6b1ea94 --- /dev/null +++ b/NP_TrackBack/trunk/trackback/japanese-utf8.templates/updatetablefinished.html @@ -0,0 +1,5 @@ + +
+ãã®ãã¼ã¸ã§ã³ã§éç¨ããããã«ã¯DBå ã®ãã¼ãã«ã®ã¢ãããã¼ããå¿ è¦ã§ãã
+ä»ã¾ã§ã®ãã¼ã¿ãåé¤ããããã¨ã¯ããã¾ããã +ä¸ã®ã¢ãããã¼ããã¿ã³ãæ¼ãã¦ãã ããã + + +
+ãã¼ãã«ã®ã¢ãããã¼ãã¯å®äºãã¾ããã ++ diff --git a/NP_TrackBack/trunk/trackback/js/prototype.js b/NP_TrackBack/trunk/trackback/js/prototype.js new file mode 100644 index 0000000..5d2100f --- /dev/null +++ b/NP_TrackBack/trunk/trackback/js/prototype.js @@ -0,0 +1,3271 @@ +/* Prototype JavaScript framework, version 1.5.1 + * (c) 2005-2007 Sam Stephenson + * + * Prototype is freely distributable under the terms of an MIT-style license. + * For details, see the Prototype web site: http://www.prototypejs.org/ + * +/*--------------------------------------------------------------------------*/ + +var Prototype = { + Version: '1.5.1', + + Browser: { + IE: !!(window.attachEvent && !window.opera), + Opera: !!window.opera, + WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1, + Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1 + }, + + BrowserFeatures: { + XPath: !!document.evaluate, + ElementExtensions: !!window.HTMLElement, + SpecificElementExtensions: + (document.createElement('div').__proto__ !== + document.createElement('form').__proto__) + }, + + ScriptFragment: '', + JSONFilter: /^\/\*-secure-\s*(.*)\s*\*\/\s*$/, + + emptyFunction: function() { }, + K: function(x) { return x } +} + +var Class = { + create: function() { + return function() { + this.initialize.apply(this, arguments); + } + } +} + +var Abstract = new Object(); + +Object.extend = function(destination, source) { + for (var property in source) { + destination[property] = source[property]; + } + return destination; +} + +Object.extend(Object, { + inspect: function(object) { + try { + if (object === undefined) return 'undefined'; + if (object === null) return 'null'; + return object.inspect ? object.inspect() : object.toString(); + } catch (e) { + if (e instanceof RangeError) return '...'; + throw e; + } + }, + + toJSON: function(object) { + var type = typeof object; + switch(type) { + case 'undefined': + case 'function': + case 'unknown': return; + case 'boolean': return object.toString(); + } + if (object === null) return 'null'; + if (object.toJSON) return object.toJSON(); + if (object.ownerDocument === document) return; + var results = []; + for (var property in object) { + var value = Object.toJSON(object[property]); + if (value !== undefined) + results.push(property.toJSON() + ': ' + value); + } + return '{' + results.join(', ') + '}'; + }, + + keys: function(object) { + var keys = []; + for (var property in object) + keys.push(property); + return keys; + }, + + values: function(object) { + var values = []; + for (var property in object) + values.push(object[property]); + return values; + }, + + clone: function(object) { + return Object.extend({}, object); + } +}); + +Function.prototype.bind = function() { + var __method = this, args = $A(arguments), object = args.shift(); + return function() { + return __method.apply(object, args.concat($A(arguments))); + } +} + +Function.prototype.bindAsEventListener = function(object) { + var __method = this, args = $A(arguments), object = args.shift(); + return function(event) { + return __method.apply(object, [event || window.event].concat(args)); + } +} + +Object.extend(Number.prototype, { + toColorPart: function() { + return this.toPaddedString(2, 16); + }, + + succ: function() { + return this + 1; + }, + + times: function(iterator) { + $R(0, this, true).each(iterator); + return this; + }, + + toPaddedString: function(length, radix) { + var string = this.toString(radix || 10); + return '0'.times(length - string.length) + string; + }, + + toJSON: function() { + return isFinite(this) ? this.toString() : 'null'; + } +}); + +Date.prototype.toJSON = function() { + return '"' + this.getFullYear() + '-' + + (this.getMonth() + 1).toPaddedString(2) + '-' + + this.getDate().toPaddedString(2) + 'T' + + this.getHours().toPaddedString(2) + ':' + + this.getMinutes().toPaddedString(2) + ':' + + this.getSeconds().toPaddedString(2) + '"'; +}; + +var Try = { + these: function() { + var returnValue; + + for (var i = 0, length = arguments.length; i < length; i++) { + var lambda = arguments[i]; + try { + returnValue = lambda(); + break; + } catch (e) {} + } + + return returnValue; + } +} + +/*--------------------------------------------------------------------------*/ + +var PeriodicalExecuter = Class.create(); +PeriodicalExecuter.prototype = { + initialize: function(callback, frequency) { + this.callback = callback; + this.frequency = frequency; + this.currentlyExecuting = false; + + this.registerCallback(); + }, + + registerCallback: function() { + this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); + }, + + stop: function() { + if (!this.timer) return; + clearInterval(this.timer); + this.timer = null; + }, + + onTimerEvent: function() { + if (!this.currentlyExecuting) { + try { + this.currentlyExecuting = true; + this.callback(this); + } finally { + this.currentlyExecuting = false; + } + } + } +} +Object.extend(String, { + interpret: function(value) { + return value == null ? '' : String(value); + }, + specialChar: { + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '\\': '\\\\' + } +}); + +Object.extend(String.prototype, { + gsub: function(pattern, replacement) { + var result = '', source = this, match; + replacement = arguments.callee.prepareReplacement(replacement); + + while (source.length > 0) { + if (match = source.match(pattern)) { + result += source.slice(0, match.index); + result += String.interpret(replacement(match)); + source = source.slice(match.index + match[0].length); + } else { + result += source, source = ''; + } + } + return result; + }, + + sub: function(pattern, replacement, count) { + replacement = this.gsub.prepareReplacement(replacement); + count = count === undefined ? 1 : count; + + return this.gsub(pattern, function(match) { + if (--count < 0) return match[0]; + return replacement(match); + }); + }, + + scan: function(pattern, iterator) { + this.gsub(pattern, iterator); + return this; + }, + + truncate: function(length, truncation) { + length = length || 30; + truncation = truncation === undefined ? '...' : truncation; + return this.length > length ? + this.slice(0, length - truncation.length) + truncation : this; + }, + + strip: function() { + return this.replace(/^\s+/, '').replace(/\s+$/, ''); + }, + + stripTags: function() { + return this.replace(/<\/?[^>]+>/gi, ''); + }, + + stripScripts: function() { + return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); + }, + + extractScripts: function() { + var matchAll = new RegExp(Prototype.ScriptFragment, 'img'); + var matchOne = new RegExp(Prototype.ScriptFragment, 'im'); + return (this.match(matchAll) || []).map(function(scriptTag) { + return (scriptTag.match(matchOne) || ['', ''])[1]; + }); + }, + + evalScripts: function() { + return this.extractScripts().map(function(script) { return eval(script) }); + }, + + escapeHTML: function() { + var self = arguments.callee; + self.text.data = this; + return self.div.innerHTML; + }, + + unescapeHTML: function() { + var div = document.createElement('div'); + div.innerHTML = this.stripTags(); + return div.childNodes[0] ? (div.childNodes.length > 1 ? + $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) : + div.childNodes[0].nodeValue) : ''; + }, + + toQueryParams: function(separator) { + var match = this.strip().match(/([^?#]*)(#.*)?$/); + if (!match) return {}; + + return match[1].split(separator || '&').inject({}, function(hash, pair) { + if ((pair = pair.split('='))[0]) { + var key = decodeURIComponent(pair.shift()); + var value = pair.length > 1 ? pair.join('=') : pair[0]; + if (value != undefined) value = decodeURIComponent(value); + + if (key in hash) { + if (hash[key].constructor != Array) hash[key] = [hash[key]]; + hash[key].push(value); + } + else hash[key] = value; + } + return hash; + }); + }, + + toArray: function() { + return this.split(''); + }, + + succ: function() { + return this.slice(0, this.length - 1) + + String.fromCharCode(this.charCodeAt(this.length - 1) + 1); + }, + + times: function(count) { + var result = ''; + for (var i = 0; i < count; i++) result += this; + return result; + }, + + camelize: function() { + var parts = this.split('-'), len = parts.length; + if (len == 1) return parts[0]; + + var camelized = this.charAt(0) == '-' + ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1) + : parts[0]; + + for (var i = 1; i < len; i++) + camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1); + + return camelized; + }, + + capitalize: function() { + return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); + }, + + underscore: function() { + return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase(); + }, + + dasherize: function() { + return this.gsub(/_/,'-'); + }, + + inspect: function(useDoubleQuotes) { + var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) { + var character = String.specialChar[match[0]]; + return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16); + }); + if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"'; + return "'" + escapedString.replace(/'/g, '\\\'') + "'"; + }, + + toJSON: function() { + return this.inspect(true); + }, + + unfilterJSON: function(filter) { + return this.sub(filter || Prototype.JSONFilter, '#{1}'); + }, + + evalJSON: function(sanitize) { + var json = this.unfilterJSON(); + try { + if (!sanitize || (/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(json))) + return eval('(' + json + ')'); + } catch (e) { } + throw new SyntaxError('Badly formed JSON string: ' + this.inspect()); + }, + + include: function(pattern) { + return this.indexOf(pattern) > -1; + }, + + startsWith: function(pattern) { + return this.indexOf(pattern) === 0; + }, + + endsWith: function(pattern) { + var d = this.length - pattern.length; + return d >= 0 && this.lastIndexOf(pattern) === d; + }, + + empty: function() { + return this == ''; + }, + + blank: function() { + return /^\s*$/.test(this); + } +}); + +if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, { + escapeHTML: function() { + return this.replace(/&/g,'&').replace(/
' + html.stripScripts() + ' |
' + html.stripScripts() + ' |
fmt may contain:
1) this.exportText+=" colspan='"+newSpan+"'"; + this.exportText+=">"+RicoUtil.getInnerText(cell)+" | "; + } + } + this.exportText+=""; + } + + for (var c=0; c
index | "; + tokensHtml += "type | "; + tokensHtml += "subtype | "; + tokensHtml += "token | "; + tokensHtml += "token tree |
" + (this.tokens.index + 1) + " | "; + tokensHtml += "" + token.type + " | "; + tokensHtml += "" + ((token.subtype.length == 0) ? " " : token.subtype) + " | "; + tokensHtml += "" + ((token.value.length == 0) ? " " : token.value).split(" ").join(" ") + " | "; + tokensHtml += "" + indent() + ((token.value.length == 0) ? " " : token.value).split(" ").join(" ") + " | "; + + tokensHtml += "
+ 0): ?> + + + | ++ + + + | +
Date | +Story | +Title, Blog and Excerpt | +Actions | +|
---|---|---|---|---|
+ + | ++ + | +
+
+
+ () + + |
+ + + | ++ + | +
+ 0): ?> + + + | ++ + + + | +
+ | id | +Date | +Story | +Title, Blog and Excerpt | ++ |
---|
+ 0): ?> + + + | ++ + + + | +
Date | +Story | +Title, Blog and Excerpt | +Actions | +|
---|---|---|---|---|
+ + | ++ + | +
+ ">
+
+ ()
+ ' :
+ '';?>
+ ';?>
+ + + |
+ + + | ++ + | +
+ 0): ?> + + + | ++ + + + | +
+ | id | +Date | +Story | +Title, Blog and Excerpt | ++ |
---|
+ Your trackback has been received properly. +
+ + ++ +
+ + + + + + \ No newline at end of file diff --git a/NP_TrackBack/trunk/trackback/templates/index.html b/NP_TrackBack/trunk/trackback/templates/index.html new file mode 100644 index 0000000..15a2ce4 --- /dev/null +++ b/NP_TrackBack/trunk/trackback/templates/index.html @@ -0,0 +1,34 @@ + +Blog: | +Total | +Action | +
---|---|---|
+ + | ++ + | ++ Trackbacks + | +
+ 0): ?> + + + | ++ + + + | +
Date | +Title, Blog and Excerpt | +Actions | +|
---|---|---|---|
+ + | +
+
+
+ () + + |
+ + + | ++ + | +
+ 0): ?> + + + | ++ + + + | +
Table update:+ diff --git a/NP_TrackBack/trunk/trackback/templates/updatetablefinished.html b/NP_TrackBack/trunk/trackback/templates/updatetablefinished.html new file mode 100644 index 0000000..d94969e --- /dev/null +++ b/NP_TrackBack/trunk/trackback/templates/updatetablefinished.html @@ -0,0 +1,5 @@ + +
+ +
+Table update done ! ++ -- 2.11.0