Example #1
0
            } else {
                $is_save = true;
            }
            if ($_POST['add_mod'] == 1 && count($error) <= 0) {
                header("Location: /users/{$_SESSION['login']}/opinions/#n_{$id_advice}");
                exit;
            }
            //}
        }
        if (!$advice) {
            header("Location: /404.php");
            exit;
        }
    } else {
        if ($edit > 0 && !get_uid(false)) {
            header("Location: /404.php");
            exit;
        }
    }
    if ($is_convert && isset($_POST['save'])) {
        header("Location: /users/{$_SESSION['login']}/opinions/?from=norisk&edit={$id_advice}");
    }
    if ($user->uid == $_SESSION['uid']) {
        $new_advices = $paid_advice->getAdvices($_SESSION['uid']);
    }
    $msgs = sbr::getUserFeedbacks($to_id, is_emp($user->role), $sort > 0 ? $sort : false, $period, true, false);
    $_user = new users();
    if (get_uid(0)) {
        $_user->GetUser($_SESSION['login']);
    }
}
Example #2
0
 /**
  * Возвращает часть ответа с отзывами о пользователе
  * 
  * @param  array $aData информация о отзывами о пользователе
  * @return array
  */
 private function _getUserOpinionsData($aData)
 {
     require_once ABS_PATH . '/classes/paid_advices.php';
     require_once ABS_PATH . '/classes/opinions.php';
     require_once ABS_PATH . '/classes/sbr_meta.php';
     require_once ABS_PATH . '/classes/sbr.php';
     $aReturn = array();
     $msgs = sbr::getUserFeedbacks($aData['uid'], is_emp($aData['role']), false, 0, false, false);
     // рекомендации
     $msgs2 = opinions::GetMsgs($aData['uid'], null, null, null, $error, 'users', false, 0, 0);
     // мнения
     if (is_array($msgs) && $msgs) {
         foreach ($msgs as $theme) {
             $oUser = new users();
             $oUser->GetUserByUID($theme['fromuser_id']);
             $taData = array();
             $taClassVars = array_keys(get_class_vars('users'));
             foreach ($taClassVars as $sVar) {
                 $taData[$sVar] = $oUser->{$sVar};
             }
             if (!is_emp($taData['role'])) {
                 require_once ABS_PATH . '/classes/freelancer.php';
                 $aTmp = freelancer::getFreelancerByLogin(array($taData['login']));
                 $taData['spec'] = $aTmp[0]['spec'];
             }
             $aReturn[] = array("id" => $theme['id'], 'type' => $theme['is_payed'] ? 2 : 1, "from_user_id" => $theme['fromuser_id'], "to_user_id" => $theme['touser_id'], "rate" => $theme['sbr_rating'], "text" => $theme['descr'] ? iconv('cp1251', 'utf-8', $theme['descr']) : '', "status" => 1, "create_time" => strtotime($theme['posted_time']), "update_time" => $theme[''], "user" => $this->_getUserData($taData));
         }
     }
     if (is_array($msgs2) && $msgs2) {
         foreach ($msgs2 as $opinion) {
             $oUser = new users();
             $oUser->GetUserByUID($opinion['fromuser_id']);
             $taData = array();
             $taClassVars = array_keys(get_class_vars('users'));
             foreach ($taClassVars as $sVar) {
                 $taData[$sVar] = $oUser->{$sVar};
             }
             if (!is_emp($taData['role'])) {
                 require_once ABS_PATH . '/classes/freelancer.php';
                 $aTmp = freelancer::getFreelancerByLogin(array($taData['login']));
                 $taData['spec'] = $aTmp[0]['spec'];
             }
             $aReturn[] = array("id" => $opinion['id'], 'type' => 2, "from_user_id" => $opinion['fromuser_id'], "to_user_id" => $opinion['touser_id'], "rate" => $opinion['rating'], "text" => $opinion['msgtext'] ? iconv('cp1251', 'utf-8', $opinion['msgtext']) : '', "status" => 1, "create_time" => strtotime($opinion['post_time']), "update_time" => $opinion['modified'] ? strtotime($opinion['modified']) : 0, "user" => $this->_getUserData($taData));
         }
     }
     return $aReturn;
 }