Example #1
0
    public function index()
    {
        $this->data['page_title'] = 'Контакты';
        $this->form_validation->set_rules('username', 'Имя', 'trim|required|min_length[2]|max_length[100]');
        $this->form_validation->set_rules('email', 'email', 'trim|required|valid_email|max_length[100]');
        $this->form_validation->set_rules('mail', 'сообщение', 'trim|required|min_length[8]|max_length[500]');
        $this->form_validation->set_rules('captcha', 'капча', 'trim|required|callback_validateCaptcha');
        if ($this->form_validation->run()) {
            $subject = 'Сообщение с сайта ' . $this->config->item('base_url');
            $body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
				<html xmlns="http://www.w3.org/1999/xhtml">
				<head>
					<meta http-equiv="Content-Type" content="text/html; charset=' . strtolower(config_item('charset')) . '" />
					<title>' . html_escape($subject) . '</title>
					<style type="text/css">
						body {
							font-family: Arial, Verdana, Helvetica, sans-serif;
							font-size: 16px;
						}
					</style>
				</head>
				<body>' . $this->input->post('mail') . '</body>
				</html>';
            if ($this->email->from($this->input->post('email'), $this->input->post('username'))->to($this->siteOptions['admin_mail'])->subject($subject)->message($body)->send()) {
                $this->session->set_flashdata('item', 'Ваше сообщение отправлено.');
                redirect(base_url('contacts'));
            } else {
                print_r($this->email->print_debugger());
                die;
            }
        }
        $this->load_theme('contacts/index', $this->data);
    }
Example #2
0
 function form_open($action = '', $attributes = array(), $hidden = array())
 {
     $CI =& get_instance();
     // If no action is provided then set to the current url
     if (!$action) {
         $action = current_url($action);
     } elseif (strpos($action, '://') === FALSE) {
         $action = if_secure_site_url($action);
     }
     $attributes = _attributes_to_string($attributes);
     if (stripos($attributes, 'method=') === FALSE) {
         $attributes .= ' method="post"';
     }
     if (stripos($attributes, 'accept-charset=') === FALSE) {
         $attributes .= ' accept-charset="' . strtolower(config_item('charset')) . '"';
     }
     $form = '<form action="' . $action . '"' . $attributes . ">\n";
     // Add CSRF field if enabled, but leave it out for GET requests and requests to external websites
     if ($CI->config->item('csrf_protection') === TRUE && strpos($action, if_secure_base_url()) !== FALSE && !stripos($form, 'method="get"')) {
         $hidden[$CI->security->get_csrf_token_name()] = $CI->security->get_csrf_hash();
     }
     // Add MY CSRF token if MY CSRF library is loaded
     if ($CI->load->is_loaded('tokens') && strpos($action, if_secure_base_url()) !== FALSE && !stripos($form, 'method="get"')) {
         $hidden[$CI->tokens->name] = $CI->tokens->token();
     }
     if (is_array($hidden)) {
         foreach ($hidden as $name => $value) {
             $form .= '<input type="hidden" name="' . $name . '" value="' . html_escape($value) . '" style="display:none;" />' . "\n";
         }
     }
     return $form;
 }
Example #3
0
 /**
  * Generic thumbnail code; returns HTML rather than adding
  * a block since thumbs tend to go inside blocks...
  */
 public function build_thumb_html(Image $image, $query = null)
 {
     global $config;
     $h_view_link = make_link("post/view/{$image->id}", $query);
     $h_thumb_link = $image->get_thumb_link();
     // Removes the size tag if the file is an mp3
     if ($image->ext == 'mp3') {
         $iitip = $image->get_tooltip();
         $mp3tip = array("0x0");
         $h_tip = str_replace($mp3tip, " ", $iitip);
         // Makes it work with a variation of the default tooltips (I.E $tags // $filesize // $size)
         $justincase = array("   //", "//   ", "  //", "//  ", "  ");
         if (strstr($h_tip, "  ")) {
             $h_tip = html_escape(str_replace($justincase, "", $h_tip));
         } else {
             $h_tip = html_escape($h_tip);
         }
     } else {
         $h_tip = html_escape($image->get_tooltip());
     }
     // If file is flash or svg then sets thumbnail to max size.
     if ($image->ext == 'swf' || $image->ext == 'svg') {
         $tsize = get_thumbnail_size($config->get_int('thumb_width'), $config->get_int('thumb_height'));
     } else {
         $tsize = get_thumbnail_size($image->width, $image->height);
     }
     return "<a class='thumb' href='{$h_view_link}'><img title='{$h_tip}' alt='{$h_tip}' " . "width='{$tsize[0]}' height='{$tsize[1]}' src='{$h_thumb_link}' /></a>";
 }
