function import()
 {
     if ($this->session->userdata('is_login') == TRUE) {
         $user_type = $this->session->userdata('type');
         if ($user_type == 2) {
             $upDir = base_dir() . 'supplier_files/' . $this->session->userdata['id'];
             if (!file_exists($upDir) || is_file($upDir)) {
                 mkdir($upDir);
             }
             $config['upload_path'] = $upDir;
             $config['allowed_types'] = 'csv';
             $config['max_size'] = '1000';
             $this->load->library('upload', $config);
             if (!$this->upload->do_upload()) {
                 $error = array('error' => $this->upload->display_errors());
                 print_r($error);
             } else {
                 // It's uploaded, so open it, loop through it and do what you need to do
                 $data = array('upload_data' => $this->upload->data());
                 $file_path = $data['upload_data']['full_path'];
                 $this->doImport($file_path);
                 $this->processedfiles->add($file_path);
             }
         }
     }
 }
 public function output()
 {
     $schema = (new SchemaBuilder($this->table->schema))->output();
     $output = file_get_contents(base_dir() . '/templates/migration.tpl');
     $output = str_replace('{{name}}', $this->table->name, $output);
     $output = str_replace('{{migration}}', $this->migration_name, $output);
     $output = str_replace('{{schema}}', $schema, $output);
     return $output;
 }
Example #3
0
 static function tpl($tpl_name, array $vars = array())
 {
     $tpl_dir = self::get_config('tpl_dir', dirname(dirname(__FILE__)) . '/tpl');
     $tpl_filename = rtrim($tpl_dir, '/\\') . '/' . ltrim($tpl_name, '/\\') . '.php';
     extract($vars);
     //        $_errors = error_reporting(0);
     //        error_reporting($_errors & ~E_NOTICE);
     $_BASE_DIR = base_dir();
     require $tpl_filename;
     //        error_reporting($_errors);
 }
