Ejemplo n.º 1
0
 function __construct($username)
 {
     $this->_username = $username;
     log_error("Initalizing DB connecion!");
     try {
         if (!MYSQL_ENABLE) {
             $path = explode('/', $_SERVER['SCRIPT_FILENAME']);
             $db_name = 'weave_db';
             array_pop($path);
             array_push($path, $db_name);
             $db_name = implode('/', $path);
             if (!file_exists($db_name)) {
                 report_error("The required sqllite database is not present! {$db_name}");
             }
             log_error("Starting SQLite connection");
             $this->_dbh = new PDO('sqlite:' . $db_name);
             $this->_dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         } else {
             if (MYSQL_ENABLE) {
                 log_error("Starting MySQL connection");
                 $this->_dbh = new PDO("mysql:host=" . MYSQL_HOST . ";dbname=" . MYSQL_DB, MYSQL_USER, MYSQL_PASSWORD);
             }
         }
     } catch (PDOException $exception) {
         log_error("database unavailable " . $exception->getMessage());
         throw new Exception("Database unavailable " . $exception->getMessage(), 503);
     }
 }
Ejemplo n.º 2
0
function assert_die($param, $message, $strict = true)
{
    if ($strict) {
        if ($param === FALSE) {
            report_error($message);
        }
    } else {
        if (!$param) {
            report_error($message);
        }
    }
}
Ejemplo n.º 3
0
 function show_exception($exception)
 {
     if (!is_null($CI =& get_instance())) {
         $message = $exception->getMessage();
         if (empty($message)) {
             $message = '(null)';
         }
         $error_data['exception'] = $exception;
         $error_data['message'] = $message;
         $CI->load->helper('email');
         report_error('error_exception', $error_data);
     }
     return parent::show_exception($exception);
 }
