<table class="table table-striped table-hover table-bordered"> <tr> <th>ردیف</th> <th>شماره بلاگ</th> <th width="20%">عنوان</th> <th>عنوان انگلیسی</th> <th>تاریخ ثبت</th> <th>تعداد بازدید</th> <th>فعال</th> <th>عملیات</th> </tr> <?php if (isset($_POST['edit'])) { DatabaseHandler::execute("UPDATE `blogs` SET `activate` = !`activate` WHERE `id` = '{$_POST['blog_id']}' ; "); } $blogs = BLOGS::blogs_SelectAll(); $i = 1; foreach ($blogs as $blog) { $blog["add_time"] = jdate("Y/m/d", $blog["add_time"]); $checked = ""; if ($blog["activate"]) { $blog["activate"] = "<span style='color:green'>فعال</span>"; $checked = "checked"; } else { $blog["activate"] = "<span style='color:red'>غیر فعال</span>"; } echo "\n\t\t <tr>\n\t\t \t\t\t<td>{$i}</td>\n\t\t\t\t\t<td>{$blog['id']}</td>\n\t\t\t\t\t<td>{$blog['title']}</td>\n\t\t\t\t\t<td>{$blog['title_en']}</td>\n\t\t\t\t\t<td>{$blog['add_time']}</td>\n\t\t\t\t\t<td>{$blog['hit_count']}</td>\n\t\t\t\t\t<td>{$blog['activate']} <form method='post' id='form{$blog['id']}'><input type='hidden' name='blog_id' value='{$blog['id']}'><input onchange='\$(" . '"#form' . $blog["id"] . '"' . ").submit();' type='checkbox' name='edit' class='edit'></form></td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<a href='?page=blog_insert&id={$blog['id']}'>ویرایش</a>\n\t\t\t\t\t</td>\t\n\t\t </tr>"; $i++; } ?>
<th>نام</th> <th>ایمیل</th> <th>متن کامنت</th> <th>تاریخ ثبت</th> <th>شماره پست</th> <th>فعال</th> <th>عملیات</th> </tr> <?php if (isset($_POST['edit'])) { DatabaseHandler::execute("UPDATE `comments` SET `activate` = !`activate` WHERE `id` = '{$_POST['comment_id']}' ; "); } $comments = COMMENTS::comments_SelectAll(); $i = 1; foreach ($comments as $comment) { $comment["add_time"] = jdate("Y/m/d", $comment["add_time"]); $checked = ""; if ($comment["activate"]) { $comment["activate"] = "<span style='color:green'>فعال</span>"; $checked = "checked"; } else { $comment["activate"] = "<span style='color:red'>غیر فعال</span>"; } $blog = BLOGS::blogs_SelectRow($comment["blog_id"]); echo "\n\t\t <tr>\n\t\t \t\t\t<td>{$i}</td>\n\t\t\t\t\t<td>{$comment['full_name']}</td>\n\t\t\t\t\t<td>{$comment['mail']}</td>\n\t\t\t\t\t<td>{$comment['text']}</td>\n\t\t\t\t\t<td>{$comment['add_time']}</td>\n\t\t\t\t\t<td>{$blog['title']}</td>\n\t\t\t\t\t<td>{$comment['activate']} <form method='post' id='form{$comment['id']}'><input type='hidden' name='comment_id' value='{$comment['id']}'><input onchange='\$(" . '"#form' . $comment["id"] . '"' . ").submit();' type='checkbox' name='edit' class='edit'></form></td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<a href='#'>پاسخ</a>\n\t\t\t\t\t</td>\t\n\t\t </tr>"; $i++; } ?> </table>
if (isset($_POST['insert'])) { $title = $_POST['title']; $title_en = $_POST['title_en']; $image = $_POST["image"]; $text = $_POST['text']; $source = $_POST['source']; $video = $_POST['video']; $description = $_POST['description']; $keywords = $_POST['keywords']; $read_time = $_POST['read_time']; $admin_id = $_SESSION['MM_admin_id']; $hit_count = 0; $add_time = time(); $modify_time = 0; $activate = 0; $insert_blog = BLOGS::blogs_Insert($title, $title_en, $image, $text, $source, $video, $description, $read_time, $hit_count, $admin_id, $add_time, $modify_time, $activate); if ($insert_blog) { $blog_id = DatabaseHandler::GetOne("SELECT `id` FROM blogs WHERE `add_time` = '{$add_time}' ; "); $keywords = explode(",", $keywords); foreach ($keywords as $keyword) { $keyword = trim($keyword); BLOG_KEYWORDS::blog_keywords_Insert($blog_id, $keyword); } if (isset($_POST['types'])) { $types = $_POST['types']; foreach ($types as $type) { $type = explode("-", $type); B_T::b_t_Insert($blog_id, $type['1']); } } if (isset($_POST['subjects'])) {