More work from Ryan Flint <rflint@dslr.net> on the Party Tool

This commit is contained in:
reed%reedloden.com 2006-09-20 07:22:46 +00:00
Родитель 7698b87ab2
Коммит c2a9df8c91
24 изменённых файлов: 946 добавлений и 454 удалений

Просмотреть файл

@ -1,4 +1,11 @@
<?php <?php
/* REQUIRED - APP_NAME is used on all <title>s and mail names/subjects. APP_BASE
* should be a FQDN with protocol minus the trailing slash e.g. http://example.tld/party
*/
define('APP_NAME', '');
define('APP_EMAIL', '');
define('APP_BASE', '');
/* You should specify a Google Map API key here. Without it, all mapping features /* You should specify a Google Map API key here. Without it, all mapping features
* will be disabled. To obtain a key, visit http://www.google.com/apis/maps/ * will be disabled. To obtain a key, visit http://www.google.com/apis/maps/
*/ */
@ -9,9 +16,8 @@ define('GMAP_API_KEY', '');
*/ */
define('GSEARCH_API_KEY', ''); define('GSEARCH_API_KEY', '');
/* The maximum year shown for party registrations */
define('MAX_YEAR', 2007); define('MAX_YEAR', 2007);
define('APP_NAME', 'Firefox Party');
define('APP_EMAIL', '');
/* The Flickr API is used to show photos of each party on the individual party /* The Flickr API is used to show photos of each party on the individual party
* pages and home page. See http://flickr.com/services/api/keys/ to obtain a key * pages and home page. See http://flickr.com/services/api/keys/ to obtain a key

Просмотреть файл

@ -1,4 +1,5 @@
<?php <?php
class DATABASE_CONFIG { class DATABASE_CONFIG {
var $default = array('driver' => 'mysql', var $default = array('driver' => 'mysql',
'connect' => 'mysql_connect', 'connect' => 'mysql_connect',

Просмотреть файл

@ -13,6 +13,7 @@ CREATE TABLE IF NOT EXISTS `parties` (
`name` tinytext NOT NULL, `name` tinytext NOT NULL,
`vname` tinytext, `vname` tinytext,
`address` tinytext NOT NULL, `address` tinytext NOT NULL,
`tz` int(2) NOT NULL default '0',
`website` tinytext, `website` tinytext,
`notes` text, `notes` text,
`date` int(10) default NULL, `date` int(10) default NULL,
@ -20,9 +21,10 @@ CREATE TABLE IF NOT EXISTS `parties` (
`guests` tinytext NOT NULL, `guests` tinytext NOT NULL,
`confirmed` tinyint(1) NOT NULL default '0', `confirmed` tinyint(1) NOT NULL default '0',
`inviteonly` tinyint(1) NOT NULL default '0', `inviteonly` tinyint(1) NOT NULL default '0',
`invitecode` tinytext NOT NULL,
`lat` float default NULL, `lat` float default NULL,
`long` float default NULL, `long` float default NULL,
`zoom` int(5) default NULL, `zoom` tinyint(2) NOT NULL default '8',
`useflickr` tinyint(1) NOT NULL default '0', `useflickr` tinyint(1) NOT NULL default '0',
`flickrid` tinytext NOT NULL, `flickrid` tinytext NOT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
@ -37,6 +39,7 @@ CREATE TABLE IF NOT EXISTS `users` (
`salt` varchar(9) NOT NULL default '', `salt` varchar(9) NOT NULL default '',
`name` tinytext NOT NULL, `name` tinytext NOT NULL,
`location` tinytext NOT NULL, `location` tinytext NOT NULL,
`tz` int(2) NOT NULL default '0',
`website` tinytext NOT NULL, `website` tinytext NOT NULL,
`lat` float default NULL, `lat` float default NULL,
`long` float default NULL, `long` float default NULL,

Просмотреть файл

@ -57,7 +57,7 @@ class CommentController extends AppController {
$this->data['Comment']['text'] = preg_replace('/\n/', '<br/>', $text); $this->data['Comment']['text'] = preg_replace('/\n/', '<br/>', $text);
$this->data['Comment']['owner'] = $uid; $this->data['Comment']['owner'] = $uid;
$this->data['Comment']['assoc'] = $pid; $this->data['Comment']['assoc'] = $pid;
$this->data['Comment']['time'] = time(); $this->data['Comment']['time'] = gmmktime();
if ($this->Comment->save($this->data)) { if ($this->Comment->save($this->data)) {
$this->redirect('/party/view/'.$pid); $this->redirect('/party/view/'.$pid);

Просмотреть файл

@ -36,8 +36,10 @@
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
class PagesController extends AppController { class PagesController extends AppController {
var $name = 'Pages'; var $name = 'Pages';
var $pageTitle;
function display() { function display() {
$this->pageTitle = APP_NAME." - Home";
$this->set('pcount', $this->Page->findCount()); $this->set('pcount', $this->Page->findCount());
$this->set('ucount', $this->Page->getUsers()); $this->set('ucount', $this->Page->getUsers());
} }

Просмотреть файл

@ -12,7 +12,7 @@
* for the specific language governing rights and limitations under the * for the specific language governing rights and limitations under the
* License. * License.
* *
* The Original Code is Firefox Party Tool * The Original Code is Mozilla Party Tool
* *
* The Initial Developer of the Original Code is * The Initial Developer of the Original Code is
* Ryan Flint <rflint@dslr.net> * Ryan Flint <rflint@dslr.net>
@ -35,46 +35,70 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
vendor('webServices'); vendor('webServices');
vendor('mail');
uses('sanitize'); uses('sanitize');
class PartyController extends AppController { class PartyController extends AppController {
var $name = 'Party'; var $name = 'Party';
var $pageTitle;
var $components = array('RequestHandler'); var $components = array('RequestHandler');
var $components = array('Security'); var $components = array('Security');
function beforeFilter() { function beforeFilter() {
$this->Security->requirePost('rsvp','unrsvp'); $this->Security->requirePost('unrsvp');
} }
function index() { function index() {
if (GMAP_API_KEY != null) if (GMAP_API_KEY != null)
$this->set('body_args', ' onload="initMashUp()" onunload="GUnload()"'); $this->set('body_args', ' onload="initMashUp()" onunload="GUnload()"');
$this->pageTitle = APP_NAME." - Party Map";
} }
function register() { function register() {
if (!$this->Session->check('User')) { if (!$this->Session->check('User')) {
$this->redirect('/user'); $this->redirect('/user');
} }
$this->pageTitle = APP_NAME." - Register";
$this->set('error', false); $this->set('error', false);
if (GMAP_API_KEY != null) if (GMAP_API_KEY != null)
$this->set('body_args', ' onload="mapInit(14.944785, -156.796875, 1)" onunload="GUnload()"'); $this->set('body_args', ' onload="mapInit(14.944785, -156.796875, 1)" onunload="GUnload()"');
if (!empty($this->data)) { if (!empty($this->data)) {
$clean = new Sanitize(); $clean = new Sanitize();
$temp = array('lat' => $clean->sql($this->data['Party']['lat']),
'long' => $clean->sql($this->data['Party']['long']),
'tz' => $clean->sql($this->data['Party']['tz']));
$clean->cleanArray($this->data); $clean->cleanArray($this->data);
$this->data['Party']['date'] = mktime($this->data['Party']['hour_hour'], $this->data['Party']['lat'] = floatval($temp['lat']);
$this->data['Party']['minute_min'], $this->data['Party']['long'] = floatval($temp['long']);
0, $this->data['Party']['tz'] = intval($temp['tz']);
$this->data['Party']['month_hour'],
$this->data['Party']['day_day'], $secoffset = ($this->data['Party']['tz'] * 60 * 60);
$this->data['Party']['year_year']);
$offsetdate = gmmktime($this->data['Party']['hour_hour'],
$this->data['Party']['minute_min'],
0,
$this->data['Party']['month_hour'],
$this->data['Party']['day_day'],
$this->data['Party']['year_year']);
$this->data['Party']['date'] = ($offsetdate + $secoffset);
$this->data['Party']['owner'] = $_SESSION['User']['id']; $this->data['Party']['owner'] = $_SESSION['User']['id'];
$key = null;
$chars = "1234567890abcdefghijklmnopqrstuvwxyz";
for ($i = 0; $i < 10; $i++) {
$key .= $chars{rand(0,35)};
}
$this->data['Party']['invitecode'] = $key;
if (empty($this->data['Party']['lat']) && !empty($this->data['Party']['address']) && if (empty($this->data['Party']['lat']) && !empty($this->data['Party']['address']) &&
$this->data['Party']['geocoded'] == 0) { $this->data['Party']['geocoded'] == 0) {
// Attempt to geocode the address again // Attempt to geocode the address again
$geocoder = new webServices(array('type' => 'geocode')); $geocoder = new webServices(array('type' => 'geocode'));
if ($ll = $geocoder->geocode($this->data['Party']['address']) != 0) { if ($ll = $geocoder->geocode($this->data['Party']['address']) != 0) {
@ -84,6 +108,7 @@ class PartyController extends AppController {
else { else {
// May not come back with exactly what the user was looking for, but they can always edit // May not come back with exactly what the user was looking for, but they can always edit
$suggest = new webServices(array('type' => 'gsuggest')); $suggest = new webServices(array('type' => 'gsuggest'));
$geocoder = new webServices(array('type' => 'geocode'));
if ($suggestion = $suggest->GSuggest($this->data['Party']['address']) != 0) { if ($suggestion = $suggest->GSuggest($this->data['Party']['address']) != 0) {
$this->data['Party']['address'] = $suggestion; $this->data['Party']['address'] = $suggestion;
if ($ll = $geocoder->geocode($suggestion) != 0) { if ($ll = $geocoder->geocode($suggestion) != 0) {
@ -93,30 +118,101 @@ class PartyController extends AppController {
} }
} }
} }
if ($this->Party->save($this->data)) if ($this->Party->save($this->data))
$this->redirect('party/view/'.$this->Party->getInsertId()); $this->redirect('party/view/'.$this->Party->getInsertId());
} }
} }
function edit($id = null) {
$this->Party->id = $id;
$party = $this->Party->read();
$this->set('party', $party);
$this->pageTitle = APP_NAME." - Edit Party";
if (empty($_SESSION['User']['id']))
$this->redirect('/user/login/');
if ($party['Party']['owner'] != $_SESSION['User']['id'])
$this->redirect('/party/view/'.$id);
else {
if (empty($this->data)) {
$this->data = $party;
$this->data['Party']['hour_hour'] = intval(date('h', $party['Party']['date']));
$this->data['Party']['minute_min'] = intval(date('i', $party['Party']['date']));
$this->data['Party']['month_hour'] = intval(date('m', $party['Party']['date']));
$this->data['Party']['day_day'] = intval(date('d', $party['Party']['date']));
$this->data['Party']['year_year'] = intval(date('Y', $party['Party']['date']));
if (GMAP_API_KEY != null) {
if ($this->data['Party']['lat'])
$this->set('body_args',
' onload="mapInit('.$this->data["Party"]["lat"].', '.$this->data["Party"]["long"].', '.$this->data["Party"]["zoom"].');" onunload="GUnload()"');
else
$this->set('body_args',
' onload="mapInit(1, 1, 1);" onunload="GUnload()"');
}
}
else {
$clean = new Sanitize();
$temp = array('lat' => $clean->sql($this->data['Party']['lat']),
'long' => $clean->sql($this->data['Party']['long']),
'tz' => $clean->sql($this->data['Party']['tz']));
$clean->cleanArray($this->data);
$this->data['Party']['lat'] = floatval($temp['lat']);
$this->data['Party']['long'] = floatval($temp['long']);
$this->data['Party']['tz'] = intval($temp['tz']);
$secoffset = ($this->data['Party']['tz'] * 60 * 60);
$offsetdate = gmmktime($this->data['Party']['hour_hour'],
$this->data['Party']['minute_min'],
0,
$this->data['Party']['month_hour'],
$this->data['Party']['day_day'],
$this->data['Party']['year_year']);
$this->data['Party']['date'] = ($offsetdate - $secoffset);
$this->data['Party']['owner'] = $_SESSION['User']['id'];
if (!empty($this->data['Party']['flickrusr'])) {
$params = array('type' => 'flickr', 'userid' => $this->data['Party']['flickrusr']);
$flick = new webServices($params);
$this->data['Party']['flickrid'] = $flick->getFlickrId();
}
if ($this->Party->save($this->data))
$this->redirect('party/view/'.$id);
}
}
}
function view($id = null, $page = null) { function view($id = null, $page = null) {
if ($id == "all") { if ($id == "all") {
$this->pageTitle = APP_NAME." - All Parties";
$count = $this->Party->findCount(); $count = $this->Party->findCount();
$pages = ceil($count/10); $pages = ceil($count/10);
if ($page == null) if ($page == null)
$page = 1; $page = 1;
if ($page > 1) if ($page > 1)
$this->set('prev', $page - 1); $this->set('prev', $page - 1);
if ($page < $pages) if ($page < $pages)
$this->set('next', $page + 1); $this->set('next', $page + 1);
$this->set('parties', $this->Party->findAll(null, null, "name ASC", 10, $page)); $this->set('parties', $this->Party->findAll(null, null, "name ASC", 10, $page));
} }
else if (is_numeric($id)) { else if (is_numeric($id)) {
$party = $this->Party->findById($id); $party = $this->Party->findById($id);
$this->set('party', $party); $this->set('party', $party);
$this->pageTitle = APP_NAME." - ".$party['Party']['name'];
if ($party['Party']['useflickr'] == 1) { if ($party['Party']['useflickr'] == 1) {
$data = array('type' => 'flickr', 'userid' => $party['Party']['flickrid']); $data = array('type' => 'flickr', 'userid' => $party['Party']['flickrid']);
@ -126,39 +222,51 @@ class PartyController extends AppController {
if (!empty($party['Party']['guests'])) { if (!empty($party['Party']['guests'])) {
$guests = explode(',', $party['Party']['guests']); $guests = explode(',', $party['Party']['guests']);
$names = array(); $names = array();
for ($i = 0; $i < count($guests); $i++) for ($i = 0; $i < count($guests); $i++)
array_push($names, $this->Party->getUserName($guests[$i])); array_push($names, $this->Party->getUserName($guests[$i]));
$this->set('guests', $guests); $this->set('guests', $guests);
$this->set('names', $names); $this->set('names', $names);
} }
$this->set('host', $this->Party->getUserName($party['Party']['owner'])); $this->set('host', $this->Party->getUserName($party['Party']['owner']));
$this->set('comments', $this->Party->getComments($party['Party']['id'])); $this->set('comments', $this->Party->getComments($party['Party']['id']));
$this->set('body_args', ' onload="mapInit('.$party['Party']['lat'].', '.$party['Party']['long'].', '.$party['Party']['zoom'].', \'stationary\')" onunload="GUnload()"'); $this->set('body_args', ' onload="mapInit('.$party['Party']['lat'].', '.$party['Party']['long'].', '.$party['Party']['zoom'].', \'stationary\')" onunload="GUnload()"');
} }
else { else {
$this->redirect('/party/view/all'); $this->redirect('/party/view/all');
} }
} }
function rsvp($aParty = null) { function rsvp($aParty = null, $icode = null) {
if (!is_numeric($aParty)) if (!is_numeric($aParty))
$this->redirect('/'); $this->redirect('/');
$party = $this->Party->findById($aParty); $invited = false;
if ($icode != null) {
$party = $this->Party->findByInvitecode($icode);
if ($aParty != $party['Party']['id'])
$this->redirect('/party/view/'.$aParty);
else
$invited = true;
}
else
$party = $this->Party->findById($aParty);
$user = $this->Session->read('User'); $user = $this->Session->read('User');
if (empty($user['id'])) if (empty($_SESSION['User']['id']))
$this->redirect('/user/login'); $this->redirect('/user/login');
else { else if ($party['Party']['inviteonly'] != 1 || $invited === true) {
if (empty($party['Party']['guests'])) { if (empty($party['Party']['guests'])) {
$this->data['Party']['guests'] = $user['id']; $this->data['Party']['guests'] = $user['id'];
$this->data['Party']['id'] = $aParty; $this->data['Party']['id'] = $aParty;
} }
else { else {
$attendees = explode(',', $party['Party']['guests']); $attendees = explode(',', $party['Party']['guests']);
if (in_array($user['id'], $attendees)) if (in_array($user['id'], $attendees))
@ -170,10 +278,13 @@ class PartyController extends AppController {
$this->data['Party']['guests'] = $csv; $this->data['Party']['guests'] = $csv;
} }
} }
if ($this->Party->save($this->data)) if ($this->Party->save($this->data))
$this->redirect('/party/view/'.$aParty.'/added'); $this->redirect('/party/view/'.$aParty.'/added');
} }
else
$this->redirect('/party/view/'.$aParty);
} }
function unrsvp($aParty) { function unrsvp($aParty) {
@ -181,7 +292,7 @@ class PartyController extends AppController {
if (empty($user)) { if (empty($user)) {
$this->redirect('/user/login'); $this->redirect('/user/login');
} }
if (is_numeric($aParty)) { if (is_numeric($aParty)) {
$party = $this->Party->findById($aParty); $party = $this->Party->findById($aParty);
$temp = explode(',', $party['Party']['guests']); $temp = explode(',', $party['Party']['guests']);
@ -199,9 +310,39 @@ class PartyController extends AppController {
else else
$this->redirect('/'); $this->redirect('/');
} }
function invite() { function invite($id = null) {
//XXX TODO $this->pageTitle = APP_NAME." - Invite a guest";
if (is_numeric($id) && isset($_SESSION['User'])) {
$party = $this->Party->findById($id);
if ($party['Party']['owner'] === $_SESSION['User']['id']) {
$this->set('partyid', $party['Party']['id']);
$this->set('inviteurl', APP_BASE.'/register/'.$party['Party']['invitecode']);
if (!empty($this->data)) {
if ($this->Party->validates($this->data)) {
$message = array('from' => APP_NAME.' <'.APP_EMAIL.'>',
'envelope' => APP_EMAIL,
'to' => $this->data['Party']['einvite'],
'subject' => 'You\'ve been invited to '.APP_NAME.'!',
'link' => APP_BASE.'/user/register/'.$party['Party']['invitecode'],
'type' => 'invite');
$mail = new mail($message);
$mail->send();
$this->set('preamble', array($this->data['Party']['einvite'], $id));
}
else {
$this->validateErrors($this->Party);
$this->render();
}
}
}
else
$this->redirect('/party/view/'.$id);
}
else
$this->redirect('/user/login');
} }
function js() { function js() {

Просмотреть файл

@ -12,7 +12,7 @@
* for the specific language governing rights and limitations under the * for the specific language governing rights and limitations under the
* License. * License.
* *
* The Original Code is Firefox Party Tool * The Original Code is Mozilla Party Tool
* *
* The Initial Developer of the Original Code is * The Initial Developer of the Original Code is
* Ryan Flint <rflint@dslr.net> * Ryan Flint <rflint@dslr.net>
@ -39,72 +39,115 @@ uses('sanitize');
class UserController extends AppController { class UserController extends AppController {
var $name = 'User'; var $name = 'User';
var $helpers = array('Html'); var $helpers = array('Html');
var $pageTitle;
function index() { function index() {
if (!$this->Session->check('User')) { if (!isset($_SESSION['User'])) {
$this->redirect('/user/login'); $this->redirect('/user/login');
} }
$this->pageTitle = APP_NAME." - My Profile";
$user = $this->Session->read('User'); $user = $this->Session->read('User');
$this->set('parties', $this->User->memberOf($user['id'])); $this->set('parties', $this->User->memberOf($user['id']));
$this->set('hparties', $this->User->hostOf($user['id'])); $this->set('hparties', $this->User->hostOf($user['id']));
} }
function edit() { function edit() {
if (!isset($_SESSION['User'])) {
$this->redirect('/user/login');
}
$this->set('error', false); $this->set('error', false);
$user = $this->User->findById($_SESSION['User']['id']); $this->pageTitle = APP_NAME." - Edit My Account";
$this->set('user', $user); if (empty($this->data)) {
if (GMAP_API_KEY != null && !empty($user['User']['lat'])) $this->User->id = $_SESSION['User']['id'];
$this->data = $this->User->read();
$this->data['User']['password'] = "";
if (GMAP_API_KEY != null && !empty($this->data['User']['lat']))
$this->set('body_args', $this->set('body_args',
' onload="mapInit('.$user["User"]["lat"].', '.$user["User"]["long"].', '.$user["User"]["zoom"].');" onunload="GUnload()"'); ' onload="mapInit('.$this->data["User"]["lat"].', '.$this->data["User"]["long"].', '.$this->data["User"]["zoom"].');" onunload="GUnload()"');
}
if (!empty($this->data)) {
//XXX TODO else {
$this->redirect('/user/'); $user = $this->User->findById($_SESSION['User']['id']);
$this->User->id = $user['User']['id'];
if (!empty($this->data['User']['password'])) {
if ($this->data['User']['password'] === $this->data['User']['confpassword']) {
$string = $user['User']['email'].uniqid(rand(), true).$this->data['User']['password'];
$this->data['User']['salt'] = substr(md5($string), 0, 9);
$this->data['User']['password'] = sha1($this->data['User']['password'] . $this->data['User']['salt']);
}
else {
$this->set('error', true);
$this->render();
}
}
else
$this->data['User']['password'] = $user['User']['password'];
if ($this->User->save($this->data)) {
$this->redirect('/user/');
}
} }
} }
function view($aUid = null) { function view($aUid = null) {
if ($aUid === null || !is_numeric($aUid)) if ($aUid === null || !is_numeric($aUid))
$this->redirect('/'); $this->redirect('/');
else { else {
$user = $this->User->findById($aUid); $user = $this->User->findById($aUid);
$this->pageTitle = APP_NAME." - ".$user['User']['name'];
$this->set('user', $user); $this->set('user', $user);
if (GMAP_API_KEY != null && !empty($user['User']['lat'])) if (GMAP_API_KEY != null && !empty($user['User']['lat']))
$this->set('body_args', $this->set('body_args',
' onload="mapInit('.$user["User"]["lat"].', '.$user["User"]["long"].', '.$user["User"]["zoom"].', \'stationary\');" onunload="GUnload()"'); ' onload="mapInit('.$user["User"]["lat"].', '.$user["User"]["long"].', '.$user["User"]["zoom"].', \'stationary\');" onunload="GUnload()"');
$parties = $this->User->memberOf($user['User']['id']); $parties = $this->User->memberOf($user['User']['id']);
$this->set('parties', $parties); $this->set('parties', $parties);
$this->set('hparties', $this->User->hostOf($user['User']['id']));
} }
} }
function register() { function register($invite = null) {
$this->set('error', false); $this->set('error', false);
if ($this->Session->check('User')) { if (isset($_SESSION['User'])) {
$this->redirect('/user/'); if ($invite != null) {
$this->redirect('/party/rsvp/'.$this->User->getPartyId($invite).'/'.$invite);
}
else
$this->redirect('/user/');
} }
if (empty($this->data))
$this->set('icode', $invite);
$this->pageTitle = APP_NAME." - Register";
if (GMAP_API_KEY != null) if (GMAP_API_KEY != null)
$this->set('body_args', ' onload="mapInit()" onunload="GUnload()"'); $this->set('body_args', ' onload="mapInit()" onunload="GUnload()"');
if (!empty($this->data)) { if (!empty($this->data)) {
$clean = new Sanitize(); $clean = new Sanitize();
$temp = array('email' => $this->data['User']['email'], $temp = array('email' => $this->data['User']['email'],
'password' => $this->data['User']['password'], 'password' => $this->data['User']['password'],
'confpassword' => $this->data['User']['confpassword'], 'confpassword' => $this->data['User']['confpassword'],
'lat' => $clean->sql($this->data['User']['lat']), 'lat' => $clean->sql($this->data['User']['lat']),
'long' => $clean->sql($this->data['User']['long'])); 'long' => $clean->sql($this->data['User']['long']),
'tz' => $clean->sql($this->data['User']['tz']));
//Nuke everything else //Nuke everything else
$clean->cleanArray($this->data); $clean->cleanArray($this->data);
$this->data['User']['email'] = $temp['email']; $this->data['User']['email'] = $temp['email'];
$this->data['User']['password'] = $temp['password']; $this->data['User']['password'] = $temp['password'];
$this->data['User']['confpassword'] = $temp['confpassword']; $this->data['User']['confpassword'] = $temp['confpassword'];
$this->data['User']['lat'] = $temp['lat']; $this->data['User']['lat'] = floatval($temp['lat']);
$this->data['User']['long'] = $temp['long']; $this->data['User']['long'] = floatval($temp['long']);
$this->data['User']['role'] = 0; $this->data['User']['role'] = 0;
$this->data['User']['tz'] = intval($temp['tz']);
if (!$this->User->findByEmail($this->data['User']['email'])) { if (!$this->User->findByEmail($this->data['User']['email'])) {
if ($this->data['User']['password'] === $this->data['User']['confpassword']) { if ($this->data['User']['password'] === $this->data['User']['confpassword']) {
if ($this->User->validates($this->data)) { if ($this->User->validates($this->data)) {
@ -117,23 +160,28 @@ class UserController extends AppController {
for ($i = 0; $i < 10; $i++) { for ($i = 0; $i < 10; $i++) {
$key .= $chars{rand(0,35)}; $key .= $chars{rand(0,35)};
} }
$this->data['User']['active'] = $key; $this->data['User']['active'] = $key;
if ($this->User->save($this->data)) { if ($this->User->save($this->data)) {
$message = array( $message = array(
'from' => 'Firefox Party <noreply@screwedbydesign.com>', 'from' => APP_NAME.' <'.APP_EMAIL.'>',
'envelope' => 'noreply@screwedbydesign.com', 'envelope' => APP_EMAIL,
'to' => $this->data['User']['email'], 'to' => $this->data['User']['email'],
'subject' => 'Your Firefox Party Registration', 'subject' => 'Your '.APP_NAME.' Registration',
'message' => "You're almost ready to party! Just go to http://screwedbydesign.com/cake/user/activate/".$key." to activate your account."); 'link' => APP_BASE.'/user/activate/'.$key,
'type' => 'act');
$mail = new mail($message); $mail = new mail($message);
$mail->send(); $mail->send();
if (!empty($this->data['User']['icode']))
$this->User->addToParty($this->data['User']['icode'], $this->User->getLastInsertID());
$this->redirect('/user/login/new'); $this->redirect('/user/login/new');
} }
} }
else { else {
$this->validateErrors($this->User); $this->validateErrors($this->User);
$this->render(); $this->render();
@ -157,7 +205,7 @@ class UserController extends AppController {
function activate($aKey = null) { function activate($aKey = null) {
if ($aKey == null) if ($aKey == null)
$this->redirect('/'); $this->redirect('/');
else { else {
$this->data = $this->User->findByActive($aKey); $this->data = $this->User->findByActive($aKey);
$this->data['User']['active'] = 1; $this->data['User']['active'] = 1;
@ -167,28 +215,29 @@ class UserController extends AppController {
} }
} }
} }
function login($isNew = null) { function login($isNew = null) {
if ($this->Session->check('User')) { if (isset($_SESSION['User'])) {
$this->redirect('/user/'); $this->redirect('/user/');
} }
$this->pageTitle = APP_NAME." - Login";
$this->set('error', false); $this->set('error', false);
if ($isNew !== null) { if ($isNew !== null) {
switch($isNew) { switch($isNew) {
case "new": case "new":
$this->set('preamble', 'Thank you for registering! To login, you\'ll need to activate your account. Please check your email for your activation link.'); $this->set('preamble', 'Thank you for registering! To login, you\'ll need to activate your account. Please check your email for your activation link.');
break; break;
case "rnew": case "rnew":
$this->set('preamble', 'An email with instructions on how to reset your password has been sent.'); $this->set('preamble', 'An email with instructions on how to reset your password has been sent.');
break; break;
case "active": case "active":
$this->set('preamble', 'Your account has been activated. You may now login.'); $this->set('preamble', 'Your account has been activated. You may now login.');
break; break;
case "reset": case "reset":
$this->set('preamble', 'Your password has been reset.'); $this->set('preamble', 'Your password has been reset.');
break; break;
@ -198,7 +247,7 @@ class UserController extends AppController {
if (!empty($this->data)) { if (!empty($this->data)) {
$user = $this->User->findByEmail($this->data['User']['email']); $user = $this->User->findByEmail($this->data['User']['email']);
if ($user['User']['active'] != 1) { if ($user['User']['active'] != 1) {
$this->set('preamble', 'Your account hasn\'t been activated yet. $this->set('preamble', 'Your account hasn\'t been activated yet.
Please check your email (including junk/spam folders) for your Please check your email (including junk/spam folders) for your
@ -206,26 +255,27 @@ class UserController extends AppController {
to resend your activation details.'); to resend your activation details.');
$this->render(); $this->render();
} }
if ($user['User']['active'] == 1 && $user['User']['password'] == sha1($this->data['User']['password'] . $user['User']['salt'])) { if ($user['User']['active'] == 1 && $user['User']['password'] == sha1($this->data['User']['password'] . $user['User']['salt'])) {
$this->Session->write('User', $user['User']); $this->Session->write('User', $user['User']);
$this->redirect('/user/'); $this->redirect('/user/');
} }
else { else {
$this->set('error', true); $this->set('error', true);
} }
} }
} }
function logout() { function logout() {
$this->Session->delete('User'); $this->Session->delete('User');
$this->redirect('/'); $this->redirect('/');
} }
function recover($aType = null, $aCode = null, $aId = null) { function recover($aType = null, $aCode = null, $aId = null) {
switch ($aType) { switch ($aType) {
case "password": case "password":
$this->pageTitle = APP_NAME." - Password Recovery";
$this->set('hideInput', false); $this->set('hideInput', false);
$this->set('url', 'password'); $this->set('url', 'password');
if (!empty($this->data)) { if (!empty($this->data)) {
@ -237,34 +287,35 @@ class UserController extends AppController {
} }
else { else {
$code = md5($user['User']['salt'].$user['User']['email'].$user['User']['password']); $code = md5($user['User']['salt'].$user['User']['email'].$user['User']['password']);
$message = array('from' => APP_NAME.'<'.APP_EMAIL.'>', $message = array('from' => APP_NAME.'<'.APP_EMAIL.'>',
'envelope' => APP_EMAIL, 'envelope' => APP_EMAIL,
'to' => $user['User']['email'], 'to' => $user['User']['email'],
'subject' => APP_NAME.' Password Request', 'subject' => APP_NAME.' Password Request',
'message' => "Just go to http://screwedbydesign.com/cake/user/recover/password/".$code."/".$user['User']['id']." to reset your password."); 'link' => APP_BASE.'/user/recover/password/'.$code.'/'.$user['User']['id'],
'type' => 'prec');
$mail = new mail($message); $mail = new mail($message);
$mail->send(); $mail->send();
$this->redirect('user/login/rnew'); $this->redirect('user/login/rnew');
} }
} }
if ($aCode !== null && $aId !== null) { if ($aCode !== null && $aId !== null) {
$this->set('hideInput', true); $this->set('hideInput', true);
$this->set('reset', false); $this->set('reset', false);
$user = $this->User->findById($aId); $user = $this->User->findById($aId);
if (!$user) { if (!$user) {
$this->set('error', 'Invalid request. Please check the URL and try again.'); $this->set('error', 'Invalid request. Please check the URL and try again.');
$this->render(); $this->render();
} }
if ($aCode == md5($user['User']['salt'].$user['User']['email'].$user['User']['password'])) { if ($aCode == md5($user['User']['salt'].$user['User']['email'].$user['User']['password'])) {
$this->set('reset', true); $this->set('reset', true);
$this->set('code', $aCode."/".$aId); $this->set('code', $aCode."/".$aId);
$this->render(); $this->render();
} }
else { else {
$this->set('error', 'Invalid request. Please check the URL and try again.'); $this->set('error', 'Invalid request. Please check the URL and try again.');
$this->render(); $this->render();
@ -272,9 +323,10 @@ class UserController extends AppController {
} }
break; break;
case "activate": case "activate":
$this->pageTitle = APP_NAME." - Resend Activation Code";
$this->set('hideInput', false); $this->set('hideInput', false);
$this->set('url', 'activate'); $this->set('url', 'activate');
if (!empty($this->data)) { if (!empty($this->data)) {
$user = $this->User->findByEmail($this->data['User']['email']); $user = $this->User->findByEmail($this->data['User']['email']);
@ -282,17 +334,17 @@ class UserController extends AppController {
$this->set('error', 'Could not find a user with that email address. Please check it and try again.'); $this->set('error', 'Could not find a user with that email address. Please check it and try again.');
$this->render(); $this->render();
} }
if ($user['User']['active'] == 1) if ($user['User']['active'] == 1)
$this->redirect('/user/login/active'); $this->redirect('/user/login/active');
else { else {
$message = array('from' => 'Firefox Party <noreply@screwedbydesign.com>', $message = array('from' => APP_NAME.' <'.APP_EMAIL.'>',
'envelope' => 'noreply@screwedbydesign.com', 'envelope' => APP_EMAIL,
'to' => $user['User']['email'], 'to' => $this->data['User']['email'],
'subject' => 'Your Firefox Party Registration', 'subject' => 'Your '.APP_NAME.' Registration',
'message' => "You're almost ready to party! Just go to http://screwedbydesign.com/cake/user/activate/".$user['User']['active']." to activate your account."); 'link' => APP_BASE.'/user/activate/'.$user['User']['active'],
'type' => 'act');
$mail = new mail($message); $mail = new mail($message);
$mail->send(); $mail->send();
$this->redirect('user/login/new'); $this->redirect('user/login/new');
@ -307,7 +359,7 @@ class UserController extends AppController {
$this->set('error', 'Invalid request. Please check the URL and try again.'); $this->set('error', 'Invalid request. Please check the URL and try again.');
$this->render(); $this->render();
} }
if ($aCode == md5($user['User']['salt'].$user['User']['email'].$user['User']['password'])) { if ($aCode == md5($user['User']['salt'].$user['User']['email'].$user['User']['password'])) {
$string = $user['User']['email'] . uniqid(rand(), true) . $this->data['User']['password']; $string = $user['User']['email'] . uniqid(rand(), true) . $this->data['User']['password'];
$this->data['User']['salt'] = substr(md5($string), 0, 9); $this->data['User']['salt'] = substr(md5($string), 0, 9);
@ -323,7 +375,7 @@ class UserController extends AppController {
$this->redirect('/'); $this->redirect('/');
} }
} }
function delete($id) { function delete($id) {
$role = $this->Session->read('User'); $role = $this->Session->read('User');
if ($role['role'] != 2) if ($role['role'] != 2)

Просмотреть файл

@ -12,7 +12,7 @@
* for the specific language governing rights and limitations under the * for the specific language governing rights and limitations under the
* License. * License.
* *
* The Original Code is Firefox Party Tool * The Original Code is Mozilla Party Tool
* *
* The Initial Developer of the Original Code is * The Initial Developer of the Original Code is
* Ryan Flint <rflint@dslr.net> * Ryan Flint <rflint@dslr.net>
@ -38,7 +38,8 @@ class Party extends AppModel {
var $name = 'Party'; var $name = 'Party';
var $validate = array( var $validate = array(
'name' => VALID_NOT_EMPTY 'name' => VALID_NOT_EMPTY,
'einvite' => VALID_EMAIL
); );
function getComments($pid) { function getComments($pid) {
@ -53,7 +54,7 @@ class Party extends AppModel {
function getUserName($uid) { function getUserName($uid) {
$rv = $this->query("SELECT name FROM users WHERE id = ".$uid); $rv = $this->query("SELECT name FROM users WHERE id = ".$uid);
return $rv[0]['users']['name']; return @$rv[0]['users']['name'];
} }
} }
?> ?>

Просмотреть файл

@ -12,7 +12,7 @@
* for the specific language governing rights and limitations under the * for the specific language governing rights and limitations under the
* License. * License.
* *
* The Original Code is Firefox Party Tool * The Original Code is Mozilla Party Tool
* *
* The Initial Developer of the Original Code is * The Initial Developer of the Original Code is
* Ryan Flint <rflint@dslr.net> * Ryan Flint <rflint@dslr.net>
@ -51,5 +51,31 @@ class User extends AppModel {
$parties = $this->query("SELECT id,name FROM parties WHERE owner = ".$uid); $parties = $this->query("SELECT id,name FROM parties WHERE owner = ".$uid);
return $parties; return $parties;
} }
function getPartyId($icode) {
$party = $this->query("SELECT id FROM parties WHERE invitecode = \"".$icode."\"");
if (!empty($party))
return $party[0]['parties']['id'];
}
function addToParty($icode, $uid) {
$party = $this->query("SELECT id,guests FROM parties WHERE invitecode = \"".$icode."\"");
if (!empty($party[0]['parties']['id'])) {
$guests = $party[0]['parties']['guests'];
if (empty($guests)) {
$guests = $uid;
}
else {
$temp = explode(',', $guests);
array_push($temp, $uid);
$guests = implode(',', $temp);
}
$this->query("UPDATE parties SET guests = \"".$guests."\" WHERE id = ".$party[0]['parties']['id']);
}
}
} }
?> ?>

42
webtools/partytool/vendors/mail.php поставляемый
Просмотреть файл

@ -5,25 +5,41 @@ class mail {
var $subject; var $subject;
var $message; var $message;
var $envelope; var $envelope;
var $head = "<strong>Firefox Party!</strong><br/>";
/** var $foot;
* Everything coming in via $params should be validated already
*/
function mail($params) { function mail($params) {
if (array_key_exists('from', $params)) { if (array_key_exists('from', $params))
$this->from = $params['from']; $this->from = $params['from'];
}
if (array_key_exists('to', $params)) { if (array_key_exists('to', $params))
$this->to = $params['to']; $this->to = $params['to'];
}
if (array_key_exists('subject', $params)) { if (array_key_exists('subject', $params))
$this->subject = $params['subject']; $this->subject = $params['subject'];
}
if (array_key_exists('message', $params)) { if (array_key_exists('message', $params))
$this->message = $params['message']; $this->message = $params['message'];
}
if (array_key_exists('envelope', $params)) { if (array_key_exists('envelope', $params))
$this->envelope = $params['envelope']; $this->envelope = $params['envelope'];
if (array_key_exists('type', $params)) {
switch($params['type']) {
case "act":
$this->message = $this->head."<br/>\nThank you for registering! To activate your account <a href=\"".$params['link']."\">click here</a>, or paste the link below into your browser<br/>".$params['link'].$this->foot;
break;
case "prec":
$this->message = $this->head."<br/>\nTo reset your password <a href=\"".$params['link']."\">click here</a>, or paste the link below into your browser<br/>".$params['link'].$this->foot;
break;
case "invite":
$this->message = $this->head."<br/>\nYou've been invited by a friend to join them in celebrating the release of Firefox 2. To join them, just <a href=\"".$params['link']."\">click here</a> and sign up for an account.\n
If you're unable to use the link above, simply paste the following URL into your browser: ".$params['link'].$this->foot;
break;
}
} }
} }

