예제 #1
0
function fs_rebuild_cache_desc($value)
{
    switch ($value) {
        case 0:
            return fs_r("Recalculating matching bots");
            break;
        default:
            return "Unsupported step number : {$value}";
    }
}
예제 #2
0
function fs_set_current_ip2c_db_version($version)
{
    $name = FS_ABS_PATH . "/lib/ip2c/db.version";
    $f = @fopen($name, "w");
    if (!$f) {
        return sprintf(fs_r('Error opening %s'), $name);
    }
    fputs($f, $version);
    return '';
}
예제 #3
0
isset($site_id) ? fs_e('Edit site') : fs_e('Create a new site');
?>
</h3>
	<table>
		<tr>
			<td><label for='new_username'><?php 
fs_e('ID');
?>
</label></td>
			<td>
				<input type="hidden" id="original_site_id" value="<?php 
echo isset($site_id) ? $site_id : fs_r('Automatic');
?>
"/>
				<input type="text" id="site_edit_id" onkeypress="$('fs_clear_site_id').style.display='inline'" onfocus="this.select()" value="<?php 
echo isset($site_id) ? $site_id : fs_r('Automatic');
?>
"/>
				<?php 
fs_create_wiki_help_link('SiteID');
?>
				<input id="fs_clear_site_id" style="display:none" type='image' title="<?php 
fs_e('Clear');
?>
" class='img_btn' src="<?php 
echo fs_url("img/clear.png");
?>
"
					onclick="FS.clearSiteID()"
				/>
			</td>
예제 #4
0
<?php

header('Content-type: text/html; charset=utf-8');
require_once dirname(__FILE__) . '/init.php';
require_once FS_ABS_PATH . '/php/html-utils.php';
require_once FS_ABS_PATH . '/php/db-sql.php';
$user = fs_get_user($_GET['user_id']);
if ($user === false) {
    die(fs_db_error());
}
if ($user === null) {
    die(fs_r("No such user"));
}
$arr = array();
$arr[] = fs_mkPair(1, fs_r('Administrator'));
$arr[] = fs_mkPair(2, fs_r('User'));
?>
<div class='<?php 
echo fs_lang_dir();
?>
'>
	<h3><?php 
fs_e('Edit user');
?>
</h3>
	<table>
		<tr>
			<td><label for='new_username'><?php 
fs_e('User name');
?>
</label></td>
예제 #5
0
파일: db-sql.php 프로젝트: alx/blogsfera
function fs_botlist_import($file, $remove_existing)
{
    $lines = @file($file);
    if ($lines === false) {
        return sprintf(fs_r('Error opening file : %s'), "<b>{$file}</b>");
    }
    return fs_botlist_import_array($lines, $remove_existing);
}
예제 #6
0
파일: header.php 프로젝트: alx/blogsfera
        ?>
		<button class="button" onclick="sendRequest('action=logout')">
			<?php 
        fs_e('Log out');
        ?>
		</button>
		<?php 
    }
    ?>
		</span>
	<?php 
}
$home = FS_HOMEPAGE;
echo "<a style='border-bottom: 0px' href='{$home}'><img alt='" . fs_r('FireStats') . "' src='" . fs_url("img/firestats-header.png") . "'/></a>";
echo '<span class="normal_font" style="padding-left:10px">';
echo sprintf("%s %s\n", FS_VERSION, fs_is_demo() ? fs_r('Demo') : '');
if (fs_is_admin()) {
    echo "<!-- Checking if there is a new FireStats version, if FireStats hangs refresh the page -->\n";
    flush();
    echo fs_get_latest_firestats_version_message() . "\n";
    echo "<!-- Checking if there is a new IP2Country database, if FireStats hangs refresh the page -->\n";
    flush();
    echo '<span id="new_ip2c_db_notification">' . fs_get_latest_ip2c_db_version_message() . "</span>";
}
echo '</span>';
?>
</h1>


<div id="feedback_div">
<button class="button" onclick="hideFeedback();"><?php 
예제 #7
0
	saveOptionImpl(optionName, $F(inputID), type, update, "system");
}

