Exemplo n.º 1
0
 public function content($text, $type = "html")
 {
     $content = $this->dom->createElement("content", html::chars($text));
     $content->setAttribute("type", $type);
     $this->element->appendChild($content);
     return $this;
 }
 function __construct()
 {
     parent::__construct("entry");
     /* Set feed ID and self link. */
     $this->id(html::chars(url::abs_current()));
     $this->link()->rel("self")->href(url::abs_current());
 }
Exemplo n.º 3
0
 public function action_index()
 {
     if ($_POST) {
         $message = html::chars((string) arr::get($_POST, 'message', ''));
         if ($message) {
             // Append user information
             if ($user = $this->auth->get_user()) {
                 $message .= '<h2>Användarinfo</h2>';
                 $message .= '<dl>';
                 foreach (array('id', 'username', 'email') as $field) {
                     $message .= sprintf('<dt>%s</dt><dd>%s</dd>', $field, html::chars($user->{$field}));
                 }
                 $message .= '</dl>';
             }
             $from = arr::extract($_POST, array('e-mail', 'name'));
             if (!Validate::email($from['e-mail'])) {
                 $from['name'] .= " ({$from['e-mail']})";
                 $from['e-mail'] = '*****@*****.**';
             }
             $sent = Email::send('*****@*****.**', array($from['e-mail'], $from['name']), '[Änglarna Stockholm] Meddelande från kontaktsidan', $message, TRUE);
             if ($sent >= 1) {
                 $this->message_add('Ditt meddelande har skickats till ' . html::mailto('*****@*****.**') . '!');
             } else {
                 $this->message_add('Något blev fel. Försök igen eller skicka ett vanligt mail till ' . html::mailto('*****@*****.**') . ' istället.', 'error');
             }
         } else {
             $this->message_add('Du måste ange ett meddelande.', 'error');
         }
         $this->request->reload();
     }
     $this->template->title = 'Kontakta Änglarna Stockholm';
     $this->template->content = View::factory('kontakt/index');
 }
Exemplo n.º 4
0
 function action_login()
 {
     $this->template->title = 'My Index Title';
     $this->template->subHeading = "Login Page";
     if ($this->auth->is_logged_in()) {
         $this->addMessage(__('You are already logged in!'));
         $this->_redirect('');
         return;
     }
     // Load the user
     $data = array();
     $user = ORM::factory('account')->where('email', '=', $this->request->post('email'))->find();
     if ($this->auth->login($user, $this->request->post('password'))) {
         $this->addMessage(__('Welcome, ') . ' ' . html::chars($user->gname) . ' ' . html::chars($user->sname) . '!');
         $this->_redirect('');
         return;
     } else {
         $data['email'] = $this->request->post('email');
     }
     foreach ($this->auth->errors() as $err) {
         $this->addError($err);
     }
     $this->auth->clearErrors();
     return $this->action_loginOrRegister($data);
 }
Exemplo n.º 5
0
 public function action_view($hash = NULL)
 {
     $commit = $this->repo->getObject(sha1_bin($hash));
     require Kohana::find_file('vendor', 'htmlpurifier/library/htmlpurifier.auto');
     require Kohana::find_file('vendor', 'markdown/markdown');
     $this->template->title = html::chars($commit->summary);
     $this->template->content = View::factory('changelog/view')->set('commit', $commit)->set('htmlpurifier', new HTMLPurifier());
 }
Exemplo n.º 6
0
 public function action_index()
 {
     $errors = array();
     $auth = Auth::instance();
     if ($auth->logged_in()) {
         $session = Session::instance();
         $user = $session->get('auth_user');
         if ($user->nivel == 5) {
             $this->request->redirect('admin');
         } else {
             $this->request->redirect('dashboard');
         }
     } else {
         if (isset($_POST['submit'])) {
             $validate = Validation::factory($this->request->post());
             $validate->rule('username', 'not_empty')->rule('password', 'not_empty');
             if ($validate->check()) {
                 $user = $auth->login(html::chars($_POST['username']), html::chars($_POST['password']));
                 if ($user) {
                     $usuario = ORM::factory('users', $auth->get_user());
                     $session = Session::instance();
                     $session->set('username', $usuario->nombre);
                     $session->set('username', $usuario->username);
                     $session->set('cargo', $usuario->cargo);
                     //vitacora
                     $this->save($usuario->id_entidad, $usuario->id, $usuario->nombre . ' <b>' . $usuario->cargo . '</b> ingresó al sistema');
                     if ($usuario->nivel == 5) {
                         $this->request->redirect('admin');
                     } else {
                         if (isset($_GET['url'])) {
                             $this->request->redirect($_GET['url']);
                         } else {
                             $this->request->redirect('dashboard');
                         }
                     }
                 } else {
                     $this->template->errors['login'] = '******';
                     //$_POST=array();
                 }
             }
         }
     }
     $this->template->title .= ' / Ingreso';
     $this->template->content = View::factory('templates/login');
 }