4
webtools/partytool/vendors/webServices.php поставляемый
Просмотреть файл

@ -74,6 +74,10 @@ class webServices {
} }
} }
function getFlickrId() {
return $this->userid;
}
function fetchPhotos($tags, $num_results) { function fetchPhotos($tags, $num_results) {
$head = "GET /services/rest/?method=flickr.photos.search&api_key=".FLICKR_API_KEY."&user_id=".$this->userid."&tags=".$tags."&per_page=".$num_results." HTTP/1.1\r\n"; $head = "GET /services/rest/?method=flickr.photos.search&api_key=".FLICKR_API_KEY."&user_id=".$this->userid."&tags=".$tags."&per_page=".$num_results." HTTP/1.1\r\n";
$head .= "Host: ".$this->host."\r\n"; $head .= "Host: ".$this->host."\r\n";

Просмотреть файл

@ -1,3 +1,5 @@
<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>

Просмотреть файл

@ -1,8 +1,9 @@
<div style="font-size: x-large; font-weight: bold; text-align: center"> <div style="font-size: x-large; font-weight: bold; text-align: center">
<?php echo $pcount.(($pcount == 1) ? ' Party, ' : ' Parties, ').$ucount.(($ucount == 1) ? ' Partygoer, ' : ' Partygoers, '); <?php
echo $pcount.(($pcount == 1) ? ' Party, ' : ' Parties, ').$ucount.(($ucount == 1) ? ' Partygoer, ' : ' Partygoers, ');
$difference = 1161975280 - time(); $difference = 1161975280 - time();
$days_left = floor($difference/60/60/24); $days_left = floor($difference/60/60/24);
echo $days_left." days until Firefox 2!"; ?><br/></div> echo "and ".$days_left." days until Firefox 2!"; ?><br/></div>
<div> <div>
<div style="float: left; width: 75%"> <div style="float: left; width: 75%">
@ -18,6 +19,6 @@ Maecenas varius massa sit amet nulla. Nunc sit amet mauris. Nunc eu purus a sapi
<li><a href="<?php echo $html->url('/party/view/all'); ?>">View all parties</a></li> <li><a href="<?php echo $html->url('/party/view/all'); ?>">View all parties</a></li>
<li><a href="<?php echo $html->url('/user/register'); ?>">Register</a></li> <li><a href="<?php echo $html->url('/user/register'); ?>">Register</a></li>
<li><a href="<?php echo $html->url('/party/register'); ?>">Create a party</a></li> <li><a href="<?php echo $html->url('/party/register'); ?>">Create a party</a></li>
<ul> </ul>
</div> </div>
</div> </div>

Просмотреть файл

@ -0,0 +1,124 @@
<form action="<?php echo $html->url('/party/edit/'.$party['Party']['id']); ?>" method="post">
<?php echo $html->hidden('Party/id'); ?>
<div>
<h2>Details</h2>
<hr/>
<label for="name">Party Name:</label>
<?php echo $html->input('Party/name', array('size' => 35)); ?>
</div>
<div>
<label for="">Venue Name:</label>
<?php echo $html->input('Party/vname', array('size' => 35)); ?>
</div>
<div>
<label for="website">Web site:</label>
<?php echo $html->input('Party/website', array('size' => 35)); ?>
</div>
<div>
<label for="address">Address:</label>
<?php echo $html->input('Party/address', array('size' => 35, 'id' => 'location', 'onkeypress' => 'capture(event)', 'onblur' => 'update()')); ?>
<div id="suggest" style="display: none">Did you mean <span style="font-style: italic"><a id="suggest2" href="#" onclick=""></a></span>?</div>
</div>
<?php if(GMAP_API_KEY != null): ?>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?php echo GMAP_API_KEY; ?>"
type="text/javascript"></script>
<script src="<?php echo $html->url('/js/maps.js'); ?>" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function update(aSuggest) {
var loc;
if (!aSuggest)
loc = document.getElementById("location").value;
else
loc = aSuggest;
if (loc != "")
geocode(loc);
}
function capture(event) {
if (event.keyCode == 13) {
event.preventDefault();
update();
}
}
//]]>
</script>
<div style="width: 350px; height: 200px;">
<div id="maperror" style="display: none" class="error"></div>
<div id="map" style="height: 100%; width: 100%;"></div>
</div>
<div>
Additional notes:<br/>
<?php echo $html->textarea('Party/notes'); ?>
</div>
<div>
<h2>Date</h2>
<hr/>
<label for="date">Date:</label>
<?php echo $html->yearOptionTag('Party/year', null, date('Y'), MAX_YEAR, date('Y'), null, null, false); ?>-<?php echo $html->hourOptionTag('Party/month', null, false, date('m')); ?>-<?php echo $html->dayOptionTag('Party/day', null, date('d'), null, false); ?>
</div>
<div>
<label for="time">Time:</label>
<?php echo $html->hourOptionTag('Party/hour', null, true);?>:<?php echo $html->minuteOptionTag('Party/minute');?>
<?php echo $html->radio('Party/confirmed', array(0 => 'Tentative', 1 => 'Confirmed')); ?>
</div>
<div>
<label for="UserTz">Timezone (current time is <?php echo gmdate("Y-m-d H:i:s"); ?>GMT):</label>
<select name="data[Party][tz]" id="UserTz">
<option value="-12">GMT-12</option>
<option value="-11">GMT-11</option>
<option value="-10">GMT-10</option>
<option value="-9">GMT-9</option>
<option value="-8">GMT-8</option>
<option value="-7">GMT-7</option>
<option value="-6">GMT-6</option>
<option value="-5">GMT-5</option>
<option value="-4">GMT-4</option>
<option value="-3">GMT-3</option>
<option value="-2">GMT-2</option>
<option value="-1">GMT-1</option>
<option value="0" selected="selected">GMT+0</option>
<option value="1">GMT+1</option>
<option value="2">GMT+2</option>
<option value="3">GMT+3</option>
<option value="4">GMT+4</option>
<option value="5">GMT+5</option>
<option value="6">GMT+6</option>
<option value="7">GMT+7</option>
<option value="8">GMT+8</option>
<option value="9">GMT+9</option>
<option value="10">GMT+10</option>
<option value="11">GMT+11</option>
<option value="12">GMT+12</option>
</select>
</div>
<div>
<h2><span style="color: #0063dc">flick</span><span style="color: #ff0084">r</span> integration</h2>
<hr/>
<p>To show photos of your party, simply tag them with <strong><?php echo FLICKR_TAG_PREFIX.$party['Party']['id'] ?></strong> and fill out the information below.</p>
<label for="PartyUseflickr">Show photostream:</label>
<?php echo $html->checkbox('Party/useflickr'); ?><br/>
<label for="PartyFlickruse">Show:</label>
<?php echo $html->radio('Party/flickruse', array(0 => 'Only my photos', 1 => 'Anyone\'s photos')); ?><br/>
<label for="website">Flickr username:</label>
<?php echo $html->input('Party/flickrusr', array('size' => 35)); ?>
</div>
<div>
<h2>Privacy</h2>
<hr/>
<label for="PartyInviteonly">Invite only:</label>
<?php echo $html->checkbox('Party/inviteonly'); ?><br/>
<label for="PartyGuestsonly">Show full address to party guests only:</label>
<?php echo $html->checkbox('Party/guestsonly'); ?><br/>
<label for="PartyGuestcomments">Limit comments to party guests only:</label>
<?php echo $html->checkbox('Party/guestcomments'); ?><br/>
</div>
<?php echo $html->hidden('Party/lat', array('id' => 'lat'));
echo $html->hidden('Party/long', array('id' => 'long'));
echo $html->hidden('Party/zoom', array('id' => 'zoom'));
echo $html->hidden('Party/geocoded', array('id' => 'geocoded', 'value' => 0)); ?>
<?php endif; ?>
<?php echo $html->submit('Update'); ?>
</form>

Просмотреть файл

@ -22,7 +22,35 @@
<div> <div>
<label for="time">Time:</label> <label for="time">Time:</label>
<?php echo $html->hourOptionTag('Party/hour', null, true);?>:<?php echo $html->minuteOptionTag('Party/minute');?> <?php echo $html->hourOptionTag('Party/hour', null, true);?>:<?php echo $html->minuteOptionTag('Party/minute');?>
<?php echo $html->radio('Party/confirmed', array(0 => 'Tentative', 1 => 'Confirmed')); ?> <?php echo $html->radio('Party/confirmed', array(0 => 'Tentative', 1 => 'Confirmed')); ?><br/>
<label for="UserTz">Timezone (current time is <?php echo gmdate("Y-m-d H:i:s"); ?>GMT):</label>
<select name="data[Party][tz]" id="UserTz">
<option value="-12">GMT-12</option>
<option value="-11">GMT-11</option>
<option value="-10">GMT-10</option>
<option value="-9">GMT-9</option>
<option value="-8">GMT-8</option>
<option value="-7">GMT-7</option>
<option value="-6">GMT-6</option>
<option value="-5">GMT-5</option>
<option value="-4">GMT-4</option>
<option value="-3">GMT-3</option>
<option value="-2">GMT-2</option>
<option value="-1">GMT-1</option>
<option value="0" selected="selected">GMT+0</option>
<option value="1">GMT+1</option>
<option value="2">GMT+2</option>
<option value="3">GMT+3</option>
<option value="4">GMT+4</option>
<option value="5">GMT+5</option>
<option value="6">GMT+6</option>
<option value="7">GMT+7</option>
<option value="8">GMT+8</option>
<option value="9">GMT+9</option>
<option value="10">GMT+10</option>
<option value="11">GMT+11</option>
<option value="12">GMT+12</option>
</select>
</div> </div>
<div> <div>
<label for="website">Web site:</label> <label for="website">Web site:</label>

Просмотреть файл

@ -9,7 +9,7 @@
if (!empty($party['Party']['vname'])) if (!empty($party['Party']['vname']))
echo 'Venue: '.$party['Party']['vname']."<br/>\n"; echo 'Venue: '.$party['Party']['vname']."<br/>\n";
echo 'Date: '.(($party['Party']['confirmed'] == 1) ? date('Y-m-d h:m', $party['Party']['date']) : "TBA")."<br/>\n"; echo 'Date: '.(($party['Party']['confirmed'] == 1) ? gmdate('Y-m-d h:ia', $party['Party']['date'] + (@$_SESSION['User']['tz'] * 60 * 60))." GMT".@$_SESSION['User']['tz'] : "TBA")."<br/>\n";
if (!empty($party['Party']['website'])) if (!empty($party['Party']['website']))
echo 'Website: <a href="'.$party['Party']['website'].'" rel="nofollow">'.$party['Party']['website']."</a><br/>\n"; echo 'Website: <a href="'.$party['Party']['website'].'" rel="nofollow">'.$party['Party']['website']."</a><br/>\n";
@ -22,17 +22,24 @@
type="text/javascript"></script> type="text/javascript"></script>
<script src="<?php echo $html->url('/js/maps.js'); ?>" type="text/javascript"></script> <script src="<?php echo $html->url('/js/maps.js'); ?>" type="text/javascript"></script>
<div id="map" style="height: 200px; width: 400px;"></div> <div id="map" style="height: 200px; width: 400px;"></div>
<h2>Who's coming:</h2> <h2>Who's coming</h2>
<div> <div>
<?php if (isset($guests)): <?php if (isset($guests)):
$i = 0; $i = 0;
$c = count($guests) - 1; $c = count($guests) - 1;
foreach ($guests as $guest): ?> foreach ($guests as $guest): ?>
<a href="<?php echo $html->url('/user/view/'.$guest); ?>"><?php echo $names[$i]; ?></a><?php echo ($i < $c) ? ", " : ""; ?> <a href="<?php echo $html->url('/user/view/'.$guest); ?>"><?php echo $names[$i]; ?></a><?php echo ($i < $c) ? ", " : ""; ?>
<?php $i++; endforeach; endif; if (isset($_SESSION['User']['id'])):?> <?php $i++;
endforeach;
else:
echo "No guests yet, be the first!";
endif;
@$isguest = (isset($guests)) ? in_array($_SESSION['User']['id'], $guests) : 0;
if (isset($_SESSION['User']['id']) && @$_SESSION['User']['id'] != $party['Party']['owner'] && ($party['Party']['inviteonly'] != 1 || $isguest)):?>
<br/><br/> <br/><br/>
<form action="<?php <form action="<?php
$isguest = (isset($guests)) ? in_array($_SESSION['User']['id'], $guests) : 0;
echo $html->url('/party/'.((!$isguest) ? 'rsvp/' : 'unrsvp/').$party['Party']['id']); ?>" method="post"> echo $html->url('/party/'.((!$isguest) ? 'rsvp/' : 'unrsvp/').$party['Party']['id']); ?>" method="post">
<?php if(!$isguest): ?> <?php if(!$isguest): ?>
<button>Count me in!</button> <button>Count me in!</button>
@ -42,16 +49,21 @@
</form> </form>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php if (@$_SESSION['User']['id'] == $party['Party']['owner']):?>
<h2>Party options</h2>
<a href="<?php echo $html->url('/party/edit/'.$party['Party']['id']);?>">Edit party</a>
<a href="<?php echo $html->url('/party/invite/'.$party['Party']['id']);?>">Invite a guest</a>
<?php endif; ?>
<?php if (isset($flickr)): ?> <?php if (isset($flickr)): ?>
<a id="photos"></a> <a id="photos"></a>
<h2>Photos:</h2> <h2>Photos</h2>
<?php foreach ($flickr as $pic): ?> <?php foreach ($flickr as $pic): ?>
<a href="http://www.flickr.com/photos/<?php echo $pic['owner']."/".$pic['id']."/" ?>"><img src="http://static.flickr.com/<?php echo $pic['server']."/".$pic['id']."_".$pic['secret']."_s.jpg" ?>"/></a> <a href="http://www.flickr.com/photos/<?php echo $pic['owner']."/".$pic['id']."/" ?>"><img src="http://static.flickr.com/<?php echo $pic['server']."/".$pic['id']."_".$pic['secret']."_s.jpg" ?>"/></a>
<?php endforeach; ?> <?php endforeach; ?>
<br/> <br/>
<?php endif; <?php endif;
if (!empty($comments)): ?> if (!empty($comments)): ?>
<h2>Comments:</h2> <h2>Comments</h2>
<?php $i = 0; <?php $i = 0;
foreach ($comments as $comment): foreach ($comments as $comment):
if ($i % 2 == 0) if ($i % 2 == 0)
@ -59,11 +71,14 @@
else else
$color = "#DDD"; $color = "#DDD";
$i++;?> $i++;?>
<div style="border-top: 1px solid #555; background: <?php echo $color;?>"><?php echo $comment['comments']['text']; ?><br/>Posted by <a href="<?php echo $html->url('/user/view/'.$comment['users']['uid']); ?>"><?php echo $comment['users']['name']; ?></a> on <?php echo date('Y-m-d h:ia', $comment['comments']['time']); ?></span></div> <div style="border-top: 1px solid #555; background: <?php echo $color;?>"><?php echo $comment['comments']['text']; ?>
<br/>Posted by <a href="<?php echo $html->url('/user/view/'.$comment['users']['uid']); ?>">
<?php echo $comment['users']['name']; ?></a> on <?php echo date('Y-m-d h:ia', $comment['comments']['time'] - (@$_SESSION['User']['tz'] * 60 * 60))." GMT".@$_SESSION['User']['tz']; ?></span>
</div>
<?php endforeach; <?php endforeach;
endif; endif;
if (isset($_SESSION['User'])): ?> if (isset($_SESSION['User'])): ?>
<h2>Add a comment:</h2> <h2>Add a comment</h2>
<form action="<?php echo $html->url('/comment/add/'.$party['Party']['id'].'/'.$_SESSION['User']['id']); ?>" method="post"> <form action="<?php echo $html->url('/comment/add/'.$party['Party']['id'].'/'.$_SESSION['User']['id']); ?>" method="post">
<div> <div>
<?php echo $html->textarea('Comment/text', array('rows' => 10, 'cols' => 50))."<br/>".$html->submit('Submit'); ?> <?php echo $html->textarea('Comment/text', array('rows' => 10, 'cols' => 50))."<br/>".$html->submit('Submit'); ?>
@ -93,7 +108,7 @@
if (!empty($party['Party']['vname'])) if (!empty($party['Party']['vname']))
echo 'Venue: '.$party['Party']['vname']."<br/>\n"; echo 'Venue: '.$party['Party']['vname']."<br/>\n";
echo 'Date: '.(($party['Party']['confirmed'] == 1) ? date('Y-m-d h:m', $party['Party']['date']) : "TBA")."<br/>\n"; echo 'Date: '.(($party['Party']['confirmed'] == 1) ? gmdate('Y-m-d h:ia', $party['Party']['date'] + (@$_SESSION['User']['tz'] * 60 * 60))." GMT".@$_SESSION['User']['tz'] : "TBA")."<br/>\n";
if (!empty($party['Party']['website'])) if (!empty($party['Party']['website']))
echo 'Website: <a href="'.$party['Party']['website'].'" rel="nofollow">'.$party['Party']['website']."</a><br/>\n"; echo 'Website: <a href="'.$party['Party']['website'].'" rel="nofollow">'.$party['Party']['website']."</a><br/>\n";
@ -102,7 +117,7 @@
?> ?>
</div> </div>
<?php endforeach; <?php endforeach;
if (isset($prev)) if (isset($prev))
echo '<a href="'.$html->url('/party/view/all/'.$prev).'">Previous Page</a> '; echo '<a href="'.$html->url('/party/view/all/'.$prev).'">Previous Page</a> ';
if (isset($next)) if (isset($next))

Просмотреть файл

@ -1,23 +1,21 @@
<?php if ($error): ?> <?php if ($error): ?>
<p>There was an error in your submission, please try again.</p> <p>There was an error in your submission, please try again.</p>
<?php endif; ?> <?php endif; ?>
<form action="<?php echo $html->url('/user/register'); ?>" method="post"> <form action="<?php echo $html->url('/user/edit'); ?>" method="post">
<?php echo $html->hidden('User/id'); ?>
<div> <div>
<h2>Profile</h2>
<hr/>
<label for="name">Name:</label> <label for="name">Name:</label>
<?php echo $html->input('User/name', array('size' => 20, 'value' => $user['User']['name'])); ?> <?php echo $html->input('User/name', array('size' => 20)); ?>
</div>
<div>
<label for="password"><strong>Password</strong>:</label>
<?php echo $html->password('User/password', array('size' => 20)); ?>
<?php echo $html->tagErrorMsg('User/password', 'Passwords don\'t match!')?>
</div> </div>
<div> <div>
<label for="confpassword"><strong>Confirm password</strong>:</label> <label for="name">Website:</label>
<?php echo $html->password('User/confpassword', array('size' => 20)); ?> <?php echo $html->input('User/website', array('size' => 20)); ?>
</div> </div>
<div> <div>
<label for="location">Location:</label> <label for="location">Location:</label>
<?php echo $html->input('User/location', array('id' => 'location', 'size' => 20, 'onkeypress' => 'capture(event)', 'value' => $user['User']['location'])); ?> <?php echo $html->input('User/location', array('id' => 'location', 'size' => 20, 'onkeypress' => 'capture(event)')); ?>
</div> </div>
<?php if(GMAP_API_KEY != null): ?> <?php if(GMAP_API_KEY != null): ?>
<a onclick="update()">Update map</a> <a onclick="update()">Update map</a>
@ -40,15 +38,34 @@
} }
//]]> //]]>
</script> </script>
<div style="width: 500px; height: 300px"> <div style="width: 400px; height: 250px">
<div id="maperror" style="display: none" class="error"></div> <div id="maperror" style="display: none" class="error"></div>
<div id="map" style="height: 100%; width: 100%;"></div> <div id="map" style="height: 100%; width: 100%;"></div>
</div> </div>
<div> <div>
<?php echo $html->hidden('User/lat', array('id' => 'lat')); <h2>Privacy</h2>
echo $html->hidden('User/long', array('id' => 'long')); <hr/>
echo $html->hidden('User/zoom', array('id' => 'zoom')); ?> <label for="UserShowemail">Show email:</label>
<?php echo $html->checkbox('User/showemail'); ?><br/>
<label for="UserShowloc">Show location:</label>
<?php echo $html->checkbox('User/showloc'); ?><br/>
<label for="UserShowmap">Show map:</label>
<?php echo $html->checkbox('User/showmap'); ?><br/>
</div> </div>
<div>
<h2>Password</h2>
<hr/>
<label for="password">New password:</label>
<?php echo $html->password('User/password', array('size' => 20)); ?>
<?php echo $html->tagErrorMsg('User/password', 'Passwords don\'t match!')?>
</div>
<div>
<label for="confpassword">Confirm new password:</label>
<?php echo $html->password('User/confpassword', array('size' => 20)); ?>
</div>
<?php echo $html->hidden('User/lat', array('id' => 'lat'));
echo $html->hidden('User/long', array('id' => 'long'));
echo $html->hidden('User/zoom', array('id' => 'zoom')); ?>
<?php endif; ?> <?php endif; ?>
<?php echo $html->submit('Update'); ?> <?php echo $html->submit('Update'); ?>
</form> </form>

