Exemplo n.º 1
0
function resource_log($resource,$type,$field,$notes="",$fromvalue="",$tovalue="",$usage=-1,$purchase_size="",$purchase_price=0)
	{
	global $userref,$k,$lang;
	
	# Do not log edits to user templates.
	if ($resource<0) {return false;}
	
	# Add difference to file.
	$diff="";
	if (($type=="e" || $type=="m") && $field!="" && ($fromvalue !== $tovalue))
		{
		$diff=log_diff($fromvalue,$tovalue);
		}

	if ($type=="s")
		{
		$diff=$lang["status" . $fromvalue] . " -> " . $lang["status" . $tovalue];
		}

	if ($type=="a")
		{
		$diff=$lang["access" . $fromvalue] . " -> " . $lang["access" . $tovalue];
		}
	
	sql_query("insert into resource_log(date,user,resource,type,resource_type_field,notes,diff,usageoption,purchase_size,purchase_price,access_key) values (now()," . (($userref!="")?"'$userref'":"null") . ",'$resource','$type'," . (($field!="")?"'$field'":"null") . ",'" . escape_check($notes) . "','" . escape_check($diff) . "','$usage','$purchase_size','$purchase_price'," . (isset($k)?"'$k'":"null") . ")");
	}
function resource_log($resource, $type, $field, $notes = "", $fromvalue = "", $tovalue = "", $usage = -1, $purchase_size = "", $purchase_price = 0)
{
    global $userref, $k, $lang;
    # Do not log edits to user templates.
    if ($resource < 0) {
        return false;
    }
    # Add difference to file.
    $diff = "";
    if ($fromvalue !== $tovalue) {
        $diff = log_diff($fromvalue, $tovalue);
    }
    if ($type == "s") {
        $diff = $lang["status" . $fromvalue] . " -> " . $lang["status" . $tovalue];
    }
    if ($type == "a") {
        $diff = $lang["access" . $fromvalue] . " -> " . $lang["access" . $tovalue];
    }
    $modifiedlogtype = hook("modifylogtype", "", array($type));
    if ($modifiedlogtype) {
        $type = $modifiedlogtype;
    }
    $modifiedlognotes = hook("modifylognotes", "", array($notes, $type, $resource));
    if ($modifiedlognotes) {
        $notes = $modifiedlognotes;
    }
    sql_query("insert into resource_log(date,user,resource,type,resource_type_field,notes,diff,usageoption,purchase_size,purchase_price,access_key,previous_value) values (now()," . ($userref != "" ? "'{$userref}'" : "null") . ",'{$resource}','{$type}'," . ($field != "" ? "'{$field}'" : "null") . ",'" . escape_check($notes) . "','" . escape_check($diff) . "','{$usage}','{$purchase_size}','{$purchase_price}'," . (isset($k) ? "'{$k}'" : "null") . ",'" . escape_check($fromvalue) . "')");
    $log_ref = sql_insert_id();
    return $log_ref;
}