Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] authored and [email protected] committed Oct 15, 2013
0 parents commit 0979224
Show file tree
Hide file tree
Showing 111 changed files with 4,323 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?url=$1 [PT,L]

</IfModule>
18 changes: 18 additions & 0 deletions MVC/controllers/console/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

class IndexController extends Controller {

public function index($change=0){
$data = array();
$data['title'] = 'Home';


renderView('header', $data);
echo '<body class="page-main">';
renderView('clientMenu', $data);
renderView('pages/console/index', $data);
renderView('footer', $data);
}


}
21 changes: 21 additions & 0 deletions MVC/controllers/en/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

class IndexController extends Controller {

public function index(){
$data = array();
$data['title'] = 'FlyBill SMS Billing';

HTML::setUserLanguage('en');
$data['newGuest']=false;
$data['locale']='en_EN';

renderView('header', $data);
echo '<body class="page-main">';
renderView('menu_en', $data);
renderView('pages/en/index', $data);
renderView('footer_en', $data);
}


}
13 changes: 13 additions & 0 deletions MVC/controllers/en/price.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

class PriceController extends Controller {

public function getNumbers($country){
echo Numbers::getNumbersByCountryJSON($country);
}

public function getPrices($number){
echo Prices::getPricesJSON($number);
}

}
22 changes: 22 additions & 0 deletions MVC/controllers/en/services/mosubscriptions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

class MosubscriptionsController extends Controller {

public function index($change=0){
$data = array();
$data['title'] = 'Pseudo SMS Subscriptions';

HTML::setUserLanguage('en');
$data['newGuest']=false;
$data['locale']='en_EN';

$data['countries'] = Countries::getExCountries()->fetchAll();
renderView('header', $data);
echo '<body class="page-inner">';
renderView('menu_en', $data);
renderView('pages/en/services/mosubscriptions', $data);
renderView('footer_en', $data);
}


}
21 changes: 21 additions & 0 deletions MVC/controllers/en/services/mtsubscriptions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

class MtsubscriptionsController extends Controller {

public function index($change=0){
$data = array();
$data['title'] = 'MT SMS Subscriptions';

HTML::setUserLanguage('en');
$data['newGuest']=false;
$data['locale']='en_EN';

renderView('header', $data);
echo '<body class="page-inner">';
renderView('menu_en', $data);
renderView('pages/en/services/mtsubscriptions', $data);
renderView('footer_en', $data);
}


}
22 changes: 22 additions & 0 deletions MVC/controllers/en/services/premium.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

class PremiumController extends Controller {

public function index($change=0){
$data = array();
$data['title'] = 'Premium SMS';

HTML::setUserLanguage('en');
$data['newGuest']=false;
$data['locale']='en_EN';

$data['countries'] = Countries::getExCountries()->fetchAll();
renderView('header', $data);
echo '<body class="page-inner">';
renderView('menu_en', $data);
renderView('pages/en/services/premium', $data);
renderView('footer_en', $data);
}


}
22 changes: 22 additions & 0 deletions MVC/controllers/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

class IndexController extends Controller {

public function index($change=0){
$data = array();
$data['title'] = 'FlyBill СМС Биллинг';

HTML::setUserLanguage('ru');
$data['newGuest']=false;
$data['locale']='ru_RU';


renderView('header', $data);
echo '<body class="page-main">';
renderView('menu', $data);
renderView('pages/index', $data);
renderView('footer', $data);
}


}
13 changes: 13 additions & 0 deletions MVC/controllers/price.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

class PriceController extends Controller {

public function getNumbers($country){
echo Numbers::getNumbersByCountryJSON($country);
}

public function getPrices($number){
echo Prices::getPricesJSON($number);
}

}
22 changes: 22 additions & 0 deletions MVC/controllers/services/mosubscriptions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

class MosubscriptionsController extends Controller {

public function index($change=0){
$data = array();
$data['title'] = 'Псевдо подписки СМС';

HTML::setUserLanguage('ru');
$data['newGuest']=false;
$data['locale']='ru_RU';

$data['countries'] = Countries::getExCountries()->fetchAll();
renderView('header', $data);
echo '<body class="page-inner">';
renderView('menu', $data);
renderView('pages/services/mosubscriptions', $data);
renderView('footer', $data);
}


}
21 changes: 21 additions & 0 deletions MVC/controllers/services/mtsubscriptions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