Просмотреть файл

@ -24,6 +24,36 @@
<label for="location">Location:</label> <label for="location">Location:</label>
<?php echo $html->input('User/location', array('id' => 'location', 'size' => 20, 'onkeypress' => 'capture(event)')); ?> <?php echo $html->input('User/location', array('id' => 'location', 'size' => 20, 'onkeypress' => 'capture(event)')); ?>
</div> </div>
<div>
<label for="UserTz">Timezone (current time is <?php echo gmdate("Y-m-d H:i:s"); ?>GMT):</label>
<select name="data[User][tz]" id="UserTz">
<option value="-12">GMT-12</option>
<option value="-11">GMT-11</option>
<option value="-10">GMT-10</option>
<option value="-9">GMT-9</option>
<option value="-8">GMT-8</option>
<option value="-7">GMT-7</option>
<option value="-6">GMT-6</option>
<option value="-5">GMT-5</option>
<option value="-4">GMT-4</option>
<option value="-3">GMT-3</option>
<option value="-2">GMT-2</option>
<option value="-1">GMT-1</option>
<option value="0" selected="selected">GMT+0</option>
<option value="1">GMT+1</option>
<option value="2">GMT+2</option>
<option value="3">GMT+3</option>
<option value="4">GMT+4</option>
<option value="5">GMT+5</option>
<option value="6">GMT+6</option>
<option value="7">GMT+7</option>
<option value="8">GMT+8</option>
<option value="9">GMT+9</option>
<option value="10">GMT+10</option>
<option value="11">GMT+11</option>
<option value="12">GMT+12</option>
</select>
</div>
<div> <div>
<label for="website">Website:</label> <label for="website">Website:</label>
<?php echo $html->input('User/website', array('size' => 20)); ?> <?php echo $html->input('User/website', array('size' => 20)); ?>
@ -56,7 +86,8 @@
<div> <div>
<?php echo $html->hidden('User/lat', array('id' => 'lat')); <?php echo $html->hidden('User/lat', array('id' => 'lat'));
echo $html->hidden('User/long', array('id' => 'long')); echo $html->hidden('User/long', array('id' => 'long'));
echo $html->hidden('User/zoom', array('id' => 'zoom')); ?> echo $html->hidden('User/zoom', array('id' => 'zoom'));
echo $html->hidden('User/icode', array('value' => $icode)); ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php echo $html->submit('Register'); ?> <?php echo $html->submit('Register'); ?>

