specialchars() public static method

public static specialchars ( $value )
 function __construct()
 {
     parent::__construct("feed");
     /* Set feed ID and self link. */
     $this->id(html::specialchars(url::abs_current()));
     $this->link()->rel("self")->href(url::abs_current());
 }
Exemplo n.º 2
0
 public function content($text, $type = "html")
 {
     $content = $this->dom->createElement("content", html::specialchars($text));
     $content->setAttribute("type", $type);
     $this->element->appendChild($content);
     return $this;
 }
Exemplo n.º 3
0
 /**
  * Create HTML link anchors.
  *
  * @param   string  URL or URI string
  * @param   string  link text
  * @param   array   HTML anchor attributes
  * @return  string
  */
 public static function anchor($uri, $title = NULL, $attributes = NULL)
 {
     if ($uri === '') {
         $siteUrl = url::base();
     } else {
         $siteUrl = $uri;
     }
     return '<a href="' . html::specialchars($siteUrl, false) . '"' . (is_array($attributes) ? html::attributes($attributes) : '') . '>' . ($title === NULL ? $siteUrl : $title) . '</a>';
 }
Exemplo n.º 4
0
 public static function anchor_lang($lang, $uri, $title = NULL, $attributes = NULL, $protocol = NULL)
 {
     if ($uri === '') {
         $site_url = url::base(FALSE);
     } elseif (strpos($uri, '://') === FALSE and strpos($uri, '#') !== 0) {
         $site_url = url::site_lang($lang, $uri, $protocol);
     } else {
         if (html::$windowed_urls === TRUE and empty($attributes['target'])) {
             $attributes['target'] = '_blank';
         }
         $site_url = $uri;
     }
     return '<a href="' . html::specialchars($site_url, FALSE) . '"' . (is_array($attributes) ? html::attributes($attributes) : '') . '>' . ($title === NULL ? $site_url : $title) . '</a>';
 }
Exemplo n.º 5
0
 public function comments()
 {
     header('Content-Type: text/xml; charset=UTF-8', TRUE);
     if ($cache = $this->cache->get('s7n_blog_feed_comments')) {
         echo $cache;
         return;
     }
     $comments = ORM::factory('blog_comment')->orderby('id', 'desc')->find_all(20);
     $info = array('title' => config::get('s7n.site_title') . ' (Latest Comments)', 'link' => url::current_site(), 'generator' => 'S7Ncms - http://www.s7n.de/');
     $items = array();
     foreach ($comments as $comment) {
         $items[] = array('author' => html::specialchars($comment->author), 'pubDate' => date('r', strtotime($comment->date)), 'title' => 'New comment for "' . $comment->blog_post->title . '"', 'description' => html::specialchars($comment->content), 'link' => $comment->blog_post->url(), 'guid' => $comment->blog_post->url());
     }
     $feed = feed::create($info, $items);
     $this->cache->set('s7n_blog_feed_comments', $feed);
     echo $feed;
 }
Exemplo n.º 6
0
Arquivo: roles.php Projeto: anqqa/Anqh
 /**
  * Single role view
  *
  * @param  string  $role_id
  * @param  string  $action
  */
 public function role($role_id, $action = null)
 {
     if ($action) {
         switch ($action) {
             // Delete role
             case 'delete':
                 $this->_role_delete($role_id);
                 return;
         }
     }
     $this->history = false;
     $role = new Role_Model((int) $role_id);
     $form_values = $role->as_array();
     $form_errors = $errors = array();
     // Check post
     if ($post = $this->input->post()) {
         $role->name = $post['name'];
         $role->description = $post['description'];
         try {
             $role->save();
             url::redirect('/roles');
         } catch (ORM_Validation_Exception $e) {
             $form_errors = $e->validation->errors();
         }
         $form_values = arr::overwrite($form_values, $post);
     }
     // show form
     if ($role->id) {
         $this->breadcrumb[] = html::anchor('role/' . url::title($role->id, $role->name), html::specialchars($role->name));
         $this->page_title = text::title($role->name);
         $this->page_actions[] = array('link' => 'role/' . url::title($role->id, $role->name) . '/delete', 'text' => __('Delete role'), 'class' => 'role-delete');
     } else {
         $this->page_title = __('Role');
     }
     if (empty($errors)) {
         widget::add('main', View_Mod::factory('roles/role_edit', array('values' => $form_values, 'errors' => $form_errors)));
     } else {
         $this->_error(Kohana::lang('generic.error'), $errors);
     }
 }
