Example #1
0
 /**
  * Create new request and sends email to user
  * @static
  * @param string Mail adress
  * @throws MailFailureException, UserNotFoundException
  */
 public static function createRequest($mail)
 {
     LostPW::cleanUp();
     $user = User::find('email', $mail);
     if ($user == NULL) {
         throw new UserNotFoundException();
     }
     // Delete old requests
     $sql = System::getDatabase()->prepare('DELETE FROM lostpw WHERE user_ID = :uid');
     $sql->execute(array(':uid' => $user->uid));
     // Create new request
     $hash = LostPW::createHash();
     $sql = System::getDatabase()->prepare('INSERT INTO lostpw (user_ID, hash, time) VALUES (:uid, :hash, :time)');
     $sql->execute(array(':uid' => $user->uid, ':hash' => $hash, ':time' => time()));
     // Send Mail
     $content = new Template();
     $content->assign('link', Router::getInstance()->build('AuthController', 'lostpw_check', array('hash' => $hash)));
     $content->assign('user', $user);
     $content->assign('title', System::getLanguage()->_('LostPW'));
     // Determine template file
     $tpl = 'mails/lostpw.' . LANGUAGE . '.tpl';
     foreach ($content->getTemplateDir() as $dir) {
         $file = 'mails/lostpw.' . $user->lang . '.tpl';
         if (file_exists($dir . $file)) {
             $tpl = $file;
             break;
         }
     }
     $mail = new Mail(System::getLanguage()->_('LostPW'), $content->fetch($tpl), $user);
     $mail->send();
 }
 public function index()
 {
     $user = System::getUser();
     $form = new Form('form-profile');
     $form->setAttribute('data-noajax', 'true');
     $form->binding = $user;
     $fieldset = new Fieldset(System::getLanguage()->_('General'));
     $firstname = new Text('firstname', System::getLanguage()->_('Firstname'));
     $firstname->binding = new Databinding('firstname');
     $lastname = new Text('lastname', System::getLanguage()->_('Lastname'));
     $lastname->binding = new Databinding('lastname');
     $email = new Text('email', System::getLanguage()->_('EMail'), true);
     $email->binding = new Databinding('email');
     $email->blacklist = $this->getListOfMailAdresses($user);
     $email->error_msg[4] = System::getLanguage()->_('ErrorMailAdressAlreadyExists');
     $language = new Radiobox('lang', System::getLanguage()->_('Language'), L10N::getLanguages());
     $language->binding = new Databinding('lang');
     $fieldset->addElements($firstname, $lastname, $email, $language);
     $form->addElements($fieldset);
     $fieldset = new Fieldset(System::getLanguage()->_('Password'));
     $password = new Password('password', System::getLanguage()->_('Password'));
     $password->minlength = PASSWORD_MIN_LENGTH;
     $password->binding = new Databinding('password');
     $password2 = new Password('password2', System::getLanguage()->_('ReenterPassword'));
     $fieldset->addElements($password, $password2);
     $form->addElements($fieldset);
     $fieldset = new Fieldset(System::getLanguage()->_('Settings'));
     $quota = new Text('quota', System::getLanguage()->_('Quota'));
     if ($user->quota > 0) {
         $quota->value = System::getLanguage()->_('QuotaAvailabe', Utils::formatBytes($user->getFreeSpace()), Utils::formatBytes($user->quota));
     } else {
         $quota->value = System::getLanguage()->_('Unlimited');
     }
     $quota->readonly = true;
     $fieldset->addElements($quota);
     $form->addElements($fieldset);
     if (Utils::getPOST('submit', false) !== false) {
         if (!empty($password->value) && $password->value != $password2->value) {
             $password2->error = System::getLanguage()->_('ErrorInvalidPasswords');
         } else {
             if ($form->validate()) {
                 $form->save();
                 System::getUser()->save();
                 System::getSession()->setData('successMsg', System::getLanguage()->_('ProfileUpdated'));
                 System::forwardToRoute(Router::getInstance()->build('ProfileController', 'index'));
                 exit;
             }
         }
     } else {
         $form->fill();
     }
     $form->setSubmit(new Button(System::getLanguage()->_('Save'), 'floppy-disk'));
     $smarty = new Template();
     $smarty->assign('title', System::getLanguage()->_('MyProfile'));
     $smarty->assign('heading', System::getLanguage()->_('MyProfile'));
     $smarty->assign('form', $form->__toString());
     $smarty->display('form.tpl');
 }
