Пример #1
0
    $_SESSION['ref_uri2'] = $from_prj;
}
$redirectUriPlain = urldecode($_SESSION['ref_uri']);
if ($hash = __paramInit('string', 'hash', 'hash')) {
    if (in_array($_user_action, array('add_vacancy', 'add_project'))) {
        $kind = $_user_action == 'add_vacancy' ? 4 : 1;
        $redirectUriPlain = '/public/?step=1&kind=' . $kind;
    }
    if (strpos($redirectUriPlain, 'hash=') === false) {
        $redirectUriPlain .= (strpos($redirectUriPlain, '?') === false ? '?' : '&') . 'hash=' . $hash;
    }
}
$redirectUri = urlencode($redirectUriPlain);
$action = __paramInit('string', null, 'action');
$registration = new registration();
$registration->listenerAction($action);
$action = $registration->getNextAction();
if ($requestedRole == "empl") {
    $registration->role = registration::ROLE_EMPLOYER;
}
if (__paramInit('string', null, 'action') != 'registration' || $registration->error['captcha'] && __paramInit('string', null, 'action') == 'registration') {
    unset($_SESSION['reg_captcha_num']);
    $registration->setFieldInfo('captchanum', uniqid('', true));
    $captcha = new captcha($registration->captchanum);
    $captcha->setNumber();
} else {
    $registration->setFieldInfo('captchanum', $_SESSION['reg_captcha_num']);
    $captcha = new captcha($registration->captchanum);
}
unset($_SESSION['login_generated']);
// Пользовательское сообщение (Alert)
 /**
  * Обрабатывает POST переменную action  и  возвращает null или данные.
  *
  * @return string
  */
 public function processRequest()
 {
     $expire = 1;
     //3600;
     $action = __paramInit('string', '', 'action');
     switch ($action) {
         case 'getdays':
             $days = array(1 => iconv('WINDOWS-1251', 'UTF-8//IGNORE', '1 день'));
             $max = __paramInit('integer', '', 'max', 1);
             $all = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 14, 21, 30, 45, 60, 90);
             if ($max > 1) {
                 $days = array();
                 foreach ($all as $day) {
                     if ($day >= $max) {
                         break;
                     }
                     $days[$day] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $day . ending($day, ' день', ' дня', ' дней'));
                 }
             }
             $days = array(array('parentId' => '0'), $days);
             return json_encode($days);
             break;
         case 'gettucategories':
             $expire = 300;
             //3600;
             $membuf = new memBuff();
             $memkey = 'b-combo-gettucategories';
             $result = $membuf->get($memkey);
             if (!$result) {
                 /*
                  * Получаем из базы иерархию категорий для
                  * типовой услуги
                  */
                 $DB = new DB('master');
                 $sql = 'SELECT 
                             g.id AS gid, 
                             g.title AS gname, 
                             g.ucnt AS gucnt, 
                             p.id AS pid, 
                             p.title AS name,
                             p.ucnt AS pucnt
                          FROM tservices_categories AS g 
                          INNER JOIN tservices_categories AS p ON p.parent_id = g.id 
                          ORDER BY g.ucnt DESC, p.ucnt DESC --gid, pid --g.n_order, p.n_order';
                 $rows = $DB->rows($sql);
                 $result = array();
                 if (count($rows)) {
                     foreach ($rows as $k => $i) {
                         if ($result[$i['gid']] === null) {
                             $result[$i['gid']] = array('0' => array(iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['gname']), $i['gucnt']));
                             if ($i['pid'] !== null) {
                                 $result[$i['gid']][$i['pid']] = array(iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['name']), $i['pucnt']);
                             } else {
                                 $result[$i['gid']] = array(iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['gname']), $i['gucnt']);
                             }
                         } elseif (is_array($result[$i['gid']])) {
                             $result[$i['gid']][$i['pid']] = array(iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['name']), $i['pucnt']);
                         }
                     }
                 }
                 //print_r($result);
                 //exit;
                 $result = json_encode($result);
                 $membuf->add($memkey, $result, $expire);
             }
             return $result;
             break;
         case 'getlettergrouplist':
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/letters.php';
             $lettergroups = letters::getGroups($_POST['word'], (int) $_POST['limit']);
             $result = array();
             $n = 0;
             foreach ($lettergroups as $k => $i) {
                 $result[$n]['uid'] = $i['id'];
                 $result[$n]['uname'] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['title']);
                 $result[$n]['usurname'] = '';
                 $result[$n]['login'] = '';
                 $result[$n]['photo'] = '';
                 $result[$n]['path'] = '';
                 $result[$n]['isContacts'] = '';
                 ++$n;
             }
             $list = array();
             $list['list'] = $result;
             $list['counters']['moreContacts'] = 0;
             $list['counters']['moreUsers'] = 0;
             $list['dav'] = WDCPREFIX;
             return json_encode($list);
             break;
         case 'getlettergroupinfo':
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/letters.php';
             $group = letters::getGroup($_POST['uid']);
             if ($group) {
                 $data = array('record' => array('uid' => $group['id'], 'uname' => iconv('WINDOWS-1251', 'UTF-8//IGNORE', $group['title']), 'usurname' => '', 'login' => '', 'photo' => '', 'path' => '', 'isContacts' => ''), 'found' => 1, 'dav' => WDCPREFIX);
             }
             return json_encode($data);
             break;
         case 'getletterdocinfo':
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/letters.php';
             $doc = letters::getDocument($_POST['uid']);
             if ($doc) {
                 $data = array('record' => array('uid' => $doc['id'], 'uname' => iconv('WINDOWS-1251', 'UTF-8//IGNORE', $doc['id'] . ' ' . htmlspecialchars($doc['group_title']) . ' - ' . htmlspecialchars($doc['title'])), 'usurname' => '', 'login' => '', 'photo' => '', 'path' => '', 'isContacts' => ''), 'found' => 1, 'dav' => WDCPREFIX);
             }
             return json_encode($data);
             break;
         case 'getletterdoclist':
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/letters.php';
             $letterdocs = letters::getDocuments($_POST['word'], (int) $_POST['limit']);
             $result = array();
             $n = 0;
             foreach ($letterdocs as $k => $i) {
                 $result[$n]['uid'] = $i['id'];
                 $result[$n]['uname'] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['id'] . ' ' . htmlspecialchars($i['group_title']) . ' - ' . htmlspecialchars($i['title']));
                 $result[$n]['usurname'] = '';
                 $result[$n]['login'] = '';
                 $result[$n]['photo'] = '';
                 $result[$n]['path'] = '';
                 $result[$n]['isContacts'] = '';
                 ++$n;
             }
             $list = array();
             $list['list'] = $result;
             $list['counters']['moreContacts'] = 0;
             $list['counters']['moreUsers'] = 0;
             $list['dav'] = WDCPREFIX;
             return json_encode($list);
             break;
         case 'getletterdocsearch':
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/letters.php';
             $letterdocs = letters::getSearchDocuments($_POST['word'], (int) $_POST['limit']);
             $result = array();
             $n = 0;
             foreach ($letterdocs as $k => $i) {
                 $result[$n]['uid'] = $i['id'];
                 $result[$n]['uname'] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['id'] . ' ' . htmlspecialchars($i['group_title']) . ' - ' . htmlspecialchars($i['title']));
                 $result[$n]['usurname'] = '';
                 $result[$n]['login'] = '';
                 $result[$n]['photo'] = '';
                 $result[$n]['path'] = '';
                 $result[$n]['isContacts'] = '';
                 ++$n;
             }
             $list = array();
             $list['list'] = $result;
             $list['counters']['moreContacts'] = 0;
             $list['counters']['moreUsers'] = 0;
             $list['dav'] = WDCPREFIX;
             return json_encode($list);
             break;
         case 'getdate':
             return date('Y-m-d');
         case 'getprofgroups':
             $membuf = new memBuff();
             $memkey = 'b-combo-getprofgroups';
             $result = $membuf->get($memkey);
             if (!$result) {
                 $rows = professions::GetAllGroupsLite();
                 $result = array();
                 foreach ($rows as $k => $i) {
                     $result[$i['id']] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['name']);
                 }
                 $membuf->add($memkey, $result, $expire);
             }
             return json_encode($result);
         case 'getprofessionsandgroups':
             $membuf = new memBuff();
             $memkey = 'b-combo-getprofandgroups';
             $result = $membuf->get($memkey);
             if (!$result) {
                 $rows = professions::GetProfessionsAndGroup();
                 $result = array();
                 foreach ($rows as $k => $i) {
                     if ($result[$i['gid']] === null) {
                         $result[$i['gid']] = array($i['gid'] => iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['gname']));
                         if ($i['id'] !== null) {
                             $result[$i['gid']][$i['id']] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['name']);
                         } else {
                             $result[$i['gid']] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['gname']);
                         }
                     } elseif (is_array($result[$i['gid']])) {
                         $result[$i['gid']][$i['id']] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['name']);
                     }
                 }
                 $membuf->add($memkey, $result, $expire);
             }
             return json_encode($result);
         case 'getprofessions':
             $n = __paramInit('integer', '', 'id');
             if ($n !== false) {
                 $membuf = new memBuff();
                 $memkey = "b-combo-getprofbygroup{$n}";
                 $result = $membuf->get($memkey);
                 if (!$result) {
                     $rows = professions::GetProfs($n);
                     $result = array(0 => iconv('WINDOWS-1251', 'UTF-8//IGNORE', 'Все специальности'));
                     foreach ($rows as $k => $i) {
                         $result[$i['id']] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['name']);
                     }
                     $membuf->add($memkey, $result, $expire);
                 }
                 $data = array(array('parentId' => "{$n}"), $result);
                 return json_encode($data);
             }
         case 'get_pro_types':
             $membuf = new memBuff();
             $memkey = 'b-combo-get_pro_type';
             $result = $membuf->get($memkey);
             if (!$result) {
                 $rows = op_codes::getCodes(array(47, 48, 49, 50, 51));
                 $result = array();
                 foreach ($rows as $k => $i) {
                     $result[$i['id']] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['op_name']);
                 }
                 $result[76] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', 'На несколько недель');
                 $membuf->add($memkey, $result, $expire);
             }
             return json_encode($result);
         case 'getcountries':
         case 'getrelevantcountries':
             $membuf = new memBuff();
             $memkey = 'b-combo-getcountriesr';
             $result = $membuf->get($memkey);
             if (!$result) {
                 $rows = country::GetCountriesByCountUser();
                 $result = array();
                 foreach ($rows as $k => $i) {
                     $result[$i['id']] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['name']);
                 }
                 $membuf->add($memkey, $result, $expire);
             }
             return json_encode($result);
         case 'getcities':
             $n = __paramInit('integer', '', 'id');
             if ($n !== false) {
                 $membuf = new memBuff();
                 $memkey = "b-combo-getcitybycountry{$n}";
                 $result = $membuf->get($memkey);
                 if (!$result) {
                     $rows = city::GetCities($n);
                     $result = array('0' => iconv('WINDOWS-1251', 'UTF-8//IGNORE', 'Все города'));
                     if (is_array($rows)) {
                         foreach ($rows as $k => $i) {
                             $result[$k] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i);
                         }
                     }
                     $membuf->add($memkey, $result, $expire);
                 }
                 $data = array(array('parentId' => "{$n}"), $result);
                 return json_encode($data);
             }
         case 'getcitiesbyid':
             $n = __paramInit('integer', '', 'id');
             if ($n !== false) {
                 $membuf = new memBuff();
                 $memkey = "b-combo-getcitybycountry{$n}";
                 $result = $membuf->get($memkey);
                 if (!$result) {
                     $rows = city::GetCities($n);
                     $result = array('0' => iconv('WINDOWS-1251', 'UTF-8//IGNORE', 'Все города'));
                     foreach ($rows as $k => $i) {
                         $result[$k] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i);
                     }
                     $membuf->add($memkey, $result, $expire);
                 }
                 return json_encode($result);
             }
         case 'getuserlistbysbr':
         case 'getuserlistold':
         case 'getuserlist':
             return $this->getUsersList($_POST['word'], (int) $_POST['limit'], (int) $_POST['userType'], (int) $_POST['scope']);
         case 'get_user_info':
             return json_encode(users::GetUserShortInfo((int) $_POST['uid']));
         case 'getusersandcompanies':
             return $this->getUsersAndCompany($_POST['word'], (int) $_POST['limit'], (int) $_POST['userType'], (int) $_POST['scope'], false);
         case 'get_user_or_company_info':
             return $this->getUserOrCompanyRecord();
         case 'getsms':
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/registration.php';
             $registration = new registration();
             $registration->listenerAction(__paramInit('string', null, 'action'));
     }
     return false;
 }
