![]() |
|---|
| [ Index ] |
Source Code Reference for V1.00 |
[Summary view] [Print] [Text view]
1 <?php /* $Id: do_watch_forum.php 56 2008-02-19 18:39:18Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/forums/do_watch_forum.php $ */ 2 if (!defined('W2P_BASE_DIR')) { 3 die('You should not access this file directly.'); 4 } 5 6 $perms = &$AppUI->acl(); 7 if (!$perms->checkModule('forums', 'view')) { 8 $AppUI->redirect('m=public&a=access_denied'); 9 } 10 11 ## 12 ## Change forum watches 13 ## 14 $watch = isset($_POST['watch']) ? $_POST['watch'] : 0; 15 16 if ($watch) { 17 // clear existing watches 18 $q = new DBQuery; 19 $q->setDelete('forum_watch'); 20 $q->addWhere('watch_user = ' . (int)$AppUI->user_id); 21 $q->addWhere('watch_' . $watch . ' IS NOT NULL'); 22 if (!$q->exec()) { 23 $AppUI->setMsg(db_error(), UI_MSG_ERROR); 24 $q->clear(); 25 } else { 26 $q->clear(); 27 foreach ($_POST as $k => $v) { 28 if (strpos($k, 'forum_') !== false) { 29 $q->addTable('forum_watch'); 30 $q->addInsert('watch_user', $AppUI->user_id); 31 $q->addInsert('watch_' . $watch, substr($k, 6)); 32 if (!$q->exec()) { 33 $AppUI->setMsg(db_error(), UI_MSG_ERROR); 34 } else { 35 $AppUI->setMsg('Watch updated', UI_MSG_OK); 36 } 37 $q->clear(); 38 } 39 } 40 } 41 } else { 42 $AppUI->setMsg('Incorrect watch type passed to sql handler.', UI_MSG_ERROR); 43 } 44 ?>
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 |