Since: 1.0.0
Author: Damjan
Esempio n. 1
2
function jkbanners_display_banners($atts)
{
    $a = shortcode_atts(array('id' => false, 'filter_menu_order' => false, 'template' => 'list'), $atts);
    $output = array();
    //
    $banners = array();
    $banners = Banner::getAll();
    if ($a['filter_menu_order']) {
        foreach ($banners as $bk => $banner) {
            if ($banner->post->menu_order != $a['filter_menu_order']) {
                unset($banners[$bk]);
            }
        }
    }
    //
    $bannerTemplate = new Template();
    //One random banner
    if ($a['template'] == 'random-single') {
        //get a random item
        $banner = $banners[array_rand($banners)];
        //show single banner
        $bannerTemplateResponse = $bannerTemplate->get(__DIR__ . '/templates/single.php', array('banner' => $banner));
        $output[] = $bannerTemplateResponse;
    }
    //List all banners
    if ($a['template'] == 'list') {
        $bannerTemplateResponse = $bannerTemplate->get(__DIR__ . '/templates/list.php', array('banners' => $banners));
        $output[] = $bannerTemplateResponse;
    }
    //
    $output = implode("\n", $output);
    return $output;
}
Esempio n. 2
0
 function action_linkpopup($args)
 {
     global $config, $manager, $tree, $user, $lang;
     $tpl = new Template($this->getTemplate('main.template'));
     if ($config->get('multiLanguageSupport')) {
         @(include _BASE_LIBRARIES_ . 'resources/iso639to3166.php');
         $languages = array();
         $list = new languages(_DEFAULT_SITE_);
         while (list(, $language) = each($list->nodes)) {
             if ($language->public) {
                 $languages[] = array('id' => $language->id, 'name' => $language->name, 'flag' => strtolower($iso639to3166[$language->id]));
             }
         }
         $tpl->set('languages', $languages);
     }
     // Call the RetrieveObjects functions of each plugin
     if (count($args)) {
         $id = array_shift($args);
         $result = array();
         $files = array();
         $data = array('id' => intval($id), 'result' => &$result);
         $manager->handleEvent('RetrieveObjects', $data);
         while (list(, $entries) = each($result)) {
             $files = array_merge($files, $entries);
         }
         $tpl->set('files', $files);
     }
     echo $tpl->fetch();
     exit;
 }
Esempio n. 3
0
 /**
  *
  * @return string
  */
 public function getCode()
 {
     if (isset($_POST['save'])) {
         foreach ($_POST as $property => $value) {
             if ($property != "save" && $property != "roles") {
                 $settings = Settings::getRootInstance()->specify($this->areaType, $this->area);
                 if ($this->dir != "" && $this->dir != "/") {
                     $settings = $settings->dir($this->dir);
                 }
                 $settings->set($property, $value, $this->role);
             }
         }
         Settings::forceReload();
         Cache::clear();
         Language::GetGlobal()->ClearCache();
         if (@header("Location:" . str_replace("&save_settings=1", "", $_SERVER['REQUEST_URI']))) {
             exit;
         } else {
             die("<script>window.location.href = '" . str_replace("&save_settings=1", "", $_SERVER['REQUEST_URI']) . "';</script>");
         }
         $changed = true;
     }
     $template = new Template();
     $template->load($this->template);
     if ($this->area != "global" || $this->areaType != "global") {
         $roleselector = "<select name=\"roles\" onchange=\"document.location.href='" . $this->url . $this->getQuerySeperator() . "areatype=" . urlencode($this->areaType) . "&area=" . urlencode($this->area) . "&role=' + this.options[this.selectedIndex].value + '&save_settings=1';\">";
     } else {
         $roleselector = "<select name=\"roles\" onchange=\"document.location.href='" . $this->url . $this->getQuerySeperator() . "role=' + this.options[this.selectedIndex].value + '&save_settings=1';\">";
     }
     $roles = DataBase::Current()->ReadRows("SELECT * FROM {'dbprefix'}roles ORDER BY name");
     if ($roles) {
         foreach ($roles as $role) {
             if ($this->role == $role->id) {
                 $roleselector .= "<option value=\"" . $role->id . "\" selected=\"selected\">" . htmlentities($role->name) . "</option>";
             } else {
                 $roleselector .= "<option value=\"" . $role->id . "\">" . $role->name . "</option>";
             }
         }
     }
     $roleselector .= "</select>";
     $template->assign_var("ROLES", $roleselector);
     if ($this->area != "global" || $this->areaType != "global") {
         $template->assign_var("URL", $this->url . $this->getQuerySeperator() . "areatype=" . urlencode($this->areaType) . "&area=" . urlencode($this->area) . "&role=" . $this->role . "&save_settings=1");
     } else {
         $template->assign_var("URL", $this->url . $this->getQuerySeperator() . "role=" . $this->role . "&save_settings=1");
     }
     $rows = Settings::getRootInstance()->specify($this->areaType, $this->area)->dir($this->dir)->getRows($this->role);
     if ($rows) {
         foreach ($rows as $row) {
             $index = $template->add_loop_item("SETTINGS");
             $template->assign_loop_var("SETTINGS", $index, "PROPERTY", $row['name']);
             $template->assign_loop_var("SETTINGS", $index, "DESCRIPTION", htmlentities($row['description']));
             $control = new $row['type']();
             $control->name = $row['name'];
             $control->value = $row['value'];
             $template->assign_loop_var("SETTINGS", $index, "CONTROL", $control->getCode());
         }
     }
     return $template->getCode();
 }
