예제 #1
0
 function alterTables()
 {
     $this->loadAdapter();
     $CI = new CI(-1);
     $CIA = $CI->newAttributes();
     switch ($this->A("PatchType")) {
         case "mysql":
             $v = explode("\n", $this->A("PatchValue"));
             foreach ($v as $key => $value) {
                 $CIA->MySQL = $value;
                 $this->Adapter->alterTable($CIA);
             }
             break;
     }
 }
예제 #2
0
파일: cron.php 프로젝트: Gninety/Microweber
 function index()
 {
     header("Content-type: text/plain");
     $segs = $this->uri->segment_array();
     $cron_group = false;
     $force = false;
     $action = false;
     foreach ($segs as $segment) {
         if (stristr($segment, 'g:') == true) {
             $cron_group = substr($segment, 2, strlen($segment));
             ///	exit($cron_group);
         }
         if (stristr($segment, 'force:true') == true) {
             $force = true;
         }
         if (stristr($segment, 'a:') == true) {
             $action = substr($segment, 2, strlen($segment));
         }
     }
     $job = CI::model('core')->cronjobGetOne($cron_group, $force, $action);
     if (!empty($job)) {
         print "\n\n" . 'Begin - ' . date("Y-m-d H:i:s") . ' - ' . $job['cronjob_name'] . "\n";
         $to_exc = '$this->' . $job['model_name'] . '->' . $job['function_to_execute'];
         //print $to_exc;
         eval($to_exc . ';');
         print "\n" . 'End - ' . date("Y-m-d H:i:s") . ' - ' . $job['cronjob_name'] . "\n\n";
     } else {
         print "\n" . 'No jobs - ' . date("Y-m-d H:i:s") . "\n\n";
     }
     //var_dump($job);
     //print 'cron-' . date("Y-m-d H:i:s");
 }
예제 #3
0
 public function index($slug)
 {
     $product = \CI::Products()->slug($slug);
     if (!$product) {
         throw_404();
     } else {
         $product->images = json_decode($product->images, true);
         if ($product->images) {
             $product->images = array_values($product->images);
         } else {
             $product->images = [];
         }
         //set product options
         $data['options'] = \CI::ProductOptions()->getProductOptions($product->id);
         $data['posted_options'] = \CI::session()->flashdata('option_values');
         //get related items
         $data['related'] = $product->related_products;
         //create view variable
         $data['page_title'] = $product->name;
         $data['meta'] = $product->meta;
         $data['seo_title'] = !empty($product->seo_title) ? $product->seo_title : $product->name;
         $data['product'] = $product;
         //load the view
         $this->view('product', $data);
     }
 }
예제 #4
0
 public function logout()
 {
     \CI::auth()->logout();
     //when someone logs out, automatically redirect them to the login page.
     \CI::session()->set_flashdata('message', lang('message_logged_out'));
     redirect('admin/login');
 }
예제 #5
0
 function getTerm($code)
 {
     CI::db()->select('term');
     $result = CI::db()->get_where('search', array('code' => $code));
     $result = $result->row();
     return $result->term;
 }
예제 #6
0
 function delete()
 {
     $id = $_POST['to_table_id'];
     if (intval($id) == 0) {
         exit('id?');
     } else {
         global $cms_db_tables;
         $id = intval($_POST['to_table_id']);
         $real_table = $cms_db_tables[$_POST['to_table']];
         $q = "delete from {$real_table} where id={$id}  ";
         $q = CI::model('core')->dbQ($q);
         $table = $cms_db_tables['table_reports'];
         $q = "delete from {$table} where to_table='{$_POST['to_table']}' and to_table_id='{$_POST['to_table_id']}'  ";
         $q = CI::model('core')->dbQ($q);
         CI::model('core')->cleanCacheGroup('reports');
         switch ($_POST['to_table']) {
             case 'table_content':
                 CI::model('core')->cleanCacheGroup('content');
                 break;
             case 'table_comments':
                 CI::model('core')->cleanCacheGroup('comments');
                 break;
             default:
                 CI::model('core')->cacheDeleteAll();
                 break;
         }
         //CI::model('comments')->commentsDeleteById ( $id );
     }
 }