Example #4
0
 public function display_aliases(Page $page, $aliases, $is_admin, $pageNumber, $totalPages)
 {
     if ($is_admin) {
         $action = "<th width='10%'>Action</th>";
         $add = "\n\t\t\t\t<tr>\n\t\t\t\t\t<form action='" . make_link("alias/add") . "' method='POST'>\n\t\t\t\t\t\t<td><input type='text' name='oldtag'></td>\n\t\t\t\t\t\t<td><input type='text' name='newtag'></td>\n\t\t\t\t\t\t<td><input type='submit' value='Add'></td>\n\t\t\t\t\t</form>\n\t\t\t\t</tr>\n\t\t\t";
     } else {
         $action = "";
         $add = "";
     }
     $h_aliases = "";
     $n = 0;
     foreach ($aliases as $old => $new) {
         $h_old = html_escape($old);
         $h_new = "<a href='" . make_link("post/list/" . url_escape($new) . "/1") . "'>" . html_escape($new) . "</a>";
         $oe = $n++ % 2 == 0 ? "even" : "odd";
         $h_aliases .= "<tr class='{$oe}'><td>{$h_old}</td><td>{$h_new}</td>";
         if ($is_admin) {
             $h_aliases .= "\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<form action='" . make_link("alias/remove") . "' method='POST'>\n\t\t\t\t\t\t\t<input type='hidden' name='oldtag' value='{$h_old}'>\n\t\t\t\t\t\t\t<input type='submit' value='Remove'>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t</td>\n\t\t\t\t";
         }
         $h_aliases .= "</tr>";
     }
     $html = "\n\t\t\t<script>\n\t\t\t\$(document).ready(function() {\n\t\t\t\t\$(\"#aliases\").tablesorter();\n\t\t\t});\n\t\t\t</script>\n\t\t\t<table id='aliases' class='zebra'>\n\t\t\t\t<thead><tr><th>From</th><th>To</th>{$action}</tr></thead>\n\t\t\t\t<tbody>{$h_aliases}</tbody>\n\t\t\t\t<tfoot>{$add}</tfoot>\n\t\t\t</table>\n\t\t\t<p><a href='" . make_link("alias/export/aliases.csv") . "'>Download as CSV</a></p>\n\t\t";
     $bulk_html = "\n\t\t\t<form enctype='multipart/form-data' action='" . make_link("alias/import") . "' method='POST'>\n\t\t\t\t<input type='file' name='alias_file'>\n\t\t\t\t<input type='submit' value='Upload List'>\n\t\t\t</form>\n\t\t";
     $page->set_title("Alias List");
     $page->set_heading("Alias List");
     $page->add_block(new NavBlock());
     $page->add_block(new Block("Aliases", $html));
     if ($is_admin) {
         $page->add_block(new Block("Bulk Upload", $bulk_html, "main", 51));
     }
     $this->display_paginator($page, "alias/list", null, $pageNumber, $totalPages);
 }
    public function send()
    {
        $this->load->library('email');
        $subject = 'This is a test';
        $message = '<p>This message has been sent for testing purposes.</p>';
        // Get full html:
        $body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=' . strtolower(config_item('charset')) . '" />
<title>' . html_escape($subject) . '</title>
<style type="text/css">
    body {
        font-family: Arial, Verdana, Helvetica, sans-serif;
        font-size: 16px;
    }
</style>
</head>
<body>
' . $message . '
</body>
</html>';
        // Also, for getting full html you may use the following internal method:
        //$body = $this->email->full_html($subject, $message);
        $result = $this->email->from('*****@*****.**')->reply_to('*****@*****.**')->to('*****@*****.**')->subject($subject)->message($body)->send();
        var_dump($result);
        echo '<br />';
        echo $this->email->print_debugger();
        exit;
    }
    public function send()
    {
        $this->load->library('email');
        $subject = 'Thank you for your submission';
        $message = '<p>Dear Himal,</p>';
        $message .= '<p>Thank you for contributing to <a href="http://translationnetwork.org">Translation Network</a>. A member of the Network will receive your submission and post it at their earliest convenience.</p>';
        $message .= '<p>Check back to see if your submission has been carried over into other languages. We hope you will consider posting something again soon!</p>';
        $message .= '<p>Thank You,</p>';
        $message .= '<p>Translation Network </p>';
        $body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=' . strtolower(config_item('charset')) . '" />
<title>' . html_escape($subject) . '</title>
<style type="text/css">
    body {
        font-family: Arial, Verdana, Helvetica, sans-serif;
        font-size: 16px;
    }
</style>
</head>
<body>
' . $message . '
</body>
</html>';
        //echo $body;
        // Also, for getting full html you may use the following internal method:
        //$body = $this->email->full_html($subject, $message);
        $result = $this->email->from('*****@*****.**', "Translation Network")->reply_to('*****@*****.**')->to('*****@*****.**')->subject($subject)->message($body)->send();
        var_dump($result);
        echo '<br />';
        echo $this->email->print_debugger();
        exit;
    }
Example #7
0
 /**
  * Generic thumbnail code; returns HTML rather than adding
  * a block since thumbs tend to go inside blocks...
  */
 public function build_thumb_html(Image $image, $query = null)
 {
     global $config;
     $i_id = int_escape($image->id);
     $h_view_link = make_link("post/view/{$i_id}", $query);
     $h_thumb_link = $image->get_thumb_link();
     // Removes the size tag if the file is an mp3
     if ($image->ext == 'mp3') {
         $iitip = $image->get_tooltip();
         $mp3tip = array("0x0");
         $h_tip = str_replace($mp3tip, " ", $iitip);
         // Makes it work with a variation of the default tooltips (I.E $tags // $filesize // $size)
         $justincase = array("   //", "//   ", "  //", "//  ", "  ");
         if (strstr($h_tip, "  ")) {
             $h_tip = html_escape(str_replace($justincase, "", $h_tip));
         } else {
             $h_tip = html_escape($h_tip);
         }
     } else {
         $h_tip = html_escape($image->get_tooltip());
     }
     // If file is flash or svg then sets thumbnail to max size.
     if ($image->ext == 'swf' || $image->ext == 'svg') {
         $tsize = get_thumbnail_size($config->get_int('thumb_width'), $config->get_int('thumb_height'));
     } else {
         $tsize = get_thumbnail_size($image->width, $image->height);
     }
     return "\n\t\t\t<center><div class='thumbblock'>\n\t\t\t\n\t\t\t\t<a href='{$h_view_link}' style='position: relative; display: block; height: {$tsize[1]}px; width: {$tsize[0]}px;'>\n\t\t\t\t\t<img id='thumb_{$i_id}' title='{$h_tip}' alt='{$h_tip}' class='highlighted' style='height: {$tsize[1]}px; width: {$tsize[0]}px;' src='{$h_thumb_link}'>\n\t\t\t\t</a>\n\t\t\t\n\t\t\t</div></center>\n\t\t";
 }
