function admin_games() { $tpl = new smarty(); $tpl->assign('icons', get_icons()); $tpl->assign('games', get_games()); ob_start(); $tpl->display(DESIGN . '/tpl/admin/games.html'); $content = ob_get_contents(); ob_end_clean(); main_content(GAMES, $content, '', 1); }
?> <?php echo $nc_core->ui->icon($ico)->title($ico)->xlarge(); } ?> </div> <?php example(); ?> <?php /*------------------------------------------------------------------------*/ ?> <?php $icons = get_icons('icons-50-white'); example('nc-icon-x nc--white'); ?> <div class="nc-box nc--grey"> <?php foreach ($icons as $i => $ico) { ?> <?php echo $nc_core->ui->icon($ico)->title($ico)->xlarge()->white(); } ?> </div> <?php example(); ?>
function process_app($app_name, $app_link, $app_group = "default") { global $scrape_options; if ($scrape_options["verbose"]) { echo "processing app {$app_name}\ngetting app page {$app_link}\n"; } //getting and parsing app page //there may be several versions of app //we store all versions meta (created date, publis date and current status) $res = getUrlContent2($app_link); if (!$res) { return error("failed to get app page\\s"); } //parsing primary meta $pat = '/<p><label>SKU<\\/label>(.*?)<\\/p>[\\s]*<p><label>Bundle ID<\\/label>(.*?)<\\/p>[\\s]*<p><label>Apple ID<\\/label>(.*?)<\\/p>[\\s]*<p><label>Type<\\/label>(.*?)<\\/p>[\\s]*<p><label style="white-space: nowrap">Default Language<\\/label>(.*?)<\\/p>/si'; $match = preg_match($pat, $res, $matches); if (!$match || !is_array($matches) || count($matches) == 0) { return error("Failed to parse app page: meta markers not found"); } $sku = trim(strip_tags($matches[1])); $bundle_id = trim(strip_tags($matches[2])); $apple_id = trim(strip_tags($matches[3])); $app_type = trim(strip_tags($matches[4])); $lang = trim(strip_tags($matches[5])); if ($scrape_options["verbose"]) { echo "parsed memo:\nsku: {$sku}\nbundle_id: {$bundle_id}\napple_id: {$apple_id}\napp_type: {$app_type}\ndefault language: {$lang}\n"; } $pat = '/<td class="value"><a target="_blank" href="(.*?)">View in App Store[\\s]*<\\/a><\\/td>/si'; $match = preg_match($pat, $res, $matches); if (!$match || !is_array($matches) || count($matches) == 0) { return error("Failed to parse app page: Appstore link not found"); } $applink = $matches[1]; if ($scrape_options["verbose"]) { echo "appstore link: {$applink}\n"; } $pat = '/id([0-9]*)\\?/si'; $match = preg_match($pat, $applink, $matches); if (!$match || !is_array($matches) || count($matches) == 0) { return error("Failed to parse app page: Appstore ID not found"); } $appid = $matches[1]; echo "appid: {$appid}\n"; $p = strpos($res, "version-container"); if ($p === false) { return error("version-container marker not found"); } $p2 = strpos($res, "version-container", $p + 10); if ($p2 === false) { if ($scrape_options["debug"]) { echo "second version-container marker not found. parsing only one\n"; } $str1 = substr($res, $p, strlen($res) - $p); $str2 = false; } else { if ($scrape_options["debug"]) { echo "both version-container markers found\n"; } $str1 = substr($res, $p, $p2 - $p); $str2 = substr($res, $p2, strlen($res) - $p2); } $ver1 = parse_version($str1); if (!$ver1) { return error("parse Current version failed"); } if ($str2) { $ver2 = parse_version($str2); // if (!$ver2) // return error("parse New version failed"); } else { $ver2 = false; } if (!is_dir(BASE_META_DIR . "/app_{$appid}") && !mkdir(BASE_META_DIR . "/app_{$appid}")) { return error("couldn't access to application directory [" . BASE_META_DIR . "/app_{$appid}]"); } $obj = array("app_name" => $app_name, "apple_id" => $apple_id, "app_group" => $app_group, "sku" => $sku, "bundle_id" => $bundle_id, "app_type" => $app_type, "lang" => $lang, "ituneslink" => $applink, "current_version" => $ver1, "new_version" => $ver2); $fn = BASE_META_DIR . "/app_{$appid}/appmeta.dat"; if (file_exists($fn)) { $cont = file_get_contents($fn); if ($cont) { $row = unserialize($cont); if ($row) { $obj["stat_max_report_date"] = $row["stat_max_report_date"]; $obj["stat_min_report_date"] = $row["stat_min_report_date"]; $obj["stat_last_day"] = $row["stat_last_day"]; $obj["stat_last_month"] = $row["stat_last_month"]; $obj["stat_whole_period"] = $row["stat_whole_period"]; } } } $res = file_put_contents($fn, serialize($obj)); $res = get_icons($appid, $ver1, $ver2); process_app_to_db($obj); if (!$res) { return error("some problems while writing appmeta.dat file"); } return true; }