Exemplo n.º 7
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::chars($password, false);
     $guess = strlen($valid) == 32 ? md5($sanitizedPassword) : $salt . md5($salt . $sanitizedPassword);
     if (!strcmp($guess, $valid)) {
         return true;
     }
     return false;
 }
Exemplo n.º 8
0
<div class="box">
    <h2><?php 
echo html::chars($title);
?>
</h2>
    <?php 
if (!empty($images)) {
    ?>
 
    <ol class="gallery images">
        <?php 
    foreach ($images as $image) {
        ?>
 
        <li>
            <a href="<?php 
        echo $image->path;
        ?>
" rel="shadowbox[galleri]"><img src="<?php 
        echo $image->thumb;
        ?>
" height="80" alt="<?php 
        echo $image->alt;
        ?>
"></a>
        </li>
        <?php 
    }
    ?>
 
    </ol>
Exemplo n.º 9
0
		<tr>
			<td class="align-right">Forma płatności</td>
			<td colspan="4">
				<?php 
        echo $order->meta()->fields('payment')->choices[$order->payment];
        ?>
			</td>
		</tr>
		<?php 
        if ($order->sendform->name != "Odbiór osobisty") {
            ?>
		<tr>
			<td class="align-right">Adres dostawy</td>
			<td colspan="4">
				<?php 
            echo nl2br(html::chars($order->address));
            ?>
			</td>
		</tr>
		<?php 
        }
        ?>
		<tr>
			<td class="align-right">Do zapłaty</td>
			<td colspan="4">
				Netto: <b><?php 
        echo number_format($sum_netto_plus, 2);
        ?>
 zł</b><br />
				Brutto: <b><?php 
        echo number_format($sum_brutto_plus, 2);
Exemplo n.º 10
0
<div class="yui-gd">

<div id="botinfo" class="yui-gd first">
	<div class="yui-u first leftinfo">
		Bot Name:<br />
		Author:<br />
		Challenge:<br />
		Coding Lanuage:<br />
		Created on:<br />
		Last online:<br/>
		Author's Notes:<br />
	</div>
	<div class="yui-u rightinfo" >
		<?php 
echo html::chars($bot->name);
?>
<br />
		<?php 
echo html::anchor($bot->user->uri(), $bot->user->name());
?>
<br />
		$challenge<br />
		$language<br />
		$created_date<br />
		$last_login<br />
		$author_notes<br />
	</div>
</div>

<div id="chart" class="yui-u">
Exemplo n.º 11
0
<h1>Inbjudan hos Änglarna Stockholm</h1>
<p>
    Du har blivit erbjuden att registrera en användare på Änglarna Stockholms hemsida av <?php 
echo html::chars($inviter);
?>
.
</p>
<?php 
if (!empty($message)) {
    printf('<p>%s meddelar också:</p><pre>%s</pre>', html::chars($inviter), html::chars($message));
}
?>
<p>
    Registrering sker på följande adress: <?php 
echo html::anchor($url, html::chars($url));
?>
.
</p>
<p>
    Mvh, Änglarna Stockholm
</p>
Exemplo n.º 12
0
<?php

View::set_global('field_lang_prefix', 'auth.changeEmail_field_');
echo '<div id="form">';
echo form::open();
echo '<h3>' . html::chars(__('convention.registration_form_header')) . '</h3>';
echo '<p>' . __('ecmproject.form_required') . '</p>';
echo "<fieldset>";
foreach (array('email') as $field) {
    echo new View('global/_form_field', array('field' => $field, 'fieldData' => $fields[$field], 'value' => $form[$field], 'hasError' => isset($errors[$field]) && $errors[$field]));
}
echo '</fieldset>';
echo "<fieldset class='left'>";
echo form::submit(null, __('auth.changeEmail_field_submit'));
echo '</fieldset>';
echo form::close();
echo '</div>';
Exemplo n.º 13
0
 /**
  * Registration procedure (from a given invitation)
  */
 public function action_register()
 {
     $token = arr::get($_GET, 'token', NULL);
     if (!Model_Invite::valid($token)) {
         $this->message_add('Din inbjudan är ogiltig.', 'error');
         // TODO: better message
         $this->request->redirect_back();
     } else {
         $invite = Model_Invite::factory($token)->load();
     }
     // Registrera användare
     if (!empty($_POST)) {
         $_POST['email'] = $invite->email;
         $_POST['logins'] = 0;
         $user = Sprig::factory('user', $_POST);
         /**
          * The following is executed as a transaction, and rolls
          * back if something goes wrong
          */
         try {
             // Start transaction
             DB::query(NULL, 'BEGIN')->execute();
             $user->create();
             $user->add('roles', array(Sprig::factory('role', array('name' => 'login'))->load(), Sprig::factory('role', array('name' => 'ängel'))->load()))->update();
             // Make invite invalid
             $invite->values(array('invitee' => $user->id))->update();
             // Commit transaction
             DB::query(NULL, 'COMMIT')->execute();
             // Log in!
             $this->auth->login($_POST['username'], $_POST['password']);
             // Welcome message and redirect to control panel
             $this->message_add(sprintf('Välkommen, %s! Du är nu registrerad och inloggad.
                     Jag tog mig också friheten att dirigera dig till forumet.', html::chars($user->username)));
             // TODO: Make message
             $this->request->redirect('forum', 303);
         } catch (Exception $e) {
             // Rollback transaction (innodb ftw)
             DB::query(NULL, 'ROLLBACK')->execute();
             // Non-validation errors are re-thrown and logged
             if (!$e instanceof Validate_Exception) {
                 throw $e;
             }
             // Show validation errors
             foreach ($e->array->errors('user/register') as $error) {
                 $this->message_add($error, 'error');
             }
         }
         $this->request->reload();
     }
     $this->template->content = View::factory('user/register')->set('invite', $invite);
 }
Exemplo n.º 14
0
			<tr>
				<th>Defaults</th>
				<td><?php 
        if (count($array['_defaults']) == 0) {
            echo "none";
        }
        foreach ($array['_defaults'] as $param => $default) {
            echo "<code>\"{$param}\" = \"{$default}\"</code><br/>";
        }
        ?>
</td>

			</tr>
			<tr>
				<th>Compiled Regex</th>
				<td><code><?php 
        echo html::chars($array['_route_regex']);
        ?>
</code></td>
			</tr>
		</table>
	<?php 
    }
    ?>
	
<?php 
} else {
    ?>
<p>No routes</p>
<?php 
}
Exemplo n.º 15
0
 * @author     Antti Qvickström
 * @copyright  (c) 2010 Antti Qvickström
 * @license    http://www.opensource.org/licenses/mit-license.php MIT license
 */
?>

<ul>

	<?php 
foreach ($gallery->find_images() as $image) {
    ?>

	<li class="unit size1of4">
		<div class="thumb">
			<?php 
    echo html::anchor(url::model($gallery) . '/' . $image->id, html::image('http://' . Kohana::config('site.image_server') . '/kuvat/' . $gallery->dir . '/thumb_' . $image->legacy_filename), array('title' => html::chars($image->description)));
    ?>
		</div>
		<?php 
    echo html::icon_value(array(':comments' => $image->comments), ':comments comment', ':comments comments', 'posts');
    ?>
		<?php 
    echo html::icon_value(array(':views' => $image->views), ':views view', ':views views', 'views');
    ?>
	</li>

	<?php 
}
?>

</ul>
Exemplo n.º 16
0
 /**
  * Escape special HTML chars ("<", ">", "&", etc.) to HTML entities.
  */
 private static function _escape_for_html($dirty_html)
 {
     return html::chars($dirty_html);
 }
Exemplo n.º 17
0
<html>
<head>
    <title>Сайт pm-11</title>
</head>
<body>
   <a href="/group/create">Добавить</a></br>
   <?foreach($groups123 as $group):?>
        <a href="/group/read/<?php 
echo $group->id;
?>
"><?php 
echo html::chars($group->name);
?>
</a></br>
   <?endforeach?>
</body>
</html>
Exemplo n.º 18
0
<?php

foreach (Session::instance()->take('messages', array()) as $type => $msgs) {
    printf('<ul class="message %s">', html::chars($type));
    foreach ($msgs as $msg) {
        printf('<li>%s</li>', $msg);
    }
    print '</ul>';
}
/* End of file messages.php */
/* Location: ./views/koxtend/messages.php */
Exemplo n.º 19
0
								</dd>
							</dl>
						<?php 
    echo form::close();
}
?>
					</div>
				
					<div id="art-Header-search">
						<?php 
