public function registrar() { $proteccion = new Proteccion(); $nombre = $proteccion->html($_POST['nombre']); $apellido = $proteccion->html($_POST['apellido']); $sexo = $proteccion->html($_POST['sexo']); $fecha_nacimiento = $proteccion->html($_POST['fecha_nacimiento']); $direccion = $proteccion->html($_POST['direccion']); $email = $proteccion->html($_POST['email']); $dni = $proteccion->html($_POST['dni']); $pass = $proteccion->html($_POST['password']); $persona = new Usuario($email, $pass); $existe = $persona->existe(); if ($existe) { $tp = new TemplatePower("templates/registro.html"); $tp->prepare(); $tp->gotoBlock("_ROOT"); $tp->newblock("no_registro"); $tp->assign("usuario", $email); $webapp = $tp->getOutputContent(); } else { $persona->setDatosUsuario($nombre, $apellido, $sexo, $fecha_nacimiento, $direccion, $dni); $persona->insertar(); $_SESSION['user'] = $email; $tp = new TemplatePower("templates/index.html"); $tp->prepare(); $tp->gotoBlock("_ROOT"); $tp->newBlock("sesion"); $tp->assign("usuario", $_SESSION['user']); $webapp = $tp->getOutputContent(); } echo $webapp; }
public function consultarReserva() { $proteccion = new Proteccion(); $cod_reserva = $proteccion->html($_POST['cod_reserva']); $reserva = new Reserva(); $result = $reserva->BuscarReserva($cod_reserva); foreach ($result['result'] as $r) { $cod_reserva = $r['cod_reserva']; } $nom_hotel = $r['nom_hotel']; $nombre = $r['nombre']; $apellido = $r['apellido']; $email = $r['email']; $fec_llegada = $r['fec_llegada']; $fec_salida = $r['fec_salida']; $fec_reserva = $r['fec_reserva']; $piso = $r['piso']; $ubicacion = $r['ubicacion']; $tp = new TemplatePower("templates/reserva.html"); $tp->prepare(); $tp->gotoBlock("_ROOT"); $tp->newBlock("generarreserva"); $tp->assign("cod_reserva", $cod_reserva); $tp->assign("nom_hotel", $nom_hotel); $tp->assign("nombre", $nombre); $tp->assign("apellido", $apellido); $tp->assign("email", $email); $tp->assign("fec_llegada", $fec_llegada); $tp->assign("fec_salida", $fec_salida); $tp->assign("fec_reserva", $fec_reserva); $tp->assign("piso", $piso); $tp->assign("ubicacion", $ubicacion); echo $tp->getOutputContent(); }
function makePlanetTooltip($options, $actions, $actionName = 'missiontype') { global $lang; if (!$options or !is_array($options)) { return false; } $tp = new TemplatePower(PATH . TEMPLATE_DIR . TEMPLATE_NAME . "/planet_actions.tpl"); $tp->prepare(); switch ($options[type]) { case "planet": $tp->newBlock("planet"); break; case "moon": $tp->newBlock("moon"); break; case "debris": $tp->newBlock("debris"); break; case "ally": $tp->newBlock("ally"); break; default: return false; break; } $actionName = $lang[$actionName]; foreach ($options as $k => $v) { $tp->assign($k, $v); } if ($actions and is_array($actions)) { foreach ($actions[id] as $k => $actionId) { //echo $actionId . "<-- <br>"; $tp->newBlock($options[type] . "_actions"); $tp->assign("action_name", $actionName[$actionId]); $tp->assign("action_link", $actions[alink][$k]); } } $tool = $tp->getOutputContent(); $find = array('"', "'", "\n", "\r"); $rep = array('\\"', "\\'", "", ""); $tool = str_replace($find, $rep, $tool); return $tool; }
function hotel($idHotel) { $mhotels = new MHotels(); $result = $mhotels->buscar_id($idHotel); foreach ($result['result'] as $r) { $nombreHotel = $r['nom_hotel']; $prov = $r['provincia']; $local = $r['localidad']; $calle = $r['calle']; $ncalle = $r['nro_calle']; $tel = $r['telefono']; $precio = $r['precio_persona']; $cant_imagenes = $r['cant_imagenes']; $descripcion = $r['descripcion']; } $tp = new TemplatePower("templates/hotel.html"); $tp->prepare(); $tp->gotoBlock("_ROOT"); $tp->assign("nombre", $nombreHotel); for ($i = 1; $i <= $cant_imagenes; $i++) { $tp->newBlock("imagenes"); $tp->assign("nombre", $nombreHotel); $tp->assign("numero", $i); } $tp->gotoBlock("_ROOT"); $tp->assign("descripcion", $descripcion); $tp->assign("prov", $prov); $tp->assign("local", $local); $tp->assign("calle", $calle); $tp->assign("ncalle", $ncalle); $tp->assign("tel", $tel); $tp->assign("precio", $precio); if (isset($_SESSION['user'])) { $tp->newBlock("reservar"); $tp->assign("idHotel", $idHotel); } if (!isset($_SESSION['user'])) { $tp->newBlock("iniciarSesion"); } echo $tp->getOutputContent(); }
function savePluginFile($tplName, $fileName, $fields) { $pluginTpl = PATH_GULLIVER_HOME . 'bin' . PATH_SEP . 'tasks' . PATH_SEP . 'templates' . PATH_SEP . $tplName . '.tpl'; $template = new TemplatePower($pluginTpl); $template->prepare(); if (is_array($fields)) { foreach ($fields as $block => $data) { $template->gotoBlock("_ROOT"); if (is_array($data)) { foreach ($data as $rowId => $row) { $template->newBlock($block); foreach ($row as $key => $val) { $template->assign($key, $val); } } } else { $template->assign($block, $data); } } } $content = $template->getOutputContent(); $iSize = file_put_contents($fileName, $content); return $iSize; }
if ($result['found']) { foreach ($result['result'] as $r) { $tpl->newblock("hotels"); $tpl->assign("idHotel", $r['id_hotel']); $tpl->assign("name", $r['nom_hotel']); $tpl->assign("prov", $r['provincia']); $tpl->assign("local", $r['localidad']); $tpl->assign("calle", $r['calle']); $tpl->assign("ncalle", $r['nro_calle']); $tpl->assign("tel", $r['telefono']); $tpl->assign("precio", $r['precio_persona']); } } else { $tpl->newblock("no_hotels"); } $webapp = $tpl->getOutputContent(); } else { if (!strpos($_REQUEST["action"], "::")) { $_REQUEST["action"] .= "::main"; } $array = explode('::', $_REQUEST["action"]); $tam = count($array); if ($tam == 2) { list($classParam, $method) = $array; } if ($tam == 3) { list($classParam, $method, $param1) = $array; } if ($tam == 4) { list($classParam, $method, $param1, $param2) = $array; }
require_once 'classes/model/Step.php'; $oStep = new Step(); $sUidGrids = $oStep->lookingforUidGrids($sPRO_UID, $sDYNAFORM); $template->assign("URL_MABORAK_JS", G::browserCacheFilesUrl("/js/maborak/core/maborak.js")); $template->assign("URL_TRANSLATION_ENV_JS", G::browserCacheFilesUrl("/jscore/labels/" . SYS_LANG . ".js")); $template->assign("siteUrl", $http . $_SERVER["HTTP_HOST"]); $template->assign("sysSys", SYS_SYS); $template->assign("sysLang", SYS_LANG); $template->assign("sysSkin", SYS_SKIN); $template->assign("processUid", $sPRO_UID); $template->assign("dynaformUid", $sDYNAFORM); $template->assign("taskUid", $sTASKS); $template->assign("dynFileName", $sPRO_UID . "/" . $sDYNAFORM); $template->assign("formId", $G_FORM->id); $template->assign("scriptCode", $scriptCode); if (sizeof($sUidGrids) > 0) { foreach ($sUidGrids as $k => $v) { $template->newBlock('grid_uids'); $template->assign('siteUrl', $http . $_SERVER['HTTP_HOST']); $template->assign('gridFileName', $sPRO_UID . '/' . $v); } } print_r('<textarea cols="77" rows="26" style="width:100%; height:99%">' . htmlentities(str_replace('</body>', '</form></body>', str_replace('</form>', '', $template->getOutputContent()))) . '</textarea>'); G::auditLog('WebEntry', 'Generate web entry with single HTML (dynaform uid: ' . $sDYNAFORM . ') in process "' . $resultProcess['PRO_TITLE'] . '"'); } } catch (Exception $e) { $G_PUBLISH = new Publisher(); $aMessage['MESSAGE'] = $e->getMessage(); $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage); G::RenderPage('publish', 'raw'); }
function update($aData) { $oConnection = Propel::getConnection(EventPeer::DATABASE_NAME); try { $oEvent = EventPeer::retrieveByPK($aData['EVN_UID']); if (!is_null($oEvent)) { //$oEvent->setProUid( $aData['PRO_UID'] ); if (isset($aData['EVN_RELATED_TO'])) { $oEvent->setEvnRelatedTo($aData['EVN_RELATED_TO']); if ($aData['EVN_RELATED_TO'] == 'SINGLE') { if (isset($aData['TAS_UID']) && $aData['TAS_UID'] != '') { $oEvent->setTasUid($aData['TAS_UID']); } $oEvent->setEvnTasUidTo(''); $oEvent->setEvnTasUidFrom(''); } else { $oEvent->setTasUid(''); if (isset($aData['EVN_TAS_UID_TO'])) { $oEvent->setEvnTasUidTo($aData['EVN_TAS_UID_TO']); } if (isset($aData['EVN_TAS_UID_FROM'])) { $oEvent->setEvnTasUidFrom($aData['EVN_TAS_UID_FROM']); } } } if (isset($aData['EVN_POSX'])) { $oEvent->setEvnPosx($aData['EVN_POSX']); } if (isset($aData['EVN_POSY'])) { $oEvent->setEvnPosy($aData['EVN_POSY']); } if (isset($aData['EVN_TAS_ESTIMATED_DURATION'])) { $oEvent->setEvnTasEstimatedDuration($aData['EVN_TAS_ESTIMATED_DURATION']); } if (isset($aData['EVN_WHEN_OCCURS'])) { $oEvent->setEvnWhenOccurs($aData['EVN_WHEN_OCCURS']); } if (isset($aData['EVN_STATUS'])) { $oEvent->setEvnStatus($aData['EVN_STATUS']); } if (isset($aData['EVN_WHEN'])) { $oEvent->setEvnWhen($aData['EVN_WHEN']); } if (isset($aData['TRI_UID'])) { $oEvent->setTriUid($aData['TRI_UID']); } if (isset($aData['EVN_TYPE'])) { $oEvent->setEvnType($aData['EVN_TYPE']); } if (isset($aData['EVN_CONDITIONS'])) { $oEvent->setEvnConditions($aData['EVN_CONDITIONS']); } if (isset($aData['EVN_ACTION'])) { $oEvent->setEvnAction($aData['EVN_ACTION']); } //if ( isset ($aData['ENV_MAX_ATTEMPTS'] )) $oEvent->setEvnMaxAttempts( 3 ); if (isset($aData['EVN_ACTION_PARAMETERS']) && $aData['EVN_ACTION_PARAMETERS'] != 0) { $oTP = new TemplatePower(PATH_TPL . 'events' . PATH_SEP . 'sendMessage.tpl'); $oTP->prepare(); $oTP->assign('from', '*****@*****.**'); $oTP->assign('subject', addslashes($aData['EVN_ACTION_PARAMETERS']['SUBJECT'])); $oTP->assign('template', $aData['EVN_ACTION_PARAMETERS']['TEMPLATE']); $oTP->assign('timestamp', date("l jS \\of F Y h:i:s A")); $recipientTO = implode(',', $aData['EVN_ACTION_PARAMETERS']['TO']); $recipientCC = implode(',', $aData['EVN_ACTION_PARAMETERS']['CC']); $recipientBCC = implode(',', $aData['EVN_ACTION_PARAMETERS']['BCC']); $oTP->assign('TO', addslashes($recipientTO)); $oTP->assign('CC', addslashes($recipientCC)); $oTP->assign('BCC', addslashes($recipientBCC)); $sTrigger = $oTP->getOutputContent(); $oTrigger = new Triggers(); $aTrigger = $oTrigger->load($oEvent->getTriUid()); $aTrigger['TRI_WEBBOT'] = $sTrigger; $oTrigger->update($aTrigger); $oParameters = new StdClass(); $oParameters->hash = md5($sTrigger); $oParameters->SUBJECT = $aData['EVN_ACTION_PARAMETERS']['SUBJECT']; $oParameters->TO = $aData['EVN_ACTION_PARAMETERS']['TO']; $oParameters->CC = $aData['EVN_ACTION_PARAMETERS']['CC']; $oParameters->BCC = $aData['EVN_ACTION_PARAMETERS']['BCC']; $oParameters->TEMPLATE = $aData['EVN_ACTION_PARAMETERS']['TEMPLATE']; //$oParameters->TRI_UID = $sTrigger->getTriUid(); $oEvent->setEvnActionParameters(serialize($oParameters)); } if ($oEvent->validate()) { //start the transaction $oConnection->begin(); if (array_key_exists('EVN_DESCRIPTION', $aData)) { $oEvent->setEvnDescription($aData['EVN_DESCRIPTION']); } $iResult = $oEvent->save(); $oConnection->commit(); return $iResult; } else { $sMessage = ''; $aValidationFailures = $oEvent->getValidationFailures(); foreach ($aValidationFailures as $oValidationFailure) { $sMessage .= $oValidationFailure->getMessage() . '<br />'; } throw new Exception('The registry cannot be updated!<br />' . $sMessage); } } else { throw new Exception('This row doesn\'t exist!'); } } catch (Exception $oError) { $oConnection->rollback(); throw $oError; } }
// ACTIONS $actions = _TooltipActions($planetsrow[$i], $g, $s, $i, 0); $tp->assign("actions", $actions); } else { // ADD BLANK TDS ? } } $replace[fleet_count] = $MaxFleetCount; $replace[fleet_max] = $FleetMax; $replace[Recyclers] = pretty_number($CurrentRC); $replace[SpyProbes] = pretty_number($CurrentSP); $replace[CurrentMIP] = pretty_number($CurrentMIP); $replace[this_galaxy] = $planetrow['galaxy']; $replace[this_system] = $planetrow['system']; $replace[this_planet] = $planetrow['planet']; $replace[this_planet_type] = $planetrow['planet_type']; $replace[PHP_SELF] = $_SERVER['PHP_SELF']; $tp->gotoBlock("_ROOT"); if (is_array($replace)) { foreach ($replace as $k => $v) { $tp->assign($k, $v); } } // GLOBAL VARIABLES $lang[dpath] = $dpath; foreach ($lang as $name => $trans) { $tp->assignGlobal($name, $trans); } $galaxy = $tp->getOutputContent(); display($galaxy, 'Galaxy', false); }
//para el caso de que queramos añadir una mascota desde el perfil de un propietario if ($_GET['dni']) { $tplPacientes->assign('dni', $_GET['dni']); } else { $tplPacientes->assign('disp_class', 'hidden'); } //creamos el bloque que nos mostrará la lista de todos los pacientes ordenados por especie y mostramos $tplPacientes->newBlock('lista'); $query = 'SELECT * FROM pacientes ORDER BY especie'; $result = mysql_query($query); if (mysql_error()) { echo mysql_error(); } else { while ($row = mysql_fetch_assoc($result)) { $tplPacientes->newBlock('fila'); $tplPacientes->assign('historia', $row['historia']); $tplPacientes->assign('nombre', $row['nombre_pac']); $tplPacientes->assign('especie', $row['especie']); $tplPacientes->assign('edad', $row['edad']); $tplPacientes->assign('sexo', $row['sexo']); $tplPacientes->assign('raza', $row['raza']); $tplPacientes->assign('dni_propietario', $row['dni_propietario']); $tplPacientes->assign('remitente', $row['remitente']); $tplPacientes->assign('id_pac', $row['id_pac']); } } } $tplIndex->assign("contenido", $tplPacientes->getOutputContent());
/** * Set value in WE_DATA * * @param string $webEntryUid Unique id of Web Entry * * return void */ public function setWeData($webEntryUid) { try { //Verify data $this->throwExceptionIfNotExistsWebEntry($webEntryUid, $this->arrayFieldNameForException["webEntryUid"]); //Set variables $arrayWebEntryData = $this->getWebEntry($webEntryUid, true); $processUid = $arrayWebEntryData["PRO_UID"]; $taskUid = $arrayWebEntryData["TAS_UID"]; $dynaFormUid = $arrayWebEntryData["DYN_UID"]; $webEntryMethod = $arrayWebEntryData["WE_METHOD"]; $webEntryInputDocumentAccess = $arrayWebEntryData["WE_INPUT_DOCUMENT_ACCESS"]; $webEntryData = ""; $wsRoundRobin = 0; //0, 1 //0 - Cyclical Assignment $pathDataPublicProcess = PATH_DATA_PUBLIC . $processUid; //Delete previous files if (trim($arrayWebEntryData["WE_DATA"]) != "") { $fileName = str_replace(".php", "", trim($arrayWebEntryData["WE_DATA"])); $file = $pathDataPublicProcess . PATH_SEP . $fileName . ".php"; if (is_file($file) && file_exists($file)) { unlink($file); unlink($pathDataPublicProcess . PATH_SEP . $fileName . "Post.php"); } } //Create files \G::mk_dir($pathDataPublicProcess, 0777); $http = \G::is_https() ? "https://" : "http://"; switch ($webEntryMethod) { case "WS": require_once PATH_RBAC . "model" . PATH_SEP . "RbacUsers.php"; $user = new \RbacUsers(); $arrayUserData = $user->load($arrayWebEntryData["USR_UID"]); $usrUsername = $arrayUserData["USR_USERNAME"]; $usrPassword = $arrayUserData["USR_PASSWORD"]; $dynaForm = new \Dynaform(); $arrayDynaFormData = $dynaForm->Load($arrayWebEntryData["DYN_UID"]); //Creating sys.info; $sitePublicPath = ""; if (file_exists($sitePublicPath . "")) { } //Creating the first file $weTitle = $this->sanitizeFilename($arrayWebEntryData["WE_TITLE"]); $fileName = $weTitle; $fileContent = "<?php\n"; $fileContent .= "global \$_DBArray;\n"; $fileContent .= "if (!isset(\$_DBArray)) {\n"; $fileContent .= " \$_DBArray = array();\n"; $fileContent .= "}\n"; $fileContent .= "\$_SESSION[\"PROCESS\"] = \"" . $processUid . "\";\n"; $fileContent .= "\$_SESSION[\"CURRENT_DYN_UID\"] = \"" . $dynaFormUid . "\";\n"; $fileContent .= "\$G_PUBLISH = new Publisher();\n"; $fileContent .= "G::LoadClass(\"pmDynaform\");\n"; $fileContent .= "\$a = new pmDynaform(array(\"CURRENT_DYNAFORM\" => \"" . $arrayWebEntryData["DYN_UID"] . "\"));\n"; $fileContent .= "if (\$a->isResponsive()) {"; $fileContent .= " \$a->printWebEntry(\"" . $fileName . "Post.php\");"; $fileContent .= "} else {"; $fileContent .= " \$G_PUBLISH->AddContent(\"dynaform\", \"xmlform\", \"" . $processUid . PATH_SEP . $dynaFormUid . "\", \"\", array(), \"" . $fileName . "Post.php\");\n"; $fileContent .= " G::RenderPage(\"publish\", \"blank\");"; $fileContent .= "}"; file_put_contents($pathDataPublicProcess . PATH_SEP . $fileName . ".php", $fileContent); //Creating the second file, the post file who receive the post form. $pluginTpl = PATH_TPL . "processes" . PATH_SEP . "webentryPost.tpl"; $template = new \TemplatePower($pluginTpl); $template->prepare(); $template->assign("wsdlUrl", $http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/services/wsdl2"); $template->assign("wsUploadUrl", $http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/services/upload"); $template->assign("processUid", $processUid); $template->assign("dynaformUid", $dynaFormUid); $template->assign("taskUid", $taskUid); $template->assign("wsUser", $usrUsername); $template->assign("wsPass", \Bootstrap::getPasswordHashType() . ':' . $usrPassword); $template->assign("wsRoundRobin", $wsRoundRobin); if ($webEntryInputDocumentAccess == 0) { //Restricted to process permissions $template->assign("USR_VAR", "\$cInfo = ws_getCaseInfo(\$caseId);\n\t \$USR_UID = \$cInfo->currentUsers->userId;"); } else { //No Restriction $template->assign("USR_VAR", "\$USR_UID = -1;"); } $template->assign("dynaform", $arrayDynaFormData["DYN_TITLE"]); $template->assign("timestamp", date("l jS \\of F Y h:i:s A")); $template->assign("ws", SYS_SYS); $template->assign("version", \System::getVersion()); $fileName = $pathDataPublicProcess . PATH_SEP . $weTitle . "Post.php"; file_put_contents($fileName, $template->getOutputContent()); //Creating the third file, only if this wsClient.php file doesn't exist. $fileName = $pathDataPublicProcess . PATH_SEP . "wsClient.php"; $pluginTpl = PATH_CORE . "templates" . PATH_SEP . "processes" . PATH_SEP . "wsClient.php"; if (file_exists($fileName)) { if (filesize($fileName) != filesize($pluginTpl)) { copy($fileName, $pathDataPublicProcess . PATH_SEP . "wsClient.php.bak"); unlink($fileName); $template = new \TemplatePower($pluginTpl); $template->prepare(); file_put_contents($fileName, $template->getOutputContent()); } } else { $template = new \TemplatePower($pluginTpl); $template->prepare(); file_put_contents($fileName, $template->getOutputContent()); } //Event $task = new \Task(); $arrayTaskData = $task->load($arrayWebEntryData["TAS_UID"]); $weEventUid = $task->getStartingEvent(); if ($weEventUid != "") { $event = new \Event(); $arrayEventData = array(); $arrayEventData["EVN_UID"] = $weEventUid; $arrayEventData["EVN_RELATED_TO"] = "MULTIPLE"; $arrayEventData["EVN_ACTION"] = $dynaFormUid; $arrayEventData["EVN_CONDITIONS"] = $usrUsername; $result = $event->update($arrayEventData); } //WE_DATA $webEntryData = $weTitle . ".php"; break; case "HTML": global $G_FORM; if (!class_exists("Smarty")) { $loader = \Maveriks\Util\ClassLoader::getInstance(); $loader->addClass("Smarty", PATH_THIRDPARTY . "smarty" . PATH_SEP . "libs" . PATH_SEP . "Smarty.class.php"); } $G_FORM = new \Form($processUid . "/" . $dynaFormUid, PATH_DYNAFORM, SYS_LANG, false); $G_FORM->action = $http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/services/cases_StartExternal.php"; $scriptCode = ""; $scriptCode = $G_FORM->render(PATH_TPL . "xmlform" . ".html", $scriptCode); $scriptCode = str_replace("/controls/", $http . $_SERVER["HTTP_HOST"] . "/controls/", $scriptCode); $scriptCode = str_replace("/js/maborak/core/images/", $http . $_SERVER["HTTP_HOST"] . "/js/maborak/core/images/", $scriptCode); //Render the template $pluginTpl = PATH_TPL . "processes" . PATH_SEP . "webentry.tpl"; $template = new \TemplatePower($pluginTpl); $template->prepare(); $step = new \Step(); $sUidGrids = $step->lookingforUidGrids($processUid, $dynaFormUid); $template->assign("URL_MABORAK_JS", \G::browserCacheFilesUrl("/js/maborak/core/maborak.js")); $template->assign("URL_TRANSLATION_ENV_JS", \G::browserCacheFilesUrl("/jscore/labels/" . SYS_LANG . ".js")); $template->assign("siteUrl", $http . $_SERVER["HTTP_HOST"]); $template->assign("sysSys", SYS_SYS); $template->assign("sysLang", SYS_LANG); $template->assign("sysSkin", SYS_SKIN); $template->assign("processUid", $processUid); $template->assign("dynaformUid", $dynaFormUid); $template->assign("taskUid", $taskUid); $template->assign("dynFileName", $processUid . "/" . $dynaFormUid); $template->assign("formId", $G_FORM->id); $template->assign("scriptCode", $scriptCode); if (sizeof($sUidGrids) > 0) { foreach ($sUidGrids as $k => $v) { $template->newBlock("grid_uids"); $template->assign("siteUrl", $http . $_SERVER["HTTP_HOST"]); $template->assign("gridFileName", $processUid . "/" . $v); } } //WE_DATA $html = str_replace("</body>", "</form></body>", str_replace("</form>", "", $template->getOutputContent())); $webEntryData = $html; break; } //Update //Update where $criteriaWhere = new \Criteria("workflow"); $criteriaWhere->add(\WebEntryPeer::WE_UID, $webEntryUid); //Update set $criteriaSet = new \Criteria("workflow"); $criteriaSet->add(\WebEntryPeer::WE_DATA, $webEntryData); \BasePeer::doUpdate($criteriaWhere, $criteriaSet, \Propel::getConnection("workflow")); } catch (\Exception $e) { throw $e; } }
/** * generateJrxmlFromDynaform * * @param string $outDocUid * @param string $dynaformUid * @param object $template * @return void */ function generateJrxmlFromDynaform($outDocUid, $dynaformUid, $template) { require_once 'classes/model/Dynaform.php'; $dyn = new Dynaform(); $aFields = $dyn->load($dynaformUid); $xmlFields = $dyn->getDynaformFields($dynaformUid); $reportTpl = PATH_TPL . 'javaBridgePM/classic.xml'; $reportFilename = PATH_DYNAFORM . $aFields['PRO_UID'] . PATH_SEP . $outDocUid . '.jrxml'; foreach ($xmlFields as $key => $val) { if ($val->type == 'submit' || $val->type == 'button' || $val->type == 'title' || $val->type == 'subtitle') { unset($xmlFields[$key]); } } //$sqlSentence = 'SELECT * from ' . $tableName; $sqlSentence = 'dynaform/'; $template = new TemplatePower($reportTpl); $template->prepare(); $template->assign('sqlSentence', $sqlSentence); $template->assign('tableName', $aFields['DYN_TITLE']); $template->assign('heightDetail', count($xmlFields) * 15 + 20); $template->assign('PAGE_NUMBER', '{PAGE_NUMBER}'); $logoReporte = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/images/processmaker.logo.jpg'; $template->assign('logoReporte', $logoReporte); foreach ($xmlFields as $key => $val) { $template->newBlock('fields'); $template->assign('fieldName', $key); } $posX = 140; $posLabelX = 5; $posY = 10; foreach ($xmlFields as $key => $val) { $template->newBlock('detailFields'); $template->assign('fieldName', '{' . $key . '}'); $template->assign('fieldLabel', $key); $template->assign('labelPosX', $posLabelX); $template->assign('fieldPosX', $posX); $template->assign('fieldPosY', $posY); $posY += 15; } $content = $template->getOutputContent(); $iSize = file_put_contents($reportFilename, $content); printf("saved %s bytes in file %s \n", $iSize, $reportFilename); }
/** * Formata a news padrão da linklar * @params string $titulo * @params string $texto * @returns html formatada. */ public function formataEmail($titulo, $texto) { global $geral; $MAIL = new TemplatePower(TEMPLATE_PATH . "includes/mail.tpl"); $MAIL->assignGlobal("uploadPath", UPLOAD_PATH); $MAIL->assignGlobal("imagePath", IMAGE_PATH); $MAIL->prepare(); $MAIL->newBlock('mail'); $MAIL->assign('titulo', $titulo); $MAIL->assign('texto', $texto); return $MAIL->getOutputContent(); }
/** * Send a test email * * @param array $arrayData Data * * return array Return array with result of send test mail */ public function sendTestMail(array $arrayData) { try { \G::LoadClass("system"); \G::LoadClass("spool"); $aConfiguration = array("MESS_ENGINE" => $arrayData["MESS_ENGINE"], "MESS_SERVER" => $arrayData["MESS_SERVER"], "MESS_PORT" => (int) $arrayData["MESS_PORT"], "MESS_ACCOUNT" => $arrayData["MESS_ACCOUNT"], "MESS_PASSWORD" => $arrayData["MESS_PASSWORD"], "MESS_FROM_NAME" => $arrayData["FROM_NAME"], "MESS_FROM_MAIL" => $arrayData["FROM_EMAIL"], "MESS_RAUTH" => (int) $arrayData["MESS_RAUTH"], "SMTPSecure" => isset($arrayData["SMTPSecure"]) ? $arrayData["SMTPSecure"] : "none"); $sFrom = \G::buildFrom($aConfiguration); $sSubject = \G::LoadTranslation("ID_MESS_TEST_SUBJECT"); $msg = \G::LoadTranslation("ID_MESS_TEST_BODY"); switch ($arrayData["MESS_ENGINE"]) { case "MAIL": $engine = \G::LoadTranslation("ID_MESS_ENGINE_TYPE_1"); break; case "PHPMAILER": $engine = \G::LoadTranslation("ID_MESS_ENGINE_TYPE_2"); break; case "OPENMAIL": $engine = \G::LoadTranslation("ID_MESS_ENGINE_TYPE_3"); break; } $sBodyPre = new \TemplatePower(PATH_TPL . "admin" . PATH_SEP . "email.tpl"); $sBodyPre->prepare(); $sBodyPre->assign("server", $_SERVER["SERVER_NAME"]); $sBodyPre->assign("date", date("H:i:s")); $sBodyPre->assign("ver", \System::getVersion()); $sBodyPre->assign("engine", $engine); $sBodyPre->assign("msg", $msg); $sBody = $sBodyPre->getOutputContent(); $oSpool = new \spoolRun(); $oSpool->setConfig($aConfiguration); $oSpool->create(array("msg_uid" => "", "app_uid" => "", "del_index" => 0, "app_msg_type" => "TEST", "app_msg_subject" => $sSubject, "app_msg_from" => $sFrom, "app_msg_to" => $arrayData["TO"], "app_msg_body" => $sBody, "app_msg_cc" => "", "app_msg_bcc" => "", "app_msg_attach" => "", "app_msg_template" => "", "app_msg_status" => "pending", "app_msg_attach" => "")); $oSpool->sendMail(); //Return $arrayTestMailResult = array(); if ($oSpool->status == "sent") { $arrayTestMailResult["status"] = true; $arrayTestMailResult["success"] = true; $arrayTestMailResult["msg"] = \G::LoadTranslation("ID_MAIL_TEST_SUCCESS"); } else { $arrayTestMailResult["status"] = false; $arrayTestMailResult["success"] = false; $arrayTestMailResult["msg"] = $oSpool->error; } return $arrayTestMailResult; } catch (\Exception $e) { throw $e; } }
private function _extjs() { G::LoadClass('serverConfiguration'); $oServerConf =& serverConf::getSingleton(); $oHeadPublisher =& headPublisher::getSingleton(); if ($oHeadPublisher->extJsInit === true) { $header = $oHeadPublisher->getExtJsVariablesScript(); $styles = $oHeadPublisher->getExtJsStylesheets($this->cssFileName); $body = $oHeadPublisher->getExtJsScripts(); //default $templateFile = G::ExpandPath("skinEngine") . 'base' . PATH_SEP . 'extJsInitLoad.html'; //Custom skins if (defined('PATH_CUSTOM_SKINS') && is_dir(PATH_CUSTOM_SKINS . $this->mainSkin)) { $templateFile = PATH_CUSTOM_SKINS . $this->mainSkin . PATH_SEP . 'extJsInitLoad.html'; } //Skin uxs - simplified if (!isset($_SESSION['user_experience'])) { $_SESSION['user_experience'] = 'NORMAL'; } if ($_SESSION['user_experience'] != 'NORMAL') { $templateFile = is_dir(PATH_CUSTOM_SKINS . 'uxs') ? PATH_CUSTOM_SKINS . 'simplified' . PATH_SEP . 'extJsInitLoad.html' : $templateFile; } } else { $styles = ""; $header = $oHeadPublisher->getExtJsStylesheets($this->cssFileName); $header .= $oHeadPublisher->includeExtJs(); $body = $oHeadPublisher->renderExtJs(); $templateFile = $this->layoutFile['dirname'] . PATH_SEP . $this->layoutFileExtjs['basename']; } $template = new TemplatePower($templateFile); $template->prepare(); $template->assign('header', $header); $template->assign('styles', $styles); $template->assign('bodyTemplate', $body); // verify is RTL $oServerConf =& serverConf::getSingleton(); if ($oServerConf->isRtl(SYS_LANG)) { $template->assign('dirBody', 'dir="RTL"'); } // end verify // verify is IE $doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'; $meta = ''; $iexplores = array('IE=10' => '(MSIE 10\\.[0-9]+)', 'IE=9' => '(MSIE 9\\.[0-9]+)', 'IE=8' => '(MSIE 8\\.[0-9]+)', 'IE=7' => '(MSIE 7\\.[0-9]+)', 'IE=6' => '(MSIE 6\\.[0-9]+)'); foreach ($iexplores as $browser => $pattern) { if (preg_match('/' . $pattern . '/', $_SERVER['HTTP_USER_AGENT'])) { $doctype = ''; $meta = '<meta http-equiv="X-UA-Compatible" content="' . $browser . '"/>'; } } // end verify $template->assign('meta', $meta); $template->assign('doctype', $doctype); echo $template->getOutputContent(); }
function enviarCambioHr($fecha, $hrIni, $hrFin) { //Cuando se realizo un cambio de horario en valija include "config/connect.php"; include "class/correo.php"; $correo = new Correo($conn); $correo->setID("1"); $correo->consultacorreoID(); $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = $correo->getHostMail(); //la dirección del servidor, p. ej.: smtp.servidor.com $mail->Port = $correo->getPortMail(); //Puerto del servidor $mail->Username = $correo->getusUarioMail(); //usuario de cuenta $mail->Password = $correo->getPassMail(); $mail->From = $correo->getCuentaMail(); // dirección remitente, p. ej.: no-responder@miempresa.com $mail->FromName = $correo->getNameMail(); // nombre remitente, p. ej.: "Servicio de envío automático" $mail->SMTPAuth = true; // si el SMTP necesita autenticación $tpl = new TemplatePower($correo->getCuerpoCambioHr(), T_BYVAR); $tpl->prepare(); $tpl->assign('fechaH', $fecha); $tpl->assign('horaI', $hrIni); $tpl->assign('horaF', $hrFin); $mail->Subject = $correo->getAsuntoCambioHr(); // asunto y cuerpo alternativo del mensaje $mail->MsgHTML($tpl->getOutputContent()); //$mail->MsgHTML($correo->getCuerpoCambioHr()); // si el cuerpo del mensaje es HTML //$mail->AddAddress("*****@*****.**"); $mail->AddAddress($this->destinatario); //direcion de correo $mail->AddCC($this->ccopia); if (!$mail->Send()) { $this->mensaje = $mail->ErrorInfo; echo "SMTP " . $this->mensaje; return false; } else { return true; } include "config/disconnect.php"; }
<?php require_once 'config.inc.php'; $tpl_main = new TemplatePower('template/master.html'); $tpl_main->prepare(); // see if the login form was submitted if (isset($_POST['login'])) { $user = stripslashes($_POST['username']); $pass = stripslashes($_POST['password']); $goto = $_POST['redirect']; if ($_AUTH->login($user, $pass)) { include_once $goto; die; } else { $tpl = new TemplatePower('template/error.html'); $tpl->assignGlobal('error_message', 'Invalid username / password.' . $user); } // display the default login form } else { $tpl = new TemplatePower('template/login.html'); $tpl->assignGlobal('redirect', $_GET['redirect']); } $tpl->prepare(); $tpl->showUnAssigned(false); $tpl_main->assign('content', $tpl->getOutputContent()); $tpl_main->showUnAssigned(false); $tpl_main->printToScreen();
/** * call to execute a internal proxy method and handle its exceptions * * @param string $name */ public function call($name) { try { $result = $this->{$name}($this->__request__); if ($this->responseType == 'json') { print G::json_encode($result); } } catch (Exception $e) { if ($this->responseType != 'json') { $result->exception->class = get_class($e); $result->exception->code = $e->getCode(); $template = new TemplatePower(PATH_TEMPLATE . 'controller.exception.tpl'); $template->prepare(); $template->assign('controller', function_exists('get_called_class') ? get_called_class() : 'Controller'); $template->assign('message', $e->getMessage()); $template->assign('file', $e->getFile()); $template->assign('line', $e->getLine()); $template->assign('trace', $e->getTraceAsString()); echo $template->getOutputContent(); } else { $result->success = false; $result->msg = $e->getMessage(); switch (get_class($e)) { case 'Exception': $error = "SYSTEM ERROR"; break; case 'PMException': $error = "PROCESSMAKER ERROR"; break; case 'PropelException': $error = "DATABASE ERROR"; break; case 'UserException': $error = "USER ERROR"; break; } $result->error = $error; $result->exception->class = get_class($e); $result->exception->code = $e->getCode(); print G::json_encode($result); } } }
/** * Function renderExtJs * this function returns the content rendered using ExtJs * extJsContent have an array, and we iterate this array to draw the content * * @author Fernando Ontiveros <*****@*****.**> * @access public * @return string */ public function renderExtJs() { $body = ''; if (isset($this->extJsContent) && is_array($this->extJsContent)) { foreach ($this->extJsContent as $key => $file) { $sPath = PATH_TPL; //if the template file doesn't exists, then try with the plugins folders if (!is_file($sPath . $file . ".html")) { $aux = explode(PATH_SEP, $file); //check if G_PLUGIN_CLASS is defined, because publisher can be called without an environment if (count($aux) == 2 && defined('G_PLUGIN_CLASS')) { $oPluginRegistry =& PMPluginRegistry::getSingleton(); if ($oPluginRegistry->isRegisteredFolder($aux[0])) { $sPath = PATH_PLUGINS; } } } $template = new TemplatePower($sPath . $file . '.html'); $template->prepare(); foreach ($this->getVars() as $k => $v) { $template->assign($k, $v); } $body .= $template->getOutputContent(); } } return $body; }
$template->assign('ADD_TRI_VARIABLE', $tri_Button); // $template->assign ( 'ADD_TRI_VALUE', str_replace ( "'", "", // str_replace ( '"', '', $paramDefaultValue ) ) ); $paramValue = isset($_GET[trim(str_replace("\$", "", $paramName))]) ? $_GET[trim(str_replace("\$", "", $paramName))] : ''; $template->assign('ADD_TRI_VALUE', str_replace("\\'", "'", $paramValue)); //turn single quotes to double quotes into an array asignation $template->assign('ADD_TRI_VALUE', str_replace("'", """, $paramValue)); if ($paramDefaultValue != "") { $fieldDescription = $paramDescription . "<br>"; $fieldDescription .= G::LoadTranslation("ID_NOT_REQUIRED") . " | " . $paramDefaultValue . " | " . $paramType; } else { $fieldDescription = ""; $fieldDescription .= G::LoadTranslation("ID_REQUIRED_FIELD") . " | " . $paramType; $fieldRequired[] = trim(str_replace("\$", "", $paramName)); } $template->assign('ADD_TRI_DESCRIPTION', $fieldDescription); $nrows++; } } } $template->gotoBlock('_ROOT'); $template->assign('FIELDS_REQUIRED', implode(",", $fieldRequired)); $template->assign('ALLFUNCTION_TYPE', implode(",", $methodParametersNamesType)); $template->assign('ALLFUNCTION', implode(",", $methodParametersOnlyNames)); $sPMfunction .= ");"; $content = $template->getOutputContent(); print $content; } catch (Exception $oException) { die($oException->getMessage()); } unset($_SESSION['PROCESS']);
$tp->newBlock("answer"); $replace[id] = $CurMess['message_sender']; $replace[subject] = $lang['mess_answer_prefix'] . htmlspecialchars($CurMess['message_subject']); foreach ($replace as $k => $v) { $tp->assign($k, $v); } } } break; } $tp->gotoBlock("_ROOT"); $tp->assignGlobal("PHPSELF", $_SERVER['PHP_SELF']); foreach ($lang as $name => $trans) { $tp->assignGlobal("lang_" . $name, $trans); } $page .= $tp->getOutputContent(); display($page, $lang['mess_pagetitle']); } else { $OwnerID = $_GET['id']; $MessCategory = $_GET['messcat']; $MessPageMode = $_GET["mode"]; $DeleteWhat = $_POST['deletemessages']; if (isset($DeleteWhat)) { $MessPageMode = "delete"; } $UsrMess = doquery("SELECT * FROM {{table}} WHERE `message_owner` = '" . $user['id'] . "' ORDER BY `message_time` DESC;", 'messages'); $UnRead = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $user['id'] . "';", 'users', true); $MessageType = array(0, 1, 2, 3, 4, 5, 15, 99, 100); $TitleColor = array(0 => '#FFFF00', 1 => '#FF6699', 2 => '#FF3300', 3 => '#FF9900', 4 => '#773399', 5 => '#009933', 15 => '#030070', 99 => '#007070', 100 => '#ABABAB'); $BackGndColor = array(0 => '#663366', 1 => '#336666', 2 => '#000099', 3 => '#666666', 4 => '#999999', 5 => '#999999', 15 => '#999999', 99 => '#999999', 100 => '#999999'); for ($MessType = 0; $MessType < 101; $MessType++) {
private function _extjs() { G::LoadClass('serverConfiguration'); $oServerConf =& serverConf::getSingleton(); $oHeadPublisher =& headPublisher::getSingleton(); if ($oHeadPublisher->extJsInit === true) { $header = $oHeadPublisher->getExtJsVariablesScript(); $styles = $oHeadPublisher->getExtJsStylesheets($this->cssFileName); $body = $oHeadPublisher->getExtJsScripts(); $templateFile = G::ExpandPath("skinEngine") . 'base' . PATH_SEP . 'extJsInitLoad.html'; } else { $styles = ""; $header = $oHeadPublisher->getExtJsStylesheets($this->cssFileName); $header .= $oHeadPublisher->includeExtJs(); $body = $oHeadPublisher->renderExtJs(); $templateFile = $this->layoutFile['dirname'] . PATH_SEP . $this->layoutFileExtjs['basename']; } $template = new TemplatePower($templateFile); $template->prepare(); $template->assign('header', $header); $template->assign('styles', $styles); $template->assign('bodyTemplate', $body); echo $template->getOutputContent(); }
} if (isset($_GET['token'])) { $token = $_GET['token']; //en caso de que haya un token en la querystring gestionamos el proceso para nueva contraseña //debemos comprobar que el toquen sea valido, sino mostramos un mensaje de error $fecha = new DateTime(date("Y-m-d H:m:s")); $fecha->modify("-1 day"); $query = "SELECT token, usuarios.usuario FROM usuarios_recuperar_clave, usuarios\n WHERE token='{$token}' \n AND fecha>'" . $fecha->format("Y-m-d H:m:s") . "'\n AND usuarios_recuperar_clave.idusuario = usuarios.idusuario"; $datos = mysql_fetch_assoc(mysql_query($query)); if (!$datos) { //token invalido o no presente en la base de datos $tplClave->newBlock("errortoken"); $tplClave->newBlock("generar_token"); } else { //token valido $tplClave->newBlock("nueva_clave"); //mostramos el usuario para el cual se va a asignar la nueva clave $tplClave->assign("user", $datos['usuario']); $tplClave->assign("token", $datos['token']); } } else { //comprobamos si ha ocurrido un error durante la recepcion del formulario para generar el token if (isset($_GET['error'])) { $tplClave->newBlock("error" . $_GET['error']); } //si no hay token mostramos el html para que se pueda recuperar la contraseña $tplClave->newBlock("generar_token"); } //imprimimos por pantalla $tplIndex->assign("contenido", $tplClave->getOutputContent());
public function forgotPassword($httpData) { $this->setResponseType('json'); global $RBAC; require_once PATH_RBAC . "model/RbacUsers.php"; require_once 'classes/model/Users.php'; G::LoadClass("system"); $rbacUser = new RbacUsers(); $user = new Users(); try { $userData = $rbacUser->getByUsername($httpData->username); if (!$userData) { $msg = G::LoadTranslation('ID_USER') . ' <b>' . $httpData->username . '</b> ' . G::LoadTranslation('ID_IS_NOT_REGISTERED'); throw new Exception($msg); } if (trim($userData['USR_EMAIL']) != trim($httpData->email)) { $msg = G::LoadTranslation('ID_EMAIL_DOES_NOT_MATCH_FOR_USER') . ' <b>' . $httpData->username . '</b>'; throw new Exception($msg); } $newPass = G::generate_password(); $aData['USR_UID'] = $userData['USR_UID']; $aData['USR_PASSWORD'] = md5($newPass); $rbacUser->update($aData); $user->update($aData); $subject = G::loadTranslation('ID_PROCESSMAKER_FORGOT_PASSWORD_SERVICE'); $template = new TemplatePower(PATH_TPL . 'main/forgotPassword.tpl'); $template->prepare(); $template->assign('server', $_SERVER['SERVER_NAME']); $template->assign('serviceMsg', G::loadTranslation('ID_PROCESSMAKER_FORGOT_PASSWORD_SERVICE')); $template->assign('content', G::loadTranslation('ID_PASSWORD_CHANGED_SUCCESSFULLY')); $template->assign('passwd', $newPass); $template->assign('poweredBy', G::loadTranslation('ID_PROCESSMAKER_SLOGAN1')); $template->assign('versionLabel', G::loadTranslation('ID_VERSION')); $template->assign('version', System::getVersion()); $template->assign('visit', G::loadTranslation('ID_VISIT')); $template->assign('footer', ''); $body = $template->getOutputContent(); G::sendMail('', 'ProcessMaker Service', $httpData->email, $subject, $body); $result->success = true; $result->message = G::LoadTranslation('ID_NEW_PASSWORD_SENT'); } catch (Exception $e) { $result->success = false; $result->message = $e->getMessage(); } return $result; }
/** * DEPRECATED createPropelClasses() * * Don't use this method, it was left only for backward compatibility * for some external plugins that still is using it */ public function createPropelClasses($sTableName, $sClassName, $aFields, $sAddTabUid, $connection = 'workflow') { try { /* $aUID = array('FLD_NAME' => 'PM_UNIQUE_ID', 'FLD_TYPE' => 'INT', 'FLD_KEY' => 'on', 'FLD_SIZE' => '11', 'FLD_NULL' => '', 'FLD_AUTO_INCREMENT' => 'on'); array_unshift($aFields, $aUID); */ $aTypes = array( 'VARCHAR' => 'string', 'TEXT' => 'string', 'DATE' => 'int', 'INT' => 'int', 'FLOAT' => 'double' ); $aCreoleTypes = array( 'VARCHAR' => 'VARCHAR', 'TEXT' => 'LONGVARCHAR', 'DATE' => 'TIMESTAMP', 'INT' => 'INTEGER', 'FLOAT' => 'DOUBLE' ); if ($sClassName == '') { $sClassName = $this->getPHPName($sTableName); } $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; if (!file_exists($sPath)) { G::mk_dir($sPath); } if (!file_exists($sPath . 'map')) { G::mk_dir($sPath . 'map'); } if (!file_exists($sPath . 'om')) { G::mk_dir($sPath . 'om'); } $aData = array(); $aData['pathClasses'] = substr(PATH_DB, 0, -1); $aData['tableName'] = $sTableName; $aData['className'] = $sClassName; $aData['connection'] = $connection; $aData['GUID'] = $sAddTabUid; $aData['firstColumn'] = isset($aFields[0]) ? strtoupper($aFields[0]['FLD_NAME']) : ($aFields[1]['FLD_NAME']); $aData['totalColumns'] = count($aFields); $aData['useIdGenerator'] = 'false'; $oTP1 = new TemplatePower(PATH_TPL . 'additionalTables' . PATH_SEP . 'Table.tpl'); $oTP1->prepare(); $oTP1->assignGlobal($aData); file_put_contents($sPath . $sClassName . '.php', $oTP1->getOutputContent()); $oTP2 = new TemplatePower(PATH_TPL . 'additionalTables' . PATH_SEP . 'TablePeer.tpl'); $oTP2->prepare(); $oTP2->assignGlobal($aData); file_put_contents($sPath . $sClassName . 'Peer.php', $oTP2->getOutputContent()); $aColumns = array(); $aPKs = array(); $aNotPKs = array(); $i = 0; foreach ($aFields as $iKey => $aField) { $aField['FLD_NAME'] = strtoupper($aField['FLD_NAME']); if ($aField['FLD_TYPE'] == 'DATE') { $aField['FLD_NULL'] = ''; } $aColumn = array( 'name' => $aField['FLD_NAME'], 'phpName' => $this->getPHPName($aField['FLD_NAME']), 'type' => $aTypes[$aField['FLD_TYPE']], 'creoleType' => $aCreoleTypes[$aField['FLD_TYPE']], 'notNull' => ($aField['FLD_NULL'] == 'on' ? 'true' : 'false'), 'size' => (($aField['FLD_TYPE'] == 'VARCHAR') || ($aField['FLD_TYPE'] == 'INT') || ($aField['FLD_TYPE'] == 'FLOAT') ? $aField['FLD_SIZE'] : 'null'), 'var' => strtolower($aField['FLD_NAME']), 'attribute' => (($aField['FLD_TYPE'] == 'VARCHAR') || ($aField['FLD_TYPE'] == 'TEXT') || ($aField['FLD_TYPE'] == 'DATE') ? '$' . strtolower($aField['FLD_NAME']) . " = ''" : '$' . strtolower($aField['FLD_NAME']) . ' = 0'), 'index' => $i, ); if ($aField['FLD_TYPE'] == 'DATE') { $aColumn['getFunction'] = '/** * Get the [optionally formatted] [' . $aColumn['var'] . '] column value. * * @param string $format The date/time format string (either date()-style or strftime()-style). * If format is NULL, then the integer unix timestamp will be returned. * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL). * @throws PropelException - if unable to convert the date/time to timestamp. */ public function get' . $aColumn['phpName'] . '($format = "Y-m-d") { if ($this->' . $aColumn['var'] . ' === null || $this->' . $aColumn['var'] . ' === "") { return null; } elseif (!is_int($this->' . $aColumn['var'] . ')) { // a non-timestamp value was set externally, so we convert it if (($this->' . $aColumn['var'] . ' == "0000-00-00 00:00:00") || ($this->' . $aColumn['var'] . ' == "0000-00-00") || !$this->' . $aColumn['var'] . ') { $ts = "0"; } else { $ts = strtotime($this->' . $aColumn['var'] . '); } if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE throw new PropelException("Unable to parse value of [' . $aColumn['var'] . '] as date/time value: " . var_export($this->' . $aColumn['var'] . ', true)); } } else { $ts = $this->' . $aColumn['var'] . '; } if ($format === null) { return $ts; } elseif (strpos($format, "%") !== false) { return strftime($format, $ts); } else { return date($format, $ts); } }'; } else { $aColumn['getFunction'] = '/** * Get the [' . $aColumn['var'] . '] column value. * * @return string */ public function get' . $aColumn['phpName'] . '() { return $this->' . $aColumn['var'] . '; }'; } switch ($aField['FLD_TYPE']) { case 'VARCHAR': case 'TEXT': $aColumn['setFunction'] = '// Since the native PHP type for this column is string, // we will cast the input to a string (if it is not). if ($v !== null && !is_string($v)) { $v = (string) $v; } if ($this->' . $aColumn['var'] . ' !== $v) { $this->' . $aColumn['var'] . ' = $v; $this->modifiedColumns[] = ' . $aData['className'] . 'Peer::' . $aColumn['name'] . '; }'; break; case 'DATE': $aColumn['setFunction'] = 'if ($v !== null && !is_int($v)) { // if($v == \'\') // $ts = null; // else $ts = strtotime($v); if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE //throw new PropelException("Unable to parse date/time value for [' . $aColumn['var'] . '] from input: " // . var_export($v, true)); } } else { $ts = $v; } if ($this->' . $aColumn['var'] . ' !== $ts) { $this->' . $aColumn['var'] . ' = $ts; $this->modifiedColumns[] = ' . $aData['className'] . 'Peer::' . $aColumn['name'] . '; }'; break; case 'INT': $aColumn['setFunction'] = '// Since the native PHP type for this column is integer, // we will cast the input value to an int (if it is not). if ($v !== null && !is_int($v) && is_numeric($v)) { $v = (int) $v; } if ($this->' . $aColumn['var'] . ' !== $v || $v === 1) { $this->' . $aColumn['var'] . ' = $v; $this->modifiedColumns[] = ' . $aData['className'] . 'Peer::' . $aColumn['name'] . '; }'; break; case 'FLOAT': $aColumn['setFunction'] = 'if ($this->' . $aColumn['var'] . ' !== $v || $v === 0) { $this->' . $aColumn['var'] . ' = $v; $this->modifiedColumns[] = ' . $aData['className'] . 'Peer::' . $aColumn['name'] . '; }'; break; } $aColumns[] = $aColumn; if ($aField['FLD_KEY'] == 1 || $aField['FLD_KEY'] === 'on') { $aPKs[] = $aColumn; } else { $aNotPKs[] = $aColumn; } if ($aField['FLD_AUTO_INCREMENT'] == 1 || $aField['FLD_AUTO_INCREMENT'] === 'on') { $aData['useIdGenerator'] = 'true'; } $i++; } $oTP3 = new TemplatePower(PATH_TPL . 'additionalTables' . PATH_SEP . 'map' . PATH_SEP . 'TableMapBuilder.tpl'); $oTP3->prepare(); $oTP3->assignGlobal($aData); foreach ($aPKs as $iIndex => $aColumn) { $oTP3->newBlock('primaryKeys'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP3->assign($sKey, $aColumn[$sKey]); } } $oTP3->gotoBlock('_ROOT'); foreach ($aNotPKs as $iIndex => $aColumn) { $oTP3->newBlock('columnsWhitoutKeys'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP3->assign($sKey, $aColumn[$sKey]); } } file_put_contents($sPath . PATH_SEP . 'map' . PATH_SEP . $sClassName . 'MapBuilder.php', $oTP3->getOutputContent()); $oTP4 = new TemplatePower(PATH_TPL . 'additionalTables' . PATH_SEP . 'om' . PATH_SEP . 'BaseTable.tpl'); $oTP4->prepare(); switch (count($aPKs)) { case 0: $aData['getPrimaryKeyFunction'] = 'return null;'; $aData['setPrimaryKeyFunction'] = ''; break; case 1: $aData['getPrimaryKeyFunction'] = 'return $this->get' . $aPKs[0]['phpName'] . '();'; $aData['setPrimaryKeyFunction'] = '$this->set' . $aPKs[0]['phpName'] . '($key);'; break; default: $aData['getPrimaryKeyFunction'] = '$pks = array();' . "\n"; $aData['setPrimaryKeyFunction'] = ''; foreach ($aPKs as $iIndex => $aColumn) { $aData['getPrimaryKeyFunction'] .= '$pks[' . $iIndex . '] = $this->get' . $aColumn['phpName'] . '();' . "\n"; $aData['setPrimaryKeyFunction'] .= '$this->set' . $aColumn['phpName'] . '($keys[' . $iIndex . ']);' . "\n"; } $aData['getPrimaryKeyFunction'] .= 'return $pks;' . "\n"; break; } $oTP4->assignGlobal($aData); foreach ($aColumns as $iIndex => $aColumn) { $oTP4->newBlock('allColumns1'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP4->assign($sKey, $aColumn[$sKey]); } $oTP4->newBlock('allColumns2'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP4->assign($sKey, $aColumn[$sKey]); } $oTP4->newBlock('allColumns3'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP4->assign($sKey, $aColumn[$sKey]); } $oTP4->newBlock('allColumns4'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP4->assign($sKey, $aColumn[$sKey]); } $oTP4->newBlock('allColumns5'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP4->assign($sKey, $aColumn[$sKey]); } $oTP4->newBlock('allColumns6'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP4->assign($sKey, $aColumn[$sKey]); } $oTP4->newBlock('allColumns7'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP4->assign($sKey, $aColumn[$sKey]); } $oTP4->newBlock('allColumns8'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP4->assign($sKey, $aColumn[$sKey]); } $oTP4->newBlock('allColumns9'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP4->assign($sKey, $aColumn[$sKey]); } } $oTP4->gotoBlock('_ROOT'); foreach ($aPKs as $iIndex => $aColumn) { $oTP4->newBlock('primaryKeys1'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP4->assign($sKey, $aColumn[$sKey]); } } $oTP4->gotoBlock('_ROOT'); foreach ($aPKs as $iIndex => $aColumn) { $oTP4->newBlock('primaryKeys2'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP4->assign($sKey, $aColumn[$sKey]); } } $oTP4->gotoBlock('_ROOT'); foreach ($aNotPKs as $iIndex => $aColumn) { $oTP4->newBlock('columnsWhitoutKeys'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP4->assign($sKey, $aColumn[$sKey]); } } file_put_contents($sPath . PATH_SEP . 'om' . PATH_SEP . 'Base' . $sClassName . '.php', $oTP4->getOutputContent()); $oTP5 = new TemplatePower(PATH_TPL . 'additionalTables' . PATH_SEP . 'om' . PATH_SEP . 'BaseTablePeer.tpl'); $oTP5->prepare(); $sKeys = ''; foreach ($aPKs as $iIndex => $aColumn) { $sKeys .= '$' . $aColumn['var'] . ', '; } $sKeys = substr($sKeys, 0, -2); //$sKeys = '$pm_unique_id'; if ($sKeys != '') { $aData['sKeys'] = $sKeys; } else { $aData['sKeys'] = '$DUMMY'; } $oTP5->assignGlobal($aData); foreach ($aColumns as $iIndex => $aColumn) { $oTP5->newBlock('allColumns1'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP5->assign($sKey, $aColumn[$sKey]); } $oTP5->newBlock('allColumns2'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP5->assign($sKey, $aColumn[$sKey]); } $oTP5->newBlock('allColumns3'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP5->assign($sKey, $aColumn[$sKey]); } $oTP5->newBlock('allColumns4'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP5->assign($sKey, $aColumn[$sKey]); } $oTP5->newBlock('allColumns5'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP5->assign($sKey, $aColumn[$sKey]); } $oTP5->newBlock('allColumns6'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP5->assign($sKey, $aColumn[$sKey]); } $oTP5->newBlock('allColumns7'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP5->assign($sKey, $aColumn[$sKey]); } $oTP5->newBlock('allColumns8'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP5->assign($sKey, $aColumn[$sKey]); } $oTP5->newBlock('allColumns9'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP5->assign($sKey, $aColumn[$sKey]); } $oTP5->newBlock('allColumns10'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP5->assign($sKey, $aColumn[$sKey]); } } $oTP5->gotoBlock('_ROOT'); foreach ($aPKs as $iIndex => $aColumn) { $oTP5->newBlock('primaryKeys1'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP5->assign($sKey, $aColumn[$sKey]); } } foreach ($aPKs as $iIndex => $aColumn) { $oTP5->newBlock('primaryKeys2'); $aKeys = array_keys($aColumn); foreach ($aKeys as $sKey) { $oTP5->assign($sKey, $aColumn[$sKey]); } } file_put_contents($sPath . PATH_SEP . 'om' . PATH_SEP . 'Base' . $sClassName . 'Peer.php', $oTP5->getOutputContent()); } catch (Exception $oError) { throw($oError); } }
function save($params) { require_once 'classes/model/Event.php'; global $G_FORM; $sPRO_UID = $params->pro_uid; $sEVN_UID = $params->evn_uid; $sDYNAFORM = $params->initDyna; $sWS_USER = trim($params->username); $sWS_PASS = trim($params->password); $sWS_ROUNDROBIN = ''; $sWE_USR = ''; $xDYNA = $params->dynaform; if ($xDYNA != '') { $pro_uid = $params->pro_uid; $filename = $xDYNA; $filename = $filename . '.php'; unlink(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . $filename); unlink(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . str_replace(".php", "Post", $filename) . ".php"); } //return $params; G::LoadClass("system"); $pathProcess = PATH_DATA_SITE . 'public' . PATH_SEP . $sPRO_UID . PATH_SEP; G::mk_dir($pathProcess, 0777); $oEvent = new Event(); $oEvent->load($sEVN_UID); $sTASKS = $oEvent->getEvnTasUidTo(); $oTask = new Task(); $oTask->load($sTASKS); $tas_title = $oTask->getTasTitle(); if (G::is_https()) { $http = 'https://'; } else { $http = 'http://'; } $sContent = ''; $SITE_PUBLIC_PATH = ''; if (file_exists($SITE_PUBLIC_PATH . '')) { } require_once 'classes/model/Dynaform.php'; $oDynaform = new Dynaform(); $aDynaform = $oDynaform->load($sDYNAFORM); $dynTitle = str_replace(' ', '_', str_replace('/', '_', $aDynaform['DYN_TITLE'])); $sContent = "<?php\n"; $sContent .= "global \$_DBArray;\n"; $sContent .= "if (!isset(\$_DBArray)) {\n"; $sContent .= " \$_DBArray = array();\n"; $sContent .= "}\n"; $sContent .= "\$_SESSION['PROCESS'] = '" . $sPRO_UID . "';\n"; $sContent .= "\$_SESSION['CURRENT_DYN_UID'] = '" . $sDYNAFORM . "';\n"; $sContent .= "\$G_PUBLISH = new Publisher;\n"; $sContent .= "\$G_PUBLISH->AddContent('dynaform', 'xmlform', '" . $sPRO_UID . '/' . $sDYNAFORM . "', '', array(), '" . $dynTitle . 'Post.php' . "');\n"; $sContent .= "G::RenderPage('publish', 'blank');"; file_put_contents($pathProcess . $dynTitle . '.php', $sContent); //creating the second file, the post file who receive the post form. $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentryPost.tpl'; $template = new TemplatePower($pluginTpl); $template->prepare(); $template->assign('wsdlUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'); $template->assign('wsUploadUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/upload'); $template->assign('processUid', $sPRO_UID); $template->assign('dynaformUid', $sDYNAFORM); $template->assign('taskUid', $sTASKS); $template->assign('wsUser', $sWS_USER); $template->assign('wsPass', 'md5:' . md5($sWS_PASS)); $template->assign('wsRoundRobin', $sWS_ROUNDROBIN); if ($sWE_USR == "2") { $template->assign('USR_VAR', "\$cInfo = ws_getCaseInfo(\$caseId);\n\t \$USR_UID = \$cInfo->currentUsers->userId;"); } else { $template->assign('USR_VAR', '$USR_UID = -1;'); } $template->assign('dynaform', $dynTitle); $template->assign('timestamp', date('l jS \\of F Y h:i:s A')); $template->assign('ws', SYS_SYS); $template->assign('version', System::getVersion()); $fileName = $pathProcess . $dynTitle . 'Post.php'; file_put_contents($fileName, $template->getOutputContent()); //creating the third file, only if this wsClient.php file doesn't exists. $fileName = $pathProcess . 'wsClient.php'; $pluginTpl = PATH_CORE . 'test' . PATH_SEP . 'unit' . PATH_SEP . 'ws' . PATH_SEP . 'wsClient.php'; if (file_exists($fileName)) { if (filesize($fileName) != filesize($pluginTpl)) { @copy($fileName, $pathProcess . 'wsClient.php.bck'); @unlink($fileName); $template = new TemplatePower($pluginTpl); $template->prepare(); file_put_contents($fileName, $template->getOutputContent()); } } else { $template = new TemplatePower($pluginTpl); $template->prepare(); file_put_contents($fileName, $template->getOutputContent()); } require_once 'classes/model/Event.php'; $oEvent = new Event(); $aDataEvent = array(); $aDataEvent['EVN_UID'] = $sEVN_UID; $aDataEvent['EVN_RELATED_TO'] = 'MULTIPLE'; $aDataEvent['EVN_ACTION'] = $sDYNAFORM; $aDataEvent['EVN_CONDITIONS'] = $sWS_USER; $output = $oEvent->update($aDataEvent); $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sPRO_UID . '/' . $dynTitle . '.php'; $this->success = true; $this->msg = G::LoadTranslation('ID_WEB_ENTRY_SUCCESS_NEW'); $this->W_LINK = $link; $this->TAS_TITLE = $tas_title; $this->DYN_TITLE = $dynTitle; $this->USR_UID = $sWS_USER; }
<?php //llamamos al constructor de la plantilla y la preparamos para ser mostrada $tplCitaRealizar = new TemplatePower("plantilla/cita_realizar.html"); $tplCitaRealizar->prepare(); $citaId = addslashes($_GET['id']); $query = "SELECT pacientes.nombre_pac, pacientes.historia, citas.fecha, citas.hora, usuarios.nombre \r\n FROM pacientes, citas\r\n LEFT JOIN usuarios\r\n ON citas.responsable=usuarios.usuario\r\n WHERE citas.id_cita='{$citaId}'\r\n AND citas.mascota=pacientes.id_pac"; $rec = mysql_query($query); $datosCita = mysql_fetch_assoc($rec); //si no hay datos de la cita indicada lo envio a index if (!$datosCita) { echo "NO EXISTEN CITAS"; exit; header("Location: /gicorec/index.php"); exit; } $tplCitaRealizar->assign("nombre_mascota", $datosCita['nombre_pac']); $tplCitaRealizar->assign("historia", $datosCita['historia']); $tplCitaRealizar->assign("fecha", $datosCita['fecha']); $tplCitaRealizar->assign("hora", $datosCita['hora']); $tplCitaRealizar->assign("vet_responsable", $datosCita['nombre']); $tplCitaRealizar->assign("id_cita", $citaId); //imprimimos por pantalla $tplIndex->assign("contenido", $tplCitaRealizar->getOutputContent());
public function bajau($email) { global $db; $tp = new TemplatePower("templates/BajaUsuario.html"); $tp->prepare(); $tp->gotoBlock("_ROOT"); $sql = "delete from usuario where(email='{$email}')"; $db->ejecutar($sql); $tp->newBlock("mensaje"); echo $tp->getOutputContent(); }
private function _extjs() { G::LoadClass('serverConfiguration'); $oServerConf =& serverConf::getSingleton(); $oHeadPublisher =& headPublisher::getSingleton(); if ($oHeadPublisher->extJsInit === true) { $header = $oHeadPublisher->getExtJsVariablesScript(); $styles = $oHeadPublisher->getExtJsStylesheets($this->cssFileName); $body = $oHeadPublisher->getExtJsScripts(); //default $templateFile = G::ExpandPath("skinEngine") . 'base' . PATH_SEP . 'extJsInitLoad.html'; //Custom skins if (defined('PATH_CUSTOM_SKINS') && is_dir(PATH_CUSTOM_SKINS . $this->mainSkin)) { $templateFile = PATH_CUSTOM_SKINS . $this->mainSkin . PATH_SEP . 'extJsInitLoad.html'; } //Skin uxs - simplified if (!isset($_SESSION['user_experience'])) { $_SESSION['user_experience'] = 'NORMAL'; } if ($_SESSION['user_experience'] != 'NORMAL') { $templateFile = is_dir(PATH_CUSTOM_SKINS . 'uxs') ? PATH_CUSTOM_SKINS . 'simplified' . PATH_SEP . 'extJsInitLoad.html' : $templateFile; } } else { $styles = ""; $header = $oHeadPublisher->getExtJsStylesheets($this->cssFileName); $header .= $oHeadPublisher->includeExtJs(); $body = $oHeadPublisher->renderExtJs(); $templateFile = $this->layoutFile['dirname'] . PATH_SEP . $this->layoutFileExtjs['basename']; } $template = new TemplatePower($templateFile); $template->prepare(); $template->assign('header', $header); $template->assign('styles', $styles); $template->assign('bodyTemplate', $body); $doctype = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; $meta = null; $dirBody = null; if (isset($_SERVER["HTTP_USER_AGENT"]) && preg_match("/^.*\\(.*MSIE (\\d+)\\..+\\).*\$/", $_SERVER["HTTP_USER_AGENT"], $arrayMatch)) { $ie = intval($arrayMatch[1]); $swTrident = preg_match("/^.*Trident.*\$/", $_SERVER["HTTP_USER_AGENT"]) ? 1 : 0; //Trident only in IE8+ $sw = 1; if (($ie == 7 && $swTrident == 1 || $ie == 8) && !preg_match("/^ux.+\$/", SYS_SKIN)) { //IE8 $sw = 0; } if ($sw == 1) { if ($ie == 10) { $ie = 8; } $doctype = null; $meta = "<meta http-equiv=\"X-UA-Compatible\" content=\"IE={$ie}\" />"; } } $serverConf =& serverConf::getSingleton(); if ($serverConf->isRtl(SYS_LANG)) { $dirBody = "dir=\"RTL\""; } $template->assign("doctype", $doctype); $template->assign("meta", $meta); $template->assign("dirBody", $dirBody); echo $template->getOutputContent(); }
/** * for send email configuration * @autor Alvaro <*****@*****.**> */ public function sendTestMail() { global $G_PUBLISH; G::LoadClass("system"); G::LoadClass('spool'); $sFrom = ($_POST['FROM_NAME'] != '' ? $_POST['FROM_NAME'] . ' ' : '') . '<' . $_POST['FROM_EMAIL'] . '>'; $sSubject = G::LoadTranslation('ID_MESS_TEST_SUBJECT'); $msg = G::LoadTranslation('ID_MESS_TEST_BODY'); switch ($_POST['MESS_ENGINE']) { case 'MAIL': $engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_1'); break; case 'PHPMAILER': $engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_2'); break; case 'OPENMAIL': $engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_3'); break; } $sBodyPre = new TemplatePower(PATH_TPL . 'admin' . PATH_SEP . 'email.tpl'); $sBodyPre->prepare(); $sBodyPre->assign('server', $_SERVER['SERVER_NAME']); $sBodyPre->assign('date', date('H:i:s')); $sBodyPre->assign('ver', System::getVersion()); $sBodyPre->assign('engine', $engine); $sBodyPre->assign('msg', $msg); $sBody = $sBodyPre->getOutputContent(); $oSpool = new spoolRun(); $oSpool->setConfig(array('MESS_ENGINE' => $_POST['MESS_ENGINE'], 'MESS_SERVER' => $_POST['MESS_SERVER'], 'MESS_PORT' => $_POST['MESS_PORT'], 'MESS_ACCOUNT' => $_POST['MESS_ACCOUNT'], 'MESS_PASSWORD' => $_POST['MESS_PASSWORD'], 'SMTPAuth' => $_POST['SMTPAuth'], 'SMTPSecure' => isset($_POST['SMTPSecure']) ? $_POST['SMTPSecure'] : 'none')); $oSpool->create(array('msg_uid' => '', 'app_uid' => '', 'del_index' => 0, 'app_msg_type' => 'TEST', 'app_msg_subject' => $sSubject, 'app_msg_from' => $sFrom, 'app_msg_to' => $_POST['TO'], 'app_msg_body' => $sBody, 'app_msg_cc' => '', 'app_msg_bcc' => '', 'app_msg_attach' => '', 'app_msg_template' => '', 'app_msg_status' => 'pending', 'app_msg_attach' => '')); $oSpool->sendMail(); $G_PUBLISH = new Publisher(); if ($oSpool->status == 'sent') { $o->status = true; $o->success = true; $o->msg = G::LoadTranslation('ID_MAIL_TEST_SUCCESS'); } else { $o->status = false; $o->success = false; $o->msg = $oSpool->error; } return $o; }