3 if( !isset($config_included) ){
4 die(
"config not loaded");
13 if( AUTH_METHOD ==
"LDAP" ){
14 $au =
new LDAPauth(LDAP_HOST , LDAP_PORT , LDAP_ROOTDN);
15 }
else if(AUTH_METHOD ==
"MYSQL"){
16 $au =
new MYSQLauth(AUTH_DB_HOST , AUTH_DB_PORT , AUTH_DB_NAME , AUTH_DB_USER , AUTH_DB_PASS);
21 throw new Exception(
"Fehlkonfiguration der Authentifizierungsmethode");
31 if( !isset($_SESSION) ){
34 if( !class_exists(
"user") ){
35 throw new exception(
"The user class was not found. Please include it BEFORE tools.php");
37 if( (!isset($_SESSION[
"user"])) OR ( (isset($_SESSION[
"user"])) AND (! $_SESSION[
"user"] instanceof
user) ) ){
38 $_SESSION[
"user"] =
new user();
53 if( class_exists(
"poll") ){
56 throw new Exception(
"Pollclass not loaded!");
58 if( !
$db instanceof
db ){
59 throw new Exception(
"No database object given!");
61 if( $method ==
"GET" ){
62 if( !isset($_GET[
"pollID"]) ){
63 return "Es muss eine UmfragenID angegeben werden!";
65 if( !( ($_GET[
"pollID"] !=
"") AND (is_numeric($_GET[
"pollID"])) ) ){
66 return "Die umfragen ID muss numerisch sein";
68 if (!$poll->load_from_id(
$db, intval($_GET[
"pollID"]) ) ){
69 return "Die angeforderte Umfrage existiert nicht (mehr)";
73 }
else if( $method ==
"POST" ){
74 if( !isset($_POST[
"pollID"]) ){
75 return "Es muss eine UmfragenID angegeben werden!";
77 if( !( ($_POST[
"pollID"] !=
"") AND (is_numeric($_POST[
"pollID"])) ) ){
78 return "Die umfragen ID muss numerisch sein";
80 if (!$poll->load_from_id(
$db, intval($_POST[
"pollID"]) ) ){
81 return "Die angeforderte Umfrage existiert nicht (mehr)";
85 throw new Exception(
"Invalid value for method parameter");
101 if( !$poll instanceof
poll ){
102 throw new Exception(
"No poll Object given");
105 if( $method ==
"GET" ){
106 if( !isset($_GET[
"widgetID"]) ){
107 return "Es muss eine Widget ID angegeben werden!";
109 if( !( ($_GET[
"widgetID"] !=
"") AND (is_numeric($_GET[
"widgetID"])) ) ){
110 return "Die Widget ID muss numerisch sein" ;
112 $widget = $poll->get_widget_by_id( intval($_GET[
"widgetID"]) );
114 }
else if( $method ==
"POST" ){
115 if( !isset($_POST[
"widgetID"]) ){
116 return "Es muss eine Widget ID angegeben werden!";
118 if( !( ($_POST[
"widgetID"] !=
"") AND (is_numeric($_POST[
"widgetID"])) ) ){
119 return "Die Widget ID muss numerisch sein" ;
121 $widget = $poll->get_widget_by_id( intval($_POST[
"widgetID"]) );
124 throw new Exception(
"Invalid value for method parameter");
128 return "Widget existiert leider nicht (mehr)";