Bug 357591 - "Party website urls beginning with www are not linked correctly" [p=ryan@ryanflint.com]

This commit is contained in:
mike.morgan%oregonstate.edu 2006-10-24 19:24:38 +00:00
Родитель 33bc8edb43
Коммит 75a8ce97dc
8 изменённых файлов: 22 добавлений и 1072 удалений

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

@ -88,6 +88,10 @@ class PartiesController extends AppController {
$this->data['Party']['invitecode'] = $this->Hash->keygen(10); $this->data['Party']['invitecode'] = $this->Hash->keygen(10);
$this->data['Party']['owner'] = $_SESSION['User']['id']; $this->data['Party']['owner'] = $_SESSION['User']['id'];
if (!preg_match("/^(http|https)\:\/\//i", $this->data['Party']['website']) &&
!empty($this->data['Party']['website']))
$this->Party->invalidate('website');
if ($this->Party->validates($this->data)) { if ($this->Party->validates($this->data)) {
if($this->Party->save($this->data)) { if($this->Party->save($this->data)) {
$this->Session->setFlash('Your party has been created!', 'infoFlash'); $this->Session->setFlash('Your party has been created!', 'infoFlash');
@ -96,7 +100,7 @@ class PartiesController extends AppController {
} }
else { else {
$this->Session->setFlash('Please correct errors below.', 'errorFlash'); $this->Session->setFlash('Please correct the errors below.', 'errorFlash');
} }
} }
} }
@ -178,15 +182,29 @@ class PartiesController extends AppController {
$this->data['Party']['owner'] = $party['Party']['owner']; $this->data['Party']['owner'] = $party['Party']['owner'];
$this->data['Party']['duration'] = intval($this->data['Party']['duration']); $this->data['Party']['duration'] = intval($this->data['Party']['duration']);
$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 (!preg_match("/^(http|https)\:\/\//i", $this->data['Party']['website']) &&
!empty($this->data['Party']['website']))
$this->Party->invalidate('website');
if ($this->data['Party']['flickrusr'] != $party['Party']['flickrusr']) { if ($this->data['Party']['flickrusr'] != $party['Party']['flickrusr']) {
$params = array('type' => 'flickr', 'username' => $this->data['Party']['flickrusr']); $params = array('type' => 'flickr', 'username' => $this->data['Party']['flickrusr']);
$flick = new webServices($params); $flick = new webServices($params);
$this->data['Party']['flickrid'] = $flick->getFlickrId(); $this->data['Party']['flickrid'] = $flick->getFlickrId();
} }
if ($this->Party->save($this->data)) { if ($this->Party->validates($this->data)) {
$this->Session->setFlash('Party edited successfully.', 'infoFlash'); if ($this->Party->save($this->data)) {
$this->redirect('parties/view/'.$id); $this->Session->setFlash('Party edited successfully.', 'infoFlash');
$this->redirect('parties/view/'.$id);
}
} }
} }
} }

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

