Beispiel #1
0
 public function index()
 {
     // Pass a language strings to client side
     clientLang("account_name", "gm");
     clientLang("ban_reason", "gm");
     clientLang("account", "gm");
     clientLang("has_been_banned", "gm");
     clientLang("character_name", "gm");
     clientLang("character_has_been_kicked", "gm");
     clientLang("close_ticket", "gm");
     clientLang("close_short", "gm");
     clientLang("ban_short", "gm");
     clientLang("kick_short", "gm");
     clientLang("send", "gm");
     clientLang("mail_sent", "gm");
     clientLang("teleported", "gm");
     clientLang("must_be_offline", "gm");
     clientLang("item_sent", "gm");
     $output = "";
     foreach ($this->realms->getRealms() as $realm) {
         $tickets = $this->gm_model->getTickets($realm);
         if ($tickets) {
             foreach ($tickets as $key => $value) {
                 $tickets[$key]['name'] = $realm->getCharacters()->getNameByGuid($value['guid']);
                 $tickets[$key]['ago'] = $this->template->formatTime(time() - $value['createTime']) . " ago";
                 $tickets[$key]['message_short'] = character_limiter($value['message'], 20);
             }
         }
         $data = array('url' => pageURL, 'tickets' => $tickets, 'hasConsole' => $realm->getEmulator()->hasConsole(), 'realmId' => $realm->getId(), 'disable_items' => $this->config->item('gm_disable_send_item'));
         $content = $this->template->loadPage('panel.tpl', $data);
         $output .= $this->template->box($realm->getName(), $content);
     }
     $this->template->view($output, "modules/gm/css/gm.css", "modules/gm/js/gm.js");
 }
 public function rss()
 {
     if (mw_is_installed() == true) {
         event_trigger('mw_cron');
     }
     header('Content-Type: application/rss+xml; charset=UTF-8');
     $cont = get_content('is_active=1&is_deleted=0&limit=2500&orderby=updated_at desc');
     $site_title = $this->app->option_manager->get('website_title', 'website');
     $site_desc = $this->app->option_manager->get('website_description', 'website');
     $rssfeed = '<?xml version="1.0" encoding="UTF-8"?>';
     $rssfeed .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">' . "\n";
     $rssfeed .= '<channel>' . "\n";
     $rssfeed .= '<atom:link href="' . site_url('rss') . '" rel="self" type="application/rss+xml" />' . "\n";
     $rssfeed .= '<title>' . $site_title . '</title>' . "\n";
     $rssfeed .= '<link>' . site_url() . '</link>' . "\n";
     $rssfeed .= '<description>' . $site_desc . '</description>' . "\n";
     foreach ($cont as $row) {
         if (!isset($row['description']) or $row['description'] == '') {
             $row['description'] = $row['content'];
         }
         $row['description'] = character_limiter(strip_tags($row['description']), 500);
         $rssfeed .= '<item>' . "\n";
         $rssfeed .= '<title>' . $row['title'] . '</title>' . "\n";
         $rssfeed .= '<description><![CDATA[' . $row['description'] . '  ]]></description>' . "\n";
         $rssfeed .= '<link>' . content_link($row['id']) . '</link>' . "\n";
         $rssfeed .= '<pubDate>' . date('D, d M Y H:i:s O', strtotime($row['created_at'])) . '</pubDate>' . "\n";
         $rssfeed .= '<guid>' . content_link($row['id']) . '</guid>' . "\n";
         $rssfeed .= '</item>' . "\n";
     }
     $rssfeed .= '</channel>' . "\n";
     $rssfeed .= '</rss>';
     event_trigger('mw_robot_url_hit');
     echo $rssfeed;
     $this->app->content_manager->ping();
 }
 function save($items, $customer_id, $employee_id, $comment, $invoice_number, $payments, $sale_id = false)
 {
     if (count($items) == 0) {
         return -1;
     }
     $sales_data = array('sale_time' => date('Y-m-d H:i:s'), 'customer_id' => $this->Customer->exists($customer_id) ? $customer_id : null, 'employee_id' => $employee_id, 'comment' => $comment, 'invoice_number' => $invoice_number);
     //Run these queries as a transaction, we want to make sure we do all or nothing
     $this->db->trans_start();
     $this->db->insert('sales_suspended', $sales_data);
     $sale_id = $this->db->insert_id();
     foreach ($payments as $payment_id => $payment) {
         $sales_payments_data = array('sale_id' => $sale_id, 'payment_type' => $payment['payment_type'], 'payment_amount' => $payment['payment_amount']);
         $this->db->insert('sales_suspended_payments', $sales_payments_data);
     }
     foreach ($items as $line => $item) {
         $cur_item_info = $this->Item->get_info($item['item_id']);
         $sales_items_data = array('sale_id' => $sale_id, 'item_id' => $item['item_id'], 'line' => $item['line'], 'description' => character_limiter($item['description'], 30), 'serialnumber' => character_limiter($item['serialnumber'], 30), 'quantity_purchased' => $item['quantity'], 'discount_percent' => $item['discount'], 'item_cost_price' => $cur_item_info->cost_price, 'item_unit_price' => $item['price'], 'item_location' => $item['item_location']);
         $this->db->insert('sales_suspended_items', $sales_items_data);
         $customer = $this->Customer->get_info($customer_id);
         if ($customer_id == -1 or $customer->taxable) {
             foreach ($this->Item_taxes->get_info($item['item_id']) as $row) {
                 $this->db->insert('sales_suspended_items_taxes', array('sale_id' => $sale_id, 'item_id' => $item['item_id'], 'line' => $item['line'], 'name' => $row['name'], 'percent' => $row['percent']));
             }
         }
     }
     $this->db->trans_complete();
     if ($this->db->trans_status() === FALSE) {
         return -1;
     }
     return $sale_id;
 }
 public function test_character_limiter()
 {
     $this->assertEquals('Once upon a time, a&#8230;', character_limiter($this->_long_string, 20));
     $this->assertEquals('Once upon a time, a&hellip;', character_limiter($this->_long_string, 20, '&hellip;'));
     $this->assertEquals('Short', character_limiter('Short', 20));
     $this->assertEquals('Short', character_limiter('Short', 5));
 }
