コード例 #1
0
    public function testMergedConfigReader()
    {
        $strSimpleConfigFile = <<<TXT
<?php
        \$config["testkey1"] = "testval1";
        \$config["testkey2"] = "testval2";

TXT;
        $strMergingConfigFile = <<<TXT
<?php
        \$config["testkey2"] = "otherval";

TXT;
        file_put_contents(class_resourceloader::getInstance()->getCorePathForModule("module_system", true) . "/module_system/system/config/test2.php", $strSimpleConfigFile);
        file_put_contents(_realpath_ . _projectpath_ . "/system/config/test2.php", $strMergingConfigFile);
        $this->assertFileExists(class_resourceloader::getInstance()->getCorePathForModule("module_system", true) . "/module_system/system/config/test2.php");
        $this->assertFileExists(_realpath_ . _projectpath_ . "/system/config/test2.php");
        $objConfig = class_config::getInstance("test2.php");
        $this->assertEquals("testval1", $objConfig->getConfig("testkey1"));
        $this->assertEquals("otherval", $objConfig->getConfig("testkey2"));
        $objFilesystem = new class_filesystem();
        $objFilesystem->fileDelete(class_resourceloader::getInstance()->getCorePathForModule("module_system") . "/module_system/system/config/test2.php");
        $objFilesystem->fileDelete(_projectpath_ . "/system/config/test2.php");
        $this->assertFileNotExists(class_resourceloader::getInstance()->getCorePathForModule("module_system", true) . "/module_system/system/config/test2.php");
        $this->assertFileNotExists(_realpath_ . _projectpath_ . "/system/config/test2.php");
    }
コード例 #2
0
 function __destruct()
 {
     if ($this->bitCacheSaveRequired && class_config::getInstance()->getConfig('resourcecaching') == true) {
         class_apc_cache::getInstance()->addValue(__CLASS__ . "classes", $this->arrClassCache);
         file_put_contents($this->strObjectsCacheFile, serialize($this->arrClassCache));
     }
 }
コード例 #3
0
ファイル: class_template.php プロジェクト: jinshana/kajonacms
 public function __destruct()
 {
     //save cache to apc
     if ($this->bitSaveToCacheRequired) {
         $this->objApcCache->addValue("templateSessionCacheTemplate", $this->arrCacheTemplates, class_config::getInstance()->getConfig("templatecachetime"));
         $this->objApcCache->addValue("templateSessionCacheTemplateSections", $this->arrCacheTemplateSections, class_config::getInstance()->getConfig("templatecachetime"));
     }
 }
コード例 #4
0
 /**
  * internal destructor
  */
 function __destruct()
 {
     if (self::$bitCacheSaveRequired && class_config::getInstance()->getConfig('resourcecaching') == true) {
         class_apc_cache::getInstance()->addValue("reflection", self::$arrAnnotationsCache);
         file_put_contents(self::$strAnnotationsCacheFile, serialize(self::$arrAnnotationsCache));
         self::$bitCacheSaveRequired = false;
     }
 }
コード例 #5
0
ファイル: class_lang.php プロジェクト: jinshana/kajonacms
 public function __destruct()
 {
     //save texts to session
     if ($this->bitSaveToCache) {
         class_apc_cache::getInstance()->addValue("textSessionCache", $this->arrTexts, class_config::getInstance()->getConfig("textcachetime"));
         class_apc_cache::getInstance()->addValue("textSessionFallbackCache", $this->arrFallbackTextEntrys, class_config::getInstance()->getConfig("textcachetime"));
     }
 }
コード例 #6
0
 /**
  * Stores the currently cached entries back to the filesystem - if required.
  */
 public function __destruct()
 {
     if ($this->bitCacheSaveRequired && class_config::getInstance()->getConfig('resourcecaching') == true) {
         class_apc_cache::getInstance()->addValue(__CLASS__ . "templates", $this->arrTemplates);
         class_apc_cache::getInstance()->addValue(__CLASS__ . "foldercontent", $this->arrFoldercontent);
         class_apc_cache::getInstance()->addValue(__CLASS__ . "langfiles", $this->arrLangfiles);
         file_put_contents($this->strTemplatesCacheFile, serialize($this->arrTemplates));
         file_put_contents($this->strFoldercontentCacheFile, serialize($this->arrFoldercontent));
         file_put_contents($this->strFoldercontentLangFile, serialize($this->arrLangfiles));
     }
 }