Example #8
0
 /**
  * This function translates strings to their according language
  * 
  * @param string $string The string to translate
  * @param mixed $escapemode Different uses require the string to be escaped accordinlgy. Possible values are 'html'(default),'js' and 'unescaped'
  * @return string Translated string
  */
 function gT($string, $escapemode = 'html')
 {
     if ($this->gettextclass) {
         $basestring = str_replace('&lsquo;', '\'', $this->gettextclass->translate($string));
         switch ($escapemode) {
             case 'html':
                 return html_escape($basestring);
                 break;
             case 'js':
                 return javascript_escape($basestring);
                 break;
             case 'unescaped':
                 return $basestring;
                 break;
             default:
                 return "Unsupported EscapeMode in gT method";
                 break;
         }
     } else {
         switch ($escapemode) {
             case 'html':
                 return html_escape($string);
                 break;
             case 'js':
                 return javascript_escape($string);
                 break;
             case 'unescaped':
                 return $string;
                 break;
             default:
                 return "Unsupported EscapeMode in gT method";
                 break;
         }
     }
 }
 public function test()
 {
     $this->load->helper('form');
     //有一个破坏html的双引号
     $string = 'Here is a string containing "quoted" text.';
     $string2 = html_escape($string);
     echo '<input type="text" name="myfield" value="' . $string2 . '" />';
     echo '<br/>';
     //创建一个表单
     //<form action="http://cyy.com/ci_cms/email/send" method="post" accept-charset="utf-8">
     echo form_open('email/send');
     echo form_close();
     echo '<br/>';
     //增加了属性
     //<form action="http://cyy.com/ci_cms/email/send" class="email" id="myform" method="post" accept-charset="utf-8">
     $attributes = array('class' => 'email', 'id' => 'myform');
     echo form_open('email/send', $attributes);
     echo form_close();
     echo '<br/>';
     //给表单添加隐藏域
     //
     $hidden = array('username' => 'Joe', 'member_id' => '234');
     echo form_open('email/send', '', $hidden);
     echo form_close();
     echo '<br/>';
 }
function social_bookmarking_toolbar($url, $title, $description = '')
{
    $html = '';
    $html .= '<!-- AddThis Button BEGIN -->';
    $html .= '<div class="addthis_toolbox addthis_default_style addthis_32x32_style"';
    $html .= ' addthis:url="' . html_escape($url) . '" addthis:title="' . html_escape($title) . '" addthis:description="' . html_escape($description) . '">';
    $html .= '<h2>Social</h2>';
    $services = social_bookmarking_get_services();
    if ($services) {
        $serviceSettings = social_bookmarking_get_service_settings();
        $booleanFilter = new Omeka_Filter_Boolean();
        foreach ($serviceSettings as $serviceCode => $value) {
            if ($booleanFilter->filter($value) && array_key_exists($serviceCode, $services)) {
                $html .= '<a class="addthis_button_' . html_escape($serviceCode) . '"></a>';
            }
        }
    } else {
        $html .= __('Sociale functies tijdelijk offline.');
    }
    $html .= '<a class="addthis_button_compact"></a>';
    //$html .= '<a class="addthis_counter addthis_bubble_style"></a>';
    $html .= '</div>';
    $html .= '<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js"></script>';
    $html .= '<!-- AddThis Button END -->';
    return $html;
}
Example #11
0
 public function display_advanced(Page $page, $options)
 {
     global $user;
     $rows = "";
     $n = 0;
     ksort($options);
     foreach ($options as $name => $value) {
         $h_value = html_escape($value);
         $len = strlen($h_value);
         $oe = $n++ % 2 == 0 ? "even" : "odd";
         $box = "";
         if (strpos($value, "\n") > 0) {
             $box .= "<textarea cols='50' rows='4' name='_config_{$name}'>{$h_value}</textarea>";
         } else {
             $box .= "<input type='text' name='_config_{$name}' value='{$h_value}'>";
         }
         $box .= "<input type='hidden' name='_type_{$name}' value='string'>";
         $rows .= "<tr class='{$oe}'><td>{$name}</td><td>{$box}</td></tr>";
     }
     $table = "\n\t\t\t<script type='text/javascript'>\n\t\t\t\$(document).ready(function() {\n\t\t\t\t\$(\"#settings\").tablesorter();\n\t\t\t});\n\t\t\t</script>\n\t\t\t" . make_form(make_link("setup/save")) . "\n\t\t\t\t<table id='settings' class='zebra'>\n\t\t\t\t\t<thead><tr><th width='25%'>Name</th><th>Value</th></tr></thead>\n\t\t\t\t\t<tbody>{$rows}</tbody>\n\t\t\t\t\t<tfoot><tr><td colspan='2'><input type='submit' value='Save Settings'></td></tr></tfoot>\n\t\t\t\t</table>\n\t\t\t</form>\n\t\t\t";
     $page->set_title("Shimmie Setup");
     $page->set_heading("Shimmie Setup");
     $page->add_block(new Block("Navigation", $this->build_navigation(), "left", 0));
     $page->add_block(new Block("Setup", $table));
 }