Exemplo n.º 7
0
 /**
  * 取得反馈
  */
 public function index()
 {
     if ($this->get_method() != 'POST') {
         $this->send_response(405, NULL, '请求的方法不存在');
     }
     $data = $this->get_data();
     $text = isset($data['text']) ? trim($data['text']) : '';
     $contact = isset($data['contact']) ? trim($data['contact']) : '';
     $kind = isset($data['kind']) ? trim($data['kind']) : '';
     $source = $this->get_source();
     if (empty($text)) {
         $this->send_response(400, NULL, '400901:反馈内容不能为空');
     }
     if (empty($source)) {
         $this->send_response(400, NULL, '400902:客户端类型id不能为空');
     }
     $this->user_id = $this->getUid();
     $name = sns::getrealname($this->user_id);
     $text = html::specialchars($text);
     $array = array('uid' => $this->user_id, 'name' => $name, 'content' => $text, 'contact' => $contact, 'kind' => $kind, 'client_id' => $source, 'addtime' => time());
     $return = $this->model->saveData($array);
     $this->send_response(200);
 }
Exemplo n.º 8
0
 /**
  * Is the password provided correct?
  *
  * @param user User Model
  * @param string $password a plaintext password
  * @return boolean true if the password is correct
  */
 static function is_correct_password($user, $password)
 {
     $valid = $user->password;
     // Try phpass first, since that's what we generate.
     if (strlen($valid) == 34) {
         require_once MODPATH . "user/lib/PasswordHash.php";
         $hashGenerator = new PasswordHash(10, true);
         return $hashGenerator->CheckPassword($password, $valid);
     }
     $salt = substr($valid, 0, 4);
     // Support both old (G1 thru 1.4.0; G2 thru alpha-4) and new password schemes:
     $guess = strlen($valid) == 32 ? md5($password) : $salt . md5($salt . $password);
     if (!strcmp($guess, $valid)) {
         return true;
     }
     // Passwords with <&"> created by G2 prior to 2.1 were hashed with entities
     $sanitizedPassword = html::specialchars($password, false);
     $guess = strlen($valid) == 32 ? md5($sanitizedPassword) : $salt . md5($salt . $sanitizedPassword);
     if (!strcmp($guess, $valid)) {
         return true;
     }
     return false;
 }
