Home « Server software «
Documentation: links/edit.php
links/edit.php - Post a new link or update an existing one
This is the main script used to post a new link, or to modify an existing one.Each link may have a label, a hovering title, a target window, and a full description.
Shortcuts for internal links are accepted. This script will automatically translate:
- a link to an article [article=123]
- a link to a section [section=123]
- a link to a file [file=123]
- a link to an image [image=123]
- a link to a category [category=123]
- a link to a user [user=jean]
This script ensures that links stored in the database may be easily classified as being external or internal. This is achieved by applying following transformations to submitted links:
- 'www.foo.bar' becomes 'http://www.foo.bar/'
- 'http://this_server/path/target' becomes '/path/target'
- 'anything@foo.bar' becomes 'mailto:anything@foo.bar'
Also, an external link may be displayed in a separate window, or in the current window.
When a new link is posted:
- the edition date of the link is updated
- the user profile is incremented
- the edition field of the anchor page is modified with the value 'link:create' (cf. shared/anchor.php)
When a link is updated:
- the edition date of the link is updated
- the edition field of the anchor page is modified with the value 'link:update' (cf. shared/anchor.php)
Associates can also decide to not stamp the creation or the modification of the link. If the silent option is checked:
- the previous edition date is retained
- the anchor page is not modified either
A button-based editor is used for the description field. It's aiming to introduce most common codes supported by YACS.
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.
The permission assessment is based upon following rules applied in the provided orders:
- associates and editors are allowed to move forward
- permission is denied if the anchor is not viewable
- surfer owns the image (= he is the last editor)
- this is a new post and the surfer is an authenticated member and submissions are allowed
- permission denied is the default
Anonymous (not-logged) surfer are invited to register to be able to post new images.
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 link, start by selecting an anchor
- edit.php/<type>/<id> create a new link for this anchor
- edit.php?anchor=<type>:<id> upload a new link for the anchor
- edit.php/<id> modify an existing link
- edit.php?id=<id> modify an existing link
If no anchor data is provided, a list of anchors is proposed to let the surfer select one of them.
There is also a special invocation format to be used for direct bookmarking from bookmarklets, such as the one provided by YACS.
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 passwordlink- the target hrefcategory- the optional id of the category where the new link will be placedtitle- an optional title for the new linktext- some optional text to document the link
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 category selection.
Also, session data is purged on successful article post.
This design allows for a generic bookmarklet bound only to the web site.
The generic bookmarking 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 the anchor for this item 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:
- Ghjmora
- GnapZ
- Cyandrea
- Lucrecius