Example #12
0
 public function display_page($image, $editor_parts)
 {
     global $page;
     $page->set_title("Image {$image->id}: " . html_escape($image->get_tag_list()));
     $page->set_heading(html_escape($image->get_tag_list()));
     $page->add_block(new Block(null, $this->build_info($image, $editor_parts), "main", 10));
 }
Example #13
0
 protected function comment_to_html($comment, $trim = false)
 {
     $inner_id = $this->inner_id;
     // because custom themes can't add params, because PHP
     global $user;
     $tfe = new TextFormattingEvent($comment->comment);
     send_event($tfe);
     //$i_uid = int_escape($comment->owner_id);
     $h_name = html_escape($comment->owner_name);
     //$h_poster_ip = html_escape($comment->poster_ip);
     $h_comment = $trim ? substr($tfe->stripped, 0, 50) . "..." : $tfe->formatted;
     $i_comment_id = int_escape($comment->comment_id);
     $i_image_id = int_escape($comment->image_id);
     $stripped_nonl = str_replace("\n", "\\n", substr($tfe->stripped, 0, 50));
     $stripped_nonl = str_replace("\r", "\\r", $stripped_nonl);
     $h_userlink = "<a href='" . make_link("user/{$h_name}") . "'>{$h_name}</a>";
     $h_date = $comment->posted;
     $h_del = $user->can("delete_comment") ? ' - <a onclick="return confirm(\'Delete comment by ' . $h_name . ':\\n' . $stripped_nonl . '\');" ' . 'href="' . make_link('comment/delete/' . $i_comment_id . '/' . $i_image_id) . '">Del</a>' : '';
     $h_reply = "[<a href='" . make_link("post/view/{$i_image_id}") . "'>Reply</a>]";
     if ($inner_id == 0) {
         return "<div class='comment' style='margin-top: 8px;'>{$h_userlink}{$h_del} {$h_date} No.{$i_comment_id} {$h_reply}<p>{$h_comment}</p></div>";
     } else {
         return "<table><tr><td nowrap class='doubledash'>&gt;&gt;</td><td>" . "<div class='reply'>{$h_userlink}{$h_del} {$h_date} No.{$i_comment_id} {$h_reply}<p>{$h_comment}</p></div>" . "</td></tr></table>";
     }
 }
Example #14
0
 protected function build_navigation($page_number, $total_pages, $search_terms)
 {
     $h_search_string = count($search_terms) == 0 ? "" : html_escape(implode(" ", $search_terms));
     $h_search_link = make_link();
     $h_search = "\n\t\t\t<p><form action='{$h_search_link}' method='GET'>\n\t\t\t\t<input name='search' type='text'\n\t\t\t\t\t\tvalue='{$h_search_string}' autocomplete='off' />\n\t\t\t\t<input type='hidden' name='q' value='/post/list'>\n\t\t\t\t<input type='submit' value='Find' style='display: none;' />\n\t\t\t</form>\n\t\t\t<div id='search_completions'></div>";
     return $h_search;
 }
Example #15
0
 /**
  * Show a page of aliases.
  *
  * Note: $can_manage = whether things like "add new alias" should be shown
  *
  * @param array $aliases An array of ($old_tag => $new_tag)
  * @param int $pageNumber
  * @param int $totalPages
  */
 public function display_aliases($aliases, $pageNumber, $totalPages)
 {
     global $page, $user;
     $can_manage = $user->can("manage_alias_list");
     if ($can_manage) {
         $h_action = "<th width='10%'>Action</th>";
         $h_add = "\n\t\t\t\t<tr>\n\t\t\t\t\t" . make_form(make_link("alias/add")) . "\n\t\t\t\t\t\t<td><input type='text' name='oldtag'></td>\n\t\t\t\t\t\t<td><input type='text' name='newtag'></td>\n\t\t\t\t\t\t<td><input type='submit' value='Add'></td>\n\t\t\t\t\t</form>\n\t\t\t\t</tr>\n\t\t\t";
     } else {
         $h_action = "";
         $h_add = "";
     }
     $h_aliases = "";
     foreach ($aliases as $old => $new) {
         $h_old = html_escape($old);
         $h_new = "<a href='" . make_link("post/list/" . url_escape($new) . "/1") . "'>" . html_escape($new) . "</a>";
         $h_aliases .= "<tr><td>{$h_old}</td><td>{$h_new}</td>";
         if ($can_manage) {
             $h_aliases .= "\n\t\t\t\t\t<td>\n\t\t\t\t\t\t" . make_form(make_link("alias/remove")) . "\n\t\t\t\t\t\t\t<input type='hidden' name='oldtag' value='{$h_old}'>\n\t\t\t\t\t\t\t<input type='submit' value='Remove'>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t</td>\n\t\t\t\t";
         }
         $h_aliases .= "</tr>";
     }
     $html = "\n\t\t\t<table id='aliases' class='sortable zebra'>\n\t\t\t\t<thead><tr><th>From</th><th>To</th>{$h_action}</tr></thead>\n\t\t\t\t<tbody>{$h_aliases}</tbody>\n\t\t\t\t<tfoot>{$h_add}</tfoot>\n\t\t\t</table>\n\t\t\t<p><a href='" . make_link("alias/export/aliases.csv") . "'>Download as CSV</a></p>\n\t\t";
     $bulk_html = "\n\t\t\t" . make_form(make_link("alias/import"), 'post', true) . "\n\t\t\t\t<input type='file' name='alias_file'>\n\t\t\t\t<input type='submit' value='Upload List'>\n\t\t\t</form>\n\t\t";
     $page->set_title("Alias List");
     $page->set_heading("Alias List");
     $page->add_block(new NavBlock());
     $page->add_block(new Block("Aliases", $html));
     if ($can_manage) {
         $page->add_block(new Block("Bulk Upload", $bulk_html, "main", 51));
     }
     $this->display_paginator($page, "alias/list", null, $pageNumber, $totalPages);
 }
    function _display_colorbox_gallery($images, $mode = null)
    {
        $mode = $mode != '' ? 'colorbox-' . $mode : 'colorbox';
        if (!empty($images)) {
            foreach ($images as $image) {
                $image_url = image_url($image['image']);
                $image_thumb_url = image_process_nowm($image_url, 180, 120);
                ?>

                        <div class="image-container">
                            <a href="<?php 
                echo $image_url;
                ?>
" title="<?php 
                echo isset($image['title']) ? html_escape($image['title']) : '';
                ?>
" target="blank" rel="<?php 
                echo html_escape($mode);
                ?>
"><img src="<?php 
                echo $image_thumb_url;
                ?>
" /></a>
                        </div>

<?php 
            }
        }
    }
