function ShowProduct($id_product) { $objResponse = new xajaxResponse(); $bError = false; $stringutil = new String(""); $tempname = "en_title"; $tempdescription = "en_detaileddescription"; $SQL = "SELECT {$tempname},{$tempdescription} FROM " . DB_PREFIX . "product WHERE id_product='" . $id_product . "'"; //$objResponse->addAlert($SQL); $retid = mysql_query($SQL); if (!$retid) { echo mysql_error(); } if ($row = mysql_fetch_array($retid)) { $name = $row[$tempname]; $description = $stringutil->cleanDescription2($row[$tempdescription]); } $ft = new FastTemplate(TEMPLATE_PATH); $ft->define(array("main" => "product_rightmenu.html")); $ft->assign("NAME", $name); //if (NONSEO==1) $ft->assign("URL_TYPE", "product.php?name=".$stringutil->CleanLink($name)."&id=".$id_product.""); //else $ft->assign("URL_TYPE", "product.php/".$stringutil->CleanLink($name)."/".$id_product."/"); $ft->assign("DESCRIPTION", $description); $ft->multiple_assign_define("LANG_"); $ft->parse("mainContent", "main"); $ft->showDebugInfo(ERROR_DEBUG); $c = $ft->fetch("mainContent"); //$objResponse->addAlert($c); $objResponse->addAssign("body_firstpage_background_right", "innerHTML", $c); return $objResponse; }
foreach ($xmlarray['data'] as $item) { if (!empty($fields)) { $fields .= ";"; } $fields .= $item['function']; if (!empty($example)) { $example .= ";"; } $example .= $item['function']; } // print_r($xmlarray);exit; $ft->assign("DEV_NAME", $xmlarray['developername']); $ft->assign("PROJECT_NAME", $xmlarray['projectname']); $ft->assign("CLASS_NAME", $xmlarray['classname']); $ft->assign("VAR_NAME", $xmlarray['varname']); $ft->assign("TABLE", $xmlarray['tablename']); $ft->assign("DISABLE_SOME_FIELDS", ' '); $ft->assign("DBFIELDS_EN", strtolower($fields)); $fields_noen = str_replace("_en", "", $fields); $ft->assign("DBFIELDS", $fields_noen); $tokexample = explode(";", $fields_noen); $tokenr = sizeof($tokexample); $ft->assign("EXAMPLE", $example); } else { header("Location: index.php"); exit; } } $ft->parse("BODY", array("content", "main")); print $ft->fetch("BODY");
/** * * @author - Elteto Zoltan * @desc - get the sidebar from table * @vers - 1.0 */ public function getSideBar() { $ft = new FastTemplate(ADMIN_TEMPLATE_CONTENT_PATH); $ft->define(array("main" => "sidebar.html")); $template = $ft->get_template("sidebar.html"); $var_array = $ft->getPrefPatternVariables("IS_", $template); // only show if is available $SQL = "SELECT * FROM `" . DB_PREFIX . $this->table_name . "` WHERE availability=1 ORDER BY `position` ASC"; $retid = mysql_query($SQL); if (!$retid) { echo mysql_error(); } $i = 0; if ($row = mysql_fetch_array($retid)) { do { $module_id[$i] = $row["module_id"]; $module_name[$i] = $row["module_name"]; $availability[$i] = $row["availability"]; $filename[$i] = $row["filename"]; $extra_menu[$i] = $row["extra_menu"]; $restriction_name[$i] = $row["restriction_name"]; $i++; } while ($row = mysql_fetch_array($retid)); } $nrmodules = $i; if ($nrmodules == 0) { $ft->assign("SIDEBAR_EXIST", 0); } else { $ft->assign("SIDEBAR_EXIST", 1); $ft->setPattern(array("LANG_", "CONF_")); $ft->define_dynamic("sideex", "main"); for ($i = 0; $i < $nrmodules; $i++) { $ft->assign("MODULE_NAME", constant($module_name[$i])); $ft->assign("FILENAME", $filename[$i]); //restriction if (!empty($restriction_name[$i])) { $tmp = array($restriction_name[$i]); foreach ($var_array as $value) { $ft->assign("{$value}", in_array($value, $tmp) ? 0 : 1); } } else { foreach ($var_array as $value) { $ft->assign("{$value}", 1); } } // could be extra details what admin want to show. This is in extra_menu field. if (!empty($extra_menu[$i])) { $var_lang_array = $ft->getPrefPatternVariables("LANG_", $extra_menu[$i]); foreach ($var_lang_array as $language) { $extra_menu[$i] = str_replace("{" . $language . "}", constant($language), $extra_menu[$i]); } $ft->assign("ISEXTRA_MENU", 1); $ft->assign("EXTRA_MENU", $extra_menu[$i]); } else { $ft->assign("ISEXTRA_MENU", 0); } $ft->parse("SIDEEX", ".sideex"); } } $ft->multiple_assign_define("LANG_"); $ft->multiple_assign_define("CONF_"); $ft->parse("mainContent", "main"); return $ft->fetch("mainContent"); }
/* Send error to ADMIN. High traffic websites have the potential to generate A LOT of emails so make sure you setup some sort of email filter for these error notifications so they don't flood your inbox. */ $ftea = new FastTemplate(EMAIL_PATH); $ftea->define(array("main" => "template_index.html", "content" => "error.html")); $ftea->assign("IP", $ip); $ftea->assign("SERVER_NAME", $server_name); $ftea->assign("REQUEST_URI", $request_uri); $ftea->assign("HTTP_REF", $http_ref); $ftea->assign("HTTP_AGENT", $http_agent); $ftea->assign("ERROR_DATE", $error_date); $ftea->assign("ERROR_CODE", $error_code); $ftea->multiple_assign_define("CONF_"); $ftea->multiple_assign_define("LANG_"); $ftea->parse("CONTENT", "content"); $ftea->parse("BODY", "main"); $subject = $error_code; $message = $ftea->fetch("BODY"); $mail = new UniversalMailSender("2"); $mail->setToAddress(EMAIL_INREG, EMAIL_NAME); $mail->setFromAddress(EMAIL_INREG, EMAIL_NAME); $mail->setSubject($subject); $mail->setType(2); $mail->setHtmlMessage($message); $mail->SendMail(); $ft->parse("BODY", array("content", "main")); $ft->showDebugInfo(ERROR_DEBUG); $ft->FastPrint();
} $output .= "<h4><a href=\"../../" . $teamcode . "/" . $row['package'] . "/index.php\">" . $row['package'] . "</a></h4>\n" . "<table border=\"0\" cellpadding=\"2\">\n" . "<tr bgcolor=\"#f0f0ff\"><td><i>filename</i></td><td><i>translated</i></td>" . "<td><i>fuzzy</i></td><td><i>untranslated</i></td></tr>\n"; $package = $row['package']; } $filename = preg_replace('/\\.po$/', "", $row['filename']); $cvsurl = cvsweburl($rev, $teamcode, $package, $row['filename']); $output .= "<tr bgcolor=\"#f8f8f8\"><td><a href=\"{$cvsurl}\">{$filename}</a></td><td>" . $row['translated'] . "</td><td>" . $row['fuzzy'] . "</td><td>" . $row['untranslated'] . "</td></tr>\n"; $count++; } if ($count == 0) { $output .= "<table border=\"0\" cellpadding=\"2\">\n" . "<tr><td>There's no files available.</td></tr>\n"; } $output .= "</table>\n\n"; $tplp4->assign(array(TXT_TEAMNAME => $teamname, TXT_TEAMCODE => $teamcode, TXT_TEAMCODE2 => strtoupper($teamcode), TEAMLIST => $teamlist, CONTENT => $output)); $tplp4->parse(MAIN, "level2partial"); writefile("{$outdir}/{$rev}/partial/{$teamcode}/index.php", $tplp4->fetch()); } // render HTML/PHP pages by KDE package for level 2 & 3 foreach ($m_packages as $package) { debug(10, "render level2 for '{$package}' package"); $output = ""; $total_error = 0; $total_translated = 0; $total_fuzzy = 0; $total_untranslated = 0; // make dirpath for $rev & current package if (!is_dir("{$outdir}/{$rev}/{$package}")) { if (!@mkdir("{$outdir}/{$rev}/{$package}", 0755)) { die("Cannot make {$outdir}/{$rev}/{$package} directory!"); } }
function bind_generartemplate($dominio) { //Generar conf apache require_once _CFG_INTERFACE_FASTTEMPLATE; $tpl = new FastTemplate(_CFG_INTERFACE_PLANTILLAS); $tpl->define(array(main => "bind.tpl")); $tpl->assign(SERVER_NAME, _CFG_SERVER_NAME); $tpl->assign(SERVER_NS, _CFG_SERVER_NS); $tpl->assign(SERVER_IP, _CFG_SERVER_IP); if ($dominio != "") { $tpl->assign(DOMINIO, $dominio); } $tpl->parse(CONTENT, "main"); $contenido = $tpl->fetch(CONTENT); return $contenido; //Fin configuración apache }
function awstats_generartemplate($dominio, $usuario) { //Generar conf require_once _CFG_INTERFACE_FASTTEMPLATE; $tpl = new FastTemplate(_CFG_INTERFACE_PLANTILLAS); $tpl->define(array(main => "awstats.tpl")); $tpl->assign(APACHE_LOGS, _CFG_APACHE_LOGS); $tpl->assign(APACHE_STRING_AWSTATS, _CFG_LOGROTATE_CFG_AWSTATSTRING); $tpl->assign(AWSTATS_DATADIR, _CFG_AWSTATS_DATADIR); if ($dominio != "") { $tpl->assign(DOMINIO, $dominio); $tpl->assign(AWSTATS_USUARIO, $usuario); $tpl->assign(DOMINIO_SIN, fnStripSLD($dominio)); $tpl->assign(DOMINIO_EXT, fnStripTLD($dominio)); } $tpl->parse(CONTENT, "main"); $contenido = $tpl->fetch(CONTENT); return $contenido; }
function make_infobypackage($outfile = "") { global $dbh, $currdate, $rundate, $rev, $m_teams; debug(10, "making compact info page by package"); $output = "\n"; $total_errors = 0; $total_translated = 0; $total_fuzzy = 0; $total_untranslated = 0; $total_total = 0; $tpl = new FastTemplate("./templates/"); $tpl->define(array("index" => "indexbypackage.tpl")); $results = @mysql_query("SELECT package, SUM(translated) AS translated, SUM(fuzzy) AS fuzzy, " . " SUM(untranslated) AS untranslated, SUM(total) AS total, " . " SUM(error) AS error FROM sum WHERE rev='{$rev}' AND team<>'templates' " . " GROUP BY package ORDER BY package", $dbh); if (!$results) { send_err("SQL error: bypackage"); exit; } while ($row = @mysql_fetch_array($results)) { $output .= bypackage_line1($row['package'], $row['error'], $row['translated'], $row['fuzzy'], $row['untranslated'], $row['total']); $total_errors += $row['error']; $total_translated += $row['translated']; $total_fuzzy += $row['fuzzy']; $total_untranslated += $row['untranslated']; $total_total += $row['total']; } // writing totalizing line $output .= bypackage_total1($total_errors, $total_translated, $total_fuzzy, $total_untranslated, $total_total); // parsing & writing PHP/HTML output $tpl->assign(array("TXT_DATE" => $currdate, "TXT_RUNDATE" => $rundate, "TXT_REV" => $rev, "TABLE" => $output)); $tpl->parse("MAIN", "index"); writefile($outfile, $tpl->fetch()); }
$password = $row["value"]; } while ($row = mysql_fetch_array($retid)); } $to = ""; $subject = ""; $headers = ""; $message = ""; $fte = new FastTemplate(EMAIL_PATH); $fte->define(array("main" => "emailpasswordrecovery.html")); $fte->assign("USERID", $username); $fte->assign("PASSWORD", $password); $fte->multiple_assign_define("LANG_"); $fte->multiple_assign_define("CONF_"); $fte->parse("mainContent", "main"); $fte->showDebugInfo(ERROR_DEBUG); $message = $fte->fetch("mainContent"); // se trimite scrisoarea $univMail = new UniversalMailSender("2"); // setting up the to address $univMail->setToAddress($email, $username); // setting up from address $univMail->setFromAddress($email, $username); // setting up subject $univMail->setSubject($all_url_vars['newslettersubject']); // setting up from text message if the type is text message $univMail->setTextMessage($message); // setting up from text message if the type is html message $univMail->setHtmlMessage($message); // sending the mail; returns an error message $ok = $univMail->SendMail(); header("Location: login.php?message=" . LANG_ADMIN_PASSWORD_SENTSUCCESSFULLY);
$ftphp->assign("STR_HEX_START", $str_hex_start); $ftphp->assign("STR_HEX_END", $str_hex_end); //$ftphp->assign ( "FORM_ELEMUPPER", strtoupper ( $field ) ); $ftphp->parse("GET_ELEMENTS", ".get_elements"); $ftphp->parse("SET_ELEMENTS", ".set_elements"); $ftphp->parse("FORMELEMENTS", ".formelements"); $ftphp->parse("ERRFORMELEMENTS", ".errformelements"); $ftphp->parse("ERRMODFORMELEMENTS", ".errmodformelements"); $ftphp->parse("UNSETFORMELEMENTS", ".unsetformelements"); if ($it == "browse") { $ftphp->parse("SWITCHELEMENTS", ".switchelements"); } $k++; } $ftphp->parse("BODY", array("main")); $outphp = $ftphp->fetch("BODY"); $outphp = str_replace("#_", "{", $outphp); $outphp = str_replace("_#", "}", $outphp); if ($fp = fopen(GEN_ADMIN_PATH . $NAME . ".php", 'w')) { fwrite($fp, $outphp); fclose($fp); //$beautify = new PhpBeautifier ( ); //$beautify->tokenSpace = true; //put space between tokens //$beautify->blockLine = true; //put empty lines between blocks of code (if, while etc) ////$beautify->optimize = true; //optimize strings (for now), if a double quoted string does not contain variables of special carachters transform it to a single quoted string to save parsing time //$beautify->file ( GEN_ADMIN_PATH . $NAME . ".php", GEN_ADMIN_PATH . $NAME . ".php" ); } $ftphp->parse("BODY", array("main_user")); $outphp = $ftphp->fetch("BODY"); $outphp = str_replace("#_", "{", $outphp); $outphp = str_replace("_#", "}", $outphp);
function apache_generartemplate($dominio, $variables, $subdominio) { //Generar conf apache require_once _CFG_INTERFACE_FASTTEMPLATE; $tpl = new FastTemplate(_CFG_INTERFACE_PLANTILLAS); if ($subdominio) { if ($variables["APACHE_CGIBIN"] == 1) { $tpl->define(array(main => "subapache-cgi.tpl")); } else { $tpl->define(array(main => "subapache.tpl")); } } else { if ($variables["APACHE_CGIBIN"] == 1) { $tpl->define(array(main => "apache-cgi.tpl")); } else { $tpl->define(array(main => "apache.tpl")); } } if ($subdominio) { $substrip = substr($dominio, 0, strpos($dominio, ".") + 1); $domstrip = substr($dominio, strpos($dominio, ".") + 1); $tpl->assign(SUBDOMINIO, $substrip); $tpl->assign(DOMINIO, $domstrip); if ($variables["APACHE_DOCUMENTROOT"] != _CFG_APACHE_DESACTIVADO) { $tpl->assign(APACHE_SUBDOCUMENTROOT, substr($variables["APACHE_DOCUMENTROOT"], 0, -strlen($substrip))); } else { $tpl->assign(APACHE_SUBDOCUMENTROOT, $variables["APACHE_DOCUMENTROOT"]); } } else { $tpl->assign(DOMINIO, $dominio); } $tpl->assign(CFG_ESTADO, $variables["CFG_ESTADO"]); $tpl->assign(CFG_DOCUMENTROOT, $variables["CFG_DOCUMENTROOT"]); $tpl->assign(APACHE_ALIAS, $variables["APACHE_ALIAS"]); $tpl->assign(APACHE_INDEXES, $variables["APACHE_INDEXES"]); $tpl->assign(APACHE_MULTIVIEWS, $variables["APACHE_MULTIVIEWS"]); $tpl->assign(APACHE_DOCUMENTROOT, $variables["APACHE_DOCUMENTROOT"]); $tpl->assign(APACHE_LOGS, _CFG_APACHE_LOGS); $tpl->assign(APACHE_STRING_AWSTATS, _CFG_LOGROTATE_CFG_AWSTATSTRING); $tpl->assign(PHP_REGISTERGLOBAL, $variables["PHP_REGISTERGLOBAL"]); $tpl->assign(PHP_SAFEMODE, $variables["PHP_SAFEMODE"]); $tpl->assign(PHP_UPLOAD, $variables["PHP_UPLOAD"]); $tpl->assign(SERVER_NAME, _CFG_SERVER_NAME); $tpl->parse(CONTENT, "main"); $contenido = $tpl->fetch(CONTENT); //Escribiendo fichero de configuración de apache $filename = _CFG_APACHE_CONF . $dominio . "_conf"; if (!($handle = fopen($filename, 'w'))) { echo "No se ha podido abrir el fichero ({$filename})"; return false; exit; } if (fwrite($handle, $contenido) === FALSE) { echo "No se ha podido abrir el fichero ({$filename})"; return false; exit; } fclose($handle); return true; //Fin configuración apache }
$ft->assign("EXIT", ""); } } $ft->parse("UPDATE", ".update"); } } $ft->parse("BODY", array("content", "main")); //$ft->FastPrint(); $session->set("functions", $functions); $session->set("fields", $fields); $session->set("author", $all_url_vars['author']); $session->set("projectname", $all_url_vars['projectname']); $session->set("date", date("Y:m:d")); $session->set("variable", $all_url_vars['varname']); $session->set("tablename", $all_url_vars['table']); $result_php = $ft->fetch("BODY"); $fp = fopen(GEN_INCLUDE_PATH . strtolower($all_url_vars['classname']), 'w'); if ($fp) { fwrite($fp, $result_php); fclose($fp); //////////////// //////////////// $beautify = new PhpBeautifier(); //////////////// $beautify -> tokenSpace = true;//put space between tokens //////////////// $beautify -> blockLine = true;//put empty lines between blocks of code (if, while etc) //////////////// //$beautify -> optimize = true;//optimize strings (for now), if a double quoted string does not contain variables of special carachters transform it to a single quoted string to save parsing time //////////////// $beautify -> file( GEN_INCLUDE_PATH.strtolower($all_url_vars['classname']), GEN_INCLUDE_PATH.strtolower($all_url_vars['classname'])); //////////////// // write phps //////////////// //fwrite($fps, $result_php); //////////////// //fclose($fps); } header('Location: generate_html.php');
############################################################ File purpose JAVA SCRIPT VALIDATOR ############################################################ */ $allowed_js = array("general_script.js"); include_once "../config.inc.php"; include_once "../cls_fast_template.php"; if (!isset($_GET["lang"])) { $LANG = $_GET["lang"]; } include_once INCLUDE_LANGUAGE_PATH . $LANG . ".inc.php"; include_once INCLUDE_LANGUAGE_PATH . "{$LANG}.admin.inc.php"; $name = $_GET["name"]; if (!in_array($name . ".js", $allowed_js)) { $error = "Error: The js filename '{$name}' doesn't exists in the allowed list."; error_log($error); echo $error; exit; } if (isset($name)) { $ft = new FastTemplate(INDEX_PATH . "javascript/"); $ft->define(array("main" => $name . ".js")); $ft->assign("CSS", ""); $ft->multiple_assign_define("CONF_"); $ft->multiple_assign_define("LANG_"); $ft->multiple_assign_define("CONF_"); $ft->parse("mainContent", "main"); print $ft->fetch("mainContent"); } else { print ""; }