예제 #1
0
 /**
  * Method invoking the hook-methods to generate a form.
  *
  * @param string $strTargetModule
  * @param string $strTargetAction
  * @param string|class_admin_formgenerator $objAdminForm
  *
  * @return string
  */
 public final function generateAdminForm($strTargetModule = "system", $strTargetAction = "systemTasks", $objAdminForm = null)
 {
     $strReturn = "";
     $objAdminForm = $objAdminForm == null ? $this->getAdminForm() : $objAdminForm;
     if ($objAdminForm instanceof class_admin_formgenerator) {
         $objAdminForm->addField(new class_formentry_hidden("", "execute"))->setStrValue("true");
         $objAdminForm->addField(new class_formentry_button("", "systemtask_run"))->setStrLabel($this->objLang->getLang("systemtask_run", "system"))->setStrValue("submit");
         if ($this->bitMultipartform) {
             $objAdminForm->setStrFormEncoding(class_admin_formgenerator::FORM_ENCTYPE_MULTIPART);
         }
         $strLink = class_link::getLinkAdminHref($strTargetModule, $strTargetAction, "task=" . $this->getStrInternalTaskName());
         $strReturn = $objAdminForm->renderForm($strLink, 0);
     } else {
         if ($objAdminForm != "") {
             if ($this->bitMultipartform) {
                 $strReturn .= $this->objToolkit->formHeader(class_link::getLinkAdminHref($strTargetModule, $strTargetAction, "task=" . $this->getStrInternalTaskName()), "taskParamForm", class_admin_formgenerator::FORM_ENCTYPE_MULTIPART);
             } else {
                 $strReturn .= $this->objToolkit->formHeader(class_link::getLinkAdminHref($strTargetModule, $strTargetAction, "task=" . $this->getStrInternalTaskName()), "taskParamForm");
             }
             $strReturn .= $objAdminForm;
             $strReturn .= $this->objToolkit->formInputHidden("execute", "true");
             $strReturn .= $this->objToolkit->formInputSubmit($this->objLang->getLang("systemtask_run", "system"));
             $strReturn .= $this->objToolkit->formClose();
         }
     }
     return $strReturn;
 }
예제 #2
0
 /**
  * Returning an instance of class_lang
  *
  * @return class_lang
  */
 public static function getInstance()
 {
     if (self::$objLang == null) {
         self::$objLang = new class_lang();
     }
     return self::$objLang;
 }
예제 #3
0
 /**
  * Used to load a property.
  * If you want to provide a list of parameters but no module (automatic loading), pass
  * the parameters array as the second argument (an array). In this case the module is resolved
  * internally.
  *
  * @param string $strName
  * @param string|array $strModule Either the module name (if required) or an array of parameters
  * @param array $arrParameters
  *
  * @return string
  */
 public function getLang($strName, $strModule = "", $arrParameters = array())
 {
     if (is_array($strModule)) {
         $arrParameters = $strModule;
     }
     if ($strModule == "" || is_array($strModule)) {
         $strModule = $this->getArrModule("modul");
     }
     //Now we have to ask the Text-Object to return the text
     return $this->objLang->getLang($strName, $strModule, $arrParameters);
 }
 /**
  * @return string
  */
 public function getReport()
 {
     $strReturn = "";
     //Create Data-table
     $arrHeader = array();
     $arrValues = array();
     //Fetch data
     $arrStats = $this->getTopVisitors();
     //calc a few values
     $intSum = 0;
     foreach ($arrStats as $arrOneStat) {
         $intSum += $arrOneStat["anzahl"];
     }
     $intI = 0;
     $objUser = new class_module_user_user(class_session::getInstance()->getUserID());
     foreach ($arrStats as $arrOneStat) {
         //Escape?
         if ($intI >= $objUser->getIntItemsPerPage()) {
             break;
         }
         $arrValues[$intI] = array();
         $arrValues[$intI][] = $intI + 1;
         if ($arrOneStat["stats_hostname"] != "" and $arrOneStat["stats_hostname"] != "na") {
             $arrValues[$intI][] = $arrOneStat["stats_hostname"];
         } else {
             $arrValues[$intI][] = $arrOneStat["stats_ip"];
         }
         $arrValues[$intI][] = $arrOneStat["anzahl"];
         $arrValues[$intI][] = $this->objToolkit->percentBeam($arrOneStat["anzahl"] / $intSum * 100);
         $strUtraceLinkMap = "href=\"http://www.utrace.de/ip-adresse/" . $arrOneStat["stats_ip"] . "\" target=\"_blank\"";
         $strUtraceLinkText = "href=\"http://www.utrace.de/whois/" . $arrOneStat["stats_ip"] . "\" target=\"_blank\"";
         if ($arrOneStat["stats_ip"] != "127.0.0.1" && $arrOneStat["stats_ip"] != "::1") {
             $arrValues[$intI][] = class_link::getLinkAdminManual($strUtraceLinkMap, "", $this->objLang->getLang("login_utrace_showmap", "user"), "icon_earth") . " " . class_link::getLinkAdminManual($strUtraceLinkText, "", $this->objLang->getLang("login_utrace_showtext", "user"), "icon_text");
         } else {
             $arrValues[$intI][] = getImageAdmin("icon_earthDisabled", $this->objLang->getLang("login_utrace_noinfo", "user")) . " " . getImageAdmin("icon_textDisabled", $this->objLang->getLang("login_utrace_noinfo", "user"));
         }
         $intI++;
     }
     //HeaderRow
     $arrHeader[] = "#";
     $arrHeader[] = $this->objLang->getLang("top_visitor_titel", "stats");
     $arrHeader[] = $this->objLang->getLang("commons_hits_header", "stats");
     $arrHeader[] = $this->objLang->getLang("anteil", "stats");
     $arrHeader[] = $this->objLang->getLang("login_utrace", "user");
     $strReturn .= $this->objToolkit->dataTable($arrHeader, $arrValues);
     $strReturn .= $this->objToolkit->getTextRow($this->objLang->getLang("stats_hint_task", "stats"));
     return $strReturn;
 }
