t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.',array('@site'=>variable_get('site_name','Drupal'))))));
}
/**
* Generates a 404 error if the request can not be handled.
*/
functiondrupal_not_found(){
drupal_set_header('HTTP/1.1 404 Not Found');
watchdog('page not found',check_plain($_GET['q']),WATCHDOG_WARNING);
400=>'Bad Request',401=>'Unauthorized',402=>'Payment Required',403=>'Forbidden',404=>'Not Found',405=>'Method Not Allowed',406=>'Not Acceptable',407=>'Proxy Authentication Required',408=>'Request Time-out',409=>'Conflict',410=>'Gone',411=>'Length Required',412=>'Precondition Failed',413=>'Request Entity Too Large',414=>'Request-URI Too Large',415=>'Unsupported Media Type',416=>'Requested range not satisfiable',417=>'Expectation Failed',
500=>'Internal Server Error',501=>'Not Implemented',502=>'Bad Gateway',503=>'Service Unavailable',504=>'Gateway Time-out',505=>'HTTP Version not supported'
);
// RFC 2616 states that all unknown HTTP codes must be treated the same as
watchdog('php',t('%message in %file on line %line.',array('%error'=>$types[$errno],'%message'=>$message,'%file'=>$filename,'%line'=>$line)),WATCHDOG_ERROR);
}
}
function_fix_gpc_magic(&$item){
if(is_array($item)){
array_walk($item,'_fix_gpc_magic');
}
else{
$item=stripslashes($item);
}
}
/**
* Helper function to strip slashes from $_FILES skipping over the tmp_name keys
* since PHP generates single backslashes for file paths on Windows systems.
* - !variable, which indicates that the text should be inserted as-is. This is
* useful for inserting variables into things like e-mail.
* @code
* $message[] = t("If you don't want to receive such e-mails, you can change your settings at !url.", array('!url' => url("user/$account->uid", NULL, NULL, TRUE)));
* @endcode
*
* - @variable, which indicates that the text should be run through check_plain,
* to strip out HTML characters. Use this for any output that's displayed within
* Register an event for the current visitor (hostname/IP) to the flood control mechanism.
*
* @param $name
* The name of the event.
*/
functionflood_register_event($name){
db_query("INSERT INTO {flood} (event, hostname, timestamp) VALUES ('%s', '%s', %d)",$name,$_SERVER['REMOTE_ADDR'],time());
}
/**
* Check if the current visitor (hostname/IP) is allowed to proceed with the specified event.
* The user is allowed to proceed if he did not trigger the specified event more than
* $threshold times per hour.
*
* @param $name
* The name of the event.
* @param $number
* The maximum number of the specified event per hour (per visitor).
* @return
* True if the user did not exceed the hourly threshold. False otherwise.
*/
functionflood_is_allowed($name,$threshold){
$number=db_num_rows(db_query("SELECT event FROM {flood} WHERE event = '%s' AND hostname = '%s' AND timestamp > %d",$name,$_SERVER['REMOTE_ADDR'],time()-3600));
return($number<$threshold?TRUE:FALSE);
}
functioncheck_file($filename){
returnis_uploaded_file($filename);
}
/**
* Prepare a URL for use in an HTML attribute. Strips harmful protocols.
*
*/
functioncheck_url($uri){
returnfilter_xss_bad_protocol($uri,FALSE);
}
/**
* @defgroup format Formatting
* @{
* Functions to format numbers, strings, dates, etc.
*/
/**
* Formats an RSS channel.
*
* Arbitrary elements may be added using the $args associative array.