Commit b5a2f8de authored by tbrehm's avatar tbrehm

Initial interface import

parents
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Scrigo CMS</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="refresh" content="0;URL=web/index.php">
</head>
<body>
</body>
</html>
<?php
/*
Copyright (c) 2005, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
ob_start("ob_gzhandler");
class app {
var $_language_inc = 0;
var $_wb;
function app() {
global $conf;
if($conf["start_db"] == true) {
$this->load('db_'.$conf["db_type"]);
$this->db = new db;
}
if($conf["start_session"] == true) {
session_start();
$_SESSION["s"]['id'] = session_id();
if($_SESSION["s"]["theme"] == '') $_SESSION["s"]['theme'] = $conf['theme'];
if($_SESSION["s"]["language"] == '') $_SESSION["s"]['language'] = $conf['language'];
}
}
function uses($classes) {
global $conf;
$cl = explode(',',$classes);
if(is_array($cl)) {
foreach($cl as $classname) {
if(!is_object($this->$classname)) {
include_once($conf['classpath'] . "/".$classname.".inc.php");
$this->$classname = new $classname;
}
}
}
}
function load($files) {
global $conf;
$fl = explode(',',$files);
if(is_array($fl)) {
foreach($fl as $file) {
include_once($conf['classpath'] . "/".$file.".inc.php");
}
}
}
/*
0 = DEBUG
1 = WARNING
2 = ERROR
*/
function log($msg, $priority = 0) {
if($priority >= $conf["log_priority"]) {
if (is_writable($conf["log_file"])) {
if (!$fp = fopen ($conf["log_file"], "a")) {
$this->error("Logfile konnte nicht geöffnet werden.");
}
if (!fwrite($fp, date("d.m.Y-H:i")." - ". $msg."\r\n")) {
$this->error("Schreiben in Logfile nicht möglich.");
}
fclose($fp);
} else {
$this->error("Logfile ist nicht beschreibbar.");
}
} // if
} // func
/*
0 = DEBUG
1 = WARNING
2 = ERROR
*/
function error($msg, $priority = 2) {
//$this->uses("error");
//$this->error->message($msg, $priority);
echo $msg;
if($priority == 2) exit;
}
function lng($text)
{
global $conf;
if($this->_language_inc != 1) {
// loading global and module Wordbook
@include_once($conf["rootpath"]."/lib/lang/".$_SESSION["s"]["language"].".lng");
@include_once($conf["rootpath"]."/web/".$_SESSION["s"]["module"]["name"]."/lib/lang/".$_SESSION["s"]["language"].".lng");
$this->_wb = $wb;
$this->_language_inc = 1;
}
if(!empty($this->_wb[$text])) {
$text = $this->_wb[$text];
}
return $text;
}
function tpl_defaults() {
$this->tpl->setVar('theme',$_SESSION["s"]["theme"]);
$this->tpl->setVar('phpsessid',session_id());
}
}
/*
Initialize application (app) object
*/
$app = new app;
?>
\ No newline at end of file
<?
/*
Copyright (c) 2005, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
class nodetree {
var $childs;
var $btext;
var $id;
}
class cmstree
{
var $_table;
// $vars enthält:
// - parent :id des Elternelementes
// - type :n = node, i = item
// - doctype_id :id des Dokumententyps, wenn nicht im content Feld
// - title :Titel des Eintrages
// - status :1 = ok, d = delete
// - icon :icon im node-tree, optional
// - modul :modul des Eintrages, noch nicht verwendet
// - doc_id :id des zugehörigen Dokumentes
function node_list()
{
global $app;
$nodes = $app->db->queryAllRecords("SELECT * FROM media_cat order by sort, name");
$optionlist = array();
$my0 = new nodetree();
foreach($nodes as $row) {
$id = "my".$row["media_cat_id"];
$btext = $row["name"];
$ordner = 'my'.$row["parent"];
if(!is_object($$id)) $$id = new nodetree();
$$id->btext = $btext;
$$id->id = $row["media_cat_id"];
if(is_object($$ordner)) {
$$ordner->childs[] = &$$id;
} else {
$$ordner = new nodetree();
$$ordner->childs[] = &$$id;
}
}
$this->ptree($my0,0,$optionlist);
if(is_array($nodes)){
return $optionlist;
} else {
return false;
}
}
function ptree($myobj, $tiefe, &$optionlist){
global $_SESSION;
$tiefe += 1;
$id = $myobj->id;
if(is_array($myobj->childs) and ($_SESSION["s"]["cat_open"][$id] == 1 or $tiefe <= 1)) {
foreach($myobj->childs as $val) {
// kategorie => str_repeat('- &nbsp;',$tiefe) . $val->btext,
// Ergebnisse Formatieren
/*
if($tiefe == 0) {
$kategorie = "<div class='mnuLevel".$tiefe."'><a href='index.php?pg=liste&kat=".$val->id."' class='navKategorien'>".$val->btext."</a></div>";
} elseif ($tiefe == 1) {
$kategorie = "<div class='mnuLevel".$tiefe."'><img src='images/listenpunkt.gif'> <a href='index.php?pg=liste&kat=".$val->id."' class='navKategorien'>".$val->btext."</a></div>";
} else {
$kategorie = "<div class='mnuLevel".$tiefe."'>&nbsp; <a href='index.php?pg=liste&kat=".$val->id."' class='navKategorien'>".str_repeat('- &nbsp;',$tiefe - 1) . $val->btext."</a></div>";
}
*/
$val_id = $val->id;
if($_SESSION["s"]["cat_open"][$val_id] == 1) {
$kategorie = "<div class='mnuLevel".$tiefe."'>&nbsp; <a href='treenavi.php?kat=".$val->id."' class='navtext' onClick=\"parent.content.location='media_list.php?search_media_cat_id=".$val->id."'\" style=\"text-decoration: none;\"><img src='../themes/default/icons/folder.png' border='0'> ".$val->btext."</a></div>";
} else {
$kategorie = "<div class='mnuLevel".$tiefe."'>&nbsp; <a href='treenavi.php?kat=".$val->id."' class='navtext' onClick=\"parent.content.location='media_list.php?search_media_cat_id=".$val->id."'\" style=\"text-decoration: none;\"><img src='../themes/default/icons/folder_closed.png' border='0'> ".$val->btext."</a></div>";
}
$optionlist[] = array( media_cat => $kategorie,
media_cat_id => $val->id,
depth => $tiefe);
$this->ptree($val, $tiefe, $optionlist);
}
}
}
}
?>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<?php
/*
Copyright (c) 2005, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* Listenbehandlung
*
* @package listform
* @author Till Brehm
* @version 1.1
*/
class listform {
var $debug = 0;
var $errorMessage;
var $listDef;
var $searchValues;
var $pagingHTML;
var $pagingValues;
var $searchChanged = 0;
var $module;
function loadListDef($file,$module = '') {
global $app,$conf;
if(!is_file($file)) die("List-Definition: $file not found.");
include_once($file);
$this->listDef = $liste;
$this->module = $module;
return true;
}
function getSearchSQL($sql_where = "") {
global $db;
// Hole Config Variablen
$list_name = $this->listDef["name"];
$search_prefix = $this->listDef["search_prefix"];
// speichere Suchanfrage
foreach($this->listDef["item"] as $i) {
$field = $i["field"];
// hat sich die suche gendert
if(isset($_REQUEST[$search_prefix.$field]) and $_REQUEST[$search_prefix.$field] != $_SESSION["search"][$list_name][$search_prefix.$field]) $this->searchChanged = 1;
// suchfeld in session speichern.
if(isset($_REQUEST[$search_prefix.$field])) $_SESSION["search"][$list_name][$search_prefix.$field] = $_REQUEST[$search_prefix.$field];
if($i["formtype"] == "SELECT") {
if(is_array($i['value'])) {
$out = '<option value=""></option>';
foreach($i['value'] as $k => $v) {
$selected = ($k == $_SESSION["search"][$list_name][$search_prefix.$field])?' SELECTED':'';
$out .= "<option value='$k'$selected>$v</option>\r\n";
}
}
$this->searchValues[$search_prefix.$field] = $out;
} else {
$this->searchValues[$search_prefix.$field] = $_SESSION["search"][$list_name][$search_prefix.$field];
}
}
// Speichere Variablen in Objekt zum spteren einparsen in Template
// $this->searchValues = $_SESSION["search"][$list_name];
foreach($this->listDef["item"] as $i) {
$field = $i["field"];
if($_REQUEST[$search_prefix.$field] != '') $sql_where .= " $field ".$i["op"]." '".$i["prefix"].$_REQUEST[$search_prefix.$field].$i["suffix"]."' and";
}
if($sql_where != '') {
$sql_where = substr($sql_where,0,-3);
} else {
$sql_where = "1";
}
return $sql_where;
}
function getPagingSQL($sql_where = "1") {
global $app, $conf;
// Hole Config Variablen
$list_name = $this->listDef["name"];
$search_prefix = $this->listDef["search_prefix"];
$records_per_page = $this->listDef["records_per_page"];
$table = $this->listDef["table"];
// setze page auf null, wenn in session nicht gesetzt
if($_SESSION["search"][$list_name]["page"] == '') $_SESSION["search"][$list_name]["page"] = 0;
// setze page auf wert der request variablen "page"
if(isset($_REQUEST["page"])) $_SESSION["search"][$list_name]["page"] = $_REQUEST["page"];
// page auf 0 setzen, wenn suche sich gendert hat.
if($this->searchChanged == 1) $_SESSION["search"][$list_name]["page"] = 0;
$sql_von = $_SESSION["search"][$list_name]["page"] * $records_per_page;
$record_count = $app->db->queryOneRecord("SELECT count(*) AS anzahl FROM $table WHERE $sql_where");
$pages = intval($record_count["anzahl"] / $records_per_page);
$vars["list_file"] = $this->listDef["file"];
$vars["page"] = $_SESSION["search"][$list_name]["page"];
$vars["last_page"] = $_SESSION["search"][$list_name]["page"] - 1;
$vars["next_page"] = $_SESSION["search"][$list_name]["page"] + 1;
$vars["pages"] = $pages;
$vars["max_pages"] = $pages + 1;
$vars["records_gesamt"] = $record_count["anzahl"];
$vars["page_params"] = $this->listDef["page_params"];
if($_SESSION["search"][$list_name]["page"] > 0) $vars["show_page_back"] = 1;
if($_SESSION["search"][$list_name]["page"] <= $seiten - 1) $vars["show_page_next"] = 1;
$this->pagingValues = $vars;
$this->pagingHTML = $this->getPagingHTML($vars);
$limit_sql = "LIMIT $sql_von, $records_per_page";
return $limit_sql;
}
function getPagingHTML($vars) {
global $app;
$content = '[ <a href="'.$vars["list_file"].'?page=0'.$vars["page_params"].'">|<< </a>]';
if($vars["show_page_back"] == 1) $content .= '[<< <a href="'.$vars["list_file"].'?page='.$vars["last_page"].$vars["page_params"].'">'.$app->lng('Back').'</a>] ';
$content .= ' '.$app->lng('Page').' '.$vars["next_page"].' '.$app->lng('of').' '.$vars["max_pages"].' ';
if($vars["show_page_next"] == 1) $content .= '[<a href="'.$vars["list_file"].'?page='.$vars["next_page"].$vars["page_params"].'">'.$app->lng('Next').' >></a>] ';
$content .= '[<a href="'.$vars["list_file"].'?page='.$vars["pages"].$vars["page_params"].'> >>| </a>]';
return $content;
}
function getSortSQL() {
global $app, $conf;
// Hole Config Variablen
$sort_field = $this->listDef["sort_field"];
$sort_direction = $this->listDef["sort_direction"];
$sql_sort = '';
if($sort_field != '' && $sort_direction != '') {
$sql_sort = "ORDER BY $sort_field $sort_direction";
}
return $sql_sort;
}
function decode($record) {
if(is_array($record)) {
foreach($this->listDef["item"] as $field) {
$key = $field["field"];
switch ($field['datatype']) {
case 'VARCHAR':
$record[$key] = stripslashes($record[$key]);
break;
case 'TEXT':
$record[$key] = stripslashes($record[$key]);
break;
case 'DATE':
if($val > 0) {
$record[$key] = date($this->dateformat,$record[$key]);
}
break;
case 'INTEGER':
$record[$key] = intval($record[$key]);
break;
case 'DOUBLE':
$record[$key] = $record[$key];
break;
case 'CURRENCY':
$record[$key] = number_format($record[$key], 2, ',', '');
break;
default:
$record[$key] = stripslashes($record[$key]);
}
}
}
return $record;
}
function encode($record) {
if(is_array($record)) {
foreach($this->listDef["item"] as $field) {
$key = $field["field"];
switch ($field['datatype']) {
case 'VARCHAR':
if(!is_array($record[$key])) {
$record[$key] = addslashes($record[$key]);
} else {
$record[$key] = implode($this->tableDef[$key]['separator'],$record[$key]);
}
break;
case 'TEXT':
if(!is_array($record[$key])) {
$record[$key] = addslashes($record[$key]);
} else {
$record[$key] = implode($this->tableDef[$key]['separator'],$record[$key]);
}
break;
case 'DATE':
if($record[$key] > 0) {
list($tag,$monat,$jahr) = explode('.',$record[$key]);
$record[$key] = mktime(0,0,0,$monat,$tag,$jahr);
}
break;
case 'INTEGER':
$record[$key] = intval($record[$key]);
break;