コード例 #1
0
ファイル: reset-install.php プロジェクト: hackingman/LinkX
function ResetInstall()
{
    global $DB, $C;
    IniParse("{$GLOBALS['BASE_DIR']}/includes/tables.php", TRUE, $tables);
    foreach ($tables as $table => $create) {
        $DB->Update('DROP TABLE IF EXISTS #', array($table));
    }
    FileWrite("{$GLOBALS['BASE_DIR']}/includes/config.php", "<?php\n\$C = array();\n?>");
    echo "Your LinkX installation has been reset<br />" . "Upload the install.php script and access it through your browser to re-initialize the software";
}
コード例 #2
0
ファイル: install.php プロジェクト: hackingman/ToplistX
function Initialize()
{
    global $errors, $t, $C, $template;
    // Already initialized
    if (!empty($C['db_username'])) {
        $t->assign('mode', 'done');
        echo $t->parse($template);
    } else {
        // Form submitted
        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
            $connection = TestDBConnection();
            if (!$connection) {
                $t->assign_by_ref('errors', $errors);
                $t->assign_by_ref('request', $_REQUEST);
                $t->assign('mode', 'getdb');
                echo $t->parse($template);
            } else {
                // Create database tables and setup initial login
                FileWrite("{$GLOBALS['BASE_DIR']}/data/.htaccess", "deny from all");
                CreateTables();
                WriteConfig($_REQUEST);
                RecompileTemplates();
                // Display initialization finished screen
                $t->assign('control_panel', "http://{$_SERVER['HTTP_HOST']}" . dirname($_SERVER['REQUEST_URI']) . "/index.php");
                $t->assign('mode', 'login');
                echo $t->parse($template);
            }
        } else {
            // Run pre-initialization tests
            ServerTest();
            FilesTest();
            DirectoriesTest();
            TemplatesTest();
            if (is_dir('../utilities')) {
                $errors[] = 'For security purposes, the utilities directory must be removed';
            }
            if (count($errors)) {
                // Display failed test information
                $t->assign('mode', 'errors');
                $t->assign_by_ref('errors', $errors);
                echo $t->parse($template);
            } else {
                $_REQUEST['db_hostname'] = 'localhost';
                $t->assign_by_ref('request', $_REQUEST);
                $t->assign_by_ref('errors', $errors);
                $t->assign('mode', 'getdb');
                echo $t->parse($template);
            }
        }
    }
}
コード例 #3
0
ファイル: cropper.php プロジェクト: Cyberspace-Networks/TGPX
function txDownloadThumb()
{
    global $json, $C;
    $out = array('status' => JSON_FAILURE);
    $id = md5($_REQUEST['thumb']);
    $cachefile = SafeFilename("_{$_REQUEST['gallery_id']}_" . $id . ".jpg", FALSE);
    if (!is_file("{$GLOBALS['BASE_DIR']}/cache/{$cachefile}")) {
        $http = new Http();
        if ($http->Get($_REQUEST['thumb'], TRUE, $_REQUEST['gallery_url'])) {
            FileWrite("{$GLOBALS['BASE_DIR']}/cache/{$cachefile}", $http->body);
        }
    }
    $out['size'] = @getimagesize("{$GLOBALS['BASE_DIR']}/cache/{$cachefile}");
    if ($out['size'] !== FALSE) {
        $out['src'] = "{$C['install_url']}/cache/{$cachefile}";
        $out['status'] = JSON_SUCCESS;
    } else {
        unlink("{$GLOBALS['BASE_DIR']}/cache/{$cachefile}");
    }
    echo $json->encode($out);
}
コード例 #4
0
function ResetInstall()
{
    global $DB, $C;
    IniParse("{$GLOBALS['BASE_DIR']}/includes/tables.php", TRUE, $tables);
    foreach ($tables as $table => $create) {
        $DB->Update('DROP TABLE IF EXISTS #', array($table));
    }
    FileWrite("{$GLOBALS['BASE_DIR']}/includes/config.php", "<?php\n\$C = array();\n?>");
    if (is_dir("{$GLOBALS['BASE_DIR']}/cache")) {
        $cached =& DirRead("{$GLOBALS['BASE_DIR']}/cache", '^[^.]');
        foreach ($cached as $cache) {
            @unlink("{$GLOBALS['BASE_DIR']}/cache/{$cache}");
        }
    }
    if (!empty($C['preview_dir']) && is_dir($C['preview_dir'])) {
        $thumbs =& DirRead($C['preview_dir'], '^[^.]');
        foreach ($thumbs as $thumb) {
            @unlink("{$C['preview_dir']}/{$thumb}");
        }
    }
    echo "Your TGPX installation has been reset<br />" . "Upload the install.php script and access it through your browser to re-initialize the software";
}
コード例 #5
0
ファイル: submit.php プロジェクト: Cyberspace-Networks/TGPX
function HandlePreviewThumb(&$v, &$format, &$annotation)
{
    global $L, $C, $domain;
    list($width, $height) = explode('x', $format['preview_size']);
    $imagefile = "{$GLOBALS['BASE_DIR']}/cache/" . md5(uniqid(rand(), true)) . ".jpg";
    $i = GetImager();
    switch ($_REQUEST['preview']) {
        // Automatically crop and resize
        case 'automatic':
            $referrer_url = $_REQUEST['scan']['end_url'];
            $preview_url = $_REQUEST['scan']['preview'];
            if (!IsEmptyString($preview_url)) {
                $http = new Http();
                if ($http->Get($preview_url, TRUE, $referrer_url)) {
                    FileWrite($imagefile, $http->body);
                    $i->ResizeAuto($imagefile, $format['preview_size'], $annotation, $C['landscape_bias'], $C['portrait_bias']);
                } else {
                    $v->SetError(sprintf($L['PREVIEW_DOWNLOAD_FAILED'], $http->errstr));
                }
            } else {
                $v->SetError($L['NO_THUMBS_FOR_PREVIEW']);
            }
            break;
            // Handle uploaded image
        // Handle uploaded image
        case 'upload':
            if (is_uploaded_file($_FILES['upload']['tmp_name'])) {
                move_uploaded_file($_FILES['upload']['tmp_name'], $imagefile);
                @chmod($imagefile, 0666);
                $image = @getimagesize($imagefile);
                if ($image !== FALSE && $image[2] == IMAGETYPE_JPEG) {
                    // Image is properly sized
                    if ($image[0] == $width && $image[1] == $height) {
                        if ($C['have_imager']) {
                            $i->Annotate($imagefile, $annotation);
                        }
                    } else {
                        if ($C['have_imager'] && $C['handle_bad_size'] == 'crop') {
                            $i->ResizeAuto($imagefile, $format['preview_size'], $annotation, $C['landscape_bias'], $C['portrait_bias']);
                        } else {
                            @unlink($imagefile);
                            $v->SetError(sprintf($L['INVALID_IMAGE_SIZE'], $width, $height));
                        }
                    }
                } else {
                    @unlink($imagefile);
                    $v->SetError($L['INVALID_IMAGE']);
                }
            } else {
                $v->SetError($L['INVALID_UPLOAD']);
            }
            break;
            // Cropping an image
        // Cropping an image
        case 'crop':
            if (IsEmptyString($_REQUEST['scan']['preview'])) {
                $v->SetError($L['NO_THUMBS_FOR_PREVIEW']);
            }
            $imagefile = null;
            break;
            // Cropping or no image provided
        // Cropping or no image provided
        default:
            $imagefile = null;
            break;
    }
    return $imagefile;
}
コード例 #6
0
ファイル: ajax.php プロジェクト: Cyberspace-Networks/TGPX
function txDownloadThumb()
{
    global $DB, $json, $C;
    $out = array('status' => JSON_FAILURE);
    $id = md5($_REQUEST['thumb']);
    $cachefile = SafeFilename("_{$_REQUEST['gallery_id']}_" . $id . ".jpg", FALSE);
    if (!is_file("{$GLOBALS['BASE_DIR']}/cache/{$cachefile}")) {
        $http = new Http();
        if ($http->Get($_REQUEST['thumb'], TRUE, $_REQUEST['gallery_url'])) {
            FileWrite("{$GLOBALS['BASE_DIR']}/cache/{$cachefile}", $http->body);
        }
    }
    $out['size'] = @getimagesize("{$GLOBALS['BASE_DIR']}/cache/{$cachefile}");
    if ($out['size'] !== FALSE) {
        if ($out['size'][0] >= $C['min_thumb_width'] && $out['size'][1] >= $C['min_thumb_height'] && $out['size'][0] <= $C['max_thumb_width'] && $out['size'][1] <= $C['max_thumb_height']) {
            $out['src'] = "{$C['install_url']}/cache/{$cachefile}";
            $out['status'] = JSON_SUCCESS;
            $out['id'] = $id;
        } else {
            $out['message'] = "Downloading " . htmlspecialchars($_REQUEST['thumb']) . " failed: image size of {$out['size'][0]}x{$out['size'][1]} is " . "not within the range of {$C['min_thumb_width']}x{$C['min_thumb_height']} to {$C['max_thumb_width']}x{$C['max_thumb_height']}";
        }
    } else {
        $out['message'] = "Downloading " . htmlspecialchars($_REQUEST['thumb']) . " failed: not a valid image file";
    }
    echo $json->encode($out);
}
コード例 #7
0
ファイル: ajax.php プロジェクト: hackingman/ToplistX
function tlxAccountEditProcess()
{
    global $DB, $json, $C, $L;
    VerifyPrivileges(P_ACCOUNT_MODIFY, TRUE);
    if ($_REQUEST['w'] == 'reject') {
        $DB->Update('UPDATE `tlx_accounts` SET `edited`=0,`edit_data`=NULL WHERE `username`=?', array($_REQUEST['username']));
    } else {
        if ($_REQUEST['w'] == 'approve') {
            $account = $DB->Row('SELECT * FROM `tlx_accounts` WHERE `username`=?', array($_REQUEST['username']));
            $edits = unserialize(base64_decode($account['edit_data']));
            if ($edits) {
                if ($edits['banner_data']) {
                    $parsed = parse_url($edits['banner_url_local']);
                    if ($parsed !== FALSE) {
                        $banner_file = SafeFilename("{$C['banner_dir']}/" . basename($parsed['path']), FALSE);
                        FileWrite($banner_file, $edits['banner_data']);
                    }
                    unset($edits['banner_data']);
                }
                $user_fields = $DB->GetColumns('tlx_account_fields');
                $default_updates = array("`edited`=?", "`edit_data`=?");
                $default_updates_binds = array(0, null);
                $user_updates = array();
                $user_updates_binds = array();
                foreach ($edits as $name => $value) {
                    $name = str_replace('`', '\\`', $name);
                    $value = mysql_real_escape_string($value, $DB->handle);
                    if (in_array($name, $user_fields)) {
                        $user_updates[] = "`{$name}`=?";
                        $user_updates_binds[] = $value;
                    } else {
                        $default_updates[] = "`{$name}`=?";
                        $default_updates_binds[] = $value;
                    }
                }
                $user_updates_binds[] = $_REQUEST['username'];
                $default_updates_binds[] = $_REQUEST['username'];
                if (count($user_updates)) {
                    $DB->Update('UPDATE `tlx_account_fields` SET ' . join(',', $user_updates) . ' WHERE `username`=?', $user_updates_binds);
                }
                $DB->Update('UPDATE `tlx_accounts` SET ' . join(',', $default_updates) . ' WHERE `username`=?', $default_updates_binds);
            }
        }
    }
    echo $json->encode(array('status' => JSON_SUCCESS));
}
コード例 #8
0
ファイル: index.php プロジェクト: hackingman/LinkX
function lxSaveEmailTemplate()
{
    global $DB, $C;
    VerifyAdministrator();
    CheckAccessList();
    $_REQUEST['plain'] = trim($_REQUEST['plain']);
    $_REQUEST['html'] = trim($_REQUEST['html']);
    $ini_data = IniWrite(null, $_REQUEST, array('subject', 'plain', 'html'));
    $compiled_code = '';
    $compiler = new Compiler();
    if ($compiler->compile($ini_data, $compiled_code)) {
        $template_file = SafeFilename("{$GLOBALS['BASE_DIR']}/templates/{$_REQUEST['loaded_template']}");
        FileWrite($template_file, $ini_data);
        $GLOBALS['message'] = 'Template has been successully saved';
    } else {
        $GLOBALS['errstr'] = "Template could not be saved:<br />" . nl2br($compiler->get_error_string());
    }
    lxShEmailTemplates();
}
コード例 #9
0
ファイル: tripadmin.php プロジェクト: Kennyl/pixmicat_modules
            SysError("フォーマットは正しくない。");
        }
        $aTripList = FileRead(TRIPFILE);
        $bFlag = FALSE;
        while (list(, $val) = @each($aTripList)) {
            list($szTrip, ) = explode("<>", $val);
            if ($trip == $szTrip) {
                $bFlag = TRUE;
                break;
            }
        }
        if ($bFlag) {
            SysError("同じトリップが存在します。");
        }
        $szTemp = "{$trip}<>" . time() . "<>" . $_SERVER['REMOTE_ADDR'] . "<>0<>0<>0<>\n";
        FileWrite(TRIPFILE, $szTemp, "a");
        HtmlHeader();
        echo "トリップ <B>{$trip}</B> を追加しました。";
        $goto = 1;
        break;
    case 'alldelview':
        check_login();
        HtmlHeader();
        echo <<<HTML
