Beispiel #1
0
function fs_install($upgrade_if_needed = false)
{
    $fp = fopen(__FILE__, "r");
    if (!$fp) {
        return "Error opening lock file";
    }
    if (flock($fp, LOCK_EX + LOCK_NB) == FALSE) {
        fs_e("Operation already in progress");
        return false;
    }
    $fsdb =& fs_get_db_conn();
    if (!isset($fsdb)) {
        die('db object not initialized');
    }
    $res = fs_install_impl($fsdb, $upgrade_if_needed);
    flock($fp, LOCK_UN);
    return $res;
}
Beispiel #2
0
		</tr>
		<tr>
			<td><label for="admin_email"><?php 
fs_e('Email');
?>
</label></td>
			<td><input type="text" size="30" id="admin_email" value=""/></td>
		</tr>
		<tr>
			<td><label for="admin_password"><?php 
fs_e('Password');
?>
</label></td>
			<td><input type="password" size="30" id="admin_password" onkeypress="return trapEnter(event,'createAdmin()')" value="" /></td>
		</tr>
		<tr>
			<td><label for="admin_password_verify"><?php 
fs_e('Verify password');
?>
</label></td>
			<td><input type="password" size="30" id="admin_password_verify" onkeypress="return trapEnter(event,'createAdmin()')" value="" /></td>
		<tr>
			<td></td>
			<td><button id="create_admin" class="button" onclick="createAdmin()"><?php 
fs_e('Create user');
?>
</button></td>
		</tr>
	</table>
</div>
?>
'>
	<h3><?php 
fs_e('Compacting old data');
?>
</h3>
	<?php 
fs_e("FireStats can tranform old data to a more compact form,");
?>
<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;
Beispiel #4
0
				<table>
					<thead>
						<tr><td><h3><?php 
    fs_e('Excluded IPs');
    ?>
</h3></td></tr>
					</thead>
					<tr>
						<td>
							<input type="text" onkeypress="return trapEnter(event,'addExcludedIP();');" id="excluded_ip_text" style="width:120px"/>
							<button class="button" onclick="addExcludedIP()"><?php 
    fs_e('Add');
    ?>
</button>
							<button class="button" onclick="removeExcludedIP()"><?php 
    fs_e('Remove');
    ?>
</button>
						</td>
					</tr>
					<tr>
						<td>
							<div id="exclude_ip_placeholder"><?php 
    echo fs_get_excluded_ips_list();
    ?>
</div>
						</td>
					</tr>
				</table>
			</td>
	</tr>
Beispiel #5
0
			<?php 
    fs_e('Import type');
    ?>
 :
			<select name="import_type">
				<option value="append"><?php 
    fs_e('Add to bots list');
    ?>
</option>
				<option value="replace"><?php 
    fs_e('Replace bots list');
    ?>
</option>
			</select><br/>
			<input type="submit" value="<?php 
    fs_e("Send File");
    ?>
" /><br/>
		</form>	
