Exemplo n.º 1
0
 public function login(AIS2Connection $connection)
 {
     $login = $this->username;
     $krbpwd = $this->krbpwd;
     // Username a password si nebudeme pamatat dlhsie ako treba
     $this->username = null;
     $this->krbpwd = null;
     $data = $connection->get(self::LOGIN);
     if (preg_match('@\\<title\\>IIKS \\- Prihlásenie\\</title\\>@', $data)) {
         assert($login !== null && $krbpwd !== null);
         $data = $connection->post(self::COSIGN_LOGIN, array('ref' => self::LOGIN, 'login' => $login, 'krbpwd' => $krbpwd));
         if (!preg_match('@\\<base href\\="https://ais2\\.uniba\\.sk/ais/portal/pages/portal_layout\\.jsp"\\>@', $data)) {
             if (preg_match('@Pri pokuse o prihlásenie sa vyskytol problém:@', $data)) {
                 if ($reason = match($data, '@\\<div style\\="color:#FF0000;"\\>\\<b\\>([^<]*)\\<\\/b\\>@')) {
                     throw new Exception('Nepodarilo sa prihlásiť, dôvod: <b>' . $reason . '</b>');
                 }
             }
             if ($reason = match($data, '@\\<title\\>IIKS - Chyba pri prihlasovaní:([^<]*)\\<\\/title\\>@')) {
                 throw new Exception('Nepodarilo sa prihlásiť, dôvod: <b>' . $reason . '</b>');
             }
             throw new Exception('Nepodarilo sa prihlásiť, dôvod neznámy.');
         }
         $this->loggedIn = true;
         return true;
     }
     $this->loggedIn = true;
     // naozaj?
     return true;
 }
Exemplo n.º 2
0
 function showList($q)
 {
     include "showProject.php";
     //---get user information---//
     if ($q !== "") {
         $userid = match("users", "username", "userid", $q);
     } else {
         $sessionid = $_SESSION["sessionid"];
         $random = $_SESSION["random"];
         $query = "SELECT * FROM sessions WHERE sessionid = '{$sessionid}' AND random = '{$random}' ";
         $recordSet = mysql_query($query) or die(mysql_error());
         $row = mysql_fetch_array($recordSet);
         $userid = $row["userid"];
     }
     //---get projects---//
     $arrayProjectids = array();
     $query = "SELECT * FROM projects WHERE shoot = '{$userid}' OR video = '{$userid}' OR photo = '{$userid}' OR copy = '{$userid}' ";
     $recordSet = mysql_query($query) or die(mysql_error());
     while ($row = mysql_fetch_array($recordSet)) {
         array_push($arrayProjectids, $row["projectid"]);
     }
     //---build return---//
     $returnArray = array();
     foreach ($arrayProjectids as $projectid) {
         array_push($returnArray, "project:|:|:|:" . showProject($projectid));
     }
     //---return information---//
     return implode(":|::|::|:", $returnArray);
 }
 function validateNewEmail($key, $newEmail)
 {
     $errorMessage = "";
     $successMessage = "";
     if (isset($key) and isset($newEmail)) {
         if ($key !== $_SESSION["key"]) {
             $errorMessage = "Please validate email again.";
         } elseif ($newEmail !== $_SESSION["newEmail"]) {
             $errorMessage = "Please validate email again.";
         } elseif (match("users", "email", "userid", $newEmail) > 0) {
             $errorMessage = "This email is taken.";
         } else {
             $sessionid = $_SESSION["sessionid"];
             $random = $_SESSION["random"];
             $query = "SELECT * FROM sessions WHERE sessionid = '{$sessionid}' AND random = '{$random}' ";
             $recordSet = mysql_query($query) or die(mysql_error());
             $row = mysql_fetch_array($recordSet);
             $userid = $row["userid"];
             if ($row["userid"] > 0) {
                 unset($_SESSION["newEmail"]);
                 unset($_SESSION["key"]);
                 $query = "UPDATE users SET email = ('{$newEmail}') WHERE userid = '{$userid}' ";
                 mysql_query($query) or die(mysql_error());
                 $successMessage = "Email updated.";
             } else {
                 $errorMessage = "Sign in conflict.";
             }
         }
     } else {
         $errorMessage = "Please complete all fields.";
     }
     return $errorMessage . ":|:|:|:" . $successMessage;
 }
Exemplo n.º 4
0
 function sendValidation($email)
 {
     $errorMessage = "";
     $successMessage = "";
     if (isset($email)) {
         if (match("users", "email", "userid", $email) > 0) {
             $errorMessage = "This email is taken.";
         } else {
             $_SESSION["key"] = substr(str_shuffle(str_repeat('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', mt_rand(1, 16))), 0, 16);
             $_SESSION["email"] = $email;
             $subject = "validation";
             $message = "\n\t\t\t\t\t\t\t<html>\n\t\t\t\t\t\t\t\t<head>\n\t\t\t\t\t\t\t\t\t<title>validation</title>\n\t\t\t\t\t\t\t\t</head>\n\t\t\t\t\t\t\t\t<body style='background-color: rgba(048,122,183,1); color: rgba(255,255,255,1); font-family: arial, sans-serif; text-align: center; font-size: 50px; border-radius: 10px'>\n\t\t\t\t\t\t\t\t\t<div style='padding-top: 50px; padding-bottom: 50px'>\n\t\t\t\t\t\t\t\t\t\t<a href='http://example.com/welcome.html?email=" . $_SESSION["email"] . "&key=" . $_SESSION["key"] . "'>Validate this email address.</a>\n\t\t\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t</body>\n\t\t\t\t\t\t\t</html>";
             $headers = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=iso-8859-1' . "\r\n" . 'From: info@example.com' . "\r\n" . 'Reply-To: info@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
             mail($email, $subject, $message, $headers);
             $domain = explode("@", $email);
             $domain = $domain[1];
             //$successMessage = "https://".$domain;
             $successMessage = "http://example.com/welcome.html?email=" . $_SESSION["email"] . "&key=" . $_SESSION["key"];
             //testing only
         }
     } else {
         $errorMessage = "Please enter a valid email address.";
     }
     return $errorMessage . ":|:|:|:" . $successMessage;
 }
