コード例 #1
0
 /**
  * Generic implementation, triggers the update or the install method, depending on the parts already installed.
  * @return string
  */
 public function installOrUpdate()
 {
     $strReturn = "";
     $objModule = null;
     if ($this->objMetadata->getStrType() == class_module_packagemanager_manager::STR_TYPE_ELEMENT) {
         if (class_module_system_module::getModuleByName("pages") !== null && is_dir(class_resourceloader::getInstance()->getCorePathForModule("module_pages", true))) {
             $objModule = class_module_pages_element::getElement(uniStrReplace("element_", "", $this->objMetadata->getStrTitle()));
         }
     } else {
         $objModule = class_module_system_module::getModuleByName($this->objMetadata->getStrTitle());
     }
     if ($objModule === null) {
         class_logger::getInstance("triggering installation of " . $this->objMetadata->getStrTitle(), class_logger::$levelInfo);
         $strReturn .= $this->install();
     } else {
         $strVersionInstalled = $objModule->getStrVersion();
         $strVersionAvailable = $this->objMetadata->getStrVersion();
         if (version_compare($strVersionAvailable, $strVersionInstalled, ">")) {
             class_logger::getInstance("triggering update of " . $this->objMetadata->getStrTitle(), class_logger::$levelInfo);
             $strReturn .= $this->update();
         }
     }
     class_carrier::getInstance()->flushCache(class_carrier::INT_CACHE_TYPE_DBTABLES);
     return $strReturn;
 }
コード例 #2
0
 /**
  * @param string $formErrors
  *
  * @return string
  */
 private function uploadForm($formErrors = "")
 {
     $strReturn = "";
     //validate the rights
     $objFilemanagerRepo = new class_module_mediamanager_repo($this->arrElementData["char2"]);
     if ($objFilemanagerRepo->rightRight1()) {
         $strTemplateID = $this->objTemplate->readTemplate("/element_portalupload/" . $this->arrElementData["char1"], "portalupload_uploadform");
         $strDlFolderId = "";
         if ($this->getParam("action") == "mediaFolder") {
             $strDlFolderId = $this->getParam("systemid");
         }
         $arrTemplate = array();
         $arrTemplate["portaluploadDlfolder"] = $strDlFolderId;
         // check if there was an successfull upload before
         if ($this->getParam("uploadSuccess") == "1") {
             $arrTemplate["portaluploadSuccess"] = $this->getLang("portaluploadSuccess");
         }
         $arrTemplate["formErrors"] = $formErrors;
         $strAllowedFileRegex = uniStrReplace(array(".", ","), array("", "|"), $objFilemanagerRepo->getStrUploadFilter());
         $arrTemplate["formAction"] = class_link::getLinkPortalHref($this->getPagename(), "", $this->getAction(), "", $strDlFolderId);
         $arrTemplate["maxFileSize"] = class_carrier::getInstance()->getObjConfig()->getPhpMaxUploadSize();
         $arrTemplate["acceptFileTypes"] = $strAllowedFileRegex != "" ? "/(\\.|\\/)(" . $strAllowedFileRegex . ")\$/i" : "''";
         $arrTemplate["elementId"] = $this->arrElementData["content_id"];
         $arrTemplate["mediamanagerRepoId"] = $objFilemanagerRepo->getSystemid();
         $strReturn .= $this->fillTemplate($arrTemplate, $strTemplateID);
     } else {
         $strReturn .= $this->getLang("commons_error_permissions");
     }
     return $strReturn;
 }
コード例 #3
0
 /**
  * Calls the single search-functions, sorts the results and creates the output.
  * Method for portal-searches.
  *
  * @param class_module_search_search $objSearch
  *
  * @return class_search_result[]
  */
 public function doPortalSearch($objSearch)
 {
     $objSearch->setStrQuery(trim(uniStrReplace("%", "", $objSearch->getStrQuery())));
     if (uniStrlen($objSearch->getStrQuery()) == 0) {
         return array();
     }
     //create a search object
     $objSearch->setBitPortalObjectFilter(true);
     $arrHits = $this->doIndexedSearch($objSearch);
     $arrReturn = array();
     foreach ($arrHits as $objOneResult) {
         $objInstance = $objOneResult->getObjObject();
         if ($objInstance instanceof class_module_pages_pageelement) {
             $objInstance = $objInstance->getConcreteAdminInstance();
             if ($objInstance != null) {
                 $objInstance->loadElementData();
             } else {
                 continue;
             }
         }
         $arrUpdatedResults = $objInstance->updateSearchResult($objOneResult);
         if (is_array($arrUpdatedResults)) {
             $arrReturn = array_merge($arrReturn, $arrUpdatedResults);
         } else {
             if ($objOneResult != null && $objOneResult instanceof class_search_result) {
                 $arrReturn[] = $objOneResult;
             }
         }
     }
     //log the query
     class_module_search_log::generateLogEntry($objSearch->getStrQuery());
     $arrReturn = $this->mergeDuplicates($arrReturn);
     return $arrReturn;
 }
コード例 #4
0
 /**
  * Triggers the "real" creation of the report and wraps the code inline into a xml-structure
  *
  * @return string
  * @permissions view
  */
 protected function actionGetReport()
 {
     $strPlugin = $this->getParam("plugin");
     $strReturn = "";
     $objPluginManager = new class_pluginmanager(class_module_stats_admin::$STR_PLUGIN_EXTENSION_POINT, "/admin/statsreports");
     $objPlugin = null;
     foreach ($objPluginManager->getPlugins(array(class_carrier::getInstance()->getObjDB(), $this->objToolkit, $this->getObjLang())) as $objOneReport) {
         if (uniStrReplace("class_stats_report_", "", get_class($objOneReport)) == $strPlugin) {
             $objPlugin = $objOneReport;
             break;
         }
     }
     if ($objPlugin !== null && $objPlugin instanceof interface_admin_statsreports) {
         //get date-params as ints
         $intStartDate = mktime(0, 0, 0, $this->objDateStart->getIntMonth(), $this->objDateStart->getIntDay(), $this->objDateStart->getIntYear());
         $intEndDate = mktime(0, 0, 0, $this->objDateEnd->getIntMonth(), $this->objDateEnd->getIntDay(), $this->objDateEnd->getIntYear());
         $objPlugin->setEndDate($intEndDate);
         $objPlugin->setStartDate($intStartDate);
         $objPlugin->setInterval($this->intInterval);
         $arrImage = $objPlugin->getReportGraph();
         if (!is_array($arrImage)) {
             $arrImage = array($arrImage);
         }
         foreach ($arrImage as $strImage) {
             if ($strImage != "") {
                 $strReturn .= $this->objToolkit->getGraphContainer($strImage);
             }
         }
         $strReturn .= $objPlugin->getReport();
         $strReturn = "<content><![CDATA[" . $strReturn . "]]></content>";
     }
     return $strReturn;
 }