<P>全てのトリップを削除します。<BR>よろしいですか?</P>
<FORM method="POST" action="{$_SERVER['PHP_SELF']}" ENCTYPE="multipart/form-data">
<INPUT type="hidden" name="action" value="alldel">
<INPUT type="submit" value="全削除">
</FORM>
HTML;
        break;
コード例 #10
0
ファイル: index.php プロジェクト: hackingman/TGPX
function txScriptTemplateSave()
{
    global $DB, $C;
    VerifyAdministrator();
    CheckAccessList();
    $_REQUEST['code'] = trim($_REQUEST['code']);
    // Compile global templates first, if this is not one
    if (!preg_match('~global-~', $_REQUEST['loaded_template'])) {
        $t = new Template();
        foreach (glob("{$GLOBALS['BASE_DIR']}/templates/*global-*.tpl") as $global_template) {
            $t->compile_template(basename($global_template));
        }
    }
    $compiled_code = '';
    $compiler = new Compiler();
    if ($compiler->compile($_REQUEST['code'], $compiled_code)) {
        $template_file = SafeFilename("{$GLOBALS['BASE_DIR']}/templates/{$_REQUEST['loaded_template']}");
        FileWrite($template_file, $_REQUEST['code']);
        $compiled_file = SafeFilename("{$GLOBALS['BASE_DIR']}/templates/compiled/{$_REQUEST['loaded_template']}", FALSE);
        FileWrite($compiled_file, $compiled_code);
        $GLOBALS['message'] = 'Template has been successully saved';
    } else {
        $GLOBALS['errstr'] = "Template could not be saved:<br />" . nl2br($compiler->get_error_string());
    }
    $GLOBALS['warnstr'] = CheckTemplateCode($_REQUEST['code']);
    // Recompile all templates if a global template was updated
    if (preg_match('~global-~', $_REQUEST['loaded_template'])) {
        RecompileTemplates();
    }
    txShScriptTemplates();
}
コード例 #11
0
function RestoreThumbnails($filename)
{
    global $DB, $C;
    $fd = fopen($filename, 'r');
    if ($fd) {
        while (!feof($fd)) {
            list($file, $thumb_data) = explode('|', trim(fgets($fd)));
            if (IsEmptyString($file)) {
                continue;
            }
            FileWrite("{$C['preview_dir']}/{$file}", base64_decode($thumb_data));
        }
        fclose($fd);
        @chmod($filename, 0666);
    }
}
コード例 #12
0
ファイル: scanner.php プロジェクト: Cyberspace-Networks/TGPX
                         }
                     }
                 }
             }
         }
     }
 }
 // Download thumbnail(s) from remote server
 if ($configuration['process_downloadpreview']) {
     foreach ($previews as $preview) {
         if (!preg_match('~^' . $C['preview_url'] . '~', $preview['preview_url'])) {
             $http = new Http();
             // Download the image
             if ($http->Get($preview['preview_url'], TRUE, $gallery['gallery_url'])) {
                 $imagefile = "{$GLOBALS['BASE_DIR']}/cache/" . md5(uniqid(rand(), true)) . ".jpg";
                 FileWrite($imagefile, $http->body);
                 $imagesize = @getimagesize($imagefile);
                 if ($imagesize !== FALSE && ($imagesize[2] = IMAGETYPE_JPEG)) {
                     $width = $imagesize[0];
                     $height = $imagesize[1];
                     $resized = FALSE;
                     // Resize thumb to specific size
                     if ($configuration['process_downloadresize'] && ($width != $preview_width || $height != $preview_height)) {
                         $imager->ResizeAuto($imagefile, $preview_width . 'x' . $preview_height, $annotation, $C['landscape_bias'], $C['portrait_bias']);
                         $width = $preview_width;
                         $height = $preview_height;
                         $resized = TRUE;
                     }
                     // Annotate the image
                     if (!$resized && !empty($annotation)) {
                         $imager->Annotate($imagefile, $annotation);
コード例 #13
0
ファイル: common.php プロジェクト: hackingman/LinkX
function FileCreate($file, $mode = NULL)
{
    if (!file_exists($file)) {
        FileWrite($file, '', $mode);
    }
}
コード例 #14
0
ファイル: accounts.php プロジェクト: hackingman/ToplistX
function tlxAccountAdd()
{
    global $C, $DB, $L, $IMAGE_EXTENSIONS, $t;
    unset($_REQUEST['banner_url_local']);
    // Get domain
    $parsed_url = parse_url($_REQUEST['site_url']);
    $_REQUEST['domain'] = preg_replace('~^www\\.~', '', $parsed_url['host']);
    $v = new Validator();
    // Get selected category (if any) and set variables
    if (isset($_REQUEST['category_id'])) {
        $category = $DB->Row('SELECT * FROM `tlx_categories` WHERE `category_id`=? AND `hidden`=0', array($_REQUEST['category_id']));
        if ($category) {
            $C['min_desc_length'] = $category['desc_min_length'];
            $C['max_desc_length'] = $category['desc_max_length'];
            $C['min_title_length'] = $category['title_min_length'];
            $C['max_title_length'] = $category['title_max_length'];
            $C['banner_max_width'] = $category['banner_max_width'];
            $C['banner_max_height'] = $category['banner_max_height'];
            $C['banner_max_bytes'] = $category['banner_max_bytes'];
            $C['allow_redirect'] = $category['allow_redirect'];
        } else {
            $v->SetError($L['INVALID_CATEGORY']);
        }
    }
    // See if username is taken
    if ($DB->Count('SELECT COUNT(*) FROM `tlx_accounts` WHERE `username`=?', array($_REQUEST['username'])) > 0) {
        $v->SetError($L['USERNAME_TAKEN']);
    }
    // Check for duplicate account information
    if ($DB->Count('SELECT COUNT(*) FROM `tlx_accounts` WHERE `site_url`=? OR `email`=? OR `domain`=?', array($_REQUEST['site_url'], $_REQUEST['email'], $_REQUEST['domain'])) > 0) {
        $v->SetError($L['EXISTING_ACCOUNT']);
    }
    $v->Register($_REQUEST['username'], V_LENGTH, $L['USERNAME_LENGTH'], '4,32');
    $v->Register($_REQUEST['username'], V_ALPHANUM, $L['INVALID_USERNAME']);
    $v->Register($_REQUEST['password'], V_LENGTH, $L['PASSWORD_LENGTH'], '4,9999');
    $v->Register($_REQUEST['email'], V_EMAIL, $L['INVALID_EMAIL']);
    $v->Register($_REQUEST['site_url'], V_URL, sprintf($L['INVALID_URL'], $L['SITE_URL']));
    $v->Register($_REQUEST['password'], V_NOT_EQUALS, $L['USERNAME_IS_PASSWORD'], $_REQUEST['username']);
    $v->Register($_REQUEST['password'], V_EQUALS, $L['PASSWORDS_DONT_MATCH'], $_REQUEST['confirm_password']);
    if (!IsEmptyString($_REQUEST['banner_url'])) {
        $v->Register($_REQUEST['banner_url'], V_URL, sprintf($L['INVALID_URL'], $L['BANNER_URL']));
    }
    // Format keywords and check number
    if ($C['allow_keywords']) {
        $_REQUEST['keywords'] = FormatSpaceSeparated($_REQUEST['keywords']);
        $keywords = explode(' ', $_REQUEST['keywords']);
        $v->Register(count($keywords), V_LESS_EQ, sprintf($L['MAXIMUM_KEYWORDS'], $C['max_keywords']), $C['max_keywords']);
    } else {
        $_REQUEST['keywords'] = null;
    }
    // Verify captcha code
    if ($C['account_add_captcha']) {
        VerifyCaptcha($v);
    }
    // Initial validation
    if (!$v->Validate()) {
        return $v->ValidationError('tlxShAccountAdd', TRUE);
    }
    // Check if the site URL is working
    $http = new Http();
    if ($http->Get($_REQUEST['site_url'], $C['allow_redirect'])) {
        $_REQUEST['html'] = $http->body;
        $_REQUEST['headers'] = $http->raw_response_headers;
    } else {
        $v->SetError(sprintf($L['BROKEN_URL'], $_REQUEST['site_url'], $http->errstr));
    }
    // Check the blacklist
    $blacklisted = CheckBlacklistAccount($_REQUEST);
    if ($blacklisted !== FALSE) {
        $v->SetError(sprintf($blacklisted[0]['reason'] ? $L['BLACKLISTED_REASON'] : $L['BLACKLISTED'], $blacklisted[0]['match'], $blacklisted[0]['reason']));
    }
    // Check site title and description length
    $v->Register($_REQUEST['title'], V_LENGTH, sprintf($L['TITLE_LENGTH'], $C['min_title_length'], $C['max_title_length']), "{$C['min_title_length']},{$C['max_title_length']}");
    $v->Register($_REQUEST['description'], V_LENGTH, sprintf($L['DESCRIPTION_LENGTH'], $C['min_desc_length'], $C['max_desc_length']), "{$C['min_desc_length']},{$C['max_desc_length']}");
    // Validation of user defined fields
    $fields =& GetUserAccountFields();
    foreach ($fields as $field) {
        if ($field['on_create']) {
            if ($field['required_create']) {
                $v->Register($_REQUEST[$field['name']], V_EMPTY, sprintf($L['REQUIRED_FIELD'], $field['label']));
            }
            if (!IsEmptyString($_REQUEST[$field['name']]) && $field['validation']) {
                $v->Register($_REQUEST[$field['name']], $field['validation'], $field['validation_message'], $field['validation_extras']);
            }
        }
    }
    // Download banner to check size
    $banner_file = null;
    if (!IsEmptyString($_REQUEST['banner_url']) && ($C['download_banners'] || $C['host_banners'])) {
        $http = new Http();
        if ($http->Get($_REQUEST['banner_url'], TRUE, $_REQUEST['site_url'])) {
            $banner_file = SafeFilename("{$C['banner_dir']}/{$_REQUEST['username']}.jpg", FALSE);
            FileWrite($banner_file, $http->body);
            $banner_info = @getimagesize($banner_file);
            if ($banner_info !== FALSE) {
                $_REQUEST['banner_width'] = $banner_info[0];
                $_REQUEST['banner_height'] = $banner_info[1];
                if (filesize($banner_file) > $C['banner_max_bytes']) {
                    $v->SetError(sprintf($L['BAD_BANNER_BYTES'], $C['banner_max_bytes']));
                }
                if ($C['host_banners']) {
                    if (isset($IMAGE_EXTENSIONS[$banner_info[2]])) {
                        $banner_ext = strtolower($IMAGE_EXTENSIONS[$banner_info[2]]);
                        if ($banner_ext != 'jpg') {
                            $new_file = preg_replace('~\\.jpg$~', ".{$banner_ext}", $banner_file);
                            rename($banner_file, $new_file);
                            $banner_file = $new_file;
                        }
                        $_REQUEST['banner_url_local'] = "{$C['banner_url']}/{$_REQUEST['username']}.{$banner_ext}";
                    } else {
                        $v->SetError($L['BAD_BANNER_IMAGE']);
                    }
                } else {
                    @unlink($banner_file);
                    $banner_file = null;
                }
            } else {
                $v->SetError($L['BAD_BANNER_IMAGE']);
            }
        } else {
            $v->SetError(sprintf($L['BROKEN_URL'], $_REQUEST['banner_url'], $http->errstr));
        }
    }
    // Check banner dimensions
    if ($_REQUEST['banner_width'] > $C['banner_max_width'] || $_REQUEST['banner_height'] > $C['banner_max_height']) {
        $v->SetError(sprintf($L['BAD_BANNER_SIZE'], $C['banner_max_width'], $C['banner_max_height']));
    }
    // Force banner dimensions
    if ($C['banner_force_size']) {
        $_REQUEST['banner_width'] = $C['banner_max_width'];
        $_REQUEST['banner_height'] = $C['banner_max_height'];
    }
    if (!$v->Validate()) {
        if (!empty($banner_file)) {
            @unlink($banner_file);
        }
        return $v->ValidationError('tlxShAccountAdd', TRUE);
    }
    $_REQUEST['status'] = STATUS_ACTIVE;
    $email_template = 'email-account-added.tpl';
    if ($C['confirm_accounts']) {
        $_REQUEST['status'] = STATUS_UNCONFIRMED;
        $email_template = 'email-account-confirm.tpl';
        $confirm_id = md5(uniqid(rand(), true));
        $t->assign('confirm_url', "{$C['install_url']}/accounts.php?r=confirm&id={$confirm_id}");
        $DB->Update('INSERT INTO `tlx_account_confirms` VALUES (?,?,?)', array($_REQUEST['username'], $confirm_id, MYSQL_NOW));
    } else {
        if ($C['review_new_accounts']) {
            $_REQUEST['status'] = STATUS_PENDING;
            $email_template = 'email-account-pending.tpl';
        }
    }
    // Add account information
    $DB->Update('INSERT INTO `tlx_accounts` VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', array($_REQUEST['username'], $_REQUEST['email'], $_REQUEST['site_url'], $_REQUEST['domain'], $_REQUEST['banner_url'], $_REQUEST['banner_url_local'], $_REQUEST['banner_height'], $_REQUEST['banner_width'], $_REQUEST['title'], $_REQUEST['description'], $_REQUEST['keywords'], MYSQL_NOW, $_REQUEST['status'] == STATUS_ACTIVE ? MYSQL_NOW : null, MYSQL_NOW, sha1($_REQUEST['password']), $C['return_percent'], $_REQUEST['status'], 0, 0, 0, $_REQUEST['category_id'], null, null, 0, 0, 0, null, null));
    // Create stats tracking data
    $stats_data = array_merge(array($_REQUEST['username']), array_fill(0, 127, 0));
    $DB->Update('INSERT INTO `tlx_account_hourly_stats` VALUES (' . CreateBindList($stats_data) . ')', $stats_data);
    // Insert user defined database fields
    $query_data = CreateUserInsert('tlx_account_fields', $_REQUEST);
    $DB->Update('INSERT INTO `tlx_account_fields` VALUES (' . $query_data['bind_list'] . ')', $query_data['binds']);
    // Assign template values
    $_REQUEST['category'] = $category['name'];
    $t->assign_by_ref('account', $_REQUEST);
    $t->assign_by_ref('user_fields', $fields);
    $t->assign('tracking_url', $C['tracking_mode'] == 'unique_link' ? "{$C['in_url']}?id={$_REQUEST['username']}" : $C['in_url']);
    // Send e-mail to account submitter
    if ($C['confirm_accounts'] || $C['email_new_accounts']) {
        SendMail($_REQUEST['email'], $email_template, $t);
    }
    // Send e-mail to administrators
    $administrators =& $DB->FetchAll('SELECT * FROM `tlx_administrators`');
    foreach ($administrators as $administrator) {
        if ($administrator['notifications'] & E_ACCOUNT_ADDED) {
            SendMail($administrator['email'], 'email-admin-account-added.tpl', $t);
        }
    }
    // Display confirmation page
    $t->display('accounts-added.tpl');
}
コード例 #15
0
 function ChangeStaInfo($FileList, $OS, $Browser, $Robots)
 {
     //获取文件数
     $MaxLine = sizeof($FileList);
     //更新数据
     for ($i = 1; $i <= $MaxLine; $i++) {
         $FileContent = FileToArray($FileList[$i]);
         $TempStaNum = explode(_SysStr_, $FileContent[1]);
         $TempStaNum[1] += 1;
         $FileContent[1] = implode(_SysStr_, $TempStaNum);
         $TempStaOS = explode(_SysStr_, $FileContent[2]);
         if ($OS != "0") {
             $TempStaOS[$OS] += 1;
         }
         $FileContent[2] = implode(_SysStr_, $TempStaOS);
         $TempStaBrowser = explode(_SysStr_, $FileContent[3]);
         if ($Browser != "0") {
             $TempStaBrowser[$Browser] += 1;
         }
         $FileContent[3] = implode(_SysStr_, $TempStaBrowser);
         $TempStaRobots = explode(_SysStr_, $FileContent[4]);
         if ($Robots != "0") {
             $TempStaRobots[$Robots] += 1;
         }
         $FileContent[4] = implode(_SysStr_, $TempStaRobots);
         $NewStaInfo = $FileContent[0] . $FileContent[1] . $FileContent[2] . $FileContent[3] . $FileContent[4];
         FileWrite($FileList[$i], "w", $NewStaInfo);
     }
 }
コード例 #16
0
ファイル: common.php プロジェクト: Cyberspace-Networks/TGPX
function FileCreate($file)
{
    if (!file_exists($file)) {
        FileWrite($file, '');
    }
}
コード例 #17
0
ファイル: index.php プロジェクト: hackingman/ToplistX
function tlxLanguageFileSave()
{
    global $DB, $C, $L;
    VerifyAdministrator();
    if (is_writable("{$GLOBALS['BASE_DIR']}/includes/language.php")) {
        $language = "<?PHP\n";
        foreach ($L as $key => $value) {
            $L[$key] = $_REQUEST[$key];
            $value = str_replace("'", "\\'", $_REQUEST[$key]);
            $language .= "\$L['{$key}'] = '{$value}';\n";
        }
        $language .= "?>";
        FileWrite("{$GLOBALS['BASE_DIR']}/includes/language.php", $language);
        $GLOBALS['message'] = 'The language file has been successfully updated';
    }
    tlxShLanguageFile();
}