Exemplo n.º 5
0
 function saveProject($q, $projectName, $shoot, $video, $photo, $copy, $shootDate, $dueDate, $notes)
 {
     $errorMessage = "";
     $successMessage = "";
     //---existingProject---//
     if (match("projects", "projectName", "projectid", $q) > 0) {
         $projectid = match("projects", "projectName", "projectid", $q);
         $shoot = match("users", "username", "userid", $shoot);
         $video = match("users", "username", "userid", $video);
         $photo = match("users", "username", "userid", $photo);
         $copy = match("users", "username", "userid", $copy);
         $query = "UPDATE projects SET projectName = '{$projectName}', shoot = '{$shoot}', video = '{$video}', photo = '{$photo}', copy = '{$copy}', shootDate = '{$shootDate}', dueDate = '{$dueDate}', notes = '{$notes}' WHERE projectid = '{$projectid}' ";
         mysql_query($query) or die(mysql_error());
         $successMessage = "Data updated.";
     } else {
         if (match("users", "username", "userid", $projectName) > 0 or match("users", "username", "userid", $projectName) > 0) {
             $errorMessage = "This project name is taken.";
         } else {
             $shoot = match("users", "username", "userid", $shoot);
             $video = match("users", "username", "userid", $video);
             $photo = match("users", "username", "userid", $photo);
             $copy = match("users", "username", "userid", $copy);
             $query = "INSERT INTO projects (projectName, shoot, video, photo, copy, shootDate, dueDate, notes) VALUES('{$projectName}','{$shoot}','{$video}','{$photo}','{$copy}','{$shootDate}','{$dueDate}','{$notes}')";
             mysql_query($query) or die(mysql_error());
             $successMessage = "Project created.";
         }
     }
     return $errorMessage . ":|:|:|:" . $successMessage . ":|:|:|:" . $projectName;
 }
Exemplo n.º 6
0
 public static function parse_expressions($css = "")
 {
     # If theres no css string given, use the master css
     if ($css == "") {
         $css = CSS::$css;
     }
     foreach (self::$numericProperties as $property) {
         preg_match_all('/[^\\s;\\}\\{\\-_A-Za-z\\*]*(?P<property_name>' . $property . ')\\s*\\:\\s*(?P<property_value>.*?)\\s*\\;/', $css, $matches);
         for ($i = 0; $i < count($matches[0]); $i++) {
             if (match('/(\\#\\[[\'\\"]?([^]]*?)[\'\\"]?\\])/', $matches['property_value'][$i])) {
                 continue;
             }
             $result = self::operate($matches['property_value'][$i], $matches['property_name'][$i]);
             if ($result !== false) {
                 $css = str_replace($matches[0][$i], "{$matches['property_name'][$i]}: {$result};", $css);
             }
         }
     }
     preg_match_all('/[^a-zA-Z]\\((?P<to_operate>[^\\)]*?)\\)/', $css, $matches);
     for ($i = 0; $i < count($matches[0]); $i++) {
         $result = self::operate($matches['to_operate'][$i], null, true);
         if ($result !== false) {
             $css = str_replace($matches[0][$i], " " . $result, $css);
         }
     }
     return $css;
 }
 public function getZapisneListy($studiumIndex)
 {
     $this->open();
     $data = $this->requestData(array('compName' => 'nacitatDataAction', 'objProperties' => array('x' => -4, 'y' => -4, 'focusedComponent' => 'nacitatButton'), 'embObj' => array('objName' => 'studiaTable', 'dataView' => array('activeIndex' => $studiumIndex, 'selectedIndexes' => $studiumIndex))));
     $data = match($data, AIS2Utils::DATA_PATTERN);
     return new AIS2Table($this->tabulka_zoznam_zapisnych_listov, $data);
 }
Exemplo n.º 8
0
 function follow($q)
 {
     $profileActionButton = "none";
     //---get profile information---//
     $profileid = match("users", "username", "userid", $q);
     //---get user information---//
     $sessionid = $_SESSION["sessionid"];
     $random = $_SESSION["random"];
     $query = "SELECT * FROM sessions WHERE sessionid = '{$sessionid}' AND random = '{$random}' ";
     $recordSet = mysql_query($query) or die(mysql_error());
     $row = mysql_fetch_array($recordSet);
     //---profileActionButton---//
     if ($row["userid"] > 0) {
         $myid = $row["userid"];
         $query = "SELECT * FROM users WHERE userid = '{$myid}' ";
         $recordSet = mysql_query($query) or die(mysql_error());
         $row = mysql_fetch_array($recordSet);
         $arrayFollowing = explode(":||:", $row["following"]);
         if ($profileid === $myid) {
             $profileActionButton = "edit_profile";
         } elseif (in_array($profileid, $arrayFollowing)) {
             $profileActionButton = "unfollow";
         } else {
             array_push($arrayFollowing, $profileid);
             $following = implode(":||:", $arrayFollowing);
             $query = "UPDATE users SET following = '{$following}' WHERE userid = '{$myid}' ";
             mysql_query($query) or die(mysql_error());
             $profileActionButton = "unfollow";
             include "notify.php";
             notify($profileid, "@{" . $myid . "}@ is now following you.");
         }
     }
     return $profileActionButton;
 }
