<?php require_once 'tags/Manager.php'; $manager = new Tags_Manager(); auth_require('pear.dev'); $errors = array(); if (isset($_POST['addtag'])) { if (!isset($_POST['admintag'])) { $_POST['admintag'] = 0; } $errors = $manager->validateNewTag($_POST['tag'], $_POST['desc'], $_POST['admintag']); if (!count($errors)) { try { if ($_POST['admintag']) { $manager->createAdminTag($_POST['tag'], $_POST['desc']); } else { $manager->createRegularTag($_POST['tag'], $_POST['desc']); } } catch (Exception $e) { $errors[] = $e->getMessage(); } } } elseif (isset($_POST['deltag'])) { if (isset($_POST['tags']) && is_array($_POST['tags'])) { foreach ($_POST['tags'] as $id => $unused) { try { $manager->deleteTag($id); } catch (Exception $e) { $errors[] = $e->getMessage(); } }
print_package_navigation($row['packageid'], $row['name'], '/package-edit.php?id=' . $row['packageid']); $sth = $dbh->query('SELECT id, name FROM categories ORDER BY name'); while ($cat_row = $sth->fetchRow(DB_FETCHMODE_ASSOC)) { $rows[$cat_row['id']] = $cat_row['name']; } $form = new HTML_QuickForm2('package-edit', 'post', array('action' => '/package-edit.php?id=' . $row['packageid'])); $form->removeAttribute('name'); $renderer = HTML_QuickForm2_Renderer::factory('default'); // Set defaults for the form elements $form->addDataSource(new HTML_QuickForm2_DataSource_Array(array('name' => htmlspecialchars($row['name']), 'license' => htmlspecialchars($row['license']), 'summary' => htmlspecialchars($row['summary']), 'description' => htmlspecialchars($row['description']), 'category' => (int) $row['categoryid'], 'homepage' => htmlspecialchars($row['homepage']), 'doc_link' => htmlspecialchars($row['doc_link']), 'bug_link' => htmlspecialchars($row['bug_link']), 'cvs_link' => htmlspecialchars($row['cvs_link']), 'unmaintained' => $row['unmaintained'] ? true : false, 'newpk_id' => (int) $row['newpk_id'], 'new_channel' => htmlspecialchars($row['new_channel']), 'new_package' => htmlspecialchars($row['new_package'])))); $form->addElement('text', 'name', array('maxlength' => "80", 'accesskey' => "c"))->setLabel('Pa<span class="accesskey">c</span>kage Name'); $form->addElement('text', 'license', array('maxlength' => "50", 'placeholder' => 'BSD'))->setLabel('License:'); $form->addElement('textarea', 'summary', array('cols' => "75", 'rows' => "7", 'maxlength' => "255"))->setLabel('Summary'); $form->addElement('textarea', 'description', array('cols' => "75", 'rows' => "12"))->setLabel('Description'); $form->addElement('select', 'category')->setLabel('Category:')->loadOptions($rows); $manager = new Tags_Manager(); $sl = $form->addElement('select', 'tags', array('multiple' => 'multiple'))->setLabel('Tags:')->loadOptions(array('' => '(none)') + $manager->getTags(false, true)); $sl->setValue(array_keys($manager->getTags($row['name'], true))); $form->addElement('text', 'homepage', array('maxlength' => 255, 'accesskey' => "O"))->setLabel('H<span class="accesskey">o</span>mepage:'); $form->addElement('text', 'doc_link', array('maxlength' => 255, 'placeholder' => 'http://example.com/manual'))->setLabel('Documentation URI:'); $form->addElement('url', 'bug_link', array('maxlength' => 255, 'placeholder' => 'http://example.com/bugs'))->setLabel('Bug Tracker URI:'); $form->addElement('url', 'cvs_link', array('maxlength' => 255, 'placeholder' => 'http://example.com/svn/trunk'))->setLabel('Web version control URI'); $form->addElement('checkbox', 'unmaintained')->setLabel('Is this package unmaintained ?'); $packages = package::listAllwithReleases(); $rows = array(0 => ''); foreach ($packages as $id => $info) { if ($id == $_GET['id']) { continue; } $rows[$id] = $info['name']; }
<?php require_once 'tags/Manager.php'; $tags = new Tags_Manager(); if (isset($_GET['tag'])) { if (!$tags->tagExists($_GET['tag'])) { throw new Exception('Unknown tag "' . $_GET['tag'] . '"'); } $tag = strip_tags($_GET['tag']); $packages = $tags->getPackages($tag); require PEARWEB_TEMPLATEDIR . '/tags/package.tpl.php'; } else { $cloud = $tags->getGlobalTagCloud(); require PEARWEB_TEMPLATEDIR . '/tags/cloud.tpl.php'; }