$db->query("INSERT INTO {$tablepre}polloptions (tid, polloption) VALUES ('{$tid}', '{$polloptvalue}')");
     }
 } elseif ($special == 4 && $allowpostactivity) {
     $db->query("INSERT INTO {$tablepre}activities (tid, uid, cost, starttimefrom, starttimeto, place, class, gender, number, expiration)\r\n\t\t\tVALUES ('{$tid}', '{$discuz_uid}', '{$activity['cost']}', '{$activity['starttimefrom']}', '{$activity['starttimeto']}', '{$activity['place']}', '{$activity['class']}', '{$activity['gender']}', '{$activity['number']}', '{$activity['expiration']}')");
 } elseif ($special == 5 && $allowpostdebate) {
     $db->query("INSERT INTO {$tablepre}debates (tid, uid, starttime, endtime, affirmdebaters, negadebaters, affirmvotes, negavotes, umpire, winner, bestdebater, affirmpoint, negapoint, umpirepoint)\r\n\t\t\tVALUES ('{$tid}', '{$discuz_uid}', '{$timestamp}', '{$endtime}', '0', '0', '0', '0', '{$umpire}', '', '', '{$affirmpoint}', '{$negapoint}', '')");
 } elseif ($special == 6 && $allowpostvideo) {
     $vid = dhtmlspecialchars($vid);
     $vsubject = dhtmlspecialchars($vsubject);
     $vclass = intval($vclass);
     $visup = intval($visup);
     $vlength = intval($vlength);
     $vautoplay = $vautoplay ? intval($vautoplay) : 2;
     $vshare = $vshare ? intval($vshare) : 1;
     $videoAccount = new VideoClient_VideoService($appid, $siteid, $sitekey);
     $result = $videoAccount->upload($vid, $tid, $visup, insenz_convert($vsubject, 1), insenz_convert($vtag, 1), '', $vclass, $vautoplay, $vshare);
     $query = $db->query("INSERT INTO {$tablepre}videos (vid, tid, uid, dateline, vthumb, vtitle, vclass, vtime, visup, vautoplay)\r\n\t\t\tVALUES ('{$vid}', '{$tid}', '{$discuz_uid}', '{$timestamp}', '', '{$vsubject}', '{$vclass}', '{$vlength}', '{$visup}', '{$vautoplay}')", 'SILENT');
 }
 if ($forum['threadsorts']['types'][$sortid] && !empty($optiondata) && is_array($optiondata)) {
     foreach ($optiondata as $optionid => $value) {
         $db->query("INSERT INTO {$tablepre}typeoptionvars (sortid, tid, optionid, value, expiration)\r\n\t\t\t\tVALUES ('{$sortid}', '{$tid}', '{$optionid}', '{$value}', '" . ($typeexpiration ? $timestamp + $typeexpiration : 0) . "')");
     }
 }
 $bbcodeoff = checkbbcodes($message, !empty($bbcodeoff));
 $smileyoff = checksmilies($message, !empty($smileyoff));
 $parseurloff = !empty($parseurloff);
 $htmlon = bindec(($tagstatus && !empty($tagoff) ? 1 : 0) . ($allowhtml && !empty($htmlon) ? 1 : 0));
 $pinvisible = $modnewthreads ? -2 : 0;
 $message = preg_replace('/\\[attachimg\\](\\d+)\\[\\/attachimg\\]/is', '[attach]\\1[/attach]', $message);
 $db->query("INSERT INTO {$tablepre}posts (fid, tid, first, author, authorid, subject, dateline, message, useip, invisible, anonymous, usesig, htmlon, bbcodeoff, smileyoff, parseurloff, attachment)\r\n\t\tVALUES ('{$fid}', '{$tid}', '1', '{$discuz_user}', '{$discuz_uid}', '{$subject}', '{$timestamp}', '{$message}', '{$onlineip}', '{$pinvisible}', '{$isanonymous}', '{$usesig}', '{$htmlon}', '{$bbcodeoff}', '{$smileyoff}', '{$parseurloff}', '{$attachment}')");
 $pid = $db->insert_id();
