Commits

Jacob Moen  committed 3d5080e

Whitespace fixes

  • Participants
  • Parent commits c8c5403

Comments (0)

Files changed (85)

 glob:protected/vendors/pyrus/vendor/.pear2registry
 glob:protected/vendors/pyrus/vendor/cache/*
 glob:protected/vendors/pyrus/vendor/downloads/*
+.tags
+.tags_sorted_by_file
+bugitor.sublime-workspace

File bugitor.sublime-project

+{
+    "folders":
+    [
+    {
+        "folder_exclude_patterns": [
+        "assets",
+        "protected/runtime",
+        "themes/sassy/.*",
+        "uploads"
+        ],
+        "path": "/var/www/bugitor"
+        },
+        {
+          "folder_exclude_patterns": [
+          "cli/views"
+          ],
+          "file_exclude_patterns": [
+          "yiilite.php"
+          ],
+          "path": "/var/www/yii/framework",
+          "ctags_command"   :  "ctags -R -f .tags '--exclude=*lite.php'"
+      }
+      ]
+  }

File protected/behaviors/BugitorTimestampBehavior.php

  * You may specify an active record model to use this behavior like so:
  * <pre>
  * public function behaviors(){
- * 	return array(
- * 		'BugitorTimestampBehavior' => array(
- * 			'class' => 'zii.behaviors.BugitorTimestampBehavior',
- * 			'createAttribute' => 'create_time_attribute',
- * 			'updateAttribute' => 'update_time_attribute',
- * 		)
- * 	);
+ *  return array(
+ *      'BugitorTimestampBehavior' => array(
+ *          'class' => 'zii.behaviors.BugitorTimestampBehavior',
+ *          'createAttribute' => 'create_time_attribute',
+ *          'updateAttribute' => 'update_time_attribute',
+ *      )
+ *  );
  * }
  * </pre>
  * The {@link createAttribute} and {@link updateAttribute} options actually default to 'create_time' and 'update_time'
  */
 
 class BugitorTimestampBehavior extends CActiveRecordBehavior {
-	/**
-	* @var mixed The name of the attribute to store the creation time.  Set to null to not
-	* use a timstamp for the creation attribute.  Defaults to 'create_time'
-	*/
-	public $createAttribute = 'create_time';
-	/**
-	* @var mixed The name of the attribute to store the modification time.  Set to null to not
-	* use a timstamp for the update attribute.  Defaults to 'update_time'
-	*/
-	public $updateAttribute = 'update_time';
+    /**
+    * @var mixed The name of the attribute to store the creation time.  Set to null to not
+    * use a timstamp for the creation attribute.  Defaults to 'create_time'
+    */
+    public $createAttribute = 'create_time';
+    /**
+    * @var mixed The name of the attribute to store the modification time.  Set to null to not
+    * use a timstamp for the update attribute.  Defaults to 'update_time'
+    */
+    public $updateAttribute = 'update_time';
 
-	/**
-	* @var bool Whether to set the update attribute to the creation timestamp upon creation.
-	* Otherwise it will be left alone.  Defaults to false.
-	*/
-	public $setUpdateOnCreate = true;
+    /**
+    * @var bool Whether to set the update attribute to the creation timestamp upon creation.
+    * Otherwise it will be left alone.  Defaults to false.
+    */
+    public $setUpdateOnCreate = true;
 
-	/**
-	* @var mixed The expression to use to generate the timestamp.  e.g. 'time()'.
-	* Defaults to null meaning that we will attempt to figure out the appropriate timestamp
-	* automatically.  If we fail at finding the appropriate timestamp, then it will
-	* fall back to using the current UNIX timestamp
-	*/
-	public $timestampExpression=null;
+    /**
+    * @var mixed The expression to use to generate the timestamp.  e.g. 'time()'.
+    * Defaults to null meaning that we will attempt to figure out the appropriate timestamp
+    * automatically.  If we fail at finding the appropriate timestamp, then it will
+    * fall back to using the current UNIX timestamp
+    */
+    public $timestampExpression=null;
 
-	/**
-	* @var array Maps column types to database method
-	*/
-	protected static $map = array(
-			'datetime'=>'UTC_TIMESTAMP()',
-			'timestamp'=>'UTC_TIMESTAMP()',
-			'date'=>'UTC_TIMESTAMP()',
-	);
+    /**
+    * @var array Maps column types to database method
+    */
+    protected static $map = array(
+            'datetime'=>'UTC_TIMESTAMP()',
+            'timestamp'=>'UTC_TIMESTAMP()',
+            'date'=>'UTC_TIMESTAMP()',
+    );
 
-	/**
-	* Responds to {@link CModel::onBeforeSave} event.
-	* Sets the values of the creation or modified attributes as configured
-	*
-	* @param CModelEvent event parameter
-	*/
-	public function beforeSave($event) {
-		if ($this->getOwner()->getIsNewRecord() && ($this->createAttribute !== null)) {
-			$this->getOwner()->{$this->createAttribute} = $this->getTimestampByAttribute($this->createAttribute);
-		}
-		if ((!$this->getOwner()->getIsNewRecord() || $this->setUpdateOnCreate) && ($this->updateAttribute !== null)) {
-			$this->getOwner()->{$this->updateAttribute} = $this->getTimestampByAttribute($this->updateAttribute);
-		}
-	}
+    /**
+    * Responds to {@link CModel::onBeforeSave} event.
+    * Sets the values of the creation or modified attributes as configured
+    *
+    * @param CModelEvent event parameter
+    */
+    public function beforeSave($event) {
+        if ($this->getOwner()->getIsNewRecord() && ($this->createAttribute !== null)) {
+            $this->getOwner()->{$this->createAttribute} = $this->getTimestampByAttribute($this->createAttribute);
+        }
+        if ((!$this->getOwner()->getIsNewRecord() || $this->setUpdateOnCreate) && ($this->updateAttribute !== null)) {
+            $this->getOwner()->{$this->updateAttribute} = $this->getTimestampByAttribute($this->updateAttribute);
+        }
+    }
 
-	/**
-	* Gets the approprate timestamp depending on the column type $attribute is
-	*
-	* @param string $attribute
-	* @return mixed timestamp (eg unix timestamp or a mysql function)
-	*/
-	protected function getTimestampByAttribute($attribute) {
-		if ($this->timestampExpression !== null)
-			return @eval('return '.$this->timestampExpression.';');
+    /**
+    * Gets the approprate timestamp depending on the column type $attribute is
+    *
+    * @param string $attribute
+    * @return mixed timestamp (eg unix timestamp or a mysql function)
+    */
+    protected function getTimestampByAttribute($attribute) {
+        if ($this->timestampExpression !== null)
+            return @eval('return '.$this->timestampExpression.';');
 
-		$columnType = $this->getOwner()->getTableSchema()->getColumn($attribute)->dbType;
-		return $this->getTimestampByColumnType($columnType);
-	}
+        $columnType = $this->getOwner()->getTableSchema()->getColumn($attribute)->dbType;
+        return $this->getTimestampByColumnType($columnType);
+    }
 
-	/**
-	* Returns the approprate timestamp depending on $columnType
-	*
-	* @param string $columnType
-	* @return mixed timestamp (eg unix timestamp or a mysql function)
-	*/
-	protected function getTimestampByColumnType($columnType) {
-		//return isset(self::$map[$columnType]) ? new CDbExpression(self::$map[$columnType]) : time();
+    /**
+    * Returns the approprate timestamp depending on $columnType
+    *
+    * @param string $columnType
+    * @return mixed timestamp (eg unix timestamp or a mysql function)
+    */
+    protected function getTimestampByColumnType($columnType) {
+        //return isset(self::$map[$columnType]) ? new CDbExpression(self::$map[$columnType]) : time();
                 return date("Y-m-d H:i:s", time());//
-	}
+    }
 }

File protected/commands/TestSCMCommand.php

 
     public function run($args) {
         echo "\n";
-        
+
         /*$hg = Yii::app()->scm->getBackend();
-        
+
         if(php_uname('s') == "Windows NT") {
             //$hg->setExecutable("C:/program files/TortoiseHg/hg.exe");
             $hg->local_path = "C:/wamp/topics";
             if(Yii::app()->config->get('python_path'))
               putenv(Yii::app()->config->get('python_path'));
         }
-        
+
         echo $hg->name;
         echo "\n---------------------------------------------------\n";
 
         print "Last Revision: " . $hg->getLastRevision() . "\n";
         echo $hg->getLastRevisionOf("themes/sassy") . "\n";*/
 
-       
+
         /*$git = Yii::app()->scm->getBackend('git');
         $git->local_path = "C:/wamp/www/foundation";
         echo $git->name;

File protected/commands/UpdateIssueCommentcountCommand.php

         $issue->comment_count = $issue->commentCount;
         $issue->update(array('comment_count'));
     }
-    
+
     public function run($args) {
         if(count($args) > 0) {
             $project = Project::model()->findByPk((int)$args[0]);

File protected/components/BugitorController.php

             parent::render($view, $data, $return);
         }
     }
- 
+
     public function beforeRender($view)
     {
         return true;
     }
-    
+
     /**
      * @var string the default layout for the controller view. Defaults to '//layouts/column1',
      * meaning using a single column layout. See 'protected/views/layouts/column1.php'.

File protected/components/Controller.php

 class Controller extends BugitorController {
 
     public $block_robots = false;
-    
+
     public function beforeRender($view)
     {
- 
+
         if ($this->block_robots)
         {
             Yii::app()->clientScript->registerMetaTag('noindex,noarchive', 'robots');
         }
- 
+
         return true;
- 
+
     }
- 
+
     /**
      * @var string the default layout for the controller view. Defaults to '//layouts/column1',
      * meaning using a single column layout. See 'protected/views/layouts/column1.php'.

File protected/components/UserIdentity.php

  */
 class UserIdentity extends CUserIdentity
 {
-	private $_id;
-	const ERROR_EMAIL_INVALID=3;
-	const ERROR_STATUS_NOTACTIV=4;
-	const ERROR_STATUS_BAN=5;
-	/**
-	 * Authenticates a user.
-	 * The example implementation makes sure if the username and password
-	 * are both 'demo'.
-	 * In practical applications, this should be changed to authenticate
-	 * against some persistent user identity storage (e.g. database).
-	 * @return boolean whether authentication succeeds.
-	 */
-	public function authenticate()
-	{
-		if (strpos($this->username,"@")) {
-			$user=User::model()->notsafe()->findByAttributes(array('email'=>$this->username));
-		} else {
-			$user=User::model()->notsafe()->findByAttributes(array('username'=>$this->username));
-		}
-		if($user===null)
-			if (strpos($this->username,"@")) {
-				$this->errorCode=self::ERROR_EMAIL_INVALID;
-			} else {
-				$this->errorCode=self::ERROR_USERNAME_INVALID;
-			}
-		else if(Yii::app()->controller->module->encrypting($this->password)!==$user->password)
-			$this->errorCode=self::ERROR_PASSWORD_INVALID;
-		else if($user->status==0&&Yii::app()->controller->module->loginNotActiv==false)
-			$this->errorCode=self::ERROR_STATUS_NOTACTIV;
-		else if($user->status==-1)
-			$this->errorCode=self::ERROR_STATUS_BAN;
-		else {
-			$this->_id=$user->id;
-			$this->username=$user->username;
-			$this->errorCode=self::ERROR_NONE;
-		}
-		return !$this->errorCode;
-	}
-    
+    private $_id;
+    const ERROR_EMAIL_INVALID=3;
+    const ERROR_STATUS_NOTACTIV=4;
+    const ERROR_STATUS_BAN=5;
+    /**
+     * Authenticates a user.
+     * The example implementation makes sure if the username and password
+     * are both 'demo'.
+     * In practical applications, this should be changed to authenticate
+     * against some persistent user identity storage (e.g. database).
+     * @return boolean whether authentication succeeds.
+     */
+    public function authenticate()
+    {
+        if (strpos($this->username,"@")) {
+            $user=User::model()->notsafe()->findByAttributes(array('email'=>$this->username));
+        } else {
+            $user=User::model()->notsafe()->findByAttributes(array('username'=>$this->username));
+        }
+        if($user===null)
+            if (strpos($this->username,"@")) {
+                $this->errorCode=self::ERROR_EMAIL_INVALID;
+            } else {
+                $this->errorCode=self::ERROR_USERNAME_INVALID;
+            }
+        else if(Yii::app()->controller->module->encrypting($this->password)!==$user->password)
+            $this->errorCode=self::ERROR_PASSWORD_INVALID;
+        else if($user->status==0&&Yii::app()->controller->module->loginNotActiv==false)
+            $this->errorCode=self::ERROR_STATUS_NOTACTIV;
+        else if($user->status==-1)
+            $this->errorCode=self::ERROR_STATUS_BAN;
+        else {
+            $this->_id=$user->id;
+            $this->username=$user->username;
+            $this->errorCode=self::ERROR_NONE;
+        }
+        return !$this->errorCode;
+    }
+
     /**
     * @return integer the ID of the user record
     */
-	public function getId()
-	{
-		return $this->_id;
-	}
-}
+    public function getId()
+    {
+        return $this->_id;
+    }
+}

File protected/components/scm/BitbucketSCMBackend.php

 
     public function getDiff($path, $from, $to = null)
     {
-    } 
+    }
 
     protected function log($start = 0, $end = '', $limit = 100)
     {
         $this->authenticate();
-        
+
         $commits = array();
 
         $changesets = new bbApiChangesets($this->getBitbucket());
-        
+
         $changeList = $changesets->show($this->url, null, null, 1);
-    
+
         //print_r($changeList);
         /*stdClass Object
         (
                                             [type] => added
                                             [file] => .hgignore
                                         )
-        
+
                                     [644] => stdClass Object
                                         (
                                             [type] => added
                                             [file] => themes/freshy2/views/layouts/main_1.php
                                         )
-        
+
                                 )
-        
+
                             [raw_author] => jacmoe2
                             [utctimestamp] => 2010-12-02 12:38:14+00:00
                             [author] => jacmoe
                             [parents] => Array
                                 (
                                 )
-        
+
                             [branch] => default
                             [message] => Initial commit
                             [revision] => 0
                             [size] => -1
                         )
-        
+
                 )
-        
+
         )*/
         foreach($changeList->changesets as $key => $val)
         {
 
         $looper = 0;
         $counter = 0;
-        
+
         while($counter <= $loop)
         {
             $changeList = $changesets->show($this->repository, null, null, $looper);
-        
+
             foreach($changeList->changesets as $key => $val)
             {
                 $commit = array();
             $counter++;
             $looper += 15;
         }
-        
+
         $remaining = $count - $looper;
-        
+
         if($remaining > 0)
         {
             $changeList = $changesets->show($this->repository, null, null, 'tip', $remaining - 1);
-        
+
             foreach($changeList->changesets as $key => $val)
             {
                 $commit = array();
                 $commits[] = $commit;
             }
         }*/
-        
+
         return $commits[0];
     }
 
     {
         return $this->repositoryId;
     }
-    
+
     public function getLastRevision()
     {
         return $this->lastRevision;
     }
-    
+
     public function getLastRevisionOf($path)
     {
     }
-    
+
     public function getFileContents($path, $revision)
     {
     }
-    
+
     public function getChanges($start = 0, $end = '', $limit = 100)
     {
         return $this->log($start, $end, $limit);
     }
-    
+
     public function getParents($revision)
     {
     }

File protected/components/scm/GitSCMBackend.php

 class GitSCMBackend extends SCMLocalBackend
 {
     private $_git = null;
-    
+
     public $name = 'git';
 
   protected function git()
         $executable = Yii::app()->config->get('git_executable');
         $this->executable = "\"" . $executable . "\"";
     }
-    
+
     public function getDiff($path, $from, $to = null)
     {
         $diff = '';
           return stream_get_contents($this->git('diff', "$from..$to", '--', $path));
         }
         return stream_get_contents($this->git('diff', "$from^..$from", '--', $path));
-        
+
     }
 
     protected function log($start = 0, $end = '', $limit = 100)
             $changeby = trim(fgets($fp));
             $entry['author'] = $changeby;
             $this->arr_users[] = $changeby;
-            
+
             $entry['email'] = trim(fgets($fp));
-            
+
             $entry['date'] = trim(fgets($fp));
-            
+
             $parent = array();
             while (($line = fgets($fp)) !== false) {
                 $line = rtrim($line, "\r\n");
                 }
             }
             $entry['files'] = $files;
-            
+
             // add entry to array of entries
             $entries[] = $entry;
 
     {
         $this->run_tool('git', 'string', array('clone', $this->url, $this->local_path));
     }
-    
+
     public function pullRepository()
     {
         //TODO: I wonder if this really works? =)
         stream_get_contents($this->git('fetch'));
         stream_get_contents($this->git('merge', 'origin/master'));
     }
-    
+
     public function getRepositoryId()
     {
         //FIXME: is there a better way to do this?
         $rev_list = explode(" ", $rev_list);
         return trim($rev_list[(count($rev_list)-2)]);
     }
-    
+
     public function getLastRevision()
     {
         $git_executable = "\"" . Yii::app()->config->get('git_executable') . "\"";
         $cmd = "{$git_executable} --git-dir={$this->local_path}/.git --work-tree={$this->local_path} log --max-count=1 --pretty=format:%H";
         return stream_get_contents(popen($cmd, 'r'));
     }
-    
+
     public function getChanges($start = 0, $end = '', $limit = 100)
     {
         return $this->log($start = 0, $end = '', $limit);
         $cmd = "{$git_executable} --git-dir={$this->local_path}/.git --work-tree={$this->local_path} log --max-count=1 --pretty=format:%H {$this->local_path}/{$path}";
         return stream_get_contents(popen($cmd, 'r'));
     }
-    
+
     public function getParents($revision)
     {
         $git_executable = "\"" . Yii::app()->config->get('git_executable') . "\"";
         $out = str_replace("\n", "", $out);
         return rtrim($out, ',');
     }
-    
+
     public function getUsers()
     {
         return $this->arr_users;

File protected/components/scm/GithubSCMBackend.php

 
     public function getDiff($path, $from, $to = null)
     {
-    } 
+    }
 
     protected function log($start = 0, $end = '', $limit = 100)
     {
                         (
                             [id] => f45bad6555162cafa55f3b47d10e3ed5efa4dee5
                         )
-        
+
                     [1] => Array
                         (
                             [id] => 3441f2ce5061843906b4bc1ea701068a0cd04492
                         )
-        
+
                 )
-        
+
             [author] => Array
                 (
                     [name] => Jacob Moen
                     [login] => jacmoe
                     [email] => mail@jacmoe.dk
                 )
-        
+
             [url] => /jacmoe/highlighter/commit/db7d468ee1920a8e0bbe27093797950743faa6cc
             [id] => db7d468ee1920a8e0bbe27093797950743faa6cc
             [committed_date] => 2011-11-07T23:45:53-08:00
             [authored_date] => 2011-11-07T23:45:53-08:00
             [message] => Merge pull request #3 from rchavik/2.0
-        
+
         upgrade for croogo 1.4 branch (cakephp 2.0)
             [tree] => a7d0fb165be51340683a2c1bce7977cd587d130e
             [committer] => Array
                     [login] => jacmoe
                     [email] => mail@jacmoe.dk
                 )
-        
+
         )*/
         /*
             revision
     {
         return $this->repositoryId;
     }
-    
+
     public function getLastRevision()
     {
         return $this->lastRevision;
     }
-    
+
     public function getLastRevisionOf($path)
     {
     }
-    
+
     public function getFileContents($path, $revision)
     {
     }
-    
+
     public function getChanges($start = 0, $end = '', $limit = 100)
     {
         return $this->log($start, $end, $limit);
     }
-    
+
     public function getParents($revision)
     {
     }

File protected/components/scm/HgSCMBackend.php

 class HgSCMBackend extends SCMLocalBackend
 {
     public $name = 'hg';
-    
+
     public function __construct()
     {
         $executable = Yii::app()->config->get('hg_executable');
         $this->executable = "\"" . $executable . "\"";
     }
-    
+
     protected function hg()
     {
         $args = func_get_args();
 
         return $this->run_tool('hg', 'read', $a);
     }
-    
+
     public function getDiff($path, $from, $to = null)
     {
         $hg_executable = "\"" . Yii::app()->config->get('hg_executable') . "\"";
         $cmd = "{$hg_executable} diff --git -c{$from} -R {$this->local_path} --cwd {$this->local_path} {$path}";
         return stream_get_contents(popen($cmd, 'r'));
-    } 
+    }
 
 
     protected function log($start = 0, $end = '', $limit = 100)
         $fp = $this->run_tool('hg', 'read', array('log', '-r0', '-R', $this->local_path, '--cwd', $this->local_path, '--template', '{node}'));
         return fgets($fp);
     }
-    
+
     public function getLastRevision()
     {
         $fp = $this->run_tool('hg', 'read', array('log', '-rtip', '-R', $this->local_path, '--cwd', $this->local_path, '--template', '{rev}'));
         return fgets($fp);
     }
-    
+
     public function getLastRevisionOf($path)
     {
         $fp = $this->run_tool('hg', 'read', array('log', $path, '-R', $this->local_path, '--cwd', $this->local_path, '--template', '{rev}', '--limit', 1));
     {
         return $this->log($start, $end, $limit);
     }
-    
+
     public function getParents($revision)
     {
         $fp = $this->run_tool('hg', 'read', array('parents', '-r' . $revision, '-R', $this->local_path, '--cwd', $this->local_path, '--template', '{rev}:{node|short}'));
     {
         return $this->arr_users;
     }
-    
+
     public function getFileContents($path, $revision)
     {
         $fp = $this->hg('cat', '-r', $revision,

File protected/components/scm/RepoInterface.php

         $scms = Yii::app()->config->get('allowed_scm');
         return call_user_func(array($scms[$scm], 'factory'), $project);
     }
-    
+
     /**
      * Return the size of the repository in bytes.
      *

File protected/components/scm/SCM.php

 class SCM extends CApplicationComponent
 {
     private $_backend = array(
-        'hg' => null, 
+        'hg' => null,
         'git' => null,
         'svn' => null,
         'github' => null,
         'bitbucket' => null,
     );
-    
+
     public $versionController = 'hg';
 
-	public $backendMap = array(
-		'hg' => 'HgSCMBackend',    // Mercurial
-		'git' => 'GitSCMBackend',   // Git
-		'svn' => 'SVNSCMBackend',    // Subversion (SVN)
-		'github' => 'GithubSCMBackend',  // Github API
-		'bitbucket' => 'BitbucketSCMBackend', // Bitbucket API
-	);
+    public $backendMap = array(
+        'hg' => 'HgSCMBackend',    // Mercurial
+        'git' => 'GitSCMBackend',   // Git
+        'svn' => 'SVNSCMBackend',    // Subversion (SVN)
+        'github' => 'GithubSCMBackend',  // Github API
+        'bitbucket' => 'BitbucketSCMBackend', // Bitbucket API
+    );
 
     public $backendList = array(
-        'hg' => 'Mercurial', 
+        'hg' => 'Mercurial',
         'git' => 'Git',
         'svn' => 'SVN',
         'github' => 'Github',
         'bitbucket' => 'Bitbucket',
     );
-    
+
     public function init() {
         parent::init();
     }
-    
+
     public function getBackend($versionController = null)
     {
         if(null == $versionController) {
                     array('{backend}' => $backend)));
         }
     }
-}
+}

File protected/components/scm/SCMBackend.php

     public $url;
     public $username;
     public $password;
-    
+
     public $changes;
-    
+
     public $arr_users = array();
 
     public abstract function getRepositoryId();
     public abstract function getFileContents($path, $revision);
 
     public abstract function getLastRevisionOf($path);
-    
+
     public abstract function getChanges($start = 0, $end = '', $limit = 100);
-    
+
     public abstract function getParents($revision);
-    
+
     public abstract function getUsers();
-    
+
     public function getName()
     {
         return $this->name;
     {
         $this->url= $url;
     }
-    
+
     public function getUsername()
     {
         return $this->username;
     {
         $this->password = $password;
     }
-}
+}

File protected/components/scm/SCMLocalBackend.php

 abstract class SCMLocalBackend extends SCMBackend
 {
     public $executable = '';
-    
+
     // function courtesy of the mtrack project
     protected function run_tool($toolname, $mode, $args = null) {
         global $FORKS;
     }
 
     public abstract function cloneRepository();
-    
+
     public abstract function pullRepository();
 
-}
+}

File protected/components/scm/SVNSCMBackend.php

         $args = func_get_args();
         return $this->run_tool('svn', 'read', $args);
     }
-    
+
     public function __construct()
     {
         $executable = Yii::app()->config->get('svn_executable');
         $xml_info = new SimpleXMLElement($info);
         return $xml_info;
     }
-    
+
     protected function log($start = 0, $end = null, $limit = 100)
     {
         if(($this->getLastRevision() < $end) && (null !== $end)) {
         $log = stream_get_contents($fp);
 
         $xml_entries = new SimpleXMLElement($log);
-        
+
         $this->arr_users = array();
 
         $entries = array();
             } else {
                 $entry['file_count'] = 0;
             }
-        
+
             $entry['author'] = (string)$xml_entry->author;
             $this->arr_users[] = (string)$xml_entry->author;
             $entries[] = $entry;
-        
+
         }
-        
+
         return $entries;
     }
 
           $this->url,
           $this->local_path));
     }
-    
+
     public function pullRepository()
     {
         stream_get_contents($this->svn('update',
           $this->local_path));
     }
-    
+
     public function getParents($revision)
     {
         return '';
         $info = $this->info();
         return $info->entry->repository->uuid;
     }
-    
+
     public function getLastRevision()
     {
         $info = $this->info();
         return $info->entry['revision'];
     }
-    
+
     public function getLastRevisionOf($path)
     {
         $fp = $this->run_tool('svn', 'read', array('log', $this->local_path . $path, '--limit', 1, '--xml'));
         $info = new SimpleXMLElement($rev_info);
         return $info->logentry['revision'];
     }
-    
+
     public function getChanges($start = 0, $end = '', $limit = 100)
     {
         return $this->log($start, $end, $limit);
     }
-    
+
     public function getUsers()
     {
         return $this->arr_users;

File protected/components/textile/Textilizer.php

     }
 
 public function fixcodeblocks($string) {
-	// Create a new array to hold our converted string
-	$newstring = array();
-	
-	// This variable will be true if we are currently between two code tags
-	$code = false;
-	
-	// The total length of our HTML string
-	$j = mb_strlen($string);
-	
-	// Loop through the string one character at a time
-	for ($k = 0; $k < $j; $k++) {
-		// The current character
-		$char = mb_substr($string, $k, 1);
-		
-		if ($code) {
-			// We are between code tags
-			// Check for end code tag
-			if ($this->atendtag($string, $k)) {
-				// We're at the end of a code block
-				$code = false;
-				
-				// Add current character to array
-				array_push($newstring, $char);
-				
-			} else {
-				// Change special HTML characters
-				$newchar = htmlspecialchars($char, ENT_NOQUOTES);
-				
-				// Add character code to array
-				array_push($newstring, $newchar);
-			}
-		} else {
-			// We are not between code tags
-			// Check for start code tag
-			if ($this->atstarttag($string, $k)) {
-				// We are at the start of a code block
-				$code = true;
-			}
-			// Add current character to array
-			array_push($newstring, $char);
-		}
-	}
-	//Turn the new array into a string
-	$newstring = join("", $newstring);
-	
-	// Return the new string
-	return $newstring;
+    // Create a new array to hold our converted string
+    $newstring = array();
+
+    // This variable will be true if we are currently between two code tags
+    $code = false;
+
+    // The total length of our HTML string
+    $j = mb_strlen($string);
+
+    // Loop through the string one character at a time
+    for ($k = 0; $k < $j; $k++) {
+        // The current character
+        $char = mb_substr($string, $k, 1);
+
+        if ($code) {
+            // We are between code tags
+            // Check for end code tag
+            if ($this->atendtag($string, $k)) {
+                // We're at the end of a code block
+                $code = false;
+
+                // Add current character to array
+                array_push($newstring, $char);
+
+            } else {
+                // Change special HTML characters
+                $newchar = htmlspecialchars($char, ENT_NOQUOTES);
+
+                // Add character code to array
+                array_push($newstring, $newchar);
+            }
+        } else {
+            // We are not between code tags
+            // Check for start code tag
+            if ($this->atstarttag($string, $k)) {
+                // We are at the start of a code block
+                $code = true;
+            }
+            // Add current character to array
+            array_push($newstring, $char);
+        }
+    }
+    //Turn the new array into a string
+    $newstring = join("", $newstring);
+
+    // Return the new string
+    return $newstring;
 }
 
 public function atstarttag($string, $pos) {
-	// Only check if the last 6 characters are the start code tag
-	// if we are more then 6 characters into the string
-	if ($pos > 4) {
-		// Get previous 6 characters
-		$prev = mb_substr($string, $pos - 5, 6);
-		
-		// Check for a match
-		if ($prev == "<code>") {
-			return true;
-		} else {
-			return false;
-		}
-	} else {
-		return false;
-	}
+    // Only check if the last 6 characters are the start code tag
+    // if we are more then 6 characters into the string
+    if ($pos > 4) {
+        // Get previous 6 characters
+        $prev = mb_substr($string, $pos - 5, 6);
+
+        // Check for a match
+        if ($prev == "<code>") {
+            return true;
+        } else {
+            return false;
+        }
+    } else {
+        return false;
+    }
 }
 
 public function atendtag($string, $pos) {
-	// Get length of string
-	$slen = mb_strlen($string);
-	
-	// Only check if the next 7 characters are the end code tag
-	// if we are more than 6 characters from the end
-	if ($pos /*+ 7*/ <= $slen) {
-		// Get next 7 characters
-		$next = mb_substr($string, $pos, 7);
-		
-		// Check for a match
-		if ($next == "</code>") {
-			return true;
-		} else {
-			return false;
-		}
-	} else {
-		return false;
-	}
+    // Get length of string
+    $slen = mb_strlen($string);
+
+    // Only check if the next 7 characters are the end code tag
+    // if we are more than 6 characters from the end
+    if ($pos /*+ 7*/ <= $slen) {
+        // Get next 7 characters
+        $next = mb_substr($string, $pos, 7);
+
+        // Check for a match
+        if ($next == "</code>") {
+            return true;
+        } else {
+            return false;
+        }
+    } else {
+        return false;
+    }
 }
         public function textilize($content, $parseSmilies = true, $use_textile = true) {
         $text = $content;//$this->fixcodeblocks($content);

File protected/config/console.php

         'application.extensions.simpleWorkflow.*',
         'ext.yii-mail.YiiMailMessage',
     ),
-    
+
     'modules' => array(
         // uncomment the following to enable the Gii tool
         'rights' => array(

File protected/config/db.in.php

             'password' => '{password_in}',
             'charset' => '{charset_in}',
             //'nullConversion' => PDO::NULL_EMPTY_STRING,
-	    //'enableProfiling'=>true,
-	    //'enableParamLogging' => true,
+        //'enableProfiling'=>true,
+        //'enableParamLogging' => true,
         );
 

File protected/config/local.php

             'db'=>array(
                 'enableProfiling'=>true,
                 'enableParamLogging'=>true,
-            ),              
+            ),
         ),
     )
 );

File protected/config/main.php

 
 return array(
     'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',
-    
+
     'name' => 'Bugitor Issue Tracker',
     'theme' => 'new',
-    
+
     'defaultController' => 'site',
-    
+
     'sourceLanguage' => 'en_gb',
     'language' => 'en_US',
-    
+
     'preload' => array('log', 'maintenanceMode'),
-    
+
     'import' => array(
         'application.models.*',
         'application.components.*',
         'ext.simpleWorkflow.*',
         'ext.yii-mail.YiiMailMessage',
     ),
-    
+
     'modules' => array(
-        
+
         'admin',
-        
+
         'rights' => array(
             'install' => false,
             'appLayout'=>'application.modules.admin.views.layouts.main',
         ),
-        
+
         'user' => array(
             'returnLogoutUrl' => array('/project/index'),
             'returnUrl' => array('/site/index'),
         ),
     ),
-    
+
     // application components
     'components' => array(
-        
+
         'user' => array(
             // enable cookie-based authentication
             'class' => 'RWebUser',
         ),
 
         'db' => require(dirname(__FILE__) . '/db.php'),
-        
+
         'mail' => require(dirname(__FILE__) . '/mail.php'),
-        
+
         'log'=>array(
             'class'=>'CLogRouter',
             'routes'=>array(
                 ),
             ),
         ),
-        
+
         'textile' => array(
             'class' => 'application.components.textile.Textilizer',
         ),
-        
+
         'mutex' => array(
             'class' => 'ext.EMutex',
         ),
-        
+
         'file' => array(
             'class' => 'ext.CFile',
         ),
-        
+
         'scm' => array(
             'class' => 'SCM',
         ),
-        
+
         'maintenanceMode' => array(
             'class' => 'ext.MaintenanceMode.MaintenanceMode',
             'enabledMode' => file_exists(dirname(__FILE__).'/.maintenance'),
             // allowed roles
             //'roles' => array('Administrator', ),
         ),
-        
+
         'config' => array(
             'class' => 'application.extensions.EConfig',
             'configTableName' => '{{config}}',
             'autoCreateConfigTable' => false,
             'strictMode' => false,
         ),
-        
+
         'cache' => array(
             'class' => 'system.caching.CFileCache',
         ),
-        
+
         'swSource' => array(
             'class' => 'application.extensions.simpleWorkflow.SWPhpWorkflowSource',
         ),
-        
+
         'timezonekeeper' => array (
             'class' => 'application.components.TimeZoneKeeper',
         ),
-        
+
         'gravatar' => array (
             'class' => 'application.helpers.Gravatar',
         ),
-        
+
         'authManager' => array(
             // The authorization manager (default: CDbAuthManager)
             'class' => 'RDbAuthManager',
             // The itemWeightTable (default: AuthItemWeight)
             'rightsTable' => '{{auth_item_weight}}',
         ),
-        
+
         'urlManager' => array(
             'urlFormat' => 'path',
             'showScriptName' => false,
             'rules' => require(dirname(__FILE__) . '/url_rules.php'),
         ),
-        
+
         'errorHandler' => array(
             // use 'site/error' action to display errors
             'errorAction' => 'site/error',

File protected/config/test.php

 <?php
 
 return CMap::mergeArray(
-	require(dirname(__FILE__).'/local.php'),
-	array(
-		'components'=>array(
-			'fixture'=>array(
-				'class'=>'system.test.CDbFixtureManager',
-			),
-			'db'=>array(
-				'connectionString' => 'mysql:host=localhost;dbname=ogitorbugs_test',
-				'emulatePrepare' => true,
-				'username' => 'root',
+    require(dirname(__FILE__).'/local.php'),
+    array(
+        'components'=>array(
+            'fixture'=>array(
+                'class'=>'system.test.CDbFixtureManager',
+            ),
+            'db'=>array(
+                'connectionString' => 'mysql:host=localhost;dbname=ogitorbugs_test',
+                'emulatePrepare' => true,
+                'username' => 'root',
                 'tablePrefix' => 'bugitor_',
-				'password' => '',
-				'charset' => 'utf8',
-			),
-		),
-	)
+                'password' => '',
+                'charset' => 'utf8',
+            ),
+        ),
+    )
 );

File protected/controllers/ApiController.php

 <?php
 
 class ApiController extends Controller {
-    
+
     public $block_robots = true;
 
-    // Key which has to be in HTTP USERNAME and APIKEY headers 
+    // Key which has to be in HTTP USERNAME and APIKEY headers
     Const APPLICATION_ID = 'BUGITOR';
 
     private $format = 'json';
             $this->_sendResponse(500, 'Error: Parameter <b>id</b> is missing');
 
         switch ($_GET['model']) {
-            // Find respective model    
+            // Find respective model
             case 'issue':
                 $model = Issue::model()->findByPk((int) $_GET['id']);
                 break;
             $this->_sendResponse(500, sprintf("Error: action <b>%s</b> could not be executed.", $_POST['action']));
         }
     }
-    
+
     // Creates a new item
     public function actionCreate() {
         $this->_checkAuth();
                 $this->_sendResponse(500, sprintf('Parameter <b>%s</b> is not allowed for model <b>%s</b>', $var, $_GET['model']));
             }
         }
-        
+
         $success = false;
-        
+
         if($model->validate()) {
             $issue = Issue::model()->with(array('project'))->findByPk((int) $model->issue_id);
             if($issue) {
                 $issue->updated_by = $model->create_user_id;
-                
+
                 if($issue->save()) {
                     $issue->sendNotification($issue->id, $model->id, $issue->updated_by);
                     $issue->addToActionLog($issue->id,$issue->updated_by,'note', $this->createUrl('issue/view', array('id' => $issue->id, 'identifier' => $issue->project->identifier, '#' => 'note-'.$issue->commentCount)), $model->id);
-                    
+
                     $model->save(false);
                     $success = true;
                 }
             } // if valid issue
         } // if model validate
-        
+
         if ($success) {
             // Saving was OK
             $this->_sendResponse(200, $this->_getObjectEncoded($_GET['model'], $model->attributes));

File protected/controllers/AttachmentController.php

 
 class AttachmentController extends Controller
 {
-	/**
-	 * @var string the default layout for the views. Defaults to '//layouts/column2', meaning
-	 * using two-column layout. See 'protected/views/layouts/column2.php'.
-	 */
-	public $layout='//layouts/column2';
+    /**
+     * @var string the default layout for the views. Defaults to '//layouts/column2', meaning
+     * using two-column layout. See 'protected/views/layouts/column2.php'.
+     */
+    public $layout='//layouts/column2';
 
-	/**
-	 * @return array action filters
-	 */
-	public function filters()
-	{
-		return array(
-			'accessControl', // perform access control for CRUD operations
-		);
-	}
+    /**
+     * @return array action filters
+     */
+    public function filters()
+    {
+        return array(
+            'accessControl', // perform access control for CRUD operations
+        );
+    }
 
-	/**
-	 * Specifies the access control rules.
-	 * This method is used by the 'accessControl' filter.
-	 * @return array access control rules
-	 */
-	public function accessRules()
-	{
-		return array(
-			array('allow',  // allow all users to perform 'index' and 'view' actions
-				'actions'=>array('index','view'),
-				'users'=>array('*'),
-			),
-			array('allow', // allow authenticated user to perform 'create' and 'update' actions
-				'actions'=>array('create','update'),
-				'users'=>array('@'),
-			),
-			array('allow', // allow admin user to perform 'admin' and 'delete' actions
-				'actions'=>array('admin','delete'),
-				'users'=>array('admin'),
-			),
-			array('deny',  // deny all users
-				'users'=>array('*'),
-			),
-		);
-	}
+    /**
+     * Specifies the access control rules.
+     * This method is used by the 'accessControl' filter.
+     * @return array access control rules
+     */
+    public function accessRules()
+    {
+        return array(
+            array('allow',  // allow all users to perform 'index' and 'view' actions
+                'actions'=>array('index','view'),
+                'users'=>array('*'),
+            ),
+            array('allow', // allow authenticated user to perform 'create' and 'update' actions
+                'actions'=>array('create','update'),
+                'users'=>array('@'),
+            ),
+            array('allow', // allow admin user to perform 'admin' and 'delete' actions
+                'actions'=>array('admin','delete'),
+                'users'=>array('admin'),
+            ),
+            array('deny',  // deny all users
+                'users'=>array('*'),
+            ),
+        );
+    }
 
-	/**
-	 * Displays a particular model.
-	 * @param integer $id the ID of the model to be displayed
-	 */
-	public function actionView($id)
-	{
-		$this->render('view',array(
-			'model'=>$this->loadModel($id),
-		));
-	}
+    /**
+     * Displays a particular model.
+     * @param integer $id the ID of the model to be displayed
+     */
+    public function actionView($id)
+    {
+        $this->render('view',array(
+            'model'=>$this->loadModel($id),
+        ));
+    }
 
-	/**
-	 * Creates a new model.
-	 * If creation is successful, the browser will be redirected to the 'view' page.
-	 */
-	public function actionCreate()
-	{
-		$model=new Attachment;
+    /**
+     * Creates a new model.
+     * If creation is successful, the browser will be redirected to the 'view' page.
+     */
+    public function actionCreate()
+    {
+        $model=new Attachment;
 
-		// Uncomment the following line if AJAX validation is needed
-		// $this->performAjaxValidation($model);
+        // Uncomment the following line if AJAX validation is needed
+        // $this->performAjaxValidation($model);
 
-		if(isset($_POST['Attachment']))
-		{
-			$model->attributes=$_POST['Attachment'];
-			if($model->save())
-				$this->redirect(array('view','id'=>$model->id));
-		}
+        if(isset($_POST['Attachment']))
+        {
+            $model->attributes=$_POST['Attachment'];
+            if($model->save())
+                $this->redirect(array('view','id'=>$model->id));
+        }
 
-		$this->render('create',array(
-			'model'=>$model,
-		));
-	}
+        $this->render('create',array(
+            'model'=>$model,
+        ));
+    }
 
-	/**
-	 * Updates a particular model.
-	 * If update is successful, the browser will be redirected to the 'view' page.
-	 * @param integer $id the ID of the model to be updated
-	 */
-	public function actionUpdate($id)
-	{
-		$model=$this->loadModel($id);
+    /**
+     * Updates a particular model.
+     * If update is successful, the browser will be redirected to the 'view' page.
+     * @param integer $id the ID of the model to be updated
+     */
+    public function actionUpdate($id)
+    {
+        $model=$this->loadModel($id);
 
-		// Uncomment the following line if AJAX validation is needed
-		// $this->performAjaxValidation($model);
+        // Uncomment the following line if AJAX validation is needed
+        // $this->performAjaxValidation($model);
 
-		if(isset($_POST['Attachment']))
-		{
-			$model->attributes=$_POST['Attachment'];
-			if($model->save())
-				$this->redirect(array('view','id'=>$model->id));
-		}
+        if(isset($_POST['Attachment']))
+        {
+            $model->attributes=$_POST['Attachment'];
+            if($model->save())
+                $this->redirect(array('view','id'=>$model->id));
+        }
 
-		$this->render('update',array(
-			'model'=>$model,
-		));
-	}
+        $this->render('update',array(
+            'model'=>$model,
+        ));
+    }
 
-	/**
-	 * Deletes a particular model.
-	 * If deletion is successful, the browser will be redirected to the 'admin' page.
-	 * @param integer $id the ID of the model to be deleted
-	 */
-	public function actionDelete($id)
-	{
-		if(Yii::app()->request->isPostRequest)
-		{
-			// we only allow deletion via POST request
-			$this->loadModel($id)->delete();
+    /**
+     * Deletes a particular model.
+     * If deletion is successful, the browser will be redirected to the 'admin' page.
+     * @param integer $id the ID of the model to be deleted
+     */
+    public function actionDelete($id)
+    {
+        if(Yii::app()->request->isPostRequest)
+        {
+            // we only allow deletion via POST request
+            $this->loadModel($id)->delete();
 
-			// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
-			if(!isset($_GET['ajax']))
-				$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
-		}
-		else
-			throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');
-	}
+            // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
+            if(!isset($_GET['ajax']))
+                $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
+        }
+        else
+            throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');
+    }
 
-	/**
-	 * Lists all models.
-	 */
-	public function actionIndex()
-	{
-		$dataProvider=new CActiveDataProvider('Attachment');
-		$this->render('index',array(
-			'dataProvider'=>$dataProvider,
-		));
-	}
+    /**
+     * Lists all models.
+     */
+    public function actionIndex()
+    {
+        $dataProvider=new CActiveDataProvider('Attachment');
+        $this->render('index',array(
+            'dataProvider'=>$dataProvider,
+        ));
+    }
 
-	/**
-	 * Manages all models.
-	 */
-	public function actionAdmin()
-	{
-		$model=new Attachment('search');
-		$model->unsetAttributes();  // clear any default values
-		if(isset($_GET['Attachment']))
-			$model->attributes=$_GET['Attachment'];
+    /**
+     * Manages all models.
+     */
+    public function actionAdmin()
+    {
+        $model=new Attachment('search');
+        $model->unsetAttributes();  // clear any default values
+        if(isset($_GET['Attachment']))
+            $model->attributes=$_GET['Attachment'];
 
-		$this->render('admin',array(
-			'model'=>$model,
-		));
-	}
+        $this->render('admin',array(
+            'model'=>$model,
+        ));
+    }
 
-	/**
-	 * Returns the data model based on the primary key given in the GET variable.
-	 * If the data model is not found, an HTTP exception will be raised.
-	 * @param integer the ID of the model to be loaded
-	 */
-	public function loadModel($id)
-	{
-		$model=Attachment::model()->findByPk((int)$id);
-		if($model===null)
-			throw new CHttpException(404,'The requested page does not exist.');
-		return $model;
-	}
+    /**
+     * Returns the data model based on the primary key given in the GET variable.
+     * If the data model is not found, an HTTP exception will be raised.
+     * @param integer the ID of the model to be loaded
+     */
+    public function loadModel($id)
+    {
+        $model=Attachment::model()->findByPk((int)$id);
+        if($model===null)
+            throw new CHttpException(404,'The requested page does not exist.');
+        return $model;
+    }
 
-	/**
-	 * Performs the AJAX validation.
-	 * @param CModel the model to be validated
-	 */
-	protected function performAjaxValidation($model)
-	{
-		if(isset($_POST['ajax']) && $_POST['ajax']==='attachment-form')
-		{
-			echo CActiveForm::validate($model);
-			Yii::app()->end();
-		}
-	}
+    /**
+     * Performs the AJAX validation.
+     * @param CModel the model to be validated
+     */
+    protected function performAjaxValidation($model)
+    {
+        if(isset($_POST['ajax']) && $_POST['ajax']==='attachment-form')
+        {
+            echo CActiveForm::validate($model);
+            Yii::app()->end();
+        }
+    }
 }

File protected/controllers/AuthorUserController.php

 
 class AuthorUserController extends Controller
 {
-	/**
-	 * @var string the default layout for the views. Defaults to '//layouts/column2', meaning
-	 * using two-column layout. See 'protected/views/layouts/column2.php'.
-	 */
-	public $layout='//layouts/column2';
+    /**
+     * @var string the default layout for the views. Defaults to '//layouts/column2', meaning
+     * using two-column layout. See 'protected/views/layouts/column2.php'.
+     */
+    public $layout='//layouts/column2';
 
-	/**
-	 * @return array action filters
-	 */
-	public function filters()
-	{
-		return array(
-			'rights', // perform access control for CRUD operations
-		);
-	}
+    /**
+     * @return array action filters
+     */
+    public function filters()
+    {
+        return array(
+            'rights', // perform access control for CRUD operations
+        );
+    }
 
-	/**
-	 * Specifies the access control rules.
-	 * This method is used by the 'accessControl' filter.
-	 * @return array access control rules
-	 */
-	public function allowedActions()
-	{
-		return 'index, view';
-	}