コード例 #5
0
 /**
  * Processes the content.
  * Make sure to return the string again, otherwise the output will remain blank.
  *
  * @param string $strContent
  *
  * @return string
  */
 public function processContent($strContent)
 {
     $objLang = class_carrier::getInstance()->getObjLang();
     $arrTemp = array();
     preg_match_all("#\\[lang,([A-Za-z0-9_]+),([0-9A-Za-z_]+)\\]#i", $strContent, $arrTemp);
     foreach ($arrTemp[0] as $intKey => $strSearchString) {
         $strContent = uniStrReplace($strSearchString, $objLang->getLang($arrTemp[1][$intKey], $arrTemp[2][$intKey]), $strContent);
     }
     return $strContent;
 }
コード例 #6
0
 /**
  * Loads the navigation-class and passes control
  *
  * @throws class_exception
  * @return string
  */
 public function loadData()
 {
     $strPath = class_resourceloader::getInstance()->getPathForFile("/portal/forms/" . $this->arrElementData["formular_class"]);
     if ($strPath === false) {
         throw new class_exception("failed to load form-class " . $this->arrElementData["formular_class"], class_exception::$level_ERROR);
     }
     require_once _realpath_ . $strPath;
     $strClassname = uniStrReplace(".php", "", $this->arrElementData["formular_class"]);
     $objForm = new $strClassname($this->arrElementData);
     $strReturn = $objForm->action();
     return $strReturn;
 }
コード例 #7
0
 /**
  *
  */
 public function sendHeaders()
 {
     if ($this->strRedirectUrl != "") {
         $this->strStatusCode = class_http_statuscodes::SC_REDIRECT;
         $this->arrAdditionalHeaders[] = "Location: " . uniStrReplace("&amp;", "&", $this->strRedirectUrl);
     }
     header($this->getStrStatusCode());
     header($this->getStrResponseType());
     foreach ($this->arrAdditionalHeaders as $strOneHeader) {
         header($strOneHeader);
     }
 }
コード例 #8
0
 /**
  * @param string $strImage
  * @param string $strTooltip
  *
  * @return null|string
  */
 private function getFASomeImage($strImage, $strTooltip)
 {
     $strName = uniStrReplace(array(".png", ".gif"), "", $strImage);
     if (isset(self::$arrFAImages[$strName])) {
         if ($strTooltip == "") {
             return self::$arrFAImages[$strName];
         } else {
             return "<span rel=\"tooltip\" title=\"" . $strTooltip . "\" data-kajona-icon='" . $strName . "' >" . self::$arrFAImages[$strName] . "</span>";
         }
     }
     return null;
 }
コード例 #9
0
ファイル: class_zip.php プロジェクト: jinshana/kajonacms
 /**
  * Adds a file to the zip-archive.
  * The second, optional param indicates the filename inside the archive
  *
  * @param string $strSourceFile
  * @param string $strTargetFile
  *
  * @return bool
  */
 public function addFile($strSourceFile, $strTargetFile = "")
 {
     $strSourceFile = uniStrReplace(_realpath_, "", $strSourceFile);
     if ($strTargetFile == "") {
         $strTargetFile = $strSourceFile;
     }
     $strTargetFile = ltrim($strTargetFile, "/");
     if (file_exists(_realpath_ . $strSourceFile)) {
         return $this->objArchive->addFile(_realpath_ . $strSourceFile, $strTargetFile);
     } else {
         return false;
     }
 }
コード例 #10
0
 /**
  * Processes the content.
  * Make sure to return the string again, otherwise the output will remain blank.
  *
  * @param string $strContent
  *
  * @return string
  */
 public function processContent($strContent)
 {
     $arrTemp = array();
     preg_match_all("#\\[img,([ \\-+%A-Za-z0-9_\\./\\\\(\\)]+),([0-9]+),([0-9]+)(,fixed|,max|)\\]#i", $strContent, $arrTemp);
     foreach ($arrTemp[0] as $intKey => $strSearchString) {
         if (isset($arrTemp[4][$intKey]) && $arrTemp[4][$intKey] == ",fixed") {
             $strContent = uniStrReplace($strSearchString, _webpath_ . "/image.php?image=" . urlencode($arrTemp[1][$intKey]) . "&amp;fixedWidth=" . $arrTemp[2][$intKey] . "&amp;fixedHeight=" . $arrTemp[3][$intKey], $strContent);
         } else {
             $strContent = uniStrReplace($strSearchString, _webpath_ . "/image.php?image=" . urlencode($arrTemp[1][$intKey]) . "&amp;maxWidth=" . $arrTemp[2][$intKey] . "&amp;maxHeight=" . $arrTemp[3][$intKey], $strContent);
         }
     }
     //fast way, no urlencode required
     //$strContent = preg_replace("#\[img,([A-Za-z0-9_\./\\\]+),([0-9]+),([0-9]+)\]#i", _webpath_."/image.php?image=\${1}&amp;maxWidth=\${2}&amp;maxHeight=\${3}", $strContent);
     return $strContent;
 }
