function sendAskedQuestion($username, $usermail, $usercat, $content) { global $IDN, $category, $PMF_LANG, $faq, $faqconfig; $retval = false; $cat = new PMF_Category(); $categories = $cat->getAllCategories(); if ($faqconfig->get('records.enableVisibilityQuestions')) { $visibility = 'N'; } else { $visibility = 'Y'; } $questionData = array('ask_username' => $username, 'ask_usermail' => $IDN->encode($usermail), 'ask_category' => $usercat, 'ask_content' => $content, 'ask_date' => date('YmdHis'), 'is_visible' => $visibility); list($user, $host) = explode("@", $questionData['ask_usermail']); if (PMF_Filter::filterVar($questionData['ask_usermail'], FILTER_VALIDATE_EMAIL) != false) { $faq->addQuestion($questionData); $questionMail = "User: "******", mailto:" . $questionData['ask_usermail'] . "\n" . $PMF_LANG["msgCategory"] . ": " . $categories[$questionData['ask_category']]["name"] . "\n\n" . wordwrap($content, 72); $userId = $category->getCategoryUser($questionData['ask_category']); $oUser = new PMF_User(); $oUser->getUserById($userId); $userEmail = $oUser->getUserData('email'); $mainAdminEmail = $faqconfig->get('main.administrationMail'); $mail = new PMF_Mail(); $mail->unsetFrom(); $mail->setFrom($questionData['ask_usermail'], $questionData['ask_username']); $mail->addTo($mainAdminEmail); // Let the category owner get a copy of the message if ($userEmail && $mainAdminEmail != $userEmail) { $mail->addCc($userEmail); } $mail->subject = '%sitename%'; $mail->message = $questionMail; $retval = $mail->send(); } return $retval; }
function sendAskedQuestion($username, $usermail, $usercat, $content) { global $PMF_LANG, $faq; $retval = false; $faqconfig = PMF_Configuration::getInstance(); $categoryNode = new PMF_Category_Node(); if ($faqconfig->get('records.enableVisibilityQuestions')) { $visibility = 'N'; } else { $visibility = 'Y'; } $questionData = array('id' => null, 'username' => $username, 'email' => $usermail, 'category_id' => $usercat, 'question' => $content, 'date' => date('YmdHis'), 'is_visible' => $visibility); list($user, $host) = explode("@", $questionData['email']); if (PMF_Filter::filterVar($questionData['email'], FILTER_VALIDATE_EMAIL) != false) { $faqQuestions = new PMF_Faq_Questions(); $faqQuestions->create($questionData); $categoryData = $categoryNode->fetch($questionData['category_id']); $questionMail = "User: "******", mailto:" . $questionData['email'] . "\n" . $PMF_LANG["msgCategory"] . ": " . $categoryData->name . "\n\n" . wordwrap($content, 72); $userId = $categoryData->user_id; $oUser = new PMF_User(); $oUser->getUserById($userId); $userEmail = $oUser->getUserData('email'); $mainAdminEmail = $faqconfig->get('main.administrationMail'); $mail = new PMF_Mail(); $mail->unsetFrom(); $mail->setFrom($questionData['email'], $questionData['username']); $mail->addTo($mainAdminEmail); // Let the category owner get a copy of the message if ($userEmail && $mainAdminEmail != $userEmail) { $mail->addCc($userEmail); } $mail->subject = '%sitename%'; $mail->message = $questionMail; $retval = $mail->send(); } return $retval; }
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the * License for the specific language governing rights and limitations * under the License. */ if (!defined('IS_VALID_PHPMYFAQ_ADMIN')) { header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); exit; } $ajax_action = PMF_Filter::filterInput(INPUT_GET, 'ajaxaction', FILTER_SANITIZE_STRING); $user_id = PMF_Filter::filterInput(INPUT_GET, 'user_id', FILTER_VALIDATE_INT); $usersearch = PMF_Filter::filterInput(INPUT_GET, 'q', FILTER_SANITIZE_STRING); if ($permission['adduser'] || $permission['edituser'] || $permission['deluser']) { $user = new PMF_User(); if ('get_user_list' == $ajax_action) { foreach ($user->searchUsers($usersearch) as $single_user) { print $single_user['login'] . '|' . $single_user['user_id'] . "\n"; } } $user->getUserById($user_id); // Return the user data if ('get_user_data' == $ajax_action) { $userdata = array(); $userdata = $user->userdata->get('*'); $userdata['status'] = $user->getStatus(); print json_encode(array_map('utf8_encode', $userdata)); } // Return the user rights if ('get_user_rights' == $ajax_action) { print json_encode($user->perm->getUserRights($user_id)); } }
if ($userEmail && $mainAdminEmail != $userEmail) { $mail->addCc($userEmail); } $mail->subject = '%sitename%'; $mail->message = $questionMail; $mail->send(); unset($mail); $message = array('success' => $PMF_LANG['msgAskThx4Mail']); } } else { $questionData = array('username' => $name, 'email' => $email, 'category_id' => $ucategory, 'question' => $question, 'is_visible' => $visibility); $faq->addQuestion($questionData); $questionMail = "User: "******", mailto:" . $questionData['email'] . "\n" . $PMF_LANG["msgCategory"] . ": " . $categories[$questionData['category_id']]["name"] . "\n\n" . wordwrap($question, 72) . "\n\n" . $faqconfig->get('main.referenceURL') . '/admin/'; $userId = $cat->getCategoryUser($questionData['category_id']); $oUser = new PMF_User(); $oUser->getUserById($userId); $userEmail = $oUser->getUserData('email'); $mainAdminEmail = PMF_Configuration::getInstance()->get('main.administrationMail'); $mail = new PMF_Mail(); $mail->setReplyTo($questionData['email'], $questionData['username']); $mail->addTo($mainAdminEmail); // Let the category owner get a copy of the message if ($userEmail && $mainAdminEmail != $userEmail) { $mail->addCc($userEmail); } $mail->subject = '%sitename%'; $mail->message = $questionMail; $mail->send(); unset($mail); $message = array('success' => $PMF_LANG['msgAskThx4Mail']); }
} print json_encode($groups); } // Return the group data if ('get_group_data' == $ajax_action) { print json_encode($user->perm->getGroupData($group_id)); } // Return the group rights if ('get_group_rights' == $ajax_action) { print json_encode($user->perm->getGroupRights($group_id)); } // Return all users if ('get_all_users' == $ajax_action) { $users = array(); foreach ($userList as $single_user) { $user->getUserById($single_user); $users[] = array('user_id' => $user->getUserId(), 'login' => $user->getLogin()); } print json_encode($users); } // Returns all group members if ('get_all_members' == $ajax_action) { $memberList = $user->perm->getGroupMembers($group_id); $members = array(); foreach ($memberList as $single_member) { $user->getUserById($single_member); $members[] = array('user_id' => $user->getUserId(), 'login' => $user->getLogin()); } print json_encode($members); } }
<tfoot> <tr> <td colspan="7"><?php echo $pagination->render(); ?> </td> </tr> </tfoot> <?php } ?> <tbody> <?php $counter = $displayedCounter = 0; foreach ($allUsers as $userId) { $user->getUserById($userId, true); if ($displayedCounter >= $perPage) { continue; } $counter++; if ($counter <= $firstPage) { continue; } $displayedCounter++; ?> <tr class="row_user_id_<?php print $user->getUserId(); ?> "> <td><?php print $user->getUserId();
</fieldset> </div> <?php } } } // delete user if ($userAction == 'delete') { $message = ''; $user = new PMF_User(); $userId = PMF_Filter::filterInput(INPUT_POST, 'user_id', FILTER_VALIDATE_INT, 0); $userAction = $defaultUserAction; if ($userId == 0) { $message .= '<p class="error">' . $errorMessages['delUser_noId'] . '</p>'; } else { if (!$user->getUserById($userId)) { $message .= '<p class="error">' . $errorMessages['delUser_noId'] . '</p>'; } if (!$user->deleteUser()) { $message .= '<p class="error">' . $errorMessages['delUser'] . '</p>'; } else { // Move the categories ownership to admin (id == 1) $oCat = new PMF_Category($current_admin_user, $current_admin_groups, false); $oCat->moveOwnership($userId, 1); // Remove the user from groups $permLevel = isset($PMF_CONF['main.permLevel']) && '' != $PMF_CONF['main.permLevel'] ? $PMF_CONF['main.permLevel'] : 'basic'; if ('medium' == $permLevel) { $oPerm = PMF_Perm::selectPerm('medium'); $oPerm->removeFromAllGroups($userId); } $message .= '<p class="success">' . $successMessages['delUser'] . '</p>';
} echo json_encode($groups); } // Return the group data if ('get_group_data' == $ajaxAction) { echo json_encode($user->perm->getGroupData($groupId)); } // Return the group rights if ('get_group_rights' == $ajaxAction) { echo json_encode($user->perm->getGroupRights($groupId)); } // Return all users if ('get_all_users' == $ajaxAction) { $users = array(); foreach ($userList as $single_user) { $user->getUserById($single_user, true); $users[] = array('user_id' => $user->getUserId(), 'login' => $user->getLogin()); } echo json_encode($users); } // Returns all group members if ('get_all_members' == $ajaxAction) { $memberList = $user->perm->getGroupMembers($groupId); $members = array(); foreach ($memberList as $single_member) { $user->getUserById($single_member, true); $members[] = array('user_id' => $user->getUserId(), 'login' => $user->getLogin()); } echo json_encode($members); } }