コード例 #7
0
ファイル: class_ldap.php プロジェクト: jinshana/kajonacms
 /**
  * Returns instances for each configured ldap source
  *
  * @return class_ldap[]
  */
 public static function getAllInstances()
 {
     if (self::$arrInstances == null) {
         $intI = 0;
         while (is_array(class_config::getInstance("ldap.php")->getConfig($intI))) {
             self::$arrInstances[$intI] = new class_ldap($intI);
             $intI++;
         }
     }
     return self::$arrInstances;
 }
コード例 #8
0
 /**
  * Returns the contents of the info-block
  *
  * @return mixed
  */
 public function getArrContent()
 {
     $objLang = class_carrier::getInstance()->getObjLang();
     $arrReturn = array();
     $arrTables = class_carrier::getInstance()->getObjDB()->getTables(true);
     $intSizeData = 0;
     $intSizeIndex = 0;
     switch (class_config::getInstance()->getConfig("dbdriver")) {
         case "mysqli":
         case "mysql":
             foreach ($arrTables as $arrTable) {
                 if (isset($arrTable["Data_length"])) {
                     $intSizeData += $arrTable["Data_length"];
                 }
                 if (isset($arrTable["Index_length"])) {
                     $intSizeIndex += $arrTable["Index_length"];
                 }
             }
             $arrInfo = class_carrier::getInstance()->getObjDB()->getDbInfo();
             $arrReturn[] = array($objLang->getLang("datenbanktreiber", "system"), $arrInfo["dbdriver"]);
             $arrReturn[] = array($objLang->getLang("datenbankserver", "system"), $arrInfo["dbserver"]);
             $arrReturn[] = array($objLang->getLang("datenbankclient", "system"), $arrInfo["dbclient"]);
             $arrReturn[] = array($objLang->getLang("datenbankverbindung", "system"), $arrInfo["dbconnection"]);
             $arrReturn[] = array($objLang->getLang("anzahltabellen", "system"), count($arrTables));
             $arrReturn[] = array($objLang->getLang("groessegesamt", "system"), bytesToString($intSizeData + $intSizeIndex));
             $arrReturn[] = array($objLang->getLang("groessedaten", "system"), bytesToString($intSizeData));
             break;
         case "postgres":
             $arrInfo = class_carrier::getInstance()->getObjDB()->getDbInfo();
             $arrReturn[] = array($objLang->getLang("datenbanktreiber", "system"), $arrInfo["dbdriver"]);
             $arrReturn[] = array($objLang->getLang("datenbankserver", "system"), $arrInfo["dbserver"]);
             $arrReturn[] = array($objLang->getLang("datenbankclient", "system"), $arrInfo["dbclient"]);
             $arrReturn[] = array($objLang->getLang("datenbankverbindung", "system"), $arrInfo["dbconnection"]);
             $arrReturn[] = array($objLang->getLang("anzahltabellen", "system"), count($arrTables));
             $arrReturn[] = array($objLang->getLang("groessegesamt", "system"), bytesToString($intSizeData + $intSizeIndex));
             $arrReturn[] = array($objLang->getLang("groessedaten", "system"), bytesToString($intSizeData));
             break;
         default:
             $arrInfo = class_carrier::getInstance()->getObjDB()->getDbInfo();
             $arrReturn[] = array($objLang->getLang("datenbanktreiber", "system"), $arrInfo["dbdriver"]);
             $arrReturn[] = array($objLang->getLang("datenbankserver", "system"), $arrInfo["dbserver"]);
             $arrReturn[] = array($objLang->getLang("anzahltabellen", "system"), count($arrTables));
             break;
     }
     return $arrReturn;
 }
コード例 #9
0
ファイル: class_db.php プロジェクト: jinshana/kajonacms
 /**
  * Constructor
  */
 private function __construct()
 {
     $this->objConfig = class_config::getInstance();
     //Load the defined db-driver
     $strDriver = $this->objConfig->getConfig("dbdriver");
     if ($strDriver != "%%defaultdriver%%") {
         //build a class-name & include the driver
         $strClassname = "class_db_" . $strDriver;
         if (class_exists($strClassname)) {
             $this->objDbDriver = new $strClassname();
         } else {
             throw new class_exception("db-driver " . $strClassname . " could not be loaded", class_exception::$level_FATALERROR);
         }
     } else {
         //Do not throw any exception here, otherwise an endless loop will exit with an overloaded stack frame
         //throw new class_exception("No db-driver defined!", class_exception::$level_FATALERROR);
     }
 }