Esempio n. 4
0
 function disp()
 {
     $t = new Template(WEB_ADMIN_TMPPATH);
     $dispObj = new DispAttachRule(&$this->dbObj, $this->getUid());
     $t->set_file('f', 'pageconfig.html');
     $t->set_block('f', 'row', 'r');
     $p = $_GET['pageid'] + 0;
     $sql = "\r\n\t\t\tSELECT c.configvalue AS userdefalut,o.* FROM " . WEB_ADMIN_TABPOX . "otherrule o \r\n\t\t\t\tLEFT OUTER JOIN " . WEB_ADMIN_TABPOX . "config c ON ( (o.otherruleid = c.otherruleid) AND (c.userid = " . $this->getUid() . ") ) \r\n\t\t\tWHERE (o.isrule = 0) AND (o.issystemvar = 0) AND (o.ruleid = {$p})\r\n\t\t";
     $rs = $this->dbObj->GetArray($sql);
     foreach ($rs as $v) {
         $t->set_var($dispObj->disp($v, $v['userdefalut']));
         $t->parse('r', 'row', true);
     }
     $r = '';
     $m = new Menu(&$this->dbObj);
     $s = $m->getRelating($p);
     for ($i = 0; $i < count($s); $i++) {
         if ($i == 0) {
             $r = $s[$i]['rulename'];
         } else {
             $r .= ' > ' . $s[$i]['rulename'];
         }
     }
     $t->set_var('updid', $p);
     $t->set_var('address', $r);
     $t->set_var('path', WEB_ADMIN_HTTPPATH . '/common/');
     $t->parse('out', 'f');
     $t->p('out');
 }
Esempio n. 5
0
 /**
  * Apply common variables to the header template
  * Common variables include:
  * * pageStylesheets
  * * pageJavascripts
  * * urlbase
  *
  * @access protected
  * @return void
  * @param Template $tpl
  * @param boolean $options 
  */
 protected function applyCommonVariables($tpl, $options = false)
 {
     $config = $this->sl->get('aetherConfig');
     if (!$options) {
         $options = $config->getOptions();
     }
     $tpl->set('urlbase', $config->getBase());
     // Stylesheets. Read from config and code
     $styles = array();
     if (array_key_exists('styles', $options)) {
         $styles = explode(';', $options['styles']);
     }
     foreach ($this->sl->getVector('styles') as $style) {
         $styles[] = $style;
     }
     $styles = array_map('trim', $styles);
     $styles = array_unique($styles);
     $tpl->set('pageStylesheets', $styles);
     // Scripts
     $scripts = array();
     if (array_key_exists('javascripts', $options)) {
         $scripts = explode(';', $options['javascripts']);
     }
     foreach ($this->sl->getVector('javascripts') as $script) {
         $scripts[] = $script;
     }
     $scripts = array_map('trim', $scripts);
     $scripts = array_unique($scripts);
     $tpl->set('pageJavascripts', $scripts);
 }
