Revision history for FrankChestnut


Revision [23203]

Last edited on 2016-05-20 07:38:47 by FrankChestnut [Replaces old-style internal links with new pipe-split links.]
Additions:
~- [[http://dev.pnconcept.com | pnConcept http://dev.pnconcept.com]]
~- [[http://www.postnuke-france.org | PostNuke-France http://www.postnuke-france.org]]
~- [[http://www.postnuke.com | PostNuke http://www.postnuke.com]] ""<img src="images/icons/logos/postnuke.gif" alt="pn icon" />""
~- [[http://community.postnuke.com/Wiki.htm | PostNuke Community Wiki]] ""<img src="images/icons/logos/postnuke.gif" alt="pn icon" />"">>Currently co-developer of the [[http://www.postnuke.com | PostNuke]] CMS, I am building a [[http://www.postnuke.com | PostNuke]] module based on pnWikka.
pnWikka is a module for [[http://www.postnuke.com | PostNuke]] based on Wikka. Since PostNuke already gives different technologies like an API, user management, permission system and a template engine, pnWikka became a "fork" of Wikka for PostNuke. Most if not all aspect of Wikka was rewritten to be PostNuke Compliant.
Deletions:
~- [[http://dev.pnconcept.com pnConcept http://dev.pnconcept.com]]
~- [[http://www.postnuke-france.org PostNuke-France http://www.postnuke-france.org]]
~- [[http://www.postnuke.com PostNuke http://www.postnuke.com]] ""<img src="images/icons/logos/postnuke.gif" alt="pn icon" />""
~- [[http://community.postnuke.com/Wiki.htm PostNuke Community Wiki]] ""<img src="images/icons/logos/postnuke.gif" alt="pn icon" />"">>Currently co-developer of the [[http://www.postnuke.com PostNuke]] CMS, I am building a [[http://www.postnuke.com PostNuke]] module based on pnWikka.
pnWikka is a module for [[http://www.postnuke.com PostNuke]] based on Wikka. Since PostNuke already gives different technologies like an API, user management, permission system and a template engine, pnWikka became a "fork" of Wikka for PostNuke. Most if not all aspect of Wikka was rewritten to be PostNuke Compliant.


Revision [19156]

Edited on 2008-01-28 00:14:03 by FrankChestnut [Modified links pointing to docs server]

No Differences

Revision [16909]

Edited on 2007-05-31 23:27:10 by FrankChestnut [Reverted]
Additions:
$pnRender =& New pnRender('pnWikka');
//$pnRender->caching = false;
// Assign the values to the template
$pnRender->Assign($pages);
$pnRender->Assign('uname', $uname);
$pnRender->Assign('percent', round(($pages['count']/$pages['total'])*100, 2));
// Return the template to the system
return $pnRender->Fetch('pnwikka_action_ownedpages.tpl', $uname);
}%%
The "Load All pages Owned By User" function...
function pnWikka_userapi_LoadAllPagesOwnedByUser($args)
extract($args);
unset($args);
if (!isset($uname)) {
return false;
$dbconn =& pnDBGetConn(true);
$pntable =& pnDBGetTables();
$tbl = &$pntable['pnwikka_pages'];
$col = &$pntable['pnwikka_pages_column'];
$sql = "SELECT $col[id],
$col[tag],
$col[time],
$col[body],
$col[owner],
$col[user],
$col[note],
$col[handler]
FROM $tbl
WHERE $col[owner] = '".pnVarPrepForStore($uname)."'
AND $col[latest] = 'Y'
ORDER BY $col[tag] ASC";
$result =& $dbconn->Execute($sql);
if ($dbconn->ErrorNo() != 0) {
pnSessionSetVar('errormsg', pnVarPrepForDisplay(_PNWIKKA_GETLOADALLPAGESBYUSERFAILED."".$dbconn->ErrorMsg()));
return false;
$pages = array();
$i = 0;
for (; !$result->EOF; $result->MoveNext()) {
list($id,
$tag,
$time,
$body,
$owner,
$user,
$note,
$handler) = $result->fields;
// Permission check
if (pnSecAuthAction(0, 'pnWikka::', "page::$page_tag", ACCESS_READ)) {
$i++;
$pages[] = array('id' => $id,
'tag' => $tag,
'time' => $time,
'body' => $body,
'owner' => $owner,
'user' => $user,
'note' => $note,
'handler' => $handler);
}
$result->Close();
$allpages = array();
$allpages['pages'] = $pages;
$allpages['count'] = $i;
$allpages['total'] = pnModAPIFunc('pnWikka', 'user', 'CountAllPages');
return $allpages;
}%%
The template...
%%(html4strict)
<blockquote>
You own <strong><!--[$count]--></strong> pages out of the <strong><!--[$total]--></strong> pages on this wiki.<br />
This means you own <strong><!--[$percent]-->%</strong> of the total.
</blockquote>
%%
The template is translated via a language file containing a define :
<?php
if (!defined('_PNWIKKA_ACTION_OWNEDPAGES')) {
define('_PNWIKKA_ACTION_OWNEDPAGES', 'You own <strong>%count%</strong> pages out of the <strong>%total%</strong> pages on this wiki.<br />This means you own <strong>%percent% %</strong> of the total.');
define('_PNWIKKA_ACTION_OWNEDPAGESERROR', 'Error getting pages !');
}
?>
%%
The final template after being translated uses a PostNuke Smarty plugin:
%%(html4strict)
<blockquote>
<!--[pnml name='_PNWIKKA_ACTION_OWNEDPAGES' count=$count total=$total percent=$percent html=true]-->
</blockquote>
%%
----
Wikka was chosen for all the good reasons already mentioned here and there and it would be very repetitive to write them all again. Let's just say that it was simply the best out there and the easiest to work on. ;-)
----
=====Also=====
DatabaseAbstraction
SpamSafeEmail
----
CategoryUsers
Deletions:
$pnRender =


Revision [16707]

Edited on 2007-05-31 10:38:28 by JwcUaj [Reverted]
Additions:
$pnRender =
Deletions:
$pnRender =& New pnRender('pnWikka');
//$pnRender->caching = false;
// Assign the values to the template
$pnRender->Assign($pages);
$pnRender->Assign('uname', $uname);
$pnRender->Assign('percent', round(($pages['count']/$pages['total'])*100, 2));
// Return the template to the system
return $pnRender->Fetch('pnwikka_action_ownedpages.tpl', $uname);
}%%
The "Load All pages Owned By User" function...
function pnWikka_userapi_LoadAllPagesOwnedByUser($args)
extract($args);
unset($args);
if (!isset($uname)) {
return false;
$dbconn =& pnDBGetConn(true);
$pntable =& pnDBGetTables();
$tbl = &$pntable['pnwikka_pages'];
$col = &$pntable['pnwikka_pages_column'];
$sql = "SELECT $col[id],
$col[tag],
$col[time],
$col[body],
$col[owner],
$col[user],
$col[note],
$col[handler]
FROM $tbl
WHERE $col[owner] = '".pnVarPrepForStore($uname)."'
AND $col[latest] = 'Y'
ORDER BY $col[tag] ASC";
$result =& $dbconn->Execute($sql);
if ($dbconn->ErrorNo() != 0) {
pnSessionSetVar('errormsg', pnVarPrepForDisplay(_PNWIKKA_GETLOADALLPAGESBYUSERFAILED."".$dbconn->ErrorMsg()));
return false;
$pages = array();
$i = 0;
for (; !$result->EOF; $result->MoveNext()) {
list($id,
$tag,
$time,
$body,
$owner,
$user,
$note,
$handler) = $result->fields;
// Permission check
if (pnSecAuthAction(0, 'pnWikka::', "page::$page_tag", ACCESS_READ)) {
$i++;
$pages[] = array('id' => $id,
'tag' => $tag,
'time' => $time,
'body' => $body,
'owner' => $owner,
'user' => $user,
'note' => $note,
'handler' => $handler);
}
$result->Close();
$allpages = array();
$allpages['pages'] = $pages;
$allpages['count'] = $i;
$allpages['total'] = pnModAPIFunc('pnWikka', 'user', 'CountAllPages');
return $allpages;
}%%
The template...
%%(html4strict)
<blockquote>
You own <strong><!--[$count]--></strong> pages out of the <strong><!--[$total]--></strong> pages on this wiki.<br />
This means you own <strong><!--[$percent]-->%</strong> of the total.
</blockquote>
%%
The template is translated via a language file containing a define :
<?php
if (!defined('_PNWIKKA_ACTION_OWNEDPAGES')) {
define('_PNWIKKA_ACTION_OWNEDPAGES', 'You own <strong>%count%</strong> pages out of the <strong>%total%</strong> pages on this wiki.<br />This means you own <strong>%percent% %</strong> of the total.');
define('_PNWIKKA_ACTION_OWNEDPAGESERROR', 'Error getting pages !');
}
?>
%%
The final template after being translated uses a PostNuke Smarty plugin:
%%(html4strict)
<blockquote>
<!--[pnml name='_PNWIKKA_ACTION_OWNEDPAGES' count=$count total=$total percent=$percent html=true]-->
</blockquote>
%%
----
Wikka was chosen for all the good reasons already mentioned here and there and it would be very repetitive to write them all again. Let's just say that it was simply the best out there and the easiest to work on. ;-)
----
=====Also=====
DatabaseAbstraction
SpamSafeEmail
----
CategoryUsers


Revision [14601]

Edited on 2006-06-14 11:30:31 by FrankChestnut [Fixed link and code]
Additions:
~- [[http://community.postnuke.com/Wiki.htm PostNuke Community Wiki]] ""<img src="images/icons/logos/postnuke.gif" alt="pn icon" />"">>Currently co-developer of the [[http://www.postnuke.com PostNuke]] CMS, I am building a [[http://www.postnuke.com PostNuke]] module based on pnWikka.
$pages[] = array('id' => $id,
'tag' => $tag,
'time' => $time,
'body' => $body,
'owner' => $owner,
'user' => $user,
'note' => $note,
'handler' => $handler);
%%(html4strict)
%%(html4strict)
Deletions:
~- [[http://community.postnuke.com PostNuke Community Wiki]] ""<img src="images/icons/logos/postnuke.gif" alt="pn icon" />"">>Currently co-developer of the [[http://www.postnuke.com PostNuke]] CMS, I am building a [[http://www.postnuke.com PostNuke]] module based on pnWikka.
$pages[] = array('id' => $id,
'tag' => $tag,
'time' => $time,
'body' => $body,
'owner' => $owner,
'user' => $user,
'note' => $note,
'handler' => $handler);


Revision [14600]

Edited on 2006-06-14 11:26:53 by FrankChestnut [Added pncommunity link]
Additions:
~- [[http://www.postnuke.com PostNuke http://www.postnuke.com]] ""<img src="images/icons/logos/postnuke.gif" alt="pn icon" />""
~- [[http://community.postnuke.com PostNuke Community Wiki]] ""<img src="images/icons/logos/postnuke.gif" alt="pn icon" />"">>Currently co-developer of the [[http://www.postnuke.com PostNuke]] CMS, I am building a [[http://www.postnuke.com PostNuke]] module based on pnWikka.
pnWikka is a module for [[http://www.postnuke.com PostNuke]] based on Wikka. Since PostNuke already gives different technologies like an API, user management, permission system and a template engine, pnWikka became a "fork" of Wikka for PostNuke. Most if not all aspect of Wikka was rewritten to be PostNuke Compliant.
Deletions:
~- [[http://www.postnuke.com PostNuke http://www.postnuke.com]] ""<img src="images/icons/logos/postnuke.gif" alt="pn icon" />"">>Currently co-developer of the PostNuke CMS, I am building a PostNuke module based on pnWikka.
pnWikka is a module for PostNuke based on Wikka. Since PostNuke already gives different technologies like an API, user management, permission system and a template engine, pnWikka became a "fork" of Wikka for PostNuke. Most if not all aspect of Wikka was rewritten to be PostNuke Compliant.


Revision [13867]

Edited on 2006-04-16 10:57:57 by FrankChestnut [Added Spamsafeemail link]
Additions:
SpamSafeEmail


Revision [13314]

Edited on 2006-02-26 20:56:32 by FrankChestnut [fixed a glitch in the code tag]
Additions:
define('_PNWIKKA_ACTION_OWNEDPAGES', 'You own <strong>%count%</strong> pages out of the <strong>%total%</strong> pages on this wiki.<br />This means you own <strong>%percent% %</strong> of the total.');
Deletions:
define('_PNWIKKA_ACTION_OWNEDPAGES', 'You own <strong>%count%</strong> pages out of the <strong>%total%</strong> pages on this wiki.<br />This means you own <strong>%percent%%</strong> of the total.');


Revision [13313]

Edited on 2006-02-26 20:54:35 by FrankChestnut [added translation part]
Additions:
The template is translated via a language file containing a define :
<?php
if (!defined('_PNWIKKA_ACTION_OWNEDPAGES')) {
define('_PNWIKKA_ACTION_OWNEDPAGES', 'You own <strong>%count%</strong> pages out of the <strong>%total%</strong> pages on this wiki.<br />This means you own <strong>%percent%%</strong> of the total.');
define('_PNWIKKA_ACTION_OWNEDPAGESERROR', 'Error getting pages !');
}
?>
The final template after being translated uses a PostNuke Smarty plugin:
<!--[pnml name='_PNWIKKA_ACTION_OWNEDPAGES' count=$count total=$total percent=$percent html=true]-->


Revision [13300]

Edited on 2006-02-25 09:46:36 by FrankChestnut [removed db abstract part...]
Additions:
=====Also=====
DatabaseAbstraction
Deletions:
=====Database Abstraction=====
(To be moved to an appropriate page under the ""CategoryDevelopment"" category.)
As I use ADODB on other projects (like PostNuke), I did a little hacking session with my Wikka.
The very big downside of changing to ADODB is that all the Wikka project must be reviewed to do the appropriate changes where MySQL calls are made. Some SQL calls are also to be revised for optimisation or compatibility fix.
ADODB will also add an extra load but the I doubt it would be such a big thing considering the... up side.
The up side is that wikka could work on different DB types like postgresql, oracle, MSSQL, etc...
====Application====
As I am quite lazy, I took the adodb folder from the PostNuke cvs (as it was already on my computer anyway) and copied it to my Wikka/3rdparty/core/adodb.
Next was to add some parameters in the wikka.config.php...
//..... under the last values...
"geshi_tab width" => "4",
"wakka_version" => "1.1.6.1",
"adodb_temp" => "Temp", // This assumes that you have a temporary folder for caching
"encoded" => 0,
"dbtype" => "mysql",
"pconnect" => 0
);
Then the big change comes...
Added functions : DBInit inside the Wakka class
function DBInit($config)
{
$this->config = $config;
// ADODB configuration
global $ADODB_CACHE_DIR;
$ADODB_CACHE_DIR = realpath($this->config["adodb_temp"] . '/adodb');
if (!defined('ADODB_DIR')) {
define('ADODB_DIR', '3rdparty/core/adodb');
}
include ADODB_DIR.'/adodb.inc.php';
// ADODB Error handle
if ($this->GetConfigValue("sql_debugging")) {
include ADODB_DIR.'/adodb-errorhandler.inc.php';
}
// Decode encoded DB parameters
if ($this->config["encoded"]) {
$this->config["mysql_user"] = base64_decode($this->config["mysql_user"]);
$this->config["mysql_password"] = base64_decode($this->config["mysql_password"]);
$this->config["encoded"] = 0;
}
$dbtype = $this->config["dbtype"];
$dbhost = $this->config["mysql_host"];
$dbname = $this->config["mysql_database"];
$dbuname = $this->config["mysql_user"];
$dbpass = $this->config["mysql_password"];
$pconnect = $this->config["pconnect"];
$this->wikkadb =& ADONewConnection($dbtype);
if ($pconnect) {
$dbh = $this->wikkadb->PConnect($dbhost, $dbuname, $dbpass, $dbname);
} else {
// itevo: /Go; It's more safe to use NConnect instead of Connect because of the following:
// If you create two connections, but both use the same userid and password, PHP will share the same connection.
// This can cause problems if the connections are meant to different databases.
// The solution is to always use different userid's for different databases, or use NConnect().
// NConnect: Always force a new connection. In contrast, PHP sometimes reuses connections when you use Connect() or PConnect().
// Currently works only on mysql (PHP 4.3.0 or later), postgresql and oci8-derived drivers.
// For other drivers, NConnect() works like Connect().
$dbh = $this->wikkadb->NConnect($dbhost, $dbuname, $dbpass, $dbname);
}
global $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
// force oracle to a consistent date format for comparison methods later on
if (strcmp($dbtype, 'oci8') == 0) {
$this->wikkadb->Execute("alter session set NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'");
}
return true;
}
Modified functions : Wakka
// constructor
function Wakka($config)
{
$this->config = $config;
$this->dblink = $this->DBInit($config);
$this->VERSION = WAKKA_VERSION;
}
function Query
// DATABASE
function Query($query)
{
$start = $this->GetMicroTime();
// Get a reference to the DB Setup
$wikkadb =& $this->wikkadb;
// Execute query
$result = $wikkadb->Execute($query);
// On error, show the ADODB ErrorMsg()
if ($wikkadb->ErrorNo() != 0) {
die("Query failed: ".$query." (".$wikkadb->ErrorMsg().")");
}
if ($this->GetConfigValue("sql_debugging"))
{
$time = $this->GetMicroTime() - $start;
$this->queryLog[] = array("query" => $query,
"time" => $time);
}
// Return result
return $result;
}
Load ALL
function LoadAll($query)
{
$data = array();
if ($result = $this->Query($query))
{
// Put items into result array.
for (; !$result->EOF; $result->MoveNext()) {
$data[] = $result->GetRowAssoc(2);
}
// All successful database queries produce a result set, and that result
// set should be closed when it has been finished with.
$result->Close();
return $data;
}
Modified action to reflect the use of the new db calls...
highscores.php
<?php
# highscores.php {{HighScores}}
# by Chris Tessmer
# 19 Dec 2002
# license: GPL
$prefix = $this->config["table_prefix"];
$userstbl = $prefix . 'users';
$pagestbl = $prefix . 'pages';

$str = "SELECT Count(*) AS cnt, name
FROM $userstbl, $pagestbl
WHERE name = owner
AND latest = 'Y'
GROUP BY name
ORDER BY cnt DESC";
$rankQuery = $this->Query( $str );
$str = "SELECT COUNT(*) AS total FROM $pagestbl WHERE latest = 'Y'";
$totalQuery = $this->Query( $str );
$total = $totalQuery->fields[0];//mysql_result($totalQuery, 0);
print( "<blockquote><table>" );
$i = 0;
for(; !$rankQuery->EOF; $rankQuery->MoveNext()) //mysql_fetch_array($rankQuery) )
{
list($cnt, $name) = $rankQuery->fields;
$i++;
$str = '<tr>';
$str .= "<td>$i.  </td>";
$str .= '<td>'. $this->Format( $name ) .'</td>';
$str .= '<td> </td>';
$str .= '<td>    </td>';
$str .= '<td>'.$cnt.'</td>';
$str .= '<td>    </td>';
$str .= '<td>'.round( ($cnt/$total)*100, 2).'% </td>';
//$str .= '<td>'.$total.'</td>';
$str .= '</tr>';
print( $str );
print( "</table></blockquote>" );
?>
countowned.php
<?php
/**
* Print number of pages owned by the current user.
*/
$str = 'SELECT COUNT(*) FROM '.$this->config["table_prefix"].'pages WHERE `owner` ';
$str .= "= '" . $this->GetUserName() . "' AND `latest` = 'Y'";
$countquery = $this->Query($str);
$count = $countquery->fields[0]; //mysql_result($countquery, 0);
echo $this->Link('MyPages', '', $count,'','','Display a list of the pages you currently own');
?>
This won't work on the full setup of course as I only did the minimum to be able to see if wikka was showing something after my changes and it was made on an already installed wikka. But it might help the Wikka dev team see where it can go.
FC. 22-02-2006


Revision [13259]

Edited on 2006-02-22 19:26:33 by FrankChestnut [small code consistency fix...]
Additions:
$prefix = $this->config["table_prefix"];
$userstbl = $prefix . 'users';
$pagestbl = $prefix . 'pages';

$str = "SELECT Count(*) AS cnt, name
FROM $userstbl, $pagestbl
WHERE name = owner
AND latest = 'Y'
GROUP BY name
ORDER BY cnt DESC";
$str = "SELECT COUNT(*) AS total FROM $pagestbl WHERE latest = 'Y'";
list($cnt, $name) = $rankQuery->fields;
$str .= '<td>'. $this->Format( $name ) .'</td>';
$str .= '<td>'.$cnt.'</td>';
$str .= '<td>'.round( ($cnt/$total)*100, 2).'% </td>';
Deletions:
$str = 'SELECT Count(*) AS cnt, `name` FROM ';
$str .= $this->config["table_prefix"] . 'users, ' ;
$str .= $this->config["table_prefix"].'pages ';
$str .= "WHERE `name` = `owner` AND `latest` = 'Y' GROUP BY name ORDER BY cnt DESC;";
$str = 'SELECT COUNT(*) AS total FROM '.$this->config["table_prefix"].'pages WHERE `latest` = \'Y\' ';
$row = $rankQuery->GetRowAssoc(2);
$str .= '<td>'. $this->Format( $row["name"] ) .'</td>';
$str .= '<td>'.$row["cnt"].'</td>';
$str .= '<td>'.round( ($row["cnt"]/$total)*100, 2).'% </td>';


Revision [13251]

Edited on 2006-02-22 11:35:49 by FrankChestnut [database abstraction...]
Additions:
=====Database Abstraction=====
(To be moved to an appropriate page under the ""CategoryDevelopment"" category.)
As I use ADODB on other projects (like PostNuke), I did a little hacking session with my Wikka.
The very big downside of changing to ADODB is that all the Wikka project must be reviewed to do the appropriate changes where MySQL calls are made. Some SQL calls are also to be revised for optimisation or compatibility fix.
ADODB will also add an extra load but the I doubt it would be such a big thing considering the... up side.
The up side is that wikka could work on different DB types like postgresql, oracle, MSSQL, etc...
====Application====
As I am quite lazy, I took the adodb folder from the PostNuke cvs (as it was already on my computer anyway) and copied it to my Wikka/3rdparty/core/adodb.
Next was to add some parameters in the wikka.config.php...
//..... under the last values...
"geshi_tab width" => "4",
"wakka_version" => "1.1.6.1",
"adodb_temp" => "Temp", // This assumes that you have a temporary folder for caching
"encoded" => 0,
"dbtype" => "mysql",
"pconnect" => 0
);
Then the big change comes...
Added functions : DBInit inside the Wakka class
function DBInit($config)
{
$this->config = $config;
// ADODB configuration
global $ADODB_CACHE_DIR;
$ADODB_CACHE_DIR = realpath($this->config["adodb_temp"] . '/adodb');
if (!defined('ADODB_DIR')) {
define('ADODB_DIR', '3rdparty/core/adodb');
}
include ADODB_DIR.'/adodb.inc.php';
// ADODB Error handle
if ($this->GetConfigValue("sql_debugging")) {
include ADODB_DIR.'/adodb-errorhandler.inc.php';
}
// Decode encoded DB parameters
if ($this->config["encoded"]) {
$this->config["mysql_user"] = base64_decode($this->config["mysql_user"]);
$this->config["mysql_password"] = base64_decode($this->config["mysql_password"]);
$this->config["encoded"] = 0;
}
$dbtype = $this->config["dbtype"];
$dbhost = $this->config["mysql_host"];
$dbname = $this->config["mysql_database"];
$dbuname = $this->config["mysql_user"];
$dbpass = $this->config["mysql_password"];
$pconnect = $this->config["pconnect"];
$this->wikkadb =& ADONewConnection($dbtype);
if ($pconnect) {
$dbh = $this->wikkadb->PConnect($dbhost, $dbuname, $dbpass, $dbname);
} else {
// itevo: /Go; It's more safe to use NConnect instead of Connect because of the following:
// If you create two connections, but both use the same userid and password, PHP will share the same connection.
// This can cause problems if the connections are meant to different databases.
// The solution is to always use different userid's for different databases, or use NConnect().
// NConnect: Always force a new connection. In contrast, PHP sometimes reuses connections when you use Connect() or PConnect().
// Currently works only on mysql (PHP 4.3.0 or later), postgresql and oci8-derived drivers.
// For other drivers, NConnect() works like Connect().
$dbh = $this->wikkadb->NConnect($dbhost, $dbuname, $dbpass, $dbname);
}
global $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
// force oracle to a consistent date format for comparison methods later on
if (strcmp($dbtype, 'oci8') == 0) {
$this->wikkadb->Execute("alter session set NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'");
}
return true;
}
Modified functions : Wakka
// constructor
function Wakka($config)
{
$this->config = $config;
$this->dblink = $this->DBInit($config);
$this->VERSION = WAKKA_VERSION;
}
function Query
// DATABASE
function Query($query)
{
$start = $this->GetMicroTime();
// Get a reference to the DB Setup
$wikkadb =& $this->wikkadb;
// Execute query
$result = $wikkadb->Execute($query);
// On error, show the ADODB ErrorMsg()
if ($wikkadb->ErrorNo() != 0) {
die("Query failed: ".$query." (".$wikkadb->ErrorMsg().")");
}
if ($this->GetConfigValue("sql_debugging"))
{
$time = $this->GetMicroTime() - $start;
$this->queryLog[] = array("query" => $query,
"time" => $time);
}
// Return result
return $result;
}
Load ALL
function LoadAll($query)
{
$data = array();
if ($result = $this->Query($query))
{
// Put items into result array.
for (; !$result->EOF; $result->MoveNext()) {
$data[] = $result->GetRowAssoc(2);
}
// All successful database queries produce a result set, and that result
// set should be closed when it has been finished with.
$result->Close();
return $data;
}
Modified action to reflect the use of the new db calls...
highscores.php
<?php
# highscores.php {{HighScores}}
# by Chris Tessmer
# 19 Dec 2002
# license: GPL
$str = 'SELECT Count(*) AS cnt, `name` FROM ';
$str .= $this->config["table_prefix"] . 'users, ' ;
$str .= $this->config["table_prefix"].'pages ';
$str .= "WHERE `name` = `owner` AND `latest` = 'Y' GROUP BY name ORDER BY cnt DESC;";
$rankQuery = $this->Query( $str );
$str = 'SELECT COUNT(*) AS total FROM '.$this->config["table_prefix"].'pages WHERE `latest` = \'Y\' ';
$totalQuery = $this->Query( $str );
$total = $totalQuery->fields[0];//mysql_result($totalQuery, 0);
print( "<blockquote><table>" );
$i = 0;
for(; !$rankQuery->EOF; $rankQuery->MoveNext()) //mysql_fetch_array($rankQuery) )
{
$row = $rankQuery->GetRowAssoc(2);
$i++;
$str = '<tr>';
$str .= "<td>$i.  </td>";
$str .= '<td>'. $this->Format( $row["name"] ) .'</td>';
$str .= '<td> </td>';
$str .= '<td>    </td>';
$str .= '<td>'.$row["cnt"].'</td>';
$str .= '<td>    </td>';
$str .= '<td>'.round( ($row["cnt"]/$total)*100, 2).'% </td>';
//$str .= '<td>'.$total.'</td>';
$str .= '</tr>';
print( $str );
print( "</table></blockquote>" );
?>
countowned.php
<?php
/**
* Print number of pages owned by the current user.
*/
$str = 'SELECT COUNT(*) FROM '.$this->config["table_prefix"].'pages WHERE `owner` ';
$str .= "= '" . $this->GetUserName() . "' AND `latest` = 'Y'";
$countquery = $this->Query($str);
$count = $countquery->fields[0]; //mysql_result($countquery, 0);
echo $this->Link('MyPages', '', $count,'','','Display a list of the pages you currently own');
?>
This won't work on the full setup of course as I only did the minimum to be able to see if wikka was showing something after my changes and it was made on an already installed wikka. But it might help the Wikka dev team see where it can go.
FC. 22-02-2006


Revision [13232]

Edited on 2006-02-20 06:24:15 by FrankChestnut [Added categoryuser link]
Additions:
----
CategoryUsers


Revision [13231]

Edited on 2006-02-20 05:54:03 by FrankChestnut [Fixed missin quote]
Additions:
ORDER BY $col[tag] ASC";
Deletions:
ORDER BY $col[tag] ASC;


Revision [13230]

Edited on 2006-02-20 05:34:34 by FrankChestnut [Removed select limit params]
Deletions:
if (!isset($startnum) || !is_numeric($startnum)) {
$startnum = 1;
if (!isset($numitems) || !is_numeric($numitems)) {
$numitems = -1;


Revision [13229]

Edited on 2006-02-20 05:33:36 by FrankChestnut [minor clean up - pn icon]
Additions:
~- [[http://www.postnuke.com PostNuke http://www.postnuke.com]] ""<img src="images/icons/logos/postnuke.gif" alt="pn icon" />"">>Currently co-developer of the PostNuke CMS, I am building a PostNuke module based on pnWikka.
ORDER BY $col[tag] ASC;
Deletions:
~- [[http://www.postnuke.com PostNuke http://www.postnuke.com]] >>Currently co-developer of the PostNuke CMS, I am building a PostNuke module based on pnWikka.
//if (isset($alpha) && $alpha == 1) {
$orderby = "ORDER BY $col[tag] ASC";
//} else {
// $orderby = "ORDER BY $col[time] DESC, $col[tag] ASC";
//}
$orderby";


Revision [13228]

The oldest known version of this page was created on 2006-02-20 05:29:33 by FrankChestnut [minor clean up - pn icon]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki