Revision [3017]

This is an old revision of NilsLindenberg made by NilsLindenberg on 2004-12-09 15:17:18.

 

Userpage of Nils Lindenberg


Last edited by NilsLindenberg:
removed part of the code
Thu, 09 Dec 2004 15:17 UTC [diff]


About me

I am a student of socail science at the university of Goettingen, Germany (currently on exchange in Bologna, Italy). You can find me also at WackoWiki, Wikipedia and http://www.openformats.org . I neither have a computer with the ability to code and test something in php, nor the skill to programm anything as complex as i would like, but someday... :-)

http://www.joelonsoftware.com/articles/APIWar.html - about the necessity of backward compatibility
http://www.joelonsoftware.com/articles/fog0000000054.html - the chicken and egg problem
http://www.joelonsoftware.com/articles/fog0000000020.html - against the myth of bload programms
http://phpwiki.sourceforge.net/phpwiki/WikiAsPim - about using Wiki for personal information management
http://www.cooper.com/articles/art_goal_directed_design.htm - designing for users, not for programmers
http://www.joelonsoftware.com/uibook/chapters/fog0000000059.html - choose which choises you give to users

My List of things which could be improved in, or added at Wikka

(the items are listed in descending priority)
  1. I18n, L10n=> WikkaInternationalization, HandlingUTF8
  1. a better System for Categorys => CategorySystemOverhaul
  1. A Calendar/organizer => GmBowenCalendar & see below
  1. E-Mail and => WikkaAndEmail & see below for some thoughts
  1. Toc (Table of Content) -> already implementet in WackoWiki
  1. Usermanagement -> UserAdmin
  1. User-to-User-Messages-System (working on this...see MailBox...the code (so far) is there....feel free to play with it - GmBowen)
  1. Access to the Config.php through a wikka-interface
  1. Footnotes (http://www.istitutocolli.org/uniwakka/FootNote)
  1. LaTex support (http://www.istitutocolli.org/uniwakka/MathInsert)
  1. OpenOffice import/export
  1. Smilys (http://www.istitutocolli.org/uniwakka/TablesAndSmileys

And, naturely, everything which gives Wikka new features oder improves the usability/the code.
 



Handling the Config

To Do:
  • TEST
  • make sure the functions operate with defaults

changes in wikka.php:

added:

define ("CONFIG_FILE_NAME", "wikka.config.php");
//We can make it easier to change the name config-file when we define it as a constant//

function wikkasetup ($installaction="install.php")
{
    include("setup/header.php");
    if (file_exists("setup/".$installAction.".php")) include("setup/".$installAction.".php"); else print("<em>File "$installaction" not found. Please make shure that this file exists and try again.</em>");
    include("setup/footer.php");
    exit;
}
//This function calls the different routines in the /setup directory. Replaces the old code after ""//"" compare versions, start installer if necessary//

""//"" load config
$configfile = CONFIG_FILE_NAME;
//gets the name of the config-file from the constant.// ''To do: check if this is possible.''

if (!configfile)
{
    setup ("install.php");
}
else
{
    include($configfile);
}

//if we have no config-file, start the installer. if we have one, include it.//

if ($wakkaConfig["wakka_version"] != WAKKA_VERSION)
{
    setup ("upgrade.php");
}
//if the versions are different, start the upgrade-action.//


removed:

$wakkaDefaultConfig = array(...)
//The default config is moved into the setup-directory//

if (!$configfile = GetEnv("WAKKA_CONFIG")) $configfile = "wikka.config.php";
if (file_exists($configfile)) include($configfile);

$wakkaConfigLocation = $configfile;
$wakkaConfig = array_merge($wakkaDefaultConfig, $wakkaConfig);
//replaced//



note that there are two files in the /setup necessary:
install.php - will get all the stuff for a fresh installation
upgrade.php - will get anything related to upgrades

these two files will replace defult.php and install.php

 


install.php
<?php
<script language="JavaScript">
function check()
{
    var f = document.forms.form1;
    var re;
    re = new RegExp("^[A-Z][a-z]+[A-Z0-9][A-Za-z0-9]*$");
    if (f.elements["config[admin_users]"].value.search(re)==-1)
    {
        alert("Admin name must be a WikiName. This means it must start with a capital letter, then have some lowercase letters, then have an uppercase letter.\nExamples: JohnSmith or JsnX");
        return false;
    }
    if (f.elements["password"].value.length<5)
    {
        alert("Password is too short.  It must be at least five (5) characters long.");
        return false;
    }
    if (f.elements["password"].value!=f.elements["password2"].value)
    {
        alert("Passwords don't match.");
        return false;
    }
    re = new RegExp("[a-z]+@[a-z]+\.[a-z]+", "i");
    if (f.elements["config[admin_email]"].value.search(re)==-1)
    {
        alert("Email address appears incorrect.");
        return false;
    }
    return true;
}
</script>
?>
<form action="<?php echo myLocation() ?>?installAction=install" name="form1" method="POST">
<table>
    <tr><td></td><td><strong>Wikka Installation</strong></td></tr>
    <tr><td></td><td>Since there is no existing Wikka configuration, this probably is a fresh Wikka install. You are about to install Wikka ".WAKKA_VERSION.". Please configure your Wikka site using the form below.</td></tr>
    <tr><td></td><td><br />NOTE: This installer will try to write the configuration data to the file <tt>".CONFIG_FILE_NAME."</tt>, located in your Wikka directory. In order for this to work, you must make sure the web server has write access to that file! If you can't do this, you will have to edit the file manually (the installer will tell you how).<br /><br />See <a href="http://wikka.jsnx.com/WikkaInstallation" target="_blank">WikkaWiki:WikkaInstallation</a> for details.</td></tr>
    <tr><td></td><td><br /><strong>Database Configuration</strong></td></tr>
    <tr><td></td><td>The host your MySQL server is running on. Usually "localhost" (ie, the same machine your Wikka site is on).</td></tr>
    <tr><td align="right" nowrap>MySQL host:</td><td><input type="text" size="50" name="config[mysql_host]" value="<?php echo $wakkaConfig["mysql_host"] ?>" /></td></tr>
    <tr><td></td><td>The MySQL database Wikka should use. This database needs to exist already before you continue!</td></tr>
    <tr><td align="right" nowrap>MySQL database:</td><td><input type="text" size="50" name="config[mysql_database]" value="<?php echo $wakkaConfig["mysql_database"] ?>" /></td></tr>
    <tr><td></td><td>Name and password of the MySQL user used to connect to your database.</td></tr>
    <tr><td align="right" nowrap>MySQL user name:</td><td><input type="text" size="50" name="config[mysql_user]" value="<?php echo $wakkaConfig["mysql_user"] ?>" /></td></tr>
    <tr><td align="right" nowrap>MySQL password:</td><td><input type="password" size="50" name="config[mysql_password]" value="<?php echo $wakkaConfig["mysql_password"] ?>" /></td></tr>
    <tr><td></td><td>Prefix of all tables used by Wikka. This allows you to run multiple Wikka installations using the same MySQL database by configuring them to use different table prefixes.</td></tr>
    <tr><td align="right" nowrap>Table prefix:</td><td><input type="text" size="50" name="config[table_prefix]" value="<?php echo $wakkaConfig["table_prefix"] ?>" /></td></tr>
    <tr><td></td><td><br /><strong>Wikka Site Configuration</strong></td></tr>

    <tr><td></td><td>The name of your Wikka site. It usually is a WikiName and looks SomethingLikeThis.</td></tr>
    <tr><td align="right" nowrap>Your Wikka's name:</td><td><input type="text" size="50" name="config[wakka_name]" value="<?php echo $wakkaConfig["wakka_name"] ?>" /></td></tr>

    <tr><td></td><td>Your Wikka site's home page. Should be a WikiName.</td></tr>
    <tr><td align="right" nowrap>Home page:</td><td><input type="text" size="50" name="config[root_page]" value="<?php echo $wakkaConfig["root_page"] ?>" /></td></tr>

    <tr><td></td><td>META Keywords/Description that get inserted into the HTML headers.</td></tr>
    <tr><td align="right" nowrap>Meta Keywords:</td><td><input type="text" size="50" name="config[meta_keywords]" value="<?php echo $wakkaConfig["meta_keywords"] ?>" /></td></tr>
    <tr><td align="right" nowrap>Meta Description:</td><td><input type="text" size="50" name="config[meta_description]" value="<?php echo $wakkaConfig["meta_description"] ?>" /></td></tr>
<tr><td></td><td><br /><strong>Administrative account configuration</strong></td></tr>

     <tr><td></td><td>Enter admin username. Should be a WikiName.</td></tr>
     <tr><td align="right" nowrap>Admin name:</td><td><input type="text" size="50" name="config[admin_users]" value="<?php echo $wakkaConfig["admin_users"] ?>" /></td></tr>

     <tr><td></td><td>Choose a password for administrator (5+ chars)</td></tr>
     <tr><td align="right" nowrap>Enter password:</td><td><input type="password" size="50" name="password" value="" /></td></tr>
     <tr><td align="right" nowrap>Repeat password:</td><td><input type="password" size="50" name="password2" value="" /></td></tr>

     <tr><td></td><td>Administrator email.</td></tr>
     <tr><td align="right" nowrap>Email:</td><td><input type="text" size="50" name="config[admin_email]" value="<?php echo $wakkaConfig["admin_email"] ?>" /></td></tr>
    <tr><td></td><td><br /><strong>Wikka URL Configuration</strong><?php echo $wakkaConfig["wakka_version"] ? "" : "<br />Since this is a new installation, the installer tried to guess the proper values. Change them only if you know what you're doing!" ?></td></tr>

    <tr><td></td><td>Your Wikka site's base URL. Page names get appended to it, so it should include the "?wakka=" parameter stuff if the funky URL rewriting stuff doesn't work on your server.</td></tr>
    <tr><td align="right" nowrap>Base URL:</td><td><input type="text" size="50" name="config[base_url]" value="<?php echo $wakkaConfig["base_url"] ?>" /></td></tr>

    <tr><td></td><td>Rewrite mode should be enabled if you are using Wikka with URL rewriting.</td></tr>
    <tr><td align="right" nowrap>Rewrite Mode:</td><td><input type="hidden" name="config[rewrite_mode]" value="0"><input type="checkbox" name="config[rewrite_mode]" value="1" <?php echo $wakkaConfig["rewrite_mode"] ? "checked" : "" ?> /> Enabled</td></tr>

    <tr><td></td><td><input type="submit" value="Continue" onclick="return check();" /></td></tr>
</table>
</form>
strong>Testing Configuration</strong><br />
<?php
test("Testing MySQL connection settings...", $dblink = @mysql_connect($config["mysql_host"], $config["mysql_user"], $config["mysql_password"]));
test("Looking for database...", @mysql_select_db($config["mysql_database"], $dblink), "The database you configured was not found. Remember, it needs to exist before you can install Wikka!\n\nPress the Back button and reconfigure the settings.");
<br />
print("<strong>Installing Stuff</strong><br />\n");
    test("Creating page table...",
        @mysql_query(
            "CREATE TABLE ".$config["table_prefix"]."pages (".
            "id int(10) unsigned NOT NULL auto_increment,".
            "tag varchar(75) NOT NULL default '',".
            "time datetime NOT NULL default '0000-00-00 00:00:00',".
            "body mediumtext NOT NULL,".
            "owner varchar(75) NOT NULL default '',".
            "user varchar(75) NOT NULL default '',".
            "latest enum('Y','N') NOT NULL default 'N',".
            "note varchar(100) NOT NULL default '',".
            "handler varchar(30) NOT NULL default 'page',".
            "PRIMARY KEY  (id),".
            "KEY idx_tag (tag),".
            "FULLTEXT KEY body (body),".
            "KEY idx_time (time),".
            "KEY idx_latest (latest)".
            ") TYPE=MyISAM;", $dblink), "Already exists?", 0);
    test("Creating ACL table...",
        @mysql_query(
            "CREATE TABLE ".$config["table_prefix"]."acls (".
            "page_tag varchar(75) NOT NULL default '',".
            "read_acl text NOT NULL,".
            "write_acl text NOT NULL,".
            "comment_acl text NOT NULL,".
            "PRIMARY KEY  (page_tag)".
            ") TYPE=MyISAM", $dblink), "Already exists?", 0);
    test("Creating link tracking table...",
        @mysql_query(
            "CREATE TABLE ".$config["table_prefix"]."links (".
            "from_tag varchar(75) NOT NULL default '',".
            "to_tag varchar(75) NOT NULL default '',".
            "UNIQUE KEY from_tag (from_tag,to_tag),".
            "KEY idx_from (from_tag),".
            "KEY idx_to (to_tag)".
            ") TYPE=MyISAM", $dblink), "Already exists?", 0);
    test("Creating referrer table...",
        @mysql_query(
            "CREATE TABLE ".$config["table_prefix"]."referrers (".
            "page_tag varchar(75) NOT NULL default '',".
            "referrer varchar(150) NOT NULL default '',".
            "time datetime NOT NULL default '0000-00-00 00:00:00',".
            "KEY idx_page_tag (page_tag),".
            "KEY idx_time (time)".
            ") TYPE=MyISAM", $dblink), "Already exists?", 0);
    test("Creating referrer blacklist table...",
        @mysql_query(
            "CREATE TABLE ".$config["table_prefix"]."referrer_blacklist (".
            "spammer varchar(150) NOT NULL default '',".
            "KEY idx_spammer (spammer)".
            ") TYPE=MyISAM", $dblink), "Already exists?", 0);
    test("Creating user table...",
        @mysql_query(
            "CREATE TABLE ".$config["table_prefix"]."users (".
            "name varchar(75) NOT NULL default '',".
            "password varchar(32) NOT NULL default '',".
            "email varchar(50) NOT NULL default '',".
            "revisioncount int(10) unsigned NOT NULL default '20',".
            "changescount int(10) unsigned NOT NULL default '50',".
            "doubleclickedit enum('Y','N') NOT NULL default 'Y',".
            "signuptime datetime NOT NULL default '0000-00-00 00:00:00',".
            "show_comments enum('Y','N') NOT NULL default 'N',".
            "PRIMARY KEY  (name),".
            "KEY idx_signuptime (signuptime)".
            ") TYPE=MyISAM", $dblink), "Already exists?", 0);
    test("Creating comment table...",
        @mysql_query(
            "CREATE TABLE ".$config["table_prefix"]."comments (".
            "id int(10) unsigned NOT NULL auto_increment,".
            "page_tag varchar(75) NOT NULL default '',".
            "time datetime NOT NULL default '0000-00-00 00:00:00',".
            "comment text NOT NULL,".
            "user varchar(75) NOT NULL default '',".
            "PRIMARY KEY  (id),".
            "KEY idx_page_tag (page_tag),".
            "KEY idx_time (time)".
            ") TYPE=MyISAM;", $dblink), "Already exists?", 0);

  test("Adding admin user...",
    @mysql_query("insert into ".$config["table_prefix"]."users set name = '".$config["admin_users"]."', password = md5('".mysql_real_escape_string($_POST["password"])."'), email = '".$config["admin_email"]."', signuptime = now()", $dblink), "Hmm!", 0);

    test("Adding some pages...", 1);
<... enter the pages here>
?>


To do: much!

Issue-based Calendar

Another idea, based on GMBowenCalendar, and on the "current day-based view" in http://www.cooper.com/articles/art_goal_directed_design.htm (second part). Instead of the typical month-based calendar "on" wich you write your eventes, the calendar should work on the base of marked events in wikkapages. Also a "current day-based view" would be nice.

 


Possible features

  • events are attached to wikipages
  • events could be repeated daily, weekly, monthly and yearly
  • events could also have a time
  • events could have a time/date/month... when they begin and when they and, making it possible to have periods
  • events could be marked up in different categorys
  • the view could be shifted between weekly, monthly, yearly and a "current day-based view"
  • it should be possible to move to a week/month into the future/past easily
  • events should be userbased (user, group, public)
  • events should be deletetable by unmarking them on the page
  • there should be configurable items like: first day of the week, etc.
  • days should be shown colored (like sundays, past days etc.)

other calendar projects
http://sourceforge.net/projects/webcalendar/
http://freshmeat.net/projects/activecalendar/
time and date related
http://phplens.com/phpeverywhere/adodb_date_library
http://www.php.net/mktime

Adding, Editing, Deleting Events

A new idea to handle events like comments attached to a page. The other way leeds to problems i can not solve now.

1. If a user has the right to see events attached to a page, they will appear on this page (below the comments or so)
2. If the user has the right to set events on a page, a form for adding events will appear, or is the action/event.php will accept the parameters "new", "change" (or "edit") and "delete" better?

The Code
needed in wikka.php:

<?php
//config_options
"hide_events" => 0, //equivalent to "hide comments"
"default_event_acl" => "*",  
?>


(there is no need to have an equivalent to "anoy_delete_own_comments" because events must be more editable then comments anyway)

<?php
function LoadPageEvents($tag) //load the events attached to a page
{
   return $this->LoadAll("SELECT * FROM ".$this->config["table_prefix"]."events WHERE page_tag = '".mysql_real_escape_string($tag)."' ORDER BY time");
}

function UpdateEvent() {} //this function will someday compare two events, the original and the changed and, if both are different, delete the old and save the new one, using DeleteEvent and SaveEvent
 
function DeleteEvent($event_id) {} //this function will delete an event from the database

function SaveEvent($startdate, $starttime, $stopdate, $stoptime, $page_tag) //saves an event to the database
{
   $user = $this ->GetUserName();
   $this->Query("INSERT INTO ".$this->config["table_prefix"]."events SET "./*...*/);
       //...
}

function LoadEvent($event_id) {} //will load an event
function EventMatchesDay($event_id, $day) {} //function if an event is on the day specified
?>


The question is where to put the code which provides the form for adding/changing an event.

The form must contain:
-Start: date dropdown menu (1-31). month drop down menu (1-12 or better names).input field for the year (four digits) Hour drop down (0-24).Minutes (0-59)
-Stop: the same for stop.
-repeat: dropdown menu (no, daily, weekly, monthly, yearly)
-end of repeat: same as Start
-frequency of repeat: dropdown (1-25)
-(categories the event is attached to - wait till category system is finished)
-(access: users which have access to the event - same structure as for the page acls)

I need another function which gets the data and checks:
- if the dates are real dates: checkdate should help
- the stop date/ end of repeat are after the start date
- the years are in the range of the organizer

The Database

There are changes in the original database needed.

It is necessary to create events, the database in which the events are stored:

CREATE TABLE `wikka_events` (
  `event_id`,
  `startdate`,
  `starttime`,
  `stopdate`,
  `stoptime`,
  `page_id`,
  `event_repeat`,
  `repeat_freqeuncy`,
  `event_weekday`,
  `creator`,
  `text`
UNIQUE KEY `event_id` (`event_id`)
) TYPE=MYISAM ;


  1. event_id as a counter
  1. startdate
  1. starttime
  1. stopdate
  1. stoptime
  1. page_id (or is the name better?) for a backlink and for the adding to a page
  1. event_repeat with the options no, daily, weekly, monthly, yearly
  1. repeat_frequency every time, every second etc.
  1. event_weekday only for repeat weekly
  1. creator the one who entered this event
  1. (access which users are able to see it - different table?)
  1. text short text with a description of the event
  1. (category an event belongs to - different table?)

The calendar itself

The events should be visible at
  • the page they belong to
  • the category the belong to
  • the daily view tbt
  • (the weekly view)
  • (the monthly view)
  • (the yearly view)

function ShowDay
function ShowDaybased Weeks
function ShowWeek
function ShowMonth
function ShowYear

Monthly view
Mostly based on the version of GmBowenCalendar. The calendar is included to a page as an action and has
  1. to get the currend date and time
  1. to build a table with the dates [the "current day-based view", weekly and yearly view could come later]
  1. to provide links to one week/month in the future/past
  1. has to look up, which day is the first in the week
  1. to mark days with different colors (like Sundays in red, days past by in gray, days with events in blue, current day in green [and the background with another color for periods of events?])
  1. to look up, which days have events and link them.

Yearly view
[for the yearly view something like: http://freshmeat.net/projects/activecalendar/ (picture!) (phpclasses.org:1870)]

The view of the events

GmBowen had a very good idea for his event action, he is actually working on. Showing them in a box near the calendar (more simple then my approach which wasn?t a real one :-) . With every click on a day linked to events, the box has to be "reloaded" ;-) to show the events of the selected day.

  • the function has to look up
  • the function for showing events has to look up, if the user has the right to see an event


E-Mail

Because I am using Wikis as a personal information manager, the possibility to read, store and write my e-mail in wikka would be a nice feature. Unfortunately I can't test anything here in Italy (no wiki), but a bit of thinking about it should'nt hurt :)

 


Idea and Features

So le'ts think about the things which are necessary for this:

  • should be able to get the necessary information from the user (e-mailserver, username, passwort,...)
  • establish/close a connection to the server
  • get the mail from the server (pop3, imap4)
  • store the mail in the database
  • show the mail (one mail, one page?, a list of mails which can be sorted after date, sender, from, size...?)
  • deal with attachments
  • asend mails (smtp)
  • final goal would be: I type a name in the search and get a list of the last e-mails sended to and recieved from him
  • should be able to be linked with an adressbook and the calendar
  • question: store the connection information for every user in the user-settings page? Perhaps allow only some users to use the e-mail action?

  • https://sourceforge.net/projects/poppawid/ popper_mod-wid is a free, full featured web based email client written in PHP. It is an extension of the now abandoned \"popper_mod\" project which was an extension of the origional popper. It runs on any server that can run PHP and mySQL. Uses POP and S
  • php/MySQL based webmail program. Currently only supports pop3, IMAP is in the works. Has a notebook, a favorites organizer and an addressbook.

RFCs

  1. old standard: 822
  1. new standard: 2822
  1. "envelope" (transmission and delivery) -> 2821 (old standard: 821)
  1. MIME document series [RFC2045, RFC2046, RFC2047, RFC2048, RFC2049] for non ascii-messages (and audio, video,etc.?)

RFC2822
  • only standard for messages, not for audio, images etc.
  • This specification is intended as a definition of what message content format is to be passed between systems.
  • local storage is outside of the scope of this standard.
  • Note: This standard specifies that messages are made up of characters in the US-ASCII range of 1 through 127.

Length
  • length of a line without CRLF: 998 char. max, 78 char. recommended (2822)

Header
  • name of header, followed by a colon (":"), followed by a field body and terminated by CRLF (2822)
  • body: US-ASCII (2822) except colon
  • header can be spread about multiple lines (folding white space after CRLF) -> should be unfolded (simply removing any CRLF
that is immediately followed by WSP)

To do

read all the rtfs
look what oother free php e-mail programms do and who
look up php-sendmail
whait till Javawomen has finished WikkaAndEmail and see what could be used :-)

CategoryUsers
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki