Esempio n. 1
0
 function link_callback($value, $row)
 {
     $replace = new Replace();
     if ($row->type == 'link_url') {
         return site_url() . $row->link_url . '.html';
     } else {
         $query = $this->db->get_where('pages', array('id_pages' => $row->static_pages))->row();
         return site_url() . 'pages' . '/' . $row->static_pages . '/' . $replace->CleanUrl(substr($query->title, 0, 70)) . '.html';
     }
 }
Esempio n. 2
0
 public function menu_frontend($parent = 0, $hasil, $cls_css = NULL)
 {
     $replace = new Replace();
     $where['parent'] = $parent;
     $w = $this->db->get_where("nav_menu", $where);
     $w_q = $this->db->get_where("nav_menu", $where)->row();
     if ($w->num_rows() > 0) {
         $hasil .= "<ul class='" . $cls_css . "'>";
     }
     foreach ($w->result() as $h) {
         $where_sub['parent'] = $h->id_menu;
         $w_sub = $this->db->get_where("nav_menu", $where_sub);
         if ($w_sub->num_rows() > 0) {
             if ($h->type == 'link_url') {
                 $hasil .= "<li><a href='" . base_url() . "" . $h->link_url . "'>" . $h->title . "</a>";
             } else {
                 $spages = $this->db->get_where('pages', array('id_pages' => $h->static_pages))->row();
                 $hasil .= "<li><a href='" . base_url('pages') . "/" . $h->static_pages . "/" . $replace->CleanUrl($spages->title) . ".html'>" . $h->title . "</a>";
             }
         } else {
             if ($h->parent == 0) {
                 if ($h->type == 'link_url') {
                     $hasil .= "<li><a href='" . base_url() . "" . $h->link_url . "'>" . $h->title . "</a>";
                 } else {
                     $spages = $this->db->get_where('pages', array('id_pages' => $h->static_pages))->row();
                     $hasil .= "<li><a href='" . base_url('pages') . "/" . $h->static_pages . "/" . $replace->CleanUrl($spages->title) . ".html'>" . $h->title . "</a>";
                 }
             } else {
                 if ($h->type == 'link_url') {
                     $hasil .= "<li><a href='" . base_url() . "" . $h->link_url . "'>" . $h->title . "</a>";
                 } else {
                     $spages = $this->db->get_where('pages', array('id_pages' => $h->static_pages))->row();
                     $hasil .= "<li><a href='" . base_url('pages') . "/" . $h->static_pages . "/" . $replace->CleanUrl($spages->title) . ".html'>" . $h->title . "</a>";
                 }
             }
         }
         $hasil = $this->menu_frontend($h->id_menu, $hasil);
         $hasil .= "</li>";
     }
     if ($w->num_rows > 0) {
         $hasil .= "</ul>";
     }
     return $hasil;
 }
Esempio n. 3
0
<div class="listing post-listing">
  <header class="listing-header">
    <h3>IM News</h3>
  </header>
  <section class="listing-cont">
    <ul>
      <?php 