예제 #5
0
 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";
 }
예제 #6
0
<?php

if (!preg_match('/(noxx|florensia-base\\.com)/i', $_SERVER['HTTP_REFERER'])) {
    die;
}
require_once "./confg.php";
require_once $cfg['root_abs'] . "/class_lang.php";
$flolang = new class_lang();
/*	workaround so no need to include whole forum-class	*/
class parser
{
    function parse_message($text, $settings = array())
    {
        return $text;
    }
}
$parser = new parser();
/*	END	*/
preg_match('/^([a-z]+)\\./', $_SERVER['SERVER_NAME'], $subdomain);
if (is_dir($cfg['language_abs'] . '/' . $subdomain[1]) && $subdomain[1] != "") {
    $flolang->language = $subdomain[1];
}
$flolang->load("global");
$db = MYSQL_CONNECT($cfg['dbhost'], $cfg['dbuser'], $cfg['dbpasswd']) or die("No Database connection");
MYSQL_SELECT_DB($cfg['dbname'], $db) or die("No Database connection");
MYSQL_QUERY("SET NAMES 'utf8'");
require_once $cfg['root_abs'] . "/functions.php";
define('is_florensia', 1);
require_once $cfg['root_abs'] . "/class_florensia.php";
$florensia = new class_florensia();
$color1 = 255;
예제 #7
0
define('is_florensia', '1');
require_once $cfg['root_abs'] . "/class_florensia.php";
$florensia = new class_florensia();
foreach ($cfg as $varname => $varvalue) {
    $florensia->{$varname} = $varvalue;
}
define("KILL_GLOBALS", 1);
define("IN_MYBB", 1);
require $florensia->forum . "/global.php";
require_once MYBB_ROOT . "inc/functions_user.php";
require_once MYBB_ROOT . "inc/class_parser.php";
$parser = new postParser();
$lang->load("member");
#date_default_timezone_set("System/Localtime"); # use system time for all date() calculations
require_once $cfg['root_abs'] . "/class_lang.php";
$flolang = new class_lang();
if (is_dir($cfg['language_abs'] . '/' . $subdomain[1]) && $subdomain[1] != "") {
    $flolang->language = $subdomain[1];
}
$flolang->load("global");
$flolang->load("market");
$flolang->load("tabbar");
$florensia->root = str_replace('http://www.', 'http://' . $flolang->language . '.', $florensia->root);
$flolang->get_languages();
require_once "{$florensia->root_abs}/class_stringtable.php";
$stringtable = new class_stringtable();
$stringtable->get_valid_languages();
$stringtable->language = $flolang->lang[$flolang->language]->prefered_stringtablelang;
if (isset($_POST['quicksearch'])) {
    $_GET['names'] = $_POST['names'];
}
 /**
  * @param string $strTargetURI If you pass null, no form-tags will be rendered.
  * @param int $intButtonConfig a list of buttons to attach to the end of the form. if you need more then the obligatory save-button,
  *                             pass them combined by a bitwise or, e.g. class_admin_formgenerator::BIT_BUTTON_SAVE | class_admin_formgenerator::$BIT_BUTTON_CANCEL
  *
  * @throws class_exception
  * @return string
  */
 public function renderForm($strTargetURI, $intButtonConfig = 2)
 {
     $strReturn = "";
     //add a hidden systemid-field
     if ($this->objSourceobject != null) {
         $objField = new class_formentry_hidden($this->strFormname, "systemid");
         $objField->setStrEntryName("systemid")->setStrValue($this->objSourceobject->getSystemid())->setObjValidator(new class_systemid_validator());
         $this->addField($objField);
     }
     $objToolkit = class_carrier::getInstance()->getObjToolkit("admin");
     if ($strTargetURI !== null) {
         $strReturn .= $objToolkit->formHeader($strTargetURI, "", $this->strFormEncoding, $this->strOnSubmit);
     }
     $strReturn .= $objToolkit->getValidationErrors($this);
     $strHidden = "";
     foreach ($this->arrFields as $objOneField) {
         if (in_array($objOneField->getStrEntryName(), $this->arrHiddenElements)) {
             $strHidden .= $objOneField->renderField();
         } else {
             $strReturn .= $objOneField->renderField();
         }
     }
     if ($strHidden != "") {
         $strReturn .= $objToolkit->formOptionalElementsWrapper($strHidden, $this->strHiddenGroupTitle, $this->bitHiddenElementsVisible);
     }
     if ($intButtonConfig & self::BIT_BUTTON_SUBMIT) {
         $strReturn .= $objToolkit->formInputSubmit(class_lang::getInstance()->getLang("commons_submit", "system"), "submitbtn");
     }
     if ($intButtonConfig & self::BIT_BUTTON_SAVE) {
         $strReturn .= $objToolkit->formInputSubmit(class_lang::getInstance()->getLang("commons_save", "system"), "submitbtn");
     }
     if ($intButtonConfig & self::BIT_BUTTON_CANCEL) {
         $strReturn .= $objToolkit->formInputSubmit(class_lang::getInstance()->getLang("commons_cancel", "system"), "cancelbtn");
     }
     if ($intButtonConfig & self::BIT_BUTTON_CLOSE) {
         $strReturn .= $objToolkit->formInputSubmit(class_lang::getInstance()->getLang("commons_close", "system"), "closebtn");
     }
     if ($intButtonConfig & self::BIT_BUTTON_DELETE) {
         $strReturn .= $objToolkit->formInputSubmit(class_lang::getInstance()->getLang("commons_delete", "system"), "deletebtn");
     }
     if ($intButtonConfig & self::BIT_BUTTON_RESET) {
         $strReturn .= $objToolkit->formInputSubmit(class_lang::getInstance()->getLang("commons_reset", "system"), "reset", "", "cancelbutton");
     }
     if ($intButtonConfig & self::BIT_BUTTON_CONTINUE) {
         $strReturn .= $objToolkit->formInputSubmit(class_lang::getInstance()->getLang("commons_continue", "system"), "continuebtn");
     }
     if ($intButtonConfig & self::BIT_BUTTON_BACK) {
         $strReturn .= $objToolkit->formInputSubmit(class_lang::getInstance()->getLang("commons_back", "system"), "backbtn");
     }
     if ($strTargetURI !== null) {
         $strReturn .= $objToolkit->formClose();
     }
     if (count($this->arrFields) > 0) {
         reset($this->arrFields);
         do {
             $objField = current($this->arrFields);
             if (!$objField instanceof class_formentry_hidden && !$objField instanceof class_formentry_plaintext && !$objField instanceof class_formentry_headline && !$objField instanceof class_formentry_divider) {
                 $strReturn .= $objToolkit->setBrowserFocus($objField->getStrEntryName());
                 break;
             }
         } while (next($this->arrFields) !== false);
     }
     //lock the record to avoid multiple edit-sessions - if in edit mode
     if ($this->objSourceobject != null && method_exists($this->objSourceobject, "getLockManager")) {
         $bitSkip = false;
         if ($this->getField("mode") != null && $this->getField("mode")->getStrValue() == "new") {
             $bitSkip = true;
         }
         if (!$bitSkip && !validateSystemid($this->objSourceobject->getSystemid())) {
             $bitSkip = true;
         }
         if (!$bitSkip) {
             if ($this->objSourceobject->getLockManager()->isAccessibleForCurrentUser()) {
                 $this->objSourceobject->getLockManager()->lockRecord();
             } else {
                 $objUser = new class_module_user_user($this->objSourceobject->getLockManager()->getLockId());
                 throw new class_exception("Current record is already locked by user '" . $objUser->getStrDisplayName() . "'.\nCannot be locked for the current user", class_exception::$level_ERROR);
             }
         }
     }
     return $strReturn;
 }
