// remove all rows where post_id = this post $res = $conn->query($query); dbQueryCheck($res, $conn); if ($values) { $query = "INSERT INTO c_posts_cats (post_id, cat_id) VALUES " . implode(',', $values); // IT ALLOWS DUPLICATION, ALSO DOESN'T UPDATE (DELETE) // execute the query and get error message if it fails if (!$conn->query($query)) { $helper = 1; goto end3; } } } end3: if (isset($helper)) { goToError('?switch=new_post', _e('post_submitted_but_not_category', '', '', true)); } } ?> <?php if (isset($_GET['id']) && $_GET['id'] > 0) { $id = $_GET['id']; $conn = MySQL::open_conn(); $query = "SELECT * FROM c_posts WHERE ID = {$id} LIMIT 1"; $res = $conn->query($query); dbQueryCheck($res, $conn); $row = $res->fetch_assoc(); $title_text = htmlspecialchars($row['post_title']); $excerpt = $row['post_excerpt']; $content_text = htmlspecialchars($row['post_content']);
$vip_expire = null; } else { $vip = $bp_vip; $vip_start = strtotime($current_datetime); $vip_expire = strtotime('+' . $vip . ' day', $vip_start); $vip_start = $current_datetime; $vip_expire = date('Y-m-d H:i:s', $vip_expire); } if (Users::userExists($username)) { goToError('?switch=users#new_user', _e('username_already_exists', '', '', true)); } if (!$username || !$password) { goToError('?switch=users#new_user', _e('username_password_wrong', '', '', true)); } if ($bp_role == 'Admin') { $role = 4; } elseif ($bp_role == 'Super User') { $role = 3; } elseif ($bp_role == 'Subscriber') { $role = 2; } $query = "INSERT INTO c_users (user_login, user_pass, user_email, user_role, vip_status, vip_start_date, vip_expire_date, user_registered) "; $query .= "VALUES ('{$username}', '{$password}', '{$email}', {$role}, {$vip}, '{$vip_start}', '{$vip_expire}', '{$current_datetime}')"; $res = $conn->query($query); if (!$res) { goToError('?switch=users#new_user', _e('cant_create_new_user', '', '', true)); } ob_end_clean(); redirectTo('?switch=users#users_list'); end: }
$res = $conn->query($query); $query = "SELECT * FROM c_posts_cats WHERE cat_id IS NULL"; $res = $conn->query($query); while ($row = $res->fetch_assoc()) { $post_id = $row['post_id']; $id2 = $row['ID']; $query2 = "SELECT * FROM c_posts_cats WHERE cat_id IS NULL AND post_id = {$post_id}"; $q_res = $conn->query($query2)->num_rows; if ($q_res == 1) { $query = "UPDATE c_posts_cats SET cat_id = {$uncategorized_id} WHERE ID = {$id2}"; $res2 = $conn->query($query); } } end: if (isset($helper) && $helper == 1) { goToError('?switch=categories#manage_cats', _e('cant_delete_default_category', '', '', true)); } //ob_end_clean(); redirectTo('index.php?switch=categories#manage_cats'); } ?> <table width="auto" class="table table-bordered table-hover"> <tr> <th><?php _e('', 'ID'); ?> </th> <th><?php _e('name'); ?> </th>
<?php if (isset($_POST["submit_delete_user"])) { $id = $_GET['id']; if ($id == Users::getIDBySeassion()) { goToError('index.php?switch=users#users_list', _e('cant_remove_logged_in_user', '', '', true)); goto end; } $query = "DELETE FROM c_users WHERE ID = {$id} LIMIT 1"; $res = $conn->query($query); dbQueryCheck($res, $conn); ob_end_clean(); redirectTo('index.php?switch=users#users_list'); end: }
if ($row) { $maxid = $row['max']; ob_end_clean(); redirectTo('index.php?switch=utilities&tab=email_templates&sub=new_template&id=' . $maxid); } else { redirectTo('index.php?switch=utilities&tab=email_templates'); } } if (isset($_POST['update_template_submit'])) { $name = escapeSingleQuotes($_POST['email_template_name']); $content_html = $_POST['email_template_html']; $content_plain = $_POST['email_template_plain']; $query = "UPDATE c_emails SET name = '{$name}', template_html = '{$content_html}', template_plain = '{$content_plain}'"; $res = MySQL::open_conn()->query($query); if (!$res) { goToError('?switch=utilities&tab=email_templates&sub=new_template', _e('cant_make_or_update_new_template', '', '', true)); } } if (isset($_GET['id'])) { $id = $_GET['id']; $query = "SELECT * FROM c_emails WHERE ID = {$id} LIMIT 1"; $row = MySQL::open_conn()->query($query)->fetch_assoc(); $template_name = $row['name']; $template_html = $row['template_html']; $template_plain = $row['template_plain']; } else { $template_name = null; $template_html = null; $template_plain = null; } ?>