Ejemplo n.º 1
0
<?php

require_once "shared/cookies.php";
require_once "shared/functions.php";
require_once "shared/header.php";
require_once "shared/bbcodeParser.php";
?>

<?php 
connect_to_database();
select_database();
if (isset($_GET['post']) && $_GET['post'] != "") {
    if (get_num_rows("posts", "post_id", $_GET['post']) == 0) {
        redirect_to("not_found.php");
    } else {
        $post_id = $_GET['post'];
        $query = query_select("posts");
        $query .= query_select_where("post_id", $post_id);
        $post = get_array_from_db($query);
        $post = $post[0];
    }
}
if (!logged_in() || $_SESSION['acess_rank'] == "member" && $post['posted_by'] != $_SESSION['user_id']) {
    redirect_to("no_permission.php");
}
?>

<div class="centerBox">

	<div class="title">
		Edit Post
Ejemplo n.º 2
0
function table_data_posts()
{
    global $post_data;
    $post_data = array();
    $arr = get_postcnt_abs();
    $nrows = get_num_rows();
    $i = 0;
    $sum = array_sum($arr);
    foreach ($arr as $key => $value) {
        if ($key) {
            $post_data[$i]['post'] = $key;
            $post_data[$i]['count'] = $value;
            $post_data[$i++]['percent'] = round($value / $sum * 100, 2);
        }
    }
}
Ejemplo n.º 3
0
Archivo: list.php Proyecto: Tkachov/POD
$query = "SELECT table_name FROM user_tables;";
//current user's tables
//"SELECT owner, table_name FROM all_tables;" for all tables
//"SELECT owner, table_name FROM dba_tables;" for ALL tables (requires DBA privilege/role)
$result = odbc_exec($client->get_connection(), $query);
if ($result === false) {
    echo "<div class='error_message'>" . odbc_error() . ": " . odbc_errormsg() . "</div>";
}
?>

<div class="entries">
	<div class="entry plus_sign">
		<a href="?tables&action=edit"><div class="plus-sign"></div></a>
	</div>

	<?php 
if ($result !== false) {
    while (odbc_fetch_row($result)) {
        $table_name = odbc_result($result, 1);
        echo "<div class=\"entry\"" . ">\n";
        echo "\t<a class=\"visibility_button\" href=\"?tables&action=delete&target=" . $table_name . "\"></a>\n";
        echo "\t<a href=\"?tables&action=view&target=" . $table_name . "\">";
        echo "\t\t<b>" . $table_name . "</b>\n";
        echo "\t\t<span class=\"date\">" . get_num_rows($client, $table_name) . "</span>\n";
        echo "\t</a>\n";
        echo "</div>\n";
    }
}
odbc_close($client->get_connection());
?>
</div>
Ejemplo n.º 4
0
<?php

require_once "shared/cookies.php";
require_once "shared/functions.php";
require_once "shared/header.php";
require_once "shared/bbcodeParser.php";
?>

