public function application_version_list_json() { if ($this->isAjax) { if ($no_auth = $this->checkAuth()) { return $no_auth; } } $response = array('data' => array(), 'recordsTotal' => 0, 'recordsFiltered' => 0, 'action' => 'manageList', 'info' => array()); $id = FALSE; $version = !empty($this->postData['version']) ? $this->postData['version'] : FALSE; if (!empty($this->data['id'])) { $id = $this->data['id']; } if (!empty($this->postData['id'])) { $id = $this->postData['id']; $response['action'] = 'createOptionForm'; } try { $apps_list = new \AppsManager(); $app = $apps_list->getAppInfo($id); } catch (\Exception $e) { $response['error'] = $error = $this->setLocalization('Failed to get the list of versions of this applications') . '. ' . $e->getMessage(); $app = FALSE; } if ($app !== FALSE) { $response["data"] = array_values(array_filter(array_map(function ($row) use($version) { if ($version === FALSE || $version == $row['version']) { $row['published'] = (int) strtotime($row['published']); $row['published'] = $row['published'] < 0 ? 0 : $row['published']; return $row; } }, $app['versions']))); $response['recordsTotal'] = count($response["data"]); $response['recordsFiltered'] = count($response["data"]); unset($app['versions']); $response['info'] = $app; } $response["draw"] = !empty($this->data['draw']) ? $this->data['draw'] : 1; $error = ""; if ($this->isAjax) { $response = $this->generateAjaxResponse($response); return new Response(json_encode($response), empty($error) ? 200 : 500); } else { return $response; } }
<?php include "./common.php"; if (empty($_GET['name']) || empty($_GET['mac'])) { exit; } $alias = str_replace('external_', '', $_GET['name']); $app = Mysql::getInstance()->from('apps')->where(array('alias' => $alias))->get()->first(); if (empty($app) || $app['status'] == 0) { exit; } $apps = new AppsManager(); $app = $apps->getAppInfo($app['id']); if (!$app['installed']) { exit; } header('Content-Type: application/x-javascript'); $user_theme = Mysql::getInstance()->from('users')->where(array('mac' => $_GET['mac']))->get()->first('theme'); $user_theme = empty($user_theme) || !array_key_exists($user_theme, Middleware::getThemes()) ? Mysql::getInstance()->from('settings')->get()->first('default_template') : $user_theme; $icon = $app['app_url'] . '/img/{0}/' . $app['icons'] . '/' . ($user_theme == 'default' ? '2010' : '2014') . '.png'; ?> /** * Redirection to <?php echo $app['name']; ?> module. */ (function(){ main_menu.add('<?php echo $app['name'];