예제 #7
0
 public function generate()
 {
     $type = CI::uri()->segment(1);
     $slug = CI::uri()->segment(2);
     if (!$type || !$slug) {
         return;
         //return blank
     }
     if ($type == 'category') {
         $category = CI::Categories()->slug($slug);
         if (!$category) {
             return;
         }
         $this->trace_categories($category->id);
     } elseif ($type == 'product') {
         $product = CI::Products()->slug($slug);
         if (!$product) {
             return;
         }
         array_unshift($this->breadcrumbs, ['link' => site_url('product/' . $product->slug), 'name' => $product->name]);
         $this->trace_categories($product->primary_category);
     } elseif ($type == 'page') {
         $page = CI::Pages()->slug($slug);
         if (!$page) {
             return;
         }
         $this->trace_pages($page->id);
     }
     echo GoCart\Libraries\View::getInstance()->get('breadcrumbs', ['breadcrumbs' => $this->breadcrumbs]);
 }
예제 #8
0
파일: Product.php 프로젝트: lekhang/gonline
 public function generator($eng, $alt)
 {
     $cos_phi = 0.8;
     $engine = \CI::Products()->getProduct($eng);
     $engine->manufacturer = \CI::Products()->getManufacturers($engine->manufacturers);
     $alternator = \CI::Products()->getProduct($alt);
     $alternator->manufacturer = \CI::Products()->getManufacturers($alternator->manufacturers);
     $engine_parameters = \CI::Products()->getParameters($engine->id, 'engines');
     $engine_alternator = \CI::Products()->getParameters($alternator->id, 'alternators');
     //echo '<pre>';print_r($alternator);exit;
     $data['page_title'] = $engine->name;
     $data['meta'] = $engine->meta;
     $data['seo_title'] = !empty($engine->seo_title) ? $engine->seo_title : $engine->name;
     $data['product'] = $engine;
     $data['engine_parameters'] = $engine_parameters;
     $data['alt'] = $alternator;
     $data['engine_alternator'] = $engine_alternator;
     $generators = array();
     $generators['kVA'] = $generators['kVA_standby'] = $engine_parameters->standby / $cos_phi * ($engine_alternator->efficiency * 0.01);
     $generators['kVA_prime'] = $engine_parameters->prime / $cos_phi * ($engine_alternator->efficiency * 0.01);
     $generators['price'] = $engine->price_1 + $alternator->price_1;
     if ($engine_alternator->power < $generators['kVA']) {
         $generators['kVA'] = $engine_alternator->power;
     }
     if ($engine->days > $alternator->days) {
         $generators['days'] = $engine->days;
     } else {
         $generators['days'] = $alternator->days;
     }
     $generators['name'] = 'G50-' . round($generators['kVA']) . $engine->manufacturer->code . $alternator->manufacturer->code . 'BA';
     //echo '<pre>';print_r($generators);exit;
     $data['generators'] = $generators;
     $this->view('generator', $data);
 }
예제 #9
0
 public function index($slug, $sort = 'id', $dir = "ASC", $page = 0)
 {
     \CI::lang()->load('categories');
     //define the URL for pagination
     $pagination_base_url = site_url('category/' . $slug . '/' . $sort . '/' . $dir);
     //how many products do we want to display per page?
     //this is configurable from the admin settings page.
     $per_page = config_item('products_per_page');
     //grab the categories
     $categories = \CI::Categories()->get($slug, $sort, $dir, $page, $per_page);
     //no category? show 404
     if (!$categories) {
         throw_404();
     }
     //load up the pagination library
     \CI::load()->library('pagination');
     $config['base_url'] = $pagination_base_url;
     $config['uri_segment'] = 5;
     $config['per_page'] = $per_page;
     $config['num_links'] = 3;
     $config['total_rows'] = $categories['total_products'];
     \CI::pagination()->initialize($config);
     //load the view
     $this->view('categories/category', $categories);
 }
