Skip to content

Commit

Permalink
Thinkshop 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
towonder committed Mar 14, 2011
1 parent 8730edb commit a70508b
Show file tree
Hide file tree
Showing 990 changed files with 7,974 additions and 107,472 deletions.
47 changes: 6 additions & 41 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -11,53 +11,18 @@
* @copyright To Wonder Multimedia
* @link http://www.getthinkshop.com Thinkshop Project
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
* @version Thinkshop beta 2.1

*/



SETUP

Place all files on an apache webserver,
and go to that url. If you have enough rights on the /app/config -folder, you'll be able to
install the webshopsystem (like wordpress) within 5 minutes.

Frontend-files views are here: /app/views/winkel/ and the frontend controller is here: /app/controllers/winkel_controller.php

Good Luck!



TEMPLATES

Templates are not yet a part of Thinkshop 2.1 (sadly) but you can use the Cakephp template engine. Read all about it, here:
http://book.cakephp.org/view/95/View-Templates

* Thanks to:
* Michael Henriksen for the css3 button css
* Mihaiciuc Bogdan for the menu icons


*/

PLUGINS

Place your plugins inside /app/plugins/ and follow normal CakePhp 1.2 rules. If you want to add front-end functions, just add a file titled /app/plugins/plugin_name/vendors/includes/front.php, same for the admin (only user vendors/includes/admin.php), custom routes (vendors/includes/routes.php) and custom menu-items (vendors/includes/menu.php).
If you need any new databasetables, place the appropriate sql in: /app/plugins/plugin_name/vendors/includes/install.php and all the uninstall sql in vendors/includes/uninstall.php.

More on this soon in the Thinkshop supportwiki. For now, check out Cake's awesome documentation on writing CakePhp plugins:
http://book.cakephp.org/view/114/Plugins



CHANGELOG

Thinkshop beta 2.1:
Added easy 5-minute "Wordpress"-like install. Just have your database, login, password and host ready.


Thinkshop beta 2.0:
Added an extended pluginsystem on top of the CakePhp pluginsystem.


Thinkshop beta 1.0:
First beta copy of Thinkshop, contains easy productmanagement, mediamanagement, categories, product metadata, financial quarterly reviews,
user management and some 'Wordpress'-like settings.

SETUP:

65 changes: 42 additions & 23 deletions app/app_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* Thinkshop : The most userfriendly open source webshopssytem.
* Copyright 2010, To Wonder Multimedia
* Copyright 2011, To Wonder Multimedia
*
*
* Licensed under The MIT License
Expand All @@ -12,6 +12,7 @@
* @copyright To Wonder Multimedia
* @link http://www.getthinkshop.com Thinkshop Project
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
* @version Thinkshop 2.2 - Hendrix
*/

