<?php
/**************************************************
  CPG Photo Shop Plugin for Coppermine Photo Gallery
  *************************************************
  Copyright (c) 2006 Thomas Lange <stramm@gmx.net>
  *************************************************
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  *************************************************
  Coppermine version: 1.4.5
  Photo Shop version: 1.0
  $Revision: 1.0 $
  $Author: stramm $
***************************************************/
if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

if (!file_exists("plugins/photo_shop/lang/{$CONFIG['lang']}.php"))
  $CONFIG['lang'] = 'english';
require "plugins/photo_shop/lang/{$CONFIG['lang']}.php";

$CONFIG['TABLE_SHOP'] = $CONFIG['TABLE_PREFIX'] . "shop";
$CONFIG['TABLE_SHOP_CONFIG'] = $CONFIG['TABLE_PREFIX'] . "shop_config";

//DEFINE SHOP_CONFIG
$SHOP_CONFIG = array();
@session_start();
if(!$_SESSION['photoshop']){

		if (isset($_COOKIE[$CONFIG['cookie_name'].'_cart'])) {
                $_SESSION['photoshop']['cart'] = @unserialize(@base64_decode($_COOKIE[$CONFIG['cookie_name'].'_cart']));
        } else {
		    $_SESSION['photoshop'] = Array();
		    $_SESSION['photoshop']['cart'] = Array();
		}


}


$results = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_SHOP_CONFIG']} ORDER BY 'priority'");
while ($row = mysql_fetch_array($results)) {
    $SHOP_CONFIG[$row['id']] = $row;
}
mysql_free_result($results);

if (defined('DISPLAYIMAGE_PHP')) {
	//load shop config data - articles+prices
}

/*
$data = base64_encode(serialize($FAVPICS));
setcookie($CONFIG['cookie_name'] . '_fav', $data, time() + 86400 * 30, $CONFIG['cookie_path']);

        if (isset($_COOKIE[$CONFIG['cookie_name'].'_data'])) {
                $USER = @unserialize(@base64_decode($_COOKIE[$CONFIG['cookie_name'].'_data']));
        }

*/
?>