コード例 #10
0
ファイル: class_testbase.php プロジェクト: jinshana/kajonacms
 protected function setUp()
 {
     $this->arrTestStartDate = gettimeofday();
     if (!defined("_block_config_db_loading_")) {
         define("_block_config_db_loading_", true);
     }
     if (!defined("_autotesting_")) {
         define("_autotesting_", true);
     }
     if (!defined("_autotesting_sqlite_checks_")) {
         if (class_config::getInstance("config.php")->getConfig("dbdriver") == "sqlite3") {
             class_db::getInstance()->_pQuery("PRAGMA journal_mode = MEMORY", array());
         }
         define("_autotesting_sqlite_checks_", true);
     }
     class_carrier::getInstance()->flushCache(class_carrier::INT_CACHE_TYPE_APC | class_carrier::INT_CACHE_TYPE_DBQUERIES);
     parent::setUp();
 }
コード例 #11
0
 /**
  * Saves the memberships passed by param
  *
  * @return string "" in case of success
  * @permissions edit
  */
 protected function actionSaveMembership()
 {
     $objUser = new class_module_user_user($this->getSystemid());
     $objUsersources = new class_module_user_sourcefactory();
     $objSourcesytem = $objUsersources->getUsersource($objUser->getStrSubsystem());
     $arrGroups = $objSourcesytem->getAllGroupIds();
     $arrUserGroups = $objUser->getArrGroupIds();
     //validate possible blocked groups
     $objConfig = class_config::getInstance("blockedgroups.php");
     $arrBlockedGroups = explode(",", $objConfig->getConfig("blockedgroups"));
     //Searching for groups to enter
     foreach ($arrGroups as $strSingleGroup) {
         $objGroup = new class_module_user_group($strSingleGroup);
         //skipped for blocked groups, those won't be updated
         if (!$this->isGroupEditable($objGroup)) {
             continue;
         }
         if ($this->getParam($strSingleGroup) != "") {
             //add the user to this group
             if (!in_array($strSingleGroup, $arrUserGroups)) {
                 $objGroup->getObjSourceGroup()->addMember($objUser->getObjSourceUser());
             } else {
                 //user is already in the group, remove the marker
                 foreach ($arrUserGroups as $strKey => $strValue) {
                     if ($strValue == $strSingleGroup) {
                         $arrUserGroups[$strKey] = null;
                     }
                 }
             }
         }
     }
     //check, if the current user is member of the admin-group.
     //if not, remain the admin-group as-is
     if (!class_carrier::getInstance()->getObjSession()->isSuperAdmin()) {
         $intKey = array_search(class_module_system_setting::getConfigValue("_admins_group_id_"), $arrUserGroups);
         if ($intKey !== false) {
             $arrUserGroups[$intKey] = null;
         }
         foreach ($arrBlockedGroups as $strOneGroup) {
             $intKey = array_search($strOneGroup, $arrUserGroups);
             if ($intKey !== false) {
                 $arrUserGroups[$intKey] = null;
             }
         }
     }
     //loop the users' list in order to remove unwanted relations
     foreach ($arrUserGroups as $strValue) {
         if (validateSystemid($strValue)) {
             $objGroup = new class_module_user_group($strValue);
             $objGroup->getObjSourceGroup()->removeMember($objUser->getObjSourceUser());
         }
     }
     if ($this->getParam("folderview")) {
         $this->adminReload(class_link::getLinkAdminHref($this->getArrModule("modul"), "list", "&peClose=1&blockAction=1"));
     } else {
         $this->adminReload(class_link::getLinkAdminHref($this->getArrModule("modul"), "list"));
     }
 }
