Beispiel #1
0
function kb_makeAttachment($data)
{
    global $smcFunc, $uploadsDirectory, $txt, $sourcedir, $modSettings;
    $uploadsDirectory = $modSettings['kb_path_attachment'];
    // Check if they are trying to delete any current attachments....
    if (isset($_POST['kb_attach_del']) && !empty($data['article_edit']) && !empty($modSettings['kb_enable_attachment'])) {
        $del_temp = array();
        foreach ($_POST['kb_attach_del'] as $i => $dummy) {
            $del_temp[$i] = (int) $dummy;
        }
        $dbresult = $smcFunc['db_query']('', '
		    SELECT thumbnail, filesize, filename, id_file  
			FROM {db_prefix}kb_attachments 
			WHERE id_file NOT IN ({array_int:parent_attachments}) AND id_article = ' . $data['article_id'] . '', array('parent_attachments' => $del_temp));
        while ($row = $smcFunc['db_fetch_assoc']($dbresult)) {
            @unlink($uploadsDirectory . '' . $row['filename']);
            @unlink($uploadsDirectory . '' . $row['thumbnail']);
            $query_params = array('table' => 'kb_attachments', 'where' => 'id_file NOT IN ({array_int:parent_attachments}) AND id_article = ' . $data['article_id'] . '');
            $query_data = array('parent_attachments' => $del_temp);
            KB_DeleteData($query_params, $query_data);
        }
        $smcFunc['db_free_result']($dbresult);
    }
    if (!empty($modSettings['kb_enable_attachment']) && !empty($_FILES['attachment']['name'])) {
        $fieldname = 'attachment';
        // check if any files were uploaded and if
        // so store the active $_FILES array keys
        $active_keys = array();
        foreach ($_FILES[$fieldname]['name'] as $key => $filename) {
            if (!empty($filename)) {
                $active_keys[] = $key;
            }
        }
        // make a unique filename for the uploaded file and check it is
        // not taken... if it is keep trying until we find a vacant one
        foreach ($active_keys as $key) {
            $now = time();
            while (file_exists($uploadFilename[$key] = $uploadsDirectory . $now . '-' . $_FILES[$fieldname]['name'][$key])) {
                $now++;
            }
        }
        // now let's move the file to its final and allocate it with the new filename
        foreach ($active_keys as $key) {
            $filesize = $_FILES[$fieldname]['size'][$key];
            @move_uploaded_file($_FILES[$fieldname]['tmp_name'][$key], $uploadFilename[$key]);
            @chmod($uploadsDirectory . $uploadFilename[$key], 0644);
            $filename = $_FILES[$fieldname]['name'][$key];
            $nname = $now . '-' . $filename;
            $smcFunc['db_insert']('', '{db_prefix}kb_attachments', array('id_article' => 'int', 'filename' => 'string', 'date' => 'string', 'filesize' => 'string', 'thumbnail' => 'string'), array($data['article_id'], $nname, time(), $filesize, ''), array());
        }
    }
}
Beispiel #2
0
function KB_knowcont()
{
    global $smcFunc, $txt, $scripturl, $sourcedir, $boardurl, $modSettings, $user_info, $context;
    $context['sub_template'] = 'kb_knowcont';
    if (isset($_REQUEST['cont'])) {
        if (($listData = cache_get_data('kb_articles_listinfo' . $_GET['cont'] . '', 3600)) === null) {
            $params = array('table' => 'kb_articles AS a', 'call' => 'a.title,a.kbnid,a.id_cat,c.name', 'left_join' => '{db_prefix}kb_category AS c ON (a.id_cat = c.kbid)', 'where' => 'a.kbnid = {int:kbnid}');
            $data = array('kbnid' => (int) $_GET['cont']);
            $listData = KB_ListData($params, $data);
            cache_put_data('kb_articles_listinfo' . $_GET['cont'] . '', $listData, 3600);
        }
        $artname = $listData['title'];
        $aid = $listData['kbnid'];
        $cid = $listData['id_cat'];
        $cname = $listData['name'];
        if (!$aid) {
            fatal_error('' . $txt['kb_pinfi7'] . ' <strong>' . $_GET['cont'] . '</strong> ' . $txt['kb_jumpgo1'] . '', false);
        }
        $context['linktree'][] = array('url' => $scripturl . '?action=kb;area=cats;cat=' . $cid . '', 'name' => $cname);
        $context['linktree'][] = array('url' => $scripturl . '?action=kb;area=article;cont=' . $_GET['cont'] . '', 'name' => $artname);
        if (($context['know'] = cache_get_data('kb_articles' . $_GET['cont'] . '', 3600)) === null) {
            $result = $smcFunc['db_query']('', '
	            SELECT k.kbnid,k.content, k.source, k.title,k.id_cat,k.date,k.id_member,m.real_name, k.views, k.rate, k.approved
	            FROM {db_prefix}kb_articles AS k
		        LEFT JOIN {db_prefix}members AS m ON (k.id_member = m.id_member)
		        LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = m.id_member)
	            WHERE kbnid = {int:kbnid}', array('kbnid' => (int) $_GET['cont']));
            $context['know'] = array();
            while ($row = $smcFunc['db_fetch_assoc']($result)) {
                $context['know'][] = array('content' => KB_parseTags($row['content'], $row['kbnid'], 3), 'title' => parse_bbc($row['title']), 'source' => parse_bbc($row['source']), 'kbnid' => $row['kbnid'], 'approved' => $row['approved'], 'views' => $row['views'], 'rate' => $row['rate'], 'date' => date('D d M Y', $row['date']), 'id_cat' => $row['id_cat'], 'id_member' => $row['id_member'], 'real_name' => $row['real_name']);
            }
            $smcFunc['db_free_result']($result);
            cache_put_data('kb_articles' . $_GET['cont'] . '', $context['know'], 3600);
        }
        $context['page_title'] = $context['know'][0]['title'];
        if ($context['know'][0]['approved'] == 0 && $context['know'][0]['id_member'] != $user_info['id'] && !allowedTo('manage_kb')) {
            fatal_lang_error('kb_articlwnot_approved', false);
        }
        KBisAllowedto($context['know'][0]['id_cat'], 'view');
        $context['kbimg'] = KB_getimages($_GET['cont']);
        if (!empty($modSettings['kb_ecom'])) {
            $context['kbcom'] = KB_getcomments($_GET['cont']);
            KB_showediter(!empty($_POST['description']) ? $_POST['description'] : '', 'description');
        }
        KB_dojprint();
        $query_params = array('table' => 'kb_articles', 'set' => 'views = views + 1', 'where' => 'kbnid = {int:kbnid}');
        $query_data = array('kbnid' => (int) $_GET['cont']);
        kb_UpdateData($query_params, $query_data);
    }
    if ($user_info['is_guest']) {
        require_once $sourcedir . '/Subs-Editor.php';
        $verificationOptions = array('id' => 'register');
        $context['visual_verification'] = create_control_verification($verificationOptions);
        $context['visual_verification_id'] = $verificationOptions['id'];
    }
    //comment
    if (isset($_REQUEST['comment'])) {
        if ($user_info['is_guest']) {
            require_once $sourcedir . '/Subs-Editor.php';
            $verificationOptions = array('id' => 'register');
            $context['visual_verification'] = create_control_verification($verificationOptions, true);
            if (is_array($context['visual_verification'])) {
                loadLanguage('Errors');
                foreach ($context['visual_verification'] as $error) {
                    fatal_error($txt['error_' . $error]);
                }
            }
        }
        isAllowedTo('com_kb');
        checkSession();
        $_POST['description'] = $smcFunc['htmlspecialchars']($_POST['description'], ENT_QUOTES);
        $_GET['arid'] = (int) $_GET['arid'];
        if (empty($_POST['description'])) {
            fatal_lang_error('knowledgebase_emtydesc', false);
        }
        $approved = allowedTo('auto_approvecom_kb') ? 1 : 0;
        $mes = '' . $txt['kb_log_text4'] . ' <strong><a href="' . $scripturl . '?action=kb;area=article;cont=' . $_GET['arid'] . '">' . $context['know'][0]['title'] . '</a></strong>';
        KB_log_actions('add_com', $_GET['arid'], $mes);
        $data = array('table' => 'kb_comments', 'cols' => array('id_article' => 'int', 'comment' => 'string', 'date' => 'int', 'id_member' => 'int', 'approved' => 'int'));
        $values = array($_GET['arid'], $_POST['description'], time(), $user_info['id'], $approved);
        $indexes = array('id_article');
        KB_InsertData($data, $values, $indexes);
        KBrecountcomments();
        KB_cleanCache();
        redirectexit('action=kb;area=article;cont=' . $_GET['arid'] . '');
    }
    if (isset($_REQUEST['commentdel'])) {
        isAllowedTo('comdel_kb');
        $mes = '' . $txt['kb_log_text3'] . ' <strong><a href="' . $scripturl . '?action=kb;area=article;cont=' . $_GET['cont'] . '">' . $context['know'][0]['title'] . '</a></strong>';
        KB_log_actions('del_com', $_GET['cont'], $mes);
        $query_params = array('table' => 'kb_comments', 'where' => 'id = {int:kbid}');
        $query_data = array('kbid' => (int) $_GET['arid']);
        KB_DeleteData($query_params, $query_data);
        KB_cleanCache();
        KBrecountcomments();
        redirectexit('action=kb;area=article;cont=' . $_GET['cont'] . '');
    }
    //approve
    if (isset($_REQUEST['approve'])) {
        checkSession('get');
        $query_params = array('table' => 'kb_articles', 'set' => 'approved = {int:one}', 'where' => 'kbnid = {int:kbnid}');
        $query_data = array('kbnid' => (int) $_REQUEST['aid'], 'one' => 1);
        kb_UpdateData($query_params, $query_data);
        $params = array('table' => 'kb_articles', 'call' => 'id_member, kbnid, title', 'where' => 'kbnid = {int:kbnid}');
        $data = array('kbnid' => (int) $_GET['aid']);
        $listData = KB_ListData($params, $data);
        $nameid = $listData['id_member'];
        $kid = $listData['kbnid'];
        $title = $listData['title'];
        $kbmes = '' . $txt['kb_aapprove1'] . ' [url=' . $scripturl . '?action=kb;area=article;cont=' . $kid . ']' . $txt['kb_aapprove2'] . '[/url] ' . $txt['kb_aapprove3'] . '';
        KB_sendpm($nameid, $txt['kb_aapprove6'], $kbmes);
        $mes = '' . $txt['kb_log_text2'] . ' <strong><a href="' . $scripturl . '?action=kb;area=article;cont=' . $kid . '">' . $title . '</a></strong>';
        KB_log_actions('app_article', $kid, $mes);
        KBrecountItems();
        KB_cleanCache();
        redirectexit('action=kb;area=article;cont=' . $_REQUEST['aid'] . '');
    }
    //unapprove
    if (isset($_REQUEST['unapprove']) && isset($_REQUEST['inap'])) {
        checkSession('get');
        $query_params = array('table' => 'kb_articles', 'set' => 'approved = {int:one}', 'where' => 'kbnid = {int:kbnid}');
        $query_data = array('kbnid' => (int) $_REQUEST['inap'], 'one' => 0);
        kb_UpdateData($query_params, $query_data);
        $params = array('table' => 'kb_articles', 'call' => 'id_member, kbnid, title', 'where' => 'kbnid = {int:kbnid}');
        $data = array('kbnid' => (int) $_GET['inap']);
        $listData = KB_ListData($params, $data);
        $nameid = $listData['id_member'];
        $kid = $listData['kbnid'];
        $title = $listData['title'];
        $kbmes = '' . $txt['kb_aapprove4'] . ' [url=' . $scripturl . '?action=kb;area=article;cont=' . $kid . ']' . $txt['kb_aapprove2'] . '[/url] ' . $txt['kb_aapprove3'] . '';
        KB_sendpm($nameid, $txt['kb_aapprove7'], $kbmes);
        $mes = '' . $txt['kb_log_text1'] . ' <strong><a href="' . $scripturl . '?action=kb;area=article;cont=' . $kid . '">' . $title . '</a></strong>';
        KB_log_actions('unapp_article', $kid, $mes);
        KBrecountItems();
        KB_cleanCache();
        redirectexit('action=kb;area=article;cont=' . $_REQUEST['inap'] . '');
    }
}
Beispiel #3
0
function KB_mreports()
{
    global $scripturl, $sourcedir, $txt, $smcFunc, $context;
    isAllowedTo('manage_kb');
    $list_options = array('id' => 'kb_know_reports', 'title' => $txt['kb_rlist1'], 'items_per_page' => 30, 'base_href' => $scripturl . '?action=kb;area=manage', 'default_sort_col' => 'id', 'start_var_name' => 'startreport', 'request_vars' => array('desc' => 'descreport', 'sort' => 'sortreport'), 'get_items' => array('function' => create_function('$start, $items_per_page, $sort', '
				global $context, $smcFunc;
			   
		    $request = $smcFunc[\'db_query\'](\'\', \'
			    SELECT k.id, k.id_article, k.id_member, k.comment, m.id_member, m.real_name, k.date
                FROM {db_prefix}kb_reports AS k
				LEFT JOIN {db_prefix}members AS m ON  (m.id_member = k.id_member)
                ORDER BY {raw:sort}
                LIMIT {int:start}, {int:per_page}\',
            array(
			   
			   \'sort\' => $sort,
			   \'start\' => $start,
			   \'per_page\' => $items_per_page,
            )
		 );
		$kbcn = array();
			while ($row = $smcFunc[\'db_fetch_assoc\']($request))
				
				   $kbcn[] = $row;
				   
			$smcFunc[\'db_free_result\']($request);

		return $kbcn;
			')), 'get_count' => array('function' => create_function('', '
				global $smcFunc;

				$request = $smcFunc[\'db_query\'](\'\', \'
					SELECT COUNT(*)
					FROM {db_prefix}kb_reports\',
			        array());
				
				list ($total_kbn) = $smcFunc[\'db_fetch_row\']($request);
				$smcFunc[\'db_free_result\']($request);

				return $total_kbn;
			')), 'no_items_label' => $txt['knowledgebasenone'], 'columns' => array('id' => array('header' => array('value' => $txt['kb_rlistcomment']), 'data' => array('function' => create_function('$row', '
					global $scripturl;
						return \'\'.$row[\'comment\'].\'\';
					'), 'style' => 'width: 20%; text-align: left;'), 'sort' => array('default' => 'id', 'reverse' => 'id DESC')), 'real_name' => array('header' => array('value' => $txt['kb_rlistnor1']), 'data' => array('function' => create_function('$row', '
                        global $scripturl;
						return \'<a href="\'.$scripturl.\'?action=profile;u=\'.$row[\'id_member\'].\'">\'.$row[\'real_name\'].\'</a>\';
					'), 'style' => 'width: 4%; text-align: center;'), 'sort' => array('default' => 'real_name', 'reverse' => 'real_name DESC')), 'date' => array('header' => array('value' => $txt['knowledgebasecreated']), 'data' => array('function' => create_function('$row', '

						return timeformat($row[\'date\']);
					'), 'style' => 'width: 5%; text-align: center;'), 'sort' => array('default' => 'date', 'reverse' => 'date DESC')), 'id_article' => array('header' => array('value' => '<input type="checkbox" name="all" class="input_check" onclick="invertAll(this, this.form);" />'), 'data' => array('function' => create_function('$row', '
                         global $sc, $txt, $scripturl;
						return \'[<a href="\'.$scripturl.\'?action=kb;area=article;cont=\'.$row[\'id_article\'].\'">\'.$txt[\'kb_rlistnor44\'].\'</a>] 
						<input type="checkbox" class="input_check" name="delete[]" value="\' . $row[\'id\'] . \'" />\';
					'), 'style' => 'width: 2%; text-align: center;'), 'sort' => array('default' => 'id_article', 'reverse' => 'id_article DESC'))), 'form' => array('href' => $scripturl . '?action=kb;area=manage', 'include_sort' => true, 'include_start' => true, 'hidden_fields' => array($context['session_var'] => $context['session_id'])), 'additional_rows' => array(array('position' => 'below_table_data', 'value' => '
						<input type="submit" name="remove" value="' . $txt['kb_remove_log2'] . '" class="button_submit" onclick="return confirmSubmit();" />
						<input type="submit" name="removeall" value="' . $txt['kb_remove_log1'] . '" class="button_submit" onclick="return confirmSubmit();" />')));
    require_once $sourcedir . '/Subs-List.php';
    createList($list_options);
    if (isset($_POST['removeall'])) {
        checkSession();
        $query_params = array('table' => 'kb_reports', 'where' => '');
        $query_data = array();
        KB_DeleteData($query_params, $query_data);
        $mes = $txt['kb_del_areports'];
        KB_log_actions('del_report', 0, $mes);
        KB_cleanCache();
        redirectexit('action=kb;area=manage');
    } elseif (!empty($_POST['remove']) && isset($_POST['delete'])) {
        checkSession();
        $query_params = array('table' => 'kb_reports', 'where' => 'id IN ({array_string:delete_actions})');
        $query_data = array('delete_actions' => array_unique($_POST['delete']));
        KB_DeleteData($query_params, $query_data);
        $mes = $txt['kb_del_reports'];
        KB_log_actions('del_report', 0, $mes);
        KB_cleanCache();
        redirectexit('action=kb;area=manage');
    }
}
Beispiel #4
0
function KB_approve()
{
    global $scripturl, $sourcedir, $txt, $smcFunc, $context;
    $list_options = array('id' => 'kb_know', 'title' => $txt['kb_alist'], 'items_per_page' => 30, 'base_href' => $scripturl . '?action=kb;area=manage', 'default_sort_col' => 'title', 'start_var_name' => 'startarticle', 'request_vars' => array('desc' => 'descarticle', 'sort' => 'sortarticle'), 'get_items' => array('function' => create_function('$start, $items_per_page, $sort', '
				global $user_info, $context, $smcFunc;

        	if ($context[\'user\'][\'is_guest\'])
		       $groupid = -1;
	         else
	           $groupid =  $user_info[\'groups\'][0];
			   
		    $request = $smcFunc[\'db_query\'](\'\', \'
			    SELECT k.kbnid, k.title, k.views, k.date, p.view, k.id_cat, k.id_member, m.real_name
                FROM {db_prefix}kb_articles AS k
			    LEFT JOIN {db_prefix}members AS m  ON (k.id_member = m.id_member) 
			    LEFT JOIN {db_prefix}kb_category AS c ON (k.id_cat = c.kbid)
			    LEFT JOIN {db_prefix}kb_catperm AS p ON (p.id_group = {int:groupid} AND k.id_cat = p.id_cat)
			    WHERE approved = 0
                ORDER BY {raw:sort}
                LIMIT {int:start}, {int:per_page}\',
            array(
			   \'groupid\' => $groupid,
			   \'sort\' => $sort,
			   \'start\' => $start,
			   \'per_page\' => $items_per_page,
            )
		 );
		$kbcn = array();
			while ($row = $smcFunc[\'db_fetch_assoc\']($request))
				
				if($row[\'view\'] != \'0\')
				   $kbcn[] = $row;
				   
			$smcFunc[\'db_free_result\']($request);

		return $kbcn;
			')), 'get_count' => array('function' => create_function('', '
				global $smcFunc;

				$request = $smcFunc[\'db_query\'](\'\', \'
					SELECT COUNT(*)
					FROM {db_prefix}kb_articles
					WHERE approved = 0 \',
			        array());
				
				list ($total_kbn) = $smcFunc[\'db_fetch_row\']($request);
				$smcFunc[\'db_free_result\']($request);

				return $total_kbn;
			')), 'no_items_label' => $txt['knowledgebasenone'], 'columns' => array('title' => array('header' => array('value' => $txt['knowledgebasetitle']), 'data' => array('function' => create_function('$row', '
					global $scripturl;
						return \'<a href="\'.$scripturl.\'?action=kb;area=article;cont=\'.$row[\'kbnid\'].\'">\'.$row[\'title\'].\'</a>\';
					'), 'style' => 'width: 20%; text-align: left;'), 'sort' => array('default' => 'title', 'reverse' => 'title DESC')), 'author' => array('header' => array('value' => $txt['knowledgebaseauthor']), 'data' => array('function' => create_function('$row', '
                        global $scripturl;
						return \'<a href="\'.$scripturl.\'?action=profile;u=\'.$row[\'id_member\'].\'">\'.$row[\'real_name\'].\'</a>\';
					'), 'style' => 'width: 4%; text-align: center;'), 'sort' => array('default' => 'real_name', 'reverse' => 'real_name DESC')), 'date' => array('header' => array('value' => $txt['knowledgebasecreated']), 'data' => array('function' => create_function('$row', '

						return timeformat($row[\'date\']);
					'), 'style' => 'width: 5%; text-align: center;')), 'views' => array('header' => array('value' => '<input type="checkbox" name="all" class="input_check" onclick="invertAll(this, this.form);" />'), 'data' => array('function' => create_function('$row', '
                         global $sc,$scripturl;
						return \'<input type="checkbox" class="input_check" name="approve1[]" value="\' . $row[\'kbnid\'] . \'" />\';
					'), 'style' => 'width: 2%; text-align: center;'))), 'form' => array('href' => $scripturl . '?action=kb;area=manage', 'include_sort' => true, 'include_start' => true, 'hidden_fields' => array($context['session_var'] => $context['session_id'])), 'additional_rows' => array(array('position' => 'below_table_data', 'value' => '
						<input type="submit" name="approve_article" value="' . $txt['kb_app_aart'] . '" class="button_submit" onclick="return confirmSubmit();" />
						<input type="submit" name="approve_article_all" value="' . $txt['kb_app_art'] . '" class="button_submit" onclick="return confirmSubmit();" />
						<input type="submit" name="remove" value="' . $txt['kb_remove_log2'] . '" class="button_submit" onclick="return confirmSubmit();" />
						<input type="submit" name="removeall3" value="' . $txt['kb_remove_log1'] . '" class="button_submit" onclick="return confirmSubmit();" />')));
    require_once $sourcedir . '/Subs-List.php';
    createList($list_options);
    if (isset($_POST['removeall3'])) {
        checkSession();
        $query_params = array('table' => 'kb_articles', 'where' => 'approved = {int:one}');
        $query_data = array('one' => 0);
        KB_DeleteData($query_params, $query_data);
        KB_cleanCache();
        redirectexit('action=kb;area=manage');
    }
    if (!empty($_POST['remove']) && isset($_POST['approve1'])) {
        checkSession();
        $query_params = array('table' => 'kb_articles', 'where' => 'kbnid IN ({array_string:delete_actions}) AND approved = {int:one}');
        $query_data = array('delete_actions' => array_unique($_POST['approve1']), 'one' => 0);
        KB_DeleteData($query_params, $query_data);
        KB_cleanCache();
        redirectexit('action=kb;area=manage');
    }
    if (isset($_POST['approve_article_all'])) {
        checkSession();
        $result = $smcFunc['db_query']('', '
		    SELECT id_member,title,kbnid
		    FROM {db_prefix}kb_articles
		    WHERE approved = {int:approved}', array('approved' => 0));
        $context['kbinfo'] = array();
        while ($row = $smcFunc['db_fetch_assoc']($result)) {
            $context['kbinfo'][] = $row;
        }
        $smcFunc['db_free_result']($result);
        foreach ($context['kbinfo'] as $kb) {
            $kbmes = '' . $txt['kb_aapprove1'] . ' [url=' . $scripturl . '?action=kb;area=article;cont=' . $kb['kbnid'] . ']' . $txt['kb_aapprove2'] . '[/url] ' . $txt['kb_aapprove3'] . '';
            KB_sendpm($kb['id_member'], $txt['kb_aapprove6'], $kbmes);
            $mes = '' . $txt['kb_log_text2'] . ' <strong><a href="' . $scripturl . '?action=kb;area=article;cont=' . $kb['kbnid'] . '">' . $kb['title'] . '</a></strong>';
            KB_log_actions('app_article', 0, $mes);
        }
        $query_params = array('table' => 'kb_articles', 'set' => 'approved = {int:one}', 'where' => '');
        $query_data = array('one' => 1);
        kb_UpdateData($query_params, $query_data);
        KBrecountItems();
        KB_cleanCache();
        redirectexit('action=kb;area=manage');
    } elseif (!empty($_POST['approve_article']) && isset($_POST['approve1'])) {
        checkSession();
        $query_params = array('table' => 'kb_articles', 'set' => 'approved = {int:one}', 'where' => 'kbnid IN ({array_string:delete_actions})');
        $query_data = array('one' => 1, 'delete_actions' => array_unique($_POST['approve1']));
        kb_UpdateData($query_params, $query_data);
        $result = $smcFunc['db_query']('', '
		    SELECT id_member,title,kbnid
		    FROM {db_prefix}kb_articles
		    WHERE kbnid IN ({array_string:delete_actions})', array('delete_actions' => array_unique($_POST['approve1'])));
        $context['kbinfo'] = array();
        while ($row = $smcFunc['db_fetch_assoc']($result)) {
            $context['kbinfo'][] = $row;
        }
        $smcFunc['db_free_result']($result);
        foreach ($context['kbinfo'] as $kb) {
            $kbmes = '' . $txt['kb_aapprove1'] . ' [url=' . $scripturl . '?action=kb;area=article;cont=' . $kb['kbnid'] . ']' . $txt['kb_aapprove2'] . '[/url] ' . $txt['kb_aapprove3'] . '';
            KB_sendpm($kb['id_member'], $txt['kb_aapprove6'], $kbmes);
            $mes = '' . $txt['kb_log_text2'] . ' <strong><a href="' . $scripturl . '?action=kb;area=article;cont=' . $kb['kbnid'] . '">' . $kb['title'] . '</a></strong>';
            KB_log_actions('app_article', 0, $mes);
        }
        KBrecountItems();
        KB_cleanCache();
        redirectexit('action=kb;area=manage');
    }
}