euromark 13 年 前
コミット
fe5d8bc773

+ 2 - 2
Lib/Error/MyErrorHandler.php

@@ -1,6 +1,7 @@
 <?php
 App::uses('ErrorHandler', 'Error');
 App::uses('CakeRequest', 'Network');
+App::uses('Utility', 'Tools.Utility');
 
 class MyErrorHandler extends ErrorHandler {
 
@@ -128,9 +129,8 @@ class MyErrorHandler extends ErrorHandler {
 	 * 2011-12-21 ms
 	 */
 	public static function traceDetails() {
-		App::uses('CommonComponent', 'Tools.Controller/Component');
 		$currentUrl = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : 'n/a';
-		$refererUrl = CommonComponent::getReferer(); //Router::getRequest()->url().'
+		$refererUrl = Utility::getReferer(); //Router::getRequest()->url().'
 		App::uses('CakeSession', 'Model/Datasource');
 		$uid = CakeSession::read('Auth.User.id');
 		if (!isset($uid)) {

+ 2 - 2
Lib/MyModel.php

@@ -404,13 +404,13 @@ class MyModel extends Model {
 
 	/**
 	 * Makes a subquery
-	 * @link http://bakery.cakephp.org/articles/lucaswxp/2011/02/11/easy_and_simple_subquery_cakephp
 	 *
 	 * @param string $type The type o the query ('count'/'all'/'first' - first only works with some mysql versions)
 	 * @param array $options The options array
 	 * @param string $alias You can use this intead of $options['alias'] if you want
 	 * @return string $result sql snippet of the query to run
 	 * @modified Mark Scherer (cake2.x ready and improvements)
+	 * @link http://bakery.cakephp.org/articles/lucaswxp/2011/02/11/easy_and_simple_subquery_cakephp
 	 * 2011-07-05 ms
 	 */
 	public function subquery($type, $options = array(), $alias = null) {
@@ -443,7 +443,7 @@ class MyModel extends Model {
 			'group' => null
 		);
 		$params = array_merge($default, $options);
-		$subQuery = '(' . $dbo->buildStatement($params, $this) . ')';
+		$subQuery = '(' . trim($dbo->buildStatement($params, $this)) . ')';
 		return $subQuery;
 	}
 

+ 2 - 1
Model/Behavior/BitmaskedBehavior.php

@@ -8,7 +8,7 @@ App::uses('ModelBehavior', 'Model');
  * You can submit/register flags in different ways. The easiest way is using a static model function.
  * It should contain the bits like so (starting with 1):
  * 	1 => w, 2 => x, 4 => y, 8 => z, ... (bits as keys - names as values)
- * The order doest't matter, as long as no bit is used twice.
+ * The order doesn't matter, as long as no bit is used twice.
  *
  * The theoretical limit for a 64-bit integer would be 64 bits (2^64).
  * But if you actually seem to need more than a hand full you
@@ -19,6 +19,7 @@ App::uses('ModelBehavior', 'Model');
  * @cake 2.x
  * @license MIT
  * @uses ModelBehavior
+ * @link http://www.dereuromark.de/2012/02/26/bitmasked-using-bitmasks-in-cakephp/
  * 2012-02-24 ms
  */
 class BitmaskedBehavior extends ModelBehavior {

+ 5 - 12
Model/Behavior/ChangePasswordBehavior.php

@@ -3,15 +3,6 @@ App::uses('ModelBehavior', 'Model');
 App::uses('CakeResponse', 'Network');
 App::uses('Security', 'Utility');
 
-/**
- * Copyright 2011, Mark Scherer
- *
- * Licensed under The MIT License
- * Redistributions of files must retain the above copyright notice.
- *
- * @license    http://www.opensource.org/licenses/mit-license.php The MIT License
- */
-
 if (!defined('PWD_MIN_LENGTH')) {
 	define('PWD_MIN_LENGTH', 3);
 }
@@ -20,7 +11,7 @@ if (!defined('PWD_MAX_LENGTH')) {
 }
 
 /**
- * A cakephp2 behavior to change passwords the easy way
+ * A cakephp2 behavior to work with passwords the easy way
  * - complete validation
  * - hashing of password
  * - requires fields (no tempering even without security component)
@@ -150,7 +141,7 @@ class ChangePasswordBehavior extends ModelBehavior {
 	 * @return bool $success
 	 * 2011-07-22 ms
 	 */
-	public function validateIdentical(Model $Model, $data, $compareWith = null) {debug($compareWith); ob_flush();
+	public function validateIdentical(Model $Model, $data, $compareWith = null) {
 		if (is_array($data)) {
 			$value = array_shift($data);
 		} else {
@@ -215,6 +206,9 @@ class ChangePasswordBehavior extends ModelBehavior {
 
 	/**
 	 * whitelisting
+	 * 
+	 * @todo currently there is a cake core bug that can break functionality here
+	 * (see http://cakephp.lighthouseapp.com/projects/42648/tickets/3071-behavior-validation-methods-broken for details)
 	 * 2011-07-22 ms
 	 */
 	public function beforeValidate(Model $Model) {
@@ -251,7 +245,6 @@ class ChangePasswordBehavior extends ModelBehavior {
 					//unset($Model->validate[$formFieldCurrent]);
 					unset($Model->data[$Model->alias][$formFieldCurrent]);
 				}
-				debug($Model->data);
 				return true;
 			}
 		}

+ 0 - 1
Model/CodeKey.php

@@ -1,6 +1,5 @@
 <?php
 App::uses('Token', 'Tools.Model');
-App::uses('CommonComponent', 'Tools.Controller/Component');
 
 /**
  * @deprecated - use "Token" class

+ 4 - 3
View/Helper/FormatHelper.php

@@ -1015,11 +1015,12 @@ class FormatHelper extends TextHelper {
 		}
 		$title = isset($text) ? $text : $username;
 		$username = slug($username);
+		$url = array('plugin' => false, 'admin' => false, 'controller' => 'members', 'action' => 'view', $uid, $username);
+
 		if (!empty($options['hash'])) {
-			$username .= '#'.$options['hash'];
+			$url['#'] = $options['hash'];
 		}
-		return $this->Html->link($title, array('plugin' => false, 'admin' => false, 'controller' => 'members', 'action' => 'view', $uid, $username),
-			$attr);
+		return $this->Html->link($title, $url, $attr);
 	}
 
 	/**