Exemplo n.º 9
0
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="<?php 
echo $this->config->conf['refresh'];
?>
"; URL="<?php 
echo $_SERVER['REQUEST_URI'];
?>
">
<title><?php 
if (isset($this->title)) {
    echo html::specialchars($this->title);
}
?>
</title>
<?php 
echo html::stylesheet('media/css/common.css');
echo html::stylesheet('media/css/imgareaselect-default.css');
echo html::stylesheet('media/css/ui-' . $this->theme . '/jquery-ui.css');
echo html::link('media/images/favicon.ico', 'icon', 'image/ico');
echo html::script('media/js/jquery-min.js');
echo html::script('media/js/jquery.imgareaselect.min.js');
echo html::script('media/js/jquery-ui.min.js');
?>
<script type="text/javascript">
jQuery.noConflict();
jQuery(window).load(
Exemplo n.º 10
0
 /**
  * User profile
  */
 public function _view()
 {
     $this->tab_id = 'profile';
     $owner = $this->user && $this->member->id == $this->user->id;
     if ($owner && $this->user->newcomments) {
         $this->user->newcomments = 0;
         $this->user->save();
     }
     // Actions
     if ($this->member->has_access(User_Model::ACCESS_EDIT)) {
         $this->page_actions[] = array('link' => url::user($this->member) . '/edit', 'text' => __('Settings'), 'class' => 'settings');
     }
     // Picture
     widget::add('side', View_Mod::factory('member/member', array('mod_class' => 'member member-' . $this->member->id, 'user' => $this->member)));
     // Comments
     if ($this->member->has_access(User_Model::ACCESS_COMMENT)) {
         $comment = new User_Comment_Model();
         $form_values = $comment->as_array();
         $form_errors = array();
         // check post
         if (csrf::valid() && ($post = $this->input->post())) {
             $comment->user_id = $this->member->id;
             $comment->author_id = $this->user->id;
             $comment->comment = $post['comment'];
             if (isset($post['private'])) {
                 $comment->private = 1;
             }
             try {
                 $comment->save();
                 if (!$owner) {
                     $this->member->newcomments += 1;
                     $this->member->save();
                 }
                 $this->user->commentsleft += 1;
                 $this->user->save();
                 if (!request::is_ajax()) {
                     url::redirect(url::current());
                 }
             } catch (ORM_Validation_Exception $e) {
                 $form_errors = $e->validation->errors();
                 $form_values = arr::overwrite($form_values, $post);
             }
         }
         // Handle pagination
         $per_page = 25;
         $page_num = $this->uri->segment('page') ? $this->uri->segment('page') : 1;
         $page_offset = ($page_num - 1) * $per_page;
         $total_comments = $this->member->get_comment_count();
         $comments = $this->member->find_comments($page_num, $per_page, $this->user);
         $pagination = new Pagination(array('items_per_page' => $per_page, 'total_items' => $total_comments));
         $view = View::factory('generic/comments', array('delete' => '/member/comment/%d/delete/?token=' . csrf::token(), 'private' => '/member/comment/%d/private/?token=' . csrf::token(), 'comments' => $comments, 'errors' => $form_errors, 'values' => $form_values, 'pagination' => $pagination, 'user' => $this->user));
         if (request::is_ajax()) {
             echo $view;
             return;
         }
         widget::add('main', $view);
     }
     // Basic info
     $basic_info = array();
     if (!empty($this->member->name)) {
         $basic_info[__('Name')] = html::specialchars($this->member->name);
     }
     if (!empty($this->member->city_name)) {
         $basic_info[__('City')] = html::specialchars($this->member->city_name);
     }
     if (!empty($this->member->dob) && $this->member->dob != '0000-00-00') {
         $basic_info[__('Date of Birth')] = __(':dob (:years years)', array(':dob' => date::format('DMYYYY', $this->member->dob), ':years' => date::timespan(strtotime($this->member->dob), null, 'years')));
     }
     if (!empty($this->member->gender)) {
         $basic_info[__('Gender')] = $this->member->gender == 'm' ? __('Male') : __('Female');
     }
     if (!empty($this->member->latitude) && !empty($this->member->longitude)) {
         $basic_info[__('Location')] = $this->member->latitude . ', ' . $this->member->longitude;
         $basic_info[__('Location')] = html::anchor('#map', __('Toggle map'), array('class' => 'expander', 'title' => __('Show/hide'))) . '<div id="map" style="display: none">' . __('Map loading') . '</div>';
         $map = new Gmap('map', array('ScrollWheelZoom' => true));
         $map->center($this->member->latitude, $this->member->longitude, 15)->controls('small')->types();
         $map->add_marker($this->member->latitude, $this->member->longitude, html::avatar($this->member->avatar, $this->member->username) . html::user($this->member));
         widget::add('foot', html::script_source($map->render('gmaps/jquery_event')));
         widget::add('foot', html::script_source("\$('a[href*=\"#map\"]:first').click(function() { \$('#map').toggle('normal', gmap_open); return false; });"));
     }
     // Site info
     $site_info = array(__('Registered') => date::format('DMYYYY_HM', $this->member->created) . ' [#' . $this->member->id . ']', __('Logins') => __(':logins (:ago ago)', array(':logins' => number_format($this->member->logins, 0), ':ago' => '<abbr title="' . date::format('DMYYYY_HM', $this->member->last_login) . '">' . date::timespan_short($this->member->last_login) . '</abbr>')), __('Posts') => number_format($this->member->posts, 0), __('Comments') => number_format($this->member->commentsleft, 0));
     // Initialize tabs
     $tabs = array('basic-info' => array('href' => '#basic-info', 'title' => __('Basic info'), 'tab' => new View('generic/list_info', array('id' => 'basic-info', 'title' => __('Basic info'), 'list' => $basic_info))), 'site-info' => array('href' => '#site-info', 'title' => __('Site info'), 'tab' => new View('generic/list_info', array('id' => 'site-info', 'title' => __('Site info'), 'list' => $site_info))));
     widget::add('side', View::factory('generic/tabs', array('id' => 'info-tab', 'tabs' => $tabs)));
     $this->_side_views();
 }
Exemplo n.º 11
0
    ?>
                            	<?php 
} else {
    ?>
                            		<?php 
    echo html::specialchars($user['email']);
    ?>
                            	<?php 
}
?>
                            </td>
                        </tr>
                        <tr>
                            <th>评论内容: </th>
                            <td style="word-wrap:break-word;word-break:break-all;overflow:hidden;"><?php 
echo html::specialchars($inquiry['content']);
?>
</td>
                        </tr>
                        <tr>
                            <th>评论时间: </th>
                            <td><?php 
echo $inquiry['create_timestamp'];
?>
</td>
                        </tr>
                        <tr>
                            <th>回复内容: </th>
                            <td><textarea id="reply_content" name="reply_content" cols="120" rows="6" class="text" type="textarea" value="" maxlength="1024"><?php 
!empty($inquiry['reply_content']) && (print $inquiry['reply_content']);
?>
Exemplo n.º 12
0
            echo "</table></div>";
            continue;
        }
        echo "<tr class='custom_field custom_field_{$field_property['field_id']}'>";
        // Get the value for the form field
        $value = $field_property['field_response'];
        // Check if a value was fetched
        if ($value == "" and empty($show_empty)) {
            continue;
        }
        if ($field_property['field_type'] == 1 or $field_property['field_type'] > 3) {
            // Text Field
            // Is this a date field?
            echo "<td><strong>" . html::specialchars($field_property['field_name']) . ": </strong></td>";
            echo "<td class=\"answer\">{$value}</td>";
        } elseif ($field_property['field_type'] == 2) {
            // TextArea Field
            echo "<td><strong>" . html::specialchars($field_property['field_name']) . ": </strong></td>";
            echo "<td class=\"answer\">{$value}</tr>";
        } elseif ($field_property['field_type'] == 3) {
            echo "<td><strong>" . html::specialchars($field_property['field_name']) . ": </strong></td>";
            echo "<td class=\"answer\">" . date('M d Y', strtotime($value)) . "</td>";
        }
        //echo "</div>";
        echo "</tr>";
    }
    ?>