Beispiel #5
0
 public function index()
 {
     $this->load->model('clientes/Clientes_model', 'cliente');
     $this->load->model('obras/Obras_model', 'obra');
     $this->load->model('usuarios/Usuarioslocatarios_model', 'users');
     $this->load->model('obras/Obras_model', 'obras');
     $this->load->model('importacao/Importacao_model', 'import');
     $this->load->model('importacao/Importacao_model', 'import');
     $this->load->helper('text');
     $data['titulo'] = 'Steel4Web - Administrador';
     $data['pagina'] = 'dash-admin';
     $data['clientes'] = $this->cliente->get_all_order('clientes');
     $data['obras'] = $this->obras->get_all_order();
     $data['users'] = $this->users->get_all_order();
     $data['imports'] = $this->import->get_all_order();
     $data['qtdClientes'] = count($this->cliente->get_all('clientes'));
     $data['qtdObras'] = count($this->obra->get_all());
     $data['qtdUsers'] = count($this->users->get_all());
     $data['qtdImport'] = count($this->import->get_all_count());
     for ($x = 0; $x < count($data['clientes']); $x++) {
         $data['clientes'][$x]->razao = character_limiter($data['clientes'][$x]->razao, 50);
     }
     for ($y = 0; $y < count($data['obras']); $y++) {
         $data['obras'][$y]->nomeObra = character_limiter($data['obras'][$y]->nomeObra, 50);
     }
     for ($h = 0; $h < count($data['users']); $h++) {
         $data['users'][$h]->nome = character_limiter($data['users'][$h]->nome, 50);
     }
     for ($j = 0; $j < count($data['imports']); $j++) {
         $data['imports'][$j]->arquivo = character_limiter($data['imports'][$j]->arquivo, 50);
     }
     $this->render($data);
 }
Beispiel #6
0
function get_message()
{
    $id = is_logged_in();
    $ci =& get_instance();
    $ci->load->helper('text');
    $query = $ci->db->query('SELECT * FROM (SELECT * FROM `workstreams` ORDER BY time DESC) AS t where receiver ="' . $id . '" GROUP BY job_id');
    $result = $query->result_object();
    if (!empty($result)) {
        $total = '';
        $liHtml = '';
        foreach ($result as $key => $value) {
            $job_data = job_data('id', $value->job_id, ['slug', 'user_id']);
            $rel = $job_data->user_id == $id ? 'buyer' : 'seller';
            $first_name = get_user_data($value->sender, 'first_name');
            if ($value->is_read == 0) {
                $class = 'active';
                $total++;
            } else {
                $class = '';
            }
            $liHtml .= '<li class=' . $class . '><a href="' . base_url("job/view/" . $job_data->slug . '?rel=' . $rel) . '">' . character_limiter($first_name . ' : ' . $value->message, 55) . '</a></li><hr style="margin-top:5px; margin-bottom:5px">';
        }
        return array('html' => $liHtml, 'total' => $total);
    } else {
        return $liHtml = '<li><a href="javascript:void(0)">No Message</a></li>';
    }
}
Beispiel #7
0
 public function getEpisode($permalink, $episode)
 {
     /**
      * Get title website from database with the same parameter.
      * 
      * @title (Object)
      *
      */
     $title = $this->config_model->select_by_function('SITE_TITLE')->row();
     /**
      * Get data anime from selected @permalink
      *
      * Paremeters:
      * @permalink (String)
      *
      * return @anime (Object)
      */
     $info['anime'] = $this->anime_model->select_by_permalink($permalink)->row();
     /**
      * Get data episode from @idanime
      *
      * Paremeters:
      * @idanime (int)
      * @episode (int)
      *
      * return @sAnime (Object)
      */
     $info['sAnime'] = $this->episode_model->select_by_episode($info['anime']->idanime, $episode)->result();
     /**
      * Condition when selected data anime not found
      * Show Error Code 404
      */
     if (empty($info['sAnime'])) {
         show_404();
     }
     /**
      * Define variable @data (array) that need to be used in header
      * Configuring meta tag header
      *
      */
     $desc = "Download " . $info['anime']->title_anime . " episode " . $episode . " from " . $title->content;
     $data['website'] = $title->content;
     $data['title'] = 'Download ' . $info['anime']->title_anime . ' Episode ' . $episode . ' | ' . $title->content;
     $data['description'] = character_limiter($desc, 150, '...');
     $data['keywords'] = "download anime " . $info['anime']->title_anime . ", streaming anime " . $info['anime']->title_anime;
     /**
      * Define variable @info (Object) that need to use within template.
      *
      */
     $info['rating'] = $this->rating->get($info['anime']->idanime);
     $genre_count = $this->generate_genres->countTags($info['anime']->genres);
     $info['genre_link'] = $this->generate_genres->get_tag_link($info['anime']->genres, $genre_count);
     $this->load->view('header', $data);
     $this->load->view('templates/downloads', $info);
     $this->load->view('footer', $data);
 }