예제 #10
0
 /**
  *
  */
 function __construct()
 {
     date_default_timezone_set('Asia/Calcutta');
     $ci = CI::get_instance();
     $ci->load->Model('Email_settings/Mdl_email_settings');
     //load email settings model
     $smtp = $ci->Mdl_email_settings->toArray();
     //get object valeus in array
     $config = array();
     $config['protocol'] = 'smtp';
     $config['mailpath'] = '/usr/sbin/sendmail';
     $config['smtp_host'] = $smtp['smtp_host'];
     $config['smtp_pass'] = $smtp['smtp_pass'];
     // email's password    - set smtp values
     $config['smtp_user'] = $smtp['smtp_user'];
     $config['smtp_port'] = $smtp['smtp_port'];
     //gmail port 465 (ssl) and 587 (TSL) required
     $config['smtp_timeout'] = 10;
     //smtp timeout in seconds
     $config['wordwrap'] = TRUE;
     $config['wrapchars'] = 76;
     $config['mailtype'] = 'html';
     $config['charset'] = 'utf-8';
     $config['validate'] = TRUE;
     $config['priority'] = 3;
     $config['crif'] = "\r\n";
     $config['newline'] = "\r\n";
     $config['bcc_batch_mode'] = TRUE;
     $config['bcc_batch_size'] = 200;
     parent::__construct($config);
 }
예제 #11
0
 function get_visits_by_url($url, $start_time = false)
 {
     global $cms_db_tables;
     $idsite = $this->site_id();
     $table = $cms_db_tables['table_log_action'];
     $cache_group = 'global/stats';
     $q = "SELECT * FROM {$table} WHERE name = '{$url}' ";
     $q = CI::model('core')->dbQuery($q, __FUNCTION__ . md5($q), $cache_group, '- 5 minutes');
     if (!empty($q)) {
         $q = $q[0];
         $idaction = $q['idaction'];
         $table2 = $cms_db_tables['table_log_link_visit_action'];
         if ($start_time == false) {
             $start_time = strtotime("4 weeks ago");
             $start_time = date("Y-m-d H:i:s", $start_time);
         } else {
             $start_time = strtotime($start_time);
             $start_time = date("Y-m-d H:i:s", $start_time);
         }
         $q = " SELECT    idaction_name as id,  \n              COUNT(idlink_va) as views,  \n              COUNT(DISTINCT idvisitor) as visits,  \n              COUNT(IF(idaction_url_ref=0, 1, null)) as entry,  \n              log_action.name as page  \n              FROM {$table2}, {$table}  \n              WHERE {$table2}.idsite={$idsite}  \n              \n              and idaction_url = {$idaction} \n              \n              AND {$table2}.idaction_name = {$table}.idaction  \n              AND server_time >='{$start_time}'\n              \n              ";
         $q = " SELECT    idaction_name as id,  \n              COUNT(idlink_va) as views \n              \n              FROM {$table2}  \n              WHERE \n              \n              idaction_url = {$idaction} \n              \n            \n              AND server_time >='{$start_time}'\n              \n              ";
         $q = CI::model('core')->dbQuery($q, __FUNCTION__ . md5($q), $cache_group, '- 5 minutes');
         return intval($q[0]["views"]);
     } else {
         return 0;
     }
 }
예제 #12
0
 function load()
 {
     $plugin_name = $this->uri->segment(4);
     $this->template['functionName'] = strtolower(__FUNCTION__);
     $this->template['pluginName'] = $plugin_name;
     $this->load->vars($this->template);
     $layout = CI::view('admin/layout', true, true);
     $primarycontent = '';
     $secondarycontent = '';
     $plugindata = CI::model('core')->plugins_getPluginConfig($plugin_name);
     //
     //print  PLUGINS_DIRNAME . $dirname .$plugin_name.'/'.$plugindata['plugin_admin_dir']. '/controller.php' ;
     if (is_file(PLUGINS_DIRNAME . $dirname . $plugin_name . '/' . $plugindata['plugin_admin_dir'] . '/controller.php') == true) {
         $firecms = get_instance();
         define('THIS_PLUGIN_URL', site_url('admin/plugins/load') . '/' . $plugin_name . '/');
         define('THIS_PLUGIN_DIRNAME', PLUGINS_DIRNAME . $dirname . $plugin_name . '/');
         define('THIS_PLUGIN_DIRNAME_ADMIN', PLUGINS_DIRNAME . $dirname . $plugin_name . '/' . $plugindata['plugin_admin_dir'] . '/');
         require_once PLUGINS_DIRNAME . $dirname . $plugin_name . '/' . $plugindata['plugin_admin_dir'] . '/controller.php';
     }
     //$primarycontent = CI::view ( 'admin/comments/index', true, true );
     //$secondarycontent = CI::view ( 'admin/content/sidebar', true, true );
     $layout = str_ireplace('{primarycontent}', $primarycontent, $layout);
     $layout = str_ireplace('{secondarycontent}', $secondarycontent, $layout);
     //CI::view('welcome_message');
     CI::library('output')->set_output($layout);
 }