Esempio n. 6
0
 function event_ExecuteEditor(&$data)
 {
     global $lang, $manager, $user;
     if (isset($manager->types[$data['type']]['content']['story']) && $data['sheet'] == 'contents') {
         // Retrieve story
         $res = sql::query("\n\t\t\t\t\tSELECT \n\t\t\t\t\t\t*\n\t\t\t\t\tFROM \n\t\t\t\t\t\t" . _TABLE_PREFIX_ . "contents_story \n\t\t\t\t\tWHERE \n\t\t\t\t\t\t`ID` = '" . $data['params']['id'] . "' AND\n\t\t\t\t\t\t`revision` = '" . $data['params']['revision'] . "'\n\t\t\t\t");
         if ($row = sql::fetch_array($res, MYSQL_ASSOC)) {
             $story = $row;
         } else {
             $story = array('text' => '');
         }
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $_POST['text'] = filter::images($_POST['text']);
             $_POST['text'] = filter::html($_POST['text']);
             $res = sql::query("\n\t\t\t\t\t\tREPLACE INTO \n\t\t\t\t\t\t\t" . _TABLE_PREFIX_ . "contents_story \n\t\t\t\t\t\tSET \n\t\t\t\t\t\t\tID='" . $data['params']['id'] . "', \n\t\t\t\t\t\t\trevision='" . $data['params']['revision'] . "',\n\t\t\t\t\t\t\ttext='" . addslashes($_POST['text']) . "'\n\t\t\t\t\t");
             // Mark this action as a modification
             revisions::updateModificationDate($data['params']['id'], $data['params']['revision']);
             header("Location: " . url::item($data['params']['id'], 'edit') . "/contents?revision=" . $data['params']['revision']);
             exit;
         }
         $tpl = new Template($this->getTemplate('editor.template'));
         $tpl->set('story', $story);
         $tpl->set('id', $data['params']['id']);
         $tpl->set('revision', $data['params']['revision']);
         $data['template']->append('content', $tpl->fetch());
     }
 }
Esempio n. 7
0
File: He.php Progetto: FMaz008/ccv4
 public static function generatePage(&$tpl, &$session, &$account, &$mj)
 {
     $dbMgr = DbManager::getInstance();
     //Instancier le gestionnaire
     $db = $dbMgr->getConn('game');
     //Demander la connexion existante
     $maxMsg = 50;
     $nbrMsg = isset($_GET['hepage']) ? $maxMsg * ($_GET['hepage'] - 1) : 0;
     //Charger le perso
     $query = 'SELECT *' . ' FROM ' . DB_PREFIX . 'perso' . ' WHERE id=:id' . ' LIMIT 1;';
     $prep = $db->prepare($query);
     $prep->bindValue(':id', $_GET['id'], PDO::PARAM_INT);
     $prep->executePlus($db, __FILE__, __LINE__);
     $arr = $prep->fetch();
     $prep->closeCursor();
     $prep = NULL;
     $perso = new Member_Perso($arr);
     //Lister les messages du HE
     $heMsg = self::listMessages($nbrMsg, $maxMsg, $_GET['id']);
     $code = '';
     while ($msg = array_shift($heMsg)) {
         $tpl2 = new Template($account);
         $tpl2->set('MSG', $msg);
         $tpl2->set('SKIN_VIRTUAL_PATH', SITE_VIRTUAL_PATH);
         $code .= $tpl2->fetch($account->getSkinRemotePhysicalPath() . 'html/Mj/Perso/He_item.htm');
         unset($tpl2);
     }
     $tpl->set('HE_MESSAGES', $code);
     //Trouver les sur la taille du HE
     $heSize = self::calculateHeSize((int) $_GET['id']);
     $tpl->set('HE_SIZE', $heSize);
     $tpl->set('HE_MSGPERPAGE', $maxMsg);
     $tpl->set('HE_PAGE', isset($_GET['hepage']) ? (int) $_GET['hepage'] : 1);
     return $tpl->fetch($account->getSkinRemotePhysicalPath() . 'html/Mj/Perso/He.htm');
 }
