Пример #1
0
/**
 * checks if the page is accessed from within the local net.
 * If not, displays a simple error page and exits
 */
function localnet_or_die()
{
    if (!localnet()) {
        errorpage('Forbidden', 'You are not allowed to access this page');
    }
}
Пример #2
0
/**
 * Assigns the searchresults/browselist to the smarty engine
 *
 * @param   array   indexed array containing the item data
 */
function tpl_list($list)
{
    global $smarty, $config;
    global $listcolumns;
    for ($i = 0; $i < count($list); $i++) {
        // setup imgurls
        $list[$i]['imgurl'] = $config['thumbnail'] ? getThumbnail($list[$i]['imgurl']) : '';
        //2015-10-6 Alex ADD start
        $list[$i]['studios'] = getItemStudios($list[$i]['id'], true);
        //2015-10-6 Alex ADD end
        // check for flagfile
        $languages = $list[$i]['language'];
        $flagfile = img('flags/' . $languages . '.gif');
        if (file_exists($flagfile)) {
            // one langage
            $list[$i]['flagfile'][$languages] = $flagfile;
            $list[$i]['language'] = array($list[$i]['language']);
        } else {
            // multiple languages
            $langary = preg_split('/,\\s*/', $languages);
            $list[$i]['language'] = $langary;
            // assign them all
            foreach ($langary as $languagepart) {
                $flagfile = img('flags/' . $languagepart . '.gif');
                if (file_exists($flagfile)) {
                    $list[$i]['flagfile'][$languagepart] = $flagfile;
                }
            }
        }
        // is this file editable?
        if (localnet()) {
            $list[$i]['editable'] = $config['multiuser'] ? check_permission(PERM_WRITE, $list[$i]['owner_id']) : true;
        } else {
            $list[$i]['editable'] = false;
        }
        /*
            uncomment this to allow display of rating in the 'Browse' tab
            require_once 'custom.php';
            customfields($list[$i], 'out');
        */
    }
    // do adultcheck
    if (is_array($list)) {
        $list = array_filter($list, create_function('$video', 'return adultcheck($video["id"]);'));
    }
    // enable dynamic columns in list view
    $smarty->assign('listcolumns', session_get('listcolumns'));
    $smarty->assign('list', $list);
    // show total number of movies in footer
    $smarty->assign('totalresults', count($list));
}
Пример #3
0
              FROM ' . TBL_DATA . '   
         LEFT JOIN ' . TBL_USERS . ' ON owner_id = ' . TBL_USERS . '.id  
         LEFT JOIN ' . TBL_USERSEEN . ' 
                ON ' . TBL_DATA . '.id = ' . TBL_USERSEEN . '.video_id AND ' . TBL_USERSEEN . '.user_id = ' . get_current_user_id() . '
         LEFT JOIN ' . TBL_MEDIATYPES . ' ON mediatype = ' . TBL_MEDIATYPES . '.id  
             WHERE ' . TBL_DATA . '.id = ' . $id;
 $res = runSQL($SELECT);
 // existing id?
 if (!count($res)) {
     redirect('index.php');
 }
 // get the item
 $video = $res[0];
 // is it editable/ copyable?
 $video['editable'] = localnet();
 $video['copyable'] = localnet();
 // multi-user permissions
 if ($config['multiuser']) {
     $video['editable'] = $video['editable'] && check_permission(PERM_WRITE, get_userid($video['owner']));
     $video['copyable'] = $video['copyable'] && check_permission(PERM_WRITE, PERM_ANY);
 }
 // save seen state
 if ($save) {
     set_userseen($id, $seen);
     $video['seen'] = $seen;
     // store in video for display
 }
 // diskid to global scope:
 $diskid = $video['diskid'];
 // check if it is lent and to whom- save query if id not set
 if ($diskid) {