Revision history for DanWest


Revision [23313]

Last edited on 2016-05-20 07:38:47 by DanWest [Replaces old-style internal links with new pipe-split links.]
Additions:
~- [[DanWestCustomNav | Custom Navigation Links]] - Define custom menu per page.
~- [[DanWestIncludeFile | Include File action]] - Include RAW text into page.
~- [[DanWestCRT | CRT Code Display Formatter]] - CODE formatter to look like CRT output.
~- [[DanWestPgHeader | Custom Page Header]] - Better control over page title.
~- [[DanWestUserReg | User Registration]] - Let Admin register users.
~- [[DanWestWx | Weather Forecast]] - Include current forecast
~- [[DanWestLink | Wiki Link Action]] - Shows link ONLY if current user has read access
~- [[DanWestCalendar | Calendar "code" Formatter]] - Uses code formatting engine to create a calendar
The result ([[http://www.posr.com | www.posr.com]]) is that the only indication is a very small login prompt on the bottom of our pages. Our inhouse publishers login to manage content. To manage images and product PDF files, I setup various ""ImageLib"" pages with the ""{{files}}"" action. Then, users will upload PDF files, images, driver updates, etc to these pages. Then I setup Interwiki links so the can just enter ""[[PDF:brochure.pdf | Title]]"" links and it all works. //Very nicely done Wikka...//
Deletions:
~- [[DanWestCustomNav Custom Navigation Links]] - Define custom menu per page.
~- [[DanWestIncludeFile Include File action]] - Include RAW text into page.
~- [[DanWestCRT CRT Code Display Formatter]] - CODE formatter to look like CRT output.
~- [[DanWestPgHeader Custom Page Header]] - Better control over page title.
~- [[DanWestUserReg User Registration]] - Let Admin register users.
~- [[DanWestWx Weather Forecast]] - Include current forecast
~- [[DanWestLink Wiki Link Action]] - Shows link ONLY if current user has read access
~- [[DanWestCalendar Calendar "code" Formatter]] - Uses code formatting engine to create a calendar
The result ([[http://www.posr.com www.posr.com]]) is that the only indication is a very small login prompt on the bottom of our pages. Our inhouse publishers login to manage content. To manage images and product PDF files, I setup various ""ImageLib"" pages with the ""{{files}}"" action. Then, users will upload PDF files, images, driver updates, etc to these pages. Then I setup Interwiki links so the can just enter ""[[PDF:brochure.pdf Title]]"" links and it all works. //Very nicely done Wikka...//


Revision [19452]

Edited on 2008-01-28 00:16:02 by DanWest [Modified links pointing to docs server]

No Differences

Revision [17849]

Edited on 2007-12-18 17:06:40 by DanWest [Modified links pointing to docs server]
Additions:
~- [[DanWestCalendar Calendar "code" Formatter]] - Uses code formatting engine to create a calendar


Revision [16350]

Edited on 2007-03-29 18:14:20 by DanWest [Minor Edits]
Deletions:
===Admin User Registration===
Since I was using Wikka as a content management system and did not want the general public to be able to register, I needed to have a method to register users under administrator control. I hack up the user registration action from DarTar. The main function is it allows you to register a user but does NOT log you in after doing so. So it allows you to add a new user to the database with all the validations but will not log you in to that user. It also checks to make sure you have 'write' access to the page the action is defined on as a basic permission trigger to allow you to register users.


Revision [16349]

Edited on 2007-03-29 18:11:24 by DanWest [Minor Edits]
Additions:
The result ([[http://www.posr.com www.posr.com]]) is that the only indication is a very small login prompt on the bottom of our pages. Our inhouse publishers login to manage content. To manage images and product PDF files, I setup various ""ImageLib"" pages with the ""{{files}}"" action. Then, users will upload PDF files, images, driver updates, etc to these pages. Then I setup Interwiki links so the can just enter ""[[PDF:brochure.pdf Title]]"" links and it all works. //Very nicely done Wikka...//
Deletions:
The result (www.posr.com) is that the only indication is a very small login prompt on the bottom of our pages. Our inhouse publishers login to manage content. To manage images and product PDF files, I setup various ""ImageLib"" pages with the ""{{files}}"" action. Then, users will upload PDF files, images, driver updates, etc to these pages. Then I setup Interwiki links so the can just enter ""[[PDF:brochure.pdf Title]]"" links and it all works. //Very nicely done Wikka...//


Revision [16348]

Edited on 2007-03-29 18:10:56 by DanWest [Minor Edits]
Additions:
The result (www.posr.com) is that the only indication is a very small login prompt on the bottom of our pages. Our inhouse publishers login to manage content. To manage images and product PDF files, I setup various ""ImageLib"" pages with the ""{{files}}"" action. Then, users will upload PDF files, images, driver updates, etc to these pages. Then I setup Interwiki links so the can just enter ""[[PDF:brochure.pdf Title]]"" links and it all works. //Very nicely done Wikka...//
Deletions:
The result (//link coming soon//) is that the only indication is a very small login prompt on the bottom of our pages. Our inhouse publishers login to manage content. To manage images and product PDF files, I setup various ""ImageLib"" pages with the ""{{files}}"" action. Then, users will upload PDF files, images, driver updates, etc to these pages. Then I setup Interwiki links so the can just enter ""[[PDF:brochure.pdf Title]]"" links and it all works. //Very nicely done Wikka...//


Revision [16347]

Edited on 2007-03-29 18:01:51 by DanWest [Minor Edits]
Additions:
~- Seen it all. //Paper tape and punch cards//
Deletions:
~- Seen it all. //Paper tape and punch cards to flash drive jewlery (oops, I mean Bling)//


Revision [16139]

Edited on 2007-02-15 18:13:57 by DanWest [Minor Edits]

No Differences

Revision [16138]

Edited on 2007-02-15 18:13:39 by DanWest [Minor Edits]
Deletions:
>>==Sites I use Wikka as a CMS==
~- [[http://www.antelopesoccer.com antelopesoccer.com]] home page //Uses wikka//
~- Our corporate site (//Coming Soon//)
~- [[http://www.westvik.com www.westvik.com]] - Our Family Page
~- [[http://dane.westvik.com dane.westvik.com]] - My home page
~- [[http://www.securevote.org Secure Vote]] - Electronic Voting Info
~- [[http://www.n6na.org N6NA Web Site]] - River City ARCS website.


Revision [16111]

Edited on 2007-02-14 04:16:17 by DanWest [Minor Edits]
Additions:
~- [[DanWestLink Wiki Link Action]] - Shows link ONLY if current user has read access


Revision [16020]

Edited on 2007-01-31 14:03:56 by DanWest [Minor Edits]
Deletions:
%%(php)
<?php
/**
* Display a form for user registration.
*
* This action allows new users to register an account, if user registration is enabled.
* All the required fields are validated before the new user is created.
*
* @package Actions
* @name Register
*
* @author {@link http://wikka.jsnx.com/DarTar Dario Taraborelli}
* @version 0.3
* @since Wikka 1.1.X.X
* @output form for user registration
*
* @todo
* - CSS to style form;
* - (optionally) drop WikiName restriction on usernames;
* - use core functions to validate fields;
* - use central error handler for printing error messages;
* - decide best strategy to link hardcoded login/logout page;
* - define welcome page where new users must be redirected;
* - (optionally) add option for email-confirmation of registered users.
*/

// constants
define('MIN_PASSW_LENGTH', '5');

print $this->Format('===== New User Registration page ===== ----');

if ($user = $this->GetUser() && $this->HasAccess("write")) {

// user is logged in

// initializing variables
$name = '';
$email = '';
$password = '';
$confpassword = '';
$error = '';
$message = '';

// Is this the result from a signup
if ((isset($_GET['reg'])) && ($_GET['reg'] == '1')) {

// print first login welcome screen
$message = '--- **Registration successful!** ---';
}


// is user trying to register?
if ($_POST) {
// get POST values
if (isset($_POST['name'])) $name = trim($_POST['name']);
if (isset($_POST['email'])) $email = trim($_POST['email']);
if (isset($_POST['password'])) $password = $_POST['password'];
if (isset($_POST['confpassword'])) $confpassword = $_POST['confpassword'];

// validate fields
// note: all these validation checks should use core functions to preserve consistency

if ($this->LoadUser($name))
{
$error = 'Sorry, this username already exists. Please choose a different name.';
$validname = $this->Action('failed');
} elseif ($this->ExistsPage($name))
{
$error = 'Sorry, this username is reserved for a page. Please choose a different name.';
$validname = $this->Action('failed');
} elseif (!$this->IsWikiName($name))
{
$error = 'Please fill in a valid username (formatted as a ##""WikiName""##).';
$validname = $this->Action('failed');
} elseif (!$email)
{
$error = 'Please specify an email address.';
$validname = $this->Action('done');
$validemail = $this->Action('failed');
} elseif (!preg_match("/^.+?\@.+?\..+$/", $email))
{
$error = 'That does not quite look like an email address.';
$validname = $this->Action('done');
$validemail = $this->Action('failed');
} elseif (!$password)
{
$error = 'Please choose a password.';
$validname = $this->Action('done');
$validemail = $this->Action('done');
$validpassword = $this->Action('failed');
} elseif (strlen($password) < MIN_PASSW_LENGTH)
{
$error = 'Sorry, password too short (min. '.MIN_PASSW_LENGTH.' chars).';
$validname = $this->Action('done');
$validemail = $this->Action('done');
$validpassword = $this->Action('failed');
} elseif (preg_match("/ /", $password)) {
$error = 'Sorry, spaces are not allowed in passwords.';
$validname = $this->Action('done');
$validemail = $this->Action('done');
$validpassword = $this->Action('failed');
} elseif (!$confpassword)
{
$error = 'You need to confirm password.';
$validname = $this->Action('done');
$validemail = $this->Action('done');
$validpassword = $this->Action('failed');
$validconfpassword = $this->Action('failed');
} elseif ($confpassword != $password)
{
$error = 'Sorry, passwords do not match.';
$validname = $this->Action('done');
$validemail = $this->Action('done');
$validpassword = $this->Action('failed');
$validconfpassword = $this->Action('failed');
} else
{
// all required fields are valid and non-empty

// create user
$this->Query("insert into ".$this->config["table_prefix"]."users set ".
"signuptime = now(), ".
"name = '".mysql_real_escape_string($name)."', ".
"email = '".mysql_real_escape_string($email)."', ".
"password = md5('".mysql_real_escape_string($password)."')");

// log in
if($dologin=="Y") {
$this->SetUser($this->LoadUser($name));
$this->Redirect($this->href('','','reg=1'));
} else {
// forward
$this->Redirect('','User ' . $name . ' Registration successful');
}
}
}

$intro = $this->Format(' --- To register, the following fields are required:
~-a **username** (it must be formatted like a ##""WikiName""##, for example: ##""JuliusCaesar""##);
~-a **valid email address** (this will only be used to retrieve your password in case you lose it);
~-a **valid password** (min. '.MIN_PASSW_LENGTH.' characters, no space allowed).
--- ---');

// build registration form
$form = $this->FormOpen();
$form .= ' <table summary="Form to provide registration data: username, email and password">';
$form .= ' <caption>Registration form</caption>';
$form .= ' <tbody>';

if (isset($error))
{
$form .= '<tr><td colspan="3" align="center"><em class="error">'.$this->Format($error).'</em></td></tr>';
}
if (isset($message))
{
$form .= '<tr><td colspan="3" align="center"><em class="error">'.$this->Format($message).'</em></td></tr>';
}
$form .= ' <tr>';
$form .= ' <th align="right" scope="row"><label for="name">Username:</label></th>';
$form .= ' <td><input name="name" id="name" size="40" value="'.$name.'" title="Choose a valid username (formatted as a WikiName)" /></td>';
$form .= ' <td>'.$validname.'</td>';
$form .= ' </tr>';
$form .= ' <tr>';
$form .= ' <th align="right" scope="row"><label for="email">User email address:</label></th>';
$form .= ' <td><input name="email" id="email" size="40" value="'.$email.'" title="Fill in a valid email address"/></td>';
$form .= ' <td align="left">'.$validemail.'</td>';
$form .= ' </tr>';
$form .= ' <tr>';
$form .= ' <th align="right" scope="row"><label for="password">Password:</label></th>';
$form .= ' <td><input type="password" name="password" id="password" size="40" title="Choose a valid password (min. '.MIN_PASSW_LENGTH.' chars, no space)" /></td>';
$form .= ' <td align="left">'.$validpassword.'</td>';
$form .= ' </tr>';
$form .= ' <tr>';
$form .= ' <th align="right" scope="row"><label for="confpassword">Confirm password:</label></th>';
$form .= ' <td><input type="password" name="confpassword" id="confpassword" size="40" title="Type again your password for confirmation" /></td>';
$form .= ' <td align="left">'.$validconfpassword.'</td>';
$form .= ' </tr>';
$form .= ' <tr>';
$form .= ' <td></td>';
$form .= ' <td><input type="submit" value="Register" title="Register" /></td>';
$form .= ' </tr>';
$form .= ' </tbody>';
$form .= ' </table>';
$form .= $this->FormClose();

// output intro and form
print $intro.$form;

} else {
print $this->Format('--- ===You do not have authority to add users=== ---');
}
?>
%%


Revision [16017]

Edited on 2007-01-31 13:56:43 by DanWest [Minor Edits]
Additions:
~- [[DanWestWx Weather Forecast]] - Include current forecast


Revision [16014]

Edited on 2007-01-31 13:45:11 by DanWest [Minor Edits]
Additions:
~- [[http://www.westvik.com www.westvik.com]] - Our Family Page


Revision [15984]

Edited on 2007-01-19 20:57:25 by DanWest [Minor Edits]
Additions:
>>==Sites I use Wikka as a CMS==
~- Our corporate site (//Coming Soon//)
~- [[http://dane.westvik.com dane.westvik.com]] - My home page
~- [[http://www.securevote.org Secure Vote]] - Electronic Voting Info
~- [[http://www.n6na.org N6NA Web Site]] - River City ARCS website.
Deletions:
>>==Sites I use Wikka at CMS==


Revision [15982]

Edited on 2007-01-19 20:49:20 by DanWest [Minor Edits]
Additions:
~- [[DanWestPgHeader Custom Page Header]] - Better control over page title.
~- [[DanWestUserReg User Registration]] - Let Admin register users.
Deletions:
===Custom Page Header===
I found that I did not always care for the 'automated' page header done by parsing out the first matched text from a list of elements. Instead, I wanted to control the page title on the page manually. I did this by first creating a "fake" action called ""{{pagetitle}}"". The "pagetitle.php" is an empty file in the //actions// folder. Then, I put the following code into the wakka.class.php file.
Once this is done, you can modify the //header.php// action to use **""$this->PageHeader()""** to populate the page title HTML tags.
**Added to wakka.class.php**
// DW - Added (Process {{pagetitle name}} fake action)
function PageHeader() {
$title = "";
$pagecontent = $this->page["body"];
if (ereg( "({){2}pagetitle ([^}\n]+)(}){2}", $pagecontent, $title)) {
$title = $title[2];
if ($title) return strip_tags($this->Format($title)); # fix for forced links in heading
else return $this->GetPageTag();
**header.php**
$PgTitle = $this->PageHeader();
.
.
.
<title><?php echo $PgTitle; ?></title>


Revision [15981]

Edited on 2007-01-19 20:46:31 by DanWest [Minor Edits]
Additions:
>>==Sites I use Wikka at CMS==
~- [[http://www.antelopesoccer.com antelopesoccer.com]] home page //Uses wikka//
==Extensions I did==
~- [[DanWestCustomNav Custom Navigation Links]] - Define custom menu per page.
~- [[DanWestIncludeFile Include File action]] - Include RAW text into page.
~- [[DanWestCRT CRT Code Display Formatter]] - CODE formatter to look like CRT output.
==Who==
~- 40 somthing software designer / developer.
~- Seen it all. //Paper tape and punch cards to flash drive jewlery (oops, I mean Bling)//
~- Also known as KO6YD in the amateur radio world.
==Why Wikka==
==What I have done==
==My extensions and hacks==
Deletions:
---->>==Sites I use Wikka at CMS==
[[http://www.antelopesoccer.com antelopesoccer.com]] home page //Uses wikka//
===Who===
I have been a software developer, designer for over 25 years. //I remember paper tape and punch cards//.
For the last 20+ years I have been designing and developing POS (point of sale) systems. My focus was on networking, communications and protocols. Also known as KO6YD in the amateur radio world.
===Why Wikka===
===What I have done===
===My extensions and hacks===
==[[DanWestCustomNav Custom Navigation Links]]==
Allows you to setup custom navigation menus by page. You just create a ""NavigationLinks"" page and enter your customized links on this page.
==[[DanWestIncludeFile Include File action]]==
Includes a RAW text file (or PHP) in the output stream. //Dangerous! for public sites//
==[[DanWestCRT CRT Code Display Formatter]]==
For some documentation pages, I wanted to display a classic "Green Screen" format. So I used the ""%%"" code formatter and a custom CRT formatter.


Revision [15974]

Edited on 2007-01-19 20:20:41 by DanWest [Minor Edits]
Additions:
Includes a RAW text file (or PHP) in the output stream. //Dangerous! for public sites//


Revision [15972]

Edited on 2007-01-19 20:19:10 by DanWest [Minor Edits]
Additions:
==[[DanWestCRT CRT Code Display Formatter]]==
Deletions:
===CRT display formatter===
File: **formatters/crt.php**
echo '<div class="code_crt">';
print('<pre>'.htmlspecialchars($text, ENT_QUOTES).'</pre>');
echo '</div>';
?>
It also requires a small addition to the CSS file (Taken from .code selector)
%%(css)
.code_crt {
color: lime;
background: black;
border: 1px solid #CCC;
font-size: 11px;
font-family: "Lucida Console", Monaco, monospace;
width: 95%;
margin: auto;
padding: 6px 3px 13px 3px;
text-align: left;
overflow: auto;
white-space: nowrap;


Revision [15967]

Edited on 2007-01-19 20:12:54 by DanWest [Minor Edits]
Additions:
====Dane Westvik====
//(pen name): Dan West//
===Who===
I have been a software developer, designer for over 25 years. //I remember paper tape and punch cards//.
For the last 20+ years I have been designing and developing POS (point of sale) systems. My focus was on networking, communications and protocols. Also known as KO6YD in the amateur radio world.
===Why Wikka===
Well, why not. I was looking at some sort of content management system for our company web site. That way the different departments can contribute to the site without having hire someone or have me do it. (we are a small company). I really fell in love with the wiki concept and the Wikka design in how is works and the very well thought out design was a natural. The system is very easy to extend with actions and not too complex.
===What I have done===
The major overhaul is to make the Wikka engine as invisible as I could. Then I could use it to host our web site and disable the public access to the system so we could maintain it inhouse. I know this is not a new concept but it turned out to be a perfect CMS for us. I made some modifications to the header and footer to "wrap" the header, logo, navigation and main page in division classes so I could have better control over the look and feel with CSS.
The result (//link coming soon//) is that the only indication is a very small login prompt on the bottom of our pages. Our inhouse publishers login to manage content. To manage images and product PDF files, I setup various ""ImageLib"" pages with the ""{{files}}"" action. Then, users will upload PDF files, images, driver updates, etc to these pages. Then I setup Interwiki links so the can just enter ""[[PDF:brochure.pdf Title]]"" links and it all works. //Very nicely done Wikka...//
===My extensions and hacks===
I'm new to this code so you may find someone has already done it //better// or it's not done the cleanest way. I did try to keep them simple (//i.e.: The least amount of core code changes//).
I put them on my page since I am sure they currently dont follow the coding guidelines for submitting an official extensions.
Some of these extensions are designed for my "Closed" wiki sites (Internal Users Only). So, they may be dangerous for public wiki sites.
//Dane//
==[[DanWestCustomNav Custom Navigation Links]]==
Allows you to setup custom navigation menus by page. You just create a ""NavigationLinks"" page and enter your customized links on this page.
==[[DanWestIncludeFile Include File action]]==
Deletions:
===Dan West===
FormattingRules
This has some extensions I did. I'm new at hacking this code so you may find someone has already done it //better// or it's not done the cleanest way. I did try to keep them simple (//i.e.: The least amount of core code changes//).
I put them on my page since I am sure they currenlty dont follow the coding guidelines for submitting an official extension.
Some of these extensions are designed for my "Closed" wiki sites (Internal Users Only). So, they can be dangerous for public wiki sites.
====My Extensions====
===[[DanWestCustomNav Custom Navigation Links]]===
===Include File action===
A basic include that will load a text file into the page.
Syntax: ##""{{include name='file.txt'}}""##
**includefile.php**
$file_name = $vars['name'];
if(isset($file_name)) {
if(is_readable($file_name)) {
if(isset($pre)) echo '<pre>';
@include($file_name);
if(isset($pre)) echo '</pre>';
echo "{{includefile}} File $fname not found";
echo 'usage: {{includefile <b><u>name</u></b>="<i>filename</i>"}} (Missing name)';


Revision [15965]

Edited on 2007-01-19 05:03:08 by DanWest [Minor Edits]
Additions:
I put them on my page since I am sure they currenlty dont follow the coding guidelines for submitting an official extension.
Deletions:
I put them on my page since I am sure they currenly dont follow the coding guidelines for submitting an official extension.


Revision [15964]

Edited on 2007-01-19 04:54:51 by DanWest [Minor Edits]
Deletions:
[[http://www.posr.com/web www.posr.com]] Some hacking on the CSS as well as header and footer to "hide" the Wikka as the real engine


Revision [15963]

Edited on 2007-01-19 04:52:50 by DanWest [Minor Edits]
Additions:
---->>==Sites I use Wikka at CMS==
Deletions:
---->>==See Also==
**Sites I use Wikka at CMS**


Revision [15962]

Edited on 2007-01-19 04:52:30 by DanWest [Minor Edits]
Additions:
---->>==See Also==
**Sites I use Wikka at CMS**
>>
Deletions:
Pages I did that use wikka
I know this has been done, the it's another twist. You define a page '""NavigationLinks""'. In that page you list each target page tag on a line delimited by : (colons) followed by the custom links.
**Example ""NavigationLinks"" page**
:SomePage: [[HomePage Home]] [[PersonalPage My Page]] [[UserSettings User Settings]]
:AnotherPage: [[HomePage Home]] [[PersonalPage My Page]] [[SomePage Some Other Page]] [[UserSettings User Settings]]
This requires a small change to the //header.php// action. ''Note, I also add a fixed ""AdminPage"" to all my sites.''
==File header.php==
%%(php;36)
$nav_page = $this->LoadPage('NavigationLinks');
if(ereg(':' . $this->page['tag'] . ': ([^\n]*)\n', $nav_page['body'], $match)) {
echo $this->Format($match[1] . (($this->GetUser())? ' [[AdminPage Admin]]' : ''));
} else if ($this->GetUser()) {
echo $this->config['logged_in_navigation_links'] ? $this->Format($this->config['logged_in_navigation_links']).'' : '';
} else {
echo $this->config['navigation_links'] ? $this->Format($this->config['navigation_links']) : '';
}


Revision [15953]

Edited on 2007-01-19 04:19:41 by DanWest [Minor Edits]
Additions:
===[[DanWestCustomNav Custom Navigation Links]]===
Deletions:
===Custom Navigation Links===


Revision [15952]

Edited on 2007-01-19 04:15:19 by DanWest [Minor Edits]
Additions:
===Admin User Registration===
Since I was using Wikka as a content management system and did not want the general public to be able to register, I needed to have a method to register users under administrator control. I hack up the user registration action from DarTar. The main function is it allows you to register a user but does NOT log you in after doing so. So it allows you to add a new user to the database with all the validations but will not log you in to that user. It also checks to make sure you have 'write' access to the page the action is defined on as a basic permission trigger to allow you to register users.
/**
* Display a form for user registration.
*
* This action allows new users to register an account, if user registration is enabled.
* All the required fields are validated before the new user is created.
*
* @package Actions
* @name Register
*
* @author {@link http://wikka.jsnx.com/DarTar Dario Taraborelli}
* @version 0.3
* @since Wikka 1.1.X.X
* @output form for user registration
*
* @todo
* - CSS to style form;
* - (optionally) drop WikiName restriction on usernames;
* - use core functions to validate fields;
* - use central error handler for printing error messages;
* - decide best strategy to link hardcoded login/logout page;
* - define welcome page where new users must be redirected;
* - (optionally) add option for email-confirmation of registered users.
*/

// constants
define('MIN_PASSW_LENGTH', '5');

print $this->Format('===== New User Registration page ===== ----');

if ($user = $this->GetUser() && $this->HasAccess("write")) {

// user is logged in

// initializing variables
$name = '';
$email = '';
$password = '';
$confpassword = '';
$error = '';
$message = '';

// Is this the result from a signup
if ((isset($_GET['reg'])) && ($_GET['reg'] == '1')) {

// print first login welcome screen
$message = '--- **Registration successful!** ---';
}


// is user trying to register?
if ($_POST) {
// get POST values
if (isset($_POST['name'])) $name = trim($_POST['name']);
if (isset($_POST['email'])) $email = trim($_POST['email']);
if (isset($_POST['password'])) $password = $_POST['password'];
if (isset($_POST['confpassword'])) $confpassword = $_POST['confpassword'];

// validate fields
// note: all these validation checks should use core functions to preserve consistency

if ($this->LoadUser($name))
{
$error = 'Sorry, this username already exists. Please choose a different name.';
$validname = $this->Action('failed');
} elseif ($this->ExistsPage($name))
{
$error = 'Sorry, this username is reserved for a page. Please choose a different name.';
$validname = $this->Action('failed');
} elseif (!$this->IsWikiName($name))
{
$error = 'Please fill in a valid username (formatted as a ##""WikiName""##).';
$validname = $this->Action('failed');
} elseif (!$email)
{
$error = 'Please specify an email address.';
$validname = $this->Action('done');
$validemail = $this->Action('failed');
} elseif (!preg_match("/^.+?\@.+?\..+$/", $email))
{
$error = 'That does not quite look like an email address.';
$validname = $this->Action('done');
$validemail = $this->Action('failed');
} elseif (!$password)
{
$error = 'Please choose a password.';
$validname = $this->Action('done');
$validemail = $this->Action('done');
$validpassword = $this->Action('failed');
} elseif (strlen($password) < MIN_PASSW_LENGTH)
{
$error = 'Sorry, password too short (min. '.MIN_PASSW_LENGTH.' chars).';
$validname = $this->Action('done');
$validemail = $this->Action('done');
$validpassword = $this->Action('failed');
} elseif (preg_match("/ /", $password)) {
$error = 'Sorry, spaces are not allowed in passwords.';
$validname = $this->Action('done');
$validemail = $this->Action('done');
$validpassword = $this->Action('failed');
} elseif (!$confpassword)
{
$error = 'You need to confirm password.';
$validname = $this->Action('done');
$validemail = $this->Action('done');
$validpassword = $this->Action('failed');
$validconfpassword = $this->Action('failed');
} elseif ($confpassword != $password)
{
$error = 'Sorry, passwords do not match.';
$validname = $this->Action('done');
$validemail = $this->Action('done');
$validpassword = $this->Action('failed');
$validconfpassword = $this->Action('failed');
} else
{
// all required fields are valid and non-empty

// create user
$this->Query("insert into ".$this->config["table_prefix"]."users set ".
"signuptime = now(), ".
"name = '".mysql_real_escape_string($name)."', ".
"email = '".mysql_real_escape_string($email)."', ".
"password = md5('".mysql_real_escape_string($password)."')");

// log in
if($dologin=="Y") {
$this->SetUser($this->LoadUser($name));
$this->Redirect($this->href('','','reg=1'));
// forward
$this->Redirect('','User ' . $name . ' Registration successful');
}
}

$intro = $this->Format(' --- To register, the following fields are required:
~-a **username** (it must be formatted like a ##""WikiName""##, for example: ##""JuliusCaesar""##);
~-a **valid email address** (this will only be used to retrieve your password in case you lose it);
~-a **valid password** (min. '.MIN_PASSW_LENGTH.' characters, no space allowed).
--- ---');

// build registration form
$form = $this->FormOpen();
$form .= ' <table summary="Form to provide registration data: username, email and password">';
$form .= ' <caption>Registration form</caption>';
$form .= ' <tbody>';

if (isset($error))
{
$form .= '<tr><td colspan="3" align="center"><em class="error">'.$this->Format($error).'</em></td></tr>';
if (isset($message))
{
$form .= '<tr><td colspan="3" align="center"><em class="error">'.$this->Format($message).'</em></td></tr>';
$form .= ' <tr>';
$form .= ' <th align="right" scope="row"><label for="name">Username:</label></th>';
$form .= ' <td><input name="name" id="name" size="40" value="'.$name.'" title="Choose a valid username (formatted as a WikiName)" /></td>';
$form .= ' <td>'.$validname.'</td>';
$form .= ' </tr>';
$form .= ' <tr>';
$form .= ' <th align="right" scope="row"><label for="email">User email address:</label></th>';
$form .= ' <td><input name="email" id="email" size="40" value="'.$email.'" title="Fill in a valid email address"/></td>';
$form .= ' <td align="left">'.$validemail.'</td>';
$form .= ' </tr>';
$form .= ' <tr>';
$form .= ' <th align="right" scope="row"><label for="password">Password:</label></th>';
$form .= ' <td><input type="password" name="password" id="password" size="40" title="Choose a valid password (min. '.MIN_PASSW_LENGTH.' chars, no space)" /></td>';
$form .= ' <td align="left">'.$validpassword.'</td>';
$form .= ' </tr>';
$form .= ' <tr>';
$form .= ' <th align="right" scope="row"><label for="confpassword">Confirm password:</label></th>';
$form .= ' <td><input type="password" name="confpassword" id="confpassword" size="40" title="Type again your password for confirmation" /></td>';
$form .= ' <td align="left">'.$validconfpassword.'</td>';
$form .= ' </tr>';
$form .= ' <tr>';
$form .= ' <td></td>';
$form .= ' <td><input type="submit" value="Register" title="Register" /></td>';
$form .= ' </tr>';
$form .= ' </tbody>';
$form .= ' </table>';
$form .= $this->FormClose();

// output intro and form
print $intro.$form;

print $this->Format('--- ===You do not have authority to add users=== ---');
?>


Revision [15951]

Edited on 2007-01-19 04:07:53 by DanWest [Minor Edits]

No Differences

Revision [15950]

Edited on 2007-01-19 04:07:18 by DanWest [Minor Edits]
Additions:
===Custom Page Header===
I found that I did not always care for the 'automated' page header done by parsing out the first matched text from a list of elements. Instead, I wanted to control the page title on the page manually. I did this by first creating a "fake" action called ""{{pagetitle}}"". The "pagetitle.php" is an empty file in the //actions// folder. Then, I put the following code into the wakka.class.php file.
Once this is done, you can modify the //header.php// action to use **""$this->PageHeader()""** to populate the page title HTML tags.
**Added to wakka.class.php**
// DW - Added (Process {{pagetitle name}} fake action)
function PageHeader() {
$title = "";
$pagecontent = $this->page["body"];
if (ereg( "({){2}pagetitle ([^}\n]+)(}){2}", $pagecontent, $title)) {
$title = $title[2];
}
if ($title) return strip_tags($this->Format($title)); # fix for forced links in heading
else return $this->GetPageTag();
**header.php**
$PgTitle = $this->PageHeader();
.
.
.
<title><?php echo $PgTitle; ?></title>


Revision [15949]

Edited on 2007-01-19 03:58:37 by DanWest [Minor Edits]
Additions:
===CRT display formatter===
For some documentation pages, I wanted to display a classic "Green Screen" format. So I used the ""%%"" code formatter and a custom CRT formatter.
File: **formatters/crt.php**
echo '<div class="code_crt">';
print('<pre>'.htmlspecialchars($text, ENT_QUOTES).'</pre>');
echo '</div>';
It also requires a small addition to the CSS file (Taken from .code selector)
%%(css)
.code_crt {
color: lime;
background: black;
border: 1px solid #CCC;
font-size: 11px;
font-family: "Lucida Console", Monaco, monospace;
width: 95%;
margin: auto;
padding: 6px 3px 13px 3px;
text-align: left;
overflow: auto;
white-space: nowrap;


Revision [15948]

Edited on 2007-01-19 03:53:38 by DanWest [Minor Edits]
Additions:
$file_name = $vars['name'];
if(isset($pre)) echo '<pre>';
if(isset($pre)) echo '</pre>';
echo 'usage: {{includefile <b><u>name</u></b>="<i>filename</i>"}} (Missing name)';
Deletions:
$file_name = $vars["name"];
if(isset($pre)) echo "<pre>";
if(isset($pre)) echo "</pre>";
echo "usage: {{includefile <b><u>name</u></b>=\"<i>filename</i>\"}} (Missing name)";


Revision [15947]

Edited on 2007-01-19 03:52:11 by DanWest [Minor Edits]
Additions:
%%(php)
Deletions:
%(php)


Revision [15946]

Edited on 2007-01-19 03:51:52 by DanWest [Minor Edits]
Additions:
===Include File action===
**includefile.php**
Deletions:
===includefile action===


Revision [15945]

Edited on 2007-01-19 03:51:14 by DanWest [Minor Edits]
Additions:
Some of these extensions are designed for my "Closed" wiki sites (Internal Users Only). So, they can be dangerous for public wiki sites.
===includefile action===
A basic include that will load a text file into the page.
Syntax: ##""{{include name='file.txt'}}""##
%(php)
<?php
$file_name = $vars["name"];
if(isset($file_name)) {
if(is_readable($file_name)) {
if(isset($pre)) echo "<pre>";
@include($file_name);
if(isset($pre)) echo "</pre>";
} else {
echo "{{includefile}} File $fname not found";
}
} else {
echo "usage: {{includefile <b><u>name</u></b>=\"<i>filename</i>\"}} (Missing name)";
}
?>


Revision [15944]

Edited on 2007-01-19 03:46:27 by DanWest [Minor Edits]
Additions:
This has some extensions I did. I'm new at hacking this code so you may find someone has already done it //better// or it's not done the cleanest way. I did try to keep them simple (//i.e.: The least amount of core code changes//).
I put them on my page since I am sure they currenly dont follow the coding guidelines for submitting an official extension.
This requires a small change to the //header.php// action. ''Note, I also add a fixed ""AdminPage"" to all my sites.''
$nav_page = $this->LoadPage('NavigationLinks');
if(ereg(':' . $this->page['tag'] . ': ([^\n]*)\n', $nav_page['body'], $match)) {
echo $this->Format($match[1] . (($this->GetUser())? ' [[AdminPage Admin]]' : ''));
echo $this->config['logged_in_navigation_links'] ? $this->Format($this->config['logged_in_navigation_links']).'' : '';
echo $this->config['navigation_links'] ? $this->Format($this->config['navigation_links']) : '';
Deletions:
This has some extensions I did. I'm new at hacking this code so you may find someone has already done it //better// or it's not done the cleanest way. I did try to keep them simple (//i.e.: The least amount of core code changes//)
This requires a small change to the //header.php// action.
$NavPage = $this->LoadPage("NavigationLinks");
if(ereg(":" . $this->page["tag"] . ": ([^\n]*)\n", $NavPage['body'], $match)) {
echo $this->Format($match[1] . (($this->GetUser())? " [[AdminPage Admin]]" : " "));
echo $this->config["logged_in_navigation_links"] ? $this->Format($this->config["logged_in_navigation_links"])."" : "";
echo $this->config["navigation_links"] ? $this->Format($this->config["navigation_links"]) : "";


Revision [15943]

Edited on 2007-01-19 03:35:06 by DanWest [Minor Edits]
Additions:
This has some extensions I did. I'm new at hacking this code so you may find someone has already done it //better// or it's not done the cleanest way. I did try to keep them simple (//i.e.: The least amount of core code changes//)
Enjoy.
Pages I did that use wikka
[[http://www.posr.com/web www.posr.com]] Some hacking on the CSS as well as header and footer to "hide" the Wikka as the real engine
====My Extensions====
Deletions:
Just wanted a userid to look at stuff you need a userid to look at.... //Huh?//
Some "Extensions" I did.
===Admin Registration===


Revision [15942]

Edited on 2007-01-19 03:30:31 by DanWest [Minor Edits]
Additions:
**Example ""NavigationLinks"" page**


Revision [15941]

Edited on 2007-01-19 03:30:03 by DanWest [Minor Edits]
Additions:
I know this has been done, the it's another twist. You define a page '""NavigationLinks""'. In that page you list each target page tag on a line delimited by : (colons) followed by the custom links.
:SomePage: [[HomePage Home]] [[PersonalPage My Page]] [[UserSettings User Settings]]
:AnotherPage: [[HomePage Home]] [[PersonalPage My Page]] [[SomePage Some Other Page]] [[UserSettings User Settings]]
This requires a small change to the //header.php// action.
Deletions:
I know this has been done, the it's another twist.


Revision [15940]

Edited on 2007-01-19 03:26:30 by DanWest [Minor Edits]
Additions:
echo $this->Format($match[1] . (($this->GetUser())? " [[AdminPage Admin]]" : " "));
echo $this->config["logged_in_navigation_links"] ? $this->Format($this->config["logged_in_navigation_links"])."" : "";
echo $this->config["navigation_links"] ? $this->Format($this->config["navigation_links"]) : "";
Deletions:
~ echo $this->Format($match[1] . (($this->GetUser())? " [[AdminPage Admin]]" : " "));
~ echo $this->config["logged_in_navigation_links"] ? $this->Format($this->config["logged_in_navigation_links"])."" : "";
~ echo $this->config["navigation_links"] ? $this->Format($this->config["navigation_links"]) : "";


Revision [15939]

Edited on 2007-01-19 03:26:08 by DanWest [Minor Edits]
Additions:
~ echo $this->Format($match[1] . (($this->GetUser())? " [[AdminPage Admin]]" : " "));
~ echo $this->config["logged_in_navigation_links"] ? $this->Format($this->config["logged_in_navigation_links"])."" : "";
~ echo $this->config["navigation_links"] ? $this->Format($this->config["navigation_links"]) : "";
Deletions:
~echo $this->Format($match[1] . (($this->GetUser())? " [[AdminPage Admin]]" : " "));
~echo $this->config["logged_in_navigation_links"] ? $this->Format($this->config["logged_in_navigation_links"])."" : "";
~echo $this->config["navigation_links"] ? $this->Format($this->config["navigation_links"]) : "";


Revision [15938]

Edited on 2007-01-19 03:25:53 by DanWest [Minor Edits]
Additions:
%%(php;36)
$NavPage = $this->LoadPage("NavigationLinks");
if(ereg(":" . $this->page["tag"] . ": ([^\n]*)\n", $NavPage['body'], $match)) {
~echo $this->Format($match[1] . (($this->GetUser())? " [[AdminPage Admin]]" : " "));
} else if ($this->GetUser()) {
~echo $this->config["logged_in_navigation_links"] ? $this->Format($this->config["logged_in_navigation_links"])."" : "";
} else {
~echo $this->config["navigation_links"] ? $this->Format($this->config["navigation_links"]) : "";
}
Deletions:
%%(php:36)
$NavPage = $this->LoadPage("NavigationLinks");
if(ereg(":" . $this->page["tag"] . ": ([^\n]*)\n", $NavPage['body'], $match)) {
echo $this->Format($match[1] . (($this->GetUser())? " [[AdminPage Admin]]" : " "));
} else if ($this->GetUser()) {
echo $this->config["logged_in_navigation_links"] ? $this->Format($this->config["logged_in_navigation_links"])."" : "";
//echo "You are ".$this->Format($this->GetUserName());
} else {
echo $this->config["navigation_links"] ? $this->Format($this->config["navigation_links"]) : "";
}


Revision [15937]

Edited on 2007-01-19 03:24:38 by DanWest [Minor Edits]
Additions:
FormattingRules


Revision [15936]

Edited on 2007-01-19 03:24:03 by DanWest [Minor Edits]
Additions:
Some "Extensions" I did.
===Custom Navigation Links===
I know this has been done, the it's another twist.
==File header.php==
%%(php:36)
$NavPage = $this->LoadPage("NavigationLinks");
if(ereg(":" . $this->page["tag"] . ": ([^\n]*)\n", $NavPage['body'], $match)) {
echo $this->Format($match[1] . (($this->GetUser())? " [[AdminPage Admin]]" : " "));
} else if ($this->GetUser()) {
echo $this->config["logged_in_navigation_links"] ? $this->Format($this->config["logged_in_navigation_links"])."" : "";
//echo "You are ".$this->Format($this->GetUserName());
} else {
echo $this->config["navigation_links"] ? $this->Format($this->config["navigation_links"]) : "";
}
%%
===Admin Registration===


Revision [15863]

Edited on 2007-01-09 04:02:49 by DanWest [Minor Edits]
Additions:
[[http://www.antelopesoccer.com antelopesoccer.com]] home page //Uses wikka//
Deletions:
[[http://www.antelopesoccer.com antelopesoccer.com home page]] //Uses wikka//


Revision [15862]

The oldest known version of this page was created on 2007-01-09 04:02:35 by DanWest [Minor Edits]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki