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; }
/** * Creates the anonymous default user * * @param PMF_Configuration $faqConfig * * @return void */ public function createAnonymousUser(PMF_Configuration $faqConfig) { $anonymous = new PMF_User($faqConfig); $anonymous->createUser('anonymous', null, -1); $anonymous->setStatus('protected'); $anonymousData = array('display_name' => 'Anonymous User', 'email' => null); $anonymous->setUserData($anonymousData); }
/** * Adds a new user account to the authentication table. * * Returns true on success, otherwise false. * * @param string $login Loginname * @param string $pass Password * @return boolean */ public function add($login, $pass) { $user = new PMF_User(); $result = $user->createUser($login, null); // Update user information from LDAP $user->setUserData(array('display_name' => $this->ldap->getCompleteName($login), 'email' => $this->ldap->getMail($login))); return $result; }
/** * Always returns true because of SSO * * @param string $login Loginname * @param string $pass Password * * @return boolean */ public function add($login, $pass) { $user = new PMF_User($this->_config); $result = $user->createUser($login, null); if ($result) { $user->setStatus('active'); } return $result; }
/** * Always returns true because of SSO * * @param string $login Loginname * @param string $pass Password * * @return boolean */ public function add($login, $pass) { if ($this->_config->get('security.ldapSupport')) { // LDAP + SSO $authLdap = new PMF_Auth_Ldap($this->_config); $result = $authLdap->add($login, $pass); return $result; } else { // LDAP disabled $user = new PMF_User($this->_config); $result = $user->createUser($login, null); if ($result) { $user->setStatus('active'); } // Update user information $user->setUserData(array('display_name' => $login)); return $result; } }
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; }
/** * Check on user and group permissions and on duplicate FAQs * * @param array $resultset Array with search results * * @return void */ public function reviewResultset(array $resultset) { $this->setResultset($resultset); $duplicateResults = []; $currentUserId = $this->user->getUserId(); if ('medium' === $this->_config->get('security.permLevel')) { $currentGroupIds = $this->user->perm->getUserGroups($currentUserId); } else { $currentGroupIds = array(-1); } foreach ($this->rawResultset as $result) { $permission = false; // check permissions for groups if ('medium' === $this->_config->get('security.permLevel')) { $groupPermission = $this->faq->getPermission('group', $result->id); if (count($groupPermission) && in_array($groupPermission[0], $currentGroupIds)) { $permission = true; } } // check permission for user if ($permission || 'basic' === $this->_config->get('security.permLevel')) { $userPermission = $this->faq->getPermission('user', $result->id); if (in_array(-1, $userPermission) || in_array($this->user->getUserId(), $userPermission)) { $permission = true; } else { $permission = false; } } // check on duplicates if (!isset($duplicateResults[$result->id])) { $duplicateResults[$result->id] = 1; } else { ++$duplicateResults[$result->id]; continue; } if ($permission) { $this->reviewedResultset[] = $result; } } $this->setNumberOfResults($this->reviewedResultset); }
/** * Check on user and group permissions and on duplicate FAQs * * @param array $resultset Array with search results * * @return void */ public function reviewResultset(array $resultset) { $this->setResultset($resultset); $faqUser = new PMF_Faq_User(); $faqGroup = new PMF_Faq_Group(); $duplicateResults = array(); $currentUserId = $this->user->getUserId(); if ('medium' == PMF_Configuration::getInstance()->get('main.permLevel')) { $currentGroupIds = $this->user->perm->getUserGroups($currentUserId); } foreach ($this->rawResultset as $index => $result) { $permission = false; // check permissions for groups if ('medium' == PMF_Configuration::getInstance()->get('main.permLevel')) { $groupPerm = $faqGroup->fetch($result->id); if (count($groupPerm) && in_array($groupPerm->group_id, $currentGroupIds)) { $permission = true; } } // check permission for user if ($permission || 'basic' == PMF_Configuration::getInstance()->get('main.permLevel')) { $userPerm = $faqUser->fetch($result->id); if (-1 == $userPerm->user_id || $this->user->getUserId() == $userPerm->user_id) { $permission = true; } else { $permission = false; } } // check on duplicates if (!isset($duplicateResults[$result->id])) { $duplicateResults[$result->id] = 1; } else { ++$duplicateResults[$result->id]; continue; } if ($permission) { $this->reviewedResultset[] = $result; } } $this->setNumberOfResults($this->reviewedResultset); }
$selectSize = 10; $defaultUserAction = 'list'; $defaultUserStatus = 'blocked'; $loginMinLength = 4; $loginInvalidRegExp = '/(^[^a-z]{1}|[\\W])/i'; $errorMessages = array('addUser_password' => $PMF_LANG['ad_user_error_password'], 'addUser_passwordsDontMatch' => $PMF_LANG['ad_user_error_passwordsDontMatch'], 'addUser_loginExists' => $PMF_LANG["ad_adus_exerr"], 'addUser_loginInvalid' => $PMF_LANG['ad_user_error_loginInvalid'], 'addUser_noEmail' => $PMF_LANG['ad_user_error_noEmail'], 'addUser_noRealName' => $PMF_LANG['ad_user_error_noRealName'], 'delUser' => $PMF_LANG['ad_user_error_delete'], 'delUser_noId' => $PMF_LANG['ad_user_error_noId'], 'delUser_protectedAccount' => $PMF_LANG['ad_user_error_protectedAccount'], 'updateUser' => $PMF_LANG['ad_msg_mysqlerr'], 'updateUser_noId' => $PMF_LANG['ad_user_error_noId'], 'updateRights' => $PMF_LANG['ad_msg_mysqlerr'], 'updateRights_noId' => $PMF_LANG['ad_user_error_noId']); $captcha = new PMF_Captcha($sids); $loginname = PMF_Filter::filterInput(INPUT_POST, 'loginname', FILTER_SANITIZE_STRING); $lastname = PMF_Filter::filterInput(INPUT_POST, 'lastname', FILTER_SANITIZE_STRING); $email = PMF_Filter::filterInput(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL); $code = PMF_Filter::filterInput(INPUT_POST, 'captcha', FILTER_SANITIZE_STRING); if (!$captcha->checkCaptchaCode($code)) { $captchaError = $PMF_LANG['captchaError']; } if (!is_null($loginname) && !is_null($lastname) && !is_null($email) && !isset($captchaError)) { $user = new PMF_User(); $message = ''; $messages = array(); // check input data $user_name = $loginname; $user_realname = $lastname; $user_password = ''; $user_email = $email; // check login name $user->setLoginMinLength($loginMinLength); $user->setLoginInvalidRegExp($loginInvalidRegExp); if (!$user->isValidLogin($user_name)) { $user_name = ''; $messages[] = $errorMessages['addUser_loginInvalid']; } if ($user->getUserByLogin($user_name)) {
$faqInstanceClient->createClient($faqInstance); $urlParts = parse_url($data['url']); $hostname = $urlParts['host']; if ($faqInstanceClient->createClientFolder($hostname)) { $clientDir = PMF_ROOT_DIR . '/multisite/' . $hostname; $clientSetup = new PMF_Instance_Setup(); $clientSetup->setRootDir($clientDir); $faqInstanceClient->copyConstantsFile($clientDir . '/constants.php'); $faqInstanceClient->copyLdapConstantsFile($clientDir . '/constants_ldap.php'); $dbSetup = array('dbServer' => $DB['server'], 'dbUser' => $DB['user'], 'dbPassword' => $DB['password'], 'dbDatabaseName' => $DB['db'], 'dbPrefix' => substr($hostname, 0, strpos($hostname, '.')), 'dbType' => $DB['type']); $clientSetup->createDatabaseFile($dbSetup, ''); $faqInstanceClient->setClientUrl('http://' . $hostname); $faqInstanceClient->createClientTables($dbSetup['dbPrefix']); PMF_Db::setTablePrefix($dbSetup['dbPrefix']); // add admin account and rights $instanceAdmin = new PMF_User($faqConfig); $instanceAdmin->createUser($admin, $password, 1); $instanceAdmin->setStatus('protected'); $instanceAdminData = array('display_name' => '', 'email' => $email); $instanceAdmin->setUserData($instanceAdminData); // Add anonymous user account $clientSetup->createAnonymousUser($faqConfig); PMF_Db::setTablePrefix($DB['prefix']); } else { $faqInstance->removeInstance($instanceId); $payload = array('error' => 'Cannot create instance.'); } if (0 !== $instanceId) { $payload = array('added' => $instanceId, 'url' => $data['url']); } else { $payload = array('error' => $instanceId);
$mail->message = $questionMail; $mail->send(); unset($mail); $message = array('success' => $PMF_LANG['msgAskThx4Mail']); } } else { $message = array('error' => $PMF_LANG['err_SaveQuestion']); } break; case 'saveregistration': $realname = PMF_Filter::filterInput(INPUT_POST, 'realname', FILTER_SANITIZE_STRING); $loginname = PMF_Filter::filterInput(INPUT_POST, 'name', FILTER_SANITIZE_STRING); $email = PMF_Filter::filterInput(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL); if (!is_null($loginname) && !empty($loginname) && !is_null($email) && !empty($email) && !is_null($realname) && !empty($realname)) { $message = array(); $user = new PMF_User(); $user->setLoginMinLength(4); // Create user account (login and password) // Note: password be automatically generated and sent by email as soon if admin switch user to "active" if (!$user->createUser($loginname, '')) { $message = array('error' => $user->error()); } else { $user->userdata->set(array('display_name', 'email'), array($realname, $email)); // set user status $user->setStatus('blocked'); $text = sprintf("New user has been registrated:\n\nUsername: %s\nLoginname: %s\n\n" . "To activate this user do please use the administration interface at %s.", $realname, $loginname, $faqconfig->get('main.referenceURL')); $mail = new PMF_Mail(); $mail->setReplyTo($email, $realname); $mail->addTo($faqconfig->get('main.administrationMail')); $mail->subject = PMF_Utils::resolveMarkers($PMF_LANG['emailRegSubject']); $mail->message = $text;
// Remove the user from groups if ('medium' == $faqConfig->get('security.permLevel')) { $oPerm = PMF_Perm::selectPerm('medium', $faqConfig); $oPerm->removeFromAllGroups($userId); } $message .= sprintf('<p class="alert alert-success">%s</p>', $PMF_LANG['ad_user_deleted']); } $userError = $user->error(); if ($userError != "") { $message .= sprintf('<p class="alert alert-error">%s</p>', $userError); } } } // save new user if ($userAction == 'addsave' && $permission['adduser']) { $user = new PMF_User($faqConfig); $message = ''; $messages = array(); $user_name = PMF_Filter::filterInput(INPUT_POST, 'user_name', FILTER_SANITIZE_STRING, ''); $user_realname = PMF_Filter::filterInput(INPUT_POST, 'user_realname', FILTER_SANITIZE_STRING, ''); $user_password = PMF_Filter::filterInput(INPUT_POST, 'user_password', FILTER_SANITIZE_STRING, ''); $user_email = PMF_Filter::filterInput(INPUT_POST, 'user_email', FILTER_VALIDATE_EMAIL); $user_password = PMF_Filter::filterInput(INPUT_POST, 'user_password', FILTER_SANITIZE_STRING, ''); $user_password_confirm = PMF_Filter::filterInput(INPUT_POST, 'user_password_confirm', FILTER_SANITIZE_STRING, ''); $csrfOkay = true; $csrfToken = PMF_Filter::filterInput(INPUT_POST, 'csrf', FILTER_SANITIZE_STRING); if (!isset($_SESSION['phpmyfaq_csrf_token']) || $_SESSION['phpmyfaq_csrf_token'] !== $csrfToken) { $csrfOkay = false; } if ($user_password != $user_password_confirm) { $user_password = '';
/** * Constructor * * @param PMF_Configuration $config * * @return PMF_User_CurrentUser */ function __construct(PMF_Configuration $config) { parent::__construct($config); $this->_ldapConfig = $config->getLdapConfig(); }
* http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" * 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) {
flush(); // add admin account and rights $admin = new PMF_User(); $admin->createUser('admin', $password, 1); $admin->setStatus('protected'); $adminData = array('display_name' => $realname, 'email' => $email); $admin->setUserData($adminData); $adminID = $admin->getUserId(); // add rights $rights = array(array('name' => 'adduser', 'description' => 'Right to add user accounts', 'for_users' => 1, 'for_groups' => 1), array('name' => 'edituser', 'description' => 'Right to edit user accounts', 'for_users' => 1, 'for_groups' => 1), array('name' => 'deluser', 'description' => 'Right to delete user accounts', 'for_users' => 1, 'for_groups' => 1), array('name' => 'addbt', 'description' => 'Right to add faq entries', 'for_users' => 1, 'for_groups' => 1), array('name' => 'editbt', 'description' => 'Right to edit faq entries', 'for_users' => 1, 'for_groups' => 1), array('name' => 'delbt', 'description' => 'Right to delete faq entries', 'for_users' => 1, 'for_groups' => 1), array('name' => 'viewlog', 'description' => 'Right to view logfiles', 'for_users' => 1, 'for_groups' => 1), array('name' => 'adminlog', 'description' => 'Right to view admin log', 'for_users' => 1, 'for_groups' => 1), array('name' => 'delcomment', 'description' => 'Right to delete comments', 'for_users' => 1, 'for_groups' => 1), array('name' => 'addnews', 'description' => 'Right to add news', 'for_users' => 1, 'for_groups' => 1), array('name' => 'editnews', 'description' => 'Right to edit news', 'for_users' => 1, 'for_groups' => 1), array('name' => 'delnews', 'description' => 'Right to delete news', 'for_users' => 1, 'for_groups' => 1), array('name' => 'addcateg', 'description' => 'Right to add categories', 'for_users' => 1, 'for_groups' => 1), array('name' => 'editcateg', 'description' => 'Right to edit categories', 'for_users' => 1, 'for_groups' => 1), array('name' => 'delcateg', 'description' => 'Right to delete categories', 'for_users' => 1, 'for_groups' => 1), array('name' => 'passwd', 'description' => 'Right to change passwords', 'for_users' => 1, 'for_groups' => 1), array('name' => 'editconfig', 'description' => 'Right to edit configuration', 'for_users' => 1, 'for_groups' => 1), array('name' => 'addatt', 'description' => 'Right to add attachments', 'for_users' => 1, 'for_groups' => 1), array('name' => 'delatt', 'description' => 'Right to delete attachments', 'for_users' => 1, 'for_groups' => 1), array('name' => 'backup', 'description' => 'Right to save backups', 'for_users' => 1, 'for_groups' => 1), array('name' => 'restore', 'description' => 'Right to load backups', 'for_users' => 1, 'for_groups' => 1), array('name' => 'delquestion', 'description' => 'Right to delete questions', 'for_users' => 1, 'for_groups' => 1), array('name' => 'addglossary', 'description' => 'Right to add glossary entries', 'for_users' => 1, 'for_groups' => 1), array('name' => 'editglossary', 'description' => 'Right to edit glossary entries', 'for_users' => 1, 'for_groups' => 1), array('name' => 'delglossary', 'description' => 'Right to delete glossary entries', 'for_users' => 1, 'for_groups' => 1), array('name' => 'changebtrevs', 'description' => 'Right to edit revisions', 'for_users' => 1, 'for_groups' => 1), array('name' => 'addgroup', 'description' => 'Right to add group accounts', 'for_users' => 1, 'for_groups' => 1), array('name' => 'editgroup', 'description' => 'Right to edit group accounts', 'for_users' => 1, 'for_groups' => 1), array('name' => 'delgroup', 'description' => 'Right to delete group accounts', 'for_users' => 1, 'for_groups' => 1), array('name' => 'addtranslation', 'description' => 'Right to add translation', 'for_users' => 1, 'for_groups' => 1), array('name' => 'edittranslation', 'description' => 'Right to edit translations', 'for_users' => 1, 'for_groups' => 1), array('name' => 'deltranslation', 'description' => 'Right to delete translations', 'for_users' => 1, 'for_groups' => 1), array('name' => 'approverec', 'description' => 'Right to approve records', 'for_users' => 1, 'for_groups' => 1)); foreach ($rights as $right) { $rightID = $admin->perm->addRight($right); $admin->perm->grantUserRight($adminID, $rightID); } // Add anonymous user account $anonymous = new PMF_User(); $anonymous->createUser('anonymous', null, -1); $anonymous->setStatus('protected'); $anonymousData = array('display_name' => 'Anonymous User', 'email' => null); $anonymous->setUserData($anonymousData); $oConf = PMF_Configuration::getInstance(); $oConf->getAll(); $configs = $oConf->config; $configs['spam.enableCaptchaCode'] = extension_loaded('gd') ? 'true' : 'false'; $configs['main.referenceURL'] = PMF_Link::getSystemUri('/install/setup.php'); $configs['main.phpMyFAQToken'] = md5(uniqid(rand())); $oConf->update($configs); print "</p>\n"; print "<p class=\"center\">All database tables were successfully created.</p>\n"; print "<p class=\"center\">Congratulation! Everything seems to be okay.</p>\n"; ?>
$protocol = 'http'; if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') { $protocol = 'https'; } header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); exit; } $ajaxAction = PMF_Filter::filterInput(INPUT_GET, 'ajaxaction', FILTER_SANITIZE_STRING); $userId = PMF_Filter::filterInput(INPUT_GET, 'user_id', FILTER_VALIDATE_INT); $usersearch = PMF_Filter::filterInput(INPUT_GET, 'q', FILTER_SANITIZE_STRING); // Send headers $response = new JsonResponse(); $responseWrapper = new ResponseWrapper($response); $responseWrapper->addCommonHeaders(); if ($user->perm->checkRight($user->getUserId(), 'adduser') || $user->perm->checkRight($user->getUserId(), 'edituser') || $user->perm->checkRight($user->getUserId(), 'deluser')) { $user = new PMF_User($faqConfig); switch ($ajaxAction) { case 'get_user_list': $users = []; foreach ($user->searchUsers($usersearch) as $singleUser) { $users[] = array('user_id' => $singleUser['user_id'], 'name' => $singleUser['login']); } $response->setData($users); break; case 'get_user_data': $user->getUserById($userId); $userdata = []; $userdata = $user->userdata->get('*'); $userdata['status'] = $user->getStatus(); $userdata['login'] = $user->getLogin(); $response->setData($userdata);
if ($groupId <= 0) { $message .= '<p class="error">' . $errorMessages['delGroup_noId'] . '</p>'; } else { if (!$user->perm->deleteGroup($groupId) && !$csrfOkay) { $message .= '<p class="error">' . $errorMessages['delGroup'] . '</p>'; } else { $message .= '<p class="success">' . $successMessages['delGroup'] . '</p>'; } $userError = $user->error(); if ($userError != "") { $message .= '<p>ERROR: ' . $userError . '</p>'; } } } if ($groupAction == 'addsave') { $user = new PMF_User(); $message = ''; $messages = array(); $group_name = PMF_Filter::filterInput(INPUT_POST, 'group_name', FILTER_SANITIZE_STRING, ''); $group_description = PMF_Filter::filterInput(INPUT_POST, 'group_description', FILTER_SANITIZE_STRING, ''); $group_auto_join = PMF_Filter::filterInput(INPUT_POST, 'group_auto_join', FILTER_SANITIZE_STRING, ''); $csrfOkay = true; $csrfToken = PMF_Filter::filterInput(INPUT_POST, 'csrf', FILTER_SANITIZE_STRING); if (!isset($_SESSION['phpmyfaq_csrf_token']) || $_SESSION['phpmyfaq_csrf_token'] !== $csrfToken) { $csrfOkay = false; } // check group name if ($group_name == '') { $messages[] = $errorMessages['addGroup_noName']; } // ok, let's go
} $faqRecord->create($newData); $recordId = $faqRecord->getSolutionId(); foreach ($categories as $category) { $categoryData = array('category_id' => $category->category_id, 'category_lang' => $newData['lang'], 'record_id' => $recordId, 'record_lang' => $newData['lang']); // save the category relations $categoryRelations->create($categoryData); } $sent = array(); // Let the PMF Administrator and the Category Owner to be informed by email of this new entry foreach ($categories as $category) { $userId = $category->user_id; // Avoid to send multiple emails to the same owner if (!isset($sent[$userId])) { // TODO: Move this code to Category.php $oUser = new PMF_User(); $oUser->getUserById($userId); $catOwnerEmail = $oUser->getUserData('email'); $mail = new PMF_Mail(); $mail->unsetFrom(); $mail->setFrom($usermail); $mail->addTo($faqconfig->get('main.administrationMail')); // Let the category owner get a copy of the message if ($faqconfig->get('main.administrationMail') != $catOwnerEmail) { $mail->addCc($catOwnerEmail); } $mail->subject = '%sitename%'; // TODO: let the email contains the faq article both as plain text and as HTML $mail->message = html_entity_decode($PMF_LANG['msgMailCheck']) . "\n\n" . $faqconfig->get('main.titleFAQ') . ": " . PMF_Link::getSystemUri('/index.php') . '/admin'; $result = $mail->send(); unset($mail);
// Remove the user from groups if ('medium' == $faqConfig->get('security.permLevel')) { $oPerm = PMF_Perm::selectPerm('medium', $faqConfig); $oPerm->removeFromAllGroups($userId); } $message .= sprintf('<p class="alert alert-success">%s</p>', $PMF_LANG['ad_user_deleted']); } $userError = $user->error(); if ($userError != "") { $message .= sprintf('<p class="alert alert-danger">%s</p>', $userError); } } } // save new user if ($userAction == 'addsave' && $user->perm->checkRight($user->getUserId(), 'adduser')) { $user = new PMF_User($faqConfig); $message = ''; $messages = []; $user_name = PMF_Filter::filterInput(INPUT_POST, 'user_name', FILTER_SANITIZE_STRING, ''); $user_realname = PMF_Filter::filterInput(INPUT_POST, 'user_realname', FILTER_SANITIZE_STRING, ''); $user_password = PMF_Filter::filterInput(INPUT_POST, 'user_password', FILTER_SANITIZE_STRING, ''); $user_email = PMF_Filter::filterInput(INPUT_POST, 'user_email', FILTER_VALIDATE_EMAIL); $user_password = PMF_Filter::filterInput(INPUT_POST, 'user_password', FILTER_SANITIZE_STRING, ''); $user_password_confirm = PMF_Filter::filterInput(INPUT_POST, 'user_password_confirm', FILTER_SANITIZE_STRING, ''); $csrfOkay = true; $csrfToken = PMF_Filter::filterInput(INPUT_POST, 'csrf', FILTER_SANITIZE_STRING); if (!isset($_SESSION['phpmyfaq_csrf_token']) || $_SESSION['phpmyfaq_csrf_token'] !== $csrfToken) { $csrfOkay = false; } if ($user_password != $user_password_confirm) { $user_password = '';
if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') { $protocol = 'https'; } header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); exit; } $ajaxAction = PMF_Filter::filterInput(INPUT_GET, 'ajaxaction', FILTER_SANITIZE_STRING); $userId = PMF_Filter::filterInput(INPUT_GET, 'user_id', FILTER_VALIDATE_INT); $usersearch = PMF_Filter::filterInput(INPUT_GET, 'q', FILTER_SANITIZE_STRING); $csrfToken = PMF_Filter::filterInput(INPUT_GET, 'csrf', FILTER_SANITIZE_STRING); // Send headers $http = new PMF_Helper_Http(); $http->setContentType('application/json'); $http->addHeader(); if ($permission['adduser'] || $permission['edituser'] || $permission['deluser']) { $user = new PMF_User($faqConfig); switch ($ajaxAction) { case 'get_user_list': $users = array(); foreach ($user->searchUsers($usersearch) as $singleUser) { $users[] = array('user_id' => $singleUser['user_id'], 'name' => $singleUser['login']); } echo json_encode($users); break; case 'get_user_data': $user->getUserById($userId, true); $userdata = array(); $userdata = $user->userdata->get('*'); $userdata['status'] = $user->getStatus(); $userdata['login'] = $user->getLogin(); print json_encode($userdata);
/** * Adds a new user account to the authentication table. * Returns true on success, otherwise false. * * @param string $login Login name * @param string $pass Password * * @return boolean */ public function add($login, $pass) { $user = new PMF_User(); $user->setLoginMinLength(2); // LDAP user names can be very short! $result = $user->createUser($login, null); $user->setStatus('active'); // Update user information from LDAP $user->setUserData(array('display_name' => $this->ldap->getCompleteName($login), 'email' => $this->ldap->getMail($login))); return $result; }
/** * Setter for permission array * * @param PMF_User $user User object * * @return void */ public function setUser(PMF_User $user) { // read all rights, set them FALSE $allRights = $user->perm->getAllRightsData(); foreach ($allRights as $right) { $this->permission[$right['name']] = false; } // check user rights, set them TRUE $allUserRights = $user->perm->getAllUserRights($user->getUserId()); foreach ($allRights as $right) { if (in_array($right['right_id'], $allUserRights)) { $this->permission[$right['name']] = true; } } }
/** * Starts the installation * * @param array $DB */ public function startInstall(array $DB = null) { $query = $uninst = $dbSetup = []; // Check table prefix $dbSetup['dbPrefix'] = $sqltblpre = PMF_Filter::filterInput(INPUT_POST, 'sqltblpre', FILTER_SANITIZE_STRING, ''); if ('' !== $dbSetup['dbPrefix']) { PMF_Db::setTablePrefix($dbSetup['dbPrefix']); } // Check database entries $dbSetup['dbType'] = PMF_Filter::filterInput(INPUT_POST, 'sql_type', FILTER_SANITIZE_STRING); if (!is_null($dbSetup['dbType'])) { $dbSetup['dbType'] = trim($dbSetup['dbType']); if (!file_exists(PMF_ROOT_DIR . '/setup/assets/sql/' . $dbSetup['dbType'] . '.sql.php')) { printf('<p class="alert alert-danger"><strong>Error:</strong> Invalid server type: %s</p>', $dbSetup['dbType']); PMF_System::renderFooter(true); } } else { echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Please select a database type.</p>\n"; PMF_System::renderFooter(true); } $dbSetup['dbServer'] = PMF_Filter::filterInput(INPUT_POST, 'sql_server', FILTER_SANITIZE_STRING); if (is_null($dbSetup['dbServer']) && !PMF_System::isSqlite($dbSetup['dbType'])) { echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Please add a database server.</p>\n"; PMF_System::renderFooter(true); } $dbSetup['dbPort'] = PMF_Filter::filterInput(INPUT_POST, 'sql_port', FILTER_VALIDATE_INT); if (is_null($dbSetup['dbPort']) && !PMF_System::isSqlite($dbSetup['dbType'])) { echo "<p class=\"alert alert-error\"><strong>Error:</strong> Please add a valid database port.</p>\n"; PMF_System::renderFooter(true); } $dbSetup['dbUser'] = PMF_Filter::filterInput(INPUT_POST, 'sql_user', FILTER_SANITIZE_STRING); if (is_null($dbSetup['dbUser']) && !PMF_System::isSqlite($dbSetup['dbType'])) { echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Please add a database username.</p>\n"; PMF_System::renderFooter(true); } $dbSetup['dbPassword'] = PMF_Filter::filterInput(INPUT_POST, 'sql_passwort', FILTER_UNSAFE_RAW); if (is_null($dbSetup['dbPassword']) && !PMF_System::isSqlite($dbSetup['dbType'])) { // Password can be empty... $dbSetup['dbPassword'] = ''; } $dbSetup['dbDatabaseName'] = PMF_Filter::filterInput(INPUT_POST, 'sql_db', FILTER_SANITIZE_STRING); if (is_null($dbSetup['dbDatabaseName']) && !PMF_System::isSqlite($dbSetup['dbType'])) { echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Please add a database name.</p>\n"; PMF_System::renderFooter(true); } if (PMF_System::isSqlite($dbSetup['dbType'])) { $dbSetup['dbServer'] = PMF_Filter::filterInput(INPUT_POST, 'sql_sqlitefile', FILTER_SANITIZE_STRING); if (is_null($dbSetup['dbServer'])) { echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Please add a SQLite database filename.</p>\n"; PMF_System::renderFooter(true); } } // check database connection PMF_Db::setTablePrefix($dbSetup['dbPrefix']); $db = PMF_Db::factory($dbSetup['dbType']); $db->connect($dbSetup['dbServer'], $dbSetup['dbUser'], $dbSetup['dbPassword'], $dbSetup['dbDatabaseName']); if (!$db) { printf("<p class=\"alert alert-danger\"><strong>DB Error:</strong> %s</p>\n", $db->error()); PMF_System::renderFooter(true); } $configuration = new PMF_Configuration($db); // check LDAP if available $ldapEnabled = PMF_Filter::filterInput(INPUT_POST, 'ldap_enabled', FILTER_SANITIZE_STRING); if (extension_loaded('ldap') && !is_null($ldapEnabled)) { $ldapSetup = []; // check LDAP entries $ldapSetup['ldapServer'] = PMF_Filter::filterInput(INPUT_POST, 'ldap_server', FILTER_SANITIZE_STRING); if (is_null($ldapSetup['ldapServer'])) { echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Please add a LDAP server.</p>\n"; PMF_System::renderFooter(true); } $ldapSetup['ldapPort'] = PMF_Filter::filterInput(INPUT_POST, 'ldap_port', FILTER_VALIDATE_INT); if (is_null($ldapSetup['ldapPort'])) { echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Please add a LDAP port.</p>\n"; PMF_System::renderFooter(true); } $ldapSetup['ldapBase'] = PMF_Filter::filterInput(INPUT_POST, 'ldap_base', FILTER_SANITIZE_STRING); if (is_null($ldapSetup['ldapBase'])) { echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Please add a LDAP base search DN.</p>\n"; PMF_System::renderFooter(true); } // LDAP User and LDAP password are optional $ldapSetup['ldapUser'] = PMF_Filter::filterInput(INPUT_POST, 'ldap_user', FILTER_SANITIZE_STRING, ''); $ldapSetup['ldapPassword'] = PMF_Filter::filterInput(INPUT_POST, 'ldap_password', FILTER_SANITIZE_STRING, ''); // check LDAP connection require PMF_ROOT_DIR . "/inc/PMF/Ldap.php"; $ldap = new PMF_Ldap($configuration); $ldap->connect($ldapSetup['ldapServer'], $ldapSetup['ldapPort'], $ldapSetup['ldapBase'], $ldapSetup['ldapUser'], $ldapSetup['ldapPassword']); if (!$ldap) { echo "<p class=\"alert alert-danger\"><strong>LDAP Error:</strong> " . $ldap->error() . "</p>\n"; PMF_System::renderFooter(true); } } // check loginname $loginname = PMF_Filter::filterInput(INPUT_POST, 'loginname', FILTER_SANITIZE_STRING); if (is_null($loginname)) { echo '<p class="alert alert-danger"><strong>Error:</strong> Please add a loginname for your account.</p>'; PMF_System::renderFooter(true); } // check user entries $password = PMF_Filter::filterInput(INPUT_POST, 'password', FILTER_SANITIZE_STRING); if (is_null($password)) { echo '<p class="alert alert-danger"><strong>Error:</strong> Please add a password for the your account.</p>'; PMF_System::renderFooter(true); } $password_retyped = PMF_Filter::filterInput(INPUT_POST, 'password_retyped', FILTER_SANITIZE_STRING); if (is_null($password_retyped)) { echo '<p class="alert alert-danger"><strong>Error:</strong> Please add a retyped password.</p>'; PMF_System::renderFooter(true); } if (strlen($password) <= 5 || strlen($password_retyped) <= 5) { echo '<p class="alert alert-danger"><strong>Error:</strong> Your password and retyped password are too short.' . ' Please set your password and your retyped password with a minimum of 6 characters.</p>'; PMF_System::renderFooter(true); } if ($password != $password_retyped) { echo '<p class="alert alert-danger"><strong>Error:</strong> Your password and retyped password are not equal.' . ' Please check your password and your retyped password.</p>'; PMF_System::renderFooter(true); } $language = PMF_Filter::filterInput(INPUT_POST, 'language', FILTER_SANITIZE_STRING, 'en'); $realname = PMF_Filter::filterInput(INPUT_POST, 'realname', FILTER_SANITIZE_STRING, ''); $email = PMF_Filter::filterInput(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL, ''); $permLevel = PMF_Filter::filterInput(INPUT_POST, 'permLevel', FILTER_SANITIZE_STRING, 'basic'); $instanceSetup = new PMF_Instance_Setup(); $instanceSetup->setRootDir(PMF_ROOT_DIR); // Write the DB variables in database.php if (!$instanceSetup->createDatabaseFile($dbSetup)) { echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Setup cannot write to ./config/database.php.</p>"; $this->_system->cleanInstallation(); PMF_System::renderFooter(true); } // check LDAP if available if (extension_loaded('ldap') && !is_null($ldapEnabled)) { if (!$instanceSetup->createLdapFile($ldapSetup, '')) { echo "<p class=\"alert alert-danger\"><strong>Error:</strong> Setup cannot write to ./config/ldap.php.</p>"; $this->_system->cleanInstallation(); PMF_System::renderFooter(true); } } // connect to the database using config/database.php require PMF_ROOT_DIR . '/config/database.php'; $db = PMF_Db::factory($dbSetup['dbType']); $db->connect($DB['server'], $DB['user'], $DB['password'], $DB['db']); if (!$db) { echo "<p class=\"alert alert-danger\"><strong>DB Error:</strong> " . $db->error() . "</p>\n"; $this->_system->cleanInstallation(); PMF_System::renderFooter(true); } require PMF_ROOT_DIR . '/setup/assets/sql/' . $dbSetup['dbType'] . '.sql.php'; // CREATE TABLES require PMF_ROOT_DIR . '/setup/assets/sql/stopwords.sql.php'; // INSERTs for stopwords $this->_system->setDatabase($db); echo '<p>'; // Erase any table before starting creating the required ones if (!PMF_System::isSqlite($dbSetup['dbType'])) { $this->_system->dropTables($uninst); } // Start creating the required tables $count = 0; foreach ($query as $executeQuery) { $result = @$db->query($executeQuery); if (!$result) { echo '<p class="alert alert-danger"><strong>Error:</strong> Please install your version of phpMyFAQ once again or send us a <a href=\\"http://www.phpmyfaq.de\\" target=\\"_blank\\">bug report</a>.</p>'; printf('<p class="alert alert-danger"><strong>DB error:</strong> %s</p>', $db->error()); printf('<code>%s</code>', htmlentities($executeQuery)); $this->_system->dropTables($uninst); $this->_system->cleanInstallation(); PMF_System::renderFooter(true); } usleep(2500); $count++; if (!($count % 10)) { echo '| '; } } $link = new PMF_Link(null, $configuration); // add main configuration, add personal settings $this->_mainConfig['main.metaPublisher'] = $realname; $this->_mainConfig['main.administrationMail'] = $email; $this->_mainConfig['main.language'] = $language; $this->_mainConfig['security.permLevel'] = $permLevel; foreach ($this->_mainConfig as $name => $value) { $configuration->add($name, $value); } $configuration->update(array('main.referenceURL' => $link->getSystemUri('/setup/index.php'))); $configuration->add('security.salt', md5($configuration->get('main.referenceURL'))); // add admin account and rights $admin = new PMF_User($configuration); if (!$admin->createUser($loginname, $password, 1)) { printf("<p class=\"alert alert-danger\"><strong>Fatal installation error:</strong><br>" . "Couldn't create the admin user: %s</p>\n", $admin->error()); $this->_system->cleanInstallation(); PMF_System::renderFooter(true); } $admin->setStatus('protected'); $adminData = array('display_name' => $realname, 'email' => $email); $admin->setUserData($adminData); // add default rights foreach ($this->_mainRights as $right) { $admin->perm->grantUserRight(1, $admin->perm->addRight($right)); } // Add anonymous user account $instanceSetup->createAnonymousUser($configuration); // Add master instance $instanceData = array('url' => $link->getSystemUri($_SERVER['SCRIPT_NAME']), 'instance' => $link->getSystemRelativeUri('setup/index.php'), 'comment' => 'phpMyFAQ ' . PMF_System::getVersion()); $faqInstance = new PMF_Instance($configuration); $faqInstance->addInstance($instanceData); $faqInstanceMaster = new PMF_Instance_Master($configuration); $faqInstanceMaster->createMaster($faqInstance); echo '</p>'; }
* under the License. * * @category phpMyFAQ * @package Administraion * @author Thorsten Rinne <*****@*****.**> * @copyright 2003-2010 phpMyFAQ Team * @license http://www.mozilla.org/MPL/MPL-1.1.html Mozilla Public License Version 1.1 * @link http://www.phpmyfaq.de * @since 2003-02-26 */ if (!defined('IS_VALID_PHPMYFAQ')) { header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); exit; } if (isset($auth)) { $user = new PMF_User(); $groupSupport = $user->perm instanceof PMF_Perm_PermMedium; $adminHelper = PMF_Helper_Administration::getInstance(); $adminHelper->setPermission($permission); $menuGroup = $secLevelEntries = ''; $dashboardPage = true; $contentPage = false; $userPage = false; $statisticsPage = false; $exportsPage = false; $backupPage = false; $configurationPage = false; switch ($action) { case 'user': case 'group': case 'passwd':
/** * Adds a new user account to the authentication table. * Returns true on success, otherwise false. * * @param string $login Login name * @param string $pass Password * * @return boolean */ public function add($login, $pass) { $user = new PMF_User($this->_config); $result = $user->createUser($login, null); $this->ldap->connect($this->ldapServer[$this->activeServer]['ldap_server'], $this->ldapServer[$this->activeServer]['ldap_port'], $this->ldapServer[$this->activeServer]['ldap_base'], $this->ldapServer[$this->activeServer]['ldap_user'], $this->ldapServer[$this->activeServer]['ldap_password']); if ($this->ldap->error) { $this->errors[] = $this->ldap->error; } $user->setStatus('active'); // Update user information from LDAP $user->setUserData(array('display_name' => $this->ldap->getCompleteName($login), 'email' => $this->ldap->getMail($login))); return $result; }
/** * constructor * * @access public * @author Lars Tiedemann, <*****@*****.**> * @return void */ function __construct() { parent::__construct(); }
if ($groupId <= 0) { $message .= sprintf('<p class="alert alert-danger">%s</p>', $PMF_LANG['ad_user_error_noId']); } else { if (!$user->perm->deleteGroup($groupId) && !$csrfOkay) { $message .= sprintf('<p class="alert alert-danger">%s</p>', $PMF_LANG['ad_group_error_delete']); } else { $message .= sprintf('<p class="alert alert-success">%s</p>', $PMF_LANG['ad_group_deleted']); } $userError = $user->error(); if ($userError != "") { $message .= sprintf('<p class="alert alert-danger">%s</p>', $userError); } } } if ($groupAction == 'addsave' && $user->perm->checkRight($user->getUserId(), 'addgroup')) { $user = new PMF_User($faqConfig); $message = ''; $messages = []; $group_name = PMF_Filter::filterInput(INPUT_POST, 'group_name', FILTER_SANITIZE_STRING, ''); $group_description = PMF_Filter::filterInput(INPUT_POST, 'group_description', FILTER_SANITIZE_STRING, ''); $group_auto_join = PMF_Filter::filterInput(INPUT_POST, 'group_auto_join', FILTER_SANITIZE_STRING, ''); $csrfOkay = true; $csrfToken = PMF_Filter::filterInput(INPUT_POST, 'csrf', FILTER_SANITIZE_STRING); if (!isset($_SESSION['phpmyfaq_csrf_token']) || $_SESSION['phpmyfaq_csrf_token'] !== $csrfToken) { $csrfOkay = false; } // check group name if ($group_name == '') { $messages[] = $PMF_LANG['ad_group_error_noName']; } // ok, let's go
* compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" * 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); $group_id = PMF_Filter::filterInput(INPUT_GET, 'group_id', FILTER_VALIDATE_INT); if ($permission['adduser'] || $permission['edituser'] || $permission['deluser']) { $user = new PMF_User(); $userList = $user->getAllUsers(); $groupList = $user->perm instanceof PMF_Perm_PermMedium ? $user->perm->getAllGroups() : array(); // Returns all groups if ('get_all_groups' == $ajax_action) { $groups = array(); foreach ($groupList as $group_id) { $data = $user->perm->getGroupData($group_id); $groups[] = array('group_id' => $data['group_id'], 'name' => $data['name']); } print json_encode($groups); } // Return the group data if ('get_group_data' == $ajax_action) { print json_encode($user->perm->getGroupData($group_id)); }
// Remove the user from groups if ('medium' == PMF_Configuration::getInstance()->get('main.permLevel')) { $oPerm = PMF_Perm::selectPerm('medium'); $oPerm->removeFromAllGroups($userId); } $message .= '<p class="success">' . $successMessages['delUser'] . '</p>'; } $userError = $user->error(); if ($userError != "") { $message .= '<p>ERROR: ' . $userError . '</p>'; } } } // save new user if ($userAction == 'addsave') { $user = new PMF_User(); $message = ''; $messages = array(); // check input data $user_name = PMF_Filter::filterInput(INPUT_POST, 'user_name', FILTER_SANITIZE_STRING, ''); $user_realname = PMF_Filter::filterInput(INPUT_POST, 'user_realname', FILTER_SANITIZE_STRING, ''); $user_password = PMF_Filter::filterInput(INPUT_POST, 'user_password', FILTER_SANITIZE_STRING, ''); $user_email = PMF_Filter::filterInput(INPUT_POST, 'user_email', FILTER_VALIDATE_EMAIL); $user_password = PMF_Filter::filterInput(INPUT_POST, 'user_password', FILTER_SANITIZE_STRING, ''); $user_password_confirm = PMF_Filter::filterInput(INPUT_POST, 'user_password_confirm', FILTER_SANITIZE_STRING, ''); if ($user_password != $user_password_confirm) { $user_password = ''; $user_password_confirm = ''; $messages[] = $errorMessages['addUser_passwordsDontMatch']; } // check login name
print $PMF_LANG['ad_gen_cancel']; ?> </button> <button class="btn btn-primary" type="submit"> <?php print $PMF_LANG['ad_gen_save']; ?> </button> </p> </form> <?php } } if ($groupAction == 'delete' && $permission['delgroup']) { $message = ''; $user = new PMF_User($faqConfig); $groupId = PMF_Filter::filterInput(INPUT_POST, 'group_id', FILTER_VALIDATE_INT, 0); $csrfOkay = true; $csrfToken = PMF_Filter::filterInput(INPUT_POST, 'csrf', FILTER_SANITIZE_STRING); if (!isset($_SESSION['phpmyfaq_csrf_token']) || $_SESSION['phpmyfaq_csrf_token'] !== $csrfToken) { $csrfOkay = false; } $groupAction = $defaultGroupAction; if ($groupId <= 0) { $message .= sprintf('<p class="alert alert-error">%s</p>', $PMF_LANG['ad_user_error_noId']); } else { if (!$user->perm->deleteGroup($groupId) && !$csrfOkay) { $message .= sprintf('<p class="alert alert-error">%s</p>', $PMF_LANG['ad_group_error_delete']); } else { $message .= sprintf('<p class="alert alert-success">%s</p>', $PMF_LANG['ad_group_deleted']); }