Permalink
Browse files

Update for phpmd naming

  • Loading branch information...
William Entriken
William Entriken committed Feb 2, 2015
1 parent fa2cbe5 commit 2132057fae0e7956e8bf00486bfb9a6d520322aa
View
@@ -17,6 +17,9 @@
"ext-xml": "*",
"lightopenid/lightopenid": "dev-master"
},
+ "require-dev": {
+ "phpmd/phpmd" : "@stable"
+ },
"recommend": {
"ext-zip": "*",
"ext-gd2": "*"
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -5,4 +5,4 @@
Models\Database::$username = 'user';
Models\Database::$password = 'pass';
Models\Database::$prefix = '';
-Models\Database::$installedSchemaVersion = 5;
+Models\Database::$schemaVersion = 5;
@@ -47,12 +47,12 @@ public function handleGet($get, $post, $files, $cookies)
/* Set up the page view */
$view = new Views\AdminView;
- $view->cameraLifeRunningVersion = constant('CAMERALIFE_VERSION');
- $view->cameraLifeLatestVersion = $this->latestAvailableVersion();
+ $view->runningVersion = constant('CAMERALIFE_VERSION');
+ $view->latestVersion = $this->latestAvailableVersion();
$checkpointLogs = intval(Models\Preferences::valueForModuleWithKey('CameraLife', 'checkpointlogs'));
- $view->numLogsSinceCheckpoint = Models\Database::selectOne('logs', 'COUNT(*)', 'id>' . $checkpointLogs);
+ $view->numNewLogs = Models\Database::selectOne('logs', 'COUNT(*)', 'id>' . $checkpointLogs);
$checkpointComments = intval(Models\Preferences::valueForModuleWithKey('CameraLife', 'checkpointcomments'));
- $view->numCommentsSinceCheckpoint = Models\Database::selectOne('comments', 'COUNT(*)', 'id>' . $checkpointComments);
+ $view->numNewComments = Models\Database::selectOne('comments', 'COUNT(*)', 'id>' . $checkpointComments);
$view->numNewUsers = Models\Database::selectOne('users', 'COUNT(*)', 'auth=1');
$view->numFlagged = Models\Database::selectOne('photos', 'COUNT(*)', 'status=1');
@@ -39,19 +39,19 @@ public function handleGet($get, $post, $files, $cookies)
$view->showChangedPhotos = isset($get['changedPhotos']) && $get['changedPhotos'];
$view->showChangedTags = isset($get['changedTags']) && $get['changedTags'];
$view->showChangedUsers = isset($get['changedUsers']) && $get['changedUsers'];
- $view->showChangedPreferences = isset($get['changedPreferences']) && $get['changedPreferences'];
+ $view->showChangedPrefs = isset($get['changedPreferences']) && $get['changedPreferences'];
if (!$view->showFromMe && !$view->showFromRegistered && !$view->showFromUnregistered) {
$view->showFromMe = true;
$view->showFromRegistered = true;
$view->showFromUnregistered = true;
}
- if (!$view->showChangedPhotos && !$view->showChangedTags && !$view->showChangedUsers && !$view->showChangedPreferences) {
+ if (!$view->showChangedPhotos && !$view->showChangedTags && !$view->showChangedUsers && !$view->showChangedPrefs) {
$view->showChangedPhotos = true;
$view->showChangedTags = true;
$view->showChangedUsers = true;
- $view->showChangedPreferences = true;
+ $view->showChangedPrefs = true;
}
/* Query the audit logs */
@@ -61,7 +61,7 @@ public function handleGet($get, $post, $files, $cookies)
$condition .= $view->showChangedPhotos ? "OR record_type = 'photo' " : '';
$condition .= $view->showChangedTags ? "OR record_type = 'album' " : '';
$condition .= $view->showChangedUsers ? "OR record_type = 'user' " : '';
- $condition .= $view->showChangedPreferences ? "OR record_type = 'preference' " : '';
+ $condition .= $view->showChangedPrefs ? "OR record_type = 'preference' " : '';
$condition .= ") AND (0 ";
$condition .= $view->showFromMe ? "OR user_name = '" . $currentUser->name . "' " : '';
@@ -151,17 +151,18 @@
* __construct function.
*
* @access public
+ * @param mixed $modelId (default: null)
* @return void
*/
- public function __construct($id = null)
+ public function __construct($modelId = null)
{
$preferences = new Models\Preferences;
$this->siteName = $preferences->valueForModuleWithKey('CameraLife', 'sitename');
$this->title = $this->siteName;
$this->type = 'website';
$this->image = constant('BASE_URL') . '/assets/main.png';
$this->imageType = 'image/png';
- $this->url = self::getUrlForID($id);
+ $this->url = self::getUrlForID($modelId);
}
public static function getUrl()
@@ -174,23 +175,23 @@ public static function getUrlForID($object)
return self::getUrlForIDWithParameters($object, array());
}
- public static function getUrlForIDWithParameters($id, $parameters)
+ public static function getUrlForIDWithParameters($modelId, $parameters)
{
$reflection = new \ReflectionClass(get_called_class());
$shortName = $reflection->getShortName();
$page = lcfirst(basename($shortName, 'Controller'));
$query = http_build_query($parameters);
- $id = ltrim($id, '/');
+ $modelId = ltrim($modelId, '/');
// TODO, use this http://stackoverflow.com/a/14375686/300224
if (self::$rewriteEnabled === null) {
self::$rewriteEnabled = Models\Preferences::valueForModuleWithKey('CameraLife', 'rewrite') == 'yes';
}
if (!self::$rewriteEnabled) {
- return constant('BASE_URL') . '/index.php?page=' . $page . '&id=' . $id . ($query ? '&' . $query : '');
+ return constant('BASE_URL') . '/index.php?page=' . $page . '&id=' . $modelId . ($query ? '&' . $query : '');
}
- return constant('BASE_URL') . '/' . $page . '/' . $id . ($query ? '?' . $query : '');
+ return constant('BASE_URL') . '/' . $page . '/' . $modelId . ($query ? '?' . $query : '');
}
/**
@@ -268,11 +269,11 @@ public function handlePost($get, $post, $files, $cookies)
header('Location: ' . $this->getUrlForID($get['id']));
}
- public static function handleException(\Exception $exception, $showDebuggingInformation = true)
+ public static function handleException(\Exception $exception, $showDebugging = true)
{
$view = new Views\ExceptionView;
$view->exception = $exception;
- $view->showDebuggingInformation = $showDebuggingInformation;
+ $view->showDebugging = $showDebugging;
$view->render();
}
}
@@ -14,10 +14,10 @@ class FolderController extends HtmlController
{
private $model;
- public function __construct($id = '/')
+ public function __construct($path = '/')
{
parent::__construct();
- $this->model = new Models\Folder($id);
+ $this->model = new Models\Folder($path);
$this->title = basename($this->model->path);
$this->icon = 'folder';
$this->url = self::getUrlForID($this->model->path);
@@ -12,7 +12,7 @@
*/
class LoginController extends HtmlController
{
- public function __construct($id)
+ public function __construct($modelId)
{
parent::__construct();
$this->title = 'Login';
@@ -38,10 +38,10 @@ public function handleGet($get, $post, $files, $cookies)
} elseif ($openid->mode == 'cancel') {
echo 'User has canceled authentication!';
} else {
- $id = "";
+ $identity = "";
$email = "";
if ($openid->validate()) {
- $id = $openid->identity;
+ $identity = $openid->identity;
$attr = $openid->getAttributes();
$email = $attr['contact/email'];
if (strlen($email)) {
@@ -112,10 +112,10 @@ public function handlePost($get, $post, $files, $cookies)
} elseif ($openid->mode == 'cancel') {
echo 'User has canceled authentication!';
} else {
- $id = "";
+ $identity = "";
$email = "";
if ($openid->validate()) {
- $id = $openid->identity;
+ $identity = $openid->identity;
$attr = $openid->getAttributes();
$email = $attr['contact/email'];
if (strlen($email)) {
@@ -61,19 +61,19 @@ public function handleGet($get, $post, $files, $cookies)
$root->setPage(0, 6);
$rootFolders = array();
- $view->folderAndPhotoOpenGraphs = array();
+ $view->folderAndPhotoOGs = array();
foreach ($root->getDescendants() as $descendant) {
$folderController = new FolderController($descendant->id);
- $folderAndPhotoOpenGraph = array($folderController);
+ $folderAndPhotoOG = array($folderController);
$photoOpenGraphs = array();
$descendant->sort = 'rand';
$descendant->setPage(0, 11);
foreach ($descendant->getPhotos() as $photo) {
$photoController = new PhotoController($photo->id);
$photoOpenGraphs[] = $photoController;
}
- $folderAndPhotoOpenGraph[] = $photoOpenGraphs;
- $view->folderAndPhotoOpenGraphs[] = $folderAndPhotoOpenGraph;
+ $folderAndPhotoOG[] = $photoOpenGraphs;
+ $view->folderAndPhotoOGs[] = $folderAndPhotoOG;
}
$view->rootOpenGraph = new FolderController('/');
@@ -14,16 +14,16 @@ class PhotoController extends HtmlController
{
private $model;
- public function __construct($id)
+ public function __construct($modelId)
{
parent::__construct();
- if (!Models\Photo::photoExists(intval($id))) {
+ if (!Models\Photo::photoExists(intval($modelId))) {
header("HTTP/1.0 404 Not Found");
- throw new \Exception('Photo #' . intval($id) . ' not found.');
+ throw new \Exception('Photo #' . intval($modelId) . ' not found.');
}
- $this->model = Models\Photo::getPhotoWithID($id);
+ $this->model = Models\Photo::getPhotoWithID($modelId);
$this->title = $this->model->get('description');
$this->icon = 'photo';
$this->url = self::getUrlForID($this->model->id); //todo: done by parent?
@@ -14,13 +14,13 @@ class SearchController extends HtmlController
{
private $model;
- public function __construct($id)
+ public function __construct($modelId)
{
parent::__construct();
- $this->model = new Models\Search($id);
+ $this->model = new Models\Search($modelId);
$this->title = $this->model->query;
$this->icon = 'search';
- $this->url = self::getUrlForID($id);
+ $this->url = self::getUrlForID($modelId);
}
public function handleGet($get, $post, $files, $cookies)
@@ -37,7 +37,7 @@ public static function getUrl()
}
// cannot use parent because database is not accessible
- public function __construct($id = null)
+ public function __construct($modelId = null)
{
$this->siteName = null;
$this->title = $this->siteName;
@@ -162,7 +162,7 @@ private function checkPrerequesites()
Database::$username = '<b class="val-user">user</b>';
Database::$password = '<b class="val-pass">password</b>';
Database::$prefix = '<b class="val-prefix"></b>';
-Database::$installedSchemaVersion = 5;
+Database::$schemaVersion = 5;
EOF;
$this->remedies['cPanel'][] = 'Open CPanel and Filemanager and create a new file <code>config.php</code> in the project folder and add these contents to the file:';
$this->remedies['cPanel'][] = "<pre>$configFileHtml</pre>";
@@ -252,19 +252,19 @@ public function handleGet($get, $post, $files, $cookies)
<!-- Nav tabs -->
<ul class="nav nav-tabs">
<?php
- $x = 0;
+ $idx = 0;
foreach ($this->remedies as $system => $systemRemedies) {
- echo '<li class="'.($x++?'':'active').'"><a href="#'.$system.'" data-toggle="tab">'.$system.'</a></li>';
+ echo '<li class="'.($idx++?'':'active').'"><a href="#'.$system.'" data-toggle="tab">'.$system.'</a></li>';
}
?>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<?php
- $x = 0;
+ $idx = 0;
foreach ($this->remedies as $system => $systemRemedies) {
- echo '<div class="tab-pane '.($x++?'':'active').'" id="'.$system.'">';
+ echo '<div class="tab-pane '.($idx++?'':'active').'" id="'.$system.'">';
foreach ($systemRemedies as $remedy) {
echo "<p>$remedy</p>";
}
@@ -21,7 +21,7 @@ public static function getUrl()
}
// cannot use parent because database is not accessible
- public function __construct($id = null)
+ public function __construct($modelId = null)
{
$this->siteName = null;
$this->title = $this->siteName;
@@ -47,10 +47,10 @@ public function handleGet($get, $post, $files, $cookies)
} elseif ($openid->mode == 'cancel') {
echo 'User has canceled authentication!';
} else {
- $id = "";
+ $identity = "";
$email = "";
if ($openid->validate()) {
- $id = $openid->identity;
+ $identity = $openid->identity;
$attr = $openid->getAttributes();
$email = $attr['contact/email'];
if (strlen($email)) {
@@ -169,10 +169,10 @@ public function handlePost($get, $post, $files, $cookies)
} elseif ($openid->mode == 'cancel') {
echo 'User has canceled authentication!';
} else {
- $id = "";
+ $identity = "";
$email = "";
if ($openid->validate()) {
- $id = $openid->identity;
+ $identity = $openid->identity;
$attr = $openid->getAttributes();
$email = $attr['contact/email'];
if (strlen($email)) {
@@ -15,10 +15,10 @@ class TagCollectionController extends HtmlController
{
private $model;
- public function __construct($id)
+ public function __construct($modelId)
{
- parent::__construct($id);
- $this->model = new Models\TagCollection($id);
+ parent::__construct($modelId);
+ $this->model = new Models\TagCollection($modelId);
$this->title = $this->model->query;
$this->icon = 'tags';
}
@@ -15,10 +15,10 @@ class TagController extends HtmlController
{
private $model;
- public function __construct($id)
+ public function __construct($modelId)
{
- parent::__construct($id);
- $this->model = new Models\Tag($id);
+ parent::__construct($modelId);
+ $this->model = new Models\Tag($modelId);
$this->title = $this->model->query;
$this->icon = 'tag';
@@ -48,10 +48,10 @@ public static function createAuditTrailForChange(User $user, $record_type, $reco
* @param mixed $id
* @return void
*/
- public static function getAuditTrailWithID($id)
+ public static function getAuditTrailWithID($modelId)
{
$retval = new AuditTrail;
- $query = Database::select('logs', '*', 'id=' . $id);
+ $query = Database::select('logs', '*', 'id=' . $modelId);
$retval->record = $query->fetchAssoc();
if (empty($retval->record)) {
throw new \Exception('AT not found');
@@ -99,7 +99,7 @@ public function revertChange()
$condition = 'record_id=' . $this->record['record_id'];
$condition .= " AND record_type='" . $this->record['record_type'] . "'";
$condition .= " AND value_field='" . $this->record['value_field'] . "'";
- $condition .= " AND id >= " . $id;
+ $condition .= " AND id >= " . $this->record['id'];
Database::delete('logs', $condition);
}
Oops, something went wrong.

0 comments on commit 2132057

Please sign in to comment.