/**
  * In nearly all cases, the additional info is rendered left to the action-icons.
  *
  * @return string
  */
 public function getStrAdditionalInfo()
 {
     if ($this->rightRight1()) {
         return $this->getLang("user_logins", "user") . " " . $this->getIntLogins() . " " . $this->getLang("user_lastlogin", "user") . " " . timeToString($this->getIntLastLogin(), false);
     }
     return "";
 }
 /**
  * Looks up the last modified-date of the current page
  *
  * @return string the prepared html-output
  */
 public function loadData()
 {
     $strReturn = "";
     //load the current page
     $objPage = class_module_pages_page::getPageByName($this->getPagename());
     if ($objPage != null) {
         $strReturn .= $this->getLang("lastmodified") . timeToString($objPage->getIntLmTime());
     }
     return $strReturn;
 }
Example #3
0
 /**
  * Writes the footer for a single page.
  * Use the passed $objPdf to access the pdf.
  *
  * @param class_pdf_tcpdf $objPdf
  * @return void
  */
 public function writeFooter($objPdf)
 {
     // Position at 1.5 cm from bottom
     $objPdf->SetY(-10);
     // Set font
     $objPdf->SetFont('helvetica', 'I', 8);
     // Page number
     $objPdf->Cell(0, 0, $objPdf->getAliasNumPage() . '/' . $objPdf->getAliasNbPages(), 'T', 0, 'R');
     $objPdf->SetY(-10);
     //date
     $objPdf->Cell(0, 0, '' . timeToString(time(), false) . $this->strFooterAddon, '0', 0, 'L');
 }
 /**
  * Returns the contents of the info-block
  *
  * @return mixed
  */
 public function getArrContent()
 {
     $strOldTimezone = date_default_timezone_get();
     $objLang = class_carrier::getInstance()->getObjLang();
     $arrReturn = array();
     $arrReturn[] = array($objLang->getLang("time_phptimestamp", "system"), time());
     $arrReturn[] = array($objLang->getLang("time_systemtimezone", "system"), date_default_timezone_get());
     $arrReturn[] = array($objLang->getLang("time_localsystemtime", "system"), timeToString(time()));
     date_default_timezone_set("UTC");
     $arrReturn[] = array($objLang->getLang("time_systemtime_UTC", "system"), date('Y-m-d H:i:s'));
     $arrReturn[] = array($objLang->getLang("time_systemzone_manual_setting", "system"), class_module_system_setting::getConfigValue("_system_timezone_"));
     date_default_timezone_set($strOldTimezone);
     return $arrReturn;
 }
Example #5
0
 function getDefaults()
 {
     $therecord = parent::getDefaults();
     $therecord["crontab"] = "*::*::*::*::*";
     $therecord["min"] = "*";
     $therecord["hrs"] = "*";
     $therecord["date"] = "*";
     $therecord["mo"] = "*";
     $therecord["day"] = "*";
     $therecord["startdate"] = dateToString(mktime(), "SQL");
     $therecord["starttime"] = sqlTimeFromString(timeToString(time()));
     $therecord["enddate"] = "";
     $therecord["endtime"] = "";
     $therecord["scripttype"] = "job";
     return $therecord;
 }
 /**
  * Loads the feed and displays it
  *
  * @return string the prepared html-output
  */
 public function loadData()
 {
     $strReturn = "";
     //Load all files in the folder
     $objFilesystem = new class_filesystem();
     $arrFiles = $objFilesystem->getFilelist($this->arrElementData["char2"]);
     $strWrapperTemplateID = $this->objTemplate->readTemplate("/element_directorybrowser/" . $this->arrElementData["char1"], "directorybrowser_wrapper");
     $strEntryTemplateID = $this->objTemplate->readTemplate("/element_directorybrowser/" . $this->arrElementData["char1"], "directorybrowser_entry");
     $strContent = "";
     foreach ($arrFiles as $strOneFile) {
         $arrDetails = $objFilesystem->getFileDetails($this->arrElementData["char2"] . "/" . $strOneFile);
         $arrTemplate = array();
         $arrTemplate["file_name"] = $arrDetails["filename"];
         $arrTemplate["file_href"] = _webpath_ . $this->arrElementData["char2"] . "/" . $strOneFile;
         $arrTemplate["file_date"] = timeToString($arrDetails["filechange"]);
         $arrTemplate["file_size"] = bytesToString($arrDetails["filesize"]);
         $strContent .= $this->fillTemplate($arrTemplate, $strEntryTemplateID);
     }
     $strReturn .= $this->fillTemplate(array("files" => $strContent), $strWrapperTemplateID);
     return $strReturn;
 }
 /**
  * This method is called, when the widget should generate it's content.
  * Return the complete content using the methods provided by the base class.
  * Do NOT use the toolkit right here!
  *
  * @return string
  */
 public function getWidgetOutput()
 {
     $strReturn = "";
     if (!class_module_system_module::getModuleByName("pages")->rightView()) {
         return $this->getLang("commons_error_permissions");
     }
     $intMax = $this->getFieldValue("nrofrows");
     if ($intMax < 0) {
         $intMax = 1;
     }
     /** @var class_module_pages_page[] $arrRecords */
     $arrRecords = class_module_system_common::getLastModifiedRecords($intMax, false, "class_module_pages_page");
     foreach ($arrRecords as $objPage) {
         if ($objPage->rightEdit()) {
             $strReturn .= $this->widgetText(class_link::getLinkAdmin("pages_content", "list", "&systemid=" . $objPage->getSystemid(), $objPage->getStrDisplayName()));
         } else {
             $strReturn .= $this->widgetText($objPage->getStrDisplayName());
         }
         $strReturn .= $this->widgetText("&nbsp; &nbsp; " . timeToString($objPage->getIntLmTime()) . "");
     }
     return $strReturn;
 }
 /**
  * @see interface_admin_systemtask::getAdminForm()
  * @return string
  */
 public function getAdminForm()
 {
     $strReturn = "";
     //show dropdown to select db-dump
     $objFilesystem = new class_filesystem();
     $arrFiles = $objFilesystem->getFilelist(_projectpath_ . "/dbdumps/", array(".sql", ".gz"));
     $arrOptions = array();
     foreach ($arrFiles as $strOneFile) {
         $arrDetails = $objFilesystem->getFileDetails(_projectpath_ . "/dbdumps/" . $strOneFile);
         $strTimestamp = "";
         if (uniStrpos($strOneFile, "_") !== false) {
             $strTimestamp = uniSubstr($strOneFile, uniStrrpos($strOneFile, "_") + 1, uniStrpos($strOneFile, ".") - uniStrrpos($strOneFile, "_"));
         }
         if (uniStrlen($strTimestamp) > 9 && is_numeric($strTimestamp)) {
             $arrOptions[$strOneFile] = $strOneFile . " (" . bytesToString($arrDetails["filesize"]) . ")" . "<br />" . $this->getLang("systemtask_dbimport_datefilename") . " " . timeToString($strTimestamp) . "<br />" . $this->getLang("systemtask_dbimport_datefileinfo") . " " . timeToString($arrDetails['filechange']);
         } else {
             $arrOptions[$strOneFile] = $strOneFile . " (" . bytesToString($arrDetails["filesize"]) . ")" . "<br />" . $this->getLang("systemtask_dbimport_datefileinfo") . " " . timeToString($arrDetails['filechange']);
         }
     }
     $strReturn .= $this->objToolkit->formInputRadiogroup("dbImportFile", $arrOptions, $this->getLang("systemtask_dbimport_file"));
     return $strReturn;
 }
 /**
  * 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 . "";
 }
Example #10
0
 /**
  *  function prepareFieldForSQL
  *
  *  Given a value, and field type, prepare the
  *  value for SQL insertion (replacing nul with the SQL string NULL,
  *  and typeing variables)
  *
  *  @param string/int $value to be prepared.
  *  @param string $type mysql field type
  *  @param string $flags A list of flags seperated by spaces (" ").
  */
 function prepareFieldForSQL($value, $type, $flags)
 {
     switch ($type) {
         case "blob":
         case "string":
             if ($value === "" or $value === NULL) {
                 if (strpos($flags, "not_null") === false) {
                     $value = NULL;
                 } else {
                     $value = "''";
                 }
             } else {
                 $value = "'" . $value . "'";
             }
             break;
         case "real":
             if ($value === "" or $value === NULL) {
                 if (strpos($flags, "not_null") === false) {
                     $value = NULL;
                 } else {
                     $value = 0;
                 }
             } else {
                 $value = (double) $value;
             }
             break;
         case "int":
             if ($value === "" or $value === NULL) {
                 if (strpos($flags, "not_null") === false) {
                     $value = NULL;
                 } else {
                     $value = 0;
                 }
             } else {
                 $value = (int) $value;
             }
             break;
         case "date":
             if ($value === "" or $value === NULL) {
                 if (strpos($flags, "not_null") === false) {
                     $value = NULL;
                 } else {
                     $value = "'" . dateToString(mktime(), "SQL") . "'";
                 }
             } else {
                 $value = "'" . sqlDateFromString($value, $this->dateFormat) . "'";
             }
             break;
         case "time":
             if ($value === "" or $value === NULL) {
                 if (strpos($flags, "not_null") === false) {
                     $value = NULL;
                 } else {
                     $value = "'" . timeToString(mktime(), "SQL") . "'";
                 }
             } else {
                 $value = "'" . sqlTimeFromString($value, $this->timeFormat) . "'";
             }
             break;
         case "year":
             if ($value === "" or $value === NULL) {
                 if (strpos($flags, "not_null") === false) {
                     $value = NULL;
                 } else {
                     $value = @strftime("%Y");
                 }
             }
             break;
         case "datetime":
         case "timestamp":
             if ($value === "" or $value === NULL) {
                 if (strpos($flags, "not_null") === false) {
                     $value = NULL;
                 } else {
                     $value = "'" . dateToString(mktime(), "SQL") . " " . timeToString(mktime(), "24 Hour") . "'";
                 }
             } else {
                 $datetimearray = explode(" ", $value);
                 $date = null;
                 $time = null;
                 //If the value can be split by spaces we assume we
                 // are looking at a "date time"
                 if (count($datetimearray) > 1) {
                     $date = sqlDateFromString($datetimearray[0], $this->dateFormat);
                     //times can have spaces... so we need
                     //to resemble in some cases.
                     if (count($datetimearray) > 2) {
                         $datetimearray[1] = $datetimearray[1] . " " . $datetimearray[2];
                     }
                     $time = sqlTimeFromString($datetimearray[1], $this->timeFormat);
                 }
                 //endif
                 //If we don't have a date, perhaps only a date was passed
                 if (!$date) {
                     $date = sqlDateFromString($value, $this->dateFormat);
                     //still no date?, then assume only a time was passed,
                     // so we need to set the time to the deafult
                     // date.
                     if (!$date) {
                         $date = "0000-00-00";
                     }
                 }
                 //endif
                 //if we don't have a time, let's try the getting the
                 //time from the full value.
                 if (!$time) {
                     $time = sqlTimeFromString($value, $this->timeFormat);
                 }
                 $value = "'" . trim($date . " " . $time) . "'";
             }
             //end if
             break;
         case "password":
             $value = "ENCODE('" . $value . "','" . ENCRYPTION_SEED . "')";
             break;
     }
     //end switch
     if ($value === NULL) {
         $value = "NULL";
     }
     return $value;
 }
 /**
  * Loads the feed and displays it
  *
  * @return string the prepared html-output
  */
 public function loadData()
 {
     $strReturn = "";
     $strFeed = "";
     try {
         $objRemoteloader = new class_remoteloader();
         if (uniStrtolower(uniSubstr($this->arrElementData["char2"], 0, 8)) == "https://") {
             $objRemoteloader->setStrProtocolHeader("https://");
         }
         $this->arrElementData["char2"] = uniStrReplace("&amp;", "&", $this->arrElementData["char2"]);
         $objRemoteloader->setStrHost(uniStrReplace(array("http://", "https://"), "", $this->arrElementData["char2"]));
         $objRemoteloader->setIntPort(0);
         $strFeed = $objRemoteloader->getRemoteContent();
     } catch (class_exception $objExeption) {
         $strFeed = "";
     }
     $strFeedTemplateID = $this->objTemplate->readTemplate("/element_rssfeed/" . $this->arrElementData["char1"], "rssfeed_feed");
     $strPostTemplateID = $this->objTemplate->readTemplate("/element_rssfeed/" . $this->arrElementData["char1"], "rssfeed_post");
     $strContent = "";
     $arrTemplate = array();
     if (uniStrlen($strFeed) == 0) {
         $strContent = $this->getLang("rssfeed_errorloading");
     } else {
         $objXmlparser = new class_xml_parser();
         $objXmlparser->loadString($strFeed);
         $arrFeed = $objXmlparser->xmlToArray();
         if (count($arrFeed) >= 1) {
             //rss feed
             if (isset($arrFeed["rss"])) {
                 $arrTemplate["feed_title"] = $arrFeed["rss"][0]["channel"][0]["title"][0]["value"];
                 $arrTemplate["feed_link"] = $arrFeed["rss"][0]["channel"][0]["link"][0]["value"];
                 $arrTemplate["feed_description"] = $arrFeed["rss"][0]["channel"][0]["description"][0]["value"];
                 $intCounter = 0;
                 if (isset($arrFeed["rss"][0]["channel"][0]["item"]) && is_array($arrFeed["rss"][0]["channel"][0]["item"])) {
                     foreach ($arrFeed["rss"][0]["channel"][0]["item"] as $arrOneItem) {
                         $strDate = isset($arrOneItem["pubDate"][0]["value"]) ? $arrOneItem["pubDate"][0]["value"] : "";
                         if ($strDate != "") {
                             $intDate = strtotime($strDate);
                             if ($intDate > 0) {
                                 $strDate = timeToString($intDate);
                             }
                         }
                         $arrMessage = array();
                         $arrMessage["post_date"] = $strDate;
                         $arrMessage["post_title"] = isset($arrOneItem["title"][0]["value"]) ? $arrOneItem["title"][0]["value"] : "";
                         $arrMessage["post_description"] = isset($arrOneItem["description"][0]["value"]) ? $arrOneItem["description"][0]["value"] : "";
                         $arrMessage["post_link"] = isset($arrOneItem["link"][0]["value"]) ? $arrOneItem["link"][0]["value"] : "";
                         $strContent .= $this->fillTemplate($arrMessage, $strPostTemplateID);
                         if (++$intCounter >= $this->arrElementData["int1"]) {
                             break;
                         }
                     }
                 } else {
                     $strContent = $this->getLang("rssfeed_noentry");
                 }
             }
             //atom feed
             if (isset($arrFeed["feed"]) && isset($arrFeed["feed"][0]["entry"])) {
                 $arrTemplate["feed_title"] = $arrFeed["feed"][0]["title"][0]["value"];
                 $arrTemplate["feed_link"] = $arrFeed["feed"][0]["link"][0]["attributes"]["href"];
                 $arrTemplate["feed_description"] = $arrFeed["feed"][0]["subtitle"][0]["value"];
                 $intCounter = 0;
                 if (isset($arrFeed["feed"][0]["entry"]) && is_array($arrFeed["feed"][0]["entry"])) {
                     foreach ($arrFeed["feed"][0]["entry"] as $arrOneItem) {
                         $strDate = isset($arrOneItem["updated"][0]["value"]) ? $arrOneItem["updated"][0]["value"] : "";
                         if ($strDate != "") {
                             $intDate = strtotime($strDate);
                             if ($intDate > 0) {
                                 $strDate = timeToString($intDate);
                             }
                         }
                         $arrMessage = array();
                         $arrMessage["post_date"] = $strDate;
                         $arrMessage["post_title"] = isset($arrOneItem["title"][0]["value"]) ? $arrOneItem["title"][0]["value"] : "";
                         $arrMessage["post_description"] = isset($arrOneItem["summary"][0]["value"]) ? $arrOneItem["summary"][0]["value"] : "";
                         $arrMessage["post_link"] = isset($arrOneItem["link"][0]["attributes"]["href"]) ? $arrOneItem["link"][0]["attributes"]["href"] : "";
                         $strContent .= $this->fillTemplate($arrMessage, $strPostTemplateID);
                         if (++$intCounter >= $this->arrElementData["int1"]) {
                             break;
                         }
                     }
                 } else {
                     $strContent = $this->getLang("rssfeed_noentry");
                 }
             }
         } else {
             $strContent = $this->getLang("rssfeed_errorparsing");
         }
     }
     $arrTemplate["feed_content"] = $strContent;
     $strReturn .= $this->fillTemplate($arrTemplate, $strFeedTemplateID);
     return $strReturn;
 }
 /**
  * In nearly all cases, the additional info is rendered left to the action-icons.
  *
  * @return string
  */
 public function getStrAdditionalInfo()
 {
     return timeToString($this->getIntGuestbookPostDate(), false) . " " . $this->getStrGuestbookPostEmail();
 }