Exemplo n.º 9
0
function serve(array $actions, $verb, $path, ...$args)
{
    $pair = match($actions, $verb, $path);
    $func = array_shift($pair) ?: function () {
        return response('', 404, []);
    };
    $caps = array_shift($pair) ?: null;
    return empty($caps) ? $func(...$args) : $func($caps, ...$args);
}
Exemplo n.º 10
0
function decode($encryptedText, $upperLeft, $upperRight, $lowerLeft, $lowerRight)
{
    $decodedText = "";
    for ($i = 0; $i < strlen($encryptedText) - 1; $i += 2) {
        $pair = textPairing($encryptedText, $i);
        $decodedText .= match($pair, $upperLeft, $upperRight, $lowerLeft, $lowerRight);
    }
    return $decodedText;
}
Exemplo n.º 11
0
 protected static function getTokens(&$block)
 {
     $tokens = [];
     foreach (static::$tokens as $name => $pattern) {
         $token = match($pattern, $block);
         $tokens[$name] = $token ? $token[1] : null;
     }
     return $tokens;
 }
Exemplo n.º 12
0
 protected static function getAttributes(&$block)
 {
     extract(static::$tokens);
     $attributes = [];
     while ($token = match($attribute, $block)) {
         $attributes[$token[1]] = $token[2];
     }
     return $attributes;
 }
Exemplo n.º 13
0
 function saveSettings($newUsername, $newPassword, $newEmailNotifications, $newAbout, $newPicture)
 {
     $errorMessage = "";
     $successMessage = "";
     //---get user information---//
     $sessionid = $_SESSION["sessionid"];
     $random = $_SESSION["random"];
     $query = "SELECT * FROM sessions WHERE sessionid = '{$sessionid}' AND random = '{$random}' ";
     $recordSet = mysql_query($query) or die(mysql_error());
     $row = mysql_fetch_array($recordSet);
     $userid = $row["userid"];
     //---update username---//
     if (isset($newUsername) and strlen($newUsername) > 0 and match("users", "username", "userid", $newUsername) !== $userid) {
         if (match("users", "username", "userid", $newUsername) > 0 or match("projects", "projectName", "projectid", $newUsername)) {
             $errorMessage = "This username is taken.";
         } else {
             $query = "UPDATE users SET username = ('{$newUsername}') WHERE userid = '{$userid}' ";
             mysql_query($query) or die(mysql_error());
             $successMessage = $successMessage . "Username updated. ";
         }
     }
     //---update password---//
     if (isset($newPassword) and strlen($newPassword) > 0) {
         $salt = substr(str_shuffle(str_repeat('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', mt_rand(1, 16))), 0, 16);
         $newPassword = sha1($newPassword . $salt);
         $query = "UPDATE users SET password = ('{$newPassword}') WHERE userid = '{$userid}' ";
         mysql_query($query) or die(mysql_error());
         $query = "UPDATE users SET salt = ('{$salt}') WHERE userid = '{$userid}' ";
         mysql_query($query) or die(mysql_error());
         $successMessage = $successMessage . "Password updated. ";
     }
     //---update email notifications---//
     if (isset($newEmailNotifications)) {
         $query = "UPDATE users SET emailNotifications = ('{$newEmailNotifications}') WHERE userid = '{$userid}' ";
         mysql_query($query) or die(mysql_error());
         $successMessage = $successMessage . "Email notifications updated. ";
     }
     //---update about---//
     if (isset($newAbout) and strlen($newAbout) > 0) {
         $newAbout = strip_tags($newAbout);
         $newAbout = addslashes($newAbout);
         $query = "UPDATE users SET about = ('{$newAbout}') WHERE userid = '{$userid}' ";
         mysql_query($query) or die(mysql_error());
         $successMessage = $successMessage . "About updated. ";
     }
     //---update picture---//
     if (isset($newPicture) and strlen($newPicture) > 0) {
         $newPicture = strip_tags($newPicture);
         $newPicture = addslashes($newPicture);
         $query = "UPDATE users SET picture = ('{$newPicture}') WHERE userid = '{$userid}' ";
         mysql_query($query) or die(mysql_error());
         $successMessage = $successMessage . "Picture updated. ";
     }
     //---return messages---//
     return $errorMessage . ":|:|:|:" . $successMessage;
 }