Example #3
0
 function FirstPage()
 {
     $query = "SELECT arts.id,arts.title FROM wb_articles AS arts\n                       JOIN wb_weblogs AS blogs ON(arts.weblog_id= blogs.id)\n\t\t       JOIN ge_subdomains as sub\n\t\t\t    ON(sub.site_id=blogs.site_id)\n                       WHERE sub.sub_domain='{$this->newsSub}'\n                       LIMIT 0,10";
     $newsPosts = $this->db->query($query)->fetchAll();
     $tmpl = new Template('frontPage.tpl');
     $query = "SELECT\n\t\t        blogs.title,\n\t\t\tsub.sub_domain\n\t\t    FROM wb_articles AS arts\n                    JOIN wb_weblogs AS blogs\n\t\t\tON(arts.weblog_id= blogs.id)\n\t\t    JOIN ge_subdomains as sub\n\t\t\tON(sub.site_id=blogs.site_id)\n\t\t    GROUP BY\n\t\t\tblogs.id\n\t\t    ORDER BY\n\t\t\tarts.`date` DESC\n\t\t    LIMIT 0,10";
     $newArt = $this->db->query($query)->fetchAll();
     $tmpl->assign('news', $newsPosts);
     $tmpl->assign('updates', $newArt);
     $tmpl->assign('subdomain', $this->newsSub);
     $tmpl->loadPage('firstPage');
     $this->reponse->setTemplate($tmpl);
 }
Example #4
0
function index()
{
    global $db, $lang, $prefix;
    include "header.php";
    $result = $db->query("SELECT *\tFROM  " . $prefix . "_fares WHERE  fare_special=1 AND fare_active=1 ORDER BY fare_id");
    $tpl = new Template();
    $tpl->modTemplate("special");
    $num_record = $db->row_count($result);
    if (isset($_GET['page'])) {
        $page = intval($_GET['page']);
    } else {
        $page = 1;
    }
    $currentpage = $page;
    $perpage = 20;
    $start = ($page - 1) * $perpage;
    $pages = ceil($num_record / $perpage);
    $starting_no = $start + 1;
    if ($num_record - $start < $perpage) {
        $end_count = $num_record;
    } elseif ($num_record - $start >= $perpage) {
        $end_count = $start + $perpage;
    }
    if ($pages > 1) {
        $page_link = makepagelink("index.php?m=special", $page, $pages);
    } else {
        $page_link = "";
    }
    // Fix the problem
    $result = $db->query("SELECT *\tFROM  " . $prefix . "_fares WHERE  fare_special=1 AND fare_active=1  ORDER BY fare_id DESC\n\n\tLIMIT {$start},{$perpage}");
    $found = $db->row_count($result);
    $tpl->assign("found", $found);
    $tpl->assign("lang", $lang);
    $tpl->assign("pagelink", $page_link);
    $tpl->assign("start", $starting_no);
    $tpl->assign("end", $end_count);
    $tpl->assign("found", $found);
    $tpl->assign("currentpage", $currentpage);
    while ($row = $db->fetch_array($result)) {
        $special[] = $row;
        $tpl->assign("date", "" . todate($row[fare_purchaseby]) . "");
        $q = $db->query("SELECT * from travel_airline WHERE airline_id={$row['fare_airline']}");
        $airline = $db->fetch_array($q);
        $tpl->assign("airline", $airline);
        $tpl->assign("special", $special);
    }
    $tpl->display("specialindex.tpl");
    include "footer.php";
}
Example #5
0
 /**
  * Put your own methods below this...
  */
 function alertstatus()
 {
     $this->auth->check_access('site/settings', TRUE);
     /* load models */
     $this->load->model('alertstatus_model', 'alert');
     $alerts = $this->alert->get_alerts();
     if ($alerts->num_rows() > 0) {
         foreach ($alerts->result() as $alert) {
             $imgstat = 'off';
             if ($alert->alert_active == 'y') {
                 $imgstat = 'on';
             }
             $data['alerts'][$alert->alert_id] = array('img' => array('src' => Location::asset('images/alerts', $alert->alert_image . '-' . $imgstat . '.png'), 'alt' => $alert->alert_name, 'class' => $imgstat, 'currStat' => $alert->alert_image, 'id' => 'al' . $alert->alert_id), 'name' => $alert->alert_name, 'desc' => $alert->alert_description, 'active' => $alert->alert_active, 'id' => $alert->alert_id, 'imgbase' => $alert->alert_image);
             $data_js['img'][$alert->alert_id] = array('src' => $alert->alert_image . '-hover.png', 'id' => $alert->alert_id);
         }
     }
     $data['loading'] = array('src' => Location::asset('images/alerts', 'black-bg-loading.gif'), 'alt' => '', 'class' => 'image');
     $data['imglocation'] = base_url() . Location::asset('images/alerts', '');
     $data['activealert'] = $this->alert->get_current_alert();
     $data['header'] = 'Alert Status';
     $data['text'] = 'Set the current alert status of your ship by clicking on the proper alert claxon.';
     $this->_regions['content'] = Location::view('admin_alertstatus', $this->skin, 'admin', $data);
     $this->_regions['javascript'] = Location::js('admin_alertstatus_js', $this->skin, 'admin');
     $this->_regions['title'] .= $data['header'];
     Template::assign($this->_regions);
     Template::render();
 }
