<td><?php echo lang('POST_TYPE'); ?> </td> <td><?php echo lang('DATE_CREATED'); ?> </td> <td></td> </tr> </thead> <?php try { $posts = new Posts(); $posts = $posts->get(); } catch (Exception $e) { echo "Error : " . $e->GetMessage(); } if ($posts) { $postIcons = array('message' => 'align-left', 'link' => 'link', 'image' => 'picture', 'video' => 'facetime-video'); foreach ($posts as $post) { echo "<tr>\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t<input type='checkbox' class='checkbox checkbox-style' name='' id='' value='' />\r\n\t\t\t\t\t\t\t<label for=''></label>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td>" . escape($post->post_title) . "</td>\r\n\t\t\t\t\t\t<td><h4><span class='label label-default'><span class='glyphicon glyphicon-" . $postIcons[Posts::PostType($post->content)] . "'> " . ucfirst(Posts::PostType($post->content)) . "</span></span></h4></td>\r\n\t\t\t\t\t\t<td>" . $post->date_created . "</td>\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t<a href='posts.php?action=delete&id=" . $post->id . "' title='" . lang('DELETE') . "' class='btn btn-danger delete' id='" . $post->id . "' onclick='return confirm(\"" . lang('POST_DELETE_CONFIRM') . "\");'><span class='glyphicon glyphicon-trash'></span> " . lang('DELETE') . "</a>\r\n\t\t\t\t\t\t<a href='index.php?post_id=" . $post->id . "' title='" . lang('POST') . "' class='btn btn-primary' id='" . $post->id . "'><span class='glyphicon glyphicon-pencil'></span> " . lang('POST') . "</a>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t</tr>"; } } ?> </table> </div> </div> <?php $template->footer();
// Set Post type if (Posts::PostType($getPost->content) == "link") { $_POST['postType'] = "link"; $_POST['link'] = escape($post->link); $_POST['picture'] = escape($post->picture); $_POST['name'] = escape($post->name); $_POST['caption'] = escape($post->caption); $_POST['description'] = escape($post->description); } // Set Post type if (Posts::PostType($getPost->content) == "image") { $_POST['postType'] = "image"; $_POST['image'] = escape($post->image); } // Set Post type if (Posts::PostType($getPost->content) == "video") { $_POST['postType'] = "video"; $_POST['video'] = escape($post->video); $_POST['description'] = isset($post->description) ? escape($post->description) : ""; } } } else { $_POST['postType'] = "message"; } $template->header("Home"); if (Session::exists('home')) { foreach (Session::Flash('home') as $error) { echo "<div class='alert alert-" . $error['type'] . "' role='alert'>"; echo "<a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>"; echo "<span class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></span>"; echo " " . $error['message'];
// Check if the post date <= current datetime of the user // Get current time $currentDateTime = new DateTime(); $next_post_time = new DateTime($scheduled->next_post_time); if (strtotime($currentDateTime->format("Y-m-d H:i")) >= strtotime($next_post_time->format("Y-m-d H:i"))) { // get the post $post = $posts->GetPost($scheduled->post_id); // Post is ready if (count($post) == 0) { logs::Save($scheduled->id, lang('POST_NOT_FOUND')); } else { // Send the post $params = array(); // Post param $postParam = json_decode($post->content); $postType = Posts::PostType($post->content); // Get list of groups $groups = json_decode($scheduled->targets, true); // Check if the current target is the last one if ($scheduled->next_target + 1 >= count($groups)) { // This was the last target DB::GetInstance()->update("scheduledposts", "id", $scheduled->id, array("status" => "1")); } else { // Update the scheduled $currentDateTime->modify("+" . $scheduled->post_interval . " minutes"); // Set the next target DB::GetInstance()->update("scheduledposts", "id", $scheduled->id, array("next_target" => $scheduled->next_target + 1, "next_post_time" => $currentDateTime->format('Y-m-d H:i'))); } $message = $spintax->get($postParam->message); // If is unique post enabled if (isset($user->Options()->uniquePost)) {