pName = 'open_9704'; $this->rootPath = 'GAMES/'; $this->wmlTemplatePath = 'templates/wap/wml/wml.template.php'; $this->xhtmlTemplatePath = 'templates/wap/xhtml/xhtml.template.php'; $this->searchResLimit = 33; $this->recordsPerPage = 3; $this->phoneRecordsPerPage = 10; $this->pageRange = 4; $this->title = 'Download Mobile Phone Games: Symbian Games, BlackBerry Games, iPhone Games, Java Games for Mobile Cell Phone!'; $this->keyWords = 'mobile java games, symbian games, blackBerry games, iPhone games, mobile cell phone games, download games'; $this->description = 'Download Games: Free iPhone Games, Symbian Games, BlackBerry Games, Windows Mobile Games, Java Games, Free Mobile Casino Games for Mobile Cell Phone!'; $this->domainRoot = "http://mobile-phone-games.mobi/"; $this->twitterUsername = 'MobilePhoneGame'; $this->twitterPsw = 'chaparal'; $this->searchCard = false; $this->downloadCard = false; $this->phonesCard = false; $this->phonesListingCard = false; $this->vendorsCard = false; $this->vendor = false; $this->gameDownloadsCard = false; $this->adMobAds = false; $this->gameLoftAds = false; $this->IphoneAds = false; $this->userData = new USER_DATA; $this->arrUserData = $this->userData->GetUserData(); $this->mysqlServer = "localhost"; $this->mysqlLogin = "dgcore"; $this->mysqlPassword = "chaparal13"; $this->mysqlDB = "pokerpwr"; $this->db = mysql_connect ($this->mysqlServer, $this->mysqlLogin, $this->mysqlPassword); mysql_select_db ($this->mysqlDB, $this->db); $this->Pointer();//redirect for selected countries $this->ADS(); $this->Request(); $this->headerCard = $this->HeaderCard(); $this->navigationCard = $this->NavigationCard(); $this->menuCard = $this->MenuCard(); $this->listingCard = $this->ListingCard(); $this->gameCard = $this->GameCard(); $this->finalPrintOut = $this->RenderTemplate(); echo $this->finalPrintOut; mysql_close ($this->db); } private function Pointer(){ if(strpos($_SERVER['HTTP_USER_AGENT'],"iPhone")){ header('HTTP/1.1 301 Moved Permanently'); header('Location: '.'http://mobile-phone-games.mobi/iphone/'); }else{ switch($this->arrUserData['country_name']){ case 'United Kingdom' : header('Location: '.'http://games.uk.dgcore.com'); break; case 'Australia' : header('Location: '.'http://games.au.dgcore.com'); break; } } } private function Request(){ $this->gameTitle = (isset($_GET['gttl']))? $this->SanitizeDBInput($_GET['gttl']) : false; if(isset($_GET['path']) && stristr($_SERVER["REQUEST_URI"], 'phones') == FALSE ){//path $this->path = $this->rootPath.$this->SanitizeDBInput($_GET['path']); $this->pathToUse = $this->SanitizeDBInput($_GET['path']); $this->pid = str_replace('/', "", $this->path); $this->pid = str_replace(' ', "", $this->path); $this->pid = (int) ereg_replace("[^0-9]", "", $this->pid); }else{ $this->path = $this->rootPath; $this->pathToUse = ''; } if(isset($_POST['q'])){//search $this->q = $this->SanitizeDBInput($_POST['q']); if(($this->q != '') && ($this->q != ' ') && (strlen($this->q) > 2)){ $this->searchCard = $this->SearchCard(); } } if(isset($_GET['d'])){//download $this->contentId = (isset($_GET['cid']))? $this->SanitizeDBInput($_GET['cid']) : '' ; $this->downloadCard = $this->DownloadCard(); } if(stristr($_SERVER["REQUEST_URI"], 'phones') === FALSE){//vendors $this->vendorsCard = $this->VendorsCard(); } if(isset($_GET['p'])){//phone $this->p = $this->SanitizeDBInput($_GET['p']); $this->cp = 0; $this->phonesCard = $this->PhonesCard(); } if(isset($_GET['pl']) && (stristr($_SERVER["REQUEST_URI"], 'phones') == TRUE) && (stristr($_SERVER["REQUEST_URI"], 'games') == FALSE) ){//phones listing $this->pl = $this->SanitizeDBInput($_GET['pl']); $this->pl = str_replace('index.php/', "", $this->pl); $this->pl = str_replace('/', "", $this->pl); $temp = $this->pl; $this->index = (int) ereg_replace("[^0-9]", "", $temp); $this->pl = str_replace($this->index, "", $this->pl); $this->phonesListingCard = $this->PhonesListingCard(); } if(isset($_GET['gl']) && (stristr($_SERVER["REQUEST_URI"], '/games') == TRUE) ){//games listing echo '1'; $this->p = $this->SanitizeDBInput($_GET['gl']); preg_match_all("/\/(.+?)\|/sim", $this->p.'|', $matchOut); $this->p = $matchOut[1][0]; preg_match_all("/_games\/(.+?)\//sim", $this->p, $matchOut1); $this->cp = (isset($matchOut1[1][0]))? (int) ereg_replace("[^0-9]", "", $matchOut1[1][0]) : ''; if(!isset($_GET['p']) && (stristr($_SERVER["REQUEST_URI"], 'games') == TRUE) ){ $this->phonesCard = $this->PhonesCard(); } } if(isset($_GET['gd'])){//game downloads $this->gd = $this->SanitizeDBInput($_GET['gd']); $this->gameDownloadsCard = $this->GameDownloadsCard(); } } private function GameDownloadsCard($out = false){ preg_match_all("/(.+?)\//sim", $this->gd, $matchOut); $vendor = $matchOut[1][0]; $this->gd = str_replace(array($vendor.'/', '|', strtolower('(ATandT)'), strtolower('(unlocked)'), strtolower('(T-Mobile)'), strtolower('(Sprint)'), strtolower('(Alltel)'), strtolower('(Cellular South)'), strtolower('(Nextel)')), array('', '@', '', '', '', '', '', '', ''), $this->gd); preg_match_all("/(.+?)\//sim", $this->gd, $matchOut1); $model = (isset($matchOut1[1][0]))? $matchOut1[1][0] : '' ; $model = str_replace(array('@', '_'), array('/', ''), $model); preg_match_all("/\/(.+?)LABEL/sim", $this->gd.'LABEL', $matchOut1); $gameTitle = $matchOut1[1][0]; $gameInfo = mysql_query ('SELECT cid, title, description, category FROM listings WHERE listings.title LIKE "'.$gameTitle.'" '); $out = '

'.strtoupper($vendor).' GAME DOWNLOADS:'.'

'; if (mysql_num_rows($gameInfo) > 0){ while ($row = mysql_fetch_assoc ($gameInfo)){ $fileName = str_replace( array(':', ') ', ' (', '_', ' ', '(', ')', '!', '-', '`', '~', '@', '#', '$', '%', '^', '&', '*', '[', ']', '\'', '\"', '.', ',', '<', '>', '?', '=', '+', '|', '\/'), array('', '', '', '_', '_', '_', '_', '_', '', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_'), $row['title'] ); $fileName = 'java_game_'.(strtolower($fileName)).'.jpg'; $out .= '

'.stripslashes($row['title']).' '.ucwords($vendor).' '.str_replace(array('@', '_'), array('/', ''), $model).' game. Download now!'.'

'; $out .= '

'.stripslashes($row['title']).'

'; $out .= '
'.stripslashes ($row['title']).' game for mobile phone'.'
'; $out .= '

'.stripslashes ($row['title']).' '.'('.ucwords($vendor).' '.$model.')'.'


'.html_entity_decode(stripslashes($row['description'])).'
'; $out .= '
Games Download
'; $this->title = 'Download '.stripslashes($row['title']).' Game for your '.strtoupper($vendor).' '.$model.' | '.strtoupper($vendor).' Games Download'; $this->keyWords .= strtolower($vendor).' downloads'; $this->description = strtoupper($vendor).' '.$model.' '.stripslashes($row['title']).' | Download Top '.$vendor.' Games for your mobile phone. Join the FUN!'; } } return $out; } private function PhonesListingCard(){ $vendorId = ''; $vendor = ''; $out = ''; $this->keyWords = ''; $this->description = 'Game Downloads for '; $vendorUid = mysql_query ("SELECT uid, vendor FROM vendors WHERE vendor = '".$this->pl."' "); if (mysql_num_rows($vendorUid) > 0){ while ($row = mysql_fetch_assoc ($vendorUid)){ $vendorId .= $row['uid']; $vendor .= $row['vendor']; } } $out = '

'.$vendor.' Phone Games:

'; $models = mysql_query ("SELECT device FROM devices WHERE vendor_id = '".$vendorId."' ORDER BY device LIMIT ".$this->index.", ".$this->phoneRecordsPerPage." "); if (mysql_num_rows($models) > 0){ while ($row = mysql_fetch_assoc ($models)){ $device = $row['device']; $row['device'] = str_replace(array('/', ' '), array('|', '_'), $row['device']); $device = str_replace(array('(ATandT)', '(unlocked)', '(T-Mobile)', '(Sprint)', '(Alltel)', '(Cellular South)', '(Nextel)'), array('', '', '', '', '', '', ''), $device); $out .= ''; $this->keyWords .= strtolower($vendor).' '.trim(strtolower($device)).', '; $this->description .= strtolower($vendor).' '.trim(strtolower($device)).', '; } } $type = (isset($this->arrUserData['is_wml']))? 'wml' : 'html'; $q = mysql_query ("SELECT device FROM devices WHERE vendor_id = '".$vendorId."' "); $numRes = mysql_num_rows($q); $paginate = new Paginate($this->phoneRecordsPerPage, $numRes, $this->domainRoot.'phones/'.$this->pl.'/', 2, $this->index, $type); if(mysql_num_rows($vendorUid) != 0){ if(isset($this->arrUserData['is_wml'])){ $out .= '

'.$paginate->displayTable().'

'; }else{ $out .= '
'.$paginate->displayTable().'
'; } } $currentPage = ($this->index !== 0)? ' | Page '.( ($this->index+$this->phoneRecordsPerPage)/$this->phoneRecordsPerPage ) : ''; $this->title = $vendor.' Games Download | Cell Phone Game Downloads'.$currentPage; $this->keyWords .= strtolower($vendor).' downloads'; return $out; } private function VendorsCard($out=false){ $out = ''; $vendors = mysql_query ("SELECT vendor FROM vendors WHERE uid = 2 OR uid = 4 OR uid = 7 OR uid = 8 OR uid = 10 OR uid = 13 OR uid = 17 OR uid = 20 OR uid = 18 OR uid = 14 OR uid = 21 OR uid = 5"); if (mysql_num_rows($vendors) > 0){ while ($row = mysql_fetch_assoc ($vendors)){ $out .= ''; } } return $out; } private function PhonesCard($out=false){ preg_match_all("/(.+?)\/games/sim", $this->p, $matchOut); $vendor = (isset($matchOut[1][0]))? $matchOut[1][0] : '' ; preg_match_all("/_(.+?)_games/sim", $this->p, $matchOut1); $device = str_replace(array('|', '_'), array('/', ' '), $matchOut1[1][0]); $model = str_replace(array(strtolower('(ATandT)'), strtolower('(unlocked)'), strtolower('(T-Mobile)'), strtolower('(Sprint)'), strtolower('(Alltel)'), strtolower('(Cellular South)'), strtolower('(Nextel)')), array('', '', '', '', '', '', ''), $device); $out = '

Games for '.$vendor.' '.$model.' phone:

'; $vendor_id = mysql_query ("SELECT uid FROM vendors WHERE vendor = '".$vendor."' "); $row = mysql_fetch_assoc($vendor_id); $vendorId = $row['uid']; $device_id = mysql_query ("SELECT uid FROM devices WHERE device = '".$device."' AND vendor_id = '".$vendorId."' "); $row = mysql_fetch_assoc($device_id); $deviceId = $row['uid']; $device_ids = mysql_query ("SELECT id, device_ids FROM listings"); //print_r($deviceId); $i = 1; while ($row1 = mysql_fetch_assoc($device_ids)){ //print_r(mysql_fetch_assoc($device_ids)); if(isset($deviceId)){ if(stristr($row1['device_ids'], $deviceId.',')){ $arrDeviceIds[] = $row1['id']; $phones = mysql_query ("SELECT title FROM listings WHERE id = '".$row1['id']."'"); $numRes = mysql_num_rows($phones); $res = $i; if ( ($numRes > 0) && ($i > $this->cp) && ($i < ($this->cp + $this->phoneRecordsPerPage + 1)) ){ $row1 = mysql_fetch_assoc($phones); $device = str_replace(array('/', ' '), array('|', '_'), $device); $out .= ''; } $i++; } } } if(isset($res)){ $type = (isset($this->arrUserData['is_wml']))? 'wml' : 'html'; $paginate = new Paginate($this->phoneRecordsPerPage, $res, $this->domainRoot.'phones/'.$vendor.'/games/'.$vendor.'_'.$device.'_games'.'/', 2, $this->cp, $type); if(isset($this->arrUserData['is_wml'])){ $out .= '

'.$paginate->displayTable().'

'; }else{ $out .= '
'.$paginate->displayTable().'
'; } }else{ $yo = eval("$I______FUCK_____NO_GAME_____TREVOGA__TRAVOGA__VOLK__UKRAL__KOZLYAT;"); } $currentPage = ($this->cp)? ' | Page '.( ($this->cp+$this->phoneRecordsPerPage)/$this->phoneRecordsPerPage ).' | ' : ' | '; $this->title = strtoupper($vendor).' '.$model.' Game Downloads'.$currentPage.'Download Mobile Games for '.$vendor.' '.$model.' phone'; $this->keyWords .= ', '.strtolower($vendor).' downloads'; $this->description = trim($vendor.' '.$model).' Games Download!'.$currentPage.'Best cell phone games for '.trim($vendor.' '.$model); return $out; } private function DownloadCard(){ $this->PostToTwitter($this->contentId); $out = ''; $redirUrl = 'http://m.thumbplay.com/tp/infomo'; $redirUrlParams = '?view=details2&pname='.$this->pName.'&cid='.$this->contentId; $result = mysql_query('SELECT intl, url FROM listings WHERE listings.cid = "'.$this->contentId.'" '); $numRslts = mysql_num_rows ($result); if($numRslts > 0){ while ($row = mysql_fetch_assoc ($result)){ $intl = $row['intl']; if($intl == 1){ $redirUrl = $row['url']; $redirUrlParams = ''; } } } if($this->arrUserData['country_name'] == 'United States' || $this->arrUserData['country_name'] == '' || $intl ==1 ){ //header('Location: '.$redirUrl.$redirUrlParams); header('Location: http://c.mobpartner.mobi/?s=7476'); }else{ if(isset($this->arrUserData['is_wml'])){ $out = '

Sorry - we do not currently support this game for your country.

'; $out .= '';//ads $out .= '*Try Amazing Casino Games Available for your cell phone & country.
'; $out .= 'Download now! Play Free Mobile Casino Games & WIN REAL CASH!
'; $out .= 'Free Mobile Poker, Slots, Blackjack, Roulette, Baccarat, Sports Betting & more in one quick & Free Download!
'; $out .= 'Act now & GET 200% Free Cash Bonus!
'; $out .= '

*No hidden costs. 18+


'; }else{ $out = '
Sorry - we do not currently support this game for your country.
'; $out .= '';//ads $out .= '*Try Amazing Casino Games Available for your cell phone & country.
'; $out .= 'Download now! Play Free Mobile Casino Games & WIN REAL CASH!
'; $out .= 'Free Mobile Poker, Slots, Blackjack, Roulette, Baccarat, Sports Betting & more in one quick & Free Download!
'; $out .= 'Act now & GET 200% Free Cash Bonus!
'; $out .= '
*No hidden costs. 18+

'; } } return $out; } private function PostToTwitter($cid){ $gameInfo = mysql_query ('SELECT title FROM listings WHERE cid = "'.$cid.'" '); if (mysql_num_rows($gameInfo) > 0){ $row = mysql_fetch_assoc ($gameInfo); $twitter_message = 'Just Downloaded: Mobile Game '.strtoupper($row['title']).' - '.'http://mobile-phone-games.mobi/games/'.str_replace(" ", "_", stripslashes(strtolower($row['title']))).'.html'; if(strlen($twitter_message)>1){ if(strpos($_SERVER['HTTP_USER_AGENT'], 'google')=== FALSE && strpos($_SERVER['HTTP_USER_AGENT'], 'yahoo')=== FALSE && $_SERVER['HTTP_USER_AGENT'] !== ''){ postToTwitter($this->twitterUsername, $this->twitterPsw, $twitter_message); } } } } private function HeaderCard(){ $out = ''; $resolutionWidth = (isset($this->arrUserData['reolution_width']))? $this->arrUserData['reolution_width'] : '176' ; $imagePath = 'images/'.$resolutionWidth.'/logo.gif'; $arrImageProp = $this->GetImageProperties($imagePath); if(isset($this->arrUserData['is_wml'])){ $out .= 'game mobile phone'; }else{ $out .= '
game mobile phone
'; } return $out; } private function SearchCard(){ $out = ''; $result = mysql_query('SELECT id, cid, title, description FROM listings WHERE listings.title LIKE "%'.$this->q.'%"'); $numRes = mysql_num_rows ($result); while ($row = mysql_fetch_assoc ($result)){ $this->arrQ[] = array( 'id' => $row['id'], 'cid' => $row['cid'], 'title' => $row['title'], 'description' => $row['description'] ); } if($numRes > 0){ if(isset($this->arrUserData['is_wml'])){ $out .= ($numRes >= $this->searchResLimit)? '

Showing '.$this->searchResLimit.' games from top '.$this->searchResLimit.' results' : '

Found '.$numRes.' '.($game = ($numRes < 2)? 'game' : 'games' ).' for query: '.$this->q.'

' ; }else{ $out .= ($numRes >= $this->searchResLimit)? '
Showing '.$this->searchResLimit.' games from top '.$this->searchResLimit.' results
' : '
Found '.$numRes.' '.($game = ($numRes < 2)? 'game' : 'games' ).' for query: '.$this->q.'
' ; } $i = 0; while(isset($this->arrQ[$i])){ $this->gameSearch = str_replace(" ", "_", stripslashes ($this->arrQ[$i]['title'])); $result = mysql_query('SELECT id, cid, title, description, category FROM listings WHERE listings.title LIKE "'.$this->gameSearch.'" '); if(mysql_num_rows($result) > 0){ $this->arrGameCard = mysql_fetch_assoc ($result); } $result = mysql_query('SELECT id, name, parent FROM cats WHERE id ='.$this->arrGameCard['category']); if(mysql_num_rows($result) > 0){ $this->category = mysql_fetch_assoc ($result); } $result = mysql_query('SELECT id, name FROM cats WHERE id ='.$this->category['parent']); if(mysql_num_rows($result) > 0){ $this->parentCategoryId = mysql_fetch_assoc ($result); } $result = mysql_query('SELECT name FROM cats WHERE id ='.$this->parentCategoryId['id']); if(mysql_num_rows($result) > 0){ $this->parentCategory = mysql_fetch_assoc ($result); } if(isset($this->arrQ[$i]['id']) && ($i < $this->searchResLimit)){ if(isset($this->arrUserData['is_wml'])){ $out .= ''.($i+1).'. '.stripslashes ($this->arrQ[$i]['title']).' '.'('.$this->parentCategory['name'].' / '.$this->category['name'].')'.'
'; }else{ $out .= '
'.'
'; } $this->title = (isset($this->q))? $this->q : 'Mobile Phone Game Search Results: '; $this->keyWords = 'mobile java games'; } $i++; } }else{ if(isset($this->arrUserData['is_wml'])){ $out .= '

No results were found for query: '.$this->q.'

'; }else{ $out .= '
No results were found for query: '.$this->q.'
'; } } return $out; } private function GameCard(){ $out = ''; if($this->gameTitle != false){ $this->gameTitle = str_replace("_", " ", stripslashes($this->gameTitle)); $result = mysql_query('SELECT id, cid, title, description, category FROM listings WHERE listings.title LIKE "'.$this->gameTitle.'" '); if(mysql_num_rows($result) > 0){ $this->arrGameCard = mysql_fetch_assoc ($result); } $result = mysql_query('SELECT id, name, parent FROM cats WHERE id ='.$this->arrGameCard['category']); if(mysql_num_rows($result) > 0){ $this->category = mysql_fetch_assoc ($result); } $result = mysql_query('SELECT id, name FROM cats WHERE id ='.$this->category['parent']); if(mysql_num_rows($result) > 0){ $this->parentCategoryId = mysql_fetch_assoc ($result); } $result = mysql_query('SELECT name FROM cats WHERE id ='.$this->parentCategoryId['id']); if(mysql_num_rows($result) > 0){ $this->parentCategory = mysql_fetch_assoc ($result); } $rslt = mysql_query('SELECT title FROM listings WHERE title LIKE "%'.$this->arrGameCard['title'].'%"'); $numRslts = mysql_num_rows ($rslt); if($numRslts > 0){ while ($row = mysql_fetch_assoc ($rslt)){ $fileName = str_replace( array(':', ') ', ' (', '_', ' ', '(', ')', '!', '-', '`', '~', '@', '#', '$', '%', '^', '&', '*', '[', ']', '\'', '\"', '.', ',', '<', '>', '?', '=', '+', '|', '\/'), array('', '', '', '_', '_', '_', '_', '_', '', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_'), $row['title'] ); $fileName = 'java_game_'.(strtolower($fileName)).'.jpg'; } if(isset($this->arrGameCard['id'])){ if(isset($this->arrUserData['is_wml'])){ $out .= '

'.stripslashes ($this->arrGameCard['title']).'

'; $out .= '

'; $out .= '

'.stripslashes ($this->arrGameCard['title']).' '.'('.$this->parentCategory['name'].' / '.$this->category['name'].')'.'
'.html_entity_decode(stripslashes($this->arrGameCard['description'])).'

'; $out .= '

'; $this->title = 'Mobile Cell Phone '.$this->parentCategory['name'].' | '.$this->category['name'].' | Play '.stripslashes ($this->arrGameCard['title']).' Game Now!'; $this->keyWords = 'mobile java games, '.strtolower($this->parentCategory['name']).', '.strtolower($this->category['name']); }else{ $out .= '

'.stripslashes ($this->arrGameCard['title']).'

'; $out .= '
'.stripslashes ($this->arrGameCard['title']).' game for mobile phone'.'
'; $out .= '

'.stripslashes ($this->arrGameCard['title']).' '.'('.$this->parentCategory['name'].' / '.$this->category['name'].')'.'


'.html_entity_decode(stripslashes($this->arrGameCard['description'])).'
'; $out .= '
Games Download
'; $this->title = $this->parentCategory['name'].' for Mobile Phone'.' | '.$this->category['name'].' | Download & Play '.stripslashes ($this->arrGameCard['title']).' Game Now!'; $this->keyWords = 'game mobile phone, mobile java games, '.strtolower($this->parentCategory['name']).', '.strtolower($this->category['name']); $this->description = $this->category['name'].' Download! Download & Play '.stripslashes ($this->arrGameCard['title']).' game!('.strtolower($this->category['name']).') '.html_entity_decode(stripslashes($this->arrGameCard['description'])); } } }else{ echo 'Error, can not get Image file Names'; die(); } } return $out; } private function NavigationCard(){ $out = ''; $arIds = array (); $arSubPath = array (); $arPath = explode ('/', $this->path); for ($i = 0; $i < count ($arPath); $i++){ array_push ($arSubPath, $arPath[$i]); $parent = ($i == 0)? 0 : ($arIds[count ($arIds) - 1]); $thisCat = mysql_query ("SELECT id, name, tname FROM cats WHERE name LIKE '$arPath[$i]' AND parent = $parent "); if (mysql_num_rows ($thisCat) > 0){ $this->row = mysql_fetch_assoc ($thisCat); $this->arrCats[$i] = $this->row['tname']; $arSubPath = str_replace(" ", "", $arSubPath); array_push ($arIds, $this->row['id']); $this->subPath = substr_replace(implode ('/', $arSubPath),'',0,strlen($this->rootPath)); if(isset($this->arrUserData['is_wml'])){ if(stripslashes($this->subPath) == ''){ $out .= ''.$this->row['name']."\n"; }else{ $out .= ''.$this->row['name']."\n"; } }else{ if(stripslashes($this->subPath) == ''){ $out .= ''.$this->row['name']."\n"; }else{ $out .= ''.$this->row['name']."\n"; } } } } return $out; } private function MenuCard(){ $out = ''; if(!isset($this->pid) || ($this->pid == 0)){ $kids = mysql_query ("SELECT id, name, children FROM cats WHERE parent = '".$this->row['id']."' ORDER BY name"); if (mysql_num_rows ($kids) > 0){ while ($kidRow = mysql_fetch_assoc ($kids)){ $this->linkTitle = $kidRow['name']; if(isset($this->arrUserData['is_wml'])){ $out .= ''.$kidRow['name']."
\n"; }else{ $out .= '\n"; } } } } $out .= '';//ads return $out; } private function ListingCard(){ $out = ''; $this->pid = (isset($this->pid))? $this->pid : 0; $q = mysql_query('SELECT id, title, description, url FROM listings WHERE category = "'.$this->row['id'].'" ORDER BY title '); $numRes = mysql_num_rows ($q); $q = mysql_query('SELECT id, cid, title, description, url FROM listings WHERE category = "'.$this->row['id'].'" ORDER BY title LIMIT '.($this->pid).', '.($this->recordsPerPage * $this->pageRange)); $numRows = mysql_num_rows ($q); if ($numRows > 0){ while($row = mysql_fetch_array($q, MYSQL_ASSOC)){ $listRow[] = array( 'id' => $row['id'], 'cid' => $row['cid'], 'title' => $row['title'], 'description' => $row['description'], 'url' => $row['url'] ); } $this->description = $this->row['name'].' Download: '; for ( $a = 0; $a < $this->recordsPerPage; $a++) { if(isset($listRow[$a]['cid'])){ $rslt = mysql_query('SELECT title FROM listings WHERE title LIKE "%'.$listRow[$a]['title'].'%"'); $numRslts = mysql_num_rows ($rslt); if($numRslts > 0){ while ($row = mysql_fetch_assoc ($rslt)){ $fileName = str_replace( array(':', ') ', ' (', '_', ' ', '(', ')', '!', '-', '`', '~', '@', '#', '$', '%', '^', '&', '*', '[', ']', '\'', '\"', '.', ',', '<', '>', '?', '=', '+', '|', '\/'), array('', '', '', '_', '_', '_', '_', '_', '', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_'), $row['title'] ); $fileName = 'java_game_'.(strtolower($fileName)).'.jpg'; } }else{ echo 'Error, can not get Image file Names'; die(); } $pageName = str_replace(" ", "_", stripslashes($listRow[$a]['title'])); if(isset($this->arrUserData['is_wml'])){ $out .= '



