News - Features - Downloads - Forum - Team - Support - Switch View: Screen
Login - Registrierung - Passwort vergessen
Codepaste - Details
Weitere Infos zum Codepaste

Name Veränderte Votes Navlist
Autor de Horscht
CMS-Version ClanSphere 2008
Datei votes/navlist.php
Datum 21.06.2008 um 15:20 Uhr
Beschreibung Von Sickboy angepasste Votes:navlist, leider noch ohne Theme.
Alter Code Alter Code +-
 
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
1. / 2. / ... 
<?php
// ClanSphere 2008 - www.clansphere.net
// $Id: navlist.php 101 2006-07-12 09:36:29Z hajo $

$cs_lang cs_translate('votes');

$users_id $account['users_id'];
$users_ip $_SERVER['REMOTE_ADDR'];
$time cs_time();
$mod 'votes';
$votes_error '';
$votes_form 1;
$votes_access $account['access_votes'];

$from 'votes';
$select 'votes_id, votes_question, votes_election, votes_several';
$where "votes_access <= '" $votes_access "' AND votes_start <= '" $time "' AND votes_end >= '" $time "'";
$cs_votes cs_sql_select(__FILE__,$from,$select,$where);
$votes_loop count($cs_votes);
$votes_id $cs_votes['votes_id'];

if(!empty(
$votes_loop)) {
  
$where "voted_mod = 'votes' AND voted_fid = '" $votes_id "' AND voted_ip = '" $users_ip "'";
  if(
$users_id 0) {
    
$where .= " OR voted_mod = 'votes' AND voted_fid = '" $votes_id "' AND users_id = '" $users_id "'";
  }
  
$checkit_userip cs_sql_count(__FILE__,'voted',$where);
}

if(!empty(
$checkit_userip)) {
  
$votes_error++;
}

if(!empty(
$_REQUEST['mod'])) {
  
$vote_mod $_REQUEST['mod'];
} else {
  
$vote_mod "";
}

if(!empty(
$_REQUEST['action'])) {
  
$vote_action $_REQUEST['action'];
} else {
  
$vote_action "votes";
}

if(!empty(
$users_id)) {
  
$users_id $users_id;
} else {
  
$users_id '0';
}

if(!empty(
$_POST['voted_answer'])) {
  if(!empty(
$cs_votes['votes_several'])) {
    foreach(
$_POST['voted_answer'] AS $answer) {
      
$voted_answer[] = $answer;
    }
  } else { 
    
$voted_answer $_POST['voted_answer'];
  }
} else {
  
$votes_error++;
}

if(!empty(
$_REQUEST['votes_id'])) {
  
$votes_id $_REQUEST['votes_id'];
} else {
  
$votes_error++;
}

if(isset(
$_POST['submit_votes']) ) {
  if(empty(
$votes_error)) {
    
$votes_form 0;
    if(isset(
$_POST['votes_several'])) {
      for(
$run=0$run<count($_POST['voted_answer']); $run++) {
        
$votes_cells = array('voted_fid','users_id','voted_time','voted_answer','voted_ip','voted_mod');
        
$votes_save = array($votes_id,$users_id,$time,$voted_answer[$run],$users_ip,$mod);
        
cs_sql_insert(__FILE__,'voted',$votes_cells,$votes_save);        
      }
    } else {
      
$votes_cells = array('voted_fid','users_id','voted_time','voted_answer','voted_ip','voted_mod');
      
$votes_save = array($votes_id,$users_id,$time,$voted_answer,$users_ip,$mod);
      
cs_sql_insert(__FILE__,'voted',$votes_cells,$votes_save);      
    }

    echo 
$cs_lang['create_done'];
    echo 
cs_html_br(1);
    echo 
cs_link($cs_lang['continue'],'votes','list');
  } else {
    
$votes_form 0;
    echo 
$cs_lang['error_occurred'];
    echo 
cs_html_br(1);
    echo 
cs_link($cs_lang['continue'],'votes','list');
  }
}

if(!empty(
$cs_votes) AND !empty($votes_form)) {
  
$from 'voted';
  
$select 'voted_id, users_id, voted_ip, voted_answer';
  
$where "voted_fid = '$votes_id' AND voted_mod = 'votes'";
  
$cs_voted cs_sql_select(__FILE__,$from,$select,$where,'','0','0');
  
$voted_loop count($cs_voted);
  
$check_user_voted 0;
  for (
$run 0$run $voted_loop$run++) {
    
$voted_users $cs_voted[$run]['users_id'];
    
$voted_ip $cs_voted[$run]['voted_ip'];
    if(
$users_id 0) {
      if(
$voted_users == $users_id) {
        
$check_user_voted++;
      }
    }
    if(
$voted_ip == $users_ip) {
      
$check_user_voted++;
    }
  }
  if(empty(
$check_user_voted)) {
    
$votes_navlist = array();
    
$votes_navlist['lang']['create'] = $cs_lang['create'];
    
$votes_navlist['votes']['id'] = $votes_id;
    
$votes_navlist['votes']['type'] = empty($cs_votes['votes_several']) ? 'radio' 'checkbox';
    
$votes_navlist['if']['several'] = empty($cs_votes['votes_several']) ? 1;
    
$votes_navlist['if']['several_name'] = empty($cs_votes['votes_several']) ? 1;
    
$votes_navlist['votes']['question'] = $cs_votes['votes_question'];
#   $votes_navlist['votes']['action']     = '?' . $vote_action . $vote_more;
    
$votes_navlist['url']['action'] = cs_url('votes');
//    $votes_navlist['url']['action'] = '?' . $_SERVER['argv'][0];
        
    
$temp explode("\n"$cs_votes['votes_election']);
    
$answers_stop count($temp) - 1;
    for (
$run 0$run $answers_stop$run++) {
      
$votes_navlist['answers'][$run]['value'] = ($run 1);
      
$votes_navlist['answers'][$run]['answer'] = $temp[($run 1)];
    }
    echo 
cs_subtemplate(__FILE__,$votes_navlist,'votes','navlist_vote');
  } else {
    
$votes_navlist = array();
    
$votes_navlist['votes']['question'] = $cs_votes['votes_question'];
    
$temp explode("\n"$cs_votes['votes_election']);
    
$answers_stop count($temp) - 1;

    for (
$run 0$run $answers_stop$run++) {
      
$answer_count 0;
      for (
$run_2 0$run_2 $voted_loop$run_2++) {
        
$voted_answer $cs_voted[$run_2]['voted_answer'];
        if(
$voted_answer == ($run 1)) {
          
$answer_count++;
        }
      }
      if(!empty(
$answer_count)) {
        
$answer_percent $answer_count $voted_loop 100;
      } else {
        
$answer_percent '0';
      }
      
$answer_percent round($answer_percent,1);
      
$votes_navlist['results'][$run]['answer'] = $temp[($run 1)];
      
$votes_navlist['results'][$run]['percent'] = $answer_percent;
      if(!empty(
$answer_count)) {
        
$votes_navlist['results'][$run]['end_img'] = cs_html_img('symbols/votes/vote02.png','13','2');
      } else {
        
$votes_navlist['results'][$run]['end_img']    = '';
      }
    }
    
$votes_navlist['votes']['id'] = $votes_id;
    
$votes_navlist['lang']['current_vote'] = $cs_lang['current_vote'];
    echo 
cs_subtemplate(__FILE__,$votes_navlist,'votes','navlist_results');
  }
} else {
  if(!empty(
$votes_form)) {
    echo 
$cs_lang['no_actvote'];
  }
}
?>
Neuer Code Neuer Code +-
 
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
177.
1. / 2. / ... 
<?php
// ClanSphere 2008 - www.clansphere.net
// $Id: navlist.php 101 2006-07-12 09:36:29Z hajo $

$cs_lang cs_translate('votes');

$users_id $account['users_id'];
$users_ip $_SERVER['REMOTE_ADDR'];
$time cs_time();
$mod 'votes';
$votes_error '';
$votes_form 1;
$votes_access $account['access_votes'];

