private static function signView()
 {
     $plantilla = new Template();
     $vista = $plantilla->getContents("../_plantilla1/_index.html");
     $signin = $plantilla->getContents("../_plantilla1/_signin.html");
     $nav = $plantilla->getContents("../_plantilla1/_nav.html");
     $datos = array("nav" => $nav, "work" => "", "edit" => "", "titulo" => "", "nombre" => "", "descripcion" => "", "login" => "", "formulario" => $signin, "mensajes" => "", "profile" => "", "upload" => "", "gallery" => "", "artistas" => "", "contact" => "");
     echo $plantilla->insertTemplate($vista, $datos);
 }
Example #2
0
 public static function getExamplejson()
 {
     $template = new Template('example', 'json');
     $template->setVars(['EXAMPLE_VALUE' => 'This is an example of substituted value']);
     self::$appOutput = $template->getContents();
     self::out();
 }
Example #3
0
 public static function getTest()
 {
     $navpanel = (require self::$appDir . '/config/navpanel.php');
     $template = new Template('layout');
     $template->setVars(['navpanel' => $navpanel]);
     $template->setVars(['contents' => file_get_contents(self::$appDir . '/views/static/test.html')]);
     self::$appOutput = $template->getContents();
     self::out();
 }
 private static function readView()
 {
     $plantilla = new Template();
     $bd = new BaseDatos();
     $gestor = new ManageArtist($bd);
     $gestorUsuario = new ManageUser($bd);
     $gestorimagenes = new ManageGallery($bd);
     //Carga de plantillas
     $vista = $plantilla->getContents("../_plantilla1/_index.html");
     $nav = $plantilla->getContents("../_plantilla1/_nav.html");
     $login = $plantilla->getContents("../_plantilla1/_login.html");
     $gallery = $plantilla->getContents("../_plantilla1/_gallery.html");
     $artistas_plantilla = $plantilla->getContents("../_plantilla1/_artistas.html");
     $lista_artistas = $plantilla->getContents("../_plantilla1/_lista-artistas.html");
     //Todos los Artistas ------------------------------
     $usuarios = $gestorUsuario->getList();
     $imagenes = $gestorimagenes->getList();
     $elementos = "";
     $elementos_a = "";
     foreach ($usuarios as $key => $artista) {
         if ($artista->getActivo() == 1 || $artista->getPersonal() == 1 || $artista->getAdministrador() == 1) {
             $elemento_i = $plantilla->replace("nombre_artista", $artista->getAlias(), $lista_artistas);
             $elemento_i = $plantilla->replace("mail_artista", $artista->getEmail(), $elemento_i);
             $elementos_a .= $elemento_i;
         }
     }
     if (Request::req("email") == "") {
         $elementos = self::loadImage($plantilla, $gallery, $imagenes, $elementos);
     } else {
         $email = Request::req("email");
         $email_artista = $gestorUsuario->get($email)->getEmail();
         $art_album = $gestor->get($email_artista)->getGaleria();
         $galeria_personalizada = $gestorimagenes->getList();
         foreach ($galeria_personalizada as $key => $imagen) {
             if ($imagen->getId() == $art_album) {
                 $elemento = $plantilla->replace("src", $imagen->getImagen(), $gallery);
                 $elemento = $plantilla->replace("piefoto", $imagen->getDescripcion(), $elemento);
                 $elemento = $plantilla->replace("id_imagen", $imagen->getId_imagen(), $elemento);
                 $elemento = $plantilla->replace("album", $imagen->getId(), $elemento);
                 $elementos .= $elemento;
             }
         }
     }
     $artistas_plantilla = $plantilla->replace("lista_artistas", $elementos_a, $artistas_plantilla);
     $datos = array("nav" => $nav, "work" => "", "edit" => "", "titulo" => "Galeria de Arte", "formulario" => "", "mensajes" => "", "descripcion" => 'Arte por todas partes', "login" => $login, "profile" => "", "upload" => "", "artistas" => $artistas_plantilla, "gallery" => "{$elementos}", "contact" => "");
     echo $plantilla->insertTemplate($vista, $datos);
 }
Example #5
0
		$a             = new Activation();
		$a->username   = $username;
		$a->email      = $email;
		$a->password   = md5($password);
		$a->nation     = $nation;
		$a->IP         = $_SERVER['REMOTE_ADDR'];
		$a->referrerId = $t->referrerId;
		$a->time       = time();
		$id            = $a->create();
	
		if ($id) {
			// Can send the email
			$et           = new Template('activation-email', 1);
			$et->username = $username;
			$et->password = $password;
			$text         = $et->getContents('activation-email-text');
			$html         = $et->getContents('activation-email-html');
				
			$e = new Email($email, "Welome to WWII::Game $username", $html, $text);
			
			if (!$e->send()) {
				throw new Exception('Could not send the activation email. Please contact an admin on the forum, or by email');
			}
			
			header('Location: index.php?e=5');
			exit;
		}
		else {
			throw new Exception('Could not create the user, please try again');
		}	
	
