Changeset 947


Ignore:
Timestamp:
11/15/08 17:19:39 (4 years ago)
Author:
ditzone
Message:

Fix for security check on textblock restor

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/textblock.php

    r934 r947  
    261261log_assert_equal($res['redirect_count'],  0); 
    262262 
     263log_print("Testing security for restore"); 
     264$res = curl_test(array( 
     265        'url' => url_textblock_edit('sandbox/test_page_revision'), 
     266        'user' => 'test_admin', 
     267        'post' => array( 
     268                'text' => "ugu 1\n", 
     269                'title' => "Test ugu 1", 
     270                'security' => "private", 
     271                'last_revision' => "0", 
     272))); 
     273usleep(1000000); 
     274$res = curl_test(array( 
     275        'url' => url_textblock_edit('sandbox/test_page_revision'), 
     276        'user' => 'test_admin', 
     277        'post' => array( 
     278                'text' => "ugu 2\n", 
     279                'title' => "Test ugu 2", 
     280                'security' => "protected", 
     281                'last_revision' => "1", 
     282))); 
     283usleep(1000000); 
     284$res = curl_test(array( 
     285        'url' => url_textblock_edit('sandbox/test_page_revision'), 
     286        'user' => 'test_admin', 
     287        'post' => array( 
     288                'text' => "ugu 3\n", 
     289                'title' => "Test ugu 3", 
     290                'security' => "public", 
     291                'last_revision' => "2", 
     292))); 
     293usleep(1000000); 
     294$res = curl_test(array( 
     295        'url' => url_textblock_restore('sandbox/test_page_revision', 1), 
     296        'user' => 'test_dude1', 
     297        'post' => array() 
     298)); 
     299log_assert_equal($res['url'],  url_absolute(url_home())); 
     300log_assert(!strstr($res['content'], 'Nu ai permisiuni')); 
     301$res = curl_test(array( 
     302        'url' => url_textblock_restore('sandbox/test_page_revision', 2), 
     303        'user' => 'test_dude1', 
     304        'post' => array() 
     305)); 
     306log_assert_equal($res['url'],  url_absolute(url_home())); 
     307log_assert(!strstr($res['content'], 'Nu ai permisiuni')); 
    263308log_print("Textblock tests all passed"); 
    264309test_cleanup(); 
  • trunk/www/controllers/textblock.php

    r945 r947  
    117117    $rev = textblock_get_revision($page_name, $rev_num); 
    118118 
    119     if ($page) { 
     119    if ($page and $rev) { 
    120120        identity_require('textblock-restore', $page); 
     121        identity_require('textblock-restore', $rev); 
    121122    } else { 
    122123        flash_error("Pagina nu exista"); 
Note: See TracChangeset for help on using the changeset viewer.