Exemple #1
0
<?php

require_once dirname(__FILE__) . '/src/Csv.php';
require_once dirname(__FILE__) . '/src/PixivArtWorkDownload.php';
$log_file = 'mklink';
list($image_dir, $link_dir, $cookie_file, $userlist_file) = SetParam();
CreateLink(ReadCsv($userlist_file));
function CreateLink($userlist)
{
    global $image_dir, $link_dir;
    MakeDirectory("{$link_dir}_windows");
    $handle = fopen('mklink.bat', 'w');
    foreach ($userlist as $user) {
        @($user_id = $user['user_id']);
        @($display_name = $user['display_name']);
        fwrite($handle, "mklink /d {$link_dir}_windows\\{$display_name} {$image_dir}\\{$user_id}" . "\r\n");
    }
    fclose($handle);
    Msg('succeed', "Create bat file 'mklink.bat'.\n");
}
function SaveSettings($EditArr)
{
    global $Db, $nsProduct, $Lang, $Logs, $Settings;
    $DoRedir = true;
    extract($EditArr);
    if (!isset($UseIp)) {
        $UseIp = 0;
    }
    if (!isset($EnableFraud)) {
        $EnableFraud = 0;
    }
    if (!isset($IpNoCookie)) {
        $IpNoCookie = 0;
    }
    if (!isset($UseWhiteLogo)) {
        $UseWhiteLogo = 0;
    }
    if (!isset($UseWhiteCopy)) {
        $UseWhiteCopy = 0;
    }
    if (!isset($TrafficPrior)) {
        $TrafficPrior = "NONE";
    }
    if (!isset($NoneEntryPrior)) {
        $NoneEntryPrior = "LAST";
    }
    if (!isset($PaidEntryPrior)) {
        $PaidEntryPrior = "LAST";
    }
    if (!isset($NaturalEntryPrior)) {
        $NaturalEntryPrior = "LAST";
    }
    $TrackingMode = $TrafficPrior . "|NONE:{$NoneEntryPrior};PAID:{$PaidEntryPrior};NATURAL:{$NaturalEntryPrior}";
    $VarCamp = RemoveMiscSymb($VarCamp, "_");
    $VarCampSource = RemoveMiscSymb($VarCampSource, "_");
    $VarKw = RemoveMiscSymb($VarKw, "_");
    $VarKeyword = RemoveMiscSymb($VarKeyword, "_");
    if (!ValidVar($FraudPeriod)) {
        $FraudPeriod = 1;
    }
    if (!ValidVar($FraudCount)) {
        $FraudCount = 5;
    }
    SetParam("P3P", "STRVAL", $P3P);
    SetParam("P3P_REF", "STRVAL", $P3P_REF);
    if (!ValidVar($DefSkin)) {
        $DefSkin = $nsProduct->DEFAULT_SKIN;
    }
    if (!ValidVar($DefLang)) {
        $DefLang = $nsProduct->DEFAULT_LANG;
    }
    if (!$nsProduct->WHITE || !ValidVar($WhiteLogo)) {
        $WhiteLogo = "";
    }
    if (!ValidVar($SendUsage)) {
        $SendUsage = 0;
    }
    if (!ValidVar($UseStore)) {
        $UseStore = 0;
    }
    if ($UseStore && !CheckStore()) {
        $Logs->Err($Lang['WriteErr']);
        $UseStore = 0;
        $GLOBALS['EditArr']['UseStore'] = 0;
        $DoRedir = false;
    }
    if ($UseStore && $UseStore != $Settings->USE_STORE) {
        RebuildStoreFiles();
    }
    $Query = "UPDATE " . PFX . "_system_product SET DEFAULT_SKIN = '{$DefSkin}', DEFAULT_LANG='{$DefLang}', WHITE_LOGO='{$WhiteLogo}' WHERE ID = " . $nsProduct->ID;
    $Db->Query($Query);
    $Query = "\n\t\tUPDATE " . PFX . "_tracker_config SET \n\t\t\tALLOW_SEND_INFO='{$SendUsage}', \n\t\t\tSSL_LINK = '{$SSLink}', \n\t\t\tUSE_STORE='{$UseStore}', \n\t\t\tFROM_EMAIL = ?, \n\t\t\tONLINE_PERIOD = ?, \n\t\t\tIP_TRACKING='{$UseIp}',\n\t\t\tIP_NO_COOKIE='{$IpNoCookie}',\n\t\t\tIP_PERIOD=?,\n\t\t\tFRAUD_ENABLE='{$EnableFraud}',\n\t\t\tFRAUD_COUNT=?,\n\t\t\tFRAUD_PERIOD=?,\n\t\t\tVAR_CAMPAIGN=?,\n\t\t\tVAR_CAMPAIGN_SOURCE=?,\n\t\t\tVAR_KW=?,\n\t\t\tVAR_KEYWORD=?,\n\t\t\tWHITE_NO_LOGO='{$UseWhiteLogo}',\n\t\t\tWHITE_NO_COPY='{$UseWhiteCopy}',\n\t\t\tTRACKING_MODE='{$TrackingMode}'\n\t\tWHERE COMPANY_ID=0 AND SITE_ID=0";
    $Db->Query($Query, $FromEmail, abs(intval($OnlinePeriod)), abs(intval($IpPeriod)), abs(intval($FraudCount)), abs(intval($FraudPeriod)), $VarCamp, $VarCampSource, $VarKw, $VarKeyword);
    if ($DoRedir) {
        $nsProduct->Redir("misc_config", "RUpd=1", "admin");
    }
}