function print_files()
 {
     $data = array();
     //should declare array to be used to hold valid input files
     echo '<b>Ingesting the data files that are in the data directory!</b>';
     echo '<br>*******************************************************<br>';
     $dirfiles = listdir(ES__PLUGIN_DIR . "data");
     if ($dirfiles) {
         foreach ($dirfiles as $key => $filename) {
             if (substr($filename, -4) == '.txt' && !is_dir($filename)) {
                 $data[$filename] = php_strip_whitespace($filename);
                 $theData = make_post($filename);
                 insert_post($theData);
                 echo "<br>";
                 echo "<br>Finished.";
                 echo "<br>";
             } else {
                 $other[$filename] = !is_dir($filename) ? file_get_contents($filename) : '';
             }
         }
         $myFile = ES__PLUGIN_DIR . "/data/test.txt";
         $fh = fopen($myFile, 'r');
         $theData = fread($fh, filesize($myFile));
         fclose($fh);
     }
     insert_post($theData);
     echo "<br>";
     echo "<br>Finished.";
     echo "<br>";
 }
function insert_post_with_attach($message, $subject, $forum_id, $user_id, $user_name, $user_attach_sig, $filenames, $topic_id = NULL, $topic_type = POST_NORMAL, $do_notification = false, $notify_user = false, $current_time = 0, $error_die_function = '', $html_on = 0, $bbcode_on = 1, $smilies_on = 1)
{
    // First, post the message
    $error_die_function = $error_die_function == '' ? "message_die" : $error_die_function;
    $post_details = insert_post($message, $subject, $forum_id, $user_id, $user_name, $user_attach_sig, $topic_id, $topic_type, $do_notification, $notify_user, $current_time, $error_die_function, $html_on, $bbcode_on, $smilies_on);
    // Now, post a attachment for each of the files listed in $filenames
    $attachments = array();
    foreach ($filenames as $filename) {
        $attachments[] = add_attach($user_id, $post_details['post_id'], $filename, $filename, $error_die_function);
    }
    $post_details['attachments'] = $attachments;
    return $post_details;
}
예제 #3
0
<?php

include '../model/messages.php';
//CRUD messages
if ($_POST['method'] == 'insertmsg') {
    insert_msg();
}
if ($_POST['method'] == 'insertpost') {
    insert_post();
}
if ($_POST['method'] == 'showmsg') {
    show_msg();
}
if ($_POST['method'] == 'showMsgsFromChatRoom') {
    showMsgsFromChatRoom();
}
예제 #4
0
파일: posts.php 프로젝트: d9867eb/oc_wss
</td>
			</tr><?php 
        }
    }
    ?>