Example #17
0
 public function display_image(Page $page, Image $image)
 {
     global $config;
     $ilink = $image->get_image_link();
     $html = "<img id='main_image' src='{$ilink}'>";
     if ($config->get_bool("image_show_meta")) {
         # FIXME: only read from jpegs?
         $exif = @exif_read_data($image->get_image_filename(), 0, true);
         if ($exif) {
             $head = "";
             foreach ($exif as $key => $section) {
                 foreach ($section as $name => $val) {
                     if ($key == "IFD0") {
                         $head .= html_escape("{$name}: {$val}") . "<br>\n";
                     }
                 }
             }
             if ($head) {
                 $page->add_block(new Block("EXIF Info", $head, "left"));
             }
         }
     }
     $zoom_default = $config->get_bool("image_zoom", false) ? "scale(img);" : "";
     $zoom = "<script type=\"text/javascript\">\n\t\t\t\t\timg = document.getElementById(\"main_image\");\n\t\t\t\t\t\n\t\t\t\t\tif(img) {\n\t\t\t\t\t\timg.onclick = function() {scale(img);};\n\t\t\t\t\t\n\t\t\t\t\t\tmsg_div = document.createElement(\"div\");\n\t\t\t\t\t\tmsg_div.id = \"msg_div\";\n\t\t\t\t\t\tmsg_div.appendChild(document.createTextNode(\"Note: Image has been scaled to fit the screen; click to enlarge\"));\n\t\t\t\t\t\tmsg_div.style.display=\"none\";\n\t\t\t\t\t\timg.parentNode.insertBefore(msg_div, img);\n\t\t\t\t\t\n\t\t\t\t\t\torig_width = {$image->width};\n\t\t\t\t\t\n\t\t\t\t\t\t{$zoom_default}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tfunction scale(img) {\n\t\t\t\t\t\tif(orig_width >= img.parentNode.clientWidth * 0.9) {\n\t\t\t\t\t\t\tif(img.style.width != \"90%\") {\n\t\t\t\t\t\t\t\timg.style.width = \"90%\";\n\t\t\t\t\t\t\t\tmsg_div.style.display = \"block\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\timg.style.width = orig_width + 'px';\n\t\t\t\t\t\t\t\tmsg_div.style.display = \"none\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t</script>";
     $page->add_block(new Block("Image", $html . $zoom, "main", 0));
 }
Example #18
0
 /**
  * 修改专题
  * Enter description here ...
  */
 public function edit()
 {
     $cmd = $this->input->post('cmd');
     if ($cmd && $cmd == 'submit') {
         $id = $this->input->post('id');
         $dataArray = array('title' => $this->input->post('title'), 'description' => $this->input->post('description'), 'content' => html_escape($_POST['content']), 'province' => $this->input->post('province'), 'city' => $this->input->post('city'), 'district' => $this->input->post('district'), 'street' => '', 'status' => $this->input->post('status'), 'create_id' => $this->input->post('create_id'), 'create_time' => now());
         //print_r($dataArray);exit;
         $result = $this->FamousModel->edit($dataArray, 'id=' . $id);
         if ($result) {
             show_error('index.php/Famous/index', 500, '提示信息:名媛专题修改成功!');
         } else {
             show_error('index.php/Famous/edit', 500, '提示信息:名媛专题修改失败!');
         }
     } else {
         $id = $this->input->get('id');
         if ($id) {
             $famous = $this->FamousModel->getModel('id=' . $id);
             if ($famous) {
                 $lady = $this->MemberModel->getList('is_lady=1');
                 if ($lady) {
                     $this->load->view('Famous/edit', array('lady' => $lady, 'famous' => $famous));
                 } else {
                     show_error('index.php/Index/index', 500, '提示信息:请先添加名媛数据,在新增名媛专题!');
                 }
             } else {
                 show_error('index.php/Famous/index', 500, '提示信息:专题不存在或已被删除!');
             }
         } else {
             show_error('index.php/Famous/index', 500, '提示信息:参数错误!');
         }
     }
 }
