예제 #1
0
파일: show.php 프로젝트: hongweipeng/screen
<?php

require '../include/init.inc.php';
$list = Flash::getList(array('status' => 1));
foreach ($list as &$val) {
    preg_match('#{{(\\d)}}#', $val['url'], $matches);
    if (count($matches) > 0) {
        if ($matches[1] > 0) {
            if (strpos($val['url'], '?')) {
                $val['url'] .= '&start_date=' . date("Y-m-d", time() - 86400 * $matches[1]);
            } else {
                $val['url'] .= '?start_date=' . date("Y-m-d", time() - 86400 * $matches[1]);
            }
            $val['url'] .= '&end_date=' . date("Y-m-d", time());
        }
        $val['url'] = preg_replace('#{{\\d}}#', '', $val['url']);
    }
}
Template::assign('flashtime', System::get('flashtime') * 1000);
Template::assign('list', json_encode($list));
Template::display('flash/show.tpl');
예제 #2
0
            $sort = intval($_POST['sort']);
            Flash::update($id, array('name' => $name, 'title' => $title, 'url' => $url, 'status' => $status, 'sort' => $sort));
            Common::jumpUrl("flash/manage.php");
        } else {
            $item = Flash::getById($id);
            Template::assign('item', $item);
            Template::display('flash/edit.tpl');
        }
    } else {
        if (isset($_GET['del'])) {
            $id = intval($_GET['id']);
            if ($id < 1) {
                Common::jumpUrl("flash/manage.php");
            }
            Flash::del($id);
            Common::jumpUrl("flash/manage.php");
        } else {
            if (isset($_GET['uptime'])) {
                if (intval($_GET['time']) > 1) {
                    System::set('flashtime', intval($_GET['time']));
                }
                Common::jumpUrl("flash/manage.php");
            } else {
                $list = Flash::getList();
                Template::assign('list', $list);
                Template::assign('flashtime', System::get('flashtime'));
                Template::display('flash/manage.tpl');
            }
        }
    }
}