if(empty(
$cs_votes)) {
$sort ='rand()';
} else {
$sort ='';
}

$from 'votes';
$select 'votes_id, votes_question, votes_election, votes_several';
$where "votes_access <= '" $votes_access "' AND votes_start <= '" $time "' AND votes_end >= '" $time "'";
$cs_votes cs_sql_select(__FILE__,$from,$select,$where,$sort);
$votes_loop count($cs_votes);
$votes_id $cs_votes['votes_id'];

if(!empty(
$votes_loop)) {
  
$where "voted_mod = 'votes' AND voted_fid = '" $votes_id "' AND voted_ip = '" $users_ip "'";
  if(
$users_id 0) {
    
$where .= " OR voted_mod = 'votes' AND voted_fid = '" $votes_id "' AND users_id = '" $users_id "'";
  }
  
$checkit_userip cs_sql_count(__FILE__,'voted',$where);
}

if(!empty(
$checkit_userip)) {
  
$votes_error++;
}

if(!empty(
$_REQUEST['mod'])) {
  
$vote_mod $_REQUEST['mod'];
} else {
  
$vote_mod "";
}

if(!empty(
$_REQUEST['action'])) {
  
$vote_action $_REQUEST['action'];
} else {
  
$vote_action "votes";
}

if(!empty(
$users_id)) {
  
$users_id $users_id;
} else {
  
$users_id '0';
}

if(!empty(
$_POST['voted_answer'])) {
  if(!empty(
$cs_votes['votes_several'])) {
    foreach(
$_POST['voted_answer'] AS $answer) {
      
$voted_answer[] = $answer;
    }
  } else { 
    
$voted_answer $_POST['voted_answer'];
  }
} else {
  
$votes_error++;
}

if(!empty(
$_REQUEST['votes_id'])) {
  
$votes_id $_REQUEST['votes_id'];
} else {
  
$votes_error++;
}

if(isset(
$_POST['submit_votes']) ) {
  if(empty(
$votes_error)) {
    
$votes_form 0;
    if(isset(
$_POST['votes_several'])) {
      for(
$run=0$run<count($_POST['voted_answer']); $run++) {
        
$votes_cells = array('voted_fid','users_id','voted_time','voted_answer','voted_ip','voted_mod');
        
$votes_save = array($votes_id,$users_id,$time,$voted_answer[$run],$users_ip,$mod);
        
cs_sql_insert(__FILE__,'voted',$votes_cells,$votes_save);        
      }
    } else {
      
$votes_cells = array('voted_fid','users_id','voted_time','voted_answer','voted_ip','voted_mod');
      
$votes_save = array($votes_id,$users_id,$time,$voted_answer,$users_ip,$mod);
      
cs_sql_insert(__FILE__,'voted',$votes_cells,$votes_save);      
    }

    echo 
$cs_lang['create_done'];
    echo 
cs_html_br(1);
    echo 
cs_link($cs_lang['continue'],'votes','list');
  } else {
    
$votes_form 0;
    echo 
$cs_lang['error_occurred'];
    echo 
cs_html_br(1);
    echo 
cs_link($cs_lang['continue'],'votes','list');
  }
}