Expand All @@ -34,14 +35,34 @@ function setTab($string){
function checkSession()
{
// If the session info hasn't been set...
if (!$this->Session->check('admin') && $this->action != 'login' && $this->action != 'passwordforgot' && $this->action != 'confirm'){
// Force the user to login
Header('Location:'.HOME.'/admin/login');
exit();
if (!$this->Session->check('admin') && $this->isGreenListed() == false){
// Force the user to login
Header('Location:'.HOME.'/admin/login');
exit();
}
}


function isGreenListed(){
$greenlisted = false;
$baseArray = array('login', 'passwordforgot', 'confirm', 'checkLogin', 'checkadminemail');
$mediaArray = array('medialibrary', 'editmainpicture', 'addMediaToProduct', 'savemainpicture','getproductpictures','getmainpicture');

foreach($baseArray as $ba){
if($this->action == $ba){
$greenlisted = true;
}
}

foreach($mediaArray as $ma){
if($this->action == $ma){
$greenlisted = true;
}
}

return $greenlisted;
}


function fetchSettings(){
//Loading model on the fly
Expand Down Expand Up @@ -224,6 +245,11 @@ function delCrumbs(){
function uploadPhotos($id = null){
//Make sure we know what the HOME folder is
$this->fetchSettings();
$this->layout = '';

//set errorstring to empty:
$error = '';


$this->loadModel('Photo');
if(!empty($id)){
Expand Down Expand Up @@ -313,38 +339,29 @@ function uploadPhotos($id = null){
$this->data['Product']['photo_id'] = $this->Photo->getLastInsertId();
$this->Product->save($this->data);
//echo 1 for uploadify:
echo "1";
$error = 'upload_okay';
}else{
//echo 1 for uploadify:
echo "1";
$error = 'upload_okay';
}
}

}else{
//thumb + medium uploads didn't work
$this->Photo->create();
$this->data['Photo']['name'] = substr($filename, 0, -4);
$this->data['Photo']['thumb'] = 'error';
$this->data['Photo']['medium'] = 'error';
$this->data['Photo']['large'] = 'error';
$this->Photo->save($this->data);
$error = 'Het genereren van de thumbnails lukt niet (waarschijnlijk een probleem met PHP safe-mode)';
}

}else{
// no upload

//
// NEED TO FIND A WAY TO GET A CORRECT ERROR MESSAGE TO UPLOADIFY
//

$error = 'Upload slaagt niet (waarschijnlijk een probleem met PHP safe-mode)';
}
}else{
//no files

//
// NEED TO FIND A WAY TO GET A CORRECT ERROR MESSAGE TO UPLOADIFY
//
$error = 'Dit zijn geen geldige bestanden';
}

$this->set('error', $error);

}


Expand All @@ -355,6 +372,7 @@ function uploadPhotos($id = null){
//
*/


function addMetatermsToProduct($product){
//just a function to make acces to metaterms & values a little simpler:

Expand Down Expand Up @@ -430,6 +448,7 @@ function getOrderProducts($id, $overview = false){
$products[$i]['Product']['price'] = $product['Product']['price'];
$products[$i]['Product']['vat'] = $product['Product']['vat'];
$products[$i]['Product']['sendcost'] = $product['Product']['sendcost'];
$products[$i]['Product']['discount'] = $prod['OrdersProducts']['discount'];

if($product['Product']['parent_id'] != '0'){
$parent = $this->Product->read(null, $product['Product']['parent_id']);
Expand Down
29 changes: 28 additions & 1 deletion app/app_error.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* Thinkshop : The most userfriendly open source webshopssytem.
* Copyright 2010, To Wonder Multimedia
* Copyright 2011, To Wonder Multimedia
*
*
* Licensed under The MIT License
Expand All @@ -13,28 +13,55 @@
* @copyright To Wonder Multimedia
* @link http://www.getthinkshop.com Thinkshop Project
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
* @version Thinkshop 2.2 - Hendrix
*/

class AppError extends ErrorHandler {

//get sessions & settings before every function:
function fetchSettings(){
//Loading model on the fly
App::import('Model','Setting');
//Fetching All params
$setting = new Setting;
$settings_array = $setting->find('all');

//Create a global for every setting:
foreach($settings_array as $key=>$value){
$constant = $value['Setting']['key'];
$val = $value['Setting']['pair'];

if(!defined($constant)){
eval("DEFINE(\$constant, \$val);");
}
}
}


function error404($params) {
$this->fetchSettings();
$this->controller->layout = "error";
parent::error404($params);
}

function missingController($params) {
$this->fetchSettings();

$this->controller->layout = "error";
parent::missingController($params);
}

function missingAction($params) {
$this->fetchSettings();

$this->controller->layout = "error";
parent::missingAction($params);
}

function missingConnection($params){
$this->fetchSettings();

$ar = explode('/',$_SERVER['REQUEST_URI']);
$middle = $ar[1];
$url = 'http://'.$_SERVER['HTTP_HOST'].'/'. $middle;
Expand Down
3 changes: 2 additions & 1 deletion app/app_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* Thinkshop : The most userfriendly open source webshopssytem.
* Copyright 2010, To Wonder Multimedia
* Copyright 2011, To Wonder Multimedia
*
*
* Licensed under The MIT License
Expand All @@ -13,6 +13,7 @@
* @copyright To Wonder Multimedia
* @link http://www.getthinkshop.com Thinkshop Project
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
* @version Thinkshop 2.2 - Hendrix
*/

Expand Down
2 changes: 1 addition & 1 deletion app/config/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,4 @@
/**
* A random string used in security hashing methods.
*/
Configure::write('Security.salt', 'u3W7GtzKuKrf2uVlOXQkvTGeo4v9q24tYBASBAm5'); ?>
Configure::write('Security.salt', '8AYZpf1LJXcrLu31tB41Yi7ms1Kftim1sLbi0c3J'); ?>
1 change: 1 addition & 0 deletions app/config/database.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php class DATABASE_CONFIG {var $default = array('driver' => 'mysql','persistent' => false,'host' => 'localhost','login' => 'root','password' => 'root','database' => 'think22','prefix' => '',);var $test = array('driver' => 'mysql','persistent' => false,'host' => 'localhost','login' => 'root','password' => 'root','database' => 'think22','prefix' => '',);} ?>
20 changes: 8 additions & 12 deletions app/config/sql/think.sql
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
-- phpMyAdmin SQL Dump
-- version 3.2.5
-- http://www.phpmyadmin.net
--
-- Machine: localhost
-- Genereertijd: 25 Dec 2010 om 15:13
-- Serverversie: 5.1.44
-- PHP-Versie: 5.2.13

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

CREATE TABLE `admins`(`id` int(11) NOT NULL AUTO_INCREMENT,`naam` varchar(255) NOT NULL,`wachtwoord` varchar(255) NOT NULL,`email` varchar(255) NOT NULL,`lastvisited` datetime NOT NULL,PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

CREATE TABLE `categories` (`id` int(11) NOT NULL AUTO_INCREMENT,`name` varchar(255) NOT NULL,`created` datetime NOT NULL,`position` int(11) NOT NULL,`parent_id` int(11) NOT NULL,PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

CREATE TABLE `categories_products` (`id` int(11) NOT NULL AUTO_INCREMENT, `category_id` int(11) NOT NULL, `product_id` int(11) NOT NULL, `position` int(11) NOT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

CREATE TABLE `costs` (`id` int(11) NOT NULL AUTO_INCREMENT,`naam` varchar(255) NOT NULL,`prijs` varchar(255) NOT NULL,`hoeveelheid` int(11) NOT NULL,`btw` varchar(4) NOT NULL,`created` datetime NOT NULL,PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

CREATE TABLE `extraterms` (`id` int(11) NOT NULL AUTO_INCREMENT,`name` varchar(255) NOT NULL,`created` datetime NOT NULL,PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
Expand All @@ -29,7 +22,7 @@ CREATE TABLE `options` (`id` int(11) NOT NULL AUTO_INCREMENT,`orders_products_id

CREATE TABLE `orders` (`id` int(11) NOT NULL AUTO_INCREMENT,`user_id` int(11) NOT NULL,`paid` tinyint(1) NOT NULL DEFAULT '0',`method` varchar(255) NOT NULL,`created` datetime NOT NULL,`paid_on` datetime NOT NULL,PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

CREATE TABLE `orders_products` (`id` int(11) NOT NULL AUTO_INCREMENT,`order_id` int(11) NOT NULL,`product_id` int(11) NOT NULL,PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
CREATE TABLE `orders_products` (`id` int(11) NOT NULL AUTO_INCREMENT,`order_id` int(11) NOT NULL,`product_id` int(11) NOT NULL,`discount` varchar(255) NOT NULL,PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

CREATE TABLE `photos` (`id` int(11) NOT NULL AUTO_INCREMENT,`name` varchar(255) DEFAULT NULL,`thumb` varchar(255) NOT NULL,`medium` varchar(255) NOT NULL,`large` varchar(255) NOT NULL,`created` datetime NOT NULL,PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Expand All @@ -39,7 +32,7 @@ CREATE TABLE `plugins` (`id` int(11) NOT NULL AUTO_INCREMENT,`name` varchar(255)

CREATE TABLE `posts` (`id` int(11) NOT NULL AUTO_INCREMENT,`title` varchar(255) NOT NULL,`body` text NOT NULL,`created` datetime NOT NULL,`edited` datetime NOT NULL,`slug` varchar(255) NOT NULL,`pagetitle` varchar(255) NOT NULL,`keywords` varchar(255) NOT NULL,`hidden` tinyint(1) NOT NULL DEFAULT '0',PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

CREATE TABLE `products` (`id` int(11) NOT NULL AUTO_INCREMENT,`image` varchar(255) NOT NULL,`name` varchar(255) NOT NULL,`description` text NOT NULL,`excerpt` text NOT NULL,`deliver` varchar(255) NOT NULL,`created` datetime NOT NULL,`price` varchar(255) NOT NULL,`sendcost` varchar(255) NOT NULL,`vat` varchar(4) NOT NULL DEFAULT '0.19',`position` int(11) NOT NULL,`sale` tinyint(1) NOT NULL DEFAULT '0',`hidden` tinyint(1) NOT NULL DEFAULT '0',`slug` varchar(255) NOT NULL,`pagetitle` varchar(255) NOT NULL,`pagemeta` varchar(255) NOT NULL,`category_id` int(11) NOT NULL,`parent_id` int(11) NOT NULL,`photo_id` int(11) NOT NULL,PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
CREATE TABLE `products` (`id` int(11) NOT NULL AUTO_INCREMENT,`image` varchar(255) NOT NULL,`name` varchar(255) NOT NULL,`description` text NOT NULL,`excerpt` text NOT NULL,`deliver` varchar(255) NOT NULL,`created` datetime NOT NULL,`price` varchar(255) NOT NULL,`sendcost` varchar(255) NOT NULL,`discount` varchar(255) NOT NULL,`vat` varchar(4) NOT NULL DEFAULT '0.19',`position` int(11) NOT NULL,`sale` tinyint(1) NOT NULL DEFAULT '0',`hidden` tinyint(1) NOT NULL DEFAULT '0',`slug` varchar(255) NOT NULL,`pagetitle` varchar(255) NOT NULL,`pagemeta` varchar(255) NOT NULL,`parent_id` int(11) NOT NULL,`photo_id` int(11) NOT NULL,PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

CREATE TABLE `settings` (`id` int(11) NOT NULL AUTO_INCREMENT,`key` varchar(255) NOT NULL,`pair` text NOT NULL,`created` datetime NOT NULL,PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Expand All @@ -57,9 +50,12 @@ INSERT INTO `settings` VALUES(19, 'PAY_AFTER', 'true', '2010-08-03 17:25:06');
INSERT INTO `settings` VALUES(20, 'PAY_IDEAL', 'true', '0000-00-00 00:00:00');
INSERT INTO `settings` VALUES(21, 'ACCOUNT_NUMBER', '1234.56.900', '2010-08-06 10:20:04');
INSERT INTO `settings` VALUES(22, 'ACCOUNT_NAME', 'Thinkshop', '2010-08-06 10:20:15');
INSERT INTO `settings` VALUES(23, 'VERSION', '2.2', '2011-03-14 10:42:00');
INSERT INTO `settings` VALUES(24, 'VERSION_NAME', 'Hendrix', '2011-03-14 10:42:00');



CREATE TABLE `staticpages` (`id` int(11) NOT NULL AUTO_INCREMENT,`title` varchar(255) NOT NULL,`body` text NOT NULL,`created` datetime NOT NULL,`menu` varchar(255) NOT NULL DEFAULT 'top',`position` int(11) NOT NULL,`hidden` tinyint(1) NOT NULL DEFAULT '0',`slug` varchar(255) NOT NULL,`pagetitle` varchar(255) NOT NULL,`keywords` varchar(255) NOT NULL,PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;
CREATE TABLE `staticpages` (`id` int(11) NOT NULL AUTO_INCREMENT,`title` varchar(255) NOT NULL,`body` text NOT NULL,`created` datetime NOT NULL,`menu` varchar(255) NOT NULL DEFAULT 'top',`position` int(11) NOT NULL,`hidden` tinyint(1) NOT NULL DEFAULT '0', `form` tinyint(1) NOT NULL, `mail_to` varchar(255) NOT NULL, `location` varchar(255) NOT NULL, `zoom` int(11) NOT NULL, `use_captcha` tinyint(1) NOT NULL, `street` varchar(255) NOT NULL, `zipcode` varchar(255) NOT NULL, `city` varchar(255) NOT NULL, `country` varchar(255) NOT NULL, `slug` varchar(255) NOT NULL,`pagetitle` varchar(255) NOT NULL,`keywords` varchar(255) NOT NULL,PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

CREATE TABLE `users` (`id` int(11) NOT NULL AUTO_INCREMENT,`firstname` varchar(255) NOT NULL,`lastname` varchar(255) NOT NULL,`gender` varchar(1) NOT NULL,`email` varchar(255) NOT NULL,`password` varchar(255) NOT NULL,`address` varchar(255) NOT NULL,`zipcode` varchar(255) NOT NULL,`city` varchar(255) NOT NULL,`country` varchar(255) NOT NULL,`invoiceaddress` varchar(255) NOT NULL,`invoicezipcode` varchar(255) NOT NULL,`invoicecity` varchar(255) NOT NULL,`invoicecountry` varchar(255) NOT NULL,`created` datetime NOT NULL,`lastvisit` datetime NOT NULL,`activated` tinyint(1) NOT NULL,PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Expand Down
Loading

0 comments on commit a70508b

Please sign in to comment.