<?php 
} else {
    if (!is_uploaded_file($_FILES['bots_list']['tmp_name'])) {
        echo "<span class='error'>Possible file upload attack</span><br/>";
        return;
    }
    $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 {
Beispiel #6
0
function fs_show_page($page, $is_file = true, $add_firestats_js = true, $hide_support_fs = false)
{
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><?php 
    fs_e('FireStats');
    ?>
</title>
	<?php 
    fs_output_head();
    ?>
</head>
<body>
	<?php 
    if ($hide_support_fs) {
        global $fs_hide_support_button;
        $fs_hide_support_button = true;
    }
    require FS_ABS_PATH . "/php/header.php";
    echo "\n";
    if ($is_file) {
        echo "<!-- PAGE : {$page} -->\n";
        require $page;
    } else {
        echo $page;
    }
    echo "\n";
    require FS_ABS_PATH . "/php/footer.php";
    ?>
</body>
</html>
	<?php 
}
Beispiel #7
0
	<!-- Use table for base layout -->
	<table>
		<tr>
			<td>
				<div id="fs_users_table_holder" class="fwrap">
					<h2><?php 
fs_e('Manage users');
?>
</h2>
					<div id="fs_users_table">
						<?php 
echo fs_get_users_manage_table();
?>
					</div>
				</div>
			</td>
			<td>
				<div id="fs_users_tab_help" class="fwrap">
					<h2><?php 
fs_e('Help');
?>
</h2>
					<?php 
fs_e('You can manage users here');
?>
				</div>
			</td>
		</tr>
	</table>
</div>
Beispiel #8
0
    ?>
		</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 
fs_e('Hide');
?>
</button>
<span id="feedback_zone"></span>
</div><!-- feedback_div -->

<div id="network_status"></div>
Beispiel #9
0
    function fs_popular_pages_widget_control()
    {
        // Get our options and see if we're handling a form submission.
        $options = get_option('firestats_popular_pages_widget');
        if (empty($options)) {
            $options = array('title' => fs_r("Popular posts"), 'num_to_show' => 10, 'days_ago' => 90, 'hide_logo2' => false);
        }
        if ($_POST['firestats-submit']) {
            $hide_logo = $_POST['hide_logo2'] == 'on';
            // Remember to sanitize and format use input appropriately.
            $options['title'] = strip_tags(stripslashes(isset($_POST['firestats-title2']) ? $_POST['firestats-title2'] : $options['title']));
            $options['num_to_show'] = strip_tags(stripslashes(isset($_POST['num_to_show']) ? $_POST['num_to_show'] : $options['num_to_show']));
            $options['days_ago'] = strip_tags(stripslashes(isset($_POST['days_ago2']) ? $_POST['days_ago2'] : $options['days_ago']));
            $options['hide_logo2'] = $hide_logo;
            if (!is_numeric($options['num_to_show'])) {
                $options['num_to_show'] = 10;
            }
            if (!is_numeric($options['days_ago']) && !empty($options['days_ago'])) {
                $options['days_ago'] = 90;
            }
            update_option('firestats_popular_pages_widget', $options);
            delete_option('cached_firestats_popular_pages');
        }
        // Be sure you format your options to be valid HTML attributes.
        $title = htmlspecialchars($options['title'], ENT_QUOTES);
        $num_to_show = htmlspecialchars($options['num_to_show'], ENT_QUOTES);
        $days_ago = htmlspecialchars($options['days_ago'], ENT_QUOTES);
        $buttontext = htmlspecialchars($options['buttontext'], ENT_QUOTES);
        $hide_logo = $options['hide_logo2'];
        // Here is our little form segment. Notice that we don't need a
        // complete form. This will be embedded into the existing form.
        ?>
		<table>
			<tr>
				<td><label for="firestats-title2"><?php 
        fs_e('Title:');
        ?>
</label></td>
				<td><input style="width: 200px;" id="firestats-title2" name="firestats-title2" type="text" value="<?php 
        echo $title;
        ?>
"/></td>
			</tr>
			<tr>
				<td><label for="num_to_show"><?php 
        fs_e('Number to show');
        ?>
</label></td>
				<td><input style="width: 200px;" id="num_to_show" name="num_to_show" type="text" value="<?php 
        echo $num_to_show;
        ?>
"/></td>
			</tr>
			<tr>
				<td><label for="days_ago"><?php 
        fs_e('Days ago (Empty for all time)');
        ?>
</label></td>
				<td><input style="width: 200px;" id="days_ago2" name="days_ago2" type="text" value="<?php 
        echo $days_ago;
        ?>
"/></td>
			</tr>
			<tr>
				<td colspan="2">
				<input id="hide_logo2" name="hide_logo2" type="checkbox" <?php 
        echo $hide_logo ? "checked='checked'" : "";
        ?>
/>
				<label for="hide_logo2"><?php 
        fs_e('Hide FireStats logo');
        ?>
</label>
				</td>
			</tr>
		</table>
	    <input type="hidden" id="firestats-submit" name="firestats-submit" value="1" />
		<?php 
    }
Beispiel #10
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 
}
?>
</li>
		<?php 
if (!defined('FS_SYSINFO_HIDE_CANCEL_INFO')) {
    ?>
		<li><?php 
    fs_e('You can change this later from the Tools tab');
    ?>
</li>
		<?php 
}
?>
	</ul>
		
	<?php 
fs_e("Do you agree to send anonymous system information?");
?>
	<div class='fs_bottom_panel' style='margin-top:25px'>
		<button id='fs_send_sysinfo_yes' class='button' onclick="saveSystemOptionValue('user_agreed_to_send_system_information','true' ,'boolean');closeParentWindow(this);">
			<?php 
fs_e("Sure, send system information");
?>
		</button>
		<button id='fs_send_sysinfo_no'  class='button' onclick="saveSystemOptionValue('user_agreed_to_send_system_information','false','boolean');closeParentWindow(this);">
			<?php 
fs_e("Nope, don't send");
?>
		</button>
	</div>
</div>
Beispiel #12
0
    else
    {
        showError('<?php 
fs_e("Invalid IP address");
?>
' + ": " + ip);
    }
}

function removeExcludedIP()
{
    var index = $('exclude_ip_table').selectedIndex;
    if (index == -1)
    {
        showError("<?php 
fs_e('You need to select an IP address you want to remove from the table');
?>
");
    }
    else
    {
        var ip = $F('exclude_ip_table');
        var params = 'action=' + 'removeExcludedIP' + '&ip=' +ip;
        sendRequest(params);
    }
}


function changeLanguage()
{
    sendRequest('action=changeLanguage&language=' + $F('language_code'));
Beispiel #13
0
echo fs_get_option('firestats_ht_useragent_filter');
?>
"/>
			</td>
			<td>
				<button class="button" 
					onclick="clearOptions('firestats_ht_ip_filter,firestats_ht_url_filter,firestats_ht_referrer_filter,firestats_ht_useragent_filter',true,'records_table')">
					<?php 
fs_e('Clear');
?>
				</button>
				<button class="button"
					onclick="applyFilters()"
				>
				<?php 
fs_e('Apply');
?>
				</button>
			</td>
		</tr>
		</table>
		

	</div>
	<div id="records_table">--</div>
</div> <!-- warp -->
</div> <!-- stats_area -->
<?php 
function fs_get_ref_order_by_dropbox($key, $onchange)
{
    $arr = array();
Beispiel #14
0
	<tr>
		<td><label for='username'><?php 
        fs_e('User name');
        ?>
</label></td>
		<td><input id='username' name='username' type='text' size="25"></input><br />
		</td>
	</tr>
	<tr>
		<td><label for='email'><?php 
        fs_e('Email address');
        ?>
</label></td>
		<td><input id='email' name='email' type='text' size="25"></input></td>
	</tr>
	<tr>
		<td colspan="2"><input type='submit'
			value='<?php 
        fs_e('Send password reset email');
        ?>
'></input></td>
	</tr>
</table>
</form>
	<?php 
    }
}
?>
</div>
</div>
Beispiel #15
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>
Beispiel #16
0
				try
				{
					eval(exec);
				}
				catch(e)
				{
					showError('Error executing ' + exec);
				}
			}
			
		}
		else if (r.status == 'session_expired')
		{
			disableResponses = true; // ignore futher responses
			alert("<?php 
fs_e('Session expired, press ok to reload');
?>
");
			window.location.reload();
		}
		else
		{
			showError('Unknown response type ' + r.status);
		}
	}
	catch (e)
	{
		showError('error processing response : ' + dump(e));	
	}
}
Beispiel #17
0
    sendRequest(params);

}

