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'); }
function sitegallery_get_thumbnail($file, $file_store = false) { $full_path = sitegallery_get_path($file, $file_store); $info = pathinfo($full_path); $ext = strtolower($info['extension']); if (!sitegallery_can_resize($ext)) { return sitegallery_url_path($file, $file_store); } $save_to = md5($file) . '.' . $ext; $save_path = 'inc/app/sitegallery/data/'; if (@file_exists($save_path . $save_to) && @filemtime($full_path) <= @filemtime($save_path . $save_to)) { return site_prefix() . '/inc/app/sitegallery/pix/thumbnails/' . $save_to; } list($w, $h) = getimagesize($full_path); $width = appconf('thumbnail_width'); $height = appconf('thumbnail_height'); if ($h > $w) { // cropping the height $hoffset = ($h - $w) / 2; $woffset = 0; $h -= $hoffset * 2; } else { // cropping the width $woffset = ($w - $h) / 2; $hoffset = 0; $w -= $woffset * 2; } $jpg = @imagecreatefromjpeg($full_path); $new = @imagecreatetruecolor($width, $height); @imagecopyresampled($new, $jpg, 0, 0, $woffset, $hoffset, $width, $height, $w, $h); @imagejpeg($new, 'inc/app/sitegallery/pix/thumbnails/' . $save_to); @imagedestroy($jpg); @imagedestroy($new); return site_prefix() . '/inc/app/sitegallery/pix/thumbnails/' . $save_to; }
function SitefaqEditForm() { parent::MailForm(); global $page, $cgi; $this->extra = 'id="cms-edit-form"'; // get copy from repository loader_import('cms.Versioning.Rex'); $rex = new Rex($cgi->_collection); // default: database, database $_document = $rex->getCurrent($cgi->_key); $widgets = $rex->getStruct(); if (!$widgets) { $widgets = array(); } // edit widgets go here $this->widgets = array_merge($this->widgets, $widgets); foreach ($this->widgets as $k => $v) { if (isset($_document->{$k})) { $this->widgets[$k]->setValue($_document->{$k}); } } $w =& $this->addWidget('hidden', '_key'); $w =& $this->addWidget('hidden', '_collection'); $w =& $this->addWidget('hidden', '_return'); if ($rex->isVersioned) { $t =& $this->addWidget('textarea', 'changelog'); $t->alt = intl_get('Change Summary'); $t->rows = 3; $t->labelPosition = 'left'; $t->extra = 'id="changelog"'; } // submit buttons $w =& $this->addWidget('msubmit', 'submit_button'); $b =& $w->getButton(); $b->setValues(intl_get('Save')); $b =& $w->addButton('submit_button', intl_get('Cancel')); $b->extra = 'onclick="return cms_cancel (this.form)"'; $this->error_mode = 'all'; if ($rex->info['Collection']['singular']) { page_title(intl_get('Editing') . ' ' . $rex->info['Collection']['singular'] . ': ' . $_document->{$rex->key}); } else { page_title(intl_get('Editing Item') . ': ' . $_document->{$rex->key}); } // the SiteFAQ additions: if (appconf('user_anonymity')) { unset($this->widgets['name']); unset($this->widgets['email']); unset($this->widgets['url']); unset($this->widgets['ip']); unset($this->widgets['member_id']); } $admin_roles = session_admin_roles(); $this->widgets['assigned_to']->setValues(db_pairs('select username, concat(lastname, ", ", firstname, " (", username, ")") from sitellite_user where role in("' . join('", "', $admin_roles) . '") order by lastname, firstname, username')); if (!$_document->assigned_to) { $this->widgets['assigned_to']->setValue(session_username()); } }
function pspell_new($language) { _pspell_set('language', $language); if (appconf('pspell_location')) { _pspell_set('aspell', appconf('pspell_location')); } return true; }
function MF_Widget_xeditor($name) { parent::MF_Widget($name); if (@file_exists('inc/app/xed/conf/properties.php')) { include 'inc/app/xed/conf/properties.php'; if (appconf('pspell_location')) { $this->spellchecker = 'true'; } } }
function ysearch_filter_title($t) { foreach (appconf('titles') as $title) { if (strpos($t, $title) === 0) { $t = substr($t, strlen($title)); if (strlen($t) == 0) { return 'Untitled'; } return $t; } } return $t; }
function SitefaqSubmissionForm() { parent::MailForm(); $this->parseSettings('inc/app/sitefaq/forms/submission/settings.php'); page_title(intl_get('Ask a Question')); if (!appconf('user_details')) { unset($this->widgets['name']); unset($this->widgets['age']); unset($this->widgets['url']); } if (appconf('user_email_not_required')) { array_shift($this->widgets['email']->rules); } }
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); }
function sitegallery_first_image($path) { loader_import('saf.File.Directory'); $valid = appconf('valid'); $files = Dir::fetch($path, true); foreach ($files as $file) { $info = pathinfo($file); if (in_array($info['extension'], $valid)) { $path = preg_replace('|^pix/|', '', $path); return $path . '/' . $file; } } return false; }
function verifyType($type) { $allowed = appconf('allowed'); if (count($allowed) > 0) { if (!in_array($type, $allowed)) { return false; } } $not = appconf('not_allowed'); if (count($not) > 0) { if (in_array($type, $not)) { return false; } } return true; }
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'); }
function SettingsForm() { parent::MailForm(); $this->parseSettings('inc/app/devnotes/forms/settings/settings.php'); $this->widgets['notes']->setValues(array('on' => intl_get('On'), 'off' => intl_get('Off'), 'date' => intl_get('Until date'))); $this->widgets['submit_button']->setValues(intl_get('Save Changes')); $this->widgets['notes_date']->setValue(date('Y-m-d')); if (DEVNOTES === true) { $this->widgets['notes']->setValue('on'); } elseif (DEVNOTES === false) { $this->widgets['notes']->setValue('off'); } else { $this->widgets['notes']->setValue('date'); $this->widgets['notes_date']->setValue(DEVNOTES); } $this->widgets['contact']->setValue(appconf('contact')); $this->widgets['ignore_list']->setValue(join(', ', appconf('ignore'))); }
function onSubmit($vals) { ob_start(); passthru(appconf('wvhtml_location') . ' --targetdir=cache ' . escapeshellarg($vals['doc']->tmp_name) . ' -'); $html = ob_get_contents(); ob_end_clean(); list($one, $two) = explode('<!--Section Begins-->', $html); list($two, $three) = explode('<!--Section Ends-->', $two); loader_import('saf.HTML.Messy'); $messy = new Messy(); $two = $messy->clean($two); //echo '<pre>' . htmlentities ($two); exit; $two = str_replace('<p><div', '<div', $two); $two = str_replace('</div></p>', '</div>', $two); $vals['doc'] = $two; echo template_simple('importer.spt', $vals); exit; }
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>'; }
function vote($score, $id) { $ip = $_SERVER['REMOTE_ADDR']; $user = session_username(); if (!$user) { $user = '******'; } if ($score == 'yes') { db_execute('UPDATE digger_linkstory SET score = score + 1 WHERE id = ?', $id); db_execute('INSERT INTO digger_vote (id, story, score, user, ip, votetime) VALUES (null, ?, 1, ?, ?, NOW())', $id, $user, $ip); } else { db_execute('UPDATE digger_linkstory SET score=score-1 WHERE id = ?', $id); db_execute('INSERT INTO digger_vote (id, story, score, user, ip, votetime) VALUES (null, ?, -1, ?, ?, NOW())', $id, $user, $ip); $score = db_shift('select score from digger_linkstory where id = ?', $id); if ($score <= appconf('ban_threshold')) { db_execute('update digger_linkstory set status = "disabled" where id = ?', $id); } } return true; }
function onSubmit($vals) { if (intl_lang() == intl_default_lang()) { $ps1 = new PropertySet('sitegallery', 'album_title'); $ps2 = new PropertySet('sitegallery', 'album_description'); $ps3 = new PropertySet('sitegallery', 'album_date'); } else { $ps1 = new PropertySet('sitegallery', 'album_title_' . intl_lang()); $ps2 = new PropertySet('sitegallery', 'album_description_' . intl_lang()); $ps3 = new PropertySet('sitegallery', 'album_date'); } $ps1->set($vals['album'], $vals['title']); $ps2->set($vals['album'], $vals['description']); $ps3->set($vals['album'], $vals['date']); if (appconf('page_alias')) { header('Location: ' . site_prefix() . '/index/' . appconf('page_alias')); exit; } header('Location: ' . site_prefix() . '/index/sitegallery-app'); exit; }
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 = session_user_add(array('username' => $vals['user_id'], 'password' => better_crypt($vals['password']), 'firstname' => $vals['firstname'], 'lastname' => $vals['lastname'], 'company' => $vals['company'], 'website' => $vals['website'], 'country' => $vals['country'], 'province' => $vals['province'], 'email' => $vals['email'], 'session_id' => $session_id, 'role' => 'member', 'team' => 'none', 'public' => $vals['public'], 'profile' => $vals['about'], 'sig' => $vals['sig'], 'registered' => date('Y-m-d H:i:s'), 'modified' => date('Y-m-d H:i:s'))); if (!$res) { page_title('Unknown Error'); echo '<p>An error occurred while creating your account. Please try again later.</p>'; return; } // 2. email confirmation @mail($vals['email'], 'Membership Confirmation', template_simple('register_confirmation.spt', $vals), 'From: ' . appconf('email')); // 3. 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>'; }
function EditPageForm() { parent::MailForm(); global $page; $this->extra = 'id="cms-edit-form" onsubmit="xed_copy_value (this, \'body\')"'; $t =& $this->addWidget('text', 'title'); $t->alt = intl_get('Page Title'); $t->addRule('not empty', 'You must enter a title for your page.'); $t->extra = 'size="40"'; $w =& $this->addWidget('xed.Widget.Xeditor', 'body'); if (appconf('tidy_path')) { $w->tidy_path = appconf('tidy_path'); } $w->addRule('not empty', 'You must enter content into your page body.'); //global $cgi; //$res = db_fetch ('select title, body from sitellite_page where id = ?', $cgi->id); //if (! $res) { // header ('Location: /index'); // exit; //} global $_document; $t->setValue($_document->title); $w->setValue($_document->body); page_title('Sitellite - Editing Page: ' . $res->title); //$this->title = 'Sitellite - Editing Page: ' . $res->title; $w =& $this->addWidget('hidden', 'id'); /* $w =& $this->addWidget ('msubmit', 'submit_button'); $b =& $w->getButton (); $b->setValues ('Save'); $b =& $w->addButton ('submit_button', 'Preview'); $b->extra = 'onclick="return cms_preview (this.form)"'; $b =& $w->addButton ('submit_button', 'Cancel'); $b->extra = 'onclick="return cms_cancel (this.form)"'; */ }
function onSubmit($vals) { $ak = appconf('akismet_key'); if ($ak) { loader_import('siteblog.Akismet'); $comment = array('author' => $vals['name'], 'email' => $vals['email'], 'website' => $vals['url'], 'body' => $vals['body'], 'permalink' => site_url() . '/index/siteblog-post-action/id.' . $vals['post'] . '/title.' . siteblog_filter_link_title($title), 'user_ip' => $_SERVER['REMOTE_ADDR'], 'user_agent' => $_SERVER['HTTP_USER_AGENT']); $akismet = new Akismet(site_url(), $ak, $comment); if (!$akismet->errorsExist()) { // no errors if ($akismet->isSpam()) { // akismet says spam $title = db_shift('select subject from siteblog_post where id = ?', $vals['post']); db_execute('insert into siteblog_akismet values (null, ?, now(), ?, ?, ?, ?, ?, ?)', $vals['post'], $comment['author'], $comment['email'], $comment['website'], $comment['user_ip'], $comment['user_agent'], $comment['body']); header('Location: ' . site_prefix() . '/index/siteblog-post-action/id.' . $vals['post'] . '/title.' . siteblog_filter_link_title($title)); exit; } } } if (!empty($vals['post'])) { $res = db_execute('insert into siteblog_comment (id, child_of_post, body, date, author, email, url, ip) values (null, ?, ?, now(), ?, ?, ?, ?)', $vals['post'], $vals['body'], $vals['name'], $vals['email'], $vals['url'], $_SERVER['REMOTE_ADDR']); if (!$res) { die(db_error()); } $id = db_lastid(); } else { $res = db_execute('update siteblog_comment set body = ?, author = ?, email = ?, url = ? where id = ?', $vals['body'], $vals['name'], $vals['email'], $vals['url'], $vals['_key']); if (!$res) { die(db_error()); } $id = $vals['_key']; $vals['post'] = db_shift('select child_of_post from siteblog_comment where id = ?', $vals['_key']); } $title = db_shift('select subject from siteblog_post where id = ?', $vals['post']); header('Location: ' . site_prefix() . '/index/siteblog-post-action/id.' . $vals['post'] . '/title.' . siteblog_filter_link_title($title) . '#siteblog-comment-' . $id); exit; }
function Footer() { $this->SetY(-15); $this->SetDrawColor(90, 90, 90); $this->Line(15, 278, 195, 278); $this->SetFont('Arial', '', 9); $this->SetTextColor(150, 150, 150); $this->Cell(0, 0, chr(169) . ' ' . appconf('company_name') . ', ' . date('Y') . ' For further information, visit us online at ' . appconf('company_website'), 0, 0, 'R'); $this->SetTextColor(0); }
function sitewiki_filter_date($date) { return Date::format($date, appconf('date_format')); }
} else { $show_domains = false; } $enc = urlencode($cgi->query); foreach (array_keys($results) as $key) { if (!in_array($results[$key]['ctype'], $sitesearch_highlight)) { continue; } if (strstr($results[$key]['url'], '?')) { $results[$key]['url'] .= '&highlight=' . $enc; } else { $results[$key]['url'] .= '?highlight=' . $enc; } } loader_import('saf.GUI.Pager'); $pg = new Pager($cgi->offset, appconf('limit')); if ($parameters['multiple'] == 'yes') { $t = ''; if (is_array($parameters['ctype'])) { foreach ($parameters['ctype'] as $ct) { $t .= '&ctype[]=' . urlencode($ct); } } $d = ''; if (is_array($parameters['domains'])) { foreach ($parameters['domains'] as $ds) { $d .= '&domains[]=' . $ds; } } } else { $t = '&ctype=' . urlencode($parameters['ctype']);
<td colspan="5" align="right">Currency</td> <td><select name="currency"> <?php foreach (appconf('currencies') as $currency) { if ($currency == appconf('default_currency')) { $sel = ' selected="selected"'; } else { $sel = ''; } echo TABx3 . sprintf('<option value="%s"%s>%s</option>', $currency, $sel, $currency); } ?> </select></td> </tr> <?php foreach (appconf('taxes') as $tax => $percent) { ?> <tr> <th colspan="5" align="right"><?php echo $tax; ?> </th> <td><select name="<?php echo $tax; ?> "> <option value="yes">Yes</option> <option value="no">No</option> </select></td> </tr> <?php
<?php if (session_admin()) { $acl = session_allowed_sql(); } else { $acl = session_approved_sql(); } $res = db_fetch_array('select name, display_title, extension, description from sitellite_filesystem where path = ? and ' . $acl . ' order by name asc', $parameters['path']); $valid = appconf('valid'); foreach (array_keys($res) as $k) { if (!in_array(strtolower($res[$k]->extension), $valid)) { unset($res[$k]); } } if ($parameters['title']) { if ($box['context'] == 'action') { page_title($parameters['title']); } else { echo '<h2>' . $parameters['title'] . '</h2>'; } } page_add_script(site_prefix() . '/js/rollover.js'); template_simple_register('results', $res); template_simple_register('first', array_shift($res)); echo template_simple('slideshow.spt', array('path' => $parameters['path'], 'total' => count($res) + 1, 'desc' => $parameters['descriptions'], 'delay' => $parameters['delay']));
$limit = appconf('limit'); $q = db_query('SELECT * FROM digger_linkstory WHERE status = "enabled" ' . $cat . ' ORDER BY posted_on desc, score desc'); if ($q->execute()) { $total = $q->rows(); $res = $q->fetch($cgi->offset, $limit); $q->free(); } else { die($q->error()); } // has voted? foreach (array_keys($res) as $k) { if (digger_has_voted($res[$k]->id)) { $res[$k]->voted = 'style="display: none"'; } } // pager loader_import('saf.GUI.Pager'); $pg = new Pager($cgi->offset, $limit, $total); $pg->setUrl(site_prefix() . '/index/digger-app?category=' . $cgi->category); $pg->getInfo(); // output if (!empty($cgi->category)) { page_title(appconf('digger_title') . ' - ' . db_shift('select category from digger_category where id = ?', $cgi->category)); } else { page_title(appconf('digger_title')); } template_simple_register('pager', $pg); echo template_simple('index.spt', array('category' => $cgi->category, 'results' => $res, 'banned_score' => appconf('ban_threshold')));
$this->parseSettings('inc/app/siteforum/forms/topic/edit/settings.php'); global $cgi; page_title(intl_get('Editing Topic') . ': ' . $cgi->id); loader_import('siteforum.Topic'); $t = new SiteForum_Topic(); $topic = $t->get($cgi->id); if (!$topic) { header('Location: ' . site_prefix() . '/index/siteforum-app'); exit; } unset($topic->sitellite_owner); unset($topic->sitellite_team); foreach (get_object_vars($topic) as $k => $v) { $this->widgets[$k]->setValue($v); } } function onSubmit($vals) { loader_import('siteforum.Topic'); loader_import('siteforum.Post'); $t = new SiteForum_Topic(); $t->modify($vals['id'], array('name' => $vals['name'], 'description' => $vals['description'], 'sitellite_access' => $vals['sitellite_access'], 'sitellite_status' => $vals['sitellite_status'])); $p = new SiteForum_Post(); $p->modify(array('topic_id' => $vals['id']), array('sitellite_access' => $vals['sitellite_access'], 'sitellite_status' => $vals['sitellite_status'])); header('Location: ' . site_prefix() . '/index/siteforum-app'); exit; } } if (appconf('template')) { page_template(appconf('template')); }
function petition_filter_province($prov) { $list = appconf('provinces'); return $list[$prov]; }
<?php // BEGIN KEEPOUT CHECKING // Add these lines to the very top of any file you don't want people to // be able to access directly. if (!defined('SAF_VERSION')) { header('HTTP/1.1 404 Not Found'); echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n" . "<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n" . "The requested URL " . $PHP_SELF . " was not found on this server.<p>\n<hr>\n" . $_SERVER['SERVER_SIGNATURE'] . "</body></html>"; exit; } // END KEEPOUT CHECKING $on = appconf('logout'); if (!$on) { header('Location: ' . site_prefix() . '/index/sitemember-app'); exit; } elseif ($on != 'box:sitemember/logout') { list($type, $call) = split(':', $on); $func = 'loader_' . $type; echo $func(trim($call), array(), $context); return; } global $session; loader_import('cms.Workflow.Lock'); lock_init(); lock_clear(); $session->close(); if (!empty($parameters['goto'])) { header('Location: ' . site_prefix() . '/index/' . $parameters['goto']); } else { header('Location: ' . site_prefix() . '/index'); }
$event->_details = false; } switch ($event->recurring) { case 'yearly': $event->recur = intl_get('Yearly'); break; case 'monthly': $event->recur = intl_get('Monthly'); break; case 'weekly': $days = array(intl_get('Sundays'), intl_get('Mondays'), intl_get('Tuesdays'), intl_get('Wednesdays'), intl_get('Thursdays'), intl_get('Fridays'), intl_get('Saturdays')); list($y, $m, $d) = explode('-', $event->_date); $event->recur = $days[date('w', mktime(5, 0, 0, $m, $d, $y))]; break; case 'daily': case 'no': default: if ($event->recurring == 'daily' || $event->until_date != '0000-00-00') { $event->recur = intl_get('Daily'); } else { $event->recur = false; } break; } if (appconf('google_maps') && !empty($event->loc_address) && empty($event->loc_map)) { $event->loc_google = sprintf('<a href="http://local.google.com/maps?q=%s, %s, %s, %s" target="_blank">%s</a>', $event->loc_address, $event->loc_city, $event->loc_province, $event->loc_country, intl_get('Map')); } else { $event->loc_google = false; } page_title(appconf('siteevent_title')); echo template_simple('details.spt', $event);
function onSubmit($vals) { loader_import('siteforum.Post'); loader_import('siteforum.Filters'); loader_import('siteforum.Topic'); $p = new SiteForum_Post(); if (!session_admin()) { $notice = 'no'; } else { if ($vals['notice'] == 'Make this post a notice.') { $notice = 'yes'; } else { $notice = 'no'; } } $t = new SiteForum_Topic(); $topic = $t->get($vals['topic']); if (!($res = $p->add(array('user_id' => session_username(), 'topic_id' => $vals['topic'], 'post_id' => $vals['post'], 'ts' => date('Y-m-d H:i:s'), 'subject' => $vals['subject'], 'body' => $vals['body'], 'sig' => db_shift('select sig from sitellite_user where username = ?', session_username()), 'notice' => $notice, 'sitellite_access' => $topic->sitellite_access, 'sitellite_status' => $topic->sitellite_status)))) { 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; } $vals['id'] = $res; if (!empty($vals['post'])) { $p->touch($vals['post']); } if ($vals['subscribe'] == 'Subscribe me to this forum thread.') { if (!$vals['post']) { $vals['post'] = $res; } db_execute('insert into siteforum_subscribe (id, post_id, user_id) values (null, ?, ?)', $vals['post'], session_username()); } $ae = appconf('admin_email'); if ($ae) { @mail($ae, intl_get('Forum Posting Notice'), template_simple('post_email.spt', $vals), 'From: ' . appconf('forum_name') . '@' . site_domain()); } $exempt = explode(',', $ae); $res = db_fetch_array('select distinct u.email, u.username from sitellite_user u, siteforum_subscribe s where s.user_id = u.username and s.post_id = ?', $vals['post']); foreach ($res as $row) { if (in_array($row->email, $exempt)) { continue; } $vals['user_id'] = $row->username; @mail($row->email, intl_get('Forum Posting Notice'), template_simple('post_email_subscriber.spt', $vals), 'From: ' . appconf('forum_name') . '@' . site_domain()); } page_title(intl_get('Message Posted')); echo template_simple('post_submitted.spt', $vals); }