Esempio n. 1
0
                 echo "window.parent.quickPRJ_process_continue();";
                 echo "</script>";
                 exit;
             }
         }
     }
 }
 $t_cats = $tmpPrj->getCategories();
 $is_edit = $tmpPrj->isEdit();
 if (!($error['buy'] = $tmpPrj->saveProject(hasPermissions('projects') ? $uid : NULL, $proj))) {
     //Если проект был создан при переходе с лендинга
     //то привязываем его для статистики
     if (!$is_edit) {
         if ($landingProjectId = getLastLandingProjectId()) {
             require_once ABS_PATH . '/classes/LandingProjects.php';
             LandingProjects::model()->linkWithProject($landingProjectId, $proj['id'], false);
         }
     }
     if (!$is_edit) {
         # Если есть раздел "Дизайн" среди выбранных
         $finded = 0;
         foreach ($t_cats as $cat) {
             if (in_array($cat['category_id'], array(3, 10, 11, 18))) {
                 $finded = $cat['category_id'];
                 break;
             }
         }
         if ($finded > 0) {
             $category_names = array(3 => 'Дизайн', 10 => 'Фотография', 11 => 'Аудио/Видео', 18 => 'Арт');
             $mail = new smtp();
             $mail->subject = 'Опубликуйте свой проект на Fotogazon.ru';
Esempio n. 2
0
/**
 * Проверка и фиксация проекта при переходе с лендинга
 * 
 * @return boolean
 */
function isLandingProject()
{
    //Если просто переход на публикацию проекта
    //то очищаем оставшийся ID перехода с лендинга
    if (empty($_POST)) {
        unset($_SESSION['landingProjectId']);
    }
    //Заполнение названия проекта при переходе с лендинга
    $name = __paramInit('striptrim', NULL, 'project_name', NULL);
    if ($name && !empty($name) && isset($_POST['hash']) && $_POST['hash'] === @$_SESSION['from_landing_hash'] && rtrim($_SERVER['HTTP_REFERER'], '/') === $GLOBALS['host']) {
        unset($_SESSION['from_landing_hash']);
        $_POST = array();
        require_once ABS_PATH . '/classes/LandingProjects.php';
        $_SESSION['landingProjectId'] = LandingProjects::model()->addLandingProject($name);
        return $name;
    }
    return false;
}
 public function doActivation($code)
 {
     $activation_data = $this->getActivation($code);
     if (!$activation_data) {
         return false;
     }
     $this->deleteActivation($code);
     $current_uid = get_uid(false);
     if ($current_uid) {
         require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/employer.php';
         $user = new employer();
         $user->GetUserByUID($current_uid);
         $status = 1;
     } else {
         require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/registration.php';
         $registration = new registration();
         $user_data = $registration->autoRegistationAndLogin(array('uid' => $activation_data['user_id'], 'role' => 1, 'email' => $activation_data['email'], 'uname' => $activation_data['uname'], 'usurname' => $activation_data['usurname']));
         if (!$user_data || !$user_data['ret']) {
             return self::REDIRECT_AUTH_FAIL;
         }
         $status = $user_data['ret'];
         $user = $user_data['user'];
     }
     $uid = $user->uid;
     $redirect = false;
     $data = $activation_data['data'];
     switch ($activation_data['type']) {
         case GuestConst::TYPE_PERSONAL_ORDER:
             $data['emp_id'] = $uid;
             require_once $_SERVER['DOCUMENT_ROOT'] . '/tu/models/TServiceOrderModel.php';
             $orderModel = TServiceOrderModel::model();
             if ($order = $orderModel->createPersonal($data)) {
                 $tservices_smail = new tservices_smail();
                 $tservices_smail->newOrder($order);
                 $redirect = sprintf(tservices_helper::url('order_card_url'), $order['id']);
             }
             break;
         case GuestConst::TYPE_VACANCY:
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php';
             $data['state'] = projects::STATE_MOVED_TO_VACANCY;
             $date_public = null;
             $redirect_layout = '/public/?step=1&kind=4&public=%s&popup=1';
         case GuestConst::TYPE_PROJECT:
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php';
             $key = md5(uniqid($uid));
             $tmpPrj = new tmp_project($key);
             $tmpPrj->initForUser($user);
             if (isset($data['IDResource']) && !empty($data['IDResource'])) {
                 require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/uploader/uploader.php';
                 $uploader = new uploader($data['IDResource']);
                 $attachedfiles_files = $uploader->getFiles();
                 $tmpPrj->clearAttaches();
                 $tmpPrj->addAttachedFiles($attachedfiles_files, false);
                 $uploader->clear();
             }
             if ($prj = $tmpPrj->addSimpleProject($data)) {
                 $_SESSION['new_public'] = 1;
                 $redirect = getFriendlyURL('project', $prj);
                 if (isset($redirect_layout)) {
                     $redirect = sprintf($redirect_layout, $prj['id']);
                 }
                 $src_id = $prj['id'];
                 //Если проект был создан при переходе с лендинга
                 //то привязываем его для статистики
                 if (isset($data['landingProjectId'])) {
                     require_once ABS_PATH . '/classes/LandingProjects.php';
                     LandingProjects::model()->linkWithProject($data['landingProjectId'], $src_id, !$activation_data['user_id']);
                 }
             }
             break;
     }
     //Обновляем приглашение
     if (isset($activation_data['invite_id']) && $activation_data['invite_id'] > 0) {
         $guestInviteModel = new GuestInviteModel();
         $guestInviteModel->updateDateComeInvite($activation_data['invite_id'], array('src_id' => isset($src_id) ? $src_id : null, 'date_public' => isset($date_public) ? $date_public : null));
     }
     //Мессага с паролями для новеньких
     if (!$activation_data['user_id'] && !$current_uid) {
         require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/Helpers/SubBarNotificationHelper.php';
         SubBarNotificationHelper::getInstance()->setMessage($activation_data['type'], array('login' => $user->login, 'password' => $user->passwd), $user->uid);
     } elseif ($status == users::AUTH_STATUS_2FA) {
         $_SESSION['ref_uri'] = $redirect;
         $redirect = '/auth/second/';
     }
     return $redirect;
 }