Example #1
0
function getReferer()
{
    // Pay credit to whom we have been sent by: the alias of a page.
    if (!get_class($GLOBALS['pie']['locale'])) {
        $GLOBALS['pie']['locale'] = new Locale();
        $GLOBALS['pie']['locale']->load();
    }
    $t = '<p class="metaInfo">' . $GLOBALS['pie']['locale']->key("RedirectedFrom") . " " . pieMakeLink(htmlspecialchars($_REQUEST['referer']), array('page' => $_REQUEST['page'], 'alias' => $_REQUEST['referer'], 'action' => "alias"), array('title' => $GLOBALS['pie']['locale']->key("Referer"))) . ".</p>\n";
    return $t;
}
Example #2
0
function printReferer()
{
    // Pay credit to whom we have been sent by: the alias of a page.
    include_once $GLOBALS['pie']['library_path'] . "/class/locale.php";
    include_once $GLOBALS['pie']['library_path'] . "/share/link.php";
    if (!get_class($GLOBALS['pie']['locale'])) {
        $GLOBALS['pie']['locale'] = new Locale();
        $GLOBALS['pie']['locale']->load();
    }
    print '<p class="metaInfo">' . $GLOBALS['pie']['locale']->key("RedirectedFrom") . " ";
    print pieMakeLink(htmlspecialchars($_REQUEST['referer']), array('page' => $_REQUEST['page'], 'alias' => $_REQUEST['referer'], 'action' => "alias"), array('title' => $GLOBALS['pie']['locale']->key("Referer")));
    print ".</p>\n";
}
Example #3
0
    if (!count($deadpages) && !count($deadfiles)) {
        pieError("NoDeadLinks");
    }
    pieNotice("ListOfDeadLinks");
    if (count($deadpages)) {
        pieNotice("PageTableHead");
        arsort($deadpages);
        $n = 0;
        foreach ($deadpages as $name => $i) {
            $n++;
            print '<tr class="' . ($n % 2 ? "oddRow" : "evenRow") . '">' . '<td>' . pieMakeLink(htmlspecialchars($name), array('action' => "edit", 'page' => $name), array('class' => "itemLink")) . '</td>' . "<td style=\"text-align: right;\">{$i}</td></tr>\n";
        }
        print "</table>\n";
    }
    if (count($deadfiles)) {
        if (count($deadpages)) {
            print "<br />\n";
        }
        pieNotice("FileTableHead");
        arsort($deadfiles);
        $n = 0;
        foreach ($deadfiles as $name => $i) {
            $n++;
            print '<tr class="' . ($n % 2 ? "oddRow" : "evenRow") . '">' . '<td>' . pieMakeLink(htmlspecialchars($name), array('action' => "upload", 'file' => $name, 'create' => "true"), array('class' => "itemLink")) . '</td>' . "<td style=\"text-align: right;\">{$i}</td></tr>\n";
        }
        print "</table>\n";
    }
} else {
    pieNotice("SelectForm");
}
pieTail();
Example #4
0
        }
        if ($page->meta['comment']) {
            if ($n = preg_match_all($pattern, $page->meta['comment'], $m)) {
                $result[$name] += 2 * $n * $val;
            }
        }
        if ($page->meta['type'] == "alias") {
            continue;
        }
        // Examine the source (of the page).
        if ($n = preg_match_all($pattern, $page->source, $m)) {
            $result[$name] += 2 * $n * $val;
        }
    }
    if (!count($result)) {
        pieError("NoMatches");
    }
    // Present the results:
    arsort($result);
    reset($result);
    list($n, $val) = each($result);
    pieNotice("TableHead");
    $i = 0;
    foreach ($result as $p => $n) {
        $i++;
        print '<tr class="' . ($i % 2 ? "oddRow" : "evenRow") . '">' . "<td>" . pieMakeLink(htmlspecialchars($p), array('page' => $p), array('class' => "itemLink")) . "</td>" . '<td><hr class="gauge" style="width: ' . sprintf("%.2f", $n * 10 / $val) . 'em;" /></td>' . "</tr>\n";
    }
    pieNotice("TableFooter");
} else {
}
pieTail();
Example #5
0
$n = 0;
reset($data);
while ($n < $_REQUEST['offset']) {
    // Skip the offset.
    each($data);
    $n++;
}
// Print the files:
$hint_show = $GLOBALS['pie']['locale']->key("Show");
$hint_info = $GLOBALS['pie']['locale']->key("Info");
$hint_download = $GLOBALS['pie']['locale']->key("Download");
$hint_update = $GLOBALS['pie']['locale']->key("Update");
$ip = pieMakeString('[[$^icon_link]]');
pieNotice("TableHead", array('order' => $_REQUEST['order'] == "ascend" ? "descend" : "ascend"));
while (($item = each($data)) && $n < $_REQUEST['offset'] + $_REQUEST['limit']) {
    print '<tr class="' . ($n % 2 ? "oddRow" : "evenRow") . "\">\n" . "<td>" . pieMakeLink(htmlspecialchars($item[0]), array('action' => "fileinfo", 'file' => $item[0]), array('title' => $hint_info, 'class' => "itemLink")) . "</td>\n" . "<td>" . date($GLOBALS['pie']['time_format'], $item[1]) . "</td>\n" . "<td>" . pieMakeLink("<img src=\"{$ip}/information.png\" alt=\"" . $hint_info . '" />', array('file' => $item[0], 'action' => "fileinfo"), array('title' => $hint_info)) . "</td>\n" . "<td>" . pieMakeLink("<img src=\"{$ip}/eye.png\" alt=\"" . $hint_show . '" />', array('file' => $item[0], 'action' => "dump"), array('title' => $hint_show, 'target' => "_blank")) . "</td>\n" . "<td>" . pieMakeLink("<img src=\"{$ip}/download.png\" alt=\"" . $hint_download . '" />', array('file' => $item[0], 'action' => "download"), array('title' => $hint_download, 'target' => "_blank")) . "</td>\n" . "<td>" . pieMakeLink("<img src=\"{$ip}/upload.png\" alt=\"" . $hint_update . '" />', array('file' => $item[0], 'action' => "upload"), array('title' => $hint_update)) . "</td>\n" . "</tr>\n";
    $n++;
}
print "</table>\n";
// Navigation for long lists.
$data = array('prev' => 0, 'next' => 0);
if ($_REQUEST['offset'] > 0) {
    $data['prev'] = $_REQUEST['offset'] - $_REQUEST['limit'];
    $data['prev'] = max(0, $data['prev']);
} else {
    $data['no_prev'] = 'disabled="disabled"';
}
if ($n < $max) {
    $data['next'] = $n;
} else {
    $data['no_next'] = 'disabled="disabled"';
Example #6
0
 function compile()
 {
     if (!$this->source) {
         $this->trapError('EmptySource');
         return false;
     }
     // Mask any special characters, if necessary.
     $source = preg_replace_callback('/\\x5C([\\x21-\\x2F\\x3A-\\x40\\x5B-\\x60\\x7B-\\x7F])/s', create_function('$matches', 'return(chr(27) . chr(ord($matches[1]) + 128));'), $this->source);
     $source = explode("\n", $source);
     $this->output = '';
     $this->context = array();
     $this->nest = array();
     $this->footnotes = array();
     $this->pages = array();
     $this->files = array();
     $this->error = array();
     $this->custom = array();
     $this->section = 1;
     $newblock = 1;
     $keepblock = 1;
     // Main loop:
     // Parse all lines of the source, one by one.
     while (count($source)) {
         $line = rtrim(array_shift($source));
         if (!$keepblock) {
             $newblock = 0;
         }
         if (empty($line)) {
             // Environments start and end at empty lines.
             $this->output .= $this->endEnvironment();
             $newblock = 1;
             $keepblock = 1;
             continue;
         }
         if (preg_match('/^\\[(\\w+:[^\\[\\]]+)\\]$/', $line, $match)) {
             // A command standing for itself.
             $this->output .= $this->expandCommand($match[1]);
             $keepblock = 1;
             continue;
         }
         $keepblock = 0;
         // Equals sign(s): headline of various levels.
         if (preg_match('/^(={1,5})(.*)$/', $line, $match)) {
             $l = strlen($match[1]);
             if (substr($match[2], 0 - $l) == $match[1]) {
                 $match[2] = rtrim($match[2], '=');
             }
             $this->output .= $this->endEnvironment();
             $this->output .= '<a name="_section' . sprintf('%u', crc32(trim($match[2]))) . "\"></a>\n";
             $this->output .= $this->openTag("h{$l}");
             $this->output .= $this->expandString(trim($match[2]));
             $this->output .= ' <span class="editSection">[';
             $this->output .= pieMakeLink($this->locale->key('EditSection'), array('action' => 'edit', 'page' => $_REQUEST['page'], 'section' => $this->section), array('class' => 'editSection', 'title' => $this->locale->key('HintEditSection')));
             $this->section++;
             $this->output .= ']';
             $this->output .= "</span></h{$l}>\n";
             continue;
         }
         // Asterix: unordered list.
         // Plus and pound sign: ordered list.
         if (preg_match('/^([#\\*\\+]{1,5})\\s*(.*)$/', $line, $match)) {
             $this->output .= $this->handleEnvironment($match[1][0], strlen($match[1]));
             $this->output .= $this->openTag('li') . $this->expandString(trim($match[2])) . "</li>\n";
             continue;
         }
         // Colon: descriptive list entry.
         if ($line[0] == ':') {
             $this->output .= $this->handleEnvironment(':', 1);
             // Escape the colon and handle DT and DD
             // separately from each other.
             $data = preg_split('/:{1,2}/', $this->hideControlChar(substr($line, 1), ':'), 2);
             $t = $this->recoverControlChar(trim($data[0]), ':');
             $this->output .= '<dt>' . $this->expandString($t) . "</dt>\n";
             $t = $this->recoverControlChar(trim($data[1]), ':');
             $this->output .= '<dd>' . $this->expandString($t) . "</dd>\n";
             continue;
         }
         // Vertical bar: a table row.
         if ($line[0] == '|') {
             $this->output .= $this->handleEnvironment('|', 1);
             $data = explode('|', $this->hideControlChar(substr($line, 1), '|'));
             array_pop($data);
             $this->output .= $this->openTag('tr');
             foreach ($data as $i) {
                 $i = $this->recoverControlChar($i, '|');
                 // Take care of special formatting.
                 if (preg_match('/^([<>=]{1,3})([^<>=]+)$/', $i, $m)) {
                     $i = $m[2];
                     $t = 'td';
                     // Equal signs introduce table headers.
                     if (strpos($m[1], '=') !== false) {
                         $t = 'th';
                     }
                     // Horicontal table cell alignment.
                     if (strpos($m[1], '<>') !== false) {
                         $this->output .= "<{$t} style=\"text-align: justify;\">";
                     } elseif (strpos($m[1], '><') !== false) {
                         $this->output .= "<{$t} style=\"text-align: center;\">";
                     } elseif (strpos($m[1], '<') !== false) {
                         $this->output .= "<{$t} style=\"text-align: left;\">";
                     } elseif (strpos($m[1], '>') !== false) {
                         $this->output .= "<{$t} style=\"text-align: right;\">";
                     } else {
                         $this->output .= "<{$t}>";
                     }
                     $this->output .= $this->expandString(trim($i)) . "</{$t}>";
                 } else {
                     $this->output .= '<td>' . $this->expandString(trim($i)) . '</td>';
                 }
             }
             $this->output .= "</tr>\n";
             continue;
         }
         // Horizontal line/rule.
         if ($line == '---') {
             $this->output .= $this->endEnvironment();
             $this->output .= "<hr/>\n";
             continue;
         }
         // Single semicolon: A comment to be ignored.
         if ($line[0] == ';') {
             continue;
         }
         // Exclaimation mark: Verbatim output.
         if ($line[0] == '!') {
             $line = substr($line, 1);
             if (substr($this->output, -7, 7) == "</pre>\n" && !$newblock) {
                 // Append to an existing PRE-block.
                 $this->output = substr($this->output, 0, strlen($this->output) - 7);
                 $this->output .= htmlspecialchars($line) . "\n</pre>\n";
             } else {
                 // Begin a new PRE-block.
                 $this->output .= $this->endEnvironment();
                 $this->output .= $this->openTag('pre') . htmlspecialchars($line) . "\n</pre>\n";
             }
             continue;
         }
         // A backslash at the end of a line merges this line
         // with the successive line.
         while (substr($line, -1) == chr(92) && count($source)) {
             $line = substr($line, 0, strlen($line) - 1);
             $line .= trim(array_shift($source));
         }
         // Standard paragraphs (.. and alignment thereof).
         $align = '';
         if (preg_match('/^([<>]{1,2})(.*)$/', $line, $match)) {
             $align = $match[1];
             $line = ltrim($match[2]);
         }
         if ($newblock || empty($this->output)) {
             // Introduce a new paragraph.
             if ($align == '<>') {
                 $this->custom['style'] = 'text-align: justify;';
             } elseif ($align == '><') {
                 $this->custom['style'] = 'text-align: center;';
             } elseif ($align == '>') {
                 $this->custom['style'] = 'text-align: right;';
             } elseif ($align == '<') {
                 $this->custom['style'] = 'text-align: left;';
             }
             $this->output .= $this->handleEnvironment('p', 1);
             $this->output .= $this->expandString($line);
         } elseif ($this->context[0][0] == 'p') {
             // Append this line to the current paragraph.
             $this->output .= "<br />\n" . $this->expandString($line);
         } else {
             // Graft a new line to the previous environment.
             $this->output = preg_replace('%</(p|li|dd)>$%s', "<br />\n" . $this->expandString($line) . '<\\1>', $this->output);
         }
         // The end of the main loop.
     }
     // No more input lines available.
     // Clean up after parsing.
     if (count($this->context)) {
         $this->output .= $this->endEnvironment();
     }
     if (count($this->nest)) {
         $this->trapError('NestingNotWellFormed');
         foreach ($this->nest as $i) {
             $this->output .= "</{$i}>\n";
         }
     }
     // Append footnotes, if any.
     if (count($this->footnotes)) {
         $this->output .= "<hr class=\"footnote\">\n<ol class=\"footnote\">\n";
         $i = 0;
         foreach ($this->footnotes as $note) {
             $i++;
             $this->output .= "<a name=\"footnote{$i}\"></a><li><a href=\"#ref{$i}\" title=\"" . $this->locale->key('GotoRef') . '">&lArr;</a>&nbsp;' . htmlspecialchars($note) . "</li>\n";
         }
         $this->output .= "</ol>\n";
     }
     // Convert escaped characters back to normal characters.
     $this->output = preg_replace_callback('/\\x1B([\\x80-\\xFF])/', create_function('$matches', 'return(chr(ord($matches[1]) - 128));'), $this->output);
     // Prepand header and append footer, if necessary.
     if ($GLOBALS['pie']['page_header'] && $this->meta['title']) {
         $this->output = '<h1 class="pageHeader">' . htmlspecialchars($this->meta['title']) . "</h1>\n" . $this->output;
     }
     if ($GLOBALS['pie']['page_footer'] && $this->meta['author']) {
         $this->output .= $this->locale->message('PageBottom', array('date' => date($GLOBALS['pie']['time_format'], $this->meta['stamp']), 'author' => $this->meta['author']));
     }
     // Bid farewell.
     if (count($this->error)) {
         return false;
     } else {
         return true;
     }
 }
Example #7
0
    $data['type'] = $GLOBALS['pie']['locale']->key("BinaryFile");
}
if (preg_match('%^(\\w+)/.*$%', $file->meta['type'], $match)) {
    $data['kind'] = $GLOBALS['pie']['locale']->key(ucfirst($match[1]) . 'File');
}
if ($file->meta['comment']) {
    $data['comment'] = htmlspecialchars($file->meta['comment']);
} else {
    $data['comment'] = "&mdash;";
}
$history = $file->history($file->name);
$data['history_count'] = count($history);
$t = 0;
ksort($history);
$n = 0;
foreach ($history as $k => $v) {
    $n++;
    if ($stamp == $k) {
        break;
    }
}
$data['history_index'] = $n;
// Present results:
pieNotice("FileInfo", $data);
switch ($file->meta['type']) {
    case 'image/jpeg':
    case 'image/gif':
    case 'image/png':
        print '<p>' . $GLOBALS['pie']['locale']->key('ImagePreview') . ":</p>\n" . "<p>" . pieMakeLink("<img src=\"" . pieMakeString($GLOBALS['pie']['base_link'], array('action' => 'image', 'file' => urlencode($file->name))) . "action=image&amp;file=" . urlencode($file->name) . '" />', array('action' => 'dump', 'file' => $file->name), array('target' => '_blank', 'title' => $GLOBALS['pie']['locale']->key('ShowFullSized'))) . "</p>\n";
}
pieTail();
Example #8
0
    $n = count($history);
} else {
    ksort($history);
    $n = 1;
}
$hint_info = $GLOBALS['pie']['locale']->key("Info");
$hint_show = $GLOBALS['pie']['locale']->key("Show");
$hint_edit = $GLOBALS['pie']['locale']->key("RevertTo");
$ip = pieMakeString('[[$^icon_link]]');
// Present results:
pieNotice("TableHead");
foreach ($history as $stamp => $info) {
    $comment = $info['comment'];
    if (strlen($comment) > 30) {
        $comment = wordwrap($comment, 30, "\n");
        list($comment) = explode("\n", $comment);
        $comment .= " ...";
    }
    print '<tr class="' . ($n % 2 ? "oddRow" : "evenRow") . '">' . "<td style=\"text-align: right;\">{$n}</td>\n" . "<td>" . date($GLOBALS['pie']['time_format'], $stamp) . "</td>\n" . "<td>" . pieMakeLink(htmlspecialchars($info['author']), array('action' => "userinfo", 'user' => $info['author'])) . "</td>\n" . "<td>" . htmlspecialchars($comment) . "</td>\n" . "<td>" . pieMakeLink("<img src=\"{$ip}/information.png\" alt=\"{$hint_info}\" />", array($context => $_REQUEST[$context], 'action' => "{$context}info", 'stamp' => $info['stamp']), array('title' => $hint_info)) . "</td>\n" . "<td>" . pieMakeLink("<img src=\"{$ip}/eye.png\" alt=\"{$hint_show}\" />", array($context => $_REQUEST[$context], 'action' => "revert", 'stamp' => $info['stamp']), array('title' => $hint_show)) . "</td>\n";
    if ($context == 'page') {
        print "<td>" . pieMakeLink("<img src=\"{$ip}/page_edit.png\" alt=\"{$hint_edit}\" />", array($context => $_REQUEST[$context], 'action' => "edit", 'stamp' => $info['stamp']), array('title' => $hint_edit)) . "</td>\n";
    }
    print "</tr>\n";
    if ($_REQUEST['order'] == "descend") {
        $n--;
    } else {
        $n++;
    }
}
print "</table>\n";
pieTail();
Example #9
0
$n = 1;
$hint_alias = $GLOBALS['pie']['locale']->key("Alias");
$hint_info = $GLOBALS['pie']['locale']->key("Details");
pieNotice("TableHead");
foreach ($data as $i) {
    list($stamp, $name) = explode("\t", $i);
    if (!$page->read($name, 0)) {
        pieError("SourceReadError");
    }
    $comment = $page->meta['comment'];
    if (strlen($comment) > 30) {
        $comment = wordwrap($comment, 30, "\n");
        list($comment) = explode("\n", $comment);
        $comment .= " ...";
    } elseif (!$comment) {
        $comment = '-';
    }
    print '<tr class="' . ($n % 2 ? "oddRow" : "evenRow") . "\">\n<td>";
    if ($page->meta['type'] == 'alias') {
        print pieMakeLink(htmlspecialchars($name) . " <span class=\"warning\">({$hint_alias})</span>", array('action' => 'alias', 'page' => $page->meta['original'], 'alias' => $name), array('class' => "itemLink", 'title' => $hint_info)) . "</td>\n";
    } else {
        print pieMakeLink(htmlspecialchars($name), array('page' => $name), array('class' => "itemLink")) . "</td>\n";
    }
    print "<td>" . date($GLOBALS['pie']['time_format'], $stamp) . "</td>\n" . "<td>" . pieMakeLink(htmlspecialchars($page->meta['author']), array('action' => 'userinfo', 'user' => $page->meta['author']), array('class' => "itemLink")) . "</td>\n" . "<td>" . htmlspecialchars($comment) . "</td>\n" . "</tr>\n";
    $n++;
    if ($n > $_REQUEST['limit']) {
        break;
    }
}
pieNotice("TableTail");
pieTail();
Example #10
0
        if ($resource->meta['original'] != $original) {
            continue;
        }
        $aliases[] = $i;
    }
    if (!count($aliases)) {
        if (@$is_alias) {
            pieTail();
            exit;
        }
        pieError("NoAliases", array('context' => $context, 'original' => htmlspecialchars($original)));
    }
    sort($aliases);
    $hint_descend = $GLOBALS['pie']['locale']->key("Descend");
    $hint_info = $GLOBALS['pie']['locale']->key("Display");
    $hint_delete = $GLOBALS['pie']['locale']->key("Delete");
    $ip = pieMakeString('[[$^icon_link]]');
    $n = 0;
    pieNotice("TableHeader", array('original' => htmlspecialchars($original)));
    foreach ($aliases as $i) {
        $n++;
        print '<tr class="' . ($n % 2 ? "oddRow" : "evenRow") . '">' . "<td>" . pieMakeLink(htmlspecialchars($i), array('action' => "alias", $context => $i), array('title' => $hint_descend, 'class' => "itemLink")) . "</td>\n" . "<td>" . pieMakeLink("<img src=\"{$ip}/information.png\" alt=\"{$hint_info}\" />", array('action' => "alias", $context => $original, 'alias' => $i), array('title' => $hint_info)) . "</td>\n" . "<td>" . pieMakeLink("<img src=\"{$ip}/delete.png\" alt=\"{$hint_delete}\" />", array('action' => "delete", $context => $i), array('title' => $hint_delete)) . "</td>\n" . "</tr>\n";
    }
    pieNotice("TableFooter", array('original' => htmlspecialchars($original), 'context' => $context));
    if (!$is_alias) {
        pieNotice("CreateAlias", array('original' => htmlspecialchars($original), 'context' => $context));
    }
} else {
    pieError("ActionInvalid");
}
pieTail();
Example #11
0
    pieNotice("LinkedPagesHead");
    $n = 0;
    foreach ($pages as $i) {
        $n++;
        print '<tr class="' . ($n % 2 ? "oddRow" : "evenRow") . '">';
        if ($page->exists($i)) {
            print "<td><img src=\"{$ip}/link.png\" alt=\"#\" /></td>\n" . "<td>" . pieMakeLink(htmlspecialchars($i), array('page' => $i), array('class' => "itemLink")) . "</td>";
        } else {
            print "<td><img src=\"{$ip}/link_broken.png\" alt=\"=\" title=\"{$hint_notavail}\" /></td>\n" . "<td>" . pieMakeLink(htmlspecialchars($i), array('page' => $i), array('title' => $hint_notavail)) . "</td>";
        }
        print "<td>" . pieMakeLink("<img src=\"{$ip}/information.png\" alt=\"{$hint_info}\" />", array('page' => $i, 'action' => "pageinfo"), array('title' => $hint_info)) . "</td>\n" . "<td>" . pieMakeLink("<img src=\"{$ip}/page_edit.png\" alt=\"{$hint_edit}\" />", array('page' => $i, 'action' => "edit"), array('title' => $hint_edit)) . "</td>\n" . "</tr>\n";
    }
    pieNotice("TableTail");
}
if (count($files)) {
    $file = new File();
    pieNotice("LinkedFilesHead");
    $n = 0;
    foreach ($files as $i) {
        $n++;
        print '<tr class="' . ($n % 2 ? "oddRow" : "evenRow") . '">';
        if ($file->exists($i)) {
            print "<td><img src=\"{$ip}/link.png\" alt=\"#\" /></td>\n" . "<td>" . pieMakeLink(htmlspecialchars($i), array('file' => $i, 'action' => "download"), array('class' => "itemLink")) . "</td>";
        } else {
            print "<td><img src=\"{$ip}/link_broken.png\" alt=\"=\" title=\"{$hint_notavail}\" /></td>\n" . "<td>" . pieMakeLink(htmlspecialchars($i), array('file' => $i, 'action' => "upload"), array('title' => $hint_notavail)) . "</td>";
        }
        print "<td>" . pieMakeLink("<img src=\"{$ip}/information.png\" alt=\"{$hint_info}\" />", array('file' => $i, 'action' => "fileinfo"), array('title' => $hint_info)) . "</td>\n" . "<td>" . pieMakeLink("<img src=\"{$ip}/download.png\" alt=\"{$hint_download}\" />", array('file' => $i, 'action' => "download"), array('title' => $hint_download)) . "</td>\n" . "<td>" . pieMakeLink("<img src=\"{$ip}/upload.png\" alt=\"{$hint_upload}\" />", array('file' => $i, 'action' => "upload"), array('title' => $hint_upload)) . "</td>\n" . "</tr>\n";
    }
    pieNotice("TableTail");
}
pieTail();
Example #12
0
    pieNotice('UserDeleted');
} elseif (@$_REQUEST['user']) {
    // Ask for approval to delete user.
    pieNotice('AskApproval');
} else {
    // Display a list of users to choose from.
    $ip = pieMakeString('[[$^icon_link]]');
    $hint_delete = $GLOBALS['pie']['locale']->key("Delete");
    $user = new User();
    $map = new MapFile();
    $n = 0;
    $admins = explode(',', $GLOBALS['pie']['admin_list']);
    $list = array();
    for ($name = $user->first(); $name; $name = $user->next()) {
        if (in_array($name, $admins)) {
            continue;
        }
        $list[] = $name;
    }
    if (!count($list)) {
        pieError('NoUsers');
    }
    pieNotice("TableHead");
    sort($list);
    foreach ($list as $name) {
        $n++;
        print '<tr class="' . ($n % 2 ? "oddRow" : "evenRow") . '">' . "<td>" . pieMakeLink(htmlspecialchars($name), array('user' => $name, 'action' => "userinfo"), array('class' => "itemLink")) . "</td>\n" . '<td style="text-align: center;">' . pieMakeLink("<img src=\"{$ip}/delete.png\" alt=\"{$hint_delete}\" />", array('action' => "userdel", 'user' => $name), array('title' => $hint_delete)) . "</td>\n" . "</tr>\n";
    }
    print "</table>\n";
}
pieTail();
Example #13
0
        $previous = prev($history);
        $previous = $previous['stamp'];
    } else {
        krsort($history);
        $n = $max;
        reset($history);
        $current = current($history);
        $current = $current['stamp'];
        $previous = next($history);
        $previous = $previous['stamp'];
    }
    $hint_info = $GLOBALS['pie']['locale']->key("Info");
    $hint_show = $GLOBALS['pie']['locale']->key("Display");
    pieNotice('ListHead');
    foreach ($history as $k => $v) {
        $comment = $v['comment'];
        if (strlen($comment) > 30) {
            $comment = wordwrap($comment, 30, "\n");
            list($comment) = explode("\n", $comment);
            $comment .= " ...";
        }
        print '<tr class="' . ($n % 2 ? 'oddRow' : 'evenRow') . '">' . '<td>' . pieMakeLink($n, array('page' => $_REQUEST['page'], 'action' => "page", 'stamp' => $k), array('title' => $hint_show)) . "</td>\n" . '<td>' . pieMakeLink(date($GLOBALS['pie']['time_format'], $k), array('page' => $_REQUEST['page'], 'action' => "pageinfo", 'stamp' => $k), array('title' => $hint_info)) . "</td>\n" . "<td>" . pieMakeLink(htmlspecialchars($v['author']), array('action' => "userinfo", 'user' => $v['author'])) . "</td>\n" . "<td>" . htmlspecialchars($comment) . "</td>\n" . "<td><input type=\"radio\" name=\"old\" value=\"{$k}\" " . ($k == $previous ? 'checked="checked" ' : '') . "/></td>\n" . "<td><input type=\"radio\" name=\"new\" value=\"{$k}\" " . ($k == $current ? 'checked="checked" ' : '') . "/></td>\n" . "</tr>\n";
        if ($_REQUEST['sort'] == 'ascending') {
            $n++;
        } else {
            $n--;
        }
    }
    pieNotice('ListTail');
}
pieTail();
Example #14
0
    asort($data);
}
$n = 0;
reset($data);
while ($n < $_REQUEST['offset']) {
    // Skip the offset.
    each($data);
    $n++;
}
// Print the pages:
$hint_info = $GLOBALS['pie']['locale']->key("Info");
$hint_edit = $GLOBALS['pie']['locale']->key("Edit");
$ip = pieMakeString('[[$^icon_link]]');
pieNotice("TableHead", array('order' => $_REQUEST['order'] == "ascend" ? "descend" : "ascend"));
while (($item = each($data)) && $n < $_REQUEST['offset'] + $_REQUEST['limit']) {
    print '<tr class="' . ($n % 2 ? "oddRow" : "evenRow") . "\">\n" . "<td>" . pieMakeLink(htmlspecialchars($item[0]), array('page' => $item[0]), array('class' => "itemLink")) . "</td>\n" . "<td>" . date($GLOBALS['pie']['time_format'], $item[1]) . "</td>\n" . "<td>" . pieMakeLink("<img src=\"{$ip}/information.png\" alt=\"" . $hint_info . '" />', array('page' => $item[0], 'action' => "pageinfo"), array('title' => $hint_info)) . "</td>\n" . "<td>" . pieMakeLink("<img src=\"{$ip}/page_edit.png\" alt=\"" . $hint_edit . '" />', array('page' => $item[0], 'action' => "edit"), array('title' => $hint_edit)) . "</td>\n" . "</tr>\n";
    $n++;
}
print "</table>\n";
// Navigation for long lists.
$data = array('prev' => 0, 'next' => 0);
if ($_REQUEST['offset'] > 0) {
    $data['prev'] = $_REQUEST['offset'] - $_REQUEST['limit'];
    $data['prev'] = max(0, $data['prev']);
} else {
    $data['no_prev'] = 'disabled="disabled"';
}
if ($n < $max) {
    $data['next'] = $n;
} else {
    $data['no_next'] = 'disabled="disabled"';
Example #15
0
    $resource = pieGetOption($_REQUEST['file']);
    $file = new File();
    if (!$file->isValidName($resource)) {
        pieError("FileNameInvalid");
    }
    if (!$file->exists($resource)) {
        pieError("FileNotFound");
    }
    $context = "file";
} else {
    pieError("ActionInvalid");
}
// Build the referer list.
if (($referers = pieRefererList($resource, $context)) === false) {
    pieError("RefererError");
}
// Present the result.
if (!count($referers)) {
    pieError("NoReferers");
}
$hint_info = $GLOBALS['pie']['locale']->key("Info");
$hint_edit = $GLOBALS['pie']['locale']->key("Edit");
$ip = pieMakeString('[[$^icon_link]]');
pieNotice("RefererList");
$n = 0;
foreach ($referers as $item) {
    $n++;
    print '<tr class="' . ($n % 2 ? "oddRow" : "evenRow") . '">' . "<td>" . pieMakeLink(htmlspecialchars($item), array('page' => $item), array('class' => "itemLink")) . "</td>\n" . "<td>" . pieMakeLink("<img src=\"{$ip}/information.png\" alt=\"" . $hint_info . '" />', array('page' => $item, 'action' => "pageinfo"), array('title' => $hint_info)) . "</td>\n" . "<td>" . pieMakeLink("<img src=\"{$ip}/page_edit.png\" alt=\"" . $hint_edit . '" />', array('page' => $item, 'action' => "edit"), array('title' => $hint_edit)) . "</td>\n" . "</tr>\n";
}
print "</table>\n";
pieTail();
Example #16
0
<?php

/*
 *	Display a list of available users.
 */
include_once "{$lib}/class/mapfile.php";
include_once "{$lib}/class/user.php";
include_once "{$lib}/share/auth.php";
include_once "{$lib}/share/link.php";
include_once "{$lib}/share/stdio.php";
include_once "{$lib}/share/string.php";
pieRequireUser();
pieHead("edit");
pieNotice("TableHead");
$user = new User();
$map = new MapFile();
$n = 0;
for ($name = $user->first(); $name; $name = $user->next()) {
    $login = $map->read($GLOBALS['pie']['run_path'] . "/user/login.map", $name);
    $n++;
    print '<tr class="' . ($n % 2 ? "oddRow" : "evenRow") . '">' . "<td>" . pieMakeLink(htmlspecialchars($name), array('user' => $name, 'action' => "userinfo"), array('class' => "itemLink")) . "</td>" . "<td>" . ($login ? date($GLOBALS['pie']['time_format'], $login) : "&mdash;") . "</td>" . "</tr>\n";
}
pieNotice("TableFoot", array('count' => $n));
pieTail();