コード例 #11
0
 /**
  * Processes the content.
  * Make sure to return the string again, otherwise the output will remain blank.
  *
  * @param string $strContent
  *
  * @return string
  */
 public function processContent($strContent)
 {
     $arrTemp = array();
     preg_match_all("#\\[qrcode,([ \\?\\&\\-=:+%;A-Za-z0-9_\\./\\\\]+)(,[1-3])\\]#i", $strContent, $arrTemp);
     foreach ($arrTemp[0] as $intKey => $strSearchString) {
         $intSize = 1;
         $strSubstr = isset($arrTemp[2][$intKey]) ? (int) substr($arrTemp[2][$intKey], 1) : 1;
         if ($strSubstr >= 1 && $strSubstr <= 3) {
             $intSize = $strSubstr;
         }
         $objQrCode = new class_qrcode();
         $objQrCode->setIntSize($intSize);
         $strImage = $objQrCode->getImageForString($arrTemp[1][$intKey]);
         $strContent = uniStrReplace($strSearchString, _webpath_ . "/" . $strImage, $strContent);
     }
     return $strContent;
 }
コード例 #12
0
ファイル: test_langTest.php プロジェクト: jinshana/kajonacms
 public function testPerformanceTest()
 {
     $objLang = class_lang::getInstance();
     $arrParameters = array("lorem", "ipsum", "dolor", "sit", "amet");
     $strPropertyRaw = "lorem {0} ipsum {1} dolor {2} sit {3} amet {4} {0}";
     $intStart = microtime(true);
     for ($intI = 0; $intI <= 100; $intI++) {
         $strProperty = $strPropertyRaw;
         foreach ($arrParameters as $intKey => $strParameter) {
             $strProperty = uniStrReplace("{" . $intKey . "}", $strParameter, $strProperty);
         }
         $this->assertEquals($strProperty, "lorem lorem ipsum ipsum dolor dolor sit sit amet amet lorem");
     }
     $intEnd = microtime(true);
     echo "uniStrReplace: " . ($intEnd - $intStart) . " sec\n";
     $intStart = microtime(true);
     for ($intI = 0; $intI <= 100; $intI++) {
         $strProperty = uniStrReplace(array_map(function ($i) {
             return "{" . $i . "}";
         }, array_keys($arrParameters)), $arrParameters, $strPropertyRaw);
         $this->assertEquals($strProperty, "lorem lorem ipsum ipsum dolor dolor sit sit amet amet lorem");
     }
     $intEnd = microtime(true);
     echo "array based uniStrReplace: " . ($intEnd - $intStart) . " sec\n";
     $intStart = microtime(true);
     for ($intI = 0; $intI <= 100; $intI++) {
         $strProperty = preg_replace_callback("/{(\\d)}/", function ($hit) use($arrParameters) {
             return $arrParameters[$hit[1]];
         }, $strPropertyRaw);
         $this->assertEquals($strProperty, "lorem lorem ipsum ipsum dolor dolor sit sit amet amet lorem");
     }
     $intEnd = microtime(true);
     echo "preg_replace based : " . ($intEnd - $intStart) . " sec\n";
     $intStart = microtime(true);
     for ($intI = 0; $intI <= 100; $intI++) {
         $strProperty = $objLang->replaceParams($strPropertyRaw, $arrParameters);
         $this->assertEquals($strProperty, "lorem lorem ipsum ipsum dolor dolor sit sit amet amet lorem");
     }
     $intEnd = microtime(true);
     echo "current implementation : " . ($intEnd - $intStart) . " sec\n";
 }
コード例 #13
0
 /**
  * Returns a list of all posts in the current gb
  *
  * @return string
  * @permissions view
  */
 protected function actionList()
 {
     $strReturn = "";
     $arrTemplate = array();
     $arrTemplate["liste_posts"] = "";
     //Load all posts
     $objArraySectionIterator = new class_array_section_iterator(class_module_guestbook_post::getPostsCount($this->arrElementData["guestbook_id"], true));
     $objArraySectionIterator->setIntElementsPerPage($this->arrElementData["guestbook_amount"]);
     $objArraySectionIterator->setPageNumber((int) ($this->getParam("pv") != "" ? $this->getParam("pv") : 1));
     $objArraySectionIterator->setArraySection(class_module_guestbook_post::getPosts($this->arrElementData["guestbook_id"], true, $objArraySectionIterator->calculateStartPos(), $objArraySectionIterator->calculateEndPos()));
     $arrObjPosts = $this->objToolkit->simplePager($objArraySectionIterator, $this->getLang("commons_next"), $this->getLang("commons_back"), "", $this->getPagename());
     //and put posts into a template
     /** @var class_module_guestbook_post $objOnePost */
     foreach ($objArraySectionIterator as $objOnePost) {
         if ($objOnePost->rightView()) {
             $strTemplatePostID = $this->objTemplate->readTemplate("/module_guestbook/" . $this->arrElementData["guestbook_template"], "post");
             $arrTemplatePost = array();
             $arrTemplatePost["post_name"] = "<a href=\"mailto:" . $objOnePost->getStrGuestbookPostEmail() . "\">" . $objOnePost->getStrGuestbookPostName() . "</a>";
             $arrTemplatePost["post_name_plain"] = $objOnePost->getStrGuestbookPostName();
             $arrTemplatePost["post_email"] = $objOnePost->getStrGuestbookPostEmail();
             $arrTemplatePost["post_page"] = "<a href=\"http://" . $objOnePost->getStrGuestbookPostPage() . "\">" . $objOnePost->getStrGuestbookPostPage() . "</a>";
             //replace encoded newlines
             $arrTemplatePost["post_text"] = uniStrReplace("&lt;br /&gt;", "<br />", $objOnePost->getStrGuestbookPostText());
             $arrTemplatePost["post_date"] = timeToString($objOnePost->getIntGuestbookPostDate());
             $arrTemplate["liste_posts"] .= $this->objTemplate->fillTemplate($arrTemplatePost, $strTemplatePostID, false);
         }
     }
     //link to the post-form & pageview links
     $arrTemplate["link_newentry"] = getLinkPortal($this->getParam("page") ? $this->getParam("page") : "", "", "", $this->getLang("eintragen"), "insertGuestbook");
     $arrTemplate["link_forward"] = $arrObjPosts["strForward"];
     $arrTemplate["link_pages"] = $arrObjPosts["strPages"];
     $arrTemplate["link_back"] = $arrObjPosts["strBack"];
     $strTemplateID = $this->objTemplate->readTemplate("/module_guestbook/" . $this->arrElementData["guestbook_template"], "list");
     $strReturn .= $this->fillTemplate($arrTemplate, $strTemplateID);
     return $strReturn . "";
 }