Просмотреть файл

@ -11,13 +11,28 @@
if (!empty($user['User']['website'])) if (!empty($user['User']['website']))
echo 'Website: <a href="'.$user['User']['website'].'" rel="nofollow">'.$user['User']['website'].'</a><br/>'; echo 'Website: <a href="'.$user['User']['website'].'" rel="nofollow">'.$user['User']['website'].'</a><br/>';
echo "Attending: "; if (!empty($parties)) {
$c = count($parties) - 1; echo "Attending: ";
$i = 0; $c = count($parties) - 1;
foreach ($parties as $party) { $i = 0;
echo '<a href="'.$html->url('/party/view/'.$party['parties']['id']).'">'.$party['parties']['name'].'</a>';
echo ($i < $c) ? ', ' : ''; foreach ($parties as $party) {
$i++; echo '<a href="'.$html->url('/party/view/'.$party['parties']['id']).'">'.$party['parties']['name'].'</a>';
echo ($i < $c) ? ', ' : '<br/>';
$i++;
}
}
if (!empty($hparties)) {
echo "Host of: ";
$c = count($hparties) - 1;
$i = 0;
foreach ($hparties as $party) {
echo '<a href="'.$html->url('/party/view/'.$party['parties']['id']).'">'.$party['parties']['name'].'</a>';
echo ($i < $c) ? ', ' : '<br/>';
$i++;
}
} }
?> ?>

