diff --git a/appview.php b/appview.php index 096f58d..bf6b8e8 100644 --- a/appview.php +++ b/appview.php @@ -190,369 +190,12 @@ if ($_REQUEST['sub']) if($_REQUEST['appId']) { $oApp = new Application($_REQUEST['appId']); - - /* is this user supposed to view this version? */ - if(!$_SESSION['current']->canViewApplication($oApp)) - { - errorpage("Something went wrong with the application or version id"); - exit; - } - - // show Vote Menu - if($_SESSION['current']->isLoggedIn()) - apidb_sidebar_add("vote_menu"); - - // header - apidb_header("Viewing App - ".$oApp->sName); - - // cat display - display_catpath($oApp->iCatId, $oApp->iAppId); - - // set Vendor - $oVendor = new Vendor($oApp->iVendorId); - - // set URL - $appLinkURL = ($oApp->sWebpage) ? "sWebpage."\">".substr(stripslashes($oApp->sWebpage),0,30)."": " "; - - // start display application - echo html_frame_start("","98%","",0); - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
\n"; - - echo ' ',"\n"; - echo " \n"; - echo " \n"; - - // main URL - echo " \n"; - - // optional links - $result = query_appdb("SELECT * FROM appData WHERE appId = ".$_REQUEST['appId']." AND versionID = 0 AND type = 'url'"); - if($result && mysql_num_rows($result) > 0) - { - echo " \n"; - } - - // image - $img = get_screenshot_img($oApp->iAppId); - echo "\n"; - - echo "
Name ".$oApp->sName."
Vendor ". - " ".$oVendor->sName."  \n"; - echo "
Votes "; - echo vote_count_app_total($oApp->iAppId); - echo "
URL".$appLinkURL."
Links\n"; - while($ob = mysql_fetch_object($result)) - { - echo " ".substr(stripslashes($ob->description),0,30)."
\n"; - } - echo "
$img
\n"; /* close of name/vendor/bugs/url table */ - - echo "
\n"; - - // Display all supermaintainers maintainers of this application - echo " \n"; - echo " \n"; - $other_maintainers = getSuperMaintainersUserIdsFromAppId($oApp->iAppId); - if($other_maintainers) - { - echo " \n"; - } else - { - echo " \n"; - } - - // Display the app maintainer button - echo ' \n"; - echo "
Super maintainers:
    \n"; - while(list($index, $userIdValue) = each($other_maintainers)) - { - $oUser = new User($userIdValue); - echo "
  • ".$oUser->sRealname."
  • \n"; - } - echo "
No maintainers.Volunteer today!
'; - if($_SESSION['current']->isLoggedIn()) - { - /* are we already a maintainer? */ - if($_SESSION['current']->isSuperMaintainer($oApp->iAppId)) /* yep */ - { - echo '
'; - } else /* nope */ - { - echo ' '; - } - - echo " iAppId."\">"; - echo " "; /* set superMaintainer to 1 because we are at the appFamily level */ - echo "
"; - - if($_SESSION['current']->isSuperMaintainer($oApp->iAppId) || $_SESSION['current']->hasPriv("admin")) - { - echo '
'; - } - if($_SESSION['current']->isLoggedIn()) - { - echo '
'; - echo ''; - echo '
'; - } - if($_SESSION['current']->hasPriv("admin")) - { - $url = BASE."admin/deleteAny.php?what=appFamily&appId=".$oApp->iAppId."&confirmed=yes"; - echo "
"; - echo '
'; - } - } else - { - echo '
'; - } - echo "
\n"; /* close of super maintainers table */ - echo "
\n"; /* close the table that contains the whole left hand side of the upper table */ - - // description - echo " \n"; - echo "
Description\n"; - echo $oApp->sDescription; - echo "
\n"; - echo html_frame_end("For more details and user comments, view the versions of this application."); - - // display versions - display_approved_versions($oApp->aVersionsIds); - - // display bundle - display_bundle($oApp->iAppId); - - // disabled for now - //log_application_visit($oApp->iAppId); -} - - -/* - * We want to see a particular version. - */ -else if($_REQUEST['versionId']) + $oApp->display(); +} else if($_REQUEST['versionId']) // We want to see a particular version. { $oVersion = new Version($_REQUEST['versionId']); - - /* is this user supposed to view this version? */ - if(!$_SESSION['current']->canViewVersion($oVersion)) - { - errorpage("Something went wrong with the application or version id"); - exit; - } - - $oApp = new Application($oVersion->iAppId); - if(!$oApp->iAppId) - { - // Oops! application not found or other error. do something - errorpage('Internal Database Access Error. No App found.'); - exit; - } - - if(!$oVersion->iVersionId) - { - // Oops! Version not found or other error. do something - errorpage('Internal Database Access Error. No Version Found.'); - exit; - } - - // header - apidb_header("Viewing App- ".$oApp->sName." Version - ".$oVersion->sName); - - // cat - display_catpath($oApp->iCatId, $oApp->iAppId, $oVersion->iVersionId); - - // set URL - $appLinkURL = ($oApp->sWebpage) ? "sWebpage."\">".substr(stripslashes($oApp->sWebpage),0,30)."": " "; - - // start version display - echo html_frame_start("","98%","",0); - echo '',"\n"; - echo '',"\n"; - echo "\n"; - echo "\n"; - - // main URL - echo " \n"; - - // links - $result = query_appdb("SELECT * FROM appData WHERE versionID = ".$oVersion->iVersionId." AND type = 'url'"); - if($result && mysql_num_rows($result) > 0) - { - echo " \n"; - } - - // rating Area - echo "\n"; - echo "\n"; - - // image - $img = get_screenshot_img($oApp->iAppId, $oVersion->iVersionId); - echo "\n"; - - // display all maintainers of this application - echo ""; - - // display the app maintainer button - echo '"; - - if ($_SESSION['current']->hasPriv("admin") || $_SESSION['current']->isMaintainer($oVersion->iVersionId) || $_SESSION['current']->isSuperMaintainer($oVersion->iAppId)) - { - echo '"; - } - $oMonitor = new Monitor(); - $oMonitor->find($_SESSION['current']->iUserId,$oApp->iAppId,$oVersion->iVersionId); - if($oMonitor->iMonitorId) - { - - echo '"; - } - echo "
Name".$oApp->sName."
Version".$oVersion->sName."
URL".$appLinkURL."
Links\n"; - while($ob = mysql_fetch_object($result)) - { - echo " url\">".substr(stripslashes($ob->description),0,30)."
\n"; - } - echo "
Maintainer Rating".$oVersion->sTestedRating."
Maintainers Version".$oVersion->sTestedRelease."
$img
Maintainers of this version:\n"; - echo ""; - $aMaintainers = getMaintainersUserIdsFromAppIdVersionId($oVersion->iVersionId); - $aSupermaintainers = getSuperMaintainersUserIdsFromAppId($oVersion->iAppId); - $aAllMaintainers = array_merge($aMaintainers,$aSupermaintainers); - $aAllMaintainers = array_unique($aAllMaintainers); - if(sizeof($aAllMaintainers)>0) - { - echo "\n"; - } else - { - echo "\n"; - } - echo "
    "; - while(list($index, $userIdValue) = each($aAllMaintainers)) - { - $oUser = new User($userIdValue); - echo "
  • ".$oUser->sRealname."
  • "; - } - echo "
"; - echo "No maintainers. Volunteer today!
'; - if($_SESSION['current']->isLoggedIn()) - { - /* is this user a maintainer of this version by virtue of being a super maintainer */ - /* of this app family? */ - if($_SESSION['current']->isSuperMaintainer($oApp->iAppId)) - { - echo '
'; - echo ''; - echo ''; - echo "iAppId."\">"; - echo "iVersionId."\">"; - echo "
"; - } else - { - /* are we already a maintainer? */ - if($_SESSION['current']->isMaintainer($oVersion->iVersionId)) /* yep */ - { - echo '
'; - echo ''; - echo ''; - echo "iAppId."\">"; - echo "iVersionId."\">"; - echo "
"; - } else /* nope */ - { - echo '
'; - echo ''; - echo "iAppId."\">"; - echo "iVersionId."\">"; - echo "
"; - $oMonitor = new Monitor(); - $oMonitor->find($_SESSION['current']->iUserId,$oApp->iAppId,$oVersion->iVersionId); - if(!$oMonitor->iMonitorId) - { - echo '
iVersionId.'&appId='.$oApp->iAppId.'>'; - echo ''; - echo ''; - echo "
"; - } - } - } - - } else - { - echo '
'; - echo ''; - echo ''; - echo '
'; - } - - echo "
'; - echo '
'; - echo ''; - echo ''; - echo ''; - echo '
'; - $url = BASE."admin/deleteAny.php?what=appVersion&appId=".$oApp->iAppId."&versionId=".$oVersion->iVersionId."&confirmed=yes"; - echo "
"; - echo ''; - echo '
'; - echo '
'; - echo ''; - echo ''; - echo '
'; - echo '
iVersionId.'>'; - echo ''; - echo ''; - echo '
'; - echo '
iVersionId.'>'; - echo ''; - echo ''; - echo '
'; - echo "
'; - echo ''; - echo '
iVersionId.'>'; - echo ''; - echo ''; - echo '
'; - echo "
\n"; - - // description - echo ""; - - /* close the table */ - echo "
Description
\n"; - echo $oVersion->sDescription; - - // Show testing data - $oTest = new TestData($_REQUEST['iTestingId']); - $iCurrentTest = $oTest->ShowTestResult($oTest->iTestingId,$oVersion->iVersionId); - if($iCurrentTest) - $oTest->ShowVersionsTestingTable($oVersion->iVersionId, - $iCurrentTest, - $_SERVER['PHP_SELF']."?versionId=".$oVersion->iVersionId."&iTestingId=", - 5); - echo '
iVersionId.'>'; - echo ''; - echo '
'; - - - echo "
\n"; - - echo html_frame_end(); - - view_version_bugs($oVersion->iVersionId, $oVersion->aBuglinkIds); - - $rNotes = query_appdb("SELECT * FROM appNotes WHERE versionId = ".$oVersion->iVersionId); - - while( $oNote = mysql_fetch_object($rNotes) ) - { - echo show_note($oNote->noteTitle,$oNote); - } - - // Comments Section - view_app_comments($oVersion->iVersionId); - -} else + $oVersion->display(); +} else { // Oops! Called with no params, bad llamah! errorpage('Page Called with No Params!'); diff --git a/include/application.php b/include/application.php index 249d676..9059b29 100644 --- a/include/application.php +++ b/include/application.php @@ -502,6 +502,144 @@ class Application { $this->sKeywords = $_REQUEST['appKeywords']; } } + + /* display this application */ + function display() + { + /* is this user supposed to view this version? */ + if(!$_SESSION['current']->canViewApplication($this)) + { + errorpage("Something went wrong with the application or version id"); + exit; + } + + // show Vote Menu + if($_SESSION['current']->isLoggedIn()) + apidb_sidebar_add("vote_menu"); + + // header + apidb_header("Viewing App - ".$this->sName); + + // cat display + display_catpath($this->iCatId, $this->iAppId); + + // set Vendor + $oVendor = new Vendor($this->iVendorId); + + // set URL + $appLinkURL = ($this->sWebpage) ? "sWebpage."\">".substr(stripslashes($this->sWebpage),0,30)."": " "; + + // start display application + echo html_frame_start("","98%","",0); + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + + echo ' ',"\n"; + echo " \n"; + echo " \n"; + + // main URL + echo " \n"; + + // optional links + $result = query_appdb("SELECT * FROM appData WHERE appId = ".$_REQUEST['appId']." AND versionID = 0 AND type = 'url'"); + if($result && mysql_num_rows($result) > 0) + { + echo " \n"; + } + + // image + $img = get_screenshot_img($this->iAppId); + echo "\n"; + + echo "
Name ".$this->sName."
Vendor ". + " ".$oVendor->sName."  \n"; + echo "
Votes "; + echo vote_count_app_total($this->iAppId); + echo "
URL".$appLinkURL."
Links\n"; + while($ob = mysql_fetch_object($result)) + { + echo " ".substr(stripslashes($ob->description),0,30)."
\n"; + } + echo "
$img
\n"; /* close of name/vendor/bugs/url table */ + + echo "
\n"; + + // Display all supermaintainers maintainers of this application + echo " \n"; + echo " \n"; + $other_maintainers = getSuperMaintainersUserIdsFromAppId($this->iAppId); + if($other_maintainers) + { + echo " \n"; + } else + { + echo " \n"; + } + + // Display the app maintainer button + echo ' \n"; + echo "
Super maintainers:
    \n"; + while(list($index, $userIdValue) = each($other_maintainers)) + { + $oUser = new User($userIdValue); + echo "
  • ".$oUser->sRealname."
  • \n"; + } + echo "
No maintainers.Volunteer today!
'; + if($_SESSION['current']->isLoggedIn()) + { + /* are we already a maintainer? */ + if($_SESSION['current']->isSuperMaintainer($this->iAppId)) /* yep */ + { + echo '
'; + } else /* nope */ + { + echo ' '; + } + + echo " iAppId."\">"; + echo " "; /* set superMaintainer to 1 because we are at the appFamily level */ + echo "
"; + + if($_SESSION['current']->isSuperMaintainer($this->iAppId) || $_SESSION['current']->hasPriv("admin")) + { + echo '
'; + } + if($_SESSION['current']->isLoggedIn()) + { + echo '
'; + echo ''; + echo '
'; + } + if($_SESSION['current']->hasPriv("admin")) + { + $url = BASE."admin/deleteAny.php?what=appFamily&appId=".$this->iAppId."&confirmed=yes"; + echo "
"; + echo '
'; + } + } else + { + echo '
'; + } + echo "
\n"; /* close of super maintainers table */ + echo "
\n"; /* close the table that contains the whole left hand side of the upper table */ + + // description + echo " \n"; + echo "
Description\n"; + echo $this->sDescription; + echo "
\n"; + echo html_frame_end("For more details and user comments, view the versions of this application."); + + // display versions + display_approved_versions($this->aVersionsIds); + + // display bundle + display_bundle($this->iAppId); + } } diff --git a/include/version.php b/include/version.php index 66a2b52..2668f72 100644 --- a/include/version.php +++ b/include/version.php @@ -617,6 +617,225 @@ class Version { $this->sTestedRelease = $_REQUEST['maintainer_release']; } } + + function display() + { + /* is this user supposed to view this version? */ + if(!$_SESSION['current']->canViewVersion($this)) + { + errorpage("Something went wrong with the application or version id"); + exit; + } + + $oApp = new Application($this->iAppId); + if(!$oApp->iAppId) + { + // Oops! application not found or other error. do something + errorpage('Internal Database Access Error. No App found.'); + exit; + } + + if(!$this->iVersionId) + { + // Oops! Version not found or other error. do something + errorpage('Internal Database Access Error. No Version Found.'); + exit; + } + + // header + apidb_header("Viewing App- ".$oApp->sName." Version - ".$this->sName); + + // cat + display_catpath($oApp->iCatId, $oApp->iAppId, $this->iVersionId); + + // set URL + $appLinkURL = ($oApp->sWebpage) ? "sWebpage."\">".substr(stripslashes($oApp->sWebpage),0,30)."": " "; + + // start version display + echo html_frame_start("","98%","",0); + echo '',"\n"; + echo '',"\n"; + echo "\n"; + echo "\n"; + + // main URL + echo " \n"; + + // links + $result = query_appdb("SELECT * FROM appData WHERE versionID = ".$this->iVersionId." AND type = 'url'"); + if($result && mysql_num_rows($result) > 0) + { + echo " \n"; + } + + // rating Area + echo "\n"; + echo "\n"; + + // image + $img = get_screenshot_img($oApp->iAppId, $this->iVersionId); + echo "\n"; + + // display all maintainers of this application + echo ""; + + // display the app maintainer button + echo '"; + + if ($_SESSION['current']->hasPriv("admin") || $_SESSION['current']->isMaintainer($this->iVersionId) || $_SESSION['current']->isSuperMaintainer($this->iAppId)) + { + echo '"; + } + $oMonitor = new Monitor(); + $oMonitor->find($_SESSION['current']->iUserId, $oApp->iAppId, $this->iVersionId); + if($oMonitor->iMonitorId) + { + echo '"; + } + echo "
Name".$oApp->sName."
Version".$this->sName."
URL".$appLinkURL."
Links\n"; + while($ob = mysql_fetch_object($result)) + { + echo " url\">".substr(stripslashes($ob->description),0,30)."
\n"; + } + echo "
Maintainer Rating".$this->sTestedRating."
Maintainers Version".$this->sTestedRelease."
$img
Maintainers of this version:\n"; + echo ""; + $aMaintainers = getMaintainersUserIdsFromAppIdVersionId($this->iVersionId); + $aSupermaintainers = getSuperMaintainersUserIdsFromAppId($this->iAppId); + $aAllMaintainers = array_merge($aMaintainers,$aSupermaintainers); + $aAllMaintainers = array_unique($aAllMaintainers); + if(sizeof($aAllMaintainers)>0) + { + echo "\n"; + } else + { + echo "\n"; + } + echo "
    "; + while(list($index, $userIdValue) = each($aAllMaintainers)) + { + $oUser = new User($userIdValue); + echo "
  • ".$oUser->sRealname."
  • "; + } + echo "
"; + echo "No maintainers. Volunteer today!
'; + if($_SESSION['current']->isLoggedIn()) + { + /* is this user a maintainer of this version by virtue of being a super maintainer */ + /* of this app family? */ + if($_SESSION['current']->isSuperMaintainer($oApp->iAppId)) + { + echo '
'; + echo ''; + echo ''; + echo "iAppId."\">"; + echo "iVersionId."\">"; + echo "
"; + } else + { + /* are we already a maintainer? */ + if($_SESSION['current']->isMaintainer($this->iVersionId)) /* yep */ + { + echo '
'; + echo ''; + echo ''; + echo "iAppId."\">"; + echo "iVersionId."\">"; + echo "
"; + } else /* nope */ + { + echo '
'; + echo ''; + echo "iAppId."\">"; + echo "iVersionId."\">"; + echo "
"; + $oMonitor = new Monitor(); + $oMonitor->find($_SESSION['current']->iUserId, + $oApp->iAppId,$this->iVersionId); + if(!$oMonitor->iMonitorId) + { + echo '
iVersionId.'&appId='.$oApp->iAppId.'>'; + echo ''; + echo ''; + echo "
"; + } + } + } + + } else + { + echo '
'; + echo ''; + echo ''; + echo '
'; + } + + echo "
'; + echo '
'; + echo ''; + echo ''; + echo ''; + echo '
'; + $url = BASE."admin/deleteAny.php?what=appVersion&appId=".$oApp->iAppId."&versionId=".$this->iVersionId."&confirmed=yes"; + echo "
"; + echo ''; + echo '
'; + echo '
'; + echo ''; + echo ''; + echo '
'; + echo '
iVersionId.'>'; + echo ''; + echo ''; + echo '
'; + echo '
iVersionId.'>'; + echo ''; + echo ''; + echo '
'; + echo "
'; + echo ''; + echo '
iVersionId.'>'; + echo ''; + echo ''; + echo '
'; + echo "
\n"; + + // description + echo ""; + + /* close the table */ + echo "
Description
\n"; + echo $this->sDescription; + + // Show testing data + $oTest = new TestData($_REQUEST['iTestingId']); + $iCurrentTest = $oTest->ShowTestResult($oTest->iTestingId, $this->iVersionId); + if($iCurrentTest) + { + $oTest->ShowVersionsTestingTable($this->iVersionId, + $iCurrentTest, + $_SERVER['PHP_SELF']."?versionId=".$this->iVersionId."&iTestingId=", + 5); + } + echo '
iVersionId.'>'; + echo ''; + echo '
'; + + echo "
\n"; + + echo html_frame_end(); + + view_version_bugs($this->iVersionId, $this->aBuglinkIds); + + $rNotes = query_appdb("SELECT * FROM appNotes WHERE versionId = ".$this->iVersionId); + + while( $oNote = mysql_fetch_object($rNotes) ) + { + echo show_note($oNote->noteTitle,$oNote); + } + + // Comments Section + view_app_comments($this->iVersionId); + } } function showVersionList($hResult)