Пример #1
0
    function saveAllCategoriesREST()
    {
        require_once 'System.php';
        $extra = '/rest/';
        $cdir = $this->_restdir . DIRECTORY_SEPARATOR . 'c';
        if (!is_dir($cdir)) {
            System::mkdir(array('-p', $cdir));
            @chmod($cdir, 0777);
        }
        $categories = category::listAll();
        $info = '<?xml version="1.0" encoding="UTF-8" ?>
<a xmlns="http://pear.php.net/dtd/rest.allcategories"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xsi:schemaLocation="http://pear.php.net/dtd/rest.allcategories
    http://pear.php.net/dtd/rest.allcategories.xsd">
<ch>' . PEAR_CHANNELNAME . '</ch>
';
        foreach ($categories as $category) {
            $info .= ' <c xlink:href="' . $extra . 'c/' . urlencode(urlencode($category['name'])) . '/info.xml">' . htmlspecialchars(utf8_encode($category['name'])) . '</c>
';
        }
        $info .= '</a>';
        file_put_contents($cdir . DIRECTORY_SEPARATOR . 'categories.xml', $info);
        @chmod($cdir . DIRECTORY_SEPARATOR . 'categories.xml', 0666);
    }
Пример #2
0
    public function saveAllCategoriesREST()
    {
        include_once 'pear-database-category.php';
        $categories = category::listAll();
        if (PEAR::isError($categories)) {
            return $categories;
        }
        $info = '<?xml version="1.0" encoding="UTF-8" ?>
<a xmlns="http://pear.php.net/dtd/rest.allcategories"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xsi:schemaLocation="http://pear.php.net/dtd/rest.allcategories
    http://pear.php.net/dtd/rest.allcategories.xsd">
<ch>' . $this->channel . '</ch>
';
        foreach ($categories as $category) {
            $info .= ' <c xlink:href="' . $this->extra . 'c/' . urlencode(urlencode($category['name'])) . '/info.xml">' . htmlspecialchars(utf8_encode($category['name'])) . '</c>
';
        }
        $info .= '</a>';
        $cdir = $this->getCategoryDirectory();
        if (!is_dir($cdir)) {
            if (!mkdir($cdir, 0777, true)) {
                return PEAR::raiseError('Creating directory ' . $cdir . ' failed - Check the permissions');
            }
            @chmod($cdir, 0777);
        }
        $file = $cdir . 'categories.xml';
        if (!file_put_contents($file, $info)) {
            return PEAR::raiseError('Writing to file ' . $file . ' failed - Check the permissions');
        }
        @chmod($file, 0666);
    }
Пример #3
0
        $pear_rest->saveAllReleasesREST($package);
        echo "done\n";
        foreach ($releases as $version => $blah) {
            $sql = 'SELECT fullpath FROM files WHERE `release` = ?';
            $fileinfo = $dbh->getOne($sql, array($blah['id']));
            $tar =& new Archive_Tar($fileinfo);
            if ($pxml = $tar->extractInString('package2.xml')) {
            } elseif ($pxml = $tar->extractInString('package.xml')) {
            }
            PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
            $pf = $pkg->fromAnyFile($fileinfo, PEAR_VALIDATE_NORMAL);
            PEAR::popErrorHandling();
            if (!PEAR::isError($pf)) {
                echo "     Version {$version}...";
                $pear_rest->saveReleaseREST($fileinfo, $pxml, $pf, $blah['doneby'], $blah['id']);
                echo "done\n";
            } else {
                echo "     Skipping INVALID Version {$version}\n";
            }
        }
        echo "\n";
    } else {
        echo "  done\n";
    }
}
echo "Generating Category Package REST...\n";
foreach (category::listAll() as $category) {
    echo "  {$category['name']}...";
    $pear_rest->savePackagesCategoryREST($category['name']);
    echo "done\n";
}
Пример #4
0
$months[1] = 'January';
$months[2] = 'February';
$months[3] = 'March';
$months[4] = 'April';
$months[5] = 'May';
$months[6] = 'June';
$months[7] = 'July';
$months[8] = 'August';
$months[9] = 'September';
$months[10] = 'October';
$months[11] = 'November';
$months[12] = 'December';
/**
* Code to fetch the current category list
*/
$category_rows = category::listAll();
if (!empty($_GET['pkg_category'])) {
    for ($i = 0; $i < count($category_rows); $i++) {
        if ($_GET['pkg_category'] == $category_rows[$i]['id']) {
            $category_rows[$i]['selected'] = 'selected="selected"';
        }
    }
}
/**
* Fetch list of users/maintainers
*/
$users = $dbh->getAll('SELECT u.handle, u.name FROM users u, maintains m WHERE u.handle = m.handle GROUP BY handle ORDER BY u.name', DB_FETCHMODE_ASSOC);
for ($i = 0; $i < count($users); $i++) {
    if (empty($users[$i]['name'])) {
        $users[$i]['name'] = $users[$i]['handle'];
    }
Пример #5
0
        $pkg[$key] = array_merge($pkg_names, $pkg_tmp[$key]);
    } else {
        $pkg[$key] = $pkg_names;
    }
}
if ($total > 0) {
    if ($rev == 1) {
        arsort($pkg[$sort_by]);
    } else {
        asort($pkg[$sort_by]);
    }
}
$query_string = $_SERVER['QUERY_STRING'] ? '?' . $_SERVER['QUERY_STRING'] : '';
// Fetch list of all categories
include_once 'pear-database-category.php';
$res = category::listAll();
?>