@ -1,429 +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 ***** */
uses('sanitize');
class UsersController extends AppController {
var $name = 'Users';
var $uses = array('User', 'Party');
var $helpers = array('Html', 'Form');
var $components = array('Security', 'Hash', 'Mail');
function index() {
if (!isset($_SESSION['User'])) {
$this->redirect('/users/login');
}
$this->pageTitle = 'My Profile';
$user = $this->Session->read('User');
$this->set('parties', $this->User->memberOf($user['id']));
$this->set('hparties', $this->User->hostOf($user['id']));
$this->set('iparties', $this->User->invitedTo($user['id']));
}
function register() {
$this->pageTitle = 'Register';
$this->set('map', 'mapInit()');
if(empty($this->data)) {
$this->set('utz', '0');
$this->render();
}
else {
if ($this->User->findByEmail($this->data['User']['email']))
$this->User->invalidate('email');
if ($this->data['User']['email'] !== $this->data['User']['confemail'])
$this->User->invalidate('confemail');
if ($this->data['User']['password'] !== $this->data['User']['confpass'])
$this->User->invalidate('confpass');
if (empty($this->data['User']['password']) || empty($this->data['User']['confpass']))
$this->User->invalidate('password');
// Repopulate the timezone with right value in case there's a validation error
$this->set('utz', $this->data['User']['tz']);
if ($this->User->validates($this->data)) {
$clean = new Sanitize();
// Generate and set the password, salt and activation key
$pass = $this->Hash->password($this->data['User']['password'],
$this->data['User']['email']);
$this->data['User']['active'] = $this->Hash->keygen(10);
$this->data['User']['password'] = $pass['pass'];
$this->data['User']['salt'] = $pass['salt'];
// Save a few fields from the wrath of cleanArray()
$temp = array('lat' => $this->data['User']['lat'],
'long' => $this->data['User']['long'],
'tz' => $this->data['User']['tz'],
'email' => $this->data['User']['email']);
// Scrub 'a dub
$clean->cleanArray($this->data);
$this->data['User']['email'] = $temp['email'];
$this->data['User']['long'] = floatval($temp['long']);
$this->data['User']['lat'] = floatval($temp['lat']);
$this->data['User']['tz'] = intval($temp['tz']);
$this->data['User']['role'] = 0;
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.'/users/activate/'.$this->data['User']['active'],
'type' => 'act');
$this->Mail->mail($message);
$this->Mail->send();
if (isset($_SESSION['invite']))
$this->Party->addGuest($this->User->getLastInsertId(), $_SESSION['invite']);
$this->Session->setFlash('Thank you for registering! To login, you\'ll
need to activate your account. Please check
your email for your activation link.', 'infoFlash');
$this->redirect('/users/login');
}
else {
$this->data['User']['password'] = null;
$this->data['User']['confpass'] = null;
$this->render();
}
}
else {
$this->data['User']['password'] = null;
$this->data['User']['confpass'] = null;
$this->Session->setFlash('There was an error in your submission. Please
correct the errors shown below and try again.',
'errorFlash');
$this->render();
}
}
}
function edit() {
if (!isset($_SESSION['User'])) {
$this->redirect('/users/login');
}
$this->set('error', false);
$this->pageTitle = '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']);
$this->data['User']['name'] = preg_replace("/&#(\d{2,5});/e",
'$this->Unicode->unicode2utf(${1})',
html_entity_decode($this->data['User']['name']));
$this->data['User']['website'] = preg_replace("/&#(\d{2,5});/e",
'$this->Unicode->unicode2utf(${1})',
html_entity_decode($this->data['User']['website']));
$this->data['User']['location'] = preg_replace("/&#(\d{2,5});/e",
'$this->Unicode->unicode2utf(${1})',
html_entity_decode($this->data['User']['location']));
if (GMAP_API_KEY != null) {
if ($this->data['User']['lat'])
$this->set('map', 'mapInit('.$this->data['User']['lat'].','.$this->data['User']['long'].','.$this->data['User']['zoom'].')');
else
$this->set('map', 'mapInit()');
}
}
else {
$user = $this->User->findById($_SESSION['User']['id']);
$this->User->id = $user['User']['id'];
$this->set('utz', $user['User']['tz']);
$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 ($this->data['User']['password'] === $this->data['User']['confpassword'] &&
!empty($this->data['User']['password'])) {
$pass = $this->Hash->password($this->data['User']['password'], $user['User']['email']);
$this->data['User']['password'] = $pass['pass'];
$this->data['User']['salt'] = $pass['salt'];
}
else if (empty($this->data['User']['password']) && empty($this->data['User']['confpassword'])) {
$this->data['User']['password'] = $user['User']['password'];
$this->data['User']['salt'] = $user['User']['salt'];
}
else {
$this->set('error', true);
$this->User->invalidate('password');
$this->User->invalidate('confpassword');
}
if ($this->User->validates($this->data)) {
if ($this->User->save($this->data)) {
$sess = $this->User->findById($user['User']['id']);
$this->redirect('/users/');
}
}
else {
$this->validateErrors($this->User);
$this->data['User']['password'] = null;
$this->data['User']['confpassword'] = null;
$this->render();
}
}
}
function login() {
if ($this->Session->Check('User'))
$this->redirect('/users');
$this->pageTitle = 'Login';
if (!empty($this->data)) {
if (empty($this->data['User']['email']) || empty($this->data['User']['password']))
$this->render();
$user = $this->User->findByEmail($this->data['User']['email']);
$pass = sha1($this->data['User']['password'].$user['User']['salt']);
if ($user['User']['password'] == $pass) {
if ($user['User']['active'] != 1) {
$this->Session->setFlash('Your account hasn\'t been activated yet. Please
check your email (including junk/spam folders)
for your activation link, or click <a href="'
.APP_BASE.'/users/recover/activate">here</a> to
resend your activation details.', 'infoFlash');
$this->render();
}
else {
if (isset($_SESSION['invite']))
$this->Party->addGuest($user['User']['id'], $_SESSION['invite']);
$this->Session->write('User', $user['User']);
$this->redirect('/users/');
}
}
else {
$this->Session->setFlash('The email address and password you supplied do
not match. Please try again.', 'errorFlash');
}
}
}
function view($id = null) {
if (!is_numeric($id))
$this->redirect('/');
else {
$user = $this->User->findById($id);
$this->pageTitle = $user['User']['name'];
$this->set('user', $user);
if (GMAP_API_KEY != null && !empty($user['User']['lat']))
$this->set('map', 'mapInit('.$user['User']['lat'].','.$user['User']['long'].','.$user['User']['zoom'].',\'stationary\');');
$this->Party->unbindModel(array('hasMany' => array('Comment')));
$this->set('hparties', $this->User->hostOf($id));
$att = $this->User->query('SELECT parties.id, parties.name
FROM parties
LEFT JOIN guests
ON parties.id = guests.pid
WHERE guests.uid = '.$id);
$this->set('parties', $att);
}
}
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 = "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->Session->setFlash('Could not find a user with that email address. Please check it and try again.', 'errorFlash');
$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.'/users/recover/password/'.$code.'/'.$user['User']['id'],
'type' => 'prec');
$this->Mail->mail($message);
$this->Mail->send();
$this->Session->setFlash('An email has been sent to '.$user['User']['email'].' with reset instructions.', 'errorFlash');
$this->redirect('users/login');
}
}
if ($aCode !== null && $aId !== null) {
$this->set('hideInput', true);
$this->set('reset', false);
$user = $this->User->findById($aId);
if (!$user) {
$this->Session->setFlash('Invalid request. Please check the URL and try again.', 'errorFlash');
$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->Session->setFlash('Invalid request. Please check the URL and try again.', 'errorFlash');
$this->render();
}
}
break;
case "activate":
$this->pageTitle = '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->Session->setFlash('Could not find a user with that email address. Please check it and try again.', 'errorFlash');
$this->render();
}
if ($user['User']['active'] == 1)
$this->redirect('/users/login');
else {
$message = array('from' => APP_NAME.' <'.APP_EMAIL.'>',
'envelope' => APP_EMAIL,
'to' => $this->data['User']['email'],
'subject' => 'Your '.APP_NAME.' Registration',
'link' => APP_BASE.'/users/activate/'.$user['User']['active'],
'type' => 'act');
$this->Mail->mail($message);
$this->Mail->send();
$this->Session->setFlash('Your activation code has been resent.', 'infoFlash');
$this->redirect('users/login');
}
}
break;
case "reset":
if ($aCode !== null && $aId !== null) {
if (!empty($this->data)) {
$user = $this->User->findById($aId);
if (!$user) {
$this->Session->setFlash('Invalid request. Please check the URL and try again.', 'errorFlash');
$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->Session->setFlash('Your password has been reset.', 'infoFlash');
$this->redirect('/users/login');
}
}
}
}
break;
default:
$this->redirect('/');
break;
}
}
function activate($aKey = null) {
if ($aKey == null)
$this->redirect('/');
else {
$user = $this->User->findByActive($aKey);
if (empty($user['User']['id'])) {
$this->Session->setFlash('Your account could not be activated. Please make
sure the URL entered is correct and try again.', 'errorFlash');
$this->redirect('/users/login');
}
else {
$this->data = $user;
$this->data['User']['active'] = 1;
if ($this->User->save($this->data)) {
$this->Session->setFlash('Your account was successfully activated.', 'infoFlash');
$this->redirect('/users/login');
}
}
}
}
}
?>

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