Exemple #2
0
function insenz_updatesettings()
{
    global $insenz, $response;
    $insenz['availableadvs'] = explode(',', $response['response'][0]['availableadvs'][0]['VALUE']);
    $insenz['hardadstatus'] = array_intersect(is_array($insenz['hardadstatus']) ? $insenz['hardadstatus'] : array(), $insenz['availableadvs']);
    if ($insenz['relatedadstatus']) {
        $insenz['topicrelatedad'] = insenz_convert($response['response'][0]['topicrelatedad'][0]['VALUE'], 0);
        $insenz['traderelatedad'] = insenz_convert($response['response'][0]['traderelatedad'][0]['VALUE'], 0);
        $insenz['relatedtrades'] = insenz_convert($response['response'][0]['relatedtrades'][0]['VALUE'], 0);
    } else {
        $insenz['topicrelatedad'] = $insenz['traderelatedad'] = $insenz['relatedtrades'] = '';
    }
    $jsurl = $response['response'][0]['jsurl'][0]['VALUE'];
    $insenz['jsurl'] = $jsurl ? $jsurl : $insenz['jsurl'];
    if (isset($response['response'][0]['topicstatus'])) {
        $insenz['topicstatus'] = intval($response['response'][0]['topicstatus'][0]['VALUE']);
    }
    $insenz['status'] = $insenz['softadstatus'] || $insenz['hardadstatus'] || $insenz['topicrelatedad'] || $insenz['traderelatedad'] || $insenz['topicstatus'];
}
				}
				</script>';
            cpfooter();
            dexit();
        } else {
            if (!($reason = intval($reason))) {
                cpmsg('insenz_campaign_input_reason');
            }
            $data = '<cmd id="ignoreVirtualForum">' . '<c_id>' . $c_id . '</c_id>' . '<reason>' . $reason . '</reason>' . '</cmd>';
            $response = insenz_request($data);
            if ($response['status']) {
                cpmsg($response['data']);
            } else {
                $response = $response['data'];
                if ($response['response'][0]['status'][0]['VALUE'] == 1) {
                    cpmsg(insenz_convert($response['response'][0]['reason'][0]['VALUE'], 0));
                }
            }
            cpmsg('insenz_campaign_specified_ignored', 'admincp.php?action=insenz');
        }
    } else {
        if ($c_status == 6) {
            $onlineids = 0;
            $query = $db->query("SELECT id FROM {$tablepre}campaigns WHERE type='4' AND status='2'");
            while ($c = $db->fetch_array($query)) {
                $onlineids .= ',' . $c['id'];
            }
        }
        $statuslist = array('2' => $lang['insenz_campaign_new'], '6' => $lang['insenz_campaign_playing'], '7' => $lang['insenz_campaign_over']);
        echo '	<script src="./include/javascript/bbcode.js" type="text/javascript"></script>
			<table width="100%" align="center" border="0" cellpadding="0" cellspacing="0" class="tableborder">
        showsetting('video_open', 'videonew[open]', $video['open'], 'radio');
        showsetting('video_site_name', 'videonew[bbname]', $video['bbname'], 'text');
        showsetting('video_site_url', 'videonew[url]', $video['url'], 'text');
        showsetting('video_site_email', 'videonew[email]', $video['email'], 'text');
        showsetting('video_site_logo', 'videonew[logo]', $video['logo'], 'text');
        showsetting('video_site_type', array('videonew[sitetype]', array(array(0, $lang['video_site_type_none']), array(1, $lang['video_site_type_1']), array(2, $lang['video_site_type_2']), array(3, $lang['video_site_type_3']), array(5, $lang['video_site_type_5']), array(6, $lang['video_site_type_6']), array(7, $lang['video_site_type_7']), array(8, $lang['video_site_type_8']), array(9, $lang['video_site_type_9']), array(10, $lang['video_site_type_10']), array(11, $lang['video_site_type_11']), array(12, $lang['video_site_type_12']), array(13, $lang['video_site_type_13']), array(14, $lang['video_site_type_14']), array(15, $lang['video_site_type_15']), array(16, $lang['video_site_type_16']), array(17, $lang['video_site_type_17']), array(18, $lang['video_site_type_18']), array(19, $lang['video_site_type_19']), array(20, $lang['video_site_type_20']), array(21, $lang['video_site_type_21']), array(22, $lang['video_site_type_22']), array(23, $lang['video_site_type_23']), array(24, $lang['video_site_type_24']), array(25, $lang['video_site_type_25']), array(26, $lang['video_site_type_26']), array(27, $lang['video_site_type_27']), array(28, $lang['video_site_type_28']), array(29, $lang['video_site_type_29']), array(30, $lang['video_site_type_30']), array(31, $lang['video_site_type_31']), array(32, $lang['video_site_type_32']), array(33, $lang['video_site_type_33']), array(34, $lang['video_site_type_34']), array(35, $lang['video_site_type_35']), array(36, $lang['video_site_type_36']), array(37, $lang['video_site_type_37']), array(38, $lang['video_site_type_38']), array(39, $lang['video_site_type_39']), array(40, $lang['video_site_type_40']), array(41, $lang['video_site_type_41']))), $video['sitetype'], 'select');
        showsubmit('configsubmit');
        showtablefooter();
        showformfooter();
    } else {
        require_once DISCUZ_ROOT . './include/insenz.func.php';
        require_once DISCUZ_ROOT . './api/video.php';
        $videoAccount = new VideoClient_SiteService($appid, $video['siteid'], $video['authkey']);
        $result = $videoAccount->edit(insenz_convert($videonew['bbname']), $videonew['url'], $videonew['logo'], $videonew['sitetype']);
        if ($result->isError()) {
            cpmsg(insenz_convert($result->getMessage(), 0), '', 'error');
        } else {
            $video['open'] = intval($videonew['open']);
            $video['bbname'] = $videonew['bbname'];
            $video['url'] = $videonew['url'];
            $video['email'] = $videonew['email'];
            $video['logo'] = $videonew['logo'];
            $video['sitetype'] = $videonew['sitetype'];
            $db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('videoinfo', '" . addslashes(serialize($video)) . "')");
            updatecache('settings');
            cpmsg('video_config_succeed', $BASESCRIPT . '?action=video&operation=config', 'succeed');
        }
    }
} elseif ($operation == 'class') {
    $videodefault = array(1 => array('name' => $lang['video_video_type_1']), 5 => array('name' => $lang['video_video_type_5']), 7 => array('name' => $lang['video_video_type_7']), 8 => array('name' => $lang['video_video_type_8']), 11 => array('name' => $lang['video_video_type_11']), 12 => array('name' => $lang['video_video_type_12']), 14 => array('name' => $lang['video_video_type_14']), 15 => array('name' => $lang['video_video_type_15']), 16 => array('name' => $lang['video_video_type_16']), 18 => array('name' => $lang['video_video_type_18']), 19 => array('name' => $lang['video_video_type_19']), 21 => array('name' => $lang['video_video_type_21']), 22 => array('name' => $lang['video_video_type_22']), 23 => array('name' => $lang['video_video_type_23']), 24 => array('name' => $lang['video_video_type_24']), 25 => array('name' => $lang['video_video_type_25']), 26 => array('name' => $lang['video_video_type_26']), 27 => array('name' => $lang['video_video_type_27']), 28 => array('name' => $lang['video_video_type_28']), 29 => array('name' => $lang['video_video_type_29']), 30 => array('name' => $lang['video_video_type_30']), 31 => array('name' => $lang['video_video_type_31']), 32 => array('name' => $lang['video_video_type_32']));
    if (!submitcheck('classsubmit')) {
					alert(\'' . $lang['insenz_campaign_input_reason'] . '\');
					return false;
				}
			</script>';
        } else {
            if (!($reason = intval($reason))) {
                cpmsg('insenz_campaign_input_reason', '', 'error');
            }
            $data = '<cmd id="ignoreVirtualForum">' . '<c_id>' . $c_id . '</c_id>' . '<reason>' . $reason . '</reason>' . '</cmd>';
            $response = insenz_request($data);
            if ($response['status']) {
                cpmsg($response['data'], '', 'error');
            } else {
                $response = $response['data'];
                if ($response['response'][0]['status'][0]['VALUE'] == 1) {
                    cpmsg(insenz_convert($response['response'][0]['reason'][0]['VALUE'], 0), '', 'error');
                }
            }
            cpmsg('insenz_campaign_specified_ignored', $BASESCRIPT . '?action=insenz&operation=virtualforum&c_status=2', 'succeed');
        }
    } else {
        shownav('adv', 'insenz', 'insenz_nav_virtualforum');
        showsubmenu('nav_insenz_vf', array(array('nav_insenz_vf_new', 'insenz&operation=virtualforum&c_status=2', $c_status == 2), array('nav_insenz_vf_online', 'insenz&operation=virtualforum&c_status=6', $c_status == 6), array('nav_insenz_vf_offline', 'insenz&operation=virtualforum&c_status=7', $c_status == 7)));
        if ($c_status == 6) {
            $onlineids = $offlineids = 0;
            $query = $db->query("SELECT id, status FROM {$tablepre}campaigns WHERE type='4' AND status IN ('2','3')");
            while ($c = $db->fetch_array($query)) {
                if ($c['status'] == 2) {
                    $onlineids .= ',' . $c['id'];
                } else {
                    $offlineids .= ',' . $c['id'];
    $response = insenz_request('forum.php', '<cmd id="getForumDetails"><c_id>' . $cid . '</c_id></cmd>');
    $threads = intval($response[0]['threads'][0]['VALUE']);
    $posts = intval($response[0]['posts'][0]['VALUE']);
    $lastpost = insenz_convert($response[0]['lastpost'][0]['VALUE'], 0);
    $db->query("UPDATE {$tablepre}virtualforums SET threads='{$threads}', posts='{$posts}', lastpost='{$lastpost}' WHERE cid='{$cid}'");
    $db->query("UPDATE {$tablepre}campaigns SET lastupdated='{$timestamp}' WHERE id='{$cid}'");
} elseif (in_array($type, array(1, 2, 3)) && $cid) {
    $campaign = $db->fetch_first("SELECT tid, autoupdate, lastupdated FROM {$tablepre}campaigns WHERE id='{$cid}' AND type='{$type}'");
    if (!$campaign || !$campaign['autoupdate'] || $timestamp - $campaign['lastupdated'] < 600) {
        exit;
    }
    $response = insenz_request('campaign.php', '<cmd id="getTopicDetails"><c_id>' . $cid . '</c_id></cmd>');
    $replies = intval($response[0]['replies'][0]['VALUE']);
    $views = intval($response[0]['views'][0]['VALUE']);
    $lastpost = intval($response[0]['lastpost'][0]['VALUE']);
    $lastposter = insenz_convert($response[0]['lastposter'][0]['VALUE'], 0);
    $db->query("UPDATE {$tablepre}threads SET replies='{$replies}', views='{$views}', lastpost='{$lastpost}', lastposter='{$lastposter}' WHERE tid='{$campaign['tid']}'");
    $db->query("UPDATE {$tablepre}campaigns SET lastupdated='{$timestamp}' WHERE id='{$cid}'");
}
function insenz_request($script, $data)
{
    global $timestamp, $insenz;
    @(include_once DISCUZ_ROOT . './discuz_version.php');
    $authkey = $insenz['authkey'];
    $t_hex = sprintf("%08x", $timestamp);
    $postdata = '<?xml version="1.0" encoding="UTF' . '-8"?><request insenz_version="' . INSENZ_VERSION . '" discuz_version="' . DISCUZ_VERSION . ' - ' . DISCUZ_RELEASE . '">' . $data . '</request>';
    $postdata = insenz_authcode($t_hex . md5($authkey . $postdata . $t_hex) . $postdata, 'ENCODE', $authkey);
    if (!($fp = @fsockopen($insenz['host'], 80))) {
        exit;
    }
    @fwrite($fp, "POST http://{$insenz['url']}/{$script}?s_id={$insenz['siteid']} HTTP/1.0\r\n");