Exemple #1
0
| Create the database file and insert the default sittengs
|
|--------------------------------------------------------------------------
*/
$dbFile = ABSPATH . '/database/' . Config::Get('db/dbname') . '.db';
if (!file_exists($dbFile)) {
    Session::Put("setup", true);
    Redirect::To("install");
    die;
}
/*
|--------------------------------------------------------------------------
| Check If there an admin 
|--------------------------------------------------------------------------
|
*/
if (file_exists($dbFile)) {
    try {
        if (DB::GetInstance()->queryGet("SELECT id FROM users where roles = 1 ")->count() == 0) {
            Session::Put("setup", true);
            Redirect::To("install");
            die;
        }
    } catch (Exception $ex) {
        session_destroy();
        die("Some database table(s) is missing Please delete the database file an reinstall the application.");
    }
}
// Everything is okay
Session::Delete("setup");
Options::CheckSiteUrl();
Exemple #2
0
<?php

if (!defined('ABSPATH')) {
    exit('No direct script access allowed');
}
if (!Session::Exists('scheduleInProcess')) {
    // Set a session to prevent multi proccess at once
    Session::Put('scheduleInProcess', true);
    // Get posts that have status 0 (not completed) and pause = 0 and date <= current date
    $scheduledposts = new scheduledposts();
    $fb = new Facebook();
    $posts = new Posts();
    $spintax = new Spintax();
    foreach ($scheduledposts->post() as $scheduled) {
        $user = new User($scheduled->userid);
        // Set user timezone if the user defined the timezone
        if (isset($user->Options()->timezone)) {
            if ($user->Options()->timezone) {
                date_default_timezone_set($user->Options()->timezone);
            }
        }
        // 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'));