euromark 12 years ago
parent
commit
66659f7372

+ 24 - 6
Console/Command/WhitespaceShell.php

@@ -7,14 +7,31 @@ class WhitespaceShell extends AppShell {
 	public $autoCorrectAll = false;
 	public $autoCorrectAll = false;
 
 
 	# each report: [0] => found, [1] => corrected
 	# each report: [0] => found, [1] => corrected
-	public $report = array('leading'=>array(0, 0), 'trailing'=>array(0, 0));
-
+	public $report = array('leading' => array(0, 0), 'trailing' => array(0, 0));
 
 
+	/**
+	 * Whitespaces before or after
+	 *
+	 * @return void
+	 */
 	public function find() {
 	public function find() {
-		$App = new Folder(APP);
+		if (!empty($this->args[0])) {
+			$folder = realpath($this->args[0]);
+		} elseif ($this->params['plugin']) {
+			$folder = CakePlugin::path(Inflector::classify($this->params['plugin']));
+		} else {
+			$folder = APP;
+		}
+		$App = new Folder($folder);
+		$this->out("Checking *.php in " . $folder);
 
 
 		$files = $App->findRecursive('.*\.php');
 		$files = $App->findRecursive('.*\.php');
-		$this->out("Checking *.php in ".APP);
+		$this->out('Found '. count($files) . ' files.');
+
+		$action = $this->in(__('Continue? [y]/[n]'), array('y', 'n'), 'n');
+		if ($action === 'n') {
+			$this->error('Aborted');
+		}
 
 
 		$folders = array();
 		$folders = array();
 
 
@@ -85,7 +102,7 @@ class WhitespaceShell extends AppShell {
 	}
 	}
 
 
 	/**
 	/**
-	 * whitespaces at the end of the file
+	 * Whitespaces at the end of the file
 	 */
 	 */
 	public function eof() {
 	public function eof() {
 		if (!empty($this->args[0])) {
 		if (!empty($this->args[0])) {
@@ -94,7 +111,7 @@ class WhitespaceShell extends AppShell {
 			$folder = APP;
 			$folder = APP;
 		}
 		}
 		$App = new Folder($folder);
 		$App = new Folder($folder);
-		$this->out("Checking *.php in ".APP);
+		$this->out("Checking *.php in " . $folder);
 
 
 		$files = $App->findRecursive('.*\.php');
 		$files = $App->findRecursive('.*\.php');
 
 
@@ -122,6 +139,7 @@ class WhitespaceShell extends AppShell {
 				file_put_contents($file, $content);
 				file_put_contents($file, $content);
 			}
 			}
 		}
 		}
+		$this->out('Done');
 	}
 	}
 
 
 	public function getOptionParser() {
 	public function getOptionParser() {

+ 7 - 7
Model/Behavior/PasswordableBehavior.php

@@ -141,11 +141,11 @@ class PasswordableBehavior extends ModelBehavior {
 		# easiest authenticate method via form and (id + pwd)
 		# easiest authenticate method via form and (id + pwd)
 		$this->Auth->authenticate = array(
 		$this->Auth->authenticate = array(
 			'Form' => array(
 			'Form' => array(
-				'fields'=>array('username' => 'id', 'password'=>$this->settings[$Model->alias]['field'])
+				'fields' => array('username' => 'id', 'password' => $this->settings[$Model->alias]['field'])
 			)
 			)
 		);
 		);
 		$request = Router::getRequest();
 		$request = Router::getRequest();
-		$request->data['User'] = array('id'=>$uid, 'password'=>$pwd);
+		$request->data['User'] = array('id' => $uid, 'password' => $pwd);
 		$response = new CakeResponse();
 		$response = new CakeResponse();
 		return (bool)$this->Auth->identify($request, $response);
 		return (bool)$this->Auth->identify($request, $response);
 	}
 	}
@@ -199,8 +199,9 @@ class PasswordableBehavior extends ModelBehavior {
 	}
 	}
 
 
 	/**
 	/**
-	 * adding validation rules
+	 * Adding validation rules
 	 * also adds and merges config settings (direct + configure)
 	 * also adds and merges config settings (direct + configure)
+	 *
 	 * @return void
 	 * @return void
 	 * 2011-08-24 ms
 	 * 2011-08-24 ms
 	 */
 	 */
@@ -252,10 +253,8 @@ class PasswordableBehavior extends ModelBehavior {
 	}
 	}
 
 
 	/**
 	/**
-	 * whitelisting
+	 * Preparing the data
 	 *
 	 *
-	 * @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)
 	 * @return bool $success
 	 * @return bool $success
 	 * 2011-07-22 ms
 	 * 2011-07-22 ms
 	 */
 	 */
@@ -311,7 +310,8 @@ class PasswordableBehavior extends ModelBehavior {
 
 
 
 
 	/**
 	/**
-	 * hashing the password now
+	 * Hashing the password and whitelisting
+	 *
 	 * @return bool $success
 	 * @return bool $success
 	 * 2011-07-22 ms
 	 * 2011-07-22 ms
 	 */
 	 */

+ 1 - 1
View/Helper/CommonHelper.php

@@ -646,7 +646,7 @@ piwikTracker.enableLinkTracking();
 		if (empty($trackingUrl)) {
 		if (empty($trackingUrl)) {
 			$trackingUrl = 'visit_stats';
 			$trackingUrl = 'visit_stats';
 		}
 		}
-		return '<img src="'.Router::url('/').$trackingUrl.'/piwik.php?idsite=1" style="border:0" alt=""/>';
+		return '<img src="' . Router::url('/', true) . $trackingUrl . '/piwik.php?idsite=1" style="border:0" alt=""/>';
 	}
 	}