protected function template($filename) { global $_W; $name = strtolower($this->modulename); $defineDir = dirname($this->__define); if (defined('IN_SYS')) { return parent::template($filename); } else { $source = THEME_DIR . "{$_W['account']['template']}/{$filename}.html"; $compile = THEME_COMPILE_DIR . "{$name}/{$_W['account']['template']}/{$filename}.tpl.php"; if (!is_file($source)) { $source = DEFAULT_THEME_DIR . "{$filename}.html"; } if (!is_file($source)) { if (in_array($filename, array('header', 'footer', 'slide', 'toolbar', 'message'))) { $source = IA_ROOT . "/app/themes/default/common/{$filename}.html"; } else { $source = IA_ROOT . "/app/themes/default/{$filename}.html"; } } } if (!is_file($source)) { exit("Error: template source {$source} - filename '{$filename}' - name {$name} is not exist!"); } if (DEVELOPMENT || !is_file($compile) || filemtime($source) > filemtime($compile)) { template_compile($source, $compile, true); } return $compile; }
$apps_sql = \Lobby\DB::getDBH()->prepare("SELECT COUNT(1) FROM `apps` WHERE `id` = ?"); $apps_sql->execute(array($app_info['id'])); $queue_sql = \Lobby\DB::getDBH()->prepare("SELECT COUNT(1) FROM `apps_queue` WHERE `id` = ?"); $queue_sql->execute(array($app_info['id'])); if ($app_edit != true && ($queue_sql->fetchColumn() != 0 || $apps_sql->fetchColumn() != 0)) { ser("App Exists", "Hmmm... Looks like the App ID you submitted already exists either on App Center Or in the App Queue. " . \Lobby::l("/apps/{$app_info['id']}", "See Existing App")); } else { if ($app_edit != true && preg_match("/\\b(?:(?:https?|ftp):\\/\\/|www\\.)[-a-z0-9+&@#\\/%?=~_|!:,.;]*[-a-z0-9+&@#\\/%=~_|]/i", $app_info['git_url']) == 0) { ser("Invalid URL", "The app's source code URL you provided was invalid."); } else { if ($app_edit != true) { $sql = \Lobby\DB::getDBH()->prepare("INSERT INTO `apps_queue` (`id`, `name`, `src`, `description`, `category`, `sub_category`, `app_page`, `author`, `updated`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW());"); $sql->execute(array($app_info['id'], $app_info['name'], $app_info['git_url'], $app_info['description'], $app_info['category'], $app_info['sub_category'], $app_info['app_page'], \Fr\LS2::$user)); $admin_access_token = \Fr\LS2::getUser("username", 1); require_once $this->dir . "/src/inc/open.auth.php"; $Opth = new OpenAuth("EAtGbLfgxiCJxhwWfsLsyxA0p8Zj4oUyOd4POaVc", "80d23edfa535caf4cc44b91e16c55c0f09e3bed927fecff96b092df0f517f410"); $Opth->action("email", array("subject" => "Lobby App Review", "body" => "Dude, a person requested to review her/his app ({$app_info['id']}). Please go and check it. http://lobby.subinsb.com"), $admin_access_token); sss("App Submitted", "Your app was added to the review queue. You will be notified by email about your app's review status."); } else { $sql = \Lobby\DB::getDBH()->prepare("UPDATE `apps` SET `name` = ?, `logo` = ?, `description` = ?, `category` = ?, `sub_category` = ?, `app_page` = ?, `lobby_web` = ?, `updated` = NOW() WHERE `id` = ? AND `author` = ?"); $sql->execute(array($app_info['name'], $app_info['logo'], $app_info['description'], $app_info['category'], $app_info['sub_category'], $app_info['app_page'], $app_info['lobby_web'], $app_info['id'], \Fr\LS2::$user)); sss("Updated", "Your app was successfully updated."); } } } } if ($app_edit) { \Response::setTitle("Edit App " . $app_info['name'] . " | Me"); } else { \Response::setTitle("New App | Me"); }