Revision history for PreventLongTags


Revision [19425]

Last edited on 2008-01-28 00:15:45 by JavaWoman [Modified links pointing to docs server]

No Differences

Revision [17807]

Edited on 2007-12-12 10:21:03 by JavaWoman [prevent function references looking as page links]
Additions:
**if ($this->""HasAccess""("write") && $this->""HasAccess""("read")) {**
Deletions:
**if ($this->HasAccess("write") && $this->HasAccess("read")) {**


Revision [16987]

Edited on 2007-05-31 23:27:32 by JsnX [Reverted]
Additions:
**if ($this->HasAccess("write") && $this->HasAccess("read")) {**
the following line:
%%if ($newtag = $_POST["newtag"]) $this->Redirect($this->href("edit", $newtag));%%
now we need a form, which posts that newtag. insert the **uncommented lines** near the end of the edit-method after the preview-section:
%%$this->maxtaglen = 50; // check length of the field "tag" in the wakka_pages table for the correct value. it's only for testing purpose. we will advance it later, see below.
// if ($_POST["submit"] == "Preview") {
// leave the preview-stuff as is
} else if (!$this->page && strlen($this->tag) > $this->maxtaglen) {
$output = "<div class='error'>Tag too long!</div>\n";
$output .= $this->FormOpen("edit");
$output .= "<input name='newtag' size='50' value='".htmlspecialchars($this->tag)."' />"; // use htmlspecialchars($this->tag, ENT_QUOTES) if you need single quotation marks (i.e. apostrophies) in tags
$output .= "<input name='submit' type='submit' value='Rename' /> ";
$output .= $this->FormClose();
$this->tag = substr($this->tag, 0, $this->maxtaglen); // truncate tag to feed a backlinks-handler with the correct value. may be omited. it only works if the link to a backlinks-handler is built in the footer.
// } else {
// edit-form follows here
// }
// print($output);%%
that's it, folks!
if everything works fine, we can set the maxtaglen-value automatically to the propper value, even if the tag-field is altered in the database.
replace the line **$this->maxtaglen = 50;** from above with the following code:
%%if ($result = mysql_query("describe ".$this->config["table_prefix"]."pages tag")) {
$field = mysql_fetch_assoc($result);
if (preg_match("/varchar\((\d+)\)/", $field["Type"], $matches)) $this->maxtaglen = $matches[1];
}%%
i've placed this code at the end of the constructor of the wakka-class (in wakka.php), but it works fine within the edit-method.
Deletions:
**if ($this->HasAccess("write")


Revision [16786]

Edited on 2007-05-31 10:48:12 by CesLig [Reverted]
Additions:
**if ($this->HasAccess("write")
Deletions:
**if ($this->HasAccess("write") && $this->HasAccess("read")) {**
the following line:
%%if ($newtag = $_POST["newtag"]) $this->Redirect($this->href("edit", $newtag));%%
now we need a form, which posts that newtag. insert the **uncommented lines** near the end of the edit-method after the preview-section:
%%$this->maxtaglen = 50; // check length of the field "tag" in the wakka_pages table for the correct value. it's only for testing purpose. we will advance it later, see below.
// if ($_POST["submit"] == "Preview") {
// leave the preview-stuff as is
} else if (!$this->page && strlen($this->tag) > $this->maxtaglen) {
$output = "<div class='error'>Tag too long!</div>\n";
$output .= $this->FormOpen("edit");
$output .= "<input name='newtag' size='50' value='".htmlspecialchars($this->tag)."' />"; // use htmlspecialchars($this->tag, ENT_QUOTES) if you need single quotation marks (i.e. apostrophies) in tags
$output .= "<input name='submit' type='submit' value='Rename' /> ";
$output .= $this->FormClose();
$this->tag = substr($this->tag, 0, $this->maxtaglen); // truncate tag to feed a backlinks-handler with the correct value. may be omited. it only works if the link to a backlinks-handler is built in the footer.
// } else {
// edit-form follows here
// }
// print($output);%%
that's it, folks!
if everything works fine, we can set the maxtaglen-value automatically to the propper value, even if the tag-field is altered in the database.
replace the line **$this->maxtaglen = 50;** from above with the following code:
%%if ($result = mysql_query("describe ".$this->config["table_prefix"]."pages tag")) {
$field = mysql_fetch_assoc($result);
if (preg_match("/varchar\((\d+)\)/", $field["Type"], $matches)) $this->maxtaglen = $matches[1];
}%%
i've placed this code at the end of the constructor of the wakka-class (in wakka.php), but it works fine within the edit-method.


Revision [844]

Edited on 2004-08-01 17:06:43 by JsnX [Reverted]
Additions:
[''Note: This is now included in Wikka by default starting with Wikka 1.1.3.1''. Thanks to DreckFehler.]


Revision [721]

Edited on 2004-07-13 13:32:35 by DreckFehler [mask single quotes]
Additions:
$output .= "<input name='newtag' size='50' value='".htmlspecialchars($this->tag)."' />"; // use htmlspecialchars($this->tag, ENT_QUOTES) if you need single quotation marks (i.e. apostrophies) in tags
Deletions:
$output .= "<input name='newtag' size='50' value='".htmlspecialchars($this->tag)."' />";


Revision [717]

The oldest known version of this page was created on 2004-07-12 20:39:47 by DreckFehler [mask single quotes]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki