/** * Views list of videos * * @param type $url * @param type $adminHash * @param type $dvd */ function viewVideoList($url, $adminHash, $dvd = 0) { $dbh = new Database(); $sth = $dbh->prepare("SELECT id FROM " . DB_PREFIX . "videos WHERE dvd = ? ORDER BY id DESC"); $sth->execute(array($dvd)); $videoCount = 0; while ($id = $sth->fetchColumn()) { $videoCount++; $video = new Video(); $video->load($id); include '../views/admin/singleVideo.php'; } if ($videoCount == 0) { include '../views/admin/noVideos.php'; } }
} if ($_GET['cid']) { $cid = $_GET['cid']; if ($obj_content_type->type) { switch ($obj_content_type->type) { case 'Image': $show_media = new Image(); break; case 'Audio': $show_media = new Audio(); break; case 'Video': $show_media = new Video(); break; } $show_media->load($cid); // loading tags for media $tags_array = Tag::load_tags_for_content($show_media->content_id); $tags_string = ""; if (count($tags_array) > 0) { for ($counter = 0; $counter < count($tags_array); $counter++) { $tags_string .= $tags_array[$counter]['name'] . ", "; } $tags_string = substr($tags_string, 0, strlen($tags_string) - 2); } $show_media->tags = $tags_string; // loading content's contentcollection information $cc_info = ContentCollection::load_collection($show_media->parent_collection_id, $_SESSION['user']['id']); } } if ($uid == $_SESSION['user']['id']) {
public static function add_default_media($user_id, $type = '', $network_info = NULL) { // global var $path_prefix has been removed - please, use PA::$path static variable require_once "api/User/User.php"; require_once "api/Album/Album.php"; require_once "api/Image/Image.php"; require_once "api/Audio/Audio.php"; require_once "api/Video/Video.php"; require_once "api/ContentCollection/ContentCollection.php"; //$extra contains networks extra information $extra = unserialize($network_info->extra); /** setting common variables according to media type */ if ($type == '') { $net_extra_ccid_str = $extra['user_defaults']['default_image_gallery']; $alb_type = IMAGE_ALBUM; $new_img = new Image(); } elseif ($type == '_audio') { $net_extra_ccid_str = $extra['user_defaults']['default_audio_gallery']; $alb_type = AUDIO_ALBUM; $new_img = new Audio(); } elseif ($type == '_video') { $net_extra_ccid_str = $extra['user_defaults']['default_video_gallery']; $alb_type = VIDEO_ALBUM; $new_img = new Video(); } /** getting array of content collection from comma separated string */ if (!empty($net_extra_ccid_str)) { $net_extra_ccid = explode(',', $net_extra_ccid_str); /** setting all content collection variables */ if (count($net_extra_ccid) >= 1) { for ($i = 0; $i < count($net_extra_ccid); $i++) { $new_im_al = new Album($alb_type); $new_im_al_default = new Album($alb_type); $new_im_al->load((int) $net_extra_ccid[$i]); $content_collection_obj = new ContentCollection(); $content_collection_obj->collection_id = $new_im_al->collection_id; $contents = $content_collection_obj->get_contents_for_collection(); $new_im_al_default->title = $new_im_al->title; $new_im_al_default->description = $new_im_al->description; $new_im_al_default->author_id = $user_id; $new_im_al_default->type = 2; // FOR ALBUM, type is 2 $new_im_al_default->save(); /** Setting content variable */ for ($j = 0; $j < count($contents); $j++) { if ($contents[$j]['type'] != 7) { // If content is not a SB content if ($alb_type == IMAGE_ALBUM) { $new_img_default = new Image(); $new_img_default->type = IMAGE; } elseif ($alb_type == AUDIO_ALBUM) { $new_img_default = new Audio(); $new_img_default->type = AUDIO; } elseif ($alb_type == VIDEO_ALBUM) { $new_img_default = new Video(); $new_img_default->type = VIDEO; } $new_img->load((int) $contents[$j]['content_id']); $new_img_default->file_name = $new_img->file_name; $new_img_default->file_perm = $new_img->file_perm; $new_img_default->title = $contents[$j]['title']; $new_img_default->body = $contents[$j]['body']; $tags = Tag::load_tags_for_content($contents[$j]['content_id']); $new_img_default->allow_comments = 1; $new_img_default->author_id = $user_id; $new_img_default->parent_collection_id = $new_im_al_default->collection_id; $new_img_default->save(); if (!empty($tags)) { $tag_array = array(); if (is_array($tags)) { for ($i = 0; $i < count($tags); $i++) { $tag_array[] = $tags[$i]['name']; } } Tag::add_tags_to_content($new_img_default->content_id, $tag_array); } } else { // If content is a SB content //TODO: handling of SB content if it is in media gallery. } } } } } }