Esempio n. 8
0
/**
*   Create the payment buttons for an external item.
*   Creates the requested buy_now button type and, if requested,
*   an add_cart button.
*
*   All gateways that have the 'external' service enabled as well as the
*   requested button type will provide a button.
*
*   $args['btn_type'] can be empty or not set, to create only an Add to Cart
*   button.  $args['add_cart'] must still be set in this case.  If neither
*   button type is requested, an empty array is returned.
*
*   Provided $args should include at least:
*       'item_number', 'item_name', 'price', 'quantity', and 'item_type'
*   $args['btn_type'] should reflect the type of immediate-purchase button
*   desired.  $args['add_cart'] simply needs to be set to get an add-to-cart
*   button.
*
*   @uses   PaymentGw::ExternalButton()
*   @param  array   $args       Array of item information
*   @param  array   &$output    Pointer to output array
*   @param  array   &$svc_msg   Unused
*   @return integer             Status code
*/
function service_genButton_paypal($args, &$output, &$svc_msg)
{
    global $_CONF, $_PP_CONF;
    $btn_type = isset($args['btn_type']) ? $args['btn_type'] : '';
    $output = array();
    // Create the immediate purchase button, if requested.  As soon as a
    // gateway supplies the requested button type, break from the loop.
    if (!empty($btn_type)) {
        PAYPAL_loadGateways();
        // load all gateways
        if (!empty($_PP_CONF['gateways'])) {
            // Should be at least one
            // Get the first gateway that supports the button type
            foreach ($_PP_CONF['gateways'] as $gw_info) {
                if (PaymentGw::Supports($btn_type, $gw_info) && PaymentGw::Supports('external', $gw_info) && class_exists($gw_info['id'])) {
                    $gw = new $gw_info['id']();
                    $output[] = $gw->ExternalButton($args, $btn_type);
                }
            }
        }
    }
    // Now create an add-to-cart button, if requested.
    if (isset($args['add_cart']) && $_PP_CONF['ena_cart'] == 1) {
        if (!isset($args['item_type'])) {
            $args['item_type'] = PP_PROD_VIRTUAL;
        }
        $T = new Template(PAYPAL_PI_PATH . '/templates');
        $T->set_file('cart', 'buttons/btn_add_cart.thtml');
        $T->set_var(array('item_name' => $args['item_name'], 'item_number' => $args['item_number'], 'short_description' => $args['short_description'], 'amount' => $args['amount'], 'pi_url' => PAYPAL_URL, 'item_type' => $args['item_type'], 'have_tax' => isset($args['tax']) ? 'true' : '', 'tax' => isset($args['tax']) ? $args['tax'] : 0, 'quantity' => isset($args['quantity']) ? $args['quantity'] : '', '_ret_url' => isset($args['_ret_url']) ? $args['_ret_url'] : ''));
        $output['add_cart'] = $T->parse('', 'cart');
    }
    return PLG_RET_OK;
}
Esempio n. 9
0
 public function displayError()
 {
     if (!ini_get('display_errors')) {
         return;
     }
     $messages = explode("\n", $this->message);
     $messages = array_map('trim', $messages);
     $messages = array_filter($messages, 'strlen');
     $messages = array_values($messages);
     $param = array("code" => $this->code, "messages" => $messages, "file" => $this->file, "line" => $this->line, "trace" => debug_backtrace());
     $template = new Template();
     // set template
     $template->assign_vars($param);
     // load template
     if (!self::$template_filename) {
         self::$template_filename = dirname(__FILE__) . '/../../component/view/Exception.tpl';
     }
     if ($template->load(self::$template_filename)) {
         $html = $template->get_display_template(true);
     } else {
         throw new PMPException('Sysmtem Error ' . __CLASS__ . ' ' . __LINE__);
     }
     print $html;
     exit;
 }