</table>
</div>
<?php 
}
Exemplo n.º 13
0
				<td><textarea id="metaDescription" class="formText" name="metaDescription"><?php 
echo $category->categories_description->meta_description;
?>
</textarea></td>
			</tr>
			<tr>
				<td><label for="metaKeywords">Keywords</label></td>
				<td><textarea id="metaKeywords" class="formText" name="metaKeywords"><?php 
echo $category->categories_description->meta_keywords;
?>
</textarea></td>
			</tr>
			<tr>
				<td><label for="metaUrl">URL</label></td>
				<td><input id="metaUrl" type="text" class="formText" name="metaUrl" value="<?php 
echo html::specialchars($category->categories_description->title_url, FALSE);
?>
" /></td>
			</tr>
			</table>
		 </div>   <!-- div id="tab_meta_infromation" -->
<!--			 
		 <div id="tab_category_products">
			<div class="headline">Category Products</div>
			<table class="list">
				<col  width="35" />
				<col  width="20" />
				<col  width="20"/>
				<col  width="20" />
          	    <col  width="100" />
			<tr>
Exemplo n.º 14
0
<ul class="contentlist favorites events">
	<?php 
foreach ($favorites as $favorite) {
    ?>
	<li class="event-<?php 
    echo $favorite->id;
    ?>
">
		<?php 
    echo date::format('DDMMYYYY', $favorite->start_time);
    ?>
		<?php 
    echo html::anchor(url::model($favorite), text::title($favorite->name), array('title' => html::specialchars($favorite->name)));
    ?>
	</li>
	<?php 
}
?>
</ul>
Exemplo n.º 15
0
 public function render_without_children()
 {
     $class = $this->active === TRUE ? 'active' : '';
     return '<li class="' . $class . '">' . html::anchor($this->uri, html::specialchars($this->title), array('class' => $class)) . '</li>';
 }
Exemplo n.º 16
0
		<th>Created</th>
		<th>Modified</th>
		<th>Uniques</th>
		<th>Views</th>
		<th>Visit</th>
		<th>QR Code</th>
	</tr>
	<?php 
