Ejemplo n.º 1
0
 /**
  * Just session init, if your app not using session place
  * ABTest::init() before headers sent
  *
  */
 public static function init($config)
 {
     DB::setConfig($config);
     if (session_status() !== PHP_SESSION_ACTIVE) {
         session_start();
     }
 }
Ejemplo n.º 2
0
 public function setConfig($CONFIG)
 {
     DB::setConfig($CONFIG["db"]);
     ChannelFactory::setConfig($CONFIG["channels"]);
     Auth::setConfig($CONFIG["auth"]);
     $this->CONFIG = $CONFIG;
 }
Ejemplo n.º 3
0
 public function __construct()
 {
     $this->loadConfig('config');
     $this->request = new Request();
     $this->router = new Router($this);
     $this->user = new User();
     DB::setConfig($this->loadConfig('db'));
 }
<?php

require_once dirname(__FILE__) . "/../fn.php";
require_once "req.php";
$CONFIG = (require dirname(__FILE__) . "/../config.php");
DB::setConfig($CONFIG["db"]);
DEBUG::start();
ob_implicit_flush(1);
mb_internal_encoding("UTF-8");
setlocale(LC_ALL, "ru_RU.UTF-8");
for ($i = 0; $i < 2; $i++) {
    $str = get_data(req("POST", "fotostrana.ru", "/mainpage/", array("cityId" => 0, "otherCity" => "", "search[gender]" => $i ? "w" : "m", "search[age]" => 0, "search[ageTo]=100")));
    $str = iconv("windows-1251", "utf-8", $str);
    preg_match_all("/pops.*?=\\s*[\"']([^\"']+)[\"']/i", $str, $ar);
    foreach ($ar[1] as $str) {
        $arr = explode("|", $str);
        $data = array("name" => $arr[0], "photo" => $arr[1], "age" => $arr[2], "city_name" => $arr[3], "about" => $arr[5], "photo_sq" => $arr[6]);
        if (preg_match("/user\\_\\d+\\/\\d+\\/(\\d+)\\./", $data["photo"], $m)) {
            $data["source_id"] = $m[1];
        } else {
            continue;
        }
        if ($rw = DB::f1("select * from users where source_id=:source_id", array("source_id" => $data["source_id"]))) {
            echo "user {$data['source_id']} {$data['name']} already added<br>\n";
            continue;
        }
        if ($rw = DB::f1("select id,country_id from geo_cities where name=:name", array("name" => $data["city_name"]))) {
            $data["city_id"] = $rw["id"];
            $data["country_id"] = $rw["country_id"];
        } else {
            continue;