function BOUCLE_documenthtml_b8a8020987dd01f8087ad24f961857eb(&$Cache, &$Pile, &$doublons, &$Numrows, $SP)
{
    static $command = array();
    static $connect;
    $command['connect'] = $connect = '';
    $in = array();
    if (!is_array($a = @$Pile[0]['mode'])) {
        $in[] = $a;
    } else {
        $in = array_merge($in, $a);
    }
    if (!isset($command['table'])) {
        $command['table'] = 'documents';
        $command['id'] = '_document';
        $command['from'] = array('documents' => 'spip_documents', 'L1' => 'spip_types_documents');
        $command['type'] = array();
        $command['groupby'] = array();
        $command['select'] = array("documents.id_document", "L1.titre AS type_document", "documents.taille", "documents.mode", "documents.largeur", "documents.hauteur", "documents.titre", "L1.mime_type");
        $command['orderby'] = array();
        $command['join'] = array('L1' => array('documents', 'extension'));
        $command['limit'] = '';
        $command['having'] = array();
    }
    $command['where'] = array(array('(documents.taille > 0 OR documents.distant=\'oui\')'), array('=', 'documents.id_document', sql_quote(@$Pile[0]['id_document'], '', 'bigint(21) NOT NULL AUTO_INCREMENT')), !(is_array(@$Pile[0]['mode']) ? count(@$Pile[0]['mode']) : strlen(@$Pile[0]['mode'])) ? '' : (is_array(@$Pile[0]['mode']) ? sql_in('documents.mode', sql_quote($in)) : array('=', 'documents.mode', sql_quote(@$Pile[0]['mode'], '', 'varchar(10) NOT NULL DEFAULT \'document\''))));
    if (defined("_BOUCLE_PROFILER")) {
        $timer = time() + microtime();
    }
    $t0 = "";
    // REQUETE
    $iter = IterFactory::create("SQL", $command, array('plugins-dist/medias/modeles/img.html', 'html_b8a8020987dd01f8087ad24f961857eb', '_document', 1, $GLOBALS['spip_lang']));
    if (!$iter->err()) {
        $SP++;
        // RESULTATS
        while ($Pile[$SP] = $iter->fetch()) {
            $t0 .= '

' . vide($Pile['vars'][$_zzz = (string) 'image'] = interdire_scripts(($a = match(entites_html(sinon(table_valeur(@$Pile[0], (string) 'mode_force', null), interdire_scripts($Pile[$SP]['mode'])), true), 'image|vignette') or is_string($a) and strlen($a)) ? $a : interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'embed', null), true)) ? ' ' : '')) . (($t1 = strval(table_valeur($Pile["vars"], (string) 'image', null))) !== '' ? $t1 . ('
<span class=\'spip_document_' . $Pile[$SP]['id_document'] . ' spip_documents' . (($t2 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'align', null), true)))) !== '' ? ' spip_documents_' . $t2 : '') . (($t2 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'class', null), true)))) !== '' ? ' ' . $t2 : '') . ' spip_lien_ok\'' . (($t2 = strval(interdire_scripts(match(entites_html(table_valeur(@$Pile[0], (string) 'align', null), true), 'left|right')))) !== '' ? '
 style=\'float:' . $t2 . ';\'' : '') . '>
' . (($t2 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'lien', null), true)))) !== '' ? '<a href="' . $t2 . ('"' . (($t3 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'lien_class', null), true)))) !== '' ? ' class="' . $t3 . '"' : '') . '>') : '') . '<img src=\'' . vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_document'], 'document', '', '', true))) . '\'' . (($t2 = strval(interdire_scripts($Pile[$SP]['largeur']))) !== '' ? ' width="' . $t2 . '"' : '') . (($t2 = strval(interdire_scripts($Pile[$SP]['hauteur']))) !== '' ? ' height="' . $t2 . '"' : '') . ' alt="' . interdire_scripts(texte_backend(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0]))) . '"' . (($t2 = strval(interdire_scripts(texte_backend(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0]))))) !== '' ? ' title="' . $t2 . '"' : '') . ' />' . interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'lien', null), true) ? '</a>' : '') . '</span>
') : '') . (!table_valeur($Pile["vars"], (string) 'image', null) ? ' ' . ('
	' . vide($Pile['vars'][$_zzz = (string) 'fichier'] = extraire_attribut(quete_logo_document(quete_document($Pile[$SP]['id_document'], ''), '', '', '', 0, 0, ''), 'src')) . '
	' . vide($Pile['vars'][$_zzz = (string) 'width'] = extraire_attribut(quete_logo_document(quete_document($Pile[$SP]['id_document'], ''), '', '', '', 0, 0, ''), 'width')) . '
	' . vide($Pile['vars'][$_zzz = (string) 'height'] = extraire_attribut(quete_logo_document(quete_document($Pile[$SP]['id_document'], ''), '', '', '', 0, 0, ''), 'height')) . '
<span class=\'spip_document_' . $Pile[$SP]['id_document'] . ' spip_documents' . (($t2 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'align', null), true)))) !== '' ? ' spip_documents_' . $t2 : '') . (($t2 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'class', null), true)))) !== '' ? ' ' . $t2 : '') . ' spip_lien_ok\'' . (($t2 = strval(interdire_scripts(match(entites_html(table_valeur(@$Pile[0], (string) 'align', null), true), 'left|right')))) !== '' ? '
 style=\'float:' . $t2 . (';' . (($t3 = strval(table_valeur($Pile["vars"], (string) 'width', null))) !== '' ? ' width:' . $t3 . 'px;' : '') . '\'') : '') . '><a href="' . interdire_scripts(($a = entites_html(table_valeur(@$Pile[0], (string) 'lien', null), true) or is_string($a) and strlen($a)) ? $a : vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_document'], 'document', '', '', true)))) . '"' . (($t2 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'lien', null), true) ? '' : 'type="' . interdire_scripts($Pile[$SP]['mime_type']) . '"'))) !== '' ? '
 ' . $t2 : '') . (($t2 = strval(interdire_scripts(texte_backend(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0]))))) !== '' ? ' title="' . $t2 . '"' : '') . '><img src=\'' . table_valeur($Pile["vars"], (string) 'fichier', null) . '\' width=\'' . table_valeur($Pile["vars"], (string) 'width', null) . '\' height=\'' . table_valeur($Pile["vars"], (string) 'height', null) . '\' alt=\'' . interdire_scripts(attribut_html(strlen(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0])) ? interdire_scripts(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0])) . ' {' . interdire_scripts($Pile[$SP]['type_document']) . '}' : interdire_scripts($Pile[$SP]['type_document']))) . '\' /></a></span>
