function platform_get_by_id($id) { $result = sql_do('SELECT id_pf,name_pf,valid_pf FROM platforms WHERE id_pf=\'' . int($id) . '\''); if ($result->numRows() != 1) { return 0; } $row = $result->fetchRow(); $pf = new Platform(); $pf->set_id_pf($row[0]); $pf->set_name_pf($row[1]); $pf->set_valid_pf($row[2]); return $pf; }
public function actionView($productId) { $categories = array(); $categories = Platform::getPlatformList(); $product = Products::getProductById($productId); $productId = $product['id']; $platform = Platform::getPlatformById($product['platform_id']); $comments = Comment::getCommentsByProductId($productId); //COMMENTS if (isset($_POST['submit'])) { $userComment = $_POST['message']; $errors = false; if (!Comment::validateMessage($userComment)) { $errors[] = "Введите собщение"; } if (User::isGuest()) { $userName = $_POST['name']; $userEmail = $_POST['email']; if (!User::validateUsername($userName)) { $errors[] = "Неверное имя"; } if (!User::validateEmail($userEmail)) { $errors[] = "Неверный Email"; } $userId = false; } else { $userId = User::validateLogged(); $user = User::getUserById($userId); $userName = $user['name']; } Comment::addComment($userComment, $userId, $userName, $productId); } require_once ROOT . '/views/product/view.php'; return true; }
public static function install($data, &$fail, &$errno, &$error) { $res = array(); if (!$fail) { // die /platform Befehle auslösen $list = Einstellungen::getLinks('postPlatform'); $platform = Installation::PlattformZusammenstellen($data); $multiRequestHandle = new Request_MultiRequest(); for ($i = 0; $i < count($list); $i++) { // inits all components $handler = Request_CreateRequest::createPost($list[$i]->getAddress() . '/platform', array(), Platform::encodePlatform($platform)); $multiRequestHandle->addRequest($handler); } $answer = $multiRequestHandle->run(); for ($i = 0; $i < count($list); $i++) { $url = $list[$i]->getTargetName(); $result = $answer[$i]; $res[$url] = array(); if (isset($result['content']) && isset($result['status']) && $result['status'] === 201) { $res[$url]['status'] = 201; } else { $res[$url]['status'] = 409; $fail = true; if (isset($result['status'])) { $errno = $result['status']; $res[$url]['status'] = $result['status']; } } } } return $res; }
public function actionUpdate($id) { self::validateAdmin(); $platformList = Platform::getPlatformListByAdmin(); $genreList = Genre::getGenresListByAdmin(); $product = Products::getProductById($id); if (isset($_POST['submit'])) { $option['code'] = $_POST['code']; $option['name'] = $_POST['name']; $option['price'] = $_POST['price']; $option['platform_id'] = $_POST['platform_id']; $option['genre_id'] = $_POST['genre_id']; $option['brand'] = $_POST['brand']; $option['description'] = $_POST['description']; $option['availability'] = $_POST['availability']; $option['is_recomend'] = $_POST['is_recomend']; $option['is_new'] = $_POST['is_new']; $option['status'] = $_POST['status']; $errors = false; if (!isset($option['name']) || empty($option['name'])) { $errors[] = "Введите имя товара"; } if ($errors == false) { Products::updateProduct($id, $option); if ($id) { if (is_uploaded_file($_FILES['image']['tmp_name'])) { move_uploaded_file($_FILES['image']['tmp_name'], $_SERVER["DOCUMENT_ROOT"] . "/upload/images/products/(" . $id . ").png"); } } } header("Location: /evkazolinAdminka/product/"); } require_once ROOT . '/views/admin_product/update.php'; return true; }
public function getView($slug) { $game = $this->getModelFromSlug($slug); $products = $game->products()->orderBy('created_at', 'DESC')->get(); $platforms = Platform::all(); $conditions = Condition::all(); return View::make('site/game/view_game', compact('game', 'products', 'platforms', 'conditions')); }
public function actionIndex() { $platforms = array(); $platforms = Platform::getPlatformList(); $genres = array(); $genres = Genre::getGenreList(); $productList = array(); $productList = Products::getProducts(6); require_once ROOT . '/views/site/index.php'; return true; }
/** * Parses tildes and environment variables in paths. * * @param string $path * @return string */ public static function expandPath($path) { if (preg_match('#^~[\\/]#', $path)) { return self::getUserDirectory() . substr($path, 1); } return preg_replace_callback('#^(\\$|(?P<percent>%))(?P<var>\\w++)(?(percent)%)(?P<path>.*)#', function ($matches) { // Treat HOME as an alias for USERPROFILE on Windows for legacy reasons if (Platform::isWindows() && $matches['var'] == 'HOME') { return (getenv('HOME') ?: getenv('USERPROFILE')) . $matches['path']; } return getenv($matches['var']) . $matches['path']; }, $path); }
public function actionGenre($genreId, $page = 1) { $platforms = array(); $platforms = Platform::getPlatformList(); $genres = array(); $genres = Genre::getGenreList(); $products = array(); $products = Products::getProductsListByGenre($genreId, $page); $total = Products::getTotalProductInGenre($genreId); $pagination = new Pagination($total, $page, Products::SHOW_BY_DEFAULT, 'page-'); require_once ROOT . '/views/catalog/category.php'; return true; }
function WxJsPayInterface($openid, $dataArr = array()) { $jsApi = new JsApi_pub(); while (!$openid) { $code = $this->_get('code'); $keycode = $this->_get('state'); if (!$code) { //触发登录weixin $authurl = Platform::MakeWpAuthURL(null, array('redirect_uri' => "http://" . HTTPHOST . $_SERVER['REQUEST_URI'], 'state' => $keycode)); redirect($authurl); } //获取微信唯一标识unionID $wxinfoArr = D("WxAccessToken")->getUserInfo(Platform::$MPID10, $code); $openid = isset($wxinfoArr['openid']) ? $wxinfoArr['openid'] : null; } //=========步骤2:使用统一支付接口,获取prepay_id============ //使用统一支付接口 $unifiedOrder = new UnifiedOrder_pub(); $unifiedOrder->setParameter("openid", "{$openid}"); //openid $unifiedOrder->setParameter("body", $dataArr['title']); //商品描述 //$timeStamp = time(); //$out_trade_no = WxPayConf_pub :: APPID . "$timeStamp"; $unifiedOrder->setParameter("out_trade_no", $dataArr['out_trade_no']); //商户订单号 $unifiedOrder->setParameter("total_fee", $dataArr['money'] * 100); //总金额 $notify_url = isset($dataArr['notify_url']) ? $dataArr['notify_url'] : WxPayConf_pub::NOTIFY_URL; $unifiedOrder->setParameter("notify_url", $notify_url); //通知地址 $unifiedOrder->setParameter("trade_type", "JSAPI"); //交易类型 //非必填参数,商户可根据实际情况选填 //$unifiedOrder->setParameter("sub_mch_id","XXXX");//子商户号 //$unifiedOrder->setParameter("device_info","XXXX");//设备号 //$unifiedOrder->setParameter("attach","XXXX");//附加数据 //$unifiedOrder->setParameter("time_start","XXXX");//交易起始时间 //$unifiedOrder->setParameter("time_expire","XXXX");//交易结束时间 //$unifiedOrder->setParameter("goods_tag","XXXX");//商品标记 //$unifiedOrder->setParameter("openid","XXXX");//用户标识 //$unifiedOrder->setParameter("product_id","XXXX");//商品ID $prepay_id = $unifiedOrder->getPrepayId(); //=========步骤3:使用jsapi调起支付============ $jsApi->setPrepayId($prepay_id); //var_dump($unifiedOrder->parameters);die(); $jsApiParameters = $jsApi->getParameters(); return $jsApiParameters; }
/** * @test */ public function getPlatforms() { $orgs = \Organization::all([], ['_id']); $results = []; foreach ($orgs as $o) { $platforms = \Platform::rssFeeds($o); $count = count($platforms); if ($count === 0) { continue; } $results = array_merge($results, $platforms); } $this->assertNotEquals(0, count($results)); return $results; }
public static function rssFeeds($org) { $users = \User::all(['org_id' => $org->_id, 'type' => 'advertiser'], ['_id']); $in = []; $result = []; foreach ($users as $u) { $in[] = $u->_id; } $platforms = \Platform::all(['user_id' => ['$in' => $in]], ['_id', 'url', 'user_id', 'meta']); foreach ($platforms as $p) { if (isset($p->meta['rss'])) { $result[Utils::getMongoID($p->_id)] = $p; } } return $result; }
public static function template_new_ggi_mail($param, $is_resend = false) { $param = json_decode(json_encode($param), FALSE); $user_name = str_replace('@gameloft.com', '', $_SERVER['REMOTE_USER']); $user_name = str_replace('.', ' ', ucfirst($user_name)); $to[] = $_SERVER['REMOTE_USER']; if (ENVIRONMENT == GOLD || ENVIRONMENT == STAGING) { $cc[] = MAIL_WOA; $bcc[] = '*****@*****.**'; } $platform = Platform::load($param->platform_id)->to_array(); $operator = Operator::load($param->operator_id)->to_array(); $country = Country::load($param->country_id)->to_array(); $product = Product::load($param->product_id)->to_array(); $store = Appstores::load($param->store_id)->to_array(); $template_params = array(); $template_params['user_name'] = $user_name; $template_params['platform_name'] = $platform['name']; $template_params['operator_name'] = $operator['name']; $template_params['country_name'] = $country['name']; $template_params['product_name'] = $product['name']; $template_params['product_id'] = $param->product_id; $template_params['ggi'] = $param->ggi; $template_params['store_name'] = $store['name']; $template_params['deployment_silo'] = $param->deployment_silo; $tpl = (object) $template_params; //Get email template ob_start(); $subject = 'TUNA - Request of new project (GGI): ' . $param->ggi; include_once 'mail_templates/new_project.php'; $body = ob_get_contents(); ob_end_clean(); //Send the email $m = new Mail('text/html'); $m->to(@implode(',', $to)); $m->cc(@implode(',', $cc)); $m->bcc(@implode(',', $bcc)); $m->subject($subject); $m->body($body); $m->send(); TunaLog::info_log(__CLASS__, __FUNCTION__, $_SERVER['REMOTE_USER'], ''); }
function index() { $p = Platform::getAll(); // print_r($p); $status = array(); foreach ($p as $key => $platform) { # code... $data['platform_name'] = $platform->getName(); $data['platform_ip'] = $platform->getIp(); $data['platform_host'] = $platform->getHostName(); // $data['status'] = json_decode(file_get_contents('http://50.28.37.181:8090/demo/seethru/api/status/'. $platform->getName() .'/sms_c'),true); $status = json_decode(file_get_contents('http://localhost/seethru/api/status'), true); // print_r($status); $gw_uptime = explode(' ', $status['gateway_uptime']); $data['gateway_uptime'] = $gw_uptime; $status[] = $data; } $this->setVariable('platforms', $status); $this->setView('', 'dashboard'); }
public function actionCreate() { self::validateAdmin(); if (isset($_POST['submit'])) { $option['name_platforms'] = $_POST['name_platforms']; $option['sort'] = $_POST['sort']; $option['status'] = $_POST['status']; $errors = false; if (!isset($option['name_platforms']) || empty($option['name_platforms'])) { $errors[] = "Введите имя категории"; print_r($errors); } if ($errors == false) { $id = Platform::createPlatform($option); header("Location: /evkazolinAdminka/platform/"); } } require_once ROOT . '/views/admin_category/create.php'; return true; }
$whereAdd[] = "(UPPER(P.name) LIKE UPPER('%" . str_replace("'", "''", $_GET['searchName']) . "%') OR UPPER(Publisher.name) LIKE UPPER('%" . str_replace("'", "''", $_GET['searchName']) . "%') OR UPPER(P.reportDisplayName) LIKE UPPER('%" . str_replace("'", "''", $_GET['searchName']) . "%'))"; } if ($_GET['startWith']) { $whereAdd[] = "TRIM(LEADING 'THE ' FROM UPPER(P.name)) LIKE UPPER('" . $_GET['startWith'] . "%')"; } $orderBy = $_GET['orderBy']; $limit = $pageStart - 1 . ", " . $numberOfRecords; //get total number of records to print out and calculate page selectors $totalPObj = new Platform(); $totalRecords = count($totalPObj->search($whereAdd, $orderBy, "")); //reset pagestart to 1 - happens when a new search is run but it kept the old page start if ($totalRecords < $pageStart) { $pageStart = 1; } $limit = $pageStart - 1 . ", " . $numberOfRecords; $platformObj = new Platform(); $platformArray = array(); $platformArray = $platformObj->search($whereAdd, $orderBy, $limit); if (count($platformArray) == 0) { echo "<br /><br /><i>Sorry, no platforms or publishers fit your query</i>"; $i = 0; } else { $thisPageNum = count($platformArray) + $pageStart - 1; echo "<span style='font-weight:bold;'>Displaying " . $pageStart . " to " . $thisPageNum . " of " . $totalRecords . " Platform Records</span><br />"; //print out page selectors if ($totalRecords > $numberOfRecords) { if ($pageStart == "1") { echo "<span class='smallerText'><<</span> "; } else { echo "<a href='javascript:setPageStart(1);' class='smallLink'><<</a> "; }
/** * @before _secure */ public function platforms() { $this->seo(array("title" => "List of Platforms")); $view = $this->getActionView(); if (RM::type() === 'POST') { $pid = RM::post('pid'); try { if ($pid) { $p = \Platform::first(['_id = ?' => $pid]); } else { $p = new \Platform(['user_id' => $this->user->_id, 'live' => true]); } $p->url = RM::post('url'); $p->save(); $view->set('message', 'Platform saved successfully!!'); } catch (\Exception $e) { $view->set('message', $e->getMessage()); } } $platforms = \Platform::all(["user_id = ?" => $this->user->_id], ['_id', 'url']); $results = []; $start = RM::get("start", date('Y-m-d', strtotime('-7 day'))); $end = RM::get("end", date('Y-m-d', strtotime('-1 day'))); $dateQuery = Utils::dateQuery(['start' => $start, 'end' => $end]); foreach ($platforms as $p) { $key = Utils::getMongoID($p->_id); } $view->set("platforms", $results)->set("start", $start)->set("end", $end); }
public static function install($data, &$fail, &$errno, &$error) { // Datenbank einrichten if (!isset($data['action']) || $data['action'] != 'update') { if (!$fail && (isset($data['DB']['db_override']) && $data['DB']['db_override'] === 'override')) { $sql = "DROP SCHEMA IF EXISTS `" . $data['DB']['db_name'] . "`;"; $oldName = $data['DB']['db_name']; $data['DB']['db_name'] = null; $result = DBRequest::request($sql, false, $data); if ($result["errno"] !== 0) { $fail = true; $errno = $result["errno"]; $error = isset($result["error"]) ? $result["error"] : ''; } $data['DB']['db_name'] = $oldName; } } if (!$fail) { $add = isset($data['DB']['db_ignore']) && $data['DB']['db_ignore'] === 'ignore' || isset($data['action']) && $data['action'] == 'update' ? 'IF NOT EXISTS ' : ''; $sql = "CREATE SCHEMA {$add}`" . $data['DB']['db_name'] . "` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;"; $oldName = $data['DB']['db_name']; $data['DB']['db_name'] = null; $result = DBRequest::request($sql, false, $data); if ($result["errno"] !== 0) { $fail = true; $errno = $result["errno"]; $error = isset($result["error"]) ? $result["error"] : ''; } $data['DB']['db_name'] = $oldName; } // CControl+DBQuery2 einrichten $res = array(); if (!$fail) { $list = array('DB/CControl', 'DB/DBQuery2'); $platform = Installation::PlattformZusammenstellen($data); for ($i = 0; $i < count($list); $i++) { $url = $list[$i]; //$data['PL']['init']; // inits all components $result = Request::post($data['PL']['url'] . '/' . $url . '/platform', array(), Platform::encodePlatform($platform)); $res[$url] = array(); if (isset($result['content']) && isset($result['status']) && $result['status'] === 201) { $res[$url]['status'] = 201; } else { $res[$url]['status'] = 409; $fail = true; if (isset($result['status'])) { $errno = $result['status']; $res[$url]['status'] = $result['status']; } ///if (isset($result['content'])) echo $result['content']; } } } return $res; }
} if (isset($_GET['limit'])) { $limit = $_GET['limit']; } else { $limit = ''; } $q = $_GET['q']; $q = str_replace(" ", "+", $q); $q = str_replace("&", "%", $q); $platform = new Platform(); $orgArray = $platform->searchOrganizations($q); echo implode("\n", $orgArray); break; //used to verify organization name isn't already being used as it's added //used to verify organization name isn't already being used as it's added case 'getExistingOrganizationName': $shortName = $_GET['shortName']; $platform = new Platform(); $orgArray = array(); $exists = 0; foreach ($platform->getOrganizationList() as $orgArray) { if (strtoupper($orgArray['name']) == strtoupper($shortName)) { $exists = $orgArray['organizationID']; } } echo $exists; break; default: echo _("Function ") . $_REQUEST['function'] . _(" not set up!"); break; }
/* |-------------------------------------------------------------------------- | Platform Hooks |-------------------------------------------------------------------------- | | Hooks for events of Platform itself. | */ Platform::booting(function ($platform) { // Before Platform and it's extensions have booted }); Platform::booted(function ($platform) { // When everything is setup and ready to roll }); Platform::ineligible(function ($platform) { // Whenever Platform cannot run (needs installing etc) }); /* |-------------------------------------------------------------------------- | Extension Hooks |-------------------------------------------------------------------------- | | Hooks for various stages of an Extension's lifecycle. You can access the | individual extension properties through $extension->getSlug(). | */ Extension::registering(function (Extension $extension) { // Before an extension is registered (happens for every extension) }); Extension::registered(function (Extension $extension) { // After an extension is registered
<?php /* |-------------------------------------------------------------------------- | Application View Composers |-------------------------------------------------------------------------- | */ View::composer(Platform::getPackageName() . '::module', 'Spescina\\PlatformCore\\Composers\\ModuleComposer');
/** * @before _secure * @after _displayData */ public function platforms($id = null) { $this->seo(["title" => "Platform wise click stats"]); $view = $this->getActionView(); $org = $this->org; $clickCol = Registry::get("MongoDB")->clicks; // find the platforms $platforms = \Platform::all(['user_id' => ['$in' => $org->users('advertisers')]], ['_id', 'url']); if (count($platforms) === 0) { return $view->set(['platforms' => [], 'publishers' => []]); } $key = array_rand($platforms); $url = RM::get('link', $platforms[$key]->url); // find ads having this url $ads = \Ad::all(['org_id' => $org->_id], ['_id', 'url']); $in = Utils::mongoObjectId(array_keys($ads)); $matched = []; foreach ($ads as $a) { $regex = preg_quote($url, '.'); if (preg_match('#^' . $regex . '#', $a->url)) { $matched[] = Utils::mongoObjectId($a->_id); } } if (count($matched) === 0) { $query['adid'] = ['$in' => $in]; } else { $query['adid'] = ['$in' => $matched]; } $query['is_bot'] = false; $query['created'] = Db::dateQuery($this->start, $this->end); $records = $clickCol->aggregate([['$match' => $query], ['$projection' => ['_id' => 1, 'pid' => 1]], ['$group' => ['_id' => '$pid', 'count' => ['$sum' => 1]]], ['$sort' => ['count' => -1]]]); $result = []; $publishers = []; foreach ($records as $r) { $obj = (object) $r; $id = Utils::getMongoID($obj->_id); $user = User::first(['_id' => $id], ['_id', 'name']); $result[$id] = (object) ['_id' => $user->_id, 'name' => $user->name, 'clicks' => $obj->count]; } $view->set(['platforms' => $platforms, 'link' => $url, 'publishers' => $result]); }
$platformID = ''; } if (isset($_GET['publisherPlatformID'])) { $publisherPlatformID = $_GET['publisherPlatformID']; } $archiveInd = $_GET['archiveInd']; $year = $_GET['year']; $statsArray = array(); if ($publisherPlatformID) { $publisherPlatform = new PublisherPlatform(new NamedArguments(array('primaryKey' => $publisherPlatformID))); $publisher = new Publisher(new NamedArguments(array('primaryKey' => $publisherPlatform->publisherID))); $platform = new Platform(new NamedArguments(array('primaryKey' => $publisherPlatform->platformID))); $nameDisplay = $publisher->name . " / " . $platform->name; $statsArray = $publisherPlatform->getYearlyOverrides($archiveInd, $year); } else { $platform = new Platform(new NamedArguments(array('primaryKey' => $platformID))); $nameDisplay = $platform->name; $statsArray = $platform->getYearlyOverrides($archiveInd, $year); } $totalRows = count($statsArray); ?> <div id='div_overrideForm'> <table class="thickboxTable" style="background-image:url('images/tbtitle.gif');width:410px;"> <tr> <td><span class='headerText'><?php echo $nameDisplay; ?> </span><br />(showing only titles for which there were outliers during the year) </td> </tr> <tr>
/** * Return a comma delimited string listing the specified columns. * * @param columns Either a list of <code>Column</code> objects, or * a list of <code>String</code> objects with column names. * @deprecated Use the DDLBuilder->getColumnList() method instead; this will be removed in 1.3 */ public static function makeList($columns, Platform $platform) { $list = array(); foreach ($columns as $col) { if ($col instanceof Column) { $col = $col->getName(); } $list[] = $platform->quoteIdentifier($col); } return implode(", ", $list); }
/** * Gets PDOStatement of query to fetch all data from a table. * @param string $tableName * @param Platform $platform * @return PDOStatement */ private function getTableDataStmt($tableName, Platform $platform) { return $this->conn->query("SELECT * FROM " . $platform->quoteIdentifier($tableName)); }
/** * Adds the component to the platform * * Called when this component receives an HTTP POST request to * /platform. */ public function addPlatform($callName, $input, $params = array()) { Logger::Log('starts POST AddPlatform', LogLevel::DEBUG); $file = dirname(__FILE__) . '/config.ini'; $text = "[DIR]\n" . "temp = \"" . str_replace(array("\\", "\""), array("\\\\", "\\\""), str_replace("\\", "/", $input->getTempDirectory())) . "\"\n" . "files = \"" . str_replace(array("\\", "\""), array("\\\\", "\\\""), str_replace("\\", "/", $input->getFilesDirectory())) . "\"\n"; if (!@file_put_contents($file, $text)) { Logger::Log('POST AddPlatform failed, config.ini no access', LogLevel::ERROR); return Model::isProblem(); } $platform = new Platform(); $platform->setStatus(201); return Model::isCreated($platform); }
public function actionOrder() { $platform = array(); $errors = array(); $userName = ''; $userEmail = ''; $userPhone = ''; $userComment = ''; $platform = Platform::getPlatformList(); $result = false; if (isset($_POST['submit'])) { $userName = $_POST['name']; $userEmail = $_POST['email']; $userPhone = $_POST['phone']; $userComment = $_POST['message']; $errors = false; if (!User::validateUsername($userName)) { $errors[] = "Неверное имя"; } if (!User::validateEmail($userEmail)) { $errors[] = "Неверный Email"; } if (!User::validatePhone($userPhone)) { $errors[] = "Неккоректный телефон"; } if ($errors == false) { $productsBasket = Basket::getProducts(); if (User::isGuest()) { $userId = false; } else { $userId = User::validateLogged(); } $result = Order::save($userName, $userEmail, $userPhone, $userComment, $userId, $productsBasket); if ($result) { $adminEmail = "*****@*****.**"; $subject = "Новый заказ"; mail($adminEmail, $subject, $userComment); Basket::clear(); } } else { $productsInBasket = Basket::getProducts(); $productId = array_keys($productsInBasket); $products = Products::getProductsByIdInBasket($productId); $totalPrice = Basket::getTotalPrice($products); $total = array_sum($totalPrice); $totalQuantity = Basket::countItem(); } } else { $productsInbasket = Basket::getProducts(); if ($productsInbasket == false) { header("Loaction: /"); } else { $productId = array_keys($productsInbasket); $products = Products::getProductsByIdInBasket($productId); $totalPrice = Basket::getTotalPrice($products); $totalQuantity = Basket::countItem(); $userName = false; $userEmail = false; $userPhone = false; $userComment = false; if (User::isGuest()) { } else { $userId = User::validateLogged(); $user = User::getUserById($userId); $userName = $user['name']; $userEmail = $user['email']; } } } require_once ROOT . "/views/basket/order.php"; return true; }
<div class="headerText">Publisher / Platform Update</div> <br /> <?php echo "<div style='line-height:130%;margin-left:5px;text-align:left;'>\n"; $platforms = new Platform(); $platform = array(); $platformArray = $platforms->getPlatformArray(); if (count($platformArray) > 0) { foreach ($platformArray as $platform) { echo "<div style='margin-bottom:15px;'>"; echo "<span class='PlatformText'>" . $platform['name'] . "</span> <a href='publisherPlatform.php?platformID=" . $platform['platformID'] . "' class='smallLink'>view / edit</a>"; echo "<br /> <a href=\"javascript:showPublisherList('" . $platform['platformID'] . "');\"><img src='images/arrowright.gif' style='border:0px' alt='show publisher list' id='image_" . $platform['platformID'] . "'></a> <a href=\"javascript:showPublisherList('" . $platform['platformID'] . "');\" id='link_" . $platform['platformID'] . "'>show publisher list</a><br />"; echo "<div id='div_" . $platform['platformID'] . "' style='display:none;width:600px;margin-left:40px'>"; $platformObj = new Platform(new NamedArguments(array('primaryKey' => $platform['platformID']))); //loop through each publisher under this platform $publisherPlatform = new PublisherPlatform(); foreach ($platformObj->getPublisherPlatforms() as $publisherPlatform) { $publisher = new Publisher(new NamedArguments(array('primaryKey' => $publisherPlatform->publisherID))); echo $publisher->name . " <a href='publisherPlatform.php?publisherPlatformID=" . $publisherPlatform->publisherPlatformID . "'>view / edit</a><br />"; } echo "</div>"; echo "</div>"; } } else { echo "<i>No publishers / platforms found.</i>"; } echo "</div>\n"; ?>
/** * Adds the component to the platform * * Called when this component receives an HTTP POST request to * /platform. */ public function addPlatform() { Logger::Log('starts POST AddPlatform', LogLevel::DEBUG); // decode the received course data, as an object $insert = Platform::decodePlatform($this->_app->request->getBody()); // always been an array $arr = true; if (!is_array($insert)) { $insert = array($insert); $arr = false; } // this array contains the indices of the inserted objects $res = array(); foreach ($insert as $in) { // starts a query, by using a given file $result = DBRequest::getRoutedSqlFile($this->query2, dirname(__FILE__) . '/Sql/AddPlatform.sql', array('object' => $in), false); // checks the correctness of the query if ($result['status'] >= 200 && $result['status'] <= 299) { $queryResult = Query::decodeQuery($result['content']); $res[] = $in; $this->_app->response->setStatus(201); if (isset($result['headers']['Content-Type'])) { $this->_app->response->headers->set('Content-Type', $result['headers']['Content-Type']); } } else { Logger::Log('POST AddPlatform failed', LogLevel::ERROR); $this->_app->response->setStatus(isset($result['status']) ? $result['status'] : 409); $this->_app->response->setBody(Platform::encodePlatform($res)); $this->_app->stop(); } } if (!$arr && count($res) == 1) { $this->_app->response->setBody(Platform::encodePlatform($res[0])); } else { $this->_app->response->setBody(Platform::encodePlatform($res)); } }
| | Finally, we'll load the overrides file, which is a convenient place to | override functionality in Laravel, Platform, all packages and | Extensions. | */ require app_path() . '/overrides.php'; /* |-------------------------------------------------------------------------- | Boot Platform |-------------------------------------------------------------------------- | | Now that we have our functions and hooks registered, we'll boot Platform. | */ Platform::boot(); /* |-------------------------------------------------------------------------- | Require The Filters File |-------------------------------------------------------------------------- | | Next we will load the filters file for the application. This gives us | a nice separate location to store our route and application filter | definitions instead of putting them all in the main routes file. | */ require app_path() . '/filters.php'; /* |-------------------------------------------------------------------------- | Require The Widgets File |--------------------------------------------------------------------------
/** * Adds the component to the platform * * Called when this component receives an HTTP POST request to * /platform. */ public function addPlatform($callName, $input, $params = array()) { Logger::Log('starts POST AddPlatform', LogLevel::DEBUG); //$this->loadConfig($name); // decode the received course data, as an object $insert = $input; $result = Model::isOK(); // always been an array $arr = true; if (!is_array($insert)) { $insert = array($insert); $arr = false; } // this array contains the indices of the inserted objects $res = array(); foreach ($insert as $in) { $file = dirname(__FILE__) . '/config.ini'; $text = "[DB]\n" . "db_path = \"" . str_replace(array("\\", "\""), array("\\\\", "\\\""), $in->getDatabaseUrl()) . "\"\n" . "db_user = \"" . str_replace(array("\\", "\""), array("\\\\", "\\\""), $in->getDatabaseOperatorUser()) . "\"\n" . "db_passwd = \"" . str_replace(array("\\", "\""), array("\\\\", "\\\""), $in->getDatabaseOperatorPassword()) . "\"\n" . "db_name = \"" . str_replace(array("\\", "\""), array("\\\\", "\\\""), $in->getDatabaseName()) . "\"\n" . "[PL]\n" . "urlExtern = \"" . str_replace(array("\\", "\""), array("\\\\", "\\\""), $in->getExternalUrl()) . "\"\n" . "url = \"" . str_replace(array("\\", "\""), array("\\\\", "\\\""), $in->getBaseUrl()) . "\""; if (!@file_put_contents($file, $text)) { Logger::Log('POST AddPlatform failed, config.ini no access', LogLevel::ERROR); $result = Model::isProblem(); } $platform = new Platform(); $platform->setStatus(201); $res[] = $platform; $result = Model::isCreated(); } $return['content'] = $res; return $return; }