コード例 #14
0
 /**
  * Renders the icon to edit a records tags
  * @param class_model|interface_model $objListEntry
  * @return string
  */
 protected function renderTagAction(class_model $objListEntry)
 {
     if ($objListEntry->getIntRecordDeleted() == 1) {
         return "";
     }
     if ($objListEntry->rightView()) {
         //the tag list is more complex and wrapped by a js-logic to load the tags by ajax afterwards
         // @codingStandardsIgnoreStart
         $strOnClick = "KAJONA.admin.folderview.dialog.setContentIFrame('" . class_link::getLinkAdminHref("tags", "genericTagForm", "&systemid=" . $objListEntry->getSystemid()) . "'); KAJONA.admin.folderview.dialog.setTitle('" . uniStrReplace(array("\r", "\n"), "", strip_tags(nl2br($objListEntry->getStrDisplayName()))) . "'); KAJONA.admin.folderview.dialog.init(); return false;";
         $strLink = "<a href=\"#\" onclick=\"" . $strOnClick . "\" title=\"" . $this->getLang("commons_edit_tags") . "\" rel=\"tagtooltip\" data-systemid=\"" . $objListEntry->getSystemid() . "\">" . class_adminskin_helper::getAdminImage("icon_tag", $this->getLang("commons_edit_tags"), true) . "</a>";
         // @codingStandardsIgnoreEnd
         return $this->objToolkit->listButton($strLink);
     }
     return "";
 }
コード例 #15
0
ファイル: functions.php プロジェクト: jinshana/kajonacms
/**
 * Creates a filename valid for filesystems
 *
 * @param string $strName
 * @param bool $bitFolder
 *
 * @return string
 */
function createFilename($strName, $bitFolder = false)
{
    $strName = uniStrtolower($strName);
    if (!$bitFolder) {
        $strEnding = uniSubstr($strName, uniStrrpos($strName, ".") + 1);
    } else {
        $strEnding = "";
    }
    if (!$bitFolder) {
        $strReturn = uniSubstr($strName, 0, uniStrrpos($strName, "."));
    } else {
        $strReturn = $strName;
    }
    //Filter non allowed chars
    $arrSearch = array(" ", ".", ":", "ä", "ö", "ü", "/", "ß", "!");
    $arrReplace = array("_", "_", "_", "ae", "oe", "ue", "_", "ss", "_");
    $strReturn = uniStrReplace($arrSearch, $arrReplace, $strReturn);
    //and the ending
    if (!$bitFolder) {
        $strEnding = uniStrReplace($arrSearch, $arrReplace, $strEnding);
    }
    //remove all other special characters
    $strTemp = preg_replace("/[^A-Za-z0-9_-]/", "", $strReturn);
    //do a replacing in the ending, too
    if ($strEnding != "") {
        //remove all other special characters
        $strEnding = "." . preg_replace("/[^A-Za-z0-9_-]/", "", $strEnding);
    }
    $strReturn = $strTemp . $strEnding;
    return $strReturn;
}
コード例 #16
0
 private function createElementData($strPageId, XMLWriter $objWriter)
 {
     $arrElements = class_module_pages_pageelement::getAllElementsOnPage($strPageId);
     foreach ($arrElements as $objOneElement) {
         $objWriter->startElement("element");
         //elements metadata
         $objWriter->startElement("metadata");
         $objWriter->startElement("systemid");
         $objWriter->text($objOneElement->getSystemid());
         $objWriter->endElement();
         $objWriter->startElement("placeholder");
         $objWriter->text($objOneElement->getStrPlaceholder());
         $objWriter->endElement();
         $objWriter->startElement("name");
         $objWriter->text($objOneElement->getStrName());
         $objWriter->endElement();
         $objWriter->startElement("element");
         $objWriter->text($objOneElement->getStrElement());
         $objWriter->endElement();
         $objWriter->startElement("title");
         $objWriter->text($objOneElement->getStrTitle(false));
         $objWriter->endElement();
         $objWriter->startElement("language");
         $objWriter->text($objOneElement->getStrLanguage());
         $objWriter->endElement();
         $objWriter->endElement();
         //the elements-content itself
         $objElement = $objOneElement->getConcreteAdminInstance();
         //Fetch the table
         $strElementTable = $objElement->getTable();
         $objWriter->startElement("foreignTable");
         $objWriter->startAttribute("table");
         $objWriter->text(uniStrReplace(_dbprefix_, "", $strElementTable));
         $objWriter->endAttribute();
         //content-row
         $arrContentRow = class_carrier::getInstance()->getObjDB()->getPRow("SELECT * FROM " . $strElementTable . " WHERE content_id = ? ", array($objOneElement->getSystemid()));
         $arrColumns = class_carrier::getInstance()->getObjDB()->getColumnsOfTable($strElementTable);
         foreach ($arrColumns as $arrOneCol) {
             $objWriter->startElement("column");
             $objWriter->startAttribute("name");
             $objWriter->text($arrOneCol["columnName"]);
             $objWriter->endAttribute();
             $objWriter->startCdata();
             $objWriter->text($arrContentRow[$arrOneCol["columnName"]]);
             $objWriter->endCdata();
             //column
             $objWriter->endElement();
         }
         //foreignTable
         $objWriter->endElement();
         //element
         $objWriter->endElement();
     }
 }
コード例 #17
0
 /**
  * Converts the string of params into an associative array e.g.
  * the string (param1=0, param2="abc", param3={"0", 123, 456}, param4=999, param5="hans im glück") is converted into an array of
  *
  * array(
  *   "param1" => "0",
  *   "param2" => "abc",
  *   "param3" => array("0", "123", "456"),
  *   "param4" => "999",
  *   "param5" => "hans im glück",
  * )
  *
  *
  * @param $strParams
  *
  * @return array ["paramname" => "value"]
  */
 private function params2Array($strParams)
 {
     $arrParams = array();
     if ($strParams == "") {
         return $arrParams;
     }
     $strPatternParams = "/(\\w+)=(\\d+?)|(\\w+)=\"(.*)\"|(\\w+)=(\\{.*\\})/U";
     if (preg_match_all($strPatternParams, $strParams, $arrMatches, PREG_SET_ORDER) !== false) {
         foreach ($arrMatches as $arrOneMatch) {
             //GetParam name
             $strParamName = "";
             if (isset($arrOneMatch[1]) && $arrOneMatch[1] != "") {
                 $strParamName = $arrOneMatch[1];
             } else {
                 if (isset($arrOneMatch[3]) && $arrOneMatch[3] != "") {
                     $strParamName = $arrOneMatch[3];
                 } else {
                     if (isset($arrOneMatch[5]) && $arrOneMatch[5] != "") {
                         $strParamName = $arrOneMatch[5];
                     }
                 }
             }
             //Get param value(s)
             $strParamValue = "";
             if (isset($arrOneMatch[2]) && $arrOneMatch[2] != "") {
                 $strParamValue = $arrOneMatch[2];
             } else {
                 if (isset($arrOneMatch[4]) && $arrOneMatch[4] != "") {
                     $strParamValue = $arrOneMatch[4];
                 } else {
                     if (isset($arrOneMatch[6]) && $arrOneMatch[6] != "") {
                         $strParamValue = $arrOneMatch[6];
                         $strParamValue = uniStrReplace(array("{"), "[", $strParamValue);
                         $strParamValue = uniStrReplace(array("}"), "]", $strParamValue);
                         $strParamValue = json_decode($strParamValue);
                     }
                 }
             }
             $arrParams[$strParamName] = $strParamValue;
         }
     }
     return $arrParams;
 }
コード例 #18
0
 /**
  * @return string
  */
 public function getReport()
 {
     $strReturn = "";
     //showing a list using the pageview
     $objArraySectionIterator = new class_array_section_iterator($this->getTopQueriesCount());
     $objArraySectionIterator->setPageNumber((int) (getGet("pv") != "" ? getGet("pv") : 1));
     $objArraySectionIterator->setArraySection($this->getTopQueries($objArraySectionIterator->calculateStartPos(), $objArraySectionIterator->calculateEndPos()));
     $intI = 0;
     $arrLogs = array();
     $objUser = new class_module_user_user(class_session::getInstance()->getUserID());
     foreach ($objArraySectionIterator as $intKey => $arrOneLog) {
         if ($intI++ >= $objUser->getIntItemsPerPage()) {
             break;
         }
         $arrLogs[$intKey][0] = $intI;
         $arrLogs[$intKey][1] = $arrOneLog["search_log_query"];
         $arrLogs[$intKey][2] = $arrOneLog["hits"];
     }
     //Create a data-table
     $arrHeader = array();
     $arrHeader[0] = "#";
     $arrHeader[1] = $this->objLang->getLang("header_query", "search");
     $arrHeader[2] = $this->objLang->getLang("header_amount", "search");
     $strReturn .= $this->objToolkit->dataTable($arrHeader, $arrLogs);
     $strReturn .= $this->objToolkit->getPageview($objArraySectionIterator, "stats", uniStrReplace("class_stats_report_", "", get_class($this)));
     return $strReturn;
 }
コード例 #19
0
ファイル: class_link.php プロジェクト: jinshana/kajonacms
 /**
  * Internal helper to transform the passed params string into an array.
  * Extracts the systemid out of the string and updates the passed reference with the
  * systemid.
  *
  * @param string $strParams
  * @param string &$strSystemid
  * @return array
  */
 private static function parseParamsString($strParams, &$strSystemid = "")
 {
     $strParams = uniStrReplace("&amp;", "&", $strParams);
     //if given, remove first ampersand from params
     if (substr($strParams, 0, 1) == "&") {
         $strParams = substr($strParams, 1);
     }
     $arrParams = explode("&", $strParams);
     foreach ($arrParams as $strKey => &$strValue) {
         $arrEntry = explode("=", $strValue);
         if (count($arrEntry) == 2 && $arrEntry[0] == "systemid") {
             //encoded and sanitized systemid param TODO: add cve number or other identifier
             $strSystemid = $arrEntry[1];
             if (!validateSystemid($strSystemid) && $strSystemid != "%systemid%") {
                 $strSystemid = "";
             }
             unset($arrParams[$strKey]);
         } else {
             if ($strValue == "") {
                 unset($arrParams[$strKey]);
             }
         }
         if (count($arrEntry) == 2) {
             $arrEntry[1] = urlencode($arrEntry[1]);
         }
         $strValue = implode("=", $arrEntry);
     }
     return $arrParams;
 }
コード例 #20
0
ファイル: class_db_oci8.php プロジェクト: jinshana/kajonacms
 /**
  * Does as cache-lookup for prepared statements.
  * Reduces the number of recompiles at the db-side.
  *
  * @param string $strQuery
  *
  * @return resource
  * @since 3.4
  */
 private function getParsedStatement($strQuery)
 {
     if (uniStripos($strQuery, "select") !== false) {
         $strQuery = uniStrReplace(array(" as ", " AS "), array(" ", " "), $strQuery);
     }
     $objStatement = oci_parse($this->linkDB, $strQuery);
     return $objStatement;
 }
コード例 #21
0
 /**
  * @param string $strImage
  * @return void
  */
 public function setStrImage($strImage)
 {
     $strImage = uniStrReplace(_webpath_, "", $strImage);
     $this->strImage = $strImage;
 }
