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
Родитель c9a84b4669
Коммит 0e2dfcfd4d
8 изменённых файлов: 38 добавлений и 12 удалений

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

@ -88,6 +88,10 @@ class PartiesController extends AppController {
$this->data['Party']['invitecode'] = $this->Hash->keygen(10);
$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->save($this->data)) {
$this->Session->setFlash('Your party has been created!', 'infoFlash');
@ -96,7 +100,7 @@ class PartiesController extends AppController {
}
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']['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']) {
$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->Session->setFlash('Party edited successfully.', 'infoFlash');
$this->redirect('parties/view/'.$id);
if ($this->Party->validates($this->data)) {
if ($this->Party->save($this->data)) {
$this->Session->setFlash('Party edited successfully.', 'infoFlash');
$this->redirect('parties/view/'.$id);
}
}
}
}

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

@ -70,6 +70,10 @@ class UsersController extends AppController {
if ($this->data['User']['email'] !== $this->data['User']['confemail'])
$this->User->invalidate('confemail');
if (!preg_match("/^(http|https)\:\/\//i", $this->data['User']['website']) &&
!empty($this->data['User']['website']))
$this->User->invalidate('website');
if ($this->data['User']['password'] !== $this->data['User']['confpass'])
$this->User->invalidate('confpass');
@ -190,6 +194,10 @@ class UsersController extends AppController {
$this->data['User']['tz'] = intval($temp['tz']);
$this->data['User']['role'] = $user['User']['role'];
if (!preg_match("/^(http|https)\:\/\//i", $this->data['User']['website']) &&
!empty($this->data['User']['website']))
$this->User->invalidate('website');
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']);

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

@ -68,6 +68,7 @@
<div>
<label for="PartyWebsite" class="label-large">Web site:</label>
<?php echo $html->input('Party/website', array('size' => 40)); ?>
<?php echo $html->tagErrorMsg('Party/website', 'Invalid URL.')?>
</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>

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

@ -12,6 +12,7 @@
<div>
<label for="PartyWebsite" class="label-large">Web site:</label>
<?php echo $html->input('Party/website', array('size' => 40)); ?>
<?php echo $html->tagErrorMsg('Party/website', 'Invalid URL.')?>
</div>
<div>
<label for="PartyAddress" class="label-large">Address:</label>
@ -102,7 +103,7 @@
<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>
<p>If you choose 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')); ?>

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

@ -16,7 +16,7 @@
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']))
if (!empty($party['Party']['website']) && preg_match("/^(http|https)\:\/\//i", $party['Party']['website']))
echo 'Website: <a href="'.$party['Party']['website'].'" rel="nofollow">'.$party['Party']['website']."</a><br/>\n";
if (!empty($party['Party']['notes']))
@ -123,11 +123,8 @@
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 '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 '<a href="'.$html->url('/parties/view/'.$party['Party']['id']).'">View Party</a>';
?>
@ -141,4 +138,3 @@
if (isset($next))
echo '<a href="'.$html->url('/parties/view/all/'.$next).'">Next Page &raquo;</a>';
endif;?>

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

@ -14,6 +14,7 @@
<div>
<label for="UserWebsite" class="label-large">Website:</label>
<?php echo $html->input('User/website', array('size' => 40)); ?>
<?php echo $html->tagErrorMsg('User/website', 'Invalid URL.')?>
</div>
<div>
<label for="location" class="label-large">Location:</label>

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

@ -31,6 +31,7 @@
<div>
<label class="label-large" for="UserWebsite">Website:</label>
<?php echo $html->input('User/website', array('size' => 40)); ?>
<?php echo $html->tagErrorMsg('User/website', 'Invalid URL.')?>
</div>
<div>
<label class="label-large" for="UserTz">Timezone<span class="required">*</span>:</label>

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

@ -8,7 +8,7 @@
if ($user['User']['showloc'] == 1 && !empty($user['User']['location']))
echo "Location: ".$user['User']['location']."<br/>";
if (!empty($user['User']['website']))
if (!empty($user['User']['website']) && preg_match("/^(http|https)\:\/\//i", $user['User']['website']))
echo 'Website: <a href="'.$user['User']['website'].'" rel="nofollow">'.$user['User']['website'].'</a><br/>';
if (!empty($parties)) {