Example #19
0
 public function display_reported_images(Page $page, $reports)
 {
     global $config;
     $h_reportedimages = "";
     $n = 0;
     foreach ($reports as $report) {
         $image = $report['image'];
         $h_reason = format_text($report['reason']);
         if ($config->get_bool('report_image_show_thumbs')) {
             $image_link = $this->build_thumb_html($image);
         } else {
             $image_link = "<a href=\"" . make_link("post/view/{$image->id}") . "\">{$image->id}</a>";
         }
         $reporter_name = html_escape($report['reporter_name']);
         $userlink = "<a href='" . make_link("user/{$reporter_name}") . "'>{$reporter_name}</a>";
         global $user;
         $iabbe = new ImageAdminBlockBuildingEvent($image, $user);
         send_event($iabbe);
         ksort($iabbe->parts);
         $actions = join("<br>", $iabbe->parts);
         $oe = $n++ % 2 == 0 ? "even" : "odd";
         $h_reportedimages .= "\n\t\t\t\t<tr class='{$oe}'>\n\t\t\t\t\t<td>{$image_link}</td>\n\t\t\t\t\t<td>Report by {$userlink}: {$h_reason}</td>\n\t\t\t\t\t<td class='formstretch'>\n\t\t\t\t\t\t<form action='" . make_link("image_report/remove") . "' method='POST'>\n\t\t\t\t\t\t\t<input type='hidden' name='id' value='{$report['id']}'>\n\t\t\t\t\t\t\t<input type='submit' value='Remove Report'>\n\t\t\t\t\t\t</form>\n\n\t\t\t\t\t\t<br>{$actions}\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t";
     }
     $thumb_width = $config->get_int("thumb_width");
     $html = "\n\t\t\t<table id='reportedimage' class='zebra'>\n\t\t\t\t<thead><td width='{$thumb_width}'>Image</td><td>Reason</td><td width='128'>Action</td></thead>\n\t\t\t\t{$h_reportedimages}\n\t\t\t</table>\n\t\t";
     $page->set_title("Reported Images");
     $page->set_heading("Reported Images");
     $page->add_block(new NavBlock());
     $page->add_block(new Block("Reported Images", $html));
 }
Example #20
0
    /**
     * @param Page $page
     * @param array $history
     * @param int $page_number
     */
    public function display_global_page(Page $page, $history, $page_number)
    {
        $start_string = "\n\t\t\t<div style='text-align: left'>\n\t\t\t\t" . make_form(make_link("tag_history/revert")) . "\n\t\t\t\t\t<ul style='list-style-type:none;'>\n\t\t";
        $end_string = "\n\t\t\t\t\t</ul>\n\t\t\t\t\t<input type='submit' value='Revert To'>\n\t\t\t\t</form>\n\t\t\t</div>\n\t\t";
        global $user;
        $history_list = "";
        foreach ($history as $fields) {
            $current_id = $fields['id'];
            $image_id = $fields['image_id'];
            $current_tags = html_escape($fields['tags']);
            $name = $fields['name'];
            $h_ip = $user->can("view_ip") ? " " . show_ip($fields['user_ip'], "Tagging Image #{$image_id} as '{$current_tags}'") : "";
            $setter = "<a href='" . make_link("user/" . url_escape($name)) . "'>" . html_escape($name) . "</a>{$h_ip}";
            $history_list .= '
				<li>
					<input type="radio" name="revert" value="' . $current_id . '">
					<a href="' . make_link('post/view/' . $image_id) . '">' . $image_id . '</a>:
					' . $current_tags . ' (Set by ' . $setter . ')
				</li>
			';
        }
        $history_html = $start_string . $history_list . $end_string;
        $page->set_title("Global Tag History");
        $page->set_heading("Global Tag History");
        $page->add_block(new Block("Tag History", $history_html, "main", 10));
        $h_prev = $page_number <= 1 ? "Prev" : '<a href="' . make_link('tag_history/all/' . ($page_number - 1)) . '">Prev</a>';
        $h_index = "<a href='" . make_link() . "'>Index</a>";
        $h_next = '<a href="' . make_link('tag_history/all/' . ($page_number + 1)) . '">Next</a>';
        $nav = $h_prev . ' | ' . $h_index . ' | ' . $h_next;
        $page->add_block(new Block("Navigation", $nav, "left"));
    }
