Add new directory structure. Tags will contain current and past releases, and stable will contain any bug fixes to the current stable release so users won't have to get the potentially broken trunk build to fix a screwup in stable.

Trunk updated to 0.9

git-svn-id: http://kusabax.cultnet.net/svn/repo/stable@176 73d99b7e-4f53-4972-b7b7-2ecd3c4d89ee
This commit is contained in:
Sazpaimon committed 2009-05-27 06:37:50 +00:00
commit 88bacfad9c
316 files changed
+79806

No files matched your search

@@ -0,0 +1,41 @@
<?php
// Generic adodblite Module
eval('class adodblite_EXTENDER extends ' . $last_module . '_ADOConnection { }');
class adodblite_ADOConnection extends adodblite_EXTENDER
{
function &GetToFieldArray($sql, $inputarr=false, $fieldname = false)
{
$data = false;
$result =& $this->Execute($sql, $inputarr);
if ($result) {
$data =& $result->GetToFieldArray($fieldname);
$result->Close();
}
return $data;
}
}
eval('class adodblite_resultset_EXTENDER extends ' . $last_module . '_ResultSet { }');
class adodblite_ResultSet extends adodblite_resultset_EXTENDER
{
function &GetToFieldArray($fieldname = false)
{
$results = false;
if(!$fieldname)
{
return $results;
}
while (!$this->EOF) {
$results[$this->fields[$fieldname]] = $this->fields;
$this->MoveNext();
}
return $results;
}
}
?>
+226
View File
@@ -0,0 +1,226 @@
<?php
// Generic Menu Module
eval('class menu_EXTENDER extends ' . $last_module . '_ADOConnection { }');
class menu_ADOConnection extends menu_EXTENDER
{
}
eval('class menu_resultset_EXTENDER extends ' . $last_module . '_ResultSet { }');
class menu_ResultSet extends menu_resultset_EXTENDER
{
// Requires $ADODB_FETCH_MODE = ADODB_FETCH_NUM
function GetMenu($name, $defstr='', $blank1stItem=true, $multiple=false, $size=0, $selectAttr='', $compareFields0=true)
{
$hasvalue = false;
if($multiple or is_array($defstr))
{
if($size==0)
$size=5;
$attr = ' multiple size="'.$size.'"';
if(!strpos($name,'[]'))
$name .= '[]';
}
else if($size)
$attr = ' size="'.$size.'"';
else $attr ='';
$s = '<select name="'.$name.'"'.$attr.' '.$selectAttr.'>';
if($blank1stItem)
if(is_string($blank1stItem))
{
$barr = explode(':',$blank1stItem);
if(sizeof($barr) == 1)
$barr[] = '';
$s .= "\n<option value=\"".$barr[0]."\">".$barr[1]."</option>";
} else $s .= "\n<option></option>";
if($this->FieldCount() > 1)
$hasvalue=true;
else $compareFields0 = true;
$value = '';
$optgroup = null;
$firstgroup = true;
$fieldsize = $this->FieldCount();
while(!$this->EOF)
{
$zval = rtrim(reset($this->fields));
if($blank1stItem && $zval=="")
{
$this->MoveNext();
continue;
}
if($fieldsize > 1)
{
if(isset($this->fields[1]))
$zval2 = rtrim($this->fields[1]);
else
$zval2 = rtrim(next($this->fields));
}
$selected = ($compareFields0) ? $zval : $zval2;
$group = '';
if($fieldsize > 2)
{
$group = rtrim($this->fields[2]);
}
if($optgroup != $group)
{
$optgroup = $group;
if($firstgroup)
{
$firstgroup = false;
$s .="\n<optgroup label='". htmlspecialchars($group) ."'>";
}
else
{
$s .="\n</optgroup>";
$s .="\n<optgroup label='". htmlspecialchars($group) ."'>";
}
}
if($hasvalue)
$value = " value='".htmlspecialchars($zval2)."'";
if(is_array($defstr))
{
if(in_array($selected,$defstr))
$s .= "\n<option selected='selected'$value>".htmlspecialchars($zval).'</option>';
else
$s .= "\n<option".$value.'>'.htmlspecialchars($zval).'</option>';
}
else
{
if(strcasecmp($selected,$defstr)==0)
$s .= "\n<option selected='selected'$value>".htmlspecialchars($zval).'</option>';
else
$s .= "\n<option".$value.'>'.htmlspecialchars($zval).'</option>';
}
$this->MoveNext();
} // while
// closing last optgroup
if($optgroup != null)
{
$s .= "\n</optgroup>";
}
return $s ."\n</select>\n";
}
function GetMenu2($name,$defstr='',$blank1stItem=true,$multiple=false,$size=0, $selectAttr='')
{
return $this->GetMenu($name, $defstr, $blank1stItem, $multiple, $size, $selectAttr, false);
}
function GetMenu3($name, $defstr='', $blank1stItem=true, $multiple=false, $size=0, $selectAttr='')
{
$hasvalue = false;
if($multiple or is_array($defstr))
{
if($size==0)
$size=5;
$attr = ' multiple size="'.$size.'"';
if(!strpos($name,'[]'))
$name .= '[]';
}
else if($size)
$attr = ' size="'.$size.'"';
else $attr ='';
$s = '<select name="'.$name.'"'.$attr.' '.$selectAttr.'>';
if($blank1stItem)
if(is_string($blank1stItem))
{
$barr = explode(':',$blank1stItem);
if(sizeof($barr) == 1)
$barr[] = '';
$s .= "\n<option value=\"".$barr[0]."\">".$barr[1]."</option>";
} else $s .= "\n<option></option>";
if($this->FieldCount() > 1)
$hasvalue=true;
else $compareFields0 = true;
$value = '';
$optgroup = null;
$firstgroup = true;
$fieldsize = sizeof($this->fields);
while(!$this->EOF)
{
$zval = rtrim(reset($this->fields));
if($blank1stItem && $zval=="")
{
$this->MoveNext();
continue;
}
if($fieldsize > 1)
{
if(isset($this->fields[1]))
$zval2 = rtrim($this->fields[1]);
else
$zval2 = rtrim(next($this->fields));
}
$selected = ($compareFields0) ? $zval : $zval2;
$group = '';
if(isset($this->fields[2]))
{
$group = rtrim($this->fields[2]);
}
if($optgroup != $group)
{
$optgroup = $group;
if($firstgroup)
{
$firstgroup = false;
$s .="\n<optgroup label='". htmlspecialchars($group) ."'>";
}
else
{
$s .="\n</optgroup>";
$s .="\n<optgroup label='". htmlspecialchars($group) ."'>";
}
}
if($hasvalue)
$value = " value='".htmlspecialchars($zval2)."'";
if(is_array($defstr))
{
if(in_array($selected,$defstr))
$s .= "\n<option selected='selected'$value>".htmlspecialchars($zval).'</option>';
else
$s .= "\n<option".$value.'>'.htmlspecialchars($zval).'</option>';
}
else
{
if(strcasecmp($selected,$defstr)==0)
$s .= "\n<option selected='selected'$value>".htmlspecialchars($zval).'</option>';
else
$s .= "\n<option".$value.'>'.htmlspecialchars($zval).'</option>';
}
$this->MoveNext();
} // while
// closing last optgroup
if($optgroup != null)
{
$s .= "\n</optgroup>";
}
return $s ."\n</select>\n";
}
}
?>
@@ -0,0 +1,99 @@
<?php
// Generic Object Module
eval('class object_EXTENDER extends ' . $last_module . '_ADOConnection { }');
class object_ADOConnection extends object_EXTENDER
{
}
class ADOFetchObj
{
}
eval('class object_resultset_EXTENDER extends ' . $last_module . '_ResultSet { }');
class object_ResultSet extends object_resultset_EXTENDER
{
var $_obj;
var $_names;
function &FetchObj()
{
$object =& $this->FetchObject(false);
return $object;
}
function &FetchObject($isupper=true)
{
if (empty($this->_obj))
{
$this->_obj = new ADOFetchObj();
$this->_names = array();
for ($i=0; $i <$this->_numOfFields; $i++)
{
$field = $this->FetchField($i);
$this->_names[] = $field->name;
}
}
$i = 0;
if (PHP_VERSION >= 5)
$object = clone($this->_obj);
else $object = $this->_obj;
for ($i=0; $i <$this->_numOfFields; $i++)
{
$name = $this->_names[$i];
if ($isupper)
$newname = strtoupper($name);
else $newname = $name;
$object->$newname = $this->Fields($name);
}
return $object;
}
function &FetchNextObj()
{
$object =& $this->FetchNextObject(false);
return $object;
}
function &FetchNextObject($isupper=true)
{
$object = false;
if ($this->_numOfRows != 0 && !$this->EOF) {
$object = $this->FetchObject($isupper);
$this->_currentRow++;
if ($this->_fetch())
return $object;
}
$this->EOF = true;
return $object;
}
/* Load a list of database objects
* @param string The field name of a primary key
* @return array If <var>key</var> is empty as sequential list of returned records.
* If <var>key</var> is not empty then the returned array is indexed by the value
* the database key. Returns <var>null</var> if the query fails.
*/
function &loadObjectList( $key='' )
{
$array = array();
while ($row = $this->FetchNextObject(false))
{
if ($key)
{
$array[$row->$key] = $row;
}
else
{
$array[] = $row;
}
}
return $array;
}
}
?>
+192
View File
@@ -0,0 +1,192 @@
<?php
// Generic Pear Module
// This module contains alternative Pear commands.
eval('class pear_EXTENDER extends ' . $last_module . '_ADOConnection { }');
class pear_ADOConnection extends pear_EXTENDER
{
/**
* Set how select queries will retrieve data.
* Usage: $oldmode = $db->SetFetchMode($mode)
*
* @param mode The fetchmode ADODB_FETCH_ASSOC or ADODB_FETCH_NUM
* @returns The previous fetch mode
*/
function SetFetchMode($mode)
{
GLOBAL $ADODB_FETCH_MODE;
$old = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = $mode;
return $old;
}
/**
* Returns the last record id of an inserted item
* Usage: $db->GetCol($sql);
*
* @access public
*/
function GetCol($sql, $inputarr = false, $trim = false)
{
$data = false;
$result =& $this->do_query($sql, -1, -1, $inputarr);
if ($result) {
$data = array();
while (!$result->EOF) {
$data[] = ($trim) ? trim(reset($result->fields)) : reset($result->fields);
$result->MoveNext();
}
$result->Close();
}
return $data;
}
/**
* Return first element of first row of sql statement. Recordset is disposed
* for you.
*
* Usage: $db->GetOne($sql);
* @access public
*/
function &GetOne($sql, $inputarr = false)
{
$data =& $this->GetRow($sql, $inputarr, true);
return $data;
}
/**
* Return one row of sql statement. Recordset is disposed for you.
*
* Usage: $db->GetRow($sql);
* @access public
*/
function &GetRow($sql, $inputarr = false, $getone = false)
{
$data = false;
$result =& $this->do_query($sql, -1, -1, $inputarr);
if ($result) {
if ($getone)
{
if (!$result->EOF) $data = reset($result->fields);
}
else
{
if (!$result->EOF) $data = $result->fields;
else $data = array();
}
$result->Close();
}
return $data;
}
/**
* PEAR DB Compat - do not use internally
*/
function &Query($sql, $inputarr = false)
{
$rs =& $this->do_query($sql, -1, -1, $inputarr);
return $rs;
}
/**
* PEAR DB Compat - do not use internally
*/
function &LimitQuery($sql, $offset, $nrows, $inputarr = false)
{
$rs =& $this->do_query($sql, $nrows, $offset, $inputarr);
return $rs;
}
/**
* PEAR DB Compat - do not use internally
*/
function Disconnect()
{
return $this->Close();
}
/**
* PEAR DB Compat - do not use internally
*/
function ErrorNative()
{
return $this->ErrorNo();
}
/**
* PEAR DB Compat - do not use internally
*/
function Quote($string)
{
return $this->qstr($string, false);
}
}
eval('class pear_resultset_EXTENDER extends ' . $last_module . '_ResultSet { }');
class pear_ResultSet extends pear_resultset_EXTENDER
{
/**
* PEAR DB Compatable Command
*/
function Free()
{
return $this->Close();
}
/**
* PEAR DB Compatable Command
*/
function NumRows()
{
return $this->_numOfRows;
}
/**
* PEAR DB Compatable Command
*/
function NumCols()
{
return $this->_numOfFields;
}
/**
* Fetch a row, returning false if no more rows.
* PEAR DB Compatable Command
*
* @return false or array containing the current record
*/
function FetchRow()
{
if ($this->EOF) {
$false = false;
return $false;
}
$arr = $this->fields;
$this->_currentRow++;
if (!$this->_fetch()) $this->EOF = true;
return $arr;
}
/**
* Fetch a row, returning PEAR_Error if no more rows.
* PEAR DB Compatable Command
*
*/
function FetchInto(&$arr)
{
$false = false;
$true = 1;
if ($this->EOF) return $false;
$arr = $this->fields;
$this->MoveNext();
return $true;
}
}
?>