Removed Cache class.
* File was little more than just a stub file for the Cache class. Removed Mailer class. * Attempting to remove non-critical classes from the system. * Class will be re-added / re-factored at a later date once the core of PICKLES is done. Removed Security class. * Removing non-critcal classes from the system. * Security class was not very generic and will be replaced down the road once the security scheme is full realized. Removed Form class. * Removing non-critcal classes from PICKLES to help the rewrite efforts. * Form class would take a database table and convert it into a webform. Nice script, but really had no place in PICKLES. * Eventually will replace with a generic HTML form element generation class. Added INSTALL file. Updated derivation of the hostname. * Hostname is now defaulted in the class variable definition. Refactoring Controller and Module
This commit is contained in:
parent
67c12593bc
commit
c2445d3a62
8 changed files with 150 additions and 709 deletions
|
@ -1,80 +0,0 @@
|
|||
<?php
|
||||
|
||||
class Form {
|
||||
|
||||
public function fromTable($table) {
|
||||
|
||||
$this->getArray('DESCRIBE menopausesolutions.affiliates');
|
||||
|
||||
$form = "<form>\n\t<dl>\n";
|
||||
|
||||
while ($row = mysql_fetch_assoc($results)) {
|
||||
|
||||
$label = ucwords(strtr($row['Field'], '_', ' '));
|
||||
$attributes = "name='{$row['Field']}' id='{$row['Field']}'";
|
||||
|
||||
$form .= "\t\t<dt>{$label}:</dt>\n\t\t<dd>\n\t\t\t";
|
||||
|
||||
// ENUM()
|
||||
if (preg_match('/^enum/', $row['Type'])) {
|
||||
$options = str_replace(array("enum('", "')"), '', $row['Type']);
|
||||
$options = explode("','", $options);
|
||||
|
||||
if (is_array($options)) {
|
||||
if (count($options) <= 2) {
|
||||
foreach ($options as $option) {
|
||||
$form .= "<input type='radio' {$attributes} value='{$option}' /> {$option} ";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$form .= "<select {$attributes}>";
|
||||
|
||||
if ($row['Null'] == 'YES' && $options[0] != '') {
|
||||
array_unshift($options, '');
|
||||
}
|
||||
|
||||
foreach ($options as $option) {
|
||||
$form .= "<option value='{$option}'>{$option}</option>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$form .= '</select>';
|
||||
}
|
||||
// TEXT and BLOG (all sizes)
|
||||
else if (preg_match('/(tiny|medium|long)?(text|blob)$/', $row['Type'])) {
|
||||
$form .= "<textarea {$attributes}></textarea>";
|
||||
}
|
||||
// DATE (not DATETIME)
|
||||
else if (preg_match('/^date$/', $row['Type'])) {
|
||||
|
||||
}
|
||||
/*
|
||||
else if (preg_match('/^datetime$/', $row['Type'])) {
|
||||
|
||||
}
|
||||
*/
|
||||
else if (preg_match('/(tiny|medium|long)?int([0-9]+)$/', $row['Type'])) {
|
||||
var_dump(split('int', $row['Type']));
|
||||
}
|
||||
// Generic default (input box)
|
||||
else {
|
||||
var_dump($row);
|
||||
if (preg_match('/^(var)?char\([0-9]+\)$/', $row['Type'])) {
|
||||
$type_array = split('(\(|\))', $row['Type']);
|
||||
$attributes .= " maxlength='{$type_array[1]}' size='{$type_array[1]}'";
|
||||
}
|
||||
|
||||
$form .= "<input type='text' {$attributes} />";
|
||||
}
|
||||
|
||||
$form .= "\n\t\t</dd>\n";
|
||||
}
|
||||
|
||||
$form .= "\t</dl>\n</form>\n";
|
||||
|
||||
exit($form);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue