Skip to content

Commit

Permalink
updated phynx
Browse files Browse the repository at this point in the history
  • Loading branch information
Rainer Furtmeier authored and Rainer Furtmeier committed Dec 17, 2012
1 parent 9791310 commit e183b8d
Show file tree
Hide file tree
Showing 137 changed files with 34,778 additions and 12,281 deletions.
4 changes: 4 additions & 0 deletions classes/backend/Adapter.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ function __construct($ID, $storage){
$this->storage = $storage;
}

function __clone() {
$this->selectStatement = clone $this->selectStatement;
}

/**
* This function returns an instance of the type of database
* specified when this class was created.
Expand Down
43 changes: 29 additions & 14 deletions classes/backend/Collection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ abstract class Collection {
protected $loadedPerPage;
protected $isFiltered = false;

function __clone() {
$this->Adapter = clone $this->Adapter;
}

/**
* If active, customizes this class.
*
Expand Down Expand Up @@ -155,9 +159,9 @@ function getMyTablesInfos(){
}

/**
* Creates a Database Table using the Informatio of the associated Database File.
* Creates a Database Table using the information of the associated database file.
*/
function createMyTable() {
function createMyTable($quiet = false) {
$_SESSION["messages"]->addMessage("Creating table for ".get_class($this).". Using file ".$this->getMyDBFolder()."CI.pfdb.php...");
#if(!$this->checkIfMyTableExists()) {

Expand All @@ -169,7 +173,7 @@ function createMyTable() {
$CIA = $CI->getA();
$CIA->MySQL = str_replace("%%&ESCSLASH%%&","\'",$CIA->MySQL);
$CIA->MSSQL = str_replace("%%&ESCSLASH%%&","\'",$CIA->MSSQL);
$message .= "<code style=\"font-size:8px;\">".nl2br(htmlentities($CIA->MySQL))."</code>";
$message .= htmlentities($CIA->MySQL);

$connection = $this->Adapter->createMyTable($CIA);
if($connection == null and PHYNX_MAIN_STORAGE == "MySQLo"){
Expand All @@ -181,10 +185,10 @@ function createMyTable() {
$message .= "<br /><br />Anzahl betroffener Datensätze: ".$connection->affected_rows."<br />";
if($connection->error) $message .= "<span style=\"color:red;\">Es ist ein SQL-Fehler aufgetreten: ".$connection->error."</span><br />";
else $message .= "<span style=\"color:green;\">Es ist kein MySQL-Fehler aufgetreten</span><br />";
$message .= "<br /><br />";
#$message .= "<br /><br />";
}
#} else $message = "Diese Tabelle wurde bereits angelegt";
echo "
$html = $message;/*"
<div class=\"backgroundColor1 Tab\"><p>Installations-Informationen</p></div>
<table>
<colgroup>
Expand All @@ -193,14 +197,19 @@ function createMyTable() {
<tr>
<td>$message</td>
</tr>
</table>";
</table>";*/

if(!$quiet)
echo $html;

return $html;
}

/**
* Prints out the number of changes between the data in the Database, accessed by Adapter,
* and the data in the Database File.
*/
function checkMyTables(){
function checkMyTables($quiet = false){
$_SESSION["messages"]->addMessage("Checking tables of ".get_class($this).".");

$creates = $this->getMyTablesInfos();
Expand All @@ -221,9 +230,13 @@ function checkMyTables(){
#else return -1;
}
} catch(TableDoesNotExistException $e){
$this->createMyTable();
$this->createMyTable($quiet);
}
echo $changes;

if(!$quiet)
echo $changes;

return $changes;
}

/**
Expand Down Expand Up @@ -650,12 +663,14 @@ protected function filterCategories(){

$mU = new mUserdata();

$K = $mU->getUDValue("searchFilterInHTMLGUI".$this->getClearClass());
$K = mUserdata::getUDValueS("searchFilterInHTMLGUI".$this->getClearClass());
$F = $this->getSearchedFields();
if($K == null OR $K == "") return $fC;
else
foreach($F as $k => $v)
$this->addAssocV3("$v","LIKE",'%'.$K.'%',($k == 0 ? "AND" : "OR"),"sfs");

if($K == null)
return $fC;

foreach($F as $k => $v)
$this->addAssocV3("$v","LIKE",'%'.$K.'%',($k == 0 ? "AND" : "OR"),"sfs");

$this->isFiltered = true;
return true;
Expand Down
4 changes: 4 additions & 0 deletions classes/backend/CorporateDesign.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,9 @@ public function getLabel() {
public function getLogoPath() {
return null;
}

public function getBackgroundColor(){
return array(245, 255, 197);
}
}
?>
5 changes: 5 additions & 0 deletions classes/backend/DBStorage.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,11 @@ public function fixUtf8($value){
return $value;
}

/**
* @deprecated since version 31.10.2012
* @param string $value
* @return string
*/
public static function findNonUft8($value){
$value = str_replace("Ä", "Ä", $value);
$value = str_replace("Ö", "Ö", $value);
Expand Down
22 changes: 17 additions & 5 deletions classes/backend/FileStorage.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private function getFileClass($file, $isDir){
else {
$A = $F->newAttributes();

$A->FileDir = dirname($file);
$A->FileDir = dirname(realpath($file));
$A->FileName = basename($file);
$A->FileIsDir = $isDir;
$A->FileSize = filesize($file);
Expand All @@ -91,12 +91,12 @@ public static function getFilesDir(){
$CH = Util::getCloudHost();
if($CH != null){
Environment::load();

$dir = $CH->scientiaDir."/".strtolower(Environment::$currentEnvironment->cloudUser())."/specifics/";
$cloudUser = strtolower(Environment::$currentEnvironment->cloudUser());
$dir = $CH->scientiaDir."/".($cloudUser != "" ? "$cloudUser/" : "")."specifics/";

if(!file_exists($dir)){
#mkdir($CH->scientiaDir."/".strtolower(Environment::$currentEnvironment->cloudUser())."/");
mkdir($CH->scientiaDir."/".strtolower(Environment::$currentEnvironment->cloudUser())."/specifics/", 0777, true);
mkdir($CH->scientiaDir."/".($cloudUser != "" ? "$cloudUser/" : "")."specifics/", 0777, true);
}

return $dir;
Expand Down Expand Up @@ -134,6 +134,18 @@ function loadMultipleV4(SelectStatement $statement){
if(strpos(basename($file), "FITCRMID") === 0)
continue;

if(strpos(basename($file), "GRLBMID") === 0)
continue;

if(strpos(basename($file), "MailArchive") === 0)
continue;

if(strpos(basename($file), "MailTemp") === 0)
continue;

if(strpos(basename($file), "Customizer") === 0 AND strpos(basename($file), ".class.php") !== false)
continue;

if(is_dir($dir.$file)) $dirs[] = $dir.$file;
else $files[] = $dir.$file;
}
Expand Down Expand Up @@ -172,7 +184,7 @@ function loadMultipleV4(SelectStatement $statement){


function deleteSingle($table, $keyName, $id){
if(strpos($id, FileStorage::getFilesDir()) === false)
if(strpos(realpath($id), realpath(FileStorage::getFilesDir())) === false)
Red::errorD("Die Datei kann wegen fehlender Berechtigung nicht gelöscht werden!");

if(is_dir($id)) {
Expand Down
19 changes: 18 additions & 1 deletion classes/backend/PersistentObject.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,28 @@ protected function getMyBPSData(){
return BPS::getAllProperties(get_class($this));
}

protected function makeNewIfNew($promote = true){
if($this->getID() != -1)
return $this->getID();

$this->loadMeOrEmpty();
$id = $this->newMe();
$this->forceReload();

if($promote)
echo OnEvent::script("contentManager.lastLoaded('left', ".$this->getID().");");

return $id;
}

public function isNoDelete(){
return $this->noDeleteHideOnly;
}

function __construct($ID){
$this->ID = $ID;
}

function getA(){
return $this->A;
}
Expand Down Expand Up @@ -118,6 +132,9 @@ public function loadMeT(){
function deleteMe() {
mUserdata::checkRestrictionOrDie("cantDelete".str_replace("GUI","",get_class($this)));

if(Session::isPluginLoaded("mArchiv"))
Archiv::archive($this);

$this->loadAdapter();
if(!$this->noDeleteHideOnly) $this->Adapter->deleteSingle($this->getClearClass(get_class($this)));
else {
Expand Down
30 changes: 30 additions & 0 deletions classes/backend/Phynx.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
/*
* This file is part of phynx.
* phynx 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 3 of the License, or
* (at your option) any later version.
* phynx is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 2007 - 2012, Rainer Furtmeier - [email protected]
*/
class Phynx {
public static function build(){
if(!file_exists(Util::getRootPath()."system/build.xml"))
return false;

$xml = new SimpleXMLElement(file_get_contents(Util::getRootPath()."system/build.xml"));

return $xml->build->prefix."-".$xml->build->number;
}
}
?>
24 changes: 17 additions & 7 deletions classes/backend/SOAP.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,38 @@

class SOAP {
private $client = null;

private $key;

public function startServer($className){
$server = new SoapServer(NULL, array('uri' => "http://".$_SERVER["HTTP_HOST"]."/"));
$server->setClass($className);
$server->handle();
}

public function authKey($key){
$this->key = $key;
}

public function startClient($serverURL){

$this->client = new SoapClient(NULL,
array(
$options = array(
"location" => $serverURL,
"uri" => "urn:phynxSOAP",
"style" => SOAP_RPC,
"use" => SOAP_ENCODED
));
"use" => SOAP_ENCODED);

if($this->key != null){
$options["login"] = "SOAPUser";
$options["password"] = $this->key;
}
$this->client = new SoapClient(NULL, $options);

return $this->client;
}

function __call($name, $arguments) {
$parameters = array();
foreach($arguments as $K => $V)
$parameters[] = new SoapParam("$V", "par$K");
$parameters[] = new SoapParam($V, "par$K");

$result = $this->client->__call(
$name,
Expand Down
10 changes: 9 additions & 1 deletion classes/backend/Session.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,15 @@ public static function reloadDBData() {
}

public function getDBData($newFolder = null){
if($newFolder == null) $newFolder = Util::getRootPath()."system/DBData/";
if(file_exists(Util::getRootPath()."../../phynxConfig"))
$newFolder = Util::getRootPath()."../../phynxConfig/";

if(file_exists(Util::getRootPath()."../phynxConfig"))
$newFolder = Util::getRootPath()."../phynxConfig/";

if($newFolder == null)
$newFolder = Util::getRootPath()."system/DBData/";

if(!isset($_SERVER["HTTP_HOST"])) $_SERVER["HTTP_HOST"] = "*";
$data = new mInstallation();
if($newFolder != "") $data->changeFolder($newFolder);
Expand Down
2 changes: 1 addition & 1 deletion classes/backend/propertyC.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public function getHTML($id, $page){
$gui->addTopButton($B);

if($this->allowEdit)
$gui->activateFeature("editInPopup", $this);
$gui->activateFeature("editInPopup", $this, "{remember:true}");


$gui->options($this->allowDelete, $this->allowEdit, false, false);
Expand Down
39 changes: 39 additions & 0 deletions classes/frontend/ADesktopGUI.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,44 @@ public function getHTML($id){
break;
}
}

public function getOffice3aRSS(){
if(Environment::getS("blogShow", "1") == "0")
return "";

$data = file_get_contents(Environment::getS("blogRSSURL", "http://blog.office3a.eu/feed/"));

if($data === false)
return "";

$html = "
<div style=\"border-bottom:1px solid #DDD;position:relative;\" class=\"desktopButton\" onclick=\"window.open('".Environment::getS("blogURL", "http://blog.office3a.eu/")."', '_blank');\">
<h1 style=\"font-size:2.0em;color:#999999;position:absolute;bottom:5px;\">".Environment::getS("blogName", "office<span style=\"color:#A0C100;\">3a</span> blog")."</h1>
</div>
<div style=\"padding-left:30px;padding-right:30px;\">";
try {
$XML = new SimpleXMLElement($data);

$i = 0;
foreach($XML->channel->item AS $item){
$html .= "<h2 style=\"color:#999999;".($i > 0 ? "margin-top:30px;" : "")."margin-bottom:0px;\">".$item->title."</h2>";

$html .= "<p style=\"color:#999999;margin-top:10px;\">".$item->description."<br />
<small style=\"color:#AAA;\">".Util::CLFormatDate(strtotime($item->pubDate), true)."</small> <a style=\"float:right;color:#444;\" href=\"$item->link\">mehr...</a></p>";
#print_r($item);

$i++;

if($i == 4)
break;
}

$html .= "</div>";

return $html;
} catch (Exception $e){
return "";
}
}
}
?>
2 changes: 1 addition & 1 deletion classes/frontend/AppPlugins.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public function getMenuTargets(){
}

public function addAdminOnly($plugin){
$this->isAdminOnlyByPlugin[$plugin] = "true";
$this->isAdminOnlyByPlugin[$plugin] = true;
}

public function getIsAdminOnly($plugin){
Expand Down
Loading

0 comments on commit e183b8d

Please sign in to comment.