Exemplo n.º 1
0
function DeleteTag()
{
    global $db_prefix, $ID_MEMBER, $txt;
    $id = (int) $_REQUEST['tagid'];
    //Check permission
    $a_manage = allowedTo('smftags_manage');
    $dbresult = db_query("\n\tSELECT \n\t\tID_MEMBER,ID_TOPIC,ID_TAG  \n\tFROM {$db_prefix}tags_log \n\tWHERE ID = {$id} LIMIT 1", __FILE__, __LINE__);
    $row = mysql_fetch_assoc($dbresult);
    mysql_free_result($dbresult);
    if ($row['ID_MEMBER'] != $ID_MEMBER && $a_manage == false) {
        fatal_error($txt['smftags_err_deletetag'], false);
    }
    // Delete the tag for the topic
    db_query("DELETE FROM {$db_prefix}tags_log WHERE ID = {$id} LIMIT 1", __FILE__, __LINE__);
    // Tag Cleanup
    TagCleanUp($row['ID_TAG']);
    // Redirect back to the topic
    redirectexit('topic=' . $row['ID_TOPIC']);
}
Exemplo n.º 2
0
function DeleteTag()
{
    global $txt, $smcFunc, $user_info;
    isAllowedTo('smftags_del');
    $id = (int) $_REQUEST['tagid'];
    // Check permission
    $a_manage = allowedTo('smftags_manage');
    $dbresult = $smcFunc['db_query']('', "\n\tSELECT\n\t\tID_MEMBER, ID_TOPIC, ID_TAG\n\tFROM {db_prefix}tags_log \n\tWHERE ID = {$id} LIMIT 1");
    $row = $smcFunc['db_fetch_assoc']($dbresult);
    $smcFunc['db_free_result']($dbresult);
    if ($row['ID_MEMBER'] != $user_info['id'] && $a_manage == false) {
        fatal_error($txt['smftags_err_deletetag'], false);
    }
    // Delete the tag for the topic
    $smcFunc['db_query']('', "DELETE FROM {db_prefix}tags_log WHERE ID = {$id} LIMIT 1");
    // Tag Cleanup
    TagCleanUp($row['ID_TAG']);
    // Redirect back to the topic
    redirectexit('topic=' . $row['ID_TOPIC']);
}
Exemplo n.º 3
0
function TaggingSystem_Delete()
{
    global $txt, $user_info;
    $isajax = $_REQUEST['action'] == 'xmlhttp' ? true : false;
    if (!$isajax) {
        isAllowedTo('smftags_del');
    } else {
        if (!allowedTo('smftags_del')) {
            TagErrorMsg($txt['cannot_smftags_del'], $isajax);
        }
    }
    $id = (int) $_REQUEST['tagid'];
    $dbresult = smf_db_query('
	SELECT id_member, id_topic, id_tag
		FROM {db_prefix}tags_log WHERE id = {int:id} LIMIT 1', array('id' => $id));
    $row = mysql_fetch_assoc($dbresult);
    mysql_free_result($dbresult);
    $topic = $row['id_topic'];
    if ($row['id_member'] != $user_info['id'] && !allowedTo('smftags_manage')) {
        TagErrorMsg($txt['smftags_err_deletetag'], $isajax);
    }
    smf_db_query('DELETE FROM {db_prefix}tags_log WHERE id = {int:id} LIMIT 1', array('id' => $id));
    TagCleanUp($row['id_tag']);
    if ($isajax) {
        $output = RegenerateTagList($topic);
        // todo: do this with a template maybe?
        echo $output;
        obExit(false);
    }
    redirectexit('topic=' . $row['id_topic']);
}