Example #1
0
     } else {
         if ($_POST['new_channel'] == 'pear.php.net') {
             $_POST['newpk_id'] = $dbh->getOne('SELECT id from packages WHERE name = ?', array($_POST['new_package']));
             if (!$_POST['newpk_id']) {
                 $_POST['new_channel'] = $_POST['new_package'] = null;
             }
         }
     }
     $qparams = array($_POST['name'], $_POST['license'], $_POST['summary'], $_POST['description'], $_POST['category'], $_POST['homepage'], $_POST['doc_link'], $_POST['bug_link'], $_POST['cvs_link'], isset($_POST['unmaintained']) ? 1 : 0, !empty($_POST['newpk_id']) ? $_POST['newpk_id'] : null, $_POST['new_channel'], $_POST['new_package'], $_GET['id']);
     $sth = $dbh->query($query, $qparams);
     if (PEAR::isError($sth)) {
         report_error('Unable to save data!');
     } else {
         if (isset($_POST['tags']) && is_array($_POST['tags'])) {
             $manager = new Tags_Manager();
             $manager->clearTags($_POST['name']);
             foreach ($_POST['tags'] as $tag) {
                 if (!$tag) {
                     continue;
                 }
                 $manager->createPackageTag($tag, $_POST['name']);
             }
         }
         include_once 'pear-rest.php';
         $pear_rest = new pearweb_Channel_REST_Generator(PEAR_REST_PATH, $dbh);
         $pear_rest->saveAllPackagesREST();
         $pear_rest->savePackageREST($_POST['name']);
         $pear_rest->savePackagesCategoryREST(package::info($_POST['name'], 'category'));
         report_success('Package information successfully updated.');
     }
 }