Esempio n. 10
0
 function disp()
 {
     //定义模板
     $t = new Template('../template/basic');
     $t->set_file('f', 'upmorefile.html');
     $t->unknowns = "remove";
     $t->left_delimiter = "[#";
     //修改左边界符为[#
     $t->right_delimiter = "#]";
     //修改右边界符#]
     $t->set_block('f', 'mainlist', 'ml');
     //设置分类
     $t->set_var('ml');
     $inrs =& $this->dbObj->Execute('select * from ' . WEB_ADMIN_TABPOX . 'apparatus  where agencyid =' . $_SESSION["currentorgan"]);
     //echo 'select * from '.WEB_ADMIN_TABPOX.'roomgroup  where agencyid ='.$_SESSION["currentorgan"];
     while ($inrrs =& $inrs->FetchRow()) {
         $t->set_var($inrrs);
         $t->parse('ml', 'mainlist', true);
     }
     $inrs->Close();
     $t->set_var('add', $this->getAddStr('img'));
     $t->set_var('path', WEB_ADMIN_HTTPPATH . '/common/');
     $t->parse('out', 'f');
     $t->p('out');
 }
Esempio n. 11
0
 protected function loadTemplate()
 {
     $modal = new \Modal('edit-file-form');
     $this->template = new \Template();
     $this->template->setModuleTemplate('filecabinet', 'FC_Forms/folders.html');
     $this->template->add('modal', $modal->get());
 }
Esempio n. 12
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();
 }
Esempio n. 13
0
function lateral_menu()
{
    global $LANG, $CONFIG;
    $tpl = new Template('admin/menus/panel.tpl');
    $tpl->assign_vars(array('L_MENUS_MANAGEMENT' => $LANG['menus_management'], 'L_ADD_CONTENT_MENUS' => $LANG['menus_content_add'], 'L_ADD_LINKS_MENUS' => $LANG['menus_links_add'], 'L_ADD_FEED_MENUS' => $LANG['menus_feed_add'], 'L_MANAGE_THEME_COLUMNS' => $LANG['manage_theme_columns'], 'THEME_NAME' => get_utheme()));
    $tpl->parse();
}
Esempio n. 14
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;
     }
 }
Esempio n. 15
0
/**
 * Campsite render function plugin
 *
 * Type:     function
 * Name:     render
 * Purpose:  template rendering
 *
 * @param array
 *     $p_params
 * @param object
 *     $p_smarty The Smarty object
 *
 * @return
 *     rendered content
 */
function smarty_function_render($p_params, &$p_smarty)
{
    if (empty($p_params['file'])) {
        return null;
    }
    $smarty = clone $p_smarty;
    if (SystemPref::Get('TemplateCacheHandler')) {
        $campsiteVector = $smarty->campsiteVector;
        foreach ($campsiteVector as $key => $value) {
            if (isset($p_params[$key])) {
                if (empty($p_params[$key])) {
                    $campsiteVector[$key] = null;
                }
                if (is_int($p_params[$key])) {
                    $campsiteVector[$key] = $p_params[$key];
                }
            }
        }
        if (isset($p_params['params'])) {
            $campsiteVector['params'] = $p_params['params'];
        }
        $smarty->campsiteVector = $campsiteVector;
        if (empty($p_params['cache'])) {
            $template = new Template($p_params['file']);
            $smarty->cache_lifetime = (int)$template->getCacheLifetime();
        } else {
            $smarty->cache_lifetime = (int)$p_params['cache'];
        }
    }
    return $smarty->display($p_params['file']);

} // fn smarty_function_render
/**
 * 编译模板文件,并且返回模板文件的路径
 * @param $file
 * @return string
 */
