diff --git a/uvote/api/votes/votes.php b/uvote/api/votes/votes.php index 12b5d70..319e8d9 100644 --- a/uvote/api/votes/votes.php +++ b/uvote/api/votes/votes.php @@ -131,16 +131,10 @@ class votes { } public static function write_vote($poll_ID, $vote){ - if(!\SYSTEM\SECURITY\Security::isLoggedIn()){ - throw new ERROR("You need to be logged in.");} - $con = new \SYSTEM\DB\Connection(new \SQL\uVote()); $res = $con->prepare( 'selVote', - 'SELECT * FROM `uvote_votes` WHERE `ID` = ? AND time_end < CURDATE();', - array($poll_ID)); - if ($res->next()){ - throw new ERROR('Your rights have expired!');} - + 'SELECT * FROM `uvote_votes` WHERE `ID` = ?;', + array($poll_ID)); $res = $con->prepare( 'insertVote', 'REPLACE uvote_data VALUES (?, ?, ?, 0, NOW());', diff --git a/uvote/page/autoload.inc b/uvote/page/autoload.inc index fcecc93..f7129ac 100644 --- a/uvote/page/autoload.inc +++ b/uvote/page/autoload.inc @@ -2,13 +2,15 @@ SYSTEM\autoload::registerFolder(dirname(__FILE__),''); SYSTEM\autoload::registerFolder(dirname(__FILE__).'/default_page',''); SYSTEM\autoload::registerFolder(dirname(__FILE__).'/default_register',''); -SYSTEM\autoload::registerFolder(dirname(__FILE__).'/default_bulletin',''); SYSTEM\autoload::registerFolder(dirname(__FILE__).'/default_comment',''); -SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main',''); -SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_uVote',''); -SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_urVote',''); -SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_myVote',''); + +SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_votelist',''); +SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_analysis',''); +SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_options',''); SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_poll',''); -SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_list',''); -SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_list_active',''); -SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_list_ended',''); + + +//SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_list_ended',''); +//SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main',''); +//SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_uVote',''); +//SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_list',''); \ No newline at end of file diff --git a/uvote/page/default_bulletin/css/bars_user.css b/uvote/page/default_bulletin/css/bars_user.css deleted file mode 100644 index 513c5aa..0000000 --- a/uvote/page/default_bulletin/css/bars_user.css +++ /dev/null @@ -1,4 +0,0 @@ -.progress#progress_bars_user { - height: 20px; - width: 350px; -} \ No newline at end of file diff --git a/uvote/page/default_bulletin/css/bulletin.css b/uvote/page/default_bulletin/css/bulletin.css deleted file mode 100644 index 1cb78e3..0000000 --- a/uvote/page/default_bulletin/css/bulletin.css +++ /dev/null @@ -1,48 +0,0 @@ -#bulletin_main { - float: left; - width: 100%; -} - -#bulletin_left { - float: left; -} - -#bulletin_sub1 { - margin-top: 30px; -} - -#bulletin_sub2 { - float: left; - width: 50%; - padding-top: 30px; -} - -#bulletin_sub3 { - float: right; - width: 50%; - padding-top: 30px; -} -#divider { - clear: both; -} - -#bulletin_sub4 { - padding-top: 30px; -} -#bulletin_sub5 { - padding-top: 20px; -} - -#bulletin_sub5_sub { - float: left; - width: 40%; -} - - #bulletin_sub6 { - float: right; - width: 40%; - } - - #bulletin_sub7 { - clear: both; - } \ No newline at end of file diff --git a/uvote/page/default_bulletin/css/comment.css b/uvote/page/default_bulletin/css/comment.css deleted file mode 100644 index 125793f..0000000 --- a/uvote/page/default_bulletin/css/comment.css +++ /dev/null @@ -1,22 +0,0 @@ -#comment_main { - float: left; - width: 90%; -} - -#comment_sub1 { - float: left; - font-size: 1; -} - -#comment_sub2 { - clear: both; -} - -#comment_sub3 { - font-size: 2; -} - -#comment_sub4 { - float: right; - font-size: 1; -} \ No newline at end of file diff --git a/uvote/page/default_bulletin/default_bulletin.php b/uvote/page/default_bulletin/default_bulletin.php deleted file mode 100644 index 15fb5c7..0000000 --- a/uvote/page/default_bulletin/default_bulletin.php +++ /dev/null @@ -1,242 +0,0 @@ -poll_ID=$poll_ID;} - - public function vote_choice(){ - $vars = votes::getUserPollData($this->poll_ID); - return $this->tablerow_class($vars); - } - - private static function tablerow_class($choice){ - switch($choice){ - case 1: - return 'pro'; - case 2: - return 'con'; - case 3: - return 'ent'; - default: - return 'open'; - } - } - - private function get_party_per_poll($choice){ - switch($choice){ - case 1: - return 'PRO'; - case 2: - return 'CON'; - case 3: - return 'ENT'; - default: - return 'NONE'; - } - } - - private function choice_party (){ - $result = ''; - $party_votes = votes::get_barsperparty($this->poll_ID); - -// $vote['bt_vote_class'] = $this->tablerow_class($vote['bt_choice']); - foreach($party_votes as $pv){ - - $result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/tpl/vote_bt.tpl'), - array( 'party' => $pv['party'], - 'choice' => $this->get_party_per_poll($pv['choice']), - 'choice_class' => $this->tablerow_class($pv['choice']), - 'party_yes' => $pv['votes_pro'] > 0 ? round($pv['votes_pro']/$pv['total']*100,0) : $pv['votes_pro'], - 'party_no' => $pv['votes_contra'] > 0 ? round($pv['votes_contra']/$pv['total']*100,0) : $pv['votes_contra'], - 'party_off' => $pv['total'] > 0 ? round(($pv['total'] - $pv['nr_attending'])/$pv['total']*100,0) : $pv['total'], - 'party_ent' => $pv['nr_attending'] > 0 ? round(($pv['nr_attending'] - $pv['votes_pro'] - $pv['votes_contra'])/$pv['nr_attending']*100,0) : $pv['nr_attending'])); - } - return $result; - } - - private function get_pro_comments (){ - $result = ''; - /*$vars = votes::getUserComments($this->poll_ID, 1); - - foreach($vars as $com){ - $rating = votes::get_commentrate($com['c_ID'], 1); - $com['count_up'] = $rating['count']; - $rating2 = votes::get_commentrate($com['c_ID'], 2); - $com['count_down'] = $rating2['count']; -// $com['c_txt'] = utf8_encode($com['c_txt']); - $result .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/tpl/comment.tpl'), $com); - }*/ - return $result; - - } - private function get_con_comments (){ - $result = ''; - /*$vars = votes::getUserComments($this->poll_ID, 2); - - foreach($vars as $com){ - $rating = votes::get_commentrate($com['c_ID'], 1); - $com['count_up'] = $rating['count']; - $rating2 = votes::get_commentrate($com['c_ID'], 2); - $com['count_down'] = $rating2['count']; -// $com['c_txt'] = utf8_encode($com['c_txt']); - $result .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/tpl/comment.tpl'), $com); - }*/ - return $result; - - } - private function bars_user(){ - $bars = votes::get_barsperusers($this->poll_ID,false); - $bars['vote_yes_perc'] = round($bars['yes_perc']*100,0); - $bars['vote_no_perc'] = round($bars['no_perc']*100,0); - $bars['vote_ent_perc'] = round($bars['ent_perc']*100,0); - $bars['title'] = 'Gemessen auf uVote'; - return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/tpl/bars_user.tpl'),$bars); - } - - private function bars_party(){ - $partyvotes = votes::get_barsperparty($this->poll_ID); - - $result = ""; - foreach($partyvotes as $vote){ - $vote['party_yes'] = $vote['votes_pro'] > 0 ? round($vote['votes_pro']/$vote['total']*100,0) : $vote['votes_pro']; - $vote['party_no'] = $vote['votes_contra'] > 0 ? round($vote['votes_contra']/$vote['total']*100,0) : $vote['votes_contra']; - $vote['party_ent'] = $vote['nr_attending'] > 0 ? round(($vote['nr_attending'] - $vote['votes_pro'] - $vote['votes_contra'])/$vote['total']*100,0) : $vote['nr_attending']; - $result .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/tpl/table_parties.tpl'), $vote); - } - - return $result; - } - - private function icons_party(){ - $vars = votes::get_bar_bt_per_poll($this->poll_ID); - if (!$vars['bt_total']){ - return '';} - $info = array(); - return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/tpl/icons_table_parties.tpl'), $info); - } - - private function bars_bt(){ - $vars = votes::get_bar_bt_per_poll($this->poll_ID); - if (!$vars['bt_total']){ - return 'Keine Ergebnisse für den Bundestag verfügbar';} - $vars['bt_ent'] = round(($vars['bt_attending'] - $vars['bt_pro'] - $vars['bt_con'])/$vars['bt_total']*100,0); - $vars['bt_pro'] = round($vars['bt_pro']/$vars['bt_total']*100,0); - $vars['bt_con'] = round($vars['bt_con']/$vars['bt_total']*100,0); - return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/tpl/table_bt.tpl'), $vars); - } - - private function voice_weight(){ - $vars = votes::get_count_user_votes_per_poll($this->poll_ID); - $vars['voteweight'] = $vars['count'] ? round(1/$vars['count']*100) : 'no votes'; - return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/tpl/voteweight.tpl'), $vars); - } - - private function p_fields (){ - $result = ""; - - $list = array (array(1, 'Aussenpolitik'), - array(2, 'Aussenpolitik'), - array(4, 'Aussenpolitik'), - array(8, 'Aussenpolitik')); - foreach($list as $l){ - if($p_fields & $l[0]) $result .= $l[1]; - } - return $result; - } - - private function vote_buttons($poll_expired,$user_poll){ - if($poll_expired){ - if(!$user_poll){ - return '