koi documentation - developer

Introduction

koi is a simple yet powerful content management system.

The documentation is in a very early state. Some important parts may be missing and the order of things may not be logical.

User Definitions

Legal

koi is licensed under the GNU General Public License, version 2.

Most artwork comes from the Tango Desktop Project under the Creative Commons Attribution Share-Alike license.

Included Software

Server Requirements

koi should run on most modern UNIX operating systems with Apache2 and PHP5.
It may run on Windows too, but that remains untested.

Other versions than the ones mentioned below may work too.

Use the TEST.php script for an automated test of most requirements.

Unix Operating System

Apache httpd

PHP

MySQL

ImageMagick

Installation

Getting Started

Administrator Requirements

koi administration (/admin) requires a modern browser due to heavy AJAX and DHTML usage.

koi has passed testing with these browsers:

koi has failed testing with these browsers:

Media Gallery

The file extensions listed below are accepted for upload by the Media Gallery.

More extensions can be added by modifying action_files_upload() in koi_admin.php.

Image Files

Adobe Flash

Bittorrent

Archives

Text

Documents

Spreadsheets

Presentations

Audio Files

Video Files

File Locations

/

.htaccess
Apache mod_rewrite rules for implemented website
preview.php
Preview application creator
public.php
Public application creator
TEST.php
System compatibility tests
This file is safe to delete

admin/

.htaccess
Apache mod_rewrite rules for administration
admin.php
Administration Application Creator
css/
Administration cascaded style sheets
images/
Administration images
scripts/
Administration javascripts

cache/

Files and processed images are stored here.
Directory must be writable.

dba/

DBA files are stored here.
Directory must be writable.

koi/

.htaccess
Apache deny access
conf.php
Configuration file. Edit this file.
koi_base.php
Shared base classes
koi_preview.php
Preview application
koi_public.php
Public application
koi_admin.php
Admin application
koi_admin.lang.csv
Language specific labels
shared4/
Public domain libraries

user/

400.php
Custom error handling of 400 Bad Request errors
401.php
Custom error handling of 401 Unauthorized errors
402.php
Custom error handling of 402 Payment Required errors
403.php
Custom error handling of 403 Forbidden errors
404.php
Custom error handling of 404 Not Found errors
css/
Recommended directory for css files
images/
Recommended directory for image files
scripts/
Recommended directory for javascript files
plugins/
Put you plug-ins here
templates/
Put your templates here

Templates

Recommendation: Take a look at the sample templates located in user/templates, before reading this section.

Template Types

There are two kinds og templates: Page and Element.

Page Templates

Element Templates

Template Methods

These methods must be implemented in the templates.

form()

show()

thumbnail()

Available Methods

The following methods are available through parent classes page_template and element_template:

get_page()

get_element()

get_elements()

show_element()

get_file()

get_image()

is_preview()

Quick Forms

Two classes, quick_page_form and quick_element_form, exist to help you implement the form() method.

__construct()

head()

foot()

text()

text_req()

email()

email_req()

textarea()

textarea_req()

date()

date_req()

checkbox()

select()

select_req()

media()

richtext()

page_link()

page_link_req()

splitter()

description()

keywords()

template()

release_expire()

special()

elements()

Plugins

Put your plug-ins (some PHP script you write) in the user/plugins directory. One sub directory for each plug-in, e.g. user/plugins/my_plugin.

You can change the icon by placing a 16x16 PNG file named koi.png in the above sub directory.

You can change the plugin name by placing a text file containing the name in same directory. The text file must be called koi.txt.

Place the following PHP code in at the top of your plug-in:

ini_set('include_path', '.:../../../koi/:../../../koi/shared4/');
require 'koi_admin.php';
$koi = new koi_admin;
if (!$koi->authenticate(@$_COOKIE['username'], @$_COOKIE['password'])) {
    die('401 Unauthorized');
}

PHP Code: Files and Classes

This section is only relevant for developers, who want to help develop koi.

shared4/abstraction.php

Note: This file is public domain and not part of koi.

class xml_gen
XHTML abstraction layer
class table_xml_gen
XHTML abstraction layer for tables
class form_xml_gen
XHTML abstraction layer for forms with javascript validation

shared4/application.php

Note: This file is public domain and not part of koi.

class application
Generic web application

shared4/dbobject.php

Note: This file is public domain and not part of koi.

class dbobject
Object oriented access to MySQL tables

shared4/mysql.php

Note: This file is public domain and not part of koi.

class mysql
MySQL abstraction layer

koi_base.php

abstract class template
Abstract superclass extended for all templates
abstract class element_template extends template
Abstract superclass for element templates
abstract class page_template extends template
Abstract superclass for page templates
class page_template_standard extends page_template
The standard page template
class page_container
Container class for pages
class element_container
Container class for elements
class file_container
Contianer class for files
abstract class koi_app
Abstract class extended by the public and preview applications

koi_public.php

class koi_public extends koi_app
Application generating the implemented website

koi_preview.php

class koi_preview extends koi_app
Application generating preview of implemented website

koi_admin.php

class koi_admin extends application
Administration pplication
class dbElement extends dbObject
Object oriented access to Element table
class dbFile extends dbObject
Object oriented access to File table
class dbFolder extends dbObject
Object oriented access to Folder table
class dbPage extends dbObject
Object oriented access to Page table
class dbUser extends dbObject
Object oriented access to User table
class Page extends dbPage
Page object for administration
class Element extends dbElement
Element object for administration
abstract class quick_form
Quick Form abstract superclass
class quick_element_form extends quick_form
Quick Form for elements
class quick_page_form extends quick_form
Quick Form for pages

Copyright © 2008 by Wagawaga & Allan Hansen