Forums / Cotonti / Core Labs / Archive / page edit hooks

esclkm
#7148 2009-02-07 09:46
we now have available are too few opportunities to hook code into page.edit

example:
now:
list ($ usr [ 'auth_read'], $ usr [ 'auth_write'], $ usr [ 'isadmin']) = sed_auth ( 'page', 'any');
sed_block ($ usr [ 'auth_read']);

$ id = sed_import ( 'id', 'G', 'INT');
$ c = sed_import ( 'c', 'G', 'TXT');

/ / Extra fields - getting
$ extrafields = array ();
$ fieldsres = sed_sql_query ( "SELECT * FROM $ db_extra_fields WHERE field_location = 'pages'");
while ($ row = sed_sql_fetchassoc ($ fieldsres)) $ extrafields [] = $ row;

if ($ a == 'update')
(
$ sql1 = sed_sql_query ( "SELECT page_cat, page_ownerid FROM $ db_pages WHERE page_id = '$ id' LIMIT 1");
Sed_die (sed_sql_numrows ($ sql1) == 0);
$ Row1 = sed_sql_fetcharray ($ sql1);

list ($ usr [ 'auth_read'], $ usr [ 'auth_write'], $ usr [ 'isadmin']) = sed_auth ( 'page', $ row1 [ 'page_cat']);
Sed_block ($ usr [ 'isadmin']);

/ * === Hook === * /
$ extp = sed_getextplugins ( 'page.edit.update.first');
If (is_array ($ extp))
(Foreach ($ extp as $ k => $ pl) (include_once ($ cfg [ 'plugins_dir'].'/'.$ pl [' pl_code'].'/'.$ pl [ 'pl_file'].'. php ');))
/ * ===== * /

I believe that is more optional:
list ($ usr [ 'auth_read'], $ usr [ 'auth_write'], $ usr [ 'isadmin']) = sed_auth ( 'page', 'any');
sed_block ($ usr [ 'auth_read']);

$ id = sed_import ( 'id', 'G', 'INT');
$ c = sed_import ( 'c', 'G', 'TXT');

/ / Extra fields - getting
$ extrafields = array ();
$ fieldsres = sed_sql_query ( "SELECT * FROM $ db_extra_fields WHERE field_location = 'pages'");
while ($ row = sed_sql_fetchassoc ($ fieldsres)) $ extrafields [] = $ row;

$ sql1 = sed_sql_query ( "SELECT page_cat, page_ownerid FROM $ db_pages WHERE page_id = '$ id' LIMIT 1");
Sed_die (sed_sql_numrows ($ sql1) == 0);
$ Row1 = sed_sql_fetcharray ($ sql1);

list ($ usr [ 'auth_read'], $ usr [ 'auth_write'], $ usr [ 'isadmin']) = sed_auth ( 'page', $ row1 [ 'page_cat']);
/ * === Hook === * /
$ Extp = sed_getextplugins ( 'page.edit.first');
If (is_array ($ extp))
(Foreach ($ extp as $ k => $ pl) (include_once ($ cfg [ 'plugins_dir'].'/'.$ pl [' pl_code'].'/'.$ pl [ 'pl_file'].'. php ');))
/ * ===== * /


if ($ a == 'update')
(
Sed_block ($ usr [ 'isadmin']);
to understand why I think so: blogs and why developers do not want to sell through a simple page and make the individual plugins without using pages; or plugin for seditio "users edit own pages" - compare files of plugin and file users.edit in Seditio

analogical pages.add

What do you think about this?[/][/]
littledev.ru - мой маленький зарождающийся блог о котонти.
снижение стоимости программирования и снижение стоимости производства разные вещи. Первое можно скорее сравнить с раздачей работникам дешевых инструментов, чем со снижением зарплаты