foreach ($islands as $island) {
    ?>
	<tr<?php 
    echo text::alternate('', ' class="odd"');
    ?>
>
		<td><?php 
    echo html::specialchars($island->title);
    ?>
</td>
		<td><?php 
    echo $island->created;
    ?>
</td>
		<td><?php 
    echo $island->modified;
    ?>
</td>
		<td style="text-align: right;"><?php 
    echo $island->visits();
    ?>
</td>
		<td style="text-align: right;"><?php 
Exemplo n.º 17
0
Arquivo: html.php Projeto: Toushi/flow
 /**
  * Creates an HTML anchor to a file.
  *
  * @param   string  name of file to link to
  * @param   string  link text
  * @param   array   HTML anchor attributes
  * @param   string  non-default protocol, eg: ftp
  * @return  string
  */
 public static function file_anchor($file, $title = NULL, $attributes = NULL, $protocol = NULL)
 {
     return '<a href="' . html::specialchars(url::base(FALSE, $protocol) . $file, FALSE) . '"' . (is_array($attributes) ? html::attributes($attributes) : '') . '>' . ($title === NULL ? end(explode('/', $file)) : $title) . '</a>';
 }
Exemplo n.º 18
0
 /**
  * Send a new private message
  */
 public function send()
 {
     $this->template->content = new View('members/private_send');
     $this->template->content->title = Kohana::lang('ui_admin.private_messages');
     // setup and initialize form field names
     $form = array('parent_id' => '', 'private_to' => '', 'private_subject' => '', 'private_message' => '');
     //	Copy the form as errors, so the errors will be stored with keys
     //	corresponding to the form field names
     $errors = $form;
     $form_error = FALSE;
     $form_saved = FALSE;
     $form['private_to'] = (isset($_GET['to']) and !empty($_GET['to'])) ? html::specialchars($_GET['to']) : "";
     $form['parent_id'] = (isset($_GET['p']) and !empty($_GET['p'])) ? html::specialchars($_GET['p']) : "";
     // check, has the form been submitted, if so, setup validation
     if ($_POST) {
         $post = Validation::factory($_POST);
         //	 Add some filters
         $post->pre_filter('trim', TRUE);
         $post->add_rules('parent_id', 'numeric');
         $post->add_rules('private_to', 'required');
         if (!empty($_POST['private_to'])) {
             $to_array = array_filter(explode(",", trim($_POST['private_to'])));
             foreach ($to_array as $name) {
                 $this->_user_name_chk($name, $post);
             }
         }
         $post->add_rules('private_subject', 'required', 'length[3,150]');
         $post->add_rules('private_message', 'required');
         if ($post->validate()) {
             $to_array = array_filter(explode(",", $post->private_to));
             foreach ($to_array as $name) {
                 $account = ORM::factory('user')->where("name", $name)->where("id !=" . $this->user->id)->find();
                 if ($account->loaded) {
                     $message = ORM::factory('private_message');
                     $message->parent_id = $post->parent_id;
                     $message->user_id = $account->id;
                     $message->from_user_id = $this->user->id;
                     $message->private_subject = $post->private_subject;
                     $message->private_message = $post->private_message;
                     $message->private_message_date = date("Y-m-d H:i:s", time());
                     $message->save();
                     // Email Private Message
                     $to = $account->email;
                     $from = array();
                     $settings = kohana::config('settings');
                     $from[] = $settings['site_email'];
                     $from[] = $settings['site_name'];
                     $subject = "[" . Kohana::config('settings.site_name') . "] - " . $post->private_subject;
                     $body = Kohana::lang('notifications.member_new_message.message') . "\n\n~~~~~~~~~~~~~~~~~~~~~~~~~\n" . $post->private_message . "\n\n" . Kohana::lang('notifications.member_new_message.footer') . "\n " . url::site('members/');
                     if (!email::send($to, $from, $subject, $body, FALSE)) {
                         Kohana::log('error', "email to {$to} could not be sent");
                     }
                 }
             }
             $form_saved = TRUE;
         } else {
             // repopulate the form fields
             $form = arr::overwrite($form, $post->as_array());
             // populate the error fields, if any
             $errors = arr::overwrite($errors, $post->errors('private_message'));
             $form_error = TRUE;
         }
     }
     $this->template->content->form = $form;
     $this->template->content->errors = $errors;
     $this->template->content->form_error = $form_error;
     $this->template->content->form_saved = $form_saved;
     // Javascript Header
     $this->themes->autocomplete_enabled = TRUE;
     $this->themes->js = new View('members/private_send_js');
 }
Exemplo n.º 19
0
 /**
  * Compiles an array of HTML attributes into an attribute string.
  *
  * @param   string|array  array of attributes
  * @return  string
  */
 public static function attributes($attrs)
 {
     if (empty($attrs)) {
         return '';
     }
     if (is_string($attrs)) {
         return ' ' . $attrs;
     }
     $compiled = '';
     foreach ($attrs as $key => $val) {
         $compiled .= ' ' . $key . '="' . html::specialchars($val) . '"';
     }
     return $compiled;
 }
Exemplo n.º 20
0
        ?>
</td>
                        <td class="cell span-4"><?php 
        echo html::specialchars(empty($product['category']) ? '' : $product['category']['title_manage']);
        ?>
</td>
                        <td class="cell span-5"><?php 
        echo html::specialchars($product['name_manage']);
        ?>
</td>
                        <td class="cell span-5"><?php 
        echo html::specialchars($product['title']);
        ?>
</td>
                        <td class="cell span-3"><?php 
        echo empty($product['brand']) ? '<font color=#ff0000>无</font>' : html::specialchars($product['brand']['name']);
        ?>
</td>
                    </tr>
                    <?php 
    }
    ?>
                    <?php 
} else {
    ?>
                    <tr>
                    	<td colspan="6"><font color="#990000">未找到可供合并的商品!</td></td>
                    </tr>
                    <?php 
}
?>
<?php