Ejemplo n.º 4
0
function has_registered_responses($player_id, $clue_id_array)
{
    /* Returns the number of registered responses for the
       given player to clues in $clue_id_array. */
    $query_template = "SELECT COUNT(*) FROM player_responses\n        WHERE player_id = ? AND clue_id IN (%s)";
    $tuple_text = implode(',', $clue_id_array);
    $query = sprintf($query_template, $tuple_text);
    $count = 0;
    $stmt = $mysqli->prepare($query);
    if (!$stmt) {
        report_error(sprintf("Could not prepare user response " . "selection statement (error %d)", $mysqli->errno));
    }
    $stmt->bind_param('i', $player_id);
    $stmt->execute();
    $stmt->bind_result($count);
    $stmt->fetch();
    $stmt->close();
    return $count;
}
Ejemplo n.º 5
0
$obsoletedby = $patchinfo->getObsoletingPatches($bug, $patch, $revision);
$obsoletes = $patchinfo->getObsoletePatches($bug, $patch, $revision);
$patches = $patchinfo->listPatches($bug);
$revisions = $patchinfo->listRevisions($bug, $patch);
$canpatch = auth_check('pear.bug') || auth_check('pear.dev');
response_header('Bug #' . clean($bug) . ' :: Patches');
if (isset($_GET['diff']) && $_GET['diff'] && isset($_GET['old']) && is_numeric($_GET['old'])) {
    /**
     * Display patch diff
     */
    $diffoldrev = (int) $_GET['old'];
    $old = $patchinfo->getPatchFullpath($bug_id, $patch, $diffoldrev);
    $new = $path;
    if (!realpath($old) || !realpath($new)) {
        response_header('Error :: Cannot retrieve patch');
        report_error('Internal error: Invalid patch revision specified for diff');
        response_footer();
        exit;
    }
    require_once 'Horde/Text/Diff.php';
    require_once 'bugs/Diff/pearweb.php';
    assert_options(ASSERT_WARNING, 0);
    $d = new Horde_Text_Diff('auto', array($orig = file($old), $now = file($new)));
    $diff = new Horde_Text_Diff_Renderer_pearweb();
    include PEARWEB_TEMPLATEDIR . '/bugs/patchinfo.php';
    include PEARWEB_TEMPLATEDIR . '/bugs/patchdiff.php';
    response_footer();
    exit;
}
/**
 * Display patch alone
Ejemplo n.º 6
0
  <li>The list of modules you compiled PHP with (your configure line).</li>
  <li>Any other information unique or specific to your setup.</li>
  <li>
     Any changes made in your php.ini compared to php.ini-dist
     (<strong>not</strong> your whole php.ini!)
  </li>
  <li>
     A <a href="http://bugs.php.net/bugs-generating-backtrace.php">gdb backtrace</a>.
  </li>
 </ul>
</p>

<?php 
}
//no post set
report_error($errors);
$action = 'report.php?package=' . $clean_package;
?>
<form method="post" action="<?php 
echo $action;
?>
" name="bugreport" id="bugreport">
<table class="form-holder" cellspacing="1">
 <tr>
  <th class="form-label_left">
<?php 
if (isset($auth_user)) {
    ?>
   Your handle:
  </th>
  <td class="form-input">
Ejemplo n.º 7
0
                    report_error('Missing package ID!');
                    break;
                }
                include_once 'pear-database-release.php';
                if (release::remove($_GET['id'], $_GET['release'])) {
                    echo "<b>Release successfully deleted.</b><br /><br />\n";
                } else {
                    report_error('An error occured while deleting the release!');
                }
                break;
        }
    }
}
$row = package::info((int) $_GET['id']);
if (empty($row['name'])) {
    report_error('Illegal package id');
    response_footer();
    exit;
}
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:');
Ejemplo n.º 8
0
                    }
                    if (!isset($rv[GESHI_AFTER])) {
                        report_error(TYPE_WARNING, "Language file contains no GESHI_AFTER entry in extended regular expression at \$language_data['REGEXPS'][{$rk}]!");
                    } elseif (!is_string($rv[GESHI_AFTER])) {
                        report_error(TYPE_ERROR, "Language file contains a GESHI_AFTER entry in extended regular expression at \$language_data['REGEXPS'][{$rk}] which is not a string!");
                    }
                } else {
                    report_error(TYPE_WARNING, "Language file contains an non-string and non-array entry at \$language_data['REGEXPS'][{$rk}]!");
                }
                if (!isset($language_data['STYLES']['REGEXPS'][$rk])) {
                    report_error(TYPE_WARNING, "Language file contains no \$language_data['STYLES']['REGEXPS'] specification for regexp group {$rk}!");
                }
            }
            foreach ($language_data['STYLES']['REGEXPS'] as $rk => $rv) {
                if (!isset($language_data['REGEXPS'][$rk])) {
                    report_error(TYPE_NOTICE, "Language file contains an superfluous \$language_data['STYLES']['REGEXPS'] specification for regexp key {$rk}!");
                }
            }
        }
        output_error_cache();
        flush();
        if ($error_abort) {
            break;
        }
    }
}
$time_end = explode(' ', microtime());
$time_diff = $time_end[0] + $time_end[1] - $time_start[0] - $time_start[1];
if (PHP_SAPI != 'cli') {
    ?>
</li>
Ejemplo n.º 9
0
                    bugdb.id = r.id AND
                    r.roadmap_id = ? AND
                    bugdb.bug_type = "Feature/Change Request" AND
                    bugdb.status = "Closed"', array($allroadmaps->id));
        }
    }
    $savant->roadmap[] = $allroadmaps->toArray();
}
usort($savant->roadmap, 'sort_roadmaps');
$savant->package = $_GET['package'];
if (isset($_GET['edit'])) {
    $bugdb = Bug_DataObject::bugDB('bugdb_roadmap');
    $bugdb->id = $_GET['edit'];
    if (!$bugdb->find(true)) {
        response_header('Error :: no such roadmap');
        report_error('Unknown roadmap "' . clean($_GET['edit']));
        response_footer();
        exit;
    }
    $savant->info = $bugdb->toArray();
    $savant->isnew = false;
    $savant->errors = false;
    $savant->display('roadmapform.php');
    exit;
}
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';
Ejemplo n.º 10
0
     report_error('Invalid token.');
     response_footer();
     exit;
 }
 // Got a new maintainer?
 if (isset($_POST['handle']['new']) && !empty($_POST['handle']['new'])) {
     $new = strip_tags($_POST['handle']['new']);
     include_once 'pear-database-user.php';
     if (!ereg('^[0-9a-z_]{2,20}$', $new)) {
         report_error('Invalid handle: ' . $new);
     } elseif (!user::exists($new)) {
         report_error($new . ' does not exist.');
     } else {
         $role = $_POST['role']['new'];
         if (!maintainer::isValidRole($role)) {
             report_error('Invalid role.');
         } else {
             if (maintainer::add($pid, $new, $role)) {
                 $message = 'Maintainer ' . $new . 'sucessfully added.';
                 $maintainers[$new] = array('role' => $role, 'active' => 1);
             }
         }
     }
 } else {
     $new = '';
 }
 // Role, active, and marked for removal
 $roles = $_POST['role'];
 if (isset($_POST['active'])) {
     $active = $_POST['active'];
 } else {
Ejemplo n.º 11
0
 function get_id($item_id)
 {
     $item = $this->get('items', array('id' => $item_id));
     if ($item->num_rows()) {
         $i = $item->row();
         $el = $this->get($i->type . 's', array('item_id' => $item_id));
         if ($el->num_rows()) {
             return $el->row()->id;
         } else {
             report_error('Not a valid element: ' . $i->type);
         }
     } else {
         report_error("No Item");
     }
 }
Ejemplo n.º 12
0
        if ($request->find($salt) && $request->pending()) {
            $email = $request->email;
            $user = $name = '';
            $errors = array();
            include PEARWEB_TEMPLATEDIR . '/bugs/registernewaccount.php';
            response_footer();
            exit;
        } else {
            report_error('Unknown salt');
        }
    } else {
        report_error('Unknown salt');
    }
} else {
    echo '<h1>Confirm Account</h1>';
    if (empty($stripped['salt']) || strlen($salt = htmlspecialchars($stripped['salt'])) != 32) {
        report_error('Unknown salt');
    } else {
        $request = new PEAR_Election_Accountrequest();
        $result = $request->confirmRequest($salt);
        if (PEAR::isError($result)) {
            report_error($result->getMessage());
        } elseif ($result) {
            report_success('Your account has been activated, you can now vote in
        PEAR elections that are for the general PHP public as well as open bugs in the bug tracker');
        } else {
            report_error('There was a problem activating your account, please contact ' . PEAR_WEBMASTER_EMAIL);
        }
    }
}
response_footer();
Ejemplo n.º 13
0
/**
 * Generates a complete PEAR web page with an error message in it then
 * calls exit
 *
 * For use with PEAR_ERROR_CALLBACK error handling mode to print fatal
 * errors and die.
 *
 * @param string|array|PEAR_Error $in  see report_error() for more info
 * @param string $title  string to be put above the message
 *
 * @return void
 *
 * @see report_error()
 */
