public function createdb() { if (!$this->dropdb()) { return false; } if (!$this->db->query(repository::sql())) { return false; } if (!$this->db->query(package::sql())) { return false; } if (!$this->db->query(filelist::sql())) { return false; } if (!$this->db->query(guestbook::sql())) { return false; } if (!$this->db->query("\n\t\t CREATE TABLE IF NOT EXISTS #__mixed (\n\t\t field VARCHAR( 255 ) NOT NULL ,\n value VARCHAR( 255 ) NULL ,\n PRIMARY KEY ( field )\n\t\t ) ENGINE = MyISAM;\n\t\t")) { return false; } if (!$this->db->query("\n\t\t CREATE TABLE IF NOT EXISTS #__searches (\n\t\t dt DATETIME,\n\t\t sname VARCHAR(50),\n\t\t sdesc VARCHAR(50),\n\t\t sfile VARCHAR(50),\n\t\t ip VARCHAR(15),\n\t\t srepo INT,\n\t\t results INT,\n\t\t duration INT\n\t\t ) ENGINE = MyISAM;\n\t ")) { return false; } $this->db->query("INSERT INTO #__mixed (field,value) value ('count_visits','1');"); $this->db->query("INSERT INTO #__mixed (field,value) value ('count_searches','1');"); $this->db->query("INSERT INTO #__mixed (field,value) value ('count_srctxt','1');"); $this->db->query("INSERT INTO #__mixed (field,value) value ('count_srcxml','1');"); return true; }
/** * Produces an array of email addresses the report should go to * * @param string $package_name the package's name * * @return array an array of email addresses */ public function getPackageMail($package_name, $bug_id = false) { global $dbh; switch ($package_name) { case 'Bug System': case 'PEPr': case 'Web Site': $arr = $this->getPackageMail('pearweb'); $arr[0] .= ', <' . PEAR_WEBMASTER_EMAIL . '>'; return array($arr[0], PEAR_WEBMASTER_EMAIL); case 'Documentation': return array('<' . PEAR_DOC_EMAIL . '>', PEAR_DOC_EMAIL); } include_once 'pear-database-package.php'; $maintainers = package::info($package_name, 'authors'); $to = array(); foreach ($maintainers as $data) { if (!$data['active']) { continue; } $to[] = '<' . $data['email'] . '>'; } /* subscription */ if ($bug_id) { $bug_id = (int) $bug_id; $assigned = $dbh->getOne('SELECT assign FROM bugdb WHERE id = ' . $bug_id); if ($assigned) { $assigned = $dbh->getOne('SELECT email FROM users WHERE handle = ?', array($assigned)); if ($assigned && !in_array($assigned, $to)) { // assigned is not a maintainer $to[] = '<' . $assigned . '>'; } } // Add the bug mailing list if any if (PEARWEB_BUGS_ML_EMAIL != '') { $to[] = '<' . PEARWEB_BUGS_ML_EMAIL . '>'; } $bcc = $dbh->getCol('SELECT email FROM bugdb_subscribe WHERE bug_id = ' . $bug_id); $bcc = array_diff($bcc, $to); $bcc = array_unique($bcc); $bcc = array_map(function ($val) { return '<' . $val . '>'; }, $bcc); return array(implode(', ', $to), PEAR_QA_EMAIL, implode(', ', $bcc)); } return array(implode(', ', $to), PEAR_QA_EMAIL); }
function __construct($package) { $this->_dbh =& $GLOBALS['dbh']; include_once 'pear-database-package.php'; $this->_info = package::info($package, 'releases'); $this->_pkgid = package::info($package, 'id'); if (is_array($this->_info) && $this->_info) { foreach ($this->_info as $ver => $release) { if (!isset($this->_lastversion)) { $this->_lastversion = $ver; $this->_laststate = $release['state']; $this->_lastid = $release['id']; } $this->_states[$release['state']] = 1; } } }
function nextRelease($package) { $sql = ' SELECT roadmap_version,releasedate FROM bugdb_roadmap WHERE package = ? AND releasedate <> "1976-09-02 17:15:30" ORDER BY releasedate ASC'; $ret = $GLOBALS['dbh']->getAll($sql, array($package)); if (!$ret) { return false; } include_once 'pear-database-package.php'; $releases = array_keys(package::info($package, 'releases')); foreach ($ret as $roadmap) { if (in_array($roadmap[0], $releases)) { continue; } return $roadmap; } }
function savePackageMaintainerREST($package) { require_once 'System.php'; global $dbh; $pid = package::info($package, 'id'); $maintainers = $dbh->getAll('SELECT * FROM maintains WHERE package = ?', array($pid), DB_FETCHMODE_ASSOC); $extra = '/rest/'; if (count($maintainers)) { $pdir = $this->_restdir . DIRECTORY_SEPARATOR . 'p'; if (!is_dir($pdir)) { System::mkdir(array('-p', $pdir)); @chmod($pdir, 0777); } if (!is_dir($pdir . DIRECTORY_SEPARATOR . strtolower($package))) { System::mkdir(array('-p', $pdir . DIRECTORY_SEPARATOR . strtolower($package))); @chmod($pdir . DIRECTORY_SEPARATOR . strtolower($package), 0777); } $info = '<?xml version="1.0" encoding="UTF-8" ?> <m xmlns="http://pear.php.net/dtd/rest.packagemaintainers" 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.packagemaintainers http://pear.php.net/dtd/rest.packagemaintainers.xsd"> <p>' . $package . '</p> <c>' . PEAR_CHANNELNAME . '</c> '; foreach ($maintainers as $maintainer) { $info .= ' <m><h>' . $maintainer['handle'] . '</h><a>' . $maintainer['active'] . '</a></m>'; } $info .= '</m>'; file_put_contents($pdir . DIRECTORY_SEPARATOR . strtolower($package) . DIRECTORY_SEPARATOR . 'maintainers.xml', $info); @chmod($pdir . DIRECTORY_SEPARATOR . strtolower($package) . DIRECTORY_SEPARATOR . 'maintainers.xml', 0666); } else { @unlink($pdir . DIRECTORY_SEPARATOR . strtolower($package) . DIRECTORY_SEPARATOR . 'maintainers.xml'); } }
function maintains($user, $pkgid, $role = 'any') { global $dbh; $package_id = package::info($pkgid, 'id'); if ($role == 'any') { return $dbh->getOne('SELECT role FROM maintains WHERE handle = ? ' . 'AND package = ?', array($user, $package_id)); } if (is_array($role)) { return $dbh->getOne('SELECT role FROM maintains WHERE handle = ? AND package = ? ' . 'AND role IN ("?")', array($user, $package_id, implode('","', $role))); } return $dbh->getOne('SELECT role FROM maintains WHERE handle = ? AND package = ? ' . 'AND role = ?', array($user, $package_id, $role)); }
<div class="container-fluide"> <ul class="breadcrumb"> <li><a href="#">Home</a></li> <li><a href="view_package.php">Packages</a></li> <li><a class="active" href="#" >Add</a></li> </ul> <div class="page-heading"> <h1>Add Package</h1> </div> <div class="form-container"> <?php $package = new package(); $ID = isset($_GET['id']) ? $_GET['id'] : NULL; if (isset($_POST['add_package'])) { // Update old record if (isset($ID)) { $results = $package->update_package($_POST, $ID); } else { // Insert new $results = $package->insert_package($_POST); } if ($results) { echo '<div class="alert alert-success" role="alert">'; echo isset($_GET['id']) ? 'Updated ' : 'Added '; echo 'package Sucessfully </div>'; } else { echo '<div class="alert alert-danger" role="alert"> Error </div>';
// 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']; } $form->addElement('select', 'newpk_id')->setLabel('Superseeded by:')->loadOptions($rows); $form->addElement('text', 'new_channel', array('maxlength' => 255, 'placeholder' => 'pear.phpunit.de'))->setLabel('Moved to channel:'); $form->addElement('text', 'new_package', array('maxlength' => 255, 'placeholder' => 'PHPUnit')); $form->addElement('submit', 'submit')->setLabel('Save Changes'); $csrf_token_value = create_csrf_token($csrf_token_name); $form->addElement('hidden', $csrf_token_name)->setValue($csrf_token_value); print $form->render($renderer); ?>
$pear_rest->saveAllMaintainersREST(); echo "done\n"; echo "Generating Package REST...\n"; $pear_rest->saveAllPackagesREST(); require_once 'Archive/Tar.php'; require_once 'PEAR/PackageFile.php'; $config =& PEAR_Config::singleton(); $pkg = new PEAR_PackageFile($config); include_once 'pear-database-package.php'; foreach (package::listAllNames() as $package) { echo " {$package}\n"; $pear_rest->savePackageREST($package); echo " Maintainers..."; $pear_rest->savePackageMaintainerREST($package); echo "...done\n"; $releases = package::info($package, 'releases'); if ($releases) { echo " Processing All Releases..."; $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)) {
$ord = 'F.filename desc'; break; case "repou": $ord = 'R.description'; break; case "repod": $ord = 'R.description desc'; break; case "locu": $ord = 'P.location'; break; case "locd": $ord = 'P.location desc'; break; } $pkg = new package(); $nres = $pkg->find($sname, $sdesc, $repo, $ord); if (isset($_GET['debug'])) { var_dump($pkg, $nres); } $to = $start + $maxresult; if ($to > $nres) { $to = $nres; } $duration = round($pkg->db->msec / 1000, 3); echo "Time: {$duration} msec<br />"; echo "Results " . ($start + 1) . "-{$to} of {$nres}: "; if ($start > 0) { echo "<a href='index.php?start=0&maxresult={$maxresult}&repo={$repo}&name={$name}&desc={$desc}&file={$file}&order={$order}#results'><<</a> "; $from = $start - $maxresult; if ($from < 0) {
/** * Updates fields of an existant package * * @param int $pkgid The package ID to update * @param array $data Assoc in the form 'field' => 'value'. * @return mixed True or PEAR_Error */ static function updateInfo($pkgid, $data) { global $dbh, $auth_user; $package_id = package::info($pkgid, 'id'); if (PEAR::isError($package_id) || empty($package_id)) { return PEAR::raiseError('Package not registered or not approved. Please register it first with "New Package" or wait until it gets approved.'); } if ($auth_user->isAdmin() === false && $auth_user->isQA() === false) { include_once 'pear-database-user.php'; $role = user::maintains($auth_user->handle, $package_id); if ($role != 'lead' && $role != 'developer') { return PEAR::raiseError('package::updateInfo: insufficient privileges'); } } // XXX (cox) what about 'name'? $allowed = array('license', 'summary', 'description', 'category'); $fields = $prep = array(); foreach ($allowed as $a) { if (isset($data[$a])) { $fields[] = "{$a} = ?"; $prep[] = $data[$a]; } } if (!count($fields)) { return; } $sql = 'UPDATE packages SET ' . implode(', ', $fields) . " WHERE id = {$package_id}"; $row = package::info($pkgid, 'name'); include_once 'pear-rest.php'; $pear_rest = new pearweb_Channel_REST_Generator(PEAR_REST_PATH, $dbh); $pear_rest->saveAllPackagesREST(); $pear_rest->savePackageREST($row); $pear_rest->savePackagesCategoryREST(package::info($pkgid, 'category')); return $dbh->query($sql, $prep); }
/** * Announce a new patch * * @param int ID of the patch * @param string Filename of the patch file * @param int ID of the package * @param string Release version * @param string email address * @param string Title of the patch * @param string Description of the patch * @return boolean */ function announce($id, $filename, $package, $release, $email, $handle, $title, $description) { $name = package::info($package, "name"); $receivers = array("martin@localhost"); // Find maintainers of the package $maintainers = package::info($package, "authors"); foreach ($maintainers as $user) { // $receivers[] = $user['email']; } $text = "New patch: http://pear.php.local/patches/details/" . $id . "\n"; return mail(implode(",", $receivers), "New patch for " . $name, $text); }
} $name = user::info($user, "name"); $channel_title = "PEAR: Latest releases for " . $user; $channel_description = "The latest releases for the PEAR developer " . $user . " (" . $name['name'] . ")"; $items = user::getRecentReleases($user); break; case 'pkg': $package = $argument; include_once 'pear-database-package.php'; if (package::isValid($package) == false) { rss_bailout(); return PEAR::raiseError("The requested URL " . $_SERVER['REQUEST_URI'] . " was not found on this server."); } $channel_title = "Latest releases of " . $package; $channel_description = "The latest releases for the package " . $package; $items = package::getRecent(10, $package); break; case 'cat': $category = $argument; include_once 'pear-database-category.php'; if (category::isValid($category) == false) { rss_bailout(); } $channel_title = "PEAR: Latest releases in category " . $category; $channel_description = "The latest releases in the category " . $category; $items = category::getRecent(10, $category); break; case 'pepr': if ($argument == 'pepr') { $channel_title = "PEPr: Latest proposals."; $channel_description = "The latest PEPr proposals.";
HTTP;HTTP;ssb;Miscellaneous HTTP utilities HTTP_Uploader;HTTP;cox;Easy and secure managment of files submitted via HTML Forms IO_Async;Networking;ssb;Backgrounded asynchronous socket IO Log;Logging;jon;Logging utilities Net_CheckIP;Networking;mj;Check the syntax of IPv4 adresses Net_IPv6;Networking;alexmerz;Class to validate and to work with IPv6 Net_NNTP;Networking;kaltroft;Communicate with an NNTP server Net_Ping;Networking;mj;Execute ping Net_Whois;Networking;sn;The PEAR::Net_Whois class provides a tool for querying Whois Servers PEAR;PEAR;ssb;PEAR base classes Science_Chemistry;Science;jmcastagnetto;Classes to manipulated chemical objects: atoms, molecules, etc. XML_fo2pdf;XML;chregu;Convert a xsl-fo file to pdf with the help of apache-fop XML_RPC;XML;ssb;A PEAR-ified version of Useful inc\'s xmlrpc implementation for PHP. XML_sql2xml;XML;chregu;Represent DB results with XML XML_Tree;XML;sebastian;Represent XML data in a tree structure '; $catmap = $dbh->getAssoc("SELECT name,id FROM categories"); foreach (explode("\n", $packages) as $line) { if (trim($line) == '') { continue; } list($name, $category, $lead, $summary) = explode(";", trim($line)); if (empty($catmap[$category])) { print "Package: {$name}: skipped - unknown category `{$category}'\n"; continue; } else { $catid = $catmap[$category]; } package::add(array('name' => $name, 'type' => 'pear', 'license' => 'PEAR License', 'description' => '', 'summary' => $summary, 'category' => $catid, 'lead' => $lead)); print "Package: {$name}\n"; }
} if ($_GET['section'] == "package") { import("models.user"); $cur = $User->get_current(); } if ($_GET['section'] == "package" && $cur->has_permission("core.administration")) { if ($_GET['action'] == "install") { import("lib.package"); $out = new textareaOutput(); if (isset($_FILES['uploadedfile']['name'])) { $_FILES['uploadedfile']['name'] = str_replace("..", "", $_FILES['uploadedfile']['name']); $target_path = '../../tmp/' . $_FILES['uploadedfile']['name']; if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { if ($res = package::install($target_path)) { $out->append("status", "success"); $out->append("compatible", package::compatible($res["compatible"])); } else { $out->append("error", "Problem installing package"); } } else { $out->append("error", "Problem accessing uploaded package"); } } else { $out->append("error", "No File Uploaded"); } } if ($_GET['action'] == "remove") { function rmdir_recurse($file) { if (is_dir($file) && !is_link($file)) { foreach (glob($file . '/*') as $sf) {
/** * Remove release * * @param integer ID of the package * @param integer ID of the release * @return boolean */ static function remove($package, $release) { global $dbh, $auth_user; include_once 'pear-database-user.php'; if (!$auth_user->isAdmin() && !$auth_user->isQA() && !user::maintains($auth_user->handle, $package, 'lead')) { return PEAR::raiseError('release::remove: insufficient privileges'); } // get files that have to be removed $sql = 'SELECT fullpath FROM files WHERE package = ? AND `release` = ?'; $sth = $dbh->query($sql, array($package, $release)); // Should we error out if the removal fails ? $success = true; while ($row = $sth->fetchRow(DB_FETCHMODE_ASSOC)) { if (!@unlink($row['fullpath'])) { $success = false; } } $sql = 'DELETE FROM files WHERE package = ? AND `release` = ?'; $sth = $dbh->query($sql, array($package, $release)); $sql = 'SELECT version from releases WHERE package = ? and id = ?'; $version = $dbh->getOne($sql, array($package, $release)); $query = 'DELETE FROM releases WHERE package = ? AND id = ?'; $sth = $dbh->query($query, array($package, $release)); // remove statistics on this release $dbh->query('DELETE FROM package_stats WHERE pid = ? AND rid = ?', array($package, $release)); $dbh->query('DELETE FROM aggregated_package_stats WHERE package_id = ? AND release_id = ?', array($package, $release)); include_once 'pear-database-package.php'; $pname = package::info($package, 'name'); include_once 'pear-rest.php'; $pear_rest = new pearweb_Channel_REST_Generator(PEAR_REST_PATH, $dbh); $pear_rest->saveAllReleasesREST($pname); $pear_rest->deleteReleaseREST($pname, $version); $pear_rest->savePackagesCategoryREST(package::info($pname, 'category')); if (PEAR::isError($sth)) { return false; } return true; }
<div class="container-fluide"> <ul class="breadcrumb"> <li><a href="#">Home</a></li> <li><a class="active" href="#">Packages</a></li> </ul> <div class="page-heading"> <h1>View Packages</h1> </div> <div class="table-responsive custom-table"> <?php $package = new package(); $results = $package->get_packages(); if ($results) { } ?> <table id="myTable"> <thead> <tr> <th>ID</th> <th>Name</th> <th>Details</th> <th></th> </tr> </thead> <tbody>
$ord = 'F.filename desc'; break; case "repou": $ord = 'R.description'; break; case "repod": $ord = 'R.description desc'; break; case "locu": $ord = 'P.location'; break; case "locd": $ord = 'P.location desc'; break; } $pkg = new package(); $xml = new xml('searcher', array('version' => '0.1')); $xml->startSection('info'); $xml->startSection('query'); $xml->setElement('field', $name, array('name' => 'name', 'description' => 'package name')); $xml->setElement('field', $desc, array('name' => 'desc', 'descriprion' => 'package description')); $xml->setElement('field', $desc, array('name' => 'file', 'descriprion' => 'file name')); $xml->endSection(); $xml->endSection(); $nres = $pkg->find($name, $desc, $repo, $ord); $xml->startSection('results', array('count' => $nres)); $to = $start + $maxresult; if ($to > $nres) { $to = $nres; } if ($start > 0) {
$dep_text .= sprintf("%s: %s %s", $dep_type_desc[$row['type']], $dep_name_html, $rel); } else { $dep_text .= sprintf("%s: %s", $dep_type_desc[$row['type']], $dep_name_html); } $dep_text .= "<br />"; } $bb->horizHeadRow($title, $dep_text); } else { $bb->horizHeadRow($title, "No dependencies registered."); } } if ($too_much && empty($version)) { $bb->fullRow("Dependencies for older releases can be found on the release overview page."); } } $bb->end(); // }}} // {{{ Dependants $dependants = package::getDependants($name); if (count($dependants) > 0) { echo "<br /><br />"; $bb = new BorderBox("Packages that depend on " . $name); foreach ($dependants as $dep) { $bb->plainRow(make_link("/package/" . $dep['p_name'], $dep['p_name'])); } $bb->end(); } // }}} // {{{ page footer response_footer(); // }}}
} if (isset($_GET['new'])) { $savant->errors = false; if (isset($_POST['go'])) { if ($_POST['releasedate'] == 'future') { // my birthday will represent the future ;) $_POST['releasedate'] = '1976-09-02 17:15:30'; } $bugdb = Bug_DataObject::bugDB('bugdb_roadmap'); $bugdb->description = $_POST['description']; $bugdb->releasedate = date('Y-m-d H:i:s', strtotime($_POST['releasedate'])); $bugdb->package = $_GET['package']; $bugdb->roadmap_version = $_POST['roadmap_version']; if (empty($_POST['roadmap_version'])) { $savant->errors = array('Roadmap version cannot be empty'); } else { $bugdb->insert(); } } if (isset($_POST['releasedate']) && $_POST['releasedate'] != 'future') { $_POST['releasedate'] = date('Y-m-d', strtotime($_POST['releasedate'])); } $savant->info = array('package' => clean($_GET['package']), 'releasedate' => isset($_POST['releasedate']) ? $_POST['releasedate'] : '', 'roadmap_version' => isset($_POST['roadmap_version']) ? clean($_POST['roadmap_version']) : '', 'description' => isset($_POST['description']) ? clean($_POST['description']) : ''); $savant->isnew = true; $savant->import = isset($_POST['importbugs']) ? true : false; $releases = package::info(clean($_GET['package']), 'releases'); $savant->lastRelease = count($releases) ? key($releases) : ''; $savant->display('roadmapform.php'); exit; } $savant->display('roadmap.php');
/** * Displays the registration form * * @param array $form_errors * @return @e void */ public function registerForm($form_errors = array()) { //----------------------------------------- // Init //----------------------------------------- $final_errors = array(); $coppa = IPSCookie::get('coppa'); $step = $this->request['step'] ? intval($this->request['step']) : 1; $this->settings['username_errormsg'] = str_replace('{chars}', $this->settings['username_characters'], $this->settings['username_errormsg']); if ($coppa == 'yes') { $this->registry->output->showError('awaiting_coppa', 10124); } $this->_resetMember(); //----------------------------------------- // COPPA swapout //----------------------------------------- if ($this->settings['use_coppa']) { $this->lang->words['confirm_over_thirteen'] = str_replace("<#FORM_LINK#>", "{$this->settings['base_url']}app=core&module=global&section=register&do=12", $this->lang->words['confirm_over_thirteen']); } //----------------------------------------- // T & C //----------------------------------------- $cache = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'core_sys_conf_settings', 'where' => "conf_key='reg_rules'")); $text = $cache['conf_value'] ? $cache['conf_value'] : $cache['conf_default']; IPSText::getTextClass('bbcode')->parse_smilies = 1; IPSText::getTextClass('bbcode')->parse_html = 1; IPSText::getTextClass('bbcode')->parse_nl2br = 1; IPSText::getTextClass('bbcode')->parse_bbcode = 1; IPSText::getTextClass('bbcode')->parsing_section = 'global'; $this->settings['_termsAndConditions'] = IPSText::getTextClass('bbcode')->preDisplayParse($text); //----------------------------------------- // Page title / navigation //----------------------------------------- $this->registry->output->setTitle($this->lang->words['registration_form'] . ' - ' . ipsRegistry::$settings['board_name']); $this->registry->output->addNavigation($this->lang->words['registration_form'], ''); //----------------------------------------- // If Nexus is installed, that is the first step //----------------------------------------- if (IPSLib::appIsInstalled('nexus') and $this->settings['nexus_reg_show'] and $this->settings['nexus_store_online']) { //----------------------------------------- // We just submitted the form //----------------------------------------- if ($this->request['nexus_pass']) { $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('nexus') . '/sources/hooks.php', 'nexusHooks', 'nexus'); $hookGateway = new $classToLoad($this->registry); //----------------------------------------- // Check for errors //----------------------------------------- if ($this->settings['nexus_reg_force'] and !IPSCookie::get('cm_reg') and empty($this->request['cm_package'])) { $nexusError = $this->lang->words['forceby_no_sel']; } } //----------------------------------------- // If no errors, create invoice and set cookie //----------------------------------------- if (!$nexusError and $this->request['nexus_pass']) { //----------------------------------------- // Did we buy a package? //----------------------------------------- $chosenPackages = ipsRegistry::$request['cm_package']; if (!empty($chosenPackages)) { foreach ($chosenPackages as $itemID) { require_once IPSLib::getAppDir('nexus') . '/sources/packageCore.php'; /*noLibHook*/ $package = package::load($itemID); $shippingData = $package->shippingData(); $renewTerm = $package->renewalTerms(); $items[] = array('act' => 'new', 'app' => 'nexus', 'type' => $package->data['p_type'], 'cost' => $package->price($this->memberData['member_id'], FALSE), 'tax' => $package->data['p_tax'], 'renew_term' => $renewTerm['term'], 'renew_units' => $renewTerm['unit'], 'renew_cost' => $renewTerm['price'], 'physical' => is_null($shippingData) ? FALSE : TRUE, 'shipping' => is_null($shippingData) ? array() : $shippingData['shipping'], 'weight' => is_null($shippingData) ? 0 : $shippingData['weight'], 'itemName' => $package->data['p_name'], 'itemID' => $package->data['p_id'], 'groupRenewals' => $package->data['p_group_renewals'], 'methods' => $package->data['p_methods'] ? explode(',', $package->data['p_methods']) : array()); } // Generate it require_once IPSLib::getAppDir('nexus') . '/sources/nexusApi.php'; /*noLibHook*/ $invoiceID = nexusApi::generateInvoice(NULL, $this->memberData['member_id'], $items); IPSCookie::set('cm_reg', $invoiceID); } } else { //----------------------------------------- // "step 1" if Nexus is set to show packages on registration //----------------------------------------- require_once IPSLib::getAppDir('nexus') . '/sources/packageCore.php'; /*noLibHook*/ $packages = array(); $this->DB->build(array('select' => '*', 'from' => 'nexus_packages', 'where' => 'p_reg=1', 'order' => 'p_position')); $e = $this->DB->execute(); while ($row = $this->DB->fetch($e)) { $packages[$row['p_id']] = package::load($row['p_id'])->buildDisplayData(); } if (!empty($packages)) { if (isset($this->request['cm_package'])) { foreach ($this->request['cm_package'] as $packageID) { $packages[$packageID]['checked'] = "checked='checked'"; } } $this->output .= $this->registry->output->getTemplate('nexus_payments')->regForm32($packages, $nexusError); return; } else { $this->settings['nexus_reg_show'] = false; } } } //----------------------------------------- // Send to an alternate registration URL? //----------------------------------------- $this->DB->build(array('select' => '*', 'from' => 'login_methods', 'where' => 'login_enabled=1')); $this->DB->execute(); while ($r = $this->DB->fetch()) { if ($r['login_register_url']) { $this->registry->output->silentRedirect($r['login_register_url']); } } //----------------------------------------- // Adjust text as needed based on validation type //----------------------------------------- if ($this->settings['reg_auth_type']) { if ($this->settings['reg_auth_type'] == 'admin_user' or $this->settings['reg_auth_type'] == 'user') { $this->lang->words['std_text'] .= "<br />" . $this->lang->words['email_validate_text']; } /* User then admin? */ if ($this->settings['reg_auth_type'] == 'admin_user') { $this->lang->words['std_text'] .= "<br />" . $this->lang->words['user_admin_validation']; } if ($this->settings['reg_auth_type'] == 'admin') { $this->lang->words['std_text'] .= "<br />" . $this->lang->words['just_admin_validation']; } } //----------------------------------------- // Captcha / Q&A //----------------------------------------- $captchaHTML = ''; $qandaHTML = ''; $question = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'question_and_answer', 'order' => $this->DB->buildRandomOrder(), 'limit' => array(1))); if ($question and count($question)) { $qandaHTML = $this->registry->output->getTemplate('global_other')->questionAndAnswer($question); } if ($this->settings['bot_antispam_type'] != 'none') { $captchaHTML = $this->registry->getClass('class_captcha')->getTemplate(); } //----------------------------------------- // Custom fields //----------------------------------------- $custom_fields_out = array('required', 'optional'); $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields'); $custom_fields = new $classToLoad(); $custom_fields->member_data = $this->memberData; $custom_fields->initData('edit', 0, array('tabindex' => 6)); $custom_fields->parseToEdit('register'); if (count($custom_fields->out_fields)) { foreach ($custom_fields->out_fields as $id => $form_element) { if ($custom_fields->cache_data[$id]['pf_not_null'] == 1) { $ftype = 'required'; } else { $ftype = 'optional'; } $custom_fields_out[$ftype][] = array('name' => $custom_fields->field_names[$id], 'desc' => $custom_fields->field_desc[$id], 'field' => $form_element, 'id' => $id, 'error' => '', 'type' => $custom_fields->cache_data[$id]['pf_type']); } } //----------------------------------------- // If Nexus is installed, also add billing information //----------------------------------------- $nexusFields = array(); $nexusStates = array(); if (IPSLib::appIsInstalled('nexus') and $this->settings['nexus_reg_show'] and $this->settings['nexus_store_online']) { ipsRegistry::getClass('class_localization')->loadLanguageFile(array('public_countries'), 'nexus'); $fields = array(); $_fields = ipsRegistry::cache()->getCache('customer_fields'); if (is_array($_fields) and count($_fields)) { foreach ($_fields['reg'] as $k) { $nexusFields[] = $_fields['fields'][$k]; } } $nexusStates = customer::generateStateDropdown(TRUE); } //----------------------------------------- // Got errors to show? //----------------------------------------- $final_errors = array('dname' => NULL, 'password' => NULL, 'email' => NULL, 'tos' => NULL); foreach (array('dname', 'password', 'email', 'tos') as $thing) { if (isset($form_errors[$thing]) and is_array($form_errors[$thing]) and count($form_errors[$thing])) { $final_errors[$thing] = implode("<br />", $form_errors[$thing]); } } $this->request['PassWord'] = $this->request['PassWord'] ? $this->request['PassWord'] : ''; $this->request['EmailAddress'] = $this->request['EmailAddress'] ? $this->request['EmailAddress'] : ''; $this->request['EmailAddress_two'] = $this->request['EmailAddress_two'] ? $this->request['EmailAddress_two'] : ''; $this->request['PassWord_Check'] = $this->request['PassWord_Check'] ? $this->request['PassWord_Check'] : ''; $this->request['members_display_name'] = $this->request['members_display_name'] ? $this->request['members_display_name'] : ''; $this->request['time_offset'] = $this->request['time_offset'] ? $this->request['time_offset'] : ''; //----------------------------------------- // Create time zone dropdown array //----------------------------------------- $this->registry->class_localization->loadLanguageFile(array('public_usercp'), 'core'); $time_select = array(); foreach ($this->lang->words as $k => $v) { if (strpos($k, "time_") === 0) { $k = str_replace("time_", '', $k); if (preg_match('/^[\\-\\d\\.]+$/', $k)) { $time_select[$k] = $v; } } } ksort($time_select); $this->request['time_offset'] = $this->request['time_offset'] ? $this->request['time_offset'] : $this->settings['time_offset']; //----------------------------------------- // Start output //----------------------------------------- $this->output .= $this->registry->output->getTemplate('register')->registerForm($form_errors['general'], array('TEXT' => $this->lang->words['std_text'], 'coppa_user' => $coppa, 'captchaHTML' => $captchaHTML, 'qandaHTML' => $qandaHTML, 'showCOPPA' => $this->settings['use_coppa'] and !(IPSLib::appIsInstalled('nexus') and $this->settings['nexus_reg_show'] and $this->settings['nexus_store_online'])), $final_errors, $time_select, $custom_fields_out, $nexusFields, $nexusStates); //----------------------------------------- // Member sync module //----------------------------------------- IPSLib::runMemberSync('onRegisterForm'); }
$stupid = false; if ($version == '1.0.0' && $info->getState() != 'stable') { $errors[] = 'Version 1.0.0 must be stable'; } if (strpos($version, 'RC') && $info->getState() != 'beta') { $errors[] = 'Release Candidate versions must have stability beta'; } if (substr($verinfo[2], 1, 2) == 'rc') { $errors[] = 'Release Candidate versions MUST use upper-case RC versioning, not rc'; } if (substr($version, 0, 4) == '0.0.') { $errors[] = 'Version 0.0.X is invalid, use 0.X.0'; } } if ($info->getState() == 'stable') { $releases = package::info($info->getPackage(), 'releases'); if (!count($releases)) { $errors[] = "The first release of a package must be 'alpha' or 'beta', not 'stable'." . " Try releasing version 1.0.0RC1, state 'beta'"; } if ($version[0] < 1) { $errors[] = "Versions < 1.0.0 may not be 'stable'"; } if (!$stupid && !strpos($version, 'RC') && !preg_match('/^\\d+\\z/', $verinfo[2])) { $errors[] = "Stable versions must not have a postfix (use 'beta' for RC postfix)"; } } $filelist = $info->getFilelist(); if (isset($filelist['package.xml'])) { $warnings[] = 'package.xml should not be present in package.xml, installation may fail'; } if (isset($filelist['package2.xml'])) {
| Authors: Martin Jansen <*****@*****.**> | +----------------------------------------------------------------------+ $Id$ */ require_once "HTML/Form.php"; response_header("PEAR Administration - Package maintainers"); if (isset($_GET['pid'])) { $id = (int) $_GET['pid']; } else { $id = 0; } $self = htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES); // Select package first if (empty($id)) { auth_require(true); $values = package::listAllNames(); $bb = new BorderBox("Select package"); $form = new HTML_Form($self); $form->addSelect("pid", "Package:", $values); $form->addSubmit(); $form->display(); $bb->end(); } else { if (!empty($_GET['update'])) { if (!isAllowed($id)) { PEAR::raiseError("Only the lead maintainer of the package or PEAR\n administrators can edit the maintainers."); response_footer(); exit; } $all = maintainer::get($id); // Transform
case 'Stale': $where_clause .= ' AND bugdb.status NOT IN' . " ('Closed', 'Duplicate', 'Bogus')" . ' AND TO_DAYS(NOW())-TO_DAYS(bugdb.ts2) > 30'; break; case 'Not Assigned': $where_clause .= ' AND bugdb.status NOT IN' . " ('Closed', 'Duplicate', 'Bogus', 'Assigned'," . " 'Wont Fix', 'Suspended')"; break; // Closed Reports Since Last Release // Closed Reports Since Last Release case 'CRSLR': if (!isset($_GET['package_name']) || count($_GET['package_name']) > 1) { // Act as ALL break; } // Fetch the last release date include_once 'pear-database-package.php'; $releaseDate = package::getRecent(1, $_GET['package_name'][0]); if (PEAR::isError($releaseDate)) { break; } $where_clause .= ' AND bugdb.status IN' . " ('Closed', 'Duplicate', 'Bogus', 'Wont Fix', 'Suspended')\n AND (UNIX_TIMESTAMP('" . $releaseDate[0]['releasedate'] . "') < UNIX_TIMESTAMP(bugdb.ts2))\n "; break; case 'Open': default: $where_clause .= " AND bugdb.status IN ('Open', 'Assigned'," . " 'Analyzed', 'Critical', 'Verified')"; case 'OpenFeedback': default: $where_clause .= " AND bugdb.status IN ('Open', 'Assigned'," . " 'Analyzed', 'Critical', 'Verified', 'Feedback')"; } if (empty($_GET['search_for'])) { $search_for = ''; } else {
/** * Konstruktor * @param string $key Package-Key * @param string $version Package-Version * @param string $type Package-Type * @param string $signature Package-Signature */ public function __construct($type, $key, $version = '', $signature = '') { parent::__construct('module', $key, $version, $signature); }
WHERE p.id = r.package AND r.package = ?'; $row = $dbh->getAll($query, array($id)); foreach ($row as $value) { $file = sprintf("%s/%s-%s.tgz", PEAR_TARBALL_DIR, $value[0], $value[1]); if (@unlink($file)) { echo "Deleting release archive \"" . $file . "\"\n"; $file_rm++; } else { echo "<font color=\"#ff0000\">Unable to delete file " . $file . "</font>\n"; } } echo "\n" . $file_rm . " file(s) deleted\n\n"; $catid = package::info($id, 'categoryid'); $packagename = package::info($id, 'name'); $dbh->query("UPDATE categories SET npackages = npackages - 1 WHERE id = {$catid}"); foreach ($tables as $table => $field) { $query = sprintf("DELETE FROM %s WHERE %s = '%s'", $table, $field, $id); echo "Removing package information from table \"" . $table . "\": "; $dbh->query($query); echo "<b>" . $dbh->affectedRows() . "</b> rows affected.\n"; } include_once 'pear-rest.php'; $pear_rest = new pearweb_Channel_REST_Generator(PEAR_REST_PATH, $dbh); $pear_rest->deletePackageREST($packagename); echo "</pre>\nPackage " . $id . " has been deleted.\n"; } else { $pkg = package::info($id); print_package_navigation($id, $pkg['name'], '/package-delete.php?id=' . $id); echo "The package has not been deleted.\n<br /><br />\n"; } response_footer();
<?php echo '<strong>Release date:</strong> ' . format_date(strtotime($info['releasedate'])) . '<br />'; echo '<strong>Release state:</strong> '; echo '<span class="' . htmlspecialchars($info['state']) . '">' . htmlspecialchars($info['state']) . '</span><br /><br />'; echo '<strong>Changelog:</strong><br /><br />' . nl2br(make_ticket_links(htmlspecialchars($info['releasenotes']), '/bugs/')) . '<br /><br />'; if (!empty($info['deps']) && count($info['deps']) > 0) { echo '<strong>Dependencies:</strong>'; $rel_trans = array('lt' => 'older than %s', 'le' => 'version %s or older', 'eq' => 'version %s', 'ne' => 'any version but %s', 'gt' => 'newer than %s', 'ge' => '%s or newer'); $dep_type_desc = array('pkg' => 'PEAR Package', 'ext' => 'PHP Extension', 'php' => 'PHP Version', 'prog' => 'Program', 'ldlib' => 'Development Library', 'rtlib' => 'Runtime Library', 'os' => 'Operating System', 'websrv' => 'Web Server', 'sapi' => 'SAPI Backend'); $dep_text = ''; foreach ($info['deps'] as $dependency) { // Print link if it's a PEAR package and it's in the db if ($dependency['type'] == 'pkg') { $dep_pkg = package::info($dependency['name']); if (!empty($dep_pkg['name']) && ($dep_pkg['package_type'] = 'pear')) { $dependency['name'] = package::makeLink($dependency['name']); } } if (isset($rel_trans[$dependency['relation']])) { $rel = sprintf($rel_trans[$dependency['relation']], $dependency['version']); $dep_text .= sprintf("<li>%s: %s %s", $dep_type_desc[$dependency['type']], $dependency['name'], $rel); } else { $dep_text .= sprintf("<li>%s: %s", $dep_type_desc[$dependency['type']], $dependency['name']); } if ($dependency['optional'] == 1) { $dep_text .= ' (optional)'; } if ($dependency['relation'] == 'not') { $dep_text .= ' (conflicts with some versions)'; } $dep_text .= '</li>';
} elseif (!empty($_GET['reject'])) { $query = "DELETE FROM packages WHERE approved = 0 AND id = " . (int) $_GET['reject']; $id = $_GET['reject']; $action = "rejected"; } $res = $dbh->query($query); if (!PEAR::isError($res) && $dbh->affectedRows() > 0) { $sql = 'SELECT * FROM packages WHERE id = ?'; $row = $dbh->getRow($sql, array($id), DB_FETCHMODE_ASSOC); if ($action == 'approved') { include_once 'pear-rest.php'; $pear_rest = new pearweb_Channel_REST_Generator(PEAR_REST_PATH, $dbh); $pear_rest->savePackageREST($row['name']); $pear_rest->saveAllPackagesREST(); include_once 'pear-database-package.php'; $pear_rest->savePackagesCategoryREST(package::info($row['name'], 'category')); } // {{{ Logging mechanism require_once "Damblan/Log.php"; require_once "Damblan/Log/Mail.php"; $logger = new Damblan_Log(); $observer = new Damblan_Log_Mail(); $observer->setRecipients(PEAR_GROUP_EMAIL); $observer->setHeader("In-Reply-To", "<approve-request-" . $row['id'] . "@" . PEAR_CHANNELNAME . ">"); $observer->setHeader("Subject", "[" . SITE_BIG . " Group] Package " . $row['name'] . " has been " . $action); $logger->attach($observer); $logger->log($auth_user->handle . " " . $action . " " . $row['name']); // }}} if (!DEVBOX) { $mailtext = 'Your package "' . $row['name'] . '" has been ' . $action . ' by the PEAR Group.'; $mailtext = wordwrap($mailtext, 72);
public function savePackageMaintainerREST($package) { include_once 'pear-database-package.php'; $pid = package::info($package, 'id'); $maintainers = $this->db->getAll('SELECT handle, active, role FROM maintains WHERE package = ?', array($pid), DB_FETCHMODE_ASSOC); $dir = $this->getPackageDirectory() . strtolower($package) . DIRECTORY_SEPARATOR; if (count($maintainers)) { $info2 = '<?xml version="1.0" encoding="UTF-8" ?> <m xmlns="http://pear.php.net/dtd/rest.packagemaintainers2" 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.packagemaintainers2 http://pear.php.net/dtd/rest.packagemaintainers2.xsd"> '; $info = '<?xml version="1.0" encoding="UTF-8" ?> <m xmlns="http://pear.php.net/dtd/rest.packagemaintainers" 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.packagemaintainers http://pear.php.net/dtd/rest.packagemaintainers.xsd"> '; $info .= ' <p>' . $package . '</p> <c>' . $this->channel . '</c> '; $info2 .= ' <p>' . $package . '</p> <c>' . $this->channel . '</c> '; foreach ($maintainers as $maintainer) { $info .= ' <m><h>' . $maintainer['handle'] . '</h><a>' . $maintainer['active'] . '</a></m>' . "\n"; $info2 .= ' <m><h>' . $maintainer['handle'] . '</h><a>' . $maintainer['active'] . '</a><r>' . $maintainer['role'] . '</r></m>' . "\n"; } $info .= '</m>'; $info2 .= '</m>'; if (!is_dir($dir)) { if (!mkdir($dir, 0777, true)) { return PEAR::raiseError('Creating directory ' . $dir . ' failed - Check the permissions'); } @chmod($dir, 0777); } if (!file_put_contents($dir . 'maintainers.xml', $info)) { return PEAR::raiseError('Writing file ' . $dir . 'maintainers.xml failed - Check the permissions'); } @chmod($dir . 'maintainers.xml', 0666); if (!file_put_contents($dir . 'maintainers2.xml', $info2)) { return PEAR::raiseError('Writing file ' . $dir . 'maintainers2.xml failed - Check the permissions'); } @chmod($dir . 'maintainers2.xml', 0666); } else { @unlink($dir . 'maintainers.xml'); @unlink($dir . 'maintainers2.xml'); } }
/** * handle and compose the email content and parameters * * @param none * @return none */ private function handleMail () { if (count( $this->fileData['envelope_to'] ) > 0) { if (array_key_exists('MESS_ENGINE',$this->config)) { switch ($this->config['MESS_ENGINE']) { case 'MAIL': case 'PHPMAILER': G::LoadThirdParty( 'phpmailer', 'class.phpmailer' ); switch ($this->config['MESS_ENGINE']) { case 'MAIL': $oPHPMailer = new PHPMailer(); $oPHPMailer->Mailer = 'mail'; break; case 'PHPMAILER': $oPHPMailer = new PHPMailer( true ); $oPHPMailer->Mailer = 'smtp'; break; } $oPHPMailer->SMTPAuth = (isset( $this->config['SMTPAuth'] ) ? $this->config['SMTPAuth'] : ''); switch ($this->config['MESS_ENGINE']) { case 'MAIL': break; case 'PHPMAILER': //Posible Options for SMTPSecure are: "", "ssl" or "tls" if (isset( $this->config['SMTPSecure'] ) && preg_match( '/^(ssl|tls)$/', $this->config['SMTPSecure'] )) { $oPHPMailer->SMTPSecure = $this->config['SMTPSecure']; } break; } $oPHPMailer->CharSet = "UTF-8"; $oPHPMailer->Encoding = "8bit"; $oPHPMailer->Host = $this->config['MESS_SERVER']; $oPHPMailer->Port = $this->config['MESS_PORT']; $oPHPMailer->Username = $this->config['MESS_ACCOUNT']; $oPHPMailer->Password = $this->config['MESS_PASSWORD']; $oPHPMailer->From = $this->fileData['from_email']; $oPHPMailer->FromName = utf8_decode( $this->fileData['from_name'] ); if (isset($this->fileData['reply_to'])) { if ($this->fileData['reply_to'] != '') { $oPHPMailer->AddReplyTo($this->fileData['reply_to'], $this->fileData['reply_to_name']); } } $msSubject = $this->fileData['subject']; if (! (mb_detect_encoding( $msSubject, "UTF-8" ) == "UTF-8")) { $msSubject = utf8_encode( $msSubject ); } $oPHPMailer->Subject = $msSubject; $msBody = $this->fileData['body']; if (! (mb_detect_encoding( $msBody, "UTF-8" ) == "UTF-8")) { $msBody = utf8_encode( $msBody ); } $oPHPMailer->Body = $msBody; $attachment = @unserialize($this->fileData['attachments']); if ($attachment === false) { $attachment = $this->fileData['attachments']; } if (is_array($attachment)) { foreach ($attachment as $key => $fileAttach) { if (file_exists( $fileAttach )) { $oPHPMailer->AddAttachment( $fileAttach, is_int( $key ) ? '' : $key ); } } } foreach ($this->fileData['envelope_to'] as $sEmail) { if (strpos( $sEmail, '<' ) !== false) { preg_match( $this->longMailEreg, $sEmail, $matches ); $sTo = trim( $matches[3] ); $sToName = trim( $matches[1] ); $oPHPMailer->AddAddress( $sTo, $sToName ); } else { $oPHPMailer->AddAddress( $sEmail ); } } //CC foreach ($this->fileData['envelope_cc'] as $sEmail) { if (strpos( $sEmail, '<' ) !== false) { preg_match( $this->longMailEreg, $sEmail, $matches ); $sTo = trim( $matches[3] ); $sToName = trim( $matches[1] ); $oPHPMailer->AddCC( $sTo, $sToName ); } else { $oPHPMailer->AddCC( $sEmail ); } } //BCC foreach ($this->fileData['envelope_bcc'] as $sEmail) { if (strpos( $sEmail, '<' ) !== false) { preg_match( $this->longMailEreg, $sEmail, $matches ); $sTo = trim( $matches[3] ); $sToName = trim( $matches[1] ); $oPHPMailer->AddBCC( $sTo, $sToName ); } else { $oPHPMailer->AddBCC( $sEmail ); } } $oPHPMailer->IsHTML($this->fileData["contentTypeIsHtml"]); if ( $this->config['MESS_ENGINE'] == 'MAIL') { $oPHPMailer->WordWrap = 300; } if ($oPHPMailer->Send()) { $this->error = ''; $this->status = 'sent'; } else { $this->error = $oPHPMailer->ErrorInfo; $this->status = 'failed'; } break; case 'OPENMAIL': G::LoadClass( 'package' ); G::LoadClass( 'smtp' ); $pack = new package( $this->fileData ); $header = $pack->returnHeader(); $body = $pack->returnBody(); $send = new smtp(); $send->setServer( $this->config['MESS_SERVER'] ); $send->setPort( $this->config['MESS_PORT'] ); $send->setUsername( $this->config['MESS_ACCOUNT'] ); $passwd = $this->config['MESS_PASSWORD']; $passwdDec = G::decrypt( $passwd, 'EMAILENCRYPT' ); $auxPass = explode( 'hash:', $passwdDec ); if (count( $auxPass ) > 1) { if (count( $auxPass ) == 2) { $passwd = $auxPass[1]; } else { array_shift( $auxPass ); $passwd = implode( '', $auxPass ); } } $this->config['MESS_PASSWORD'] = $passwd; $send->setPassword( $this->config['MESS_PASSWORD'] ); $send->setReturnPath( $this->fileData['from_email'] ); $send->setHeaders( $header ); $send->setBody( $body ); $send->setEnvelopeTo( $this->fileData['envelope_to'] ); if ($send->sendMessage()) { $this->error = ''; $this->status = 'sent'; } else { $this->error = implode( ', ', $send->returnErrors() ); $this->status = 'failed'; } break; } } } }