![]() |
|---|
| [ Index ] |
Source Code Reference for V1.00 |
[Summary view] [Print] [Text view]
1 <?php /* $Id: do_link_aed.php 40 2008-02-11 12:11:44Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/links/do_link_aed.php $ */ 2 if (!defined('W2P_BASE_DIR')) { 3 die('You should not access this file directly.'); 4 } 5 6 //addlink sql 7 $link_id = intval(w2PgetParam($_POST, 'link_id', 0)); 8 $del = intval(w2PgetParam($_POST, 'del', 0)); 9 10 $not = w2PgetParam($_POST, 'notify', '0'); 11 if ($not != '0') { 12 $not = '1'; 13 } 14 15 $isNotNew = $_POST['link_id']; 16 $perms = &$AppUI->acl(); 17 if ($del) { 18 if (!$perms->checkModuleItem('links', 'delete', $link_id)) { 19 $AppUI->redirect('m=public&a=access_denied'); 20 } 21 } elseif ($isNotNew) { 22 if (!$perms->checkModuleItem('links', 'edit', $link_id)) { 23 $AppUI->redirect('m=public&a=access_denied'); 24 } 25 } else { 26 if (!$perms->checkModule('links', 'add')) { 27 $AppUI->redirect('m=public&a=access_denied'); 28 } 29 } 30 31 $obj = new CLink(); 32 if ($link_id) { 33 $obj->_message = 'updated'; 34 } else { 35 $obj->_message = 'added'; 36 } 37 $obj->link_date = date('Y-m-d H:i:s'); 38 $obj->link_category = intval(w2PgetParam($_POST, 'link_category', 0)); 39 40 if (!$obj->bind($_POST)) { 41 $AppUI->setMsg($obj->getError(), UI_MSG_ERROR); 42 $AppUI->redirect(); 43 } 44 45 // prepare (and translate) the module name ready for the suffix 46 $AppUI->setMsg('Link'); 47 // delete the link 48 if ($del) { 49 $obj->load($link_id); 50 if (($msg = $obj->delete())) { 51 $AppUI->setMsg($msg, UI_MSG_ERROR); 52 $AppUI->redirect(); 53 } else { 54 if ($not == '1') { 55 $obj->notify(); 56 } 57 $AppUI->setMsg('deleted', UI_MSG_ALERT, true); 58 $AppUI->redirect('m=links'); 59 } 60 } 61 62 if (!$link_id) { 63 $obj->link_owner = $AppUI->user_id; 64 } 65 66 if (($msg = $obj->store())) { 67 $AppUI->setMsg($msg, UI_MSG_ERROR); 68 } else { 69 $obj->load($obj->file_id); 70 if ($not == '1') 71 $obj->notify(); 72 $AppUI->setMsg($file_id ? 'updated' : 'added', UI_MSG_OK, true); 73 } 74 75 $AppUI->redirect(); 76 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Fri Jan 9 03:00:02 2009 | Cross-referenced by PHPXref 0.7 |