jhuesser/bzu-jodel-clone

View on GitHub

Showing 43 of 44 total issues

Method reportContent has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function reportContent( $content, $contentID, $reason){
global $apiroot;
$userid = $_SESSION['userid'];
if($content == "post"){
$postfields = "{\n \n \"abuseIDFK\": \"$reason\",\n \"jodelDFK\": \"$contentID\"\n,\n \"jodlerIDFK\": \"$userid\"\n}";
Severity: Minor
Found in functions/admintools.php - About 1 hr to fix

Avoid using undefined variables such as '$config' which will lead to PHP notices.
Open

$newscore = $score - $config->postmeta['get_report'];
Severity: Minor
Found in functions/admintools.php by phpmd

Avoid using undefined variables such as '$config' which will lead to PHP notices.
Open

$newscore = $score - $config->postmeta['get_report'];
Severity: Minor
Found in functions/admintools.php by phpmd

Method deleteComment has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function deleteComment($commentID){
global $apiroot, $config, $baseurl;
//get uploaddir
$uploaddir = $config->image_upload_dir;
//get imageID of comment
Severity: Minor
Found in functions/jodelmeta.php - About 1 hr to fix

Function jodelage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function jodelage($postdate)
{
$now = date('Y-m-d H:i:s');
$now = date_create_from_format('Y-m-d H:i:s', $now);
$postdate = date_create_from_format('Y-m-d H:i:s', $postdate);
Severity: Minor
Found in functions/jodelmeta.php - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

if($caps['promote_to_mod'] == true || $caps['promote_to_admin'] == true || $caps['promote_to_superadmin'] == true || $caps['promote_to_user'] == true || $caps['ban'] == true || $caps['delete_users'] == true || $caps['change_karma'] == true ) {
//can manage users
echo '<a href="user/usermgmt.php" class="list-group-item list-group-item-action">Usermanagement</a>';
$hascaps = true;
}
Severity: Major
Found in user.php - About 1 hr to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

case "myvotes":
$voteurl = $apiroot . "jodelvotes?transform=1&userIDFK,eq," . $userid;
$votesjson = getCall($voteurl);
$votes = json_decode($votesjson, true);
$filter = "";
Severity: Minor
Found in jodels.php and 1 other location - About 40 mins to fix
jodels.php on lines 149..158

Similar blocks of code found in 2 locations. Consider refactoring.
Open

case "mycomms":
$commenturl = $apiroot . "comments?transform=1,filter=jodlerIDFK,eq," . $userid;
$commentsjson = getCall($commenturl);
$comments = json_decode($commentsjson, true);
$filter = "";
Severity: Minor
Found in jodels.php and 1 other location - About 40 mins to fix
jodels.php on lines 159..168

Function deleteComment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function deleteComment($commentID){
global $apiroot, $config, $baseurl;
//get uploaddir
$uploaddir = $config->image_upload_dir;
//get imageID of comment
Severity: Minor
Found in functions/jodelmeta.php - About 25 mins to fix

Function getAccountType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function getAccountType($config, $acctype){
//init array
$usertype = (object) array();
switch($acctype){
case 0:
Severity: Minor
Found in functions/admintools.php - About 25 mins to fix

Function reportContent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function reportContent( $content, $contentID, $reason){
global $apiroot;
$userid = $_SESSION['userid'];
if($content == "post"){
$postfields = "{\n \n \"abuseIDFK\": \"$reason\",\n \"jodelDFK\": \"$contentID\"\n,\n \"jodlerIDFK\": \"$userid\"\n}";
Severity: Minor
Found in functions/admintools.php - About 25 mins to fix

The function voteJodel() has an NPath complexity of 435. The configured NPath complexity threshold is 200.
Open

function voteJodel($jodel2vote, $how2vote){
global $apiroot, $baseurl, $config;
//Get the post to upvote and users who voted this post
$callurl = $apiroot . "jodels?transform=1&filter=jodelID,eq," . $jodel2vote;
$jodeljson = getCall($callurl);
Severity: Minor
Found in functions/votes.php by phpmd

Avoid unused local variables such as '$uservoted'.
Confirmed

$uservoted = postCall($callurl,$postfields);
Severity: Minor
Found in functions/votes.php by phpmd

Avoid unused local variables such as '$config'.
Open

global $apiroot, $config;
Severity: Minor
Found in functions/usermanipulation.php by phpmd

Avoid unused local variables such as '$karmaupdated'.
Open

$karmaupdated = putCall($callurl, $postfields);
Severity: Minor
Found in functions/votes.php by phpmd

Avoid unused local variables such as '$baseurl'.
Open

global $apiroot, $baseurl, $config;
Severity: Minor
Found in functions/jodelmeta.php by phpmd

The function voteComment() has an NPath complexity of 435. The configured NPath complexity threshold is 200.
Open

function voteComment( $comment2vote, $how2vote){
global $apiroot, $baseurl, $config;
$userid = $_SESSION['userid'];
$apiroot = $config->apiUrl;
$commentsjson = getCall($apiroot . "comments?transform=1&filter=commentID,eq," . $comment2vote);
Severity: Minor
Found in functions/votes.php by phpmd

Avoid unused local variables such as '$karmaupdated'.
Open

$karmaupdated = putCall($callurl, $postfields);
Severity: Minor
Found in functions/votes.php by phpmd

Avoid unused local variables such as '$uservoted'.
Confirmed

$uservoted = postCall($callurl,$postfields);
Severity: Minor
Found in functions/votes.php by phpmd

Avoid unused local variables such as '$scoreupdate'.
Open

$scoreupdate = putCall($callurl, $putfields);
Severity: Minor
Found in functions/admintools.php by phpmd
Severity
Category
Status
Source
Language