Changeset 1030 for trunk/common


Ignore:
Timestamp:
03/03/09 19:23:59 (3 years ago)
Author:
savin.tiberiu@…
Message:
 
Location:
trunk/common
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/common/db/textblock.php

    r997 r1030  
    7272} 
    7373 
     74// Delete $revision from database 
     75// The revision is identified by name and timestamp 
     76// $curr is true if $revision is the current revision and false otherwise 
     77function textblock_delete_revision($revision, $curr) 
     78{ 
     79    if ($curr == false) { 
     80        $name = $revision['name']; 
     81        $timestamp = $revision['timestamp']; 
     82        $query = "DELETE FROM `ia_textblock_revision` 
     83            WHERE `name` = ".db_quote($name)." && 
     84                `timestamp` = ".db_quote($timestamp); 
     85        db_query($query); 
     86    } else { 
     87        $name = $revision['name']; 
     88        $query = "REPLACE INTO `ia_textblock` 
     89                    (SELECT * FROM `ia_textblock_revision` 
     90                    WHERE `name` = ".db_quote($name)." 
     91                    ORDER BY `timestamp` DESC LIMIT 1)"; 
     92        db_query($query); 
     93 
     94        //delete last_rev from ia_textblock_revision 
     95        $query = "DELETE FROM `ia_textblock_revision` 
     96                WHERE `name` = ".db_quote($name)." 
     97                ORDER BY `timestamp` DESC LIMIT 1"; 
     98        db_query($query); 
     99    } 
     100} 
     101 
    74102// This is the function called by most query functions. 
    75103function textblock_complex_query($options) 
  • trunk/common/security.php

    r1008 r1030  
    131131        case 'round-delete': 
    132132        case 'textblock-delete': 
     133        case 'textblock-delete-revision': 
    133134        case 'grader-overwrite': 
    134135        case 'grader-delete': 
Note: See TracChangeset for help on using the changeset viewer.