defined('SYSPATH') or die('No direct access allowed.');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style type="text/css">
<?php 
include Kohana::find_file('views', 'kohana_errors', FALSE, 'css');
?>
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title><?php 
echo $error;
?>
</title>
</head>
<body>
<div id="framework_error" style="width:24em;margin:50px auto;">
<h3><?php 
echo html::specialchars($error);
?>
</h3>
<p style="text-align:center"><?php 
echo $message;
?>
</p>
</div>
</body>
</html>
Exemplo n.º 22
0
Arquivo: forum.php Projeto: anqqa/Anqh
 /**
  * View topic
  *
  * @param  mixed   $topic_id
  * @param  string  $action
  * @param  mixed   $extra
  */
 public function topic($topic_id, $action = false, $extra = false)
 {
     // Hide tabs
     $this->tabs = null;
     if ($action) {
         switch ($action) {
             // Delete topic
             case 'delete':
                 $this->_topic_delete($topic_id);
                 return;
                 // Edit topic
             // Edit topic
             case 'edit':
                 $this->_topic_edit($topic_id);
                 return;
                 // Post to topic
             // Post to topic
             case 'post':
                 $this->_post_add($topic_id);
                 return;
                 // Go to post
             // Go to post
             default:
                 if (is_numeric($action)) {
                     $post_id = (int) $action;
                 }
         }
     }
     $forum_topic = new Forum_Topic_Model((int) $topic_id);
     $errors = $forum_topic->id ? array() : __('Topic not found');
     if (empty($errors)) {
         $forum_area = $forum_topic->forum_area;
         $this->breadcrumb[] = html::anchor(url::model($forum_area), $forum_area->name);
         // Admin actions
         if ($forum_topic->has_access(Forum_Topic_Model::ACCESS_EDIT)) {
             $this->page_actions[] = array('link' => url::model($forum_topic) . '/edit', 'text' => __('Edit topic'), 'class' => 'topic-edit');
         }
         // Logged user actions
         if ($forum_topic->has_access(Forum_Topic_Model::ACCESS_WRITE)) {
             $this->page_actions[] = array('link' => '#reply', 'text' => __('Reply to topic'), 'class' => 'topic-post');
         }
         // Check access and proceed
         if ($forum_area->has_access(Forum_Area_Model::ACCESS_READ)) {
             $this->breadcrumb[] = html::anchor(url::model($forum_topic), $forum_topic->name);
             $this->page_title = ($forum_topic->read_only ? '<span class="locked">' . __('[Locked]') . '</span> ' : '') . text::title($forum_topic->name);
             $this->page_subtitle = __('Area :area. ', array(':area' => html::anchor(url::model($forum_area), text::title($forum_area->name), array('title' => strip_tags($forum_area->description)))));
             $this->page_subtitle .= html::icon_value(array(':views' => $forum_topic->reads), ':views view', ':views views', 'views');
             $this->page_subtitle .= html::icon_value(array(':posts' => $forum_topic->posts), ':posts post', ':posts posts', 'posts');
             // Handle pagination
             $per_page = $this->config['posts_per_page'];
             $pagination = new Pagination(array('items_per_page' => $per_page, 'total_items' => $forum_topic->posts));
             if ($action == 'page' && $extra == 'last') {
                 $pagination->to_last_page();
             }
             $posts = $forum_topic->forum_posts->find_all($per_page, $pagination->sql_offset);
             // Update read counter if not owner
             if (!$forum_topic->is_author($this->user)) {
                 $forum_topic->reads++;
                 $forum_topic->save();
             }
             if (count($posts)) {
                 // Posts
                 widget::add('main', View_Mod::factory('forum/topic', array('mod_class' => 'topic articles topic-' . $forum_topic->id, 'user' => $this->user, 'topic' => $forum_topic, 'posts' => $posts, 'pagination' => $pagination)));
                 // Reply
                 if ($forum_topic->has_access(Forum_Topic_Model::ACCESS_WRITE)) {
                     widget::add('main', View_Mod::factory('forum/post_edit', array('mod_id' => 'reply', 'mod_title' => __('Reply'), 'form_post' => url::model($forum_topic) . '/post', 'post' => array('post_id' => 0), 'errors' => array(), 'parent_id' => 0)));
                 }
             } else {
                 $errors[] = __('No posts found.');
             }
         } else {
             // No access
             $this->page_title = text::title($forum_area->name);
             $this->page_subtitle = html::specialchars($forum_area->description) . '&nbsp;';
             $errors[] = __('Access denied.');
         }
     }
     if (count($errors)) {
         $this->_error(Kohana::lang('generic.error'), $errors);
     }
     $this->_side_views();
 }
Exemplo n.º 23
0
Arquivo: BB.php Projeto: anqqa/Anqh
 /**
  * Handle forum quotations
  *
  * @param   BBCode  $bbcode
  * @param   string  $action
  * @param   string  $name
  * @param   string  $default
  * @param   array   $params
  * @param   string  $content
  * @return  string
  */
 public function bbcode_quote($bbcode, $action, $name, $default, $params, $content)
 {
     // Pass all to 2nd phase
     if ($action == BBCODE_CHECK) {
         return true;
     }
     // Parse parameters
     foreach ($params['_params'] as $param) {
         switch ($param['key']) {
             // Parent post id
             case 'post':
                 $post_id = (int) $param['value'];
                 $post = ORM::factory('forum_post', $post_id);
                 break;
                 // Parent post author
             // Parent post author
             case 'author':
                 $author_name = $param['value'];
                 $author = ORM::factory('user')->find_user($author_name);
                 break;
         }
     }
     // Add parent post
     if (isset($post) && $post->id) {
         $quote = '<blockquote cite="' . url::model($post->forum_topic) . '/' . $post->id . '#post-' . $post->id . '">';
         // Override author
         $author = $post->author;
     } else {
         $quote = '<blockquote>';
     }
     $quote .= '<p>' . trim($content) . '</p>';
     // Post author
     if (isset($author) && $author->id) {
         $quote .= '<cite>' . __('-- :author', array(':author' => html::user($author))) . '</cite>';
     } else {
         if (isset($author_name)) {
             $quote .= '<cite>' . __('-- :author', array(':author' => html::specialchars($author_name))) . '</cite>';
         }
     }
     $quote .= '</blockquote>';
     return $quote;
 }