Example #4
0
 /**
  * @param \Symfony\Component\Console\Input\InputInterface   $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $dump = new Loader($input->getArgument('sqldump'));
     $parser = new Parser();
     $tables = $parser->get_tables($dump->data());
     foreach ($tables as $table) {
         $migration = new MigrationBuilder($table);
         file_put_contents(base_dir() . '/output/' . $migration->migration_name . '.php', $migration->output());
     }
     $output->writeln('<info>Done!</info>');
 }
 public function index($type = 'all')
 {
     $filesDir = base_dir() . 'buyers_files';
     if (!file_exists($filesDir) || !is_dir($filesDir)) {
         mkdir($filesDir, 0777, true);
     }
     switch ($type) {
         case 'custom':
             //custom
             $listings = $this->buyers->listing(1);
             foreach ($listings as $buyer) {
                 $u_id = $buyer->u_id;
                 $uiddir = $filesDir . DIRECTORY_SEPARATOR . $u_id;
                 if (!file_exists($uiddir) || !is_dir($uiddir)) {
                     mkdir($uiddir, 0777, true);
                 }
                 $datafeed = $this->datafeeds->custom_prodlist($u_id);
                 $this->export($datafeed, 'custom', $uiddir);
             }
             break;
         case 'supplier':
             //supplier
             $supplier_list = $this->suppliers->listing(1);
             foreach ($supplier_list as $supplier) {
                 $s_id = $supplier->u_id;
                 $supplier_info = $this->users->info($s_id);
                 $datafeed = $this->datafeeds->prodlist('supplier', $s_id);
                 $companyName = strtolower(preg_replace('/[\\s]+/i', '_', $supplier_info->u_company));
                 $extract = preg_replace('/[\\_]{2,}/i', '_', $companyName);
                 $this->export($datafeed, $extract, $filesDir);
             }
             break;
         case 'dropshipping':
             //dropshipping
             $datafeed = $this->datafeeds->prodlist('dropshipping');
             $this->export($datafeed, 'dropshipping', $filesDir);
             break;
         case 'all':
         default:
             //all
             $datafeed = $this->datafeeds->prodlist();
             $this->export($datafeed, 'all', $filesDir);
             break;
     }
     echo '';
     return;
 }
 public function parsesupplierscsv()
 {
     $filesDir = base_dir() . 'suppliers_files';
     if (!file_exists($filesDir) || !is_dir($filesDir)) {
         echo 'dir not found';
         exit;
     }
     $dir = opendir($filesDir);
     while (false !== ($file = readdir($dir))) {
         if ($file == '.' || $file == '..' || !preg_match('/^\\d+$/', $file)) {
             continue;
         }
         $this->session->userdata['id'] = $file;
         $this->import($filesDir, 'txt');
         $this->import($filesDir, 'csv');
     }
     echo '';
     return;
 }
Example #7
0
 function resolveHelper($name)
 {
     // try local
     $location = $this->path . "/helper/" . $name;
     // try common
     if (!is_file($location)) {
         $location = base_dir() . "base/helper/" . $name;
     }
     if (is_file($location)) {
         // return template if its found
         return $location;
     } else {
         return null;
     }
 }
 function delete_image($ii_id)
 {
     $this->db->select('*');
     $this->db->where('inventory_image.ii_id', $ii_id);
     $result = $this->db->get('inventory_image');
     $result = $result->row(1);
     if (!empty($result->ii_link)) {
         $path = base_dir() . $result->ii_link;
         if (file_exists($path)) {
             @unlink($path);
         }
     }
     $this->db->where('ii_id', $ii_id);
     $this->db->delete('inventory_image');
     return 1;
 }
 function delete_product_attachment()
 {
     $file_name = $this->input->post('fname');
     @unlink(base_dir() . "product_image/{$file_name}");
 }
Example #10
0
function controller_basedir()
{
    return realpath(base_dir() . '/controllers/');
}
 function get_random_products($sup_id = "")
 {
     $this->load->model('inventories');
     $this->db->select('*');
     $this->db->from('inventory_child');
     $this->db->join('inventory', 'inventory.i_id = inventory_child.i_id', 'left');
     $this->db->join('inventory_image', 'inventory_image.i_id = inventory.i_id', 'left');
     $this->db->join('manufacturer', 'manufacturer.m_id = inventory.m_id', 'left');
     $this->db->join('brand', 'brand.b_id = inventory.b_id', 'left');
     $this->load->model('countries');
     $default_country = $this->countries->default_country();
     $this->db->join('translation', 'translation.i_id = inventory.i_id AND translation.c_id = ' . $default_country, 'left');
     // 1 English
     if (isset($sup_id) and $sup_id != "") {
         $this->db->where('inventory_child.u_id', $sup_id);
     }
     $this->db->order_by('RAND()');
     $this->db->group_by('inventory_child.i_id');
     $this->db->limit(4);
     $result = $this->db->get();
     //echo $this->db->last_query();exit;
     $rows = $result->result();
     foreach ($rows as $key => $row) {
         $images = $this->inventories->list_image($row->i_id);
         foreach ($images as $image) {
             $row->ii_name = '';
             $row->ii_link = '';
             $row->ii_feat = '';
             $row->ii_time = '';
             if (file_exists(base_dir() . $image->ii_link)) {
                 $row->ii_name = $images[0]->ii_name;
                 $row->ii_link = $images[0]->ii_link;
                 $row->ii_feat = $images[0]->ii_feat;
                 $row->ii_time = $images[0]->ii_time;
                 $rows[$key] = $row;
                 break;
             }
         }
     }
     return $rows;
 }
        $("#upload123").uploadify({
            uploader: '<?php 
echo base_url();
?>
js/uploadify/uploadify.swf',
            script: '<?php 
echo base_url();
?>
js/uploadify/uploadify.php',
            cancelImg: '<?php 
echo base_url();
?>
js/uploadify/cancel.png',
            folder: '<?php 
echo base_dir();
?>
product_image/<?php 
echo $this->inventories->get_image_upload_group_id($product->i_id) . '/' . $product->i_id;
?>
/',
            scriptAccess: 'always',
            multi: true,
            auto: true,
            width: 110,
            'onError': function (a, b, c, d) {
                if (d.status == 404)
                    alert('Could not find upload script.');
                else if (d.type === "HTTP")
                    alert('error ' + d.type + ": " + d.status);
                else if (d.type === "File Size")
 public function doDelete($file, $type = 'csv', $cron = false)
 {
     gc_enable();
     $separator = $type == 'csv' ? ';' : "\t";
     @set_time_limit(0);
     @ini_set('max_execution_time', 0);
     $this->load->library('form_validation');
     $row = 0;
     $total = 0;
     $deleted = 0;
     $user_type = $this->session->userdata('type');
     $errors = array();
     $this->load->model('inventories');
     if (($handle = fopen($file, "r")) !== FALSE) {
         while (($data = fgetcsv($handle, 1024, $separator)) !== FALSE) {
             $total++;
             if ($user_type == 2) {
                 $is = $this->db->get_where('inventory_child', array('SKU' => $data[0], 'u_id' => $this->session->userdata('id')))->result();
                 if (!$is) {
                     $errors[] = '<b>' . $data[0] . '</b> - inventory does not exist';
                     continue;
                 }
                 if ($is['u_id'] == $this->session->userdata('id')) {
                 }
                 $res = $this->db->delete('inventory_child', array('SKU' => $data[0], 'u_id' => $this->session->userdata('id')));
                 if ($res) {
                     $deleted++;
                 }
             } else {
                 $is = $this->db->get_where('inventory', array('manuf_num' => $data[0]))->result();
                 if (!$is || empty($is)) {
                     $errors[] = '<b>' . $data[0] . '</b> - inventory does not exist';
                     continue;
                 }
                 foreach ($is as $inv) {
                     $this->db->where('i_id', $inv->i_id);
                     $this->db->where('ii_src_url', NULL);
                     $results = $this->db->get('inventory_image')->result();
                     foreach ($results as $result) {
                         $path = base_dir() . 'product_image/' . $this->inventories->get_image_upload_group_id($result->i_id) . '/' . $result->i_id . '/' . $result->ii_name;
                         if (file_exists($path)) {
                             @unlink($path);
                         }
                     }
                     $tables = array('inventory', 'inventory_image', 'inventory_child');
                     $this->db->where('i_id', $inv->i_id);
                     $res = $this->db->delete($tables);
                     $deleted++;
                 }
             }
         }
         fclose($handle);
         return array('imported' => $row, 'updated' => 0, 'inserted' => 0, 'deleted' => $deleted, 'total' => $total, 'verr' => implode('<br>', $errors));
     }
     return false;
 }
Example #14
0
function myheading($q, $title, $displaymenu = true)
{
    // Generate the correct prefix for URLs in menu.
    $BASE_URL = base_url();
    $BASE_DIR = base_dir();
    $myDirPath = $BASE_DIR . '/menus/';
    $myWwwPath = $BASE_URL . '/menus/';
    // these files should probably not be here
    require_once $myDirPath . 'lib/PHPLIB.php';
    require_once $myDirPath . 'lib/layersmenu-common.inc.php';
    require_once $myDirPath . 'lib/layersmenu.inc.php';
    require_once $BASE_DIR . '/menudefs.php';
    eval("\$ADMIN_MENU = \"{$ADMIN_MENU}\";");
    // create the html page HEAD section
    insert($q, $header = wheader("IPPlan - {$title}"));
    insert($q, $w = container("div", array("class" => "matte")));
    insert($header, generic("meta", array("http-equiv" => "Content-Type", "content" => "text/html; charset=UTF-8")));
    if ($displaymenu) {
        insert($header, generic("link", array("rel" => "stylesheet", "href" => "{$myWwwPath}" . "layersmenu-gtk2.css")));
        //    insert($header, generic("link",array("rel"=>"stylesheet","href"=>"$myWwwPath"."layersmenu-demo.css")));
    }
    // Konqueror and Safari browsers do not support overflow: auto css tag so use custom stylesheet
    if (stristr($_SERVER["HTTP_USER_AGENT"], "konqueror") or stristr($_SERVER["HTTP_USER_AGENT"], "safari")) {
        insert($header, generic("link", array("rel" => "stylesheet", "href" => "{$BASE_URL}" . "/themes/default-safari.css")));
    } else {
        // Added theme support.
        $themecookie = isset($_COOKIE["ipplanTheme"]) ? $_COOKIE["ipplanTheme"] : "";
        global $config_themes;
        // obtained from config.php file which is global
        if (!empty($themecookie) and $config_themes[$themecookie] != "") {
            insert($header, generic("link", array("rel" => "stylesheet", "href" => "{$BASE_URL}" . "/themes/{$config_themes[$themecookie]}")));
        } else {
            insert($header, generic("link", array("rel" => "stylesheet", "href" => "{$BASE_URL}" . "/themes/default.css")));
        }
    }
    if ($displaymenu) {
        insert($w, script("", array("language" => "JavaScript", "type" => "text/javascript", "src" => $myWwwPath . "libjs/layersmenu-browser_detection.js")));
        insert($w, script("", array("language" => "JavaScript", "type" => "text/javascript", "src" => $myWwwPath . 'libjs/layersmenu-library.js')));
        insert($w, script("", array("language" => "JavaScript", "type" => "text/javascript", "src" => $myWwwPath . 'libjs/layersmenu.js')));
        $mid = new LayersMenu(6, 7, 2, 1);
        $mid->setDirroot($BASE_DIR . '/menus/');
        $mid->setLibjsdir($BASE_DIR . '/menus/libjs/');
        $mid->setImgdir($BASE_DIR . '/menus/menuimages/');
        $mid->setImgwww($BASE_URL . '/menus/menuimages/');
        $mid->setIcondir($BASE_DIR . '/menus/menuicons/');
        $mid->setIconwww($BASE_URL . '/menus/menuicons/');
        $mid->setTpldir($BASE_DIR . '/menus/templates/');
        $mid->SetMenuStructureString($ADMIN_MENU);
        $mid->setIconsize(16, 16);
        $mid->parseStructureForMenu('hormenu1');
        $mid->newHorizontalMenu('hormenu1');
    }
    // draw header box
    insert($w, $con = container("div", array("class" => "headerbox", "align" => "center")));
    insert($con, heading(1, my_("IPPlan - IP Address Management and Tracking")));
    insert($con, block("<br>"));
    insert($con, heading(3, $title));
    if ($displaymenu) {
        // draw menu box here
        insert($w, $con = container("div", array("class" => "menubox")));
        insert($con, $t = table(array("cols" => "2", "width" => "100%")));
        insert($t, $c1 = cell());
        insert($t, $c2 = cell(array("align" => "right")));
        insert($c1, block($mid->getHeader()));
        insert($c1, block($mid->getMenu('hormenu1')));
        insert($c1, block($mid->getFooter()));
        // find a place to display logged in user
        insert($c2, $uc = container("div", array("class" => "userbox")));
        if (getAuthUsername() != "") {
            insert($uc, block(sprintf(my_("Logged in as %s"), getAuthUsername())));
        }
    }
    insert($w, $con = container("div", array("class" => "normalbox")));
    insert($w, $con1 = container("div", array("class" => "footerbox")));
    insert($con1, block("IPPlan v4.92b"));
    return $con;
}
Example #15
0
 * Date:        $Date: 2011-10-24 11:54:02 +0200 $
 * -----------------------------------------------------------------------
 * @author      $Author: Edd, Exinaus, Shw  $
 * @copyright   2011-2012 Edd - Aleksandr Ustinov
 * @link        http://wot-news.com
 * @package     Clan Stat
 * @version     $Rev: 2.2.0 $
 *
 */
