示例#1
0
            break;
        case 'removevideo':
            sync_delete($_POST, $_GET['t']);
            break;
        case 'updatevideo':
            if (isset($_POST['id'])) {
                sync_delete(array($_POST['id']), $_GET['t']);
                sync_add($mysql_tables);
            } else {
                echo 'No POST data';
            }
            break;
            /* ##########
             * # IMAGES #
             */
            ##########
        /* ##########
         * # IMAGES #
         */
        ##########
        case 'showimages':
            show_images();
            break;
        case 'addimages':
            add_images($_POST);
            break;
        case 'removeimages':
            remove_images($_POST);
            break;
    }
}
示例#2
0
function sync_delete($id, $table)
{
    $del_array = array($table);
    if ($table == 'movies') {
        array_push($del_array, $table . '_actor', $table . '_genre', $table . '_country', $table . '_studio', $table . '_director', $table . '_stream');
    }
    if ($table == 'tvshows') {
        array_push($del_array, $table . '_actor', $table . '_genre');
    }
    if ($table == 'episodes') {
        array_push($del_array, $table . '_stream');
    }
    foreach ($del_array as $t) {
        $delete_sql = 'DELETE FROM `' . $t . '` WHERE `id` IN ("' . implode('", "', $id) . '")';
        $delete = mysql_q($delete_sql);
    }
    # delete images
    $files_to_remove = array();
    $files = scandir('cache/');
    foreach ($id as $i) {
        foreach ($files as $file) {
            $match = preg_match('/^' . $table . '_' . $i . '[_\\.]/', $file);
            if ($match == 1) {
                $files_to_remove[] = $file;
            }
        }
    }
    remove_images($files_to_remove);
}
function sc_posts_for_page($atts, $content = null)
{
    if ($atts['length'] > 0) {
    } else {
        $atts['length'] = 50;
    }
    //echo $atts['read_more'];
    if ($atts['read_more'] != "") {
        $_opts['readMoreText'] = $atts['read_more'];
    } else {
        $_opts['readMoreText'] = "Read More »";
    }
    if ($atts['prev_text'] != "") {
        $_opts['prevText'] = $atts['prev_text'];
    } else {
        $_opts['prevText'] = "« Newer Entries";
    }
    if ($atts['next_text'] != "") {
        $_opts['nextText'] = $atts['next_text'];
    } else {
        $_opts['nextText'] = "Older Entries » ";
    }
    // set values from the shortcode
    $_opts['cat_slug'] = $atts['cat_slug'];
    $_opts['cat'] = $atts['cat'];
    $_opts['tag_slug'] = $atts['tag_slug'];
    $_opts['order_by'] = $atts['order_by'];
    $_opts['post_id'] = $atts['post_id'];
    $_opts['author'] = $atts['author'];
    $_opts['num'] = $atts['num'];
    $_opts['showFullPost'] = $atts['show_full_posts'];
    global $paged;
    if (empty($paged)) {
        $_opts['cur_page'] = 1;
    } else {
        $_opts['cur_page'] = $paged;
    }
    $_opts['hide_images'] = $atts['hide_images'];
    $_opts['use_wp_excerpt'] = $atts['use_wp_excerpt'];
    $_opts['strip_html'] = $atts['strip_html'];
    $_opts['hide_post_content'] = $atts['hide_post_content'];
    $_opts['show_meta'] = $atts['show_meta'];
    $_opts['hide_post_title'] = $atts['hide_post_title'];
    $_opts['hide_read_more'] = $atts['hide_read_more'];
    $_opts['create_para_tags'] = $atts['create_para_tags'];
    $_opts['order'] = $atts['order'];
    $_opts['force_excerpt_image'] = $atts['force_excerpt_image'];
    $_opts['force_image_height'] = $atts['force_image_height'];
    $_opts['force_image_width'] = $atts['force_image_width'];
    //get the id of the current article that is calling the shortcode
    $parent_id = get_the_ID();
    $output = "";
    $i = 0;
    $children = pfp_get_posts($_opts);
    if (is_array($children)) {
        if (count($children) <= 0) {
            $out = "<strong>Items for Page:</strong> There are no posts that match the selection criteria.";
            return $out;
        }
        foreach ($children as $child) {
            $title = $child->post_title;
            $link = get_permalink($child->ID);
            $content;
            $date;
            //$thumb = get_the_post_thumbnail($child->ID,array(60, 60, true));
            $imageSrc = "";
            $image_html = "";
            $excerpt_images = "";
            if ($_opts['create_para_tags'] == "true") {
                //$content = wpautop($child->post_content);
                $content = wpautop(apply_filters('the_content', $child->post_content));
                //echo "wpautop";
            } else {
                //if($_opts['showFullPost'] == "true")
                //{
                //$content = apply_filters('the_content', $child->post_content);
                //}
                //else
                //{
                //$content = $child->post_content;
                //}
                $content = apply_filters('the_content', $child->post_content);
                //echo "no wpautop";
            }
            if ($_opts['showFullPost'] != "true") {
                if ($_opts['hide_images'] != 'true') {
                    $args = array('numberposts' => 1, 'order' => 'ASC', 'post_mime_type' => 'image', 'post_parent' => $child->ID, 'post_status' => null, 'post_type' => 'attachment');
                    //get the first image and resize it
                    $attachments = get_children($args);
                    if ($attachments) {
                        foreach ($attachments as $attachment) {
                            $image_attributes = wp_get_attachment_image_src($attachment->ID, 'thumbnail') ? wp_get_attachment_image_src($attachment->ID, 'thumbnail') : wp_get_attachment_image_src($attachment->ID, 'full');
                            $imageSrc = '<img src="' . wp_get_attachment_thumb_url($attachment->ID) . '" />';
                            $imageSrc = pfp_resize_image($imageSrc, $_opts['force_image_height'], $_opts['force_image_width']);
                        }
                        // if attachment found need to remove the image from the post content **TODO - this is odd behaviour but works
                        $content = remove_images($content);
                    } else {
                        $match = preg_match('/<img[^>]+./', $content, $excerpt_images);
                        // got array of any images found now get just the src value so we can use it when forcing the image size
                        if (!empty($excerpt_images[0])) {
                            $imageSrc = pfp_resize_image($excerpt_images[0], $_opts['force_image_height'], $_opts['force_image_width']);
                            $content = remove_images($content);
                        }
                    }
                }
                if ($_opts['use_wp_excerpt'] == 'true') {
                    // use wp excerpt function
                    //$post = get_post($post_id);
                    //if($_opts['force_excerpt_image'] == 'true')
                    //{
                    //    //echo "imageSrc: " . $child->ID . $imageSrc . "<br>";
                    //    // if one not already added as thumbnail get it from post content itself
                    //    if(empty($imageSrc))
                    //    {
                    //        $match = preg_match('/<img[^>]+./', $content, $excerpt_images);
                    //        // got array of any images found now get just the src value so we can use it when forcing the image size
                    //        if(!empty($excerpt_images[0]))
                    //        {
                    //            $image_html = pfp_resize_image($excerpt_images[0], $_opts['force_image_height'], $_opts['force_image_width']);
                    //        }
                    // }
                    //}
                    setup_postdata($child);
                    $content = robins_get_the_excerpt($child->ID);
                    if (!empty($image_html)) {
                        $content = $image_html . $content;
                    }
                } else {
                    // remove all images from the post
                    if ($_opts['hide_images'] == 'true') {
                        $content = remove_images($content);
                    } else {
                        $content = $content;
                    }
                    if ($_opts['strip_html'] == 'true') {
                        $content = strip_tags($content);
                    }
                    //split excerpt into array for processing
                    $words = explode(' ', $content);
                    //chop off the excerpt based on the atts->lenth
                    $words = array_slice($words, 0, $atts['length']);
                    //merge the array of words for the excerpt back into sentances
                    $content = implode(' ', $words) . "...";
                }
            }
            // output post
            $output .= "<div class='pfpItem entry-content'>";
            if ($_opts['hide_post_title'] != 'true') {
                $output .= "<h2 class='entry-title'><a href='{$link}'>{$title}</a></h2>";
            }
            if ($_opts['show_meta'] == 'true') {
                $userid = $child->post_author;
                $userdata = get_userdata($userid);
                $output .= "<div class='entry-meta'>";
                $output .= "Posted on " . mysql2date('F j, Y', $child->post_date) . " by " . $userdata->user_nicename;
                $output .= "</div>";
            }
            // do not get any content if it is to be hidden (i.e. show titles only)
            if ($_opts['hide_post_content'] != 'true') {
                if ($_opts['hide_images'] != 'true' && $_opts['showFullPost'] != "true") {
                    $output .= $imageSrc;
                }
                $output .= $content;
                if ($_opts['hide_read_more'] != 'true' && $_opts['showFullPost'] != "true") {
                    $output .= "<a href='{$link}' class='pfpReadMore'>" . $_opts['readMoreText'] . "</a>";
                }
            }
            $output .= "<div class='clear'></div>";
            $output .= "<hr>";
            $output .= "</div>";
        }
    }
    global $wp_query;
    $page_links_total = $wp_query->max_num_pages;
    if ($_opts['cur_page'] > 1) {
        // show prev
        $output .= "<span class='pfpNav'>" . get_previous_posts_link($_opts['prevText']) . "</span>";
    }
    if ($_opts['cur_page'] < $page_links_total) {
        // show next
        $output .= "<span class='pfpNav'>" . get_next_posts_link($_opts['nextText']) . "</span>";
    }
    wp_reset_query();
    return $output;
}
示例#4
0
        $truncate = array('tvshows', 'tvshows_actor', 'tvshows_genre', 'episodes', 'episodes_stream');
        $reg_exp = '#^(tvshows|episodes)#';
    }
    foreach ($truncate as $t) {
        $sql = 'TRUNCATE `' . $t . '`';
        mysql_q($sql);
    }
    $files = scandir('cache/');
    $files_to_remove = array();
    foreach ($files as $file) {
        $match = preg_match_all($reg_exp, $file);
        if ($match > 0) {
            $files_to_remove[] = $file;
        }
    }
    remove_images($files_to_remove);
}
/* ############
 * # SETTINGS #
 */
