This commit is contained in:
Ulf Gebhardt 2013-05-22 23:27:23 +02:00
parent 1d530063b0
commit 020cff24b0
7 changed files with 79 additions and 7 deletions

19
api.php Normal file
View File

@ -0,0 +1,19 @@
<?php
require_once '../system/autoload.inc.php'; //SYSTEM Classes
require_once 'danube/autoload.inc.php'; //Project Classes
require_once '../system/log/register_exception_shortcut.php'; //allow ERROR() instead of \SYSTEM\LOG\ERROR()
require_once '../system/log/register_errorhandler_jsonoutput.php'; //print errors as json to caller
SYSTEM\system::start(array( array(SYSTEM\CONFIG\config_ids::SYS_CONFIG_ERRORREPORTING, E_ALL | E_STRICT),
array(SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL, 'http://www.mojotrollz.eu/web/danube/'),
array(SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEPATH, '/home/web/webdir/danube/'),
array(SYSTEM\CONFIG\config_ids::SYS_CONFIG_DB_TYPE, SYSTEM\CONFIG\config_ids::SYS_CONFIG_DB_TYPE_MYS),
array(SYSTEM\CONFIG\config_ids::SYS_CONFIG_DB_HOST, '127.0.0.1'),
array(SYSTEM\CONFIG\config_ids::SYS_CONFIG_DB_PORT, ''),
array(SYSTEM\CONFIG\config_ids::SYS_CONFIG_DB_USER, 'mojotrolls_mysql'),
array(SYSTEM\CONFIG\config_ids::SYS_CONFIG_DB_PASSWORD, 'dajsabeaisvd345'),
array(SYSTEM\CONFIG\config_ids::SYS_CONFIG_DB_DBNAME, 'host_danube')));
$api = new \SYSTEM\API\Api (new SYSTEM\verifyclass(), new ApiClass());
echo $api->CALL(array_merge($_POST,$_GET));

8
danube/api/ApiClass.php Normal file
View File

@ -0,0 +1,8 @@
<?php
class ApiClass extends \SYSTEM\API\apiloginclass {
public static function call_img($id){
return picfolder::get(\SYSTEM\SERVERPATH(new PPAGE,'pics'),$id);
}
}

View File

@ -0,0 +1,6 @@
<?php
$autoload = SYSTEM\autoload::getInstance();
$autoload->registerFolder(dirname(__FILE__),'');
$autoload->registerFolder(dirname(__FILE__).'/picfolder','');

View File

@ -0,0 +1,23 @@
<?php
class picfolder {
public static function get($path, $id){
if(!is_dir($path)){
throw new ERROR("Picfolder -> invalid folder");}
$filelist = array();
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));
while($it->valid()) {
if (!$it->isDot()) {
$filelist[] = $it->key();}
$it->next();
}
//random
if($id == -1 || $id < 0 || $id >= count($filelist)){
$id = rand(0, count($filelist)-1);}
\SYSTEM\HEADER::PNG();
return file_get_contents($filelist[$id]);
}
}

View File

@ -3,4 +3,6 @@
//keep this
require_once dirname(__FILE__).'/path/register_path_classes.php';
require_once dirname(__FILE__).'/page/register_page_classes.php';
require_once dirname(__FILE__).'/dbd/autoload.inc.php';
require_once dirname(__FILE__).'/dbd/autoload.inc.php';
require_once dirname(__FILE__).'/api/autoload.inc.php';

View File

@ -3,8 +3,7 @@
class PageApi extends \SYSTEM\PAGE\PageClass {
public static function default_page(){
return new default_page();
}
return new default_page();}
public static function action_media(){
throw new ERROR("test");
@ -23,15 +22,16 @@ class PageApi extends \SYSTEM\PAGE\PageClass {
}
public static function action_prices(){
return new default_prices();
}
return new default_prices();}
public static function action_contact(){
return new default_contact();
}
return new default_contact();}
public static function action_pic(){
return new pic();
}
public static function action_developer(){
return new \SYSTEM\SAI\saigui();}
}

View File

@ -5,6 +5,10 @@ $(document).ready(function() {
loadAjaxContent($(this).attr('url'));
loadUrlPic($(this).attr('url'));
});
//handle arrowclicks
$('.right, .left').click(function () {
loadApiPic(-1);
});
});
function loadAjaxContent(url) {
@ -36,4 +40,14 @@ function loadUrlPic(url_pic) {
site_content_is_visible = true;
}});
});
}
function loadApiPic(id) {
var dataTmp;
$.get('./api.php?call=img&id='+id, function (data) {
dataTmp = data;
bodyelem = $("html,body");
bodyelem.animate();
}).complete(function() {
});
}