@ -1,108 +0,0 @@
<h1>Create a Party</h1>
<form class="fxform" action="<?php echo $html->url('/parties/add'); ?>" 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)); ?>
<?php echo $html->tagErrorMsg('Party/name', 'Please enter a party name.')?>
</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="locerr" class="info" style="display: none">Did you mean: <a id="locerrlink" onclick="geocode_suggest()" href="#"></a>? <a href="#" onclick="shide()"><span style="font-size: x-small">(close)</span></a></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>
<?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',
'13' => 'GMT+13');
echo $html->selectTag('Party/tz', $tzs, $utz, null, null, false);
?>
(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&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() {
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>
<?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('Create Party'); ?>
</form>

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

@ -1,130 +0,0 @@
<form class="fxform" action="<?php echo $html->url('/parties/edit/'.$party['Party']['id']); ?>" method="post">
<?php echo $html->hidden('Party/id'); ?>
<h1>Details</h1>
<div>
<label for="PartyName" class="label-large">Party Name:</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="PartyWebsite" class="label-large">Web site:</label>
<?php echo $html->input('Party/website', 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>
<?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>
<p id="map" class="med-map-r"></p>
<div>
<label for="PartyNotes" class="label-large">Additional Notes:</label>
<?php echo $html->textarea('Party/notes', array('rows' => 10, 'cols' => 50)); ?>
</div>
<h1>Date</h1>
<div>
<label for="PartyYear" class="label-large">Date:</label>
<?php echo $html->yearOptionTag('Party/year', null, date('Y'), MAX_YEAR, $date['year'], null, null, false); ?>-<?php echo $html->hourOptionTag('Party/month', null, false, $date['mon']); ?>-<?php echo $html->dayOptionTag('Party/day', null, $date['day'], null, false); ?>
</div>
<div>
<label for="PartyHour" class="label-large">Time:</label>
<?php echo $html->hourOptionTag('Party/hour', null, true, $date['hour']);?>:<?php echo $html->minuteOptionTag('Party/minute', null, $date['min']);?>
<?php echo $html->radio('Party/confirmed', array(0 => 'Tentative', 1 => 'Confirmed')); ?>
</div>
<div>
<label for="PartyTz" 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',
'13' => 'GMT+13');
echo $html->selectTag('Party/tz', $tzs, $date['tz'], null, null, false);?>
(current time is <?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>
<h1><span style="color: #0063dc">flick</span><span style="color: #ff0084">r<sup style="font-size: 8px">TM</sup></span> Options</h1>
<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>
<div>
<label for="PartyUseflickr" class="label-large">Show photostream:</label>
<?php echo $html->checkbox('Party/useflickr'); ?>
</div>
<p>To show photos from anyone using your party's tag, please note that no photos will show until two or more people are using the tag.</p>
<div>
<label for="PartyFlickrperms" class="label-large">Show:</label>
<?php echo $html->radio('Party/flickrperms', array(0 => 'Only my photos', 1 => 'Anyone\'s photos')); ?>
</div>
<div>
<label for="PartyFlickrusr" class="label-large">Flickr username:</label>
<?php echo $html->input('Party/flickrusr', array('size' => 40)); ?>
</div>
<h1>Privacy</h1>
<div>
<label for="PartyInviteonly" class="label-large">Invite only:</label>
<?php echo $html->checkbox('Party/inviteonly'); ?>
</div>
<div>
<label for="PartyGuestcomments" class="label-large">Limit comments to party guests only:</label>
<?php echo $html->checkbox('Party/guestcomments'); ?>
</div>
<br/>
<?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>

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

@ -1,144 +0,0 @@
<?php
if (isset($party)): ?>
<h1><?php echo $party['Party']['name']; ?></h1>
<br/>
<?php if ($party['Party']['canceled']): ?>
<div class="error">This party has been canceled</div>
<?php endif; ?>
Host: <a href="<?php echo $html->url('/users/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'].' hour'.(($party['Party']['duration'] == 1) ? '' : 's')."\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&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>
<div id="map" class="small-map"></div>
<h1>Who's coming</h1>
<div>
<?php if (!empty($guests)):
$i = 0;
$c = count($guests) - 1;
foreach ($guests as $guest): ?>
<a href="<?php echo $html->url('/users/view/'.$guest['users']['id']); ?>"><?php echo $guest['users']['name']; ?></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 && !$party['Party']['canceled'])):?>
<br/><br/>
<form action="<?php
echo $html->url('/parties/'.((!$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; ?>
<? if ($party['Party']['inviteonly'] == 1 && (!$isguest && @$_SESSION['User']['id'] != $party['Party']['owner'] && !$party['Party']['canceled'])):?>
<p>This party is invite only. You'll need an invite code from the host to join in.</p>
<?php endif; ?>
</div>
<?php if (@$_SESSION['User']['id'] == $party['Party']['owner']):?>
<h1>Party options</h1>
<a href="<?php echo $html->url('/parties/edit/'.$party['Party']['id']);?>">Edit party</a>
<?php if (!$party['Party']['canceled']): ?>| <a href="<?php echo $html->url('/parties/invite/'.$party['Party']['id']);?>">Invite a guest</a>
<?php endif; echo (($party['Party']['canceled'] == 1) ? ' | <a href="'.$html->url('/parties/uncancel/'.$party['Party']['id']).'">
Reactivate this party</a>' : '| <a href="'.$html->url('/parties/cancel/'.$party['Party']['id']).'" onclick="return confirm(\'Are you sure you want to cancel your party?\')"><span style="color: #bc1313">Cancel this party</span></a>'); ?>
<?php endif; ?>
<?php if (isset($flickr)): ?>
<h1 id="photos">Photos <a title="Photo Feed" href="<?php echo $html->url('/feeds/photos/'.$party['Party']['id']); ?>"><img src="<?php echo $html->url('/img/feed16.png'); ?>" alt="Atom"/></a></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 <a title="Comment Feed" href="<?php echo $html->url('/feeds/comments/'.$party['Party']['id']); ?>"><img src="<?php echo $html->url('/img/feed16.png'); ?>" alt="RSS"/></a></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('/users/view/'.$comment['users']['uid']); ?>">
<?php echo $comment['users']['name']; ?></a> on <?php echo gmdate('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) || !$party['Party']['guestcomments'] || @$_SESSION['User']['id'] == $party['Party']['owner']): ?>
<h1>Add a comment</h1>
<form action="<?php echo $html->url('/comments/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('/parties/view/all/'.$prev).'">&laquo; Previous Page</a> ';
if (isset($prev) && isset($next))
echo ' | ';
if (isset($next))
echo '<a href="'.$html->url('/parties/view/all/'.$next).'">Next Page &raquo;</a>';
$i = 0;
foreach ($parties as $party):
if ($party['Party']['canceled'] != 1): ?>
<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('/parties/view/'.$party['Party']['id']).'">View Party</a>';
?>
</p>
</div>
<?php endif; endforeach;
if (isset($prev))
echo '<a href="'.$html->url('/parties/view/all/'.$prev).'">&laquo; Previous Page</a> ';
if (isset($prev) && isset($next))
echo ' | ';
if (isset($next))
echo '<a href="'.$html->url('/parties/view/all/'.$next).'">Next Page &raquo;</a>';
endif;?>

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

@ -1,104 +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('/users/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)); ?>
<?php echo $html->tagErrorMsg('User/name', 'You must enter a name.')?>
</div>
<div>
<label for="UserWebsite" 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',
'13' => 'GMT+13');
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&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() {
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/>
</div>
<div>
<label for="UserShowloc" class="label-large">Show location:</label>
<?php echo $html->checkbox('User/showloc'); ?><br/>
</div>
<div>
<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, 'autocomplete' => 'off')); ?>
</div>
<div>
<label for="UserConfpassword" class="label-large">Confirm new password:</label>
<?php echo $html->password('User/confpassword', array('size' => 20, 'autocomplete' => 'off')); ?>
<?php echo $html->tagErrorMsg('User/confpassword', 'The supplied passwords do not match!')?>
</div>
<?php echo $html->submit('Update'); ?>
</form>

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

@ -1,109 +0,0 @@
<h1>Register</h1>
<form class="fxform" action="<?php echo $html->url('/users/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)', 'onblur' => 'update()')); ?>
<div id="locerr" class="info" style="display: none">Did you mean: <a id="locerrlink" onclick="geocode_suggest()" href="#"></a>? <a href="#" onclick="shide()"><span style="font-size: x-small">(close)</span></a></div>
</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>
<?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',
'13' => 'GMT+13');
echo $html->selectTag('User/tz', $tzs, $utz, null, null, false);
?>
(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/confpass', array('size' => 40)); ?>
<?php echo $html->tagErrorMsg('User/confpass', 'The passwords you supplied do not match.')?>
</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() {
var loc = document.getElementById("location").value;
geocode(loc);
}
function capture(event) {
if (event.keyCode == 13) {
event.preventDefault();
update();
}
}
//]]>
</script>
<p><span class="required">*</span> Required field</p>
<p>Drag the map or the marker to specify your 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/geocoded', array('id' => 'geocoded', 'value' => 0));
echo $html->hidden('User/icode', array('value' => @$icode)); ?>
</div>
<?php endif; ?>
<?php echo $html->submit('Register'); ?>
</form>

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

@ -1,44 +0,0 @@
<?php
if (!empty($user['User']['name']))
echo "<h1>".$user['User']['name']."</h1><br/>";
if ($user['User']['showemail'] == 1 && @$_SESSION['User'])
echo "Email: ".$user['User']['email']."<br/>";
if ($user['User']['showloc'] == 1 && !empty($user['User']['location']))
echo "Location: ".$user['User']['location']."<br/>";
if (!empty($user['User']['website']))
echo 'Website: <a href="'.$user['User']['website'].'" rel="nofollow">'.$user['User']['website'].'</a><br/>';
if (!empty($parties)) {
echo "Attending: ";
$c = count($parties) - 1;
$i = 0;
foreach ($parties as $party) {
echo '<a href="'.$html->url('/parties/view/'.$party['parties']['id']).'">'.$party['parties']['name'].'</a>';
echo ($i < $c) ? ', ' : '<br/>';
$i++;
}
}
if (!empty($hparties)) {
echo "Hosting: ";
$c = count($hparties) - 1;
$i = 0;
foreach ($hparties as $party) {
echo '<a href="'.$html->url('/parties/view/'.$party['parties']['id']).'">'.$party['parties']['name'].'</a>';
echo ($i < $c) ? ', ' : '<br/>';
$i++;
}
}
?>
<?php if(isset($map) && $user['User']['showmap'] == 1): ?>
<br/>
<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>
<div id="map" style="height: 200px; width: 350px;"></div>
<?php endif; ?>