本文整理汇总了PHP中ewiki_t函数的典型用法代码示例。如果您正苦于以下问题:PHP ewiki_t函数的具体用法?PHP ewiki_t怎么用?PHP ewiki_t使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ewiki_t函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ewiki_edit_lock
function ewiki_edit_lock($id, &$data, $action)
{
$keep = 500;
// in seconds
$o = "";
#-- lock dir
if (!file_exists($dir = EWIKI_TMP . "/edit.d/")) {
mkdir($dir);
}
#-- check file
$lockfile = $dir . ewiki_lowercase($id) . ".lock";
$time = 0;
if (file_exists($lockfile)) {
$time = filemtime($lockfile);
}
#-- force
if ($_REQUEST["edit_unlock"]) {
unlink($lockfile);
$time = -1;
} elseif ($_SERVER["REQUEST_METHOD"] == "POST") {
@unlink($lockfile);
} else {
if ($time + $keep > time()) {
$o = ewiki_t("<p class=\"system-message\"><b>_{Warning}</b>:" . " _{This page is currently being edited by someone else}," . " _{and therefore locked currently}." . " " . '<form action="' . $_SERVER[REQUEST_URI] . '" method="POST">' . '<input type="id" name="' . "{$action}/{$id}" . '">' . '<input type="submit" name="edit_unlock" value="_{unlock}">' . '</form>' . "</p>\n");
} elseif ($time) {
// unlink($lockfile);
touch($lockfile);
} else {
touch($lockfile);
}
}
return $o;
}
示例2: ewiki_page_liveuser_chprefs
/**
* changes user preferences based on form input
*
* @param mixed id
* @param mixed data
* @return mixed
*/
function ewiki_page_liveuser_chprefs($id, $data)
{
global $liveuser, $liveuserDB;
// if form was submitted, write
if (isset($_REQUEST['submit_prefs'])) {
return ewiki_t('CHPWFORM');
}
ob_start();
echo ewiki_make_title($id, $id, 2);
$results = $liveuserDB->getAll('SELECT * FROM ' . LW_PREFIX . '_prefs_fields');
foreach ($results as $result) {
if (isset($_REQUEST[$result['field_name']])) {
liveuser_pref_setPref($liveuser->getHandle(), $result['field_name'], $_REQUEST[$result['field_name']]);
}
}
echo '<form action="" method="post"><table border="1">';
foreach ($results as $result) {
echo '<tr><td>';
echo '<label for="' . $result['field_name'] . '">' . $result['field_name'] . '</label></td><td>';
echo '<input id="' . $result['field_name'] . '" name="' . $result['field_name'] . '" type="text" ';
echo ' value=' . liveuser_pref_getPref($liveuser->getHandle(), $result['field_name']) . '></td></tr>';
}
echo '<tr><td colspan="2"><input type="reset" text="Reset"><input type="submit"></td></tr></table></form>';
$o = ob_get_contents();
ob_end_clean();
return $o;
}
示例3: ewiki_view_append_attachments
function ewiki_view_append_attachments($id, $data, $action)
{
$o = '<hr /><h4><a href="' . ewiki_script(EWIKI_ACTION_ATTACHMENTS, $id) . '">' . ewiki_t("ATTACHMENTS") . '</a></h4>';
$scan = 's:7:"section";' . serialize($id);
$result = ewiki_database("SEARCH", array("meta" => $scan));
#### BEGIN MOODLE CHANGES - show attachments link only if there are attachments.
#### - don't show the attachments on the content page.
if (count($result->entries) <= 0) {
$o = '';
}
// $ord = array();
// while ($row = $result->get()) {
// $ord[$row["id"]] = $row["created"];
// }
// arsort($ord);
//
// foreach ($ord as $id => $uu) {
// $row = ewiki_database("GET", array("id"=>$id));
// if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth($row["id"], $row, "view")) {
// continue;
// }
// $o .= ewiki_entry_downloads($row, "*");
// }
#### END MOODLE CHANGES
return $o;
}
示例4: ewiki_extract
function ewiki_extract($id, $data, $action)
{
global $ewiki_links, $ewiki_config, $ewiki_plugins, $ewiki_ring, $ewiki_title;
$extracttypes = $ewiki_config["extracttypes"][$action];
$o = ewiki_make_title($id, ewiki_t(strtoupper($action) . "FROM") . $ewiki_title, 2, $action, "", "_MAY_SPLIT=1");
//ignore any number of list markup tags in front of an @@{todotype},
//extract only the @@, the types, and their message
//or
//extract any header line
//1 2 3 4-Class 5 6
preg_match_all("/^(([-;:#\\* ]*)(@@(" . implode("|", $extracttypes) . ")(.*))|(!+.*))\$/im", $data["content"], $matches);
for ($index = 0; $index < sizeof($matches[0]); $index++) {
//a line will be either header or todo, concatenate the two sub expressions
$extractedContent .= $matches[3][$index] . $matches[6][$index] . "\n\n";
}
//Render extracted lines as a wiki page, this code extracted from ewiki_page
#-- render requested wiki page <-- goal !!!
$o .= "<div class='ewiki_page_todolist'>" . $ewiki_plugins["render"][0]($extractedContent . ewiki_t(strtoupper($action) . "POSTSCRIPT"), 1, EWIKI_ALLOW_HTML || @$data["flags"] & EWIKI_DB_F_HTML) . "</div>";
#-- control line + other per-page info stuff
if ($pf_a = $ewiki_plugins["view_append"]) {
ksort($pf_a);
foreach ($pf_a as $n => $pf) {
$o .= $pf($id, $data, $action);
}
}
if ($pf_a = $ewiki_plugins["view_final"]) {
ksort($pf_a);
foreach ($pf_a as $n => $pf) {
if (!preg_match('/_title/', $pf)) {
$pf($o, $id, $data, $action);
}
}
}
return $o;
}
示例5: ewiki_addpage
function ewiki_addpage($id, &$data, $version)
{
$o = ewiki_make_title($id, $id, 2);
#-- output page creation dialog
if (empty($_REQUEST["new_id"])) {
$o .= ewiki_t('<form action="' . ewiki_script("", $id) . '" method="POST" enctype="multipart/formdata"> ' . '_{name of the new page} <input type="text" name="new_id" size="26" value="">' . '<br />' . '<input type="submit" value="_{create}">' . '<br /><br />' . '<input type="checkbox" name="add_link_from" value="1" checked="checked">' . ' _{link it from} ' . '<input type="text" name="link_from" size="20" value="_{AddedPages}">' . '</form>');
} else {
$new_id = trim($_REQUEST["new_id"]);
#-- add a link to new page
if ($_REQUEST["add_link_from"] && ($from = $_REQUEST["link_from"])) {
$row = ewiki_db::GET($from);
if ($row && $row["version"]) {
if (($row["flags"] & EWIKI_DB_F_TYPE) == EWIKI_DB_F_TEXT) {
$row["version"]++;
$row["content"] .= "\n* [{$new_id}]";
ewiki_scan_wikiwords($row["content"], $row["refs"], "_STRIP_EMAIL=1");
$row["refs"] = "\n\n" . implode("\n", array_keys($row["refs"])) . "\n\n";
} else {
$row = false;
}
} else {
$row = array("id" => $from, "version" => 1, "flags" => EWIKI_DB_F_TEXT, "created" => time(), "lastmodified" => time(), "hits" => 0, "meta" => "", "content" => "\n* [{$new_id}]", "refs" => "\n\n{$new_id}\n\n");
}
if ($row) {
ewiki_db::WRITE($row);
}
}
#-- call edit <form>
$o = ewiki_page($new_id);
}
return $o;
}
示例6: ewiki_page_wiki_dump_tarball
function ewiki_page_wiki_dump_tarball($id, $data, $action)
{
#-- return legacy page
if (empty($_REQUEST["download_tarball"])) {
$url = ewiki_script("", $id);
return ewiki_make_title($id, $id, 2) . ewiki_t(<<<END
_{WIKIDUMP}
<br /><br />
<form action="{$url}" method="POST" enctype="multipart/form-data">
<input type="hidden" name="id" value="{$id}">
<input type="submit" name="download_tarball" value="_{download tarball}">
<br /><br />
<input type="checkbox" name="dump_images" value="1"> _{with images}<br />
<input type="checkbox" name="dump_virtual" value="1"> _{include virtual pages}<br />
<input type="checkbox" name="dump_fullhtml" value="1" checked> _{complete .html files}<br />
<input type="checkbox" name="dump_linksto" value="1"> _{with backlink pages}<br />
</form>
END
);
} else {
$di = $_REQUEST["dump_images"];
$fh = $_REQUEST["dump_fullhtml"];
$bl = $_REQUEST["dump_linksto"];
$vp = $_REQUEST["dump_virtual"];
$_REQUEST = $_GET = $_POST = array();
set_time_limit(180);
ewiki_page_wiki_dump_send($di, $fh, $vp, $bl);
}
}
示例7: ewiki_auth_query_http
function ewiki_auth_query_http(&$data, $force_query = 0)
{
global $ewiki_plugins, $ewiki_errmsg, $ewiki_author, $ewiki_ring;
#-- fetch user:password
if ($uu = trim($_SERVER["HTTP_AUTHORIZATION"])) {
$auth_method = strtolower(strtok($uu, " "));
if ($auth_method == "basic") {
$uu = strtok(" ;,");
$uu = base64_decode($uu);
list($_a_u, $_a_p) = explode(":", $uu, 2);
} else {
#-- invalid response, ignore
}
} elseif (strlen($_a_u = trim($_SERVER["PHP_AUTH_USER"]))) {
$_a_p = trim($_SERVER["PHP_AUTH_PW"]);
}
#-- check password
$_success = ewiki_auth_user($_a_u, $_a_p);
#-- request HTTP Basic authentication otherwise
if (!$_success && $force_query || $force_query >= 2) {
$realm = ewiki_t("RESTRICTED_ACCESS");
$addmethod = "";
if ($uu = $ewiki_config["login_notice"]) {
$realm .= " " . $uu;
}
if ($uu = $ewiki_config["http_auth_add"]) {
$addmethod = ", {$uu} realm=\"{$realm}\"";
}
header('HTTP/1.1 401 Authentication Required');
header('Status: 401 Authentication Required');
header('WWW-Authenticate: Basic realm="' . $realm . '"' . $addmethod);
}
#-- fin
return $_success;
}
示例8: ewiki_createpage
function ewiki_createpage($id, &$data, $version)
{
$o = ewiki_make_title($id, $id, 2);
#-- output page creation dialog
$o .= ewiki_t('<form action="' . ewiki_script("", "") . '" method="POST" enctype="multipart/formdata"> ' . '_{name of the new page} <input type="text" name="id" size="26" value="">' . '<br />' . '<input type="submit" value="_{create}">' . '</form>');
return $o;
}
示例9: ewiki_edit_form_append_updFormat
function ewiki_edit_form_append_updFormat($id, $data, $action)
{
global $ewiki_ring;
if (!ewiki_auth_perm_liveuser($id, $data, 'manage', $ewiki_ring, 0)) {
return '';
}
return ' <a href="' . ewiki_script('updformatheader', $id) . '">' . ewiki_t("UPDHEADERFORMAT") . '</a>';
}
示例10: ewiki_edit_save_antibot_checkbox
function ewiki_edit_save_antibot_checkbox(&$save, &$data)
{
global $ewiki_errmsg;
if (!$_REQUEST["antibot_check"] && !isset($GLOBALS["ewiki_no_bot"])) {
$save = NULL;
$ewiki_errmsg = ewiki_t("ANTIBOT_FAILED");
}
}
示例11: ewiki_password_status
function ewiki_password_status($id, &$data, $action)
{
global $liveuser;
$passwd_status = ewiki_get_uservar("passwdstatus", 'expired');
if ($passwd_status != 'good' && $id != "Logout" && $id != "ChangePassword" && $liveuser->isLoggedIn()) {
return ewiki_make_title($id, "Change Password:") . "<p>You password has expired</p>" . ewiki_t("CHPW_FORM");
}
return 0;
}
示例12: ewiki_edit_user_flags
function ewiki_edit_user_flags($id, &$data, $action)
{
global $ewiki_config;
$o = "";
foreach ($ewiki_config as $FLAG => $str) {
$o .= '<input type="checkbox" name="page_user_flag[' . dechex($FLAG) . ']" value="1"' . ($FLAG != EWIKI_DB_F_MINOR && $data["flags"] & $FLAG ? " checked" : "") . ' id="page_user_flag_' . $FLAG . '"><label for="page_user_flag_' . $FLAG . '"> ' . ewiki_t($str) . '</label><br />' . "\n";
}
return $o;
}
示例13: ewiki_builtin_categories
function ewiki_builtin_categories($id, &$data, $action)
{
global $ewiki_categories;
$cat = array_merge(array("" => "-"), $ewiki_categories);
$current = @$data["meta"]["meta"][EWIKI_BULTINCAT_METAID];
$o = "<br /> \n " . ewiki_t("category") . ": ";
$o .= ewiki_htm_select(EWIKI_UP_SET_CATEGORY, $cat, $current);
return $o;
}
示例14: ewiki_view_append_subpages
function ewiki_view_append_subpages($id, $data, $action, $title = "SUBPAGES", $class = "subpages")
{
$pages = ewiki_subpage_list($id);
if (0 == count($pages)) {
return "";
}
$o = '<div class="' . $class . '"><small>' . ewiki_t($title) . ":</small><br />";
$o .= ewiki_list_pages($pages) . "</div>\n";
return $o;
}
示例15: ewiki_aedit_authorname
function ewiki_aedit_authorname($id, &$data, $action)
{
$var = EWIKI_UP_AUTHOR_NAME;
return ewiki_t(<<<EOT
<br />
_{set the AuthorName to} <input size="20" name="{$var}" value="{$GLOBALS['ewiki_author']}">
<br />
EOT
);
}