Advertisement
Guest User

Untitled

a guest
Apr 6th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.76 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP7 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 4.0.8.5
  8. * @ Author : DeZender
  9. * @ Release on : 25.03.2019
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. namespace Module\Aldoc\Admin\Controller\Catalog;
  15.  
  16. class LicenseCategory extends \Module\Core\Controller
  17. {
  18. private $curl;
  19. public $json = [];
  20. private $new_car_info = '';
  21. private $sync_file;
  22.  
  23. public function __construct($registry, $module)
  24. {
  25. parent::__construct($registry, $module);
  26. $this->variables += $this->getAldocSettings();
  27. $this->module_load->model('aldoc', 'common/License', 'catalog');
  28. $this->sync_file = DIR_MODULE . $this->module . DS . 'Log' . DS . $this->sync_data_file;
  29. }
  30.  
  31. public function getPage()
  32. {
  33. $data = [];
  34. $this->jade->loadTemplate('Catalog/Category');
  35. $this->load_language('Catalog/LicenseCategory');
  36. $breadcrumbs = [
  37. ['breadcrumb_text' => $this->data['text_home'], 'breadcrumb_href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)],
  38. ['breadcrumb_text' => $this->data['text_easymenu'] . ' >> ' . $this->data['heading_title'], 'breadcrumb_href' => $this->url->link('easyhosting/easyhosting/aldoc_categories', 'user_token=' . $this->session->data['user_token'], true)]
  39. ];
  40. $this->data['breadcrumbs'] = $this->jade->renderSubTemplateRecursive('aldoc_category/breadcrumbs', $breadcrumbs);
  41. $json['user_token'] = $this->session->data['user_token'];
  42. $this->data['aldoc_js'] = '<script type="text/javascript"><!--' . "\n" . $this->load_javascript('aldoc') . "\n" . 'var js_vars = ' . json_encode($json) . "\n" . '//--></script>';
  43. $data['easy_content'] = $this->jade->renderTemplate('aldoc_category', $this->data);
  44. $this->renderTwig($data);
  45. }
  46.  
  47. private function renderTwig($data)
  48. {
  49. $data['header'] = $this->load->controller('common/header');
  50. $data['column_left'] = $this->load->controller('common/column_left');
  51. $data['footer'] = $this->load->controller('common/footer');
  52. $this->response->setOutput($this->load->view('easyhosting/skeleton', $data));
  53. }
  54.  
  55. public function deleteAldocBase()
  56. {
  57. $this->model_aldoc_common_License->truncateTable('category_aldoc');
  58. $this->model_aldoc_common_License->truncateTable('save_aldoc_data');
  59. $this->clear_sync_data();
  60. $this->json['result'] = '(php response) Aldoc categorie-data gereset.' . "\n";
  61. $this->json['finished'] = 'finished';
  62. $this->response->setOutput(json_encode($this->json));
  63. }
  64.  
  65. public function getAldocMenu()
  66. {
  67. ob_start();
  68. set_error_handler([$this, 'import_exception_error_handler']);
  69.  
  70. if ($this->debug_xml) {
  71. $this->module_log = new \Module\Library\ModuleLog(DIR_MODULE . $this->module . DS . 'Log' . DS . $this->aldoc_log);
  72. }
  73.  
  74. $this->curl_connect();
  75. $start_time = time();
  76. $start_microtime = microtime(true);
  77. $time_out = ini_get('max_execution_time');
  78. if (is_null($time_out) || !$time_out || ($time_out == 0)) {
  79. $time_out = $this->time_out;
  80. }
  81.  
  82. $this->json['finished'] = '';
  83. $this->json['error'] = '';
  84. $this->json['result'] = '';
  85. $sync_data = $this->get_sync_data();
  86.  
  87. if (!$sync_data) {
  88. $sync_data['data_name'] = 'truncate_aldoc_tables';
  89. $sync_data['limit'] = 0;
  90. $sync_data['start_time'] = $start_time;
  91. $this->set_sync_data($sync_data);
  92. }
  93.  
  94. $max_exec_secs = (int) $time_out - (int) $this->break_time;
  95.  
  96. if (15 < $max_exec_secs) {
  97. $max_exec_secs = 15;
  98. }
  99.  
  100. $restart = false;
  101.  
  102. while (!$this->json['error'] && ((time() - $start_time) < $max_exec_secs) && !$restart) {
  103. switch ($sync_data['data_name']) {
  104. case 'truncate_aldoc_tables':
  105. $this->truncate_aldoc_tables();
  106. $this->cache->delete('category');
  107. $this->cache->delete('product');
  108. $sync_data['data_name'] = 'get_menu_data';
  109. $this->set_sync_data($sync_data);
  110. $this->json['result'] .= 'Aldoc tabellen en cache geleegd' . "\n";
  111. break;
  112. case 'get_menu_data':
  113. $this->getMenuData();
  114. $sync_data['limit'] = 0;
  115. $sync_data['menu_data'] = json_encode($this->data['menu_data']);
  116. $sync_data['data_name'] = 'organize_menu';
  117. $this->set_sync_data($sync_data);
  118. $this->json['result'] .= 'Menu opgehaald bij Aldoc' . "\n";
  119. break;
  120. case 'organize_menu':
  121. if (!isset($this->data['menu_data']) || !$this->data['menu_data']) {
  122. $this->data['menu_data'] = json_decode($sync_data['menu_data'], true);
  123. }
  124.  
  125. if ($this->data['menu_data']) {
  126. if (isset($this->data['menu_data']) && is_array($this->data['menu_data']['Menuitem'])) {
  127. $menu_data = [];
  128. $menu_code = 0;
  129.  
  130. foreach ($this->data['menu_data']['Menuitem'] as $index => $menu_item) {
  131. if (((int) $menu_item['state'] == 1) || ((int) $menu_item['state'] == 2)) {
  132. $menu_code = $menu_item['menucode'];
  133. }
  134.  
  135. if ($menu_item) {
  136. $menu_item['menu'] = ucfirst(strtolower($menu_item['menu']));
  137. $menu_data[$menu_code][] = $menu_item;
  138. }
  139. }
  140.  
  141. $this->data['menu_data'] = [];
  142. $tmp_menu_data = [];
  143.  
  144. foreach ($menu_data as $index => $values) {
  145. $menuitems = $values;
  146. usort($menuitems, [$this, 'cmp_menu']);
  147. $tmp_submenu = [];
  148. $tmp_submenu[0] = 'foo';
  149.  
  150. foreach ($menuitems as $sub_index => $menu_item) {
  151. if (((int) $menu_item['state'] == 1) || ((int) $menu_item['state'] == 2)) {
  152. $tmp_submenu[0] = $menu_item;
  153. }
  154. else {
  155. $tmp_submenu[] = $menu_item;
  156. }
  157. }
  158.  
  159. $tmp_menu_data[$index] = $tmp_submenu;
  160. }
  161.  
  162. foreach ($tmp_menu_data as $menuitems) {
  163. foreach ($menuitems as $menu_item) {
  164. $this->data['menu_data'][] = $menu_item;
  165. ................................................
  166. ..............................
  167. ............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement