This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (isset($_POST["PHPSESSID"])) { | |
session_id($_POST["PHPSESSID"]); | |
} | |
session_start(); | |
if (!isset($_FILES["Filedata"]) || !is_uploaded_file($_FILES["Filedata"]["tmp_name"]) || $_FILES["Filedata"]["error"] != 0) { | |
// Usually we'll only get an invalid upload if our PHP.INI upload sizes are smaller than the size of the file we allowed | |
// to be uploaded. | |
header("HTTP/1.1 500 File Upload Error"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
if (count($_FILES)) { | |
// Handle degraded form uploads here. Degraded form uploads are POSTed to index.php. SWFUpload uploads | |
// are POSTed to upload.php | |
} | |
?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def set_locale | |
locales = ['en-US', 'en-AU'] | |
begin | |
# Try to auto-detect it | |
if request.headers['Accept-Language'] | |
browser_language = request.headers['Accept-Language'].split(',')[0] | |
browser_language = browser_language.split('-')[0] + '-' + browser_language.split('-')[1].upcase | |
session[:locale] = browser_language | |
end | |
session[:locale] = params[:locale] if params[:locale] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub create($%) { | |
my GCX::Runtime::Community $self = shift; | |
my (%params) = @_; | |
my $system = $params{'system'}; | |
#short-circuit on invalid community names or invalid guid | |
($params{'name'} = $params{'display_name'}) =~ s/[^a-z0-9_~\-]/_/g; | |
return undef if(!$self->isValidName($params{'name'}, $system) ||$params{'guid'} !~ /^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/io); | |
#default values |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#retrieve values from form for the new community | |
our $communityName = getInParam('name'); | |
my $communityTitle = getInParam('title'); | |
my $description = getInParam('description'); | |
my $templateID = getInParam('template'); | |
my $type = getInParam('type') || 'community'; | |
my $parent = getInParam('parent'); | |
my $nestingType = getInParam('nestingType'); | |
if($parent) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#retrieve values from form for the new community | |
my $communityDisplayName = getInParam('display_name'); | |
our $communityName = getInParam('display_name'); | |
$communityName =~ s/[^a-z0-9_~\-]/_/g; | |
my $communityTitle = getInParam('title'); | |
my $description = getInParam('description'); | |
my $templateID = getInParam('template'); | |
my $type = getInParam('type') || 'community'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function communityCreator_selectTemplate(tdObj) { | |
var input = tdObj.getElementsByTagName("input")[0]; | |
if(!input.disabled) | |
input.checked = true; | |
} | |
function communityCreator_submit(form) { | |
var name = form.elements["display_name"].value.replace(/[^a-z0-9_~\-]/g, "_"); | |
var url = "/report-raw/global/checkCommunityName?name="+escape(name); | |
importXML(url, "communityCreator_checkNameResults"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SessionCleaner | |
def self.remove_stale_sessions | |
timeout = 360.minutes.ago | |
CGI::Session::ActiveRecordStore::Session.destroy_all( ['updated_at < ? ', timeout] ) | |
Cart.destroy_all( ["user_id is null and updated_at < ?", timeout]) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" | |
} | |
export PS1='\[\033[1;33m\]\w\[\033[0m\]$(parse_git_branch)$ ' |
OlderNewer