Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: ip_poll_panel

Parašė ChipsasMD· 2011 Vas. 25 05:02:21
#1

Sveiki, manau daugumai žinoma modifikacija ip_poll_panel. Bet kiek ieškojau, visur jinai palaiko iki 10-ies atsakymų pasirinkimų, gal kas galėtų padėti pasidaryti daugiau? Kad ir 15, užvedus ant kelio pasidaryčiau ir pats, nes kiek bandžiau, tiek meta errorus.

Redaguotini failai:

infusion.php


<?php
/*-------------------------------------------------------+
| <span style="border-bottom: 1px dotted black;">PHP</span>-Fusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
| <a href='http://www.php-fusion.co.uk/' target='_blank'><span style='color:005C5B'>http://www.php-fusion.co.uk/</span></a>
+--------------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit <a href='http://gnu.org' target='_blank'><span style='color:005C5B'>http://gnu.org</span></a>
+--------------------------------------------------------+
Przystosowanie do v7: bartek124
E-Mail: <a href="mailto:bartek124@php-fusion.pl"><span style="color:005C5B">bartek124@php-fusion.pl</span></a>
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }
 
include INFUSIONS."ip_poll_panel/infusion_db.php";
 
if (file_exists(INFUSIONS."ip_poll_panel/locale/".$settings['locale'].".php")) {
	include INFUSIONS."ip_poll_panel/locale/".$settings['locale'].".php";
} else {
	include INFUSIONS."ip_poll_panel/locale/English.php";
}
 
$inf_title = $locale['PLAN_TITLE'];
$inf_description = $locale['PLAN_DESC'];
$inf_version = "1.0";
$inf_developer = "Digitanium & bartek124";
$inf_email = "digitanium@php-fusion.co.uk";
$inf_weburl = "http://www.php-fusion.co.uk";
 
$inf_folder = "ip_poll_panel";
 
$inf_newtable[1] = DB_IP_POLLS." (
		poll_id mediumint(8) unsigned NOT NULL auto_increment,
		poll_title varchar(200) NOT NULL default '',
		poll_opt_0 varchar(200) NOT NULL default '',
		poll_opt_1 varchar(200) NOT NULL default '',
		poll_opt_2 varchar(200) NOT NULL default '',
		poll_opt_3 varchar(200) NOT NULL default '',
		poll_opt_4 varchar(200) NOT NULL default '',
		poll_opt_5 varchar(200) NOT NULL default '',
		poll_opt_6 varchar(200) NOT NULL default '',
		poll_opt_7 varchar(200) NOT NULL default '',
		poll_opt_8 varchar(200) NOT NULL default '',
		poll_opt_9 varchar(200) NOT NULL default '',
		poll_votes_0 MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
		poll_votes_1 MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
		poll_votes_2 MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
		poll_votes_3 MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
		poll_votes_4 MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
		poll_votes_5 MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
		poll_votes_6 MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
		poll_votes_7 MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
		poll_votes_8 MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
		poll_votes_9 MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
		poll_ips text NOT NULL,
		poll_started int(10) unsigned NOT NULL default '0',
		poll_ended int(10) unsigned NOT NULL default '0',
		PRIMARY KEY (poll_id)
	) ENGINE=MyISAM;";
 
$inf_droptable[1] = DB_IP_POLLS;
 
$inf_adminpanel[1] = array(
	"title" => $locale['PLAN_ADMIN1'],
	"image" => "image.gif",
	"panel" => "ip_poll_admin.php",
	"rights" => "IPP"
);
?>


ip_poll_admin.php


<?php
/*---------------------------------------------------+
| <span style="border-bottom: 1px dotted black;">PHP</span>-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright (c) 2005 Nick Jones
| <a href='http://www.php-fusion.co.uk/' target='_blank'><span style='color:005C5B'>http://www.php-fusion.co.uk/</span></a>
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit <a href='http://gnu.org' target='_blank'><span style='color:005C5B'>http://gnu.org</span></a>
+----------------------------------------------------*/
require_once "../../maincore.php";
require_once THEMES."templates/admin_header.php";
 
include INFUSIONS."ip_poll_panel/infusion_db.php";
 
if (file_exists(INFUSIONS."ip_poll_panel/locale/".$settings['locale'].".php")) {
	include INFUSIONS."ip_poll_panel/locale/".$settings['locale'].".php";
} else {
	include INFUSIONS."ip_poll_panel/locale/English.php";
}
 
if (!checkrights("IPP") || !defined("iAUTH") || $_GET['aid'] != iAUTH) { redirect("../../index.php"); }
if (isset($_GET['poll_id']) && !isnum($_GET['poll_id'])) redirect("../../index.php");
 