function renderTemplate($module, $action = null)
{
    if (defined('TEMPLATE_EXT')) {
        $ext = TEMPLATE_EXT;
    } else {
        $ext = ".htm";
    }
    if (empty($action)) {
        $file = "{$module}";
    } else {
        $file = "{$module}/{$action}";
    }
    $tplfile = TEMPLATE_DIR . '/' . $file . $ext;
    if (!file_exists($tplfile)) {
        die("template file {$tplfile} not exists");
    }
    $objfile = TEMPLATE_DATA_DIR . '/' . $file . '.tpl.php';
    if (!file_exists($objfile) || filemtime($tplfile) > filemtime($objfile)) {
        if (!file_exists(TEMPLATE_DATA_DIR)) {
            mkdir(TEMPLATE_DATA_DIR, 0777, true);
        }
        if (!file_exists(dirname($objfile))) {
            mkdir(dirname($objfile), 0777, true);
        }
        $t = new Template();
        if ($t->complie($tplfile, $objfile) === false) {
            die('Cannot write to template cache.');
        }
    }
    return $objfile;
}
Esempio n. 17
0
 /**
  * 新建模板
  * @author yongze
  */
 public function actionCreate($id)
 {
     $dsModel = $this->loadModel((int) $id, 'ds');
     $dbModel = $this->loadModel((int) $dsModel->database_id, 'db');
     $model = new Template('Create');
     $data = array();
     if (isset($_POST['Template'])) {
         if (isset($_POST['Template']['type'])) {
             $_POST['Template']['type'] = (int) $_POST['Template']['type'];
         }
         $model->attributes = $_POST['Template'];
         $model->dataset_id = (int) $dsModel->id;
         $model->dataset_name = $dsModel->name;
         if ($model->save()) {
             $this->addLog('template', $model->id, '添加新模板“' . $model->tpname . '”');
             Yii::app()->user->setFlash("success", "新建 <b>{$model->tpname}</b> 模板成功!");
         } else {
             $errorMsg = '';
             $errorErr = $model->getErrors();
             foreach ($errorErr as $value) {
                 $errorMsg .= "\t" . $value[0];
             }
             $errorMsg = trim($errorMsg, ',');
             Yii::app()->user->setFlash("error", $errorMsg);
         }
         $this->redirect(array('/Template/Index/' . $dsModel->id));
     }
     $data['dbModel'] = $dbModel;
     $data['dsModel'] = $dsModel;
     $data['model'] = $model;
     $data['datasetId'] = $id;
     $this->_getFieldsInfos($data['_txtfiled'], $id);
     $this->render('edit', $data);
 }
Esempio n. 18
0
 public static function GetPanel()
 {
     $tpl = new Template();
     $pages = Pages_Model::GetPages();
     $tpl->SetParam('pages', $pages);
     return $tpl->Fetch('templates/pages/pages-panel.tpl');
 }
Esempio n. 19
0
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;
}
 /** !!
  * Uses the template in this directory to compute the innerHTML for this module.
  *
  * @return A string used by {@see render()} which is passed for display.
  */
 function generate_inner_html()
 {
     $tpl = new Template(PA::$blockmodule_path . '/' . get_class($this) . "/center_inner_public.tpl", $this);
     $tpl->set("test_blob", PA::$login_user->get_profile_field("echo_test_module", "test_blob"));
     $inner_html = $tpl->fetch();
     return $inner_html;
 }
