add("Add Note", BASE."admin/addAppNote.php?appId=$appId&versionId=".$_REQUEST['versionId']); $m->addmisc(" "); $m->add("Edit Version", BASE."admin/editAppVersion.php?appId=$appId&versionId=".$_REQUEST['versionId']); $url = BASE."admin/deleteAny.php?what=appVersion&versionId=".$_REQUEST['versionId']."&confirmed=yes"; $m->add("Delete Version", "javascript:deleteURL(\"Are you sure?\", \"".$url."\")"); } else { $m->add("Add Version", BASE."admin/addAppVersion.php?appId=".$_REQUEST['appId']); $m->addmisc(" "); $m->add("Edit App", BASE."admin/editAppFamily.php?appId=".$_REQUEST['appId']); // global admin options if(havepriv("admin")) { $url = BASE."admin/deleteAny.php?what=appFamily&appId=".$_REQUEST['appId']."&confirmed=yes"; $m->add("Delete App", "javascript:deleteURL(\"Are you sure?\", \"".$url."\")"); $m->addmisc(" "); $m->add("Edit Owners", BASE."admin/editAppOwners.php?appId=".$_REQUEST['appId']); $m->add("Edit Bundle", BASE."admin/editBundle.php?bundleId=".$_REQUEST['appId']); } } $m->done(); } /** * Get a random image for a particular version of an app. * If the version is not set, get a random app image */ function get_screenshot_img($appId, $versionId="") { if($versionId) { $result = mysql_query("SELECT *, RAND() AS rand FROM appData WHERE appId = $appId AND versionId = $versionId AND type = 'image' ORDER BY rand"); } else { $result = mysql_query("SELECT *, RAND() AS rand FROM appData WHERE appId = $appId AND type = 'image' ORDER BY rand"); } if(!$result || !mysql_num_rows($result)) { $imgFile = "No Screenshot"; } else { $ob = mysql_fetch_object($result); $imgFile = ""; } $img = html_frame_start("",'128','',2); if($versionId || mysql_num_rows($result)) $img .= "$imgFile"; else // no link for adding app screenshot as screenshots are linked to versions $img .= $imgFile; $img .= html_frame_end()."
"; return $img; } /** * TODO: what does it do ? */ function display_catpath($catId) { $cat = new Category($catId); $catFullPath = make_cat_path($cat->getCategoryPath()); echo html_frame_start("",'98%','',2); echo "

Category: ". $catFullPath ."
\n"; echo html_frame_end(); } /** * display the SUB apps that belong to this app */ function display_bundle($appId) { $result = mysql_query("SELECT appFamily.appId, appName, description FROM appBundle, appFamily ". "WHERE bundleId = $appId AND appBundle.appId = appFamily.appId"); if(!$result || mysql_num_rows($result) == 0) { return; // do nothing } echo html_frame_start("","98%","",0); echo "\n\n"; echo "\n"; echo " \n"; echo " \n"; echo "\n\n"; $c = 0; while($ob = mysql_fetch_object($result)) { //set row color $bgcolor = ($c % 2 == 0) ? "color0" : "color1"; //format desc $desc = substr(stripslashes($ob->description),0,50); if(strlen($desc) == 50) $desc .= " ..."; //display row echo "\n"; echo " \n"; echo " \n"; echo "\n\n"; $c++; } echo "
Application NameDescription
".stripslashes($ob->appName)."$desc  
\n\n"; echo html_frame_end(); } /** * display the notes for the app */ function display_notes($appId, $versionId = 0) { $result = mysql_query("SELECT noteId,noteTitle FROM appNotes ". "WHERE appId = $appId AND versionId = $versionId"); if(!$result || mysql_num_rows($result) == 0) { // do nothing return; } echo " Notes\n"; $c = 1; while($ob = mysql_fetch_object($result)) { // skip if NONAME if ($ob->noteTitle == "NONAME" || $ob->noteTitle == "WARNING" || $ob->noteTitle == "HOWTO") { continue; } // set link for version if ($versionId != 0) { $versionLink = "&versionId=$versionId"; } // display row if (havepriv("admin") || $_SESSION['current']->is_maintainer($appId,$versionId) ) echo " $c. ".substr(stripslashes($ob->noteTitle),0,30)."
\n"; else echo " $c. ".substr(stripslashes($ob->noteTitle),0,30)."
\n"; $c++; } echo "\n"; } /** * display the versions */ function display_versions($appId, $versions) { if ($versions) { echo html_frame_start("","98%","",0); echo "\n\n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "\n\n"; $c = 0; while(list($idx, $ver) = each($versions)) { //set row color $bgcolor = ($c % 2 == 0) ? "color0" : "color1"; //format desc $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); //display row echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "\n\n"; $c++; } echo "
VersionDescriptionRating With WindowsRating Without WindowsComments
".$ver->versionName."$desc  $r_win$r_fake$r_count
\n"; echo html_frame_end("Click the Version Name to view the details of that Version"); } } $appId = $_REQUEST['appId']; $versionId = $_REQUEST['versionId']; /** * We want to see an application family (=no version) */ if(!is_numeric($appId)) { errorpage("Something went wrong with the IDs"); exit; } if($appId && !$versionId) { $app = new Application($appId); $data = $app->data; if(!$data) { // oops! application not found or other error. do something errorpage('Internal Database Access Error'); exit; } // show Vote Menu if(loggedin()) apidb_sidebar_add("vote_menu"); // show Admin Menu if(loggedin() && (havepriv("admin") || $_SESSION['current']->ownsApp($appId))) apidb_sidebar_add("admin_menu"); // header apidb_header("Viewing App - ".$data->appName); // cat display display_catpath($app->data->catId); // set Vendor $vendor = $app->getVendor(); // set URL $appLinkURL = ($data->webPage) ? "".substr(stripslashes($data->webPage),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"; echo " \n"; echo " \n"; // display notes display_notes($appId); // main URL echo " \n"; // optional links $result = mysql_query("SELECT * FROM appData WHERE appId = $appId AND type = 'url'"); if($result && mysql_num_rows($result) > 0) { echo " \n"; } // image $img = get_screenshot_img($appId); echo "\n"; // display app owner $result = mysql_query("SELECT * FROM appOwners WHERE appId = $appId"); if($result && mysql_num_rows($result) > 0) { echo " \n"; echo " \n"; } echo "
Name ".stripslashes($data->appName)."
Vendor ". " ".stripslashes($vendor->vendorName)."  \n"; echo "
BUGS ". " Check for bugs in bugzilla  \n"; echo "
URL".$appLinkURL."
Links\n"; while($ob = mysql_fetch_object($result)) { echo " ".substr(stripslashes($ob->description),0,30)."
\n"; } echo "
$img
Owner\n"; while($ob = mysql_fetch_object($result)) { $inResult = mysql_query("SELECT username,email FROM user_list WHERE userid = $ob->ownerId"); if ($inResult && mysql_num_rows($inResult) > 0) { $foo = mysql_fetch_object($inResult); echo " ".substr(stripslashes($foo->username),0,30)."
\n"; } } echo "
\n"; /* close of name/vendor/bugs/url table */ echo "
\n"; // Display all supermaintainers maintainers of this application echo " \n"; echo " \n"; $other_maintainers = getSuperMaintainersUserIdsFromAppId($appId); if($other_maintainers) { while(list($index, list($userIdValue)) = each($other_maintainers)) { echo " \n"; } } else { echo " \n"; } // Display the app maintainer button echo " \n"; echo "
Super maintainers:
\n"; echo "
  • ".lookupUsername($userIdValue)."
  • No maintainers.Volunteer today!
    \n"; if(loggedin()) { /* are we already a maintainer? */ if($_SESSION['current']->is_super_maintainer($appId)) /* yep */ { echo '
    '; } else /* nope */ { echo ' '; } echo " "; echo " "; echo " "; /* set superMaintainer to 1 because we are at the appFamily level */ echo "
    "; } else { echo ' '; } echo "
    \n"; /* close of super maintainers table */ echo "
    \n"; echo "
    Submit New Version  
    \n"; echo "
    \n"; /* close the table that contains the whole left hand side of the upper table */ // description echo " \n"; echo "
    Description
    \n"; echo add_br(stripslashes($data->description)); echo "
    \n"; echo html_frame_end("For more details and user comments, view the versions of this application."); // display versions display_versions($appId,$app->getAppVersionList()); // display bundle display_bundle($appId); // disabled for now //log_application_visit($appId); } ####################################### # We want to see a particular version # ####################################### else if($appId && $versionId) { $app = new Application($appId); $data = $app->data; if(!$data) { // Oops! application not found or other error. do something errorpage('Internal Database Access Error. No App found.'); exit; } $ver = $app->getAppVersion($versionId); if(!$ver) { // Oops! Version not found or other error. do something errorpage('Internal Database Access Error. No Version Found.'); exit; } // rating menu if(loggedin()) { apidb_sidebar_add("rating_menu"); } // admin menu if(loggedin() && havepriv("admin")) { apidb_sidebar_add("admin_menu"); } // header apidb_header("Viewing App Version - ".$data->appName); // cat display_catpath($app->data->catId); // set URL $appLinkURL = ($ver->webPage) ? "".substr(stripslashes($ver->webPage),0,30)."": " "; // start version display echo html_frame_start("","98%","",0); echo '',"\n"; echo '',"\n"; echo "\n"; echo "\n"; echo "\n"; // rating Area $r_win = rating_stars_for_version($versionId, "windows"); $r_fake = rating_stars_for_version($versionId, "fake"); echo "\n"; // notes display_notes($appId, $versionId); // image $img = get_screenshot_img($appId, $versionId); echo "\n"; // display all maintainers of this application echo ""; // display the app maintainer button echo ""; if (loggedin() && (havepriv("admin") || $_SESSION['current']->is_maintainer($appId, $versionId))) { echo ""; } echo "
    Name".stripslashes($data->appName)."
    Version".stripslashes($ver->versionName)."
    URL".stripslashes($appLinkURL)."
    Rating $r_win \n"; echo "
    $r_fake
    $img
    Maintainers of this application:\n"; echo ""; $other_maintainers = getMaintainersUserIdsFromAppIdVersionId($appId, $versionId); if($other_maintainers) { while(list($index, list($userIdValue)) = each($other_maintainers)) { echo "\n"; } } else { echo "\n"; } echo "
    "; echo "
  • ".lookupUsername($userIdValue)."
  • "; echo "No maintainers. Volunteer today!
    "; if(loggedin()) { /* is this user a maintainer of this version by virtue of being a super maintainer */ /* of this app family? */ if($_SESSION['current']->is_super_maintainer($appId) && !$_SESSION['current']->is_maintainer($appId, $versionId)) { echo '
    '; echo ""; } else { /* are we already a maintainer? */ if($_SESSION['current']->is_maintainer($appId, $versionId)) /* yep */ { echo ''; echo ""; } else /* nope */ { echo ''; } } echo ""; echo ""; echo "
    "; } else { echo '
    '; echo ''; echo '
    '; } echo "
    "; echo '
    '; echo ''; echo '
    '; echo '
    '; echo ''; echo '
    '; echo ''; echo '
    '; echo ''; echo ''; echo '
    '; echo ''; echo '
    '; echo ''; echo ''; echo '
    '; echo "
    \n"; //Desc Image echo ""; /* close the table */ echo "
    Description
    \n"; echo add_br(stripslashes($ver->description)); echo "
    \n"; echo html_frame_end(); //Show Warnings $result = mysql_query("SELECT * FROM appNotes WHERE appId = $appId and versionId = $versionId and noteTitle = 'WARNING'"); if($result && mysql_num_rows($result)) { while($ob = mysql_fetch_object($result)) { echo html_frame_start("","98%",'',0); echo "","\n"; echo "\n"; echo "\n"; if (loggedin() && (havepriv("admin") || $_SESSION['current']->is_maintainer($appId, $versionId))) { echo "'; } echo "
    Warning
    \n"; echo add_br(stripslashes($ob->noteDesc)); echo "
    "; echo '
    noteId.'&appId='.$appId.'&versionId='.$versionId.'>'; echo ''; echo '
    \n"; echo html_frame_end(); } } // show How tos $result = mysql_query("SELECT * FROM appNotes WHERE appId = $appId and versionId = $versionId and noteTitle = 'HOWTO'"); if($result && mysql_num_rows($result)) { while($ob = mysql_fetch_object($result)) { echo html_frame_start("","98%",'',0); echo "","\n"; echo "\n"; echo "\n"; if (loggedin() && (havepriv("admin") || $_SESSION['current']->is_maintainer($appId, $versionId))) { echo "'; } echo "
    How To
    \n"; echo add_br(stripslashes($ob->noteDesc)); echo "
    "; echo '
    noteId.'&appId='.$appId.'&versionId='.$versionId.'>'; echo ''; echo '
    \n"; echo html_frame_end(); } } //TODO: code to view/add user experience record // if(!$versionId) // { // $versionId = 0; // } // Comments Section view_app_comments($appId, $versionId); } else { // Oops! Called with no params, bad llamah! errorpage('Page Called with No Params!'); exit; } ?>