more documentation for code in core
git-svn-id: file:///home/shish/svn/shimmie2/trunk@629 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
60e89ef893
commit
db582a2d46
6 changed files with 49 additions and 11 deletions
|
@ -1,4 +1,14 @@
|
|||
<?php
|
||||
/*
|
||||
* A basic chunk of page
|
||||
* $header -- the block's title
|
||||
* $body -- the content
|
||||
* $section -- where the block should be placed. The default theme supports
|
||||
* "main" and "left", other themes can add their own areas
|
||||
* $position -- how far down the section the block should appear, higher
|
||||
* numbers appear lower. The scale is 0-100 by convention,
|
||||
* though any number or string will work.
|
||||
*/
|
||||
class Block {
|
||||
var $header;
|
||||
var $body;
|
||||
|
@ -13,6 +23,11 @@ class Block {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* A generic navigation block with a link to the main page. Used
|
||||
* because "new NavBlock()" is easier than "new Block('Navigation', ..."
|
||||
*/
|
||||
class NavBlock extends Block {
|
||||
public function NavBlock() {
|
||||
$this->header = "Navigation";
|
||||
|
|
|
@ -1,12 +1,23 @@
|
|||
<?php
|
||||
/*
|
||||
* A class for easy access to the 'config' table, can always be accessed
|
||||
* through "global $config;"
|
||||
*/
|
||||
class Config {
|
||||
var $values = array();
|
||||
var $database = null;
|
||||
|
||||
/*
|
||||
* Load the config table from a database
|
||||
*/
|
||||
public function Config($database) {
|
||||
$this->database = $database;
|
||||
$this->values = $this->database->db->GetAssoc("SELECT name, value FROM config");
|
||||
}
|
||||
|
||||
/*
|
||||
* Save the current values as the new config table
|
||||
*/
|
||||
public function save($name=null) {
|
||||
if(is_null($name)) {
|
||||
foreach($this->values as $name => $value) {
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
$ADODB_CACHE_DIR="./data";
|
||||
require_once "lib/adodb/adodb.inc.php";
|
||||
|
||||
class Querylet { // {{{
|
||||
/* Querylet {{{
|
||||
* A fragment of a query, used to build large search queries
|
||||
*/
|
||||
class Querylet {
|
||||
var $sql;
|
||||
var $variables;
|
||||
|
||||
|
@ -25,6 +28,9 @@ class Querylet { // {{{
|
|||
}
|
||||
} // }}}
|
||||
|
||||
/*
|
||||
* A class for controlled database access, available through "global $database"
|
||||
*/
|
||||
class Database {
|
||||
var $db;
|
||||
var $extensions;
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
/*
|
||||
* A generic extension class, for subclassing
|
||||
*/
|
||||
class Extension {
|
||||
public function receive_event($event) {}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* An object representing an entry in the images table. As of 2.2, this no
|
||||
* longer necessarily represents an image per se, but could be a video,
|
||||
* sound file, or any other supported upload type.
|
||||
*/
|
||||
class Image {
|
||||
var $id = null;
|
||||
var $height, $width;
|
||||
|
@ -9,15 +13,11 @@ class Image {
|
|||
var $posted;
|
||||
var $source;
|
||||
|
||||
public function Image($a=null) {
|
||||
if(!is_null($a)) {
|
||||
$this->create_from_row($a);
|
||||
}
|
||||
}
|
||||
|
||||
private function create_from_row($row) {
|
||||
foreach($row as $name => $value) {
|
||||
$this->$name = $value; // hax
|
||||
public function Image($row=null) {
|
||||
if(!is_null($row)) {
|
||||
foreach($row as $name => $value) {
|
||||
$this->$name = $value; // hax
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
/*
|
||||
* An object representing a row in the "users" table.
|
||||
*/
|
||||
class User {
|
||||
var $id;
|
||||
var $name;
|
||||
|
|
Reference in a new issue