$replace = new Replace();
$this->db->order_by('id_news', 'desc');
$query = $this->db->get_where('news', array('publish' => 'publish'), 5);
foreach ($query->result() as $row) {
    ?>
      <li class="item post">
        <div class="row">
          <div class="col-md-4"> <a href="<?php 
    echo site_url();
    ?>
assets/uploads/news/<?php 
    echo $row->thumb;
    ?>
" class="media-box" data-rel="prettyPhoto[Gallery]"> <img src="<?php 
    echo site_url();
    ?>
assets/uploads/news/<?php 
    echo $row->thumb;
    ?>
" alt="" class="img-thumbnail"> </a></div>
          <div class="col-md-8">
            <div class="post-title">
              <h2><a href="<?php 
    echo base_url('news') . "/" . $row->id_news . "/" . $replace->CleanUrl($row->title);
 /**
  * Taken partially from phpMyAdmin and partially from
  * Alain Wolf, Zurich - Switzerland
  * Website: http://restkultur.ch/personal/wolf/scripts/db_backup/
  * Modified by Scott Merrill (http://www.skippy.net/)
  * to use the WordPress $wpdb object
  *
  * @param string $search
  * @param string $replace
  * @param string $table
  * @param string $new_table_prefix
  *
  * @return array $table_report Reports the changes made to the db.
  */
 public function backup_table($search = '', $replace = '', $table, $new_table_prefix = '')
 {
     $table_report = array('table_name' => $table, 'rows' => 0, 'change' => 0, 'changes' => array());
     //do we need to replace the prefix?
     $table_prefix = $this->dbm->get_base_prefix();
     $new_table = $table;
     if ('' !== $new_table_prefix) {
         $new_table = $this->get_new_table_name($table, $new_table_prefix);
     }
     // Create the SQL statements
     $this->stow('# --------------------------------------------------------' . "\n");
     $this->stow('# ' . sprintf(__('Table: %s', 'search-and-replace'), $this->backquote($new_table)) . "\n");
     $table_structure = $this->dbm->get_table_structure($table);
     if (!$table_structure) {
         $this->errors->add(1, __('Error getting table details', 'search-and-replace') . ": {$table}");
         return $table_report;
     }
     $this->stow("\n\n");
     $this->stow("#\n");
     $this->stow('# ' . sprintf(__('Delete any existing table %s', 'search-and-replace'), $this->backquote($new_table)) . "\n");
     $this->stow("#\n");
     $this->stow("\n");
     $this->stow('DROP TABLE IF EXISTS ' . $this->backquote($new_table) . ';' . "\n");
     // Table structure
     // Comment in SQL-file
     $this->stow("\n\n");
     $this->stow("#\n");
     $this->stow('# ' . sprintf(__('Table structure of table %s', 'search-and-replace'), $this->backquote($new_table)) . "\n");
     $this->stow("#\n");
     $this->stow("\n");
     /** @var array $create_table */
     $create_table = $this->dbm->get_create_table_statement($table);
     if ($create_table === FALSE) {
         $err_msg = sprintf(__('Error with SHOW CREATE TABLE for %s.', 'search-and-replace'), $table);
         $this->errors->add(2, $err_msg);
         $this->stow("#\n# {$err_msg}\n#\n");
     }
     //replace prefix if necessary
     if ('' !== $new_table_prefix) {
         $create_table[0][1] = str_replace($table, $new_table, $create_table[0][1]);
     }
     $this->stow($create_table[0][1] . ' ;');
     if ($table_structure === FALSE) {
         $err_msg = sprintf(__('Error getting table structure of %s', 'search-and-replace'), $table);
         $this->errors->add(3, $err_msg);
         $this->stow("#\n# {$err_msg}\n#\n");
     }
     // Comment in SQL-file
     $this->stow("\n\n");
     $this->stow("#\n");
     $this->stow('# ' . sprintf(__('Data contents of table %s', 'search-and-replace'), $this->backquote($new_table)) . "\n");
     $this->stow("#\n");
     $defs = array();
     $ints = array();
     foreach ($table_structure as $struct) {
         if (0 === strpos($struct->Type, 'tinyint') || 0 === strpos(strtolower($struct->Type), 'smallint') || 0 === strpos(strtolower($struct->Type), 'mediumint') || 0 === strpos(strtolower($struct->Type), 'int') || 0 === strpos(strtolower($struct->Type), 'bigint')) {
             $defs[strtolower($struct->Field)] = NULL === $struct->Default ? 'NULL' : $struct->Default;
             $ints[strtolower($struct->Field)] = '1';
         }
     }
     //split columns array in primary key string and columns array
     $columns = $this->dbm->get_columns($table);
     $primary_key = $columns[0];
     $row_count = $this->dbm->get_rows($table);
     $page_size = $this->page_size;
     $pages = ceil($row_count / $page_size);
     for ($page = 0; $page < $pages; $page++) {
         $start = $page * $page_size;
         $table_data = $this->dbm->get_table_content($table, $start, $page_size);
         $entries = 'INSERT INTO ' . $this->backquote($new_table) . ' VALUES (';
         //    \x08\\x09, not required
         $hex_search = array("", "\n", "\r", "");
         $hex_replace = array('\\0', '\\n', '\\r', '\\Z');
         if ($table_data) {
             foreach ($table_data as $row) {
                 $values = array();
                 $table_report['rows']++;
                 foreach ($row as $column => $value) {
                     //if "change database prefix" is set we have to look for occurrences of the old prefix in the db entries and change them
                     if ($new_table !== $table) {
                         $value = $this->replace->recursive_unserialize_replace($table_prefix, $new_table_prefix, $value);
                     }
                     //skip replace if no search pattern
                     //check if we need to replace something
                     //skip primary_key
                     if ($search !== '' && $column !== $primary_key) {
                         $edited_data = $this->replace->recursive_unserialize_replace($search, $replace, $value);
                         // Something was changed
                         if ($edited_data !== $value) {
                             $table_report['change']++;
                             // log changes
                             $table_report['changes'][] = array('row' => $table_report['rows'], 'column' => $column, 'from' => $value, 'to' => $edited_data);
                             $value = $edited_data;
                         }
                     }
                     if (isset($ints[strtolower($column)])) {
                         // make sure there are no blank spots in the insert syntax,
                         // yet try to avoid quotation marks around integers
                         $value = NULL === $value || '' === $value ? $defs[strtolower($column)] : $value;
                         $values[] = '' === $value ? "''" : $value;
                     } else {
                         $values[] = "'" . str_replace($hex_search, $hex_replace, $this->sql_addslashes($value)) . "'";
                     }
                 }
                 $this->stow(" \n" . $entries . implode(', ', $values) . ');');
             }
         }
     }
     // Create footer/closing comment in SQL-file
     $this->stow("\n");
     $this->stow("#\n");
     $this->stow('# ' . sprintf(__('End of data contents of table %s', 'search-and-replace'), $this->backquote($new_table)) . "\n");
     $this->stow("# --------------------------------------------------------\n");
     $this->stow("\n");
     return $table_report;
 }
 function uploadfilejpg()
 {
     if (isset($_FILES['image'])) {
         $data = $_FILES['image'];
         $total = count($data['name']);
         $data2 = array();
         for ($i = 0; $i < $total; $i++) {
             $data2[] = array('name' => $data['name'][$i], 'type' => $data['type'][$i], 'tmp_name' => $data['tmp_name'][$i], 'error' => $data['error'][$i], 'size' => $data['size'][$i], 'id_ktg' => $_POST['id_ktg'], 'id_mf' => $_POST['id_mf'], 'deskripsi' => $_POST['deskripsi'][$i]);
         }
         //echo'<pre>';print_r($data2);
         $replace = new Replace();
         $no = 0;
         foreach ($data2 as $row) {
             $acak = rand(1, 9999999999);
             $config['file_name'] = $replace->NamaFile($row['deskripsi']) . '-' . $acak;
             $config['upload_path'] = './asset/fileupload/img';
             $config['allowed_types'] = 'png|jpg';
             $this->load->library('multi_upload');
             $this->multi_upload->initialize($config);
             if ($this->multi_upload->do_upload($data2[$no])) {
                 $image_data = $this->multi_upload->data();
                 //Proses input data
                 $in['id_ktg'] = $row['id_ktg'];
                 $in['id_mf'] = $row['id_mf'];
                 $in['nfile'] = $image_data['file_name'];
                 $in['jfile'] = $image_data['file_ext'];
                 $in['deskripsi'] = $row['deskripsi'];
                 $in['deo_id'] = $_SESSION['username'];
                 $in['deo_tg'] = date('Y-m-d');
                 $this->db->insert("pptx_jpg", $in);
             }
             $no++;
         }
     }
 }
Esempio n. 6
0
     $navigation[] = array("url" => 'profile', "title" => 'Восстановление пароля');
     $page_found = true;
     $template = 'restore_pwd.html';
     break;
 case $url[$n] == 'history_orders' && count($url) == 2:
     if (empty($_SESSION['fw_user'])) {
         header("Location: /cabinet/");
         exit;
     }
     $navigation[] = array("url" => 'history_orders', "title" => 'История заказов');
     $page_found = true;
     $profile = $db->get_single("SELECT *,(SELECT COUNT(*) FROM fw_orders WHERE user=u.id) AS orders FROM fw_users u WHERE u.id='" . $_SESSION['fw_user']['id'] . "'");
     $profile = String::unformat_array($profile, 'front');
     $orders_list = $db->get_all("SELECT a.id,a.user,a.insert_date,a.status,\n\t\t\t\t\t\t\t\t\tb.product_id,b.order_id,b.product_count,\n\t\t\t\t\t\t\t\t\tc.name,c.small_description,c.price,c.article FROM fw_products\n\t\t\t\t\t\t\t\t\tas c INNER JOIN (fw_orders as a INNER JOIN fw_orders_products as b\n\t\t\t\t\t\t\t\t\tON b.order_id=a.id) ON c.id=b.product_id\n\t\t\t\t\t\t\t\t\tWHERE a.user='******'fw_user']['id'] . "'");
     $search = array("'<FONT[^>]*?>'", "'</FONT>'", "'<font[^>]*?>'", "'</font>'");
     $replace = new Replace();
     if (count($orders_list)) {
         foreach ($orders_list as $key => $val) {
             $price = $orders_list[$key]['price'];
             $orders_list[$key]['price'] = number_format($orders_list[$key]['price'] * $cur_admin['kurs'] / $cur_site['kurs'], 2);
             $orders_list[$key]['price2'] = number_format($price * $cur_admin['kurs'] / $cur_site2['kurs'], 2);
             $orders_list[$key]['small_description'] = $replace->getReplace($search, "", $orders_list[$key]['small_description']);
         }
     }
     if (count($orders_list) > 0) {
         $orders_list = String::unformat_array($orders_list, 'front');
         $smarty->assign("orders_list", $orders_list);
     }
     $template = 'cabinet_orders.html';
     break;
 default:
Esempio n. 7
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../src/FAR.php';
$app = new Silex\Application();
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views'));
$app->get('/', function () use($app) {
    return $app['twig']->render('find_and_replace.html.twig');
});
$app->get('far', function () use($app) {
    $to_far = new Replace($_GET['phrase']);
    $replaced = $to_far->find_and_replace($_GET['word'], $_GET['replace']);
    return $app['twig']->render('found_and_replaced.html.twig', array('replaced' => $replaced));
});
return $app;
Esempio n. 8
0
<?php

defined('BASEPATH') or exit('No direct script access allowed');
?>
<ul class="grid-holder col-3 events-grid">
  <?php 
$replace = new Replace();
foreach ($tampil as $row) {
    ?>
  <li class="grid-item format-standard">
    <div class="grid-item-inner"> <a href="<?php 
    echo base_url('gallery') . "/" . $row->id . "/" . $replace->CleanUrl($row->subject);
    ?>
" class="media-box"> <img src="<?php 
    echo site_url();
    ?>
assets/uploads/gallery/<?php 
    echo $row->cover;
    ?>
" alt=""> </a>
      <div class="grid-content">
        <h3><a href="<?php 
    echo base_url('gallery') . "/" . $row->id . "/" . $replace->CleanUrl($row->subject);
    ?>
"><?php 
    echo $row->subject;
    ?>
</a></h3>
        <p><?php 
    echo $row->deskripsi;
    ?>
Esempio n. 9
0
 public function __construct($pattern)
 {
     parent::__construct($pattern, '');
 }
Esempio n. 10
0
<div class="listing events-listing">
  <header class="listing-header">
    <h3>IM Events</h3>
  </header>
  <section class="listing-cont">
    <ul>
      <?php 
$replace = new Replace();
$this->db->order_by('id_event', 'desc');
$query = $this->db->get_where('event', array('publish' => 'publish'), 5);
foreach ($query->result() as $row) {
    ?>
      <li class="item event-item">
        <div class="event-date"> <span class="date"><?php 
    echo substr($row->tanggal, 8, 2);
    ?>
</span> <span class="month"><?php 
    echo substr(getBulan(substr($row->tanggal, 5, 2)), 0, 3);
    ?>
</span> </div>
        <div class="event-detail">
          <h4><a href="<?php 
    echo base_url('event') . "/" . $row->id_event . "/" . $replace->CleanUrl($row->title);
    ?>
"><?php 
    echo $row->title;
    ?>
</a></h4>
          <span class="event-dayntime meta-data"><?php 
    echo $row->jam;
    ?>