コード例 #22
0
 /**
  * Saves or updates a navi-point
  *
  * @return string "" in case of success
  * @permissions edit
  */
 protected function actionSaveNaviPoint()
 {
     $strReturn = "";
     $objPoint = new class_module_navigation_point();
     if ($this->getParam("mode") == "edit") {
         $objPoint = new class_module_navigation_point($this->getSystemid());
     }
     $objForm = $this->getPointAdminForm($objPoint);
     if (!$objForm->validateForm()) {
         return $this->actionNewNaviPoint($this->getParam("mode"), $objForm);
     }
     $objForm->updateSourceObject();
     $strExternalLink = $objPoint->getStrPageE();
     $strExternalLink = uniStrReplace(_indexpath_, "_indexpath_", $strExternalLink);
     $strExternalLink = uniStrReplace(_webpath_, "_webpath_", $strExternalLink);
     $objPoint->setStrPageE($strExternalLink);
     if ($this->getParam("mode") == "new") {
         $objPoint->updateObjectToDb($this->getSystemid());
     } else {
         $objPoint->updateObjectToDb();
     }
     //Flush pages cache
     $this->flushCompletePagesCache();
     $this->adminReload(class_link::getLinkAdminHref($this->getArrModule("modul"), "list", "systemid=" . $objPoint->getPrevId() . ($this->getParam("pe") == "" ? "" : "&peClose=" . $this->getParam("pe"))));
     return $strReturn;
 }
 /**
  * Gets the version of the package currently installed.
  * If not installed, null should be returned instead.
  *
  * @return string|null
  */
 public function getVersionInstalled()
 {
     if (class_module_system_module::getModuleByName("pages") === null) {
         return null;
     }
     $objElement = class_module_pages_element::getElement(uniStrReplace("element_", "", $this->objMetadata->getStrTitle()));
     if ($objElement !== null) {
         return $objElement->getStrVersion();
     } else {
         return null;
     }
 }
コード例 #24
0
ファイル: class_logger.php プロジェクト: jinshana/kajonacms
 /**
  * Adds a row to the current log
  * For $intLevel use on of the static level provided by this class
  *
  * @param string $strMessage
  * @param int $intLevel
  * @param bool $bitSkipSessionData
  *
  * @return void
  */
 public function addLogRow($strMessage, $intLevel, $bitSkipSessionData = false)
 {
     $arrStack = debug_backtrace();
     //check, if there someting to write
     if ($this->intLogLevel == 0) {
         return;
     }
     //errors in level >=1
     if ($intLevel == self::$levelError && $this->intLogLevel < 1) {
         return;
     }
     //warnings in level >=2
     if ($intLevel == self::$levelWarning && $this->intLogLevel < 2) {
         return;
     }
     //infos in level >=3
     if ($intLevel == self::$levelInfo && $this->intLogLevel < 3) {
         return;
     }
     //a log row has the following scheme:
     // YYYY-MM-DD HH:MM:SS LEVEL USERID (USERNAME) MESSAGE
     $strDate = strftime("%Y-%m-%d %H:%M:%S", time());
     $strLevel = "";
     if ($intLevel == self::$levelError) {
         $strLevel = "ERROR";
     } elseif ($intLevel == self::$levelInfo) {
         $strLevel = "INFO";
     } elseif ($intLevel == self::$levelWarning) {
         $strLevel = "WARNING";
     }
     $strSessid = "";
     if (!$bitSkipSessionData && class_carrier::getInstance()->getObjSession()->getBitLazyLoaded()) {
         $strSessid = class_carrier::getInstance()->getObjSession()->getInternalSessionId();
         $strSessid .= " (" . class_carrier::getInstance()->getObjSession()->getUsername() . ")";
     }
     $strMessage = uniStrReplace(array("\r", "\n"), array(" ", " "), $strMessage);
     $strFileInfo = "";
     if (isset($arrStack[1]) && isset($arrStack[1]["file"])) {
         $strFileInfo = basename($arrStack[1]["file"]) . ":" . $arrStack[1]["function"] . ":" . $arrStack[1]["line"];
     }
     $strText = $strDate . " " . $strLevel . " " . $strSessid . " " . $strFileInfo . " " . $strMessage . "\r\n";
     $handle = fopen(_realpath_ . "/project/log/" . $this->strFilename, "a");
     fwrite($handle, $strText);
     fclose($handle);
 }
コード例 #25
0
 /**
  * Returns the core-folder the passed file is located in, e.g. core or core2.
  * Pass a full file-path, so the absolute path and filename.
  *
  * @param string $strPath
  * @param bool $bitPrependRealpath
  *
  * @return string
  */
 public function getCorePathForPath($strPath, $bitPrependRealpath = false)
 {
     $strPath = uniStrReplace(_realpath_ . "/", "", $strPath);
     $strPath = uniSubstr($strPath, 0, uniStrpos($strPath, "/"));
     return ($bitPrependRealpath ? _realpath_ : "") . "/" . $strPath;
 }
コード例 #26
0
*   (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 "| Analyze external packages                                                     |\n";
echo "+-------------------------------------------------------------------------------+\n";
echo "Searching for *_external.json files...\n\n";
$objRegex = new RegexIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator(_realpath_)), '/^.+_external\\.json/i', RecursiveRegexIterator::GET_MATCH);
$arrExternals = array();
foreach ($objRegex as $arrOne) {
    $objContent = json_decode(file_get_contents($arrOne[0]));
    $strSimplePath = uniStrReplace(_realpath_, "", $arrOne[0]);
    if (is_array($objContent)) {
        foreach ($objContent as $objOneExternal) {
            $objOneExternal->path = $strSimplePath;
            $arrExternals[] = $objOneExternal;
        }
    } else {
        $objContent->path = $strSimplePath;
        $arrExternals[] = $objContent;
    }
}
usort($arrExternals, function ($objOneEntry, $objSecondEntry) {
    return strcmp($objOneEntry->name, $objSecondEntry->name);
});
$arrHeader = array();
$arrHeader[] = "Component";
コード例 #27
0
ファイル: class_lang.php プロジェクト: jinshana/kajonacms
 /**
  *
  * Internal helper to fill parametrized properties.
  *
  * @param $strProperty
  * @param $arrParameters
  *
  * @return mixed
  */
 public function replaceParams($strProperty, $arrParameters)
 {
     foreach ($arrParameters as $intKey => $strParameter) {
         $strProperty = uniStrReplace("{" . $intKey . "}", $strParameter, $strProperty);
     }
     return $strProperty;
 }
コード例 #28
0
ファイル: class_db.php プロジェクト: jinshana/kajonacms
 /**
  * Dumps the current db
  * Takes care of holding just the defined number of dumps in the filesystem, defined by _system_dbdump_amount_
  *
  * @param array $arrTablesToExclude specify a set of tables not to be included in the dump
  *
  * @return bool
  */
 public function dumpDb($arrTablesToExclude = array())
 {
     if (!$this->bitConnected) {
         $this->dbconnect();
     }
     // Check, how many dumps to keep
     $objFilesystem = new class_filesystem();
     $arrFiles = $objFilesystem->getFilelist(_projectpath_ . "/dbdumps/", array(".sql", ".gz"));
     while (count($arrFiles) >= class_module_system_setting::getConfigValue("_system_dbdump_amount_")) {
         $strFile = array_shift($arrFiles);
         if (!$objFilesystem->fileDelete(_projectpath_ . "/dbdumps/" . $strFile)) {
             class_logger::getInstance(class_logger::DBLOG)->addLogRow("Error deleting old db-dumps", class_logger::$levelWarning);
             return false;
         }
         $arrFiles = $objFilesystem->getFilelist(_projectpath_ . "/dbdumps/", array(".sql", ".gz"));
     }
     $strTargetFilename = _projectpath_ . "/dbdumps/dbdump_" . time() . ".sql";
     $arrTables = $this->getTables();
     $arrTablesFinal = array();
     if (count($arrTablesToExclude) > 0) {
         foreach ($arrTables as $strOneTable) {
             if (!in_array(uniStrReplace(_dbprefix_, "", $strOneTable), $arrTablesToExclude)) {
                 $arrTablesFinal[] = $strOneTable;
             }
         }
     } else {
         $arrTablesFinal = $arrTables;
     }
     $bitDump = $this->objDbDriver->dbExport($strTargetFilename, $arrTablesFinal);
     if ($bitDump == true) {
         $objGzip = new class_gzip();
         try {
             if (!$objGzip->compressFile($strTargetFilename, true)) {
                 class_logger::getInstance(class_logger::DBLOG)->addLogRow("Failed to compress (gzip) the file " . basename($strTargetFilename) . "", class_logger::$levelWarning);
             }
         } catch (class_exception $objExc) {
             $objExc->processException();
         }
     }
     if ($bitDump) {
         class_logger::getInstance(class_logger::DBLOG)->addLogRow("DB-Dump " . basename($strTargetFilename) . " created", class_logger::$levelInfo);
     } else {
         class_logger::getInstance(class_logger::DBLOG)->addLogRow("Error creating " . basename($strTargetFilename), class_logger::$levelError);
     }
     return $bitDump;
 }
コード例 #29
0
 /**
  * Returns all eventes in json-format.
  * Expects the params start & end.
  * @xml
  * @return string
  * @permissions view
  */
 protected function actionGetJsonEvents()
 {
     $arrPrintableEvents = array();
     $objStartDate = null;
     $objEndDate = null;
     if ($this->getParam("start") != "" && $this->getParam("end") != "") {
         $objStartDate = new class_date($this->getParam("start"));
         $objEndDate = new class_date($this->getParam("end"));
     }
     $arrEvents = class_module_eventmanager_event::getAllEvents(false, false, $objStartDate, $objEndDate, true);
     foreach ($arrEvents as $objOneEvent) {
         if ($objOneEvent->rightView()) {
             $arrSingleEvent = array();
             $arrSingleEvent["id"] = $objOneEvent->getSystemid();
             $arrSingleEvent["title"] = $objOneEvent->getStrTitle();
             $arrSingleEvent["start"] = $objOneEvent->getObjStartDate()->getTimeInOldStyle();
             $arrSingleEvent["end"] = $objOneEvent->getObjEndDate() != null ? $objOneEvent->getObjEndDate()->getTimeInOldStyle() : "";
             $arrSingleEvent["url"] = uniStrReplace("&amp;", "&", class_link::getLinkPortalHref($this->getParam("page"), "", "eventDetails", "", $objOneEvent->getSystemid(), "", $objOneEvent->getStrTitle()));
             $arrPrintableEvents[] = $arrSingleEvent;
         }
     }
     class_response_object::getInstance()->setStrResponseType(class_http_responsetypes::STR_TYPE_JSON);
     return json_encode($arrPrintableEvents);
 }
