예제 #1
0
    $stb_groups = new StbGroup();
    $member = $stb_groups->getMemberByUid(intval($_GET['id']));
    if (empty($member)) {
        $stb_groups->addMember(array('mac' => Middleware::normalizeMac($_POST['mac']), 'uid' => Middleware::getUidByMac($_POST['mac']), 'stb_group_id' => $_POST['group_id']));
    } else {
        $stb_groups->setMember(array('stb_group_id' => $_POST['group_id']), $member['id']);
    }
    header("Location: profile.php?id=" . @$_GET['id']);
    exit;
}
if (@$_POST['account']) {
    Admin::checkAccess(AdminAccess::ACCESS_EDIT);
    $stb_groups = new StbGroup();
    $member = $stb_groups->getMemberByUid(intval($_GET['id']));
    if (empty($member)) {
        $stb_groups->addMember(array('mac' => Middleware::normalizeMac($_POST['mac']), 'uid' => Middleware::getUidByMac($_POST['mac']), 'stb_group_id' => $_POST['group_id']));
    } else {
        $stb_groups->setMember(array('stb_group_id' => $_POST['group_id']), $member['id']);
    }
    Mysql::getInstance()->update('users', array('fname' => $_POST['fname'], 'phone' => $_POST['phone'], 'ls' => $_POST['ls'], 'comment' => $_POST['comment'], 'expire_billing_date' => $_POST['expire_billing_date']), array('id' => intval($_GET['id'])));
    header("Location: profile.php?id=" . @$_GET['id']);
    exit;
}
if (@$_GET['video_out']) {
    Admin::checkAccess(AdminAccess::ACCESS_CONTEXT_ACTION);
    $video_out = @$_GET['video_out'];
    $id = intval($_GET['id']);
    if ($video_out == 'svideo') {
        $new_video_out = 'svideo';
    } else {
        $new_video_out = 'rca';
예제 #2
0
 private function saveUsersData(&$form, $edit = FALSE)
 {
     if (!empty($this->method) && $this->method == 'POST') {
         $form->handleRequest($this->request);
         $data = $form->getData();
         $action = isset($this->user) ? 'updateUserById' : 'insertUsers';
         if (array_key_exists('password', $data) && $edit && empty($data['password'])) {
             unset($data['password']);
         }
         if ($form->isValid()) {
             $stb_groups = new \StbGroup();
             $member = $stb_groups->getMemberByUid(intval($data['id']));
             $id = $data['id'];
             if (empty($member)) {
                 $stb_groups->addMember(array('mac' => \Middleware::normalizeMac($data['mac']), 'uid' => \Middleware::getUidByMac($data['mac']), 'stb_group_id' => $data['group_id']));
             } else {
                 $stb_groups->setMember(array('stb_group_id' => $data['group_id']), $member['id']);
             }
             $curr_fields = $this->db->getTableFields('users');
             $curr_fields = $this->getFieldFromArray($curr_fields, 'Field');
             $curr_fields = array_flip($curr_fields);
             $data = array_intersect_key($data, $curr_fields);
             $match = array();
             if (!empty($data['expire_billing_date']) && preg_match("/(0[1-9]|[12][0-9]|3[01])([- \\/\\.])(0[1-9]|1[012])[- \\/\\.](19|20)\\d\\d/im", $data['expire_billing_date'], $match)) {
                 $data['expire_billing_date'] = implode('-', array_reverse(explode($match[2], $data['expire_billing_date'])));
             } else {
                 $data['expire_billing_date'] = 0;
             }
             if ($data['reseller_id'] == '-') {
                 $data['reseller_id'] = NULL;
             }
             if (!empty($this->user) && array_key_exists('status', $this->user) && (int) $this->user['status'] != (int) $data['status']) {
                 $data['last_change_status'] = FALSE;
                 $event = new \SysEvent();
                 $event->setUserListById($data['id']);
                 if ((int) $data['status'] == 0) {
                     $event->sendCutOn();
                 } else {
                     $event->sendCutOff();
                 }
             } else {
                 unset($data['last_change_status']);
             }
             unset($data['version']);
             $result = call_user_func_array(array($this->db, $action), array($data, $data['id']));
             if (!empty($this->postData['tariff_plan_packages'])) {
                 $this->changeUserPlanPackages($id, $this->postData['tariff_plan_packages']);
             }
             return TRUE;
         }
     }
     return FALSE;
 }