Esempio n. 1
0
 public function html()
 {
     $this->render_field->set('tag', 'option')->text($this->field->alias())->attr('value', HTML::entities($this->render_field->value));
     if ($this->field->parent()->val() == $this->render_field->value) {
         $this->render_field->attr('selected', 'selected');
     }
 }
Esempio n. 2
0
 protected function html()
 {
     $this->render_field->set('tag', 'input')->attr('type', 'checkbox')->attr('name', $this->field->parent()->alias() . '[]')->attr('value', HTML::entities($this->render_field->value));
     if ($this->field->checked()) {
         $this->render_field->attr('checked', 'checked');
     }
 }
Esempio n. 3
0
 public function html()
 {
     $this->render_field->set('tag', 'input')->attr('type', 'radio')->attr('name', $this->field->parent()->alias())->attr('value', HTML::entities($this->render_field->value));
     if ($this->field->parent()->val() == $this->render_field->value) {
         $this->render_field->attr('checked', 'checked');
     }
 }
Esempio n. 4
0
File: forum.php Progetto: anqh/forum
 /**
  * Construct controller
  */
 public function before()
 {
     parent::before();
     $this->page_title = __('Forum');
     // Generic page actions
     $this->page_actions['new-posts'] = array('link' => Route::url('forum'), 'text' => '<i class="icon-comment icon-white"></i> ' . __('New posts'));
     // Forum areas dropdown
     $groups = Model_Forum_Group::factory()->find_all();
     $areas = array();
     foreach ($groups as $group) {
         $divider = false;
         foreach ($group->areas() as $area) {
             if (Permission::has($area, Model_Forum_Area::PERMISSION_READ, self::$user)) {
                 $divider = true;
                 $areas[] = array('link' => Route::model($area), 'text' => HTML::entities($area->name));
             }
         }
         if ($divider) {
             $areas[] = array('divider' => true);
         }
     }
     array_pop($areas);
     $this->page_actions['areas'] = array('link' => Route::url('forum_group'), 'text' => '<i class="icon-folder-open icon-white"></i> ' . __('Areas'));
     $this->page_actions['area'] = array('link' => Route::url('forum_group'), 'text' => '', 'dropdown' => $areas);
     if (self::$user) {
         $this->page_actions['private-messages'] = array('link' => Forum::private_messages_url(), 'text' => '<i class="icon-envelope icon-white"></i> ' . __('Private messages'));
     }
 }
Esempio n. 5
0
 public function action_create()
 {
     // form post handling
     if (isset($_POST) && Valid::not_empty($_POST)) {
         // validate
         $post = Validation::factory($_POST)->rule('email', 'not_empty')->rule('email', 'email')->rule('email', 'email_domain')->rule('username', 'not_empty')->rule('username', Kohana::$config->load('ko32example.account.create.username.format'))->rule('username', 'min_length', array(':value', Kohana::$config->load('ko32example.account.create.username.min_length')))->rule('username', 'max_length', array(':value', Kohana::$config->load('ko32example.account.create.username.max_length')))->rule('password', 'not_empty')->rule('password', 'min_length', array(':value', Kohana::$config->load('ko32example.account.create.password.min_length')))->rule('password', array($this, 'pwdneusr'), array(':validation', ':field', 'username'));
         if ($post->check()) {
             // save
             $model = ORM::factory('user');
             $model->values(array('email' => $post['email'], 'username' => HTML::entities(strip_tags($post['username'])), 'password' => $post['password']));
             try {
                 $model->save();
                 $model->add('roles', ORM::factory('role')->where('name', '=', 'login')->find());
                 $model->add('roles', ORM::factory('role')->where('name', '=', 'participant')->find());
                 // success login
                 if (Auth::instance()->login($post['username'], $post['password'])) {
                     if (Auth::instance()->logged_in('participant')) {
                         // sucessfully loged
                         $this->request->redirect('dashboard');
                     }
                 } else {
                     //TODO error
                 }
             } catch (ORM_Validation_Exception $e) {
                 $errors = $e->errors('user');
             }
         } else {
             $errors = $post->errors('user');
         }
     }
     // TODO i18n
     $this->template->title = __('Create an account');
     // display
     $this->template->content = View::factory('account/create')->bind('post', $post)->bind('errors', $errors);
 }
