示例#1
0
/**
 * Check if this item is already in the database
 */
function is_known_item($id, &$sp_id, &$sp_diskid)
{
    $SQL = "SELECT imdbID, id, diskid\n              FROM " . TBL_DATA . "\n             WHERE imdbID = '" . addslashes($id) . "'\n             ORDER BY diskid DESC";
    $result = runSQL($SQL);
    // do we know this movie?
    if (count($result) && isset($result[0]['imdbID']) && adultcheck($result[0]['id']) && check_videopermission(PERM_READ, $result[0]['id'])) {
        $sp_id = $result[0]['id'];
        $sp_diskid = $result[0]['diskid'];
        if (!$sp_diskid) {
            $sp_diskid = 'no_diskid';
        }
        return true;
    }
    return false;
}
示例#2
0
/**
 * Assigns the header urls to the smarty engine
 *
 * @param string $help    The helpfile to display (optional, without extension)
 * @param string $title   The text to add to html <title> tag (optional, will be html-encoded)
 */
function tpl_header($help = '', $title = '')
{
    global $smarty, $lang, $config;
    global $id, $diskid;
    // viewing is only availble if autorized or public access
    if (auth_check(false)) {
        $header['browse'] = 'index.php';
        if (check_permission(PERM_READ, PERM_ANY)) {
            $header['random'] = 'show.php';
            $header['search'] = 'search.php';
        }
        $header['stats'] = 'stats.php';
        if ($config['imdbBrowser']) {
            $header['trace'] = 'trace.php';
        }
        $header['help'] = 'help.php';
        if ($help) {
            $header['help'] .= '?page=' . $help . '.html';
        }
    }
    // editing is only available in local network
    if (localnet()) {
        if (check_permission(PERM_WRITE, PERM_ANY)) {
            //2015-10-6 Alex ADD start
            $header['studio'] = 'studiolist.php';
            //2015-10-6 Alex ADD end
            $header['new'] = 'edit.php';
            if ($config['showtools']) {
                $header['contrib'] = 'contrib.php';
            }
        }
        if (check_permission(PERM_ADMIN)) {
            $header['setup'] = 'setup.php';
        }
        // edit or show?
        if ($id) {
            if (check_videopermission(PERM_WRITE, $id)) {
                $header['edit'] = 'edit.php?id=' . $id;
            }
            if (!preg_match('/show.php$/', $_SERVER['PHP_SELF'])) {
                $header['view'] = 'show.php?id=' . $id;
            }
            if (check_videopermission(PERM_WRITE, $id)) {
                $header['del'] = 'delete.php?id=' . $id;
            }
        }
        if (check_permission(PERM_WRITE, PERM_ANY)) {
            $header['borrow'] = 'borrow.php';
            if (isset($diskid)) {
                $header['borrow'] .= '?diskid=' . $diskid;
            }
        }
    }
    // multiuser settings
    if ($config['multiuser']) {
        $header['login'] = '******';
        // logged in?
        if (!empty($_COOKIE['VDBusername']) && $_COOKIE['VDBuserid'] != $config['guestid']) {
            $header['profile'] = 'profile.php';
            $smarty->assign('loggedin', $_COOKIE['VDBusername']);
        } else {
            // make sure anonymous users don't get access to trace for security reasons
            unset($header['trace']);
        }
        if (check_permission(PERM_ADMIN)) {
            $header['users'] = 'users.php';
        }
    }
    // determine active tab
    if (preg_match('/(\\w+)\\.php/', $_SERVER['PHP_SELF'], $m)) {
        $tab = strtolower($m[1]);
        switch ($tab) {
            case 'show':
            case 'edit':
                if (!empty($id)) {
                    $header['active'] = $tab;
                } else {
                    $header['active'] = $tab == 'show' ? 'random' : 'new';
                }
                break;
            default:
                /* legacy version 
                   $translate = array('index' => 'browse', 'users' => 'setup', 'permissions' => 'setup', 'delete' => 'show');
                   */
                $translate = array('index' => 'browse', 'permissions' => 'users', 'delete' => 'show');
                if (in_array($tab, array_keys($translate))) {
                    $tab = $translate[$tab];
                }
                $header['active'] = $tab;
        }
    }
    // breadcrumbs
    $breadcrumbs = session_get('breadcrumbs', array());
    $smarty->assign('breadcrumbs', $breadcrumbs);
    $smarty->assign('title', htmlspecialchars($title));
    $smarty->assign('header', $header);
    $smarty->assign('style', $config['style']);
    $smarty->assign('langcode', $config['language']);
}
示例#3
0
文件: show.php 项目: huya1010/videodb
        }
        $id = $result[0]['id'];
        if (!adultcheck($id)) {
            $id = 0;
        }
        //adult movie? -> try again
    }
    // id still empty? go back to index.
    if (empty($id)) {
        redirect('index.php');
    }
}
// get data (id may be empty on a empty database)
if (!empty($id)) {
    // no adult permissions? -> back to index
    if (!adultcheck($id) || !check_videopermission(PERM_READ, $id)) {
        redirect('index.php');
    }
    // XML / RSS / PDF export
    if ($export && $config[$export]) {
        // either (xml|rss|pdf)export
        $func = $export . 'export';
        if ($export == 'rss') {
            $export = 'xml';
        }
        require_once './core/' . $export . '.php';
        if (function_exists($func)) {
            $func('WHERE ' . TBL_DATA . '.id = ' . $id);
        }
        exit;
    }