function Main() { global $TPLV, $bottom, $urls, $db, $migalha; $TPLV = new TemplatePower(TEMPLATE_PATH . "modulos/categoria.tpl"); $TPLV->assignGlobal("uploadPath", UPLOAD_PATH); $TPLV->assignGlobal("uploadPath", UPLOAD_PATH_SITE); $TPLV->assignGlobal("imagePath", IMAGE_PATH); $TPLV->assignGlobal("swfPath", SWF_PATH); $TPLV->assignGlobal("localPath", LOCAL_PATH); $TPLV->assignGlobal("localPath", LOCAL_PATH_SITE); $TPLV->assignGlobal('navBottom', $bottom); $TPLV->assignGlobal($urls->var); $TPLV->prepare(); $in = $_GET['in']; switch ($in) { default: case 'lista': lista(); break; case 'novo': novo(); break; case 'editar': editar(); break; case 'salvar': salvar(); break; case 'deletar': deletar(); break; } }
function Main() { global $TPLV, $urls, $usuario, $imovel; $TPLV = new TemplatePower(TEMPLATE_PATH . "login.tpl"); $TPLV->assignGlobal("uploadPath", UPLOAD_PATH); $TPLV->assignGlobal("imagePath", IMAGE_PATH); $TPLV->assignGlobal("swfPath", SWF_PATH); $TPLV->assignGlobal("localPath", LOCAL_PATH); $TPLV->assignGlobal('navBottom', $bottom); $TPLV->assignGlobal($urls->var); $TPLV->prepare(); $in = $_GET['in']; switch ($in) { //FILTROS DE BUSCAS default: case 'deletaUsuario': deletaUsuario(); break; case 'deletaMidia': deletaMidia(); break; //LOGIN E RECUPERA SENHA //LOGIN E RECUPERA SENHA case 'getLogin': getLogin(); break; case 'login': login(); break; case 'getSenha': getSenha(); break; case 'recuperaSenha': recuperaSenha(); break; case 'isLogado': if ($usuario->isLogado()) { echo 'logado'; } else { echo 'erro'; } break; //CADASTRO //CADASTRO case 'validaEmailCadastro': validaEmailCadastro(); break; //LEADS DETALHES //LEADS DETALHES case 'getCadastro': getCadastro(); break; case 'salvarCadastro': salvarCadastro(); break; case 'verificaCPF': verificaCPF(); break; } }
function Main() { global $TPLV, $bottom, $db, $migalha, $usuario; $TPLV = new TemplatePower(TEMPLATE_PATH . "login.tpl"); $TPLV->assignGlobal("uploadPath", UPLOAD_PATH); $TPLV->assignGlobal("imagePath", IMAGE_PATH); $TPLV->assignGlobal("swfPath", SWF_PATH); $TPLV->assignGlobal("localPath", LOCAL_PATH); $TPLV->assignGlobal('navBottom', $bottom); $TPLV->prepare(); $in = $_GET['in']; switch ($in) { default: case 'restrito': if ($usuario->isLogado()) { inicio(); } else { restrito(); } break; case 'inicio': inicio(); break; case 'logout': logout(); break; } }
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(); }
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; }
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; }
/** * 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); } }
<?php //llamamos al constructor de la plantilla y la poreparamos para ser mostrada $tplClave = new TemplatePower("plantilla/recuperar_clave.html"); $tplClave->prepare(); //primero comprobamos que el usuario NO este logeado, si esta logeado redirigimos a index.php if (isset($_SESSION['logueado'])) { header("Location: index.php"); exit; } 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
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; }
public function processMap() { global $G_PUBLISH; global $G_CONTENT; global $G_FORM; global $G_TABLE; global $RBAC; G::LoadClass('processMap'); $oTemplatePower = new TemplatePower(PATH_TPL . 'processes/processes_Map.html'); $oTemplatePower->prepare(); $G_PUBLISH = new Publisher(); $G_PUBLISH->AddContent('template', '', '', '', $oTemplatePower); $oHeadPublisher =& headPublisher::getSingleton(); //$oHeadPublisher->addScriptfile('/jscore/processmap/core/processmap.js'); $oHeadPublisher->addScriptCode(' var maximunX = ' . processMap::getMaximunTaskX($_SESSION['PROCESS']) . '; window.onload = function(){ var pb=leimnud.dom.capture("tag.body 0"); Pm=new processmap(); var params = "{\\"uid\\":\\"' . $_SESSION['PROCESS'] . '\\",\\"mode\\":false,\\"ct\\":false}"; // maximun x and y position var xPos = 0; var yPos = 0; //obtaining the processmap object for the current process var oRPC = new leimnud.module.rpc.xmlhttp({ url : "../processes/processes_Ajax", async : false, method: "POST", args : "action=load&data="+params }); oRPC.make(); var response = eval(\'(\' + oRPC.xmlhttp.responseText + \')\'); for (var i in response){ if (i==\'task\'){ elements = response[i]; for (var j in elements){ if (elements[j].uid!=undefined){ if (elements[j].position.x > xPos){ xPos = elements[j].position.x; } if (elements[j].position.y > yPos){ yPos = elements[j].position.y; } } } } } Pm.options = { target : "pm_target", dataServer: "../processes/processes_Ajax", uid : "' . $_SESSION['PROCESS'] . '", lang : "' . SYS_LANG . '", theme : "processmaker", size : {w:xPos+800,h:yPos+150}, images_dir: "/jscore/processmap/core/images/", rw : false, hideMenu : false } Pm.make(); oLeyendsPanel = new leimnud.module.panel(); oLeyendsPanel.options = { size :{w:260,h:155}, position:{x:((document.body.clientWidth * 95) / 100) - ((document.body.clientWidth * 95) / 100 - (((document.body.clientWidth * 95) / 100) - 260)),y:45,center:false}, title :G_STRINGS.ID_COLOR_LEYENDS, theme :"processmaker", statusBar:false, control :{resize:false,roll:false,drag:true,close:false}, fx :{modal:false,opacity:false,blinkToFront:true,fadeIn:false,drag:false} }; oLeyendsPanel.setStyle = { content:{overflow:"hidden"} }; oLeyendsPanel.events = { remove: function() {delete(oLeyendsPanel);}.extend(this) }; oLeyendsPanel.make(); oLeyendsPanel.loader.show(); var oRPC = new leimnud.module.rpc.xmlhttp({ url : "cases_Ajax", args: "action=showLeyends" }); oRPC.callback = function(rpc){ oLeyendsPanel.loader.hide(); var scs=rpc.xmlhttp.responseText.extractScript(); oLeyendsPanel.addContent(rpc.xmlhttp.responseText); }.extend(this); oRPC.make(); }'); G::RenderPage('publish', 'blank'); }
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; } }
<?php session_start(); include "inc.includes.php"; $db = new BaseDatos($config['dbhost'], $config['dbuser'], $config['dbpass'], $config['db']); $tpl = new TemplatePower("templates/index.html"); $tpl->prepare(); $tpl->gotoBlock("_ROOT"); //isset determina si una variable esta definida o es null //$_REQUEST tiene el contenido de get y post if (!isset($_REQUEST["action"]) || $_REQUEST["action"] == "") { $tpl->newBlock("contenido"); $mhotels = new MHotels(); $result = $mhotels->allhoteles(); 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 {
//inclimos los archivos de control necesarios para la clase templatepower include_once 'clases/class.TemplatePower.inc.php'; require_once 'clases/class.phpmailer.php'; require_once 'libreria.php'; //iniciamos sesión con mysql session_start(); //Datos para la conexion a mysql define('DB_SERVER', 'localhost'); define('DB_NAME', 'gicorec'); define('DB_USER', 'root'); define('DB_PASS', ''); $con = mysql_connect(DB_SERVER, DB_USER, DB_PASS); mysql_select_db(DB_NAME, $con); //Inicializamos la plantilla $tplIndex = new TemplatePower("plantilla/index.html"); $tplIndex->prepare(); //Establecemos el archivo de gestión a usar para las tareas que lo precisen if (isset($_GET['gestion'])) { $gestion = $_GET['gestion']; include_once "gestion/{$gestion}.php"; } elseif (isset($_GET['ajax'])) { //peticiones ajax que recibimos. $filePath = "ajax/" . $_GET['ajax'] . ".php"; if (is_file($filePath)) { include_once "{$filePath}"; exit; } //para el caso en el que se necesite crear el pdf } elseif (isset($_GET['imprimir'])) { include_once "imprimir.php"; } else {
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(); }
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(); }
<?php $errors = new TemplatePower('../html/errors.tpl'); $errors->prepare(); try { $db = new PDO('mysql:host=localhost;dbname=mydb;charset=utf8', 'root', ''); $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $error) { //print "er is een error: ".$error->getFile()." ".$error->getLine(); $errors->newBlock("ERRORS"); $errors->assign("ERROR", "er is een error: " . $error->getFile() . " " . $error->getLine()); }
/** * 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; }
<?php //llamamos al contructor de la plantilla y la preparamos para mostrar $tplPacientes = new TemplatePower("plantilla/pacientes.html"); $tplPacientes->prepare(); //creamos el mensaje a mostrar en función de la acción realizada $tplPacientes->assign("titulo", "Pacientes"); if (isset($_GET['msg'])) { $tplPacientes->newBlock('notificacion_ok'); switch ($_GET['msg']) { case 'pac_add': $msg = 'Paciente añadido con éxito'; break; case 'pac_del': $msg = 'Paciente eliminado con éxito'; break; case 'pac_edit': $msg = 'Paciente editado con éxito'; break; case 'pac_noedit': $msg = 'No se ha modificado nigún campo'; break; default: $msg = ''; break; } $tplPacientes->assign("msg", $msg); } if (isset($_POST) && isset($_POST['buscar'])) { //gestionamos el buscar $query = "SELECT DISTINCT * FROM pacientes \r\n WHERE historia LIKE '%" . $_POST['buscar'] . "%'\r\n OR nombre_pac LIKE '%" . $_POST['buscar'] . "%'\r\n OR especie LIKE '%" . $_POST['buscar'] . "%' \r\n OR edad LIKE '%" . $_POST['buscar'] . "%'\r\n OR sexo LIKE '%" . $_POST['buscar'] . "%'\r\n OR raza LIKE '%" . $_POST['buscar'] . "%' \r\n OR dni_propietario LIKE '%" . $_POST['buscar'] . "%'\r\n OR remitente LIKE '%" . $_POST['buscar'] . "%'\r\n OR clinica_remitente LIKE '%" . $_POST['buscar'] . "%'\r\n OR tel_remitente LIKE '%" . $_POST['buscar'] . "%' \r\n OR mail_remitente LIKE '%" . $_POST['buscar'] . "%' \r\n ORDER BY especie";
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"; }
/** * 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; }
$output = $oEvent->update($aDataEvent); //Show link $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sPRO_UID . '/' . $dynTitle . '.php'; print $link; //print "\n<a href='$link' target='_new' > $link </a>"; } else { $G_FORM = new Form($sPRO_UID . '/' . $sDYNAFORM, 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_CORE . 'templates/' . '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_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentry.tpl'; $template = new TemplatePower($pluginTpl); $template->prepare(); 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);
switch ($_GET[action]) { case "deleteall": $MessCat = intval($_GET[messcat]); if ($MessCat != "100") { $sql = "`message_type` = " . $MessCat . " AND "; } doquery("DELETE FROM {{table}} WHERE {$sql} message_owner = " . $user[id], 'messages'); header("Location: " . $_SERVER['PHP_SELF'] . "?messcat=" . $MessCat); exit; break; } } // ADD SMILIES ARRAY makeSmiliesArray(); $tp = new TemplatePower($ugamela_root_path . TEMPLATE_DIR . TEMPLATE_NAME . "/messages.tpl"); $tp->prepare(); $OwnerID = $_GET['id']; $MessCategory = isset($_GET['messcat']) ? $_GET['messcat'] : '100'; $MessPageMode = isset($_GET['mode']) ? $_GET['mode'] : 'show'; $UsrMess = doquery("SELECT SQL_CACHE * FROM {{table}} WHERE `message_owner` = " . $user['id'] . " ORDER BY `message_time` DESC;", 'messages'); $UnRead = $user; $MessageType = array(100, 0, 1, 2, 3, 4, 5, 15, 99); $TitleColor = array(0 => '#FFFF00', 1 => '#FFFF00', 2 => '#FFFF00', 3 => '#FFFF00', 4 => '#FFFF00', 5 => '#FFFF00', 15 => '#FFFF00', 99 => '#FFFF00', 100 => '#FFFF00'); $BackGndColor = array(0 => '#663366', 1 => '#663366', 2 => '#663366', 3 => '#663366', 4 => '#663366', 5 => '#663366', 15 => '#663366', 99 => '#663366', 100 => '#663366'); for ($MessType = 0; $MessType < 101; $MessType++) { if (in_array($MessType, $MessageType)) { $WaitingMess[$MessType] = $UnRead[$messfields[$MessType]]; $TotalMess[$MessType] = 0; } } while ($CurMess = mysql_fetch_array($UsrMess)) {
<?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());
<?php // Hier laad ik de header.html in $header = new TemplatePower("template/files/header.tpl"); $header->prepare(); if (!empty($_SESSION['accountid'])) { $header->newBlock("LOGGEDIN"); $header->assign("USERNAME", $_SESSION['username']); // if($_SESSION['roleid'] == 2){ // $header->newBlock("ADMINMENU"); // } } else { $header->newBlock("LOGINTOP"); }
/* GET , POST & $_SESSION Vars */ if (isset($_GET['POSITION'])) { $_SESSION['STEP_POSITION'] = (int) $_GET['POSITION']; } if (isset($_SESSION['CASES_REFRESH'])) { unset($_SESSION['CASES_REFRESH']); G::evalJScript("if(typeof parent != 'undefined' && parent.refreshCountFolders) parent.refreshCountFolders();"); } /* Menues */ $G_MAIN_MENU = 'processmaker'; $G_ID_MENU_SELECTED = 'CASES'; $G_SUB_MENU = 'caseOptions'; $G_ID_SUB_MENU_SELECTED = '_'; /* Prepare page before to show */ $oTemplatePower = new TemplatePower(PATH_TPL . 'cases/cases_Step.html'); $oTemplatePower->prepare(); $G_PUBLISH = new Publisher(); $oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher->addScriptCode(' var Cse = {}; Cse.panels = {}; var leimnud = new maborak(); leimnud.make(); leimnud.Package.Load("rpc,drag,drop,panel,app,validator,fx,dom,abbr",{Instance:leimnud,Type:"module"}); leimnud.exec(leimnud.fix.memoryLeak); leimnud.event.add(window,"load",function(){ ' . (isset($_SESSION['showCasesWindow']) ? 'try{' . $_SESSION['showCasesWindow'] . '}catch(e){}' : '') . ' }); '); $G_PUBLISH->AddContent('template', '', '', '', $oTemplatePower); $oCase = new Cases();
<?php require_once 'config.inc.php'; $tpl_main = new TemplatePower('template/master.html'); $tpl_main->prepare(); // check to see if the user is logged in and is a student, staff or admin if (!$_AUTH->isLoggedIn() || !$_AUTH->isStudent() && !$_AUTH->isStaff() && !$_AUTH->isAdmin()) { // send the user to an error page and that's it $tpl = new TemplatePower('template/error.html'); $tpl->assignGlobal('error_message', 'You are not logged in as a student.'); $tpl->prepare(); // check to see if the user is in any courses } elseif (sizeof(get_user_courses($_DB)) == 0) { // send the user to an error page and that's it $tpl = new TemplatePower('template/error.html'); $tpl->assignGlobal('error_message', 'You are not not enrolled in any courses.'); $tpl->prepare(); // the user is good to go } else { $tpl = new TemplatePower('template/students.html'); // see if a form was submitted if (isset($_POST['action'])) { $action = $_POST['action']; // check to see what the user wanted to do switch ($action) { // uploading a file case 'upload': $assignment = $_POST['assignment']; $user = $_SESSION['userID']; $path = $_CONF['upload_path']; $tpl->assignInclude('upload', 'template/upload.html');
<?php $content = new TemplatePower("../html/registratie.tpl"); $content->prepare(); if (isset($_GET['action'])) { $action = $_GET['action']; } else { $action = NULL; } switch ($action) { case "registreren": if (!empty($_POST['voornaam']) && !empty($_POST['achternaam']) && !empty($_POST['gebruikersnaam']) && !empty($_POST['email']) && !empty($_POST['password1']) && !empty($_POST['password2'])) { // insert if ($_POST['password1'] == $_POST['password2']) { // insert $insert_user = $db->prepare("INSERT INTO users SET\n Surename = :achternaam,\n Name = :voornaam,\n Email = :email"); $insert_user->bindParam(":achternaam", $_POST['achternaam']); $insert_user->bindParam(":voornaam", $_POST['voornaam']); $insert_user->bindParam(":email", $_POST['email']); $insert_user->execute(); $userid = $db->lastInsertId(); $insert_account = $db->prepare("INSERT INTO accounts SET\n Username = :username,\n Password = :password,\n salt = :salt,\n Users_idUsers = :userid,\n Role_idRole = :roleid"); $insert_account->bindParam(":username", $_POST['gebruikersnaam']); $password = sha1($_POST['password1']); $insert_account->bindParam(":password", $password); $insert_account->bindParam(":salt", $userid); $insert_account->bindParam(":userid", $userid); $insert_account->bindValue(":roleid", 1); $insert_account->execute(); $content->newBlock("MELDING"); $content->assign("MELDING", "Gebruiker is toegevoegd");
<?php // inladen van footer.html $footer = new TemplatePower("template/files/footer.tpl"); $footer->prepare(); // Op het einde van de code zorg ik ervoor dat alles uit word geprint $header->printToScreen(); $errors->printToScreen(); $content->printToScreen(); $footer->printToScreen();