pwg_db_real_escape_string($video['title']), 'author' => pwg_db_real_escape_string($video['author']), 'is_gvideo' => 1, ); if ( $_POST['sync_description'] and !empty($video['description']) ) { $updates['comment'] = pwg_db_real_escape_string($video['description']); } if ( $_POST['sync_tags'] and !empty($video['tags']) ) { set_tags(get_tag_ids(implode(',', $video['tags'])), $image_id); } single_update( IMAGES_TABLE, $updates, array('id' => $image_id), true ); // register video if ($_POST['size_common'] == 'true') { $_POST['width'] = $_POST['height'] = ''; } else if ( !preg_match('#^([0-9]+)$#', $_POST['width']) or !preg_match('#^([0-9]+)$#', $_POST['height']) ) { array_push($page['errors'], l10n('Width and height must be integers')); $_POST['width'] = $_POST['height'] = ''; } if ($_POST['autoplay_common'] == 'true') { $_POST['autoplay'] = ''; } $insert = array( 'picture_id' => $image_id, 'url' => $video['url'], 'type' => $video['type'], 'video_id' => $video['video_id'], 'width' => $_POST['width'], 'height' => $_POST['height'], 'autoplay' => $_POST['autoplay'], ); single_insert( GVIDEO_TABLE, $insert ); $query = ' SELECT id, name, permalink FROM '.CATEGORIES_TABLE.' WHERE id = '.$_POST['category'].' ;'; $category = pwg_db_fetch_assoc(pwg_query($query)); array_push($page['infos'], sprintf( l10n('Video successfully added. View'), make_picture_url(array( 'image_id' => $image_id, 'category' => array( 'id' => $category['id'], 'name' => $category['name'], 'permalink' => $category['permalink'], ), )) )); unset($_POST); } } // categories $query = ' SELECT id,name,uppercats,global_rank FROM '.CATEGORIES_TABLE.' ;'; display_select_cat_wrapper($query, array(), 'category_parent_options'); // upload limit $upload_max_filesize = min( get_ini_size('upload_max_filesize'), get_ini_size('post_max_size') ); $upload_max_filesize_shorthand = ($upload_max_filesize == get_ini_size('upload_max_filesize')) ? get_ini_size('upload_max_filesize', false) : get_ini_size('post_max_filesize', false); // template $template->assign(array( 'upload_max_filesize' => $upload_max_filesize, 'upload_max_filesize_shorthand' => $upload_max_filesize_shorthand, 'gd_available' => function_exists('imagecreatetruecolor'), 'gvideo' => $conf['gvideo'], 'POST' => @$_POST, )); $template->set_filename('gvideo_content', dirname(__FILE__) . '/template/add.tpl'); ?>