function useWordpressDB()
{
    var params = 'action=useWordpressDB';
    sendRequest(params);
}

function upgradeDatabase()
{
	$('upgrade_db').disabled = true;
	$('upgrade_db').innerHTML = '<?php 
fs_e('Upgrading, do not interrupt');
?>
';
    var params = 'action=upgradeDatabase';
    sendRequest(params, function(response)
    {
    	if (response.status == 'error')
    	{
    		$('upgrade_db').disabled = false;
   			$('upgrade_db').innerHTML = '<?php 
fs_e('Upgrade');
?>
';
    	}
    });
}
Beispiel #18
0
		var div = this.tabs[i].div; /* The tab content div */
		
		if (div.className.indexOf('ajax_tab') != -1)
		{
			var children = $(div).childNodes;
			for (var i = 0; i < children.length; i++) 
			{
				if (children[i].nodeName == "#comment")
				{
					var command = children[i].nodeValue.trim();
					if (command.indexOf("__page__:") == 0)
					{
						var page = command.substring("__page__:".length);
						/* Display a loading message */
						div.innerHTML = "<p><?php 
fs_e('Loading...');
?>
<\/p>";
						/* Fetch some html depending on which tab was clicked */
						var url = page;
						var pars = '';
						var myAjax = new Ajax.Updater(div, url, {method:'get',parameters:pars});
					}
					else
					if (command.indexOf("__css__:") == 0)
					{
						var css = command.substring("__css__:".length);
						FS.loadCSS(css);
					}
					else
					if (command.indexOf("__js__:") == 0)
Beispiel #19
0
	$('fs_clear_site_id').style.display='none';
	$('site_edit_id').value = $('original_site_id').value;
}


function updateDeleteDialog()
{
	var dt = $('delete_type');
	var del = dt.selectedIndex == 0;
	var s = (del ? "none" : "block");
	$('transfer_option').style.display = s;
	var text = del ? "<?php 
fs_e("Delete");
?>
" : "<?php 
fs_e("Transfer");
?>
";
	$('fs_site_delete_button').innerHTML = text;
}


FS.activationHelp = function(type,id)
{
	var url = '<?php 
echo fs_url('php/help-window.php');
?>
?TYPE=' + type + "&SITE_ID=" + id;
	openWindow(url,600,600);
}
Beispiel #20
0
<?php 
fs_e("Even though FireStats is free, it takes a lot of time and hard work to develop and maintain.");
?>
<br/>
<?php 
fs_e("If you like FireStats and would like to show your support for the hard work I put into it, You can make a small Donation. Even a \$5 donation would be greatly appreciated.");
?>
<br/>
<ul>
	<li><button class='button' onclick='openWindow("<?php 
echo FS_WIKI . "Donate";
?>
",700,700);closeParentWindow(this);'><?php 
fs_e("Yeah, I want to help");
?>
</button></li>
	<li><button class='button' onclick='saveOptionValue("donation_status","no" ,"string");closeParentWindow(this);'><?php 
fs_e("Nah, go away");
?>
</button></li>
	<li><button class='button' onclick='saveOptionValue("donation_status","later" ,"string");closeParentWindow(this);'><?php 
fs_e("Maybe later");
?>
</button></li>
	<li><button class='button' onclick='saveOptionValue("donation_status","donated" ,"string");closeParentWindow(this);'><?php 
fs_e("Already donated");
?>
</button></li>
</ul>
</div>
<br />
			<input type="text"
				onkeypress="return trapEnter(event,'saveWpSiteID();');"
				id="wp_site_id" style="width:120px"
				value="<?php 
    echo fs_get_local_option('firestats_site_id', '');
    ?>
" />
			<button class="button" onclick="saveWpSiteID()"><?php 
    fs_e('Save');
    ?>
</button>
		</td>
	</tr>
	<tr>
		<td class="config_cell" colspan="2">
			<?php 
    fs_e("This will update the titles of the blog posts inside FireStats, you don't normally need to use it");
    ?>
			<button class="button" onclick="sendRequest('action=update_wordpress_titles')"><?php 
    fs_e('Update');
    ?>
</button>
		</td>
	</tr>
	<?php 
}
?>
</table>
</div>
Beispiel #22
0
		<tr>
			<td><label for='baseline_visitors'><?php 
fs_e('Baseline visitors');
?>
</label></td>
			<td><input type='text' size='20' id='baseline_visitors' value='<?php 
echo $visits;
?>
' onfocus="this.select()"/><?php 
fs_create_wiki_help_link('BaselineValues');
?>
</td>
		</tr>
		<tr>
			<td colspan='2'>
				<button id='create_user' class='button' onclick='<?php 
echo isset($site_id) ? "FS.updateSite({$site_id}, this)" : "FS.createSite(this)";
?>
'><?php 
fs_e('Save');
?>
</button>
				<button class='button' onclick='closeParentWindow(this)'><?php 
fs_e('Close');
?>
</button>
			</td>
		</tr>
	</table>
</div>
Beispiel #23
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>