Example #6
0
 /**
  * Handle form action
  */
 protected function formAction()
 {
     switch ($this->s->action) {
         case 'reload':
             // element: submenu
             $this->s->resetParams('form');
             $module = $this->s->loadModule($this->s->controller);
             $tpl = new Template('system');
             $tpl->assign('subnav', $this->generateNav($module->getSection()));
             $tpl->display('submenu.html');
             return true;
             break;
         case 'submenu':
             if ($this->s->element == '') {
                 Error::addWarning('Fehler: ID des Untermenüs ist nicht definiert!');
                 return false;
             }
             $section = str_replace('nav_', '', $this->s->element);
             $this->s->resetParams();
             $tpl = new Template('system');
             $tpl->assign('subnav', $this->generateNav($section));
             $tpl->display('submenu.html');
             return true;
             break;
         case 'cleanlog':
             if ($this->s->element == 'error') {
                 $file = fopen("logs/error.log", "w+");
                 fclose($file);
             }
             return true;
             break;
     }
 }
Example #7
0
 public function modmanifest()
 {
     // load the models
     if (isset($_POST['submit'])) {
         $showSpecies = $this->input->post('chkShowSpecies', true);
         $showGender = $this->input->post('chkShowGender', true);
         $showThumbnail = $this->input->post('chkShowThumbnail', true);
         $setting_data = array('setting_value' => $showSpecies);
         $update_settings = $this->settings->update_setting('modManifest_show_species', $setting_data);
         $setting_data = array('setting_value' => $showGender);
         $update_settings = $this->settings->update_setting('modManifest_show_gender', $setting_data);
         $setting_data = array('setting_value' => $showThumbnail);
         $update_settings = $this->settings->update_setting('modManifest_show_thumbnail', $setting_data);
         $message = "Settings updated sucessfully.";
         $flash['status'] = 'success';
         $flash['message'] = text_output($message);
     }
     $data['checkboxes']['show_species'] = array('name' => 'chkShowSpecies', 'id' => 'chkShowSpecies', 'value' => 'true');
     $data['checkboxes']['show_gender'] = array('name' => 'chkShowGender', 'id' => 'chkShowGender', 'value' => 'true');
     $data['checkboxes']['show_thumbnail'] = array('name' => 'chkShowThumbnail', 'id' => 'chkShowThumbnail', 'value' => 'true');
     $set_species = $this->settings->get_setting('modManifest_show_species');
     $set_gender = $this->settings->get_setting('modManifest_show_gender');
     $set_thumbnail = $this->settings->get_setting('modManifest_show_thumbnail');
     $data['temp'] = $set_species;
     $data['checkboxes']['show_species']['checked'] = $set_species;
     $data['checkboxes']['show_gender']['checked'] = $set_gender;
     $data['checkboxes']['show_thumbnail']['checked'] = $set_thumbnail;
     $data['submit'] = array('type' => 'submit', 'class' => 'button-main', 'name' => 'submit', 'value' => 'submit', 'content' => ucwords(lang('actions_submit')));
     $data['header'] = "Manifest Details Configuration";
     $view_loc = "admin_modmanifest";
     $this->_regions['content'] = Location::view($view_loc, $this->skin, 'admin', $data);
     $this->_regions['title'] .= $data['header'];
     Template::assign($this->_regions);
     Template::render();
 }