Example #13
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 "| DATECONVERTER                                                                 |\n";
echo "|                                                                               |\n";
echo "+-------------------------------------------------------------------------------+\n";
echo "<form method=\"post\">";
echo "--- UNIX timestamp handling -----------------------------------------------------\n\n";
echo "integer to date: \n";
echo "\tinteger: <input type=\"text\" value=\"" . getPost("inttime") . "\" name=\"inttime\"/>";
echo "  --> " . timeToString(getPost("inttime")) . "\n";
echo "date to integer: \n";
echo "\tdate: d:<input type=\"text\" value=\"" . getPost("strday") . "\" name=\"strday\" size=\"2\" />";
echo " m:<input type=\"text\" value=\"" . getPost("strmonth") . "\" name=\"strmonth\" size=\"2\" />";
echo " y:<input type=\"text\" value=\"" . getPost("stryear") . "\" name=\"stryear\" size=\"4\" />";
echo "  --> " . strtotime(getPost("stryear") . "-" . getPost("strmonth") . "-" . getPost("strday")) . "\n";
echo "\n<input type=\"submit\" value=\"submit\" />\n";
echo "\n--- Kajona timestamp handling ---------------------------------------------------\n\n";
echo "integer to date: \n";
$objDateFromInt = new class_date();
$objDateFromInt->setTimeInOldStyle(getPost("kajonainttime"));
echo "\tinteger: <input type=\"text\" value=\"" . getPost("kajonainttime") . "\" name=\"kajonainttime\"/>";
echo "  --> " . $objDateFromInt . "\n";
$objDateFromInt = new class_date(getPost("kajonainttime"));
echo "\tinteger: <input type=\"text\" value=\"" . getPost("kajonainttime") . "\" name=\"kajonainttime\"/>";
echo "  --> " . $objDateFromInt . "\n";
 /**
  * Show a logbook of all downloads
  *
  * @return string
  * @permissions edit
  * @autoTestable
  */
 protected function actionLogbook()
 {
     $strReturn = "";
     $intNrOfRecordsPerPage = 25;
     $strReturn .= $this->objToolkit->getTextRow(class_link::getLinkAdmin($this->getArrModule("modul"), "logbookFlush", "", $this->getLang("action_logbook_flush"), "") . "<br />");
     $objLogbook = new class_module_mediamanager_logbook();
     $objArraySectionIterator = new class_array_section_iterator($objLogbook->getLogbookDataCount());
     $objArraySectionIterator->setIntElementsPerPage($intNrOfRecordsPerPage);
     $objArraySectionIterator->setPageNumber((int) ($this->getParam("pv") != "" ? $this->getParam("pv") : 1));
     $objArraySectionIterator->setArraySection($objLogbook->getLogbookData($objArraySectionIterator->calculateStartPos(), $objArraySectionIterator->calculateEndPos()));
     $arrLogs = array();
     foreach ($objArraySectionIterator as $intKey => $arrOneLog) {
         $arrLogs[$intKey][0] = $arrOneLog["downloads_log_id"];
         $arrLogs[$intKey][1] = timeToString($arrOneLog["downloads_log_date"]);
         $arrLogs[$intKey][2] = $arrOneLog["downloads_log_file"];
         $arrLogs[$intKey][3] = $arrOneLog["downloads_log_user"];
         $arrLogs[$intKey][4] = $arrOneLog["downloads_log_ip"];
         $strUtraceLinkMap = "href=\"http://www.utrace.de/ip-adresse/" . $arrOneLog["downloads_log_ip"] . "\" target=\"_blank\"";
         $strUtraceLinkText = "href=\"http://www.utrace.de/whois/" . $arrOneLog["downloads_log_ip"] . "\" target=\"_blank\"";
         if ($arrOneLog["downloads_log_ip"] != "127.0.0.1" && $arrOneLog["downloads_log_ip"] != "::1") {
             $arrLogs[$intKey][5] = class_link::getLinkAdminManual($strUtraceLinkMap, "", $this->getLang("login_utrace_showmap", "user"), "icon_earth") . " " . class_link::getLinkAdminManual($strUtraceLinkText, "", $this->getLang("login_utrace_showtext", "user"), "icon_text");
         } else {
             $arrLogs[$intKey][5] = class_adminskin_helper::getAdminImage("icon_earthDisabled", $this->getLang("login_utrace_noinfo", "user")) . " " . class_adminskin_helper::getAdminImage("icon_textDisabled", $this->getLang("login_utrace_noinfo", "user"));
         }
     }
     //Create a data-table
     $arrHeader = array();
     $arrHeader[0] = $this->getLang("header_id");
     $arrHeader[1] = $this->getLang("commons_date");
     $arrHeader[2] = $this->getLang("header_file");
     $arrHeader[3] = $this->getLang("header_user");
     $arrHeader[4] = $this->getLang("header_ip");
     $arrHeader[5] = $this->getLang("login_utrace", "user");
     $strReturn .= $this->objToolkit->dataTable($arrHeader, $arrLogs);
     $strReturn .= $this->objToolkit->getPageview($objArraySectionIterator, $this->getArrModule("modul"), "logbook");
     return $strReturn;
 }
 /**
  * @return string
  */
 public function getReport()
 {
     $strReturn = "";
     $arrLogsRaw = $this->getLogbookData();
     $arrLogs = array();
     $intI = 0;
     $objUser = new class_module_user_user(class_session::getInstance()->getUserID());
     foreach ($arrLogsRaw as $intKey => $arrOneLog) {
         if ($intI++ >= $objUser->getIntItemsPerPage()) {
             break;
         }
         $arrLogs[$intKey][0] = $intI;
         $arrLogs[$intKey][1] = $arrOneLog["downloads_log_id"];
         $arrLogs[$intKey][2] = timeToString($arrOneLog["downloads_log_date"]);
         $arrLogs[$intKey][3] = $arrOneLog["downloads_log_file"];
         $arrLogs[$intKey][4] = $arrOneLog["downloads_log_user"];
         $arrLogs[$intKey][5] = $arrOneLog["stats_hostname"] != null ? $arrOneLog["stats_hostname"] : $arrOneLog["downloads_log_ip"];
     }
     //Create a data-table
     $arrHeader = array();
     $arrHeader[0] = "#";
     $arrHeader[1] = $this->objTexts->getLang("header_id", "mediamanager");
     $arrHeader[2] = $this->objTexts->getLang("commons_date", "mediamanager");
     $arrHeader[3] = $this->objTexts->getLang("header_file", "mediamanager");
     $arrHeader[4] = $this->objTexts->getLang("header_user", "mediamanager");
     $arrHeader[5] = $this->objTexts->getLang("header_ip", "mediamanager");
     $strReturn .= $this->objToolkit->dataTable($arrHeader, $arrLogs);
     return $strReturn;
 }
 /**
  * Adds the portal-editor code to the current page-output - if all requirements are given
  *
  * @param class_module_pages_page $objPageData
  * @param bool $bitEditPermissionOnMasterPage
  * @param string $strPageContent
  *
  * @return string
  */
 private function renderPortalEditorCode(class_module_pages_page $objPageData, $bitEditPermissionOnMasterPage, $strPageContent)
 {
     //add the portaleditor toolbar
     if (class_module_system_setting::getConfigValue("_pages_portaleditor_") == "false") {
         return $strPageContent;
     }
     if (!$this->objSession->isAdmin()) {
         return $strPageContent;
     }
     if (!$objPageData->rightEdit() && !$bitEditPermissionOnMasterPage) {
         return $strPageContent;
     }
     class_adminskin_helper::defineSkinWebpath();
     //save back the current portal text language and set the admin-one
     $strPortalLanguage = class_carrier::getInstance()->getObjLang()->getStrTextLanguage();
     class_carrier::getInstance()->getObjLang()->setStrTextLanguage($this->objSession->getAdminLanguage());
     if ($this->objSession->getSession("pe_disable") != "true") {
         $strPeToolbar = "";
         $arrPeContents = array();
         $arrPeContents["pe_status_page_val"] = $objPageData->getStrName();
         $arrPeContents["pe_status_status_val"] = $objPageData->getIntRecordStatus() == 1 ? "active" : "inactive";
         $arrPeContents["pe_status_autor_val"] = $objPageData->getLastEditUser();
         $arrPeContents["pe_status_time_val"] = timeToString($objPageData->getIntLmTime(), false);
         $arrPeContents["pe_dialog_close_warning"] = $this->getLang("pe_dialog_close_warning", "pages");
         //Add an iconbar
         $arrPeContents["pe_iconbar"] = "";
         $arrPeContents["pe_iconbar"] .= class_link::getLinkAdmin("pages_content", "list", "&systemid=" . $objPageData->getSystemid() . "&language=" . $strPortalLanguage, $this->getLang("pe_icon_edit"), $this->getLang("pe_icon_edit", "pages"), "icon_page");
         $arrPeContents["pe_iconbar"] .= "&nbsp;";
         $strEditUrl = class_link::getLinkAdminHref("pages", "editPage", "&systemid=" . $objPageData->getSystemid() . "&language=" . $strPortalLanguage . "&pe=1");
         $arrPeContents["pe_iconbar"] .= "<a href=\"#\" onclick=\"KAJONA.admin.portaleditor.openDialog('" . $strEditUrl . "'); return false;\">" . class_adminskin_helper::getAdminImage("icon_edit", $this->getLang("pe_icon_page", "pages")) . "</a>";
         $arrPeContents["pe_iconbar"] .= "&nbsp;";
         $strEditUrl = class_link::getLinkAdminHref("pages", "newPage", "&systemid=" . $objPageData->getSystemid() . "&language=" . $strPortalLanguage . "&pe=1");
         $arrPeContents["pe_iconbar"] .= "<a href=\"#\" onclick=\"KAJONA.admin.portaleditor.openDialog('" . $strEditUrl . "'); return false;\">" . class_adminskin_helper::getAdminImage("icon_new", $this->getLang("pe_icon_new", "pages")) . "</a>";
         $arrPeContents["pe_disable"] = "<a href=\"#\" onclick=\"KAJONA.admin.portaleditor.switchEnabled(false); return false;\" title=\"\">" . class_adminskin_helper::getAdminImage("icon_enabled", $this->getLang("pe_disable", "pages")) . "</a>";
         //Load portaleditor javascript (even if it's maybe already loaded in portal and init the ckeditor)
         $strTemplateInitID = $this->objTemplate->readTemplate("/elements.tpl", "wysiwyg_ckeditor_inits");
         $strSkinInit = $this->objTemplate->fillTemplate(array(), $strTemplateInitID);
         $strConfigFile = "'config_kajona_standard.js'";
         if (is_file(_realpath_ . "/project/admin/scripts/ckeditor/config_kajona_standard.js")) {
             $strConfigFile = "KAJONA_WEBPATH+'/project/admin/scripts/ckeditor/config_kajona_standard.js'";
         }
         $strPeToolbar .= "<script type='text/javascript'>\n                KAJONA.admin.lang.pe_rte_unsavedChanges = '" . $this->getLang("pe_rte_unsavedChanges", "pages") . "';\n\n                if(\$) {\n                    KAJONA.portal.loader.loadFile([\n                        '/core/module_pages/admin/scripts/kajona_portaleditor.js',\n                        '/core/module_system/admin/scripts/jqueryui/jquery-ui.custom.min.js',\n                        '/core/module_system/admin/scripts/jqueryui/css/smoothness/jquery-ui.custom.css'\n                    ], function() {\n                        KAJONA.admin.portaleditor.RTE.config = {\n                            language : '" . (class_session::getInstance()->getAdminLanguage() != "" ? class_session::getInstance()->getAdminLanguage() : "en") . "',\n                            filebrowserBrowseUrl : '" . uniStrReplace("&amp;", "&", class_link::getLinkAdminHref("folderview", "browserChooser", "&form_element=ckeditor")) . "',\n                            filebrowserImageBrowseUrl : '" . uniStrReplace("&amp;", "&", class_link::getLinkAdminHref("mediamanager", "folderContentFolderviewMode", "systemid=" . class_module_system_setting::getConfigValue("_mediamanager_default_imagesrepoid_") . "&form_element=ckeditor&bit_link=1")) . "',\n                            customConfig : {$strConfigFile},\n                            " . $strSkinInit . "\n                        }\n                        \$(KAJONA.admin.portaleditor.initPortaleditor);\n                    });\n                }\n                else {\n                    KAJONA.portal.loader.loadFile([\n                        '/core/module_system/admin/scripts/jquery/jquery.min.js',\n                        '/core/module_system/admin/scripts/jqueryui/jquery-ui.custom.min.js',\n                        '/core/module_pages/admin/scripts/kajona_portaleditor.js',\n                        '/core/module_system/admin/scripts/jqueryui/css/smoothness/jquery-ui.custom.css'\n                    ], function() {\n                        KAJONA.admin.portaleditor.RTE.config = {\n                            language : '" . (class_session::getInstance()->getAdminLanguage() != "" ? class_session::getInstance()->getAdminLanguage() : "en") . "',\n                            filebrowserBrowseUrl : '" . uniStrReplace("&amp;", "&", class_link::getLinkAdminHref("folderview", "browserChooser", "&form_element=ckeditor")) . "',\n                            filebrowserImageBrowseUrl : '" . uniStrReplace("&amp;", "&", class_link::getLinkAdminHref("mediamanager", "folderContentFolderviewMode", "systemid=" . class_module_system_setting::getConfigValue("_mediamanager_default_imagesrepoid_") . "&form_element=ckeditor&bit_link=1")) . "',\n                            " . $strSkinInit . "\n                        }\n                        \$(KAJONA.admin.portaleditor.initPortaleditor);\n                    });\n                }\n            </script>";
         //Load portaleditor styles
         $strPeToolbar .= $this->objToolkit->getPeBasicData();
         $strPeToolbar .= $this->objToolkit->getPeToolbar($arrPeContents);
         $objScriptlets = new class_scriptlet_helper();
         $strPeToolbar = $objScriptlets->processString($strPeToolbar, interface_scriptlet::BIT_CONTEXT_ADMIN);
         //The toolbar has to be added right after the body-tag - to generate correct html-code
         $strTemp = uniSubstr($strPageContent, uniStrpos($strPageContent, "<body"));
         //find closing bracket
         $intTemp = uniStrpos($strTemp, ">") + 1;
         //and insert the code
         $strPageContent = uniSubstr($strPageContent, 0, uniStrpos($strPageContent, "<body") + $intTemp) . $strPeToolbar . uniSubstr($strPageContent, uniStrpos($strPageContent, "<body") + $intTemp);
     } else {
         //Button to enable the toolbar & pe
         $strEnableButton = "<div id=\"peEnableButton\" style=\"z-index: 1000; position: fixed; top: 0px; right: 0px;\"><a href=\"#\" onclick=\"KAJONA.admin.portaleditor.switchEnabled(true); return false;\" title=\"\">" . getImageAdmin("icon_disabled", $this->getLang("pe_enable", "pages")) . "</a></div>";
         //Load portaleditor javascript
         $strEnableButton .= "\n<script type=\"text/javascript\" src=\"" . _webpath_ . "/core/module_pages/admin/scripts/kajona_portaleditor.js?" . class_module_system_setting::getConfigValue("_system_browser_cachebuster_") . "\"></script>";
         $strEnableButton .= $this->objToolkit->getPeBasicData();
         //Load portaleditor styles
         //The toobar has to be added right after the body-tag - to generate correct html-code
         $strTemp = uniSubstr($strPageContent, uniStripos($strPageContent, "<body"));
         //find closing bracket
         $intTemp = uniStripos($strTemp, ">") + 1;
         //and insert the code
         $strPageContent = uniSubstr($strPageContent, 0, uniStrpos($strPageContent, "<body") + $intTemp) . $strEnableButton . uniSubstr($strPageContent, uniStrpos($strPageContent, "<body") + $intTemp);
     }
     //reset the portal texts language
     class_carrier::getInstance()->getObjLang()->setStrTextLanguage($strPortalLanguage);
     return $strPageContent;
 }
 /**
  * Creates a table filled with the sessions currently registered
  *
  * @autoTestable
  * @return string
  * @permissions right1
  */
 protected function actionSystemSessions()
 {
     $strReturn = "";
     //react on commands?
     if ($this->getParam("logout") == "true") {
         $objSession = new class_module_system_session($this->getSystemid());
         $objSession->setStrLoginstatus(class_module_system_session::$LOGINSTATUS_LOGGEDOUT);
         $objSession->updateObjectToDb();
         class_carrier::getInstance()->getObjDB()->flushQueryCache();
     }
     //showing a list using the pageview
     $objArraySectionIterator = new class_array_section_iterator(class_module_system_session::getNumberOfActiveSessions());
     $objArraySectionIterator->setPageNumber((int) ($this->getParam("pv") != "" ? $this->getParam("pv") : 1));
     $objArraySectionIterator->setArraySection(class_module_system_session::getAllActiveSessions($objArraySectionIterator->calculateStartPos(), $objArraySectionIterator->calculateEndPos()));
     $arrData = array();
     $arrHeader = array();
     $arrHeader[0] = "";
     $arrHeader[1] = $this->getLang("session_username");
     $arrHeader[2] = $this->getLang("session_valid");
     $arrHeader[3] = $this->getLang("session_status");
     $arrHeader[4] = $this->getLang("session_activity");
     $arrHeader[5] = "";
     /** @var $objOneSession class_module_system_session */
     foreach ($objArraySectionIterator as $objOneSession) {
         $arrRowData = array();
         $strUsername = "";
         if ($objOneSession->getStrUserid() != "") {
             $objUser = new class_module_user_user($objOneSession->getStrUserid());
             $strUsername = $objUser->getStrUsername();
         }
         $arrRowData[0] = class_adminskin_helper::getAdminImage("icon_user");
         $arrRowData[1] = $strUsername;
         $arrRowData[2] = timeToString($objOneSession->getIntReleasetime());
         if ($objOneSession->getStrLoginstatus() == class_module_system_session::$LOGINSTATUS_LOGGEDIN) {
             $arrRowData[3] = $this->getLang("session_loggedin");
         } else {
             $arrRowData[3] = $this->getLang("session_loggedout");
         }
         //find out what the user is doing...
         $strLastUrl = $objOneSession->getStrLasturl();
         if (uniStrpos($strLastUrl, "?") !== false) {
             $strLastUrl = uniSubstr($strLastUrl, uniStrpos($strLastUrl, "?"));
         }
         $strActivity = "";
         if (uniStrpos($strLastUrl, "admin=1") !== false) {
             $strActivity .= $this->getLang("session_admin");
             foreach (explode("&amp;", $strLastUrl) as $strOneParam) {
                 $arrUrlParam = explode("=", $strOneParam);
                 if ($arrUrlParam[0] == "module") {
                     $strActivity .= $arrUrlParam[1];
                 }
             }
         } else {
             $strActivity .= $this->getLang("session_portal");
             if ($strLastUrl == "") {
                 $strActivity .= class_module_system_setting::getConfigValue("_pages_indexpage_") != "" ? class_module_system_setting::getConfigValue("_pages_indexpage_") : "";
             } else {
                 foreach (explode("&amp;", $strLastUrl) as $strOneParam) {
                     $arrUrlParam = explode("=", $strOneParam);
                     if ($arrUrlParam[0] == "page") {
                         $strActivity .= $arrUrlParam[1];
                     }
                 }
                 if ($strActivity == $this->getLang("session_portal") && uniSubstr($strLastUrl, 0, 5) == "image") {
                     $strActivity .= $this->getLang("session_portal_imagegeneration");
                 }
             }
         }
         $arrRowData[4] = $strActivity;
         if ($objOneSession->getStrLoginstatus() == class_module_system_session::$LOGINSTATUS_LOGGEDIN) {
             $arrRowData[5] = class_link::getLinkAdmin("system", "systemSessions", "&logout=true&systemid=" . $objOneSession->getSystemid(), "", $this->getLang("session_logout"), "icon_delete");
         } else {
             $arrRowData[5] = class_adminskin_helper::getAdminImage("icon_deleteDisabled");
         }
         $arrData[] = $arrRowData;
     }
     $strReturn .= $this->objToolkit->dataTable($arrHeader, $arrData);
     $strReturn .= $this->objToolkit->getPageview($objArraySectionIterator, "system", "systemSessions");
     return $strReturn;
 }
 /**
  * Prints a file as a detailed-view
  * and generates forward / backward links + a strip of prev / next files
  *
  * @param bool $bitRegisterAdditionalTitle
  * @return string
  */
 protected function actionFileDetails($bitRegisterAdditionalTitle = true)
 {
     if (!$this->checkIfRequestedIdIsInElementsTree()) {
         return $this->actionList();
     }
     $bitIsImage = false;
     //Load record
     $objFile = new class_module_mediamanager_file($this->getSystemid());
     //common fields
     $arrDetailsTemplate = array();
     $arrDetailsTemplate["file_name"] = $objFile->getStrName();
     $arrDetailsTemplate["file_description"] = $objFile->getStrDescription();
     $arrDetailsTemplate["file_subtitle"] = $objFile->getStrSubtitle();
     $arrDetailsTemplate["file_filename"] = $objFile->getStrFilename();
     $arrDetailsTemplate["file_size"] = bytesToString($objFile->getIntFileSize());
     $arrDetailsTemplate["file_hits"] = $objFile->getIntHits();
     $arrDetailsTemplate["file_systemid"] = $objFile->getSystemid();
     $arrDetailsTemplate["file_elementid"] = $this->arrElementData["content_id"];
     $arrDetailsTemplate["file_lmtime"] = timeToString(filemtime(_realpath_ . $objFile->getStrFilename()));
     if (validateSystemid($objFile->getOwnerId())) {
         $objUser = new class_module_user_user($objFile->getOwnerId());
         $arrDetailsTemplate["file_owner"] = $objUser->getStrUsername();
     }
     if ($objFile->rightRight2()) {
         $arrDetailsTemplate["file_link_href"] = _webpath_ . "/download.php?systemid=" . $objFile->getSystemid();
         $arrDetailsTemplate["file_link"] = "<a href=\"" . _webpath_ . "/download.php?systemid=" . $objFile->getSystemid() . "\">" . $this->getLang("download_link") . "</a>";
     }
     //if its an image, provide additional information
     $strSuffix = uniStrtolower(uniSubstr($objFile->getStrFilename(), uniStrrpos($objFile->getStrFilename(), ".")));
     if (in_array($strSuffix, $this->arrImageTypes) && isset($this->arrElementData["gallery_maxh_d"]) && isset($this->arrElementData["gallery_maxw_d"])) {
         $bitIsImage = true;
         $arrDetailsTemplate["image_src"] = $this->getImageUrl($objFile->getStrFilename(), $this->arrElementData["gallery_maxh_d"], $this->arrElementData["gallery_maxw_d"], $this->arrElementData["gallery_text"], $this->arrElementData["gallery_overlay"], $objFile->getSystemid(), $this->arrElementData["content_id"]);
     }
     $arrStripIds = $this->getNextPrevIds();
     $arrDetailsTemplate["backlink"] = $arrStripIds["backward_1"] != "" ? class_link::getLinkPortal($this->getPagename(), "", "", $this->getLang("commons_back"), "fileDetails", "", $arrStripIds["backward_1"]) : "";
     $arrDetailsTemplate["forwardlink"] = $arrStripIds["forward_1"] != "" ? class_link::getLinkPortal($this->getPagename(), "", "", $this->getLang("commons_next"), "fileDetails", "", $arrStripIds["forward_1"]) : "";
     //next /prev 3 files
     for ($intI = 1; $intI <= 3; $intI++) {
         if ($arrStripIds["forward_" . $intI] != "") {
             $objCurFile = new class_module_mediamanager_file($arrStripIds["forward_" . $intI]);
             $arrDetailsTemplate["forwardlink_" . $intI] = $this->renderFileStripEntry($objCurFile);
         }
         if ($arrStripIds["backward_" . $intI] != "") {
             $objCurFile = new class_module_mediamanager_file($arrStripIds["backward_" . $intI]);
             $arrDetailsTemplate["backlink_" . $intI] = $this->renderFileStripEntry($objCurFile);
         }
     }
     //current file
     $arrDetailsTemplate["filestrip_current"] = $this->renderFileStripEntry($objFile);
     $arrDetailsTemplate["overview"] = getLinkPortal($this->getPagename(), "", "", $this->getLang("overview"), "mediaFolder", "", $objFile->getPrevId());
     $arrDetailsTemplate["pathnavigation"] = $this->generatePathnavi(true);
     //ratings available?
     if ($objFile->getFloatRating() !== null) {
         /** @var $objRating class_module_rating_portal */
         $objRating = class_module_system_module::getModuleByName("rating")->getPortalInstanceOfConcreteModule();
         $arrDetailsTemplate["file_rating"] = $objRating->buildRatingBar($objFile->getFloatRating(), $objFile->getIntRatingHits(), $objFile->getSystemid(), $objFile->isRateableByUser(), $objFile->rightRight3());
     }
     $strTemplateID = $this->objTemplate->readTemplate("/module_mediamanager/" . $this->arrElementData["repo_template"], "filedetail");
     $strReturn = $this->fillTemplate($arrDetailsTemplate, $strTemplateID);
     //Add pe code
     $arrPeConfig = array("pe_module" => "mediamanager", "pe_action_edit" => "editFile", "pe_action_edit_params" => "&systemid=" . $objFile->getSystemid());
     $strReturn = class_element_portal::addPortalEditorCode($strReturn, $objFile->getSystemid(), $arrPeConfig);
     //set the name of the current image to the page title via class_pages
     if ($bitRegisterAdditionalTitle) {
         class_module_pages_portal::registerAdditionalTitle($objFile->getStrName());
     }
     //Update view counter
     if ($bitIsImage) {
         $objFile->increaseHits();
     }
     return $this->addPortaleditorCode($strReturn);
 }
 /**
  * Returns a list of available placeholders & elements on this page
  *
  * @return string
  * @permissions edit
  */
 protected function actionList()
 {
     $strReturn = "";
     class_module_languages_admin::enableLanguageSwitch();
     $objPage = new class_module_pages_page($this->getSystemid());
     //get infos about the page
     $arrToolbarEntries = array();
     $arrToolbarEntries[0] = "<a href=\"" . class_link::getLinkAdminHref("pages", "editPage", "&systemid=" . $this->getSystemid()) . "\">" . class_adminskin_helper::getAdminImage("icon_edit") . $this->getLang("contentToolbar_pageproperties") . "</a>";
     $arrToolbarEntries[1] = "<a href=\"" . class_link::getLinkAdminHref("pages_content", "list", "&systemid=" . $this->getSystemid()) . "\">" . class_adminskin_helper::getAdminImage("icon_page") . $this->getLang("contentToolbar_content") . "</a>";
     $arrToolbarEntries[2] = "<a href=\"" . class_link::getLinkPortalHref($objPage->getStrName(), "", "", "&preview=1", "", $this->getLanguageToWorkOn()) . "\" target=\"_blank\">" . class_adminskin_helper::getAdminImage("icon_lens") . $this->getLang("contentToolbar_preview") . "</a>";
     if ($objPage->getIntType() != class_module_pages_page::$INT_TYPE_ALIAS) {
         $strReturn .= $this->objToolkit->getContentToolbar($arrToolbarEntries, 1);
     }
     $arrInfoRows = array(array($this->getLang("template"), $objPage->getStrTemplate()), array($this->getLang("lastuserTitle"), $objPage->getLastEditUser()), array($this->getLang("lasteditTitle"), timeToString($objPage->getIntLmTime())));
     $strReturn .= $this->objToolkit->dataTable(null, $arrInfoRows);
     $strReturn .= $this->objToolkit->divider();
     //try to load template, otherwise abort
     $strTemplateID = null;
     try {
         $strTemplateID = $this->objTemplate->readTemplate("/module_pages/" . $objPage->getStrTemplate(), "", false, true);
     } catch (class_exception $objException) {
         $strReturn .= $this->getLang("templateNotLoaded") . "<br />";
     }
     //Load elements on template, master-page special case!
     if ($objPage->getStrName() == "master") {
         $arrElementsOnTemplate = $this->objTemplate->getElements($strTemplateID, 1);
     } else {
         $arrElementsOnTemplate = $this->objTemplate->getElements($strTemplateID, 0);
     }
     //Language-dependant loading of elements, if installed
     $arrElementsOnPage = class_module_pages_pageelement::getElementsOnPage($this->getSystemid(), false, $this->getLanguageToWorkOn());
     //save a copy of the array to be able to check against all values later on
     $arrElementsOnPageCopy = $arrElementsOnPage;
     //Loading all Elements installed on the system ("RAW"-Elements)
     $arrElementsInSystem = class_module_pages_element::getObjectList();
     //So, loop through the placeholders and check, if there's any element already belonging to this one
     $intI = 0;
     if (is_array($arrElementsOnTemplate) && count($arrElementsOnTemplate) > 0) {
         //Iterate over every single placeholder provided by the template
         foreach ($arrElementsOnTemplate as $arrOneElementOnTemplate) {
             $strOutputAtPlaceholder = "";
             //Do we have one or more elements already in db at this placeholder?
             $bitHit = false;
             //Iterate over every single element-type provided by the placeholder
             foreach ($arrElementsOnPage as $intArrElementsOnPageKey => $objOneElementOnPage) {
                 //Check, if its the same placeholder
                 $bitSamePlaceholder = false;
                 if ($arrOneElementOnTemplate["placeholder"] == $objOneElementOnPage->getStrPlaceholder()) {
                     $bitSamePlaceholder = true;
                 }
                 if ($bitSamePlaceholder) {
                     $bitHit = true;
                     //try to unlock the record
                     $objOneElementOnPage->getLockManager()->unlockRecord();
                     $strActions = $this->getActionIcons($objOneElementOnPage);
                     //Put all Output together
                     $strOutputAtPlaceholder .= $this->objToolkit->simpleAdminList($objOneElementOnPage, $strActions, $intI++);
                     //remove the element from the array
                     unset($arrElementsOnPage[$intArrElementsOnPageKey]);
                 }
             }
             //Check, if one of the elements in the placeholder is allowed to be used multiple times
             foreach ($arrOneElementOnTemplate["elementlist"] as $arrSingleElementOnTemplateplaceholder) {
                 /** @var class_module_pages_element $objOneElementInSystem  */
                 foreach ($arrElementsInSystem as $objOneElementInSystem) {
                     if ($objOneElementInSystem->getStrName() == $arrSingleElementOnTemplateplaceholder["element"]) {
                         if ($objOneElementInSystem->getIntRepeat() == 1 || $bitHit === false) {
                             //So, the Row for a new element: element is repeatable or not yet created
                             $strActions = $this->objToolkit->listButton(class_link::getLinkAdmin("pages_content", "new", "&placeholder=" . $arrOneElementOnTemplate["placeholder"] . "&element=" . $arrSingleElementOnTemplateplaceholder["element"] . "&systemid=" . $this->getSystemid(), "", $this->getLang("element_anlegen"), "icon_new"));
                             $strOutputAtPlaceholder .= $this->objToolkit->genericAdminList("", $objOneElementInSystem->getStrDisplayName(), "", $strActions, $intI++);
                         } else {
                             //element not repeatable.
                             //Is there already one element installed? if not, then it IS allowed to create a new one
                             $bitOneInstalled = false;
                             foreach ($arrElementsOnPageCopy as $objOneElementToCheck) {
                                 if ($arrOneElementOnTemplate["placeholder"] == $objOneElementToCheck->getStrPlaceholder() && $arrSingleElementOnTemplateplaceholder["element"] == $objOneElementToCheck->getStrElement()) {
                                     $bitOneInstalled = true;
                                 }
                             }
                             if (!$bitOneInstalled) {
                                 //So, the Row for a new element
                                 $strActions = $this->objToolkit->listButton(class_link::getLinkAdmin("pages_content", "new", "&placeholder=" . $arrOneElementOnTemplate["placeholder"] . "&element=" . $arrSingleElementOnTemplateplaceholder["element"] . "&systemid=" . $this->getSystemid(), "", $this->getLang("element_anlegen"), "icon_new"));
                                 $strOutputAtPlaceholder .= $this->objToolkit->genericAdminList("", $objOneElementInSystem->getStrDisplayName(), "", $strActions, $intI++);
                             }
                         }
                     }
                 }
             }
             if ((int) uniStrlen($strOutputAtPlaceholder) > 0) {
                 $arrSinglePlaceholder = explode("_", $arrOneElementOnTemplate["placeholder"]);
                 if (count($arrSinglePlaceholder) == 2) {
                     $strOutputAtPlaceholder .= $this->objToolkit->formHeadline($arrSinglePlaceholder[0]);
                 }
                 $strListId = generateSystemid();
                 $strReturn .= $this->objToolkit->dragableListHeader($strListId, true);
                 $strReturn .= $strOutputAtPlaceholder;
                 $strReturn .= $this->objToolkit->dragableListFooter($strListId);
             }
         }
     } else {
         $strReturn .= $this->getLang("element_liste_leer");
     }
     //if there are any page-elements remaining, print a warning and print the elements row
     if (count($arrElementsOnPage) > 0) {
         $strReturn .= $this->objToolkit->divider();
         $strReturn .= $this->objToolkit->warningBox($this->getLang("warning_elementsremaining"));
         $strReturn .= $this->objToolkit->listHeader();
         //minimized actions now, plz. this ain't being a real element anymore!
         foreach ($arrElementsOnPage as $objOneElement) {
             $strActions = "";
             $strActions .= $this->objToolkit->listDeleteButton($objOneElement->getStrDisplayName(), $this->getLang("element_loeschen_frage"), class_link::getLinkAdminHref("pages_content", "deleteElementFinal", "&systemid=" . $objOneElement->getSystemid() . ($this->getParam("pe") == "" ? "" : "&peClose=" . $this->getParam("pe"))));
             //Put all Output together
             $strReturn .= $this->objToolkit->genericAdminList("", $objOneElement->getStrDisplayName() . $this->getLang("placeholder") . $objOneElement->getStrPlaceholder(), "", $strActions, $intI++);
         }
         $strReturn .= $this->objToolkit->listFooter();
     }
     $strReturn .= $this->objToolkit->getTableOfContents("h2");
     return $strReturn;
 }
 /**
  * saves a post in the database and returns the post as html.
  * In case of missing fields, the form is returned again
  *
  * @return string
  * @permissons right1
  */
 protected function actionSavePost()
 {
     $strXMLContent = "";
     //validate needed fields
     if (!$this->validateForm()) {
         //Create form to reenter values
         $strTemplateID = $this->objTemplate->readTemplate("/module_postacomment/" . $this->getParam("comment_template"), "postacomment_form");
         $arrForm = array();
         $arrForm["formaction"] = class_link::getLinkPortalHref($this->getPagename(), "", "postComment", "", $this->getSystemid());
         $arrForm["comment_name"] = $this->getParam("comment_name");
         $arrForm["comment_subject"] = $this->getParam("comment_subject");
         $arrForm["comment_message"] = $this->getParam("comment_message");
         $arrForm["comment_template"] = $this->getParam("comment_template");
         $arrForm["comment_systemid"] = $this->getParam("comment_systemid");
         $arrForm["comment_page"] = $this->getParam("comment_page");
         $arrForm["validation_errors"] = $this->strErrors;
         foreach ($arrForm as $strKey => $strValue) {
             if (uniStrpos($strKey, "comment_") !== false) {
                 $arrForm[$strKey] = htmlspecialchars($strValue, ENT_QUOTES, "UTF-8", false);
             }
         }
         //texts
         $arrForm["postacomment_write_new"] = $this->getLang("postacomment_write_new");
         $arrForm["form_name_label"] = $this->getLang("form_name_label");
         $arrForm["form_subject_label"] = $this->getLang("form_subject_label");
         $arrForm["form_message_label"] = $this->getLang("form_message_label");
         $arrForm["form_captcha_label"] = $this->getLang("commons_captcha");
         $arrForm["form_captcha_reload_label"] = $this->getLang("commons_captcha_reload");
         $arrForm["form_submit_label"] = $this->getLang("form_submit_label");
         $strXMLContent .= $this->fillTemplate($arrForm, $strTemplateID);
     } else {
         //save the post to the db
         //pageid or systemid to filter?
         $strSystemidfilter = $this->getParam("comment_systemid");
         if (class_module_pages_page::getPageByName($this->getParam("comment_page")) !== null) {
             $strPagefilter = class_module_pages_page::getPageByName($this->getParam("comment_page"))->getSystemid();
         } else {
             $strPagefilter = "";
         }
         $objPost = new class_module_postacomment_post();
         $objPost->setStrUsername($this->getParam("comment_name"));
         $objPost->setStrTitle($this->getParam("comment_subject"));
         $objPost->setStrComment($this->getParam("comment_message"));
         $objPost->setStrAssignedPage($strPagefilter);
         $objPost->setStrAssignedSystemid($strSystemidfilter);
         $objPost->setStrAssignedLanguage($this->getStrPortalLanguage());
         $objPost->updateObjectToDb();
         $this->flushPageFromPagesCache($this->getPagename());
         $strMailtext = $this->getLang("new_comment_mail") . "\r\n\r\n" . $objPost->getStrComment() . "\r\n";
         $strMailtext .= class_link::getLinkAdminHref("postacomment", "edit", "&systemid=" . $objPost->getSystemid(), false);
         $objMessageHandler = new class_module_messaging_messagehandler();
         $arrGroups = array();
         $allGroups = class_module_user_group::getObjectList();
         foreach ($allGroups as $objOneGroup) {
             if (class_rights::getInstance()->checkPermissionForGroup($objOneGroup->getSystemid(), class_rights::$STR_RIGHT_EDIT, $this->getObjModule()->getSystemid())) {
                 $arrGroups[] = $objOneGroup;
             }
         }
         $objMessageHandler->sendMessage($strMailtext, $arrGroups, new class_messageprovider_postacomment());
         //reinit post -> encoded entities
         $objPost->initObject();
         //load the post as a new post to add it at top of the list
         $arrOnePost = array();
         $arrOnePost["postacomment_post_name"] = $objPost->getStrUsername();
         $arrOnePost["postacomment_post_subject"] = $objPost->getStrTitle();
         $arrOnePost["postacomment_post_message"] = $objPost->getStrComment();
         $arrOnePost["postacomment_post_systemid"] = $objPost->getSystemid();
         $arrOnePost["postacomment_post_date"] = timeToString($objPost->getIntDate(), true);
         $strTemplateID = $this->objTemplate->readTemplate("/module_postacomment/" . $this->getParam("comment_template"), "postacomment_post");
         $strXMLContent .= $this->objTemplate->fillTemplate($arrOnePost, $strTemplateID);
     }
     class_response_object::getInstance()->setStrResponseType(class_http_responsetypes::STR_TYPE_JSON);
     return $strXMLContent;
 }