예제 #9
0
/* * * */
$db = MYSQL_CONNECT($cfg['dbhost'], $cfg['dbuser'], $cfg['dbpasswd']) or die("No Database connection");
MYSQL_SELECT_DB($cfg['dbname'], $db) or die("No Database connection");
MYSQL_QUERY("SET NAMES 'utf8'");
/*	workaround so no need to include whole forum-class	*/
class parser
{
    function parse_message($text, $settings = array())
    {
        return $text;
    }
}
$parser = new parser();
/*	END	*/
require_once "{$cfg['root_abs']}/class_lang.php";
$flolang = new class_lang();
require_once $cfg['root_abs'] . "/class_character.php";
preg_match('/^([a-z]{2})/', $_GET['sig'], $language);
if (is_dir($cfg['language_abs'] . '/' . $language[1]) && $language[1] != "") {
    $flolang->language = $language[1];
}
$flolang->load("signature");
/*
 * Loading character...
 */
preg_match("/^([a-z]{2}|0){$sep}([0-9t]+){$sep}(.+)\\.(png|gif)\$/", $_GET['sig'], $character);
$character = explode($sep, $character[3]);
foreach ($character as $charname) {
    if (trim($charname) == "0" or $charname == "") {
        $charinfo['placeholder_' . bcadd(count($charinfo), 1)] = 0;
        continue;
예제 #10
0
 /**
  * Generates a list of errors found by the form-validation
  *
  * @param class_admin_controller|class_admin_formgenerator $objCalling
  * @param string $strTargetAction
  *
  * @return string
  */
 public function getValidationErrors($objCalling, $strTargetAction = null)
 {
     $strRendercode = "";
     //render mandatory fields?
     if (method_exists($objCalling, "getRequiredFields") && is_callable(array($objCalling, "getRequiredFields"))) {
         if ($objCalling instanceof class_admin_formgenerator) {
             $arrFields = $objCalling->getRequiredFields();
         } else {
             $strTempAction = $objCalling->getAction();
             $objCalling->setAction($strTargetAction);
             $arrFields = $objCalling->getRequiredFields();
             $objCalling->setAction($strTempAction);
         }
         if (count($arrFields) > 0) {
             $strRendercode .= "<script type=\"text/javascript\">\$(document).ready(function () {\r\n                        KAJONA.admin.forms.renderMandatoryFields([";
             foreach ($arrFields as $strName => $strType) {
                 $strRendercode .= "[ '" . $strName . "', '" . $strType . "' ], ";
             }
             $strRendercode .= " [] ]); });</script>";
         }
     }
     $arrErrors = method_exists($objCalling, "getValidationErrors") ? $objCalling->getValidationErrors() : array();
     if (count($arrErrors) == 0) {
         return $strRendercode;
     }
     $strTemplateID = $this->objTemplate->readTemplate("/elements.tpl", "error_container");
     $strTemplateRowID = $this->objTemplate->readTemplate("/elements.tpl", "error_row");
     $strRows = "";
     $strRendercode .= "<script type=\"text/javascript\">\$(document).ready(function () {\r\n            KAJONA.admin.forms.renderMissingMandatoryFields([";
     foreach ($arrErrors as $strKey => $arrOneErrors) {
         foreach ($arrOneErrors as $strOneError) {
             $strRows .= $this->objTemplate->fillTemplate(array("field_errortext" => $strOneError), $strTemplateRowID);
             $strRendercode .= "[ '" . $strKey . "' ], ";
         }
     }
     $strRendercode .= " [] ]); });</script>";
     $arrTemplate = array();
     $arrTemplate["errorrows"] = $strRows;
     $arrTemplate["errorintro"] = class_lang::getInstance()->getLang("errorintro", "system");
     return $this->objTemplate->fillTemplate($arrTemplate, $strTemplateID) . $strRendercode;
 }
예제 #11
0
 /**
  * Loads a text-fragement from the textfiles
  *
  * @param string $strKey
  * @param array $arrParameters
  *
  * @return string
  */
 public final function getLang($strKey, $arrParameters = array())
 {
     return $this->objLang->getLang($strKey, "adminwidget", $arrParameters);
 }
예제 #12
0
 /**
  * Managing access to the text object. Use ONLY this method to
  * get an instance!
  *
  * @return class_lang
  */
 public function getObjLang()
 {
     //Do we have to generate the object?
     if ($this->objLang == null) {
         $this->objLang = class_lang::getInstance();
     }
     return $this->objLang;
 }
예제 #13
0
 /**
  * Loads a text
  *
  * @param string $strKey
  * @param array $arrParameters
  *
  * @return string
  */
 private function getLang($strKey, $arrParameters = array())
 {
     return $this->objLang->getLang($strKey, "installer", $arrParameters);
 }