예제 #1
0
function view_macro_wanted($args)
{
    global $pagestore, $LkTbl, $PgTbl;
    // Check for CurlyOptions, and split them
    preg_match("/^(?:\\s*{([^]]*)})?\\s*(.*)\$/", $args, $arg);
    $options = split(',', $arg[1]);
    $search = $arg[2];
    // Defaults
    $displayOrigin = false;
    // Parse options
    foreach ($options as $opt) {
        list($name, $value) = split('=', $opt);
        $name = strtolower($name);
        if (preg_match("/^or/i", $name)) {
            // ORigin  - Displays origin of wanted pages
            $displayOrigin = !($value == 'false');
        }
    }
    $text = '';
    $first = 1;
    $q1 = $pagestore->dbh->query("SELECT l.link, SUM(l.count) AS ct, l.page, p.title " . "FROM {$LkTbl} AS l LEFT JOIN {$PgTbl} AS p " . "ON l.link = p.title " . "WHERE p.title IS NULL " . "GROUP BY l.link " . "ORDER BY ct DESC, l.link");
    while ($result = $pagestore->dbh->result($q1)) {
        if (!$first) {
            $text = $text . "\n";
        } else {
            $first = 0;
        }
        if ($displayOrigin) {
            if ($result[1] > 1) {
                $q2 = $pagestore->dbh->query("SELECT l.page, l.link from {$LkTbl} as l " . "WHERE l.link = '" . $result[0] . "'");
                $deref = ' ' . PARSE_From . ' ';
                while ($res2 = $pagestore->dbh->result($q2)) {
                    $deref .= html_url(editUrl($res2[0]), '?' . $res2[0]) . ', ';
                }
                $deref = preg_replace("/, \$/", "", $deref);
            } else {
                $deref = ' ' . PARSE_From . ' ' . html_url(editURL($result[2]), '?' . $result[2]);
            }
        } else {
            $deref = '';
        }
        $text = $text . '(' . html_url(findURL($result[0]), $result[1]) . ') ' . html_ref($result[0], $result[0]) . $deref;
    }
    return html_code($text);
}
예제 #2
0
function template_common_epilogue($args)
{
    global $FindScript, $pagestore;
    ?>
<div id="footer">
<hr />
<div id="toolbar-bottom">
<?php 
    if ($args['edit']) {
        if ($args['editver'] == 0) {
            echo '<a href="' . editUrl($args['edit']) . '">' . TMPL_EditDocument . '</a>';
        } else {
            if ($args['editver'] == -1) {
                echo TMPL_NoEditDocument;
            } else {
                echo '<a href="' . editUrl($args['edit'], $args['editver']) . '">' . TMPL_EditArchiveVersion . '</a>';
            }
        }
        if ($args['history']) {
            print ' | ';
        }
    }
    if ($args['history']) {
        echo '<a href="' . historyURL($args['history']) . '">' . TMPL_ViewDocHistory . '</a><br />';
    }
    if ($args['timestamp']) {
        echo "\n</div>\n" . TMPL_DocLastModified . ' ' . html_time($args['timestamp']) . '<br />';
    }
    if ($args['twin'] != '') {
        if (count($twin = $pagestore->twinpages($args['twin']))) {
            echo TMPL_TwinPages . ' ';
            for ($i = 0; $i < count($twin); $i++) {
                print html_twin($twin[$i][0], $twin[$i][1]) . ' <br />';
            }
        }
    }
    if (!$args['nosearch']) {
        ?>
<form method="get" action="<?php 
        print $FindScript;
        ?>
">
<div class="form">
  <input type="hidden" name="action" value="find" />
  <?php 
        print TMPL_Search;
        ?>
 <input type="text" name="find" size="20" />
</div>
</form>
<?php 
    }
    ?>
</div>
<!-- Commented out since this is done via Group-Office framework
</body>
</html>
-->
<?php 
    // Following three lines are commented out since this is done via Group-Office framework
    //  $size = ob_get_length();
    //  header("Content-Length: $size");
    //  ob_end_flush();
}