') : '');
        }
        $iter->free();
    }
    if (defined("_BOUCLE_PROFILER") and 1000 * ($timer = time() + microtime() - $timer) > _BOUCLE_PROFILER) {
        spip_log(intval(1000 * $timer) . "ms BOUCLE_document @ plugins-dist/medias/modeles/img.html", "profiler" . _LOG_AVERTISSEMENT);
    }
    return $t0;
}
Exemplo n.º 15
0
function validate_id()
{
    $fields = func_get_args();
    $arr = array_shift($fields);
    foreach ($fields as $field) {
        if (!preg . match("^[0-9]+\$", $arr[$field])) {
            throw new Exception("Field '{$field}' is not an ID");
        }
    }
}
Exemplo n.º 16
0
function getvotes($urlForVotes)
{
    $chnl = curl_init();
    $timeout = 5;
    curl_setopt($chnl, CURLOPT_URL, $urlForVotes);
    curl_setopt($chnl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($chnl, CURLOPT_CONNECTTIMEOUT, $timeout);
    $htmlForVotes = curl_exec($chnl);
    curl_close($chnl);
    $vote = match('/<span itemprop="ratingCount">(.*)<\\/span>/', $htmlForVotes, 1);
    return $vote;
}
Exemplo n.º 17
0
 public function prihlasNaTermin(Trace $trace, $terminIndex)
 {
     $this->openIfNotAlready($trace);
     $data = $this->executor->doRequest($trace, array('compName' => 'enterAction', 'eventClass' => 'avc.ui.event.AVCActionEvent', 'embObj' => array('objName' => 'zoznamTerminovTable', 'dataView' => array('activeIndex' => $terminIndex, 'selectedIndexes' => $terminIndex))));
     $error = match($data, '@webui\\.messageBox\\("([^"]*)",@');
     if ($error) {
         throw new Exception('Nepodarilo sa prihlásiť na zvolený termín.<br/>Dôvod: <b>' . $error . '</b>');
     }
     $this->terminated = true;
     // po uspesnom prihlaseni za dialog hned zavrie
     return true;
 }
Exemplo n.º 18
0
 protected static function getContent(&$block)
 {
     extract(static::$tokens);
     if ($token = match($textContent, $block)) {
         return Block::lex("|{$token['0']}");
     }
     if ($token = match($variableContent, $block)) {
         return Block::lex($token[0]);
     }
     if ($token = match($nodeContent, $block)) {
         return Block::lex($token[1]);
     }
 }
Exemplo n.º 19
0
 public function prihlasNaTermin(Trace $trace, $terminIndex)
 {
     $this->openIfNotAlready($trace);
     $data = $this->executor->doRequest($trace, array('compName' => 'enterAction', 'eventClass' => 'avc.ui.event.AVCActionEvent', 'embObj' => array('objName' => 'zoznamTerminovTable', 'dataView' => array('activeIndex' => $terminIndex, 'selectedIndexes' => $terminIndex))));
     $error = match($data, '@webui\\(\\)\\.messageBox\\("([^"]*)",@');
     if ($error) {
         throw new Exception('Nepodarilo sa prihlásiť na zvolený termín.<br/>' . 'Dôvod: <b>' . $error . '</b>');
     }
     if (!preg_match("@dm\\(\\)\\.closeDialog\\(" . "\"VSES206_VyberTerminuHodnoteniaDlg1\"\\);@", $data)) {
         throw new Exception("Problém pri prihlasovaní: " . "Neočakávaná odozva od AISu");
     }
     $this->closeIfNeeded($trace);
     return true;
 }
Exemplo n.º 20
0
 function showProject($projectid)
 {
     //---get project information---//
     $query = "SELECT * FROM projects WHERE projectid = '{$projectid}' ";
     $recordSet = mysql_query($query) or die(mysql_error());
     $row = mysql_fetch_array($recordSet);
     $projectName = $row["projectName"];
     $shoot = $row["shoot"];
     $video = $row["video"];
     $photo = $row["photo"];
     $copy = $row["copy"];
     $shootDate = $row["shootDate"];
     $dueDate = $row["dueDate"];
     $notes = $row["notes"];
     //---return information---//
     return $projectName . ":|:|:|:" . match("users", "userid", "username", $shoot) . ":|:|:|:" . match("users", "userid", "username", $video) . ":|:|:|:" . match("users", "userid", "username", $photo) . ":|:|:|:" . match("users", "userid", "username", $copy) . ":|:|:|:" . $shootDate . ":|:|:|:" . $dueDate . ":|:|:|:" . $notes;
     //7
 }
 public function odhlasZTerminu(Trace $trace, $terminIndex)
 {
     $this->openIfNotAlready($trace);
     // Posleme request ze sa chceme odhlasit.
     $data = $this->executor->doRequest($trace, array('compName' => 'odstranitTerminAction', 'eventClass' => 'avc.ui.event.AVCActionEvent', 'embObj' => array('objName' => 'terminyTable', 'dataView' => array('activeIndex' => $terminIndex, 'selectedIndexes' => $terminIndex))));
     if (!preg_match("@Skutočne chcete odobrať vybraný riadok?@", $data)) {
         throw new Exception("Problém pri odhlasovaní - neočakávaná odozva AISu");
     }
     // Odklikneme konfirmacne okno ze naozaj.
     $data = $this->executor->doRequest($trace, array('events' => false, 'app' => false, 'dlgName' => false, 'changedProperties' => array('confirmResult' => 2)));
     $message = match($data, '@webui\\.messageBox\\("([^"]*)"@');
     if ($message !== false && $message != 'Činnosť úspešne dokončená.') {
         throw new Exception("Z termínu sa (pravdepodobne) nepodarilo odhlásiť." . "Dôvod:<br/><b>" . $message . '</b>');
     }
     if (!preg_match("@dm\\(\\).setActiveDialogName\\(" . "'VSES007_StudentZoznamPrihlaseniNaSkuskuDlg0'\\);@", $data)) {
         throw new Exception("Problém pri odhlasovaní - neočakávaná odpoveď od AISu");
     }
     return true;
 }
Exemplo n.º 22
0
 function showComments($q)
 {
     //---get user information---//
     $sessionid = $_SESSION["sessionid"];
     $random = $_SESSION["random"];
     $query = "SELECT * FROM sessions WHERE sessionid = '{$sessionid}' AND random = '{$random}' ";
     $recordSet = mysql_query($query) or die(mysql_error());
     $row = mysql_fetch_array($recordSet);
     if ($row["userid"] > 0) {
         $myid = $row["userid"];
     } else {
         $myid = 0;
     }
     //---build megaArray---//
     $megaArray = array();
     array_push($megaArray, "comments");
     $resultArray = explode(":|:|:|:", pageType($q));
     $pageType = $resultArray[0];
     $match = $resultArray[1];
     $query = "SELECT * FROM comments WHERE locationType = '{$pageType}' AND locationid = '{$match}' ";
     $recordSet = mysql_query($query) or die(mysql_error());
     while ($row = mysql_fetch_array($recordSet)) {
         $arrayComment = array();
         if ($myid > 0 and $row["commenterid"] === $myid) {
             $arrayComment[0] = "editable";
         } elseif ($myid > 0 and $row["locationType"] === "profile" and $row["locationid"] === $myid) {
             $arrayComment[0] = "deletable";
         } else {
             $arrayComment[0] = "readable";
         }
         $arrayComment[1] = $row["commentid"];
         $arrayComment[2] = match("users", "userid", "username", $row["commenterid"]);
         $arrayComment[3] = $row["createDate"];
         $arrayComment[4] = unsquiggly($row["comment"]);
         array_push($megaArray, $arrayComment);
     }
     //---return megaArray---//
     for ($i = 1; $i < count($megaArray); $i++) {
         $stringifiedComment = implode(":|:|:|:", $megaArray[$i]);
         $megaArray[$i] = $stringifiedComment;
     }
     return implode(":|::|::|:", $megaArray);
 }
 public function odhlasZTerminu($terminIndex)
 {
     $this->open();
     // Posleme request ze sa chceme odhlasit.
     $data = $this->requestData(array('compName' => 'odstranitTerminAction', 'eventClass' => 'avc.ui.event.AVCActionEvent', 'embObj' => array('objName' => 'terminyTable', 'dataView' => array('activeIndex' => $terminIndex, 'selectedIndexes' => $terminIndex))));
     // Odklikneme konfirmacne okno ze naozaj.
     $data = $this->requestData(array('events' => false, 'app' => false, 'dlgName' => false, 'changedProperties' => array('confirmResult' => 2)));
     if (!preg_match('@dialogManager\\.openDialog\\("PleaseWaitDlg0"@', $data)) {
         throw new Exception('Z termínu sa nepodarilo odhlásiť.<br/>Pravdepodobne termín s daným indexom neexistuje.');
     }
     // Nacitame loading obrazovku.
     $data = AIS2Utils::request('https://ais2.uniba.sk/ais/servlets/WebUIServlet?appId=' . $this->getAppId() . '&form=PleaseWaitDlg0&antiCache=' . random());
     // Zavrieme loading obrazovku. Az po tomto kroku sme naozaj odhlaseni.
     $data = $this->requestData(array('events' => false, 'dlgName' => false, 'appProperties' => array('activeDlgName' => 'PleaseWaitDlg0')));
     $message = match($data, '@webui\\.messageBox\\("([^"]*)"@');
     if ($message !== false && $message != 'Činnosť úspešne dokončená.') {
         throw new Exception("Z termínu sa (pravdepodobne) nepodarilo odhlásiť. Dôvod:<br/><b>" . $message . '</b>');
     }
     return true;
 }
function getPhpDocForFile($fileName)
{
    global $nClasses, $nClassesTotal;
    $phpdoc = "";
    $file = str_replace("\r", "", str_replace("\t", "    ", file_get_contents($fileName, true)));
    $classes = match('#\\n(?:abstract )?class (?<name>\\w+) extends .+\\{(?<content>.+)\\n\\}(\\n|$)#', $file);
    foreach ($classes as &$class) {
        $gets = match('#\\* @return (?<type>\\w+)(?: (?<comment>(?:(?!\\*/|\\* @).)+?)(?:(?!\\*/).)+|[\\s\\n]*)\\*/' . '[\\s\\n]{2,}public function (?<kind>get)(?<name>\\w+)\\((?:,? ?\\$\\w+ ?= ?[^,]+)*\\)#', $class['content']);
        $sets = match('#\\* @param (?<type>\\w+) \\$\\w+(?: (?<comment>(?:(?!\\*/|\\* @).)+?)(?:(?!\\*/).)+|[\\s\\n]*)\\*/' . '[\\s\\n]{2,}public function (?<kind>set)(?<name>\\w+)\\(\\$\\w+(?:, ?\\$\\w+ ?= ?[^,]+)*\\)#', $class['content']);
        $acrs = array_merge($gets, $sets);
        //print_r($acrs); continue;
        $props = array();
        foreach ($acrs as &$acr) {
            $acr['name'] = camelCase($acr['name']);
            $acr['comment'] = trim(preg_replace('#(^|\\n)\\s+\\*\\s?#', '$1 * ', $acr['comment']));
            $props[$acr['name']][$acr['kind']] = array('type' => $acr['type'], 'comment' => fixSentence($acr['comment']));
        }
        /*foreach ($props as $propName => &$prop) // I don't like write-only props...
          if (!isset($prop['get']))
              unset($props[$propName]);*/
        if (count($props) > 0) {
            $phpdoc .= "\n" . $class['name'] . ":\n";
            $phpdoc .= " *\n";
            foreach ($props as $propName => &$prop) {
                $phpdoc .= ' * @';
                /*if (isset($prop['get']) && isset($prop['set'])) // Few IDEs support complex syntax
                      $phpdoc .= 'property';
                  elseif (isset($prop['get']))
                      $phpdoc .= 'property-read';
                  elseif (isset($prop['set']))
                      $phpdoc .= 'property-write';*/
                $phpdoc .= 'property';
                $phpdoc .= ' ' . getPropParam($prop, 'type') . " \${$propName} " . getPropParam($prop, 'comment') . "\n";
            }
            $phpdoc .= " *\n";
            $nClasses++;
        }
        $nClassesTotal++;
    }
    return $phpdoc;
}
Exemplo n.º 25
0
 function signUp($key, $email, $username, $password)
 {
     $errorMessage = "";
     $successMessage = "";
     if (isset($key) and isset($email) and isset($username) and isset($password)) {
         if ($key !== $_SESSION["key"]) {
             $errorMessage = "Please validate email again.";
         } elseif ($email !== $_SESSION["email"]) {
             $errorMessage = "Please validate email again.";
         } else {
             if (match("users", "username", "userid", $username) > 0 or match("projects", "projectName", "projectid", $username) > 0) {
                 $errorMessage = "This username is taken.";
             } else {
                 unset($_SESSION["email"]);
                 unset($_SESSION["key"]);
                 $salt = substr(str_shuffle(str_repeat('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', mt_rand(1, 16))), 0, 16);
                 $password = sha1($password . $salt);
                 $query = "INSERT INTO users (username, email, password, salt) VALUES('{$username}','{$email}','{$password}','{$salt}')";
                 mysql_query($query) or die(mysql_error());
                 $query = "SELECT * FROM users WHERE username = '******' AND email = '{$email}' ";
                 $recordSet = mysql_query($query) or die(mysql_error());
                 $row = mysql_fetch_array($recordSet);
                 $userid = $row["userid"];
                 $random = substr(str_shuffle(str_repeat('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', mt_rand(1, 16))), 0, 16);
                 $browserInfo = $_SERVER['HTTP_USER_AGENT'];
                 $query = "INSERT INTO sessions (userid, random, browserInfo) VALUES ('{$userid}','{$random}','{$browserInfo}')";
                 mysql_query($query) or die(mysql_error());
                 $query = "SELECT * FROM sessions WHERE userid = '{$userid}' AND random = '{$random}' ";
                 $recordSet = mysql_query($query) or die(mysql_error());
                 $row = mysql_fetch_array($recordSet);
                 $_SESSION["sessionid"] = $row["sessionid"];
                 $_SESSION["random"] = $row["random"];
                 $successMessage = "redirect";
             }
         }
     } else {
         $errorMessage = "Please complete all fields.";
     }
     return $errorMessage . ":|:|:|:" . $successMessage;
 }
Exemplo n.º 26
0
 function unsquiggly($string)
 {
     $input = $string;
     preg_match_all("~@{(.*?)}@~", $input, $output);
     $arrayTags = $output[1];
     foreach ($arrayTags as $tagid) {
         $tagName = match("users", "userid", "username", $tagid);
         if ($tagName !== "") {
             $string = str_replace("@{" . $tagid . "}@", "<a class='userTag' href='index.html?q=" . $tagName . "'>" . $tagName . "</a>", $string);
         }
     }
     $input = $string;
     preg_match_all("~#{(.*?)}#~", $input, $output);
     $arrayTags = $output[1];
     foreach ($arrayTags as $tagid) {
         $tagName = match("projects", "projectid", "projectName", $tagid);
         if ($tagName !== "") {
             $string = str_replace("#{" . $tagid . "}#", "<a class='projectTag' href='index.html?q=" . $tagName . "'>" . $tagName . "</a>", $string);
         }
     }
     return $string;
 }
Exemplo n.º 27
0
 function pageType($q)
 {
     if ($q === "") {
         return "home" . ":|:|:|:" . "home";
     } else {
         $q = strip_tags($q);
         $q = trim($q);
         $q = addslashes($q);
         $profileidMatch = match("users", "username", "userid", $q);
         $projectidMatch = match("projects", "projectName", "projectid", $q);
         if ($profileidMatch > 0) {
             $pageType = "profile";
             $match = $profileidMatch;
         } elseif ($projectidMatch > 0) {
             $pageType = "project";
             $match = $projectidMatch;
         } else {
             $pageType = "search";
             $match = $q;
         }
     }
     return $pageType . ":|:|:|:" . $match;
 }
Exemplo n.º 28
0
 public function login(HttpConnection $connection)
 {
     $login = $this->username;
     $krbpwd = $this->krbpwd;
     // Username a password si nebudeme pamatat dlhsie ako treba
     $this->username = null;
     $this->krbpwd = null;
     $data = $connection->get(new NullTrace(), self::LOGIN);
     if (preg_match('@\\<title\\>IIKS \\- Prihlásenie\\</title\\>@', $data)) {
         assert($login !== null && $krbpwd !== null);
         $data = $connection->post(new NullTrace(), self::COSIGN_LOGIN, array('ref' => self::LOGIN, 'login' => $login, 'password' => $krbpwd));
         if (!preg_match('@\\<base href\\="https://ais2\\.uniba\\.sk/ais/portal/pages/portal_layout\\.jsp"\\>@', $data)) {
             if (($reason = match($data, self::COSIGN_ERROR_PATTERN1)) || ($reason = match($data, self::COSIGN_ERROR_PATTERN2)) || ($reason = match($data, self::COSIGN_ERROR_PATTERN3))) {
                 throw new Exception('Nepodarilo sa prihlásiť, dôvod: <b>' . $reason . '</b>');
             }
             throw new Exception('Nepodarilo sa prihlásiť, dôvod neznámy.');
         }
         $this->loggedIn = true;
         return true;
     }
     $this->loggedIn = true;
     // naozaj?
     return true;
 }
Exemplo n.º 29
0
 function editComment($commentid)
 {
     //---get user information---//
     $sessionid = $_SESSION["sessionid"];
     $random = $_SESSION["random"];
     $query = "SELECT * FROM sessions WHERE sessionid = '{$sessionid}' AND random = '{$random}' ";
     $recordSet = mysql_query($query) or die(mysql_error());
     $row = mysql_fetch_array($recordSet);
     //---get comment text---//
     if ($row["userid"] > 0) {
         $myid = $row["userid"];
         if (match("comments", "commentid", "commenterid", $commentid) === $myid) {
             $query = "SELECT * FROM comments WHERE commentid= '{$commentid}' ";
             $recordSet = mysql_query($query) or die(mysql_error());
             $row = mysql_fetch_array($recordSet);
             $commentText = unsquiggly($row["comment"]);
             return "success:|:|:|:" . $commentid . ":|:|:|:" . $commentText;
         } else {
             return "failure:|:|:|:strangerComment";
         }
     } else {
         return "failure:|:|:|:signIn";
     }
 }
function mediabox_insert_head_css($flux)
{
    $config = mediabox_config();
    if ($config['active'] == 'oui' and $f = find_in_path((test_espace_prive() ? "prive/" : "") . "colorbox/" . $config['skin'] . '/colorbox.css')) {
        $flux .= '<link rel="stylesheet" href="' . direction_css($f) . '" type="text/css" media="all" />';
        /**
         * Initialiser la config de la mediabox
         */
        $configmediabox = '<script type="text/javascript">/* <![CDATA[ */
var box_settings = {tt_img:' . ($config['traiter_toutes_images'] == 'oui' ? 'true' : 'false') . ',sel_g:"' . $config['selecteur_galerie'] . '",sel_c:"' . $config['selecteur_commun'] . '",trans:"' . $config['transition'] . '",speed:"' . $config['speed'] . '",ssSpeed:"' . $config['slideshow_speed'] . '",maxW:"' . $config['maxWidth'] . '",maxH:"' . $config['maxHeight'] . '",minW:"' . $config['minWidth'] . '",minH:"' . $config['minHeight'] . '",opa:"' . $config['opacite'] . '",str_ssStart:"' . unicode2charset(html2unicode(_T('mediabox:boxstr_slideshowStart'))) . '",str_ssStop:"' . unicode2charset(html2unicode(_T('mediabox:boxstr_slideshowStop'))) . '",str_cur:"' . _T('mediabox:boxstr_current', array('current' => '{current}', 'total' => '{total}')) . '",str_prev:"' . _T('mediabox:boxstr_previous') . '",str_next:"' . _T('mediabox:boxstr_next') . '",str_close:"' . _T('mediabox:boxstr_close') . '",splash_url:"' . $config['splash_url'] . '"};' . "\n";
        // Si c'est une image, on la chargera avec une redimentionnement automatique
        // Sinon, chargement dans une iframe
        $extension = pathinfo($config['splash_url'], PATHINFO_EXTENSION);
        if (match($extension, 'gif|png|jpg|jpeg')) {
            $configmediabox .= 'var box_settings_iframe = false;' . "\n";
        } else {
            $configmediabox .= 'var box_settings_splash_width = "' . $config['splash_width'] . '";
var box_settings_splash_height = "' . $config['splash_height'] . '";' . "\n";
            $configmediabox .= 'var box_settings_iframe = true;' . "\n";
        }
        $flux = $configmediabox . '/* ]]> */</script>' . "\n" . $flux;
    }
    return $flux;
}