Esempio n. 6
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $whereAmI = $this->ruta . $this->listOneBreadcrumb('editar localidad', '', 1);
     $departamentos = Departamento::listByFullName();
     $localidad = Localidad::with('departamento')->with('departamento.provincia')->with('departamento.provincia.pais')->findOrFail($id);
     $donde_estoy[0] = \HTML::entities(\Html::linkRoute('cities.localidades.index', 'localidades'));
     $data = ['whereAmI' => $whereAmI, 'departamentos' => $departamentos, 'donde_estoy' => $donde_estoy, 'localidad' => $localidad];
     return view('admin.cities.localidades.edit', $data);
 }
 public function saveContract($id)
 {
     $form = DeliveryForm::find($id);
     if ($form->contract_type->secondary_lang) {
         $rules = ['user_email' => 'required', 'company_name' => 'required', 'user_name' => 'required', 'user_surname' => 'required', 'user_patronymic' => 'required', 'requisites' => 'required', 'en_company_name' => 'required', 'en_user_name' => 'required', 'en_user_surname' => 'required', 'en_user_patronymic' => 'required', 'en_requisites' => 'required'];
     } else {
         $rules = ['user_email' => 'required', 'company_name' => 'required', 'user_name' => 'required', 'user_surname' => 'required', 'user_patronymic' => 'required', 'requisites' => 'required'];
     }
     if ($form->contract_type->id == 6) {
         $rules['tax_content'] = 'required';
     }
     $data = Input::except('_token');
     $validator = Validator::make($data, $rules);
     if ($validator->fails()) {
         return Redirect::back()->withInput()->withErrors($validator->messages());
     }
     if (isset($form->user_id) && $this->user_id == $form->user_id) {
         $form->user_email = HTML::entities(Input::get('user_email'));
         $form->company_name = HTML::entities(Input::get('company_name'));
         $form->user_name = HTML::entities(Input::get('user_name'));
         $form->user_surname = HTML::entities(Input::get('user_surname'));
         $form->user_patronymic = HTML::entities(Input::get('user_patronymic'));
         $form->requisites = HTML::entities(Input::get('requisites'));
         if ($form->contract_type->secondary_lang) {
             $form->en_company_name = HTML::entities(Input::get('en_company_name'));
             $form->en_user_name = HTML::entities(Input::get('en_user_name'));
             $form->en_user_surname = HTML::entities(Input::get('en_user_surname'));
             $form->en_user_patronymic = HTML::entities(Input::get('en_user_patronymic'));
             $form->en_requisites = HTML::entities(Input::get('en_requisites'));
         }
         if ($form->contract_type->id == 6) {
             if (!$form->tax) {
                 $tax = new Tax(['content' => HTML::entities(Input::get('tax_content'))]);
                 $tax = $form->tax()->save($tax);
             } else {
                 $form->tax->content = HTML::entities(Input::get('tax_content'));
                 $form->tax->save();
             }
         }
         $form->user_confirmed = 1;
         $form->save();
         return Redirect::to('/profile/forms/edit/' . $id);
     } else {
         return Redirect::to('/login');
     }
 }
Esempio n. 8
0
 public function html()
 {
     $this->render_field->set('tag', 'input')->attr('type', 'submit')->attr('name', $this->field->alias())->attr('value', HTML::entities($this->render_field->value));
 }
Esempio n. 9
0
<?php

/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
$factory->define(App\User::class, function (Faker\Generator $faker) {
    return ['name' => $faker->name, 'username' => $faker->userName, 'email' => $faker->email, 'password' => Hash::make('password'), 'remember_token' => str_random(10)];
});
$factory->define(App\Post::class, function (Faker\Generator $faker) {
    return ['post_content' => HTML::entities('<p>' . implode('</p><p>', $faker->paragraphs(random_int(3, 10))) . '</p>'), 'post_title' => HTML::entities($faker->sentence()), 'post_featured_image_url' => "http://lorempixel.com/1000/500/food/" . random_int(1, 10), 'created_at' => $faker->dateTime, 'updated_at' => $faker->dateTime];
});
$factory->define(App\Comment::class, function (Faker\Generator $faker) {
    return ['comment_content' => $faker->paragraph()];
});
Esempio n. 10
0
<?php