Example #8
0
 public function render()
 {
     if ($this->callback) {
         $callback = Cogear::prepareCallback($this->callback);
         $this->setValues(call_user_func($callback));
     }
     $this->setAttributes();
     $code = array();
     foreach ($this->values as $key => $value) {
         $attributes = $this->attributes;
         $attributes['value'] = $key;
         if ($key === $this->value) {
             $attributes['checked'] = 'checked';
         }
         $code[] = HTML::tag('input', $attributes) . $value;
     }
     $code = implode("<br/>", $code);
     if ($this->wrapper) {
         $tpl = new Template($this->wrapper);
         $tpl->assign($this->attributes);
         $tpl->code = $code;
         $code = $tpl->render();
     }
     return $code;
 }
Example #9
0
 /**
  *
  * @return type
  */
 public function render()
 {
     if ($this->callback) {
         $callback = new Callback($this->callback);
         if ($callback->check()) {
             $this->options->values = $callback->run(array($this->form));
         }
     }
     $this->prepareOptions();
     $code[] = HTML::open_tag('select', $this->options);
     foreach ($this->values as $key => $value) {
         $attributes = array();
         if ($this->value instanceof Core_ArrayObject) {
             $this->value = $this->value->toArray();
         }
         if (is_array($this->value)) {
             if (in_array($key, $this->value)) {
                 $attributes['selected'] = 'selected';
             }
         } elseif ($key == $this->value) {
             $attributes['selected'] = 'selected';
         }
         $attributes['value'] = $key;
         $code[] = HTML::paired_tag('option', $value, $attributes);
     }
     $code[] = HTML::close_tag('select');
     $code = implode("\n", $code);
     if ($this->wrapper) {
         $tpl = new Template($this->wrapper);
         $tpl->assign($this->options);
         $tpl->code = $code;
         $code = $tpl->render();
     }
     return $code;
 }
Example #10
0
 public function html()
 {
     $content = null;
     if (!$this->totalItems) {
         return $content;
     }
     $numberOfPages = ceil($this->totalItems / $this->itemsPerPage);
     if ($numberOfPages == 1) {
         return $content;
     }
     $onFirstPage = $this->currentPage == 1;
     $onLastPage = $this->currentPage == $numberOfPages;
     $pageLinks = array();
     if (!$onFirstPage) {
         $pageLinks[] = array('id' => $this->currentPage - 1, 'title' => _('Previous'));
     }
     for ($i = 1; $i <= $numberOfPages; ++$i) {
         $isCurrentPage = (int) ($i == $this->currentPage);
         $pageLinks[] = array('id' => $i, 'title' => $i, 'active' => $isCurrentPage);
     }
     if (!$onLastPage) {
         $pageLinks[] = array('id' => $this->currentPage + 1, 'title' => _('Next'));
     }
     $template = new Template('parts/paging');
     $template->assign('pageLinks', $pageLinks);
     return $template->fetch();
 }
Example #11
0
 public static function exitWithMessage($message_detail, $forward_url, $second = 3, $type = "message")
 {
     switch ($type) {
         case "success":
             $page_title = "操作成功!";
             break;
         case "error":
             $page_title = "错误!";
             break;
         default:
             $page_title = "嗯!";
             break;
     }
     $temp = explode('?', $forward_url);
     $file_url = $temp[0];
     if ($file_url[0] !== "/") {
         $file_url = '/' . $file_url;
         $forward_url = '/' . $forward_url;
     }
     $menu = MenuUrl::getMenuByUrl($file_url);
     $forward_title = "首页";
     if (sizeof($menu) > 0) {
         $forward_title = $menu['menu_name'];
     }
     if ($forward_url) {
         $message_detail = "{$message_detail} <script>setTimeout(\"window.location.href ='" . ADMIN_URL . "{$forward_url}';\", " . $second * 1000 . ");</script>";
     }
     Template::assign('type', $type);
     Template::assign('page_title', $page_title);
     Template::assign('message_detail', $message_detail);
     Template::assign('forward_url', $forward_url);
     Template::assign('forward_title', $forward_title);
     Template::Display('message.tpl');
     exit;
 }