'.stripslashes($listRow[$a]['title']).'
'; $out .= '
'; $out .= 'more info about '.stripslashes($listRow[$a]['title']).' game

'."\n"; }else{ $out .= '

game mobile phone

'.stripslashes ($listRow[$a]['title']).'


'; $out .= 'Download now
'; $out .= 'more info about
'.stripslashes($listRow[$a]['title']).'
game
'."\n"; } $this->description .= ($a!=0)? ', '.stripslashes($listRow[$a]['title']) : stripslashes($listRow[$a]['title']); } } $type = (isset($this->arrUserData['is_wml']))? 'wml' : 'html'; $paginate = new Paginate($this->recordsPerPage, $numRes, $this->domainRoot.stripslashes($this->subPath).'/', 2, $this->pid, $type); if(isset($this->arrUserData['is_wml'])){ $out .= '

'.$paginate->displayTable().'

'; }else{ $out .= '
'.$paginate->displayTable().'
'; } } $catName = (isset($this->arrCats[2])) ? $this->arrCats[1].' '.$this->row['name'] : $catName = $this->row['name'] ; $currentPage = ($this->pid !== 0)? ' | Page '.( ($this->pid+$this->recordsPerPage)/$this->recordsPerPage ).' | ' : ' | '; $this->title = ($this->row['id'] != 1)? $catName.' Download'.$currentPage.'Download '.$this->arrCats[1].' Games for Mobile Phone' : $this->title; $this->keyWords = ($this->row['id'] != 1)? (strtolower($this->row['name'])).', mobile java games, cell phone games, download games, mobile downloads' : $this->keyWords; return $out; } private function RenderTemplate(){ $wapTemplate = (isset($this->arrUserData['is_wml']))? file_get_contents($this->wmlTemplatePath) : file_get_contents($this->xhtmlTemplatePath) ; $wapTemplate = str_replace(array( '###DOCTYPE###', '###TITLE###', '###HEAD###', '###NAVIGATION###', '###MENU###', '###LISTING###', '###GAME_LISTING###', '###KEYWORDS###', '###DESCRIPTION###', '###SEARCH_CARD###', '###FORM_ACTION###', '###DOWNLOAD_CARD###', '###PHONES_CARD###', '###VENDORS_CARD###', '###PHONES_LISTING###', '###GAME_DOWNLOADS###', '###MOBPARTNER_GAMELOFT_ADS###', '###MOBPARTNER_IPHONE_ADS###' ), array( $this->arrUserData['doctype'], $this->title, $this->headerCard, $this->navigationCard, $this->menuCard, $this->listingCard, $this->gameCard, $this->keyWords, $this->description, $this->searchCard, $this->domainRoot, $this->downloadCard, $this->phonesCard, $this->vendorsCard, $this->phonesListingCard, $this->gameDownloadsCard, $this->gameLoftAds, $this->IphoneAds ), $wapTemplate); return $wapTemplate; } private function SanitizeDBInput($string){ if(function_exists('mysql_real_escape_string')){ if(get_magic_quotes_gpc()){ $string = stripslashes($string); } $string = mysql_real_escape_string($string); }elseif(function_exists('mysql_escape_string')){ if(get_magic_quotes_gpc()){ $string = stripslashes($string); } $string = mysql_escape_string($string); }else{ $string = addslashes($string); } return $string; } private function GetImageProperties($imagePath){ $size = @getimagesize($imagePath); return array('width' => $size[0], 'height' => $size[1]); } private function ADS(){ $ads = false; $iphoneAds = false; //----------------------------------------------------------ADMOB--------------------------------------------------------------------------------- $admob_params = array( 'PUBLISHER_ID' => 'a14ae9644e6abfe', // Required to request ads. To find your Publisher ID, log in to your AdMob account and click on the "Sites & Apps" tab. 'ANALYTICS_ID' => 'a14ae965ba1684e', // Required to collect Analytics data. To find your Analytics ID, log in to your Analytics account and click on the "Edit" link next to the name of your site. 'AD_REQUEST' => true, // To request an ad, set to TRUE. 'ANALYTICS_REQUEST' => true, // To enable the collection of analytics data, set to TRUE. 'TEST_MODE' => false, // While testing, set to TRUE. When you are ready to make live requests, set to FALSE. // Additional optional parameters are available at: http://developer.admob.com/wiki/AdCodeDocumentation 'OPTIONAL' => array() ); $this->adMobAds = $this->admob_request($admob_params); //-------------------------------------------------------IPHONE-MOBPARTNER----------------------------------------------------------------------------- $iphoneBrowser = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone"); if($iphoneBrowser == true){ $iphoneAds .= '
'; $iphoneAds .= 'App Store:'.'
'; $iphoneAds .= 'Clic here'; $iphoneAds .= '
'; $iphoneAds .= 'Top Paid Apps:'.'
'; $iphoneAds .= 'Clic here'; $iphoneAds .= '
'; $iphoneAds .= 'iTunes - Albums & Musics:'.'
'; $iphoneAds .= 'Clic here'; $iphoneAds .= '
'; $iphoneAds .= 'iTunes Top Singles:'.'
'; $iphoneAds .= 'Clic here'; $iphoneAds .= '
'; $iphoneAds .= 'iTunes Top Albums:'.'
'; $iphoneAds .= 'Clic here'; $iphoneAds .= '
'; $iphoneAds .= 'Top Profitable Apps:'.'
'; $iphoneAds .= 'Clic here'; } $this->IphoneAds = (isset($iphoneAds))? $iphoneAds : false ; //-------------------------------------------------------GAMELOFT-MOBPARTNER------------------------------------------------------------------------------ switch($this->arrUserData['country_name']){ case 'France' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Jeu mobile OFFERT a choisir ICI !'; break; case 'Germany' : $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; $ads .= '
'; $ads .= 'Clic here'; break; case 'Belgium' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Jeu mobile GRATUIT avec le Gameloft Club !'; break; case 'Colombia' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '?Juego GRATIS! Clic Aqui!'; break; case 'India' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Indonesia' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Italy' : $ads .= 'Clic here'; $ads .= '
'; $ads .= 'Scarica ora i migliori giochi mobile! Clicca qui!'; break; case 'Netherlands' : $ads .= 'Clic here'; $ads .= '
'; $ads .= 'Games op je Mobiel? 1 GRATIS! Klik hier'; break; case 'Norway' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Philippines' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'South Africa' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Spain' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '?Juego GRATIS! Clic Aqui!'; break; case 'Sweden' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Austria' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Denmark' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Finland' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Poland' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Portugal' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Estonia' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Ireland' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Lithuania' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Hong Kong' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Brunei Darussalam' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Singapore' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Thailand' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Brazil' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Ecuador' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Mexico' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Bolivia' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Guatemala' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Honduras' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Peru' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Malaysia' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Switzerland' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Turkey' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Chile' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; case 'Argentina' : $ads .= 'Clic here'; $ads .= '
'; $ads .= '1 Mobile Game from Gameloft for FREE! Click here!'; break; } $this->gameLoftAds = (isset($ads))? $ads : false ; } private function admob_request($admob_params) { static $pixel_sent = false; $ad_mode = false; if (!empty($admob_params['AD_REQUEST']) && !empty($admob_params['PUBLISHER_ID'])) $ad_mode = true; $analytics_mode = false; if (!empty($admob_params['ANALYTICS_REQUEST']) && !empty($admob_params['ANALYTICS_ID']) && !$pixel_sent) $analytics_mode = true; $protocol = 'http'; if (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off') $protocol = 'https'; $rt = $ad_mode ? ($analytics_mode ? 2 : 0) : ($analytics_mode ? 1 : -1); if ($rt == -1) return ''; list($usec, $sec) = explode(' ', microtime()); $params = array('rt=' . $rt, 'z=' . ($sec + $usec), 'u=' . urlencode($_SERVER['HTTP_USER_AGENT']), 'i=' . urlencode($_SERVER['REMOTE_ADDR']), 'p=' . urlencode("$protocol://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']), 'v=' . urlencode('20081105-PHPCURL-acda0040bcdea222')); $sid = empty($admob_params['SID']) ? session_id() : $admob_params['SID']; if (!empty($sid)) $params[] = 't=' . md5($sid); if ($ad_mode) $params[] = 's=' . $admob_params['PUBLISHER_ID']; if ($analytics_mode) $params[] = 'a=' . $admob_params['ANALYTICS_ID']; if (!empty($_COOKIE['admobuu'])) $params[] = 'o=' . $_COOKIE['admobuu']; if (!empty($admob_params['TEST_MODE'])) $params[] = 'm=test'; if (!empty($admob_params['OPTIONAL'])) { foreach ($admob_params['OPTIONAL'] as $k => $v) { $params[] = urlencode($k) . '=' . urlencode($v); } } $ignore = array('HTTP_PRAGMA' => true, 'HTTP_CACHE_CONTROL' => true, 'HTTP_CONNECTION' => true, 'HTTP_USER_AGENT' => true, 'HTTP_COOKIE' => true); foreach ($_SERVER as $k => $v) { if (substr($k, 0, 4) == 'HTTP' && empty($ignore[$k]) && isset($v)) { $params[] = urlencode('h[' . $k . ']') . '=' . urlencode($v); } } $post = implode('&', $params); $request = curl_init(); $request_timeout = 1; // 1 second timeout curl_setopt($request, CURLOPT_URL, 'http://r.admob.com/ad_source.php'); curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); curl_setopt($request, CURLOPT_TIMEOUT, $request_timeout); curl_setopt($request, CURLOPT_CONNECTTIMEOUT, $request_timeout); curl_setopt($request, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded', 'Connection: Close')); curl_setopt($request, CURLOPT_POSTFIELDS, $post); list($usec_start, $sec_start) = explode(' ', microtime()); $contents = curl_exec($request); list($usec_end, $sec_end) = explode(' ', microtime()); curl_close($request); if ($contents === true || $contents === false) $contents = ''; if (!$pixel_sent) { $pixel_sent = true; $contents .= "'; } return $contents; } } $CATALOG = new CATALOG; ?>