コード例 #30
0
 /**
  * Creates the code surrounding the element.
  * Creates the "entry" to the portal-editor
  *
  * @param string $strContent elements' output
  * @param string $strSystemid elements' systemid
  * @param array $arrConfig : pe_module, pe_action, [pe_action_new, pe_action_new_params]
  * @param string $strElement
  *
  * @return string
  * @static
  */
 public static function addPortalEditorCode($strContent, $strSystemid, $arrConfig, $strElement = "")
 {
     $strReturn = "";
     if (!validateSystemid($strSystemid)) {
         return $strContent;
     }
     $objInstance = class_objectfactory::getInstance()->getObject($strSystemid);
     if ($objInstance == null || class_module_system_setting::getConfigValue("_pages_portaleditor_") != "true") {
         return $strContent;
     }
     if (!class_carrier::getInstance()->getObjSession()->isAdmin() || !$objInstance->rightEdit($strSystemid) || class_carrier::getInstance()->getObjSession()->getSession("pe_disable") == "true") {
         return $strContent;
     }
     //switch the text-language temporary
     $strPortalLanguage = class_carrier::getInstance()->getObjLang()->getStrTextLanguage();
     class_carrier::getInstance()->getObjLang()->setStrTextLanguage(class_carrier::getInstance()->getObjSession()->getAdminLanguage());
     //fetch the language to set the correct admin-lang
     $objLanguages = new class_module_languages_language();
     $strAdminLangParam = "&language=" . $objLanguages->getPortalLanguage();
     $strModule = "pages_content";
     $strAction = "edit";
     //param-inits ---------------------------------------
     //Generate url to the admin-area
     if ($arrConfig["pe_module"] != "") {
         $strModule = $arrConfig["pe_module"];
     }
     //---------------------------------------------------
     //---------------------------------------------------
     //Link to create a new entry - only for modules, so not the page-content directly!
     $strNewLink = "";
     if ($strModule != "pages_content") {
         //Use Module-config to generate link
         if (isset($arrConfig["pe_action_new"]) && $arrConfig["pe_action_new"] != "") {
             $strNewUrl = class_link::getLinkAdminHref($strModule, $arrConfig["pe_action_new"], $arrConfig["pe_action_new_params"] . $strAdminLangParam . "&pe=1");
             $strNewLink = "<a href=\"#\" onclick=\"KAJONA.admin.portaleditor.openDialog('" . $strNewUrl . "'); return false;\">" . class_carrier::getInstance()->getObjLang()->getLang("pe_new_old", "pages") . "</a>";
         }
     }
     //---------------------------------------------------
     //Link to edit current element
     $strEditLink = "";
     //standard: pages_content.
     if ($strModule == "pages_content") {
         $arrConfig["pe_action_edit"] = $strAction;
         $arrConfig["pe_action_edit_params"] = "&systemid=" . $strSystemid;
     }
     //Use Module-config to generate link
     if (isset($arrConfig["pe_action_edit"]) && $arrConfig["pe_action_edit"] != "") {
         $strEditUrl = class_link::getLinkAdminHref($strModule, $arrConfig["pe_action_edit"], $arrConfig["pe_action_edit_params"] . $strAdminLangParam . "&pe=1");
         $strEditLink = "<a href=\"#\" onclick=\"KAJONA.admin.portaleditor.openDialog('" . $strEditUrl . "'); return false;\">" . class_carrier::getInstance()->getObjLang()->getLang("pe_edit", "pages") . "</a>";
     }
     //---------------------------------------------------
     //link to copy an element to the same or another placeholder
     $strCopyLink = "";
     //standard: pages_content.
     if ($strModule == "pages_content") {
         $arrConfig["pe_action_copy"] = "copyElement";
         $arrConfig["pe_action_copy_params"] = "&systemid=" . $strSystemid;
     }
     //Use Module-config to generate link
     if (isset($arrConfig["pe_action_copy"]) && $arrConfig["pe_action_copy"] != "") {
         $strCopyUrl = class_link::getLinkAdminHref($strModule, $arrConfig["pe_action_copy"], $arrConfig["pe_action_copy_params"] . $strAdminLangParam . "&pe=1");
         $strCopyLink = "<a href=\"#\" onclick=\"KAJONA.admin.portaleditor.openDialog('" . $strCopyUrl . "'); return false;\">" . class_carrier::getInstance()->getObjLang()->getLang("pe_copy", "pages") . "</a>";
     }
     //---------------------------------------------------
     //link to delete the current element
     $strDeleteLink = "";
     if ($objInstance->rightDelete()) {
         //standard: pages_content.
         if ($strModule == "pages_content") {
             $arrConfig["pe_action_delete"] = "deleteElementFinal";
             $arrConfig["pe_action_edit_params"] = "&systemid=" . $strSystemid;
             $strCallback = " function() { delDialog.hide(); KAJONA.admin.portaleditor.deleteElementData('{$strSystemid}'); return false; } ";
         } else {
             if (isset($arrConfig["pe_action_delete"]) && $arrConfig["pe_action_delete"] != "") {
                 $strDeleteUrl = class_link::getLinkAdminHref($strModule, $arrConfig["pe_action_delete"], $arrConfig["pe_action_edit_params"] . $strAdminLangParam . "&pe=1");
                 $strCallback = " function() { delDialog.hide(); KAJONA.admin.portaleditor.openDialog('{$strDeleteUrl}'); return false; } ";
             }
         }
         if (isset($arrConfig["pe_action_delete"]) && $arrConfig["pe_action_delete"] != "") {
             $strElementName = uniStrReplace(array('\''), array('\\\''), $objInstance->getStrDisplayName());
             $strQuestion = uniStrReplace("%%element_name%%", htmlToString($strElementName, true), class_carrier::getInstance()->getObjLang()->getLang("commons_delete_record_question", "system"));
             $strDeleteLink = class_link::getLinkAdminManual("href=\"#\" onclick=\"javascript:delDialog.setTitle('" . class_carrier::getInstance()->getObjLang()->getLang("dialog_deleteHeader", "system") . "'); delDialog.setContent('" . $strQuestion . "', '" . class_carrier::getInstance()->getObjLang()->getLang("dialog_deleteButton", "system") . "',  " . $strCallback . "); delDialog.init(); return false;\"", class_carrier::getInstance()->getObjLang()->getLang("commons_delete", "system"), class_carrier::getInstance()->getObjLang()->getLang("commons_delete", "system"));
         }
     }
     //---------------------------------------------------
     //link to drag n drop element
     //TODO: check if there are more than one elements in current placeholder before showing shift buttons
     $strMoveHandle = "";
     if ($strModule == "pages_content") {
         $strMoveHandle = "<i href=\"#\" class=\"moveHandle fa fa-arrows\" title=\"" . class_carrier::getInstance()->getObjLang()->getLang("pe_move", "pages") . "\" rel=\"tooltip\"></i>";
     }
     //---------------------------------------------------
     //link to set element inactive
     $strSetInactiveLink = "";
     //standard: pages_content.
     if ($strModule == "pages_content") {
         $arrConfig["pe_action_setStatus"] = "elementStatus";
         $arrConfig["pe_action_setStatus_params"] = "&systemid=" . $strSystemid;
     }
     //Use Module-config to generate link
     if (isset($arrConfig["pe_action_setStatus"]) && $arrConfig["pe_action_setStatus"] != "") {
         $strSetInactiveUrl = class_link::getLinkAdminHref($strModule, $arrConfig["pe_action_setStatus"], $arrConfig["pe_action_setStatus_params"] . $strAdminLangParam . "&pe=1");
         $strSetInactiveLink = "<a href=\"#\" onclick=\"KAJONA.admin.portaleditor.openDialog('" . $strSetInactiveUrl . "'); return false;\">" . class_carrier::getInstance()->getObjLang()->getLang("pe_setinactive", "pages") . "</a>";
     }
     //---------------------------------------------------
     // layout generation
     $strReturn .= class_carrier::getInstance()->getObjToolkit("portal")->getPeActionToolbar($strSystemid, array($strMoveHandle, $strNewLink, $strEditLink, $strCopyLink, $strDeleteLink, $strSetInactiveLink), $strContent, $strElement);
     //reset the portal texts language
     class_carrier::getInstance()->getObjLang()->setStrTextLanguage($strPortalLanguage);
     return $strReturn;
 }