Просмотреть файл

@ -3,4 +3,4 @@
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule> </IfModule>

Просмотреть файл

@ -1,104 +1,104 @@
<?php <?php
/* SVN FILE: $Id: css.php,v 1.1 2006/09/11 05:56:11 reed%reedloden.com Exp $ */ /* SVN FILE: $Id: css.php,v 1.3 2006/09/28 03:22:10 reed%reedloden.com Exp $ */
/** /**
* Short description for file. * Short description for file.
* *
* Long description for file * Long description for file
* *
* PHP versions 4 and 5 * PHP versions 4 and 5
* *
* CakePHP : Rapid Development Framework <http://www.cakephp.org/> * CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2006, Cake Software Foundation, Inc. * Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204 * 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104 * Las Vegas, Nevada 89104
* *
* Licensed under The MIT License * Licensed under The MIT License
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @filesource * @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc. * @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake * @package cake
* @subpackage cake.app.webroot * @subpackage cake.app.webroot
* @since CakePHP v 0.2.9 * @since CakePHP v 0.2.9
* @version $Revision: 1.1 $ * @version $Revision: 1.3 $
* @modifiedby $LastChangedBy: phpnut $ * @modifiedby $LastChangedBy: phpnut $
* @lastmodified $Date: 2006/09/11 05:56:11 $ * @lastmodified $Date: 2006/09/28 03:22:10 $
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
if (!defined(CAKE_CORE_INCLUDE_PATH)) { if (!defined(CAKE_CORE_INCLUDE_PATH)) {
die('You can not access this file directly'); die('You can not access this file directly');
} }
/** /**
* Enter description here... * Enter description here...
*/ */
require(CONFIGS . 'paths.php'); require(CONFIGS . 'paths.php');
require(CAKE . 'basics.php'); require(CAKE . 'basics.php');
require(LIBS . 'folder.php'); require(LIBS . 'folder.php');
require(LIBS . 'file.php'); require(LIBS . 'file.php');
require(LIBS . 'legacy.php'); require(LIBS . 'legacy.php');
/** /**
* Enter description here... * Enter description here...
* *
* @param unknown_type $path * @param unknown_type $path
* @param unknown_type $name * @param unknown_type $name
* @return unknown * @return unknown
*/ */
function make_clean_css($path, $name) { function make_clean_css($path, $name) {
require(VENDORS . 'csspp' . DS . 'csspp.php'); require(VENDORS . 'csspp' . DS . 'csspp.php');
$data =file_get_contents($path); $data =file_get_contents($path);
$csspp =new csspp(); $csspp =new csspp();
$output=$csspp->compress($data); $output=$csspp->compress($data);
$ratio =100 - (round(strlen($output) / strlen($data), 3) * 100); $ratio =100 - (round(strlen($output) / strlen($data), 3) * 100);
$output=" /* file: $name, ratio: $ratio% */ " . $output; $output=" /* file: $name, ratio: $ratio% */ " . $output;
return $output; return $output;
} }
/** /**
* Enter description here... * Enter description here...
* *
* @param unknown_type $path * @param unknown_type $path
* @param unknown_type $content * @param unknown_type $content
* @return unknown * @return unknown
*/ */
function write_css_cache($path, $content) { function write_css_cache($path, $content) {
if (!is_dir(dirname($path))) { if (!is_dir(dirname($path))) {
mkdir(dirname($path)); mkdir(dirname($path));
} }
$cache=new File($path); $cache=new File($path);
return $cache->write($content); return $cache->write($content);
} }
if (preg_match('|\.\.|', $url) || !preg_match('|^ccss/(.+)$|i', $url, $regs)) { if (preg_match('|\.\.|', $url) || !preg_match('|^ccss/(.+)$|i', $url, $regs)) {
die('Wrong file name.'); die('Wrong file name.');
} }
$filename = 'css/' . $regs[1]; $filename = 'css/' . $regs[1];
$filepath = CSS . $regs[1]; $filepath = CSS . $regs[1];
$cachepath = CACHE . 'css' . DS . str_replace(array('/','\\'), '-', $regs[1]); $cachepath = CACHE . 'css' . DS . str_replace(array('/','\\'), '-', $regs[1]);
if (!file_exists($filepath)) { if (!file_exists($filepath)) {
die('Wrong file name.'); die('Wrong file name.');
} }
if (file_exists($cachepath)) { if (file_exists($cachepath)) {
$templateModified=filemtime($filepath); $templateModified=filemtime($filepath);
$cacheModified =filemtime($cachepath); $cacheModified =filemtime($cachepath);
if ($templateModified > $cacheModified) { if ($templateModified > $cacheModified) {
$output=make_clean_css($filepath, $filename); $output=make_clean_css($filepath, $filename);
write_css_cache($cachepath, $output); write_css_cache($cachepath, $output);
} else { } else {
$output = file_get_contents($cachepath); $output = file_get_contents($cachepath);
} }
} else { } else {
$output=make_clean_css($filepath, $filename); $output=make_clean_css($filepath, $filename);
write_css_cache($cachepath, $output); write_css_cache($cachepath, $output);
} }
header("Date: " . date("D, j M Y G:i:s ", $templateModified) . 'GMT'); header("Date: " . date("D, j M Y G:i:s ", $templateModified) . 'GMT');
header("Content-Type: text/css"); header("Content-Type: text/css");
header("Expires: " . gmdate("D, j M Y H:i:s", time() + DAY) . " GMT"); header("Expires: " . gmdate("D, j M Y H:i:s", time() + DAY) . " GMT");
header("Cache-Control: cache"); // HTTP/1.1 header("Cache-Control: cache"); // HTTP/1.1
header("Pragma: cache"); // HTTP/1.0 header("Pragma: cache"); // HTTP/1.0
print $output; print $output;
?> ?>