예제 #13
0
 function edit()
 {
     $this->template['functionName'] = strtolower(__FUNCTION__);
     $this->load->vars($this->template);
     if ($_POST) {
         $save = $this->cacaomail_model->saveMailAccounts($_POST);
         redirect('mailaccounts');
     }
     $segs = $this->uri->segment_array();
     $the_id = false;
     foreach ($segs as $segment) {
         if (stristr($segment, 'id:') == true) {
             $the_id = $segment;
             $the_id = substr($the_id, 3, strlen($the_id));
         }
     }
     if (intval($the_id) != 0) {
         $form_values = $this->cacaomail_model->getMailAccounts(array('id' => $the_id), 1);
         $form_values = $form_values[0];
         $this->template['form_values'] = $form_values;
     } else {
         //$this->template ['form_values'] = false;
     }
     $this->template['form_values']['account_groups'] = $this->cacaomail_model->getMailAccountsGroups();
     $this->load->vars($this->template);
     $layout = CI::view('layout', true, true);
     $primarycontent = '';
     $secondarycontent = '';
     $primarycontent = CI::view('mailaccounts/edit', true, true);
     $secondarycontent = CI::view('mailaccounts/sidebar', true, true);
     $layout = str_ireplace('{primarycontent}', $primarycontent, $layout);
     $layout = str_ireplace('{secondarycontent}', $secondarycontent, $layout);
     //CI::view('welcome_message');
     CI::library('output')->set_output($layout);
 }
예제 #14
0
function lap_dat()
{
    \CI::load()->model(['Materials']);
    $tmp = \CI::Materials()->getMaterials();
    echo '<pre>';
    print_r($tmp);
    exit;
}
예제 #15
0
파일: core.php 프로젝트: Gninety/Microweber
 function mediaDelete()
 {
     $id = $_POST['id'];
     if (intval($id) != 0) {
         CI::model('core')->mediaDelete($id);
     }
     exit;
 }
예제 #16
0
 public function shortcode($slug = false, $perPage = false)
 {
     if (!$perPage) {
         $perPage = config_item('products_per_page');
     }
     $products = \CI::Categories()->get($slug, 'id', 'ASC', 0, $perPage);
     return $this->partial('categories/products', $products);
 }
예제 #17
0
 public function rates()
 {
     $settings = \CI::Settings()->get_settings('FlatRate');
     if ($settings['enabled'] && $settings['enabled'] > 0) {
         return ['Flat Rate' => $settings['rate']];
     } else {
         return [];
     }
 }
예제 #18
0
 function getVideos($criteria = false)
 {
     $table = TABLE_PREFIX . 'masterdebate_videos';
     $q = " SELECT * FROM {$table} order by id DESC ";
     //print $q ;
     $query = CI::db()->query($q);
     $query = $query->result_array();
     return $query;
 }
예제 #19
0
 function delete()
 {
     $id = $_POST['id'];
     if (intval($id) == 0) {
         exit('id');
     } else {
         CI::model('comments')->commentsDeleteById($id);
     }
 }
예제 #20
0
파일: FlatRate.php 프로젝트: vandona/v3
 public function rates()
 {
     $settings = \CI::Settings()->get_settings('FlatRate');
     if (isset($settings['enabled']) && (bool) $settings['enabled']) {
         return ['фирма Спиди' => $settings['rate']];
     } else {
         return [];
     }
 }