############
if ($option == 'settings') {
    $output_lang = '';
    $output_theme = '';
    $output_select_media_header = '';
    $output_view = '';
    $output_panel_top = '';
    $output_panel_view = '';
    $output_watched_status = '';
    $output_show_playcount = '';
    $output_live_search = '';
示例#5
0
文件: opraf.php 项目: nimral/opraf
function regen2_pdf_img()
{
    global $pdf_file;
    global $pdf_dir;
    global $img_dir;
    get_pdf_file_post();
    render_regen_pdf_img_init();
    render_short_begin();
    flush();
    assert(preg_match('/^[-a-z_A-Z0-9\\.]+$/', $pdf_file));
    $pdf_base = strip_ext($pdf_file);
    remove_images(get_images($pdf_base));
    $pdf_path = "{$pdf_dir}/{$pdf_file}";
    if (!is_file($pdf_path)) {
        ee("file ({$pdf_path}) not exists");
        die('');
    }
    $pageno = 0;
    while (true) {
        $img_path = "{$img_dir}/{$pdf_base}-{$pageno}.png";
        $pdf_path_page = "{$pdf_path}[{$pageno}]";
        $cmd = "convert -density 180x180 -geometry 1024x1448  \"{$pdf_path_page}\" \"{$img_path}\"";
        ee("{$img_path}\n");
        flush();
        system($cmd, $rc);
        if ($rc != 0) {
            render_regen_pdf_img_done($cmd, $pdf_file);
            render_short_end();
            die("");
        }
        $pageno++;
    }
    #die("");
}
示例#6
0
            $episodes_id[] = $epi['id'];
        }
        sync_delete(array($_GET['id']), 'tvshows');
        sync_delete($episodes_id, 'episodes');
    }
}
// delete img
if ($option == 'deleteposter' or $option == 'deletefanart') {
    // admin permission
    if (!isset($_SESSION['logged_admin']) or $_SESSION['logged_admin'] !== true) {
        die('no permission');
    }
    include 'function.php';
    connect($mysql_ml);
    $filename = $_GET['video'] . '_' . $_GET['id'] . ($option == 'deletefanart' ? '_f' : '') . '.jpg';
    remove_images(array($filename));
}
// hide movie or tvshow
if ($option == 'hidemovie' or $option == 'hidetvshow' or $option == 'visiblemovie' or $option == 'visibletvshow') {
    // admin permission
    if (!isset($_SESSION['logged_admin']) or $_SESSION['logged_admin'] !== true) {
        die('no permission');
    }
    include 'function.php';
    $id = $_GET['id'];
    if ($option == 'hidemovie' or $option == 'hidetvshow') {
        $hide = 1;
    } else {
        $hide = 0;
    }
    if ($option == 'hidemovie' or $option == 'visiblemovie') {