function error_handler($errobj, $title = 'Error')
{
    response_header($title);
    report_error($errobj);
    response_footer();
    error_log('pearweb errorhandler: ' . get_detail_error_msg($errobj), 0);
    exit;
}
Ejemplo n.º 14
0
 * @category  pearweb
 * @package   PEPr
 * @author    Tobias Schlitt <*****@*****.**>
 * @author    Daniel Convissor <*****@*****.**>
 * @copyright Copyright (c) 1997-2005 The PHP Group
 * @license   http://www.php.net/license/3_0.txt  PHP License
 * @version   $Id$
 */
/**
 * Obtain the common functions and classes.
 */
require_once 'pepr/pepr.php';
if (!($proposal = proposal::get($dbh, (int) @$_GET['id']))) {
    response_header('PEPr :: Comments :: Invalid Request');
    echo "<h1>Comments for</h1>\n";
    report_error('The requested proposal does not exist.');
    response_footer();
    exit;
}
$id = $proposal->id;
response_header('PEPr :: Comments :: ' . htmlspecialchars($proposal->pkg_name));
echo '<h1>Comments for &quot;' . htmlspecialchars($proposal->pkg_name) . "&quot;</h1>\n";
display_pepr_nav($proposal);
if ($auth_user && $proposal->getStatus() == 'proposal') {
    include_once 'HTML/QuickForm2.php';
    $form = new HTML_QuickForm2('comment', 'post', array('action' => 'pepr-comments-show.php?id=' . $id));
    $form->removeAttribute('name');
    $c = $form->addElement('textarea', 'comment', array('cols' => 70, 'rows' => 20, 'required' => 'required', 'placeholder' => 'Hi. Can I politely suggest that...', 'id' => 'comment_field'))->setLabel('Comments:');
    $form->addElement('submit', 'submit');
    $c->addFilter('trim');
    $c->addRule('required', 'A comment is required');
Ejemplo n.º 15
0
<?php

try {
    $pdo = new PDO("mysql:dbname=test;host=localhost", "dbuser", "dbpassword");
} catch (PDOException $e) {
    //(1)
    report_error($e->getMessage());
    return;
}
$sql = "SELECT bug_id, summary, date_reported FROM Bugs\n    WHERE assigned_to = ? AND status = ?";
if (($stmt = $pdo->prepare($sql)) === false) {
    //(2)
    $error = $pdo->errorInfo();
    report_error($error[2]);
    return;
}
if ($stmt->execute(array(1, "OPEN")) === false) {
    //(3)
    $error = $stmt->errorInfo();
    report_error($error[2]);
    return;
}
if (($bug = $stmt->fetch()) === false) {
    //(4)
    $error = $stmt->errorInfo();
    report_error($error[2]);
    return;
}
Ejemplo n.º 16
0
function auth_require()
{
    global $auth_user;
    $res = true;
    $user = @$_COOKIE['PEAR_USER'];
    $passwd = @$_COOKIE['PEAR_PW'];
    if (!auth_verify($user, $passwd)) {
        auth_reject();
        // exits
    }
    $num = func_num_args();
    for ($i = 0; $i < $num; $i++) {
        $arg = func_get_arg($i);
        $res = auth_check($arg);
        if ($res === true) {
            return true;
        }
    }
    if ($res === false) {
        response_header("Insufficient Privileges");
        report_error("Insufficient Privileges");
        response_footer();
        exit;
    }
    return true;
}
Ejemplo n.º 17
0
                require_once $html2pdf;
                ob_start();
            }
        } else {
            require_once $html2pdf;
            ob_start();
        }
    }
}
PFLoadCalendar();
$now = date("Y-m-d H:i:s", time() + $mosConfig_offset * 60 * 60);
$form_query = "SELECT * FROM #__performs WHERE id='{$formId}' AND published='1'" . "\n AND ( start_date = '0000-00-00 00:00:00' OR start_date <= '{$now}'  )" . "\n AND ( finish_date = '0000-00-00 00:00:00' OR finish_date >= '{$now}' )";
$database->setQuery($form_query);
$form_data = null;
if (!$database->loadObject($form_data)) {
    report_error(23, PF_ERROR_23, PF_ERROR_23_COMMENTA . " <b>{$formId}</b> " . PF_ERROR_23_COMMENTB . "<div>Joomla  Version: " . (isJ15() ? "J15" : (isJ10() ? "J10" : "Not Happening")));
    die(NO_FORM_FOUND);
}
if (empty($myArrFields)) {
    $myArrFields = makeArray($formId, $form_data->includeSubmit, $form_data->submitLabel, $form_data->includeReset, $form_data->resetLabel);
}
$objMyForm = new phpform($form_data->title, $myArrFields);
$objMyForm->strAction = $_SERVER['REQUEST_URI'];
$theme = "performs";
if (!empty($form_data->theme)) {
    $theme = substr($form_data->theme, 0, strpos($form_data->theme, '.'));
}
$objMyForm->strSkin = $mosConfig_absolute_path . "/components/com_performs/skins/{$theme}/tpl_form.html";
if ($form_data->use_securityimages == 1 && $my->id == 0) {
    //		$objMyForm->use_securityimages = true;
    $objMyForm->use_securityimages = file_exists($mosConfig_absolute_path . "/components/com_securityimages");
Ejemplo n.º 18
0
/**
 * Generates a complete PEAR web page with an error message in it then
 * calls exit
 *
 * For use with PEAR_ERROR_CALLBACK error handling mode to print fatal
 * errors and die.
 *
 * @param string|array|PEAR_Error $in  see report_error() for more info
 * @param string $title  string to be put above the message
 *
 * @return void
 *
 * @see report_error()
 */
function error_handler($errobj, $title = 'Error')
{
    response_header($title);
    report_error($errobj);
    response_footer();
    exit;
}
Ejemplo n.º 19
0
function _PHP_FUNC_cond($obj)
{
    global $symnil, $listnil;
    $ret = $symnil;
    for ($i = 1; $i < sizeof($obj); $i++) {
        $clause = $obj[$i];
        // something like ((equal x 1)(do something)...)
        if (!is_array($clause)) {
            report_error('cond expected a list clause');
        }
        $test = _LISP_evalobject($clause[0]);
        if ($test != $symnil && $test != $listnil) {
            for ($j = 1; $j < sizeof($clause); $j++) {
                $ret = _LISP_evalobject($clause[$j]);
            }
            break;
        }
    }
    return $ret;
}
Ejemplo n.º 20
0
if (!$revision || !$patch || !$id) {
    header('HTTP/1.0 400 Bad Request');
    header('Content-Type: text/plain');
    response_header('Error :: File does not exist');
    report_error('Please specify id, patch and revision');
    response_footer();
    exit;
}
require_once 'bugs/patchtracker.php';
$pt = new Bugs_Patchtracker();
if (!$pt->isPatchValid($id, $patch, $revision)) {
    header('HTTP/1.0 404 Not Found');
    response_header('Error :: Patch not found');
    report_error('Patch or revision does not exist');
    response_footer();
    exit;
}
$path = $pt->getPatchFullpath($id, $patch, $revision);
if (!file_exists($path)) {
    header('HTTP/1.0 404 Not Found');
    response_header('Error :: File does not exist');
    report_error('File does not exist on server');
    response_footer();
    exit;
}
require_once 'HTTP.php';
header('Last-modified: ' . HTTP::date(filemtime($path)));
header('Content-type: application/octet-stream');
header('Content-disposition: attachment; filename="' . $patch . '.patch.txt"');
header('Content-length: ' . filesize($path));
readfile($path);
Ejemplo n.º 21
0
    report_error('No package ID specified.');
    response_footer();
    exit;
}
$id = (int) $_GET['id'];
include_once 'pear-database-package.php';
if (!isset($_POST['confirm'])) {
    $pkg = package::info($id);
    print_package_navigation($id, $pkg['name'], '/package-delete.php?id=' . $id);
    echo '<form action="' . 'package-delete.php?id=' . htmlspecialchars($id) . '" method="post">';
    echo '<table class="form-holder" style="margin-bottom: 2em;" cellspacing="1">';
    echo '<caption class="form-caption">Confirm</caption>';
    echo '<tr><td class="form-input">';
    echo 'Are you sure that you want to delete the package?' . "</td></tr>\n";
    echo '<tr><td class="form-input">';
    report_error('Deleting the package will remove all package information' . ' and all releases!', 'warnings', 'WARNING:');
    echo "</td></tr>\n";
    echo '<td class="form-input">';
    echo '<input type="submit" value="yes" name="confirm" />';
    echo '&nbsp;';
    echo '<input type="submit" value="no" name="confirm" />';
    echo "</td></tr>\n";
    echo "</table>";
    echo '<input type="hidden" value="' . create_csrf_token($csrf_token_name) . '" name="' . $csrf_token_name . '" />';
    echo "</form>";
} elseif ($_POST['confirm'] == 'yes' && validate_csrf_token($csrf_token_name)) {
    // XXX: Implement backup functionality
    // make_backup($id);
    $tables = array('releases' => 'package', 'maintains' => 'package', 'deps' => 'package', 'files' => 'package', 'packages' => 'id');
    echo "<pre>\n";
    $file_rm = 0;
Ejemplo n.º 22
0
function validate_cookie($cookie)
{
    global $dict_db;
    $query = "SELECT cookie, disabled_p FROM cookies WHERE cookie='{$cookie}';";
    $row = $dict_db->get_row($query);
    if ($row) {
        if ($row->disabled_p == "t") {
            report_error(ERR_COOKIE_DISABLED);
        }
    } else {
        report_error(ERR_COOKIE_UNKNOWN);
    }
    # everything went fine so the cookie is ok
}
Ejemplo n.º 23
0
            if (!$stmt->fetch()) {
                $report .= sprintf(<<<STR
Check post #%d by %s--%s is not a registered player.

STR
, $current_post, $author, $author);
                $stmt->close();
                continue;
            }
            $stmt->close();
            /*printf('<p style="background-color: #CCCCFF">%s</p>',
              $posttext);*/
            $query = sprintf("SELECT COUNT(*) FROM player_responses\n                WHERE player_id = ? AND clue_id IN\n                ('%d', '%d', '%d', '%d', '%d',\n                '%d', '%d', '%d', '%d', '%d')", $clue_ids[1][2], $clue_ids[1][4], $clue_ids[1][6], $clue_ids[1][8], $clue_ids[1][10], $clue_ids[2][3], $clue_ids[2][6], $clue_ids[2][9], $clue_ids[2][12], $clue_ids[2][15]);
            $stmt = $mysqli->prepare($query);
            if (!$stmt) {
                report_error(sprintf("Could not prepare user response " . "selection statement (error %d)", $mysqli->errno));
            }
            $stmt->bind_param('i', $player_id);
            $stmt->execute();
            $stmt->bind_result($count);
            $stmt->fetch();
            $stmt->close();
            if ($count > 0) {
                $report .= sprintf(<<<STR
Post #%d by %s is fine; %s already has a registered response.

STR
, $current_post, $author, $author);
            } else {
                $report .= sprintf(<<<STR
Check post #%d by %s--%s does not have a registered response.
Ejemplo n.º 24
0
if (!isset($_GET['handle'])) {
    response_header('Error: no handle selected');
    report_error('Error: no handle selected for display');
    response_footer();
    exit;
}
require 'bugs/pear-bug-accountrequest.php';
$account = new PEAR_Bug_Accountrequest($_GET['handle']);
if ($account->pending()) {
    try {
        $account->sendEmail();
    } catch (Exception $e) {
        response_header('Error: cannot send confirmation email');
        report_error('Error: confirmation email could not be sent: ' . $e->getMessage());
        response_footer();
        exit;
    }
} else {
    response_header('Error: handle does not need verification');
    report_error('Error: handle is either already verified or does not exist');
    response_footer();
    exit;
}
response_header('PEAR :: email re-sent');
?>
<h1>Verification email resent</h1>
<p>
The verification email has been sent to your email address.
</p>
<?php 
response_footer();
Ejemplo n.º 25
0
if ($handle === null || empty($handle)) {
    $form = new HTML_QuickForm2('karma_edit', 'post');
    $form->removeAttribute('name');
    include_once 'pear-database-user.php';
    $list = user::listAll(true);
    $users = array();
    foreach ($list as $user) {
        $users[$user['handle']] = $user['handle'] . ' (' . $user['name'] . ')';
    }
    $form->addElement('select', 'handle')->setLabel('Handle:&nbsp;')->loadOptions($users);
    $form->addElement('submit', 'submit')->setLabel('Submit Changes');
    print $form;
} else {
    if (!empty($_GET['action'])) {
        if (!validate_csrf_token($csrf_token_name)) {
            report_error('Invalid token.');
            response_footer();
            exit;
        }
        include_once 'pear-database-note.php';
        switch ($_GET['action']) {
            case "remove":
                $res = $karma->remove($handle, $_GET['level']);
                if ($res) {
                    echo "Successfully <b>removed</b> karma &quot;" . htmlspecialchars($_GET['level']) . "&quot;<br /><br />";
                    note::add($handle, 'removed ' . $_GET['level'] . ' karma', $auth_user->handle);
                }
                break;
            case "grant":
                $res = $karma->grant($handle, $_POST['level']);
                if ($res) {
Ejemplo n.º 26
0
   +----------------------------------------------------------------------+
   | PEAR Web site version 1.0                                            |
   +----------------------------------------------------------------------+
   | Copyright (c) 2001-2003 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 2.02 of the PHP license,      |
   | that is bundled with this package in the file LICENSE, and is        |
   | available at through the world-wide-web at                           |
   | http://www.php.net/license/2_02.txt.                                 |
   | If you did not receive a copy of the PHP license and are unable to   |
   | obtain it through the world-wide-web, please send a note to          |
   | license@php.net so we can mail you a copy immediately.               |
   +----------------------------------------------------------------------+
   | Authors:                                                             |
   +----------------------------------------------------------------------+
   $Id$
*/
if (isset($showmsg)) {
    $delay = 3;
    Header("Refresh: {$delay}; url=\"" . htmlspecialchars($_SERVER['PHP_SELF']) . "\"");
    response_header("Logging Out...");
    //	$ua = $HTTP_USER_AGENT;
    $logoutmsg = "Authorization failed. Retry?";
    report_error("Press 'Cancel' when presented a new login box or " . "one saying '{$logoutmsg}'<br />");
    response_footer();
} else {
    Header("HTTP/1.0 401 Unauthorized");
    Header("WWW-authenticate: basic realm=\"PEAR user\"");
    Header("Refresh: 1; url=\"./\"");
    auth_reject(PEAR_AUTH_REALM, "Logging out");
}
Ejemplo n.º 27
0
    }
    $languages = array();
    if (!$error_abort) {
        while ($file = readdir($dir)) {
            if (!$file || $file[0] == '.' || strpos($file, '.') === false) {
                continue;
            }
            $lang = substr($file, 0, strpos($file, '.'));
            $languages[] = $lang;
        }
        closedir($dir);
    }
    $languages = array_unique($languages);
    sort($languages);
    if (!count($languages)) {
        report_error(TYPE_WARNING, 'Unable to locate any usable language files in "' . GESHI_LANG_ROOT . '"!');
    }
}
output_error_cache();
// --- empty variables for values of $_POST - begin ---
$post_var_names = array('li', 'ai', 'ld');
$li = array('file' => 'example', 'name' => 'Example');
$ai = array('name' => 'Benny Baumann', 'email' => '*****@*****.**', 'web' => 'http://qbnz.com/highlighter/');
$ld = array('cmt' => array('sl' => array(1 => array('start' => '//', 'style' => 'font-style: italic; color: #666666;'), 2 => array('start' => '#', 'style' => 'font-style: italic; color: #666666;')), 'ml' => array(1 => array('start' => '/*', 'end' => '*/', 'style' => 'font-style: italic; color: #666666;'), 2 => array('start' => '/**', 'end' => '*/', 'style' => 'font-style: italic; color: #006600;')), 'rxc' => array(1 => array('rx' => '/Hello RegExp/', 'style' => 'font-style: italic; color: #666666;'))), 'str' => array('qm' => array(1 => array('delim' => "'", 'style' => 'color: #0000FF;'), 2 => array('delim' => "&quot;", 'style' => 'color: #0000FF;')), 'ec' => array('char' => '\\', 'style' => 'font-weight: bold; color: #000080;'), 'erx' => array(1 => array('rx' => '/\\{\\\\$\\w+\\}/', 'style' => 'font-weight: bold; color: #008080;'), 2 => array('rx' => '/\\{\\\\$\\w+\\}/', 'style' => 'font-weight: bold; color: #008080;'))), 'kw_case' => 'GESHI_CAPS_NO_CHANGE', 'kw' => array(1 => array('list' => '', 'case' => '0', 'style' => 'color: #0000FF; font-weight: bold;', 'docs' => '')), 'sy' => array(0 => array('list' => '', 'style' => 'color: #0000FF; font-weight: bold;')));
$kw_case_sel = array('GESHI_CAPS_NO_CHANGE' => '', 'GESHI_CAPS_UPPER' => '', 'GESHI_CAPS_LOWER' => '');
$kw_cases_sel = array(1 => array(0 => '', 1 => ''));
// --- empty variables for values of $_POST - end ---
echo "<pre>";
//var_dump($languages);
var_dump($_GET);
var_dump($_POST);
Ejemplo n.º 28
0
    exit;
}
$canpatch = true;
require_once 'Text/CAPTCHA/Numeral.php';
$numeralCaptcha = new Text_CAPTCHA_Numeral();
$patchinfo = new Bugs_Patchtracker();
// captcha is not necessary if the user is logged in
if (isset($auth_user) && $auth_user->registered) {
    auth_require('pear.dev', 'pear.bug');
    if (isset($_SESSION['answer'])) {
        unset($_SESSION['answer']);
    }
}
if (PEAR::isError($buginfo = $patchinfo->getBugInfo($id))) {
    response_header('Error :: invalid bug selected');
    report_error('Invalid bug "' . $id . '" selected');
    response_footer();
    exit;
}
$loggedin = isset($auth_user) && $auth_user->registered;
if (!isset($_POST['addpatch'])) {
    /**
     * Normal patch form with predefined variables
     */
    $email = isset($_GET['email']) ? $_GET['email'] : '';
    $errors = array();
    $package = $buginfo['package_name'];
    $bug = $buginfo['id'];
    $patchname = isset($_GET['patchname']) ? $_GET['patchname'] : '';
    $captcha = $numeralCaptcha->getOperation();
    $_SESSION['answer'] = $numeralCaptcha->getAnswer();
Ejemplo n.º 29
0
            include dirname(__FILE__) . '/index.php';
            exit;
        }
        if (isset($_POST['url']) && !empty($_POST['url'])) {
            $pendingComments = $manualNotes->getPageComments($_POST['url'], 'pending');
        } else {
            $pendingComments = $manualNotes->getPageComments('', 'pending', true);
        }
        $url = isset($_POST['url']) ? strip_tags($_POST['url']) : '';
        $error = '';
        require PEARWEB_TEMPLATEDIR . '/notes/note-manage-admin.tpl.php';
        break;
    case 'updatesingle':
        break;
    default:
        response_header('Note Administration', null, null);
        report_error('Missing action');
        response_footer();
        exit;
}
function getPackageNameForId($id)
{
    global $dbh;
    $res = preg_match('/^package\\.[\\w-]+\\.([\\w-]+).*\\.php$/', $id, $matches);
    if ($res === 0) {
        return null;
    }
    $package = str_replace('-', '_', $matches[1]);
    $query = 'SELECT name FROM packages WHERE LCASE(name) = LCASE(?)';
    return $dbh->getOne($query, $package);
}
Ejemplo n.º 30
0
    //Get the data out of the database
} else {
    $Q = "select \t*\n\t\t\tfrom \tproperties\n\t\t\twhere \tfront_page \t= 'Yes'\n\t\t\tand\t\tvisible \t= 'Yes'\n\t\t\torder\tby sal_auc, title asc";
    if (!($res = mysql_query($Q, $db))) {
        report_error($db, "display_properties.1" . $Q, $Q);
    } else {
        if (mysql_num_rows($res) > 0) {
            $p = array();
            $i = 0;
            while ($row = mysql_fetch_array($res)) {
                // Insert this entry into the array
                $p[$i] = array("property_id" => $row['property_id'], "pdf" => $row['pdf'], "sal_auc" => $row['sal_auc'], "title" => $row['title'], "text" => $row['text'], "directory" => $row['directory'], "details" => strlen($row['details']), "status" => $row['status']);
                // Get and insert the images
                $Q = "select \t*\n\t\t\t\t\tfrom \timages\n\t\t\t\t\twhere \tproperty_id = " . $row['property_id'] . "\n\t\t\t\t\tand\t\tfront_page\t= 1\n\t\t\t\t\torder\tby iorder";
                if (!($ires = mysql_query($Q, $db))) {
                    report_error($db, "index.2" . $Q, $Q);
                } else {
                    if (mysql_num_rows($ires) > 0) {
                        $j = 1;
                        while ($irow = mysql_fetch_array($ires)) {
                            // Update the order
                            //$Q = "update images set iorder = ".$j." where image_id = ".$irow['image_id'];
                            //execute($db, $Q, "index.3");
                            $image = "image" . $j++;
                            $p[$i][$image] = $irow['location'] . "/" . $irow['image'];
                        }
                    }
                }
                $i++;
            }
        }