<table class="bugstats">
 <tr>
  <td style="white-space: nowrap">
   <form method="get" action="stats.php<?php 
echo htmlspecialchars($query_string);
?>
">
   <p><span class="filter">
    <label for="category" accesskey="o">
     Categ<span class="accesskey">o</span>ry:
    </label>
   <select class="small" name="category" id="category" onchange="this.form.submit(); return false;">
<?php 
Пример #6
0
$_GET['rid'] = isset($_GET['rid']) ? (int) $_GET['rid'] : 0;
$query = "SELECT * FROM packages" . (!empty($_GET['cid']) ? " WHERE category = '" . $_GET['cid'] . "' AND " : " WHERE ") . " packages.package_type = '" . SITE . "'" . " ORDER BY name";
$sth = $dbh->query($query);
$packages = array();
while ($row = $sth->fetchRow(DB_FETCHMODE_ASSOC)) {
    $packages[$row['id']] = $row['name'];
}
echo ' <form action="package-stats.php" method="get">' . "\n";
echo ' <table>' . "\n";
echo '  <caption style="background-color: #CCCCCC;">Select Package</caption>' . "\n";
echo '  <tr>' . "\n";
echo '  <td>' . "\n";
echo '   <select name="cid" onchange="javascript:reloadMe();">' . "\n";
echo '    <option value="">Select category ...</option>' . "\n";
include_once 'pear-database-category.php';
foreach (category::listAll() as $value) {
    $selected = '';
    if (isset($_GET['cid']) && $_GET['cid'] == $value['id']) {
        $selected = ' selected="selected"';
    }
    echo '    <option value="' . $value['id'] . '"' . $selected . '>' . $value['name'] . "</option>\n";
}
echo "  </select>\n";
echo "  </td>\n";
echo "  <td>\n";
if (isset($_GET['cid']) && $_GET['cid'] != '') {
    echo "  <select name=\"pid\" onchange=\"javascript:reloadMe();\">\n";
    echo '    <option value="">Select package ...</option>' . "\n";
    foreach ($packages as $value => $name) {
        $selected = '';
        if (isset($_GET['pid']) && $_GET['pid'] == $value) {
Пример #7
0
$form->removeAttribute('name');
$renderer =& $form->defaultRenderer();
$renderer->setElementTemplate('
 <tr>
  <th class="form-label_left">
   <!-- BEGIN required --><span style="color: #ff0000">*</span><!-- END required -->
   {label}
  </th>
  <td class="form-input">
   <!-- BEGIN error --><span style="color: #ff0000">{error}</span><br /><!-- END error -->
   {element}
  </td>
 </tr>
');
include_once 'pear-database-category.php';
$categories = category::listAll();
$mapCategories['RFC'] = 'RFC (No package category!)';
foreach ($categories as $categorie) {
    $mapCategories[$categorie['name']] = $categorie['name'];
}
$form->addElement('select', 'pkg_category', '<label for="pkg_category" accesskey="o">Categ<span class="accesskey">o</span>ry:</label>', $mapCategories, 'id="pkg_category"');
$field_desc = 'New category:<br /><p style="font-size: 75%; padding: 4px; margin: 0;">
    Only fill this out if you don\'t find a category that fits your package</p>';
$form->addElement('text', 'pkg_category_new', $field_desc);
$form->addElement('text', 'pkg_name', 'Package name:');
// Dropdown possible licenses, less confusing for users
$possibleLicenses = array('Apache License' => 'Apache License', 'LGPL' => 'LGPL', 'BSD Style' => 'BSD Style', 'MIT License' => 'MIT License');
$form->addElement('select', 'pkg_license', 'License:', $possibleLicenses);
/**
 * @desc Easy codes. makes it easier for people to put bb codes
 *       Since 2011-03-18 these helpers are Text_Wiki examples.