/** * Displays a organization * @param boolean $id If id is supplied, an organization with that id will be * retrieved. */ public function view($id = FALSE) { $this->template->header->this_page = 'help'; $this->template->content = new View('help_view'); if (!$id) { url::redirect('main'); } else { $organization = ORM::factory('organization', $id); if ($organization->loaded == FALSE) { url::redirect('main'); } // Comment Post? // setup and initialize form field names $form = array('name' => '', 'email' => '', 'phone' => '', 'message' => '', 'captcha' => ''); $captcha = Captcha::factory(); $errors = $form; $form_error = FALSE; // Check, has the form been submitted, if so, setup validation if ($_POST) { // Instantiate Validation, use $post, so we don't overwrite // $_POST fields with our own things $post = Validation::factory($_POST); // Add some filters $post->pre_filter('trim', TRUE); // Add some rules, the input field, followed by a list of checks, // carried out in order $post->add_rules('name', 'required', 'length[3, 100]'); $post->add_rules('email', 'required', 'email', 'length[4, 100]'); $post->add_rules('phone', 'length[3, 100]'); $post->add_rules('message', 'required'); $post->add_rules('captcha', 'required', 'Captcha::valid'); // Test to see if things passed the rule checks if ($post->validate()) { // Yes! everything is valid - Send Message if (!empty($organization->organization_email)) { $to = $organization->organization_email; $from = $post->email; $subject = "New Message From " . Kohana::config('settings.site_name'); $message = ""; $message .= "Name: " . $post->name . "\n"; $message .= "Email: " . $post->email . "\n"; $message .= "Phone: " . $post->phone . "\n\n"; $message .= "Message:\n" . $post->message . "\n"; email::send($to, $from, $subject, $message, FALSE); } // Redirect url::redirect('help/view/' . $id); } else { // repopulate the form fields $form = arr::overwrite($form, $post->as_array()); // populate the error fields, if any $errors = arr::overwrite($errors, $post->errors('message')); $form_error = TRUE; } } $this->template->content->organization_id = $organization->id; $this->template->content->organization_name = $organization->organization_name; $this->template->content->organization_description = nl2br($organization->organization_description); $this->template->content->organization_website = text::auto_link($organization->organization_website); $this->template->content->organization_email = $organization->organization_email; $this->template->content->organization_phone1 = $organization->organization_phone1; $this->template->content->organization_phone2 = $organization->organization_phone2; // Forms $this->template->content->form = $form; $this->template->content->captcha = $captcha; $this->template->content->errors = $errors; $this->template->content->form_error = $form_error; // Javascript Header $this->template->header->js = new View('help_view_js'); } }
echo rawurlencode($layer_id); ?> ')">Delete</a>]</li> <?php } ?> </ul> <ul class="links"> <?php if ($layer_url) { ?> <li class="none-separator"><?php echo Kohana::lang('ui_main.kml_url'); ?> : <strong><?php echo text::auto_link($layer_url); ?> </strong></li><?php } ?> </ul> </td> <td class="col-3"> <?php echo "<img src=\"" . url::base() . "swatch/?c=" . $layer_color . "&w=30&h=30\">"; ?> </td> <td class="col-4"> <ul> <li class="none-separator"><a href="#add" onClick="fillFields('<?php echo rawurlencode($layer_id);
<td colspan="4" class="col"> <h3><?php echo Kohana::lang('ui_main.no_results'); ?> </h3> </td> </tr> <?php } foreach ($messages as $message) { $message_id = $message->id; $message_from = $message->reporter->service_account; $message_to = $message->message_to; $incident_id = $message->incident_id; $message_description = text::auto_link($message->message); $message_detail = nl2br(text::auto_link($message->message_detail)); $message_date = date('Y-m-d', strtotime($message->message_date)); $message_type = $message->message_type; $message_level = $message->message_level; $level_id = $message->reporter->level_id; ?> <tr <?php if ($message_level == "99") { echo " class=\"spam_tr\""; } ?> > <td class="col-1"><input name="message_id[]" id="message" value="<?php echo $message_id; ?> " type="checkbox" class="check-box"/></td>
?> <tr> <td class="col-1"> </td> <td class="col-2"> <div class="post"> <h4><?php echo $sharing_name; ?> </h4> </div> <ul class="links"> <?php if ($sharing_url) { ?> <li class="none-separator"><strong><?php echo text::auto_link("http://" . $sharing_url); ?> </strong></li><?php } ?> </ul> </td> <td class="col-3"> <?php echo "<img src=\"" . url::base() . "swatch/?c=" . $sharing_color . "&w=30&h=30\">"; ?> </td> <td class="col-4"> <ul> <li class="none-separator"><a href="#add" onClick="fillFields('<?php echo rawurlencode($sharing_id);
<h3><?php echo Kohana::lang('ui_main.no_results'); ?> </h3> </td> </tr> <?php } ?> <?php foreach ($checkins as $checkin) { $checkin_id = $checkin->id; $checkin_from = $checkin->user->email; $incident_id = 0; // TODO: Change this so we can make reports out of checkins $checkin_description = text::auto_link($checkin->checkin_description); $checkin_date = date("Y-m-d H:i:s", strtotime($checkin->checkin_date)); ?> <tr> <td class="col-1"><input name="checkin_id[]" id="checkin" value="<?php echo $checkin_id; ?> " type="checkbox" class="check-box"/></td> <td class="col-2"> <div class="post"> <p><?php echo $checkin_description; ?> </p> <?php // Action::checkin_extra_admin - Checkin Additional/Extra Stuff
<td colspan="4" class="col"> <h3><?php echo Kohana::lang('ui_main.no_results'); ?> </h3> </td> </tr> <?php } foreach ($messages as $message) { $message_id = $message->id; $message_from = html::strip_tags($message->reporter->service_account); $message_to = html::strip_tags($message->message_to); $incident_id = $message->incident_id; $message_description = text::auto_link(html::strip_tags($message->message)); $message_detail = nl2br(text::auto_link(html::strip_tags($message->message_detail))); $message_date = date('Y-m-d H:i', strtotime($message->message_date)); $message_type = $message->message_type; $message_level = $message->message_level; $latitude = $message->latitude; $longitude = $message->longitude; $level_id = $message->reporter->level_id; ?> <tr <?php if ($message_level == "99") { echo " class=\"spam_tr\""; } ?> > <td class="col-1"><input name="message_id[]" id="message" value="<?php echo $message_id;
?> <tr> <td class="col-1"> </td> <td class="col-2"> <div class="post"> <h4><?php echo $sharing_name; ?> </h4> </div> <ul class="links"> <?php if ($sharing_url) { ?> <li class="none-separator"><strong><?php echo text::auto_link($sharing_url); ?> </strong></li><?php } ?> </ul> </td> <td class="col-3"> <?php echo "<img src=\"" . url::base() . "swatch/?c=" . $sharing_color . "&w=30&h=30\">"; ?> </td> <td class="col-4"> <ul> <li class="none-separator"><a href="#add" onClick="fillFields('<?php echo rawurlencode($sharing_id);
/** * Tests the text::auto_link_urls() function. * @dataProvider auto_link_urls_provider * @group core.helpers.text.auto_link_urls * @test */ public function auto_link($text, $expected_result) { $result = text::auto_link($text); $this->assertEquals($expected_result, $result); }
?> " /> <h1><?php echo $project->name; ?> </h1> <p id="info_list"> <span><strong>Project type:</strong> <?php echo $project->project_type; ?> </span> <span><strong>Time frame:</strong> 56 hours</span> <span><strong>URL:</strong> <?php echo text::auto_link($project->url); ?> </span> <?php if ($project->user_can($user, 'edit')) { ?> <a class="right" href="<?php echo $project->local_url, '/edit'; ?> " >Edit</a> <?php } ?> </p> <p class="project_tags">
if ($total_items == 0) { ?> <tr> <td colspan="4" class="col"> <h3>No Results To Display!</h3> </td> </tr> <?php } foreach ($messages as $message) { $message_id = $message->id; $message_from = $message->message_from; $message_to = $message->message_to; $incident_id = $message->incident_id; $message_description = text::auto_link($message->message); $message_detail = text::auto_link($message->message_detail); $message_date = date('Y-m-d', strtotime($message->message_date)); $message_type = $message->message_type; ?> <tr> <td class="col-1"><input name="message_id[]" value="<?php echo $message_id; ?> " type="checkbox" class="check-box"/></td> <td class="col-2"> <div class="post"> <p><?php echo $message_description; ?> </p> <?php
} foreach ($messages as $priv_message) { $message_id = $priv_message->id; $parent_id = $priv_message->parent_id ? $priv_message->parent_id : $message_id; if ($priv_message->user_id == $user_id) { $message_from_user = ORM::factory("user", $priv_message->from_user_id); } else { $message_from_user = ORM::factory("user", $priv_message->user_id); } if ($message_from_user->loaded) { $message_from = $message_from_user->name; } else { $message_from = "Unknown"; } $subject = $priv_message->private_subject; $message = text::auto_link($priv_message->private_message); $message_preview = text::limit_chars(strip_tags($message), 150, "...", true); $message_date = date('Y-m-d', strtotime($priv_message->private_message_date)); $message_new = $priv_message->private_message_new; ?> <tr> <td class="col-1"><input name="message_id[]" id="message" value="<?php echo $message_id; ?> " type="checkbox" class="check-box" /></td> <td class="col-2"> <div class="post"> <p> <?php
/** * Finds links in a text and converts them to anchors * * @param string * @return string */ public static function links($text) { $text = preg_replace_callback('#"([^"]+)":"([^"]+)"#', array('Markup', 'anchors'), $text); $text = text::auto_link($text); return $text; }
?> </h3> </td> </tr> <?php } foreach ($messages as $message) { $message_id = $message->id; $message_from = $reporters[$message->reporter_id]; //$message_from = $message->reporter->service_account; //$message_from = $reporters[$message->reporter_id]; //$message_from = $message->reporter->service_account; $message_to = $message->message_to; $incident_id = $message->incident_id; $message_description = text::auto_link(html::specialchars($message->message)); $message_detail = nl2br(text::auto_link(html::specialchars($message->message_detail))); $message_date = date('Y/m/d', strtotime($message->message_date)); $message_type = $message->message_type; $message_level = $message->message_level; $level_id = $message->reporter->level_id; ?> <tr <?php if ($message_level == "99") { echo " class=\"spam_tr\""; } ?> > <td class="col-1"> <div class="post"> <p><?php echo $message_description;
public function __twitter() { $twitter_username = ORM::factory('setting', 'twitter_username'); $twitter_password = ORM::factory('setting', 'twitter_password'); if (isset($_POST['twitter'])) { $twitter_username->value = $_POST['twitter_username']; $twitter_username->save(); $twitter_password->value = $_POST['twitter_password']; $twitter_password->save(); } if (isset($_POST['tweet']) && $_POST['tweet'] != '') { $twitter = Twitter::instance(ORM::factory('setting', 'twitter_username')->value, ORM::factory('setting', 'twitter_password')->value); $twitter->update_status($_POST['tweet']); $this->__throw_success('Just tweeted!'); } $html = form::open(NULL); $html .= '<p><a href="http://twitter.com/" target="_BLANK">What is twitter?</a></p>'; $html .= form::hidden('twitter', 'true'); $html .= form::label('twitter_username', 'Username'); $html .= form::input('twitter_username', ORM::factory('setting', 'twitter_username')->value, 'class="fullWidth"'); $html .= form::label('twitter_password', 'Password'); $html .= form::password('twitter_password', ORM::factory('setting', 'twitter_password')->value, 'class="fullWidth"'); $html .= form::submit('submit', 'Save', 'class="submit"') . '<p> </p><p> </p>'; $html .= form::close(); $twitter = Twitter::instance(ORM::factory('setting', 'twitter_username')->value, ORM::factory('setting', 'twitter_password')->value); if (IS_ONLINE && $twitter->account_valid()) { $html .= form::open(NULL); $html .= form::label('tweet', 'Post a tweet'); $html .= form::textarea(array('name' => 'tweet', 'class' => 'fullWidth no-editor', 'style' => 'height:50px;')); $html .= form::submit('submit', 'Tweet', 'class="submit"') . '<p> </p><p> </p>'; $html .= form::close(); $html .= '<h2>Recent Tweets</h2>'; $recent_tweets = json_decode($twitter->user_timeline(null, 5)); foreach ($recent_tweets as $tweet) { $html .= '<p>' . date('d-m-y', strtotime($tweet->created_at)) . ' ' . text::auto_link($tweet->text) . '</p>'; } $html .= '<h2>Recent Replies</h2>'; $recent_tweets = json_decode($twitter->replies()); $count = 0; foreach ($recent_tweets as $tweet) { if ($count == 5) { break; } $html .= '<p>' . date('d-m-y', strtotime($tweet->created_at)) . ' ' . text::auto_link($tweet->text) . '</p>'; $count++; } } return $html; }
?> <tr> <td class="col-1"> </td> <td class="col-2"> <div class="post"> <h4><?php echo $site_name; ?> </h4> </div> <ul class="info"> <?php if ($site_url) { ?> <li class="none-separator"><strong><?php echo text::auto_link($site_url); ?> </strong></li><?php } if ($site->share_reports) { ?> <li class=""><?php echo Kohana::lang('sharing_two.share_reports_enabled'); ?> </li><?php } if ($site->share_categories) { ?> <li class=""><?php echo Kohana::lang('sharing_two.share_categories_enabled'); ?>
<p><strong><?php echo $name; ?> </strong> is interested in <strong><?php echo $work; ?> </strong> with a budget of <strong><?php echo $budget; ?> </strong>.</p> <?php echo text::auto_p(text::auto_link($description));