class MtsubscriptionsController extends Controller {

public function index($change=0){
$data = array();
$data['title'] = 'МТ подписки СМС';

HTML::setUserLanguage('ru');
$data['newGuest']=false;
$data['locale']='ru_RU';

renderView('header', $data);
echo '<body class="page-inner">';
renderView('menu', $data);
renderView('pages/services/mtsubscriptions', $data);
renderView('footer', $data);
}


}
22 changes: 22 additions & 0 deletions MVC/controllers/services/premium.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

class PremiumController extends Controller {

public function index($change=0){
$data = array();
$data['title'] = 'Премиум СМС';

HTML::setUserLanguage('ru');
$data['newGuest']=false;
$data['locale']='ru_RU';

$data['countries'] = Countries::getExCountries()->fetchAll();
renderView('header', $data);
echo '<body class="page-inner">';
renderView('menu', $data);
renderView('pages/services/premium', $data);
renderView('footer', $data);
}


}
34 changes: 34 additions & 0 deletions MVC/models/countries.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

class Countries extends Model
{

public static function getCountries(){
global $db;
$stmt = $db->prepare("
SELECT * FROM `countries`
");
$stmt->execute();
if($stmt->rowCount()>0){
$stmt->setFetchMode(PDO::FETCH_ASSOC);
} else {
$stmt=FALSE;
}
return $stmt;
}

public static function getExCountries(){
global $db;
$stmt = $db->prepare("
SELECT numbers.`country_id` AS `id`,countries.`name` FROM `numbers` numbers,`countries` countries WHERE numbers.`country_id`=countries.`id` group by `country_id`
");
$stmt->execute();
if($stmt->rowCount()>0){
$stmt->setFetchMode(PDO::FETCH_ASSOC);
} else {
$stmt=FALSE;
}
return $stmt;
}

}
84 changes: 84 additions & 0 deletions MVC/models/numbers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?php

class Numbers extends Model
{

public static function getNumbersByCountryJSON($country){
global $db;
$stmt = $db->prepare("
SELECT * FROM `numbers` WHERE `country_id`=:c ORDER BY `price` DESC
");
$stmt->execute( array(
'c' => $country
));
if($stmt->rowCount()>0){
$stmt->setFetchMode(PDO::FETCH_ASSOC);
} else {
$stmt=FALSE;
}
return json_encode($stmt->fetchAll());
}

public static function getNumbers(){
global $db;
$stmt = $db->prepare("
SELECT numbers.`id`, numbers.`number`, numbers.`preprefix`,numbers.`price`, numbers.`country_id`, numbers.`agregator_id`, countries.`name` AS `country`, agregators.`name` AS `agregator`
FROM `numbers` numbers , `countries` countries, `agregators` agregators
WHERE numbers.`country_id` = countries.`id` and numbers.`agregator_id` = agregators.`id`
ORDER BY numbers.`country_id`, numbers.`price` DESC
");
$stmt->execute();
if($stmt->rowCount()>0){
$stmt->setFetchMode(PDO::FETCH_ASSOC);
} else {
$stmt=FALSE;
}
return $stmt;
}

public static function addNumber(){
global $db;
$stmt = $db->prepare("
SELECT * FROM `numbers` WHERE `country_id`=:c and `number`=:n
");
$stmt->execute( array(
'c' => $_POST['country'],
'n' => $_POST['number']
));
if($stmt->rowCount()==0){
$data = array(
$_POST['number'],$_POST['price']*100,$_POST['agregator'],$_POST['country'],$_POST['preprefix']
);
$stmt = $db->prepare('
INSERT INTO `numbers`(`number`, `price`, `agregator_id`, `country_id`,`preprefix`) VALUES (?,?,?,?,?)
');
$stmt->execute($data);
}

}

public static function saveNumber(){
print_r($_POST);
global $db;
$data = array(
$_POST['price']*100,$_POST['agregator'],$_POST['country'],$_POST['number'],$_POST['preprefix'],$_POST['number']
);
$stmt = $db->prepare('
UPDATE `numbers` SET `price`=?,`agregator_id`=?,`country_id`=?,`number`=?,`preprefix`=? WHERE `number`=?
');
$stmt->execute($data);
}

public static function deleteNumber($id){
global $db;
$data = array(
$id
);
$stmt = $db->prepare('
DELETE FROM `numbers` WHERE `id`=?
');
$stmt->execute($data);
}


}
Loading

0 comments on commit 0979224

Please sign in to comment.