Example #21
0
 public function display_events($events)
 {
     $table = "\n<style>\n.sizedinputs TD INPUT {\n\twidth: 100%;\n}\n</style>\n<table class='zebra'>\n\t<thead>\n\t\t<tr><th>Time</th><th>Module</th><th>User</th><th>Message</th></tr>\n\t\t<form action='" . make_link("log/view") . "' method='GET'>\n\t\t\t<tr class='sizedinputs'>\n\t\t\t\t<td><input type='text' name='time' value='" . $this->heie("time") . "'></td>\n\t\t\t\t<td><input type='text' name='module' value='" . $this->heie("module") . "'></td>\n\t\t\t\t<td><input type='text' name='user' value='" . $this->heie("user") . "'></td>\n\t\t\t\t<td>\n\t\t\t\t\t<select name='priority'>\n\t\t\t\t\t\t<option value='" . SCORE_LOG_DEBUG . "'>Debug</option>\n\t\t\t\t\t\t<option value='" . SCORE_LOG_INFO . "' selected>Info</option>\n\t\t\t\t\t\t<option value='" . SCORE_LOG_WARNING . "'>Warning</option>\n\t\t\t\t\t\t<option value='" . SCORE_LOG_ERROR . "'>Error</option>\n\t\t\t\t\t\t<option value='" . SCORE_LOG_CRITICAL . "'>Critical</option>\n\t\t\t\t\t</select>\n\t\t\t\t\t<input type='submit' value='Search' style='width: 20%'>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</form>\n\t</thead>\n\t<tbody>\n";
     $n = 0;
     foreach ($events as $event) {
         $oe = $n++ % 2 == 0 ? "even" : "odd";
         $c = $this->pri_to_col($event['priority']);
         $table .= "<tr style='color: {$c}' class='{$oe}'>";
         $table .= "<td>" . str_replace(" ", "&nbsp;", $event['date_sent']) . "</td>";
         $table .= "<td>" . $event['section'] . "</td>";
         if ($event['username'] == "Anonymous") {
             $table .= "<td>" . $event['address'] . "</td>";
         } else {
             $table .= "<td><span title='" . $event['address'] . "'>" . "<a href='" . make_link("user/" . url_escape($event['username'])) . "'>" . html_escape($event['username']) . "</a>" . "</span></td>";
         }
         $table .= "<td>" . $this->scan_entities(html_escape($event['message'])) . "</td>";
         $table .= "</tr>\n";
     }
     $table .= "</tbody></table>";
     global $page;
     $page->set_title("Event Log");
     $page->set_heading("Event Log");
     $page->add_block(new NavBlock());
     $page->add_block(new Block("Events", $table));
 }
Example #22
0
 public function display_image(Page $page, Image $image)
 {
     global $config;
     $u_ilink = $image->get_image_link();
     if ($config->get_bool("image_show_meta") && function_exists("exif_read_data")) {
         # FIXME: only read from jpegs?
         $exif = @exif_read_data($image->get_image_filename(), 0, true);
         if ($exif) {
             $head = "";
             foreach ($exif as $key => $section) {
                 foreach ($section as $name => $val) {
                     if ($key == "IFD0") {
                         // Cheap fix for array'd values in EXIF-data
                         if (is_array($val)) {
                             $val = implode(',', $val);
                         }
                         $head .= html_escape("{$name}: {$val}") . "<br>\n";
                     }
                 }
             }
             if ($head) {
                 $page->add_block(new Block("EXIF Info", $head, "left"));
             }
         }
     }
     $html = "<img alt='main image' class='shm-main-image' id='main_image' src='{$u_ilink}' " . "data-width='{$image->width}' data-height='{$image->height}'>";
     $page->add_block(new Block("Image", $html, "main", 10));
 }
Example #23
0
    public function send_to_email($name, $age, $email)
    {
        try {
            $subject = "[KepoAbis.com] Happy Birthday " . $name;
            $from = "*****@*****.**";
            $to = $email;
            $message = "<p><strong>HAPPY BIRTHDAY " . $name . " yang ke-" . $age . "</strong></p>";
            $message .= "<br><p>Semoga tercapai segala cita-citanya :D</p><br><br>";
            $message .= "<strong>Best Regards,<br>\n\t\t\t\t\t\tHaamill Productions</strong>\n\t\t\t\t\t\t<br>\n\t\t\t\t\t\t<br>Jalan Pelita RT 02/09 No. 69 Kel. Tengah, Kec. Kramat Jati, Jakarta Timur 13540, Indonesia\n\t\t\t\t\t\t<br><a href='http://kepoabis.com'>KepoAbis.com</a> by Haamill Productions\n\t\t\t\t\t\t<br>Phone: 085697309204\n\t\t\t\t\t\t<br>Email: hi@kepoabis.com or contact@kepoabis.com";
            $body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
				<html xmlns="http://www.w3.org/1999/xhtml">
				<head>
				    <meta http-equiv="Content-Type" content="text/html; charset=' . strtolower(config_item('charset')) . '" />
				    <title>' . html_escape($subject) . '</title>
				    <style type="text/css">
				        body {
				            font-family: Arial, Verdana, Helvetica, sans-serif;
				            font-size: 16px;
				        }
				    </style>
				</head>
				<body>
					<p>' . $message . '</p>
				</body>
				</html>';
            //$body = $this->email->full_html($subject, $message);
            $result = $this->email->from($from)->to($to)->subject($subject)->message($body)->send();
            echo $result . "<br>" . $message;
        } catch (Exception $e) {
            print_r($e->getMessage());
        }
    }