if (isset($_POST['save'])) {
	$poll_title = stripinput($_POST['poll_title']);
	foreach($_POST['poll_option'] as $key => $value) {
		$poll_option[$key] = stripinput($_POST['poll_option'][$key]);
	}
	if (isset($_GET['poll_id'])) {
		if (!isNum($_GET['poll_id'])) { header("Location: ".FUSION_SELF); exit; }
		$ended = (isset($_POST['close']) ? time() : 0);
		$result = dbquery("UPDATE ".DB_IP_POLLS." SET poll_title='$poll_title', poll_opt_0='".$_POST['poll_option'][0]."', poll_opt_1='".$_POST['poll_option'][1]."', poll_opt_2='".(isset($_POST['poll_option'][2]) ? $_POST['poll_option'][2] : "")."', poll_opt_3='".(isset($_POST['poll_option'][3]) ? $_POST['poll_option'][3] : "")."', poll_opt_4='".(isset($_POST['poll_option'][4]) ? $_POST['poll_option'][4] : "")."', poll_opt_5='".(isset($_POST['poll_option'][5]) ? $_POST['poll_option'][5] : "")."', poll_opt_6='".(isset($_POST['poll_option'][6]) ? $_POST['poll_option'][6] : "")."', poll_opt_7='".(isset($_POST['poll_option'][7]) ? $_POST['poll_option'][7] : "")."', poll_opt_8='".(isset($_POST['poll_option'][8]) ? $_POST['poll_option'][8] : "")."', poll_opt_9='".(isset($_POST['poll_option'][9]) ? $_POST['poll_option'][9] : "")."', poll_ended='$ended' WHERE poll_id='".$_GET['poll_id']."'");
		opentable($locale['PLAN_400']);
		echo "<center><br>\n".$locale['PLAN_401']."<br /><br />\n<a href='".FUSION_SELF.$aidlink."'>".$locale['PLAN_405']."</a><br><br>\n</center>\n";
		closetable();
	} else {
 
		$result = dbquery("UPDATE ".DB_IP_POLLS." SET poll_ended='".time()."' WHERE poll_ended='0'");
		$result = dbquery("INSERT INTO ".DB_IP_POLLS." VALUES('', '$poll_title', '".$_POST['poll_option'][0]."', '".$_POST['poll_option'][1]."', '".(isset($_POST['poll_option'][2]) ? $_POST['poll_option'][2] : "")."', '".(isset($_POST['poll_option'][3]) ? $_POST['poll_option'][3] : "")."', '".(isset($_POST['poll_option'][4]) ? $_POST['poll_option'][4] : "")."', '".(isset($_POST['poll_option'][5]) ? $_POST['poll_option'][5] : "")."', '".(isset($_POST['poll_option'][6]) ? $_POST['poll_option'][6] : "")."', '".(isset($_POST['poll_option'][7]) ? $_POST['poll_option'][7] : "")."', '".(isset($_POST['poll_option'][8]) ? $_POST['poll_option'][8] : "")."', '".(isset($_POST['poll_option'][9]) ? $_POST['poll_option'][9] : "")."', '', '', '', '', '', '', '', '', '', '', '', '".time()."', '0')");
		opentable($locale['PLAN_400']);
		echo "<center><br>\n".$locale['PLAN_402']."<br><br>\n<a href='".FUSION_SELF.$aidlink."'>".$locale['PLAN_405']."</a><br><br>\n</center>\n";
		closetable();
	}
} else if (isset($_POST['delete'])) {
	$result = dbquery("SELECT * FROM ".DB_IP_POLLS." WHERE poll_id='".$_POST['poll_id']."'");
	if (dbrows($result) != 0) $result = dbquery("DELETE FROM ".DB_IP_POLLS." WHERE poll_id='".$_POST['poll_id']."'");
	opentable($locale['PLAN_403']);
	echo "<center><br>\n".$locale['PLAN_404']."<br><br>\n<a href='".FUSION_SELF.$aidlink."'>".$locale['PLAN_405']."</a><br><br>\n</center>\n";
	closetable();
} else {
	if (isset($_POST['preview'])) {
		$poll = ""; $i = 0;
		$poll_title = stripinput($_POST['poll_title']);
		while ($i < count($_POST['poll_option'])) {
			$poll_option[$i] = stripinput($_POST['poll_option'][$i]);
			$poll .= "<input type='checkbox' name='option[$i]'> $poll_option[$i]<br><br>\n";
			$i++;
		}
		$opt_count = (isset($_POST['opt_count']) && $_POST['opt_count'] != 10 ? count($poll_option) : $_POST['opt_count']);
		opentable($locale['PLAN_410']);
		echo "<table align='center' width='280' cellpadding='0' cellspacing='0' class='tbl'>
<tr>
<td>$poll_title<br><br>
$poll</td>
</tr>
<tr>
<td align='center'><input type='button' name='blank' value='".$locale['PLAN_411']."' class='button' style='width:70px'></td>
</tr>
</table>\n";
		closetable();
		tablebreak();
	}
	$editlist = "";
	$result = dbquery("SELECT * FROM ".DB_IP_POLLS." ORDER BY poll_id DESC");
	if (dbrows($result) != 0) {
		while ($data = dbarray($result)) {
			$editlist .= "<option value='".$data['poll_id']."'>".$data['poll_title']."</option>\n";
		}
		opentable($locale['PLAN_420']);
		echo "<form name='editform' method='post' action='".FUSION_SELF.$aidlink."'>
<center>
<select name='poll_id' class='textbox' style='width:200px;'>
$editlist</select>
<input type='submit' name='edit' value='".$locale['PLAN_421']."' class='button'>
<input type='submit' name='delete' value='".$locale['PLAN_422']."' class='button'>
</center>
</form>\n";
		closetable();
		tablebreak();
	}
	if (isset($_POST['edit'])) {
		//if (!isNum($poll_id)) { header("Location: ".FUSION_SELF); exit; }
		$data = dbarray(dbquery("SELECT * FROM ".DB_IP_POLLS." WHERE poll_id='".$_POST['poll_id']."'"));
		$poll_title = $data['poll_title'];
		for ($i=0; $i<=9; $i++) {
			if ($data["poll_opt_".$i]) $poll_option[$i] = $data["poll_opt_".$i];
		}
		$opt_count = count($poll_option);
		$poll_started = $data['poll_started'];
		$poll_ended = $data['poll_ended'];
	}
	if (isset($_POST['addoption'])) {
		$poll_title = stripinput($_POST['poll_title']);
		foreach($_POST['poll_option'] as $key => $value) {
			$poll_option[$key] = stripinput($_POST['poll_option'][$key]);
		}
		$opt_count = ($_POST['opt_count'] != 10 ? count($poll_option) + 1 : $_POST['opt_count']);
	}
	$i = 0; $opt = 1;
	$poll_title = isset($poll_title) ? $poll_title : "";
	$opt_count = isset($opt_count) ? $opt_count : 2;
	if (isset($poll_id)) $poll_ended = isset($_POST['poll_ended']) ? $_POST['poll_ended'] : 0;
	opentable((isset($_POST['poll_id']) ? $locale['PLAN_431'] : $locale['PLAN_430']));
	echo "<form name='pollform' method='post' action='".FUSION_SELF.$aidlink.(isset($_POST['poll_id']) ? "&amp;poll_id=".$_POST['poll_id']."&poll_ended=$poll_ended" : "")."'>
<table align='center' width='280' cellpadding='0' cellspacing='0' class='tbl'>
<tr>
<td width='80'>".$locale['PLAN_433']."</td><td><input type='text' name='poll_title' value='$poll_title' class='textbox' style='width:200px'></td>
</tr>
<tr>\n";
	while ($i != $opt_count) {
		$poll_opt = isset($poll_option[$i]) ? $poll_option[$i] : "";
		echo "<tr>\n<td width='80'>".$locale['PLAN_434']."$opt</td>\n";
		echo "<td><input type='text' name='poll_option[$i]' value='$poll_opt' class='textbox' style='width:200px'></td>\n</tr>\n";
		$i++; $opt++;
	}
	echo "</table>
<table align='center' width='280' cellpadding='0' cellspacing='0'>
<tr>
<td align='center'><br>\n";
	if (isset($_POST['poll_id']) && $poll_ended == 0) {
		echo "<input type='checkbox' name='close' value='yes'>".$locale['PLAN_435']."<br><br>\n";
	}
	if (!isset($_POST['poll_id']) || isset($_POST['poll_id']) && $poll_ended == 0) {
		echo "<input type='hidden' name='opt_count' value='$opt_count'>
<input type='submit' name='addoption' value='".$locale['PLAN_438']."' class='button'>
<input type='submit' name='preview' value='".$locale['PLAN_439']."' class='button'>
<input type='submit' name='save' value='".$locale['PLAN_440']."' class='button'>\n";
	} else {
		echo $locale['PLAN_436'].showdate("shortdate", $poll_started)."<br>\n";
		echo $locale['PLAN_437'].showdate("shortdate", $poll_ended)."<br>\n";
	}
	echo "</td>\n</tr>\n</table>\n</form>\n";
	closetable();
}
 