</table><?php 
}
if ($_POST["action"] == "addnew") {
    if (post_exists($_POST["id"], "post")) {
        $data = "title='" . $_POST["title"] . "', content='" . $_POST["content"] . "'";
        update_post($_POST["id"], $data);
        echo "updated post!";
        echo "<a href=?action=new&id=" . $_POST["id"] . ">Edit again</a> | ";
        echo "<a href=" . get_blog_stuff("url") . "blog.htm#post" . $_POST["id"] . ">Visit</a>";
    } else {
        insert_post($_POST["title"], $_POST["content"]);
        echo "inserted post";
    }
} elseif ($_GET["action"] == "new") {
    ?>
<form method="post" action="<?php 
    echo $_SERVER["PHP_SELF"];
    ?>
">
<input type="hidden" name="action" value="addnew">
<input name="title" id="title" value="<?php 
    echo get_post_stuff($_GET["id"], "title");
    ?>
">
<input name="id" type="hidden" value="<?php 
    echo $_GET["id"];
예제 #5
0
function topic_move($topic_id, $to_forum_id, $from_forum_id = null, $leave_shadow = false, $insert_bot_msg = false)
{
    global $log_action;
    $to_forum_id = (int) $to_forum_id;
    // Verify input params
    if (!($topic_csv = get_id_csv($topic_id))) {
        return false;
    }
    if (!forum_exists($to_forum_id)) {
        return false;
    }
    if ($from_forum_id && (!forum_exists($from_forum_id) || $to_forum_id == $from_forum_id)) {
        return false;
    }
    // Get topics info
    $where_sql = ($forum_csv = get_id_csv($from_forum_id)) ? "AND forum_id IN({$forum_csv})" : '';
    $sql = "SELECT * FROM " . BB_TOPICS . " WHERE topic_id IN({$topic_csv}) AND topic_status != " . TOPIC_MOVED . " {$where_sql}";
    $topics = array();
    $sync_forums = array($to_forum_id => true);
    foreach (DB()->fetch_rowset($sql) as $row) {
        if ($row['forum_id'] != $to_forum_id) {
            $topics[$row['topic_id']] = $row;
            $sync_forums[$row['forum_id']] = true;
        }
    }
    if (!$topics or !($topic_csv = get_id_csv(array_keys($topics)))) {
        return false;
    }
    // Insert topic in the old forum that indicates that the topic has moved
    if ($leave_shadow) {
        $shadows = array();
        foreach ($topics as $topic_id => $row) {
            $shadows[] = array('forum_id' => $row['forum_id'], 'topic_title' => $row['topic_title'], 'topic_poster' => $row['topic_poster'], 'topic_time' => TIMENOW, 'topic_status' => TOPIC_MOVED, 'topic_type' => POST_NORMAL, 'topic_vote' => $row['topic_vote'], 'topic_views' => $row['topic_views'], 'topic_replies' => $row['topic_replies'], 'topic_first_post_id' => $row['topic_first_post_id'], 'topic_last_post_id' => $row['topic_last_post_id'], 'topic_moved_id' => $topic_id, 'topic_last_post_time' => $row['topic_last_post_time']);
        }
        if ($sql_args = DB()->build_array('MULTI_INSERT', $shadows)) {
            DB()->query("INSERT INTO " . BB_TOPICS . $sql_args);
        }
    }
    DB()->query("UPDATE " . BB_TOPICS . " SET forum_id = {$to_forum_id} WHERE topic_id IN({$topic_csv})");
    DB()->query("UPDATE " . BB_POSTS . " SET forum_id = {$to_forum_id} WHERE topic_id IN({$topic_csv})");
    DB()->query("UPDATE " . BB_BT_TORRENTS . " SET forum_id = {$to_forum_id} WHERE topic_id IN({$topic_csv})");
    // Bot
    if ($insert_bot_msg) {
        foreach ($topics as $topic_id => $row) {
            insert_post('after_move', $topic_id, $to_forum_id, $row['forum_id']);
        }
        sync('topic', array_keys($topics));
    }
    // Sync
    sync('forum', array_keys($sync_forums));
    // Log action
    foreach ($topics as $topic_id => $row) {
        $log_action->mod('mod_topic_move', array('forum_id' => $row['forum_id'], 'forum_id_new' => $to_forum_id, 'topic_id' => $topic_id, 'topic_title' => $row['topic_title']));
    }
    return true;
}
예제 #6
0
    if (isset($_GET['state'])) {
        $state = $_GET['state'];
    } else {
        $state = -1;
    }
    if (isset($_GET['county'])) {
        $county = $_GET['county'];
    } else {
        $county = -1;
    }
    if (isset($_GET['city'])) {
        $city = $_GET['city'];
    } else {
        $city = -1;
    }
    insert_post($conn, $author, $title, $content, $state, $county, $city);
} catch (PDOException $e) {
    echo "Connection failed: " . $e->getMessage();
    return;
}
$conn = null;
function insert_post($conn, $author, $title, $content, $state, $county, $city)
{
    echo $state;
    $stmt = $conn->prepare("INSERT INTO posts (author, title, content, state, county, city) VALUES (:author,:title,:content,:state,:county,:city);");
    $stmt->bindparam(':author', $author);
    $stmt->bindparam(':title', $title);
    $stmt->bindparam(':content', $content);
    $stmt->bindparam(':state', $state);
    $stmt->bindparam(':county', $county);
    $stmt->bindparam(':city', $city);
예제 #7
0
파일: page.php 프로젝트: d9867eb/oc_wss
function create_page($title, $content)
{
    return insert_post($title, $content, "page");
}
예제 #8
0
파일: done.php 프로젝트: postoakt/feelr
}
?>
			</ul>
		</div> <!-- header -->
			
		<div id = 'sort_menu'>
			<ul>
				<li><a href = '../feels/index.php?m=latest'>Latest</a></li>
				<li><a href = '../feels/index.php?m=p_today'>Popular Today</a></li>
				<li><a href = '../feels/index.php?m=p_week'>Popular This Week</a></li>
				<li><a href = '../feels/index.php?m=all_time'>Popular All Time</a></li>
				<li><a href = '../feels/index.php?m=random'>Random</a></li>
				<li><a class = 'active' href = 'index.php'>Post</a></li>
			</ul>
		</div> <!-- sort menu -->
		
		<?php 
require_once "../scripts/functions.php";
if (!isset($_POST['u_name']) || !isset($_POST['body'])) {
    die;
}
$name = $_POST['u_name'];
$body = $_POST['body'];
if (insert_post($name, $body)) {
    echo "<div style = \n\t\t\t\t' text-align: center; color: #39f; font-size: 2em;\n\t\t\t\t margin: 0 auto; margin-top: 32px; padding: 32px; font-family: Sans-Serif;'>\n\t\t\t\t Feel posted successfully!</div>";
} else {
    echo "<div style = \n\t\t\t\t' text-align: center; color: #8F0000; font-size: 2em;\n\t\t\t\t margin: 0 auto; margin-top: 64px; padding: 32px; font-family: Sans-Serif;'>\n\t\t\t\t There was an error processing your request.</div>";
}
?>
	</body>
</html>
예제 #9
0
         if (!DB()->sql_query($sql)) {
             message_die(GENERAL_ERROR, 'Could not update topics watch table', '', __LINE__, __FILE__, $sql);
         }
         $sql_where = !empty($HTTP_POST_VARS['split_type_beyond']) ? " post_time >= {$post_time} AND topic_id = {$topic_id}" : "post_id IN ({$post_id_sql})";
         $sql = "UPDATE " . POSTS_TABLE . "\r\n\t\t\t\t\tSET topic_id = {$new_topic_id}, forum_id = {$new_forum_id}\r\n\t\t\t\t\tWHERE {$sql_where}";
         if (!DB()->sql_query($sql, END_TRANSACTION)) {
             message_die(GENERAL_ERROR, 'Could not update posts table', '', __LINE__, __FILE__, $sql);
         }
         //bot
         if (isset($_POST['after_split_to_old'])) {
             require_once FT_ROOT . 'includes/functions_post.php';
             insert_post('after_split_to_old', $topic_id, $forum_id, '', $new_topic_id, str_replace("\\'", "''", $post_subject));
         }
         if (isset($_POST['after_split_to_new'])) {
             require_once FT_ROOT . 'includes/functions_post.php';
             insert_post('after_split_to_new', $new_topic_id, $new_forum_id, $forum_id, $new_topic_id, '', $topic_id);
         }
         //bot end
         sync('topic', $new_topic_id);
         sync('topic', $topic_id);
         sync('forum', $new_forum_id);
         sync('forum', $forum_id);
         $template->assign_vars(array('META' => '<meta http-equiv="refresh" content="3;url=' . "viewtopic.php?" . POST_TOPIC_URL . "={$topic_id}&amp;sid=" . $userdata['session_id'] . '">'));
         //bot
         $message = $lang['Topic_split'] . '<br /><br /><a href="' . "viewtopic.php?" . POST_TOPIC_URL . "={$topic_id}&amp;sid=" . $userdata['session_id'] . '">' . $lang['Topic_split_old'] . '</a>';
         $message .= ' &nbsp;::&nbsp; <a href="' . "viewtopic.php?" . POST_TOPIC_URL . "={$new_topic_id}&amp;sid=" . $userdata['session_id'] . '">' . $lang['Topic_split_new'] . '</a>';
         //bot end
         message_die(GENERAL_MESSAGE, $message);
     }
 } else {
     if ($post_id_sql && $delete_posts) {
예제 #10
0
    if (isset($_GET['state'])) {
        $state = $_GET['state'];
    } else {
        $state = -1;
    }
    if (isset($_GET['county'])) {
        $county = $_GET['county'];
    } else {
        $county = -1;
    }
    if (isset($_GET['city'])) {
        $city = $_GET['city'];
    } else {
        $city = -1;
    }
    insert_post($conn, $author, $question, $state, $county, $city);
} catch (PDOException $e) {
    echo "Connection failed: " . $e->getMessage();
    return;
}
$conn = null;
function insert_post($conn, $author, $question, $content, $state, $county, $city)
{
    echo $state;
    $stmt = $conn->prepare("INSERT INTO polls (author, question, state, county, city) VALUES (:author,:question,:state,:county,:city);");
    $stmt->bindparam(':author', $author);
    $stmt->bindparam(':question', $question);
    $stmt->bindparam(':state', $state);
    $stmt->bindparam(':county', $county);
    $stmt->bindparam(':city', $city);
    $stmt->execute();
예제 #11
0
<?php

session_start();
include_once '../includes/db_access.php';
include_once '../includes/functions.php';
$title = $_POST["title"];
$author = $_SESSION["uname"];
$anchor = $_POST["anchor"];
$content = $_POST["content"];
$type = NULL;
if (!isset($_POST["video"])) {
    $type = "1";
} else {
    $type = "2";
}
$order = $_POST["order"];
$post_id = insert_post($title, $author, $anchor, $content, $type, $video = NULL, $status = 0, $order);
예제 #12
0
<?php

include 'functions.php';
session_start();
check_valid_user();
do_html_header('Write Post');
$author_id = $_POST['author_id'];
$category = $_POST['category'];
$title = $_POST['title'];
$body = $_POST['body'];
$result = insert_post($author_id, $title, $body, $category);
if ($result) {
    echo "Insert your post successfully.";
} else {
    echo "Fail to insert your post.";
}
do_html_url('blog', 'Back to Home');
do_html_footer();
예제 #13
0


<?php 
session_start();
if (isset($_POST["submit"]) and !empty($_POST["box"])) {
    $id = $_SESSION['id'];
    $rollno = $_SESSION['rollno'];
    $status = $_POST["box"];
    include "db.php";
    $connectionStatus = connect_db();
    $result = insert_post($connectionStatus, $id, $rollno, $status);
    if ($result) {
        echo "success";
        header("Location: status.php?id=&v=Success");
    } else {
        echo "Error";
    }
    header("Location: status.php");
} else {
    header("Location: status.php?id=error&v=Error: All fields mandatory");
}