Exemplo n.º 24
0
        <span>Indicia</span>
    </div>
    <!-- END: banner -->


    <!-- BEGIN: page level content -->
    <div id="content" role="main">

        <h1><?php 
echo html::specialchars($error);
?>
</h1>

        <div id="framework_error" style="width:42em;margin:20px auto;">
            <pre><?php 
echo html::specialchars($description);
?>
</pre>

            <?php 
if (!empty($line) and !empty($file)) {
    ?>
            <p><?php 
    echo Kohana::lang('core.error_file_line', $file, $line);
    ?>
</p>
            <?php 
}
?>

            <pre><?php 
Exemplo n.º 25
0
						  <a class="btn-show btn-less" href="#<?php 
    echo $incident_id;
    ?>
">&laquo; <?php 
    echo Kohana::lang('ui_main.less_information');
    ?>
</a> 
						</div>
						<p class="r_location"><a href="<?php 
    echo url::site();
    ?>
reports/?l=<?php 
    echo $location_id;
    ?>
"><?php 
    echo html::specialchars($location_name);
    ?>
</a></p>
						<?php 
    // Action::report_extra_details - Add items to the report list details section
    Event::run('ushahidi_action.report_extra_details', $incident_id);
    ?>
					</div>
				</div>
			<?php 
}
?>
			</div>
			<div id="rb_map-view" style="display:none; width: 590px; height: 384px; border:1px solid #CCCCCC; margin: 3px auto;">
			</div>
		</div>
Exemplo n.º 26
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php 
if (isset($seoTitle)) {
    echo html::specialchars($seoTitle);
}
?>
</title>
<?php 
echo html::stylesheet(array('assets/css/reset.css', 'assets/css/forms.css', 'assets/css/navigation.css', 'assets/css/layout.css', 'assets/css/typography.css', 'assets/css/design.css', 'assets/css/jquery.thickbox.css', 'assets/css/jquery.datePicker.css'), 'screen', FALSE);
echo html::script(array('assets/js/jquery-1.2.6.min.js', 'assets/js/ui.jquery.js', 'assets/js/jquery.thickbox.js', 'assets/js/jquery.cycle.js'), FALSE);
if (isset($extraHead)) {
    echo $extraHead;
}
?>

<script type="text/javascript">
$(function() {
	$('#s1').cycle('fade');	


$('#s3').cycle({ 
    fx:    'scrollRight', 
    timeout: 8000, 
    speed:   3000 ,
});

$('#s2').cycle({ 
    fx:      'custom', 
Exemplo n.º 27
0
    echo html::specialchars($incident_location);
    ?>
</strong>,<strong><?php 
    if ($country_id != 0) {
        echo $countries[$country_id];
    }
    ?>
</strong></li>
												<li><?php 
    echo Kohana::lang('ui_main.submitted_by');
    ?>
 <strong><?php 
    echo html::specialchars($submit_by);
    ?>
</strong> via <strong><?php 
    echo html::specialchars($submit_mode);
    ?>
</strong></li>
											</ul>
											<ul class="links">
												<li class="none-separator"><?php 
    echo Kohana::lang('ui_main.categories');
    ?>
:<?php 
    echo $incident_category;
    ?>
</li>
											</ul>
											<?php 
    // Action::report_extra_admin - Add items to the report list in admin
    Event::run('ushahidi_action.report_extra_members', $incident);
Exemplo n.º 28
0
                <td class="elements">
                    <input name="footballer[photo]" value="<?php 
    echo @html::specialchars($_POST['footballer']['photo']);
    ?>
" />
                    <div class="smallInfo">
                        Нужно указать ссылку на фотографию игрока, с полным адресов (http://...)
                    </div>
                </td>
            </tr>

            <tr>
                <td class="label">Фотография: <nobr>(лучший гол)</nobr></td>
                <td class="elements">
                    <input name="footballer[photo_best]" value="<?php 
    echo @html::specialchars($_POST['footballer']['photo_best']);
    ?>
" />
                    <div class="smallInfo">
                        http://...)
                    </div>
                </td>
            </tr>

            <tr>
                <td class="label"></td>
                <td class="elements">
                    <input type="submit" value="Добавить">
                </td>
            </tr>
Exemplo n.º 29
0
 /**
  * Displays nice backtrace information.
  * @see http://php.net/debug_backtrace
  *
  * @param   array   backtrace generated by an exception or debug_backtrace
  * @return  string
  */
 public static function backtrace($trace)
 {
     if (!is_array($trace)) {
         return;
     }
     // Final output
     $output = array();
     foreach ($trace as $entry) {
         $temp = '<li>';
         if (isset($entry['file'])) {
             $temp .= self::lang('core.error_file_line', preg_replace('!^' . preg_quote(DOCROOT) . '!', '', $entry['file']), $entry['line']);
         }
         $temp .= '<pre>';
         if (isset($entry['class'])) {
             // Add class and call type
             $temp .= $entry['class'] . $entry['type'];
         }
         // Add function
         $temp .= $entry['function'] . '( ';
         // Add function args
         if (isset($entry['args']) and is_array($entry['args'])) {
             // Separator starts as nothing
             $sep = '';
             while ($arg = array_shift($entry['args'])) {
                 if (is_string($arg) and is_file($arg)) {
                     // Remove docroot from filename
                     $arg = preg_replace('!^' . preg_quote(DOCROOT) . '!', '', $arg);
                 }
                 $temp .= $sep . html::specialchars(print_r($arg, TRUE));
                 // Change separator to a comma
                 $sep = ', ';
             }
         }
         $temp .= ' )</pre></li>';
         $output[] = $temp;
     }
     return '<ul class="backtrace">' . implode("\n", $output) . '</ul>';
 }
Exemplo n.º 30
0
 public function put()
 {
     $request_data = $this->input->post();
     //权限检查
     if (isset($request_data['id'])) {
         role::check('product_feature_edit');
     } else {
         role::check('product_feature_add');
     }
     //安全过滤
     $request_data = trims::run($request_data);
     tool::filter_strip_tags($request_data);
     $request_data['type'] = isset($request_data['type']) ? $request_data['type'] : 0;
     $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
     try {
         //初始化返回数据
         $return_data = array();
         $validation = Validation::factory($request_data);
         $validResult = $validation->pre_filter('trim')->add_rules('name', 'required', 'length[1,100]');
         if ($validResult->validate() == FALSE) {
             $return_struct['content']['errors'] = $validResult->errors();
             throw new MyRuntimeException(Kohana::lang('o_global.input_error'), 400);
         }
         // 调用底层服务
         $attribute_service = AttributeService::get_instance();
         //是输入项时,要先删除旧的选项值
         if (isset($request_data['type']) && $request_data['type'] == 1) {
             $request_data['option_name'] = '';
             $request_data['id'] > 0 && $attribute_service->clear_attribute_value($request_data['id']);
         } else {
             //数据验证
             if (!isset($request_data['option_name']) || empty($request_data['option_name'])) {
                 throw new MyRuntimeException(Kohana::lang('o_global.bad_request'), 400);
             }
         }
         //执行添加
         $set_data = array();
         $set_data['apply'] = self::ATTRIBUTE_TYPE;
         $set_data['name'] = html::specialchars($request_data['name']);
         $set_data['alias'] = html::specialchars($request_data['alias']);
         $set_data['memo'] = html::specialchars($request_data['memo']);
         $set_data['type'] = $request_data['type'];
         if ($request_data['id']) {
             $return_data['id'] = $set_data['id'] = $request_data['id'];
             $attribute_service->update($set_data);
         } else {
             $return_data['id'] = $attribute_service->add($set_data);
         }
         if (!$return_data['id']) {
             throw new MyRuntimeException('Internal Error', 500);
         }
         //option
         if ($request_data['type'] == 0 && isset($request_data['option_name']) && !empty($request_data['option_name'])) {
             foreach ($request_data['option_name'] as $key => $val) {
                 $att_val = array();
                 $att_val['attribute_id'] = $return_data['id'];
                 $att_val['name'] = html::specialchars($val);
                 $att_val['alias'] = isset($request_data['option_alias'][$key]) ? html::specialchars($request_data['option_alias'][$key]) : '';
                 $att_val['order'] = (int) $request_data['option_order'][$key];
                 if (isset($request_data['option_image'][$key]) && !empty($request_data['option_image'][$key])) {
                     $att_val['image'] = $request_data['option_image'][$key];
                 }
                 if (isset($request_data['option_id_old'][$key]) && !empty($request_data['option_id_old'][$key])) {
                     $att_val['id'] = $request_data['option_id_old'][$key];
                 }
                 $flag = $attribute_service->save_attribute_value($att_val);
                 if (!$flag) {
                     throw new MyRuntimeException('Internal Error', 500);
                 }
             }
         }
         //* 补充&修改返回结构体 */
         $return_struct['status'] = 1;
         $return_struct['code'] = 200;
         $return_struct['msg'] = '保存成功';
         $return_struct['content'] = $return_data;
         $return_struct['action'] = array('type' => 'location', 'url' => url::base() . 'product/' . $this->class_name . '/index');
         //* 请求类型 */
         if ($this->is_ajax_request()) {
             // ajax 请求
             // json 输出
             $this->template->content = $return_struct;
         } else {
             // html 输出
             $this->template->return_struct = $return_struct;
             $content = new View('info');
             $this->template->content = $content;
             //* 请求结构数据绑定 */
             $this->template->content->request_data = $request_data;
             //* 返回结构体绑定 */
             $this->template->content->return_struct = $return_struct;
         }
         // end of request type determine
     } catch (MyRuntimeException $ex) {
         $this->_ex($ex, $request_data, $return_struct);
     }
 }