Example #1
0
 function getQueue($type = false)
 {
     if (!$type) {
         $type = $this->name;
     }
     loader_import('cms.Workspace.Notice.' . $this->types[$type]);
     $res = db_fetch('select * from sitellite_msg_queue where type = ?', $type);
     if (!$res) {
         $this->error = db_error();
         return false;
     } elseif (is_object($res)) {
         $res = array($res);
     }
     foreach ($res as $k => $v) {
         $qid = $res[$k]->id;
         $struct = $res[$k]->struct;
         $res[$k] = unserialize($struct);
         if (!$res[$k]) {
             $this->error = 'unserialize() failed: ' . $struct;
             return false;
         }
         $res[$k]->qid = $qid;
     }
     return $res;
 }
Example #2
0
 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');
 }
Example #3
0
 function onSubmit($vals)
 {
     unset($vals['submit_button']);
     loader_import('saf.File');
     file_overwrite('inc/app/sitewiki/conf/settings.php', ini_write($vals));
     echo '<p>Settings saved.  <a href="' . site_prefix() . '/index/sitewiki-app">Continue</a></p>';
 }
Example #4
0
 function getThemes($path = false)
 {
     if (!$path) {
         $path = site_docroot() . '/inc/app/sitepresenter/themes';
     }
     $themes = array();
     //'' => 'Default');
     loader_import('saf.File.Directory');
     $dir = new Dir();
     if (!$dir->open($path)) {
         return $themes;
     }
     foreach ($dir->read_all() as $file) {
         if (strpos($file, '.') === 0 || !@is_dir($path . '/' . $file)) {
             continue;
         }
         //if (preg_match ('/^html.([^\.]+)\.tpl$/', $file, $regs)) {
         //if ($regs[1] == 'default') {
         //	continue;
         //}
         $themes[$file] = ucfirst($file);
         //}
     }
     return $themes;
 }
Example #5
0
 function getTemplates($path = false)
 {
     if (!$path) {
         $path = 'inc/html/' . conf('Server', 'default_template_set');
     }
     $templates = array('' => 'Inherit', 'default' => 'Default');
     loader_import('saf.File.Directory');
     $dir = new Dir();
     if (!$dir->open($path)) {
         return $templates;
     }
     foreach ($dir->read_all() as $file) {
         if (strpos($file, '.') === 0 || @is_dir($path . '/' . $file)) {
             continue;
         }
         if (preg_match('/^html.([^\\.]+)\\.tpl$/', $file, $regs)) {
             if ($regs[1] == 'default') {
                 continue;
             }
             $templates[$regs[1]] = ucfirst($regs[1]);
         }
     }
     asort($templates);
     return $templates;
 }
Example #6
0
 function onSubmit($vals)
 {
     loader_import('saf.File');
     if (!preg_match('/\\.html$/', $vals['filename'])) {
         $vals['filename'] .= '.html';
     }
     if (!preg_match('/\\.html$/', $vals['helpfile'])) {
         $vals['helpfile'] .= '.html';
     }
     $vals['body'] = '<h1>' . $vals['title'] . '</h1>' . NEWLINEx2 . $vals['body'];
     if (!file_overwrite(site_docroot() . '/inc/app/' . $vals['appname'] . '/docs/' . $vals['lang'] . '/' . $vals['filename'], $vals['body'])) {
         echo '<p>Error: Unable to write to the file.  Please verify your file and folder permissions.</p>';
         return;
     }
     if ($vals['helpfile'] != $vals['filename']) {
         // erase old file, this is a rename
         $res = @unlink(site_docroot() . '/inc/app/' . $vals['appname'] . '/docs/' . $vals['lang'] . '/' . $vals['helpfile']);
         if (!$res) {
             echo '<p>Error: Unable to remove the old file.  Please verify your file and folder permissions.</p>';
             return;
         }
     }
     header('Location: ' . site_prefix() . '/index/appdoc-helpdoc-action?appname=' . $vals['appname'] . '&lang=' . $vals['lang']);
     exit;
 }
Example #7
0
function the_cleaners($data, $wrap = true, $safe = true)
{
    global $TIDY_PATH;
    if ($TIDY_PATH) {
        ob_start();
        passthru($TIDY_PATH . " -asxhtml -icq -f /dev/null 2>&1 <<END-XED-INPUT\n" . $data . "\nEND-XED-INPUT");
        $data = ob_get_contents();
        ob_end_clean();
        if ($wrap) {
            $data = the_cleaners_strip_tidy_output($data);
        }
        return $data;
    } else {
        if ($wrap) {
            $data = the_cleaners_wrapper($data);
        }
        loader_import('saf.HTML.Messy');
        $messy = new Messy();
        $messy->safe = $safe;
        $data = $messy->clean($data);
        if ($wrap) {
            $data = the_cleaners_remove_wrapper($data);
        }
        return $data;
    }
}
Example #8
0
 function onSubmit($vals)
 {
     loader_import('saf.File');
     loader_import('saf.File.Directory');
     loader_import('saf.Misc.Ini');
     $info = help_get_langs($vals['appname']);
     $info[$vals['lang_code']] = $vals['lang_name'];
     if (!@mkdir(site_docroot() . '/inc/app/' . $vals['appname'] . '/docs/' . $vals['lang_code'], 0777)) {
         echo '<p>Error: Unable to create language folder.  Please verify your folder permissions.</p>';
         return;
     }
     if (!file_overwrite(site_docroot() . '/inc/app/' . $vals['appname'] . '/docs/languages.php', ini_write($info))) {
         echo '<p>Error: Unable to write to the file.  Please verify your folder permissions.</p>';
         return;
     }
     if (!empty($vals['copy_from'])) {
         // copy help files from specified lang to new dir
         $pages = help_get_pages($vals['appname'], $vals['lang']);
         foreach ($pages as $page) {
             $id = help_get_id($page);
             $res = copy(site_docroot() . '/inc/app/' . $vals['appname'] . '/docs/' . $vals['lang'] . '/' . $id . '.html', site_docroot() . '/inc/app/' . $vals['appname'] . '/docs/' . $vals['lang_code'] . '/' . $id . '.html');
             if (!$res) {
                 echo '<p>Error: Unable to duplicate help files.  Please verify your folder permissions.</p>';
                 return;
             }
         }
     }
     // go to new language
     header('Location: ' . site_prefix() . '/index/appdoc-helpdoc-action?appname=' . $vals['appname'] . '&lang=' . $vals['lang_code']);
     exit;
 }
Example #9
0
 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'] == 1 ? 'not visible' : 'visible';
     if (empty($vals['category'])) {
         $vals['category'] = $vals['oldcat'];
     }
     $category = $vals['category'];
     $body = $vals['body'];
     $data = array('subject' => $subject, 'author' => $author, 'status' => $status, 'category' => $category, 'body' => $body);
     if (!empty($id)) {
         $method = $rex->determineAction($id);
         $rex->{$method}($id, $data);
     } else {
         $data['created'] = date('Y-m-d H:i:s');
         $id = $rex->create($data);
     }
     //view post
     header('Location: ' . site_prefix() . '/index/siteblog-view-action?id=' . $id);
     exit;
 }
Example #10
0
 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;
 }
Example #11
0
 function onSubmit($vals)
 {
     loader_import('cms.Workspace.Message');
     $msg = new WorkspaceMessage();
     $msg->renameCategory($vals['name'], $vals['category']);
     header('Location: ' . site_prefix() . '/index/cms-messages-action');
     exit;
 }
Example #12
0
 function onSubmit($vals)
 {
     loader_import('siteforum.Topic');
     $t = new SiteForum_Topic();
     $t->add(array('name' => $vals['name'], 'description' => $vals['description'], 'sitellite_access' => $vals['sitellite_access'], 'sitellite_status' => $vals['sitellite_status']));
     header('Location: ' . site_prefix() . '/index/siteforum-app');
     exit;
 }
Example #13
0
function &siteevent_translate(&$obj)
{
    loader_import('saf.Database.Generic');
    $g = new Generic('siteevent_event', 'id');
    $g->multilingual = true;
    $res =& $g->translate($obj);
    return $res;
}
Example #14
0
function siteforum_filter_shortdate($date)
{
    if (!$date) {
        return '';
    }
    loader_import('saf.Date');
    return Date::timestamp($date, 'M j - g:i A');
}
Example #15
0
 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);
 }
