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(); } } }
public function index() { $this->language->load('newsletter/active'); $this->load->model('catalog/newsletter'); $code = $this->request->get['code']; $check = $this->model_catalog_newsletter->getNewsLetterVerifyCode($code); if ($check) { $newsletter_info = $this->model_catalog_newsletter->getNewsLetterbyEmail($check['email']); $this->model_catalog_newsletter->updateNewsLetterStatusEmail($newsletter_info['email']); $this->model_catalog_newsletter->deleteNewsLetterVerifyEmail($newsletter_info['email']); $this->data['text_desc_active'] = $this->language->get('text_desc_active'); // HTML Mail $template = new Template(); $subject = $this->language->get('text_subject'); $template->data['title'] = $this->language->get('text_subject'); $template->data['text_hello'] = sprintf($this->language->get('text_hello'), $newsletter_info['email'], $newsletter_info['name']); $template->data['text_greeting'] = $this->language->get('text_greeting'); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/verify_success.tpl')) { $html = $template->fetch($this->config->get('config_template') . '/template/mail/verify_success.tpl'); } else { $html = $template->fetch('default/template/mail/verify_success.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($newsletter_info['email']); $mail->setFrom($this->config->get('config_email')); $mail->setSender($this->config->get('config_name')); $mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8')); $mail->setHtml($html); $mail->send(); } else { $this->data['text_desc_active'] = $this->language->get('text_desc_code'); } $this->document->setTitle($this->language->get('heading_title')); $this->data['breadcrumbs'] = array(); $this->data['breadcrumbs'][] = array('href' => $this->url->link('common/home'), 'text' => $this->language->get('text_home'), 'separator' => false); $this->data['breadcrumbs'][] = array('href' => $this->url->link('newsletter/confirm'), 'text' => $this->language->get('text_confirm'), 'separator' => $this->language->get('text_separator')); $this->data['heading_title'] = $this->language->get('heading_title'); $this->data['button_continue'] = $this->language->get('button_continue'); $this->data['continue'] = $this->url->link('common/home'); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/newsletter/active.tpl')) { $this->template = $this->config->get('config_template') . '/template/newsletter/active.tpl'; } else { $this->template = 'default/template/newsletter/active.tpl'; } $this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header'); $this->response->setOutput($this->render()); }
public function confirm($order_id) { $this->load->model('checkout/order'); $order_info = $this->model_checkout_order->getOrder($order_id); if ($order_info) { $this->load->model('localisation/language'); $language = new Language($order_info['language_directory']); $language->load($order_info['language_filename']); $language->load('mail/voucher'); $voucher_query = $this->db->query("SELECT *, vtd.name AS theme FROM `" . DB_PREFIX . "voucher` v LEFT JOIN " . DB_PREFIX . "voucher_theme vt ON (v.voucher_theme_id = vt.voucher_theme_id) LEFT JOIN " . DB_PREFIX . "voucher_theme_description vtd ON (vt.voucher_theme_id = vtd.voucher_theme_id) AND vtd.language_id = '" . (int) $order_info['language_id'] . "' WHERE order_id = '" . (int) $order_id . "'"); foreach ($voucher_query->rows as $voucher) { // HTML Mail $template = new Template(); $template->data['title'] = sprintf($language->get('text_subject'), $voucher['from_name']); $template->data['text_greeting'] = sprintf($language->get('text_greeting'), $this->currency->format($voucher['amount'], $order_info['currency_code'], $order_info['currency_value'])); $template->data['text_from'] = sprintf($language->get('text_from'), $voucher['from_name']); $template->data['text_message'] = $language->get('text_message'); $template->data['text_redeem'] = sprintf($language->get('text_redeem'), $voucher['code']); $template->data['text_footer'] = $language->get('text_footer'); if (file_exists(DIR_IMAGE . $voucher['image'])) { $template->data['image'] = 'cid:' . md5(basename($voucher['image'])); } else { $template->data['image'] = ''; } $template->data['store_name'] = $order_info['store_name']; $template->data['store_url'] = $order_info['store_url']; $template->data['message'] = nl2br($voucher['message']); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/voucher.tpl')) { $html = $template->fetch($this->config->get('config_template') . '/template/mail/voucher.tpl'); } else { $html = $template->fetch('default/template/mail/voucher.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($voucher['to_email']); $mail->setFrom($this->config->get('config_email')); $mail->setSender($order_info['store_name']); $mail->setSubject(sprintf($language->get('text_subject'), $voucher['from_name'])); $mail->setHtml($html); if (file_exists(DIR_IMAGE . $voucher['image'])) { $mail->addAttachment(DIR_IMAGE . $voucher['image'], md5(basename($voucher['image']))); } $mail->send(); } } }
public function child() { $this->language->load('comment/write'); $this->load->model('catalog/comment'); $json = array(); if (strlen(utf8_decode($this->request->post['name'])) < 3 || strlen(utf8_decode($this->request->post['name'])) > 255) { $json['error'] = $this->language->get('error_name'); } if (strlen(utf8_decode($this->request->post['text'])) < 3) { $json['error'] = $this->language->get('error_text'); } if ($this->request->server['REQUEST_METHOD'] == 'POST' && !isset($json['error'])) { $this->model_catalog_comment->addCommentChild($this->request->post); $json['success'] = $this->language->get('text_success'); $info = $this->model_catalog_comment->getComment($this->request->post['parent_id']); if ($this->request->post['send_mail'] == 'on' && $info['email'] != '') { // HTML Mail $email = $info['email']; $name = $info['name']; $template = new Template(); $subject = $this->language->get('text_subject'); $template->data['title'] = $this->language->get('text_subject'); $template->data['text_hello'] = sprintf($this->language->get('text_hello'), $email, $name); $template->data['text_greeting'] = $this->language->get('text_greeting'); $template->data['text_greeting'] .= sprintf($this->language->get('text_faq'), $info['text']); $template->data['text_greeting'] .= sprintf($this->language->get('text_ans'), $this->request->post['text']); if (file_exists(DIR_TEMPLATE . 'mail/reply_comment.tpl')) { $html = $template->fetch('mail/reply_comment.tpl'); } else { $html = $template->fetch('mail/reply_comment.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($email); $mail->setFrom($this->config->get('config_email')); $mail->setSender($this->config->get('config_name')); $mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8')); $mail->setHtml($html); $mail->send(); } } $this->response->setOutput(json_encode($json)); }
function event_ExecuteEditor(&$data) { global $lang, $manager; if ($data['type'] == 'external' && $data['sheet'] == 'external') { if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_REQUEST['url'] != 'http://') { $res = sql::query("\r\n\t\t\t\t\t\t\tREPLACE \r\n\t\t\t\t\t\t\t\t" . _TABLE_PREFIX_ . "contents_external\r\n\t\t\t\t\t\t\tSET\r\n\t\t\t\t\t\t\t\tID='" . $data['params']['id'] . "',\r\n\t\t\t\t\t\t\t\trevision='" . $data['params']['revision'] . "',\r\n\t\t\t\t\t\t\t\turl='" . addslashes($_REQUEST['url']) . "'\r\n\t\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') . "/external?revision=" . $data['params']['revision']); exit; } $res = sql::query("\r\n\t\t\t\t\tSELECT\r\n\t\t\t\t\t\t*\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t\t" . _TABLE_PREFIX_ . "contents_external\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\tID='" . $data['params']['id'] . "' AND\r\n\t\t\t\t\t\trevision='" . $data['params']['revision'] . "'\r\n\t\t\t\t"); $tpl = new Template($this->getTemplate('editor.template')); if ($row = sql::fetch_array($res)) { $tpl->set("url", $row['url']); } else { $tpl->set("url", 'http://'); } $tpl->set("id", $data['params']['id']); $tpl->set("revision", $data['params']['revision']); $data['template']->append('content', $tpl->fetch()); } }
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(); }
function action_sitemap($args) { global $manager, $language; $sitemap = array(); $user = new anonymousUser(); $list = new languages(); while (list(, $lang) = each($list->nodes)) { $language = $lang->id; $tree = new pageTree($user, $manager, $lang->id); while (list($id, $item) = each($tree->data)) { if ($item['visible'] && $item['navigation']) { $tz = date('O', $item['meta']['modified']); $tz = substr($tz, 0, 3) . ':' . substr($tz, 3, 2); if (time() - $item['meta']['modified'] < 86400 * 2) { $fq = 'hourly'; } elseif (time() - $item['meta']['modified'] < 86400 * 14) { $fq = 'daily'; } elseif (time() - $item['meta']['modified'] < 86400 * 62) { $fq = 'weekly'; } else { $fq = 'monthly'; } $sitemap[] = array('loc' => 'http://' . $_SERVER['HTTP_HOST'] . $item['url'], 'lastmod' => gmdate('Y-m-d\\TH:i:s', $item['meta']['modified']) . $tz, 'changefreq' => $fq, 'priority' => '1.0'); } } } $tpl = new Template($this->getTemplate('main.template')); $tpl->set('sitemap', $sitemap); header("Content-type: text/xml;charset=UTF-8"); echo $tpl->fetch(); exit; }
/** * 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(); }
/** * Build site content depending on requested action. */ protected function buildSite() { switch ($this->s->action) { case 'info': $site = $this->s->getConfig('site'); $site['modules']['all'] = Module::getNumber(); $site['modules']['active'] = Module::getNumber(true); $site['users'] = User::getNumber(true); $db = DB::getInstance(); $server = array('type' => $_SERVER['SERVER_SOFTWARE'], 'php' => array('version' => phpversion(), 'safe_mode' => ini_get('safe_mode'), 'magic_quotes_gpc' => ini_get('magic_quotes_gpc'), 'magic_quotes_runtime' => ini_get('magic_quotes_runtime'), 'gpc_order' => ini_get('gpc_order'), 'memory_limit' => ini_get('memory_limit'), 'max_execution_time' => ini_get('max_execution_time'), 'disable_functions' => ini_get('disable_functions'), 'sql_safe_mode' => ini_get('sql.safe_mode'), 'include_path' => ini_get('include_path')), 'gd' => $this->getPhpModuleInfo('gd'), 'db' => $db->info()); $file = 'CHANGELOG.txt'; $changelog = is_readable($file) ? file_get_contents($file) : false; $file = 'logs/error.log'; $errorlog = is_readable($file) ? file_get_contents($file) : false; if ($errorlog == '') { $errorlog = 'Errorlog ist leer!'; } $tpl = new Template('system'); $tpl->assign('chispa', $this->s->getConfig('chispa')); $tpl->assign('site', $site); $tpl->assign('server', $server); $tpl->assign('changelog', $changelog); $tpl->assign('errorlog', $errorlog); $content = $tpl->fetch('info.html'); break; } parent::buildSite($content); }
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; }
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; }
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); }
/** !! * 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; }
function event_ExecuteEditor(&$data) { global $lang, $manager; if ($data['sheet'] == 'background') { if ($_SERVER['REQUEST_METHOD'] == 'POST') { $res = sql::query("\r\n\t\t\t\t\t\tREPLACE INTO \r\n\t\t\t\t\t\t\t" . _TABLE_PREFIX_ . "contents_background\r\n\t\t\t\t\t\tSET \r\n\t\t\t\t\t\t\tID='" . $data['params']['id'] . "', \r\n\t\t\t\t\t\t\trevision='" . $data['params']['revision'] . "',\r\n\t\t\t\t\t\t\timage='" . addslashes($_REQUEST['image']) . "', \r\n\t\t\t\t\t\t\tmodified=NOW()\r\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') . "/background?revision=" . $data['params']['revision']); exit; } $res = sql::query("\r\n\t\t\t\t\tSELECT \r\n\t\t\t\t\t\t* \r\n\t\t\t\t\tFROM \r\n\t\t\t\t\t\t" . _TABLE_PREFIX_ . "contents_background\r\n\t\t\t\t\tWHERE \r\n\t\t\t\t\t\tid='" . $data['params']['id'] . "' AND\r\n\t\t\t\t\t\trevision='" . $data['params']['revision'] . "'\r\n\t\t\t\t"); if ($row = sql::fetch_array($res)) { $image = $row['image']; } else { $image = ''; } $tpl = new Template($this->getTemplate('editor.template')); $tpl->set('id', $data['params']['id']); $tpl->set('revision', $data['params']['revision']); $tpl->set('image', $image); $data['template']->append('content', $tpl->fetch()); // Make sure the following assets are included $data['page']->assets->registerJavascript('/core/assets/javascript/modaldialog.js'); $data['page']->assets->registerCSS($this->localAsset('editor.css')); } }
function generate_inner_html() { $Pagination = new Pagination(); $Pagination->setPaging($this->Paging); $this->page_prev = $Pagination->getPreviousPage(); $this->page_next = $Pagination->getNextPage(); $this->page_links = $Pagination->getPageLinks(); $inner_template = NULL; switch ($this->mode) { case 'relations': case 'in_relations': $inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_public_relation.tpl'; break; default: $inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_public_relation.tpl'; } $obj_inner_template = new Template($inner_template, $this); $obj_inner_template->set_object('links', $this->links); $obj_inner_template->set_object('gid', @$this->gid); $obj_inner_template->set('sub_title', @$this->sub_title); $obj_inner_template->set('total', $this->Paging['count']); $obj_inner_template->set('reciprocated_relationship_set', @$this->reciprocated_relationship_set); $obj_inner_template->set('relations', @$this->relations); $obj_inner_template->set('in_relations', @$this->in_relations); $obj_inner_template->set('user_name', $this->page_user); $obj_inner_template->set('page_prev', $this->page_prev); $obj_inner_template->set('page_next', $this->page_next); $obj_inner_template->set('page_links', $this->page_links); $obj_inner_template->set('view_type', $this->view_type); $inner_html = $obj_inner_template->fetch(); return $inner_html; }
/** !! * Set where the html should be rendered and what template it should user * @return string $inner_html all the html for the module */ function generate_inner_html() { $tmp_file = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_public.tpl'; $net_details = new Template($tmp_file); $inner_html = $net_details->fetch(); return $inner_html; }
function content_horizontal(&$data) { global $manager, $tree, $user; if ($item =& $tree->getItemById($data['params']['id'])) { if (!$item['visible']) { return; } $tpl = new Template($this->getTemplate('main.template', $data['type'])); if (intval($item['parent']) > 0) { $parent =& $tree->getItemById($item['parent']); $list =& $parent['children']; } else { $list =& $GLOBALS['tree']->tree; } $prev = null; reset($list); while (list($k, ) = each($list)) { if ($list[$k]['id'] == $item['id']) { if ($prev) { $tpl->set('prev', $prev); } if (list($k, ) = each($list)) { $tpl->set('next', $list[$k]); } break; } $prev = $list[$k]; } $data['page']->composite->set('horizontal', $tpl->fetch()); } }
function generate_inner_html() { global $app; switch ($this->type) { case 'forum': $inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/forum_inner_template.tpl'; break; default: $inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_private.tpl'; } $Pagination = new Pagination(); $Pagination->setPaging($this->Paging); $this->page_first = $Pagination->getFirstPage(); $this->page_last = $Pagination->getLastPage(); $this->page_links = $Pagination->getPageLinks(); $inner_html_gen = new Template($inner_template); $inner_html_gen->set('links', $this->links); $inner_html_gen->set('back_page', PA::$url . $app->current_route); $inner_html_gen->set('type', $this->type); $inner_html_gen->set('page_first', $this->page_first); $inner_html_gen->set('page_last', $this->page_last); $inner_html_gen->set('page_links', $this->page_links); $inner_html = $inner_html_gen->fetch(); return $inner_html; }
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($links) { $extra = unserialize(PA::$network_info->extra); $this->rel_term = __('Friend'); // default title if (isset($extra['relationship_show_mode']['term'])) { $this->rel_term = $extra['relationship_show_mode']['term']; } if (empty($links)) { $this->view_all_url = NULL; } $inner_template = NULL; switch ($this->mode) { case SORT_BY: $inner_template = 'side_inner_sortby.tpl'; break; default: $inner_template = 'side_inner_public.tpl'; } $inner_template = PA::$blockmodule_path . '/' . (get_parent_class($this) ? get_parent_class($this) : get_class($this)) . '/' . $inner_template; $obj_inner_template = new Template($inner_template); $obj_inner_template->set('links', $links); $obj_inner_template->set('block_name', $this->html_block_id); if ($this->sort_by) { $obj_inner_template->set('sort_by', $this->sort_by); $obj_inner_template->set('sorting_options', $this->sorting_options); $obj_inner_template->set('selected_option', $this->selected_option); } $obj_inner_template->set('rel_term', $this->rel_term); $obj_inner_template->set('current_theme_path', PA::$theme_url); $inner_html = $obj_inner_template->fetch(); return $inner_html; }
/** * Function to send email where the container is specified but not the email template. * */ function simple_pa_mail($to, $subject, $message, $from = DEFAULT_SENDER, $container_html = 'default_email_container.tpl') { if (empty($from)) { $from = DEFAULT_SENDER; } // patching up message and subject in the email container if (!empty($container_html)) { $email_container = new Template('config/email_containers/' . $container_html); $email_container->set('subject', $subject); $email_container->set('message', $message); // actual message to be sent through the mail $message = $email_container->fetch(); } $headers = "MIME-Version: 1.0\r\n" . "Content-type: text/html; charset=iso-8859-1\r\n" . "From: {$from}"; // if you want to test the e-mail system, set global // $mail_testing_callback to point to your own function, that // behaves like mail(). global $mail_testing_callback; $mail_func = $mail_testing_callback ? $mail_testing_callback : "mail"; $check = call_user_func($mail_func, $to, $subject, $message, $headers); if ($check == FALSE) { throw new PAException(MAIL_FUNCTION_FAILED, "Mail is not sent due to some internal server problem"); } else { return TRUE; } }
function generate_inner_html($links) { if (empty($links)) { $this->sort_by = FALSE; } $inner_template = NULL; switch ($this->mode) { case SORT_BY: $inner_template = PA::$blockmodule_path . '/' . (get_parent_class($this) ? get_parent_class($this) : get_class($this)) . '/cnmodule_sortby.php'; break; default: $inner_template = PA::$blockmodule_path . '/' . (get_parent_class($this) ? get_parent_class($this) : get_class($this)) . '/cnmodule.php'; } $obj_inner_template = new Template($inner_template); $obj_inner_template->set('links', $links); $obj_inner_template->set('block_name', $this->html_block_id); if (!empty($this->sort_by)) { $obj_inner_template->set('sort_by', $this->sort_by); $obj_inner_template->set('sorting_options', $this->sorting_options); $obj_inner_template->set('selected_option', $this->selected_option); } $obj_inner_template->set('current_theme_path', PA::$theme_url); $inner_html = $obj_inner_template->fetch(); return $inner_html; }
function generate_inner_html() { if (empty($this->links)) { return ""; } $links = $this->links; /* if ($links->type == 'textpad') { $this->title = $links->title; } */ $pos = explode(',', $links->orientation); $x_loc = $pos[0]; if ($x_loc == 2) { $width = AD_WIDTH_MIDDLE; //$height = AD_HEIGHT_MIDDLE; } else { $width = AD_WIDTH_LR; //$height = AD_HEIGHT_LR; $this->outer_template = 'cnmodule_advertisement.php'; } // we never want to reduce the height of an ad, so we set $height very high $height = 1000; $tmp_file = PA::$blockmodule_path . '/' . get_class($this) . '/cnmodule.php'; $inner_html_gen = new Template($tmp_file); $inner_html_gen->set_object('links', $links); $inner_html_gen->set('width', $width); $inner_html_gen->set('height', $height); $inner_html_gen->set('block_name', $this->html_block_id); $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; }
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()); } }
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'); }
/** !! * Called by { @link render() } to create the html for the page * @return string $inner_html the html for the module */ function generate_inner_html() { $tmp_file = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_public.tpl'; $inner_html_gen = new Template($tmp_file); $inner_html_gen->set('forgot_password_id', $this->forgot_password_id); $inner_html = $inner_html_gen->fetch(); return $inner_html; }
function generate_inner_html() { $inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/poll_archive.tpl.php'; $inner_html_gen = new Template($inner_template); $inner_html_gen->set('polls', $this->prev_polls); $inner_html = $inner_html_gen->fetch(); return $inner_html; }
function generate_inner_html() { $tmp_file = PA::$blockmodule_path . '/' . get_class($this) . '/side_inner_public.tpl'; $inner_html_gen = new Template($tmp_file); $inner_html_gen->set('following', $this->_following); $inner_html = $inner_html_gen->fetch(); return $inner_html; }
/** * This generates the page specific html to be passed on to the render function. * It uses the standard templates to achieve this. * * @return string $inner_html The aforementioned page specific html */ function generate_inner_html() { $inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/cnmodule.php'; $inner_html_gen = new Template($inner_template, $this); $inner_html_gen->set('block_name', $this->html_block_id); $inner_html = $inner_html_gen->fetch(); return $inner_html; }