Example #12
0
 public function render()
 {
     if ($this->callback) {
         $callback = Callback::prepare($this->callback);
         is_callable($callback) && $this->setValues(call_user_func($callback));
     }
     $this->getAttributes();
     $code[] = HTML::open_tag('select', $this->attributes);
     foreach ($this->values as $key => $value) {
         $attributes = array();
         if ($key == $this->value) {
             $attributes['selected'] = 'selected';
         }
         $attributes['value'] = $key;
         $code[] = HTML::paired_tag('option', $value, $attributes);
     }
     $code[] = HTML::close_tag('select');
     $code = implode("\n", $code);
     if ($this->wrapper) {
         $tpl = new Template($this->wrapper);
         $tpl->assign($this->attributes);
         $tpl->code = $code;
         $code = $tpl->render();
     }
     return $code;
 }
Example #13
0
    public static function tag( $args ) {

        $tag = str_replace('_', ' ', urldecode($args[0]));
        
        $filtred = array();
        $post  = ModelHandler::get("Posts");
        for ($i = 0; $i < count($post); $i++) {
            $tags = explode(',', $post[$i]->bean['tags']);
            if(in_array($tag, $tags) ) $filtred[] = $post[$i];
        }

        $post = $filtred;

        for ($i = 0; $i < count($post); $i++) {
            $newtags = "";
            $tags = explode(',', $post[$i]->bean['tags']);
            foreach ($tags as $tag) {
                $newtags .= "<a href='/?/posts/tag/".$tag."'>".$tag."</a>, ";
            }
            $post[$i]->bean['tags'] =  substr($newtags, 0, strlen($newtags)-2);

        }
        
        $post = array_reverse($post);
        $content = ViewHandler::wrapGroup("post", $post);
        Template::reset();
        Template::assign("content",$content);
        Template::assign("allpostslink","");
        echo Template::render("main.html");
        
        
    }
 function testSubstitutionInSubtemplate()
 {
     $tText = 'Hello World.' . '<!-- BEGIN subtemplate -->' . " I love 'you'!" . '<!-- END subtemplate -->';
     $expText = 'Hello World.';
     $t = new Template($tText);
     $t->assign('you', 'bugs');
     $this->assertEquals($expText, $t->result());
 }
Example #15
0
function render($template_file, array $vars = array())
{
    $template = new Template($template_file, TEMPLATE_PATH);
    foreach ($vars as $key => $value) {
        $template->assign($key, $value);
    }
    return $template->render();
}
Example #16
0
 public function fillTemplate(Template $tmpl)
 {
     $s =& $this->stats;
     $tmpl->assign('statsFile', self::STATS_FILE);
     $tmpl->assign('books', $s[1]);
     $tmpl->assign('total', (int) $s[2]);
     $tmpl->assign('offerors', $s[3]);
     $booksPerOfferor = $s[3] ? round($s[1] / $s[3], 1) : 0;
     $tmpl->assign('booksPerOfferor', $booksPerOfferor);
     $tmpl->assign('images', $s[4]);
     $imageFraction = $s[1] ? round($s[4] / $s[1] * 100) : 0;
     $tmpl->assign('imageFraction', $imageFraction);
     $imageFiles = array();
     $iterator = new DirectoryIterator(self::STATS_DIR);
     while ($iterator->valid()) {
         $entry = $iterator->getFilename();
         $iterator->next();
         if (substr($entry, -4) == '.png') {
             $imageFiles[] = $entry;
         }
     }
     sort($imageFiles);
     foreach ($imageFiles as $file) {
         $sub = $tmpl->addSubtemplate('image');
         $sub->assign('url', self::STATS_DIR . $file);
     }
 }