Beispiel #8
0
 function get_aseguradoras()
 {
     $this->db->order_by("nombre", "asc");
     $aseguradoras = $this->db->get_where("clientes", array("id_grupo" => 1, "estado" => 1));
     $aseguradoras = $aseguradoras->result();
     foreach ($aseguradoras as $aseguradora) {
         $aseguradora->nombre = character_limiter($aseguradora->nombre, 25);
     }
     return $aseguradoras;
 }
 public function index()
 {
     $this->load->model('Share_inventory');
     $model = $this->Share_inventory;
     $tabular_data = [];
     $report_data = $model->getData();
     foreach ($report_data as $row) {
         $tabular_data[] = [$row['item_id'], character_limiter($row['name'], 16), $row['quantity']];
     }
     $data = ['title' => $this->lang->line('share_items'), 'subtitle' => 'Send Items to others Locations', 'headers' => $model->getDataColumns(), 'data' => $tabular_data, 'controller_name' => strtolower(get_class()), 'session' => $this->session->userdata('items_shipping')];
     $this->load->view('items/share_inventory', $data);
 }
 public function block_content($context, array $blocks = array())
 {
     // line 8
     echo "<div class=\"module message\">\n    <div class=\"module-head\">\n        <h3>Pesan</h3>\n    </div>\n    <div class=\"module-body\">\n        <div class=\"module-option clearfix\">\n            ";
     // line 14
     echo get_flashdata("msg");
     echo "\n\n            <div class=\"pull-right\">\n                <form class=\"form-search\" method=\"get\" action=\"";
     // line 17
     echo twig_escape_filter($this->env, site_url("message/index/"), "html", null, true);
     echo "\">\n                    <div class=\"input-append\">\n                        <input type=\"text\" class=\"span3 search-query\" placeholder=\"cari pesan...\" name=\"q\" value=\"";
     // line 19
     echo twig_escape_filter($this->env, isset($context["keyword"]) ? $context["keyword"] : null, "html", null, true);
     echo "\">\n                        <button type=\"submit\" class=\"btn\"><i class=\"icon-search\"></i></button>\n                    </div>\n                </form>\n            </div>\n            <div class=\"pull-left\">\n                <a href=\"";
     // line 25
     echo twig_escape_filter($this->env, site_url("message/create/"), "html", null, true);
     echo "\" class=\"btn btn-primary\"><i class=\"icon-pencil\"></i> Tulis pesan</a>\n            </div>\n        </div>\n        <div class=\"module-body table\">\n            <table class=\"table table-message\">\n                <tbody>\n                    ";
     // line 31
     $context['_parent'] = (array) $context;
     $context['_seq'] = twig_ensure_traversable(isset($context["inbox"]) ? $context["inbox"] : null);
     foreach ($context['_seq'] as $context["_key"] => $context["d"]) {
         // line 32
         echo "                    <tr class=\"";
         echo $this->getAttribute(isset($context["d"]) ? $context["d"] : null, "opened") == 0 ? "unread" : "";
         echo " clickable-row\" data-href=\"";
         echo twig_escape_filter($this->env, site_url("message/detail/" . $this->getAttribute(isset($context["d"]) ? $context["d"] : null, "id") . "#msg-" . $this->getAttribute(isset($context["d"]) ? $context["d"] : null, "id")), "html", null, true);
         echo "\">\n                        <td class=\"cell-author\">\n                            <img style=\"height:30px;width:30px; margin-right: 10px;\" class=\"img-polaroid img-circle pull-left\" src=\"";
         // line 34
         echo twig_escape_filter($this->env, get_url_image_siswa($this->getAttribute($this->getAttribute(isset($context["d"]) ? $context["d"] : null, "profil"), "foto"), "medium", $this->getAttribute($this->getAttribute(isset($context["d"]) ? $context["d"] : null, "profil"), "jenis_kelamin")), "html", null, true);
         echo "\">\n                            <a href=\"";
         // line 35
         echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute(isset($context["d"]) ? $context["d"] : null, "profil"), "link_profil"), "html", null, true);
         echo "\">";
         echo twig_escape_filter($this->env, character_limiter($this->getAttribute($this->getAttribute(isset($context["d"]) ? $context["d"] : null, "profil"), "nama"), 23, "..."), "html", null, true);
         echo "</a>\n                            <br><small>";
         // line 36
         echo twig_escape_filter($this->env, $this->getAttribute(isset($context["d"]) ? $context["d"] : null, "date"), "html", null, true);
         echo "</small>\n                        </td>\n                        <td class=\"cell-title hidden-phone hidden-tablet\">\n                            <a class=\"pull-right\" style=\"margin-left:10px;\" href=\"";
         // line 39
         echo twig_escape_filter($this->env, site_url("message/detail/" . $this->getAttribute(isset($context["d"]) ? $context["d"] : null, "id") . "/?confirm=1#confirm"), "html", null, true);
         echo "\"><i class=\"icon-trash\"></i></a>\n                            ";
         // line 40
         echo character_limiter(strip_tags($this->getAttribute(isset($context["d"]) ? $context["d"] : null, "content")), 80, "...");
         echo "\n                        </td>\n                    </tr>\n                    ";
     }
     $_parent = $context['_parent'];
     unset($context['_seq'], $context['_iterated'], $context['_key'], $context['d'], $context['_parent'], $context['loop']);
     $context = array_intersect_key($context, $_parent) + $_parent;
     // line 44
     echo "\n                </tbody>\n            </table>\n        </div>\n        <div class=\"module-foot\">\n            ";
     // line 49
     echo isset($context["pagination"]) ? $context["pagination"] : null;
     echo "\n        </div>\n\n    </div>\n</div>\n";
 }
 function summary_items($start_date, $end_date, $sale_type, $export_excel = 0)
 {
     $this->CI->load->model('reports/Summary_items');
     $model = $this->CI->Summary_items;
     $tabular_data = array();
     $report_data = $model->getData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type));
     foreach ($report_data as $row) {
         $tabular_data[] = array(character_limiter($row['name'], 16), $row['quantity_purchased'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']), to_currency($row['profit']));
     }
     $data = array("title" => $this->CI->lang->line('reports_items_summary_report'), "subtitle" => date('m/d/Y', strtotime($start_date)) . '-' . date('m/d/Y', strtotime($end_date)), "headers" => $model->getDataColumns(), "data" => $tabular_data, "summary_data" => $model->getSummaryData(array('start_date' => $start_date, 'end_date' => $end_date, 'sale_type' => $sale_type)), "export_excel" => $export_excel, "report_name" => __FUNCTION__);
     $this->renderData = array('view' => 'partial/tabular_report', 'data' => $data);
     return $this;
 }
Beispiel #12
0
function smarty_function_shorten($params, $smarty)
{
    if (!isset($params['length'])) {
        return 'You must specify a "length" parameter for the {shorten} template function.';
    } elseif (!isset($params['string'])) {
        return 'You must specify a "string" parameter for the {shorten} template function.';
    } else {
        $smarty->CI->load->helper('text');
        $shortened = character_limiter($params['string'], $params['length']);
        // we may have HTML, so remove any unclosed tags
        $shortened = preg_replace("/<([^<>]*)(?=<|\$)/", "\$1", $shortened);
        return $shortened;
    }
}
Beispiel #13
0
 protected function parseRow(array $r)
 {
     if ($r['active'] == 1) {
         $r['active_icon'] = '<img src="' . assets_img('admin/button_green.gif', false) . '">';
     } else {
         $r['active_icon'] = '<img src="' . assets_img('admin/button_red.gif', false) . '">';
     }
     if (!empty($r['description'])) {
         $r['description_active'] = character_limiter($r['description'], 120);
     } else {
         $r['description_active'] = '<img src="' . assets_img('admin/no.gif', false) . '">';
     }
     return $r;
 }
Beispiel #14
0
 function index()
 {
     if (is_dir('./installer')) {
         $this->data->messages['notice'] = lang('delete_installer_message');
     }
     // Load stuff
     $this->data->modules = $this->modules_m->getModules();
     $this->load->model('comments/comments_m');
     $this->load->model('pages/pages_m');
     $this->load->model('users/users_m');
     $this->lang->load('comments/comments');
     $this->data->recent_users = $this->users_m->order_by('created_on')->limit(10)->get_all();
     $this->data->recent_comments = $this->comments_m->get_recent();
     foreach ($this->data->recent_comments as &$comment) {
         // work out who did the commenting
         if ($comment->user_id > 0) {
             $comment->name = anchor('admin/users/edit/' . $comment->user_id, $comment->name);
         }
         // What did they comment on
         switch ($comment->module) {
             case 'news':
                 $this->load->model('news/news_m');
                 $article = $this->news_m->get($comment->module_id);
                 $comment->item = anchor('admin/news/preview/' . $article->id, $article->title, 'class="modal-large"');
                 break;
             case 'photos':
                 $this->load->model('photos/photo_albums_m');
                 $album = $this->photo_albums_m->get($comment->module_id);
                 $comment->item = anchor('photos/' . $album->slug, $album->title, 'class="modal-large iframe"');
                 break;
             default:
                 $comment->item = $comment->module . ' #' . $comment->module_id;
                 break;
         }
         // Link to the comment
         if (strlen($comment->comment) > 30) {
             $comment->comment = character_limiter($comment->comment, 30);
         }
     }
     // Dashboard RSS feed (using SimplePie)
     $this->load->library('simplepie');
     $this->simplepie->set_cache_location(APPPATH . 'cache/simplepie/');
     $this->simplepie->set_feed_url($this->settings->item('dashboard_rss'));
     $this->simplepie->init();
     $this->simplepie->handle_content_type();
     // Store the feed items
     $this->data->rss_items = $this->simplepie->get_items(0, $this->settings->item('dashboard_rss_count'));
     $this->template->set_partial('sidebar', 'admin/partials/sidebar', FALSE);
     $this->template->build('admin/dashboard', $this->data);
 }
function get_person_data_row($person, $controller)
{
    $CI =& get_instance();
    $controller_name = $CI->uri->segment(1);
    $width = $controller->get_form_width();
    $table_data_row = '<tr>';
    $table_data_row .= "<td width='5%'><input type='checkbox' id='person_{$person->person_id}' value='" . $person->person_id . "'/></td>";
    $table_data_row .= '<td width="20%">' . character_limiter($person->last_name, 13) . '</td>';
    $table_data_row .= '<td width="20%">' . character_limiter($person->first_name, 13) . '</td>';
    $table_data_row .= '<td width="30%">' . mailto($person->email, character_limiter($person->email, 22)) . '</td>';
    $table_data_row .= '<td width="20%">' . character_limiter($person->phone_number, 13) . '</td>';
    $table_data_row .= '<td width="5%">' . anchor($controller_name . "/view/{$person->person_id}/width:{$width}", $CI->lang->line('common_edit'), array('class' => 'thickbox', 'title' => $CI->lang->line($controller_name . '_update'))) . '</td>';
    $table_data_row .= '</tr>';
    return $table_data_row;
}
 /**
  * form reservation
  */
 public function reservation()
 {
     $this->load->model('MetaData_model');
     $this->layout->setLayout('layouts/frontend/layout-reservas');
     $page = $this->uri->segment(1);
     $subPage = $this->uri->segment(2);
     $title = str_replace('-', ' ', $subPage);
     $title = $this->security->xss_clean($title);
     $data = array('data' => $this->Post_model->getByTitle($title));
     if (is_array($data['data']) && count($data['data']) > 0) {
         $this->layout->setTitle($data['data']['title_seo']);
         $descriptionSeo = character_limiter(strip_tags($data['data']['description']), 135);
         $this->layout->setDescripcion($descriptionSeo);
     }
     $this->layout->view('frontend/post/reservation', $data);
 }
 function process_notification()
 {
     $this->CI->load->library('composer/lib_aws');
     $sqs_client = $this->CI->lib_aws->get_sqs();
     // $result = $sqs_client->ListQueues(); print_r($result); die();
     $config = $this->CI->config->item('aws', 'api_key');
     // https://sqs.us-west-2.amazonaws.com/012345678901/ses-bounces
     // https://sqs.us-west-2.amazonaws.com/012345678901/ses-complaints
     // https://sqs.us-west-2.amazonaws.com/012345678901/ses-deliveries
     $queue_url = 'https://sqs.' . $config['region'] . '.amazonaws.com/' . $config['account_id'] . '/ses-notifications';
     $result = $sqs_client->receiveMessage(array('QueueUrl' => $queue_url, 'MaxNumberOfMessages' => 9));
     if (empty($result['Messages'])) {
         exit('@kill-task: No task found');
     }
     foreach ($result['Messages'] as $sqs_message) {
         if (!empty($sqs_message['Body'])) {
             $sns_message = json_decode($sqs_message['Body'], TRUE);
             if (!empty($sns_message['Message'])) {
                 $feedback = NULL;
                 $ses_message = json_decode($sns_message['Message'], TRUE);
                 if (!empty($ses_message['bounce'])) {
                     $feedback = ['type' => 'bounce', 'sub_type' => $ses_message['bounce']['bounceSubType'] . ', ' . $ses_message['bounce']['bounceType'], 'to_email' => $ses_message['bounce']['bouncedRecipients'][0]['emailAddress']];
                 } elseif (!empty($ses_message['complaint'])) {
                     $feedback = ['type' => 'complaint', 'sub_type' => $ses_message['complaint']['complaintFeedbackType'], 'to_email' => $ses_message['complaint']['complainedRecipients'][0]['emailAddress']];
                 } elseif (!empty($ses_message['delivery'])) {
                     $feedback = ['type' => 'delivery', 'sub_type' => $ses_message['delivery']['smtpResponse'], 'to_email' => $ses_message['delivery']['recipients'][0]];
                 }
                 if (!empty($feedback)) {
                     $feedback['sub_type'] = !empty($feedback['sub_type']) ? character_limiter($feedback['sub_type'], 64) : NULL;
                     $feedback['recieved'] = date('Y-m-d H:i:s', strtotime($ses_message['mail']['timestamp']));
                     $this->CI->model_feedback->store($feedback['to_email']);
                     $this->CI->model_feedback->update($feedback);
                     echo "\t" . 'Email address: ' . $feedback['to_email'] . ', [' . $feedback['type'] . '] ' . $feedback['sub_type'] . PHP_EOL;
                 } else {
                     print_r($ses_message) . PHP_EOL;
                 }
             }
         }
         if (!empty($sqs_message['ReceiptHandle'])) {
             echo "\t" . 'Delete message SQS: ' . $sqs_message['ReceiptHandle'] . PHP_EOL;
             $receipt_handle = $sqs_message['ReceiptHandle'];
             $sqs_client->deleteMessage(array('QueueUrl' => $queue_url, 'ReceiptHandle' => $receipt_handle));
         }
     }
     return TRUE;
 }
Beispiel #18
0
 function prep_word_url($string, $spacer = "-")
 {
     $string = rtrim(trim($string));
     $string = character_limiter($string, 40, '');
     $string = mb_strtolower($string, 'UTF-8');
     $string = preg_replace("/[ÁáÄäÂâ]/iu", "a", $string);
     $string = preg_replace("/[ÉéËëÊê]/iu", "e", $string);
     $string = preg_replace("/[ÍíÏïÎî]/iu", "i", $string);
     $string = preg_replace("/[ÓóÖöÔô]/iu", "o", $string);
     $string = preg_replace("/[ÚúÜüÛû]/iu", "u", $string);
     $string = preg_replace("/[Ññ]/iu", "n", $string);
     $string = trim(preg_replace("/[^ A-Za-z0-9_]/", " ", $string));
     $string = preg_replace("/[ \t\n\r]+/", $spacer, $string);
     $string = str_replace(" ", $spacer, $string);
     $string = preg_replace("/[ -]+/", $spacer, $string);
     return $string;
 }
Beispiel #19
0
 public function Index($id = NULL)
 {
     if ($id == NULL) {
         $article = $this->Model_Get_Article->Get_By_Param('article', 1, 8);
     } else {
         $article = $this->Model_Get_Article->Get_By_Param('article', 1, 100, 'YEAR(date_created)', $id);
     }
     $group_article = $this->Model_Get_Article->Get_By_Param('article', 1, 8, 0, 0, 'date_created');
     //print_r($article);exit;
     foreach ($article as $key => $row) {
         $article[$key]['non_tags'] = character_limiter(strip_tags($row['description'], 10));
     }
     $view_data['article'] = $article;
     $view_data['group_article'] = $group_article;
     $view_data['title'] = 'Article';
     $view_data['body'] = 'body/article';
     $this->load->view('wrapper', $view_data);
 }
Beispiel #20
0
 public function comboAllProblem()
 {
     $q = 'SELECT problem_id, problem_title FROM pc_problem order by problem_id desc';
     $qr = $this->db->query($q);
     if ($qr->num_rows() > 0) {
         echo "<form method='post' action='" . site_url() . "/admin/detailProblem'>";
         echo "<select name='problem'>";
         foreach ($qr->result() as $row) {
             echo "<option value='" . $row->problem_id . "'>" . character_limiter($row->problem_title, 25) . "</option>";
         }
         echo "</select><br />";
         echo "<input type='submit' value='Edit This Problem' name='contestselect' />";
         echo "</form>";
         echo "<br />";
     } else {
         echo "Cannot Load Problem";
     }
 }
Beispiel #21
0
 public function comboMyProblem()
 {
     $user = $this->session->userdata('username');
     $q = 'SELECT problem_id, problem_title FROM pc_problem WHERE user_name = "' . $user . '" order by problem_id desc';
     $qr = $this->db->query($q);
     if ($qr->num_rows() > 0) {
         echo "<form method='post' action='" . site_url() . "/probset/detailProblem'>";
         echo "<select name='problem'>";
         foreach ($qr->result() as $row) {
             echo "<option value='" . $row->problem_id . "'>" . character_limiter($row->problem_title, 25) . "</option>";
         }
         echo "</select><br />";
         echo "<input type='submit' value='Edit My Problem' name='contestselect' />";
         echo "</form>";
         echo "<br />";
     } else {
         echo "You Have No Problem";
     }
 }
 public function index()
 {
     //$this->lang->load("message","spanish");
     //echo $this->lang->line("msg_hello"); exit;
     //var_dump($this->config->item('language'));
     $data = array('data' => $this->Post_model->getHome());
     $params = $data['data'];
     if (is_array($params) && count($params) > 0) {
         $descriptionSeo = character_limiter(strip_tags($params['description']), 135);
         $this->layout->setTitle($params['title_seo']);
         $this->layout->setDescripcion($descriptionSeo);
         $this->layout->setSocialSiteName("Name");
         $this->layout->setSocialTitle($params['title_seo']);
         $this->layout->setSocialResumen("Resumen");
         $this->layout->setSocialDescripcion($descriptionSeo);
     }
     //Layout load view
     $this->layout->view('frontend/home/index', $data);
 }
Beispiel #23
0
 public function Index($id = NULL)
 {
     if ($id == NULL) {
         $testimonial = $this->Model_Get_Testimonial->Get_By_Param('testimonial', 1, 8);
     } else {
         $testimonial = $this->Model_Get_Testimonial->Get_By_Param('testimonial', 1, 100, 'YEAR(date_created)', $id);
     }
     $group_testi = $this->Model_Get_Testimonial->Get_By_Param('testimonial', 1, 8, 0, 0, 'date_created');
     //print_r($article);exit;
     foreach ($testimonial as $key => $row) {
         $testimonial[$key]['non_tags'] = character_limiter(strip_tags($row['description'], 10));
     }
     //print_r($testimonial);exit;
     $view_data['testimonial'] = $testimonial;
     $view_data['group_testi'] = $group_testi;
     $view_data['title'] = 'Testimonial';
     $view_data['body'] = 'body/testimonial';
     $this->load->view('wrapper', $view_data);
 }
Beispiel #24
0
 /**
  *
  *
  * @access public
  * @return void
  */
 public function index()
 {
     $data = array();
     /*
      * Get User Data
      */
     $user_id = (int) $this->uri->segment(2, 0);
     $query = $this->db->where('user_id', $user_id)->limit(1)->get('user');
     $data['user'] = $query->result_array();
     foreach ($data['user'] as $v) {
         $user['name'] = $v['firstname'] . ' ' . $v['lastname'];
         $data['meta'] = array('title' => 'Profile - ' . $user['name'] . ' - ' . $this->setting->site_name, 'keywords' => $v['firstname'] . ',' . $v['lastname'] . ',' . $user['name'] . ',profile,author,editor,writer,user' . $v['user_id'], 'description' => character_limiter(strip_tags($v['profile']), 60));
     }
     $query = $this->db->where('user_id', $user_id)->where('page_active', 1)->order_by('page_date', 'desc')->limit(5)->get('page');
     $result = $query->result_array();
     $blogs = array();
     foreach ($result as $v) {
         $v['menu_id'] = explode(',', trim($v['menu_id'], ','));
         $v['menu_id'] = $v['menu_id'][0];
         $title = url_title($v['page_title']);
         $blogs[$v['page_id']]['url'] = site_url('blog/' . $v['menu_id'] . '/' . $v['page_id'] . '/' . $title);
         $blogs[$v['page_id']]['title'] = $v['page_title'];
     }
     $data['blogs']['Latest'] = $blogs;
     $query = $this->db->where('user_id', $user_id)->where('page_active', 1)->order_by('page_view', 'desc')->limit(5)->get('page');
     $result = $query->result_array();
     $blogs = array();
     foreach ($result as $v) {
         $v['menu_id'] = explode(',', trim($v['menu_id'], ','));
         $v['menu_id'] = $v['menu_id'][0];
         $title = url_title($v['page_title']);
         $blogs[$v['page_id']]['url'] = site_url('blog/' . $v['menu_id'] . '/' . $v['page_id'] . '/' . $title);
         $blogs[$v['page_id']]['title'] = $v['page_title'];
     }
     $data['blogs']['Most Viewed'] = $blogs;
     //main content block [content view]
     $data['content_block'] = 'user/user_view';
     /*
     | @process_view('data', 'master page')
     | @see app/core/MY_Controller.php
     */
     $this->process_view($data);
 }
Beispiel #25
0
 public function post_status($article)
 {
     $this->ci->load->model('social/credential_m');
     $url = site_url('blog/' . date('Y/m') . '/' . $this->ci->input->post('slug'));
     // Try and post that shit to facebook!
     if ($credentials = $this->ci->credential_m->get_active_provider('facebook')) {
         $params = array('access_token' => $credentials->access_token, 'name' => $this->ci->input->post('title'), 'message' => html_entity_decode(strip_tags($this->ci->input->post('intro'))), 'link' => $url);
         log_message('info', 'Post status with Facebook: ' . json_encode($params));
         $ch = curl_init();
         curl_setopt_array($ch, array(CURLOPT_URL => 'https://graph.facebook.com/me/feed', CURLOPT_POSTFIELDS => $params, CURLOPT_RETURNTRANSFER => true, CURLOPT_VERBOSE => true));
         $result = curl_exec($ch);
     }
     // Twitter wants it too... yeah she does!
     if ($credentials = $this->ci->credential_m->get_active_provider('twitter')) {
         $this->ci->load->library('twitter', array('consumer_key' => $credentials->client_key, 'consumer_secret' => $credentials->client_secret, 'oauth_token' => $credentials->access_token, 'oauth_token_secret' => $credentials->secret));
         $message = character_limiter(strip_tags($this->ci->input->post('title')), 130) . ' ' . $url;
         log_message('info', 'Post status with Twitter: ' . json_encode(array('status' => $message)));
         $this->ci->twitter->post('statuses/update', array('status' => $message));
     }
 }
 /**
  * Generate Admin Preview HTML
  *
  * Generate and return the HTML for this element for
  * the preview in the admin page controller
  *
  * @return string The HTML for this element
  */
 public function generate_admin_preview_HTML()
 {
     // store the generated HTML
     $output = NULL;
     // load this elements model
     $this->ci->load->model($this->element_path->models . 'element_text_model');
     // load the text helper
     $this->ci->load->helper('text');
     // get text from database
     $data['text'] = $this->ci->element_text_model->get_text($this->id);
     // get optional preview version first
     $data['concept'] = $this->ci->element_text_model->get_text_concept($this->id);
     // limit number of characters in content
     if (!empty($data['text'])) {
         $data['text']['content'] = character_limiter(strip_tags($data['text']['content'], '<p><br>'), 400);
     }
     // generate the HTML
     $output = $this->ci->load->view($this->element_path->views . 'admin_preview', $data, true);
     return $output;
 }
Beispiel #27
0
 public function view($gid, $iid = false)
 {
     $this->db->from('galleries');
     $this->db->where(array('galleries.gid' => $gid));
     $this->db->join('images', 'images.gid = galleries.gid')->order_by('images.iid', 'asc');
     $result = $this->db->get();
     if ($result->num_rows() == 0) {
         if ($this->session->userdata('logged')) {
             $this->data['err'] = $this->db->last_query() . "\n" . $result->num_rows();
         }
         $this->data['main_content'] = $this->load->view('gallery/error', $this->data, true);
     } else {
         $this->data['images'] = $result->result_array();
         $res = $this->db->get_where('galleries', array('gid' => $gid));
         $row = $res->row_array();
         $this->data['title'] .= " - " . anchor('/gallery/view/' . $row['gid'], $row['title']);
         $this->data['gdescription'] = $row['description'];
         if ($iid !== false) {
             //Show the ith image in the gallery
             $result = $this->db->get_where('images', array('iid' => $iid));
             if ($result->num_rows() == 0) {
                 $this->data['main_content'] = 'No such image exists in this gallery!';
             } else {
                 $this->data['img'] = $result->row_array();
                 $this->data['main_content'] = $this->load->view('gallery/gallery_view', $this->data, true);
             }
         } else {
             //Show the entire gallery
             $this->load->library('table');
             $table = array();
             foreach ($this->data['images'] as $i) {
                 $img = img('assets/images/thumbs/' . $i['link']) . '<br/>' . character_limiter($i['description'], 40);
                 $table[] = anchor('gallery/view/' . $i['gid'] . '/' . $i['iid'], $img);
             }
             $table = $this->table->make_columns($table, 4);
             $this->data['image_table'] = $this->table->generate($table);
             $this->data['main_content'] = $this->load->view('gallery/gallery_preview', $this->data, true);
         }
     }
     $this->load->view('default', $this->data);
 }
Beispiel #28
0
/**
 * Function to process the items in an X amount of comments
 * 
 * @param array $comments The comments to process
 * @return array
 */
function process_comment_items($comments)
{
    $ci =& get_instance();
    foreach ($comments as &$comment) {
        // work out who did the commenting
        if ($comment->user_id > 0) {
            $comment->name = anchor('admin/users/edit/' . $comment->user_id, $comment->name);
        }
        // What did they comment on
        switch ($comment->module) {
            case 'news':
                $ci->load->model('news/news_m');
                if ($article = $ci->news_m->get($comment->module_id)) {
                    $comment->item = anchor('admin/news/preview/' . $article->id, $article->title, 'class="modal-large"');
                    break;
                }
            case 'photos':
                $ci->load->model('photos/photos_m');
                $ci->load->model('photos/photo_albums_m');
                $photo = $ci->photos_m->get($comment->module_id);
                if ($photo && ($album = $ci->photo_albums_m->get($photo->album_id))) {
                    $comment->item = anchor(image_path('photos/' . $album->id . '/' . $photo->filename), $photo->description, 'class="modal"');
                    break;
                }
            case 'photos-album':
                $ci->load->model('photos/photo_albums_m');
                if ($album = $ci->photo_albums_m->get($comment->module_id)) {
                    $comment->item = anchor('photos/' . $album->slug, $album->title, 'class="modal-large iframe"');
                    break;
                }
            default:
                $comment->item = $comment->module . ' #' . $comment->module_id;
                break;
        }
        // Link to the comment
        if (strlen($comment->comment) > 30) {
            $comment->comment = character_limiter($comment->comment, 30);
        }
    }
    return $comments;
}
Beispiel #29
0
 function _send_text_message($data)
 {
     //THIS IS THE ONE THAT ACTUALLY GETS USED ON THE WEBSITE!
     if (!isset($data['firstname'])) {
         $data['firstname'] = "";
     }
     if (!isset($data['lastname'])) {
         $data['lastname'] = "";
     }
     if (!isset($data['message_type'])) {
         $data['message_type'] = "";
     }
     if (!isset($data['telnum'])) {
         $data['telnum'] = "";
     }
     if (!isset($data['message'])) {
         $data['message'] = "";
     }
     $firstname = $data['firstname'];
     $lastname = $data['lastname'];
     $message_type = $data['message_type'];
     $telnum = $data['telnum'];
     $message = $data['message'];
     $name = $firstname . " " . $lastname;
     //start building the message
     $the_message = $message_type . ": ";
     $the_message .= $name . " ";
     $the_message .= $telnum . " :: ";
     $the_message .= $message;
     $this->load->helper('text');
     $the_message = character_limiter($the_message, 140);
     $the_message = str_replace('&#8230;', '...', $the_message);
     $from_name = "FVL System";
     $target_mobile_numbers = $this->get_target_mobile_numbers();
     foreach ($target_mobile_numbers as $target_mobile_number) {
         $is_number_good = $this->is_mobile_good($target_mobile_number);
         if ($is_number_good == TRUE) {
             $this->fire_text($target_mobile_number, $the_message, $from_name);
         }
     }
 }
 function get_excerpt_formatted($char_limit = NULL, $readmore = '')
 {
     $this->_CI->load->helper('typography');
     $this->_CI->load->helper('text');
     $excerpt = $this->content;
     if (!empty($char_limit)) {
         // must strip tags to get accruate character count
         $excerpt = strip_tags($excerpt);
         $excerpt = character_limiter($excerpt, $char_limit);
     }
     $excerpt = auto_typography($excerpt);
     $excerpt = $this->_parse($excerpt);
     if (!empty($readmore)) {
         $attrs = array('class' => 'readmore');
         if ($this->type == 'news') {
             $attrs['target'] = '_blank';
         }
         $excerpt .= ' ' . anchor($this->get_url(), $readmore, $attrs);
     }
     return $excerpt;
 }