function getPageChangeEmails($notify) { $emails = array(); $userids = array(); foreach ($notify as $page => $users) { if (glob_match($page, $this->_pagename)) { foreach ($users as $userid => $user) { $um = UserManager::instance(); $dbUser = $um->getUserByUserName($userid); $wiki = new Wiki($_REQUEST['group_id']); $wp = new WikiPage($_REQUEST['group_id'], $_REQUEST['pagename']); if ($dbUser && ($dbUser->isActive() || $dbUser->isRestricted()) && $wiki->isAutorized($dbUser->getId()) && $wp->isAutorized($dbUser->getId())) { if (!$user) { // handle the case for ModeratePage: no prefs, just userid's. global $request; $u = $request->getUser(); if ($u->UserName() == $userid) { $prefs = $u->getPreferences(); } else { // not current user if (ENABLE_USER_NEW) { $u = WikiUser($userid); $u->getPreferences(); $prefs =& $u->_prefs; } else { $u = new WikiUser($GLOBALS['request'], $userid); $prefs = $u->getPreferences(); } } $emails[] = user_getemail_from_unix($userid); $userids[] = $userid; } else { if (!empty($user['verified']) and !empty($user['email'])) { $emails[] = user_getemail_from_unix($userid); $userids[] = $userid; } elseif (!empty($user['email'])) { global $request; // do a dynamic emailVerified check update $u = $request->getUser(); if ($u->UserName() == $userid) { if ($request->_prefs->get('emailVerified')) { $emails[] = user_getemail_from_unix($userid); $userids[] = $userid; $notify[$page][$userid]['verified'] = 1; $request->_dbi->set('notify', $notify); } } else { // not current user if (ENABLE_USER_NEW) { $u = WikiUser($userid); $u->getPreferences(); $prefs =& $u->_prefs; } else { $u = new WikiUser($GLOBALS['request'], $userid); $prefs = $u->getPreferences(); } if ($prefs->get('emailVerified')) { $emails[] = user_getemail_from_unix($userid); $userids[] = $userid; $notify[$page][$userid]['verified'] = 1; $request->_dbi->set('notify', $notify); } } // ignore verification /* if (DEBUG) { if (!in_array($user['email'],$emails)) $emails[] = $user['email']; } */ } } } } } } $emails = array_unique($emails); $userids = array_unique($userids); return array($emails, $userids); }
/** * check whether val is one of the prefdefined values of this field * @param field: the field concerned * @param field_name: the fields field_name * @param label: the fields label * @param val: the csv value to check * @param predef_vals: array containing all predefined values of this field * @param row: row number in csv file (for error reporting) * @param data: array containing the parsed csv file (for error reporting) */ function checkPredefinedValues($field, $field_name, $label, $val, $predef_vals, $row, $data) { global $Language; $hp = Codendi_HTMLPurifier::instance(); if ($field->getDisplayType() == "MB") { $val_arr = explode(",", $val); while (list(, $name) = each($val_arr)) { if (!array_key_exists($name, $predef_vals) && $name != $Language->getText('global', 'none')) { $this->setError($Language->getText('plugin_tracker_import_utils', 'not_a_predefined_value', array($row + 1, $hp->purify(implode(",", $data), CODENDI_PURIFIER_CONVERT_HTML), $hp->purify($name, CODENDI_PURIFIER_CONVERT_HTML), $hp->purify($label, CODENDI_PURIFIER_CONVERT_HTML), $hp->purify(implode(",", array_keys($predef_vals)), CODENDI_PURIFIER_CONVERT_HTML)))); return false; } } } else { if (!array_key_exists($val, $predef_vals) && $val != $Language->getText('global', 'none') && $val != "") { if ($field_name == 'severity' && (strcasecmp($val, '1') == 0 || strcasecmp($val, '5') == 0 || strcasecmp($val, 9) == 0)) { //accept simple ints for Severity fields instead of 1 - Ordinary,5 - Major,9 - Critical //accept simple ints for Priority fields instead of 1 - Lowest,5 - Medium,9 - Highest } else { if ($field_name == 'submitted_by' && ($val == $Language->getText('global', 'none') && $this->ath->allowsAnon() || $val == "" || user_getemail_from_unix($val) != $Language->getText('include_user', 'not_found'))) { //accept anonymous user, use importing user as 'submitted by', or simply make sure that user is a known user } else { $this->setError($Language->getText('plugin_tracker_import_utils', 'not_a_predefined_value', array($row + 1, $hp->purify(implode(",", $data), CODENDI_PURIFIER_CONVERT_HTML), $hp->purify($val, CODENDI_PURIFIER_CONVERT_HTML), $hp->purify($label, CODENDI_PURIFIER_CONVERT_HTML), $hp->purify(implode(",", array_keys($predef_vals)), CODENDI_PURIFIER_CONVERT_HTML)))); return false; } } } } return true; }