Example #17
0
 /**
  * Render
  */
 public function render()
 {
     $this->prepareOptions();
     $tpl = new Template('File/templates/url');
     $tpl->assign($this->options);
     $this->code = $tpl->render();
     $this->decorate();
     return $this->code;
 }
 /**
  * @see TemplatePluginFunction::execute()
  */
 public function execute($tagArgs, Template $tplObj)
 {
     // get params
     $name = isset($tagArgs['name']) ? $tagArgs['name'] : 'default';
     $print = isset($tagArgs['print']) ? $tagArgs['print'] : 1;
     $advance = isset($tagArgs['advance']) ? $tagArgs['advance'] : 1;
     $reset = isset($tagArgs['reset']) ? $tagArgs['reset'] : 0;
     // get values
     if (!isset($tagArgs['values'])) {
         if (!isset($this->cycles[$name]['values'])) {
             throw new SystemException("missing 'values' argument in cycle tag", 12001);
         }
     } else {
         if (isset($this->cycles[$name]['values']) && $this->cycles[$name]['values'] != $tagArgs['values']) {
             $this->cycles[$name]['index'] = 0;
         }
         $this->cycles[$name]['values'] = $tagArgs['values'];
     }
     // get delimiter
     if (!isset($this->cycles[$name]['delimiter'])) {
         // set default delimiter
         $this->cycles[$name]['delimiter'] = ',';
     }
     if (isset($tagArgs['delimiter'])) {
         $this->cycles[$name]['delimiter'] = $tagArgs['delimiter'];
     }
     // split values
     if (is_array($this->cycles[$name]['values'])) {
         $cycleArray = $this->cycles[$name]['values'];
     } else {
         $cycleArray = explode($this->cycles[$name]['delimiter'], $this->cycles[$name]['values']);
     }
     // set index
     if (!isset($this->cycles[$name]['index']) || $reset) {
         $this->cycles[$name]['index'] = 0;
     }
     // get result
     $result = $cycleArray[$this->cycles[$name]['index']];
     // assign result to template var
     if (isset($tagArgs['assign'])) {
         $print = false;
         $tplObj->assign($tagArgs['assign'], $result);
     }
     // update index
     if ($advance) {
         if ($this->cycles[$name]['index'] >= count($cycleArray) - 1) {
             $this->cycles[$name]['index'] = 0;
         } else {
             $this->cycles[$name]['index']++;
         }
     }
     // print var
     if ($print) {
         return $result;
     }
 }
Example #19
0
function ResetPassword()
{
    global $template, $DB;
    $t = new Template();
    // Form submitted
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        $password = RandomPassword();
        $domain = preg_replace('~^www\\.~', '', $_SERVER['HTTP_HOST']);
        $t->assign('password', $password);
        $t->assign('control_panel', "http://{$_SERVER['HTTP_HOST']}" . dirname($_SERVER['REQUEST_URI']) . "/index.php");
        $DB->Update('DELETE FROM lx_administrators WHERE username=?', array('administrator'));
        $DB->Update('INSERT INTO lx_administrators VALUES (?,?,?,?,?,?,?,?,?,?)', array('administrator', sha1($password), '', 0, 'Administrator', 'webmaster@$domain', 'administrator', '', 0, 0));
        $DB->Disconnect();
        $t->assign('mode', 'confirmed');
    } else {
        $t->assign('mode', 'confirm');
    }
    echo $t->parse($template);
}
 static function getWidgetContent($pid, $widget, $params = array())
 {
     if (!self::checkRight(2)) {
         return false;
     }
     if (strpos($widget, '/')) {
         return null;
     }
     global $cmsWidgetCont;
     $cmsWidgetCont = self::$Cont;
     L::nsStart('cms');
     $P = self::$Cont;
     $T = new Template();
     $T->assign('Cont', $P);
     $T->assign('param', $params);
     L::nsStop();
     // better at end?
     return $T->get(sysPATH . 'cms/view/widgets/' . $widget . '.php');
 }
Example #21
0
function serverInterface_cms_frontend_0_widget($pid, $widget, $params = array())
{
    $P = Page($pid);
    if ($P->access() < 2) {
        return false;
    }
    if (strpos($widget, '/')) {
        return null;
    }
    global $cmsWidgetCont;
    $cmsWidgetCont = $P;
    L::nsStart('cms');
    $T = new Template();
    $T->assign('Cont', $P);
    $T->assign('param', $params);
    L::nsStop();
    // todo: better at end?
    return $T->get(sysPATH . 'cms.frontend.0/view/widgets/' . $widget . '.php');
}
Example #22
0
 /**
  * Render
  * 
  * @return string
  */
 public function render()
 {
     $code = HTML::paired_tag('textarea', $this->value, $this->getAttributes());
     if ($this->wrapper) {
         $tpl = new Template($this->wrapper);
         $tpl->assign($this->attributes);
         $tpl->code = $code;
         $code = $tpl->render();
     }
     return $code;
 }
