[ewiki] Re: ewiki_control_links() refactor
- From: Andy Fundinger <Andy@xxxxxxxxxxx>
- To: "'ewiki@xxxxxxxxxxxxx'" <ewiki@xxxxxxxxxxxxx>
- Date: Thu, 18 Mar 2004 11:42:13 -0500
Can I commit this change?
On Thu, 2004-03-11 at 12:28, Andy Fundinger wrote:
> I would like us to refactor ewiki_control_links() so that I can reuse
> the inner foreach in page_info, page_imagegallery, and the downloads
> system. The below code implements this and also adds a security check.
> Can I commit this?
>
> Andy
>
> function ewiki_control_links($id, &$data, $action) {
>
> global $ewiki_plugins, $ewiki_ring, $ewiki_config;
> $action_links = & $ewiki_config["action_links"][$action];
>
> #-- disabled
> if (!$ewiki_config["control_line"]) {
> return("");
> }
>
> $o = "\n"
> . '<div align="right" class="action-links control-links">'
> . "\n<br>\n"
> . "<hr noshade>" . "\n";
>
>
> if (@$data["forced_version"]&&ewiki_auth($id, $data, "edit")) {
>
> $o .= '<form action="' . ewiki_script("edit", $id) . '"
> method="POST">' .
> '<input type="hidden" name="edit" value="old">' .
> '<input type="hidden" name="version"
> value="'.$data["forced_version"].'">' .
> '<input type="submit" value="' . ewiki_t("OLDVERCOMEBACK") .
> '"></form> ';
> }
> else {
> $o .= ewiki_control_links_list($id, &$data, $action_links);
> }
>
> if ($data["lastmodified"] >= UNIX_MILLENNIUM) {
> $o .= ' <small>' . strftime(ewiki_t("LASTCHANGED"),
> @$data["lastmodified"]) . '</small>';
> }
>
> $o .= "</div>\n";
>
> return($o);
> }
>
> //The core of ewiki_control_links, separated for use in info and plugins
> function ewiki_control_links_list($id, &$data,
> $action_links,$version=NULL) {
> global $ewiki_plugins;
>
> foreach ($action_links as $action => $title)
> if (!empty($ewiki_plugins["action"][$action]) ||
> !empty($ewiki_plugins["action_always"][$action]) || strpos($action,
> ":/"))
> {
> if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING &&
> !ewiki_auth($id, $data, $action)) { continue; }
>
> $o .= '<a href="' //What is the :/ ?
> . (strpos($action, ":/") ? $action : ewiki_script($action,
> $id,isset($version)?array("version"=>$version):NULL))
> . '">' . ewiki_t($title) . '</a> ';
> }
>
> return($o);
> }
>
>
>
>
- Follow-Ups:
- [ewiki] New sitemap plugin
- From: Andy Fundinger
- References:
- [ewiki] ewiki_control_links() refactor
- From: Andy Fundinger
Other related posts:
- » [ewiki] ewiki_control_links() refactor
- » [ewiki] Re: ewiki_control_links() refactor
- [ewiki] New sitemap plugin
- From: Andy Fundinger
- [ewiki] ewiki_control_links() refactor
- From: Andy Fundinger