コード例 #1
0
function ApproveDownload()
{
    global $smcFunc, $modSettings, $sourcedir, $txt, $context, $boardurl;
    //Right permissions?
    isAllowedTo('adk_downloads_manage');
    //get the session please
    checkSession('get');
    //Get the id
    if (!empty($_REQUEST['id']) && is_numeric($_REQUEST['id'])) {
        $id = (int) $_REQUEST['id'];
    } else {
        fatal_lang_error('adkfatal_require_id_file', false);
    }
    $approved = getApprovedByFile($id);
    //if it's approved... don't make anything else
    if ($approved == 1) {
        if (!empty($_REQUEST['return']) && $_REQUEST['return'] == 'admin') {
            redirectexit('action=admin;area=adkdownloads;sa=approvedownloads;' . $context['session_var'] . '=' . $context['session_id']);
        } else {
            redirectexit('action=downloads;sa=view;down=' . $id);
        }
    }
    //Update it
    $smcFunc['db_query']('', '
		UPDATE {db_prefix}adk_down_file
		SET approved = {int:a}
		WHERE id_file = {int:file}', array('a' => 1, 'file' => $id));
    //get id category
    $id_cat = getCatByFile($id);
    //And update category
    TotalCategoryUpdate($id_cat);
    $s = $smcFunc['db_query']('', '
		SELECT a.id_topic, c.id_board, c.locktopic, a.title, a.description, a.id_member, a.id_cat, c.id_cat, a.main_image
		FROM {db_prefix}adk_down_file AS a, {db_prefix}adk_down_cat AS c
		WHERE a.id_file = {int:file} AND a.id_cat = c.id_cat', array('a' => 1, 'file' => $id));
    $row = $smcFunc['db_fetch_assoc']($s);
    $smcFunc['db_free_result']($s);
    $id_board = $row['id_board'];
    $id_topic = $row['id_topic'];
    $locktopic = $row['locktopic'];
    $title = $row['title'];
    $id_cat = $row['id_cat'];
    $description = $row['description'];
    $id_member = $row['id_member'];
    $image = $row['main_image'];
    TotalCategoryUpdate($id_cat);
    require_once $sourcedir . '/Subs-Post.php';
    if (!empty($id_board) && empty($id_topic)) {
        setTopic(array('body' => $description, 'subject' => $title, 'id_file' => $id, 'image' => $image, 'id_board' => $id_board, 'locked' => $locktopic, 'id_member' => $id_member));
    }
    global $adkportal;
    if (!empty($adkportal['download_enable_sendpmApprove']) && !empty($adkportal['download_sendpm_body']) && !empty($adkportal['download_sendpm_userId'])) {
        //Load this members and send MP
        $select = $smcFunc['db_query']('', '
			SELECT member_name, real_name 
			FROM {db_prefix}members 
			WHERE id_member = {int:member}', array('member' => $adkportal['download_sendpm_userId']));
        $member = $smcFunc['db_fetch_assoc']($select);
        $smcFunc['db_free_result']($select);
        $from = array('id' => $adkportal['download_sendpm_userId'], 'name' => $member['real_name'], 'username' => $member['member_name']);
        $select = $smcFunc['db_query']('', '
			SELECT a.id_member, a.title, m.id_member, m.real_name, m.member_name
			FROM {db_prefix}members AS m, {db_prefix}adk_down_file AS a
			WHERE a.id_member = m.id_member AND a.id_file = {int:file}', array('file' => $id));
        $member2 = $smcFunc['db_fetch_assoc']($select);
        $smcFunc['db_free_result']($select);
        $recs = array('to' => array($member2['id_member']), 'bcc' => array());
        $subject = $member2['title'] . ' ' . $txt['adkdown_send_pm'];
        $message = $adkportal['download_sendpm_body'];
        sendpm($recs, $subject, $message, false, $from);
    }
    //redirect and end :)
    if (!empty($_REQUEST['return']) && $_REQUEST['return'] == 'admin') {
        redirectexit('action=admin;area=adkdownloads;sa=approvedownloads;' . $context['session_var'] . '=' . $context['session_id']);
    } else {
        redirectexit('action=downloads;sa=view;down=' . $id);
    }
}
コード例 #2
0
ファイル: data.php プロジェクト: perrr/svada
} elseif ($_GET['action'] == 'getOnlineUsers') {
    getOnlineUsers();
} elseif ($_GET['action'] == 'setProfilePicture') {
    setUserImage($_SESSION['user']['id'], $_POST['image']);
} elseif ($_GET['action'] == 'setStatusMessage') {
    setStatusMessage($_SESSION['user']['id'], $_POST['statusMessage']);
} elseif ($_GET['action'] == 'setDisplayName') {
    setDisplayName($_SESSION['user']['id'], $_POST['displayName']);
} elseif ($_GET['action'] == 'setHighPriorityUserInformation') {
    setHighPriorityUserInformation($_SESSION['user']['id'], $_POST['status'], $_POST['isTyping']);
} elseif ($_GET['action'] == 'setLowPriorityUserInformation') {
    setLowPriorityUserInformation($_SESSION['user']['id'], $_POST['statusMessage'], $_POST['imageId']);
} elseif ($_GET['action'] == 'searchMessages') {
    searchMessages($_POST['string'], $_POST['caseSensitive'], (int) $_POST['userId']);
} elseif ($_GET['action'] == 'setTopic') {
    setTopic($_POST['topic'], $_SESSION['user']['id']);
} elseif ($_GET['action'] == 'setChatName') {
    setChatName($_POST['chatName'], $_SESSION['user']['id']);
} elseif ($_GET['action'] == 'setChatImage') {
    setChatImage($_POST['image'], $_SESSION['user']['id']);
} elseif ($_GET['action'] == 'getChatImage') {
    getChatImage();
} elseif ($_GET['action'] == 'getChatInformation') {
    getChatInformation();
} elseif ($_GET['action'] == 'setLanguage') {
    setLanguage($_SESSION['user']['id'], $_POST['language']);
} elseif ($_GET['action'] == 'setIsTyping') {
    setIsTyping($_SESSION['user']['id'], $_POST['isTyping']);
} elseif ($_GET['action'] == 'checkUserActivity') {
    checkUserActivity($_SESSION['user']['id']);
} elseif ($_GET['action'] == 'getUser') {