SVN's being dumb so I'm commiting everything so that I can remove some directories and swap some crap around.
git-svn-id: http://svn.cleancode.org/svn/pickles@28 4d10bc64-7434-11dc-a737-d2d0f8310089
This commit is contained in:
parent
1fb64a5141
commit
15bab71735
15 changed files with 90 additions and 687 deletions
|
@ -1,21 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class ArrayUtils {
|
|
||||||
|
|
||||||
public static function object2array($object) {
|
|
||||||
if (is_object($object)) {
|
|
||||||
$object = (array)$object;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($object as $key => $value) {
|
|
||||||
if (is_object($value)) {
|
|
||||||
$object[$key] = self::object2array($value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $object;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,20 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Buffer {
|
|
||||||
|
|
||||||
public static function get() {
|
|
||||||
$buffer = ob_get_contents();
|
|
||||||
ob_end_clean();
|
|
||||||
|
|
||||||
$buffer = str_replace(
|
|
||||||
array(' ', "\r\n", "\n", "\t"),
|
|
||||||
null,
|
|
||||||
$buffer
|
|
||||||
);
|
|
||||||
|
|
||||||
return $buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,70 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Config {
|
|
||||||
|
|
||||||
private static $data;
|
|
||||||
|
|
||||||
private function __construct() { }
|
|
||||||
|
|
||||||
public static function check($site) {
|
|
||||||
if (file_exists('/var/www/josh/common/config/' . $site . '.ini')) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (file_exists('/var/www/josh/common/config/' . $site . '.xml')) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function load($site) {
|
|
||||||
// @todo no hardcoded paths!
|
|
||||||
$file = '/var/www/josh/common/config/' . $site . '.ini';
|
|
||||||
if (file_exists($file)) {
|
|
||||||
self::$data = parse_ini_file($file, true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$file = str_replace('ini', 'xml', $file);
|
|
||||||
|
|
||||||
if (file_exists($file)) {
|
|
||||||
$xml = ArrayUtils::object2array(simplexml_load_file($file));
|
|
||||||
|
|
||||||
self::$data = $xml;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Error::addError('Unable to load the configuration file');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function get($variable, $section = null) {
|
|
||||||
if (isset($section)) {
|
|
||||||
if (isset(self::$data[$section][$variable])) {
|
|
||||||
return self::$data[$section][$variable];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset(self::$data[$variable])) {
|
|
||||||
return self::$data[$variable];
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function enableDebug() { self::$data['debug'] = true; }
|
|
||||||
public static function disableDebug() { self::$data['debug'] = false; }
|
|
||||||
public static function getDebug() { return self::get('debug'); }
|
|
||||||
|
|
||||||
public static function getDisable() { return self::get('disable'); }
|
|
||||||
public static function getSession() { return self::get('session'); }
|
|
||||||
public static function getSmarty() { return self::get('smarty'); }
|
|
||||||
public static function getFCKEditor() { return self::get('fckeditor'); }
|
|
||||||
public static function getMagpieRSS() { return self::get('magpierss'); }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,111 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Controller {
|
|
||||||
|
|
||||||
public function __construct() {
|
|
||||||
global $smarty;
|
|
||||||
|
|
||||||
$section = $action = $is_admin = null;
|
|
||||||
|
|
||||||
if ((isset($_REQUEST['section']) && $_REQUEST['section'] == 'admin')) {
|
|
||||||
Session::authenticate();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set up the section and action from the _REQUEST values
|
|
||||||
// @todo this needs to be refactored.. my idea is to take what's there and throw it out, then loop through and load the variables that are
|
|
||||||
// present, then go ahead and set flags as to what kind of page it is, and what to load (is_admin, load_logic, load_template
|
|
||||||
if (isset($_REQUEST['section'])) {
|
|
||||||
// Determine if we're on an admin page
|
|
||||||
$is_admin = preg_match('/^admin/', $_REQUEST['section']);
|
|
||||||
|
|
||||||
// Check for section.action.php
|
|
||||||
if (isset($_REQUEST['action']) && file_exists('../logic/' . $_REQUEST['section'] . '.' . $_REQUEST['action'] . '.php')) {
|
|
||||||
$section = $_REQUEST['section'];
|
|
||||||
$action = $_REQUEST['action'];
|
|
||||||
}
|
|
||||||
// Else check for section.php
|
|
||||||
else if (file_exists('../logic/' . $_REQUEST['section'] . '.php')) {
|
|
||||||
$section = $_REQUEST['section'];
|
|
||||||
}
|
|
||||||
// Else check for section.action.tpl
|
|
||||||
else if (isset($_REQUEST['action']) && file_exists('../templates/' . $_REQUEST['section'] . '.' . $_REQUEST['action'] . '.tpl')) {
|
|
||||||
$section = $_REQUEST['section'];
|
|
||||||
$action = $_REQUEST['action'];
|
|
||||||
}
|
|
||||||
// Else check for section.tpl
|
|
||||||
else if (file_exists('../templates/' . $_REQUEST['section'] . '.tpl')) {
|
|
||||||
$section = $_REQUEST['section'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check that the user is authenticated
|
|
||||||
// @todo need to fucking fix this
|
|
||||||
if ($is_admin && !isset($_SESSION['user_id']) && !isset($_SESSION['artist_id'])) {
|
|
||||||
$section = 'admin';
|
|
||||||
$action = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we've come this far without a section, use the default
|
|
||||||
if (!isset($section)) {
|
|
||||||
$section = Config::get('default', 'navigation');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check that the logic script exists and if so, load it
|
|
||||||
$file = '../logic/' . $section . ($action ? '.' . $action : null) . '.php';
|
|
||||||
if (file_exists($file)) {
|
|
||||||
require_once $file;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if we're accessing an admin sub section and load the logic script
|
|
||||||
if (isset($_REQUEST['section']) && $_REQUEST['section'] != 'admin' && $is_admin) {
|
|
||||||
if ($_REQUEST['section'] == 'admin.logout') {
|
|
||||||
Session::logout();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$template = $_REQUEST['section'] . '.tpl';
|
|
||||||
|
|
||||||
$file = '../logic/' . $_REQUEST['section'] . '.php';
|
|
||||||
|
|
||||||
if (file_exists($file)) {
|
|
||||||
require_once $file;
|
|
||||||
}
|
|
||||||
|
|
||||||
$section = 'admin';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Else, just define the template
|
|
||||||
else {
|
|
||||||
$template = $section . ($action ? '.' . $action : null) . '.tpl';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load the main navigation from the config
|
|
||||||
$navigation = Config::get('sections', 'navigation');
|
|
||||||
|
|
||||||
// Add the admin section if we're authenticated
|
|
||||||
if (isset($_SESSION['user_id']) || isset($_SESSION['artist_id'])) {
|
|
||||||
if (Config::get('menu', 'admin') == 'true') {
|
|
||||||
$navigation['admin'] = 'Admin';
|
|
||||||
}
|
|
||||||
|
|
||||||
$smarty->assign('admin', Config::get('sections', 'admin'));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pass all of our controller values to Smarty
|
|
||||||
$smarty->assign('navigation', $navigation);
|
|
||||||
$smarty->assign('section', $section);
|
|
||||||
$smarty->assign('action', $action);
|
|
||||||
$smarty->assign('template', $template);
|
|
||||||
|
|
||||||
if (isset($_SESSION)) {
|
|
||||||
$smarty->assign('session', $_SESSION);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load it up!
|
|
||||||
header('Content-type: text/html; charset=UTF-8');
|
|
||||||
// @todo path is hardcoded case i am teh suckage
|
|
||||||
$smarty->display(isset($_REQUEST['ajax']) ? '/var/www/josh/common/smarty/templates/ajax.tpl' : 'index.tpl');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
226
classes/DB.php
226
classes/DB.php
|
@ -1,226 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class DB {
|
|
||||||
|
|
||||||
private static $hostname;
|
|
||||||
private static $username;
|
|
||||||
private static $password;
|
|
||||||
private static $database;
|
|
||||||
|
|
||||||
private static $connection;
|
|
||||||
private static $results;
|
|
||||||
|
|
||||||
public static function open() {
|
|
||||||
self::$hostname = Config::get('hostname', 'database');
|
|
||||||
self::$username = Config::get('username', 'database');
|
|
||||||
self::$password = Config::get('password', 'database');
|
|
||||||
self::$database = Config::get('database', 'database');
|
|
||||||
|
|
||||||
if (isset(self::$hostname) && isset(self::$username) && isset(self::$password) && isset(self::$database)) {
|
|
||||||
self::$connection = @mysql_connect(self::$hostname, self::$username, self::$password);
|
|
||||||
|
|
||||||
if (is_resource(self::$connection)) {
|
|
||||||
if (!mysql_select_db(self::$database, self::$connection)) {
|
|
||||||
Error::addWarning("There was an error selecting the '" . self::$database , "' database");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Error::addError('There was an error connecting to the database server');
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Error::addError('There was an error loading the configuration');
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function close() {
|
|
||||||
if (is_resource(self::$connection)) {
|
|
||||||
return mysql_close(self::$connection);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function execute($sql) {
|
|
||||||
if (!is_resource(self::$connection)) {
|
|
||||||
self::open();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (trim($sql) != '') {
|
|
||||||
self::$results = @mysql_query($sql, self::$connection);
|
|
||||||
if (empty(self::$results)) {
|
|
||||||
Error::addError('There was an error executing the SQL');
|
|
||||||
Error::addError(mysql_error());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Error::addWarning('There was no SQL to execute');
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getField($sql = null) {
|
|
||||||
if (isset($sql)) {
|
|
||||||
self::execute($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_resource(self::$results)) {
|
|
||||||
$results = @mysql_fetch_row(self::$results);
|
|
||||||
if (is_array($results)) {
|
|
||||||
return $results[0];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Error::addWarning('There is nothing to return');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Error::addError('There is no valid MySQL result resource');
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getRow($sql = null) {
|
|
||||||
if (isset($sql)) {
|
|
||||||
self::execute($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_resource(self::$results)) {
|
|
||||||
$results = @mysql_fetch_assoc(self::$results);
|
|
||||||
if (is_array($results)) {
|
|
||||||
return $results;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Error::addWarning('There is nothing to return');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Error::addError('There is no valid MySQL result resource');
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getArray($sql = null) {
|
|
||||||
if (isset($sql)) {
|
|
||||||
self::execute($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_resource(self::$results)) {
|
|
||||||
$return = null;
|
|
||||||
while ($row = mysql_fetch_assoc(self::$results)) {
|
|
||||||
if (!is_array($return)) {
|
|
||||||
$return = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
array_push($return, $row);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Error::addError('There is no valid MySQL result resource');
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function insert($table, $columnValues) {
|
|
||||||
if (!is_resource(self::$connection)) {
|
|
||||||
self::open();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (trim($table) != '') {
|
|
||||||
// @todo Check that the table exists, and possibly check that the columns exist as well
|
|
||||||
|
|
||||||
if (is_array($columnValues)) {
|
|
||||||
foreach ($columnValues as $key => $value) {
|
|
||||||
$columnValues[$key] = $value == null ? 'NULL' : "'" . mysql_real_escape_string(stripslashes($value), self::$connection) . "'";
|
|
||||||
}
|
|
||||||
|
|
||||||
self::execute("
|
|
||||||
INSERT INTO {$table} (
|
|
||||||
" . implode(array_keys($columnValues), ', ') . "
|
|
||||||
) VALUES (
|
|
||||||
" . implode($columnValues, ", ") . "
|
|
||||||
);
|
|
||||||
");
|
|
||||||
|
|
||||||
return mysql_insert_id(self::$connection);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Error::addError('No data was specified');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Error::addError('No database table was specified');
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function update($table, $columnValues, $conditions) {
|
|
||||||
if (!is_resource(self::$connection)) {
|
|
||||||
self::open();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (trim($table) != '') {
|
|
||||||
// @todo Check that the table exists, and possibly check that the columns exist as well
|
|
||||||
|
|
||||||
$fields = $where = null;
|
|
||||||
if (is_array($columnValues)) {
|
|
||||||
foreach ($columnValues as $key => $value) {
|
|
||||||
$fields .= ($fields ? ', ' : null) . $key . " = '" . mysql_real_escape_string(stripslashes($value), self::$connection) . "'";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_array($conditions)) {
|
|
||||||
foreach ($conditions as $key => $value) {
|
|
||||||
$where = ($where == null) ? 'WHERE ' : ' AND ';
|
|
||||||
|
|
||||||
if ($value == null) {
|
|
||||||
$where .= $key . ' IS NULL';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$where .= $key . " = '" . mysql_real_escape_string(stripslashes($value), self::$connection) . "'";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = 'UPDATE ' . $table . ' SET ' . $fields . $where;
|
|
||||||
if (self::execute($sql)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Error::addError('No conditions were specified');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Error::addError('No data was specified');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Error::addError('No database table was specified');
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function delete($table, $columnValues, $conditions) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,67 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Error {
|
|
||||||
|
|
||||||
private static $errors;
|
|
||||||
private static $warnings;
|
|
||||||
|
|
||||||
public static function instance() {
|
|
||||||
static $object;
|
|
||||||
|
|
||||||
if (!is_object($object)) {
|
|
||||||
$object = new Error();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $object;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function addError($message) {
|
|
||||||
self::$errors[] = $message;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function addWarning($message) {
|
|
||||||
self::$warnings[] = $message;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getError() {
|
|
||||||
return self::$errors;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getWarning() {
|
|
||||||
return self::$warnings;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function isError() {
|
|
||||||
if (is_array(self::getError()) || is_array(self::getWarning())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function display() {
|
|
||||||
if (self::isError()) {
|
|
||||||
if (self::getError()) {
|
|
||||||
foreach (self::getError() as $error) {
|
|
||||||
echo "{$error}<br />";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (self::getWarning()) {
|
|
||||||
foreach (self::getWarning() as $error) {
|
|
||||||
echo "{$warning}<br />";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
self::$errors = self::$warnings = null;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,28 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Form {
|
|
||||||
|
|
||||||
private function __construct() { }
|
|
||||||
|
|
||||||
public static function displayContact() {
|
|
||||||
?>
|
|
||||||
<form action="">
|
|
||||||
Name:<br />
|
|
||||||
Email:<br />
|
|
||||||
Subject:<br />
|
|
||||||
Message:<br />
|
|
||||||
|
|
||||||
</form>
|
|
||||||
<?php
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function processContact() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class ImageUtils {
|
|
||||||
|
|
||||||
static function check($type, $types = array('image/jpeg', 'image/gif', 'image/png')) {
|
|
||||||
if (!is_array($types)) {
|
|
||||||
$types[0] = $types;
|
|
||||||
}
|
|
||||||
|
|
||||||
return in_array($type, $types);
|
|
||||||
}
|
|
||||||
|
|
||||||
static function move($origin, $destination) {
|
|
||||||
move_uploaded_file($origin, $destination);
|
|
||||||
imagedestroy($origin);
|
|
||||||
}
|
|
||||||
|
|
||||||
static function resize() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static function convert($original, $destination, $keep_original = true) {
|
|
||||||
var_dump('convert ' . $original . ' ' . $destination);
|
|
||||||
|
|
||||||
var_dump( exec('convert ' . $original . ' ' . $destination) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
|
|
||||||
if ($_FILES['image']['type'] == 'image/jpeg') {
|
|
||||||
$original = $directory . 'original.jpg';
|
|
||||||
|
|
||||||
$source = imagecreatefromjpeg($original);
|
|
||||||
list($width, $height) = getimagesize($original);
|
|
||||||
|
|
||||||
$sizes = array('small' => 75, 'medium' => 150, 'large' => 500);
|
|
||||||
foreach ($sizes as $name => $size) {
|
|
||||||
$temp = imagecreatetruecolor($size, $size);
|
|
||||||
imagecopyresampled($temp, $source, 0, 0, 0, 0, $size, $size, $width, $height);
|
|
||||||
imagejpeg($temp, "{$directory}{$name}.jpg", 85);
|
|
||||||
|
|
||||||
imagedestroy($temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
imagedestroy($source);
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,43 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Mail {
|
|
||||||
|
|
||||||
static function send($recipients = null, $prefix = null) {
|
|
||||||
|
|
||||||
global $smarty;
|
|
||||||
|
|
||||||
$defaults = Config::get('contact');
|
|
||||||
|
|
||||||
if (!isset($recipients)) {
|
|
||||||
$recipients = $defaults['recipients']['recipient'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_array($recipients)) {
|
|
||||||
$to = null;
|
|
||||||
foreach ($recipients as $recipient) {
|
|
||||||
$to .= (isset($to) ? ',' : '') . $recipient;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$to = $recipients;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($prefix)) {
|
|
||||||
$prefix = isset($defaults['prefix']) ? $defaults['prefix'] : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mail($to, str_replace("\n", '', (isset($prefix) ? "[{$prefix}] " : '') . $_REQUEST['subject']), stripslashes($_REQUEST['message']), "From: {$_REQUEST['email']}\r\n")) {
|
|
||||||
$type = 'success';
|
|
||||||
$message = 'Message sent successfully';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$type = 'error';
|
|
||||||
$message = 'An unexpected error has occurred';
|
|
||||||
}
|
|
||||||
|
|
||||||
$smarty->assign('type', $type);
|
|
||||||
$smarty->assign('message', $message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,28 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Request {
|
|
||||||
|
|
||||||
private static $request;
|
|
||||||
|
|
||||||
public static function load() {
|
|
||||||
if (is_array($_REQUEST)) {
|
|
||||||
foreach ($_REQUEST as $key => $value) {
|
|
||||||
self::$request[$key] = $value;
|
|
||||||
unset($_REQUEST[$key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function get($variable) {
|
|
||||||
if (isset(self::$request[$variable])) {
|
|
||||||
return self::$request[$variable];
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -11,4 +11,32 @@
|
||||||
<password>m347r0n1c</password>
|
<password>m347r0n1c</password>
|
||||||
<database>meatronic</database>
|
<database>meatronic</database>
|
||||||
</database>
|
</database>
|
||||||
|
<navigation>
|
||||||
|
<default>home</default>
|
||||||
|
<sections>
|
||||||
|
<home>home</home>
|
||||||
|
<artists>artists</artists>
|
||||||
|
<releases>releases</releases>
|
||||||
|
<events>events</events>
|
||||||
|
<links>links</links>
|
||||||
|
<about>about</about>
|
||||||
|
</sections>
|
||||||
|
</navigation>
|
||||||
|
<admin>
|
||||||
|
<sections>
|
||||||
|
<news>news</news>
|
||||||
|
<artists>artists</artists>
|
||||||
|
<releases>releases</releases>
|
||||||
|
<links>links</links>
|
||||||
|
<downloads>download stats</downloads>
|
||||||
|
<logout>logout</logout>
|
||||||
|
</sections>
|
||||||
|
</admin>
|
||||||
|
<contact>
|
||||||
|
<prefix>VNN</prefix>
|
||||||
|
<recipients>
|
||||||
|
<recipient>verynicenoise@gmail.com</recipient>
|
||||||
|
<recipient>joshsherman@gmail.com</recipient>
|
||||||
|
</recipients>
|
||||||
|
</contact>
|
||||||
</config>
|
</config>
|
||||||
|
|
|
@ -1,29 +1,28 @@
|
||||||
<config>
|
<config>
|
||||||
<debug></debug>
|
|
||||||
<disable></disable>
|
|
||||||
<fckeditor></fckeditor>
|
|
||||||
<session>true</session>
|
|
||||||
<smarty>true</smarty>
|
|
||||||
<magpierss></magpierss>
|
|
||||||
<database>
|
<database>
|
||||||
<hostname>localhost</hostname>
|
<hostname>localhost</hostname>
|
||||||
<username>verynicenoise</username>
|
<username>verynicenoise</username>
|
||||||
<password>v3ryn1c3n0153</password>
|
<password>v3ryn1c3n0153</password>
|
||||||
<database>verynicenoise</database>
|
<database>verynicenoise</database>
|
||||||
</database>
|
</database>
|
||||||
<default>home</default>
|
|
||||||
<navigation>
|
<navigation>
|
||||||
<home>Home</home>
|
<default>home</default>
|
||||||
<about>About</about>
|
<sections>
|
||||||
<releases>Releases</releases>
|
<home>Home</home>
|
||||||
<artists>Artists</artists>
|
<about>About</about>
|
||||||
<shop>Shop</shop>
|
<releases>Releases</releases>
|
||||||
<contact>Contact</contact>
|
<artists>Artists</artists>
|
||||||
|
<shop>Shop</shop>
|
||||||
|
<contact>Contact</contact>
|
||||||
|
</sections>
|
||||||
</navigation>
|
</navigation>
|
||||||
<admin>
|
<admin>
|
||||||
<artist>Artist Profile</artist>
|
<menu>true</menu>
|
||||||
<user>User Account</user>
|
<sections>
|
||||||
<logout>Logout</logout>
|
<artist>Artist Profile</artist>
|
||||||
|
<user>User Account</user>
|
||||||
|
<logout>Logout</logout>
|
||||||
|
</sections>
|
||||||
</admin>
|
</admin>
|
||||||
<contact>
|
<contact>
|
||||||
<prefix>VNN</prefix>
|
<prefix>VNN</prefix>
|
||||||
|
|
35
config/verynicenoise.xml
Executable file
35
config/verynicenoise.xml
Executable file
|
@ -0,0 +1,35 @@
|
||||||
|
<config>
|
||||||
|
<debug></debug>
|
||||||
|
<disable></disable>
|
||||||
|
<fckeditor></fckeditor>
|
||||||
|
<session>true</session>
|
||||||
|
<smarty>true</smarty>
|
||||||
|
<magpierss></magpierss>
|
||||||
|
<database>
|
||||||
|
<hostname>localhost</hostname>
|
||||||
|
<username>verynicenoise</username>
|
||||||
|
<password>v3ryn1c3n0153</password>
|
||||||
|
<database>verynicenoise</database>
|
||||||
|
</database>
|
||||||
|
<default>home</default>
|
||||||
|
<navigation>
|
||||||
|
<home>Home</home>
|
||||||
|
<about>About</about>
|
||||||
|
<releases>Releases</releases>
|
||||||
|
<artists>Artists</artists>
|
||||||
|
<shop>Shop</shop>
|
||||||
|
<contact>Contact</contact>
|
||||||
|
</navigation>
|
||||||
|
<admin>
|
||||||
|
<artist>Artist Profile</artist>
|
||||||
|
<user>User Account</user>
|
||||||
|
<logout>Logout</logout>
|
||||||
|
</admin>
|
||||||
|
<contact>
|
||||||
|
<prefix>VNN</prefix>
|
||||||
|
<recipients>
|
||||||
|
<recipient>verynicenoise@gmail.com</recipient>
|
||||||
|
<recipient>joshsherman@gmail.com</recipient>
|
||||||
|
</recipients>
|
||||||
|
</contact>
|
||||||
|
</config>
|
11
jLib.php
11
jLib.php
|
@ -4,7 +4,10 @@ date_default_timezone_set('America/New_York');
|
||||||
define('JLIB_PATH', '/var/www/josh/common/');
|
define('JLIB_PATH', '/var/www/josh/common/');
|
||||||
|
|
||||||
function __autoload($class) {
|
function __autoload($class) {
|
||||||
require_once JLIB_PATH . 'classes/' . $class . '.php';
|
$file = JLIB_PATH . 'classes/' . $class . '.php';
|
||||||
|
if (file_exists($file)) {
|
||||||
|
require_once $file;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obliterates any passed in PHPSESSID (thanks Google)
|
// Obliterates any passed in PHPSESSID (thanks Google)
|
||||||
|
@ -88,12 +91,12 @@ if (Config::getSmarty()) {
|
||||||
|
|
||||||
// Use the FCKeditor instead of textareas
|
// Use the FCKeditor instead of textareas
|
||||||
if (Config::getFCKEditor()) {
|
if (Config::getFCKEditor()) {
|
||||||
require_once '/var/www/josh/common/static/fckeditor/fckeditor.php';
|
require_once JLIB_PATH . 'common/static/fckeditor/fckeditor.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the FCKeditor instead of textareas
|
// Load up MagpieRSS is so desired
|
||||||
if (Config::getMagpieRSS()) {
|
if (Config::getMagpieRSS()) {
|
||||||
require_once '/var/www/josh/common/contrib/magpierss/rss_fetch.inc';
|
require_once JLIB_PATH . '/var/www/josh/common/contrib/magpierss/rss_fetch.inc';
|
||||||
}
|
}
|
||||||
|
|
||||||
//Request::load();
|
//Request::load();
|
||||||
|
|
|
@ -2,14 +2,17 @@
|
||||||
|
|
||||||
function smarty_function_contact_form($params, &$smarty) {
|
function smarty_function_contact_form($params, &$smarty) {
|
||||||
$form = '
|
$form = '
|
||||||
<form action="/contact/send" method="post">
|
<form action="/contact/send" method="post" class="contact_form">
|
||||||
Email:<br />
|
Email:<br />
|
||||||
<input name="email" title="required" class="contact_input" /><br /><br />
|
<input name="email" title="required" class="contact_input" /><br /><br />
|
||||||
Subject:<br />
|
Subject:<br />
|
||||||
<input name="subject" title="required" class="contact_input" /><br /><br />
|
<input name="subject" title="required" class="contact_input" /><br /><br />
|
||||||
Message:<br />
|
Message:<br />
|
||||||
<textarea name="message" title="required" class="contact_textarea"></textarea><br /><br />
|
<textarea name="message" title="required" class="contact_textarea"></textarea><br /><br />
|
||||||
<input type="button" value="Send" onclick="ajaxSubmit(this.parentNode); return false;" class="contact_button" />
|
<div class="contact_button">
|
||||||
|
<input type="button" value="Send Message" onclick="ajaxSubmit(this.parentNode.parentNode); return false;" />
|
||||||
|
<input type="submit" />
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
';
|
';
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue