コード例 #1
0
 /**
  * Shows a form for editing a reply to the given message.
  */
 function show_compose_reply(&$_parent_msg)
 {
     $message = new Posting();
     // Prepend 'Re: ' if necessary
     if (strpos($_parent_msg->get_subject(), _('Re: ')) !== 0) {
         $subject = _('Re: ') . $_parent_msg->get_subject();
         $message->set_subject(substr($subject, 0, cfg('max_subjectlength')));
     } else {
         $message->set_subject($_parent_msg->get_subject());
     }
     $this->show_compose($message, $_parent_msg->get_id(), TRUE);
 }
コード例 #2
0
ファイル: thread.class.php プロジェクト: kainabel/freech
 function _create_posting_at($_path)
 {
     $posting = new Posting();
     $posting->_set_path(substr($_path, 8) . '00');
     $posting->set_status(POSTING_STATUS_LOCKED);
     $posting->apply_block();
     // TODO: faked timestamp against the time bug in ThreadView
     $posting->set_created_unixtime(1118786400);
     $posting->set_updated_unixtime(1118786400);
     $posting = $this->api->_decorate_posting($posting);
     $this->_add_posting($posting);
     return $posting;
 }
コード例 #3
0
 public function actionSetstatus()
 {
     //DebugBreak();
     $id = Yii::app()->request->getParam('id');
     $is_active = Yii::app()->request->getParam('is_active');
     $is_top = Yii::app()->request->getParam('is_top');
     $is_slider = Yii::app()->request->getParam('is_slider');
     if (strlen($is_active)) {
         Posting::setPostParam($id, 'is_active', $is_active);
     } else {
         if (strlen($is_top)) {
             //News::setNewsParam($id, 'is_top', $is_top, 4);
             $this->setParam($id, 'is_top', $is_top, $this->_maxTopCount);
         } else {
             if (strlen($is_slider)) {
                 //News::setNewsParam($id, 'is_slider', $is_slider, 4);
                 $this->setParam($id, 'is_slider', $is_slider, 4);
             }
         }
     }
     Yii::app()->end();
 }
コード例 #4
0
ファイル: News.php プロジェクト: andreyantonov78/atmosphera
 public function afterDelete()
 {
     parent::afterDelete();
     //run parent event handler...
     if ($post = Posting::model()->findByPk($this->post_id)) {
         $success = $post->delete();
         //delete posting record
     }
     if (is_object($this->_transaction)) {
         $this->_transaction->commit();
     }
 }
コード例 #5
0
ファイル: plugin.php プロジェクト: useada/freech-1
function &message_init_posting_from_post_data(&$_posting = NULL)
{
    if (!$_posting) {
        $_posting = new Posting();
    }
    $_posting->set_id($_POST['msg_id']);
    $_posting->set_username($_POST['username']);
    $_posting->set_subject($_POST['subject']);
    $_posting->set_body($_POST['body']);
    return $_posting;
}
コード例 #6
0
 public static function setPostParam($id, $paramName, $paramValue)
 {
     //DebugBreak();
     $transaction = Yii::app()->db->beginTransaction();
     try {
         $posts = Posting::model()->findByPk($id);
         $posts->{$paramName} = $paramValue ? self::SWITCH_ON : self::SWITCH_OFF;
         $posts->save(true, array($paramName));
         $transaction->commit();
     } catch (Exception $e) {
         $transaction->rollback();
     }
 }
