本文整理汇总了PHP中template_simple函数的典型用法代码示例。如果您正苦于以下问题:PHP template_simple函数的具体用法?PHP template_simple怎么用?PHP template_simple使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了template_simple函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sitefaq_virtual_add_faq
function sitefaq_virtual_add_faq(&$obj)
{
return template_simple('<a href="{site/prefix}/index/cms-add-form?collection=sitefaq_question&question={filter urlencode}{question}&answer={answer}{end filter}">
<img src="{site/prefix}/inc/app/sitefaq/pix/add.gif" border="0"
alt="{intl Add to live FAQs}"
title="{intl Add to live FAQs}" /></a>', $obj);
}
示例2: onSubmit
function onSubmit($vals)
{
// 1. prepare vals for insertion
if ($vals['contact_url'] == 'http://') {
$vals['contact_url'] = '';
}
if ($vals['loc_map'] == 'http://') {
$vals['loc_map'] = '';
}
$vals['details'] = nl2br(wordwrap(htmlentities_compat($vals['details']), 70, "\n", true));
if (!$vals['public'] || empty($vals['public'])) {
$vals['public'] = 'no';
}
if (!$vals['media'] || empty($vals['media'])) {
$vals['media'] = 'no';
}
if (!empty($vals['loc_addr2'])) {
$vals['loc_address'] .= "\n" . $vals['loc_addr2'];
}
$data = array('title' => $vals['title'], 'date' => $vals['date'], 'until_date' => $vals['end_date'], 'time' => $vals['time'], 'until_time' => $vals['end_time'], 'category' => $vals['category'], 'audience' => $vals['audience'], 'details' => $vals['details'], 'contact' => $vals['contact'], 'contact_email' => $vals['contact_email'], 'contact_phone' => $vals['contact_phone'], 'contact_url' => $vals['contact_url'], 'loc_name' => $vals['loc_name'], 'loc_address' => $vals['loc_address'], 'loc_city' => $vals['loc_city'], 'loc_province' => $vals['loc_province'], 'loc_country' => $vals['loc_country'], 'sponsor' => $vals['sponsor'], 'rsvp' => $vals['rsvp'], 'public' => $vals['public'], 'media' => $vals['media'], 'sitellite_status' => 'draft', 'sitellite_access' => 'public');
if (session_valid()) {
$data['sitellite_owner'] = session_username();
$data['sitellite_team'] = session_team();
}
// 2. submit event as 'draft'
loader_import('cms.Versioning.Rex');
$rex = new Rex('siteevent_event');
$res = $rex->create($data, 'Event submission.');
$vals['id'] = $res;
// 3. email notification
@mail(appconf('submissions'), 'Event Submission Notice', template_simple('submission_email.spt', $vals));
// 4. thank you screen
page_title(intl_get('Thank You!'));
echo template_simple('submissions.spt');
}
示例3: onSubmit
function onSubmit($vals)
{
global $cgi;
if ($vals['submit_buttons'] == 'Cancel') {
header('Location: ' . $vals['refer']);
exit;
}
loader_import('cms.Versioning.Rex');
$rex = new Rex('siteblog_post');
$id = $cgi->_key;
$subject = $vals['subject'];
$author = $vals['author'];
$status = $vals['status'];
$category = $vals['category'];
$created = $vals['created'];
$body = $vals['body'];
$data = array('subject' => $subject, 'author' => $author, 'status' => $status, 'category' => $category, 'created' => $created, 'body' => $body);
if (!empty($id)) {
if (!$data['created']) {
unset($data['created']);
}
$method = $rex->determineAction($id);
$rex->{$method}($id, $data);
} else {
if (!$data['created']) {
$data['created'] = date('Y-m-d H:i:s');
}
$id = $rex->create($data);
}
session_set('sitellite_alert', intl_get('Your item has been saved.'));
// view post
if (!empty($vals['_return'])) {
header('Location: ' . $vals['_return']);
} else {
header('Location: ' . site_prefix() . '/index/siteblog-post-action/id.' . $id . '/title.' . siteblog_filter_link_title($subject));
}
// ping blog directories via pingomatic.com
$host = 'rpc.pingomatic.com';
$path = '';
$out = template_simple('ping.spt', $obj);
$len = strlen($out);
$req = 'POST /' . $path . " HTTP/1.0\r\n";
$req .= 'User-Agent: Sitellite ' . SITELLITE_VERSION . "/SiteBlog\r\n";
$req .= 'Host: ' . $host . "\r\n";
$req .= "Content-Type: text/xml\r\n";
$req .= 'Content-Length: ' . $len . "\r\n\r\n";
$req .= $out . "\r\n";
if ($ph = @fsockopen($host, 80)) {
@fputs($ph, $req);
//echo '<pre>';
//echo htmlentities ($req);
while (!@feof($ph)) {
$res = @fgets($ph, 128);
//echo htmlentities ($res);
}
@fclose($ph);
}
exit;
}
示例4: onSubmit
function onSubmit($vals)
{
$i = $vals['ifname'];
unset($vals['ifname']);
unset($vals['submit_button']);
echo template_simple('link_return.spt', array('ifname' => $i, 'vals' => $vals));
exit;
}
示例5: sitepresenter_virtual_run
function sitepresenter_virtual_run($row)
{
return template_simple('<a href="{site/prefix}/index/sitepresenter-presentation-action?id={id}" target="_blank"><img
src="{site/prefix}/inc/app/sitepresenter/pix/run.gif" alt="{intl Run}" title="{intl Run}" border="0" /></a>
<a href="{site/prefix}/index/sitepresenter-slides-action?id={id}"><img
src="{site/prefix}/inc/app/sitepresenter/pix/slides.gif" alt="{intl Edit Slides}" title="{intl Edit Slides}" border="0" /></a>', $row);
}
示例6: cms_alert
/**
* Shows a notice (e.g., "Item deleted.") if one is set.
*/
function cms_alert()
{
if (!cms_is_alert()) {
return '';
}
$notice = session_get('sitellite_alert');
session_set('sitellite_alert', null);
return template_simple('alert.spt', array('msg' => $notice));
}
示例7: onSubmit
function onSubmit($vals)
{
loader_import('news.Comment');
$c = new NewsComment();
$vals['ts'] = date('Y-m-d H:i:s');
unset($vals['submit_button']);
$c->modify($vals['id'], $vals);
page_title(intl_get('Comment Updated'));
echo template_simple('comment_updated.spt', $vals);
}
示例8: onSubmit
function onSubmit($vals)
{
loader_import('sitepoll.Comment');
$c = new SitepollComment();
$vals['ts'] = date('Y-m-d H:i:s');
unset($vals['submit_button']);
$c->add($vals);
$ce = appconf('comments_email');
if ($ce) {
@mail($ce, intl_get('Poll Comment Notice'), template_simple('comment_email.spt', $vals), 'From: ' . 'sitepoll@' . site_domain());
}
page_title(intl_get('Comment Added'));
echo template_simple('comment_added.spt', $vals);
}
示例9: onSubmit
function onSubmit($vals)
{
loader_import('siteforum.Post');
loader_import('siteforum.Filters');
loader_import('siteforum.Topic');
$p = new SiteForum_Post();
if (!$p->modify($vals['id'], array('subject' => $vals['subject'], 'body' => $vals['body']))) {
page_title(intl_get('Database Error'));
echo '<p>' . intl_get('An error occurred. Please try again later.') . '</p>';
echo '<p>' . intl_get('Error Message') . ': ' . $p->error . '</p>';
return;
}
$post = $p->get($vals['id']);
page_title(intl_get('Post Updated'));
echo template_simple('post_updated.spt', $post);
}
示例10: onSubmit
function onSubmit($vals)
{
$vals['public'] = $vals['public'] ? 'yes' : 'no';
if ($vals['website'] == 'http://') {
$vals['website'] = '';
}
// 1. update sitellite_user
$res = session_user_edit(session_username(), array('firstname' => $vals['firstname'], 'lastname' => $vals['lastname'], 'company' => $vals['company'], 'website' => $vals['website'], 'country' => $vals['country'], 'province' => $vals['province'], 'email' => $vals['email'], 'expires' => date('Y-m-d H:i:s', time() + 3600), 'public' => $vals['public'], 'profile' => $vals['profile'], 'sig' => $vals['sig'], 'modified' => date('Y-m-d H:i:s')));
if (!$res) {
page_title('Unknown Error');
echo '<p>' . intl_get('An error occurred while updating your account. Please try again later.') . '</p>';
return;
}
// 2. respond
page_title(intl_get('Preferences Saved'));
echo template_simple('<p>Your account information been updated. <a href="{site/prefix}/index/sitemember-app">{intl Click here to continue.}</a></p>');
}
示例11: onSubmit
function onSubmit($vals)
{
if ($this->parameters['save'] == 'yes') {
// save to sitellite_form_submission table
$parts = explode(' ', $vals['name']);
$first = array_shift($parts);
$last = join(' ', $parts);
db_execute('insert into sitellite_form_submission values (null, ?, now(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', 1, 'Contact Form', $_SERVER['REMOTE_ADDR'], null, null, null, $first, $last, $vals['from'], null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, $vals['message']);
}
if (!@mail($this->parameters['email'], '[' . site_domain() . '] ' . intl_get('Contact Form'), template_simple('util_contact_email.spt', $vals), 'From: ' . $vals['name'] . ' <' . $vals['from'] . '>')) {
page_title(intl_get('An Error Occurred'));
echo '<p>' . intl_get('Our apologies, your message failed to be sent. Please try again later.') . '</p>';
return;
}
page_title(intl_get('Thank You'));
echo template_simple('util_contact_thanks.spt');
}
示例12: onSubmit
function onSubmit($vals)
{
// 1. add author if necessary
if (!db_shift('select * from sitellite_news_author where name = ?', $vals['author'])) {
db_execute('insert into sitellite_news_author (name) values (?)', $vals['author']);
}
// 2. submit story as 'draft'
loader_import('cms.Versioning.Rex');
$rex = new Rex('sitellite_news');
$res = $rex->create(array('title' => $vals['title'], 'author' => $vals['author'], 'category' => $vals['category'], 'summary' => $vals['summary'], 'body' => $vals['body'], 'date' => date('Y-m-d'), 'sitellite_status' => 'draft', 'sitellite_access' => 'public'), 'Story submission.');
$vals['id'] = $res;
// 3. email notification
@mail(appconf('submissions'), 'News Submission Notice', template_simple('submission_email.spt', $vals));
// 4. thank you screen
page_title(intl_get('Thank You!'));
echo template_simple('submissions.spt');
}
示例13: onSubmit
function onSubmit($vals)
{
// your handler code goes here
chdir('inc/html');
$out = shell_exec('../app/devtools/bin/tpl.sh ' . escapeshellarg($vals['setname']));
chdir('../..');
if (trim($out) == 'Your template set is ready, sir.') {
chdir('inc/html');
shell_exec('umask 0000; chmod -R 0777 ' . escapeshellarg($vals['setname']));
chdir('../..');
page_title(intl_get('Template Set Created'));
echo template_simple('tpl_created.spt', $vals);
} else {
page_title(intl_get('An Error Occurred'));
echo template_simple('error.spt', array('msg' => $out));
}
}
示例14: SitewikiEditForm
function SitewikiEditForm()
{
parent::MailForm(__FILE__);
$level = 0;
if (session_valid()) {
$level++;
}
if (session_admin()) {
$level++;
}
global $cgi;
$res = db_fetch('select * from sitewiki_page where id = ?', $cgi->page);
if (!$res) {
$this->widgets['submit_button']->buttons[1]->extra = 'onclick="window.location.href = \'' . site_prefix() . '/index/sitewiki-edit-form?page=' . $cgi->page . '&unlock=1&ret=' . urlencode($_SERVER['HTTP_REFERER']) . '\'; return false"';
if ($level >= appconf('default_edit_level')) {
$this->new_page = true;
} else {
echo template_simple('not_visible.spt');
$this->editable = false;
return;
}
$this->widgets['view_level']->setValue(appconf('default_view_level'));
$this->widgets['edit_level']->setValue(appconf('default_edit_level'));
} else {
$this->widgets['submit_button']->buttons[1]->extra = 'onclick="window.location.href = \'' . site_prefix() . '/index/sitewiki-edit-form?page=' . $cgi->page . '&unlock=1\'; return false"';
if ($level < $res->edit_level) {
echo template_simple('not_visible.spt');
$this->editable = false;
return;
} else {
$this->widgets['body']->setValue($res->body);
$this->widgets['view_level']->setValue($res->view_level);
$this->widgets['edit_level']->setValue($res->edit_level);
}
}
if (!appconf('security_test')) {
unset($this->widgets['security_test']);
}
if (!session_valid()) {
unset($this->widgets['files']);
unset($this->widgets['file_1']);
unset($this->widgets['file_2']);
unset($this->widgets['file_3']);
}
}
示例15: onSubmit
function onSubmit($vals)
{
$vals['public'] = $vals['public'] ? 'yes' : 'no';
if ($vals['website'] == 'http://') {
$vals['website'] = '';
}
$session_id = session_make_pending_key();
$vals['verify'] = str_replace('PENDING:', '', $session_id);
// 1. insert into sitellite_user
$res = db_execute('
insert into sitellite_user
(username, password, firstname, lastname, company, website, country, province, email, session_id, role, team)
values
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $vals['user_id'], better_crypt($vals['password']), $vals['firstname'], $vals['lastname'], $vals['company'], $vals['website'], $vals['country'], $vals['province'], $vals['email'], $session_id, 'member', 'core');
if (!$res) {
page_title('Unknown Error');
echo '<p>An error occurred while creating your account. Please try again later.</p>';
echo '<p>Error Message: ' . db_error() . '</p>';
return;
}
// 2. insert into org_profile
/*db_execute (
'insert into org_profile
(user_id, public, about, sig)
values
(?, ?, ?, ?)',
$vals['user_id'],
$vals['public'],
$vals['about'],
$vals['sig']
);*/
// 3. email confirmation
@mail($vals['email'], 'Membership Confirmation', template_simple('member_confirmation.spt', $vals), 'From: ' . appconf('email'));
// 4. log them in
//global $cgi, $session;
//$cgi->username = $cgi->user_id;
//$session->username = $cgi->user_id;
//$session->password = $cgi->password;
//$session->start ();
// 5. respond
page_title(intl_get('Welcome') . ' ' . $vals['firstname'] . ' ' . $vals['lastname']);
echo '<p>Your account has been created. An email has also been sent to your address containing information necessary to activate your account.</p>';
}