Example #16
0
function json($data)
{
    if (function_exists('json_encode')) {
        $out = json_encode($data);
    } else {
        loader_import('pear.Services.JSON');
        $json = new Services_JSON();
        $out = $json->encode($data);
    }
    return str_replace('\\/', '/', $out);
}
Example #17
0
 function onSubmit($vals)
 {
     loader_import('cms.Versioning.Rex');
     $collection = $vals['collection'];
     unset($vals['collection']);
     if (empty($collection)) {
         $collection = 'sitellite_page';
     }
     $return = $vals['_return'];
     unset($vals['_return']);
     $changelog = $vals['changelog'];
     unset($vals['changelog']);
     $rex = new Rex($collection);
     //$vals['sitellite_owner'] = session_username ();
     //$vals['sitellite_team'] = session_team ();
     unset($vals['submit_button']);
     unset($vals['tab1']);
     unset($vals['tab2']);
     unset($vals['tab3']);
     unset($vals['tab-end']);
     unset($vals['header_properties']);
     unset($vals['header_contact']);
     unset($vals['header_loc']);
     if ($vals['contact_url'] == 'http://') {
         $vals['contact_url'] = '';
     }
     if ($vals['loc_map'] == 'http://') {
         $vals['loc_map'] = '';
     }
     $res = $rex->create($vals, $changelog);
     if (isset($vals[$rex->key])) {
         $key = $vals[$rex->key];
     } elseif (!is_bool($res)) {
         $key = $res;
     } else {
         $key = 'Unknown';
     }
     if (!$res) {
         if (!$return) {
             $return = site_prefix() . '/index/cms-browse-action?collection=siteevent_event';
         }
         echo loader_box('cms/error', array('message' => $rex->error, 'collection' => $collection, 'key' => $key, 'action' => $method, 'data' => $vals, 'changelog' => $changelog, 'return' => $return));
     } else {
         loader_import('cms.Workflow');
         echo Workflow::trigger('add', array('collection' => $collection, 'key' => $key, 'data' => $vals, 'changelog' => intl_get('Item added.'), 'message' => 'Collection: ' . $collection . ', Item: ' . $key));
         session_set('sitellite_alert', intl_get('Your item has been created.'));
         if ($return) {
             header('Location: ' . $return);
             exit;
         }
     }
     header('Location: ' . site_prefix() . '/index/siteevent-app/id.' . $res);
     exit;
 }
Example #18
0
 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;
 }
Example #19
0
 function getWeek($date, $cat, $aud, $user, $fields = '*')
 {
     loader_import('saf.Date');
     $cur = date('w', strtotime($date));
     if ($cur > 0) {
         $week_of = Date::subtract($date, $cur . ' day');
     } else {
         $week_of = $date;
     }
     $until = Date::add($week_of, '6 day');
     return $this->_eventsInRange($week_of, $until, $cat, $aud, $user, $fields);
 }
Example #20
0
 function onSubmit($vals)
 {
     loader_import('cms.Versioning.Rev');
     $rev = new Rev();
     // default: database, database
     unset($vals['submit_button']);
     $res = $rev->modify('sitellite_page', 'id', $vals['id'], $vals);
     if (!$res) {
         die($rev->error);
     } else {
         header('Location: ' . site_prefix() . '/index/' . $vals['id']);
         exit;
     }
 }
Example #21
0
/**
 * @package CMS
 */
function filter_cms_messages_date($date)
{
    global $simple_template_register;
    $obj =& $simple_template_register['parent'];
    if ($obj->status == 'unread') {
        $start = '<strong>';
        $end = '</strong>';
    } else {
        $start = '';
        $end = '';
    }
    loader_import('saf.Date');
    return $start . Date::timestamp($date, array('today' => '\\T\\o\\d\\a\\y - g:i A', 'yesterday' => '\\Y\\e\\s\\t\\e\\r\\d\\a\\y - g:i A', 'tomorrow' => '\\T\\o\\m\\o\\r\\r\\o\\w - g:i A', 'this week' => 'l, F j, Y - g:i A', 'other' => 'F j, Y - g:i A')) . $end;
}
Example #22
0
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;
}
Example #23
0
 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);
 }
Example #24
0
 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);
 }