require_once THEMES."templates/footer.php";
?>


ip_poll_archive.php


<?php
/*---------------------------------------------------+
| <span style="border-bottom: 1px dotted black;">PHP</span>-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright (c) 2005 Nick Jones
| <a href='http://www.php-fusion.co.uk/' target='_blank'><span style='color:005C5B'>http://www.php-fusion.co.uk/</span></a>
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit <a href='http://gnu.org' target='_blank'><span style='color:005C5B'>http://gnu.org</span></a>
+----------------------------------------------------*/
require_once "../../maincore.php";
require_once THEMES."templates/header.php";
 
include INFUSIONS."ip_poll_panel/infusion_db.php";
 
if (file_exists(INFUSIONS."ip_poll_panel/locale/".$settings['locale'].".php")) {
	include INFUSIONS."ip_poll_panel/locale/".$settings['locale'].".php";
} else {
	include INFUSIONS."ip_poll_panel/locale/English.php";
}
 
$result = dbquery("SELECT * FROM ".DB_IP_POLLS." WHERE poll_ended!='0' ORDER BY poll_id DESC");
if (dbrows($result) != 0) {
	$view_list = "";
	while ($data = dbarray($result)) {
		$view_list .= "<option value='".$data['poll_id']."'>".$data['poll_title']."</option>\n";
	}
	opentable($locale['PLAN_107']);
	echo "<form name='pollsform' method='post' action='".FUSION_SELF."'>
<center>
".$locale['PLAN_108']."<br>
<select name='oldpoll_id' class='textbox'>
$view_list</select>
<input type='submit' name='view' value='".$locale['PLAN_109']."' class='button'>
</center>
</form>\n";
	closetable();
}
if (isset($_POST['oldpoll_id'])) {
	$data = dbarray(dbquery("SELECT * FROM ".DB_IP_POLLS." WHERE poll_id='".$_POST['oldpoll_id']."' AND poll_ended!='0'"));
	$oldpoll_votes = 0;
	for ($i=0; $i<=9; $i++) {
		if ($data["poll_opt_".$i]) $oldpoll_option[$i] = $data["poll_opt_".$i];
		$oldpoll_votes = $oldpoll_votes + $data["poll_votes_".$i];
	}
	$poll_archive = ""; $i = 0;
	while ($i < count($oldpoll_option)) {
		$oldnum_votes = $data["poll_votes_".$i];
		$oldopt_votes = ($oldpoll_votes ? number_format(100 / $oldpoll_votes * $oldnum_votes) : 0);
		$poll_archive .= $oldpoll_option[$i]."<br>
<img src='".THEME."images/pollbar.gif' alt='".$oldpoll_option[$i]."' height='12' width='$oldopt_votes%' class='poll'><br>
".$oldopt_votes."% [".$oldnum_votes." ".($oldnum_votes == 1 ? $locale['PLAN_102'] : $locale['PLAN_103'])."]<br>\n";
		$i++;
	}
	tablebreak();
	opentable($locale['PLAN_110']);
	echo "<table align='center' width='200' cellspacing='0' cellpadding='0' class='tbl'>
<tr>
<td>".$data['poll_title']."
<hr>
$poll_archive
<center><br>
".$locale['PLAN_104'].$oldpoll_votes."<br>
".$locale['PLAN_105'].showdate("shortdate", $data['poll_started'])."<br>
".$locale['PLAN_106'].showdate("shortdate", $data['poll_ended'])."
</center>
</td>
</td>
</table>\n";
	closetable();
}
 
