Changeset 573 in subversion


Ignore:
Timestamp:
May 18, 2007 7:29:25 AM (6 years ago)
Author:
thomasb
Message:

Use HTTP-POST requests for actions that change application state

Location:
trunk/roundcubemail
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/CHANGELOG

    r571 r573  
    11CHANGELOG RoundCube Webmail 
    22--------------------------- 
     3 
     42007/05/18 (thomasb) 
     5---------- 
     6- Use HTTP-POST requests for actions that change state 
     7 
    38 
    492007/05/17 (thomasb) 
  • trunk/roundcubemail/index.php

    r571 r573  
    33 +-----------------------------------------------------------------------+ 
    44 | RoundCube Webmail IMAP Client                                         | 
    5  | Version 0.1-20070517                                                  | 
     5 | Version 0.1-20070518                                                  | 
    66 |                                                                       | 
    77 | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland                 | 
     
    286286    include('program/steps/mail/getunread.inc'); 
    287287     
    288   if ($_action=='list' && isset($_GET['_remote'])) 
     288  if ($_action=='list' && isset($_REQUEST['_remote'])) 
    289289    include('program/steps/mail/list.inc'); 
    290290 
     
    324324    include('program/steps/addressbook/show.inc');   
    325325 
    326   if ($_action=='list' && $_GET['_remote']) 
     326  if ($_action=='list' && $_REQUEST['_remote']) 
    327327    include('program/steps/addressbook/list.inc'); 
    328328 
  • trunk/roundcubemail/program/js/app.js

    r568 r573  
    13051305    // send request to server 
    13061306    var url = '_mbox='+urlencode(mbox); 
    1307     this.http_request('expunge', url+add_url, lock); 
     1307    this.http_post('expunge', url+add_url, lock); 
    13081308    }; 
    13091309 
     
    13271327    // send request to server 
    13281328    var url = '_mbox='+urlencode(mbox); 
    1329     this.http_request('purge', url+add_url, lock); 
     1329    this.http_post('purge', url+add_url, lock); 
    13301330    return true; 
    13311331    }; 
     
    14331433 
    14341434    // send request to server 
    1435     this.http_request(action, '_uid='+a_uids.join(',')+'&_mbox='+urlencode(this.env.mailbox)+add_url, lock); 
     1435    this.http_post(action, '_uid='+a_uids.join(',')+'&_mbox='+urlencode(this.env.mailbox)+add_url, lock); 
    14361436    }; 
    14371437 
     
    15121512      } 
    15131513       
    1514     this.http_request('mark', '_uid='+a_uids.join(',')+'&_flag='+flag); 
     1514    this.http_post('mark', '_uid='+a_uids.join(',')+'&_flag='+flag); 
    15151515  }; 
    15161516   
     
    15891589    } 
    15901590 
    1591     this.http_request('mark', '_uid='+a_uids.join(',')+'&_flag=undelete'); 
     1591    this.http_post('mark', '_uid='+a_uids.join(',')+'&_flag=undelete'); 
    15921592    return true; 
    15931593  }; 
     
    16161616    } 
    16171617 
    1618     this.http_request('mark', '_uid='+a_uids.join(',')+'&_flag=delete'); 
     1618    this.http_post('mark', '_uid='+a_uids.join(',')+'&_flag=delete'); 
    16191619    return true;   
    16201620  }; 
     
    19271927    { 
    19281928    if (name) 
    1929       this.http_request('remove-attachment', '_file='+urlencode(name)); 
     1929      this.http_post('remove-attachment', '_file='+urlencode(name)); 
    19301930 
    19311931    return true; 
     
    23572357 
    23582358    // send request to server 
    2359     this.http_request('delete', '_cid='+urlencode(a_cids.join(','))+'&_from='+(this.env.action ? this.env.action : '')); 
     2359    this.http_post('delete', '_cid='+urlencode(a_cids.join(','))+'&_from='+(this.env.action ? this.env.action : '')); 
    23602360    return true; 
    23612361    }; 
     
    24412441 
    24422442    if (name) 
    2443       this.http_request('create-folder', '_name='+urlencode(name), true); 
     2443      this.http_post('create-folder', '_name='+urlencode(name), true); 
    24442444    else if (form.elements['_folder_name']) 
    24452445      form.elements['_folder_name'].focus(); 
     
    24642464 
    24652465    if (oldname && newname) 
    2466       this.http_request('rename-folder', '_folder_oldname='+urlencode(oldname)+'&_folder_newname='+urlencode(newname)); 
     2466      this.http_post('rename-folder', '_folder_oldname='+urlencode(oldname)+'&_folder_newname='+urlencode(newname)); 
    24672467    }; 
    24682468 
     
    25212521      var newname = this.name_input ? this.name_input.value : null; 
    25222522      if (this.edit_folder && newname) 
    2523         this.http_request('rename-folder', '_folder_oldname='+urlencode(this.env.subscriptionrows[this.edit_folder][0])+'&_folder_newname='+urlencode(newname));         
     2523        this.http_post('rename-folder', '_folder_oldname='+urlencode(this.env.subscriptionrows[this.edit_folder][0])+'&_folder_newname='+urlencode(newname)); 
    25242524      } 
    25252525    // escape 
     
    25362536     
    25372537    if (folder) 
    2538       this.http_request('delete-folder', '_mboxes='+urlencode(folder)); 
     2538      this.http_post('delete-folder', '_mboxes='+urlencode(folder)); 
    25392539    }; 
    25402540 
     
    26632663      this.change_subscription('_unsubscribed', '_subscribed', 'subscribe'); 
    26642664    else if (folder) 
    2665       this.http_request('subscribe', '_mboxes='+urlencode(folder)); 
     2665      this.http_post('subscribe', '_mboxes='+urlencode(folder)); 
    26662666    }; 
    26672667 
     
    26732673      this.change_subscription('_subscribed', '_unsubscribed', 'unsubscribe'); 
    26742674    else if (folder) 
    2675       this.http_request('unsubscribe', '_mboxes='+urlencode(folder)); 
     2675      this.http_post('unsubscribe', '_mboxes='+urlencode(folder)); 
    26762676    }; 
    26772677     
     
    27072707          } 
    27082708           
    2709         this.http_request(action, '_mboxes='+urlencode(a_folders.join(','))); 
     2709        this.http_post(action, '_mboxes='+urlencode(a_folders.join(','))); 
    27102710        } 
    27112711      } 
  • trunk/roundcubemail/program/steps/addressbook/delete.inc

    r543 r573  
    2020*/ 
    2121 
    22 if (($cid = get_input_value('_cid', RCUBE_INPUT_GPC)) && preg_match('/^[0-9]+(,[0-9]+)*$/', $cid)) 
     22if (($cid = get_input_value('_cid', RCUBE_INPUT_POST)) && preg_match('/^[0-9]+(,[0-9]+)*$/', $cid)) 
    2323  { 
    2424  $deleted = $CONTACTS->delete($cid); 
  • trunk/roundcubemail/program/steps/mail/compose.inc

    r543 r573  
    3030 
    3131// remove an attachment 
    32 if ($_action=='remove-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_GET['_file'], $regs)) 
     32if ($_action=='remove-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_POST['_file'], $regs)) 
    3333  { 
    3434  $id = $regs[1]; 
  • trunk/roundcubemail/program/steps/mail/folders.inc

    r543 r573  
    2222 
    2323// send EXPUNGE command 
    24 if ($_action=='expunge') 
     24if ($_action=='expunge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST))) 
    2525{ 
    26   $success = $IMAP->expunge(get_input_value('_mbox', RCUBE_INPUT_GET)); 
     26  $success = $IMAP->expunge($mbox); 
    2727 
    2828  // reload message list if current mailbox   
    29   if ($success && !empty($_GET['_reload'])) 
     29  if ($success && !empty($_REQUEST['_reload'])) 
    3030  { 
    3131    $OUTPUT->command('message_list.clear'); 
     
    3838 
    3939// clear mailbox 
    40 else if ($_action=='purge') 
     40else if ($_action=='purge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST))) 
    4141{ 
    42   $success = $IMAP->clear_mailbox(get_input_value('_mbox', RCUBE_INPUT_GET)); 
     42  $success = $IMAP->clear_mailbox($mbox); 
    4343   
    44   if ($success && !empty($_GET['_reload'])) 
     44  if ($success && !empty($_REQUEST['_reload'])) 
    4545  { 
    4646    $OUTPUT->set_env('messagecount', 0); 
  • trunk/roundcubemail/program/steps/mail/func.inc

    r567 r573  
    5353 
    5454// set message set for search result 
    55 if (!empty($_GET['_search']) && isset($_SESSION['search'][$_GET['_search']])) 
    56   $IMAP->set_search_set($_SESSION['search'][$_GET['_search']]); 
     55if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search']])) 
     56  $IMAP->set_search_set($_SESSION['search'][$_REQUEST['_search']]); 
    5757 
    5858 
  • trunk/roundcubemail/program/steps/mail/list.inc

    r543 r573  
    4343  $a_headers = $IMAP->list_headers($mbox_name, NULL, $sort_col, $sort_order); 
    4444 
    45 $unseen = $IMAP->messagecount($mbox_name, 'UNSEEN', !empty($_GET['_refresh']) ? TRUE : FALSE); 
     45$unseen = $IMAP->messagecount($mbox_name, 'UNSEEN', !empty($_REQUEST['_refresh']) ? TRUE : FALSE); 
    4646 
    4747// update message count display 
  • trunk/roundcubemail/program/steps/mail/mark.inc

    r543 r573  
    2525  'unread' => 'UNSEEN'); 
    2626 
    27 if (($uids = get_input_value('_uid', RCUBE_INPUT_GET)) && ($flag = get_input_value('_flag', RCUBE_INPUT_GET))) 
     27if (($uids = get_input_value('_uid', RCUBE_INPUT_POST)) && ($flag = get_input_value('_flag', RCUBE_INPUT_POST))) 
    2828{ 
    2929  $flag = $a_flags_map[$flag] ? $a_flags_map[$flag] : strtoupper($flag); 
  • trunk/roundcubemail/program/steps/mail/move_del.inc

    r543 r573  
    2121 
    2222// move messages 
    23 if ($_action=='moveto' && !empty($_GET['_uid']) && !empty($_GET['_target_mbox'])) 
     23if ($_action=='moveto' && !empty($_POST['_uid']) && !empty($_POST['_target_mbox'])) 
    2424{ 
    25   $count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_GET)))); 
    26   $target = get_input_value('_target_mbox', RCUBE_INPUT_GET); 
    27   $moved = $IMAP->move_message($uids, $target, get_input_value('_mbox', RCUBE_INPUT_GET)); 
     25  $count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_POST)))); 
     26  $target = get_input_value('_target_mbox', RCUBE_INPUT_POST); 
     27  $moved = $IMAP->move_message($uids, $target, get_input_value('_mbox', RCUBE_INPUT_POST)); 
    2828   
    2929  if (!$moved) 
     
    3838 
    3939// delete messages  
    40 else if ($_action=='delete' && !empty($_GET['_uid'])) 
     40else if ($_action=='delete' && !empty($_POST['_uid'])) 
    4141{ 
    42   $count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_GET)))); 
    43   $del = $IMAP->delete_message($uids, get_input_value('_mbox', RCUBE_INPUT_GET)); 
     42  $count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_POST)))); 
     43  $del = $IMAP->delete_message($uids, get_input_value('_mbox', RCUBE_INPUT_POST)); 
    4444   
    4545  if (!$del) 
     
    7979 
    8080// add new rows from next page (if any) 
    81 if ($_GET['_from']!='show' && $pages>1 && $IMAP->list_page < $pages) 
     81if ($_POST['_from']!='show' && $pages>1 && $IMAP->list_page < $pages) 
    8282{ 
    8383  $sort_col   = isset($_SESSION['sort_col'])   ? $_SESSION['sort_col']   : $CONFIG['message_sort_col']; 
  • trunk/roundcubemail/program/steps/settings/manage_folders.inc

    r543 r573  
    2727if ($_action=='subscribe') 
    2828  { 
    29   if ($mboxes = get_input_value('_mboxes', RCUBE_INPUT_GET)) 
     29  if ($mboxes = get_input_value('_mboxes', RCUBE_INPUT_POST)) 
    3030    $IMAP->subscribe(array($mboxes)); 
    3131 
     
    3737else if ($_action=='unsubscribe') 
    3838  { 
    39   if ($mboxes = get_input_value('_mboxes', RCUBE_INPUT_GET)) 
     39  if ($mboxes = get_input_value('_mboxes', RCUBE_INPUT_POST)) 
    4040    $IMAP->unsubscribe(array($mboxes)); 
    4141 
     
    4747else if ($_action=='create-folder') 
    4848  { 
    49   if (!empty($_GET['_name'])) 
    50     $create = $IMAP->create_mailbox(trim(get_input_value('_name', RCUBE_INPUT_GET, FALSE, 'UTF-7')), TRUE); 
     49  if (!empty($_POST['_name'])) 
     50    $create = $IMAP->create_mailbox(trim(get_input_value('_name', RCUBE_INPUT_POST, FALSE, 'UTF-7')), TRUE); 
    5151 
    5252  if ($create && $OUTPUT->ajax_call) 
     
    6767else if ($_action=='rename-folder') 
    6868  { 
    69   if (!empty($_GET['_folder_oldname']) && !empty($_GET['_folder_newname'])) 
    70     $rename = $IMAP->rename_mailbox(($oldname = get_input_value('_folder_oldname', RCUBE_INPUT_GET)), trim(get_input_value('_folder_newname', RCUBE_INPUT_GET, FALSE, 'UTF-7'))); 
     69  if (!empty($_POST['_folder_oldname']) && !empty($_POST['_folder_newname'])) 
     70    $rename = $IMAP->rename_mailbox(($oldname = get_input_value('_folder_oldname', RCUBE_INPUT_POST)), trim(get_input_value('_folder_newname', RCUBE_INPUT_POST, FALSE, 'UTF-7'))); 
    7171     
    7272  if ($rename && $OUTPUT->ajax_call) 
     
    8989else if ($_action=='delete-folder') 
    9090  { 
    91   if ($mboxes = get_input_value('_mboxes', RCUBE_INPUT_GET)) 
     91  if ($mboxes = get_input_value('_mboxes', RCUBE_INPUT_POST)) 
    9292    $deleted = $IMAP->delete_mailbox(array($mboxes)); 
    9393 
    9494  if ($OUTPUT->ajax_call && $deleted) 
    9595    { 
    96     $OUTPUT->command('remove_folder_row', get_input_value('_mboxes', RCUBE_INPUT_GET)); 
     96    $OUTPUT->command('remove_folder_row', get_input_value('_mboxes', RCUBE_INPUT_POST)); 
    9797    $OUTPUT->show_message('folderdeleted', 'confirmation'); 
    9898    $OUTPUT->send(); 
Note: See TracChangeset for help on using the changeset viewer.