Просмотреть файл

@ -1,74 +1,81 @@
.error { .error, .error_message {
background: #ffa5a5; background: #ffa5a5;
border: 1px solid red; border: 1px solid red;
text-align: center; text-align: center;
font-weight: bold; font-weight: bold;
padding: 5px; padding: 5px;
margin: 5px 0 5px 0; margin: 5px 0 5px 0;
} }
.info { .form_error {
background: #fffe94; background: #ffa5a5;
border: 1px solid yellow; border: 1px solid red;
text-align: center; }
font-weight: bold;
padding: 5px; .info {
margin: 5px 0 5px 0; background: #fffe94;
} border: 1px solid yellow;
text-align: center;
#user { font-weight: bold;
position: absolute; padding: 5px;
right: 0; margin: 5px 0 5px 0;
} }
img { border: 1px solid #555 } #user {
position: absolute;
body { right: 0;
background: #fff url("/cake/img/body_back.png") top repeat-x; }
color: #555;
font-family: arial, sans-serif; img { border: 1px solid #555 }
margin: 0 10px;
padding: 0; h2 + hr { padding: 0; margin: 0;}
font-size: x-small;
voice-family: "\"}\""; body {
voice-family: inherit; background: #fff url("/cake/img/body_back.png") top repeat-x;
font-size: small; color: #555;
} font-family: arial, sans-serif;
margin: 0 10px;
a { color: #34518c; text-decoration: none; } padding: 0;
a:hover { text-decoration: underline; } font-size: x-small;
voice-family: "\"}\"";
#container { voice-family: inherit;
width: 742px; font-size: small;
position: relative; }
margin: 0 auto;
padding: 22px 0; a { color: #34518c; text-decoration: none; }
} a:hover { text-decoration: underline; }
#mozilla-com a { #container {
position: absolute; width: 742px;
top: 0; position: relative;
left: 0; margin: 0 auto;
display: block; padding: 22px 0;
text-indent: -5000em; }
width: 110px;
height: 25px; #mozilla-com a {
text-decoration: none; position: absolute;
background: url("/cake/img/mozilla-org.png") no-repeat; top: 0;
} left: 0;
display: block;
#header { text-indent: -5000em;
background: url("/cake/img/header.gif") no-repeat; width: 110px;
color: white; height: 25px;
font-family: Arial; text-decoration: none;
font-size: 30px; background: url("/cake/img/mozilla-org.png") no-repeat;
font-weight: bold; }
text-align: center;
height: 127px; #header {
} background: url("/cake/img/header.gif") no-repeat;
color: white;
#header a { color: white; text-decoration: none; } font-family: Arial;
font-size: 30px;
#map { font-weight: bold;
border: 1px solid #555; text-align: center;
height: 127px;
}
#header a { color: white; text-decoration: none; }
#map {
border: 1px solid #555;
} }

