Ejemplo n.º 1
0
 function galeria()
 {
     if ($this->session->userdata('status') == 1) {
         if ($this->uri->segment(3) == "view") {
             $this->load->view('admin/header');
             $this->load->view('admin/galeria_view');
             $this->load->view('admin/footer');
         } elseif ($this->uri->segment(3) == "user") {
             $this->load->view('admin/header');
             $this->load->view('admin/galeria_user');
             $this->load->view('admin/footer');
         } elseif ($this->uri->segment(3) == "control") {
             if ($this->input->post('control') == 3) {
                 remove_image($this->input->post('id'));
                 redirect('admin/galeria/ok');
             } else {
                 $this->active = $this->input->post('control');
                 $this->db->update('galeria', $this, array('id' => $this->input->post('id')));
                 redirect('admin/galeria/');
             }
         } elseif ($this->uri->segment(3) == "buscar") {
             $this->load->view('admin/header');
             $this->load->view('admin/galeria_buscar');
             $this->load->view('admin/footer');
         } else {
             $this->load->view('admin/header');
             $this->load->view('admin/galeria');
             $this->load->view('admin/footer');
         }
     } else {
         $error['fail'] = '';
         $this->load->view('admin/login_form', $error);
     }
 }
function del_image($connection)
{
    $id = $_REQUEST['id'];
    $connection->begin_transaction();
    remove_image($connection, $id);
    $connection->commit();
    print '[["SUCCESS"],["Successfully removed image"]]';
}
Ejemplo n.º 3
0
function print_comments_content($display = true)
{
    global $links_text, $link_number, $max_link_number, $matched_links;
    if (!isset($matched_links)) {
        $matched_links = array();
    }
    $content = get_comment_text();
    $content = apply_filters('comment_text', $content);
    if (!print_can('images')) {
        $content = remove_image($content);
    }
    if (!print_can('videos')) {
        $content = remove_video($content);
    }
    if (print_can('links')) {
        preg_match_all('/<a(.+?)href=[\\"\'](.+?)[\\"\'](.*?)>(.+?)<\\/a>/', $content, $matches);
        for ($i = 0; $i < count($matches[0]); $i++) {
            $link_match = $matches[0][$i];
            $link_url = $matches[2][$i];
            if (stristr($link_url, 'https://')) {
                $link_url = strtolower(substr($link_url, 0, 8)) != 'https://' ? get_option('home') . $link_url : $link_url;
            } else {
                if (stristr($link_url, 'mailto:')) {
                    $link_url = strtolower(substr($link_url, 0, 7)) != 'mailto:' ? get_option('home') . $link_url : $link_url;
                } else {
                    if ($link_url[0] == '#') {
                        $link_url = $link_url;
                    } else {
                        $link_url = strtolower(substr($link_url, 0, 7)) != 'http://' ? get_option('home') . $link_url : $link_url;
                    }
                }
            }
            $new_link = true;
            $link_url_hash = md5($link_url);
            if (!isset($matched_links[$link_url_hash])) {
                $link_number = ++$max_link_number;
                $matched_links[$link_url_hash] = $link_number;
            } else {
                $new_link = false;
                $link_number = $matched_links[$link_url_hash];
            }
            $content = str_replace_one($link_match, "<a href=\"{$link_url}\" rel=\"external\">" . $link_text . '</a> <sup>[' . number_format_i18n($link_number) . ']</sup>', $content);
            if ($new_link) {
                if (preg_match('/<img(.+?)src=[\\"\'](.+?)[\\"\'](.*?)>/', $link_text)) {
                    $links_text .= '<p style="margin: 2px 0;">[' . number_format_i18n($link_number) . '] ' . __('Image', 'wp-print') . ': <b><span dir="ltr">' . $link_url . '</span></b></p>';
                } else {
                    $links_text .= '<p style="margin: 2px 0;">[' . number_format_i18n($link_number) . '] ' . $link_text . ': <b><span dir="ltr">' . $link_url . '</span></b></p>';
                }
            }
        }
    }
    if ($display) {
        echo $content;
    } else {
        return $content;
    }
}
Ejemplo n.º 4
0
function print_comments_content($display = true)
{
    global $links_text, $link_number;
    $content = get_comment_text();
    $content = apply_filters('comment_text', $content);
    if (!print_can('images')) {
        $content = remove_image($content);
    }
    if (print_can('links')) {
        preg_match_all('/<a(.+?)href=\\"(.+?)\\"(.*?)>(.+?)<\\/a>/', $content, $matches);
        for ($i = 0; $i < count($matches[0]); $i++) {
            $link_match = $matches[0][$i];
            $link_number++;
            $link_url = $matches[2][$i];
            if (stristr($link_url, 'https://')) {
                $link_url = strtolower(substr($link_url, 0, 8)) != 'https://' ? get_option('home') . $link_url : $link_url;
            } else {
                if (stristr($link_url, 'mailto:')) {
                    $link_url = strtolower(substr($link_url, 0, 7)) != 'mailto:' ? get_option('home') . $link_url : $link_url;
                } else {
                    if ($link_url[0] == '#') {
                        $link_url = $link_url;
                    } else {
                        $link_url = strtolower(substr($link_url, 0, 7)) != 'http://' ? get_option('home') . $link_url : $link_url;
                    }
                }
            }
            $link_text = $matches[4][$i];
            $content = str_replace_one($link_match, '[' . $link_number . "] <a href=\"{$link_url}\" rel=\"external\">" . $link_text . '</a>', $content);
            if (strlen($link_url) > 100) {
                $link_url = chunk_split($link_url, 100, "<br />\n");
            }
            if (preg_match('/<img(.+?)src=\\"(.+?)\\"(.*?)>/', $link_text)) {
                $links_text .= '<br />[' . $link_number . '] ' . __('Image', 'wp-print') . ': <b>' . $link_url . '</b>';
            } else {
                $links_text .= '<br />[' . $link_number . '] ' . $link_text . ': <b>' . $link_url . '</b>';
            }
        }
    }
    if ($display) {
        echo $content;
    } else {
        return $content;
    }
}