1
0
Fork 0
SemmelstatzR/semmelstatzR-options.php

390 Zeilen
20 KiB
PHP

<?php
/**
* file semmelstatzR_options.php
*
* @package SemmelstatzR
* @version $Rev$
* @since 1.0.0
* @author SEM-Team
* @copyright (c)2011 SEM-Team
* @link http://sourceforge.net/projects/semmelstatz/
* @license http://www.gnu.org/licenses/gpl-3.0.html
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*
*/
/**
* based upon semmelstatz
* Copyright (c) 2005-2009 Andreas 'Redunzl' Mueller (redunzl@gmx.de)
*
* @license http://www.gnu.org/licenses/gpl-2.0.html
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2) as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
if(!current_user_can('manage_statz')) {
die('Acces denied!!!');
}
if(isset($_POST['options_save'])) {
$sem_options['statz_write_admins'] = $_POST['statz_write_admins'];
$sem_options['statz_write_users'] = $_POST['statz_write_users'];
$sem_options['statz_encode_ip'] = $_POST['statz_encode_ip'];
$sem_options['statz_days_limit'] = $_POST['statz_days_limit'];
$sem_options['statz_show_dailystatz'] = $_POST['statz_show_dailystatz'];
$sem_options['statz_referer_limit'] = $_POST['statz_referer_limit'];
$sem_options['statz_show_referers'] = $_POST['statz_show_referers'];
$sem_options['statz_mask_referer'] = $_POST['statz_mask_referer'];
$sem_options['statz_keyword_limit'] = $_POST['statz_keyword_limit'];
$sem_options['statz_show_keywords'] = $_POST['statz_show_keywords'];
$sem_options['statz_topreads_limit'] = $_POST['statz_topreads_limit'];
$sem_options['statz_show_reads'] = $_POST['statz_show_reads'];
$sem_options['statz_show_todayreads'] = $_POST['statz_show_todayreads'];
$sem_options['statz_comment_limit'] = $_POST['statz_comment_limit'];
$sem_options['statz_show_commenters'] = $_POST['statz_show_commenters'];
$sem_options['statz_show_topcommposts'] = $_POST['statz_show_topcommposts'];
$sem_options['statz_show_useronline'] = $_POST['statz_show_useronline'];
$sem_options['statz_online_time'] = $_POST['statz_online_time'];
$sem_options['statz_show_todayusers'] = $_POST['statz_show_todayusers'];
$sem_options['statz_on_dashboard'] = $_POST['statz_on_dashboard'];
$sem_options['statz_datarecs_limit'] = $_POST['statz_datarecs_limit'];
$sem_options['statz_use_img'] = $_POST['statz_use_img'];
update_option("semmelstatzR_options", $sem_options);
echo '<div class="updated fade"><p>'.semr_i18n('Options saved').'</strong></p></div>';
}
if(isset($_POST['trunc_save'])) {
if (sem_truncateStatzTable()) {
echo "<div class='updated'><p>".semr_i18n('<i>statz</i>-table emptied succesfully.')."</p></div>";
}
}
if(isset($_POST['limit_save'])) {
$sem_options["statz_recdays_limit"] = $_POST["statz_recdays_limit"];
if($sem_options["statz_recdays_limit"] < 1 || (!is_numeric($sem_options["statz_recdays_limit"]))) $sem_options["statz_recdays_limit"] = 1;
update_option("semmelstatzR_options", $sem_options);
echo "<div class='updated fade'><p>".semr_i18n("Successfully saved limit value.")."</p></div>";
}
if(isset($_POST['limit_execute'])) {
$days = $sem_options["statz_recdays_limit"];
if(($days >= sem_showStatzDays()) || (!is_numeric($days))) {
echo "<div class='error fade'><p>".semr_i18n("Given value is no number or to big!")."</p></div>";
}
else {
if ($result == sem_delOutOfLimit()) {
echo "<div class='updated fade'>".sprintf(semr_i18n("Successfully shortened <i>statz</i>-table to %s days."), $days)."</p></div>";
}
}
}
if(isset($_POST['cron_save'])) {
if($sem_options['statz_do_cron'] == true) {
$sem_options['statz_do_cron'] = false;
}
else {
$sem_options['statz_do_cron'] = true;
$sem_options['statz_next_cron'] = time() + 86400;
}
update_option("semmelstatzR_options", $sem_options);
}
?>
<div class="wrap">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=<?php echo plugin_basename(__FILE__); ?>">
<div id='icon-semmelstatzR' class='icon32'><br /></div>
<h2>SemmelstatzR &rsaquo; <?php echo semr_i18n('Options'); ?></h2>
<p><input type="submit" class="button-secondary" name="options_save" value="<?php echo semr_i18n('Save Changes'); ?>" /></p>
<table class="form-table">
<tr style="background:#eee;" valign="middle">
<th><?php echo semr_i18n('Use tracking image'); ?></th>
<td><input name="statz_use_img" type="checkbox" id="statz_write_admins" value="statz_use_img"
<?php if($sem_options["statz_use_img"] == TRUE) {?> checked="checked" <?php } ?> />
</td>
<td><?php echo semr_i18n('Use a pixelimage in the footer to track visitors. Only needed with some cache-plugins. - (default: off)'); ?></td>
</tr>
<tr style="background:#eee;" valign="middle">
<th><?php echo semr_i18n('Log blog administrators'); ?></th>
<td><input name="statz_write_admins" type="checkbox" id="statz_write_admins" value="statz_write_admins"
<?php if($sem_options["statz_write_admins"] == TRUE) {?> checked="checked" <?php } ?> />
</td>
<td><?php echo semr_i18n('All frontend hits of blog-admin(s) are tracked - (default: off)'); ?></td>
</tr>
<tr valign="middle">
<th><?php echo semr_i18n('Log blog-user'); ?></th>
<td><input name="statz_write_users" type="checkbox" id="statz_write_users" value="statz_write_users"
<?php if($sem_options["statz_write_users"] == TRUE) {?> checked="checked" <?php } ?> />
</td>
<td><?php echo semr_i18n('All frontend hits of registered blog-users are tracked - (default: off)'); ?></td>
</tr>
<tr style="background:#eee;" valign="middle">
<th><?php echo semr_i18n('Disguised record of IP addresses'); ?></th>
<td><input name="statz_encode_ip" type="checkbox" id="statz_encode_ip" value="statz_encode_ip"
<?php if($sem_options["statz_encode_ip"] == TRUE) {?> checked="checked" <?php } ?> />
</td>
<td><?php echo semr_i18n('In some countries there are restrictions by law to use and/or store an IP address
longer than the time of visit. If you activate this option SEMMELSTATZ will hide IP by a simple arithmetical process.
Therefor no readable IP address will be stored to <i>statz</i>-table - (default: off)'); ?></td>
</tr>
<tr valign="middle">
<th><?php echo sprintf(semr_i18np('Show statz of last <input name="statz_days_limit" type="text" id="statz_days_limit"
value="%s" style="text-align:center;" size="2" maxlength="2" /> day',
'Show statz of last <input name="statz_days_limit" type="text" id="statz_days_limit"
value="%s" style="text-align:center;" size="2" maxlength="2" /> days',
$sem_options["statz_days_limit"]), $sem_options["statz_days_limit"])?></th>
<td><input name="statz_show_dailystatz" type="checkbox" id="statz_show_dailystatz" value="statz_show_dailystatz"
<?php if($sem_options["statz_show_dailystatz"] == TRUE) {?> checked="checked" <?php } ?> />
</td>
<td><?php echo semr_i18n('Daily visitor/hits/referer in absolute terms, with descending date - (default: 7 , on)'); ?></td>
</tr>
<tr style="background:#eee;" valign="middle">
<th><?php echo sprintf(semr_i18n('Show %s referer'),
'<input name="statz_referer_limit" type="text" id="statz_referer_limit"
value="'.$sem_options["statz_referer_limit"].'" style="text-align:center;" size="2" maxlength="2" />'); ?></th>
<td><input name="statz_show_referers" type="checkbox" id="statz_show_referers" value="statz_show_referers"
<?php if($sem_options["statz_show_referers"] == TRUE) {?> checked="checked" <?php } ?> />
</td>
<td><?php echo sprintf(semr_i18n('List of %s links to websites which backlink to this blog - (default: 10, on)'),
$sem_options["statz_referer_limit"]); ?></td>
</tr>
<tr valign="middle">
<th>Referer-Links via Google maskieren</th>
<td><input name="statz_mask_referer" type="checkbox" id="statz_mask_referer" value="statz_mask_referer"
<?php if($sem_options["statz_mask_referer"] == TRUE) {?> checked="checked" <?php } ?> />
</td>
<td>Der Aufruf einer referenzierenden Webseite aus SEMMELSTATZ heraus w&uuml;rde die komplette URL
des Adminbereichs an den Webserver dieser Webseite &uuml;bermitteln. Die Maskierung der Referer-Links
als GOOGLE-Weiterleitung verhindert dies. Funktioniert nicht mit allen Links - (default: AUS)</td>
</tr>
<tr style="background:#eee;" valign="middle">
<th><input name="statz_keyword_limit" type="text" id="statz_keyword_limit"
value="<?php echo $sem_options["statz_keyword_limit"]; ?>" style="text-align:center;" size="2" maxlength="2" />
Suchbegriffe anzeigen
</th>
<td><input name="statz_show_keywords" type="checkbox" id="statz_show_keywords" value="statz_show_keywords"
<?php if($sem_options["statz_show_keywords"] == TRUE) {?> checked="checked" <?php } ?> />
</td>
<td>Listet <?php echo $sem_options["statz_keyword_limit"]; ?> Links zu Suchbegriffen, mit denen Besucher
das Blog gefunden haben. Der Name der entsprechenden Searchengine (soweit bekannt) ist dem
Suchbegriff vorangestellt. Der WP-internen Suche steht ein INTERN voraus - (default: 10, AN)</td>
</tr>
<tr valign="middle">
<th>Top<input name="statz_topreads_limit" type="text" id="statz_topreads_limit"
value="<?php echo $sem_options["statz_topreads_limit"]; ?>" style="text-align:center;" size="2" maxlength="2" />
Posts & Pages anzeigen
</th>
<td><input name="statz_show_reads" type="checkbox" id="statz_show_reads" value="statz_show_reads"
<?php if($sem_options["statz_show_reads"] == TRUE) {?> checked="checked" <?php } ?> />
</td>
<td>Die <?php echo $sem_options["statz_topreads_limit"]; ?> meist gelesenen Posts & Pages, basierend
auf dem seit SEMMELSTATZ 3.2 neuen Z&auml;hler in der <i>posts</i>-Tabelle. Dieser Z&auml;hler ist, im Gegensatz
zur Ermittlung aus der <i>statz</i>-Tabelle, dauerhaft - (default: 10, AN)</td>
</tr>
<tr style="background:#eee;" valign="middle">
<th>Top10 Posts & Pages heute anzeigen</th>
<td><input name="statz_show_todayreads" type="checkbox" id="statz_show_todayreads" value="statz_show_todayreads"
<?php if($sem_options["statz_show_todayreads"] == TRUE) {?> checked="checked" <?php } ?> />
</td>
<td>Die 10 meist gelesenen Posts & Pages des laufenden Tages mit Anzahl der Klicks - (default: AN)</td>
</tr>
<tr valign="middle">
<th>Top<input name="statz_comment_limit" type="text" id="statz_comment_limit"
value="<?php echo $sem_options["statz_comment_limit"]; ?>" style="text-align:center;" size="2" maxlength="2" />
Kommentierer anzeigen
</th>
<td><input name="statz_show_commenters" type="checkbox" id="statz_show_commenters" value="statz_show_commenters"
<?php if($sem_options["statz_show_commenters"] == TRUE) {?> checked="checked" <?php } ?> />
</td>
<td>Die Top<?php echo $sem_options["statz_comment_limit"]; ?> der Kommentierer auf Basis der
<i>comments</i>-Tabelle mit Anzahl ihrer Kommentare - (default: 10, AN)</td>
</tr>
<tr style="background:#eee;" valign="middle">
<th>Top10 kommentierter Posts anzeigen</th>
<td><input name="statz_show_topcommposts" type="checkbox" id="statz_show_topcommposts" value="statz_show_topcommposts"
<?php if($sem_options["statz_show_topcommposts"] == TRUE) {?> checked="checked" <?php } ?> />
</td>
<td>Die Top10 der kommentierten Posts mit Anzahl der Kommentare - (default: AN)</td>
</tr>
<tr valign="middle">
<th>Online-User anzeigen</th>
<td><input name="statz_show_useronline" type="checkbox" id="statz_show_useronline" value="statz_show_useronline"
<?php if($sem_options["statz_show_useronline"] == TRUE) {?> checked="checked" <?php } ?> />
</td>
<td>Zeigt einen Besucher an, sobald er das Blog 'betreten' hat. Ist er ein Administrator oder regsitrierter
User des Blogs oder kommt mit einem Kommentar-COOKIE, wird er mit seinem Login- bzw. Kommentierer-Namen und
nicht als GAST angezeigt - (default: AN)</td>
</tr>
<tr style="background:#eee;" valign="middle">
<th>Sekunden, die ein User als anwesend gilt</th>
<td><input name="statz_online_time" type="text" id="statz_onlinetime_time"
value="<?php echo $sem_options["statz_online_time"]; ?>" style="text-align:center;" size="3" maxlength="4" />
</td>
<td>Dieser Wert legt fest, dass ein Besucher <?php echo $sem_options["statz_online_time"]; ?> Sekunden als
anwesend gilt und so lange als ONLINE-Besucher angezeigt wird - (default: 180)</td>
</tr>
<tr valign="middle">
<th>Heutige User anzeigen</th>
<td><input name="statz_show_todayusers" type="checkbox" id="statz_show_todayusers" value="statz_show_todayusers"
<?php if($sem_options["statz_show_todayusers"] == TRUE) {?> checked="checked" <?php } ?> /></td>
<td>(default: AN)</td>
</tr>
<tr style="background:#eee;" valign="middle">
<th>Mini-Statz im Dashboard anzeigen</th>
<td><input name="statz_on_dashboard" type="checkbox" id="statz_on_dashboard" value="statz_on_dashboard"
<?php if($sem_options["statz_on_dashboard"] == TRUE) {?> checked="checked" <?php } ?> />
</td>
<td>Aktiviert das SEMMELSTATZ-Widget im Dashboard - (default: AUS)</td>
</tr>
<tr valign="middle">
<th>Anzahl Datens&auml;tze im <a href='admin.php?page=semmelstatzR/semmelstatzR-log.php'>Log</a></th>
<td><input name="statz_datarecs_limit" type="text" id="statz_datarecs_limit"
value="<?php echo $sem_options["statz_datarecs_limit"]; ?>" style="text-align:center;" size="3" maxlength="4" />
</td>
<td>Anzahl der kompletten Datens&auml;tze <i>DATUM-TCP/IP-REFERER-SUCHBEGRIFF-POST/PAGE-USERNAME</i>
im SEMMELSTATZ-Log - (default: 100)</td>
</tr>
<tr valign="middle">
<th></th>
<td></td>
</tr>
</table>
<p><input type="submit" class="button-secondary" name="options_save" value="&Auml;nderungen &uuml;bernehmen" /></p>
</form>
<div id='icon-semmelstatzR' class='icon32'><br /></div>
<h2>SemmelstatzR &rsaquo; Statz-Tabellen</h2>
<table class="form-table">
<tr valign="middle">
<td colspan="2">
<i>statz</i>-Tabelle: <?php echo sem_countDaysInStatzTable()-1; ?>,xx Tage (Der aktuelle Tag ist nat&uuml;rlich nie komplett!!!)<br />
<i>statzhist</i>-Tabelle: <?php echo sem_showStatzDays(); ?> Tage
</td>
</tr>
<tr style="background:#eee;" valign="middle">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=<?php echo plugin_basename(__FILE__); ?>">
<th><input name="statz_recdays_limit" type="input" id="statz_recdays_limit"
value="<?php echo $sem_options["statz_recdays_limit"]; ?>" style="text-align:center;"
size="2" maxlength="3" />-Tage-Limit f&uuml;r die <i>statz</i>-Tabelle festlegen.
</th>
<td>
<input type="submit" class="button-secondary" name="limit_save" value="Limit speichern" />
</td>
<td>
Um die <i>statz</i>-Tabelle nicht ins Unendliche anwachsen zu lassen, macht es Sinn sie zu limitieren,
egal, ob nun manuell oder automatisch. Links die Anzahl der Statistiktage (nicht der zu l&ouml;schenden Tage)
eintragen und speichern. Der Wert muss eine Ganzzahl <b>>= 1</b> (default: 20) sein, sonst werden falsche
Werte in die <i>statzhist</i>-Tabelle &uuml;bertragen. Der Wert gilt dann sowohl f&uuml;r das manuelle, wie
auch das automatische Limit.<br /><u>Dieser Schritt l&ouml;scht noch keine Daten, sondern speichert nur den Wert
f&uuml; das Limit!</u>
</td>
</form>
</tr>
<tr valign="middle">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=<?php echo plugin_basename(__FILE__); ?>">
<th><i>statz</i>-Tabelle manuell limitieren</th>
<td>
<input type="submit" class="button-secondary" name="limit_execute" value="statz-Tabelle k&uuml;rzen" />
</td>
<td>Es erfolgt <u>keine</u> R&uuml;ckfrage! Die <i>statz</i>-Tabelle wird <u>einmalig</u> auf
<b><?php echo $sem_options["statz_recdays_limit"]; ?></b> Tage gek&uuml;rzt. Alle Datens&auml;tze <u>&uuml;ber diesen
Zeitraum hinaus</u> werden unwiderruflich gel&ouml;scht. Dies gilt nicht f&uuml;r die historischen Daten.
</td>
</form>
</tr>
<tr style="background:#eee;" valign="middle">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=<?php echo plugin_basename(__FILE__); ?>">
<th><i>statz</i>-Tabelle automatisch limitieren</th>
<td>
<?php if($sem_options["statz_do_cron"] == true): ?>
<input type="submit" class="button-secondary" name="cron_save" value="Automatisches Limit deaktivieren" />
<?php else:?>
<input type="submit" class="button-secondary" name="cron_save" value="Automatisches Limit aktivieren" />
<?php endif ?>
</td>
<td>Das automatische Limitieren der statz-Tabelle ist <?php if ($sem_options["statz_do_cron"] == false): ?>
<span style="color:#fff;background:red;font-weight:bold;">&nbsp;deaktiviert&nbsp;</span>
<?php else: ?>
<span style="color:#fff;background:green;font-weight:bold;">&nbsp;aktiviert&nbsp;</span>
<?php endif ?>
<?php if ($sem_options["statz_do_cron"] == true): ?>
<br />N&auml;chster Lauf am <?php echo date("j.n.Y", $sem_options["statz_next_cron"]); ?>
gegen <?php echo date("G:i", $sem_options["statz_next_cron"]); ?> Uhr.
<?php else: ?>
<br />Es erfolgt keine automatische Limitierung
<?php endif ?>
</td>
</form>
</tr>
<tr valign="middle">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=<?php echo plugin_basename(__FILE__); ?>">
<th><i>statz</i>-Tabelle leeren</th>
<td>
<input type="submit" class="button-secondary" name="trunc_save" value="statz-Tabelle leeren" />
</td>
<td>Die Datens&auml;tze der <b>statz</b>-Tabelle werden unwiderruflich geleert, und der Speicherplatz in der Datenbank mittels
<b>OPTIMIZE TABLE</b> freigegeben. ACHTUNG: Es erfolgt <u>keine</u> R&uuml;ckfrage! Die Aufzeichnung
l&auml;uft ohne Unterbrechung weiter. Die Daten der <i>statzhist</i>-Tabelle bleiben unber&uuml;hrt.
</td>
</form>
</tr>
</table>
<hr />
<?php sem_showCopyright(); ?>
</div>