Просмотреть файл

@ -1,87 +1,87 @@
<?php <?php
/* SVN FILE: $Id: index.php,v 1.1 2006/09/11 05:56:11 reed%reedloden.com Exp $ */ /* SVN FILE: $Id: index.php,v 1.4 2006/10/08 03:39:23 reed%reedloden.com Exp $ */
/** /**
* Short description for file. * Short description for file.
* *
* Long description for file * Long description for file
* *
* PHP versions 4 and 5 * PHP versions 4 and 5
* *
* CakePHP : Rapid Development Framework <http://www.cakephp.org/> * CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2006, Cake Software Foundation, Inc. * Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204 * 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104 * Las Vegas, Nevada 89104
* *
* Licensed under The MIT License * Licensed under The MIT License
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @filesource * @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc. * @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake * @package cake
* @subpackage cake.app.webroot * @subpackage cake.app.webroot
* @since CakePHP v 0.2.9 * @since CakePHP v 0.2.9
* @version $Revision: 1.1 $ * @version $Revision: 1.4 $
* @modifiedby $LastChangedBy: phpnut $ * @modifiedby $LastChangedBy: phpnut $
* @lastmodified $Date: 2006/09/11 05:56:11 $ * @lastmodified $Date: 2006/10/08 03:39:23 $
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
/** /**
* Do not change * Do not change
*/ */
if (!defined('DS')) { if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR); define('DS', DIRECTORY_SEPARATOR);
} }
/** /**
* These defines should only be edited if you have cake installed in * These defines should only be edited if you have cake installed in
* a directory layout other than the way it is distributed. * a directory layout other than the way it is distributed.
* Each define has a commented line of code that explains what you would change. * Each define has a commented line of code that explains what you would change.
* *
*/ */
if (!defined('ROOT')) { if (!defined('ROOT')) {
//define('ROOT', 'FULL PATH TO DIRECTORY WHERE APP DIRECTORY IS LOCATED DO NOT ADD A TRAILING DIRECTORY SEPARATOR'; //define('ROOT', 'FULL PATH TO DIRECTORY WHERE APP DIRECTORY IS LOCATED DO NOT ADD A TRAILING DIRECTORY SEPARATOR';
//You should also use the DS define to seperate your directories //You should also use the DS define to seperate your directories
define('ROOT', dirname(dirname(dirname(__FILE__)))); define('ROOT', dirname(dirname(dirname(__FILE__))));
} }
if (!defined('APP_DIR')) { if (!defined('APP_DIR')) {
//define('APP_DIR', 'DIRECTORY NAME OF APPLICATION'; //define('APP_DIR', 'DIRECTORY NAME OF APPLICATION';
define('APP_DIR', basename(dirname(dirname(__FILE__)))); define('APP_DIR', basename(dirname(dirname(__FILE__))));
} }
/** /**
* This only needs to be changed if the cake installed libs are located * This only needs to be changed if the cake installed libs are located
* outside of the distributed directory structure. * outside of the distributed directory structure.
*/ */
if (!defined('CAKE_CORE_INCLUDE_PATH')) { if (!defined('CAKE_CORE_INCLUDE_PATH')) {
//define ('CAKE_CORE_INCLUDE_PATH', FULL PATH TO DIRECTORY WHERE CAKE CORE IS INSTALLED DO NOT ADD A TRAILING DIRECTORY SEPARATOR'; //define ('CAKE_CORE_INCLUDE_PATH', FULL PATH TO DIRECTORY WHERE CAKE CORE IS INSTALLED DO NOT ADD A TRAILING DIRECTORY SEPARATOR';
//You should also use the DS define to seperate your directories //You should also use the DS define to seperate your directories
define('CAKE_CORE_INCLUDE_PATH', ROOT); define('CAKE_CORE_INCLUDE_PATH', ROOT);
} }
/////////////////////////////// ///////////////////////////////
//DO NOT EDIT BELOW THIS LINE// //DO NOT EDIT BELOW THIS LINE//
/////////////////////////////// ///////////////////////////////
if (!defined('WEBROOT_DIR')) { if (!defined('WEBROOT_DIR')) {
define('WEBROOT_DIR', basename(dirname(__FILE__))); define('WEBROOT_DIR', basename(dirname(__FILE__)));
} }
if (!defined('WWW_ROOT')) { if (!defined('WWW_ROOT')) {
define('WWW_ROOT', dirname(__FILE__) . DS); define('WWW_ROOT', dirname(__FILE__) . DS);
} }
if (!defined('CORE_PATH')) { if (!defined('CORE_PATH')) {
if (function_exists('ini_set')) { if (function_exists('ini_set')) {
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS); ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS);
define('APP_PATH', null); define('APP_PATH', null);
define('CORE_PATH', null); define('CORE_PATH', null);
} else { } else {
define('APP_PATH', ROOT . DS . APP_DIR . DS); define('APP_PATH', ROOT . DS . APP_DIR . DS);
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS); define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
} }
} }
require CORE_PATH . 'cake' . DS . 'bootstrap.php'; require CORE_PATH . 'cake' . DS . 'bootstrap.php';
if (isset($_GET['url']) && $_GET['url'] === 'favicon.ico') { if (isset($_GET['url']) && $_GET['url'] === 'favicon.ico') {
} else { } else {
$Dispatcher=new Dispatcher(); $Dispatcher=new Dispatcher();
$Dispatcher->dispatch($url); $Dispatcher->dispatch($url);
} }
if (DEBUG) { if (DEBUG) {
echo "<!-- " . round(getMicrotime() - $TIME_START, 4) . "s -->"; echo "<!-- " . round(getMicrotime() - $TIME_START, 4) . "s -->";
} }
?> ?>

