Home « Server software «
Documentation: articles/edit.php
articles/edit.php - Create a new article or edit an existing one
This is the main script used to post a new page, or to modify an existing one.On anonymous usage YACS attempts to stop robots by generating a random string and by asking user to type it.
A button-based editor is used for the description field. It's aiming to introduce most common codes supported by YACS. Also, sample smilies are displayed, and may be used to introduce related codes into the description field.
This script attempts to validate the new or updated article description against a standard PHP XML parser. The objective is to spot malformed or unordered HTML and XHTML tags. No more, no less.
Advanced options are available in a folded division.
If a publication date is provided, YACS will wait for the given date before listing the page - automatically. Note that no external server will be pinged with this way of publishing pages. Pings require either to use the publishing script (articles/publish.php), or to trigger explicit ping (servers/ping.php).
Note that in Wiki mode (i.e.
with_auto_publish
set to 'Y'),
or in forum sections (i.e. with option 'auto_publish
'), posted pages are published as well.Optional publication and expiration dates are automatically translated from and to the surfer time zone and the server time zone.
The permission assessment is based upon following rules applied in the provided orders:
- associates and editors are allowed to move forward
- surfer created the page and the page has not been published
- surfer created the published page and revisions are allowed
- permission is denied if the anchor is not viewable
- this is a new post and the surfer is an authenticated member and submission is allowed
- permission denied is the default
If a secret handle has been provided, and if the surfer has not been authenticated, he is automatically logged in as the article creator. This is necessary to authorize the handling of items attached to the anchor, such as comments, file, links or actions.
The edition time is not limited at all. Some Javascript code polls the server in the background to ensure that session data is not lost during all the time the browser window is opened.
Accepted calls:
- edit.php create a new article, start by selecting a section
- edit.php?anchor=section:<id> create a new article within the given section
- edit.php?anchor=section:<id>&variant=<overlay> create a new overlaid article within the given section
- edit.php/<id> modify an existing article
- edit.php?id=<id> modify an existing article
If no anchor data is provided, a list of sections is proposed to let the surfer select one of them.
There is also a special invocation format to be used for direct blogging from bookmarklets, such as the one provided by YACS for each section (see sections/view.php), or the one dedicated to users of Internet Explorer (see articles/ie_bookmarklet.php).
This format is aiming to provide to YACS every necessary parameters, but through a single GET or POST call. Following parameters have to be provided:
account
- the nickname to log inpassword
- the related passwordsection
, orblogid
- the optional id of the section where the new page will be placedtitle
- an optional title for the new pageintroduction
- some optional introduction texttext
- some optional text to be bloggedsource
- the optional source
If no authentication data is provided (
account
and password
),
the surfer is redirected to the login page at users/login.php.Data submitted from a bookmarklet is saved as session data. Therefore information is preserved through any additional steps, including user authentication and section selection.
Also, session data is purged on successful article post.
This design allows for a generic bookmarklet (i.e., not restricted to a section) bound only to the web site.
This bookmarklet is proposed as a direct link to any authenticated member:
- at the control panel (control/index.php)
- at any user page (users/view.php)
- at the main help page (help.php)
If this article, or one of its anchor, specifies a specific skin (option keyword '
skin_xyz
'),
or a specific variant (option keyword 'variant_xyz
'), they are used instead default values.This script is a reference file of this system.
Voir aussi:
Licence: GNU Lesser General Public License
Auteurs:
- Bernard Paques bernard.paques@bigfoot.com
- Vincent Noël
Testeurs:
- GnapZ
- Pascal
- Guillaume Perez
- Manuel López Gallego
- Jérôme Douillé
- Jan Boen
Reste à faire:
- on new page, add a link to switch to publication script
- add some hook to validate posts (TheAlchemist)
- beautify description before submission to xhtml validation (pat)
- create a nick name based on page title (wiki)