/**
 * @var string $bill_id
 * @var string $textStatus
 */
?>
<html>
<head>
	<title>Изменения в счёте</title>
</head>
<body>
<p>
	Счёт № <?php 
echo HTML::entities($bill_id);
?>
 <?php 
echo HTML::entities($textStatus);
?>
</p>
</body>
</html>
Esempio n. 11
0
				<td><?php 
    echo $mail->getDatetimeSent();
    ?>
</td>
				<td>
					<?php 
    foreach ($msg->getTo() as $email => $name) {
        if ($name) {
            echo '&lt;' . $name . '&gt; ';
        }
        echo $email;
    }
    ?>
				</td>
				<td><?php 
    echo $msg->getSubject();
    ?>
</td>
				<td>
					<?php 
    echo $msg->getContentType() == 'text/html' ? $msg->getBody() : HTML::entities($msg->getBody());
    ?>
				</td>
			</tr>
			<?php 
}
?>
		</tbody>
	</table>
</div>
Esempio n. 12
0
    ?>
"</th>
        </tr>
        <?php 
    foreach ($stats as $num => $query) {
        ?>
            <tr class="<?php 
        echo Text::alternate('odd', 'even');
        ?>
">
                <td><?php 
        echo $num + 1;
        ?>
</td>
                <td><?php 
        echo HTML::entities($query['name']);
        ?>
</td>
                <td><?php 
        echo number_format($query['time'] * 1000, 3);
        ?>
 ms</td>
                <td><?php 
        echo number_format($query['memory'] / 1024, 3);
        ?>
 kb</td>
            </tr>
            <?php 
    }
    ?>
        <?php 
Esempio n. 13
0
<?php

/**
 * @var string $themeName
 * @var string $baseMessage
 * @var string $comment
 */
?>
<html>
<head>
	<title><?php 
echo HTML::entities($themeName);
?>
</title>
</head>
<body>
<p>
	 <?php 
echo HTML::entities($baseMessage);
?>
.<br>

	<br>  <?php 
echo HTML::entities($comment);
?>
</p>
</body>
</html>
Esempio n. 14
0
 /**
  * Replace HTML entities in humanize
  * @param  string $currency optionally convert to another currency
  * @return string
  */
 public function as_html($currency = NULL)
 {
     return HTML::entities($this->humanize($currency));
 }
Esempio n. 15
0
 protected function _HTML_ENTITIES($elem)
 {
     return HTML::entities($elem[\Zeyon\SIGN_CDATA]);
 }
Esempio n. 16
0
 /**
  * Returns a "<select></select>" box and selects the option matching the HTTP POST/GET data, or the value if the former is missing.
  *
  * @param string $name The <select> tag name.
  * @param array $options An associative array of options. The keys contain
  *     the captions while the array elements contain the values. You can
  *     define an option group ("<optgroup>") by specifying an array of
  *     options as the value. For options with additional XHTML attributes,
  *     specify an array with the option value as the very first element and
  *     additional attributes thereafter.
  *     Example:
  *     <code>
  *         select('pizza', array(
  *             'Regular' => array(
  *                 'Margherita'    => array('margherita', 'title' => '50% Off Special'),
  *                 'Funghi'        => 'funghi',
  *                 'Prosciutto'    => 'prosciutto',
  *                 'Salame'        => 'salame',
  *             ),
  *             'Specials' => array(
  *                 'Mexican Style' => 'mexican',
  *                 'Spicy Curry'   => 'curry',
  *             ),
  *         ));
  *     </code>
  * @param mixed $value Optional. The value to select if no matching HTTP
  *     POST/GET variable exists. Default is NULL.
  * @param array $attributes Optional. Additional attributes to include.
  *     You can use this e.g. to set a tag ID or to override the "type"
  *     attribute. Default is NULL.
  * @param string $method Optional. Default is {@link METHOD_POST}.
  * @return string
  * @uses expandOptions()
  */
 public static function select($name, array $options, $value = null, array $attributes = null, $method = self::METHOD_POST)
 {
     $selectedValue = $method == self::METHOD_POST ? HTTP::readPOST($name, $value) : HTTP::readGET($name, $value);
     return '<select name="' . HTML::entities($name) . '" ' . HTML::expandAttributes($attributes) . '>' . self::expandOptions($options, $selectedValue) . '</select>';
 }
