コード例 #1
0
ファイル: stat.ratings.php プロジェクト: nosch/phpMyFAQ
if (!defined('IS_VALID_PHPMYFAQ_ADMIN')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
if ($permission['viewlog']) {
    // Get category data
    $categoryData = new PMF_Category_Tree_DataProvider_SingleQuery($LANGCODE);
    $categoryLayout = new PMF_Category_Layout(new PMF_Category_Tree_Helper(new PMF_Category_Tree($categoryData)));
    // Get rating data
    $ratings = new PMF_Rating();
    //$ratingData     = $ratings->fetchAll();
    $ratingdata = $ratings->getAllRatings();
    $numratings = count($ratingdata);
    $oldcategory = 0;
    // Get FAQ record data
    $faqRecord = new PMF_Faq_Record();
    $faqRecord->setLanguage($LANGCODE);
    $faqData = $faqRecord->fetchAll();
    ?>
    <h2><?php 
    print $PMF_LANG["ad_rs"];
    ?>
</h2>
    <table id="tableUserRatings">
<?php 
    foreach ($ratingdata as $data) {
        if ($data['category_id'] != $oldcategory) {
            ?>
    <tr>
        <th colspan="5"><strong><?php 
            print $categoryLayout->renderBreadcrumb($categoryData->getPath($data['category_id']));
コード例 #2
0
ファイル: save.php プロジェクト: nosch/phpMyFAQ
     $faqsession->userTracking('save_new_translation_entry', 0);
 } else {
     $faqsession->userTracking('save_new_entry', 0);
 }
 $isTranslation = false;
 if (!is_null($faqlanguage)) {
     $isTranslation = true;
     $newLanguage = $faqlanguage;
 }
 if (PMF_String::substr($contentlink, 7) != "") {
     $content = $content . "<br />" . $PMF_LANG["msgInfo"] . "<a href=\"http://" . PMF_String::substr($contentlink, 7) . "\" target=\"_blank\">" . $contentlink . "</a>";
 }
 $newData = array('lang' => $isTranslation == true ? $newLanguage : $LANGCODE, 'thema' => $thema, 'active' => FAQ_SQL_ACTIVE_NO, 'sticky' => 0, 'content' => $content, 'keywords' => $keywords, 'author' => $username, 'email' => $usermail, 'comment' => FAQ_SQL_YES, 'date' => date('YmdHis'), 'dateStart' => '00000000000000', 'dateEnd' => '99991231235959', 'linkState' => '', 'linkDateCheck' => 0);
 $categoryNode = new PMF_Category_Node();
 $categoryRelation = new PMF_Category_Relations();
 $faqRecord = new PMF_Faq_Record();
 if ($isNew) {
     $newData['id'] = null;
     $categories = $categoryNode->fetchAll($categories['rubrik']);
 } else {
     $newData['id'] = $faqid;
     foreach ($categoryRelation->fetchAll() as $relation) {
         if ($relation->record_id == $newData['id']) {
             $categories[] = $relation;
         }
     }
 }
 $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']);
コード例 #3
0
ファイル: record.add.php プロジェクト: nosch/phpMyFAQ
 $solution_id = PMF_Filter::filterInput(INPUT_POST, 'solution_id', FILTER_VALIDATE_INT);
 $revision_id = PMF_Filter::filterInput(INPUT_POST, 'revision_id', FILTER_VALIDATE_INT);
 $changed = PMF_Filter::filterInput(INPUT_POST, 'changed', FILTER_SANITIZE_STRING);
 // Permissions
 $user_permission = PMF_Filter::filterInput(INPUT_POST, 'userpermission', FILTER_SANITIZE_STRING);
 $restricted_users = 'all' == $user_permission ? -1 : PMF_Filter::filterInput(INPUT_POST, 'restricted_users', FILTER_VALIDATE_INT);
 $group_permission = PMF_Filter::filterInput(INPUT_POST, 'grouppermission', FILTER_SANITIZE_STRING);
 $restricted_groups = 'all' == $group_permission ? -1 : PMF_Filter::filterInput(INPUT_POST, 'restricted_groups', FILTER_VALIDATE_INT);
 if (isset($submit['submit'][1]) && !is_null($question) && !is_null($categories['rubrik'])) {
     // new entry
     $logging = new PMF_Logging();
     $logging->logAdmin($user, 'Beitragcreatesave');
     printf("<h2>%s</h2>\n", $PMF_LANG['ad_entry_aor']);
     $recordData = array('id' => null, 'lang' => $record_lang, 'active' => $active, 'sticky' => !is_null($sticky) ? 1 : 0, 'thema' => html_entity_decode($question), 'content' => html_entity_decode($content), 'keywords' => $keywords, 'author' => $author, 'email' => $email, 'comment' => !is_null($comment) ? 'y' : 'n', 'date' => date('YmdHis'), 'dateStart' => empty($dateStart) ? '00000000000000' : str_replace('-', '', $dateStart) . '000000', 'dateEnd' => empty($dateEnd) ? '99991231235959' : str_replace('-', '', $dateEnd) . '235959', 'linkState' => '', 'linkDateCheck' => 0);
     // Add new record and get that ID
     $faqRecord = new PMF_Faq_Record();
     $faqChangelog = new PMF_Faq_Changelog();
     if ($faqRecord->create($recordData)) {
         $recordId = $faqRecord->getRecordId();
         // Create ChangeLog entry
         $changelogData = array('record_id' => $recordId, 'record_lang' => $recordData['lang'], 'revision_id' => 0, 'user_id' => $user->getUserId(), 'date' => $_SERVER['REQUEST_TIME'], 'changelog' => nl2br($changed));
         $faqChangelog->create($changelogData);
         // Create the visit entry
         $visits = PMF_Visits::getInstance();
         $visits->add($recordId, $recordData['lang']);
         // Insert the new category relations
         $categoryRelations = new PMF_Category_Relations();
         // Insert the tags
         if ($tags != '') {
             $tagging = new PMF_Tags();
             $tagging->saveTags($recordId, explode(',', $tags));
コード例 #4
0
ファイル: record.save.php プロジェクト: nosch/phpMyFAQ
     print "<h2>" . $PMF_LANG["ad_entry_aor"] . "</h2>\n";
     $logging = new PMF_Logging();
     $logging->logAdmin($user, 'Saved record ' . $record_id);
     if ('yes' == $revision) {
         // Add current version into revision table
         $revision = new PMF_Faq_Revision();
         $revision->creat(array('id' => $record_id, 'lang' => $record_lang));
         $revision_id++;
     }
     $recordData = array('id' => $record_id, 'lang' => $record_lang, 'revision_id' => $revision_id, 'active' => $active, 'sticky' => !is_null($sticky) ? 1 : 0, 'thema' => html_entity_decode($question), 'content' => html_entity_decode($content), 'keywords' => $keywords, 'author' => $author, 'email' => $email, 'comment' => !is_null($comment) ? 'y' : 'n', 'date' => empty($date) ? date('YmdHis') : str_replace(array('-', ':', ' '), '', $date), 'dateStart' => empty($dateStart) ? '00000000000000' : str_replace('-', '', $dateStart) . '000000', 'dateEnd' => empty($dateEnd) ? '99991231235959' : str_replace('-', '', $dateEnd) . '235959', 'linkState' => '', 'linkDateCheck' => 0);
     // Create ChangeLog entry
     $faqChangelog = new PMF_Faq_Changelog();
     $changelogData = array('record_id' => $record_id, 'record_lang' => $record_lang, 'revision_id' => $revision_id, 'user_id' => $user->getUserId(), 'date' => $_SERVER['REQUEST_TIME'], 'changelog' => nl2br($changed));
     $faqChangelog->create($changelogData);
     // save or update the FAQ record
     $faqRecord = new PMF_Faq_Record();
     if ($faq->isAlreadyTranslated($record_id, $record_lang)) {
         $faqRecord->update($record_id, $recordData);
     } else {
         $faqRecord->create($recordData);
         $record_id = $faqRecord->getRecordId();
     }
     if ($record_id) {
         print $PMF_LANG['ad_entry_savedsuc'];
         link_ondemand_javascript($record_id, $record_lang);
         ?>
 <script type="text/javascript">
 <!--
 $(document).ready(function(){
     setTimeout(function() {
         window.location = "index.php?action=view";