Inheritance: extends Extension
Ejemplo n.º 1
0
/**
 * Callback function to validate data
 * @return bool must return true or other hooks don't get called
 */
function validateUserPage($editPage, $textBox1, $section, &$hookError)
{
    $ns = $editPage->mTitle->getNamespace();
    if ($ns == NS_USER) {
        $user = new UserPage($editPage->mTitle->getText());
        $user->validate($textBox1, $section, $hookError);
    }
    return true;
}
Ejemplo n.º 2
0
 public static function getUaRunsHtmlRows($runs, $userAgents)
 {
     $html = '';
     foreach ($runs as $run) {
         $html .= '<tr><th><a href="' . htmlspecialchars($run['info']['url']) . '">' . $run['info']['name'] . '</a></th>';
         // Looping over $userAgents instead of $run["uaRuns"],
         // to avoid shifts in the table (github.com/jquery/testswarm/issues/13)
         foreach ($userAgents as $uaID => $uaInfo) {
             if (isset($run['uaRuns'][$uaID])) {
                 $uaRun = $run['uaRuns'][$uaID];
                 $html .= html_tag_open('td', array('class' => 'swarm-status swarm-status-' . $uaRun['runStatus'], 'data-run-id' => $run['info']['id'], 'data-run-status' => $uaRun['runStatus'], 'data-useragent-id' => $uaID, 'data-client-id' => isset($uaRun['clientID']) ? $uaRun['clientID'] : ''));
                 if (isset($uaRun['runResultsUrl']) && isset($uaRun['runResultsLabel'])) {
                     $html .= html_tag_open('a', array('rel' => 'nofollow', 'href' => $uaRun['runResultsUrl'])) . ($uaRun['runResultsLabel'] ? $uaRun['runResultsLabel'] : UserPage::getStatusIconHtml($uaRun['runStatus'])) . '<i class="icon-list-alt pull-right" title="' . htmlspecialchars("Open run results for {$userAgents[$uaID]['displaytitle']}") . '"></i>' . '</a>';
                 } else {
                     $html .= UserPage::getStatusIconHtml($uaRun['runStatus']);
                 }
                 $html .= '</td>';
             } else {
                 // This run isn't schedules to be ran in this UA
                 $html .= '<td class="swarm-status swarm-status-notscheduled"></td>';
             }
         }
     }
     return $html;
 }
Ejemplo n.º 3
0
 protected function initContent()
 {
     $request = $this->getContext()->getRequest();
     $this->setTitle("Job status");
     $this->setRobots("noindex,nofollow");
     $this->bodyScripts[] = swarmpath("js/job.js");
     $error = $this->getAction()->getError();
     $data = $this->getAction()->getData();
     $html = '';
     if ($error) {
         $html .= html_tag('div', array('class' => 'alert alert-error'), $error['info']);
     }
     if (!isset($data["jobInfo"])) {
         return $html;
     }
     $this->setSubTitle('#' . $data["jobInfo"]["id"]);
     $html .= '<h2>' . $data["jobInfo"]["name"] . '</h2>' . '<p><em>Submitted by ' . html_tag("a", array("href" => swarmpath("user/{$data["jobInfo"]["ownerName"]}")), $data["jobInfo"]["ownerName"]) . ' on ' . htmlspecialchars(date("Y-m-d H:i:s", gmstrtotime($data["jobInfo"]["creationTimestamp"]))) . ' (UTC)' . '</em>.</p>';
     if ($request->getSessionData("auth") === "yes" && $data["jobInfo"]["ownerName"] == $request->getSessionData("username")) {
         $html .= '<script>SWARM.jobInfo = ' . json_encode($data["jobInfo"]) . ';</script>' . '<div class="form-actions">' . ' <button id="swarm-job-delete" class="btn btn-danger">Delete job</button>' . ' <button id="swarm-job-reset" class="btn btn-info">Reset job</button>' . '</div>' . '<div class="alert alert-error" id="swarm-wipejob-error" style="display: none;"></div>';
     }
     $html .= '<table class="table table-bordered swarm-results"><thead><tr><th>&nbsp;</th>';
     // Header with user agents
     foreach ($data["userAgents"] as $userAgent) {
         $html .= '<th><img src="' . swarmpath("img/" . $userAgent["displayicon"]) . '.sm.png" class="swarm-browsericon ' . '" alt="' . htmlspecialchars($userAgent["displaytitle"]) . '" title="' . htmlspecialchars($userAgent["displaytitle"]) . '"><br>' . htmlspecialchars(preg_replace("/\\w+ /", "", $userAgent["displaytitle"])) . '</th>';
     }
     $html .= '</tr></thead><tbody>';
     foreach ($data["runs"] as $run) {
         $html .= '<tr><th><a href="' . htmlspecialchars($run["info"]["url"]) . '">' . $run["info"]["name"] . '</a></th>';
         // Looping over $data["userAgents"] instead of $run["uaRuns"],
         // to avoid shifts in the table (github.com/jquery/testswarm/issues/13)
         foreach ($data["userAgents"] as $uaID => $uaInfo) {
             if (isset($run["uaRuns"][$uaID])) {
                 $uaRun = $run["uaRuns"][$uaID];
                 $html .= html_tag_open("td", array("class" => "swarm-status swarm-status-" . $uaRun["runStatus"], "data-job-id" => $data["jobInfo"]["id"], "data-run-id" => $run["info"]["id"], "data-run-status" => $uaRun["runStatus"], "data-useragent-id" => $uaID, "data-client-id" => isset($uaRun["clientID"]) ? $uaRun["clientID"] : ""));
                 if (isset($uaRun["runResultsUrl"]) && $uaRun["runResultsLabel"]) {
                     $html .= html_tag_open('a', array("rel" => "nofollow", "href" => $uaRun["runResultsUrl"])) . $uaRun["runResultsLabel"] . '<i class="icon-list-alt pull-right" title="' . htmlspecialchars("Open run results for {$data["userAgents"][$uaID]["displaytitle"]}") . '"></i>' . '</a>';
                 } else {
                     $html .= UserPage::getStatusIconHtml($uaRun["runStatus"]);
                 }
                 $html .= '</td>';
             } else {
                 // This run isn't schedules to be ran in this UA
                 $html .= '<td class="swarm-status swarm-status-notscheduled"></td>';
             }
         }
     }
     $html .= '</tbody></table>';
     return $html;
 }