Example #23
0
 /**
  * Render
  */
 public function render()
 {
     $this->getAttributes();
     if ($this->value && ($this->value = Url::link(Url::toUri(UPLOADS . $this->value, ROOT, FALSE)))) {
         $tpl = new Template('Form.file');
         $tpl->assign($this->attributes);
         $tpl->value = $this->value;
         $this->code = $tpl->render();
     }
     return parent::render();
 }
 public function php()
 {
     parent::checkAuthentification();
     parent::checkIfAdmin();
     $entries = LogEntry::find('log', 'php');
     if ($entries == NULL) {
         $entries = array();
     } else {
         if ($entries instanceof LogEntry) {
             $entries = array($entries);
         }
     }
     usort($entries, array('LogEntry', 'compare'));
     $smarty = new Template();
     $smarty->assign('entries', $entries);
     $smarty->assign('title', System::getLanguage()->_('Log'));
     $smarty->assign('heading', System::getLanguage()->_('PHPEntries'));
     $smarty->assign('showPHPEntries', true);
     $smarty->display('log/log.tpl');
 }
Example #25
0
 function Login()
 {
     $tmpl = new Template('empty.tpl');
     $this->reponse->setTitle('ورود کاربران');
     $tmpl->loadPage('login');
     $ret = base64_decode($this->input->getString('ret'));
     if (!$ret) {
         $ret = ResponseRegistery::getInstance()->baseURL . "/dashboard/template/show";
     }
     $tmpl->assign("ret", $ret);
     $this->reponse->setTemplate($tmpl);
 }
Example #26
0
 private static function checkMySqlConfig()
 {
     if (!MySQLiFactory::configIsReadable()) {
         require_once 'SetupProcessor.php';
         $processor = new SetupProcessor();
         $tmpl = new Template();
         $tmpl->setTemplate('html.tpl');
         $content = $processor->processParams($_GET, $_POST);
         $tmpl->assign('content', $content);
         echo $tmpl->render();
         exit;
     }
 }
Example #27
0
 public function render($template, $_vars = array(), $fetch = false)
 {
     $tpl = new Template($template);
     $this->addVars($_vars);
     foreach ($this->vars as $key => $var) {
         $tpl->assign($key, $var);
     }
     if ($fetch === true) {
         return $tpl->fetch($tpl->getTemplate());
     }
     $tpl->display($tpl->getTemplate());
     return true;
 }
Example #28
0
function createFilesList($files, $template, $path, $class = 'hidden')
{
    $content = new Template(SYS_UI_TMPL_DIR, 'project/filesTable.xhtml');
    $content->assign('path', $path);
    $content->assign('class', $class);
    if (count($files) == 0) {
        $content->assignFromNew('content', 'project/filesMessage.xhtml', array('message' => 'no Files'));
        $content->assign('height', '70px');
        $template->assign('filesTable', $content);
        return;
    }
    $content->assign('height', count($files) * 29 . 'px');
    foreach ($files as $key => $value) {
        if (is_array($value)) {
            $content->assignFromNew('content', 'project/filesRowDir.xhtml', array('name' => (string) $key, 'date' => '20.12.2012', 'link' => $path . $key . '/'));
            createFilesList($value, $template, $path . $key . '/');
            continue;
        }
        $content->assignFromNew('content', 'project/filesRowFile.xhtml', array('file' => $key . $value, 'name' => $key, 'size' => '37`478 KB', 'date' => '20.12.2012'));
    }
    $template->assign('filesTable', $content);
}
Example #29
0
 /**
  * Render
  */
 public function render()
 {
     $this->getAttributes();
     $this->attributes->type = 'file';
     $this->attributes->class = 'ajaxed image';
     $tpl = new Template('Upload_Ajax.image');
     $tpl->assign($this->attributes);
     if ($this->value && ($this->value = Url::link(Url::toUri(UPLOADS . $this->value, ROOT, FALSE)))) {
         $tpl->value = $this->value;
         $tpl->image = $this->image;
     }
     $this->code = $tpl->render();
     return Form_Element_Abstract::render();
 }
Example #30
0
 /**
  * Put your own methods below this...
  */
 function index()
 {
     /* other data used by the view */
     $data['header'] = ucwords(lang('labels_the') . ' ' . lang('global_sim'));
     $data['msg_sim'] = $this->msgs->get_message('sim');
     /* load models */
     $this->load->model('alertstatus_model', 'alert');
     $currAlert = $this->alert->get_current_alert();
     $data['alertimg'] = array('src' => Location::asset('images/alerts', $currAlert->alert_image . '-on.png'), 'alt' => $currAlert->alert_name, 'id' => 'al' . $currAlert->alert_id);
     $this->_regions['content'] = Location::view('sim_index', $this->skin, 'main', $data);
     $this->_regions['title'] .= $data['header'];
     Template::assign($this->_regions);
     Template::render();
 }