Example #25
0
 function onSubmit($vals)
 {
     loader_import('cms.Workspace.Message');
     $msg = new WorkspaceMessage();
     if (!$vals['response_id']) {
         $vals['response_id'] = '0';
     }
     $res = $msg->send($vals['subject'], $vals['body'], explode(',', $vals['recipients']), array(), $vals['response_id'], $vals['priority'], session_username());
     if (!$res) {
         echo '<p>Error: ' . $msg->error . '</p>';
     }
     session_set('sitellite_alert', intl_get('Your message has been sent.'));
     header('Location: ' . site_prefix() . '/index/cms-cpanel-action?_msg=sent');
     exit;
 }
Example #26
0
 function onSubmit($vals)
 {
     loader_import('cms.Versioning.Rex');
     $collection = $vals['collection'];
     unset($vals['collection']);
     if (empty($collection)) {
         $collection = 'sitellite_page';
     }
     $return = $vals['_return'];
     unset($vals['_return']);
     $changelog = $vals['changelog'];
     unset($vals['changelog']);
     $rex = new Rex($collection);
     //$vals['sitellite_owner'] = session_username ();
     //$vals['sitellite_team'] = session_team ();
     unset($vals['submit_button']);
     unset($vals['edit-top']);
     unset($vals['edit-middle']);
     unset($vals['edit-middle2']);
     unset($vals['edit-middle3']);
     unset($vals['edit-bottom']);
     unset($vals['cover_heading']);
     $vals['ts'] = date('YmdHis');
     $res = $rex->create($vals, $changelog);
     if (isset($vals[$rex->key])) {
         $key = $vals[$rex->key];
     } elseif (!is_bool($res)) {
         $key = $res;
     } else {
         $key = 'Unknown';
     }
     if (!$res) {
         if (!empty($return)) {
             $return = site_prefix() . '/index/cms-browse-action?collection=sitepresenter_presentation';
         }
         echo loader_box('cms/error', array('message' => $rex->error, 'collection' => $collection, 'key' => $key, 'action' => $method, 'data' => $vals, 'changelog' => $changelog, 'return' => $return));
     } else {
         loader_import('cms.Workflow');
         echo Workflow::trigger('add', array('collection' => $collection, 'key' => $key, 'data' => $vals, 'changelog' => intl_get('Item added.'), 'message' => 'Collection: ' . $collection . ', Item: ' . $key));
         session_set('sitellite_alert', intl_get('Your item has been created.'));
         //if ($return) {
         //	header ('Location: ' . $return);
         //	exit;
         //}
         header('Location: ' . site_prefix() . '/index/sitepresenter-slides-action/id.' . $res);
         exit;
     }
 }
Example #27
0
function formrules_get($list, $fieldName = false)
{
    loader_import('saf.MailForm.Rule');
    $rules = $GLOBALS['formrules'][$list];
    if (!is_array($rules)) {
        return array();
    }
    if (!$fieldName) {
        $fieldName = $list;
    }
    $out = array();
    foreach ($rules as $rule) {
        $out[] = new MailFormRule($rule[0], $fieldName, $rule[1]);
    }
    return $out;
}
Example #28
0
/**
 * Updates all pages that reference the specified image.
 */
function imagechooser_update_pages($image, $new)
{
    $links = imagechooser_links($image);
    if (count($links) > 0) {
        loader_import('cms.Versioning.Rex');
        $rex = new Rex('sitellite_page');
        foreach ($links as $id => $title) {
            $c = $rex->getCurrent($id);
            if (is_object($c)) {
                $c->body = str_replace($image, $new, $c->body);
                $method = $rex->determineAction($id, $c->sitellite_status);
                $rex->{$method}($id, (array) $c, 'An image in this page was renamed, updating link.');
            }
        }
    }
}
Example #29
0
function sitesearch_filter_highlight($text)
{
    $text = strip_tags(xmlentities_reverse($text));
    if (strlen($text) >= 300) {
        $text = substr($text, 0, 297);
    }
    loader_import('saf.Misc.Search');
    global $cgi, $sitesearch_queries;
    if (!is_array($sitesearch_queries)) {
        $sitesearch_queries = search_split_query($cgi->query);
    }
    foreach ($sitesearch_queries as $query) {
        $text = preg_replace('/(' . preg_quote($query, '/') . ')/i', '<strong>\\1</strong>', $text);
    }
    return $text;
}
Example #30
0
 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);
 }