| Harker |
|
|---|---|
|
Hello all, I have problems and i ask your help again :] I explain, I would like to make a plugin using the systeme page.add.tags.page.edit.tags. I know it's easy to use the extra-fields in the pages but I would like use the plugin as it is a very big database. I have already done some of the plugin and it works but I dont' know how to retrieve the ID from the page rather than the alias and even worse, I don't know if in security if that's ok
Could you take a look at what I did and show me how to retrieve the page ID and add the security :] Thank you in advance for your help
items.page.add.tags.php
defined('COT_CODE') or die('Wrong URL');
if ($m == 'add')
{
$t->assign(array(
'PAGEADD_TOP_ITEMS_COST' => $L['Tags'],
'PAGEADD_FORM_ITEMS_COST' => cot_inputbox(text, 'ritemscost', '', array('size' => 3, 'maxlength' => 3))
));
}
items.page.add.done.php
defined('COT_CODE') or die('Wrong URL');
if (!cot_error_found() && cot_auth('plug', 'items', 'W'))
{
if (cot_import('ritemscost', 'P', 'INT'))
{
$ritemscost = cot_import('ritemscost', 'P', 'INT');
$db->insert(cot_items, array('items_cost' => $ritemscost, 'items_page_id' => $pag['page_id'], 'items_page_alias' => $rpage['page_alias'], 'items_page_cat' => $rpage['page_cat']));
}
}
items.page.edit.tags
defined('COT_CODE') or die('Wrong URL');
$page_alias = $pag['page_alias'];
if ($m == 'edit' && cot_auth('plug', 'items', 'W'))
{
$sqlitems = $db->query("SELECT * FROM cot_items WHERE items_page_alias= ?", $page_alias)->fetch();
$t->assign(array(
"PAGEEDIT_FORM_ITEMS_COST" => '<input name="ritemscost" value="'.$sqlitems['items_cost'].'" />',
));
}
items.page.edit.done
defined('COT_CODE') or die('Wrong URL');
if (!cot_error_found() && cot_auth('plug', 'items', 'W'))
{
if (cot_import('ritemscost', 'G', 'INT'))
{
$ritemscost = cot_import('ritemscost', 'G', 'INT');
$db->update(cot_items, array('items_cost' => $ritemscost,), 'items_page_alias="'.$page['page_alias'].'"');
}
}
|