예제 #1
0
 /**
  * Read field information from cached storage
  *
  * @param bool   $force_update   read fields from database and not cached storage
  *
  * @return array
  */
 public function &loadFields($force_update = false)
 {
     static $fields = array();
     if ($force_update || count($fields) == 0) {
         $criteria = new icms_db_criteria_Item('fieldid', 0, '!=');
         $criteria->setSort('field_weight');
         $fieldObjs = $this->getObjects($criteria);
         foreach (array_keys($fieldObjs) as $i) {
             $fields[$fieldObjs[$i]->getVar('field_name')] = $fieldObjs[$i];
         }
     }
     return $fields;
 }
예제 #2
0
	switch ($op) {
		case 'cancel':
			// FIXME: does this always go back to correct location??
			redirect_header('index.php');
			break;
	
		case 'list':
			// Do we allow other users to see our notifications?  Nope, but maybe
			// see who else is monitoring a particular item (or at least how many)?
			// Well, maybe admin can see all...
	
			// TODO: need to span over multiple pages...???
	
			// Get an array of all notifications for the selected user
	
			$criteria = new icms_db_criteria_Item('not_uid', $uid);
			$criteria->setSort('not_modid,not_category,not_itemid');
			$notification_handler = icms::handler('icms_data_notification');
			$notifications =& $notification_handler->getObjects($criteria);
	
			// Generate the info for the template
	
			$module_handler = icms::handler('icms_module');
	
			$modules = array();
			$prev_modid = -1;
			$prev_category = -1;
			$prev_item = -1;
			foreach ($notifications as $n) {
				$modid = $n->getVar('not_modid');
				if ($modid != $prev_modid) {
예제 #3
0
/**
 * Modify settings for a group
 * @param int $g_id	Unique group ID
 */
function modifyGroup($g_id) {
	$userstart = $memstart = 0;
	if (!empty($_POST['userstart'])) {
		$userstart = (int) $_POST['userstart'];
	} elseif (!empty($_GET['userstart'])) {
		$userstart = (int) $_GET['userstart'];
	}
	if (!empty($_POST['memstart'])) {
		$memstart = (int) $_POST['memstart'];
	} elseif (!empty($_GET['memstart'])) {
		$memstart = (int) $_GET['memstart'];
	}
	icms_cp_header();
	echo '<div class="CPbigTitle" style="background-image: url(' . ICMS_MODULES_URL . '/system/admin/groups/images/groups_big.png)"><a href="admin.php?fct=groups">'. _AM_GROUPSMAIN .'</a>&nbsp;<span style="font-weight:bold;">&raquo;&raquo;</span>&nbsp;'. _AM_MODIFYADG . '</div><br />';
	$member_handler = icms::handler('icms_member');
	$thisgroup =& $member_handler->getGroup($g_id);
	$name_value = $thisgroup->getVar("name", "E");
	$desc_value = $thisgroup->getVar("description", "E");
	$moduleperm_handler = icms::handler('icms_member_groupperm');
	$a_mod_value =& $moduleperm_handler->getItemIds('module_admin', $thisgroup->getVar('groupid'));
	$r_mod_value =& $moduleperm_handler->getItemIds('module_read', $thisgroup->getVar('groupid'));
	$ed_mod_value =& $moduleperm_handler->getItemIds('use_wysiwygeditor', $thisgroup->getVar('groupid'));
	$debug_mod_value =& $moduleperm_handler->getItemIds('enable_debug', $thisgroup->getVar('groupid'));
	$group_manager_value =& $moduleperm_handler->getItemIds('group_manager', $thisgroup->getVar('groupid'));
	$gperm_handler = icms::handler('icms_member_groupperm');
	$r_block_value =& $gperm_handler->getItemIds('block_read', $g_id);
	$op_value = "update";
	$submit_value = _AM_UPDATEADG;
	$g_id_value = $thisgroup->getVar("groupid");
	$type_value = $thisgroup->getVar("group_type", "E");
	$form_title = _AM_MODIFYADG;
	if (XOOPS_GROUP_ADMIN == $g_id) {
		$s_cat_disable = TRUE;
	}

	$sysperm_handler = icms::handler('icms_member_groupperm');
	$s_cat_value =& $sysperm_handler->getItemIds('system_admin', $g_id);

	include ICMS_MODULES_PATH . "/system/admin/groups/groupform.php";
	echo "<br /><h4 style='text-align:" . _GLOBAL_LEFT . "'>" . _AM_EDITMEMBER . "</h4>";
	$usercount = $member_handler->getUserCount(new icms_db_criteria_Item('level', 0, '>'));
	$member_handler = icms::handler('icms_member');
	$membercount = $member_handler->getUserCountByGroup($g_id);
	if ($usercount < 200 && $membercount < 200) {
		// do the old way only when counts are small
		$mlist = array();
		$members =& $member_handler->getUsersByGroup($g_id, FALSE);
		if (count($members) > 0) {
			$member_criteria = new icms_db_criteria_Item('uid', "(" . implode(',', $members) . ")", "IN");
			$member_criteria->setSort('uname');
			$mlist = $member_handler->getUserList($member_criteria);
		}
		$criteria = new icms_db_criteria_Item('level', 0, '>');
		$criteria->setSort('uname');
		$userslist =& $member_handler->getUserList($criteria);
		$users =& array_diff($userslist, $mlist);
		echo '<table class="outer"><tr><th align="center">' . _AM_NONMEMBERS . '<br />';

		echo '</th><th></th><th align="center">' . _AM_MEMBERS . '<br />';
		echo '</th></tr><tr><td class="even">'
		. '<form action="admin.php" method="post">'
		. '<select name="uids[]" size="10" multiple="multiple">' . "\n";
		foreach ($users as $u_id => $u_name) {
			echo '<option value="' . (int) $u_id . '">' . $u_name . '</option>' . "\n";
		}
		echo '</select>';
		echo "</td><td align='center' class='odd'><input type='hidden' name='op' value='addUser' />" 
		. icms::$security->getTokenHTML() 
		. "<input type='hidden' name='fct' value='groups' /><input type='hidden' name='groupid' value='" 
		. $thisgroup->getVar("groupid") 
		. "' /><input type='submit' name='submit' value='" 
		. _AM_ADDBUTTON . "' /></form><br /><form action='admin.php' method='post' />"
		. "<input type='hidden' name='op' value='delUser' />" 
		. icms::$security->getTokenHTML() 
		. "<input type='hidden' name='fct' value='groups' /><input type='hidden' name='groupid' value='" 
		. $thisgroup->getVar("groupid") 
		. "' /><input type='submit' name='submit' value='" 
		. _AM_DELBUTTON . "' /></td><td class='even'>";
		echo "<select name='uids[]' size='10' multiple='multiple'>";
		foreach ($mlist as $m_id => $m_name) {
			echo '<option value="' . (int) $m_id . '">' . $m_name . '</option>' . "\n";
		}
		echo "</select>";
		echo '</td></tr></form></table>';
	} else {
		$members =& $member_handler->getUsersByGroup($g_id, FALSE, 200, $memstart);
		$mlist = array();
		if (count($members) > 0) {
			$member_criteria = new icms_db_criteria_Item('uid', "(" . implode(',', $members) . ")", "IN");
			$member_criteria->setSort('uname');
			$mlist = $member_handler->getUserList($member_criteria);
		}
		echo '<a href="' . ICMS_MODULES_URL . '/system/admin.php?fct=findusers&amp;group=' . (int) $g_id . '">' . _AM_FINDU4GROUP . '</a><br />';
		echo '<form action="admin.php" method="post"><table class="outer"><tr><th align="center">' . _AM_MEMBERS . '<br />';
		$nav = new icms_view_PageNav($membercount, 200, $memstart, "memstart", "fct=groups&amp;op=modify&amp;g_id=" . (int) $g_id);
		echo $nav->renderNav(4);
		echo "</th></tr><tr><td class='even' align='center'>"
		. "<input type='hidden' name='op' value='delUser' />"
		. "<input type='hidden' name='fct' value='groups' />"
		. "<input type='hidden' name='groupid' value='" . $thisgroup->getVar("groupid") 
		. "' /><input type='hidden' name='memstart' value='" . $memstart 
		. "' />" . icms::$security->getTokenHTML() 
		. "<select name='uids[]' size='10' multiple='multiple'>";
		foreach ($mlist as $m_id => $m_name) {
			echo '<option value="' . (int) $m_id . '">' . $m_name . '</option>' . "\n";
		}
		echo "</select><br /><input type='submit' name='submit' value='" . _DELETE 
		. "' /></td></tr></table></form>";
	}
	icms_cp_footer();
}
예제 #4
0
			echo implode('<br />', icms::$security->getErrors());
			exit();
		}
		$size = count($_POST['msg_id']);
		$msg =& $_POST['msg_id'];
		for ($i = 0; $i < $size; $i++) {
			$pm =& $pm_handler->get($msg[$i]);
			if ($pm->getVar('to_userid') == icms::$user->getVar('uid')) {
				$pm_handler->delete($pm);
			}
			unset($pm);
		}
		redirect_header('viewpmsg.php', 1, _PM_DELETED);
	}
	include ICMS_ROOT_PATH . '/header.php';
	$criteria = new icms_db_criteria_Item('to_userid', (int) (icms::$user->getVar('uid')));
	$criteria->setOrder('DESC');
	$pm_arr =& $pm_handler->getObjects($criteria);
	echo "<h4>" . _PM_PRIVATEMESSAGE
	. "</h4><p><a href='userinfo.php?uid=". (int) (icms::$user->getVar('uid')) . "'>"
	. _PM_PROFILE ."</a>&nbsp;<span style='font-weight:bold;'>&raquo;&raquo;</span>&nbsp;" . _PM_INBOX . "</p>";
	echo "<form id='prvmsg' method='post' action='viewpmsg.php'>";
	echo "<table border='0' cellspacing='1' cellpadding='4' width='100%' class='outer'>\n";
	echo "<tr align='center' valign='middle'><th>"
	. "<input name='allbox' id='allbox' onclick='xoopsCheckAll(\"prvmsg\", \"allbox\");'"
	. "type='checkbox' value='Check All' /></th><th>"
	. "<img src='images/download.gif' alt='' /></th><th>&nbsp;</th><th>"
	. _PM_FROM . "</th><th>" . _PM_SUBJECT . "</th><th align='center'>" . _PM_DATE . "</th></tr>\n";
	$total_messages = count($pm_arr);
	if ($total_messages == 0) {
		echo "<tr><td class='even' colspan='6' align='center'>" . _PM_YOUDONTHAVE . "</td></tr>";
예제 #5
0
		if (!icms::$security->check()) {
			echo implode('<br />', icms::$security->getErrors());
			exit();
		}
		$pm =& $pm_handler->get( (int) ($_POST['msg_id']));
		if (!is_object($pm) || $pm->getVar('to_userid') != icms::$user->getVar('uid') || !$pm_handler->delete($pm)) {
			exit();
		} else {
			redirect_header("viewpmsg.php",1,_PM_DELETED);
			exit();
		}
	}
	$start = !empty($_GET['start']) ? (int) ($_GET['start']) : 0;
	$total_messages = !empty($_GET['total_messages']) ? (int) ($_GET['total_messages']) : 0;
	include ICMS_ROOT_PATH.'/header.php';
	$criteria = new icms_db_criteria_Item('to_userid', (int) (icms::$user->getVar('uid')));
	$criteria->setLimit(1);
	$criteria->setStart($start);
	$criteria->setSort('msg_time');
	$pm_arr =& $pm_handler->getObjects($criteria);
	echo "<div><h4>". _PM_PRIVATEMESSAGE."</h4></div><br /><a href='userinfo.php?uid="
		. (int) (icms::$user->getVar("uid")) ."'>". _PM_PROFILE ."</a>&nbsp;
		<span style='font-weight:bold;'>&raquo;&raquo;</span>&nbsp;
		<a href='viewpmsg.php'>". _PM_INBOX ."</a>&nbsp;
		<span style='font-weight:bold;'>&raquo;&raquo;</span>&nbsp;\n";
	if (empty($pm_arr)) {
		echo '<br /><br />'._PM_YOUDONTHAVE;
	} else {
		if (!$pm_handler->setRead($pm_arr[0])) {
			//echo "failed";
		}
예제 #6
0
 public function __construct($column, $value = '', $operator = '=', $prefix = '', $function = '')
 {
     parent::__construct($column, $value, $operator, $prefix, $function);
     $this->_errors = icms_core_Debug::setDeprecated('icms_db_criteria_Item', sprintf(_CORE_REMOVE_IN_VERSION, '1.4'));
 }