にへるつおるぐ | src | ブログ | コンタクト | 統計 | | Login |
|
|
ソースコード・スクリプト・パッチ置き場 |
アイテム一覧(新着順)sdl2ics.pl
sdl2ics.pl #!/usr/bin/perl # sdl2ics.pl 2017-1-3 by akebia # Calender.sdl to iCal converter # http://2hz.org/akebia/item/1030 use utf8; use Encode; use Data::ICal; use Data::ICal::Entry::Event; use Data::ICal::Entry::Todo; my @a = (), $w, $event = 0, $todo = 0, $due = 0, $comp = 0; foreach $_ (@ARGV[1..$#ARGV]) { if($_ =~ /^\d+$/){push(@a, $_); next;} $w = lc($_); if($w eq 'event'){$event = 1; next;} if($w eq 'todo'){$todo = 1; next;} if($w eq 'due'){$due = 1; next;} if($w eq 'completed'){$comp = 1; next;} if($w ne ''){die "'$w' is unknown option";} } my $sd = $a[0] ? $a[0] : '00000000'; my $ed = $a[1] ? $a[1] : '99999999'; @a = (); my $b = []; my $i, $fh, $fn = $ARGV[0]; open($fh, $fn) or die "$!"; binmode($fh); while(read($fh, $_, 2) == 2){ for($i = unpack("S<", $_); $i && read($fh, $_, 1); $i--){ $_ = $_ ne "\xff" ? unpack("C", $_) : read($fh, $_, 2) == 2 ? unpack("S<", $_) : 0; unless(read($fh, $_, $_)){$_ = "";} push(@$b, $_); } push(@a, $b); $b = []; } close($fh); my $y = shift(@a); splice(@$y, 0, 100); my $m = shift(@a); splice(@$m, 0, 100); my $d = shift(@a); splice(@$d, 0, 100); $b = shift(@a); splice(@$b, 0, 100); my $ic = Data::ICal->new, $ie; my $ymd, $c = 0; for($i = @$y; $i; $i--){ $ymd = sprintf('%02d%02d%02d', shift(@$y), shift(@$m), shift(@$d)); if($ymd lt $sd or $ymd gt $ed){shift(@$b); next;} $_ = decode('cp932', shift(@$b)); $_ =~ s/\r//g; if($_ =~ /([^\s ][^\n]*)/){$w = $1; $w =~ s/[\s ]+$//;}else{$w = '';} if($event){ $ie = Data::ICal::Entry::Event->new; $ie->add_properties( "UID" => "e$ymd\@$fn", "DTSTART" => ["$ymd", {"VALUE" => "DATE"}], "SUMMARY" => $w, "DESCRIPTION" => $_); $ic->add_entry($ie); $c++; } if($todo){ $ie = Data::ICal::Entry::Todo->new; $ie->add_properties( "UID" => "t$ymd\@$fn", "DTSTART" => ["$ymd", {"VALUE" => "DATE"}], "SUMMARY" => $w, "DESCRIPTION" => $_); $due and $ie->add_property("DUE" => ["$ymd", {"VALUE" => "DATE"}]); $comp and $ie->add_property("STATUS" => "COMPLETED"); $ic->add_entry($ie); $c++; } } binmode(STDOUT); print Encode::encode('utf8', $ic->as_string); print STDERR "$c item(s)\n"; NP_TrackBack.php.patch
NP_TrackBack.php.patch *** NP_TrackBack.php 2008-12-14 21:39:20.000000000 +0900 --- NP_TrackBack.php 2013-08-16 17:14:24.927015497 +0900 *************** *** 1160,1166 **** 'ipblock' => true, ); ! $manager->notify('SpamCheck', array ('spamcheck' => & $spamcheck)); if (isset($spamcheck['result']) && $spamcheck['result'] == true) { --- 1160,1166 ---- 'ipblock' => true, ); ! $_ = array ('spamcheck' => & $spamcheck); $manager->notify('SpamCheck', $_); if (isset($spamcheck['result']) && $spamcheck['result'] == true) { *************** *** 2442,2450 **** /* Plugin API calls, for installation, configuration and setup */ function getName() { return 'TrackBack'; } ! function getAuthor() { return 'rakaz + nakahara21 + hsur'; } ! function getURL() { return 'http://blog.cles.jp/np_cles/category/31/subcatid/3'; } ! function getVersion() { return '2.0.3 jp13'; } function getDescription() { return '[$Revision: 1.311 $]<br />' . _TB_DESCRIPTION; } //modify start+++++++++ --- 2442,2450 ---- /* Plugin API calls, for installation, configuration and setup */ function getName() { return 'TrackBack'; } ! function getAuthor() { return 'rakaz + nakahara21 + hsur + akebia'; } ! function getURL() { return 'http://nyan.co.uk/akebia/item/884'; } ! function getVersion() { return '2.0.3 jp13-1'; } function getDescription() { return '[$Revision: 1.311 $]<br />' . _TB_DESCRIPTION; } //modify start+++++++++ NP_ExtraSkinJP.php.patch
NP_ExtraSkinJP.php.patch *** NP_ExtraSkinJP.php 2007-10-10 16:48:14.000000000 +0900 --- NP_ExtraSkinJP.php 2013-08-16 16:16:12.073238610 +0900 *************** *** 33,41 **** class NP_ExtraSkinJP extends NucleusPlugin { function getName() { return 'ExtraSkinJP'; } ! function getAuthor() { return 'Radek HULAN + Taka + Nucleus(JP) team'; } ! function getURL() { return 'http://japan.nucleuscms.org/wiki/plugins:extraskinjp'; } ! function getVersion() { return '0.4.7'; } function getDescription() { return ''._LANG_NP_EXTRASKINJP10.''; } function supportsFeature($what) { --- 33,41 ---- class NP_ExtraSkinJP extends NucleusPlugin { function getName() { return 'ExtraSkinJP'; } ! function getAuthor() { return 'Radek HULAN + Taka + Nucleus(JP) team + akebia'; } ! function getURL() { return 'http://nyan.co.uk/akebia/item/884'; } ! function getVersion() { return '0.4.7-1'; } function getDescription() { return ''._LANG_NP_EXTRASKINJP10.''; } function supportsFeature($what) { *************** *** 576,588 **** $contenttype = 'text/html'; } if (function_exists("sendContentType")) { ! $manager->notify( ! 'PreSendContentType', ! array( 'contentType' => &$contenttype, 'charset' => &$charset, 'pageType' => 'skin' ! ) ); } if (!headers_sent()) --- 576,589 ---- $contenttype = 'text/html'; } if (function_exists("sendContentType")) { ! $_ = array( 'contentType' => &$contenttype, 'charset' => &$charset, 'pageType' => 'skin' ! ); ! $manager->notify( ! 'PreSendContentType', ! $_ ); } if (!headers_sent()) *************** *** 593,606 **** $skinType = ($o->skintype == 'same') ? $o->skinvartype : 'pageparser'; if (!isset($skin)) $skin = new SKIN($CONF['BaseSkin']); ! $manager->notify('PreSkinParse',array('skin' => &$skin, 'type' => $skinType)); $handler =& new ACTIONS($skinType); $parser =& new PARSER(SKIN::getAllowedActionsForType($o->skinvartype), $handler); $handler->setParser($parser); $parser->parse($o->skin); ! $manager->notify('PostSkinParse',array('skin' => &$skin, 'type' => $skinType)); } } --- 594,607 ---- $skinType = ($o->skintype == 'same') ? $o->skinvartype : 'pageparser'; if (!isset($skin)) $skin = new SKIN($CONF['BaseSkin']); ! $_ = array('skin' => &$skin, 'type' => $skinType); $manager->notify('PreSkinParse',$_); $handler =& new ACTIONS($skinType); $parser =& new PARSER(SKIN::getAllowedActionsForType($o->skinvartype), $handler); $handler->setParser($parser); $parser->parse($o->skin); ! $_ = array('skin' => &$skin, 'type' => $skinType); $manager->notify('PostSkinParse',$_); } } *** extraskinjp/class.php 2004-12-18 23:08:00.000000000 +0900 --- extraskinjp/class.php 2013-08-14 22:30:40.662692313 +0900 *************** *** 16,22 **** function action($action) { $methodName = 'action_' . $action; if (method_exists($this, $methodName)) { ! call_user_func(array(&$this, $methodName)); } else { $this->error(_BADACTION . " ($action)"); } --- 16,22 ---- function action($action) { $methodName = 'action_' . $action; if (method_exists($this, $methodName)) { ! call_user_func(array($this, $methodName)); } else { $this->error(_BADACTION . " ($action)"); } NP_znShowDraft.php.patch
NP_znShowDraft.php.patch *** NP_znShowDraft.php 2007-05-21 20:57:12.000000000 +0900 --- NP_znShowDraft.php 2016-03-12 20:58:47.337823500 +0900 *************** *** 5,12 **** */ class NP_znShowDraft extends NucleusPlugin { function getName() { return 'ShowDraft'; } ! function getURL() { return 'http://wa.otesei.com/NP_znShowDraft'; } ! function getVersion() { return '0.02'; } function supportsFeature($w) { return ($w == 'SqlTablePrefix') ? 1 : 0; } function getDescription() { --- 5,12 ---- */ class NP_znShowDraft extends NucleusPlugin { function getName() { return 'ShowDraft'; } ! function getURL() { return 'http://2hz.org/akebia/item/1002'; } ! function getVersion() { return '0.02-2'; } function supportsFeature($w) { return ($w == 'SqlTablePrefix') ? 1 : 0; } function getDescription() { *************** *** 15,21 **** function getAuthor() { $this->languageInclude(); ! return ''._ZNSD2.''; } function install() { --- 15,21 ---- function getAuthor() { $this->languageInclude(); ! return ''._ZNSD2.' + akebia'; } function install() { *************** *** 75,87 **** global $itemid, $highlight; if (!$member->canAlterItem($itemid)) return; // if ($manager->existsItem($itemid, 1, 0)) return; // ! $manager->notify('PreBlogContent',array('blog' => &$blog, 'type' => 'item')); $query = $blog->getSqlBlog('AND 0 OR i.inumber='.intval($itemid)).' limit 1'; $numrows = $this->numrows($query); if ($numrows) echo $this->getOption('draftHeader'); $blog->showUsingQuery($template, $query, '', 1, 1); if ($numrows) echo $this->getOption('draftfooter'); ! $manager->notify('PostBlogContent',array('blog' => &$blog, 'type' => 'item')); break; } } --- 75,87 ---- global $itemid, $highlight; if (!$member->canAlterItem($itemid)) return; // if ($manager->existsItem($itemid, 1, 0)) return; // ! $_ = array('blog' => &$blog, 'type' => 'item'); $manager->notify('PreBlogContent',$_); $query = $blog->getSqlBlog('AND 0 OR i.inumber='.intval($itemid)).' limit 1'; $numrows = $this->numrows($query); if ($numrows) echo $this->getOption('draftHeader'); $blog->showUsingQuery($template, $query, '', 1, 1); if ($numrows) echo $this->getOption('draftfooter'); ! $_ = array('blog' => &$blog, 'type' => 'item'); $manager->notify('PostBlogContent',$_); break; } } *************** *** 152,158 **** $skin = new SKIN($skinid); if (!$skin->isValid) doError(_ERROR_NOSUCHSKIN); // parse the skin ! $skin->parse('item'); } } ?> --- 152,159 ---- $skin = new SKIN($skinid); if (!$skin->isValid) doError(_ERROR_NOSUCHSKIN); // parse the skin ! $output = $skin->parse('item'); ! echo $output; } } ?> NP_MarkdownEditor.php.patch
NP_MarkdownEditor.php.patch *** NP_MarkdownEditor.php 2007-11-24 00:27:40.000000000 +0900 --- NP_MarkdownEditor.php 2013-08-16 16:18:56.533786622 +0900 *************** *** 32,40 **** class NP_MarkdownEditor extends NucleusPlugin { function getName() { return 'Markdown Editor for Nucleus'; } ! function getAuthor() { return 'yu'; } ! function getVersion() { return '0.1'; } ! function getURL() { return 'http://nucleus.datoka.jp/';} function getMinNucleusVersion() { return 250; } function getDescription() { return _MARKDOWNEDITOR_DESCRIPTION; } function supportsFeature($what) { return (int)($what=='SqlTablePrefix'); } --- 32,40 ---- class NP_MarkdownEditor extends NucleusPlugin { function getName() { return 'Markdown Editor for Nucleus'; } ! function getAuthor() { return 'yu + akebia'; } ! function getVersion() { return '0.1-1'; } ! function getURL() { return 'http://nyan.co.uk/akebia/item/884';} function getMinNucleusVersion() { return 250; } function getDescription() { return _MARKDOWNEDITOR_DESCRIPTION; } function supportsFeature($what) { return (int)($what=='SqlTablePrefix'); } *************** *** 96,102 **** $script=''; $pattern='/<div([^>]*?)class="jsbuttonbar"([^>]*?)>/'; if (preg_match($pattern,$buff,$matches)){ ! $manager->notify('PreToolbarParse',array('lbutton' => &$lbutton, 'rbutton' => &$rbutton, 'script' => &$script)); //$buff=str_replace($matches[0],$matches[0].$lbutton,$buff); $pattern=array('/<\/div>([^<]*?)<textarea([^>]*?)id="inputbody"([^>]*?)>/', --- 96,102 ---- $script=''; $pattern='/<div([^>]*?)class="jsbuttonbar"([^>]*?)>/'; if (preg_match($pattern,$buff,$matches)){ ! $_ = array('lbutton' => &$lbutton, 'rbutton' => &$rbutton, 'script' => &$script); $manager->notify('PreToolbarParse',$_); //$buff=str_replace($matches[0],$matches[0].$lbutton,$buff); $pattern=array('/<\/div>([^<]*?)<textarea([^>]*?)id="inputbody"([^>]*?)>/', NP_znItemCache.php.patch
NP_znItemCache.php.patch *** NP_znItemCache.php 2007-05-15 06:47:18.000000000 +0900 --- NP_znItemCache.php 2013-08-12 19:42:15.476434151 +0900 *************** *** 27,33 **** } if (!$this->checkPluginOption('debugMode')) $this->createOption("debugMode", 'debug mode', 'yesno', 'no'); if (!$this->checkPluginOption('verCheck')) $this->createOption('verCheck', ''._ZNITEMCACHE1.'', 'yesno', 'no'); //version check //vc ! return '0.024'; } function getName() { --- 27,33 ---- } if (!$this->checkPluginOption('debugMode')) $this->createOption("debugMode", 'debug mode', 'yesno', 'no'); if (!$this->checkPluginOption('verCheck')) $this->createOption('verCheck', ''._ZNITEMCACHE1.'', 'yesno', 'no'); //version check //vc ! return '0.024-2'; } function getName() { *************** *** 35,45 **** } function getAuthor() { ! return ''._ZNITEMCACHE2.''; } function getURL() { ! return 'http://wa.otesei.com/NP_znItemCache'; } function supportsFeature($w) { --- 35,45 ---- } function getAuthor() { ! return ''._ZNITEMCACHE2.' + akebia'; } function getURL() { ! return 'http://nyan.co.uk/akebia/item/231'; } function supportsFeature($w) { *************** *** 125,130 **** --- 125,139 ---- function event_PreSkinParse() { global $CONF; + //NP_Revision + $this->rev = requestVar('rev'); + if ($CONF['URLMode'] == 'pathinfo') { + global $virtualpath; + if (preg_match('/revision\/([0-9]+\.[0-9]+)/', $virtualpath, $matches)) { + $this->rev = $matches[1]; + } + } + //$CONF['Self'] $confSelf = $this->getOption('confSelf'); $this->selfArray = array_map('trim', preg_split("/[\r\n]+/", $confSelf)); *************** *** 203,208 **** --- 212,232 ---- function event_PreItem($data) { global $manager; + //NP_Revision + if ($this->rev != '') { + $manager->_loadPlugin('NP_Revision'); $o = $manager->plugins['NP_Revision']; + if($this->rev == $o->eval_Last($data['item']->itemid)) { + $this->rev = ''; + } else { + if ($this->cacheExist($data['item']->itemid)) { + $o->event_PreItem($data); + if($data['item']->body) $this->cacheFound($data); + $manager->subscriptions['PreItem'] = array('NP_znItemCache'); // + return; + } + } + } + // if ($this->cacheExist($data['item']->itemid)) { $this->cacheFound($data); *************** *** 224,230 **** $data['item']->more = $cache['more']; // $manager->subscriptions['PreItem'] = $this->notcachePlugins; ! $manager->notify('PreItem', array('blog' => &$data['blog'], 'item' => &$data['item'])); } else { //unserialize $this->cacheNotFound($data); --- 248,254 ---- $data['item']->more = $cache['more']; // $manager->subscriptions['PreItem'] = $this->notcachePlugins; ! $_ = array('blog' => &$data['blog'], 'item' => &$data['item']); $manager->notify('PreItem', $_); } else { //unserialize $this->cacheNotFound($data); *************** *** 238,244 **** global $manager; // $manager->subscriptions['PreItem'] = array_diff($this->subscriptionsPreItem, $this->notcachePlugins); ! $manager->notify('PreItem', array('blog' => &$data['blog'], 'item' => &$data['item'])); // $ibody = $data['item']->body; $imore = $data['item']->more; --- 262,268 ---- global $manager; // $manager->subscriptions['PreItem'] = array_diff($this->subscriptionsPreItem, $this->notcachePlugins); ! $_ = array('blog' => &$data['blog'], 'item' => &$data['item']); $manager->notify('PreItem', $_); // $ibody = $data['item']->body; $imore = $data['item']->more; *************** *** 250,256 **** } // $manager->subscriptions['PreItem'] = $this->notcachePlugins; ! $manager->notify('PreItem', array('blog' => &$data['blog'], 'item' => &$data['item'])); } // // --- 274,280 ---- } // $manager->subscriptions['PreItem'] = $this->notcachePlugins; ! $_ = array('blog' => &$data['blog'], 'item' => &$data['item']); $manager->notify('PreItem', $_); } // // *************** *** 276,281 **** --- 300,311 ---- //global $manager; //$cacheFileName = $manager->getParserProperty('znItemCachePrefix') . $itemid; global $CONF; + //NP_Revision + if ($this->rev != '') { + $cacheFileName = $CONF['Self'] . $itemid . '/' . $this->rev; + return $this->getDirectory().'cache/'.md5('i'.$cacheFileName); + } + $cacheFileName = $CONF['Self'] . $itemid; return $this->getDirectory().'cache/'.md5('i'.$cacheFileName); } NP_RevisionFirst.php
NP_RevisionFirst.php <?php class NP_RevisionFirst extends NucleusPlugin{ function getName() {return 'Revision First';} function getAuthor() {return 'akebia';} function getURL() {return 'http://nyan.co.uk/akebia/item/235';} function getVersion() {return '1.2';} function getDescription(){return '<%RevisionFirst%>';} function supportsFeature($f) {switch($f){case 'SqlTablePrefix': return 1; default: return 0;}} function doSkinVar($skinType, $itemid = '') {echo $this->eval_First($itemid);} function doTemplateVar(&$item) {echo $this->eval_First($item->itemid);} function eval_First($itemid){ $last = $this->firstRevision($itemid); if($last){ list($base, $sub) = $last; return $base . '.' . $sub; }else{ return '1.0'; } } function firstRevision($inumber) { global $manager; $manager->_loadPlugin('NP_Revision'); $o = $manager->plugins['NP_Revision']; if($o->getOption('acOp1')){ $l = $o->lastRevision($inumber); if($l) $l = $l[0]; else $l = 1; $res = mysql_query( 'SELECT rrevbase, rrevsub FROM ' . sql_table('plugin_revision') . ' WHERE inumber = ' . $inumber . ' AND idraft = 0 AND rrevbase = ' . $l . ' ORDER BY rrevbase ASC, rrevsub ASC LIMIT 1' ); }else{ $res = mysql_query( 'SELECT rrevbase, rrevsub FROM ' . sql_table('plugin_revision') . ' WHERE inumber = ' . $inumber . ' AND idraft = 0' . ' ORDER BY rrevbase ASC, rrevsub ASC LIMIT 1' ); } if($row = mysql_fetch_array($res)) return array($row['rrevbase'], $row['rrevsub']); else return false; } } ?> NP_GenerateURL.php
NP_GenerateURL.php <?php class NP_GenerateURL extends NucleusPlugin{ function getName() {return 'Generate URL';} function getAuthor() {return 'akebia';} function getURL() {return 'http://nyan.co.uk/akebia/item/858';} function getVersion() {return '1.2';} function getDescription(){return '';} function getEventList() {return array('GenerateURL');} function supportsFeature($f){switch($f){ case 'SqlTablePrefix': case 'SqlApi': return 1; default: return 0;}} function event_GenerateURL($data) { global $CONF, $manager, $virtualpath, $blogid; // url already generated if ($data['completed']) return; $params = $data['params']; $extra = $params['extra']; if (!is_array($extra)) $extra = array(); switch ($data['type']) { case 'item': $item_id = intval($params['itemid']); $blog_id = getBlogIDFromItemID($item_id); if ($blog_id == $blogid || !$blog_id) { $base_url = $CONF['ItemURL']; } else { $b =& $manager->getBlog($blog_id); $base_url = $b->getURL(); } if (substr($base_url, -1) != '/') $base_url .= '/'; $url = $base_url.$CONF['ItemKey'].'/'.$item_id; break; case 'member': $member_id = intval($params['memberid']); $url = $CONF['Self'].'/'.$CONF['MemberKey'].'/'.$member_id; break; case 'category': $cat_id = intval($params['catid']); $blog_id = getBlogIDFromCatID($cat_id); if ($blog_id == $blogid) { $base_url = $CONF['CategoryURL']; } elseif(!$blog_id) { $url = $CONF['CategoryURL'].'/'; break; } else { $b =& $manager->getBlog($blog_id); $base_url = $b->getURL(); } if (substr($base_url, -1) != '/') $base_url .= '/'; $url = $base_url.$CONF['CategoryKey'].'/'.$cat_id; break; case 'archivelist': if (!$params['blogid']) { $blog_id = $CONF['DefaultBlog']; } else { $blog_id = intval($params['blogid']); } if ($blog_id == $blogid || !$blog_id) { $base_url = $CONF['ArchiveListURL']; } else { $b =& $manager->getBlog($blog_id); $base_url = $b->getURL(); } if (substr($base_url, -1) != '/') $base_url .= '/'; $url = $base_url.$CONF['ArchivesKey'].'/'.$blog_id; break; case 'archive': $blog_id = intval($params['blogid']); if ($blog_id == $blogid || !$blog_id) { $base_url = $CONF['ArchiveURL']; } else { $b =& $manager->getBlog($blog_id); $base_url = $b->getURL(); } sscanf($params['archive'], '%d-%d-%d', $y, $m, $d); if ($d) { $archive = sprintf('%d-%d-%d', $y, $m, $d); } else { $archive = sprintf('%d-%d', $y, $m); } if (substr($base_url, -1) != '/') $base_url .= '/'; $url = $base_url.$CONF['ArchiveKey'].'/'.$archive; break; case 'blog': $blog_id = intval($params['blogid']); if ($blog_id == $blogid || !$blog_id) { $base_url = $CONF['BlogURL']; } else { $b =& $manager->getBlog($blog_id); $base_url = $b->getURL(); } if (substr($base_url, -1) != '/') $base_url .= '/'; $url = $base_url; break; } if ($extra['blogid'] == $blogid && !preg_match('/(^|\/)('.$CONF['BlogKey'].'|blogid)\//', $virtualpath)) { unset($extra['blogid']); } $data['url'] = addLinkParams($url, $extra); $data['completed'] = TRUE; return $data; } } ?> aw.suspend.js
aw.suspend.js // aw.suspend.js 2013-7-21 by akebia // SetSuspendState // http://nyan.co.uk/akebia/item/848 args = new Array(); objArgs = WScript.Arguments; for (i = 0; i < objArgs.length; i++){args[i] = objArgs(i);} new ActiveXObject("WScript.Shell").Run( 'cmd /C aw.SetSuspendState "' + args.join('" "') + '"', 0, false ); aw.SetSuspendState.c
aw.SetSuspendState.c /* aw.SetSuspendState.c 2013-7-21 by akebia * SetSuspendState * http://nyan.co.uk/akebia/item/848 */ #include <windows.h> #include <PowrProf.h> #include <string.h> int a(int argc, char *argv[], char *s) { int i; for(i = 1; i < argc; i++){ if(stricmp(argv[i], s) == 0) return TRUE; } return FALSE; } int main(int argc, char *argv[]) { return SetSuspendState( a(argc, argv, "Hibernate"), a(argc, argv, "ForceCritical"), a(argc, argv, "DisableWakeEvent") ) == 0 ? -1 : 0; } |