Example #24
0
 private function build_stats(Image $image)
 {
     $h_owner = html_escape($image->get_owner()->name);
     $h_ownerlink = "<a href='" . make_link("user/{$h_owner}") . "'>{$h_owner}</a>";
     $h_ip = html_escape($image->owner_ip);
     $h_date = autodate($image->posted);
     $h_filesize = to_shorthand_int($image->filesize);
     global $user;
     if ($user->can("view_ip")) {
         $h_ownerlink .= " ({$h_ip})";
     }
     $html = "\n\t\tId: {$image->id}\n\t\t<br>Posted: {$h_date} by {$h_ownerlink}\n\t\t<br>Size: {$image->width}x{$image->height}\n\t\t<br>Filesize: {$h_filesize}\n\t\t";
     if (!is_null($image->source)) {
         $h_source = html_escape($image->source);
         if (substr($image->source, 0, 7) != "http://" && substr($image->source, 0, 8) != "https://") {
             $h_source = "http://" . $h_source;
         }
         $html .= "<br>Source: <a href='{$h_source}'>link</a>";
     }
     if (class_exists("Ratings")) {
         if ($image->rating == null || $image->rating == "u") {
             $image->rating = "u";
         }
         $h_rating = Ratings::rating_to_human($image->rating);
         $html .= "<br>Rating: {$h_rating}";
     }
     return $html;
 }
Example #25
0
 public function onPageRequest(PageRequestEvent $event)
 {
     global $config, $page;
     // hax.
     if ($page->mode == "page" && (!isset($page->blocks) || $this->count_main($page->blocks) == 0)) {
         $h_pagename = html_escape(implode('/', $event->args));
         $f_pagename = preg_replace("/[^a-z_\\-\\.]+/", "_", $h_pagename);
         $theme_name = $config->get_string("theme", "default");
         if (file_exists("themes/{$theme_name}/{$f_pagename}") || file_exists("lib/static/{$f_pagename}")) {
             $filename = file_exists("themes/{$theme_name}/{$f_pagename}") ? "themes/{$theme_name}/{$f_pagename}" : "lib/static/{$f_pagename}";
             $page->add_http_header("Cache-control: public, max-age=600");
             $page->add_http_header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 600) . ' GMT');
             $page->set_mode("data");
             $page->set_data(file_get_contents($filename));
             if (endsWith($filename, ".ico")) {
                 $page->set_type("image/x-icon");
             }
             if (endsWith($filename, ".png")) {
                 $page->set_type("image/png");
             }
             if (endsWith($filename, ".txt")) {
                 $page->set_type("text/plain");
             }
         } else {
             log_debug("handle_404", "Hit 404: {$h_pagename}");
             $page->set_code(404);
             $page->set_title("404");
             $page->set_heading("404 - No Handler Found");
             $page->add_block(new NavBlock());
             $page->add_block(new Block("Explanation", "No handler could be found for the page '{$h_pagename}'"));
         }
     }
 }
 /**
  * Generic thumbnail code; returns HTML rather than adding
  * a block since thumbs tend to go inside blocks...
  *
  * @param Image $image
  * @return string
  */
 public function build_thumb_html(Image $image)
 {
     global $config;
     $i_id = (int) $image->id;
     $h_view_link = make_link('post/view/' . $i_id);
     $h_thumb_link = $image->get_thumb_link();
     $h_tip = html_escape($image->get_tooltip());
     $h_tags = strtolower($image->get_tag_list());
     $extArr = array_flip(array('swf', 'svg', 'mp3'));
     //List of thumbless filetypes
     if (!isset($extArr[$image->ext])) {
         $tsize = get_thumbnail_size($image->width, $image->height);
     } else {
         //Use max thumbnail size if using thumbless filetype
         $tsize = get_thumbnail_size($config->get_int('thumb_width'), $config->get_int('thumb_height'));
     }
     $custom_classes = "";
     if (class_exists("Relationships")) {
         if (property_exists($image, 'parent_id') && $image->parent_id !== NULL) {
             $custom_classes .= "shm-thumb-has_parent ";
         }
         if (property_exists($image, 'has_children') && $image->has_children == TRUE) {
             $custom_classes .= "shm-thumb-has_child ";
         }
     }
     return "<a href='{$h_view_link}' class='thumb shm-thumb shm-thumb-link {$custom_classes}' data-tags='{$h_tags}' data-post-id='{$i_id}'>" . "<img id='thumb_{$i_id}' title='{$h_tip}' alt='{$h_tip}' height='{$tsize[1]}' width='{$tsize[0]}' src='{$h_thumb_link}'>" . "</a>\n";
 }
Example #27
0
 private function saveTip()
 {
     global $database;
     $enable = isset($_POST["enable"]) ? "Y" : "N";
     $image = html_escape($_POST["image"]);
     $text = $_POST["text"];
     $database->execute("\n\t\t\t\tINSERT INTO tips (enable, image, text)\n\t\t\t\tVALUES (?, ?, ?)", array($enable, $image, $text));
 }
 public function index()
 {
     if ($this->input->method() !== 'post') {
         show_404('Not Found');
     }
     $name = $this->input->post('name');
     echo html_escape($name) . ', you sent POST request!';
 }
Example #29
0
 public function display_message(Page $page, User $from, User $to, PM $pm)
 {
     $this->display_composer($page, $to, $from, "Re: " . $pm->subject);
     $page->set_title("Private Message");
     $page->set_heading(html_escape($pm->subject));
     $page->add_block(new NavBlock());
     $page->add_block(new Block("Message from {$from->name}", format_text($pm->message), "main", 10));
 }
Example #30
0
 function edit_into_db()
 {
     $user_id = $this->session->userdata('user_id');
     $title = html_escape($_POST['title']);
     $description = $_POST['description'];
     $bid = $_POST['bid'];
     $this->db->query("UPDATE blog SET title = '" . $this->db->escape_str($title) . "', description = '" . $this->db->escape_str($description) . "' ,user_id = '{$user_id}', status = '3' WHERE id = '{$bid}'; ");
 }