Changeset 1097 for trunk/common


Ignore:
Timestamp:
12/27/09 01:24:58 (2 years ago)
Author:
bogdan2412
Message:

Admin edit button on task pages

Done by Toni. Solves ticket #308.
Review URL: http://reviewboard.infoarena.ro/r/129

Location:
trunk/common
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/common/security.php

    r1091 r1097  
    211211 
    212212    // Forward security to task. 
    213     if (preg_match("/^ \s* task: \s* (".IA_RE_TASK_ID.") \s* $/xi", $textsec, $matches)) { 
     213    if (($task_id = textblock_security_is_task($textsec))) { 
    214214        require_once(IA_ROOT_DIR . "common/db/task.php"); 
    215         $task = task_get($matches[1]); 
     215        $task = task_get($task_id); 
    216216        if ($task === null) { 
    217217            log_warn("Bad security descriptor, ask an admin."); 
     
    310310    // Convert action into a grader action if the textblock is a task 
    311311    // textblock and the attachment has the grader_ prefix. 
    312     if (preg_match("/^ \s* task: \s* (".IA_RE_TASK_ID.") \s* $/xi", $tb["security"]) && 
     312    if (textblock_security_is_task($tb['security']) && 
    313313        preg_match('/^grader\_/', $att_name)) { 
    314314        $newaction = preg_replace('/^attach/', 'grader', $action); 
  • trunk/common/textblock.php

    r1079 r1097  
    188188} 
    189189 
     190// Checks if the textblock is task and return the task_id if true or false if false 
     191function textblock_security_is_task($textblock) { 
     192    if (preg_match("/^ \s* task: \s* (".IA_RE_TASK_ID.") \s* $/xi", $textblock, $matches)) { 
     193        return $matches[1]; 
     194    } 
     195    return false; 
     196} 
     197 
    190198?> 
Note: See TracChangeset for help on using the changeset viewer.