error_reporting(E_ALL & ~E_STRICT);
ini_set("display_errors", 1);
if (file_exists(dirname(__FILE__) . '/func_admin.php')) {
    define('LOCAL_DIR', dirname(__FILE__));
    include_once LOCAL_DIR . '/func_admin.php';
    include_once LOCAL_DIR . '/translate/tabs.php';
    define('ROOT_DIR', base_dir('admin'));
    //Cheker
    include_once ROOT_DIR . '/including/check.php';
    //Multiget CURL
    include_once ROOT_DIR . '/function/curl.php';
    include_once ROOT_DIR . '/function/mcurl.php';
    include_once ROOT_DIR . '/function/auth.php';
    include_once ROOT_DIR . '/function/cache.php';
    include_once ROOT_DIR . '/function/mysql.php';
    include_once ROOT_DIR . '/function/func.php';
    include_once ROOT_DIR . '/function/func_get.php';
    include_once ROOT_DIR . '/function/func_main.php';
    include_once ROOT_DIR . '/function/config.php';
    include_once ROOT_DIR . '/config/config_' . $config['server'] . '.php';
    foreach (scandir(LOCAL_DIR . '/translate/') as $files) {
        if (preg_match("/_" . $config['lang'] . ".php/", $files)) {
 function add()
 {
     if ($this->session->userdata('is_login') == TRUE) {
         $user_type = $this->session->userdata('type');
         //get user type;
         $uid = $this->session->userdata('id');
         if ($this->input->post('action') != "") {
             $action = $this->input->post('action');
             if ($action == 'add') {
                 $upc_ean = $this->input->post('upc_ean');
                 $manu_num = $this->input->post('manu_num');
                 $manu = $this->input->post('manu');
                 $brand = $this->input->post('brand');
                 $weight = $this->input->post('weight');
                 $weight_scale = $this->input->post('weight_scale');
                 //$item_price = $this->input->post('item_price');
                 $ship_alone = $this->input->post('ship_alone');
                 $height = $this->input->post('height');
                 $width = $this->input->post('width');
                 $depth = $this->input->post('depth');
                 $d_scale = $this->input->post('d_scale');
                 $category = $this->input->post('category');
                 $case_pack = $this->input->post('case_pack');
                 $min_order = $this->input->post('min_order');
                 $this->load->library('form_validation');
                 if ($user_type == 2) {
                     $sku = $this->input->post('sku');
                     $quan = $this->input->post('quan');
                     $price = $this->input->post('price');
                     $ret_price = $this->input->post('ret_price');
                     $ret_price = trim($ret_price) == '' || $ret_price == 0 ? $price * 3 : $ret_price;
                     $lead_time = $this->input->post('lead_time');
                     $map = $this->input->post('map');
                     $ship_cost = $this->input->post('ship_cost') == '' ? null : $this->input->post('ship_cost');
                     $ship_from = $this->input->post('ship_from');
                     $prom_text = $this->input->post('prom_text');
                     $this->form_validation->set_rules('sku', 'SKU', 'trim|required|xss_clean');
                     $this->form_validation->set_rules('quan', 'Quantity', 'trim|required|xss_clean');
                     $this->form_validation->set_rules('price', 'Price', 'trim|required|xss_clean');
                     $this->form_validation->set_rules('ret_price', 'Retailed Price', 'trim|required|xss_clean');
                     $this->form_validation->set_rules('lead_time', 'Lead Time', 'trim|required|xss_clean');
                     $this->form_validation->set_rules('map', 'MAP', 'trim|xss_clean');
                 }
                 $this->form_validation->set_rules('upc_ean', 'UPC/EAN', 'trim|required|min_length[5]|numeric|xss_clean');
                 $this->form_validation->set_rules('manu_num', 'Manufacturer Part Number', 'trim|required|min_length[3]|xss_clean');
                 $this->form_validation->set_rules('manu', 'Manufacture', 'trim|required|xss_clean');
                 $this->form_validation->set_rules('brand', 'Brand', 'trim|required|xss_clean');
                 $this->form_validation->set_rules('weight', 'Weight', 'trim|required|xss_clean|numeric');
                 $this->form_validation->set_rules('weight_scale', 'Weight Scale', 'trim|required|xss_clean');
                 $this->form_validation->set_message('min_length', 'The %s must be at least %s characters long');
                 //$this->form_validation->set_rules('item_price','Item Price','trim|required|xss_clean|numeric');
                 $this->form_validation->set_rules('ship_alone', 'Ship Alone', 'trim|required|xss_clean');
                 //$this->form_validation->set_rules('height','Height','trim|required|xss_clean');
                 //$this->form_validation->set_rules('width','Width','trim|required|xss_clean');
                 //$this->form_validation->set_rules('depth','Depth','trim|required|xss_clean');
                 if ($this->form_validation->run() == FALSE) {
                     //If has invalid input
                     $returnmessage = array('message' => validation_errors(), 'status' => 0);
                     echo json_encode($returnmessage);
                 } else {
                     $array_insert = array("u_id" => $uid, "upc_ean" => $upc_ean, "manuf_num" => $manu_num, "m_id" => $manu, "b_id" => $brand, "c_id" => $category, "weight" => $weight, "weightScale" => $weight_scale, "qty" => 0, "ship_alone" => $ship_alone, "d_height" => $height, "d_width" => $width, "d_dept" => $depth, "d_scale" => $d_scale, "i_time" => apputils::ConvertUnStampToMysqlDateTime(time()));
                     @ini_set('display_errors', 'On');
                     $i_id = $this->inventories->add($array_insert);
                     $images = $this->input->post('images');
                     foreach ($images as $image) {
                         mkdir(base_dir() . 'product_image/' . $i_id);
                         copy(base_dir() . 'product_image/' . $image['filename'], base_dir() . 'product_image/' . $i_id . '/' . $image['filename']);
                         $image_id = $this->inventories->add_image(array("i_id" => $i_id, "ii_name" => $image['filename'], "ii_link" => 'product_image/' . $i_id . '/' . $image['filename'], "ii_feat" => $image['featured'], "ii_time" => apputils::ConvertUnStampToMysqlDateTime(time())));
                     }
                     $lang_title = $this->input->post('lang_title');
                     $short_desc = $this->input->post('short_desc');
                     $long_decs = $this->input->post('long_decs');
                     $lang = $this->input->post('lang');
                     $data_add_language = array('i_id' => $i_id, 'c_id' => $lang, 'tr_title' => $lang_title, 'tr_short_desc' => $short_desc, 'tr_desc' => $long_decs, 'tr_time' => date("Y-m-d h:i:s", time()));
                     $this->inventories->add_product_translation($data_add_language);
                     if ($user_type == 2) {
                         $add_array = array('i_id' => $i_id, 'u_id' => $uid, 'SKU' => $sku, 'ic_quan' => $quan, 'ic_price' => $price, 'ic_retail_price' => $ret_price, 'ic_leadtime' => $lead_time, 'ic_map' => $map, 'ic_ship_cost' => $ship_cost, 'ic_ship_country' => $ship_from, 'ic_prom_text' => $prom_text, 'ic_min_order' => $min_order, 'ic_case_pack' => $case_pack, 'ic_time' => apputils::ConvertUnStampToMysqlDateTime(time()));
                         $stock_id = $this->inventories->add_stock($add_array);
                     }
                     if ($user_type == 2) {
                         $returnmessage = array('message' => base_url() . 'inventory/detail/' . $i_id . "/" . $stock_id . "", 'status' => 1);
                     } elseif ($user_type == 1) {
                         $returnmessage = array('message' => base_url() . 'inventory/detail/' . $i_id . "", 'status' => 1);
                     }
                     echo json_encode($returnmessage);
                 }
             } elseif ($action == 'stock') {
                 $sku = $this->input->post('sku');
                 $quan = $this->input->post('quan');
                 $price = $this->input->post('price');
                 $ret_price = $this->input->post('ret_price');
                 $lead_time = $this->input->post('lead_time');
                 $i_id = $this->input->post('inv_id');
                 $map = $this->input->post('map');
                 $ship_cost = $this->input->post('ship_cost') == '' ? null : $this->input->post('ship_cost');
                 $ship_from = $this->input->post('ship_from');
                 $prom_text = $this->input->post('prom_text');
                 $this->load->library('form_validation');
                 $this->form_validation->set_rules('sku', 'SKU', 'trim|required|min_length[4]|xss_clean');
                 $this->form_validation->set_rules('quan', 'Quantity', 'trim|required|numeric|xss_clean|greater_than[-1]');
                 $this->form_validation->set_rules('price', 'Price', 'trim|required|numeric|xss_clean|greater_than[0]');
                 $this->form_validation->set_rules('ret_price', 'Retailed Price', 'trim|required|numeric|xss_clean|greater_than[0]');
                 if ($map != "") {
                     $this->form_validation->set_rules('map', 'MAP', 'trim|numeric|xss_clean');
                 }
                 $this->form_validation->set_rules('ship_cost', 'Ship Cost', 'trim|numeric|xss_clean');
                 $this->form_validation->set_rules('ship_from', 'Ship Country', 'trim|required|xss_clean');
                 $this->form_validation->set_rules('prom_text', 'Promo Text', 'trim|xss_clean');
                 $this->form_validation->set_rules('inv_id', 'Inventory ID', 'trim|required|xss_clean');
                 if ($this->form_validation->run() == FALSE) {
                     $returnmessage = array('message' => validation_errors(), 'status' => 0);
                     echo json_encode($returnmessage);
                 } else {
                     $add_array = array('i_id' => $i_id, 'u_id' => $uid, 'SKU' => $sku, 'ic_quan' => $quan, 'ic_price' => $price, 'ic_retail_price' => $ret_price, 'ic_leadtime' => $lead_time, 'ic_map' => $map, 'ic_ship_cost' => $ship_cost, 'ic_ship_country' => $ship_from, 'ic_prom_text' => $prom_text, 'ic_time' => apputils::ConvertUnStampToMysqlDateTime(time()));
                     $ic_id = $this->inventories->add_stock($add_array);
                     $url_ext = $i_id . '/' . $ic_id;
                     $returnmessage = array('message' => "Stock is Added Succesfully", 'status' => 1, 'url_ext' => $url_ext);
                     echo json_encode($returnmessage);
                 }
             }
         } else {
             if ($user_type == 1) {
                 $level = 0;
                 $data['list_manufac'] = $this->manufacturers->listing();
                 $data['scale_dimension'] = $this->categories->scale_dimension_listing();
                 $data['list_scale'] = $this->inventories->listing_scale();
                 $data['categories'] = $this->categories->listings($level);
                 $data['countries'] = $this->countries->listing_country();
                 $data['default_country'] = $this->countries->default_country();
                 $this->load->view('admin/inventory/add-inventory', $data);
             } elseif ($user_type == 2) {
                 $view_form = $this->uri->segment(3);
                 if ($view_form == "stock") {
                     $i_id = $this->uri->segment(4);
                     $this->addStockInventory($i_id);
                     //redirect to another function for stock inventory page
                 } else {
                     $this->addSupplierInventory();
                 }
                 //Add Product for Supplier
             }
         }
     } else {
         redirect('', 'refresh');
     }
 }
 function file($datafeed, $separator, $filename, $user_id = '')
 {
     $temp_file = base_dir() . 'buyers_files' . DIRECTORY_SEPARATOR . $user_id . $filename;
     if (!file_exists($temp_file)) {
         $this->load->helper('download');
         $output = "";
         $row = array('SKU', 'Barcode', 'Manufacturer Part Number', 'Manufacturer Name', 'Brand', 'Title', 'Description', 'Category ID', 'Category Name', 'Weight', 'Ship Alone', 'Height', 'Width', 'Depth', 'Lead Time', 'Quantity In Stock', 'Selling Price', 'MSRP', 'Promo text', 'MAP', 'Shipping cost', 'Image 1', 'Image 2', 'Image 3', 'Image 4', 'Image 5', 'Image 6', 'Case Pack', 'Min Order');
         $output = $output . str_putcsv($row, $separator);
         foreach ($datafeed as $feed) {
             $feed->ic_retail_price = trim($feed->ic_retail_price) == '' || $feed->ic_retail_price == 0 ? $feed->ic_price * 3 : $feed->ic_retail_price;
             $row = array($feed->SKU, $feed->upc_ean, $feed->manuf_num, $feed->m_name, $feed->b_name, $feed->tr_title, str_replace(array("\n", "\r\n", "\t"), " ", strip_tags($feed->tr_desc)), $feed->c_id, $this->getFullCategoryName($feed->c_id), $feed->weight + " " + $feed->weightScale, $feed->ship_alone, $feed->d_height + " " + $feed->d_scale, $feed->d_width + " " + $feed->d_scale, $feed->d_dept + " " + $feed->d_scale, $feed->ic_leadtime, $feed->ic_quan, $feed->ic_price, $feed->ic_retail_price, str_replace(array("\n", "\r\n", "\t"), " ", $feed->ic_prom_text), $feed->ic_map, $feed->ic_ship_cost);
             $this->load->model('inventories');
             $image_list = $this->inventories->list_image($feed->i_id);
             $images = array('', '', '', '', '', '');
             for ($i = 0; $i < count($image_list); $i++) {
                 if ($i >= count($images)) {
                     break;
                 }
                 $images[$i] = base_url() . $image_list[$i]->ii_link;
             }
             $row = array_merge($row, $images, array($feed->ic_case_pack, $feed->ic_min_order));
             $output = $output . "\r\n" . str_putcsv($row, $separator);
         }
         force_download($filename, $output);
     } else {
         set_time_limit(0);
         ini_set('memory_limit', '512M');
         my_force_download($temp_file);
     }
 }
Example #18
0
<?php

// Copyright (C) 2010-2011 Aron Racho <*****@*****.**>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
// for security
$fake_register_globals = false;
$sanitize_all_escapes = true;
require "../../globals.php";
require_once "ui.php";
require_once "common.php";
// recursively require all .php files in the base library folder
foreach (glob(base_dir() . "base/library/*.php") as $filename) {
    require_once $filename;
}
// recursively require all .php files in the application library folder
foreach (glob(library_dir() . "/*.php") as $filename) {
    require_once $filename;
}
Example #19
0
 * Began:       2011
 * Date:        $Date: 2011-10-24 11:54:02 +0200 $
 * -----------------------------------------------------------------------
 * @author      $Author: Edd, Exinaus, Shw  $
 * @copyright   2011-2012 Edd - Aleksandr Ustinov
 * @link        http://wot-news.com
 * @package     Clan Stat
 * @version     $Rev: 2.2.0 $
 *
 */
error_reporting(E_ALL & ~E_STRICT);
ini_set("display_errors", 1);
if (file_exists(dirname(__FILE__) . '/func_ajax.php')) {
    define('LOCAL_DIR', dirname(__FILE__));
    include_once LOCAL_DIR . '/func_ajax.php';
    define('ROOT_DIR', base_dir('ajax'));
} else {
    define('LOCAL_DIR', '.');
    include_once LOCAL_DIR . '/func_ajax.php';
    define('ROOT_DIR', '..');
}
include_once ROOT_DIR . '/including/check.php';
include_once ROOT_DIR . '/function/auth.php';
include_once ROOT_DIR . '/function/mysql.php';
$db->change_prefix($_POST['db_pref']);
include_once ROOT_DIR . '/function/func.php';
include_once ROOT_DIR . '/function/func_main.php';
include_once ROOT_DIR . '/function/config.php';
include_once ROOT_DIR . '/config/config_' . $config['server'] . '.php';
foreach (scandir(ROOT_DIR . '/translate/') as $files) {
    if (preg_match("/_" . $config['lang'] . ".php/", $files)) {
 function activate()
 {
     $id_activate = $this->uri->segment(3);
     if ($this->users->validate_regisCode($id_activate)) {
         $user_id = $this->session->userdata('id');
         if ($user_id) {
             @mkdir(base_dir() . 'suppliers_files' . DIRECTORY_SEPARATOR . $user_id, 0777);
         }
         redirect('supplier', 'refresh');
     } else {
         echo 'Invalid registration Code, or the Code is Already used';
     }
 }
	<div class='prod-list-cont fl'>
		<div class='img-feat-prod-list-cont'>
			<a href="<?php 
        echo base_url();
        ?>
inventory/detail/<?php 
        echo $inv->i_id;
        ?>
">
				<?php 
        //				$image_list = $this->inventories->list_image($inv->i_id,1,true);
        $image_list = $this->inventories->list_image($inv->i_id);
        //limit 1, select only the featured image
        $img = null;
        foreach ($image_list as $image) {
            if (file_exists(base_dir() . $image->ii_link)) {
                $img = $image;
                break;
            }
        }
        //echo 'test'.$_SERVER['DOCUMENT_ROOT'].'/'.str_replace('http://'.$_SERVER['HTTP_HOST'].'/', '', base_url().$img->ii_link).'<div class=\'clear\'></div>';
        if ($img == null) {
            ?>
					<img width=100% src="<?php 
            echo base_url();
            ?>
images/default-preview.jpg">

				<?php 
        } else {
            ?>