function testTemplateClass() { $t = new Template('index.html'); $t->replace('FOOTER', '<b>This is the footer</b>'); $t->replace('LOGIN_FORM', joinPaths(CHRIS_VIEW_FOLDER, 'login_form.html')); return $t; }
public static function getHTML($object) { $t = new Template('plugin.html'); $t->replace('PLUGIN_CAROUSEL', PluginV::getCarousel($object)); $plugin_parameters = ''; foreach ($object as $p) { $plugin_parameters .= PluginC::getUI($p['name']); } $t->replace('PLUGIN_PARAMETERS', $plugin_parameters); return $t; }
private static function testTemplateType() { if (self::$clanData['data']['premiumBis'] < time()) { if (!empty(self::$clanData['data']['useStandartDesign'])) { echo "Eigenes Standart Design "; } else { Template::init("templates/standart.html"); Template::replace("</head>", "\n" . Template::leerzeichen("<title>") . '<link rel="stylesheet" type="text/css" href="http://myclankonto.net/' . self::$routerData['clanid'] . '/stylecheet.css" />' . "\n" . Template::leerzeichen("<head>") . '</head>'); Template::replaceContent("{seiteninhalt}", "pages/site/" . self::$routerData['site'] . ".php"); Template::replace("{title}", self::$clanData['data']['pageTitle']); echo Template::out(); } } else { MySQL::query("SELECT * FROM `inhalte` WHERE `clanid`='" . self::$routerData['clanid'] . "' AND `template`='1' AND `templateType`='5'"); if (MySQL::count() == 1) { $row = MySQL::fetchArray(); Template::init(NULL, true, $row['inhalt']); MySQL::query("SELECT * FROM `inhalte` WHERE `template`='1' AND `templateType`='6'"); if (MySQL::count()) { Template::replace("</head>", "\n" . Template::leerzeichen("<title>") . '<link rel="stylesheet" type="text/css" href="http://myclankonto.net/' . self::$routerData['clanid'] . '/stylecheet.css" />' . "\n" . Template::leerzeichen("<head>") . '</head>'); } Template::replaceContent("{seiteninhalt}", "pages/site/" . self::$routerData['site'] . ".php"); Template::replace("{title}", self::$clanData['data']['pageTitle']); echo Template::out(); } else { echo "Premium Standart"; } } }
private static function testTemplateType() { if (self::$clanData['premiumBis'] < time()) { if (!empty(self::$clanData['useStandartDesign'])) { echo "Eigenes Standart Design "; } else { Template::init("templates/standart_stylecheet.css"); Template::replace("{header_height}", self::$clanData['designset_headerheight']); Template::set("Content-Type: text/css"); echo Template::out(); } } else { MySQL::query("SELECT * FROM `inhalte` WHERE `template`='1' AND `templateType`='5'"); if (MySQL::count()) { MySQL::query("SELECT * FROM `inhalte` WHERE `template`='1' AND `templateType`='6'"); if (MySQL::count()) { $row = MySQL::fetchArray(); Template::init(NULL, true, $row['inhalt']); Template::replace("{header_height}", self::$clanData['designset_headerheight']); Template::set("Content-Type: text/css"); echo Template::out(); } } else { echo "Premium Standart"; } } }
function moderateComment($id, $action, $fullUser) { global $dbConnectionInfo; $toReturn = ""; $act = false; if ($action == "approved") { $act = true; } $cmt = new Comment($dbConnectionInfo, "", $fullUser); $return = $cmt->moderate($id, $action); $toReturn = $return['page']; if ($return['page'] != "" && $act && $return['oldState'] == 'new') { // notify users $user = new User($dbConnectionInfo); $usersToNotify = $user->getUsersToNotify($toReturn, $id); $cmtInfo = $cmt->getInfo($id); $productTranslate = defined("__PRODUCT_NAME__") ? __PRODUCT_NAME__ : $cmtInfo['product']; $template = new Template("./templates/newComment.html"); $confirmationMsg = $template->replace(array("page" => __BASE_URL__ . $toReturn . "#" . $id, "text" => $cmtInfo['text'], "user" => $cmtInfo['name'], "productName" => $productTranslate)); foreach ($usersToNotify as $key => $value) { $mail = new Mail(); $subject = "[" . $productTranslate . "] " . Utils::translate('newCommentApproved'); $subject .= " [" . $toReturn . "]"; $mail->Subject($subject); $mail->To($value); $mail->From(__EMAIL__); $mail->Body($confirmationMsg); $mail->Send(); //$toReturn = "\nSEND to ".$value."user email='".$userEmail."'"; } } return $toReturn; }
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); }
private function runTest($metadata, Template $template, $memcheck = false) { $test_args = $template->hasArgs(); foreach ($this->args as $key => $arg) { // Prepare for next template $template->clear(); $template->replace('funcname', @$metadata['function']); $template->replace('classname', @$metadata['class']); $template->replace('methodname', @$metadata['method']); // For argument concatenation $template->replace('args2', empty($arg) ? $arg : $arg . ','); // For argument without concatenation $template->replace('args', $arg); if ($test_args) { printf("- %s - Args: %s\n", $metadata['name'], $arg); } else { printf("- %s:\n", $metadata['name']); } if ($memcheck) { $ret = $this->memcheck($metadata['name'], $template->getSource()); } else { $ret = $this->execute($metadata['name'], $template->getSource()); switch ($ret) { case 139: /* signal 11 */ printf(" SIGSEGV\n", $ret); break; default: printf(" Exit status = %d\n", $ret); break; } if (!$test_args) { break; } } } }
function notifyModerators($id, $page, $text, $userName, $name, $product, $moderators) { $template = new Template("./templates/newCommentToModerate.html"); $productTranslate = defined("__PRODUCT_NAME__") ? __PRODUCT_NAME__ : $product; $subject = "[" . $productTranslate . "] " . Utils::translate('newCommentToModerate'); if (defined('__MODERATE__') && !__MODERATE__) { $template = new Template("./templates/newUnmoderatedComment.html"); $subject = "[" . $productTranslate . "] " . Utils::translate('newUnmoderatedCommentAdded'); } $subject .= " [" . $page . "]"; $ca = base64_encode($id . "&approved"); $cr = base64_encode($id . "&deleted"); $confirmationMsg = $template->replace(array("page" => __BASE_URL__ . $page . "#" . $id, "text" => $text, "userName" => $userName, "user" => $name, "productName" => $productTranslate, "aproveLink" => __BASE_URL__ . "oxygen-webhelp/resources/moderate.html?c=" . $ca, "deleteLink" => __BASE_URL__ . "oxygen-webhelp/resources/moderate.html?c=" . $cr)); foreach ($moderators as $key => $value) { $mail = new Mail(); $mail->Subject($subject); $mail->To($value); $mail->From(__EMAIL__); $mail->Body($confirmationMsg); $mail->Send(); } }
// Det ?r vi, fixa variabler $iNumberThreads = $_SESSION['oUser']->getNumberThreads(); $iThreadTimestamp = $_SESSION['oUser']->getLastLogout(); $a_iOldThreads = $_SESSION['a_iOldThreads']; } // H?mta tr?dlistan $oTL = new ThreadList(); if (FALSE === ($a_oThreads = $oTL->getThreads($_GET['Sort'], $iNumberThreads, $iNumberThreads * ($_GET['Page'] - 1), $iThreadTimestamp, $a_iOldThreads))) { trigger_error("11: " . $oTL->getErrorMsg(), E_USER_WARNING); } // Bygg upp sidan $oTemplate->set("title", $oConfiguration->getCustomValue("Title")); if ($bInlogged) { $oTemplate->set("User_ID", $_SESSION['oUser']->getID()); $oTemplate->set("User_Name", htmlspecialchars($_SESSION['oUser']->getName())); $oTemplate->replace("Login_Outside", "Login_Inside"); } $oTemplate->set("Page", $_GET['Page']); $oTemplate->set("Page_Next", $_GET['Page'] + 1); $oTemplate->set("Page_Prev", $_GET['Page'] - 1); $oTemplate->set("Sort", $_GET['Sort']); $iCounter = 0; foreach (array_keys($a_oThreads) as $iThread) { $oThread =& $a_oThreads[$iThread]; $oUser = $oThread->getUser(); $oLastUser = $oThread->getLastPostUser(); $oTemplate->set("Thread_ID", $oThread->getThreadID()); $oTemplate->set("Thread_Rubrik", $oThread->getRubrik()); $oTemplate->set("Thread_Answers", $oThread->getNumberPosts() - 1); $oTemplate->set("Thread_Reads", $oThread->getNumberReads()); $oTemplate->set("Thread_Last_Time", fixDateFormat($oThread->getLastPostTimestamp()));
} } } } /* validate page request */ // empty defaults to landing page set in config if (empty($_REQUEST['page'])) { $loadPage = $cfg['landing_page']; } elseif (in_array($_REQUEST['page'], $pagesArray)) { $loadPage = $_REQUEST['page']; } else { die('page: ' . $_REQUEST['page'] . ', does not exist'); } // else $loadPage='404error'; /* output page */ $template->load(PATH . './pages/' . $loadPage . '.php'); $templateList = loadTemplates(); foreach ($templateList as $tpl) { $tplName = substr($tpl, 0, strlen($tpl) - 4); $template->replace($tplName, file_get_contents(PATH . $cfg['theme_templateDir'] . $tpl)); } $template->publish(); /* debug stats */ @(print '<p>' . mysql_stat($cfg['mysql_linkid']) . '</p>'); $microTime = microtime(); $microTime = explode(' ', $microTime); $microTime = $microTime[1] + $microTime[0]; $loadEnd = $microTime; $loadTime = round($loadEnd - $loadStart, 4); echo '<p>Page generated in ' . $loadTime . ' seconds.' . '</p>'; exit;
/** * Sends the newly generated password to the email of user using the given username in the model. * @return boolean whether successfuly send password */ public function send_password($user_id) { $userModel = new SuUser(); $model = new Admin_ajax(); $password = $userModel->random_password(); $this->user_password = md5($password); $userData = $this->getUserData($user_id); $userData['user_password'] = $password; /////////////////////////////////////////////////////////////////////// ///////////Create Forgot password email Template ////////////////////// /////////////////////////////////////////////////////////////////////// $tempemaildata = $model->customOneRowQuery("SELECT * FROM `su_notification_templates` WHERE type='email' and alias='forgotpassward'"); $emailtemplate = new Template(); $emailtemplate->setKeys($userData); $emailText = $emailtemplate->replace($tempemaildata['content']); /////////////////////////////////////////////////////////////////////// ///////////End Create Forgot password email Template ////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// ///////////Create Forgot password email Template ////////////////////// /////////////////////////////////////////////////////////////////////// $tempsmsdata = $model->customOneRowQuery("SELECT * FROM `su_notification_templates` WHERE type='sms' and alias='forgotpassward'"); $smstemplate = new Template(); $smstemplate->setKeys($userData); $smsText = $smstemplate->replace($tempsmsdata['content']); //print_r($userData);die; /////////////////////////////////////////////////////////////////////// ///////////End Create Forgot password email Template ////////////////// /////////////////////////////////////////////////////////////////////// // $data = array("name" => $userData["user_fname"], "email" => $userData["user_email"], "password" => $password); // $msg_data = 'Below are the new password for PayWayhelp account : // // Username/Email : ' . $userData["user_email"] . ' // // Password : '******''; // if ($insert) { if (isset($userData["user_notification"]) && $userData["user_notification"] == 'both') { //$UserEmail = new UserEmail($this->username,$this->user_password); $UserEmail = new UserEmail(); //$status = $UserEmail->SendMail($userData["user_email"], 'Reset Password', 'reset_password', $data); $UserEmail->SendCustomMail($userData["user_email"], "Paywayhelp : Reset Password", $emailText); //sms api //$msg_id = $this->send_sms_via_gateway($userData["user_fname"], 'Reset Password', $msg_data); $msg_id = $this->send_sms_via_gateway($userData["user_phoneNumber"], 'Reset Password', $smsText); //add message data $admin_ajax->insert_data('su_message', array('message_id' => $msg_id, 'message_user' => $user_id, 'message_date' => date('Y-m-d H:i:s'))); } elseif (isset($userData["user_notification"]) && $userData["user_notification"] == 'mail') { $UserEmail = new UserEmail(); //$status = $UserEmail->SendMail($userData["user_email"], 'Reset Password', 'reset_password', $data); $UserEmail->SendCustomMail($userData["user_email"], "Paywayhelp : Reset Password", $emailText); } elseif (isset($userData["user_notification"]) && $userData["user_notification"] == 'sms') { //sms api $msg_id = $this->send_sms_via_gateway($userData["user_phoneNumber"], 'Reset Password', $smsText); //add message data $admin_ajax->insert_data('su_message', array('message_id' => $msg_id, 'message_user' => $user_id, 'message_date' => date('Y-m-d H:i:s'))); } return $msg_id; /* } else { return false; } */ }
$mail = new Mail(); $mail->Subject("[" . $productTranslate . "] " . Utils::translate('RecoveredEmailSubject')); $mail->To($info['email']); $mail->From(__EMAIL__); $mail->Body($confirmationMsg); $mail->Send(); $user->changePassword($info['email'], $generateInfo['generated']); $toReturn->set("success", "true"); $toReturn->set("message", Utils::translate('passwordChanged')); } else { // confirmation link $data = date('Y-m-d H:i:s'); $template = new Template("./templates/" . __LANGUAGE__ . "/confirmRecover.html"); $id = base64_encode($info['email'] . "|" . $data . "|recover|" . $generateInfo['generated']); $link = "<a href='" . __BASE_URL__ . "oxygen-webhelp/resources/confirm.html?id={$id}'>" . __BASE_URL__ . "oxygen-webhelp/resources/confirm.html?id={$id}</a>"; $confirmationMsg = $template->replace(array("product" => $info['product'], "link" => $link, "productName" => $productTranslate)); $mail = new Mail(); $mail->Subject("[" . $productTranslate . "] " . Utils::translate('RecoverConfirmationEmailSubject')); $mail->To($info['email']); $mail->From(__EMAIL__); $mail->Body($confirmationMsg); $mail->Send(); $toReturn->set("success", "true"); $toReturn->set("message", Utils::translate('confirmationRequired')); } } //echo "Success"; } else { $toReturn->set("success", "false"); $toReturn->set("message", Utils::translate('noEmailSpecified')); //echo "Invalid recovery data!";
<?php chdir('..'); require 'libraries/start.php'; // setup $message = ''; $config = array(); // save input if (array_key_exists('config', $_POST) && $_POST['config']) { $config = Http::clean($_POST['config'], 'html'); $errors = find_configuration_errors($config); // display errors, if any if ($errors) { foreach ($errors as $error) { $message .= "<p class='error'>{$error}</p>"; } } else { Configuration::write($config); Configuration::reset(); } } // get config $config = Configuration::getInstance(); // templating $t = new Template(Configuration::get('base_dir') . DS . 'templates' . DS . 'base.html'); $t->replace('base_url', Configuration::get('base_url')); $t->replaceFromPHPFile('content', Configuration::get('base_dir') . DS . 'templates' . DS . 'configuration.html', array('c' => $config)); $t->replace('message', $message); $t->display();
} if ($bInlogged) { $_SESSION['a_iOldThreads'][$_GET['ID']] = $oThread->getNumberPosts(); } // Markera tr?den som l?st $oThread->read(); if (FALSE === ($a_oPosts = $oThread->getPosts($iNumberPosts * ($_GET['Page'] - 1), $iNumberPosts))) { trigger_error("23. " . $oThread->getErrorMsg(), E_USER_WARNING); } // Bygg upp sidan $oTemplate->set("title", $oConfiguration->getCustomValue("Title")); $oTemplate->set("id", $oThread->getThreadID()); if ($bInlogged) { $oTemplate->set("User_ID", $_SESSION['oUser']->getID()); $oTemplate->set("User_Name", htmlspecialchars($_SESSION['oUser']->getName())); $oTemplate->replace("Login_Outside", "Login_Inside"); $oTemplate->replace("CantPost", "NewPost"); } // Kolla om det finns fler sidor if ($oThread->getNumberPosts() > $iNumberPosts) { $oTemplate->replace("Empty", "MultiPages"); $oTemplate->replace("Empty2", "MultiPages"); $iPages = (int) (@$oThread->getNumberPosts() / $iNumberPosts); if (!((double) $iPages == @$oThread->getNumberPosts() / $iNumberPosts)) { $iPages++; } for ($n = 1; $n <= $iPages; $n++) { $oTemplate->set("Page", $n); $oTemplate->parse("MultiPage"); $oTemplate->parse("MultiPage2"); }
protected function deleteToHtml($deleted) { // get template $template = new Template(Configuration::get('base_dir') . DS . 'templates' . DS . 'base.html'); $template->replace('base_url', Configuration::get('base_url')); // make title $title = 'Invoice Deleted Successfully'; $template->replace('title', $title); // make body $body = '<a href="' . $this->getLink() . '">List All</a> '; $body .= $deleted ? '<p>Deleted successfully.</p>' : '<p>Failed to delete.</p>'; $template->replace('content', $body); // return return $template; }
public static function getTagsList() { $n = new Template('tags_list.html'); $tagMapper = new Mapper('Tag'); $tagMapper->filter('user_id=(?)', $_SESSION['userid']); $tagresults = $tagMapper->get(); $tags = ''; foreach ($tagresults['Tag'] as $key => $value) { $tags .= '<option value="' . $value->name . '" data-backgroundcolor="' . $value->color . '" data-color="' . invertColor($value->color) . '">' . $value->name . '</option>'; } $n->replace('TAGS_LIST', $tags); return $n; }
function homePage() { $t = new Template('home.html'); $t->replace('BACKGROUND', $_SESSION['userconf']['general']['background']); $t->replace('CSS', 'css.html'); $t->replace('NAVBAR', 'navbar.html'); $t->replace('DATA_COUNT', DataC::getCount($_SESSION['userid'])); $t->replace('FEED_COUNT', FeedC::getCount($_SESSION['userid'])); $t->replace('RUNNING_COUNT', FeedC::getRunningCount($_SESSION['userid'])); $t->replace('PLUGIN', PluginC::getHTML()); $t->replace('FEED_ALL', FeedC::getAllHTML($_SESSION['userid'])); $t->replace('MODAL_DDROP', 'modal_ddrop.html'); $t->replace('MODAL_TAG', 'modal_tag.html'); $t->replace('TAGS_LIST', TagC::getTagsList()); $t->replace('PLUGINS_LIST', PluginC::getPluginsList()); $t->replace('MODAL_PREVIEW', 'feed_data_preview.html'); $t->replace('FOOTER', 'footer.html'); $t->replace('JAVASCRIPT_LIBS', 'javascript.libs.php'); $t->replace('JAVASCRIPT_CHRIS', 'javascript.chris.html'); $t->replace('USERNAME', ucfirst($_SESSION['username'])); $t->replace('CHRIS_VERSION', CHRIS_VERSION); // ui $t->replace('CHRIS_UI_CHECKBOX', 'ui_checkbox.html'); if (CHRIS_MAINTENANCE) { $t->replace('MAINTENANCE', 'display:block'); } else { $t->replace('MAINTENANCE', 'display:none'); } return $t; }
<?php // get base template $t = new Template(realpath('./templates/base-install.html')); // create error html $content = '<p>You are done!</p> <form method="POST"> <input type="hidden" name="install" value="1"/> <p> <input type="submit" value="Continue to home page"/> </p> </form>'; // replace $t->replace('title', 'Install'); $t->replace('base_url', get_base_url('invoices')); $t->replace('content', $content); // display $t->display();
<?php // get base template $t = new Template(realpath('./templates/base-install.html')); // create error html $message = '<p>To start off, please enter some configuration information</p>'; if ($this->getCurrentStep()->getErrors()) { $errors = Set::flatten($this->getCurrentStep()->getErrors()); foreach ($errors as $error) { $message .= "<p class='error'>{$error}</p>"; } } // replace $t->replace('title', 'Install'); $t->replace('base_url', get_base_url('invoices')); $config = $this->getCurrentStep()->getData(); $t->replaceFromPHPFile('content', realpath('./templates/configuration.html'), array('c' => @$_POST['config'])); $t->replace('message', $message); // display $t->display();
require 'libraries/start.php'; // create app $app = new App(); $app->setAllowedObjects('invoices', 'payments'); $app->setAllowedActions('create', 'edit', 'validate', 'view', 'publish'); // routing try { $object = Routing::getToken('object'); } catch (Exception $e) { $object = 'home'; } // show home page if ($object == 'home') { $t = new Template('templates/base.html'); $t->replace('base_url', Configuration::get('base_url')); $t->replaceFromFile('content', 'templates/home.html'); $t->replaceFromPHPFile('invoice-list', 'templates/invoice-list.php'); $t->display(); exit; } // allowed input if ($object == 'payments') { $app->setOutputFormat('PaymentHtml'); } elseif ($object == 'invoices') { $app->setOutputFormat('InvoiceHtml'); } else { $app->setOutputFormat('AppFormatHtml'); } $app->setInputFormat('Html'); // execute
/** * Get HTML representation of the given object. * @param Feed $object object to be converted to HMTL. * @return string HTML representation of the object */ public static function getHTML($object, $shine = '') { // Format username $username = FeedV::_getUsername($object->user_id); $username_displayed = ucwords($username); $feed_meta_simple = ''; // Format simple meta feed $feedMetaSimpleMapper = new Mapper('Feed'); $feedMetaSimpleMapper->ljoin('Meta', 'meta.target_id = feed.id')->filter('meta.target_type=(?)', 'feed')->filter('meta.name=(?)', 'sharer_id')->filter('meta.target_id=(?)', $object->id)->filter('meta.type=(?)', 'simple'); $feedMetaSimpleResults = $feedMetaSimpleMapper->get(); $shared_feed = false; if (count($feedMetaSimpleResults['Meta']) >= 1) { $username_displayed = 'Shared by ' . ucwords(FeedV::_getUsername($feedMetaSimpleResults['Meta'][0]->value)); $shared_feed = true; } // Format advanced meta feed $root_id = 0; $root_id = FeedV::findFirstRootID($object->id); $feed_meta_advanced = $feed_meta_simple; $feed_status = 'feed_success'; $feed_folder = joinPaths(CHRIS_USERS, $username, $object->plugin, $object->name . '-' . $object->id); if ($handle = opendir($feed_folder)) { while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != "..") { $match = glob($feed_folder . '/' . $entry . '/_chrisRun_/ERR*'); if (count($match)) { $feed_status = 'feed_failure'; break; } if ($feed_status == 'feed_failure') { break; } } } } // create the status text $status_text = '<span style="background-color: #009DE9;color: #fff;padding: 1px 2px;">Running<i class="icon-refresh rotating_class"></i></span>'; // ('.$object->status.'%) if ($feed_status == 'feed_failure') { $status_text = '<span style="background-color: #E90000;color: #fff;padding: 1px 2px;">Errors</span>'; $feed_status = 'feed_success'; } else { if ($object->status == 100) { $status_text = '<span style="background-color: #41E900;color: #fff;padding: 1px 2px;">Success</span>'; } else { if ($object->status == 101) { $status_text = '<span style="background-color: #E95D00;color: #fff;padding: 1px 2px;">Canceled</span>'; } } } $view_icon = 'icon-eye-open'; $share_icon = 'icon-share-alt'; $tag_icon = 'icon-tag'; $archive_icon = 'icon-remove'; $archive_text = 'Archive'; if ($object->archive == '1') { $archive_icon = 'icon-plus'; $archive_text = 'Restore'; } $favorite_icon = 'icon-star-empty'; $favorite_text = 'Favorite'; if ($object->favorite == '1') { $favorite_icon = 'icon-star'; $favorite_text = '<b>Favorited</b>'; } $edit_icon = ''; $cancel = ''; $view = "display:none"; if ($object->status >= 100 || $shared_feed) { $edit_icon = "<img class='feed_edit_icon show_me focus' src='view/gfx/jigsoar-icons/dark/16_edit_page2.png'>"; // if the job is not queued or running, don't display the cancel icon // also if the feed was shared $cancel = "display:none"; $view = ""; } $t = new Template('feed.html'); $t->replace('ID', $object->id); $t->replace('ROOT_ID', $root_id); $feed_gfx64 = 'plugins/' . $object->plugin . '/feed.png'; $feed_gfx64_checked = 'view/gfx/feed_checked.png'; if (!is_file(joinPaths(CHRIS_WWWROOT, $feed_gfx64))) { $feed_gfx64 = 'http://placehold.it/48x48'; } $t->replace('IMAGE_SRC', $feed_gfx64); $t->replace('IMAGE_CHECKED', $feed_gfx64_checked); $t->replace('USERNAME', $username_displayed); $t->replace('FEED_STATUS', $feed_status); $t->replace('FEED_NAME', $object->name); $t->replace('FEED_META_CONTENT', $feed_meta_advanced); $t->replace('TIME_FORMATED', $object->time); $t->replace('PLUGIN', ucwords(str_replace('_', ' ', $object->plugin))); $t->replace('STATUS', $object->status); $t->replace('STATUS_TEXT', $status_text); $t->replace('VIEW_ICON', $view_icon); $t->replace('SHARE_ICON', $share_icon); $t->replace('TAG_ICON', $tag_icon); $t->replace('ARCHIVE_ICON', $archive_icon); $t->replace('ARCHIVE_TEXT', $archive_text); $t->replace('FAVORITE_ICON', $favorite_icon); $t->replace('FAVORITE_TEXT', $favorite_text); $t->replace('VIEW', $view); $t->replace('CANCEL', $cancel); $t->replace('EDIT_ICON', $edit_icon); $t->replace('FEED_SHINE', $shine); // set data browser $d = new Template('feed_data_browser.html'); $feed_folder = joinPaths($username, $object->plugin, $object->name . '-' . $object->id); if (file_exists($feed_folder)) { $feed_subfolders = scandir(CHRIS_USERS . '/' . $feed_folder); natcasesort($feed_subfolders); // get rid of eventual notes.html or index.html files // find notes.html $notes = array_search('notes.html', $feed_subfolders); if ($notes) { // remove this entry - we don't want to touch it unset($feed_subfolders[$notes]); } // find index.html $index = array_search('index.html', $feed_subfolders); if ($index) { // remove this entry - we don't want to touch it unset($feed_subfolders[$index]); } } $d->replace('FOLDER', $feed_folder); $d->replace('PATIENT_ID', 'fake_patient_id'); $d->replace('DATA_ID', 'fake_data_id'); $t->replace('DATA_BROWSER', $d); // set tags $feedtagMapper = new Mapper('Feed_Tag'); $feedtagMapper->join('Tag', 'feed_tag.tag_id = tag.id')->filter('feed_tag.feed_id=(?)', $object->id); $feedtagResults = $feedtagMapper->get(); $feedtags = ''; if (count($feedtagResults['Feed_Tag']) >= 1) { foreach ($feedtagResults['Tag'] as $key => $value) { $n = new Template('feed_tag.html'); $n->replace('USER_ID', $object->user_id); $n->replace('TAG_ID', $value->id); $n->replace('TAG_NAME', $value->name); $n->replace('TAG_COLOR', $value->color); $n->replace('TEXT_COLOR', invertColor($value->color)); $n->replace('LOCATION', 'infeed'); $feedtags .= $n; } } $t->replace('TAGS', $feedtags); // notes $n = new Template('feed_notes.html'); $n->replace('PATH', joinPaths($username, $object->plugin, $object->name . '-' . $object->id, 'notes.html')); $t->replace('NOTES', $n); // set html viewer if "index.html" exists in username/plugin/feed-id/ if (is_file(joinPaths(CHRIS_USERS, $username, $object->plugin, $object->name . '-' . $object->id, 'index.html'))) { $t->replace('FEED_HTML', 'feed_html.html'); $t->replace('HTML_VIEWER', joinPaths('api.php?action=get&what=file¶meters=', $username, $object->plugin, $object->name . '-' . $object->id, 'index.html')); } else { $t->replace('FEED_HTML', ''); } return $t; }
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with PHPDaft; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Visa var filerna finns ini_set("include_path", "/home/daft/konferens/"); // Inkludera filer require "Functions/function_validUser.php"; require "Classes/class_Configuration.php"; require "Classes/class_User.php"; require "Classes/class_UserPresentation.php"; require "Classes/yapter.php"; $oConfiguration =& Configuration::createInstance(); // Kolla om inloggad session_start(); if (!validUser()) { trigger_error("43", E_USER_ERROR); } // Template $oTemplate = new Template("/home/daft/Templates/NewThread.tpl"); $oTemplate->setParseMode(TRUE); $oTemplate->setWarningLevel(E_YAPTER_ERROR); $oTemplate->set("Title", $oConfiguration->getCustomValue("Title")); $oTemplate->set("User_ID", $_SESSION['oUser']->getID()); $oTemplate->set("User_Name", htmlspecialchars($_SESSION['oUser']->getName())); $oTemplate->replace("Login_Outside", "Login_Inside"); $oTemplate->set("Signature", "\n\n\n" . $_SESSION['oUser']->getSignature()); // Tryck ut $oTemplate->parse(); $oTemplate->spit();
$info['email'] = $_POST['email']; $user = new User($dbConnectionInfo); $return = $user->insertNewUser($info); if ($return->error == "true") { echo $return; } else { $id = base64_encode($user->userId . "|" . $user->date); $link = "<a href='" . __BASE_URL__ . "oxygen-webhelp/resources/confirm.html?id={$id}'>" . __BASE_URL__ . "oxygen-webhelp/resources/confirm.html?id={$id}</a>"; $template = new Template("./templates/signUp.html"); $productTranslate = defined("__PRODUCT_NAME__") ? __PRODUCT_NAME__ : $_POST['product']; $arrayProducts = $user->getSharedProducts(); $products = ""; foreach ($arrayProducts as $productId => $productName) { $products .= "\"" . $productName . "\" "; } $confirmationMsg = $template->replace(array("name" => $info['name'], "username" => $info['username'], "confirmationLink" => $link, "productName" => $productTranslate, "products" => $products)); $mail = new Mail(); $mail->Subject("[" . $productTranslate . "] " . Utils::translate('signUpEmailSubject')); $mail->To($info['email']); $mail->From(__EMAIL__); $mail->Body($confirmationMsg); $mail->Send(); $json->set("error", "false"); $json->set("msg", "SignUp Success"); echo $json; } } else { $json->set("error", "true"); $json->set("errorCode", "6"); $json->set("msg", "Invalid username!"); echo $json;
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); }
} $user = new User($dbConnectionInfo); //echo "id=".$id." date=".$date; $currentDate = date("Y-m-d G:i:s"); $days = Utils::getTimeDifference($currentDate, $date, 3); if ($days > 7) { $toReturn->set("error", true); $toReturn->set("msg", "Confirmation code expired!"); } else { $productTranslate = defined("__PRODUCT_NAME__") ? __PRODUCT_NAME__ : $_POST['productName']; if ($action == "recover") { $email = $id; $userName = $user->changePassword($email, $newPassword); if ($userName != "") { $template = new Template("./templates/" . __LANGUAGE__ . "/recover.html"); $confirmationMsg = $template->replace(array("username" => $userName, "password" => $newPassword, "productName" => $productTranslate)); // // $confirmationMsg = "Your generated password form username '".$userName."' is '".$newPassword."'"; // $confirmationMsg.="<br/>Thank you !"; $mail = new Mail(); $mail->Subject("[" . $productTranslate . "] " . $translate['RecoveredEmailSubject']); $mail->To($email); $mail->From(__EMAIL__); $mail->Body($confirmationMsg); $mail->Send(); $toReturn->set("error", false); $toReturn->set("msg", Utils::translate('passwordChanged')); } else { $toReturn->set("error", true); $toReturn->set("msg", Utils::translate("signUp.invalidPswd")); }
/** * Get HTML representation of the last nth feeds. * @param int $nb_feeds number of html feeds to be returned * @return string */ public static function getAllHTML($user_id) { $t = new Template('feed_all.html'); $t->replace('FEED_FAV', FeedC::getHTML($user_id, 'favorites')); $t->replace('FEED_RUN', FeedC::getHTML($user_id, 'running')); $t->replace('FEED_FIN', FeedC::getHTML($user_id, 'finished', 20)); return $t; }
<?php include "template.class.php"; $template = new Template(); $template->load("design.html"); $template->replace("title", "My Template Class"); $template->replace("name", "William"); $template->replace("datetime", date("m/d/y")); $template->publish();
if ($file[0] == '.') { // skip hidden files and folders continue; } $fullpath = $path . $file; if (file_exists($fullpath) && $file != '.' && $file != '..') { if (is_dir($fullpath)) { $GLOBALS['fullpath'] = $fullpath; $t = new Template('feed_data_browser_directory_item.html'); $t->replace('CLASSES', 'directory collapsed'); $t->replace('FULLPATH', $fullpath); $t->replace('VIEWERS', 'feed_data_browser_directory_item_viewers.php'); $t->replace('RELATIVEPATH', htmlentities($_directory . $file . '/')); $t->replace('FILENAME', htmlentities($file)); echo $t; } elseif (is_file($fullpath)) { $ext = preg_replace('/^.*\\./', '', $file); $GLOBALS['ext'] = $ext; $t = new Template('feed_data_browser_file_item.html'); $t->replace('CLASSES', 'file ext_' . $ext); $t->replace('FULLPATH', $fullpath); $t->replace('VIEWERS', 'feed_data_browser_file_item_viewers.php'); $t->replace('RELATIVEPATH', htmlentities($_directory . $file)); $t->replace('FILENAME', htmlentities($file)); echo $t; } } } echo "</ul>"; } }