コード例 #12
0
ファイル: ldap.php プロジェクト: jinshana/kajonacms
/*"******************************************************************************************************
*   (c) 2004-2006 by MulchProductions, www.mulchprod.de                                                 *
*   (c) 2007-2015 by Kajona, www.kajona.de                                                              *
*       Published under the GNU LGPL v2.1, see /system/licence_lgpl.txt                                 *
*-------------------------------------------------------------------------------------------------------*
*   $Id$                                     *
********************************************************************************************************/
echo "+-------------------------------------------------------------------------------+\n";
echo "| Kajona Debug Subsystem                                                        |\n";
echo "|                                                                               |\n";
echo "| Checks the connection to the configured ldap servers                          |\n";
echo "|                                                                               |\n";
echo "+-------------------------------------------------------------------------------+\n";
$intI = 0;
foreach (class_ldap::getAllInstances() as $objOneLdap) {
    $arrCfg = class_config::getInstance("ldap.php")->getConfig($objOneLdap->getIntCfgNr());
    echo "Connecting to ldap at " . $arrCfg["ldap_server"] . "\n";
    echo "Searching for bind-user " . $arrCfg["ldap_bind_username"] . "\n";
    $arrUser = $objOneLdap->getUserdetailsByName($arrCfg["ldap_bind_username"]);
    var_dump($arrUser);
    echo "Loading user by DN\n";
    $arrUser = $objOneLdap->getUserDetailsByDN($arrUser[0]["identifier"]);
    var_dump($arrUser);
    //    echo "Loading groups for user\n";
    //    var_dump($objOneLdap->getMembersOfGroup("CN=Entwickler,OU=Gruppen,DC=ad,DC=artemeon,DC=int"));
    //    var_dump($objOneLdap->getNumberOfGroupMembers("CN=Entwickler,OU=Gruppen,DC=ad,DC=artemeon,DC=int"));
}
echo "\n\n";
echo "+-------------------------------------------------------------------------------+\n";
echo "| (c) www.kajona.de                                                             |\n";
echo "+-------------------------------------------------------------------------------+\n";
コード例 #13
0
 /**
  * Returns a input-file element
  *
  * @param string $strName
  * @param string $strTitle
  * @param string $strClass
  *
  * @return string
  */
 public function formInputUpload($strName, $strTitle = "", $strClass = "")
 {
     $strTemplateID = $this->objTemplate->readTemplate("/elements.tpl", "input_upload");
     $arrTemplate = array();
     $arrTemplate["name"] = $strName;
     $arrTemplate["title"] = $strTitle;
     $arrTemplate["class"] = $strClass;
     $objText = class_carrier::getInstance()->getObjLang();
     $arrTemplate["maxSize"] = $objText->getLang("max_size", "mediamanager") . " " . bytesToString(class_config::getInstance()->getPhpMaxUploadSize());
     return $this->objTemplate->fillTemplate($arrTemplate, $strTemplateID);
 }
コード例 #14
0
 /**
  * Returns all content-providers as configured in the /config/packagemanager.php file.
  *
  * @return interface_packagemanager_contentprovider[]
  */
 public function getContentproviders()
 {
     $objConfig = class_config::getInstance("packagemanager.php");
     $strProvider = $objConfig->getConfig("contentproviders");
     $arrProviders = explode(",", $strProvider);
     $arrReturn = array();
     foreach ($arrProviders as $strOneProvider) {
         $strOneProvider = trim($strOneProvider);
         if ($strOneProvider != "") {
             $arrReturn[] = new $strOneProvider();
         }
     }
     return $arrReturn;
 }
コード例 #15
0
ファイル: class_carrier.php プロジェクト: jinshana/kajonacms
 /**
  * Managing access to the config object. Use ONLY this method to
  * get an instance!
  *
  * @return class_config
  */
 public function getObjConfig()
 {
     //Do we have to generate the object?
     if ($this->objConfig == null) {
         $this->objConfig = class_config::getInstance();
         //Loading the config-Files
         //Invocation removed, all configs from database
         //$this->objConfig->loadConfigsFilesystem();
     }
     return $this->objConfig;
 }
コード例 #16
0
 /**
  * Validates whether the current module/element is removable or not.
  * This is the place to trigger special validations and consistency checks going
  * beyond the common metadata-dependencies.
  *
  * @return bool
  */
 public function isRemovable()
 {
     return uniStrpos(class_config::getInstance()->getConfig("loginproviders"), "ldap") === false;
 }
コード例 #17
0
 /**
  * Removes marks from the text
  * @return void
  */
 private function clearmarks()
 {
     $arrMarks = class_config::getInstance("search_blacklist.php")->getConfig("marks_list");
     $this->setText(uniStrReplace($arrMarks, "", html_entity_decode($this->getText())));
 }