diff --git a/appview.php b/appview.php index f99f799..b3b3159 100644 --- a/appview.php +++ b/appview.php @@ -13,7 +13,6 @@ require(BASE."include/"."comments.php"); require(BASE."include/"."appdb.php"); require(BASE."include/"."vote.php"); -require(BASE."include/"."rating.php"); require(BASE."include/"."category.php"); require(BASE."include/"."screenshot.php"); require(BASE."include/"."maintainer.php"); @@ -169,9 +168,8 @@ function display_versions($appId, $versions) echo "\n"; echo " Version\n"; echo " Description\n"; - echo " Rating With Windows\n"; - echo " Rating Without Windows\n"; - echo " Maintainer Rating\n"; + echo " Rating\n"; + echo " Wine version\n"; echo " Comments\n"; echo "\n\n"; @@ -185,11 +183,7 @@ function display_versions($appId, $versions) $desc = substr(stripslashes($ver->description),0,75); if(strlen($desc) == 75) $desc .= " ..."; - - //get ratings - $r_win = rating_stars_for_version($ver->versionId, "windows"); - $r_fake = rating_stars_for_version($ver->versionId, "fake"); - + //count comments $r_count = count_comments($appId,$ver->versionId); @@ -197,9 +191,8 @@ function display_versions($appId, $versions) echo "\n"; echo " ".$ver->versionName."\n"; echo " $desc  \n"; - echo " $r_win\n"; - echo " $r_fake\n"; echo " $ver->maintainer_rating\n"; + echo " $ver->maintainer_release\n"; echo " $r_count\n"; echo "\n\n"; @@ -396,12 +389,6 @@ else if($appId && $versionId) exit; } - // rating menu - if(loggedin()) - { - apidb_sidebar_add("rating_menu"); - } - // admin menu if(loggedin() && havepriv("admin")) { @@ -430,12 +417,6 @@ else if($appId && $versionId) echo " Maintainer Rating".stripslashes($ver->maintainer_rating)."\n"; echo " Maintainers Version".stripslashes($ver->maintainer_release)."\n"; - $r_win = rating_stars_for_version($versionId, "windows"); - $r_fake = rating_stars_for_version($versionId, "fake"); - - echo " User Rating $r_win \n"; - echo "
$r_fake \n"; - // image $img = get_screenshot_img($appId, $versionId); echo "$img\n"; diff --git a/include/rating.php b/include/rating.php deleted file mode 100644 index acd0944..0000000 --- a/include/rating.php +++ /dev/null @@ -1,221 +0,0 @@ -userid; - - $result = query_appdb("SELECT score FROM appRating WHERE versionId = $versionId AND system = '$system' AND userId = $userId"); - if(!$result) - return 0; - $ob = mysql_fetch_object($result); - return $ob->score; -} - - - -/*========================================================================= - * - * Display the app(-version) rating menu - * - */ -function rating_menu() -{ - - $s = 's1'; - $n = 's0'; - - $j = new htmlmenu("Compatibility Rating","updaterating.php"); - - $r_win = rating_current_for_user($_REQUEST['versionId'], "windows"); - $r_fake = rating_current_for_user($_REQUEST['versionId'], "fake"); - - $wchk = array('checked',' ',' ',' ',' ',' '); - $fchk = array('checked',' ',' ',' ',' ',' '); - - if($r_win) - { - $wchk[0] = ' '; - $wchk[$r_win] = 'checked'; - } - - if($r_fake) - { - $fchk[0] = ' '; - $fchk[$r_fake] = 'checked'; - } - - $j->addmisc("". - "". - "". - "
With Windows With WindowsWithout Windows Without Windows
"); - - $j->addmisc("".$n.$n.$n.$n.$n."","center"); - $j->addmisc("".$s.$n.$n.$n.$n."","center"); - $j->addmisc("".$s.$s.$n.$n.$n."","center"); - $j->addmisc("".$s.$s.$s.$n.$n."","center"); - $j->addmisc("".$s.$s.$s.$s.$n."","center"); - $j->addmisc("".$s.$s.$s.$s.$s."","center"); - - - $j->addmisc("","center"); - $j->addmisc(""); - - $j->add("Rating Help", BASE."help/?topic=ratings"); - - $j->done(1); -} - - -/*========================================================================= - * - * returns the avg rating for versionId - * - */ -function rating_for_version($versionId, $system) -{ - $result = query_appdb("SELECT avg(score) as rating, count(id) as hits FROM appRating ". - "WHERE versionId = $versionId and system = '$system'"); - if(!$result) - return 0; - $ob = mysql_fetch_object($result); - return $ob; -} - - -/*========================================================================= - * - * returns rating as star images - * - */ -function rating_stars_for_version($versionId, $system) -{ - - $r = rating_for_version($versionId, $system); - - $s = 's1'; - $n = 's0'; - $h = 's2'; - - if ($system == "fake") - { - $win_gif = "w0.gif"; - $alt_desc = "Without Windows"; - } - else - { - $win_gif = "w1.gif"; - $alt_desc = "With Windows"; - } - - if(!$r->rating) - { - $str = ""; - for($c = 0; $c < 5; $c++) { $str .= $n; } - $str = "$alt_desc ".$str."
"."unrated".""; - return $str; - } - - $result = ""; - for($i = 0; $i < (int)floor($r->rating); $i++) - $result .= $s; - if(floor($r->rating) < round($r->rating)) - { - $i++; - $result .= $h; - } - for(; $i < 5; $i++) - $result .= $n; - - $result = "$alt_desc ".$result. - "
".substr($r->rating,0,4). - " (".$r->hits." votes) ".""; - - return $result; -} - -/*========================================================================= - * - * called by /updaterating.php to update the rating table - * - */ -function rating_update($vars) -{ - - if(!loggedin()) - { - // do something, must be logged in - return; - } - - $userId = $_SESSION['current']->userid; - - if(is_numeric($vars['versionId'])) - $versionId = $vars["versionId"]; - else - return; - - if(is_numeric($vars['score_w'])) - $score_w = $vars["score_w"]; - else - return; - - if(is_numeric($vars['score_f'])) - $score_f = $vars["score_f"]; - else - return; - - if($score_w) - { - $result = query_appdb("SELECT * FROM appRating WHERE versionId = $versionId AND ". - "userId = $userId AND system = 'windows'"); - - if($result && mysql_num_rows($result)) - { - $ob = mysql_fetch_object($result); - query_appdb("UPDATE appRating SET score = $score_w WHERE id = $ob->id"); - } - else - { - $aInsert = compile_insert_string( array( 'versionId' => $versionId, - 'userId' => $userId, - 'system' => 'windows', - 'score' => $score_w)); - - query_appdb("INSERT INTO appRating ({$aInsert['FIELDS']}) VALUES ({$aInsert['VALUES']})"); - } - - $r = rating_for_version($versionId, "windows"); - query_appdb("UPDATE appVersion SET rating_windows = $r->rating WHERE versionId = $versionId"); - } - - if($score_f) - { - $result = query_appdb("SELECT * FROM appRating WHERE versionId = $versionId AND ". - "userId = $userId AND system = 'fake'"); - if($result && mysql_num_rows($result)) - { - $ob = mysql_fetch_object($result); - query_appdb("UPDATE appRating SET score = $score_f WHERE id = $ob->id"); - } - else - { - $aInsert = compile_insert_string( array( 'versionId' => $versionId, - 'userId' => $userId, - 'system' => 'fake', - 'score' => $score_f)); - query_appdb("INSERT INTO appRating ({$aInsert['FIELDS']}) VALUES ({$aInsert['VALUES']})"); - } - - $r = rating_for_version($versionId, "fake"); - query_appdb("UPDATE appVersion SET rating_fake = $r->rating WHERE versionId = $versionId"); - } -} - -?> diff --git a/updaterating.php b/updaterating.php deleted file mode 100644 index 7f07479..0000000 --- a/updaterating.php +++ /dev/null @@ -1,17 +0,0 @@ -