Esempio n. 21
0
 public function addCustomer($data)
 {
     $this->db->query("INSERT INTO " . DB_PREFIX . "customer SET firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', birthday = '" . $this->db->escape($data['birthday_year']) . '-' . $this->db->escape($data['birthday_month']) . '-' . $this->db->escape($data['birthday_day']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', newsletter = '" . (int) $data['newsletter'] . "', customer_group_id = '" . (int) $data['customer_group_id'] . "', customer_type_id = '" . (int) $data['customer_type_id'] . "', salt = '" . $this->db->escape($salt = substr(md5(uniqid(rand(), true)), 0, 9)) . "', password = '******'password'])))) . "', status = '" . (int) $data['status'] . "', date_added = NOW()");
     $customer_id = $this->db->getLastId();
     if (isset($data['address'])) {
         foreach ($data['address'] as $address) {
             $this->db->query("INSERT INTO " . DB_PREFIX . "address SET customer_id = '" . (int) $customer_id . "', firstname = '" . $this->db->escape($address['firstname']) . "', lastname = '" . $this->db->escape($address['lastname']) . "', company = '" . $this->db->escape($address['company']) . "', company_id = '" . $this->db->escape($address['company_id']) . "', tax_id = '" . $this->db->escape($address['tax_id']) . "', address_1 = '" . $this->db->escape($address['address_1']) . "', address_2 = '" . $this->db->escape($address['address_2']) . "', city = '" . $this->db->escape($address['city']) . "', postcode = '" . $this->db->escape($address['postcode']) . "', country_id = '" . (int) $address['country_id'] . "', zone_id = '" . (int) $address['zone_id'] . "'");
             if (isset($address['default'])) {
                 $address_id = $this->db->getLastId();
                 $this->db->query("UPDATE " . DB_PREFIX . "customer SET address_id = '" . $address_id . "' WHERE customer_id = '" . (int) $customer_id . "'");
             }
         }
     }
     if ($data['send_mail']) {
         $customer_info = $this->getCustomer($customer_id);
         if ($customer_info) {
             $this->db->query("UPDATE " . DB_PREFIX . "customer SET approved = '1' WHERE customer_id = '" . (int) $customer_id . "'");
             $this->language->load('mail/customer');
             $this->load->model('setting/store');
             $store_info = $this->model_setting_store->getStore($customer_info['store_id']);
             if ($store_info) {
                 $store_name = $store_info['name'];
                 $store_url = $store_info['url'] . 'tai-khoan/dang-nhap';
             } else {
                 $store_name = $this->config->get('config_name');
                 $store_url = HTTP_CATALOG . 'tai-khoan/dang-nhap';
             }
             $template = new Template();
             $subject = sprintf($this->language->get('text_subject'), $store_name);
             $template->data['title'] = sprintf($this->language->get('text_subject'), $store_name);
             $template->data['text_welcome'] = sprintf($this->language->get('text_welcome'), $store_name);
             $template->data['text_login'] = $this->language->get('text_login');
             $template->data['text_url'] = sprintf($this->language->get('text_url'), $store_url, $store_url);
             $template->data['text_email'] = sprintf($this->language->get('text_email'), $data['email']);
             $template->data['text_password'] = sprintf($this->language->get('text_password'), $data['password']);
             $template->data['text_services'] = $this->language->get('text_services');
             $template->data['text_thanks'] = $this->language->get('text_thanks');
             $template->data['text_store_name'] = $store_name;
             if (file_exists(DIR_TEMPLATE . 'mail/customer.tpl')) {
                 $html = $template->fetch('mail/customer.tpl');
             } else {
                 $html = $template->fetch('mail/customer.tpl');
             }
             $mail = new Mail();
             $mail->protocol = $this->config->get('config_mail_protocol');
             $mail->parameter = $this->config->get('config_mail_parameter');
             $mail->hostname = $this->config->get('config_smtp_host');
             $mail->username = $this->config->get('config_smtp_username');
             $mail->password = $this->config->get('config_smtp_password');
             $mail->port = $this->config->get('config_smtp_port');
             $mail->timeout = $this->config->get('config_smtp_timeout');
             $mail->setTo($customer_info['email']);
             $mail->setFrom($this->config->get('config_email'));
             $mail->setSender($store_name);
             $mail->setSubject($subject);
             $mail->setHtml($html);
             $mail->send();
         }
     }
 }
Esempio n. 22
0
 function generate_inner_html()
 {
     $inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/side_inner_public.tpl';
     $inner_html_gen = new Template($inner_template);
     $inner_html = $inner_html_gen->fetch();
     return $inner_html;
 }
 function generate_inner_html()
 {
     $tmp_file = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_public.tpl';
     $user_comment_form = new Template($tmp_file);
     $inner_html = $user_comment_form->fetch();
     return $inner_html;
 }
Esempio n. 24
0
 public function __construct($esxman, $database, $username = '', $error = null)
 {
     $this->esxman = $esxman;
     $this->database = $database;
     $this->username = $username;
     $this->html = array('footer' => '&nbsp;', 'menu' => '&nbsp;', 'tree' => '&nbsp;', 'user' => '&nbsp;', 'content' => '&nbsp;');
     $this->commands = array();
     $this->title = _('Login');
     if (request('form_name') == 'login') {
         if ($this->database->authenticate_user(request('username'), request('password'))) {
             session_destroy();
             session_start();
             $_SESSION['username'] = request('username');
             $_SESSION['key'] = md5($_SESSION['username'] . getenv('REMOTE_ADDR') . getenv('X-FORWARDED-FOR'));
             debug('User ' . request('username') . ' logging in!');
             $this->commands[] = "\$('#dialog').html('" . _('Populating inventory...') . "');";
             $this->commands[] = js_command('get', 'action=populate_inventory');
             return;
         }
         $error = _('Authentication failed');
     }
     $tpl = new Template('dialog_login.html');
     if ($error) {
         $tpl->setVar('error', $error);
         $tpl->parse('error_message');
     }
     $this->commands[] = js_command('display_dialog', _('Login'), $tpl->get(), _('Login'));
 }