<?php 
connect_to_database();
select_database();
if (isset($_GET['user']) && $_GET['user'] != "") {
    if (get_num_rows("users", "user_id", $_GET['user']) == 0) {
        redirect_to("not_found.php");
    } else {
        $user_id = $_GET['user'];
        $query = query_select("users");
        $query .= query_select_where("user_id", $user_id);
        $user = get_array_from_db($query);
        $user = $user[0];
    }
} else {
    if (logged_in()) {
        $user_id = $_SESSION['user_id'];
        $query = query_select("users");
        $query .= query_select_where("user_id", $user_id);
        $user = get_array_from_db($query);
        $user = $user[0];
    } else {
        redirect_to("not_found.php");
    }
         $message = $user->lang['PTT_ADD_TAGS_NO_TAGS'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $meta_info . '">', '</a>');
     }
     trigger_error($message);
     break;
 case 'search':
 default:
     $search_tag = utf8_normalize_nfc(request_var('tag', '', true));
     if ($search_tag == '') {
         $template->assign_vars(array('S_TAG_SEARCH_ACTION' => append_sid("{$phpbb_root_path}phpbb_topic_tagging.{$phpEx}", 'mode=search'), 'S_SEARCH_STRING' => $search_tag));
         page_header($user->lang['PTT_TAGS_RESULT_TITLE']);
         $template->set_filenames(array('body' => 'phpbb_topic_tagging_search.html'));
         page_footer();
     } else {
         $start = request_var('start', 0);
         $result_set = search_tags($search_tag, $start);
         $topics_count = get_num_rows($search_tag);
         $s_type_switch = 0;
         if ($topics_count > 0) {
             foreach ($result_set as $row) {
                 $topic_id = $row['topic_id'];
                 $forum_id = $row['forum_id'];
                 // This will allow the style designer to output a different header
                 // or even separate the list of announcements from sticky and normal topics
                 $s_type_switch_test = $row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL ? 1 : 0;
                 // Replies
                 $replies = $auth->acl_get('m_approve', $forum_id) ? $row['topic_replies_real'] : $row['topic_replies'];
                 if ($row['topic_status'] == ITEM_MOVED) {
                     $topic_id = $row['topic_moved_id'];
                     $unread_topic = false;
                 } else {
                     $unread_topic = isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id] ? true : false;
Ejemplo n.º 6
0
						<input type="hidden" name="forum_id" value="<?php 
echo $forum['forum_id'];
?>
">
						<input type="submit" name="submit" value="Update" class="button">		
					</td>
				</tr>
				</form>

				<form method="post" action="validation.php">
				<tr>
					<td>Change Position</td>
					<td>
						<select name="new_position" class="text">
							<?php 
$forum_num = get_num_rows("forums", "section_id", $forum['section_id']);
for ($i = 1; $i <= $forum_num; $i++) {
    echo "<option value=\"{$i}\" ";
    if ($i == $forum['position']) {
        echo "selected";
    }
    echo "> {$i} </option>";
}
?>
						</select>
					</td>
					<td>
						<input type="hidden" name="action" value="update_forum_position">
						<input type="hidden" name="forum_id" value="<?php 
echo $forum['forum_id'];
?>
Ejemplo n.º 7
0
<?php

require_once "shared/cookies.php";
require_once "shared/functions.php";
require_once "shared/header.php";
require_once "shared/bbCodeParser.php";
connect_to_database();
select_database();
if (!isset($_GET['thread']) || $_GET['thread'] == "" || get_num_rows("threads", "thread_id", $_GET['thread']) == 0) {
    redirect_to("not_found.php");
}
$thread_id = $_GET['thread'];
$query = query_select("posts");
$query .= query_select_where("thread_id", $thread_id);
$query .= query_select_order("time_posted", "ASC");
$posts = get_array_from_db($query);
$thread_author = get_value_from_db("threads", "author_id", "thread_id", $thread_id);
$thread_locked = get_value_from_db("threads", "locked", "thread_id", $thread_id);
//if the thread is locked, no one is allowed to post
if (logged_in() && !$thread_locked) {
    echo "<form method=\"post\" action=\"new_post.php\">";
    echo "<input type=\"hidden\" name=\"thread_id\" value=\"{$thread_id}\" >";
    echo "<input type=\"submit\" name=\"submit\" value=\"+ Reply to this thread\" class=\"button plus\">";
    echo "</form>";
}
echo "<div class=\"listBoxOuter\">";
echo "<div class=\"listBoxTitle\">";
if ($thread_locked) {
    echo "<span class=\"locked\">";
    echo "<img src=\"images/lock.png\" width=\"20\" height=\"25\" title=\"This Thread is locked.\" style=\"vertical-align:bottom\">";
    echo "</span>";
Ejemplo n.º 8
0
        die("Error executing query: " . mysql_error());
    }
    $query = " UPDATE forums SET position = ( SELECT @pos := @pos + 1 ) WHERE section_id = {$section_id} ORDER BY position ASC ";
    $result = mysql_query($query, $connection);
    if (!$result) {
        die("Error executing query: " . mysql_error());
    }
    close_connection($connection);
    redirect_to("index_.php");
}
//delete section
if ($_POST['submit'] == "Delete" && $_POST['action'] == "delete_section") {
    connect_to_database();
    select_database();
    $section_id = $_POST['section_id'];
    if (get_num_rows("forums", "section_id", $section_id) == 0) {
        //means that the section is empty
        $query = " DELETE FROM sections\n\t\t\t\t\t\tWHERE section_id = {$section_id}\n\t\t\t";
        $result = mysql_query($query, $connection);
        if (!$result) {
            die("Database query failed: " . mysql_error());
        }
    } else {
        $query = "\n\t\t\t\tDELETE FROM \n\t\t\t\t  sections, forums, threads, posts \n\t\t\t\tUSING \n\t\t\t\t  sections\n\t\t\t\tJOIN \n\t\t\t\t  forums ON sections.section_id = forums.section_id\n\t\t\t\tJOIN \n\t\t\t\t  threads ON forums.forum_id = threads.forum_id\n\t\t\t\tJOIN \n\t\t\t\t  posts ON threads.thread_id = posts.thread_id\n\t\t\t\tWHERE \n\t\t\t\t  sections.section_id = {$section_id}\n\t\t\t";
        $result = mysql_query($query, $connection);
        if (!$result) {
            die("Database query failed: " . mysql_error());
        }
        if (mysql_affected_rows($connection) == 0) {
            //means that all forums inside this section is empty
            //deletes section manually
Ejemplo n.º 9
0
    echo "{$section['section_name']}";
    echo "</div>";
    echo "<table class=\"listBoxTable\">";
    echo "<tr>";
    echo "<th style=\"width:800px\">Forum</th>";
    echo "<th style=\"width:150px\">Threads</th>";
    echo "</tr>";
    if (empty($forums)) {
        echo "<tr><td colspan=\"2\" class=\"center\">Section empty.</td></tr>";
    } else {
        foreach ($forums as $forum) {
            echo "<tr>";
            echo "<td class=\"table_name\">";
            if ($forum['locked']) {
                echo "<span class=\"locked\">";
                echo "<img src=\"images/lock.png\" width=\"20\" height=\"25\" title=\"This Forum is locked.\" style=\"vertical-align:bottom\">";
                echo "</span>";
            }
            echo "<a href=\"forum.php?forum={$forum['forum_id']}\">{$forum['forum_name']}</a><br />";
            echo "<div class=\"description\">{$forum['description']}</div>";
            echo "</td>";
            echo "<td class=\"table_thread\">" . get_num_rows("threads", "forum_id", $forum['forum_id']) . "</td>";
            echo "</tr>";
        }
    }
    echo "</table>";
    echo "<div class=\"listBottom\">";
    echo "</div>";
    echo "</div>";
}
require_once "shared/footer.php";
Ejemplo n.º 10
0
}
echo get_value_from_db("forums", "forum_name", "forum_id", $forum_id);
echo "</div>";
echo "<table class=\"listBoxTable\">";
echo "<tr>";
echo "<th style=\"width:850px\">Thread</th>";
echo "<th style=\"width:150px\">Replies</th>";
echo "<th style=\"width:300px\">Last Post</th>";
echo "</tr>";
if (empty($threads)) {
    echo "<tr><td colspan=\"3\" class=\"center bold\">There are currently no threads in this forum.</td></tr>";
} else {
    foreach ($threads as $thread) {
        $poster_id = $thread['author_id'];
        $last_poster_id = get_value_from_db("posts", "posted_by", "post_id", $thread['last_post_id']);
        $num_of_threads = get_num_rows("posts", "thread_id", $thread['thread_id']) - 1;
        $last_post = "#" . $thread['last_post_id'];
        echo "<tr>";
        echo "<td class=\"table_name\">";
        if ($thread['locked']) {
            echo "<span class=\"locked\">";
            echo "<img src=\"images/lock.png\" width=\"20\" height=\"25\" title=\"This Thread is locked.\" style=\"vertical-align:bottom\">";
            echo "</span>";
        }
        echo "<a href=\"thread.php?thread={$thread['thread_id']}\">{$thread['thread_name']}</a>";
        echo "<div class=\"description\">by <a href=\"profile.php?user={$poster_id}\">" . get_value_from_db("users", "username", "user_id", $poster_id) . "</a></div>";
        echo "</td>";
        echo "<td class=\"table_thread\">" . $num_of_threads . "</td>";
        echo "<td class=\"table_thread\">";
        echo "<a href=\"profile.php?user={$last_poster_id}\">" . get_value_from_db("users", "username", "user_id", $last_poster_id) . "</a>";
        echo "<a href=\"thread.php?thread={$thread['thread_id']}{$last_post}\">>></a><br />";
Ejemplo n.º 11
0
Archivo: view.php Proyecto: Tkachov/POD
<div class="table_panel">
	<h1><?php 
echo $target;
?>
</h1>
	<span><?php 
echo get_num_rows($client, $target);
?>
</span>
	<!-- TODO get edit table button working -->
	<a class="button delete" href=<?php 
echo "\"?tables&action=delete&target=" . $target . "\"";
?>
></a>
	<a class="button edit" href=<?php 
echo "\"?tables&action=edit&target=" . $target . "\"";
?>
></a>
	<a class="button add" href=<?php 
echo "\"?tables&action=add_entry&target=" . $target . "\"";
?>
><div class="plus-sign"></div></a>
</div>

<div id="save_message" style="display: none;"></div>
<?php 
$query = "select ROWID, a.* from " . $target . " a where rownum<50;";
$result = odbc_exec($client->get_connection(), $query);
make_results_table($result, false, $target);
?>
Ejemplo n.º 12
0
function submit_create_action($sql)
{
    //Führt eine Create-Anweisung durch und ermittelt danach die Anzahl der aktuellen Spalten
    // und legt diese im Array ab
    global $restore;
    $tablename = get_tablename($sql);
    if (DEBUG) {
        echo "<br>Tabellenname: " . $tablename;
        echo "<br>Create: " . $sql;
    }
    $res = mysql_query($sql);
    if (!$res === false) {
        if (DEBUG) {
            echo "<br>Create-Anweisung erfolgreich ausgeführt.";
        }
        $restore['actual_table'] = $tablename;
        $restore['table_ready']++;
    } else {
        //erster Versuch die Tabelle anzulegen hat nicht geklappt
        // versuchen wir es mal mit der alten Syntax
        $res = mysql_query(downgrade($sql));
        if (!$res === false) {
            if (DEBUG) {
                echo "<br>Create-Anweisung nach Downgrade erfolgreich ausgeführt.";
            }
            $restore['actual_table'] = $tablename;
            $restore['table_ready']++;
        } else {
            SQLError($sql, 'Couldn\'t create table: ' . $tablename);
            die;
        }
    }
    return get_num_rows($tablename);
}