/** * Show detail information about an app * and offer download of it. * * @param string $package * The package name of the app to show information for. * * @throws Exception * If package does not exists. */ public function app($package = NULL) { $sql = <<<EOF SELECT package, title, author, description FROM Apps WHERE package LIKE :package ; EOF; // Get info from DB and show app details. $db = DBApps::getInstance()->db; $sth = $db->prepare($sql); $sth->bindValue(':package', trim($package), SQLITE3_TEXT); $res = $sth->execute(); $row = $res->fetchArray(SQLITE3_ASSOC); $this->_alterRow($row); if (!empty($row)) { $this->view->package = $package = $row['package']; $this->view->title = $row['title']; $this->view->author = $row['author']; $play_url = 'https://play.google.com/store/apps/details?id=' . urlencode($package); $this->view->teaser = $row['teaser'] . _f(' %s[more]%s<br><br><i>This is a short extract from %s<br>%sCopyright notice%s</i>', '<a target="_blank" href="' . q($play_url) . '">', '</a>', '<a target="_blank" href="' . q($play_url) . '">' . q($play_url) . '</a>', '<a href="' . q(url('impressum')) . '#app-teaser">[', ']</a>'); } else { if (package_exists($package)) { $this->view->package = $package; $this->view->title = $package; $this->view->author = _('Unknown'); $this->view->teaser = '<i>' . _f('App-Download.org has no description for this app, however you can still download the app using the %sdownload link%s.' . ' Please visit the %sPlay Store%s for information about this app.', '<a href="' . q(url('download/direct/' . urlencode($package))) . '">', '</a>', '<a target="_blank" href="https://play.google.com/store/apps/details?id=' . q(urlencode($package)) . '">', '</a>') . '</i>'; } else { throw new Exception(_f('Could not find app with package name "%s".', $package)); } } // Build links. $this->view->downloadUrl = url('download/direct/') . urlencode($package); $this->view->playstoreUrl = 'https://play.google.com/store/apps/details?id=' . urlencode($package); $this->view->display('app'); }
response_header('Report'); $errors[] = 'The package name in the URL is not proper, please fix it and try again.'; $errors[] = 'It should look like this: report.php?package=PackageName'; report_error($errors); response_footer(); exit; } $clean_package = clean($_REQUEST['package']); if (empty($_REQUEST['package'])) { $errors[] = 'Please choose a package before clicking "Go".'; response_header("Report - No package selected"); report_error($errors); response_footer(); exit; } if (!package_exists($_REQUEST['package'])) { $errors[] = 'Package "' . $clean_package . '" does not exist.'; response_header("Report - Invalid package"); report_error($errors); response_footer(); exit; } response_header('Report - New'); // See if this package uses an external bug system require_once 'bugs/pear-bugs-utils.php'; $bug_link = PEAR_Bugs_Utils::getExternalSystem($clean_package); if (!empty($bug_link)) { $link = make_link($bug_link); report_success($clean_package . ' has an external bug system that can be reached at ' . $link); response_footer(); exit;
/** * Validate an incoming bug report * * @param * * @return void */ function incoming_details_are_valid($in, $initial = 0, $logged_in = false) { global $bug, $dbh, $bug_types; $errors = array(); if (!is_array($in)) { $errors[] = 'Invalid data submitted!'; return $errors; } if ($initial || !empty($in['email']) && $bug['email'] != $in['email']) { if (!is_valid_email($in['email'])) { $errors[] = 'Please provide a valid email address.'; } } if (!$logged_in && $initial && empty($in['passwd'])) { $errors[] = 'Please provide a password for this bug report.'; } if (isset($in['php_version']) && $in['php_version'] == 'earlier') { $errors[] = 'Please select a valid PHP version. If your PHP version is too old, please upgrade first and see if the problem has not already been fixed.'; } if (empty($in['php_version'])) { $errors[] = 'Please select a valid PHP version.'; } if (empty($in['package_name']) || $in['package_name'] == 'none') { $errors[] = 'Please select an appropriate package.'; } else { if (!package_exists($in['package_name'])) { $errors[] = 'Please select an appropriate package.'; } } if (empty($in['bug_type']) || !array_key_exists($in['bug_type'], $bug_types)) { $errors[] = 'Please select a valid bug type.'; } if (empty($in['sdesc'])) { $errors[] = 'You must supply a short description of the bug you are reporting.'; } if ($initial && empty($in['ldesc'])) { $errors[] = 'You must supply a long description of the bug you are reporting.'; } return $errors; }
<?php require_once __DIR__ . '/../inc/functions.php'; require_once __DIR__ . '/../inc/autoload.php'; set_time_limit(0); define('LANGUAGE', 'en'); $db = DBApps::getInstance()->db; $res = $db->query('SELECT package FROM Apps;'); while ($row = $res->fetchArray(SQLITE3_ASSOC)) { echo '.'; // Try to recover from errors. for ($i = 0; $i < 3; $i++) { try { if (!package_exists($row['package'])) { $sth = $db->prepare('DELETE FROM Apps WHERE package = :package;'); $sth->bindValue(':package', $row['package']); $sth->execute(); } break; } catch (Exception $e) { echo 'f'; sleep(30); } } }
# Now we've parsed the pkgbuild, let's move it to where it belongs if (!$error) { $pkg_name = str_replace("'", "", $new_pkgbuild['pkgname']); $pkg_name = escapeshellarg($pkg_name); $pkg_name = str_replace("'", "", $pkg_name); $presult = preg_match("/^[a-z0-9][a-z0-9\\.+_-]*\$/", $pkg_name); if (!$presult) { $error = __("Invalid name: only lowercase letters are allowed."); } } if (isset($pkg_name)) { $incoming_pkgdir = INCOMING_DIR . $pkg_name; } if (!$error) { # First, see if this package already exists, and if it can be overwritten $pkg_exists = package_exists($pkg_name); if (can_submit_pkg($pkg_name, $_COOKIE["AURSID"])) { if (file_exists($incoming_pkgdir)) { # Blow away the existing file/dir and contents rm_rf($incoming_pkgdir); } if (!@mkdir($incoming_pkgdir)) { $error = __("Could not create directory %s.", $incoming_pkgdir); } rename($pkg_dir, $incoming_pkgdir . "/" . $pkg_name); } else { $error = __("You are not allowed to overwrite the %h%s%h package.", "<b>", $pkg_name, "</b>"); } } # Re-tar the package for consistency's sake if (!$error) {
exit; } else { // Default values $form_data = array_merge(array('NAME' => null, 'DESCRIPTION' => null, 'OS' => 'WINDOWS', 'ACTION' => 'STORE', 'ACTION_INPUT' => null, 'DEPLOY_SPEED' => 'MIDDLE', 'PRIORITY' => 5, 'NB_FRAGS' => null, 'NOTIFY_USER' => null, 'NOTIFY_TEXT' => null, 'NOTIFY_COUNTDOWN' => null, 'NOTIFY_CAN_CANCEL' => null, 'NOTIFY_CAN_DELAY' => null, 'NEED_DONE_ACTION' => null, 'NEED_DONE_ACTION_TEXT' => null, 'REDISTRIB_USE' => null, 'REDISTRIB_PRIORITY' => 5, 'REDISTRIB_NB_FRAGS' => null, 'DOWNLOAD_SERVER_DOCROOT' => get_redistrib_distant_download_root()), $_POST); $form_data['TIMESTAMP'] = $timestamp; $errors = array(); if (isset($_POST['create_package'])) { require_once 'lib/package_forms.php'; // Perform validation $errors = validate_package_form($form_data, $_FILES); if (!$errors) { require_once 'require/function_telediff.php'; // Create package $sql_details = array('document_root' => get_download_root(), 'timestamp' => $timestamp, 'nbfrags' => $form_data['NB_FRAGS'], 'name' => $form_data['NAME'], 'os' => $form_data['OS'], 'description' => $form_data['DESCRIPTION'], 'size' => 0, 'id_wk' => 0); $info_details = array('PRI' => $form_data['PRIORITY'], 'ACT' => $form_data['ACTION'], 'DIGEST' => 'TODO', 'PROTO' => 'HTTP', 'DIGEST_ALGO' => 'MD5', 'DIGEST_ENCODE' => 'HEXA', 'PATH' => $form_data['ACTION_INPUT'], 'NAME' => $form_data['ACTION_INPUT'], 'COMMAND' => $form_data['ACTION_INPUT'], 'NOTIFY_USER' => $form_data['NOTIFY_USER'], 'NOTIFY_TEXT' => $form_data['NOTIFY_TEXT'], 'NOTIFY_COUNTDOWN' => $form_data['NOTIFY_COUNTDOWN'], 'NOTIFY_CAN_ABORT' => $form_data['NOTIFY_CAN_ABORT'], 'NOTIFY_CAN_DELAY' => $form_data['NOTIFY_CAN_DELAY'], 'NEED_DONE_ACTION' => $form_data['NEED_DONE_ACTION'], 'NEED_DONE_ACTION_TEXT' => $form_data['NEED_DONE_ACTION_TEXT'], 'GARDEFOU' => 'rien'); create_pack($sql_details, $info_details); } } if ($errors or !isset($_POST['create_package'])) { require_once 'views/package_form_view.php'; show_package_form($form_data, $errors); } } } // If the package has been created, show the details of the package if (package_exists($timestamp)) { $form_data = array(); $errors = array(); require_once 'views/activate_form_view.php'; show_activate_form($timestamp, $form_data, $errors); }