Ejemplo n.º 1
0
    }
    if (isset($date_on) && $date_on == date("Y-m-d")) {
        Mysql::getInstance()->delete('video_on_tasks', array('video_id' => $video_id));
    }
    if (isset($date_on) && $date_on != date("Y-m-d")) {
        //var_dump($date_on, $_GET['id']); exit;
        $video_on_task = Mysql::getInstance()->from('video_on_tasks')->where(array('video_id' => $video_id))->get()->first();
        $data = array('video_id' => $video_id, 'date_on' => $date_on);
        if (empty($video_on_task)) {
            Mysql::getInstance()->insert('video_on_tasks', $data);
        } else {
            Mysql::getInstance()->update('video_on_tasks', $data, array('video_id' => $video_id));
        }
    } else {
        if ($_GET['accessed'] == 1) {
            Video::switchOnById($video_id);
        } else {
            Video::switchOffById($video_id);
        }
    }
    header("Location: add_video.php?letter=" . @$_GET['letter'] . "&search=" . @urldecode($_GET['search']) . "&page=" . @$_GET['page']);
    exit;
}
if (@$_GET['del']) {
    Admin::checkAccess(AdminAccess::ACCESS_DELETE);
    Video::log(intval(@$_GET['id']), _('video deleted'));
    Mysql::getInstance()->delete('video', array('id' => intval(@$_GET['id'])));
    header("Location: add_video.php?letter=" . @$_GET['letter'] . "&search=" . @$_GET['search'] . "&page=" . @$_GET['page']);
    exit;
}
if (count(@$_POST) > 0) {
Ejemplo n.º 2
0
<?php

include "./common.php";
$today_tasks = Mysql::getInstance()->from('video_on_tasks')->where(array('date_on<=' => 'CURDATE()'))->get()->all();
foreach ($today_tasks as $task) {
    try {
        Video::switchOnById($task['video_id']);
        Mysql::getInstance()->delete('video_on_tasks', array('id' => $task['id']));
    } catch (Exception $e) {
        echo $e->getTraceAsString();
    }
}