예제 #21
0
 public function delete($direction = false, $id = false)
 {
     if ($id) {
         \CI::db()->delete($this->_db_table[$direction], array('id' => $id));
     } else {
         //if they do not provide an id send them to the product list page with an error
         \CI::session()->set_flashdata('error', lang('error_not_found'));
     }
     redirect('admin/materials/' . $direction);
 }
예제 #22
0
파일: me.php 프로젝트: Gninety/Microweber
 function useremail_check($username)
 {
     $check = CI::model('users')->doUserExist('email', $username);
     if ($check == true) {
         $this->validation->set_message('useremail_check', "The email {$username} is already assigned to another user! Please choose new one!");
         return FALSE;
     } else {
         return TRUE;
     }
 }
예제 #23
0
파일: Tax.php 프로젝트: haouach/GoCart3
 public function getAreaTaxRate()
 {
     $rate = CI::db()->where(array('code' => $this->address['zip'], 'zone_id' => $this->address['zone_id']))->get('country_zone_areas')->row();
     if ($rate) {
         $rate = $rate->tax / 100;
     } else {
         $rate = 0;
     }
     return $rate;
 }
예제 #24
0
 function ajax_delete_by_id()
 {
     $id = $_POST['id'];
     if (intval($id) == 0) {
         exit(0);
     } else {
         CI::model('core')->optionsDeleteById($id);
         exit(1);
     }
 }
예제 #25
0
 public function completeSitemap()
 {
     $xml = $this->partial('sitemap_xml_foot', [], true);
     echo $xml;
     $file = fopen('sitemap.xml', 'a');
     fwrite($file, $xml);
     fclose($file);
     \CI::session()->set_flashdata('message', lang('success_sitemap_generate') . ' File location ' . site_url('sitemap.xml'));
     redirect('admin/sitemap');
 }
예제 #26
0
파일: Page.php 프로젝트: vandona/v3
 public function api($slug)
 {
     \CI::load()->language('page');
     $page = $this->Page_model->slug($slug);
     if (!$page) {
         $json = json_encode(['error' => lang('error_page_not_found')]);
     } else {
         $json = json_encode($page);
     }
     $this->view('json', ['json' => json_encode($json)]);
 }
예제 #27
0
파일: Search.php 프로젝트: buzkall/GoCart3
 public function index($code = false, $page = 0)
 {
     $pagination_base_url = site_url('search/' . $code);
     //how many products do we want to display per page?
     //this is configurable from the admin settings page.
     $per_page = config_item('products_per_page');
     \CI::load()->model('Search');
     //check to see if we have a search term
     if (!$code) {
         //if the term is in post, save it to the db and give me a reference
         $term = \CI::input()->post('term', true);
         if (empty($term)) {
             //if there is still no search term throw an error
             $data['error'] = lang('search_error');
             $this->view('search_error', $data);
             return;
         } else {
             $code = \CI::Search()->recordTerm($term);
             // no code? redirect so we can have the code in place for the sorting.
             // I know this isn't the best way...
             redirect('search/' . $code . '/' . $page);
         }
     } else {
         //if we have the md5 string, get the term
         $term = \CI::Search()->getTerm($code);
     }
     //fix for the category view page.
     $data['base_url'] = [];
     $sortArray = array('name/asc' => array('by' => 'name', 'sort' => 'ASC'), 'name/desc' => array('by' => 'name', 'sort' => 'DESC'), 'price/asc' => array('by' => 'price', 'sort' => 'ASC'), 'price/desc' => array('by' => 'price', 'sort' => 'DESC'));
     $sortBy = array('by' => false, 'sort' => false);
     if (isset($_GET['by'])) {
         if (isset($sortArray[$_GET['by']])) {
             $sortBy = $sortArray[$_GET['by']];
         }
     }
     if (empty($term)) {
         //if there is still no search term throw an error
         $this->view('search_error', $data);
         return;
     } else {
         $result = \CI::Products()->search_products($term, $per_page, $page, $sortBy['by'], $sortBy['sort']);
         $config['total_rows'] = $result['count'];
         \CI::load()->library('pagination');
         $config['base_url'] = $pagination_base_url;
         $config['uri_segment'] = 3;
         $config['per_page'] = $per_page;
         $config['num_links'] = 3;
         $config['total_rows'] = $result['count'];
         \CI::pagination()->initialize($config);
         $data['products'] = $result['products'];
         $data['category'] = (object) ['name' => str_replace('{term}', $term, lang('search_title'))];
         $this->view('categories/category', $data);
     }
 }