function saveOptionImpl(optionName, txt, type, update, dest)
{
	var output = txt;
	var parsed = true;
	switch (type)
	{
	case 'positive_num':
		var n = parseInt(txt);
		parsed = n && n >= 0;
		if (!parsed)
		{
			showError("<?php 
print fs_r("Not a positive number : ");
?>
" + txt);
		}
		break;
	case 'boolean':
		output = (txt == 'on' || txt == 'yes' || txt == 'true') ? 'true' : 'false';
		break;
	case 'string':
		break;
	default:
		showError('JS:unsupported type ' + type);
		return;
	}

	if (parsed)
예제 #8
0
            if ($res === true) {
                echo "<div class='info'>" . fs_r("Email sent") . "</div>";
            } else {
                echo "<div class='error'>" . fs_r("Failed to send email") . "</div>";
            }
        } else {
            echo "<div class='error'>" . $user . "</div>";
        }
    }
    ?>
 <?php 
} else {
    if (isset($_GET['reset'])) {
        $res = fs_resume_user_session();
        if ($res !== true) {
            echo "<div class='error'>" . sprintf(fs_r("Failed, maybe too much time have passed since you generated the email? %s"), fs_link("tools.php?file_id=reset_password", fs_r("try again"))) . "</div>";
        } else {
            ?>
<script type="text/javascript">
//<![CDATA[
FS.changePassword = function(id)
{
	var user = $F('username');
	var pass1 = $F('new_password');
	var pass2 = $F('new_password_verify');
	var request = 'action=changePassword&id='+id+'&username='******'&pass1='+pass1+'&pass2='+pass2;
	sendRequest(request);
}
//]]>
</script> 
<table>
예제 #9
0
function fs_get_powered_by($css_class)
{
    $img = fs_url("img/firestats-icon-small.png");
    $firestats_url = FS_HOMEPAGE;
    $powered = "<img alt='FireStats icon' src='{$img}'/><a href='{$firestats_url}'>&nbsp;" . fs_r("Powered by FireStats") . '</a>';
    return "<span class='{$css_class}'>{$powered}</span>";
}
예제 #10
0
function fs_ajax_change_password(&$response)
{
    $id = $_POST['id'];
    $username = $_POST['username'];
    $pass1 = !empty($_POST['pass1']) ? $_POST['pass1'] : null;
    $pass2 = !empty($_POST['pass2']) ? $_POST['pass2'] : null;
    if (empty($username)) {
        return ajax_error($response, fs_r("User name not specified"));
    }
    if ($pass1 !== $pass2) {
        return ajax_error($response, fs_r("Passwords did not match"));
    }
    if (empty($pass1)) {
        return ajax_error($response, fs_r("Empty password"));
    }
    // not translated
    require_once FS_ABS_PATH . '/php/auth.php';
    $res = fs_change_password($id, $username, $pass1);
    if ($res !== true) {
        return ajax_error($response, $res);
    } else {
        $base = fs_get_absolute_url(dirname(dirname($_SERVER['REQUEST_URI'])));
        $response['redirect'] = $base;
    }
}
예제 #11
0
파일: footer.php 프로젝트: alx/blogsfera
<div class="fwrap" style="text-align:center; margin: 0 auto">
	<?php 
$helpStr = sprintf(fs_r("If you have any problems or questions, please visit the %s"), sprintf("<a href='%s'>%s</a>", FS_HOMEPAGE, fs_r("FireStats homepage")));
echo fs_r('FireStats') . ' ' . FS_VERSION . "<br/>{$helpStr}";
?>
</div>
</div> <!-- fs_body -->
</div><!-- firestats -->
예제 #12
0
function fs_get_config_source_desc()
{
    $db_config_type = fs_get_db_config_type();
    switch ($db_config_type) {
        case FS_DB_CONFIG_UNAVAILABLE:
            $cfg_source = fs_r('Not configured');
            break;
        case FS_DB_CONFIG_FILE:
            $cfg_source = fs_r('FireStats configuration file');
            break;
        case FS_DB_CONFIG_WORDPRESS:
            $cfg_source = fs_r('Wordpress configuration file');
            break;
    }
    return $cfg_source;
}
예제 #13
0
function fs_get_time_range_dropbox($key, $onchange)
{
    $arr = array();
    $arr[] = fs_mkPair(1, fs_r('the last 24 hours'));
    $arr[] = fs_mkPair(7, fs_r('the last week'));
    $arr[] = fs_mkPair(30, fs_r('the last month'));
    $arr[] = fs_mkPair(90, fs_r('the three months'));
    $arr[] = fs_mkPair(180, fs_r('the last six months'));
    $arr[] = fs_mkPair(365, fs_r('the last year'));
    $arr[] = fs_mkPair('ever', fs_r('all time'));
    $arr[] = fs_mkPair('time_range', fs_r('time range'));
    $selected = fs_get_option($key, 90);
    return fs_create_dropbox($arr, $selected, $key, $onchange);
}
예제 #14
0
파일: db-common.php 프로젝트: alx/blogsfera
function fs_db_error($rollback = false)
{
    $fsdb =& fs_get_db_conn();
    $msg = sprintf(fs_r('Database error: %s'), $fsdb->last_error) . '<br/><br/>' . sprintf('SQL Query:<br/>%s', $fsdb->last_query);
    if ($rollback) {
        $fsdb->query("ROLLBACK");
    }
    return $msg;
}
예제 #15
0
    }
    $file = $_FILES['bots_list']['tmp_name'];
    $lines = file($file);
    if (trim($lines[0]) != '# FireStats bots list') {
        echo "<span class='notice'>" . fs_r('Incorrect file format') . "</span><br/>";
        echo "<a href='javascript:history.go(-1)'>Back</a>";
    } else {
        require_once dirname(__FILE__) . '/db-sql.php';
        $ok = true;
        $type = $_POST['import_type'];
        $remove_existing = $type == 'replace';
        $res = fs_botlist_import_array($lines, $remove_existing);
        if ($res != '') {
            echo "<span class='notice'>" . sprintf(fs_r('Error importing bots list : %s'), $res) . "</span><br/>";
            echo "<a href='javascript:history.go(-1)'>Back</a>";
        } else {
            echo fs_r("bots list imported successfully") . "<br/>";
            // update botlist and num excluded
            ?>
			<script language="javascript">
				window.close();
			</script>
			<?php 
        }
    }
}
?>
	</div>
	</body>
</html>
예제 #16
0
function fs_get_archive_dropbox()
{
    $selected = fs_get_archive_older_than();
    $arr = array();
    $arr[] = fs_mkPair(30, fs_r('One month'));
    $arr[] = fs_mkPair(60, fs_r('Two months'));
    $arr[] = fs_mkPair(90, fs_r('Three months'));
    $arr[] = fs_mkPair(180, fs_r('Half a year'));
    $arr[] = fs_mkPair(365, fs_r('One year'));
    $arr[] = fs_mkPair(365 * 2, fs_r('Two years'));
    $onchange = "saveSystemOption('archive_older_than','archive_older_than','positive_num','fs_archive_status')";
    return fs_create_dropbox($arr, $selected, 'archive_older_than', $onchange);
}
예제 #17
0
<br/>
	<?php 
fs_e("This will reduce storage size and improve performance at the cost of losing some information which is not essential.");
?>
<br/>
	<?php 
fs_e("it is highly recommended that you allow FireStats to do this automatically.");
?>
<br/>
	<ul>
		<li><?php 
echo sprintf(fs_r("Click %s if you would like FireStats to automatically compact data older than %s days"), "<b>{$btyes}</b>", fs_get_archive_older_than());
?>
.</li>
		<li><?php 
echo sprintf(fs_r("Click %s if you want to compact data manually or change compacting options (From the Settings tab)"), "<b>{$btno}</b>");
?>
.</li>
	</ul>
	<div align='center' style='padding: 10px'>
		<button class='button' id='archive_manually' onclick='saveSystemOptionValue("archive_method","manual","string");closeParentWindow(this)'><?php 
echo $btno;
?>
</button>
		<span style='padding: 10px'/>
		<button class='button' id='archive_automatically' onclick='saveSystemOptionValue("archive_method","auto","string");closeParentWindow(this)'><?php 
echo $btyes;
?>
</button>
	</div>
</div>
예제 #18
0
function fs_output_database_help()
{
    ?>
<div class="fwrap" id="database_help_panel_div">
	<h2><?php 
    fs_e('Help');
    ?>
</h2>
	<h3><?php 
    fs_e('Attach to an existing FireStats database');
    ?>
</h3>
	<?php 
    echo sprintf(fs_r('Enter the parameters in the table, press %s, and then %s.'), '<b>' . fs_r('Test connection') . '</b>', '<b>' . fs_r('Use this database') . '</b>');
    ?>
	<br/>
	<h3><?php 
    fs_e('Install FireStats into an existing database');
    ?>
</h3>
	<?php 
    echo sprintf(fs_r('Enter the parameters in the table, press %s, and then %s.'), '<b>' . fs_r('Test connection') . '</b>', '<b>' . fs_r('Install tables') . '</b>');
    ?>
	<br/>
	<h3><?php 
    fs_e('Create a new database and install FireStats there');
    ?>
</h3>
	<?php 
    echo sprintf(fs_r('Enter the parameters into the table, <u>you need to enter a database administrator user</u>. press %s, and then enter FireStats database user and password, and finally press %s.'), '<b>' . fs_r('Test connection') . '</b>', '<b>' . fs_r('Create database') . '</b>');
    ?>
</div>
<?php 
}
예제 #19
0
파일: utils.php 프로젝트: alx/blogsfera
function fs_fetch_http_file($url, &$error)
{
    $res = fs_create_http_conn($url);
    if ($res['status'] != 'ok') {
        $error = $res['status'];
        return null;
    } else {
        $http = $res['http'];
        $args = $res['args'];
        $error = $http->Open($args);
        if (!empty($error)) {
            return false;
        }
        $error = $http->SendRequest($args);
        if (!empty($error)) {
            return false;
        }
        $http->ReadReplyHeadersResponse($headers);
        if ($http->response_status != '200') {
            $error = sprintf(fs_r("Server returned error %s for %s"), "<b>{$http->response_status}</b>", "<b>{$url}</b>");
            return false;
        }
        $content = '';
        for (;;) {
            $body = "";
            $error = $http->ReadReplyBody($body, 1000);
            if ($error != "" || strlen($body) == 0) {
                break;
            }
            $content .= $body;
        }
        return $content;
    }
}
예제 #20
0
<h3><?php 
fs_e("FireStats tools");
?>
</h3>
<ul>
	<li><?php 
echo fs_link("tools.php?file_id=system_test", fs_r("System test"));
?>
</li>
	<li><?php 
echo fs_link("tools.php?file_id=reset_password", fs_r("Reset password"));
?>
</li>
	<li><?php 
echo fs_link("tools.php?file_id=manage_users", fs_r("Manage users"));
?>
</li>
</ul>
예제 #21
0
<?php

require_once dirname(__FILE__) . '/init.php';
require_once dirname(__FILE__) . '/db-sql.php';
$res = fs_get_bots();
if ($res !== false) {
    header('Content-disposition: attachment; filename=botlist.txt');
    echo "# FireStats bots list\n";
    echo "# Generated at " . date("D M j G:i:s T Y") . "\n";
    if ($res) {
        foreach ($res as $r) {
            echo $r['wildcard'] . "\n";
        }
    }
} else {
    fs_r("Error exporting bots list");
}
예제 #22
0
function fs_extract_zip_ip2c_database($zipFile, &$bin_file)
{
    require_once FS_ABS_PATH . "/lib/unzip/dUnzip2.inc.php";
    ob_start();
    $zip = new dUnzip2($zipFile);
    $dir = $GLOBALS['FS_TEMP_DIR'];
    $zip->unzipAll($dir);
    $tempName2 = tempnam($dir, "fs_ip2c_");
    if (!$tempName2) {
        return fs_r('Error creating temporary file');
    }
    $zip->unzip("ip-to-country.bin", $tempName2);
    $output = ob_get_clean();
    if ($output != '') {
        return $output;
    }
    $bin_file = $tempName2;
    return '';
}
예제 #23
0
파일: auth.php 프로젝트: alx/blogsfera
function fs_update_user($id, $username, $email, $password, $security_level)
{
    if (!fs_is_admin()) {
        return "Access denied : fs_update_user";
    }
    if (!fs_validate_email_address($email)) {
        return fs_r("Invalid email address");
    }
    $fsdb =& fs_get_db_conn();
    $users = fs_users_table();
    $id = $fsdb->escape($id);
    $username = $fsdb->escape($username);
    $email = $fsdb->escape($email);
    $security_level = $fsdb->escape($security_level);
    $r = $fsdb->get_var("SELECT COUNT(*) FROM `{$users}` WHERE `username` = {$username} AND `id` != {$id}");
    if ($r === false) {
        return fs_db_error();
    }
    if ((int) $r > 0) {
        return fs_r("A user with this name already exists");
    }
    $r = $fsdb->get_var("SELECT COUNT(*) FROM `{$users}` WHERE `email` = {$email} AND `id` != {$id}");
    if ($r === false) {
        return fs_db_error();
    }
    if ((int) $r > 0) {
        return fs_r("A user with this email address already exists");
    }
    if (empty($password)) {
        $sql = "UPDATE `{$users}` set `username`={$username},`email`={$email} ,`security_level`={$security_level} WHERE `id` = {$id}";
    } else {
        $password = $fsdb->escape($password);
        $sql = "UPDATE `{$users}` set `username`={$username},`password`=MD5({$password}),`email`={$email} ,`security_level`={$security_level} WHERE `id` = {$id}";
    }
    $r = $fsdb->query($sql);
    if ($r === false) {
        return fs_db_error();
    }
    return true;
}
예제 #24
0
<?php

$enabled = false;
require_once dirname(dirname(__FILE__)) . "/init.php";
require_once FS_ABS_PATH . "/php/html-utils.php";
if (!$enabled) {
    $msg = "<h3>" . fs_r("Message") . "</h3>";
    $msg .= fs_r("This page will allow you to change the password of any user in FireStats.") . "<br/>";
    $msg .= sprintf(fs_r("For security reasons, you must first edit the file %s"), "<b>" . __FILE__ . "</b>") . "<br/>";
    $msg .= sprintf(fs_r("and change the line %s to %s and then refresh this page."), "<b>\$enabled = false;</b>", "<b>\$enabled = true;</b>") . "<br/>";
    $msg .= fs_r("Don't forget to change it back when you are done.") . "<br/>";
    fs_show_page($msg, false);
} else {
    echo sprintf("%s Don't forget to change the line back to %s when you are done.", sprintf("<b>%s:</b>", fs_r("IMPORTANT")), "<b>\$enabled = false;</b>") . "<br/>";
    $user = new stdClass();
    $user->name = "Admin";
    $user->id = 1;
    $user->security_level = SEC_ADMIN;
    fs_start_user_session($user);
    fs_show_page(FS_ABS_PATH . "/php/page-users.php");
}
예제 #25
0
function fs_output_sysinfo_information()
{
    $sysinfo = fs_r('System information');
    $you_can_help = fs_r('You can help by sending anonymous system information that will help make better decisions about new features') . ".";
    $line1 = fs_r('The information will be sent anonymously, but a unique identifier will be sent to prevent duplicate entries from the same FireStats');
    echo "<h3>{$sysinfo}</h3>{$you_can_help}<br/>{$line1}.";
}
예제 #26
0
파일: index.php 프로젝트: alx/blogsfera
<?php

/*
This file is the standalone entry point for FireStats
Its not called when FireStats is installed inside WordPress or other systems
*/
require_once dirname(__FILE__) . '/php/init.php';
require_once dirname(__FILE__) . '/php/utils.php';
require_once dirname(__FILE__) . '/php/html-utils.php';
if (fs_in_wordpress()) {
    // security check.
    // prevent uncontroled access to FireStats installed inside another system
    $msg = "<h3>" . fs_r('Error') . "</h3>" . fs_r('Access denied');
    fs_show_page($msg, false, false);
    return;
}
require_once FS_ABS_PATH . '/php/auth.php';
require_once FS_ABS_PATH . '/php/db-common.php';
$db = fs_get_db_status();
if ($db['status'] != FS_DB_VALID) {
    $show_db = false;
    switch ($db['status']) {
        case FS_DB_NOT_INSTALLED:
        case FS_DB_NOT_CONFIGURED:
            $show_db = true;
            break;
        case FS_DB_NEED_UPGRADE:
            if ($db['status'] == FS_DB_NEED_UPGRADE && $db['ver'] < 11) {
                $show_db = true;
            }
            break;
예제 #27
0
<?php

header('Content-type: text/html; charset=utf-8');
require_once dirname(__FILE__) . '/init.php';
require_once FS_ABS_PATH . '/php/html-utils.php';
require_once FS_ABS_PATH . '/php/db-sql.php';
$user = fs_get_user($_GET['user_id']);
if ($user === false) {
    die(fs_db_error());
}
if ($user === null) {
    die(fs_r("No such user"));
}
?>
<div class='<?php 
echo fs_lang_dir();
?>
'>
	<h3><?php 
fs_e('Delete user');
?>
</h3>
	<table>
		<tr>
			<td colspan='2'><?php 
fs_e("Are you sue you want to delete the user <b>{$user->username}</b>?");
?>
</td>
		</tr>
		<tr>
			<td colspan='2'>
예제 #28
0
			<h3><?php 
    fs_e('Permissions');
    ?>
</h3>
			<?php 
    fs_e("Select the minimum user role that can access FireStats (Only administrators can manage FireStats)");
    ?>
<br/>
			<?php 
    $selected = fs_get_local_option('firestats_min_view_security_level', 3);
    $arr = array();
    $arr[] = fs_mkPair(5, fs_r('Administrator'));
    $arr[] = fs_mkPair(4, fs_r('Editor'));
    $arr[] = fs_mkPair(3, fs_r('Author'));
    $arr[] = fs_mkPair(2, fs_r('Contributor'));
    $arr[] = fs_mkPair(1, fs_r('Subscriber'));
    $onchange = "saveLocalOption('wordpress_view_security_level','firestats_min_view_security_level','string')";
    echo fs_create_dropbox($arr, $selected, 'wordpress_view_security_level', $onchange);
    ?>
		</td>
	</tr>
	<tr>
		<td class="config_cell" colspan="2">
			<h3><?php 
    fs_e('Advanced');
    ?>
</h3>
			<?php 
    fs_e('WordPress site ID, every hit From this blog is recorded with this as the source Site ID');
    ?>
<br />
예제 #29
0
function fs_get_help_str($typeStr, $link)
{
    return sprintf(fs_r("To collect statistics from your %s site your need to install the %s"), $typeStr, $link);
}
예제 #30
0
</td>
    <td><button class="button" id="rebuild_countries_button" onclick="FS.executeProcess('rebuild_countries')"><?php 
fs_e("Start");
?>
</button></td>
    <td><span id="rebuild_countries_process_progress"></span></td>
  </tr>
  <tr>
    <td><?php 
fs_e('Rebuild database cache') . " : ";
?>
</td>
    <td><button class="button" id="rebuild_cache_button" onclick="FS.executeProcess('rebuild_cache')"><?php 
echo fs_r("Start");
?>
</button></td>
    <td><span id="rebuild_cache_process_progress"></span></td>
  </tr>
  <tr>
    <td><?php 
fs_e('Recalculate search engine terms') . " : ";
?>
</td>
    <td><button class="button" id="recalculate_search_engine_terms_button" onclick="FS.executeProcess('recalculate_search_engine_terms')"><?php 
echo fs_r("Start");
?>
</button></td>
    <td><span id="recalculate_search_engine_terms_process_progress"></span></td>
  </tr>
</table>