コード例 #1
0
ファイル: users_controller.php プロジェクト: paolocerto/x3cms
 /**
  * Update user permissions on table records
  *
  * @access	private
  * @param   array 	$_post _POST array
  * @return  void
  */
 private function detailing($_post)
 {
     $msg = null;
     // check permission
     $msg = AdmUtils_helper::chk_priv_level($_SESSION['xuid'], 'users', $_post['id_user'], 3);
     if (is_null($msg)) {
         $mod = new Permission_model();
         // handle _post
         $c = 0;
         $post = array();
         while (isset($_post['id_' . $c])) {
             // if the new value do not match the old value
             if ($_post['value_' . $c] != $_post['old_value_' . $c]) {
                 $post[] = array('id' => $_post['id_' . $c], 'value' => $_post['value_' . $c]);
             }
             $c++;
         }
         if (!empty($post)) {
             // perform the update
             $result = $mod->update_detail_privs($_post['id_user'], $_post['id_area'], $_post['what'], $post);
         } else {
             // simulate update
             $result = array(0, 1);
         }
         // set message
         $msg = AdmUtils_helper::set_msg($result);
         // set what update
         if ($result[1]) {
             $msg->update[] = array('element' => 'modal', 'url' => BASE_URL . 'users/perm/' . $_post['id_user'] . '/' . $_post['id_area'] . '/1', 'title' => null);
         }
     }
     $this->response($msg);
 }