echo form::open('products/search');
?>
						 	<dl>
						 		<dt>Szukaj:</dt>
						 		<dd><?php 
echo form::input('query', !empty($query) ? html::chars($query) : NULL, array('placeholder' => 'Szukaj&hellip;'));
?>
</dd>
						 		<dd><?php 
echo form::submit('search', 'Szukaj', array('class' => 'art-button'));
?>
</dd>
						 	</dl>
						<?php 
echo form::close();
?>
					</div>
				</div>
				<div class="art-contentLayout">
					
					<div class="art-sidebar1">
Exemplo n.º 20
0
</td>
								<td>
									<?php 
echo $form->second_name;
?>
								</td>
							</tr>

							<tr>
								<td><?php 
echo $form->label('address');
?>
</td>
								<td>
									<?php 
echo nl2br(html::chars($form->address));
?>
								</td>
							</tr>

							<tr>
								<td><?php 
echo $form->label('phone_number');
?>
</td>
								<td>
									<?php 
echo $form->phone_number;
?>
								</td>
							</tr>
Exemplo n.º 21
0
<?php

echo View::factory('common/header')->set('title', 'Home');
?>
<h3>Your Settings</h3>
User - <?php 
echo html::chars($user->name());
?>
<br/>
<?php 
if ($message !== false) {
    echo '<h2>', html::chars($message), '</h2>';
}
$fields = array('firstname' => 'First Name', 'lastname' => 'Last Name', 'email' => 'Email', 'password' => 'Password', 'password2' => 'Confirm Password', 'key' => 'Auth Key');
echo form::open();
echo '<ul class="reg">';
foreach ($fields as $key => $label) {
    if ($key != 'password2') {
        $value = $user->{$key};
    }
    $input_type = 'input';
    $attr = array('class' => 'text');
    $error = '';
    $extra = '';
    if ('password' == $key || 'password2' == $key) {
        $input_type = 'password';
        $value = '';
        $attr['autocomplete'] = 'off';
    }
    if (isset($errors[$key])) {
        $error = $errors[$key];
Exemplo n.º 22
0
//If the row containing the information is set, print out the information.
if (isset($row)) {
    ?>

<tr>
	<td><?php 
    print html::chars($row->gname) . ' ' . html::chars($row->sname);
    ?>
</td>
	<td><?php 
    print $row->reg_id;
    ?>
</td>	
	<td><?php 
    print html::chars($row->email);
    ?>
</td>
	<td><?php 
    print $row->statusToString();
    ?>
</td>	
	<?php 
    foreach ($actions as $action) {
        print '<td class="center">' . $action;
        '</td>';
    }
    ?>
</tr>

<?php 
Exemplo n.º 23
0
<?php

// Displayed feeds are cached for 5 minutes
if (!Fragment::load('feed:' . $feed . ':' . $limit, Date::MINUTE * 5)) {
    // Parse the feed
    $items = Feed::parse($feed, $limit);
    // Set the "link" and "title" variable names
    isset($link) or $link = 'link';
    isset($title) or $title = 'title';
    foreach ($items as $item) {
        // Clean the title so no one can inject anything
        $clean = html::chars($item[$title]);
        // Shorten it to 50 characters, but don't cut words in half, add 2 so that if the 51st char is a space, it will grab the 52nd character, and the word its attached to, so that the strrpos below works.
        $short = Text::limit_chars($clean, 52, false, true);
        // If the string is longer than 50 chars, cut off the leftover workd from limit_chars, and append '...'
        if (strlen($short) > 50) {
            $short = substr($short, 0, strrpos($short, ' ')) . '&#8230;';
        }
        // At this point, $short is at MAX 51 characters (50 characters of the string + "..."), usually less, because its rare for the words to line up exactly with the 50th character.
        echo '<li>' . HTML::anchor($item[$link], $short, array('title' => $clean)) . '</li>';
    }
    Fragment::save();
}
Exemplo n.º 24
0
        Här samlar vi bilder från både matcher och änglamöten. Sitter du
        och trycker på lite bilder? Skicka dem till oss på <?php 
echo html::mailto('*****@*****.**');
?>
!
    </p>
    <?php 
if (!empty($galleries)) {
    ?>
    <ol class="gallery galleries">
        <?php 
    foreach ($galleries as $gallery) {
        ?>
        <li><a href="<?php 
        echo url::site(Route::get('gallery')->uri(array('galleri' => $gallery->path)));
        ?>
"><?php 
        echo html::chars($gallery->path);
        ?>
 (<?php 
        echo $gallery->images;
        ?>
 bilder)</a></li>
        <?php 
    }
    ?>
    </ol>
    <?php 
}
?>
</div>
Exemplo n.º 25
0
if (count($venue->images->find_all()) > 1) {
    ?>
		<article class="pictures lightboxed">
			<header>
				<h3><?php 
    echo __('Pictures');
    ?>
</h3>
			</header>

			<?php 
    foreach ($venue->images->find_all() as $image) {
        if ($image->id != $venue->default_image_id) {
            ?>
				<?php 
            echo html::anchor($image->url('normal'), html::img($image, 'thumb', __('Picture')), array('title' => html::chars($venue->name)));
            ?>
			<?php 
        }
    }
    ?>

		</article>
		<?php 
}
?>
	</div>
</section>

<div class="lightbox" id="slideshow">
	<a class="prev" title="<?php 
Exemplo n.º 26
0
				<?php 
            if ($event->venue_id) {
                ?>
				<span class="details venue">@ <?php 
                echo html::anchor(url::model($event->venue), $event->venue->name);
                ?>
, <?php 
                echo html::chars($event->venue->city->city);
                ?>
</span>
				<?php 
            } elseif ($event->venue_name || $event->city_name) {
                ?>
				<span class="details venue">@ <?php 
                echo html::chars($event->venue_name) . ($event->venue_name && $event->city_name ? ', ' : '') . html::chars($event->city_name);
                ?>
</span>
				<?php 
            }
            ?>

				<?php 
            if ($event->age && $event->age != -1) {
                ?>
				<span class="details age">(<?php 
                echo __('Age limit :limit', array(':limit' => '<var>' . $event->age . '</var>'));
                ?>
)</span>
				<?php 
            }
Exemplo n.º 27
0
echo form::open("user/register?token={$invite->token}", array('class' => 'box'));
?>
    <h2>Registrera dig som Ängel!</h2>
    <dl>
        <dt><label>Namn <input type="text" name="username" class="voodoo" maxlength="50"></label></dt>
            <dd>
                Det alias eller nick du vill ha för att logga in med.
                Får inte vara längre än 50 tecken.
            </dd>
        
        <dt><label>Lösenord <input type="password" name="password" class="voodoo"></label></dt>
            <dd>
                Hitta på ett lösenord som du vill ha associerat till ditt konto
                och skriv in det i rutan ovan. Detta används när du loggar in.
            </dd>
    
        <dt><label>E-Mail <input type="text" disabled="disabled" value="<?php 
echo html::chars($invite->email);
?>
" class="voodoo"></label></dt>
            <dd>
                Den mailadress som registreras till ditt konto. Den går
                att ändra efter registrering men inte innan dess. Adressen
                används för att återställa glömda lösenord.
            </dd>
    </dl>
    <p>
        <input type="submit" value="Registrera" class="voodoo">
    </p>
</form>
Exemplo n.º 28
0
 public function action_view($galleri)
 {
     $this->template->title = 'Änglarna Stockholms galleri: ' . html::chars($galleri);
     $this->template->content = View::factory('galleri/view')->set('images', Model_Gallery::factory($galleri)->load()->images)->set('title', $galleri);
 }
Exemplo n.º 29
0
		var disp = document.defaultView.getComputedStyle(elem, null).getPropertyValue('display');

	// Toggle the state of the "display" style
	elem.style.display = disp == 'block' ? 'none' : 'block';
	return false;
}
</script>
<div id="kohana_error">
	<h1><span class="type"><?php 
echo $type;
?>
 [ <?php 
echo $code;
?>
 ]:</span> <span class="message"><?php 
echo html::chars($message);
?>
</span></h1>
	<div id="<?php 
echo $error_id;
?>
" class="content">
		<p><span class="file"><?php 
echo Kohana::debug_path($file);
?>
 [ <?php 
echo $line;
?>
 ]</span></p>
		<?php 
echo Kohana::debug_source($file, $line);
Exemplo n.º 30
0
 public function name()
 {
     return html::chars($this->firstname . ' ' . $this->lastname[0] . '.');
 }