コード例 #1
0
ファイル: manage.php プロジェクト: Nikitian/fl-ru-damp
$name = trim($_GET['user']);
$user_obj = new users();
$user_obj->GetUser($name);
$is_owner = $user_obj->uid == $uid;
if (!$user_obj->uid || !($is_owner || $is_adm)) {
    header("Location: /404.php");
    exit;
}
//------------------------------------------------------------------------------
$tservice = new tservices($user_obj->uid);
$errors = array();
$is_exist_feedbacks = 0;
switch ($action) {
    case 'edit':
        $tuid = __paramInit('int', 'tuid', NULL, 0);
        if ($tuid <= 0 || !$tservice->getByID($tuid)) {
            header("Location: /404.php");
            exit;
        }
        if ($is_adm) {
            $tservice->is_angry = FALSE;
        }
        $action = __paramInit('string', NULL, 'action', '');
        if ($action == 'save' && $tuid == __paramInit('int', NULL, 'id', 0)) {
            $is_exist_feedbacks = $tservice->isExistFeedbacks($tuid);
            $errors = tu_validation($tservice, $is_exist_feedbacks);
            if (count($errors) == 0) {
                if ($tservice->update($tuid)) {
                    $sess_p = __paramInit('string', NULL, 'preview_sess', NULL);
                    if ($sess_p) {
                        $tservice->addAttachedFiles($sess_p, $tuid, true);