Example #6
0
function doEmail($username, $password, $email) {
	$et = new Template('activation-email', 1);
	$et->username = $username;
	$et->email    = $email;
	$et->password = $password;
	$text = $et->getContents('change-prefs-email-text');
	$html = $et->getContents('change-prefs-email-html');

	$e = new Email($email, "Login credential change notification for $username", $html, $text);
	return $e->send();
}
 private static function editView($gestor)
 {
     $plantilla_editar = new Template();
     $sesion = new Session();
     $artista = self::getArtist($sesion);
     $formulario = $plantilla_editar->getContents("../" . $artista->getStyle() . "/_form.html");
     $vista = $plantilla_editar->getContents("../" . $artista->getStyle() . "/_index.html");
     $trabajo = $plantilla_editar->getContents("../" . $artista->getStyle() . "/_work.html");
     $edit = $plantilla_editar->getContents("../" . $artista->getStyle() . "/_edit.html");
     $nav = $plantilla_editar->getContents("../" . $artista->getStyle() . "/_nav.html");
     $textarea = $plantilla_editar->getContents("../" . $artista->getStyle() . "/_textarea.html");
     $textarea = $plantilla_editar->replace("value3", $artista->getPerfil(), $textarea);
     $datos_form_textarea = array("label3" => "Enter profile description:", "campo3" => "perfil", "value3" => $artista->getPerfil());
     foreach ($datos_form_textarea as $key => $value) {
         $textarea = $plantilla_editar->replace($key, $value, $textarea);
     }
     $datos_form = array("action" => "?action=edit&do=Set", "method" => "POST", "type1" => "text", "type2" => "text", "type3" => "textarea", "label1" => "Enter title", "label2" => "Enter description", "label3" => "Enter profile", "campo1" => "titulo", "campo2" => "descripcion", "campo_3" => "", "value1" => $artista->getTitulo(), "value2" => $artista->getDescripcion(), "textarea" => $textarea);
     foreach ($datos_form as $key => $value) {
         $formulario = $plantilla_editar->replace($key, $value, $formulario);
     }
     $datos = array("nav" => $nav, "work" => $trabajo, "edit" => $edit, "titulo" => "EDIT PROFILE ARTIST", "nombre" => "", "descripcion" => $sesion->getUser()->getAlias(), "login" => "", "formulario" => $formulario, "mensajes" => "", "profile" => "", "upload" => "", "gallery" => "", "artistas" => "", "contact" => "");
     echo $plantilla_editar->insertTemplate($vista, $datos);
 }
Example #8
0
 function createPasswordAndSend()
 {
     // Konfiguration
     $oConfiguration =& Configuration::createInstance();
     // Templat
     $oTemplate = new Template(TEMPLATE_PATH);
     $oTemplate->setParseMode(TRUE);
     // Skapa password
     $this->setPassword($sPassword = randStr($oConfiguration->getCustomValue("PasswordLen")));
     // Definiera
     $oTemplate->set("UserName", $this->sName);
     $oTemplate->set("Password", $sPassword);
     // Hämta output
     $oTemplate->parse();
     $sData = $oTemplate->getContents();
     // Maila
     if (!mail($this->sEmail, $oConfiguration->getCustomValue("MailSubject"), $sData, "From: " . $oConfiguration->getCustomValue("MailFrom") . " <*****@*****.**>")) {
         trigger_error("41", E_USER_WARNING);
         return FALSE;
     }
     // Returnera
     return TRUE;
 }
 protected function loadTemplateBlocks(Template &$template)
 {
     if ($this->benchmarkRendering) {
         $this->Benchmark->start('load-template-blocks-' . $template->getName());
     }
     $unparsedContent = $template->getContents();
     $templateBlocks = array();
     $parsedContent = '';
     $foundOne = false;
     while (($pos = strpos($unparsedContent, '{% begin ')) !== false) {
         $foundOne = true;
         $parsedContent .= substr($unparsedContent, 0, $pos);
         $content = substr($unparsedContent, $pos);
         $eol = strpos($content, "\n");
         $line = $content;
         if ($eol !== FALSE) {
             $line = substr($content, 0, $eol !== FALSE ? $eol : 0);
         }
         if (preg_match("/\\{\\%\\s+begin\\s+([^\\%]+?)\\s+\\%\\}[\n\r\t]*/s", $line, $m)) {
             $blockName = $m[1];
             $endpos = strpos($content, '{% end %}');
             if ($endpos === FALSE) {
                 throw new Exception('No end block found for :' . $m[0]);
             }
             $blockContents = trim(substr($content, strlen($m[0]), $endpos - strlen($m[0])), "\n\r\t");
             $blockContents = $this->parseFormatVariables($blockContents, $this->getConstants());
             $templateBlocks[$blockName] = $blockContents;
         } else {
             throw new Exception('Invalid begin block found: ' . $line);
         }
         $unparsedContent = substr($content, $endpos + strlen('{% end %}'));
     }
     if (!$foundOne) {
         $blockContents = $this->parseFormatVariables($unparsedContent, $this->getConstants());
         $templateBlocks['contents'] = $blockContents;
     }
     $template->setTemplateBlocks($templateBlocks);
     if ($this->benchmarkRendering) {
         $this->Benchmark->end('load-template-blocks-' . $template->getName());
     }
     return $template;
 }