/** * Provides a tag input field * * @param Pieform $form The form to render the element for * @param array $element The element to render * @return string The HTML for the element */ function pieform_element_tags(Pieform $form, $element) { $smarty = smarty(); $value = array(); if (isset($element['defaultvalue']) && is_array($element['defaultvalue'])) { $value = $element['defaultvalue']; } if ($form->get_value($element)) { $value = $form->get_value($element); } if (isset($element['value']) && is_array($element['value'])) { $value = $element['value']; } if (!is_array($value)) { $value = array(); } if (!isset($element['size'])) { $element['size'] = 60; } $smarty->assign('name', $element['name']); $smarty->assign('size', $element['size']); $smarty->assign('id', $form->get_name() . '_' . $element['id']); $smarty->assign('value', join(', ', $value)); $smarty->left_delimiter = '{{'; $smarty->right_delimiter = '}}'; return $smarty->fetch('form/tags.tpl'); }
function index() { //验证权限,跳转提示页面 if (!in_array(parent::visite_access, $this->admin_access)) { http::skip('message/login/forbid'); } //接收请求参数 $category = rq(2); //类型(1,已读/0,未读/全部) $page = rq(3, 1); //页码 //获取删除和回复权限 $del_access = in_array(parent::del_access, $this->admin_access); $reply_access = in_array(parent::reply_access, $this->admin_access); //调用查询模型 $message = self::message_model($category, $page, 10); //处理分页导航 $page_url = dc_url . 'manage/' . $category . '/'; $page_nav = s_page::mark($page_url, $message['info'][0], $page, 3); //视图赋值 $tpl = smarty('admin'); $head['frame'] = '_self'; $head['title'] = '留言管理_EQPHP案例留言本'; $tpl->assign('head', $head); $tpl->assign('del_access', $del_access); $tpl->assign('reply_access', $reply_access); $tpl->assign('rs_count', $message['num']); $tpl->assign('message', $message['info'][1]); $tpl->assign('page_nav', $page_nav); //渲染视图模板 $tpl->display('message/manage'); }
/** * Provides an email list, with verification to enable addresses * * @param array $element The element to render * @param Pieform $form The form to render the element for * @return string The HTML for the element */ function pieform_element_authlist(Pieform $form, $element) { $smarty = smarty(); $smarty->left_delimiter = '{{'; $smarty->right_delimiter = '}}'; $value = $form->get_value($element); if (!is_array($value) && isset($element['defaultvalue']) && is_array($element['defaultvalue'])) { $value = $element['defaultvalue']; } if (!isset($value['default'])) { $value['default'] = ''; } if (is_array($value) && count($value)) { $smarty->assign('authtypes', $value['authtypes']); $smarty->assign('instancelist', $value['instancelist']); $smarty->assign('instancestring', implode(',', $value['instancearray'])); $smarty->assign('default', $value['default']); $smarty->assign('institution', $value['institution']); } $smarty->assign('name', $element['name']); $smarty->assign('cannotremove', json_encode(get_string('cannotremove', 'auth'))); $smarty->assign('cannotremoveinuse', json_encode(get_string('cannotremoveinuse', 'auth'))); $smarty->assign('saveinstitutiondetailsfirst', json_encode(get_string('saveinstitutiondetailsfirst', 'auth'))); $smarty->assign('noauthpluginconfigoptions', json_encode(get_string('noauthpluginconfigoptions', 'auth'))); return $smarty->fetch('form/authlist.tpl'); }
public function display($tpl = null) { if (is_null($tpl)) { smarty()->display(strtolower(get_class($this)) . '.tpl'); } else { smarty()->display($tpl); } }
function generate_feed($feed, $posts) { $smarty = smarty(); $smarty->assign('feed', $feed); $smarty->assign('posts', $posts); header("Content-Type: application/atom+xml"); $smarty->display('artefact:blog:atom.xml.tpl'); }
public function fetch() { $this->gabarit->process(); $this->process(); smarty()->assign('page', $this); smarty()->assign($this->template_vars); return smarty()->fetch(DIR_TPL . $this->name . '.tpl'); }
public function process() { $this->setRegles(); $this->addJs(WWW_JS . 'jquery.event.drag-2.0.min.js'); smarty()->assign('plateau_inverse', intval(slot()->position) == 1); $demi = $this->taille_plateau / 2; $nb_pion = $demi * ($demi - 1); smarty()->assign($this->getArrayParam()); }
public function process() { $this->initRegles(); $this->initPlateau(); $this->addJs(WWW_JS . 'jquery.event.drag.min.js'); $demi = $this->regles->taille_plateau / 2; $nb_pion = $demi * ($demi - 1); smarty()->assign(array('plateau_inverse' => intval(slot()->position) == 1, 'regles' => $this->regles, 'nb_joueur' => partie()->getNbJoueur())); }
/** * Show a login form for when a user needs to link an OIDC account but is not yet logged in locally. */ public function showloginform() { $smarty = smarty(array(), array(), array(), array('pagehelp' => false, 'sidebars' => false)); $smarty->assign('pagedescriptionhtml', get_string('logintolinkdesc', 'auth.oidc', $this->oidcusername, get_config('sitename'))); $smarty->assign('form', '<div id="loginform_container"><noscript><p>{str tag="javascriptnotenabled"}</p></noscript>' . $this->generate_login_form()); $smarty->assign('PAGEHEADING', get_string('logintolink', 'auth.oidc', get_config('sitename'))); $smarty->assign('LOGINPAGE', true); $smarty->display('form.tpl'); die; }
static function index() { $head = array('title' => 'EQPHP开源中文WEB应用开发框架'); input::cookie('frame_name', 'EQPHP'); $logo_file = DATA_STORE . 'txt/logo_pic.txt'; $source = base64_decode(file_get_contents($logo_file)); file_put_contents(FILE_CREATE . 'eqphp_logo.png', $source); $logo = '<img src="' . URL_CREATE . 'eqphp_logo.png">'; smarty()->assign(compact('head', 'logo'))->display('index'); }
static function index() { $tpl = smarty(); //设置、输出页面标题和关键词 $head['title'] = '欢迎使用EQPHP案例留言本'; $head['keywords'] = 'EQPHP留言本、简约留言薄、邮件发送、数据安全与过滤'; $head['keywords'] .= 'json数据、权限分配、正则验证、配置文件读取、css sprite'; $tpl->assign('head', $head); //渲染视图模板 $tpl->display('message/index'); }
public function process() { $slots = queryTab(' select * from slot natural join joueur where partie_id=' . partie()->getID() . ' order by slot_position '); smarty()->assign('slots', $slots); smarty()->assign('options', jeu()->getOptions()); smarty()->assign('isHost', intval(slot()->joueur_id) == intval(partie()->host)); }
static function index() { $tpl = smarty(); $head['title'] = 'EQPHP 文件上传(file upload)'; $tpl->assign('head', $head); $lie = 1; $param['type'] = url($lie); $param['dir'] = url($lie + 1); $param['id'] = url($lie + 2); $tpl->assign('up', $param); $tpl->display('plugin/upload'); }
static function index() { $admin = session('admin'); //若管理员已登录,跳转至管理首页 if ($admin && $admin['account']) { http::skip('message/manage'); } $tpl = smarty(); $head['title'] = '管理员登陆_EQPHP案例留言本'; $tpl->assign('head', $head); //输出模板 $tpl->display('message/login'); }
function export_submit(Pieform $form, $values) { global $SESSION; $views = array(); foreach ($values as $key => $value) { if (substr($key, 0, 5) == 'view_' && $value) { $views[] = intval(substr($key, 5)); } } $exportdata = array('format' => $values['format'], 'what' => $values['what'], 'views' => $views); $SESSION->set('exportdata', $exportdata); $smarty = smarty(); $smarty->assign('heading', ''); $smarty->display('export/export.tpl'); exit; }
static function index() { //初始化工作 self::del_empty_file('gitkeep'); //1、删除空文件(github空目录) self::logo(); //2、生成logo图片 self::clean(); //3、删除模板编译文件 $tpl = smarty(); $head['title'] = 'Home'; $tpl->assign('head', $head); $tpl->assign('logo', '<img src="' . dc_url_create . 'eqphp_logo.png">'); cookie::set('frame_name', 'EQPHP'); $tpl->display('index'); }
public function process() { $this->loadData(); $cases = array(); for ($i = 0; $i < 9; $i++) { $class = ''; switch ($this->grille[$i]) { case 1: $class = 'red'; break; case 2: $class = 'blue'; break; } $cases[] = array('x' => $i % 3, 'y' => (int) ($i / 3), 'p' => $i % 2 == 0, 'class' => $class); } smarty()->assign('cases', $cases); }
function bulkexport_submit(Pieform $form, $values) { global $SESSION; $usernames = array(); // Read in the usernames explicitly specified foreach (explode("\n", $values['usernames']) as $username) { $username = trim($username); if (!empty($username)) { $usernames[] = $username; } } if (empty($usernames) and !empty($values['authinstance'])) { // Export all users from the selected institution $rs = get_recordset_select('usr', 'authinstance = ? AND deleted = 0', array($values['authinstance']), '', 'username'); while ($record = $rs->FetchRow()) { $usernames[] = $record['username']; } } $SESSION->set('exportdata', $usernames); $smarty = smarty(); $smarty->assign('heading', ''); $smarty->display('admin/users/bulkdownload.tpl'); exit; }
foreach ($MEMBERS as $gid => $members) { $updates = group_update_members($gid, $members, $lines_done, $num_lines); $lines_done += sizeof($members); if (empty($updates)) { unset($UPDATES[$GROUPS[$gid]]); } else { $UPDATES[$GROUPS[$gid]] = $updates; log_debug('updated group members ' . $GROUPS[$gid] . ' (' . implode(', ', array_keys((array) $updates)) . ')'); } } db_commit(); // TODO: Fix this to show correct info $SESSION->add_ok_msg(get_string('csvfileprocessedsuccessfully', 'admin')); if ($UPDATES) { $updatemsg = smarty_core(); $updatemsg->assign('updates', $UPDATES); $SESSION->add_info_msg($updatemsg->fetch('admin/groups/memberscsvupdatemessage.tpl'), false); } else { $SESSION->add_ok_msg(get_string('numbergroupsupdated', 'admin', 0)); } set_progress_done('uploadgroupmemberscsv'); redirect('/admin/groups/uploadmemberscsv.php'); } $uploadcsvpagedescription = get_string('uploadgroupmemberscsvpagedescription3', 'admin', get_config('wwwroot') . 'admin/groups/uploadcsv.php', get_string('uploadgroupcsv', 'admin')); $form = pieform($form); set_progress_done('uploadgroupmemberscsv'); $smarty = smarty(array('adminuploadcsv')); $smarty->assign('uploadcsvpagedescription', $uploadcsvpagedescription); $smarty->assign('uploadcsvform', $form); $smarty->assign('PAGEHEADING', TITLE); $smarty->display('admin/groups/uploadcsv.tpl');
$message .= '<li>' . full_name($user) . ' <' . hsc($user->email) . "></li>\n"; } $message .= "</ul>\n"; $SESSION->add_info_msg($message, false); } } log_info('Inserted ' . count($CSVDATA) . ' records'); $SESSION->add_ok_msg(get_string('uploadcsvusersaddedsuccessfully', 'admin')); redirect('/admin/users/uploadcsv.php'); } // Get a list of all profile fields, to inform the user on what fields they can // put in their file. $fields = "<ul class=fieldslist>\n"; foreach (array_keys(ArtefactTypeProfile::get_all_fields()) as $type) { if ($type == 'firstname' || $type == 'lastname' || $type == 'email') { continue; } $fields .= '<li>' . hsc($type) . "</li>\n"; } $fields .= "<div class=cl></div></ul>\n"; if ($USER->get('admin')) { $uploadcsvpagedescription = get_string('uploadcsvpagedescription2', 'admin', get_config('wwwroot') . 'admin/extensions/pluginconfig.php?plugintype=artefact&pluginname=internal&type=profile', get_config('wwwroot') . 'admin/users/institutions.php', $fields); } else { $uploadcsvpagedescription = get_string('uploadcsvpagedescription2institutionaladmin', 'admin', get_config('wwwroot') . 'admin/users/institutions.php', $fields); } $form = pieform($form); $smarty = smarty(); $smarty->assign('uploadcsvpagedescription', $uploadcsvpagedescription); $smarty->assign('uploadcsvform', $form); $smarty->assign('PAGEHEADING', TITLE); $smarty->display('admin/users/uploadcsv.tpl');
function do_import() { global $SESSION, $USER, $TRANSPORTER, $IMPORTER; safe_require('import', 'leap'); // Get $TRANSPORTER and $IMPORTER from $SESSION $importrecord = (object) array('data' => array('importid' => $SESSION->get('importid'), 'extracted' => $SESSION->get('extracted'), 'mimetype' => $SESSION->get('mimetype'))); $TRANSPORTER = new LocalImporterTransport($importrecord); $importdata = (object) array('token' => '', 'usr' => $USER->get('id'), 'queue' => (int) false, 'ready' => 0, 'expirytime' => db_format_timestamp(time() + 60 * 60 * 24), 'format' => 'leap', 'loglevel' => PluginImportLeap::LOG_LEVEL_STANDARD, 'logtargets' => LOG_TARGET_FILE, 'profile' => true); $IMPORTER = PluginImport::create_importer(null, $TRANSPORTER, $importdata); try { $result = $IMPORTER->do_import_from_requests(); } catch (ImportException $e) { log_info("Leap2A import failed: " . $e->getMessage()); die_info(get_string('importfailed', 'import')); } $smarty = smarty(); $smarty->assign('PAGEHEADING', get_string('importresult', 'import')); $smarty->assign('form', $result); $smarty->display('form.tpl'); }
public final function handle_exception() { if (!empty($this->log)) { log_message($this->getMessage(), LOG_LEVEL_WARN, true, true, $this->getFile(), $this->getLine(), $this->getTrace()); } if (defined('JSON')) { // behave differently @header('Content-type: text/plain'); @header('Pragma: no-cache'); echo json_encode(array('error' => true, 'message' => $this->render_exception())); exit; } if (defined('TESTSRUNNING')) { exit; // let it be caught by phpunit } if (defined('CRON') || defined('CLI')) { echo $this->render_exception(); exit; } if (defined('XMLRPC')) { // it's preferable to throw an XmlrpcServerException echo xmlrpc_error($this->render_exception(), $this->getCode()); exit; } if (headers_sent()) { echo '<span style="color: red;">ERROR - something bad happened after headers have been sent. Check the error log for more information.</span>'; die; } $outputtitle = $this->get_string('title'); $outputmessage = trim($this->render_exception()); if (function_exists('smarty') && !$this instanceof ConfigSanityException) { try { $smarty = smarty(array(), array(), array(), array('sidebars' => false)); $smarty->assign('title', $outputtitle); $smarty->assign('message', $outputmessage); $smarty->display('error.tpl'); die; } catch (Exception $e) { // If an exception is thrown in smarty(), ignore it // and print the message out the ugly way log_warn("Exception thrown by smarty call while handling exception"); } } $outputtitle = htmlspecialchars($outputtitle, ENT_COMPAT, 'UTF-8'); $outputmessage = nl2br(htmlspecialchars($outputmessage, ENT_COMPAT, 'UTF-8')); echo <<<EOF <html> <head> <title>{$outputtitle}</title> <style type="text/css"> html { margin: 0; padding: 0; font-family: Arial, sans-serif; } body { width: 600px; margin: 100px auto; font-size: 12px; } h1 { color: #547c22; font-size: 20px; font-weight: normal; margin: 0 0 5px 0; padding: 0; text-transform: capitalize; border-bottom: 1px solid #819f18; text-align: center; } #message { width: 90%; margin: 0 auto; text-align: justify; } #reason { margin: 0 3em; } </style> </head> <body> EOF; echo <<<EOF <h1>{$outputtitle}</h1> <div id="message">{$outputmessage}</div> </body> </html> EOF; // end of printing stuff to the screen... die; }
* @author Catalyst IT Ltd * @license http://www.gnu.org/copyleft/gpl.html GNU GPL * @copyright (C) 2006-2008 Catalyst IT Ltd http://catalyst.net.nz * */ define('INTERNAL', 1); define('MENUITEM', 'myportfolio/blogs'); define('SECTION_PLUGINTYPE', 'artefact'); define('SECTION_PLUGINNAME', 'blog'); define('SECTION_PAGE', 'new'); require dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php'; define('TITLE', get_string('newblog', 'artefact.blog')); require_once 'pieforms/pieform.php'; safe_require('artefact', 'blog'); $form = pieform(array('name' => 'newblog', 'method' => 'post', 'action' => '', 'plugintype' => 'artefact', 'pluginname' => 'blog', 'elements' => array('title' => array('type' => 'text', 'title' => get_string('blogtitle', 'artefact.blog'), 'description' => get_string('blogtitledesc', 'artefact.blog'), 'rules' => array('required' => true)), 'description' => array('type' => 'wysiwyg', 'rows' => 10, 'cols' => 70, 'title' => get_string('blogdesc', 'artefact.blog'), 'description' => get_string('blogdescdesc', 'artefact.blog'), 'rules' => array('required' => false)), 'tags' => array('type' => 'tags', 'title' => get_string('tags'), 'description' => get_string('tagsdescprofile'), 'help' => true), 'submit' => array('type' => 'submitcancel', 'value' => array(get_string('createblog', 'artefact.blog'), get_string('cancel', 'artefact.blog')))))); $smarty =& smarty(); $smarty->assign_by_ref('newblogform', $form); $smarty->display('artefact:blog:new.tpl'); exit; /** * This function gets called to submit the new blog. * * @param array */ function newblog_submit(Pieform $form, $values) { global $USER; ArtefactTypeBlog::new_blog($USER, $values); redirect('/artefact/blog/'); } /**
$highlight = array($file); } $form = pieform(array('name' => 'editgoalsandskills', 'method' => 'post', 'jsform' => true, 'newiframeonsubmit' => true, 'jssuccesscallback' => 'editgoalsandskills_callback', 'jserrorcallback' => 'editgoalsandskills_callback', 'plugintype' => 'artefact', 'pluginname' => 'resume', 'configdirs' => array(get_config('libroot') . 'form/', get_config('docroot') . 'artefact/file/form/'), 'elements' => array('description' => array('type' => 'wysiwyg', 'title' => get_string('description', 'artefact.resume'), 'rows' => 20, 'cols' => 65, 'defaultvalue' => $artefact->get('description'), 'rules' => array('maxlength' => 65536)), 'filebrowser' => array('type' => 'filebrowser', 'title' => get_string('attachments', 'artefact.blog'), 'folder' => $folder, 'highlight' => $highlight, 'browse' => $browse, 'page' => get_config('wwwroot') . 'artefact/resume/editgoalsandskills.php?id=' . $artefact->get('id') . '&browse=1', 'browsehelp' => 'browsemyfiles', 'config' => array('upload' => true, 'uploadagreement' => get_config_plugin('artefact', 'file', 'uploadagreement'), 'resizeonuploaduseroption' => get_config_plugin('artefact', 'file', 'resizeonuploaduseroption'), 'resizeonuploaduserdefault' => $USER->get_account_preference('resizeonuploaduserdefault'), 'createfolder' => false, 'edit' => false, 'select' => true), 'defaultvalue' => $artefact->attachment_id_list(), 'selectlistcallback' => 'artefact_get_records_by_id', 'selectcallback' => 'add_resume_attachment', 'unselectcallback' => 'delete_resume_attachment'), 'artefacttype' => array('type' => 'hidden', 'value' => $artefact->get('artefacttype')), 'submitform' => array('type' => 'submitcancel', 'class' => 'btn-success', 'value' => array(get_string('save'), get_string('cancel')), 'goto' => get_config('wwwroot') . 'artefact/resume/goalsandskills.php')))); /* * Javascript specific to this page. Creates the list of files * attached to the resume goals or skills. */ $wwwroot = get_config('wwwroot'); $noimagesmessage = json_encode(get_string('noimageshavebeenattachedtothispost', 'artefact.blog')); $javascript = <<<EOF function editgoalsandskills_callback(form, data) { editgoalsandskills_filebrowser.callback(form, data); }; EOF; $smarty = smarty(array(), array(), array(), array('tinymceconfig' => ' plugins: "tooltoggle,textcolor,link,imagebrowser,table,emoticons,spellchecker,paste,code,fullscreen,directionality,searchreplace,nonbreaking,charmap", image_filebrowser: "editgoalsandskills_filebrowser", ', 'sideblocks' => array(array('name' => 'quota', 'weight' => -10, 'data' => array())))); $smarty->assign('INLINEJAVASCRIPT', $javascript); $smarty->assign('PAGEHEADING', TITLE); $smarty->assign('SUBPAGENAV', PluginArtefactResume::submenu_items()); $smarty->assign('subsectionheading', get_string('goalsandskills', 'artefact.resume')); $smarty->assign_by_ref('artefactform', $form); $smarty->assign('artefacttype', $type); $smarty->display('artefact:resume:editgoalsandskills.tpl'); function editgoalsandskills_submit(Pieform $form, array $values) { global $SESSION, $artefact, $USER; require_once 'embeddedimage.php'; $newdescription = EmbeddedImage::prepare_embedded_images($values['description'], $values['artefacttype'], $USER->get('id')); db_begin(); $artefact->set('title', get_string($values['artefacttype'], 'artefact.resume'));
/** * Creates and displays the transient login page. * * This login page remembers all GET/POST data and passes it on. This way, * users can have their sessions time out, and then can log in again without * losing any of their data. * * As this function builds and validates a login form, it is possible that * calling this may validate a user to be logged in. * * @param Pieform $form If specified, just build this form to get the HTML * required. Otherwise, this function will build and * validate the form itself. * @access private */ function auth_draw_login_page($message = null, Pieform $form = null) { global $USER, $SESSION; if ($form != null) { $loginform = get_login_form_js($form->build()); } else { require_once 'pieforms/pieform.php'; $loginform = get_login_form_js(pieform(auth_get_login_form())); /* * If $USER is set, the form was submitted even before being built. * This happens when a user's session times out and they resend post * data. The request should just continue if so. */ if ($USER->is_logged_in()) { return; } } $externallogin = get_config('externallogin'); if ($externallogin) { $externallogin = preg_replace('/{shorturlencoded}/', urlencode(get_relative_script_path()), $externallogin); $externallogin = preg_replace('/{wwwroot}/', get_config('wwwroot'), $externallogin); redirect($externallogin); } if ($message) { $SESSION->add_info_msg($message); } $smarty = smarty(array(), array(), array(), array('pagehelp' => false, 'sidebars' => false)); $smarty->assign('login_form', $loginform); $smarty->assign('PAGEHEADING', get_string('loginto', 'mahara', get_config('sitename'))); $smarty->assign('LOGINPAGE', true); $smarty->display('login.tpl'); exit; }
/** * * @package mahara * @subpackage artefact-resume * @author Catalyst IT Ltd * @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later * @copyright For copyright information on Mahara, please see the README file distributed with this software. * */ define('INTERNAL', true); define('MENUITEM', 'content/resume'); define('SECTION_PLUGINTYPE', 'artefact'); define('SECTION_PLUGINNAME', 'resume'); define('SECTION_PAGE', 'index'); define('RESUME_SUBPAGE', 'achievements'); require_once dirname(dirname(dirname(__FILE__))) . '/init.php'; define('TITLE', get_string('resume', 'artefact.resume')); require_once 'pieforms/pieform.php'; safe_require('artefact', 'resume'); if (!PluginArtefactResume::is_active()) { throw new AccessDeniedException(get_string('plugindisableduser', 'mahara', get_string('resume', 'artefact.resume'))); } $compositetypes = array('certification', 'book', 'membership'); $inlinejs = ArtefactTypeResumeComposite::get_js($compositetypes); $compositeforms = ArtefactTypeResumeComposite::get_forms($compositetypes); $smarty = smarty(array('tablerenderer', 'expandable')); $smarty->assign('compositeforms', $compositeforms); $smarty->assign('INLINEJAVASCRIPT', $inlinejs); $smarty->assign('PAGEHEADING', TITLE); $smarty->assign('SUBPAGENAV', PluginArtefactResume::submenu_items()); $smarty->display('artefact:resume:achievements.tpl');
$highlight = array($file); } $form = pieform(array('name' => 'editpost', 'method' => 'post', 'autofocus' => $focuselement, 'jsform' => true, 'newiframeonsubmit' => true, 'jssuccesscallback' => 'editpost_callback', 'jserrorcallback' => 'editpost_callback', 'plugintype' => 'artefact', 'pluginname' => 'blog', 'configdirs' => array(get_config('libroot') . 'form/', get_config('docroot') . 'artefact/file/form/'), 'elements' => array('blog' => array('type' => 'hidden', 'value' => $blog), 'blogpost' => array('type' => 'hidden', 'value' => $blogpost), 'title' => array('type' => 'text', 'title' => get_string('posttitle', 'artefact.blog'), 'rules' => array('required' => true), 'defaultvalue' => $title), 'description' => array('type' => 'wysiwyg', 'rows' => 20, 'cols' => 70, 'title' => get_string('postbody', 'artefact.blog'), 'description' => get_string('postbodydesc', 'artefact.blog'), 'rules' => array('maxlength' => 65536, 'required' => true), 'defaultvalue' => $description), 'tags' => array('defaultvalue' => $tags, 'type' => 'tags', 'title' => get_string('tags'), 'description' => get_string('tagsdesc'), 'help' => true), 'license' => license_form_el_basic(isset($blogpostobj) ? $blogpostobj : null), 'licensing_advanced' => license_form_el_advanced(isset($blogpostobj) ? $blogpostobj : null), 'filebrowser' => array('type' => 'filebrowser', 'title' => get_string('attachments', 'artefact.blog'), 'folder' => $folder, 'highlight' => $highlight, 'institution' => $institutionname, 'group' => $groupid, 'browse' => $browse, 'page' => get_config('wwwroot') . 'artefact/blog/post.php?' . ($blogpost ? 'id=' . $blogpost : 'blog=' . $blog) . '&browse=1', 'browsehelp' => 'browsemyfiles', 'config' => array('upload' => true, 'uploadagreement' => get_config_plugin('artefact', 'file', 'uploadagreement'), 'resizeonuploaduseroption' => get_config_plugin('artefact', 'file', 'resizeonuploaduseroption'), 'resizeonuploaduserdefault' => $USER->get_account_preference('resizeonuploaduserdefault'), 'createfolder' => false, 'edit' => false, 'select' => true), 'defaultvalue' => $attachments, 'selectlistcallback' => 'artefact_get_records_by_id', 'selectcallback' => 'add_attachment', 'unselectcallback' => 'delete_attachment'), 'draft' => array('type' => 'switchbox', 'title' => get_string('draft', 'artefact.blog'), 'description' => get_string('thisisdraftdesc', 'artefact.blog'), 'defaultvalue' => $checked, 'help' => true), 'allowcomments' => array('type' => 'switchbox', 'title' => get_string('allowcomments', 'artefact.comment'), 'description' => get_string('allowcommentsonpost', 'artefact.blog'), 'defaultvalue' => $blogpost ? $blogpostobj->get('allowcomments') : 1), 'submitpost' => array('type' => 'submitcancel', 'class' => 'btn-primary', 'value' => array(get_string('savepost', 'artefact.blog'), get_string('cancel')), 'goto' => get_config('wwwroot') . 'artefact/blog/view/index.php?id=' . $blog)))); /* * Javascript specific to this page. Creates the list of files * attached to the blog post. */ $wwwroot = get_config('wwwroot'); $noimagesmessage = json_encode(get_string('noimageshavebeenattachedtothispost', 'artefact.blog')); $javascript = <<<EOF function editpost_callback(form, data) { editpost_filebrowser.callback(form, data); }; EOF; $smarty = smarty(array(), array(), array(), array('tinymceconfig' => ' image_filebrowser: "editpost_filebrowser", ', 'sideblocks' => array(array('name' => 'quota', 'weight' => -10, 'data' => array())))); $smarty->assign('INLINEJAVASCRIPT', $javascript); $smarty->assign_by_ref('form', $form); $smarty->assign('PAGEHEADING', TITLE); if (!empty($subsectionheading)) { $smarty->assign('subsectionheading', $subsectionheading); } $smarty->display('artefact:blog:editpost.tpl'); /** * This function get called to cancel the form submission. It returns to the * blog list. */ function editpost_cancel_submit() { global $blog;
$function_list = array(); if ($functions) { foreach ($functions as $function) { $dbfunction = get_record('external_functions', 'name', $function->functionname); $function_list[] = '<a href="' . get_config('wwwroot') . 'webservice/wsdoc.php?id=' . $dbfunction->id . '">' . $function->functionname . '</a>'; } } $token_details['elements']['functions'] = array('title' => get_string('functions', 'auth.webservice'), 'value' => implode(', ', $function_list), 'type' => 'html'); $token_details['elements']['wssigenc'] = array('defaultvalue' => $dbtoken->wssigenc == 1 ? 'checked' : '', 'type' => 'checkbox', 'disabled' => false, 'title' => get_string('wssigenc', 'auth.webservice')); $token_details['elements']['publickey'] = array('type' => 'textarea', 'title' => get_string('publickey', 'admin'), 'defaultvalue' => $dbtoken->publickey, 'rows' => 15, 'cols' => 90); $token_details['elements']['publickeyexpires'] = array('type' => 'html', 'title' => get_string('publickeyexpires', 'admin'), 'value' => $dbtoken->publickeyexpires ? format_date($dbtoken->publickeyexpires, 'strftimedatetime', 'formatdate', 'auth.webservice') : format_date(time(), 'strftimedatetime', 'formatdate', 'auth.webservice')); $token_details['elements']['submit'] = array('type' => 'submitcancel', 'value' => array(get_string('save'), get_string('back')), 'goto' => get_config('wwwroot') . 'webservice/admin/index.php?open=webservices_token'); $elements = array('token_details' => array('type' => 'fieldset', 'legend' => get_string('tokenid', 'auth.webservice', $dbtoken->token), 'elements' => array('sflist' => array('type' => 'html', 'value' => pieform($token_details))), 'collapsible' => false)); $form = array('renderer' => 'table', 'type' => 'div', 'id' => 'maintable', 'name' => 'tokenconfig', 'jsform' => true, 'successcallback' => 'allocate_webservice_tokens_submit', 'validatecallback' => 'allocate_webservice_tokens_validate', 'elements' => $elements); $form = pieform($form); $smarty = smarty(array(), array('<link rel="stylesheet" type="text/css" href="' . $THEME->get_url('style/webservice.css', false, 'auth/webservice') . '">')); safe_require('auth', 'webservice'); $webservice_menu = PluginAuthWebservice::menu_items(MENUITEM); $smarty->assign('TERTIARYMENU', $webservice_menu); $smarty->assign('token', $dbtoken->token); $smarty->assign('form', $form); $heading = get_string('tokens', 'auth.webservice'); $smarty->assign('PAGEHEADING', $heading); $smarty->display('form.tpl'); function allocate_webservice_tokens_submit(Pieform $form, $values) { global $SESSION; $dbtoken = get_record('external_tokens', 'id', $values['tokenid']); if (empty($dbtoken)) { $SESSION->add_error_msg(get_string('invalidtoken', 'auth.webservice')); redirect('/webservice/admin/index.php?open=webservices_token');
} function delete_success(form, data) { addElementClass('postdetails_' + data.id, 'hidden'); if (\$('postfiles_' + data.id)) { addElementClass('postfiles_' + data.id, 'hidden'); } addElementClass('postdescription_' + data.id, 'hidden'); addElementClass('posttitle_' + data.id, 'hidden'); var results = \$j('#blogpost_pagination div.results').html(); var oldcount = parseInt(results, 10); var newcount = oldcount - 1; \$j('#blogpost_pagination div.results').html(results.replace(oldcount, newcount)); progressbarUpdate('blogpost', true); } EOF; $smarty = smarty(array('paginator')); setpageicon($smarty, 'icon icon-book'); $smarty->assign('PAGEHEADING', !empty($blog) ? $blog->get('title') : $title); if (!empty($institutionname)) { $smarty->assign('institution', $institutionname); if ($institutionname != 'mahara') { $smarty->assign('institutionselector', $s['institutionselector']); $js .= $s['institutionselectorjs']; } } $smarty->assign('INLINEJAVASCRIPT', $js); if ($institutionname) { require_once get_config('libroot') . 'institution.php'; $institution = new Institution($institutionname); $smarty->assign('institutiondisplayname', $institution->displayname); } else {
$merchant_notify_email = Yii::app()->functions->getOption("merchant_notify_email", $merchant_id); $enabled_alert_notification = Yii::app()->functions->getOption("enabled_alert_notification", $merchant_id); /*dump($merchant_notify_email); dump($enabled_alert_notification); */ if ($enabled_alert_notification == "") { $merchant_receipt_subject = Yii::app()->functions->getOption("merchant_receipt_subject", $merchant_id); $merchant_receipt_subject = empty($merchant_receipt_subject) ? t("New Order From") . " " . $data['full_name'] : $merchant_receipt_subject; $merchant_receipt_content = Yii::app()->functions->getMerchantReceiptTemplate($merchant_id); $final_tpl = ''; if (!empty($merchant_receipt_content)) { $merchant_token = Yii::app()->functions->getMerchantActivationToken($merchant_id); $confirmation_link = Yii::app()->getBaseUrl(true) . "/store/confirmorder/?id=" . $data['order_id'] . "&token={$merchant_token}"; $final_tpl = smarty('receipt-number', Yii::app()->functions->formatOrderNumber($data['order_id']), $merchant_receipt_content); $final_tpl = smarty('customer-name', $data['full_name'], $final_tpl); $final_tpl = smarty('receipt', $receipt, $final_tpl); $final_tpl = smarty('confirmation-link', $confirmation_link, $final_tpl); } else { $final_tpl = $tpl; } $global_admin_sender_email = Yii::app()->functions->getOptionAdmin('global_admin_sender_email'); if (empty($global_admin_sender_email)) { $global_admin_sender_email = $receipt_sender; } // fixed if email is multiple $merchant_notify_email = explode(",", $merchant_notify_email); if (is_array($merchant_notify_email) && count($merchant_notify_email) >= 1) { foreach ($merchant_notify_email as $merchant_notify_email_val) { sendEmail(trim($merchant_notify_email_val), $global_admin_sender_email, $merchant_receipt_subject, $final_tpl); } } }