Esempio n. 17
0
<div class="comment">
  <div class="header">
    <?php 
echo App::gravatar_for($comment->email);
?>
    <?php 
echo $comment->username;
?>
  </div>
  <div class="content">
    <?php 
echo HTML::entities($comment->content);
?>
  </div>
</div>
Esempio n. 18
0
 /**
  * Convert HTML characters to entities.
  *
  * The encoding specified in the application configuration file will be used.
  *
  * @param string[] $array
  *
  * @return string[]
  */
 function e_array($array)
 {
     foreach ($array as $key => $value) {
         if (is_array($value)) {
             $array[$key] = e_array($value);
         } else {
             $array[$key] = HTML::entities($value);
         }
     }
     return $array;
 }
Esempio n. 19
0
    }
    if (is_null($title) or $title === false) {
        $title = $url;
    }
    return '<a href="' . $url . '"' . HTML::attributes($attributes) . '>' . HTML::image($image) . ' ' . HTML::entities($title) . '</a>';
});
HTML::macro('iconLink', function ($url, $title = null, $attributes = array(), $icon = null, $secure = null) {
    if ($url != 'void') {
        $url = url($url);
    } else {
        $url = 'javascript:void(0)';
    }
    if (is_null($title) or $title === false) {
        $title = $url;
    }
    return '<a href="' . $url . '"' . HTML::attributes($attributes) . '><i class="fa ' . $icon . '"></i> ' . HTML::entities($title) . '</a>';
});
/*
|--------------------------------------------------------------------------
| Delete form macro
|--------------------------------------------------------------------------
|
| This macro creates a form with only a submit button. 
| We'll use it to generate forms that will post to a certain url with the DELETE method,
| following REST principles.
|
*/
Form::macro('delete', function ($url, $button_label = 'Delete', $form_parameters = array(), $button_options = array()) {
    if (empty($form_parameters)) {
        $form_parameters = array('method' => 'DELETE', 'class' => 'delete-form', 'url' => $url);
    } else {
/**
 * @var string $name
 * @var string $email
 * @var string $about
 */
?>
<html>
<head>
	<title>Принята заявка в программу стажировки</title>
</head>
<body>

<p><img src="http://fintech-fab.ru/assets/main/logo.png" width="185" height="87"></p>

<p>Приветствуем вас, <?php 
echo HTML::entities($name);
?>
!</p>

<p><strong>Вы отправили заявку на участие в программе стажировки FINTECH_FAB</strong></p>

<p>Подождите день (максимум два) - мы обязательно вам ответим.</p>

<p>(если я не буду в отпуске)</p>

<p>
	С уважением,<br> Михаил<br> m.novikov@fintech-fab.ru<br> <a href="http://fintech-fab.ru">fintech-fab.ru</a>
</p>

</body>
</html>
Esempio n. 21
0
 static function format_404($str, array $info, $page, $error_page)
 {
     $replaces = array('%404_URL%' => URL::current(), '%404_LANG%' => static::lang(), '%404_ROOT%' => static::relative_path($page, $error_page), '%404_PATH%' => $info['root'] . "/{$page}", '%404_PAGE%' => $page, '%404_REFERRER%' => Request::referrer());
     foreach ($replaces as $key => $value) {
         $replaces[substr($key, 0, -1) . 'Q%'] = HTML::entities($value);
     }
     $replaces = array_map('e', $replaces);
     return strtr((string) $str, $replaces);
 }
Esempio n. 22
0
 /**
  * Turn attributes array into a string.
  *
  * @access protected
  * @return void
  */
 protected function _attr_to_str()
 {
     $str = NULL;
     $arr1 = $this->driver('get_attr');
     $arr2 = $this->get('attr', array());
     $attr = \Arr::merge($arr1, $arr2);
     foreach ($attr as $key => $value) {
         if ($value === true) {
             $str .= ' ' . $key;
         } elseif ($value !== false) {
             $str .= ' ' . $key . '="' . HTML::entities($value) . '"';
         }
     }
     return $str;
 }
Esempio n. 23
0
 /**
  * Create a HTML button element.
  *
  * @param  string  $value
  * @param  array   $attributes
  * @return string
  */
 public static function button($value, $attributes = array())
 {
     return '<button' . HTML::attributes($attributes) . '>' . HTML::entities($value) . '</button>';
 }
Esempio n. 24
0
 protected function attr_to_str()
 {
     $classes_str = implode(' ', $this->classes);
     // Begin with _classes
     $str = $classes_str ? " class=\"{$classes_str}\"" : NULL;
     $attrs = $this->attr;
     foreach ($attrs as $attr => $value) {
         $valsue = HTML::entities($value);
         $str .= " {$attr}=\"{$value}\"";
     }
     // Then attach styles
     if ($this->css) {
         $str .= ' style="';
         $styles = $this->css;
         foreach ($styles as $style => $value) {
             $str .= "{$style}:{$value};";
         }
         $str .= '"';
     }
     return $str;
 }
Esempio n. 25
0
 public function person_save()
 {
     if (Request::ajax()) {
         $person = $this->person;
         $inputs = Input::except('_token');
         if (!$person->is_valid($inputs)) {
             return '{"errors":' . Person::$errors . '}';
         } else {
             $user = $this->user->find(Session::get('id'));
             $person->name = HTML::entities(Input::get('name'));
             $person->surname = HTML::entities(Input::get('surname'));
             $person->patronymic = HTML::entities(Input::get('patronymic'));
             $person->phone = HTML::entities(Input::get('phone'));
             if (!$user->person) {
                 $user->person()->save($person);
             } else {
                 $person = $this->person->where('user_id', '=', $user->id)->first();
                 $person->name = HTML::entities(Input::get('name'));
                 $person->surname = HTML::entities(Input::get('surname'));
                 $person->patronymic = HTML::entities(Input::get('patronymic'));
                 $person->phone = HTML::entities(Input::get('phone'));
                 $person->save();
             }
             if (Input::get('work') != '') {
                 if ($user->work()->first()) {
                     $user->work()->detach();
                     $user->work()->attach(Input::get('work'));
                 } else {
                     $user->work()->attach(Input::get('work'));
                 }
             }
             return '{"success":"Персональные данные пользователя успешно сохранены"}';
         }
     }
     $inputs = Input::except('_token');
     $person = $this->person;
     $person->name = Input::get('name');
     $person->surname = Input::get('surname');
     $person->patronymic = Input::get('patronymic');
     $person->phone = Input::get('phone');
     if (!$person->is_valid($inputs)) {
         return Redirect::back()->withInput()->withErrors(Person::$errors);
     }
     $user = $this->user->whereEmail(Session::get('email'))->first();
     if (!isset($user->person->name)) {
         $person = $this->person;
         $person->name = HTML::entities(Input::get('name'));
         $person->surname = HTML::entities(Input::get('surname'));
         $person->patronymic = HTML::entities(Input::get('patronymic'));
         $person->phone = HTML::entities(Input::get('phone'));
         $user->person()->save($person);
         return Redirect::back()->withUser($user);
     } else {
         $person = $this->person->where('user_id', '=', $user->id)->first();
         $person->name = HTML::entities(Input::get('name'));
         $person->surname = HTML::entities(Input::get('surname'));
         $person->patronymic = HTML::entities(Input::get('patronymic'));
         $person->phone = HTML::entities(Input::get('phone'));
         $person->save();
         return Redirect::back()->withUser($user)->withErrors(['success-msg' => ['Персональные данные сохранены!']]);
     }
 }
Esempio n. 26
0
File: html.php Progetto: refo/kohana
	/**
	 * Turn attributes into a string (tag="val" tag2="val2")
	 *
	 * @access protected
	 * @return void
	 */
	protected function _attr_to_str()
	{
		$classes_str = implode(' ', $this->_vars['classes']);

		// Begin with _classes
		$str = $classes_str
			? " class=\"$classes_str\""
			: NULL;

		$attrs = $this->_vars['attr'];

		foreach ($attrs as $attr => $value)
		{
			$value = HTML::entities($value);
			$str.= " $attr=\"$value\"";
		}

		// Then attach styles
		if ($this->_vars['css'])
		{
			$str.= ' style="';

			$styles = $this->_vars['css'];

			foreach ($styles as $style => $value)
			{
				$str.= "$style:$value;";
			}
			$str.= '"';
		}

		return $str;
	}
Esempio n. 27
0
            ?>
" class="img-responsive" alt="<?php 
            echo HTML::chars($ad->title);
            ?>
" />
                      <?php 
        } else {
            ?>
                          <img data-src="holder.js/<?php 
            echo core::config('image.width_thumb');
            ?>
x<?php 
            echo core::config('image.height_thumb');
            ?>
?text=<?php 
            echo HTML::entities($ad->category->name);
            ?>
&amp;size=14&amp;auto=yes" class="img-responsive" alt="<?php 
            echo HTML::chars($ad->title);
            ?>
"> 
                      <?php 
        }
        ?>
                  </figure>
              </a>
          </div>
          
          <ul>
              <?php 
        if (core::request('sort') == 'distance' and Model_User::get_userlatlng()) {
Esempio n. 28
0
                <div class="tab-pane ckeditor-style <?php 
        echo $idx === 0 ? 'active' : '';
        ?>
" id="tab<?php 
        echo $idx;
        ?>
"><?php 
        echo $item['content'];
        ?>
</div>
                <textarea name="tabContents[tab<?php 
        echo $idx;
        ?>
]" class="tab<?php 
        echo $idx;
        ?>
 editor"><?php 
        echo HTML::entities($item['content']);
        ?>
</textarea>
                <?php 
    }
    ?>
            <?php 
}
?>
        </div>
        <!-- Tab panes -->
    </div>