コード例 #7
0
ファイル: board.php プロジェクト: stormeus/Kusaba-Z
// {{{ Fake email field check
if (isset($_POST['email']) && !empty($_POST['email'])) {
    exitWithErrorPage('Spam bot detected');
}
// Start the session
session_start();
// Require the configuration file, functions file, board and post class, bans class, and posting class
require 'config.php';
require KU_ROOTDIR . 'inc/functions.php';
require KU_ROOTDIR . 'inc/classes/board-post.class.php';
require KU_ROOTDIR . 'inc/classes/bans.class.php';
require KU_ROOTDIR . 'inc/classes/posting.class.php';
require KU_ROOTDIR . 'inc/classes/parse.class.php';
$bans_class = new Bans();
$parse_class = new Parse();
$posting_class = new Posting();
// {{{ Module loading
modules_load_all();
// }}}
// {{{ GET/POST board send check
// In some cases, the board value is sent through post, others get
if (isset($_POST['board']) || isset($_GET['board'])) {
    $_POST['board'] = isset($_GET['board']) ? $_GET['board'] : $_POST['board'];
}
// }}}
// If the script was called using a board name:
if (isset($_POST['board'])) {
    $board_name = $tc_db->GetOne("SELECT `name` FROM `" . KU_DBPREFIX . "boards` WHERE `name` = " . $tc_db->qstr($_POST['board']) . "");
    if (!empty($board_name)) {
        $board_class = new Board($board_name);
        if (!empty($board_class->board['locale'])) {
コード例 #8
0
//$template = $twig->loadTemplate('template.htm');
include "functions.php";
include "classes/login_user.class.php";
$pr = new MyLogin();
$glob_user = $pr->checkLogin();
$user_id = $pr->get_user_id();
$user_name = $pr->get_username();
/*******************************************************************/
//reaguje na odeslani formularu
if (isset($_POST["logging_out"])) {
    $glob_user = null;
    $pr->logoutUser();
}
if ($glob_user && $user_id != -1 && $user_name) {
    include_once "classes/posting.class.php";
    $posting = new Posting();
    if (isset($_POST["post_textarea"])) {
        $post_id = $posting->send_new_post($user_id, $_POST["post_textarea"]);
        $ret = upload_my_file($post_id, "images/post/");
    }
    if (isset($_POST["comment_textarea"])) {
        $posting->send_new_comment($user_id, $user_name, $_POST["comment_textarea"], $_POST["post_id"]);
    }
    call_edit_post($posting);
    call_delete_post($posting);
    call_like_post($posting, $user_id);
}
/********************************************************************/
// seznam dostupnych stran k zobrazeni
$dostupne = array("index", "login", "register", "home", "profile");
// defaultne se zobrazuje prvni strana
コード例 #9
0
 public static function createDefault()
 {
     $v = new Posting();
     $v->defaultAllFields();
     return $v;
 }
コード例 #10
0
 function _posting_read()
 {
     $posting = $this->forumdb->get_posting_from_id($_GET['msg_id']);
     $this->_add_posting_breadcrumbs($posting);
     /* Plugin hook: on_message_read_print
      *   Called before the HTML for the posting is produced.
      *   Args: posting: The posting that is about to be shown.
      */
     $this->eventbus->emit('on_message_read_print', $this->api, $posting);
     // Hide subject and body if the message is locked.
     if ($posting) {
         // bypassed in threadview or listview, if permitted
         if (!$this->current_group->permissions['bypass']) {
             $posting->apply_block();
         }
     } else {
         $posting = new Posting();
         $posting->set_subject(_('No Such Message'));
         $posting->set_body(_('A message with the given ID does not exist.'));
     }
     $view = $this->_get_current_view();
     $view->show_posting($posting);
 }
コード例 #11
0
                     $db->commitTransaction();
                     $committed = true;
                     $result->successMsg .= sprintf(_t('crud.idUpdated'), _t('crud.posting.tableDescription', 'Posting'), $row->id) . "\n";
                 }
             }
             if (!$success) {
                 if ($result->errorMsg == '' && empty($result->fieldErrors)) {
                     $result->errorMsg .= sprintf(_t('crud.rowCouldNotBeUpdated'), _t('crud.posting.tableDescription', 'Posting')) . "\n";
                 }
             }
         }
     }
 } else {
     // if ($row->id > 0)
     // Convert the value object into the actual entity.
     $newRow = new Posting();
     $newRow->loadFromArray((array) $row);
     if (function_exists('preInsertHook')) {
         preInsertHook();
     }
     try {
         $success = $postingDAO->insert($newRow);
     } catch (Exception $ex) {
         $success = false;
     }
     if ($success) {
         $row->id = $newRow->id;
         $justInsertedRowId = $newRow->id;
         if (function_exists('postInsertHook')) {
             postInsertHook();
         }
コード例 #12
0
 public function findWithPreparedStatement($ps)
 {
     $cacheKey = null;
     if ($this->cache !== null) {
         $cacheKey = serialize($ps);
         if (($rows = $this->cache->get($cacheKey)) !== false) {
             return $rows;
         }
     }
     $rows = array();
     $rs = $this->connection->executeQuery($ps);
     while ($arr = $this->connection->fetchArray($rs)) {
         $row = new Posting();
         $row->loadFromArray($arr);
         $rows[] = $row;
     }
     $this->connection->freeResult($rs);
     if ($this->cache !== null) {
         $this->cache->set($cacheKey, $rows);
     }
     return $rows;
 }
コード例 #13
0
<?php

// DO NOT EDIT THIS FILE.
// This file was generated by searchgen.
// If you need to customize this file, please edit the corresponding
// yaml file in the gencfg directory, and then re-generate this file
// by running searchgen, passing in the table name.
if (isset($command) && $command == 'loadPosting') {
    header('Content-Type: application/json');
    $db = ConnectionFactory::getConnection();
    $postingDAO = new PostingDAO($db);
    $id = isset($params['id']) ? (int) trim($params['id']) : 0;
    if ($id <= 0) {
        $rows = array(Posting::createDefault());
    } else {
        $sql = <<<EOF
select * from posting pri where pri.id = ?
EOF;
        $ps = new PreparedStatement($sql, 0, 1);
        $ps->setInt($id);
        $rows = $postingDAO->findWithPreparedStatement($ps);
    }
    echo json_encode($rows);
    $db->close();
    exit;
}