コード例 #1
0
ファイル: index.php プロジェクト: vojtajina/sitellite
 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;
 }
コード例 #2
0
ファイル: index.php プロジェクト: vojtajina/sitellite
 function onSubmit($vals)
 {
     $header = 'Location: ' . site_prefix() . '/index/siteblog-view-action/head.on/complex.on';
     if ($vals['author'] != '0') {
         $header .= '/author.' . $vals['author'];
     }
     if ($vals['year'] != 0) {
         $header .= '/year.' . $vals['year'];
     }
     if ($vals['month'] != 0) {
         $header .= '/month.' . $vals['month'];
     }
     if ($vals['category'] != 0) {
         $header .= '/category.' . $vals['category'];
         $header .= '/title.' . siteblog_filter_link_title(db_shift('select title from siteblog_category where id = ?', $vals['category']));
     }
     header($header);
     exit;
 }
コード例 #3
0
ファイル: index.php プロジェクト: vojtajina/sitellite
 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;
 }
コード例 #4
0
ファイル: index.php プロジェクト: vojtajina/sitellite
<ul>
<?php 
loader_import('siteblog.Filters');
foreach (db_pairs('select id, title from siteblog_category order by title asc') as $id => $title) {
    $count = db_shift('select count(*) from siteblog_post where category = ?', $id);
    echo '<li><a href="' . site_prefix() . '/index/siteblog-topic-action/id.' . $id . '/title.' . siteblog_filter_link_title($title) . '">' . $title . ' (' . $count . ')</a></li>';
}
?>
</ul>
コード例 #5
0
ファイル: index.php プロジェクト: vojtajina/sitellite
<?php

$ak = appconf('akismet_key');
if (!$ak) {
    header('Location: ' . $_SERVER['HTTP_REFERER']);
    exit;
}
loader_import('siteblog.Filters');
$c = db_single('select * from siteblog_comment where id = ?', $parameters['id']);
db_execute('delete from siteblog_comment where id = ?', $parameters['id']);
$title = db_shift('select subject from siteblog_post where id = ?', $vals['post']);
$comment = array('author' => $c->name, 'email' => $c->email, 'website' => $c->url, 'body' => $c->body, 'permalink' => site_url() . '/index/siteblog-post-action/id.' . $c->post_id . '/title.' . siteblog_filter_link_title($title), 'user_ip' => $c->ip, 'user_agent' => '');
loader_import('siteblog.Akismet');
$akismet = new Akismet(site_url(), $ak, $comment);
if (!$akismet->errorsExist()) {
    // no errors
    $akismet->submitSpam();
}
header('Location: ' . $_SERVER['HTTP_REFERER']);
exit;
コード例 #6
0
ファイル: index.php プロジェクト: vojtajina/sitellite
<?php

$ak = appconf('akismet_key');
if (!$ak) {
    header('Location: ' . site_prefix() . '/index/siteblog-akismet-action');
    exit;
}
loader_import('siteblog.Filters');
loader_import('siteblog.Akismet');
$comment = (array) db_single('select * from siteblog_akismet where id = ?', $parameters['id']);
unset($comment['id']);
$title = db_shift('select subject from siteblog_post where id = ?', $comment['post_id']);
$comment['permalink'] = site_url() . '/index/siteblog-post-action/id.' . $comment['post_id'] . '/title.' . siteblog_filter_link_title($title);
$pid = $comment['post_id'];
unset($comment['post_id']);
$akismet = new Akismet(site_url(), $ak, $comment);
if (!$akismet->errorsExist()) {
    // no errors
    switch ($parameters['spam']) {
        case 'yes':
            $akismet->submitSpam();
            db_execute('delete from siteblog_akismet where id = ?', $parameters['id']);
            break;
        case 'no':
            $akismet->submitHam();
            db_execute('insert into siteblog_comment values (null, ?, ?, ?, ?, ?, ?, 0, ?)', $comment['ts'], $comment['author'], $comment['email'], $comment['website'], $comment['user_ip'], $pid, $comment['body']);
            db_execute('delete from siteblog_akismet where id = ?', $parameters['id']);
            break;
    }
}
header('Location: ' . site_prefix() . '/index/siteblog-akismet-action');
コード例 #7
0
ファイル: index.php プロジェクト: vojtajina/sitellite
<ul>
<?php 
if (!$parameters['limit']) {
    $parameters['limit'] = 5;
}
loader_import('siteblog.Filters');
$res = db_fetch_array('select id, subject from siteblog_post where status = "visible" order by created desc limit ' . $parameters['limit']);
foreach ($res as $row) {
    echo '<li><a href="' . site_prefix() . '/index/siteblog-post-action/id.' . $row->id . '/title.' . siteblog_filter_link_title($row->subject) . '">' . $row->subject . '</a></li>';
}
?>
</ul>
コード例 #8
0
ファイル: index.php プロジェクト: vojtajina/sitellite
    $before = date('Y-m-d', mktime(0, 0, 0, $cgi->month + 1, 1, $cgi->year));
} else {
    $year = date('Y');
    $month = date('m');
    $after = date('Y-m-d', mktime(0, 0, 0, $month, 0, $year));
    $before = date('Y-m-d', mktime(0, 0, 0, $month + 1, 1, $year));
}
$constraints[] = 'created > "' . $after . '" and created < "' . $before . '"';
if (!empty($constraints)) {
    $query .= ' where ';
    $total = count($constraints);
    $sofar = 0;
    foreach ($constraints as $constraint) {
        $sofar++;
        $query .= $constraint;
        if ($sofar < $total) {
            $query .= ' and ';
        }
    }
}
$query .= ' order by created desc';
$res = db_fetch_array($query);
//generate the calendar
loader_import('siteblog.Filters');
loader_import('saf.Date.Calendar.Mini');
$cal = new MiniCal($parameters['minical']);
foreach ($res as $post) {
    list($year, $month, $day) = explode('-', $post->created);
    $cal->addLink($day, '/index/siteblog-post-action/id.' . $post->id . '/title.' . siteblog_filter_link_title($post->subject));
}
echo $cal->render();
コード例 #9
0
ファイル: Filters.php プロジェクト: vojtajina/sitellite
function siteblog_filter_blog_link($id)
{
    $title = db_shift('select subject from siteblog_post where id = ?', $id);
    return '<a href="' . site_prefix() . '/index/siteblog-post-action/id.' . $id . '/title.' . siteblog_filter_link_title($title) . '">' . $title . '</a>';
}