コード例 #1
0
ファイル: common.php プロジェクト: apenwarr/gracefultavi
function toolbar($page, $args)
{
    // view
    toolbar_button($args['button_view'] ? viewURL($args['headlink']) : '', 'View', $args['button_selected'] == 'view');
    // edit
    $edit_label = 'Edit';
    if (isset($args['editver']) && $args['editver'] > -1) {
        if ($args['editver'] == 0) {
            $edit_url = editURL($args['headlink']);
        } else {
            $edit_url = editURL($args['headlink'], $args['editver']);
            $edit_label = 'Edit Archive';
        }
    } else {
        $edit_url = '';
    }
    toolbar_button($edit_url, $edit_label, $args['button_selected'] == 'edit');
    // diff
    $diff_url = isset($args['timestamp']) && $args['timestamp'] != '' ? historyURL($args['headlink']) : '';
    toolbar_button($diff_url, 'Diff', $args['button_selected'] == 'diff');
    // backlinks
    $backlinks_url = $args['button_backlinks'] && $args['headlink'] ? backlinksURL($args['headlink']) : '';
    toolbar_button($backlinks_url, 'Backlinks', $args['button_selected'] == 'backlinks');
    // toolbar buttons added by macros
    global $macroToolbarButtons;
    ksort($macroToolbarButtons);
    foreach ($macroToolbarButtons as $macro => $label) {
        toolbar_button(macroURL($page, $macro, ''), $label, false);
    }
}
コード例 #2
0
ファイル: index.php プロジェクト: hardikk/HNH
function _moduleContent(&$smarty, $module_name)
{
    require_once "modules/{$module_name}/libs/externalUrl.class.php";
    load_language_module($module_name);
    //include module files
    include_once "modules/{$module_name}/configs/default.conf.php";
    global $arrConf;
    global $arrConfig;
    //folder path for custom templates
    $base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
    $templates_dir = isset($arrConfig['templates_dir']) ? $arrConfig['templates_dir'] : 'themes';
    $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme'];
    // Conexión a la base de datos CallCenter
    $pDB = new paloDB($arrConf['cadena_dsn']);
    // Mostrar pantalla correspondiente
    $contenidoModulo = '';
    $sAction = 'list_urls';
    if (isset($_GET['action'])) {
        $sAction = $_GET['action'];
    }
    switch ($sAction) {
        case 'new_url':
            $contenidoModulo = newURL($pDB, $smarty, $module_name, $local_templates_dir);
            break;
        case 'edit_url':
            $contenidoModulo = editURL($pDB, $smarty, $module_name, $local_templates_dir);
            break;
        case 'list_urls':
        default:
            $contenidoModulo = listURL($pDB, $smarty, $module_name, $local_templates_dir);
            break;
    }
    return $contenidoModulo;
}
コード例 #3
0
function template_common_epilogue($args)
{
    global $FindScript, $pagestore, $PrefsScript, $AdminScript;
    //echo "<p>template_common_epilogue(".print_r($args,True).")</p>";
    ?>
<div id="footer">
<hr align=left width=99% />
<?php 
    if (!$args['nosearch']) {
        ?>
	
    <form method="POST" action="<?php 
        print $FindScript;
        ?>
" name="thesearch">
      <div class="form">
        <input type="hidden" name="action" value="find" />
<?php 
    }
    if ($args['edit']) {
        if ($args['editver'] == 0) {
            echo '<a href="' . editURL($args['edit']) . '">' . lang('Edit this document') . '</a>';
        } else {
            if ($args['editver'] == -1) {
                echo lang('This page can not be edited.');
            } else {
                echo '<a href="' . editURL($args['edit'], $args['editver']) . '">' . lang('Edit this <em>ARCHIVE VERSION</em> of this document') . '</a>';
            }
        }
        if ($args['history']) {
            print ' | ';
        }
    }
    if ($args['history']) {
        echo '<a href="' . historyURL($args['history']) . '">' . lang('View document history') . '</a>';
        echo ' | <a href="' . $PrefsScript . '">' . lang('Preferences') . '</a>';
        if (!$args['nosearch']) {
            echo '| ' . lang('Search') . ': <input type="text" name="find" size="20" />';
        }
        echo "<br />";
    }
    if ($args['timestamp']) {
        echo lang('Document last modified') . ' ' . html_time($args['timestamp']) . '<br />';
    }
    ?>
      </div>
    </form>
<?php 
    if ($args['twin'] != '') {
        if (count($twin = $pagestore->twinpages($args['twin']))) {
            echo lang('Twin pages') . ': ';
            for ($i = 0; $i < count($twin); $i++) {
                print html_twin($twin[$i][0], $twin[$i][1]) . ' ';
            }
            ?>
<br /><?php 
        }
    }
    if (!$args['nosearch'] && $args['history']) {
        echo "\n<hr align=left width=99% />\n";
    }
    ?>
</div>
<?php 
    //</body>
    //</html>
    /*
      $size = ob_get_length();
      ##header("Content-Length: $size");
      ob_end_flush();
    */
}
コード例 #4
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);
}
コード例 #5
0
function html_ref($page, $appearance, $hover = '', $anchor = '', $anchor_appearance = '')
{
    global $db, $SeparateLinkWords;
    if (!is_array($page) && strstr($page, ':')) {
        list($name, $lang) = explode(':', $page);
        if (strlen($lang) == 2 || strlen($lang) == 5 && $lang[2] == '-') {
            $page = array('name' => $name, 'lang' => $lang);
        }
    }
    $title = get_title($page);
    if (is_array($appearance)) {
        $appearance = $appearance['lang'] && $appearance['lang'] != $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] ? $appearance['title'] . ':' . $appearance['lang'] : $appearance['title'];
    }
    if ($hover != '') {
        $hover = ' title="' . $hover . '"';
    }
    global $pagestore;
    $p = $pagestore->page($page);
    if ($p->exists()) {
        if ($SeparateLinkWords && $title == $appearance) {
            $appearance = html_split_name($title);
        }
        return '<a href="' . viewURL($page) . $anchor . '"' . $hover . ' class="wiki">' . $appearance . $anchor_appearance . '</a>';
    } elseif (!$p->acl_check()) {
        if (validate_page($title) == 1 && $appearance == $title) {
            return $title;
        } else {
            return $appearance;
        }
    } else {
        if (validate_page($title) == 1 && $appearance == $title) {
            return $title . '<a href="' . editURL($page) . '"' . $hover . '>?</a>';
        } else {
            return '(' . $appearance . ')<a href="' . editURL($page) . '"' . $hover . '>?</a>';
        }
    }
}
コード例 #6
0
ファイル: html.php プロジェクト: apenwarr/gracefultavi
function html_ref($refPage, $appearance, $hover = '', $anchor = '', $anchor_appearance = '')
{
    global $db, $SeparateLinkWords, $page, $pagestore;
    if ($hover != '') {
        $hover = ' alt="' . $hover . '" title="' . $hover . '"';
    }
    $redirect_from = '';
    if ($page == 'RecentChanges') {
        $p_exists = $pagestore->page_exists($refPage);
    } else {
        $p = new WikiPage($db, $refPage);
        $p_exists = $p->exists();
        // automatically handle plurals
        if (!$p_exists) {
            foreach (array('s', 'es') as $plural) {
                if (substr($refPage, -strlen($plural)) == $plural) {
                    $temp_refPage = substr($refPage, 0, strlen($refPage) - strlen($plural));
                    $p = new WikiPage($db, $temp_refPage);
                    if ($p_exists = $p->exists()) {
                        $redirect_from = $refPage;
                        $refPage = $temp_refPage;
                        break;
                    }
                }
            }
        }
    }
    $twintext = "";
    $onlytwin = "";
    $twin = $pagestore->twinpages($refPage, $page);
    if (!$p_exists && count($twin) == 1) {
        $onlytwin = html_twin_x($twin[0][0], $twin[0][1], $twin[0][1]);
    } else {
        if (count($twin)) {
            // point at the sisterwiki's version
            $n = 1;
            foreach ($twin as $site) {
                $twintext = $twintext . html_twin_x($site[0], $n, $site[1]);
                $n++;
            }
            $twintext = '<sup>' . $twintext . '</sup>';
        }
    }
    if ($p_exists) {
        if ($SeparateLinkWords && $refPage == $appearance) {
            $appearance = html_split_name($refPage);
        }
        $result = '<a href="' . viewURL($refPage) . ($redirect_from ? '&redirect_from=' . $redirect_from : '') . $anchor . '"' . $hover . '>' . $appearance . $anchor_appearance . '</a>' . $onlytwin;
    } else {
        $result = "";
        if (validate_page($refPage) == 1 && $appearance == $refPage) {
            if ($onlytwin) {
                $result = $onlytwin;
            } else {
                $result = $refPage;
            }
        } else {
            // Puts the appearance between parenthesis if there's a space in it.
            if (strpos($appearance, ' ') === false) {
                $tempAppearance = $appearance;
            } else {
                $tempAppearance = "({$appearance})";
            }
            if ($onlytwin) {
                $result = $onlytwin;
            } else {
                $result = $tempAppearance;
            }
        }
        $result = $result . '<a href="' . editURL($refPage, '', $page) . '"' . ' title="Create this Wiki page" ' . $hover . '>?</a>' . $twintext;
    }
    return $result;
}
コード例 #7
0
ファイル: html.php プロジェクト: BackupTheBerlios/hpt-obm-svn
function html_ref($page, $appearance, $hover = '', $anchor = '', $anchor_appearance = '')
{
    global $db, $SeparateLinkWords;
    if ($hover != '') {
        $hover = ' title="' . $hover . '"';
    }
    $p = new WikiPage($db, $page);
    if ($p->exists()) {
        if ($SeparateLinkWords && $page == $appearance) {
            $appearance = html_split_name($page);
        }
        return '<a href="' . viewURL($page) . $anchor . '"' . $hover . '>' . $appearance . $anchor_appearance . '</a>';
    } else {
        if (validate_page($page) == 1 && $appearance == $page) {
            return $page . '<a href="' . editURL($page) . '"' . $hover . '>?</a>';
        } else {
            return '(' . $appearance . ')<a href="' . editURL($page) . '"' . $hover . '>?</a>';
        }
    }
}