New Blog Articles

From ChekMate Security Group


2008 October 07 11:46:28 MDT
Posted By: Mpiirain
Discussion
Mpiirain's Blog

sdfsdf

Blog Entry: User:Mpiirain/BlogEntry: 2008 October 07 11:46:28 MDT

ZoneDateTime Mediawiki extension
Posted By: Smcnaught
Discussion
Smcnaught's Blog

Contents

ZoneDateTime Mediawiki extension

Recently built this new MediaWiki Extension so that the users of our irc.chekmate.org network would be able to know the time for a specific server.

This extension is super simple. It just determines the time differnce from GMT and then displays it.

Modify as you see fit.

Note: Most up to date version of this extension can be found at: http://www.chekmate.org/wiki/index.php/Projects

Change History

  • 10:30, 2 September 2006 (MDT) - ZoneDateTime.php published (Smcnaught)

Maintainer

Shannon McNaught (smcnaught)

Homepage

ChekMate Technical Focus Group

License

ZoneDateTime.php 
  - Displays Location and Current Timestamp

Copyright (C) 2006  Shannon McNaught

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

Installation

  • Put this file (ZoneDateTime.php) into the extension directory of your mediawiki installation
  • Add the following to the end of LocalSettings.php: include("extensions/ZoneDateTime.php");

Examples

<ZoneDateTime>
London:0:0
Calgary:1:-7
</ZoneDateTime>
<ZoneDateTime>Location:DaylightSaving:ZoneDifference</ZoneDateTime>

Source Code

<?php
# ZoneDateTime Mediawiki extension
#
# original by smcnaught 01.09.2006
# Installation:
#  * put this file (ZoneDateTime.php) into the extension directory of your mediawiki installation
#  * add the following to the end of LocalSettings.php: include("extensions/ZoneDateTime.php");
#
# Examples:
#    <ZoneDateTime>
#     London:0:0
#     Calgary:1:-7
#    </ZoneDateTime>
#
#    <ZoneDateTime>Location:DaylightSaving:ZoneDifference</ZoneDateTime> 
#

#install extension hook
$wgExtensionFunctions[] = "wfZoneDateTimeExtension";

#extension hook callback function
function wfZoneDateTimeExtension() {
  global $wgParser;
  $wgParser->setHook( "ZoneDateTime", "renderZoneDateTime" );
}

#parser hook callback function
function renderZoneDateTime( $input, $argv, &$parser ) {
  global $wgVersion, $wgTitle, $wgDBprefix, $wgOut, $wgUser, $wgRequest;

  // ###### DEFINE VARIABLES TO Nagios Server ######

  // ###### INVALIDATE CACHE ######

  $ts = mktime();
  $now = gmdate("YmdHis", $ts + 120);
  $ns = $wgTitle->getNamespace();
  $ti = wfStrencode($wgTitle->getDBkey());
  $version = preg_replace("/^([1-9]).([1-9]).*/", "\\1\\2", $wgVersion);
  if ($version>14) $sql = "UPDATE $wgDBprefix"."page SET page_touched='$now' WHERE page_namespace=$ns AND page_title='$ti'";
  else             $sql = "UPDATE $wgDBprefix"."cur SET cur_touched='$now' WHERE cur_namespace=$ns AND cur_title='$ti'";
  wfQuery($sql, DB_WRITE, "");
  $Output = "";
  $aParams = explode("\n", $input);
  foreach($aParams as $location) {
    if ($location != "") {
      list($Location, $DaylightSaving, $ZoneDifference) = explode(",", $location);
      $LocationDate = zonedate('Y-m-d H:i:s',$ZoneDifference,$DayLightSavings);
      $output = $output . "$Location ($LocationDate)\n";
    }
  }
  return $output;
}


function zonedate($layout, $countryzone, $daylightsaving)
{
  if ($daylightsaving){
    $daylight_saving = date('I');
    if ($daylight_saving){$zone=3600*($countryzone+1);}
  }
  else {
    if ($countryzone>>0){$zone=3600*$countryzone;}
    else {$zone=0;}
  }
  $date=gmdate($layout, time() + $zone);
  return $date;
}

Blog Entry: User:Smcnaught/BlogEntry: ZoneDateTime Mediawiki extension

2008 September 16 00:07:48 MDT
Posted By: Travimca
Discussion
Travimca's Blog
Blog Entry: User:Travimca/BlogEntry: 2008 September 16 00:07:48 MDT

2008 September 05 23:31:30 MDT
Posted By: Osama
Discussion
Osama's Blog

i oi uopi u i l; jl

Blog Entry: User:Osama/BlogEntry: 2008 September 05 23:31:30 MDT

2008 September 01 03:19:17 MDT
Posted By: Etduck
Discussion
Etduck's Blog

aadafdf

Blog Entry: User:Etduck/BlogEntry: 2008 September 01 03:19:17 MDT

2008 August 14 15:38:38 MDT
Posted By: ZeevN
Discussion
ZeevN's Blog

My second blog entry

Just checking

Blog Entry: User:ZeevN/BlogEntry: 2008 August 14 15:38:38 MDT

2008 August 14 15:31:56 MDT
Posted By: ZeevN
Discussion
ZeevN's Blog

My first entry in this Blog.

Just checking

Blog Entry: User:ZeevN/BlogEntry: 2008 August 14 15:31:56 MDT

2008 August 11 00:58:40 MDT
Posted By: Kimdaejeong
Discussion
Kimdaejeong's Blog

테스트

아하..

Blog Entry: User:Kimdaejeong/BlogEntry: 2008 August 11 00:58:40 MDT

2008 August 04 09:15:46 MDT
Posted By: Jtynev
Discussion
Jtynev's Blog

This is a second test.

Blog Entry: User:Jtynev/BlogEntry: 2008 August 04 09:15:46 MDT

2008 August 04 09:14:49 MDT
Posted By: Jtynev
Discussion
Jtynev's Blog

This is a test.

Blog Entry: User:Jtynev/BlogEntry: 2008 August 04 09:14:49 MDT