Example #1
0
function exportData($WHERE)
{
    $SQL = 'SELECT ' . TBL_DATA . '.*, 
                    ' . TBL_USERS . '.name AS owner, 
                    ' . TBL_MEDIATYPES . '.name AS mediatype,
                    ' . TBL_LENT . '.who AS lentto,
          CASE WHEN ' . TBL_USERSEEN . '.video_id IS NULL THEN 0 ELSE 1 END AS seen
               FROM ' . TBL_DATA . '
          LEFT JOIN ' . TBL_USERS . ' ON ' . TBL_DATA . '.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_LENT . ' ON ' . TBL_DATA . '.diskid = ' . TBL_LENT . '.diskid 
          LEFT JOIN ' . TBL_MEDIATYPES . ' ON mediatype = ' . TBL_MEDIATYPES . '.id ' . $WHERE;
    $result = runSQL($SQL);
    // do adultcheck
    if (is_array($result)) {
        $result = array_filter($result, create_function('$video', 'return adultcheck($video["id"]);'));
    }
    // genres
    for ($i = 0; $i < count($result); $i++) {
        $result[$i]['genres'] = getItemGenres($result[$i]['id'], true);
    }
    //2015-10-6 Alex ADD start
    // studios
    for ($i = 0; $i < count($result); $i++) {
        $result[$i]['studios'] = getItemStudios($result[$i]['id'], true);
    }
    //2015-10-6 Alex ADD end
    return $result;
}
Example #2
0
/**
 * Assigns the videoinfos to the smarty engine
 */
function tpl_studioedit($studio)
{
    global $smarty, $config, $lang;
    // create a form ready quoted version for each value
    foreach (array_keys($video) as $key) {
        $video['q_' . $key] = formvar($video[$key]);
    }
    // use custom function for language
    $video['f_language'] = custom_language_input('language', $video['language']);
    // create mediatype selectbox
    $smarty->assign('mediatypes', out_mediatypes());
    if (!isset($video['mediatype'])) {
        $video['mediatype'] = $config['mediadefault'];
    }
    // prepare the custom fields
    customfields($video, 'in');
    if ($config['multiuser']) {
        $smarty->assign('owners', out_owners(array('0' => ''), check_permission(PERM_ADMIN) ? false : PERM_WRITE, true));
    }
    // item genres
    $item_genres = getItemGenres($video['id']);
    // new-style
    $smarty->assign('genres', out_genres2($item_genres));
    #dlog(out_genres2($item_genres));
    #dlog($item_genres);
    // classic
    $smarty->assign('genreselect', out_genres($item_genres));
    //2015-10-6 Alex ADD start
    // item studios
    $item_studios = getItemStudios($video['id']);
    // new-style
    $smarty->assign('studios', out_studios2($item_studios));
    // classic
    $smarty->assign('studioselect', out_studios($item_studios));
    //2015-10-6 Alex ADD end
    // assign data
    $smarty->assign('video', $video);
    // get drilldown url for visit link
    if ($video['imdbID']) {
        require_once './engines/engines.php';
        $engine = engineGetEngine($video['imdbID']);
        $smarty->assign('link', engineGetContentUrl($video['imdbID'], $engine));
        $smarty->assign('engine', $engine);
    }
    /*
        // populate autocomplete boxes
        $smarty->assign('audio_codecs', array_extract(runSQL('SELECT DISTINCT audio_codec FROM '.TBL_DATA.' WHERE audio_codec IS NOT NULL'), 'audio_codec'));
        $smarty->assign('video_codecs', array_extract(runSQL('SELECT DISTINCT video_codec FROM '.TBL_DATA.' WHERE video_codec IS NOT NULL'), 'video_codec'));
    */
    $smarty->assign('lookup', array('0' => $lang['radio_look_ignore'], '1' => $lang['radio_look_lookup'], '2' => $lang['radio_look_overwrite']));
    // needed for ajax image lookup
    $smarty->assign('engines', $config['engines']);
}
Example #3
0
    // get fields (according to list) from db to be saved later
    foreach ($video[0] as $name => $val) {
        // don't copy diskid
        if ($name == 'diskid') {
            if ($config['autoid']) {
                ${$name} = getDiskId();
            }
        } else {
            if (in_array($name, $imdb_set_fields)) {
                ${$name} = $val;
            }
        }
    }
    $genres = getItemGenres($copyid);
    //2015-10-6 Alex ADD start
    $studios = getItemStudios($copyid);
    //2015-10-6 Alex ADD end
}
// save data
if ($save) {
    // uncomment the following line to provide simple protection for your own public access videoDB
    //if (!preg_match('/[0-9]{2+}/', $id)) break;
    // implicit owner id if not set
    if (!$owner_id) {
        $owner_id = get_current_user_id();
    }
    // generate diskid
    if (empty($diskid) && $config['autoid'] && $mediatype != MEDIA_WISHLIST) {
        $diskid = getDiskId();
    }
    // write videodata table