Example #21
0
    function showReport()
    {
        if (!$this->whereClause) {
            $this->whereClause = "invoices.id!=-1";
        }
        $this->whereClause = " WHERE " . $this->whereClause;
        $pageTitle = $this->title;
        ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="<?php 
        echo APP_PATH;
        ?>
common/stylesheet/<?php 
        echo STYLESHEET;
        ?>
/pages/totalreports.css" rel="stylesheet" type="text/css" />
<title><?php 
        echo $pageTitle;
        ?>
</title>
</head>

<body>
	<div id="toprint">
		<h1><span><?php 
        echo $pageTitle;
        ?>
</span></h1>
		<h2>Source: <?php 
        echo $_SESSION["printing"]["dataprint"];
        ?>
</h2>
		<h2>Date: <?php 
        echo dateToString(mktime()) . " " . timeToString(mktime());
        ?>
</h2>

		<?php 
        $this->showReportTable();
        ?>
	</div>
</body>
</html><?php 
    }
Example #22
0
echo "|                                                                               |\n";
echo "+-------------------------------------------------------------------------------+\n";
$arrEntries = class_cache::getAllCacheEntries();
$arrData = array();
$arrHeader = array();
$objText = class_carrier::getInstance()->getObjLang();
$arrHeader[] = "Leasetime";
$arrHeader[] = "Source";
$arrHeader[] = "Language";
$arrHeader[] = "Hash 1";
$arrHeader[] = "Hash 2";
$arrHeader[] = "Hits";
$arrHeader[] = "Size";
foreach ($arrEntries as $objOneEntry) {
    $arrRowData = array();
    $arrRowData[] = timeToString($objOneEntry->getIntLeasetime());
    $arrRowData[] = $objOneEntry->getStrSourceName();
    $arrRowData[] = $objOneEntry->getStrLanguage();
    $arrRowData[] = uniStrTrim($objOneEntry->getStrHash1(), 40);
    $arrRowData[] = uniStrTrim($objOneEntry->getStrHash2(), 40);
    if (_cache_ === true) {
        $arrRowData[] = $objOneEntry->getIntEntryHits();
    } else {
        $arrRowData[] = "n.a.";
    }
    $arrRowData[] = uniStrlen($objOneEntry->getStrContent());
    $arrData[] = $arrRowData;
}
echo "<table border=\"1\">";
echo "<tr>";
foreach ($arrHeader as $strOneHeader) {
 /**
  * Creates a table filled with the sessions currently registered.
  * Returned structure:
  * <sessions>
  *    <session>
  *        <username></username>
  *        <loginstatus></loginstatus>
  *        <releasetime></releasetime>
  *        <activity></activity>
  *    </session>
  * </sessions>
  *
  * @return string
  * @permissions right1
  */
 protected function actionSystemSessions()
 {
     $strReturn = "";
     //check needed rights
     $arrSessions = class_module_system_session::getAllActiveSessions();
     $strReturn .= "<sessions>";
     foreach ($arrSessions as $objOneSession) {
         $strReturn .= "<session>";
         $strUsername = "";
         if ($objOneSession->getStrUserid() != "") {
             $objUser = new class_module_user_user($objOneSession->getStrUserid());
             $strUsername = $objUser->getStrUsername();
         }
         $strLoginStatus = "";
         if ($objOneSession->getStrLoginstatus() == class_module_system_session::$LOGINSTATUS_LOGGEDIN) {
             $strLoginStatus = $this->getLang("session_loggedin");
         } else {
             $strLoginStatus = $this->getLang("session_loggedout");
         }
         //find out what the user is doing...
         $strLastUrl = $objOneSession->getStrLasturl();
         if (uniStrpos($strLastUrl, "?") !== false) {
             $strLastUrl = uniSubstr($strLastUrl, uniStrpos($strLastUrl, "?"));
         }
         $strActivity = "";
         if (uniStrpos($strLastUrl, "admin=1") !== false) {
             $strActivity .= $this->getLang("session_admin");
             foreach (explode("&amp;", $strLastUrl) as $strOneParam) {
                 $arrUrlParam = explode("=", $strOneParam);
                 if ($arrUrlParam[0] == "module") {
                     $strActivity .= $arrUrlParam[1];
                 }
             }
         } else {
             $strActivity .= $this->getLang("session_portal");
             if ($strLastUrl == "") {
                 $strActivity .= class_module_system_setting::getConfigValue("_pages_indexpage_");
             } else {
                 foreach (explode("&amp;", $strLastUrl) as $strOneParam) {
                     $arrUrlParam = explode("=", $strOneParam);
                     if ($arrUrlParam[0] == "page") {
                         $strActivity .= $arrUrlParam[1];
                     }
                 }
                 if ($strActivity == $this->getLang("session_portal") && uniSubstr($strLastUrl, 0, 5) == "image") {
                     $strActivity .= $this->getLang("session_portal_imagegeneration");
                 }
             }
         }
         $strReturn .= "<username>" . xmlSafeString($strUsername) . "</username>";
         $strReturn .= "<loginstatus>" . xmlSafeString($strLoginStatus) . "</loginstatus>";
         $strReturn .= "<releasetime>" . xmlSafeString(timeToString($objOneSession->getIntReleasetime())) . "</releasetime>";
         $strReturn .= "<activity>" . xmlSafeString($strActivity) . "</activity>";
         $strReturn .= "</session>";
     }
     $strReturn .= "</sessions>";
     return $strReturn;
 }
Example #24
0
 function addOneDayCourse()
 {
     header('Access-Control-Allow-Origin:*');
     //跨域
     header("Content-type: text/html; charset=utf-8");
     /*
     {
         "xtoken": "35dsakfsdjfcvjdsajfkdsf234",
         "coachid": 23,
         "uid": 333,
         "pid": 11,
         "time": "3825843",
         "action_list": [
             {
                 "actionid": 34,
                 "group": 3,
                 "count": 20,
                 "order": 1,
                 "type": 1,
                 "duration": 34
             },
             {
                 "actionid": 34,
                 "group": 3,
                 "count": 20,
                 "order": 1,
                 "type": 2,
                 "duration": 54
             }
         ]
     }
     */
     $param = json_decode(file_get_contents('php://input'), true);
     //         $str = '{
     //     "xtoken": "35dsakfsdjfcvjdsajfkdsf234",
     //     "coachid": 34,
     //     "uid": 76,
     //     "pid": 2,
     //     "time": "1448255875",
     //     "action_list": [
     //         {
     //             "actionid": 34,
     //             "group": 3,
     //             "count": 200,
     //             "order": 1,
     //             "type": 1,
     //             "duration": 20
     //         },
     //         {
     //             "actionid": 44,
     //             "group": 3,
     //             "count": 150,
     //             "order": 1,
     //             "type": 1,
     //             "duration": 30
     //         }
     //     ]
     // }';
     // $param = json_decode($str, true);
     $token = $param['xtoken'];
     init_verify_token($token);
     $coachid = $param['coachid'];
     // $coachid = 34;
     if (!isset($coachid)) {
         err_ret(-205, 'lack of param', '缺少参数');
     }
     $uid = $param['uid'];
     // $uid = 42;
     if (!isset($uid)) {
         err_ret(-205, 'lack of param', '缺少参数');
     }
     $pid = $param['pid'];
     // $pid = 1;
     if (!isset($pid)) {
         err_ret(-205, 'lack of param', '缺少参数');
     }
     //时间有可能是未来的某天的课程
     $time = $param['time'];
     // $time = 1447257600;
     if (!isset($time)) {
         err_ret(-205, 'lack of param', '缺少参数');
     }
     //先查询数据库中是否购买了课程
     $model_my_plan = new Model('my_plan');
     $condition['uid'] = $uid;
     $condition['pid'] = $pid;
     $condition['coachid'] = $coachid;
     $result = $model_my_plan->where($condition)->select();
     if (count($result) <= 0) {
         err_ret(-206, 'user has no buy plan', '客户没有购买计划');
     }
     $model_course_record = new Model('course_record');
     $next_courseid = $model_course_record->max('courseid') + 1;
     //再查询用户在这一天是否有课程
     $sql = "SELECT * FROM my_plan WHERE FROM_UNIXTIME(course_time,'%Y-%m-%d')=FROM_UNIXTIME({$time},'%Y-%m-%d') AND uid={$uid} AND pid={$pid} AND coachid={$coachid}";
     $model = new Model();
     $result = $model->query($sql);
     if (count($result) > 0) {
         //这一天已经有课程了,修改课程
         $cur_courseid = $result[0]['courseid'];
         //根据cur_courseid删除原来的课程
         $delete_course_sql = "DELETE FROM course_record WHERE courseid=" . $cur_courseid;
         $model->execute($delete_course_sql);
         //添加课程
         $action_list = $param['action_list'];
         for ($i = 0; $i < count($action_list); $i++) {
             $action_list[$i]['courseid'] = $cur_courseid;
             $model_course_record->add($action_list[$i]);
         }
         //修改课程状态
         $save_data['status'] = 3;
         $save_data['iscontacted'] = 1;
         $save_data['isfinished'] = 0;
         $save_data['tips'] = '';
         $save_data['pay_time'] = $result[0]['pay_time'];
         $save_data['course_time'] = $time;
         $save_data['begin_time'] = $result[0]['begin_time'];
         $save_data['end_time'] = $result[0]['end_time'];
         $model_my_plan->where('id=' . $result[0]['id'])->save($save_data);
         //返回结果
         $data['errno'] = 0;
         $data['courseid'] = $cur_courseid;
         echo json_encode($data);
     } else {
         //这一天没有课程
         //添加课程
         $action_list = $param['action_list'];
         for ($i = 0; $i < count($action_list); $i++) {
             $action_list[$i]['courseid'] = $next_courseid;
             $model_course_record->add($action_list[$i]);
         }
         //找到开始时间和结束时间
         $result_my_plan = $model_my_plan->where($condition)->select();
         $begin_time = $result_my_plan[0]['begin_time'];
         $end_time = $result_my_plan[0]['end_time'];
         $pay_time = $result_my_plan[0]['pay_time'];
         $course_time = $result_my_plan[0]['course_time'];
         if ($course_time == 1 || $course_time == 0) {
             $begin_time = time();
             $end_time = $begin_time + 30 * 86400;
         }
         //把课程添加到计划
         unset($condition);
         $condition['uid'] = $uid;
         $condition['pid'] = $pid;
         $condition['coachid'] = $coachid;
         $condition['courseid'] = 0;
         unset($result_my_plan);
         $result_my_plan = $model_my_plan->where($condition)->select();
         if (count($result_my_plan) > 0) {
             $id = $result_my_plan[0]['id'];
             $save_data['uid'] = $uid;
             $save_data['pid'] = $pid;
             $save_data['coachid'] = $coachid;
             $save_data['courseid'] = $next_courseid;
             $save_data['status'] = 3;
             $save_data['iscontacted'] = 1;
             $save_data['isfinished'] = 0;
             $save_data['tips'] = '';
             $save_data['pay_time'] = $pay_time;
             $save_data['course_time'] = $time;
             $save_data['begin_time'] = $begin_time;
             $save_data['end_time'] = $end_time;
             $model_my_plan->where('id=' . $id)->save($save_data);
         } else {
             $add_data['uid'] = $uid;
             $add_data['pid'] = $pid;
             $add_data['coachid'] = $coachid;
             $add_data['courseid'] = $next_courseid;
             $add_data['status'] = 3;
             $add_data['iscontacted'] = 1;
             $add_data['isfinished'] = 0;
             $add_data['tips'] = '';
             $add_data['pay_time'] = $pay_time;
             $add_data['course_time'] = $time;
             $add_data['begin_time'] = $begin_time;
             $add_data['end_time'] = $end_time;
             $model_my_plan->add($add_data);
         }
         //返回数据
         $data['errno'] = 0;
         $data['courseid'] = $next_courseid;
         echo json_encode($data);
         //通知用户
         $sql = "SELECT id, name,nicker FROM user_info WHERE id IN({$uid},{$coachid})";
         $model = new Model();
         $result = $model->query($sql);
         foreach ($result as $value) {
             if ($value['id'] == $uid) {
                 //用户
                 $userNicker = $value['nicker'];
             } else {
                 if ($value['id'] == $coachid) {
                     $coachName = $value['name'];
                 }
             }
         }
         $strDate = timeToString($time);
         $strTicker = 'Hi,' . $userNicker . ' 你有新的计划啦,快点开看看吧';
         $strTitle = 'Hi,' . $userNicker . ' 你有新的计划啦,快点开看看吧';
         //            $strText = 'Hi,'.$userNicker.' 你的教练'.$coachName.'给你安排了'.$time.'的训练计划啦  记得去查看哦~';
         $strText = 'Hi,' . $userNicker . ' 你的教练' . $coachName . '给你安排了新的训练计划啦  记得去查看哦~';
         //发通知
         //            sendDeviceUnicast($uid,$strTicker,$strTitle,$strText);
         getuiSendDeviceUnicast($uid, $strTitle, $strText);
     }
 }
Example #25
0
                            <option value="24 Hour" <?php 
if ($therecord["time_format"] == "24 Hour") {
    echo "selected=\"selected\"";
}
?>
>24 Hour (<?php 
echo timeToString(mktime(), "24 Hour");
?>
)</option>
                            <option value="12 Hour" <?php 
if ($therecord["time_format"] == "12 Hour") {
    echo "selected=\"selected\"";
}
?>
>12 Hour (<?php 
echo timeToString(mktime(), "12 Hour");
?>
)</option>
                        </select>
                    </p>

                    <p>&nbsp;</p>

                    <p><?php 
$theform->showField("currency_sym");
?>
</p>

                    <p><?php 
$theform->showField("currency_accuracy");
?>
    function generate()
    {
        ob_start();
        ?>

        <h1>Client Purchase History</h1>

	<ul>
	    <li>
                source:<br />
                <?php 
        echo formatVariable($this->dataPrint);
        ?>
            </li>
            <li>
                date generated:<br />
                <?php 
        echo dateToString(mktime()) . " " . timeToString(mktime());
        ?>
            </li>
            <li>
                view:<br />
                <?php 
        echo $this->view;
        ?>
            </li>
            <li>
                from:<br />
                <?php 
        echo $this->fromDate;
        ?>
            </li>
            <li>
                to:<br />
                <?php 
        echo $this->toDate;
        ?>
            </li>
	</ul>

        <?php 
        $this->reportOutput = ob_get_contents();
        ob_end_clean();
        while ($therecord = $this->db->fetchArray($this->clientQueryresult)) {
            $this->reportOutput .= '<h2>' . $therecord["thename"] . '</h2>';
            $this->reportOutput .= $this->generateSingleClientHistory($therecord["uuid"]);
        }
        //endwhile
    }
 /**
  * Returns a list of comments.
  *
  * @return string
  * @permissions view
  */
 protected function actionList()
 {
     $strReturn = "";
     $strPosts = "";
     $strForm = "";
     $strNewButton = "";
     //pageid or systemid to filter?
     $strSystemidfilter = "";
     $strPagefilter = $this->strPagefilter;
     if ($this->getSystemid() != "") {
         $strSystemidfilter = $this->getSystemid();
     }
     if ($strPagefilter === null && class_module_pages_page::getPageByName($this->getPagename()) !== null) {
         $strPagefilter = class_module_pages_page::getPageByName($this->getPagename())->getSystemid();
     }
     $intNrOfPosts = isset($this->arrElementData["int1"]) ? $this->arrElementData["int1"] : 0;
     //Load all posts
     $objArraySectionIterator = new class_array_section_iterator(class_module_postacomment_post::getNumberOfPostsAvailable(true, $strPagefilter, $strSystemidfilter, $this->getStrPortalLanguage()));
     $objArraySectionIterator->setIntElementsPerPage($intNrOfPosts);
     $objArraySectionIterator->setPageNumber((int) ($this->getParam("pvPAC") != "" ? $this->getParam("pvPAC") : 1));
     $objArraySectionIterator->setArraySection(class_module_postacomment_post::loadPostList(true, $strPagefilter, $strSystemidfilter, $this->getStrPortalLanguage(), $objArraySectionIterator->calculateStartPos(), $objArraySectionIterator->calculateEndPos()));
     //params to add?
     $strAdd = "";
     if ($this->getParam("action") != "") {
         $strAdd .= "&action=" . $this->getParam("action");
     }
     if ($this->getParam("systemid") != "") {
         $strAdd .= "&systemid=" . $this->getParam("systemid");
     }
     if ($this->getParam("pv") != "") {
         $strAdd .= "&pv=" . $this->getParam("pv");
     }
     $arrComments = $this->objToolkit->simplePager($objArraySectionIterator, $this->getLang("commons_next"), $this->getLang("commons_back"), "", $this->getPagename(), $strAdd, "pvPAC");
     $strTemplateID = $this->objTemplate->readTemplate("/module_postacomment/" . $this->arrElementData["char1"], "postacomment_post");
     if (!$objArraySectionIterator->valid()) {
         $strPosts .= $this->getLang("postacomment_empty");
     }
     //Check rights
     /** @var class_module_postacomment_post $objOnePost */
     foreach ($objArraySectionIterator as $objOnePost) {
         if ($objOnePost->rightView()) {
             $strOnePost = "";
             $arrOnePost = array();
             $arrOnePost["postacomment_post_name"] = $objOnePost->getStrUsername();
             $arrOnePost["postacomment_post_subject"] = $objOnePost->getStrTitle();
             $arrOnePost["postacomment_post_message"] = $objOnePost->getStrComment();
             $arrOnePost["postacomment_post_systemid"] = $objOnePost->getSystemid();
             $arrOnePost["postacomment_post_date"] = timeToString($objOnePost->getIntDate(), true);
             //ratings available?
             if ($objOnePost->getFloatRating() !== null) {
                 /** @var $objRating class_module_rating_portal */
                 $objRating = class_module_system_module::getModuleByName("rating")->getPortalInstanceOfConcreteModule();
                 $arrOnePost["postacomment_post_rating"] = $objRating->buildRatingBar($objOnePost->getFloatRating(), $objOnePost->getIntRatingHits(), $objOnePost->getSystemid(), $objOnePost->isRateableByUser(), $objOnePost->rightRight2());
             }
             $strOnePost .= $this->objTemplate->fillTemplate($arrOnePost, $strTemplateID, false);
             //Add pe code
             $arrPeConfig = array("pe_module" => "postacomment", "pe_action_edit" => "edit", "pe_action_edit_params" => "&systemid=" . $objOnePost->getSystemid(), "pe_action_new" => "", "pe_action_new_params" => "", "pe_action_delete" => "delete", "pe_action_delete_params" => "&systemid=" . $objOnePost->getSystemid());
             $strPosts .= class_element_portal::addPortalEditorCode($strOnePost, $objOnePost->getSystemid(), $arrPeConfig);
         }
     }
     //Create form
     if ($this->getObjModule()->rightRight1()) {
         $strTemplateID = $this->objTemplate->readTemplate("/module_postacomment/" . $this->arrElementData["char1"], "postacomment_form");
         $arrForm = array();
         if ($this->getParam("comment_name") == "" && $this->objSession->isLoggedin()) {
             $this->setParam("comment_name", $this->objSession->getUsername());
         }
         $arrForm["formaction"] = class_link::getLinkPortalHref($this->getPagename(), "", "postComment", "", $this->getSystemid());
         $arrForm["comment_name"] = $this->getParam("comment_name");
         $arrForm["comment_subject"] = $this->getParam("comment_subject");
         $arrForm["comment_message"] = $this->getParam("comment_message");
         $arrForm["comment_template"] = $this->arrElementData["char1"];
         $arrForm["comment_systemid"] = $this->getSystemid();
         $arrForm["comment_page"] = $this->getPagename();
         $arrForm["validation_errors"] = $this->strErrors;
         foreach ($arrForm as $strKey => $strValue) {
             if (uniStrpos($strKey, "comment_") !== false) {
                 $arrForm[$strKey] = htmlspecialchars($strValue, ENT_QUOTES, "UTF-8", false);
             }
         }
         $strForm .= $this->objTemplate->fillTemplate($arrForm, $strTemplateID, false);
         //button to show the form
         $strTemplateNewButtonID = $this->objTemplate->readTemplate("/module_postacomment/" . $this->arrElementData["char1"], "postacomment_new_button");
         $strNewButton = $this->objTemplate->fillTemplate(array("comment_systemid" => $this->getSystemid()), $strTemplateNewButtonID, false);
     }
     //add sourrounding list template
     $strTemplateID = $this->objTemplate->readTemplate("/module_postacomment/" . $this->arrElementData["char1"], "postacomment_list");
     //link to the post-form & pageview links
     $arrTemplate = array();
     $arrTemplate["postacomment_forward"] = $arrComments["strForward"];
     $arrTemplate["postacomment_pages"] = $arrComments["strPages"];
     $arrTemplate["postacomment_back"] = $arrComments["strBack"];
     $arrTemplate["postacomment_form"] = $strForm;
     $arrTemplate["postacomment_new_button"] = $strNewButton;
     $arrTemplate["postacomment_systemid"] = $this->getSystemid();
     $arrTemplate["postacomment_list"] = $strPosts;
     $strReturn .= $this->fillTemplate($arrTemplate, $strTemplateID);
     return $strReturn;
 }
    function showReport()
    {
        ?>
<head>
<title>Product Sales History</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
<!--
BODY,TH,TD,H1,H2,h3{
	font-size : 11px;
	font-family : sans-serif;
	color : Black;
}
H1,H2{
	font-size:18px;
	border-bottom:4px solid black;
	margin:0px;
}
H2{ font-size:11px; border-bottom-width:2px; margin-bottom:10px;}
H3{ font-size:14px; margin-bottom:2px;}
div {padding:5px;}

UL{margin:0;padding:0;}
LI{float:left;display:inline;padding-left:10px;}

TABLE{border:3px solid black;border-bottom-width:1px;border-right-width:1px;}
TH, TD{ padding:2px; border-right:1px solid black;border-bottom:1px solid black;}
TH {
	background-color:#EEEEEE;
	font-size:12px;
	font-weight: bold;
	border-bottom-width:3px;
}

.grandtotals{font-size:12px; border-top:3px double black; font-weight:bold; padding-top:8px;padding-bottom:8px; background-color:#EEEEEE;}

.invoices{font-size:10px; border-bottom-style:dotted; border-bottom-width:2px;}
.lineitems{font-size:9px;border-bottom-style:dotted; border-bottom-width:1px; border-right-width:0px;}
-->
</style>
</head>
<body>
<h1>Product Sales History</h1>
<h2>
	<ul>
		<li>
			source:<br />
			<?php 
        echo $_SESSION["printing"]["dataprint"];
        ?>
		</li>
		<li>
			date generated:<br />
			<?php 
        echo dateToString(mktime()) . " " . timeToString(mktime());
        ?>
		</li>
		<li style="padding-left:30px;padding-right:20px;">
			view:<br />
			<?php 
        echo $this->view;
        ?>
		</li>
		<li>
			from:<br />
			<?php 
        echo $this->fromdate;
        ?>
		</li>
		<li>
			to:<br />
			<?php 
        echo $this->todate;
        ?>
		</li>
	</ul><br /><br />
</h2>
<?php 
        while ($therecord = $this->db->fetchArray($this->productQuery)) {
            ?>
	<h3><?php 
            echo $therecord["partnumber"] . " - " . $therecord["partname"];
            ?>
</h3>
<?php 
            $this->showSalesHistory($therecord["id"]);
        }
        //end while
        ?>
</body>
</html>
	<?php 
    }
Example #29
0
function timeToStr($time, $fraction = 1000)
{
    return preg_replace('/^(0+:)+/', '', timeToString($time, $fraction));
}
Example #30
0
 function test()
 {
     echo 'Show/test';
     die;
     $uid = $_GET['uid'];
     $coachid = $_GET['coachid'];
     $time = time();
     //通知用户
     $sql = "SELECT id, name,nicker FROM user_info WHERE id IN({$uid},{$coachid})";
     echo $sql;
     die;
     $model = new Model();
     $result = $model->query($sql);
     var_dump($result);
     foreach ($result as $value) {
         if ($value['id'] == $uid) {
             //用户
             $userNicker = $value['nicker'];
         } else {
             if ($value['id'] == $coachid) {
                 $coachName = $value['name'];
             }
         }
     }
     $strDate = timeToString($time);
     $strTicker = 'Hi,' . $userNicker . ' 你有新的计划啦,查看';
     $strTitle = 'Hi,' . $userNicker . ' 你有新的计划啦,查看';
     $strText = "Hi,{$userNicker} 你的教练{$coachName给你安排了}{$strDate的新的训练计划啦}  记得去查看哦";
     //发通知
     sendDeviceUnicast($uid, $strTicker, $strTitle, $strText);
     die;
     //xplan_images/action_f_coverimg
     //http://123.57.135.102/xplan_headers/ac_x001z.jpg
     //fcoverimg
     // $model = new Model('action');
     // $result = $model->select();
     // for ($i=0; $i < count($result); $i++) {
     //     $filename = basename($result[$i]['coverimg']);
     //     $fcoverimg = 'http://123.57.135.102/xplan_images/action_f_coverimg/'.$filename;
     //     $data['fcoverimg'] = $fcoverimg;
     //     $model->where('id='.$result[$i]['id'])->save($data);
     // }
     // $user = '******';
     // $comment = 'd:/comment.xml';
     // $xml = simplexml_load_file($comment);
     // $model_user_info = new Model('user_info');
     // $model_comment = new Model('comment');
     // $data = array();
     // foreach($xml->children() as $child){
     //     $record_name = $child->getName();
     //     if($record_name == 'RECORD'){
     //         foreach ($child as $subchild) {
     //            $key = $subchild->getName();
     //            if($key == 'coachid'){
     //                 $data['coachid'] = (int)$subchild;
     //            }else if($key == 'userid'){
     //                 $data['userid'] = (int)$subchild + 1251;
     //            }else if($key == 'content'){
     //                 $data['content'] = (string)$subchild;
     //            }else if($key == 'time'){
     //                 $data['time'] = (int)$subchild;
     //            }
     //         }
     //         $model_comment->add($data);
     //     }
     // }
     // foreach($xml->children() as $child){
     //     $record_name = $child->getName();
     //     if($record_name == 'RECORD'){
     //         foreach ($child as $subchild) {
     //            $key = $subchild->getName();
     //            if($key == 'username'){
     //                 $data['username'] = (string)$subchild;
     //            }else if($key == 'password'){
     //                 $data['password'] = (string)$subchild;
     //            }else if($key == 'name'){
     //                 $data['name'] = (string)$subchild;
     //            }else if($key == 'gender'){
     //                 $data['gender'] = (string)$subchild;
     //            }else if($key == 'header'){
     //                 $data['header'] = (string)$subchild;
     //            }else if($key == 'nicker'){
     //                 $data['nicker'] = (string)$subchild;
     //            }else if($key == 'height'){
     //                 $data['height'] = (string)$subchild;
     //            }else if($key == 'weight'){
     //                 $data['weight'] = (string)$subchild;
     //            }else if($key == 'type'){
     //                 $data['type'] = (string)$subchild;
     //            }else if($key == 'qq'){
     //                 $data['qq'] = (string)$subchild;
     //            }else if($key == 'weixin'){
     //                 $data['weixin'] = (string)$subchild;
     //            }else if($key == 'phone'){
     //                 $data['phone'] = (string)$subchild;
     //            }else if($key == 'weibo'){
     //                 $data['weibo'] = (string)$subchild;
     //            }else if($key == 'city'){
     //                 $data['city'] = (string)$subchild;
     //            }else if($key == 'birthday'){
     //                 $data['birthday'] = (string)$subchild;
     //            }else if($key == 'email'){
     //                 $data['email'] = (string)$subchild;
     //            }else if($key == 'regtime'){
     //                 $data['regtime'] = (int)$subchild + 123;
     //            }
     //         }
     //        $model_user_info->add($data);
     //        unset($data);
     //     }
     // }
     // echo "添加评论成功";
 }