" /> <?php if ($parentId > 0) { $userAllowed = $categoryUser->fetch($parentId); $groupAllowed = $categoryGroup->fetch($parentId); ?> <input type="hidden" name="restricted_users" value="<?php print $userAllowed->user_id; ?> " /> <input type="hidden" name="restricted_groups" value="<?php print $groupAllowed->group_id; ?> " /> <?php printf(" <p>%s: %s (%s)</p>\n", $PMF_LANG["msgMainCategory"], $categoryData->name, $languageCodes[PMF_String::strtoupper($categoryData->lang)]); } ?> <label class="left"><?php print $PMF_LANG["ad_categ_titel"]; ?> :</label> <input type="text" id="name" name="name" size="30" style="width: 300px;" /><br /> <label class="left"><?php print $PMF_LANG["ad_categ_desc"]; ?> :</label> <textarea id="description" name="description" rows="3" cols="80" style="width: 300px;"></textarea><br /> <label class="left"><?php
/** * Make a string upper case * * @param string $str String * * @return string */ public static function strtoupper($str) { return self::$instance->strtoupper($str); }
$num = round($searchItem['number'] * 100 / $searchesCount, 2); ?> <tr class="row_search_id_<?php print $searchItem['id']; ?> "> <td><?php print PMF_String::htmlspecialchars($searchItem['searchterm']); ?> </td> <td><?php print $searchItem['number']; ?> </td> <td><?php print $languageCodes[PMF_String::strtoupper($searchItem['lang'])]; ?> </td> <td><?php print $num; ?> %</td> <td> <a onclick="deleteSearchTerm('<?php print $searchItem['searchterm']; ?> ', <?php print $searchItem['id']; ?> ); return false;" href="javascript:;">
/** * Validate the Captcha * * @param string $captchaCode Captcha code * @return boolean */ public function validateCaptchaCode($captchaCode) { // Sanity check if (0 == PMF_String::strlen($captchaCode)) { return false; } $captchaCode = PMF_String::strtoupper($captchaCode); // Help the user: treat "0" (ASCII 48) like "O" (ASCII 79) // if "0" is not in the realm of captcha code letters if (!in_array("0", $this->letters)) { $captchaCode = str_replace("0", "O", $captchaCode); } // Sanity check for ($i = 0; $i < PMF_String::strlen($captchaCode); $i++) { if (!in_array($captchaCode[$i], $this->letters)) { return false; } } // Search for this Captcha in the db $query = sprintf("\n SELECT\n id\n FROM\n %sfaqcaptcha\n WHERE\n id = '%s'", PMF_Db::getTablePrefix(), $this->_config->getDb()->escape($captchaCode)); if ($result = $this->_config->getDb()->query($query)) { $num = $this->_config->getDb()->numRows($result); if ($num > 0) { $this->code = $captchaCode; $this->removeCaptcha($captchaCode); return true; } } return false; }
$groupsAllowed = $category->getPermissions('group', array($parentId)); ?> <input type="hidden" name="restricted_users" value="<?php echo $userAllowed[0]; ?> "> <?php foreach ($groupsAllowed as $group) { ?> <input type="hidden" name="restricted_groups[]" value="<?php echo $group; ?> "> <?php } printf('<div class="control-group">%s: %s (%s)</div>', $PMF_LANG['msgMainCategory'], $category->categoryName[$parentId]['name'], $languageCodes[PMF_String::strtoupper($category->categoryName[$parentId]['lang'])]); } ?> <div class="control-group"> <label class="control-label" for="name"><?php echo $PMF_LANG['ad_categ_titel']; ?> :</label> <div class="controls"> <input type="text" id="name" name="name" required="required"> </div> </div> <div class="control-group"> <label class="control-label" for="description"><?php echo $PMF_LANG['ad_categ_desc'];
/** * Returns all records from the current first letter * * @param string $letter Letter * @return array * @since 2007-03-30 * @author Thorsten Rinne <*****@*****.**> */ public function getRecordsFromLetter($letter = 'A') { global $sids, $PMF_LANG; if ($this->groupSupport) { $permPart = sprintf("( fdg.group_id IN (%s)\n OR\n (fdu.user_id = %d AND fdg.group_id IN (%s)))", implode(', ', $this->groups), $this->user, implode(', ', $this->groups)); } else { $permPart = sprintf("( fdu.user_id = %d OR fdu.user_id = -1 )", $this->user); } $letter = PMF_String::strtoupper($this->db->escape_string(PMF_String::substr($letter, 0, 1))); $writeMap = ''; switch ($this->type) { case 'db2': case 'sqlite': $query = sprintf("\n SELECT\n fd.thema AS thema,\n fd.id AS id,\n fd.lang AS lang,\n fcr.category_id AS category_id,\n fd.content AS snap\n FROM\n %sfaqcategoryrelations fcr,\n %sfaqdata fd\n LEFT JOIN\n %sfaqdata_group AS fdg\n ON\n fd.id = fdg.record_id\n LEFT JOIN\n %sfaqdata_user AS fdu\n ON\n fd.id = fdu.record_id\n WHERE\n fd.id = fcr.record_id\n AND\n SUBSTR(fd.thema, 1, 1) = '%s'\n AND\n fd.lang = '%s'\n AND\n fd.active = 'yes'\n AND\n %s", SQLPREFIX, SQLPREFIX, SQLPREFIX, SQLPREFIX, $letter, $this->language, $permPart); break; default: $query = sprintf("\n SELECT\n fd.thema AS thema,\n fd.id AS id,\n fd.lang AS lang,\n fcr.category_id AS category_id,\n fd.content AS snap\n FROM\n %sfaqcategoryrelations fcr,\n %sfaqdata fd\n LEFT JOIN\n %sfaqdata_group AS fdg\n ON\n fd.id = fdg.record_id\n LEFT JOIN\n %sfaqdata_user AS fdu\n ON\n fd.id = fdu.record_id\n WHERE\n fd.id = fcr.record_id\n AND\n SUBSTRING(fd.thema, 1, 1) = '%s'\n AND\n fd.lang = '%s'\n AND\n fd.active = 'yes'\n AND\n %s", SQLPREFIX, SQLPREFIX, SQLPREFIX, SQLPREFIX, $letter, $this->language, $permPart); break; } $result = $this->db->query($query); $oldId = 0; while ($row = $this->db->fetch_object($result)) { if ($oldId != $row->id) { $title = PMF_String::htmlspecialchars($row->thema, ENT_QUOTES, 'utf-8'); $url = sprintf('%saction=artikel&cat=%d&id=%d&artlang=%s', $sids, $row->category_id, $row->id, $row->lang); $oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . '?' . $url); $oLink->itemTitle = $row->thema; $oLink->text = $title; $oLink->tooltip = $title; $writeMap .= '<li>' . $oLink->toHtmlAnchor() . '<br />' . "\n"; $writeMap .= PMF_Utils::chopString(strip_tags($row->snap), 25) . " ...</li>\n"; } $oldId = $row->id; } $writeMap = empty($writeMap) ? '' : '<ul>' . $writeMap . '</ul>'; return $writeMap; }
" /> <?php if ($parent_id > 0) { $user_allowed = $category->getPermissions('user', array($parent_id)); $group_allowed = $category->getPermissions('group', array($parent_id)); ?> <input type="hidden" name="restricted_users" value="<?php print $user_allowed[0]; ?> " /> <input type="hidden" name="restricted_groups" value="<?php print $group_allowed[0]; ?> " /> <?php printf("<p>%s: %s (%s)</p>", $PMF_LANG["msgMainCategory"], $category->categoryName[$parent_id]["name"], $languageCodes[PMF_String::strtoupper($category->categoryName[$parent_id]["lang"])]); } ?> <p> <label><?php print $PMF_LANG["ad_categ_titel"]; ?> :</label> <input type="text" id="name" name="name" size="30" style="width: 300px;" autofocus="autofocus" /> </p> <p> <label><?php print $PMF_LANG["ad_categ_desc"]; ?>
*/ if (!defined('IS_VALID_PHPMYFAQ')) { $protocol = 'http'; if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') { $protocol = 'https'; } header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); exit; } if ($user->perm->checkRight($user->getUserId(), 'addcateg')) { $parentId = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT, 0); $templateVars = array('LANGCODE' => $LANGCODE, 'PMF_LANG' => $PMF_LANG, 'csrfToken' => $user->getCsrfTokenFromSession(), 'parentId' => $parentId, 'renderGroupPermissions' => false, 'userOptions' => $user->getAllUserOptions()); $category = new PMF_Category($faqConfig, [], false); $category->setUser($currentAdminUser); $category->setGroups($currentAdminGroups); if ($parentId > 0) { $userAllowed = $category->getPermissions('user', array($parentId)); $groupsAllowed = $category->getPermissions('group', array($parentId)); $templateVars['userAllowed'] = $userAllowed[0]; $templateVars['groupsAllowed'] = $groupsAllowed; $templateVars['parentCategoryName'] = $category->categoryName[$parentId]['name']; $templateVars['parentCategoryLanguage'] = $languageCodes[PMF_String::strtoupper($category->categoryName[$parentId]['lang'])]; } elseif ($faqConfig->get('security.permLevel') != 'basic') { $templateVars['renderGroupPermissions'] = true; $templateVars['groupOptions'] = $user->perm->getAllGroupsOptions([]); } $twig->loadTemplate('category/add.twig')->display($templateVars); unset($templateVars, $parentId, $category, $userAllowed, $groupsAllowed); } else { require 'noperm.php'; }