Ejemplo n.º 4
0
ini_set("display_errors", "On");
error_reporting(E_ALL ^ E_WARNING);
require_once "settings.php";
require_once USER_DIR . "/UserPage.php";
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
	<head>
		<title>Login</title>
	</head>
	<body>
	<?php 
if (!Session::getUser()) {
    UserPage::showLoginForm();
    if (Session::getUser() != false) {
        header('Location: http://127.0.0.1/IoEsistoProgetto/v02/sessiontest.php');
    }
} else {
    if (isset($_GET['logout'])) {
        UserManager::logout();
        header('Location: http://127.0.0.1/IoEsistoProgetto/v02/sessiontest.php');
    } else {
        $user = Session::getUser();
        $nome = $user->getName();
        $cognome = $user->getSurname();
        echo '<h1>Bevenuto ' . $nome . " " . $cognome . '</h1>';
        echo '<a href="sessiontest.php?logout=1">Logout</a>';
    }
}
Ejemplo n.º 5
0
 private static function PCAuthor($data)
 {
     if (isset(self::$currentObject) && !is_null(self::$currentObject) && self::$currentObject !== false) {
         require_once 'user/UserManager.php';
         $user = UserManager::loadUser(self::$currentObject->getAuthor(), false);
         if (true) {
             //TODO se l'autore vuole
             echo "<p>L'autore</p>";
             require_once 'user/UserPage.php';
             UserPage::showProfile($user);
         }
     }
 }
Ejemplo n.º 6
0
<?php

define("UNITTEST", true);
define("TIMEZONE", 'UTC');
define("EXTRA_EXTS", str_replace("ext/", "", implode(',', glob('ext/*'))));
define("BASE_HREF", "/");
define("CLI_LOG_LEVEL", 50);
$_SERVER['QUERY_STRING'] = '/';
chdir(dirname(dirname(__FILE__)));
require_once "core/_bootstrap.inc.php";
if (is_null(User::by_name("demo"))) {
    $userPage = new UserPage();
    $userPage->onUserCreation(new UserCreationEvent("demo", "demo", ""));
    $userPage->onUserCreation(new UserCreationEvent("test", "test", ""));
}
abstract class ShimmiePHPUnitTestCase extends PHPUnit_Framework_TestCase
{
    protected $backupGlobalsBlacklist = array('database', 'config');
    private $images = array();
    public function setUp()
    {
        $class = str_replace("Test", "", get_class($this));
        if (!method_exists($class, "is_live") || !ext_is_live($class)) {
            $this->markTestSkipped("{$class} not supported with this database");
        }
        // things to do after bootstrap and before request
        // log in as anon
        $this->log_out();
    }
    public function tearDown()
    {