Пример #3
0
    if (!empty($_GET['u'])) {
        if ($_GET['u'] == 'frl') {
            $role = wizard_registration::REG_FRL_ID;
        }
        if ($_GET['u'] == 'emp') {
            $role = wizard_registration::REG_EMP_ID;
        }
    }
    if ($role) {
        $wizard = new wizard();
        setcookie($wizard->getCookieName('uid') . $role, preg_replace('/[^a-z0-9]/', '', $_GET['m']), time() + 3600 * 24 * 180, '/', $GLOBALS['domain4cookie']);
        if ($role == wizard_registration::REG_FRL_ID) {
            setcookie($wizard->getCookieName('step') . $role, step_freelancer::STEP_REGISTRATION_CONFIRM, time() + 3600 * 24 * 180, '/', $GLOBALS['domain4cookie']);
        }
        if ($role == wizard_registration::REG_EMP_ID) {
            setcookie($wizard->getCookieName('step') . $role, step_employer::STEP_REGISTRATION_CONFIRM, time() + 3600 * 24 * 180, '/', $GLOBALS['domain4cookie']);
        }
    }
}
$registration = new registration();
if ($registration->validActivateCode(__paramInit('string', 'code'))) {
    $code = true;
    $registration->listenerAction('activate_account');
} else {
    $code = false;
}
$header = "../header.php";
$footer = "../footer.html";
$content = "tpl.activate.php";
$js_file = array('/scripts/wizard/wizard.js');
include "../template2.php";
Пример #4
0
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stdf.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/registration.php';
session_start();
$uid = get_uid(false);
$validUser = true;
if ($uid) {
    if ($_SESSION['role'][0] == 1 && $_SESSION['requestedRole'] == 'empl' || $_SESSION['role'][0] == 0 && $_SESSION['requestedRole'] != 'empl') {
        $validUser = false;
    } else {
        $validUser = true;
    }
} else {
    if (empty($_SESSION['email'])) {
        $validUser = false;
    }
}
// Зарегистрированным пользователям доступ к странице закрыт пользователи которые не регистрировались в текущей сессии тоже
if (!$validUser) {
    include $_SERVER['DOCUMENT_ROOT'] . '/403.php';
    exit;
}
$registration = new registration();
$registration->listenerAction(__paramInit('string', null, 'action'));
$is_suspect = isset($_SESSION['suspect']) ? $_SESSION['suspect'] : false;
$no_attempts = isset($_SESSION['activate_resend_attempts']) && $_SESSION['activate_resend_attempts'] == 0;
$allow_resend_mail = !$is_suspect && !$no_attempts;
$header = '../header.php';
$footer = '../footer.html';
$content = 'tpl.complete.php';
$js_file = array('registration/complete.js');
include '../template2.php';