зеркало из https://github.com/mozilla/pjs.git
Fixes from Ryan Flint <rflint@dslr.net> for problems found by clouserw and fligtar.
This commit is contained in:
Родитель
5aac116800
Коммит
037c6e32b5
|
@ -0,0 +1,32 @@
|
|||
<?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
|
||||
* will be disabled. To obtain a key, visit http://www.google.com/apis/maps/
|
||||
*/
|
||||
define('GMAP_API_KEY', '');
|
||||
|
||||
/* The search API key is used to generate spelling suggestions for locations not
|
||||
* not found during a Geocode operation. You may obtain a key here: http://www.google.com/apis/
|
||||
*/
|
||||
define('GSEARCH_API_KEY', '');
|
||||
|
||||
/* The maximum year shown for party registrations */
|
||||
define('MAX_YEAR', 2007);
|
||||
|
||||
/* 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
|
||||
*/
|
||||
define('FLICKR_API_KEY', '');
|
||||
|
||||
/* The tag prefix is used to limit the results returned to a specific party.
|
||||
* e.g. any photo tagged with FirefoxParty11 will be shown on party 11's page.
|
||||
* Photos tagged with only the prefix are shown on the front page (so choose wisely! ;) ).
|
||||
*/
|
||||
define('FLICKR_TAG_PREFIX', '');
|
||||
?>
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
/* SVN FILE: $Id: core.php,v 1.2 2006-09-20 07:22:44 reed%reedloden.com Exp $ */
|
||||
/* SVN FILE: $Id: core.php,v 1.3 2006-10-03 09:15:26 reed%reedloden.com Exp $ */
|
||||
/**
|
||||
* This is core configuration file.
|
||||
*
|
||||
|
@ -21,9 +21,9 @@
|
|||
* @package cake
|
||||
* @subpackage cake.app.config
|
||||
* @since CakePHP v 0.2.9
|
||||
* @version $Revision: 1.2 $
|
||||
* @version $Revision: 1.3 $
|
||||
* @modifiedby $LastChangedBy: phpnut $
|
||||
* @lastmodified $Date: 2006-09-20 07:22:44 $
|
||||
* @lastmodified $Date: 2006-10-03 09:15:26 $
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
/**
|
||||
|
@ -49,7 +49,7 @@
|
|||
* With the other debug levels you get to click the "flash message" to continue.
|
||||
*
|
||||
*/
|
||||
define('DEBUG', 1);
|
||||
define('DEBUG', 0);
|
||||
/**
|
||||
* Turn of caching checking wide.
|
||||
* You must still use the controller var cacheAction inside you controller class.
|
||||
|
@ -87,12 +87,12 @@
|
|||
* Set a random string of used in session.
|
||||
*
|
||||
*/
|
||||
define('CAKE_SESSION_STRING', 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi');
|
||||
define('CAKE_SESSION_STRING', 'h874dPHn8i19CI43vZ0n30L3SHtS4mze06TkBuA91P7x2FyzXC');
|
||||
/**
|
||||
* Set the name of session cookie
|
||||
*
|
||||
*/
|
||||
define('CAKE_SESSION_COOKIE', 'CAKEPHP');
|
||||
define('CAKE_SESSION_COOKIE', 'sess');
|
||||
/**
|
||||
* Set level of Cake security.
|
||||
*
|
||||
|
|
0
webtools/partytool/config/database.php → webtools/partytool/config/database.dist.php
Executable file → Normal file
0
webtools/partytool/config/database.php → webtools/partytool/config/database.dist.php
Executable file → Normal file
|
@ -3,48 +3,47 @@ CREATE TABLE IF NOT EXISTS `comments` (
|
|||
`assoc` int(10) NOT NULL default '0',
|
||||
`owner` int(10) NOT NULL default '0',
|
||||
`time` int(15) NOT NULL default '0',
|
||||
`text` text NOT NULL,
|
||||
`text` text collate utf8_unicode_ci NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `parties` (
|
||||
`id` int(10) NOT NULL auto_increment,
|
||||
`owner` int(10) NOT NULL default '0',
|
||||
`name` tinytext NOT NULL,
|
||||
`vname` tinytext,
|
||||
`address` tinytext NOT NULL,
|
||||
`name` tinytext collate utf8_unicode_ci NOT NULL,
|
||||
`vname` tinytext collate utf8_unicode_ci,
|
||||
`address` tinytext collate utf8_unicode_ci NOT NULL,
|
||||
`tz` int(2) NOT NULL default '0',
|
||||
`website` text,
|
||||
`notes` text,
|
||||
`website` text collate utf8_unicode_ci,
|
||||
`notes` text collate utf8_unicode_ci,
|
||||
`date` int(10) default NULL,
|
||||
`duration` tinyint(2) NOT NULL default '2',
|
||||
`guests` text NOT NULL,
|
||||
`guests` text collate utf8_unicode_ci NOT NULL,
|
||||
`confirmed` tinyint(1) NOT NULL default '0',
|
||||
`canceled` tinyint(1) NOT NULL default '0',
|
||||
`guestcomments` tinyint(1) NOT NULL default '0',
|
||||
`inviteonly` tinyint(1) NOT NULL default '0',
|
||||
`invitecode` tinytext NOT NULL,
|
||||
`invitecode` tinytext collate utf8_unicode_ci NOT NULL,
|
||||
`lat` float default NULL,
|
||||
`long` float default NULL,
|
||||
`zoom` tinyint(2) NOT NULL default '8',
|
||||
`useflickr` tinyint(1) NOT NULL default '0',
|
||||
`flickrperms` tinyint(1) default '0',
|
||||
`flickrid` tinytext NOT NULL,
|
||||
`flickrusr` tinytext NOT NULL,
|
||||
`flickrid` tinytext collate utf8_unicode_ci NOT NULL,
|
||||
`flickrusr` tinytext collate utf8_unicode_ci NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `users` (
|
||||
`id` int(10) NOT NULL auto_increment,
|
||||
`role` tinyint(2) NOT NULL default '0',
|
||||
`email` varchar(75) NOT NULL default '',
|
||||
`active` varchar(10) default NULL,
|
||||
`password` varchar(40) NOT NULL default '',
|
||||
`salt` varchar(9) NOT NULL default '',
|
||||
`name` tinytext NOT NULL,
|
||||
`location` tinytext NOT NULL,
|
||||
`email` varchar(75) collate utf8_unicode_ci NOT NULL default '',
|
||||
`active` varchar(10) collate utf8_unicode_ci default NULL,
|
||||
`password` varchar(40) collate utf8_unicode_ci NOT NULL default '',
|
||||
`salt` varchar(9) collate utf8_unicode_ci NOT NULL default '',
|
||||
`name` tinytext collate utf8_unicode_ci NOT NULL,
|
||||
`location` tinytext collate utf8_unicode_ci NOT NULL,
|
||||
`tz` int(2) NOT NULL default '0',
|
||||
`website` tinytext NOT NULL,
|
||||
`website` tinytext collate utf8_unicode_ci NOT NULL,
|
||||
`lat` float default NULL,
|
||||
`long` float default NULL,
|
||||
`zoom` tinyint(2) NOT NULL default '12',
|
||||
|
@ -53,4 +52,4 @@ CREATE TABLE IF NOT EXISTS `users` (
|
|||
`showmap` tinyint(1) NOT NULL default '1',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `email` (`email`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
|
|
@ -74,6 +74,7 @@ class FeedsController extends AppController {
|
|||
function ical() {
|
||||
$this->layout = 'ajax';
|
||||
header('Content-type: text/calendar');
|
||||
header("Content-Disposition: inline; filename=partylist.ics");
|
||||
$weekago = time() - 604800;
|
||||
$this->set('events', $this->Feed->findAll('WHERE date > '. $weekago, '', 'date ASC', 50, 1));
|
||||
}
|
||||
|
|
|
@ -1,366 +0,0 @@
|
|||
<?php
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Party Tool
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ryan Flint <rflint@dslr.net>
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
vendor('webServices');
|
||||
vendor('mail');
|
||||
uses('sanitize');
|
||||
class PartyController extends AppController {
|
||||
var $name = 'Party';
|
||||
var $pageTitle;
|
||||
var $components = array('Security');
|
||||
|
||||
function beforeFilter() {
|
||||
$this->Security->requirePost('unrsvp');
|
||||
}
|
||||
|
||||
function index() {
|
||||
if (GMAP_API_KEY != null)
|
||||
$this->set('body_args', ' onload="initMashUp()" onunload="GUnload()"');
|
||||
$this->pageTitle = APP_NAME." - Party Map";
|
||||
$this->set('current', "map");
|
||||
}
|
||||
|
||||
function register() {
|
||||
if (!$this->Session->check('User')) {
|
||||
$this->redirect('/user/login');
|
||||
}
|
||||
|
||||
$this->pageTitle = APP_NAME." - Register";
|
||||
$this->set('current', "create");
|
||||
|
||||
$this->set('error', false);
|
||||
if (GMAP_API_KEY != null)
|
||||
$this->set('body_args', ' onload="mapInit(14.944785, -156.796875, 1)" onunload="GUnload()"');
|
||||
|
||||
if (!empty($this->data)) {
|
||||
$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'];
|
||||
$this->data['Party']['duration'] = intval($this->data['Party']['duration']);
|
||||
|
||||
$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']) &&
|
||||
$this->data['Party']['geocoded'] == 0) {
|
||||
|
||||
// Attempt to geocode the address again
|
||||
$geocoder = new webServices(array('type' => 'geocode'));
|
||||
if ($ll = $geocoder->geocode($this->data['Party']['address']) != 0) {
|
||||
$this->data['Party']['lat'] = $ll['lat'];
|
||||
$this->data['Party']['long'] = $ll['lng'];
|
||||
}
|
||||
else {
|
||||
// May not come back with exactly what the user was looking for, but they can always edit
|
||||
$suggest = new webServices(array('type' => 'gsuggest'));
|
||||
$geocoder = new webServices(array('type' => 'geocode'));
|
||||
if ($suggestion = $suggest->GSuggest($this->data['Party']['address']) != 0) {
|
||||
$this->data['Party']['address'] = $suggestion;
|
||||
if ($ll = $geocoder->geocode($suggestion) != 0) {
|
||||
$this->data['Party']['lat'] = $ll['lat'];
|
||||
$this->data['Party']['long'] = $ll['lng'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->Party->save($this->data))
|
||||
$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";
|
||||
$this->set('current', "create");
|
||||
|
||||
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;
|
||||
|
||||
$date = array('hour' => intval(date('h', $party['Party']['date'])),
|
||||
'min' => intval(date('i', $party['Party']['date'])),
|
||||
'mon' => intval(date('m', $party['Party']['date'])),
|
||||
'day' => intval(date('d', $party['Party']['date'])),
|
||||
'year' => intval(date('Y', $party['Party']['date'])),
|
||||
'tz' => $party['Party']['tz']);
|
||||
|
||||
$this->set('date', $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'] = $party['Party']['owner'];
|
||||
$this->data['Party']['duration'] = intval($this->data['Party']['duration']);
|
||||
|
||||
if ($this->data['Party']['flickrusr'] != $party['Party']['flickrusr']) {
|
||||
$params = array('type' => 'flickr', 'username' => $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) {
|
||||
if ($id == "all") {
|
||||
$this->pageTitle = APP_NAME." - All Parties";
|
||||
$this->set('current', "parties");
|
||||
$count = $this->Party->findCount();
|
||||
$pages = ceil($count/10);
|
||||
if ($page == null)
|
||||
$page = 1;
|
||||
|
||||
if ($page > 1)
|
||||
$this->set('prev', $page - 1);
|
||||
if ($page < $pages)
|
||||
$this->set('next', $page + 1);
|
||||
|
||||
$this->set('parties', $this->Party->findAll(null, null, "name ASC", 10, $page));
|
||||
}
|
||||
|
||||
else if (is_numeric($id)) {
|
||||
$party = $this->Party->findById($id);
|
||||
$this->set('party', $party);
|
||||
|
||||
$this->pageTitle = APP_NAME." - ".$party['Party']['name'];
|
||||
$this->set('current', "parties");
|
||||
|
||||
if (FLICKR_API_KEY != null) {
|
||||
if ($party['Party']['useflickr'] == 1) {
|
||||
$data = array('type' => 'flickr', 'userid' => $party['Party']['flickrid']);
|
||||
$flickr = new webServices($data);
|
||||
$photoset = $flickr->fetchPhotos(FLICKR_TAG_PREFIX.$party['Party']['id'], 15, (($party['Party']['flickrperms']) ? false : true));
|
||||
$this->set('flickr', array_slice($photoset, 0, 9));
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($party['Party']['guests'])) {
|
||||
$guests = explode(',', $party['Party']['guests']);
|
||||
$names = array();
|
||||
|
||||
for ($i = 0; $i < count($guests); $i++)
|
||||
array_push($names, $this->Party->getUserName($guests[$i]));
|
||||
|
||||
$this->set('guests', $guests);
|
||||
$this->set('names', $names);
|
||||
}
|
||||
|
||||
$this->set('host', $this->Party->getUserName($party['Party']['owner']));
|
||||
$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()"');
|
||||
}
|
||||
|
||||
else {
|
||||
$this->redirect('/party/view/all');
|
||||
}
|
||||
}
|
||||
|
||||
function rsvp($aParty = null, $icode = null) {
|
||||
if (!is_numeric($aParty))
|
||||
$this->redirect('/');
|
||||
|
||||
$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');
|
||||
if (empty($_SESSION['User']['id']))
|
||||
$this->redirect('/user/login');
|
||||
|
||||
else if ($party['Party']['inviteonly'] != 1 || $invited === true) {
|
||||
if (empty($party['Party']['guests'])) {
|
||||
$this->data['Party']['guests'] = $user['id'];
|
||||
$this->data['Party']['id'] = $aParty;
|
||||
}
|
||||
|
||||
else {
|
||||
$attendees = explode(',', $party['Party']['guests']);
|
||||
if (in_array($user['id'], $attendees))
|
||||
$this->redirect('/party/view/'.$aParty);
|
||||
|
||||
else {
|
||||
array_push($attendees, $user['id']);
|
||||
$csv = implode(',', $attendees);
|
||||
$this->data['Party']['guests'] = $csv;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->Party->save($this->data))
|
||||
$this->redirect('/party/view/'.$aParty.'/added');
|
||||
}
|
||||
|
||||
else
|
||||
$this->redirect('/party/view/'.$aParty);
|
||||
}
|
||||
|
||||
function unrsvp($aParty) {
|
||||
$user = $this->Session->read('User');
|
||||
if (empty($user)) {
|
||||
$this->redirect('/user/login');
|
||||
}
|
||||
|
||||
if (is_numeric($aParty)) {
|
||||
$party = $this->Party->findById($aParty);
|
||||
$temp = explode(',', $party['Party']['guests']);
|
||||
$id = array_search($user['id'], $temp);
|
||||
|
||||
if (!empty($temp[$id])) {
|
||||
unset($temp[$id]);
|
||||
$this->data['Party']['guests'] = implode(',', $temp);
|
||||
$this->data['Party']['id'] = $aParty;
|
||||
|
||||
if ($this->Party->save($this->data))
|
||||
$this->redirect('/party/view/'.$aParty.'/removed');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->redirect('/');
|
||||
}
|
||||
|
||||
function invite($id = null) {
|
||||
$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() {
|
||||
$this->layout = 'ajax';
|
||||
$this->set('parties', $this->Party->findAll());
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,428 +0,0 @@
|
|||
<?php
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Party Tool
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ryan Flint <rflint@dslr.net>
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
vendor('mail');
|
||||
uses('sanitize');
|
||||
class UserController extends AppController {
|
||||
var $name = 'User';
|
||||
var $pageTitle;
|
||||
|
||||
function index() {
|
||||
if (!isset($_SESSION['User'])) {
|
||||
$this->redirect('/user/login');
|
||||
}
|
||||
|
||||
$this->pageTitle = APP_NAME." - My Profile";
|
||||
|
||||
$user = $this->Session->read('User');
|
||||
$this->set('parties', $this->User->memberOf($user['id']));
|
||||
$this->set('hparties', $this->User->hostOf($user['id']));
|
||||
}
|
||||
|
||||
function edit() {
|
||||
if (!isset($_SESSION['User'])) {
|
||||
$this->redirect('/user/login');
|
||||
}
|
||||
$this->set('error', false);
|
||||
$this->pageTitle = APP_NAME." - Edit My Account";
|
||||
if (empty($this->data)) {
|
||||
$this->User->id = $_SESSION['User']['id'];
|
||||
$this->data = $this->User->read();
|
||||
$this->data['User']['password'] = "";
|
||||
$this->set('utz', $this->data['User']['tz']);
|
||||
|
||||
if (GMAP_API_KEY != null && !empty($this->data['User']['lat']))
|
||||
$this->set('body_args',
|
||||
' onload="mapInit('.$this->data["User"]["lat"].', '.$this->data["User"]["long"].', '.$this->data["User"]["zoom"].');" onunload="GUnload()"');
|
||||
}
|
||||
|
||||
else {
|
||||
$user = $this->User->findById($_SESSION['User']['id']);
|
||||
$this->User->id = $user['User']['id'];
|
||||
|
||||
$clean = new Sanitize();
|
||||
$temp = array('password' => $this->data['User']['password'],
|
||||
'confpassword' => $this->data['User']['confpassword'],
|
||||
'lat' => $clean->sql($this->data['User']['lat']),
|
||||
'long' => $clean->sql($this->data['User']['long']),
|
||||
'tz' => $clean->sql($this->data['User']['tz']));
|
||||
//Nuke everything else
|
||||
$clean->cleanArray($this->data);
|
||||
|
||||
$this->data['User']['email'] = $user['User']['email'];
|
||||
$this->data['User']['password'] = $temp['password'];
|
||||
$this->data['User']['confpassword'] = $temp['confpassword'];
|
||||
$this->data['User']['lat'] = floatval($temp['lat']);
|
||||
$this->data['User']['long'] = floatval($temp['long']);
|
||||
$this->data['User']['tz'] = intval($temp['tz']);
|
||||
$this->data['User']['role'] = $user['User']['role'];
|
||||
|
||||
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)) {
|
||||
$sess = $this->User->findById($user['User']['id']);
|
||||
$this->Session->destroy();
|
||||
$this->Session->delete('User');
|
||||
$this->Session->write('User', $sess['User']);
|
||||
$this->redirect('/user/');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function view($aUid = null) {
|
||||
if (!is_numeric($aUid))
|
||||
$this->redirect('/');
|
||||
|
||||
else {
|
||||
$user = $this->User->findById($aUid);
|
||||
$this->pageTitle = APP_NAME." - ".$user['User']['name'];
|
||||
$this->set('user', $user);
|
||||
if (GMAP_API_KEY != null && !empty($user['User']['lat']))
|
||||
$this->set('body_args',
|
||||
' onload="mapInit('.$user["User"]["lat"].', '.$user["User"]["long"].', '.$user["User"]["zoom"].', \'stationary\');" onunload="GUnload()"');
|
||||
|
||||
$this->set('parties', $this->User->memberOf($user['User']['id']));
|
||||
$this->set('hparties', $this->User->hostOf($user['User']['id']));
|
||||
}
|
||||
}
|
||||
|
||||
function register($invite = null) {
|
||||
$this->set('error', false);
|
||||
if (isset($_SESSION['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)
|
||||
$this->set('body_args', ' onload="mapInit()" onunload="GUnload()"');
|
||||
|
||||
if (!empty($this->data)) {
|
||||
$clean = new Sanitize();
|
||||
$temp = array('email' => $this->data['User']['email'],
|
||||
'cemail' => $this->data['User']['confemail'],
|
||||
'password' => $this->data['User']['password'],
|
||||
'confpassword' => $this->data['User']['confpassword'],
|
||||
'lat' => $clean->sql($this->data['User']['lat']),
|
||||
'long' => $clean->sql($this->data['User']['long']),
|
||||
'tz' => $clean->sql($this->data['User']['tz']));
|
||||
//Nuke everything else
|
||||
$clean->cleanArray($this->data);
|
||||
|
||||
$this->data['User']['email'] = $temp['email'];
|
||||
$this->data['User']['confemail'] = $temp['cemail'];
|
||||
$this->data['User']['password'] = $temp['password'];
|
||||
$this->data['User']['confpassword'] = $temp['confpassword'];
|
||||
$this->data['User']['lat'] = floatval($temp['lat']);
|
||||
$this->data['User']['long'] = floatval($temp['long']);
|
||||
$this->data['User']['role'] = 0;
|
||||
$this->data['User']['tz'] = intval($temp['tz']);
|
||||
|
||||
if ($this->data['User']['email'] === $temp['cemail']) {
|
||||
if (!$this->User->findByEmail($this->data['User']['email'])) {
|
||||
if ($this->data['User']['password'] === $this->data['User']['confpassword']) {
|
||||
if ($this->User->validates($this->data)) {
|
||||
$string = $this->data['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']);
|
||||
|
||||
$key = null;
|
||||
$chars = "1234567890abcdefghijklmnopqrstuvwxyz";
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
$key .= $chars{rand(0,35)};
|
||||
}
|
||||
|
||||
$this->data['User']['active'] = $key;
|
||||
|
||||
if ($this->User->save($this->data)) {
|
||||
$message = array('from' => APP_NAME.' <'.APP_EMAIL.'>',
|
||||
'envelope' => APP_EMAIL,
|
||||
'to' => $this->data['User']['email'],
|
||||
'subject' => 'Your '.APP_NAME.' Registration',
|
||||
'link' => APP_BASE.'/user/activate/'.$key,
|
||||
'type' => 'act');
|
||||
|
||||
$mail = new mail($message);
|
||||
$mail->send();
|
||||
|
||||
if (!empty($this->data['User']['icode']))
|
||||
$this->User->addToParty($this->data['User']['icode'], $this->User->getLastInsertID());
|
||||
|
||||
$this->redirect('/user/login/new');
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
$this->validateErrors($this->User);
|
||||
$this->data['User']['password'] = null;
|
||||
$this->data['User']['confpassword'] = null;
|
||||
$this->render();
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
$this->User->invalidate('confpassword');
|
||||
$this->data['User']['password'] = null;
|
||||
$this->data['User']['confpassword'] = null;
|
||||
$this->render();
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
$this->User->invalidate('email');
|
||||
$this->data['User']['password'] = null;
|
||||
$this->data['User']['confpassword'] = null;
|
||||
$this->render();
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
$this->User->invalidate('confemail');
|
||||
$this->data['User']['password'] = null;
|
||||
$this->data['User']['confpassword'] = null;
|
||||
$this->render();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function activate($aKey = null) {
|
||||
if ($aKey == null)
|
||||
$this->redirect('/');
|
||||
|
||||
else {
|
||||
$this->data = $this->User->findByActive($aKey);
|
||||
$this->data['User']['active'] = 1;
|
||||
|
||||
if ($this->User->save($this->data)) {
|
||||
$this->redirect('/user/login/active');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function login($isNew = null) {
|
||||
if (isset($_SESSION['User'])) {
|
||||
$this->redirect('/user/');
|
||||
}
|
||||
|
||||
$this->pageTitle = APP_NAME." - Login";
|
||||
$this->set('error', false);
|
||||
|
||||
if ($isNew !== null) {
|
||||
switch($isNew) {
|
||||
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.');
|
||||
break;
|
||||
|
||||
case "rnew":
|
||||
$this->set('preamble', 'An email with instructions on how to reset your password has been sent.');
|
||||
break;
|
||||
|
||||
case "active":
|
||||
$this->set('preamble', 'Your account has been activated. You may now login.');
|
||||
break;
|
||||
|
||||
case "reset":
|
||||
$this->set('preamble', 'Your password has been reset.');
|
||||
break;
|
||||
}
|
||||
$this->render();
|
||||
}
|
||||
|
||||
if (!empty($this->data)) {
|
||||
$user = $this->User->findByEmail($this->data['User']['email']);
|
||||
|
||||
if ($user['User']['active'] != 1) {
|
||||
$this->set('preamble', 'Your account hasn\'t been activated yet.
|
||||
Please check your email (including junk/spam folders) for your
|
||||
activation link, or click <a href="/cake/user/recover/activate">here</a>
|
||||
to resend your activation details.');
|
||||
$this->render();
|
||||
}
|
||||
|
||||
if ($user['User']['active'] == 1 && $user['User']['password'] == sha1($this->data['User']['password'].$user['User']['salt'])) {
|
||||
$this->Session->write('User', $user['User']);
|
||||
$this->redirect('/user/');
|
||||
}
|
||||
|
||||
else {
|
||||
$this->set('error', true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function logout() {
|
||||
$this->Session->destroy();
|
||||
$this->Session->delete('User');
|
||||
$this->redirect('/');
|
||||
}
|
||||
|
||||
function recover($aType = null, $aCode = null, $aId = null) {
|
||||
switch ($aType) {
|
||||
case "password":
|
||||
$this->pageTitle = APP_NAME." - Password Recovery";
|
||||
$this->set('atitle', 'Password Recovery');
|
||||
$this->set('hideInput', false);
|
||||
$this->set('url', 'password');
|
||||
|
||||
if (!empty($this->data)) {
|
||||
$user = $this->User->findByEmail($this->data['User']['email']);
|
||||
|
||||
if (!isset($user['User']['email'])) {
|
||||
$this->set('error', 'Could not find a user with that email address. Please check it and try again.');
|
||||
$this->render();
|
||||
}
|
||||
else {
|
||||
$code = md5($user['User']['salt'].$user['User']['email'].$user['User']['password']);
|
||||
$message = array('from' => APP_NAME.'<'.APP_EMAIL.'>',
|
||||
'envelope' => APP_EMAIL,
|
||||
'to' => $user['User']['email'],
|
||||
'subject' => APP_NAME.' Password Request',
|
||||
'link' => APP_BASE.'/user/recover/password/'.$code.'/'.$user['User']['id'],
|
||||
'type' => 'prec');
|
||||
|
||||
$mail = new mail($message);
|
||||
$mail->send();
|
||||
$this->redirect('user/login/rnew');
|
||||
}
|
||||
}
|
||||
|
||||
if ($aCode !== null && $aId !== null) {
|
||||
$this->set('hideInput', true);
|
||||
$this->set('reset', false);
|
||||
$user = $this->User->findById($aId);
|
||||
|
||||
if (!$user) {
|
||||
$this->set('error', 'Invalid request. Please check the URL and try again.');
|
||||
$this->render();
|
||||
}
|
||||
|
||||
if ($aCode == md5($user['User']['salt'].$user['User']['email'].$user['User']['password'])) {
|
||||
$this->set('reset', true);
|
||||
$this->set('code', $aCode."/".$aId);
|
||||
$this->render();
|
||||
}
|
||||
|
||||
else {
|
||||
$this->set('error', 'Invalid request. Please check the URL and try again.');
|
||||
$this->render();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "activate":
|
||||
$this->pageTitle = APP_NAME." - Resend Activation Code";
|
||||
$this->set('atitle', 'Resend Activation Code');
|
||||
$this->set('hideInput', false);
|
||||
$this->set('url', 'activate');
|
||||
|
||||
if (!empty($this->data)) {
|
||||
$user = $this->User->findByEmail($this->data['User']['email']);
|
||||
|
||||
if (!$user) {
|
||||
$this->set('error', 'Could not find a user with that email address. Please check it and try again.');
|
||||
$this->render();
|
||||
}
|
||||
|
||||
if ($user['User']['active'] == 1)
|
||||
$this->redirect('/user/login/active');
|
||||
|
||||
else {
|
||||
$message = array('from' => APP_NAME.' <'.APP_EMAIL.'>',
|
||||
'envelope' => APP_EMAIL,
|
||||
'to' => $this->data['User']['email'],
|
||||
'subject' => 'Your '.APP_NAME.' Registration',
|
||||
'link' => APP_BASE.'/user/activate/'.$user['User']['active'],
|
||||
'type' => 'act');
|
||||
$mail = new mail($message);
|
||||
$mail->send();
|
||||
$this->redirect('user/login/new');
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "reset":
|
||||
if ($aCode !== null && $aId !== null) {
|
||||
if (!empty($this->data)) {
|
||||
$user = $this->User->findById($aId);
|
||||
if (!$user) {
|
||||
$this->set('error', 'Invalid request. Please check the URL and try again.');
|
||||
$this->render();
|
||||
}
|
||||
|
||||
if ($aCode == md5($user['User']['salt'].$user['User']['email'].$user['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']['password'] = sha1($this->data['User']['password'] . $this->data['User']['salt']);
|
||||
$this->data['User']['id'] = $aId;
|
||||
if ($this->User->save($this->data))
|
||||
$this->redirect('/user/login/reset');
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$this->redirect('/');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function delete($id) {
|
||||
$role = $this->Session->read('User');
|
||||
if ($role['role'] != 2)
|
||||
die("Access denied.");
|
||||
else {
|
||||
$this->User->del($id);
|
||||
$this->redirect('/');
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -42,10 +42,10 @@ class Comment extends AppModel {
|
|||
);
|
||||
|
||||
function canComment($pid, $uid) {
|
||||
$status = $this->query("SELECT guests, guestcomments FROM parties WHERE id = ".$pid);
|
||||
$status = $this->query("SELECT owner, guests, guestcomments FROM parties WHERE id = ".$pid);
|
||||
|
||||
if ($status[0]['parties']['guestcomments'] == 1) {
|
||||
if (in_array($uid, explode(',', $status[0]['parties']['guests'])))
|
||||
if (in_array($uid, explode(',', $status[0]['parties']['guests'])) || $uid == $status[0]['parties']['owner'])
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
|
|
@ -48,7 +48,8 @@ class Party extends AppModel {
|
|||
FROM users, parties, comments
|
||||
WHERE comments.assoc = ".$pid."
|
||||
AND users.id = comments.owner
|
||||
AND parties.id = ".$pid);
|
||||
AND parties.id = ".$pid."
|
||||
ORDER BY cid ASC");
|
||||
return $rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?php if(!isset($_SESSION['User'])): ?>
|
||||
<strong>Welcome Guest!</strong>
|
||||
<strong>Welcome, Guest!</strong>
|
||||
<a href="<?php echo $html->url('/user/login'); ?>">Login</a>
|
||||
<a href="<?php echo $html->url('/user/register'); ?>">Register</a>
|
||||
<?php else: ?>
|
||||
<strong>Welcome <?php echo (!empty($_SESSION['User']['name'])) ? $_SESSION['User']['name'] : $_SESSION['User']['email']; ?>!</strong>
|
||||
<strong>Welcome, <?php echo (!empty($_SESSION['User']['name'])) ? $_SESSION['User']['name'] : $_SESSION['User']['email']; ?>!</strong>
|
||||
<a href="<?php echo $html->url('/user'); ?>">My Account</a>
|
||||
<a href="<?php echo $html->url('/user/logout'); ?>">Logout</a>
|
||||
<?php endif; ?>
|
|
@ -1,7 +1,6 @@
|
|||
BEGIN:VCALENDAR
|
||||
X-WR-CALNAME:<?php echo APP_NAME."\n"; ?>
|
||||
X-WR-CALDESC:Upcoming Parties
|
||||
X-WR-TIMEZONE:US/Eastern
|
||||
PRODID:-//<?php echo $_SERVER["SERVER_NAME"]; ?>//calendar//EN
|
||||
VERSION:2.0
|
||||
CALSCALE:GREGORIAN
|
||||
|
@ -16,11 +15,11 @@ DTSTART:<?php echo date('Ymd\This', $event['Feeds']['date'])."\n"; ?>
|
|||
DURATION:PT<?php echo $event['Feeds']['duration']; ?>H
|
||||
URL:<?php echo "http://".$_SERVER["SERVER_NAME"].$html->url('/party/view/'.$event['Feeds']['id'])."\n"; ?>
|
||||
STATUS:<?php echo (($event['Feeds']['confirmed'] == 1) ? "CONFIRMED" : "TENTATIVE")."\n"; ?>
|
||||
DESCRIPTION:
|
||||
<?php echo $event['Feeds']['name']." \n"; ?>
|
||||
<?php echo str_replace(",", "\,", $event['Feeds']['address'])." \n"; ?>
|
||||
<?php echo date('h:ia', $event['Feeds']['date'])." \n"; ?>
|
||||
<?php echo $event['Feeds']['notes']." \n"; ?>
|
||||
DESCRIPTION;ENCODING=QUOTED-PRINTABLE:
|
||||
<?php echo $event['Feeds']['name']."\n"; ?>
|
||||
<?php echo str_replace(",", "\,", $event['Feeds']['address'])."\n"; ?>
|
||||
<?php echo date('h:ia', $event['Feeds']['date'])."\n"; ?>
|
||||
<?php echo $event['Feeds']['notes']."\n"; ?>
|
||||
END:VEVENT
|
||||
<?php endforeach; ?>
|
||||
END:VCALENDAR
|
|
@ -14,7 +14,7 @@
|
|||
<div id="mozilla-com"><a href="http://www.mozilla.com/">Visit Mozilla.com</a></div>
|
||||
<div id="header">
|
||||
<div id="key-title">
|
||||
<h1><a href="<?php echo $html->url('/'); ?>" title="Return to home page" accesskey="1"><img src="<?php echo $html->url('/img/firefox-title.png'); ?>" width="276" height="54" alt="Firefox Add-ons Beta"/></a></h1>
|
||||
<h1><a href="<?php echo $html->url('/'); ?>" title="Return to home page" accesskey="1"><img src="<?php echo $html->url('/img/firefox-title.png'); ?>" width="276" height="54" alt="Firefox Party"/></a></h1>
|
||||
<div id="user"><?php echo $this->renderElement('user_options'); ?></div>
|
||||
</div>
|
||||
<div id="key-menu">
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
<?php if(!empty($preamble)): ?>
|
||||
<div class="info">
|
||||
<p>An email has been sent to <strong><?php echo $preamble[0]; ?></strong>. You can invite another
|
||||
guest below or <a href="<?php echo $html->url('/party/view/'.$preamble[1]); ?>">go back</a> to your party.
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<p>Since your party is invite only, you'll need to invite your guests. You can do this by
|
||||
entering their email address into the field below, or by handing them a link to
|
||||
<strong><?php echo $inviteurl; ?></strong></p>
|
||||
<form action="<?php echo $html->url('/party/invite/'.$partyid) ?>" method="post">
|
||||
<label for="PartyEinvite">Guest's email address:</label>
|
||||
<?php echo $html->input('Party/einvite')."\n".$html->submit('Submit')."\n"; ?>
|
||||
<?php echo $html->tagErrorMsg('Party/einvite', 'Invalid email address')?>
|
||||
</form>
|
|
@ -1,7 +0,0 @@
|
|||
function addParties() {
|
||||
<?php foreach ($parties as $party):
|
||||
if (!empty($party['Party']['lat']) && !empty($party['Party']['long'])): ?>
|
||||
addParty(<?php echo $party['Party']['lat'];?>, <?php echo $party['Party']['long']?>, "<strong><?php echo $party['Party']['name']?></strong><br/><?php echo $party['Party']['vname']; ?><br/><?php echo $party['Party']['notes']; ?><br/><a href=\"<?php echo $html->url('/party/view/'.$party['Party']['id'])?>\">View Party</a>");
|
||||
<?php endif; endforeach;?>
|
||||
}
|
||||
//
|
|
@ -1,117 +0,0 @@
|
|||
<h1>Create a Party</h1>
|
||||
<?php if ($error): ?>
|
||||
<div class="error">
|
||||
There was an error in your submission, please try again.
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<form class="fxform" action="<?php echo $html->url('/party/register'); ?>" method="post">
|
||||
<div>
|
||||
<label for="PartyName" class="label-large">Party Name<span class="required">*</span>:</label>
|
||||
<?php echo $html->input('Party/name', array('size' => 40)); ?>
|
||||
</div>
|
||||
<div>
|
||||
<label for="PartyVname" class="label-large">Venue Name:</label>
|
||||
<?php echo $html->input('Party/vname', array('size' => 40)); ?>
|
||||
</div>
|
||||
<div>
|
||||
<label for="PartyAddress" class="label-large">Address:</label>
|
||||
<?php echo $html->input('Party/address', array('size' => 40, '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>
|
||||
<p>Enter your party's time and date (in your local time) here. If you're not ready to commit to a specific time or date, select the 'Tentative'
|
||||
radio button. Otherwise select 'Confirmed'.</p>
|
||||
<div>
|
||||
<label for="PartyYear" class="label-large">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="PartyHour" class="label-large">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')); ?><br/>
|
||||
</div>
|
||||
<p>The timezone is used to calculate the appropriate GMT time from the local time specified above. This is done to show
|
||||
the party in the local time of the person viewing it.</p>
|
||||
<div>
|
||||
<label for="PartyTz" class="label-large">Timezone<span class="required">*</span>:</label>
|
||||
<select name="data[Party][tz]" id="PartyTz">
|
||||
<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>
|
||||
(this page was loaded at <?php echo gmdate("Y-m-d H:i:s"); ?>GMT)
|
||||
</div>
|
||||
<div>
|
||||
<label for="PartyDuration" class="label-large">Duration (in hours):</label>
|
||||
<?php echo $html->input('Party/duration', array('size' => 5)); ?>
|
||||
</div>
|
||||
<p>Enter a website (complete with http://) that guests can visit to learn more about your party. If you don't have one, simply leave it blank.</p>
|
||||
<div>
|
||||
<label for="PartyWebsite" class="label-large">Web site:</label>
|
||||
<?php echo $html->input('Party/website', array('size' => 40)); ?>
|
||||
</div>
|
||||
<p>If you choose to make your party invite only, you will have to send guests an invite containing a random invite code to allow them to join your party.</p>
|
||||
<div>
|
||||
<label for="PartyInviteonly" class="label-large">Invite only</label>
|
||||
<?php echo $html->checkbox('Party/inviteonly'); ?>
|
||||
</div>
|
||||
<?php if(GMAP_API_KEY != null): ?>
|
||||
<script src="http://maps.google.com/maps?file=api&v=2&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>
|
||||
<p>Drag the map or the marker to specify a location. Set the zoom by using the '+' or '-' buttons on the left.</p>
|
||||
<p id="map" class="med-map-r"></p>
|
||||
<?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; ?>
|
||||
<div>
|
||||
<label for="PartyNotes" class="label-large">Additional Notes</label>
|
||||
<?php echo $html->textarea('Party/notes', array('rows' => 10, 'cols' => 50)); ?>
|
||||
</div>
|
||||
<?php echo $html->submit('Register'); ?>
|
||||
</form>
|
|
@ -1,131 +0,0 @@
|
|||
<?php
|
||||
if (isset($party)):
|
||||
@$isguest = (isset($guests)) ? in_array($_SESSION['User']['id'], $guests) : 0;?>
|
||||
<h1><?php echo $party['Party']['name']; ?></h1>
|
||||
<br/>
|
||||
Host: <a href="<?php echo $html->url('/user/view/'.$party['Party']['owner']).'">'.$host; ?></a><br/>
|
||||
<?php
|
||||
if (!empty($party['Party']['address']))
|
||||
echo 'Location: '.$party['Party']['address']."<br/>\n";
|
||||
|
||||
if (!empty($party['Party']['vname']))
|
||||
echo 'Venue: '.$party['Party']['vname']."<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";
|
||||
echo 'Duration: '.$party['Party']['duration']." hours\n<br/>";
|
||||
|
||||
if (!empty($party['Party']['website']))
|
||||
echo 'Website: <a href="'.$party['Party']['website'].'" rel="nofollow">'.$party['Party']['website']."</a><br/>\n";
|
||||
|
||||
if (!empty($party['Party']['notes']))
|
||||
echo 'Notes: '.$party['Party']['notes']."<br/>\n";
|
||||
?>
|
||||
<br/>
|
||||
<script src="http://maps.google.com/maps?file=api&v=2&key=<?php echo GMAP_API_KEY; ?>"
|
||||
type="text/javascript"></script>
|
||||
<script src="<?php echo $html->url('/js/maps.js'); ?>" type="text/javascript"></script>
|
||||
<div id="map" class="small-map"></div>
|
||||
<h1>Who's coming</h1>
|
||||
<div>
|
||||
<?php if (isset($guests)):
|
||||
$i = 0;
|
||||
$c = count($guests) - 1;
|
||||
foreach ($guests as $guest): ?>
|
||||
<a href="<?php echo $html->url('/user/view/'.$guest); ?>"><?php echo $names[$i]; ?></a><?php echo ($i < $c) ? ", " : ""; ?>
|
||||
<?php $i++;
|
||||
endforeach;
|
||||
else:
|
||||
echo "No guests yet, be the first!";
|
||||
endif;
|
||||
|
||||
if (isset($_SESSION['User']['id']) && @$_SESSION['User']['id'] != $party['Party']['owner'] && ($party['Party']['inviteonly'] != 1 || $isguest)):?>
|
||||
<br/><br/>
|
||||
<form action="<?php
|
||||
echo $html->url('/party/'.((!$isguest) ? 'rsvp/' : 'unrsvp/').$party['Party']['id']); ?>" method="post">
|
||||
<?php if(!$isguest): ?>
|
||||
<button>Count me in!</button>
|
||||
<?php else: ?>
|
||||
<button>Remove me</button>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if (@$_SESSION['User']['id'] == $party['Party']['owner']):?>
|
||||
<h1>Party options</h1>
|
||||
<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)): ?>
|
||||
<h1 id="photos">Photos</h1>
|
||||
<div style="text-align: center">
|
||||
<?php if (empty($flickr)): ?>
|
||||
<p>No photos yet, tag your flickr pictures with <?php echo FLICKR_TAG_PREFIX.$party['Party']['id']; ?> to display them here.</p>
|
||||
<?php else:
|
||||
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" ?>" title="<?php echo $pic['title']; ?>"/></a>
|
||||
<?php endforeach;
|
||||
endif; ?>
|
||||
<br/>
|
||||
</div>
|
||||
<?php endif;
|
||||
if (!empty($comments)): ?>
|
||||
<h1 id="comments">Comments</h1>
|
||||
<?php $i = 0;
|
||||
foreach ($comments as $comment):
|
||||
if ($i % 2 == 0)
|
||||
$class = "";
|
||||
else
|
||||
$class = "comment-mod";
|
||||
$i++;?>
|
||||
<div id="c<?php echo $comment['comments']['cid'];?>" class="comment <?php echo $class;?>">
|
||||
<span class="comment-content"><?php echo $comment['comments']['text']; ?></span>
|
||||
<span class="comment-tag"><br/><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)); ?></span>
|
||||
</span>
|
||||
</div>
|
||||
<?php endforeach;
|
||||
endif;
|
||||
if (isset($_SESSION['User'])):
|
||||
if ($party['Party']['guestcomments'] && $isguest): ?>
|
||||
<h1>Add a comment</h1>
|
||||
<form action="<?php echo $html->url('/comment/add/'.$party['Party']['id'].'/'.$_SESSION['User']['id']); ?>" method="post">
|
||||
<div>
|
||||
<?php echo $html->textarea('Comment/text', array('rows' => 10, 'cols' => 50))."<br/>".$html->submit('Submit'); ?>
|
||||
</div>
|
||||
</form>
|
||||
<?php endif;
|
||||
endif;
|
||||
endif; ?>
|
||||
|
||||
<?php if (isset($parties)):
|
||||
if (isset($prev))
|
||||
echo '<a href="'.$html->url('/party/view/all/'.$prev).'">Previous Page</a> ';
|
||||
if (isset($next))
|
||||
echo '<a href="'.$html->url('/party/view/all/'.$next).'">Next Page</a>';
|
||||
$i = 0;
|
||||
foreach ($parties as $party): ?>
|
||||
<div>
|
||||
<h1><?php echo $party['Party']['name']; ?></h1>
|
||||
<p>
|
||||
<?php
|
||||
if (!empty($party['Party']['address']))
|
||||
echo 'Location: '.$party['Party']['address']."<br/>\n";
|
||||
|
||||
if (!empty($party['Party']['vname']))
|
||||
echo 'Venue: '.$party['Party']['vname']."<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']))
|
||||
echo 'Website: <a href="'.$party['Party']['website'].'" rel="nofollow">'.$party['Party']['website']."</a><br/>\n";
|
||||
|
||||
echo '<a href="'.$html->url('/party/view/'.$party['Party']['id']).'">View Party</a>';
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php endforeach;
|
||||
if (isset($prev))
|
||||
echo '<a href="'.$html->url('/party/view/all/'.$prev).'">Previous Page</a> ';
|
||||
if (isset($next))
|
||||
echo '<a href="'.$html->url('/party/view/all/'.$next).'">Next Page</a>';
|
||||
endif;?>
|
|
@ -1,98 +0,0 @@
|
|||
<?php if ($error): ?>
|
||||
<div class="error">
|
||||
There was an error in your submission, please try again.
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<form class="fxform" action="<?php echo $html->url('/user/edit'); ?>" method="post">
|
||||
<?php echo $html->hidden('User/id'); ?>
|
||||
<h1>Profile</h1>
|
||||
<div>
|
||||
<label for="UserName" class="label-large">Name:</label>
|
||||
<?php echo $html->input('User/name', array('size' => 40)); ?>
|
||||
</div>
|
||||
<div>
|
||||
<label for="name" class="label-large">Website:</label>
|
||||
<?php echo $html->input('User/website', array('size' => 40)); ?>
|
||||
</div>
|
||||
<div>
|
||||
<label for="location" class="label-large">Location:</label>
|
||||
<?php echo $html->input('User/location', array('id' => 'location', 'size' => 40, 'onkeypress' => 'capture(event)')); ?>
|
||||
</div>
|
||||
<div>
|
||||
<label for="UserTz" class="label-large">Timezone:</label>
|
||||
<?php
|
||||
$tzs = array('-12' => 'GMT-12',
|
||||
'-11' => 'GMT-11',
|
||||
'-10' => 'GMT-10',
|
||||
'-9' => 'GMT-9',
|
||||
'-8' => 'GMT-8',
|
||||
'-7' => 'GMT-7',
|
||||
'-6' => 'GMT-6',
|
||||
'-5' => 'GMT-5',
|
||||
'-4' => 'GMT-4',
|
||||
'-3' => 'GMT-3',
|
||||
'-2' => 'GMT-2',
|
||||
'-1' => 'GMT-1',
|
||||
'0' => 'GMT+0',
|
||||
'1' => 'GMT+1',
|
||||
'2' => 'GMT+2',
|
||||
'3' => 'GMT+3',
|
||||
'4' => 'GMT+4',
|
||||
'5' => 'GMT+5',
|
||||
'6' => 'GMT+6',
|
||||
'7' => 'GMT+7',
|
||||
'8' => 'GMT+8',
|
||||
'9' => 'GMT+9',
|
||||
'10' => 'GMT+10',
|
||||
'11' => 'GMT+11',
|
||||
'12' => 'GMT+12');
|
||||
echo $html->selectTag('User/tz', $tzs, $utz, null, null, false);
|
||||
?>
|
||||
(current time is <?php echo gmdate("Y-m-d H:i:s"); ?>GMT)
|
||||
</div>
|
||||
<?php if(GMAP_API_KEY != null): ?>
|
||||
<script src="http://maps.google.com/maps?file=api&v=2&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() {
|
||||
var loc = document.getElementById("location").value;
|
||||
geocode(loc);
|
||||
}
|
||||
|
||||
function capture(event) {
|
||||
if (event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
update();
|
||||
}
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
<p id="map" class="small-map"></p>
|
||||
<?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; ?>
|
||||
<h1>Privacy</h1>
|
||||
<div>
|
||||
<label for="UserShowemail" class="label-large">Show email:</label>
|
||||
<?php echo $html->checkbox('User/showemail'); ?><br/>
|
||||
<label for="UserShowloc" class="label-large">Show location:</label>
|
||||
<?php echo $html->checkbox('User/showloc'); ?><br/>
|
||||
<label for="UserShowmap" class="label-large">Show map:</label>
|
||||
<?php echo $html->checkbox('User/showmap'); ?><br/>
|
||||
</div>
|
||||
<h1>Password</h1>
|
||||
<div>
|
||||
<label for="UserPassword" class="label-large">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="UserConfpassword" class="label-large">Confirm new password:</label>
|
||||
<?php echo $html->password('User/confpassword', array('size' => 20)); ?>
|
||||
</div>
|
||||
<?php echo $html->submit('Update'); ?>
|
||||
</form>
|
|
@ -1,27 +0,0 @@
|
|||
<h1>Login</h1>
|
||||
<?if ($error): ?>
|
||||
<div class="error">
|
||||
The email address and password you supplied do not match. Please try again.
|
||||
</div>
|
||||
<? endif;
|
||||
if (isset($preamble)): ?>
|
||||
<div class="info">
|
||||
<?php echo $preamble; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<form class="fxform" action="<?php echo $html->url('/user/login'); ?>" method="post">
|
||||
<div>
|
||||
<label class="label-large" for="email">Email Address:</label>
|
||||
<?php echo $html->input('User/email', array('size' => 40)); ?>
|
||||
</div>
|
||||
<div>
|
||||
<label class="label-large" for="password">Password:</label>
|
||||
<?php echo $html->password('User/password', array('size' => 40)); ?>
|
||||
</div>
|
||||
<div>
|
||||
<?php echo $html->submit('Login'); ?>
|
||||
</div>
|
||||
<p>
|
||||
<a href="">Create an account</a> | <a href="<?php echo $html->url('/user/recover/password'); ?>">Forgot your password?</a>
|
||||
</p>
|
||||
</form>
|
|
@ -1,110 +0,0 @@
|
|||
<h1>Register</h1>
|
||||
<?php if ($error): ?>
|
||||
<div class="error">
|
||||
There was an error in your submission, please try again.
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<form class="fxform" action="<?php echo $html->url('/user/register'); ?>" method="post">
|
||||
<p>Your e-mail address is used as your username to login. You'll also receive a confirmation e-mail to
|
||||
this address. In order for your account to be activated successfully, you must specify a valid e-mail address.</p>
|
||||
<div>
|
||||
<label class="label-large" for="UserEmail">Email address<span class="required">*</span>:</label>
|
||||
<?php echo $html->input('User/email', array('size' => 40)); ?>
|
||||
<?php echo $html->tagErrorMsg('User/email', 'The email address you entered is invalid or has already been registered.')?>
|
||||
</div>
|
||||
<div>
|
||||
<label class="label-large" for="UserConfemail">Confirm Email address<span class="required">*</span>:</label>
|
||||
<?php echo $html->input('User/confemail', array('size' => 40)); ?>
|
||||
<?php echo $html->tagErrorMsg('User/confemail', 'The email addresses you entered do not match.')?>
|
||||
</div>
|
||||
<p>How do you want to be known to visitors of <?php echo APP_NAME; ?>?</p>
|
||||
<div>
|
||||
<label class="label-large" for="UserName">Name<span class="required">*</span>:</label>
|
||||
<?php echo $html->input('User/name', array('size' => 40)); ?>
|
||||
<?php echo $html->tagErrorMsg('User/name', 'You must enter a name.')?>
|
||||
</div>
|
||||
<p>If you choose to enter it, your location will be shown on your profile. This
|
||||
field is optional.
|
||||
<div>
|
||||
<label class="label-large" for="UserLocation">Location:</label>
|
||||
<?php echo $html->input('User/location', array('id' => 'location', 'size' => 40, 'onkeypress' => 'capture(event)')); ?>
|
||||
</div>
|
||||
<p>If you have a website, enter the URL here. (including the http:// ) Your website will be
|
||||
shown to site visitors on your author profile page. This field is optional; if you don't
|
||||
have a website or don't want it linked to from <?php echo APP_NAME; ?>, leave this box blank.</p>
|
||||
<div>
|
||||
<label class="label-large" for="UserWebsite">Website:</label>
|
||||
<?php echo $html->input('User/website', array('size' => 40)); ?>
|
||||
</div>
|
||||
<div>
|
||||
<label class="label-large" for="UserTz">Timezone<span class="required">*</span>:</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>
|
||||
(this page was loaded at <?php echo gmdate("Y-m-d H:i:s"); ?>GMT)
|
||||
</div>
|
||||
<div>
|
||||
<label class="label-large" for="password">Password<span class="required">*</span>:</label>
|
||||
<?php echo $html->password('User/password', array('size' => 40)); ?>
|
||||
<?php echo $html->tagErrorMsg('User/password', 'You must enter a password.')?>
|
||||
</div>
|
||||
<div>
|
||||
<label class="label-large" for="confpassword">Confirm password<span class="required">*</span>:</label>
|
||||
<?php echo $html->password('User/confpassword', array('size' => 40)); ?>
|
||||
<?php echo $html->tagErrorMsg('User/confpassword', 'The passwords you supplied do not match.')?>
|
||||
</div>
|
||||
<?php if(GMAP_API_KEY != null): ?>
|
||||
<script src="http://maps.google.com/maps?file=api&v=2&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() {
|
||||
var loc = document.getElementById("location").value;
|
||||
geocode(loc);
|
||||
}
|
||||
|
||||
function capture(event) {
|
||||
if (event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
update();
|
||||
}
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
<p>Drag the map or the marker to specify a location. Set the zoom by using the '+' or '-' buttons on the left.</p>
|
||||
<p id="map" class="med-map-r"></p>
|
||||
<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'));
|
||||
echo $html->hidden('User/icode', array('value' => @$icode)); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php echo $html->submit('Register'); ?>
|
||||
</form>
|
|
@ -30,10 +30,10 @@ function mapInit(aLat, aLng, aZoom, aState) {
|
|||
|
||||
function geocode(aLoc) {
|
||||
var gcoder = new GClientGeocoder();
|
||||
document.getElementById('geocoded').value = 1;
|
||||
gcoder.getLatLng(aLoc, function (point) {
|
||||
if (!point) {
|
||||
//mapHelper.suggest(aLoc);
|
||||
alert("point not found");
|
||||
suggest(aLoc);
|
||||
}
|
||||
else {
|
||||
map.setZoom(10);
|
||||
|
@ -41,11 +41,28 @@ function geocode(aLoc) {
|
|||
map.removeOverlay(marker);
|
||||
marker = new GMarker(point, {draggable: true});
|
||||
map.addOverlay(marker);
|
||||
//GEvent.addListener(marker, "dragend", function() { mapHelper.onDragEnd(); });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function suggest(loc) {
|
||||
GDownloadUrl("/cake/js/suggest.php?s=" + loc, function(data, responseCode) {
|
||||
var xml = GXml.parse(data);
|
||||
var sug = xml.documentElement.getElementsByTagName("string");
|
||||
if (sug[0].getAttribute('value') !== 0) {
|
||||
document.getElementById('locerrlink').innerHTML = sug[0].getAttribute('value');
|
||||
document.getElementById('locerr').setAttribute('style', '');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function geocode_suggest() {
|
||||
var str = document.getElementById('locerrlink').innerHTML;
|
||||
document.getElementById('location').value = str;
|
||||
document.getElementById('locerr').setAttribute('style', 'display: none');
|
||||
geocode(str);
|
||||
}
|
||||
|
||||
function onMoveEnd() {
|
||||
var point = map.getCenter();
|
||||
map.removeOverlay(marker);
|
||||
|
@ -75,6 +92,10 @@ function editForm() {
|
|||
document.getElementById('zoom').value = map.getZoom();
|
||||
}
|
||||
|
||||
function shide() {
|
||||
document.getElementById('locerr').setAttribute('style', 'display: none');
|
||||
}
|
||||
|
||||
function addParty(aLat, aLng, aTxt) {
|
||||
var point = new GLatLng(aLat, aLng);
|
||||
var mark = new GMarker(point);
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
if (empty($_REQUEST['s']))
|
||||
die();
|
||||
|
||||
include('../../vendors/webServices.php');
|
||||
include('../../config/bootstrap.php');
|
||||
|
||||
$suggest = new webServices(array('type' => 'gsuggest'));
|
||||
$string = $suggest->GSuggest($_REQUEST['s']);
|
||||
|
||||
echo '<?xml version="1.0"?>
|
||||
';?>
|
||||
<suggestion>
|
||||
<string value="<?php echo $string; ?>"/>
|
||||
</suggestion>
|
Загрузка…
Ссылка в новой задаче