Example #1
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 #2
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 #3
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);
 }
Example #4
0
<?php

// your app begins here
if (!$parameters['limit']) {
    $parameters['limit'] = 5;
}
loader_import('siteforum.Post');
loader_import('siteforum.Filters');
$p = new SiteForum_Post();
$list = $p->getLatest($parameters['limit']);
echo template_simple('sidebar.spt', array('list' => $list));
Example #5
0
<?php

global $cgi;
loader_import('siteforum.Post');
loader_import('siteforum.Filters');
$p = new SiteForum_Post();
global $cgi;
if (!isset($cgi->limit)) {
    $cgi->limit = 10;
}
if (isset($parameters['topic'])) {
    $list = $p->getLatest($cgi->limit, $parameters['topic']);
    $topic = db_shift('select name from siteforum_topic where id = ?', $parameters['topic']);
    $title = appconf('rss_title') . ': ' . $topic;
} elseif (isset($parameters['threads'])) {
    $p->limit = $cgi->limit;
    $list = $p->getThreads($parameters['threads']);
    $topic = db_shift('select name from siteforum_topic where id = ?', $parameters['threads']);
    $title = appconf('rss_title') . ': ' . $topic;
} elseif (isset($parameters['thread'])) {
    $p->limit = $cgi->limit;
    $list = $p->getThread($parameters['thread'], true);
    $title = appconf('rss_title') . ': ' . db_shift('select subject from siteforum_post where id = ? and post_id = 0', $parameters['thread']);
} else {
    $list = $p->getLatest($cgi->limit);
    $title = appconf('rss_title') . ': ' . intl_get('Latest Postings');
}
foreach (array_keys($list) as $k) {
    if (!empty($topic)) {
        $list[$k]->topic = $topic;
    } else {
Example #6
0
<?php

loader_import('siteforum.Post');
loader_import('siteforum.Topic');
loader_import('siteforum.Filters');
loader_import('saf.GUI.Pager');
global $cgi;
if (empty($cgi->topic)) {
    header('Location: ' . site_prefix() . '/index/siteforum-app');
    exit;
}
if (!isset($cgi->offset) || !is_numeric($cgi->offset)) {
    $cgi->offset = 0;
}
$p = new SiteForum_Post();
$p->limit(appconf('limit'));
$p->offset($cgi->offset);
$list = $p->getThreads($cgi->topic);
$pg = new Pager($cgi->offset, appconf('limit'), $p->total);
$pg->setUrl(site_prefix() . '/index/siteforum-topic-action?topic=%s', $cgi->topic);
$pg->getInfo();
$t = new SiteForum_Topic();
$topic = $t->getTitle($cgi->topic);
page_title($topic);
template_simple_register('pager', $pg);
echo template_simple('thread_list.spt', array('forum_name' => appconf('forum_name'), 'topic' => $topic, 'list' => $list, 'sitesearch' => @file_exists('inc/app/sitesearch/data/sitesearch.pid')));
if (appconf('template')) {
    page_template(appconf('template'));
}
Example #7
0
<?php

loader_import('siteforum.Post');
$p = new SiteForum_Post();
$post = $p->get($parameters['id']);
if (!empty($post->post_id)) {
    $id = $post->post_id;
} else {
    $id = $post->id;
}
// bug: this doesn't account for the pager on larger threads
// also missing: highlighting of search results
header('Location: ' . site_prefix() . '/index/siteforum-list-action?post=' . $id . '&highlight=' . $parameters['highlight'] . '#siteforum-message-' . $parameters['id']);
exit;
Example #8
0
<?php

loader_import('siteforum.Post');
loader_import('siteforum.Topic');
loader_import('siteforum.Filters');
loader_import('saf.GUI.Pager');
global $cgi;
if (empty($cgi->post)) {
    header('Location: ' . site_prefix() . '/index/siteforum-topic-action?topic=' . $cgi->topic);
    exit;
}
if (!isset($cgi->offset) || !is_numeric($cgi->offset)) {
    $cgi->offset = 0;
}
$p = new SiteForum_Post();
$p->orderBy('ts asc');
$p->limit(appconf('limit'));
$p->offset($cgi->offset);
$list = $p->getThread($cgi->post);
if (!empty($cgi->highlight)) {
    $highlight = '?highlight=' . $cgi->highlight;
} else {
    $highlight = '?highlight=';
}
$pg = new Pager($cgi->offset, appconf('limit'), $p->total);
$pg->setUrl(site_prefix() . '/index/siteforum-list-action/post.%s' . $highlight, $cgi->post);
$pg->getInfo();
if (!$cgi->topic) {
    $cgi->topic = $list[0]->topic_id;
}
$t = new SiteForum_Topic();
Example #9
0
<?php

loader_import('siteforum.Post');
$p = new SiteForum_Post();
$post = $p->get($parameters['id']);
$p->remove($parameters['id']);
header('Location: ' . site_prefix() . '/index/siteforum-list-action?topic=' . $post->topic_id . '&post=' . $post->post_id);
exit;