Esempio n. 25
0
function lastArticle()
{
    global $bdd;
    global $_TABLES;
    $content = "";
    $view = new Template(dirname(dirname(__FILE__)) . '/html/article.html');
    if (!is_null($bdd) && !is_null($_TABLES)) {
        $objLastArticle = new LastArticle($bdd, $_TABLES);
        $articles = $objLastArticle->getLastArticles();
        if (!is_null($articles)) {
            foreach ($articles as $key => $value) {
                $temp_subscription = '';
                if (isset($_SESSION['user_auth']) && $_SESSION['user_auth'] == '1' && isset($_SESSION['user_subscription'])) {
                    if (in_array($value->website_id, $_SESSION['user_subscription'])) {
                        $temp_subscription = "<div class='unsubscription' website_id='%%website_id%%'></div>";
                    } else {
                        $temp_subscription = "<div class='subscription' website_id='%%website_id%%'></div>";
                    }
                }
                $content .= $view->getView(array("url" => '/to/' . $value->guid . '#' . $value->url, "title" => $value->title, "width_image" => $value->width_image, "height_image" => $value->height_image, "image" => $value->image, "alt_image" => $value->alt_image, "description" => $value->description, "logo_site" => $value->logo, "alt_logo_site" => $value->website, "title_site" => $value->website, "subscription" => $temp_subscription, "website_id" => $value->website_id));
            }
            return $content;
        } else {
            // 404
            return "404 Not Found";
        }
    } else {
        error_log("BDD ERROR : " . json_encode($bdd));
        error_log("TABLES ERROR : " . json_encode($_TABLES));
    }
}
 public function poem($f3)
 {
     $this->get_poem($f3, (int) $f3->get('PARAMS.idpoem'));
     $f3->set('do_analytics', 1);
     $template = new Template();
     echo $template->render('ui.html');
 }
Esempio n. 27
0
 public function view()
 {
     $val = array('result');
     $arr = array('result' => $this->res);
     $new = new Template(realpath('all/pages/install/view.php'), $val, $arr);
     $new->view(realpath('all/pages/install/view.php'), $val, $arr);
 }
Esempio n. 28
0
 function filter_AddTitle($string, $template)
 {
     global $config;
     $tpl = new Template($this->getTemplate('title.template'));
     $tpl->set('title', $template->get('title'));
     return str_replace('{%TITLE%}', $tpl->fetch(), $string);
 }
 function Render()
 {
     $vars = array();
     $vars['img'] = $this->img;
     $tpl = new Template();
     echo $tpl->Process(BASE_PATH . 'view.tpl', $vars);
 }
 function generate_inner_html()
 {
     $inner_template = NULL;
     switch ($this->mode) {
         default:
             $inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_html.tpl';
     }
     if (!empty($this->profile_feeds)) {
         $counter = 0;
         foreach ($this->profile_feeds as $data) {
             $params = array('feed_id' => $data['feed_id']);
             $ExternalFeed = new ExternalFeed();
             try {
                 //Getting the feed data corresponding to the feed id
                 $this->profile_feeds[$counter]['links'] = $ExternalFeed->get_feed_data($params);
             } catch (PAException $e) {
                 //TODO: pending error handling if function fails.
                 //$error = $e->message;
             }
             $counter++;
         }
     }
     $inner_html_gen = new Template($inner_template);
     $inner_html_gen->set('profile_feeds', @$this->profile_feeds);
     $inner_html_gen->set('feed_id', $this->feed_id);
     $inner_html = $inner_html_gen->fetch();
     return $inner_html;
 }