Ejemplo n.º 1
0
 protected function parseBlock($lines, $current = 0)
 {
     //printf("parseBlock: line %s\n", $current);
     $rootBlock = new Block('[root]');
     for ($i = $current, $count = count($lines); $i < $count; $i++) {
         $line = trim($lines[$i]);
         $line = $this->stripComment($line);
         if ($line === '' || $line[0] === '#') {
             //printf("parseBlock: skip line %s\n", $i);
             continue;
         }
         if ($line[strlen($line) - 1] === '{') {
             list($block, $i) = $this->parseBlock($lines, ++$i);
             if ($block !== false) {
                 list($name, $value) = $this->parseLine($line);
                 $block->name = $name;
                 $block->value = $value;
                 $rootBlock->addBlock($block);
             }
             continue;
         }
         if ($line === '}') {
             return [$rootBlock, $i];
         }
         list($property, $i) = $this->parseProperty($lines, $i);
         if ($property !== false) {
             $rootBlock->addProperty($property);
         }
     }
     return $rootBlock;
 }
Ejemplo n.º 2
0
//$if (!$searchnum)
//begin displaying if there is a user with name or number given
// Create the new page
if (User::logged_in()) {
    //TODO add searchname instead?
    $page->url = add_param($page->url, 'searchnum', $searchnum);
    $addtolist = isset($_POST['addtolist']) ? (bool) $_POST['addtolist'] : false;
    // if person is manipulating which tier this plan is on their autoread list
    if (isset($_POST['block_user'])) {
        if ($_POST['block_user'] == 1) {
            $user = User::get();
            if ($user->webview == 1) {
                $warning = new AlertText("Warning! Your plan is set to be viewable by guests. This will allow blocked users to read your plan\nsimply by logging out. If you would like to change this setting, please visit\n<a href=\"/webview.php\">the guest settings page</a>.");
                $page->append($warning);
            }
            Block::addBlock($idcookie, $searchnum);
            $msg = new InfoText("<p>You have blocked this user. Blocking a user is one-directional. Selecting \"Block\" renders the contents of your plan unavailable to this user. Neither will see any [planlove] by the other, and any updates either make will not show up on each other’s planwatch.</p>\n\n<p>If this block was made in error, please use the option at the bottom of the page to un-do.</p>");
        } else {
            Block::removeBlock($idcookie, $searchnum);
            $msg = new InfoText("User " . $planinfo[0][0] . " has been unblocked.");
        }
        $page->append($msg);
    } else {
        if ($addtolist) {
            $privlevel = isset($_POST['privlevel']) ? (int) $_POST['privlevel'] : 0;
            if ($privlevel == 0) {
                mysql_query("DELETE FROM autofinger WHERE owner = '{$idcookie}' and interest = '{$searchnum}'");
                $yay = new InfoText("User " . $planinfo[0][0] . " removed from your autoread list.");
            } else {
                if ($privlevel > 0 && $privlevel <= 3) {
                    mysql_query("INSERT INTO autofinger (owner, interest, priority) VALUES ('{$idcookie}', '{$searchnum}', '{$privlevel}') ON DUPLICATE KEY UPDATE priority={$privlevel}");