</div>
<!-- tabs -->
Esempio n. 29
0
/**
 * Convert HTML characters to entities.
 *
 * The encoding specified in the application configuration file will be used.
 *
 * @param  string  $value
 * @return string
 */
function e($value)
{
    return HTML::entities($value);
}
Esempio n. 30
0
 public function action_newUser()
 {
     //            echo '<pre>'; print_r($_POST); exit;
     // form post handling
     if (isset($_POST) && Valid::not_empty($_POST)) {
         // validate
         $post = Validation::factory($_POST)->rule('email', 'not_empty')->rule('email', 'email')->rule('email', 'email_domain')->rule('username', 'not_empty')->rule('username', Kohana::$config->load('musyme.account.create.username.format'))->rule('username', 'min_length', array(':value', Kohana::$config->load('musyme.account.create.username.min_length')))->rule('username', 'max_length', array(':value', Kohana::$config->load('musyme.account.create.username.max_length')))->rule('password', 'not_empty')->rule('password', 'min_length', array(':value', Kohana::$config->load('musyme.account.create.password.min_length')))->rule('password', array($this, 'pwdneusr'), array(':validation', ':field', 'username'));
         if ($post->check()) {
             // save
             $model = ORM::factory('User');
             $model->values(array('email' => $post['email'], 'username' => HTML::entities(strip_tags($post['username'])), 'password' => $post['password']));
             try {
                 $model->save();
                 $model->add('roles', ORM::factory('Role')->where('name', '=', 'login')->find());
                 $model->add('roles', ORM::factory('Role')->where('name', '=', 'participant')->find());
                 $this->redirect('dashboard/users');
             } catch (ORM_Validation_Exception $e) {
                 $errors = $e->errors('user');
             }
         } else {
             $errors = $post->errors('user');
         }
     }
     // TODO i18n
     $this->template->title = __('Create an account');
     // display
     $this->template->content = View::factory('dashboard/users/new')->bind('post', $post)->bind('errors', $errors);
 }