if(!empty(
$cs_votes) AND !empty($votes_form)) {
  
$from 'voted';
  
$select 'voted_id, users_id, voted_ip, voted_answer';
  
$where "voted_fid = '$votes_id' AND voted_mod = 'votes'";
  
$cs_voted cs_sql_select(__FILE__,$from,$select,$where,'','0','0');
  
$voted_loop count($cs_voted);
  
$check_user_voted 0;
  for (
$run 0$run $voted_loop$run++) {
    
$voted_users $cs_voted[$run]['users_id'];
    
$voted_ip $cs_voted[$run]['voted_ip'];
    if(
$users_id 0) {
      if(
$voted_users == $users_id) {
        
$check_user_voted++;
      }
    }
    if(
$voted_ip == $users_ip) {
      
$check_user_voted++;
    }
  }
  if(empty(
$check_user_voted)) {
    
$votes_navlist = array();
    
$votes_navlist['lang']['create'] = $cs_lang['create'];
    
$votes_navlist['votes']['id'] = $votes_id;
    
$votes_navlist['votes']['type'] = empty($cs_votes['votes_several']) ? 'radio' 'checkbox';
    
$votes_navlist['if']['several'] = empty($cs_votes['votes_several']) ? 1;
    
$votes_navlist['if']['several_name'] = empty($cs_votes['votes_several']) ? 1;
    
$votes_navlist['votes']['question'] = $cs_votes['votes_question'];
#   $votes_navlist['votes']['action']     = '?' . $vote_action . $vote_more;
    
$votes_navlist['url']['action'] = cs_url('votes');
//    $votes_navlist['url']['action'] = '?' . $_SERVER['argv'][0];
        
    
$temp explode("\n"$cs_votes['votes_election']);
    
$answers_stop count($temp) - 1;
    for (
$run 0$run $answers_stop$run++) {
      
$votes_navlist['answers'][$run]['value'] = ($run 1);
      
$votes_navlist['answers'][$run]['answer'] = $temp[($run 1)];
    }
    echo 
cs_subtemplate(__FILE__,$votes_navlist,'votes','navlist_vote');
  } else {
    
$votes_navlist = array();
    
$votes_navlist['votes']['question'] = $cs_votes['votes_question'];
    
$temp explode("\n"$cs_votes['votes_election']);
    
$answers_stop count($temp) - 1;

    for (
$run 0$run $answers_stop$run++) {
      
$answer_count 0;
      for (
$run_2 0$run_2 $voted_loop$run_2++) {
        
$voted_answer $cs_voted[$run_2]['voted_answer'];
        if(
$voted_answer == ($run 1)) {
          
$answer_count++;
        }
      }
      if(!empty(
$answer_count)) {
        
$answer_percent $answer_count $voted_loop 100;
      } else {
        
$answer_percent '0';
      }
      
$answer_percent round($answer_percent,1);
      
$votes_navlist['results'][$run]['answer'] = $temp[($run 1)];
      
$votes_navlist['results'][$run]['percent'] = $answer_percent;
      if(!empty(
$answer_count)) {
        
$votes_navlist['results'][$run]['end_img'] = cs_html_img('symbols/votes/vote02.png','13','2');
      } else {
        
$votes_navlist['results'][$run]['end_img']    = '';
      }
    }
    
$votes_navlist['votes']['id'] = $votes_id;
    
$votes_navlist['lang']['current_vote'] = $cs_lang['current_vote'];
    echo 
cs_subtemplate(__FILE__,$votes_navlist,'votes','navlist_results');
  }
} else {
  if(!empty(
$votes_form)) {
    echo 
$cs_lang['no_actvote'];
  }
}
?>
Zurück - Übersicht

Kommentare: 4
Seite [1]
Horscht

18.05.2024

Ort: -
Beiträge: 765
# 1 - 21.06.2008 um 15:22 Uhr

Dieser Codepast lässt die Votes bei jedem Seitenaufruf wechseln, solltet Ihr mehrere Votes gleichzeitig laufen haben.
Tille2000

22.10.2011

Ort: -
Beiträge: 93
# 2 - 15.10.2008 um 17:13 Uhr

Hallo, kann es sein das in der Version 2008.2.1 nicht mehr funktioniert? Jedesmal wenn ich abstimmen will, erhalte ich die Meldung das ein Fehler aufgetreten ist.
coolcat

25.11.2015

Ort: Buchholz in der Nordheide
Beiträge: 262
# 3 - 22.10.2008 um 11:41 Uhr

kommt bei mir auch.....aber in der Version 2008 (leider)

mfg

Coolcat
Horscht

18.05.2024

Ort: -
Beiträge: 765
# 4 - 05.12.2008 um 15:49 Uhr

Hmm. Vllt nochmal im Forum nachfragen


Bitte Login benutzen, um Kommentare zu schreiben.


ClanSphere Project - Mailus - Imprint - Disclaimer - Scriptinfo