Skip to content
Browse files

Merge branch 'master' of github.com:donatj/CorpusPHP

  • Loading branch information...
2 parents 9396cc4 + bd1e72a commit 127a6aea86259affa50eb5e89b507be2ca30a06e @donatj committed Aug 31, 2011
View
2 Source/corpus/content/contact.php
@@ -5,8 +5,6 @@
//hide from sitemap
$_meta['header'] = '<link rel="stylesheet" href="css/form.css" type="text/css" charset="utf-8" />';
-require(DWS_CLASS . 'class.FormUtility.php');
-require(DWS_CLASS . 'class.phpmailer.php');
$x_message_stack = new MessageStack('contact_us');
$thanks_stack = new MessageStack('thanks');
View
4 Source/corpus/content/search.php
@@ -12,9 +12,9 @@
<h1>Search Results</h1>
<?
- $ss = implodePre(" concat(name,description,large_description,details) like '%", $searchA, "%' OR ", "%'");
+ $ss = implodePre(" concat_ws(' ',name,description,large_description,details) like '%", $searchA, "%' OR ", "%'");
- $spr = new SplitPageResults("SELECT *, concat(name,description,large_description,details) as Data, Match(name,description,large_description,details) Against ( '".$search."' ) score
+ $spr = new SplitPageResults("SELECT *, concat_ws(' ',name,description,large_description,details) as Data, Match(name,description,large_description,details) Against ( '".$search."' ) score
From categories
Where list = 1 AND (template > 0 OR template = -2) AND
( Match(name,description,large_description,details) Against ( '".$search."' ) > 0
View
52 Source/includes/app_top.php
@@ -1,65 +1,25 @@
<?
-
+error_reporting(E_ALL ^ E_NOTICE);
require_once('includes/configure.php');
-
-//Load DBO --MUST BE BEFORE INIT--
-require_once(DWS_DBO . 'User.php');
-
require_once(DWS_INCL . 'init.php');
-require_once(DWS_CLASS . 'MessageStack.php');
$_ms = new MessageStack;
+require_once(DWS_CLASS . 'Corpus.php');
require_once(DWS_CLASS . 'Core.php');
+require_once(DWS_CLASS . 'Database.php');
+require_once(DWS_CLASS . 'FormElements.php');
-include(DWS_FUNC . 'error.php');
-error_reporting(E_ALL ^ E_NOTICE);
-//set_error_handler( _errorHandler, E_ALL ^ E_NOTICE );
-
+require_once(DWS_FUNC . 'error.php');
require_once(DWS_FUNC . 'general.php');
require_once(DWS_FUNC . 'corporeal.php');
-require_once(DWS_CLASS . 'Database.php');
-$_db = new Database;
-
-require_once(DWS_CLASS . 'Cache.php');
-require_once(DWS_CLASS . 'Configuration.php');
+$_db = new Database;
$_cfg = new Configuration;
$_cfg->PAGELOADS += 1;
-require_once(DWS_CLASS . 'Corpus.php');
new Corpus;
-
-require_once(DWS_CLASS . 'NavigationHistory.php');
$_nh = new NavigationHistory;
-
-require_once(DWS_CLASS . 'Login.php');
$_lg = new Login;
-if(isset($_GET['logout'])){
- $_nh->Reset('login');
- $_lg->Logout();
- redirect(DWS_BASE);
-}
-
-if(isset( $_GET['login'] )) {
- if( $_lg->attempt( $_POST['username'], $_POST['password'] ) ) {
- $url = $_nh->RestoreURL('login');
- if($url) {
- $_nh->Reset('login');
- redirect($url);
- }else{
- redirect('application');
- }
- }else{
- $_ms->add("Error Logging In", true);
- redirect('login.php');
- }
-}
-
-require_once(DWS_CLASS . 'SplitPageResults.php');
-
-require_once(DWS_CLASS . 'Elements.php');
-require_once(DWS_CLASS . 'FormElements.php');
-
new Core;
View
1 Source/includes/classes/Cache.php
@@ -24,6 +24,7 @@ class Cache {
private $module;
function __construct($module = false) {
+ self::cleanup();
$this->module = $module;
$qry = db::query("Select `expires`, `autoclear` From cache Where module = '".db::input($this->module)."' ", true);
View
6 Source/includes/classes/Core.php
@@ -16,7 +16,11 @@ function __construct() {
$this->cacheUrls();
self::$id = (int)$_GET['id'];
self::$url = trim($_GET['url']);
-
+
+ if( self::$url == '' ) {
+ self::$url = 'index.php';
+ }
+
//SEO Urls
if( self::$id <= 0 && isset($___Urls[ self::$url ]) ){
self::$id = $___Urls[ self::$url ];
View
2 Source/includes/classes/Database.php
@@ -21,7 +21,7 @@ class db extends Database {} class Database {
/**
* Creates connection to the database, checks the database character set, and sets the database to work in UTF-8
*/
- function __construct(){
+ function __construct() {
global $_ms;
$this->link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$this->link) $_ms->add('Error Connecting to Database', true);
View
0 ...ce/includes/classes/class.FormUtility.php → Source/includes/classes/FormUtility.php
File renamed without changes.
View
27 Source/includes/classes/Login.php
@@ -15,11 +15,34 @@ class Login {
public $user;
function __construct() {
+ global $_nh;
+
if( $_SESSION['corpus']['user'] instanceof User ) {
$this->user =& $_SESSION['corpus']['user'];
}else{
$this->user = false;
}
+
+ if(isset($_GET['logout'])){
+ $_nh->Reset('login');
+ $_lg->Logout();
+ redirect(DWS_BASE);
+ }
+
+ if(isset( $_GET['login'] )) {
+ if( $this->attempt( $_POST['username'], $_POST['password'] ) ) {
+ $url = $_nh->RestoreURL('login');
+ if($url) {
+ $_nh->Reset('login');
+ redirect($url);
+ }else{
+ redirect( href() );
+ }
+ }else{
+ $_ms->add("Error Logging In", true);
+ redirect('login.php');
+ }
+ }
}
function IsLoggedIn() { return ($this->user instanceof User); }
@@ -37,9 +60,9 @@ function VerifyLoggedIn() {
function Logout() { unset($_SESSION['corpus']['user']); }
function attempt($user,$pass) {
-
+
$uinfo = db::fetch("Select user_id, access From users WHERE email = '".db::input(trim($user))."' AND PASSWORD(password) = PASSWORD('".db::input(trim($pass))."')", db::ROW);
-
+
if($uinfo['user_id'] > 0) {
$dbo_name = ucwords($uinfo['access']);
if( class_exists($dbo_name) && is_subclass_of($dbo_name, 'User') ) {
View
0 Source/includes/classes/class.phpmailer.php → Source/includes/classes/PHPMailer.php
File renamed without changes.
View
4 Source/includes/classes/Vcard.php
@@ -6,7 +6,7 @@
*
*/
-class vcard {
+class Vcard {
var $log;
var $data; //array of this vcard's contact data
var $filename; //filename for download file naming
@@ -17,7 +17,7 @@ class vcard {
/*
The class constructor. You can set some defaults here if desired.
*/
- function vcard() {
+ function __construct() {
$this->log = "New vcard() called<br />";
$this->data = array(
"display_name"=>null
View
2 Source/includes/configure.php
@@ -32,5 +32,7 @@
define('STORE_OWNER_EMAIL_ADDRESS', 'noreply@donatstudios.com');
define('STORE_GENERIC_FROM', 'noreply@donatstudios.com');
+
+ $__autoload_paths = array( DWS_CLASS, DWS_DBO );
endif;
View
2 Source/includes/dbo/User.php
@@ -1,6 +1,6 @@
<?
-Class User {
+class User {
public $info;
var $id;
View
1 Source/includes/functions/corporeal.php
@@ -113,7 +113,6 @@ function button( $text, $link = false, $linkParams = '', $buttonParams = '', $ty
}
function keywordExpansion( $searchedFor ) {
- require_once(DWS_CLASS . 'Inflector.php');
$inf = new Inflector();
$search = trim( $searchedFor );
View
22 Source/includes/init.php
@@ -1,22 +1,16 @@
<?
-/*
-
-TODO: auto dbo loader needs a way to prioritize the order things are loaded
-
-function __dbo_loader() {
- $root_classes = get_declared_classes();
- $dbofs = scandir( DWS_DBO );
- foreach( $dbofs as $dbof ) {
- if( is_file( DWS_DBO . $dbof ) ) {
- echo DWS_DBO . $dbof;
- include( DWS_DBO . $dbof );
+function __autoload($class) {
+ global $__autoload_paths;
+ foreach( $__autoload_paths as $path ) {
+ if( file_exists($path . $class . '.php') ) {
+ include($path . $class . '.php');
+ return true;
}
}
- print_r($root_classes);
+
+ die('Failed to dynamically load class "' . $class . '"');
}
-__dbo_loader();
-*/
session_name(md5(DWS_BASE));
session_start();

0 comments on commit 127a6ae

Please sign in to comment.
Something went wrong with that request. Please try again.