$HEADERS->err403(true); } // Access.. if (!in_array($cmd, $userAccess) && $MSTEAM->id != '1') { $HEADERS->err403(true); } // Download attachment.. if (isset($_GET['fattachment'])) { include REL_PATH . 'control/classes/class.download.php'; $D = new msDownload(); $D->faqAttachment((int) $_GET['fattachment'], $SETTINGS, true); exit; } // Class.. include_once PATH . 'control/classes/class.faq.php'; $FAQ = new faqCentre(); $FAQ->settings = $SETTINGS; // Enable/disable (Ajax).. if (isset($_GET['changeState'])) { $FAQ->enableDisableAtt(); echo $JSON->encode(array('ok')); exit; } // Delete.. if (isset($_POST['delete']) && USER_DEL_PRIV == 'yes') { $FAQ->deleteAttachments(); $OK1 = true; } // Order.. if (isset($_POST['update-order'])) { $FAQ->orderAttSequence();
public function batchImportQuestions($lines, $del, $enc) { $count = 0; // Clear current questions.. if (isset($_POST['clear'])) { $que = array(); $chop = empty($_POST['cat']) ? $_POST['catall'] : $_POST['cat']; if (!empty($chop)) { $q = mysql_query("SELECT `question` FROM `" . DB_PREFIX . "faqassign`\n\t WHERE `itemID` IN(" . implode(',', $chop) . ")\n\t\t\t AND `desc` = 'category'\n\t\t\t GROUP BY `question`\n\t\t\t ORDER BY `itemID`\n\t\t\t "); while ($QUE = mysql_fetch_object($q)) { $que[] = $QUE->question; } if (!empty($que)) { mysql_query("DELETE FROM `" . DB_PREFIX . "faq` WHERE `id` IN(" . implode(',', $que) . ")") or die(mswMysqlErrMsg(mysql_errno(), mysql_error(), __LINE__, __FILE__)); if (mswRowCount('faq') == 0) { @mysql_query("TRUNCATE TABLE `" . DB_PREFIX . "faq`"); @mysql_query("TRUNCATE TABLE `" . DB_PREFIX . "faqassign`"); } } } } // Upload CSV file.. if (is_uploaded_file($_FILES['file']['tmp_name'])) { // If uploaded file exists, read CSV data... $handle = fopen($_FILES['file']['tmp_name'], 'r'); if ($handle) { while (($CSV = fgetcsv($handle, $lines, $del, $enc)) !== false) { // Clean array.. $CSV = array_map('trim', $CSV); mysql_query("INSERT INTO `" . DB_PREFIX . "faq` (\n `ts`,\n `question`,\n `answer`\n ) VALUES (\n UNIX_TIMESTAMP(UTC_TIMESTAMP),\n '" . mswSafeImportString($CSV[0]) . "',\n '" . mswSafeImportString($CSV[1]) . "'\n )") or die(mswMysqlErrMsg(mysql_errno(), mysql_error(), __LINE__, __FILE__)); $ID = mysql_insert_id(); // Assign categories.. $assign = empty($_POST['cat']) ? $_POST['catall'] : $_POST['cat']; if (!empty($assign) && $ID > 0) { foreach ($assign as $aID) { mysql_query("INSERT INTO `" . DB_PREFIX . "faqassign` (\n `question`,`itemID`,`desc`\n ) VALUES (\n '{$ID}','{$aID}','category'\n )") or die(mswMysqlErrMsg(mysql_errno(), mysql_error(), __LINE__, __FILE__)); } } ++$count; } fclose($handle); } } // Clear temp file.. if (file_exists($_FILES['file']['tmp_name'])) { @unlink($_FILES['file']['tmp_name']); } // Rebuild sequence.. faqCentre::rebuildQueSequence(); return $count; }
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ This File: faq-import.php Description: System File ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ if (!defined('PARENT')) { $HEADERS->err403(true); } // Access.. if (!in_array($cmd, $userAccess) && $MSTEAM->id != '1') { $HEADERS->err403(true); } // Class.. include_once PATH . 'control/classes/class.faq.php'; $FAQ = new faqCentre(); $FAQ->settings = $SETTINGS; // Import.. if (isset($_POST['process'])) { // Set defaults.. $lines = $_POST['lines'] ? str_replace(array('.', ','), array(), $_POST['lines']) : '0'; $del = $_POST['delimiter'] ? $_POST['delimiter'] : ','; $enc = $_POST['enclosed'] ? $_POST['enclosed'] : '"'; // Import.. $total = $FAQ->batchImportQuestions($lines, $del, $enc); $OK1 = true; } $title = $msg_adheader55; include PATH . 'templates/header.php'; include PATH . 'templates/system/faq/faq-import.php'; include PATH . 'templates/footer.php';
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ This File: faq.php Description: System File ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ if (!defined('PARENT')) { $HEADERS->err403(true); } // Access.. if (!in_array($cmd, $userAccess) && $MSTEAM->id != '1') { $HEADERS->err403(true); } // Class.. include_once PATH . 'control/classes/class.faq.php'; $FAQ = new faqCentre(); $FAQ->settings = $SETTINGS; // Preview message.. if (isset($_GET['previewMsg'])) { echo $MSPARSER->mswTxtParsingEngine(mswCleanData($_POST['msg'])); exit; } // Add.. if (isset($_POST['process'])) { if (trim($_POST['question']) && trim($_POST['answer'])) { $return = $FAQ->addQuestion(); $OK1 = true; } } // Update if (isset($_POST['update'])) {
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ This File: faq-cat.php Description: System File ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ if (!defined('PARENT')) { $HEADERS->err403(true); } // Access.. if (!in_array($cmd, $userAccess) && $MSTEAM->id != '1') { $HEADERS->err403(true); } // Class.. include_once PATH . 'control/classes/class.faq.php'; $FAQ = new faqCentre(); $FAQ->settings = $SETTINGS; // Add.. if (isset($_POST['process'])) { if (trim($_POST['name'])) { $FAQ->addCategory(); $OK1 = true; } } // Update.. if (isset($_POST['update'])) { if (trim($_POST['name'])) { $FAQ->updateCategory(); $OK2 = true; } }
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ This File: faqman.php Description: System File ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ if (!defined('PARENT')) { $HEADERS->err403(true); } // Access.. if (!in_array($cmd, $userAccess) && $MSTEAM->id != '1') { $HEADERS->err403(true); } // Class.. include_once PATH . 'control/classes/class.faq.php'; $FAQ = new faqCentre(); $FAQ->settings = $SETTINGS; // Enable/disable (Ajax).. if (isset($_GET['changeState'])) { $FAQ->enableDisableQuestions(); echo $JSON->encode(array('ok')); exit; } // View.. if (isset($_GET['view'])) { include PATH . 'templates/system/faq/faq-window.php'; exit; } // Reset.. if (isset($_POST['reset'])) { $FAQ->resetCounts();
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ This File: faq-catman.php Description: System File ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ if (!defined('PARENT')) { $HEADERS->err403(true); } // Access.. if (!in_array($cmd, $userAccess) && $MSTEAM->id != '1') { $HEADERS->err403(true); } // Class.. include_once PATH . 'control/classes/class.faq.php'; $FAQ = new faqCentre(); $FAQ->settings = $SETTINGS; // Enable/disable (Ajax).. if (isset($_GET['changeState'])) { $FAQ->enableDisableCats(); echo $JSON->encode(array('ok')); exit; } // Delete.. if (isset($_POST['delete']) && USER_DEL_PRIV == 'yes') { $count = $FAQ->deleteCategories(); $OK1 = true; } // Order.. if (isset($_POST['update-order'])) { $FAQ->orderCatSequence();
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ This File: attachments.php Description: System File ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ if (!defined('PARENT')) { $HEADERS->err403(true); } // Access.. if (!in_array($cmd, $userAccess) && $MSTEAM->id != '1') { $HEADERS->err403(true); } // Class.. include_once PATH . 'control/classes/class.faq.php'; $FAQ = new faqCentre(); $FAQ->settings = $SETTINGS; // Add if (isset($_POST['process'])) { $total = $FAQ->addAttachments(); $OK1 = true; } // Update.. if (isset($_POST['update'])) { $FAQ->updateAttachment(); $OK2 = true; } $title = isset($_GET['edit']) ? $msg_attachments12 : $msg_attachments2; $loadJQAlertify = true; include PATH . 'templates/header.php'; include PATH . 'templates/system/faq/faq-attachments.php';