require_once THEMES."templates/footer.php";
?>


ip_poll_panel.php


<?php
/*---------------------------------------------------+
| <span style="border-bottom: 1px dotted black;">PHP</span>-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright (c) 2005 Nick Jones
| <a href='http://www.php-fusion.co.uk/' target='_blank'><span style='color:005C5B'>http://www.php-fusion.co.uk/</span></a>
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit <a href='http://gnu.org' target='_blank'><span style='color:005C5B'>http://gnu.org</span></a>
+----------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }
 
include INFUSIONS."ip_poll_panel/infusion_db.php";
 
if (file_exists(INFUSIONS."ip_poll_panel/locale/".$settings['locale'].".php")) {
	include INFUSIONS."ip_poll_panel/locale/".$settings['locale'].".php";
} else {
	include INFUSIONS."ip_poll_panel/locale/English.php";
}
 
openside($locale['PLAN_100']);
if (isset($_POST['cast_vote'])) {
	$sql = dbquery("SELECT * FROM ".DB_IP_POLLS." WHERE poll_id='".$_POST['poll_id']."'");
	$data = dbarray($sql);
	$poll_ips = explode("|", $data['poll_ips']);
	if (!in_array(USER_IP, $poll_ips)) {
		array_push($poll_ips, USER_IP);
		$poll_ips = implode("|", $poll_ips);
		$result = dbquery("UPDATE ".DB_IP_POLLS." SET poll_votes_".$_POST['voteoption']."=poll_votes_".$_POST['voteoption']."+1, poll_ips='$poll_ips' WHERE poll_id=".$_POST['poll_id']."");
		header("Location: ".FUSION_SELF.(FUSION_QUERY ? "?".FUSION_QUERY : ""));
	}
}
$result = dbquery("SELECT * FROM ".DB_IP_POLLS." ORDER BY poll_started DESC LIMIT 1");
if (dbrows($result) != 0) {
	$data = dbarray($result);
	$poll_title = $data['poll_title'];
	$poll_ips = explode("|", $data['poll_ips']);
	$poll_votes = 0;
	for ($i=0; $i<=9; $i++) {
		if ($data["poll_opt_".$i]) $poll_option[$i] = $data["poll_opt_".$i];
		$poll_votes = $poll_votes + $data["poll_votes_".$i];
	}
	if (!in_array(USER_IP, $poll_ips) && $data['poll_ended'] == 0) {
		$poll = ""; $i = 0; $num_opts = count($poll_option);
		while ($i < $num_opts) {
			$poll .= "<input type='radio' name='voteoption' value='$i'> $poll_option[$i]<br><br>\n";
			$i++;
		}
		echo "<form name='voteform' method='post' action='".FUSION_SELF.(FUSION_QUERY ? "?".FUSION_QUERY : "")."'>
<b>$poll_title</b><br><br>
$poll<center><input type='hidden' name='poll_id' value='".$data['poll_id']."'>
<input type='submit' name='cast_vote' value='".$locale['PLAN_101']."' class='button'></center>
</form>\n";
	} else {
		$poll =  ""; $i = 0; $num_opts = count($poll_option);
		while ($i < $num_opts) {
			$num_votes = $data["poll_votes_".$i];
			$opt_votes = ($poll_votes ? number_format(100 / $poll_votes * $num_votes) : 0);
			$poll .= "<div>".$poll_option[$i]."</div>
<div><img src='".THEME."images/pollbar.gif' alt='".$poll_option[$i]."' height='12' width='$opt_votes' class='poll'></div>
<div>".$opt_votes."% [".$num_votes." ".($num_votes == 1 ? $locale['PLAN_102'] : $locale['PLAN_103'])."]</div><br>\n";
			$i++;
		}
		echo "<b>".$poll_title."</b><br><br>
$poll
<center>".$locale['PLAN_104'].$poll_votes."<br>
".$locale['PLAN_105'].showdate("shortdate", $data['poll_started']);
		if ($data['poll_ended'] > 0) {
			echo "<br>\n".$locale['PLAN_106'].showdate("shortdate", $data['poll_ended'])."\n";
		}
		$result = dbquery("SELECT * FROM ".DB_IP_POLLS);
		if (dbrows($result) > 1) {
			echo "<br><br><img src='".THEME."images/bulletb.gif'>
<a href='".INFUSIONS."ip_poll_panel/ip_poll_archive.php' class='side'>".$locale['PLAN_107']."</a> <img src='".THEME."images/bulletb.gif'>\n";
		}
		echo "</center>\n";
	}
} else {
	echo "<center>".$locale['global_142']."</center>\n";
}
closeside();
?>

Redagavo ChipsasMD· 2011 Vas. 25 06:02:54

Parašė MDSidabras· 2011 Vas. 25 07:02:08
#2

Bet Tu tai urodas, negali savo nick susigalvot.. :[

Parašė ChipsasMD· 2011 Vas. 25 07:02:04
#3

Pirma žiūrėk ką rašai. Antra, toks mano nick jau geri 15 metų, taip kad STFU man. Trečia, jeigu dėl trumpinio MD, tai tuomet Tu visiškas asilas, nes čia vardo ir pavardės pirmosios raidės...

Redagavo ChipsasMD· 2011 Vas. 25 07:02:59

Parašė MDSidabras· 2011 Vas. 25 09:02:44
#4

Tuomet tu totalus asilas, pasikeisk pavardę mulki. M. Suskis? Man px tavo nuomonė, išsižągink. No more post's, adios my friend.

Parašė ChipsasMD· 2011 Vas. 25 13:02:00
#5

:DD Susidegink vaikeli :/