Просмотреть файл

@ -1,36 +1,36 @@
<?php <?php
/* SVN FILE: $Id: vendors.php,v 1.1 2006/09/11 05:56:11 reed%reedloden.com Exp $ */ /* SVN FILE: $Id: vendors.php,v 1.3 2006/09/28 03:22:10 reed%reedloden.com Exp $ */
/** /**
* Short description for file. * Short description for file.
* *
* This file includes js vendor-files from /vendor/ directory if they need to * This file includes js vendor-files from /vendor/ directory if they need to
* be accessible to the public. * be accessible to the public.
* *
* PHP versions 4 and 5 * PHP versions 4 and 5
* *
* CakePHP : Rapid Development Framework <http://www.cakephp.org/> * CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2006, Cake Software Foundation, Inc. * Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204 * 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104 * Las Vegas, Nevada 89104
* *
* Licensed under The MIT License * Licensed under The MIT License
* Redistributions of files must retain the above copyright notice. * Redistributions of files must retain the above copyright notice.
* *
* @filesource * @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc. * @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake * @package cake
* @subpackage cake.app.webroot.js * @subpackage cake.app.webroot.js
* @since CakePHP v 0.2.9 * @since CakePHP v 0.2.9
* @version $Revision: 1.1 $ * @version $Revision: 1.3 $
* @modifiedby $LastChangedBy: phpnut $ * @modifiedby $LastChangedBy: phpnut $
* @lastmodified $Date: 2006/09/11 05:56:11 $ * @lastmodified $Date: 2006/09/28 03:22:10 $
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
/** /**
* Enter description here... * Enter description here...
*/ */
if (is_file('../../vendors/javascript/' . $_GET['file']) && (preg_match('/(.+)\\.js/', $_GET['file']))) { if (is_file('../../vendors/javascript/' . $_GET['file']) && (preg_match('/(.+)\\.js/', $_GET['file']))) {
readfile('../../vendors/javascript/' . $_GET['file']); readfile('../../vendors/javascript/' . $_GET['file']);
} }
?> ?>