예제 #28
0
파일: Base.php 프로젝트: JamieLomas/pyrocms
	public function __construct() {

		/* assign the application instance */
		self::$APP = $this;

		/* re-assign language and config for modules */
		if ( ! is_a($this->lang, 'MX_Lang')) $this->lang = new MX_Lang;
		if ( ! is_a($this->config, 'MX_Config')) $this->config = new MX_Config;

		parent::__construct();
	}
예제 #29
0
 public function index()
 {
     \CI::auth()->check_access('Admin', true);
     \CI::lang()->load('settings');
     \CI::load()->helper('inflector');
     global $shippingModules;
     $data['shipping_modules'] = $shippingModules;
     $data['enabled_modules'] = \CI::Settings()->get_settings('shipping_modules');
     $data['page_title'] = lang('common_shipping_modules');
     $this->view('shipping_index', $data);
 }
예제 #30
0
 function google_Analytics_getKeywordsForProfile($profile_id, $start_date = false, $end_date = false)
 {
     $email = CI::model('content')->optionsGetByKey('google_analytics_login');
     $pass = CI::model('content')->optionsGetByKey('google_analytics_pass');
     require_once "Zend/Loader.php";
     Zend_Loader::loadClass('Zend_Gdata');
     Zend_Loader::loadClass('Zend_Gdata_Query');
     Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
     $client = Zend_Gdata_ClientLogin::getHttpClient($email, $pass, "analytics");
     $gdClient = new Zend_Gdata($client);
     if ($start_date == false) {
         $start_date = date("Y-m-d", mktime(0, 0, 0, date("m") - 1, date("d"), date("Y")));
     }
     if ($end_date == false) {
         $end_date = date("Y-m-d", mktime(0, 0, 0, date("m") - 0, date("d"), date("Y")));
     }
     try {
         $dimensions = array("ga:region", "ga:city", "ga:latitude", "ga:longitude");
         $metrics = array("ga:visits", "ga:pageviews");
         $dimensions = array("ga:keyword");
         $metrics = array("ga:pageviews");
         //dimensions=ga:country&metrics=ga:visitors
         $reportURL = "https://www.google.com/analytics/feeds/data?ids={$profile_id}&" . "dimensions=" . @implode(",", $dimensions) . "&" . "metrics=" . @implode(",", $metrics) . "&max-results=50" . '&sort=ga:pageviews' . "&" . "start-date={$start_date}&" . "end-date={$end_date}";
         //	var_dump($reportURL);
         $results = $gdClient->getFeed($reportURL);
         $titleRow = 1;
         // To output a row of column labels
         foreach ($results as $rep) {
             if ($titleRow) {
                 foreach ($rep->extensionElements as $elem) {
                     $titles[] = $elem->extensionAttributes["name"]["value"];
                 }
                 //	echo implode ( ",", $titles ) . "\n";
                 //echo  "<hr>";
                 $titleRow = 0;
             }
             foreach ($rep->extensionElements as $elem) {
                 //var_dump($elem);
                 $the_item = $elem->extensionAttributes["value"]["value"];
                 var_dump($the_item);
                 if (strlen($the_item) > 5) {
                     print '<pre>';
                     $row[] = $the_item;
                     print '</pre>';
                 }
             }
             //echo implode ( ",", $row ) . "\n";
             //echo  "<br>";
         }
     } catch (Zend_Exception $e) {
         echo "Caught exception: " . get_class($e) . "\n";
         echo "Message: " . $e->getMessage() . "\n";
     }
 }