Changeset 143


Ignore:
Timestamp:
03/30/2009 10:30:26 PM (3 years ago)
Author:
ofer
Message:

Permissions before DB work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/WordPress/plugin/transposh/transposh_db.php

    r142 r143  
    112112        $source = $_POST['source']; 
    113113 
     114        // check params 
    114115        logger("Enter " . __FILE__ . " Params: $original , $translation, $lang, $ref", 3); 
    115116        if(!isset($original) || !isset($translation) || !isset($lang)) 
     
    117118                logger("Enter " . __FILE__ . " missing params: $original , $translation, $lang," . $ref, 0); 
    118119                return; 
     120        } 
     121 
     122        //Check permissions, first the lanugage must be on the edit list. Then either the user 
     123        //is a translator or automatic translation if it is enabled. 
     124        if(!(is_editable_lang($lang) && 
     125            (is_translator() || ($source == 1 && get_option(ENABLE_AUTO_TRANSLATE))))) 
     126        { 
     127                logger("Unauthorized translation attempt " . $_SERVER['REMOTE_ADDR'] , 1); 
     128                header("HTTP/1.0 401 Unauthorized translation"); 
     129                exit; 
    119130        } 
    120131 
     
    141152                        return; 
    142153                } 
    143         } 
    144  
    145         //Check permissions, first the lanugage must be on the edit list. Then either the user 
    146         //is a translator or automatic translation if it is enabled. 
    147         if(!(is_editable_lang($lang) && 
    148             (is_translator() || ($source == 1 && get_option(ENABLE_AUTO_TRANSLATE))))) 
    149         { 
    150                 logger("Unauthorized translation attempt " . $_SERVER['REMOTE_ADDR'] , 1); 
    151                 header("HTTP/1.0 401 Unauthorized translation"); 
    152                 exit; 
    153154        } 
    154155 
Note: See TracChangeset for help on using the changeset viewer.