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 | |
/* Date to Age */ | |
if( | |
isset ($data['day']) && isset($data['month']) && isset($data['year']) && | |
is_numeric($data['day']) && | |
is_numeric($data['month']) && | |
is_numeric($data['year']) | |
){ |
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 | |
/* Time ago */ | |
$timestamp = 1332686482; // a unix timestamp | |
$t = array('year'=>31556926,'month'=>2629744,'week'=>604800,'day'=>86400,'hour'=>3600,'minute'=>60,'second'=>1); | |
// Calculate how long ago the timestamp is | |
$diff = time() - $timestamp; |
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 | |
/* GeoCode class */ | |
// Usage | |
$Geonames = new Geonames(); | |
print_r( $Geonames->geocode_postcode('SW1A 0AA','username') ); | |
if( ! empty($Geonames->message) ){ | |
echo $Geonames->message; |
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 | |
/* CI AJAX */ | |
public function index( $output_type ){ | |
// the main controller logic... | |
switch( $output_type ){ |
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 | |
public function upload( $gallery_id , $ajax = FALSE ){ | |
// Check if a user of any level is logged in | |
if( $this->require_min_level(1) ){ | |
$file_input = 'userfile[]'; | |
$config['encrypt_name'] = TRUE; | |
$config['upload_path'] = $this->config->item('user_upload_folder').'working/'; | |
$config['storage_path'] = $this->config->item('user_upload_folder'); |
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
<section id='upload-media'> | |
<h3 class='clickable'>Upload Media</h3> | |
<section id='file-uploader'> | |
<p>Max total file size: 200mb</p> | |
<input type='hidden' name='gallery_id' value='<?php echo $gallery->gallery_id; ?>' /> | |
<noscript> | |
<?php echo form_open_multipart('gallery/upload/'.$gallery->gallery_id);?> | |
<input type="hidden" name="max_file_size" value="209715200" /> | |
<input type="file" name="userfiles" /> |
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() { | |
var base_url = $('base').attr('href'); | |
gallery_id = $('input[name=gallery_id]').val(); | |
/* Uploader */ | |
var uploader = new qq.FileUploader({ |
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 | |
// Run from the command line, so we'll grab arguments from there | |
// input arguments: 0=>script, 1=>file_name, 2=>temp_file | |
$file_name = $argv[1]; | |
$temp_file = $argv[2]; | |
$uploads = '/opt/lampp/htdocs/user_uploads/'; | |
// Set up file location strings |
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 ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
/* | |
@author: [email protected] / http://dtownsend.co.uk | |
A hex-based colour converter. | |
Currently only supports altering brightness and saturation. | |
*/ | |
class HexWheel{ |
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 this is an ajax call, just return what's needed | |
if(isset($_POST['ajax'])){ | |
sleep(2); // Add some lag | |
echo $_POST['value']; // The input message | |
}else{ | |
?> | |
<html> | |
<head> |
OlderNewer