Skip to content

Commit 79b2542

Browse files
committed
update framework
1 parent 0756d5b commit 79b2542

File tree

362 files changed

+10014
-3336
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

362 files changed

+10014
-3336
lines changed

classes/backend/Adapter.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* You should have received a copy of the GNU General Public License
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*
18-
* 2007 - 2020, open3A GmbH - [email protected]
18+
* 2007 - 2021, open3A GmbH - [email protected]
1919
*/
2020

2121
class Adapter {

classes/backend/Attributes.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* You should have received a copy of the GNU General Public License
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*
18-
* 2007 - 2020, open3A GmbH - [email protected]
18+
* 2007 - 2021, open3A GmbH - [email protected]
1919
*/
2020
class Attributes {
2121
function __construct(){

classes/backend/BackgroundPluginState.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* You should have received a copy of the GNU General Public License
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*
18-
* 2007 - 2020, open3A GmbH - [email protected]
18+
* 2007 - 2021, open3A GmbH - [email protected]
1919
*/
2020
class BackgroundPluginState {
2121

classes/backend/Collection.class.php

+40-21
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* You should have received a copy of the GNU General Public License
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*
18-
* 2007 - 2020, open3A GmbH - [email protected]
18+
* 2007 - 2021, open3A GmbH - [email protected]
1919
*/
2020
abstract class Collection {
2121
protected $A = null;
@@ -118,8 +118,8 @@ function getCollectionOf(){
118118
*/
119119
function checkIfMyDBFileExists(){
120120
#$p = $this->getClearClass();#
121-
$p = str_replace("GUI","",get_class($this));
122-
return file_exists(Util::getRootPath().$_SESSION["CurrentAppPlugins"]->getAppFolderOfPlugin($p)."/".$_SESSION["CurrentAppPlugins"]->getFolderOfPlugin($p)."/CI.pfdb.php");
121+
#$p = str_replace("GUI","",get_class($this));
122+
return file_exists($this->getMyDBFileName());
123123
}
124124

125125
/**
@@ -130,7 +130,7 @@ function checkIfMyDBFileExists(){
130130
function getMyDBFileName(){
131131
#$p = $this->getClearClass();
132132
$p = str_replace("GUI","",get_class($this));
133-
return Util::getRootPath().$_SESSION["CurrentAppPlugins"]->getAppFolderOfPlugin($p)."/".$_SESSION["CurrentAppPlugins"]->getFolderOfPlugin($p)."/CI.pfdb.php";
133+
return Util::getRootPath().$_SESSION["CurrentAppPlugins"]->getAppFolderOfPlugin($p)."/".$_SESSION["CurrentAppPlugins"]->getFolderOfPlugin($p)."/mysql.sql";
134134
}
135135

136136
/**
@@ -154,9 +154,23 @@ function getMyTablesInfos(){
154154
$this->loadAdapter();
155155

156156
if($this->checkIfMyDBFileExists()) {
157-
$creates = new CIs();
158-
$creates->setMyDBFolder($this->getMyDBFolder());
159-
$creates->lCV3();
157+
$data = file_get_contents($this->getMyDBFileName());
158+
$creates = new ArrayCollection();
159+
foreach(explode("-- END", $data) AS $sql){
160+
if(trim($sql) == "")
161+
continue;
162+
163+
$A = new stdClass();
164+
$A->MySQL = $sql;
165+
166+
$P = new PersistentObject(-1);
167+
$P->setA($A);
168+
169+
$creates->add($P);
170+
}
171+
#$creates = new CIs();
172+
#$creates->setMyDBFolder($this->getMyDBFolder());
173+
#$creates->lCV3();
160174

161175
return $creates;
162176
} else $_SESSION["messages"]->addMessage("Database-information file for plugin ".str_replace("GUI","",get_class($this))." does not exist.");
@@ -167,7 +181,7 @@ function getMyTablesInfos(){
167181
* Creates a Database Table using the information of the associated database file.
168182
*/
169183
function createMyTable($quiet = false) {
170-
$_SESSION["messages"]->addMessage("Creating table for ".get_class($this).". Using file ".$this->getMyDBFolder()."CI.pfdb.php...");
184+
$_SESSION["messages"]->addMessage("Creating table for ".get_class($this).". Using file ".$this->getMyDBFolder()."mysql.sql...");
171185
#if(!$this->checkIfMyTableExists()) {
172186

173187
$creates = $this->getMyTablesInfos();
@@ -182,8 +196,8 @@ function createMyTable($quiet = false) {
182196
continue;
183197
}
184198

185-
$CIA->MySQL = str_replace("%%&ESCSLASH%%&","\'",$CIA->MySQL);
186-
$CIA->MSSQL = str_replace("%%&ESCSLASH%%&","\'",$CIA->MSSQL);
199+
#$CIA->MySQL = str_replace("%%&ESCSLASH%%&","\'",$CIA->MySQL);
200+
#$CIA->MSSQL = str_replace("%%&ESCSLASH%%&","\'",$CIA->MSSQL);
187201
$message .= SqlFormatter::format(htmlentities($CIA->MySQL), false);
188202

189203
$connection = $this->Adapter->createMyTable($CIA);
@@ -223,23 +237,25 @@ function createMyTable($quiet = false) {
223237
* and the data in the Database File.
224238
*/
225239
function checkMyTables($quiet = false){
226-
$_SESSION["messages"]->addMessage("Checking tables of ".get_class($this).".");
240+
#$_SESSION["messages"]->addMessage("Checking tables of ".get_class($this).".");
227241

228242
$creates = $this->getMyTablesInfos();
229-
243+
230244
$changes = 0;
231245

232-
if(is_numeric($creates) AND $creates == -1) {
246+
if($creates === -1) {
233247
echo -2;
234248
return;
235249
}
250+
236251
try {
237-
while(($CI = $creates->getNextEntry())){
238-
$_SESSION["messages"]->addMessage("checking entry ".$CI->getID());
252+
while($CI = $creates->n()){
253+
#$_SESSION["messages"]->addMessage("checking entry ".$CI->getID());
239254
#$CIA = $CI->getA();
240255
$c = $this->Adapter->checkMyTable($CI->getA());
241256

242-
if($c >= 0) $changes+=$c;
257+
if($c >= 0)
258+
$changes += $c;
243259
#else return -1;
244260
}
245261
} catch(TableDoesNotExistException $e){
@@ -507,9 +523,9 @@ function resetPointer(){
507523
* @return String Classname
508524
*/
509525
function getClearClass(){
510-
if(isset($this->collectionOf) AND (get_class($this) == "mGenericGUI" OR get_class($this) == "anyC" OR get_parent_class($this) == "anyC"))
526+
if(isset($this->collectionOf) AND $this instanceof anyC)
511527
return "m".$this->collectionOf;
512-
528+
513529
$n = get_class($this);
514530
if(strstr($n,"GUI"))
515531
$n = get_parent_class($this);
@@ -667,6 +683,9 @@ public function getTotalNum(){
667683
* @return Integer Number of entries in Collector
668684
*/
669685
public function numLoaded(){
686+
if($this->collector === null)
687+
return 0;
688+
670689
return count($this->collector);
671690
}
672691

@@ -699,8 +718,8 @@ protected function filterCategories(){
699718
$F = $this->getCategoryFieldName();
700719
if($K != null AND $K != "") {
701720
$Ks = explode(";",$K);
702-
foreach($Ks as $k => $v)
703-
$this->addAssocV3("$F","=",$v,($k == "0" ? "AND" : "OR"),"fCs");
721+
foreach($Ks AS $k => $v)
722+
$this->addAssocV3($F, "=", $v, ($k == "0" ? "AND" : "OR"), "fCs");
704723

705724
$fC = true;
706725
}
@@ -797,7 +816,7 @@ public function asJSON($append = null){
797816
#$this->lCV3();
798817

799818
$array = array();
800-
while($A = $this->getNextEntry()){
819+
while($A = $this->n()){
801820
$subArray = array();
802821
foreach($A->getA() as $key => $value)
803822
$subArray[$key] = $value;

classes/backend/CorporateDesign.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* You should have received a copy of the GNU General Public License
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*
18-
* 2007 - 2020, open3A GmbH - [email protected]
18+
* 2007 - 2021, open3A GmbH - [email protected]
1919
*/
2020
class CorporateDesign implements iCorporateDesign {
2121
public function getLabel() {

classes/backend/DBPDOStorage.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* You should have received a copy of the GNU General Public License
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*
18-
* 2007 - 2020, open3A GmbH - [email protected]
18+
* 2007 - 2021, open3A GmbH - [email protected]
1919
*/
2020

2121
class DBPDOStorage {

classes/backend/DBStorage.class.php

+19-10
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* You should have received a copy of the GNU General Public License
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*
18-
* 2007 - 2020, open3A GmbH - [email protected]
18+
* 2007 - 2021, open3A GmbH - [email protected]
1919
*/
2020

2121
class DBStorage {
@@ -194,21 +194,30 @@ function checkMyTable($CIA){
194194
$rand = "RANDOM".rand(10000,100000);
195195

196196
if(!$view)
197-
$CIA->MySQL = str_replace("CREATE TABLE `$regs[1]`","CREATE TABLE `".$regs[1].$rand."`",$CIA->MySQL);
197+
$CIA->MySQL = str_replace("CREATE TABLE `$regs[1]`", "CREATE TABLE `".$regs[1].$rand."`",$CIA->MySQL);
198198
else
199-
$CIA->MySQL = str_replace("CREATE VIEW `$regs[1]`","CREATE VIEW `".$regs[1].$rand."`",$CIA->MySQL);
199+
$CIA->MySQL = str_replace("CREATE VIEW `$regs[1]`", "CREATE VIEW `".$regs[1].$rand."`",$CIA->MySQL);
200+
201+
$result = $this->createTable($CIA);
202+
if($result->errno)
203+
throw new Exception($result->error);
200204

201-
$this->createTable($CIA);
202205
$newTable = PMReflector::getAttributesArrayAnyObject($this->getTableColumns($regs[1].$rand));
203206

204207
if(!$view)
205208
$this->dropTable($regs[1].$rand);
206209
else
207210
$this->dropView($regs[1].$rand);
208211

209-
$oldTable = PMReflector::getAttributesArrayAnyObject($this->getTableColumns($regs[1]));
210-
$unterschied2 = array_diff($newTable,$oldTable);
212+
try {
213+
$oldTable = PMReflector::getAttributesArrayAnyObject($this->getTableColumns($regs[1]));
214+
} catch (TableDoesNotExistException $e){
215+
$this->createTable($CIAAlt);
216+
return 0;
217+
}
211218

219+
$unterschied2 = array_diff($newTable,$oldTable);
220+
212221
$this->cWrite->query("ALTER TABLE `$regs[1]` COMMENT = '".$_SESSION["applications"]->getActiveApplication()."_".$_SESSION["applications"]->getRunningVersion().";'");
213222
DBStorage::$queryCounter++;
214223

@@ -230,6 +239,7 @@ function checkMyTable($CIA){
230239

231240
$_SESSION["messages"]->addMessage("Please be aware that this function only works on properly formatted SQL-code. The fieldname must be enclosed by ` and a newline \\n must follow the ,.");
232241
$changes = 0;
242+
233243
foreach($unterschied2 as $key => $value){
234244
$newSQL = strstr($CIA->MySQL,"`$value`");
235245
#$ex = explode(",", $newSQL);
@@ -638,10 +648,9 @@ function loadMultipleV4(SelectStatement $statement, $lazyload = false){
638648
}
639649
#if($this->c->error AND $this->c->errno == 1028) //aborted query
640650
# die($sql);
641-
if($this->c->error AND $this->c->errno == 2006) throw new StorageException($this->c->error);
642-
643-
644-
651+
if($this->c->error AND ($this->c->errno == 2006 OR $this->c->errno == 1052))
652+
throw new StorageException($this->c->error." (".$this->c->errno."): ".$sql);
653+
645654
if($this->c->error)
646655
echo "MySQL-Fehler: ".$this->c->error." (".$this->c->errno.")<br>\nQuery:$sql";
647656

classes/backend/DBStorageU.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* You should have received a copy of the GNU General Public License
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*
18-
* 2007 - 2020, open3A GmbH - [email protected]
18+
* 2007 - 2021, open3A GmbH - [email protected]
1919
*/
2020
class DBStorageU {
2121
protected $instance;

classes/backend/File.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* You should have received a copy of the GNU General Public License
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*
18-
* 2007 - 2020, open3A GmbH - [email protected]
18+
* 2007 - 2021, open3A GmbH - [email protected]
1919
*/
2020

2121
class File extends PersistentObject {

classes/backend/FileStorage.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* You should have received a copy of the GNU General Public License
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*
18-
* 2007 - 2020, open3A GmbH - [email protected]
18+
* 2007 - 2021, open3A GmbH - [email protected]
1919
*/
2020
class FileStorage {
2121
protected $instance;

classes/backend/LDAPStorage.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* You should have received a copy of the GNU General Public License
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*
18-
* 2007 - 2020, open3A GmbH - [email protected]
18+
* 2007 - 2021, open3A GmbH - [email protected]
1919
*/
2020

2121
class LDAPStorage {

classes/backend/MSSQLStorage.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* You should have received a copy of the GNU General Public License
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*
18-
* 2007 - 2020, open3A GmbH - [email protected]
18+
* 2007 - 2021, open3A GmbH - [email protected]
1919
*/
2020

2121
function mssql_real_escape_string($s) {

classes/backend/PersistentObject.class.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* You should have received a copy of the GNU General Public License
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*
18-
* 2007 - 2020, open3A GmbH - [email protected]
18+
* 2007 - 2021, open3A GmbH - [email protected]
1919
*/
2020
class PersistentObject {
2121
protected $ID;
@@ -365,6 +365,14 @@ protected function getJSON(){
365365

366366
return json_encode($this->A, defined("JSON_UNESCAPED_UNICODE") ? JSON_UNESCAPED_UNICODE : 0);
367367
}
368+
369+
public function getLink(){
370+
return "?:".str_replace("open3A ", "", Applications::activeApplicationLabel()).",m".$this->getClearClass().",".$this->getID();
371+
}
372+
373+
public function setLink(){
374+
375+
}
368376
}
369377

370378

classes/backend/Phynx.class.php

+16-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* You should have received a copy of the GNU General Public License
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*
18-
* 2007 - 2020, open3A GmbH - [email protected]
18+
* 2007 - 2021, open3A GmbH - [email protected]
1919
*/
2020
class Phynx {
2121
public static function build(){
@@ -31,6 +31,21 @@ public static function build(){
3131
}
3232
}
3333

34+
public static function users(){
35+
if(!file_exists(Util::getRootPath()."system/build.xml"))
36+
return 1;
37+
38+
try {
39+
$xml = new SimpleXMLElement(file_get_contents(Util::getRootPath()."system/build.xml"));
40+
if(!isset($xml->build->users))
41+
return 1;
42+
43+
return $xml->build->users;
44+
} catch(Exception $e){
45+
return false;
46+
}
47+
}
48+
3449
public static function abo(){
3550
if(!file_exists(Util::getRootPath()."system/build.xml"))
3651
return "0";

classes/backend/PluginV2.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* You should have received a copy of the GNU General Public License
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*
18-
* 2007 - 2020, open3A GmbH - [email protected]
18+
* 2007 - 2021, open3A GmbH - [email protected]
1919
*/
2020
class PluginV2 {
2121
function registerApplications(){

classes/backend/SOAP.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* You should have received a copy of the GNU General Public License
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*
18-
* 2007 - 2020, open3A GmbH - [email protected]
18+
* 2007 - 2021, open3A GmbH - [email protected]
1919
*/
2020

2121
class SOAP {

classes/backend/SQLiteStorage.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* You should have received a copy of the GNU General Public License
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*
18-
* 2007 - 2020, open3A GmbH - [email protected]
18+
* 2007 - 2021, open3A GmbH - [email protected]
1919
*/
2020
class SQLiteStorage {
2121
private $parsers;

classes/backend/SelectStatement.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* You should have received a copy of the GNU General Public License
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*
18-
* 2007 - 2020, open3A GmbH - [email protected]
18+
* 2007 - 2021, open3A GmbH - [email protected]
1919
*/
2020
class SelectStatement {
2121
public $fields = array();

0 commit comments

Comments
 (0)