News - Features - Downloads - Forum - Team - Support - Switch View: Screen
Login - Registrierung - Passwort vergessen

Antworten: 4
Seite [1]
malice


Try to beat me




Beiträge: 122
# Thema - 09.11.2009 um 21:56 Uhr
hi, ich hab versucht aus der files/view.php das mit dem rating auf die replays/view.php zu übertragen, allerdings funktioniert das nicht.
in der datenbank hab ich in die der replays, ne replay_vote tabelle hinzugefügt (mit dem selben werten wie in der files db)

kann mir jmd sagen, was ich noch ändern muss?


replays/view.php +-

 
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.
1. / 2. / ... 
<?php
// ClanSphere 2009 - www.clansphere.net
// $Id$

$cs_lang cs_translate('replays');

$cs_replays_id = empty($_REQUEST['where']) ? $_GET['id'] : $_REQUEST['where'];
settype($cs_replays_id,'integer');

$select 'users_id, replays_since, categories_id, games_id, replays_version, replays_team1, ';
$select .= 'replays_team2, replays_date, replays_map, replays_vote, replays_mirrors, replays_info, replays_id, replays_close';
$cs_replays cs_sql_select(__FILE__,'replays',$select,"replays_id = '" $cs_replays_id "'");



$from 'voted';
$select 'users_id, voted_answer';
$where "voted_fid = '" $replays_id "' AND voted_mod = '" $modul "'"
$order '';
$start '';
$cs_voted cs_sql_select(__FILE__,$from,$select,$where,0,0,0);
$voted_loop count($cs_voted);

if(!empty(
$_POST['voted_answer'])) 
{
  
$voted_answer $_POST['voted_answer'];
}

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

$check_user_voted 0;
for (
$run 0$run $voted_loop$run++)
{
  
$voted_users_id $cs_voted[$run]['users_id'];
  if(
$voted_users_id == $users_id)
  {
    
$check_user_voted++;
  }
}

if(empty(
$check_user_voted))
{  
  if(isset(
$_POST['submit'])) 
  {        
    
$time cs_time();
    
$voted_ip =$_SERVER['REMOTE_ADDR'];
    
$votes_cells = array('voted_fid','users_id','voted_time','voted_answer','voted_ip','voted_mod');
    
$votes_save = array($replays_id,$users_id,$time,$voted_answer,$voted_ip,$modul);
    
cs_sql_insert(__FILE__,'voted',$votes_cells,$votes_save);
    
header('location:' $_SERVER['PHP_SELF'] . '?mod=replays&action=view&where=' .$replays_id);
  }
}


$who "users_id = '" $cs_replays['users_id'] . "'";
$cs_users cs_sql_select(__FILE__,'users','users_nick, users_active, users_delete',$who);
$cs_users_nick cs_secure($cs_users['users_nick']);
$data['replays']['user'] = cs_user($cs_replays['users_id'],$cs_users['users_nick'], $cs_users['users_active'], $cs_users['users_delete']);

$data['replays']['since'] = cs_date('unix',$cs_replays['replays_since'],1);

$where "categories_id = '" $cs_replays['categories_id'] . "'";
$cs_cat cs_sql_select(__FILE__,'categories','categories_name, categories_id',$where);
$data['replays']['category'] = cs_link($cs_cat['categories_name'],'categories','view','id=' $cs_cat['categories_id']);

if(!empty(
$cs_replays['games_id'])) {
  
$img cs_html_img('uploads/games/' $cs_replays['games_id'] . '.gif') . ' ';
  
$where "games_id = '" $cs_replays['games_id'] . "'";
  
$cs_game cs_sql_select(__FILE__,'games','games_name, games_id',$where);
  
$data['replays']['game_img'] = $img cs_link($cs_game['games_name'],'games','view','id=' $cs_game['games_id']);
}
else {
  
$data['replays']['game_img'] = ' - ';
}

$data['replays']['version'] = cs_secure($cs_replays['replays_version']);
$data['replays']['team1'] = cs_secure($cs_replays['replays_team1']);
$data['replays']['team2'] = cs_secure($cs_replays['replays_team2']);
$data['replays']['date'] = cs_date('date',$cs_replays['replays_date']);
$data['replays']['map'] = cs_secure($cs_replays['replays_map']);

$data['if']['vote'] = false;

$data['if']['unvoted'] = false;

if(!empty(
$cs_replays['replays_vote'])) {
  
$data['if']['vote'] = true;
  
$data['votes'] = array();
  if(empty(
$check_user_voted)) {  
    
$data['if']['unvoted'] = true;
    for(
$l 1;$l 7;$l++) {
      
$data['votes'][$l-1]['name'] = $l ' - ' $cs_lang['vote_' $l];
      
$data['votes'][$l-1]['value'] = $l;
    }   
  }
  else
  {
    
$replays_votes 0;
    for(
$run=0$run<$voted_loop$run++) 
    {
      
$a cs_secure($cs_voted[$run]['voted_answer']);
      
$replays_votes += $a;
    }  
    
$replays_votes $replays_votes $voted_loop;
    
$replays_votes round($replays_votes,2);
    
$replays_votes round($replays_votes,0);
    
$stars '';
    for(
$run=6$run>$replays_votes$run--) 
    {
      
$stars .= cs_icon('favorites');
    }
    for(
$run=1$run<$replays_votes$run++) 
    {
      
$stars .= cs_icon('favorites1');
    }
    
$data['vote']['stars'] = $stars;
  }
}


if(empty(
$cs_replays['replays_mirrors'])) {
  
$data['replays']['mirrors'] = ' - ';
}
else {
  
$mirror explode("\n"$cs_replays['replays_mirrors']); 
  foreach(
$mirror AS $load) {
    
$data['replays']['mirrors'] = cs_html_link($load,$load) . cs_html_br(1);
  }
}

$data['replays']['info'] = cs_secure($cs_replays['replays_info'],1,1);

echo 
cs_subtemplate(__FILE__,$data,'replays','view');

$where_com "comments_mod = 'replays' AND comments_fid = '" $cs_replays['replays_id'] . "'";
$count_com cs_sql_count(__FILE__,'comments',$where_com);
include_once(
'mods/comments/functions.php');

if(!empty(
$count_com)) {
  echo 
cs_html_br(1);
  echo 
cs_comments_view($cs_replays_id,'replays','view',$count_com);
}

echo 
cs_comments_add($cs_replays_id,'replays',$cs_replays['replays_close']);


Zuletzt editiert von malice am 09.11.2009 um 23:10 Uhr (2x Editiert)
Inaktiv
Tom08 ClanSphere Team

Supporter
Supporter



Herkunft: Daheim
Beiträge: 2923
# Antwort: 1 - 09.11.2009 um 22:10 Uhr
Du musst noch $modul definieren.

Suche
 
1.
1. / 2. / ... 
 $from 'voted';


Füge davor ein
 
1.
1. / 2. / ... 
 $modul 'replays';


Dann sollte es funktionieren.

lg,
Tom

/e: ABCode korrigiert



------------------
Bei Problemen mit Code von mir bitte eine Private Nachricht an mich


Zuletzt editiert von Tom08 ClanSphere Team am 09.11.2009 um 22:11 Uhr (1x Editiert)
Inaktiv
|
malice
Thread-Ersteller


Try to beat me




Beiträge: 122
# Antwort: 2 - 09.11.2009 um 22:25 Uhr
hi, erstmal danke für die schnelle hilfe


ein problem gibt es noch, ich hab ein replay bewertet und die bewertung wird jetzt bei allen replays angezeigt.

nach dem bewerten bin ich außerdem auf ner anderen seite gelandet
index.php?mod=replays&action=view&where=
hab das in zeile 58 geändert, müsste ja jetzt klappen

edit: klappt doch nicht, er setzt die id nicht hinter die url, außerdem konnte ich auch voten, ohne eingeloggt zu sein

edit2: er speichert das voting mit voted_fid = 0 in der datenbank, also irgendwie geht das mit der replays_id nicht


edit3: die datei ist jetzt

replays/view.php +-

 
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.
1. / 2. / ... 

<?php
// ClanSphere 2009 - www.clansphere.net
// $Id$

$cs_lang cs_translate('replays');

$cs_replays_id = empty($_REQUEST['where']) ? $_GET['id'] : $_REQUEST['where'];
settype($cs_replays_id,'integer');

$select 'users_id, replays_since, categories_id, games_id, replays_version, replays_team1, ';
$select .= 'replays_team2, replays_date, replays_map, replays_vote, replays_mirrors, replays_info, replays_id, replays_close';
$cs_replays cs_sql_select(__FILE__,'replays',$select,"replays_id = '" $cs_replays_id "'");


$modul 'replays';
$from 'voted';
$select 'users_id, voted_answer';
$where "voted_fid = '" $replays_id "' AND voted_mod = '" $modul "'"
$order '';
$start '';
$cs_voted cs_sql_select(__FILE__,$from,$select,$where,0,0,0);
$voted_loop count($cs_voted);

if(!empty(
$_POST['voted_answer'])) 
{
  
$voted_answer $_POST['voted_answer'];
}

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

$check_user_voted 0;
for (
$run 0$run $voted_loop$run++)
{
  
$voted_users_id $cs_voted[$run]['users_id'];
  if(
$voted_users_id == $users_id)
  {
    
$check_user_voted++;
  }
}

if(empty(
$check_user_voted))
{  
  if(isset(
$_POST['submit'])) 
  {        
    
$time cs_time();
    
$voted_ip =$_SERVER['REMOTE_ADDR'];
    
$votes_cells = array('voted_fid','users_id','voted_time','voted_answer','voted_ip','voted_mod');
    
$votes_save = array($replays_id,$users_id,$time,$voted_answer,$voted_ip,$modul);
    
cs_sql_insert(__FILE__,'voted',$votes_cells,$votes_save);
    
header('location:' $_SERVER['PHP_SELF'] . '?mod=replays&action=view&id=' .$replays_id);
  }
}



$who "users_id = '" $cs_replays['users_id'] . "'";
$cs_users cs_sql_select(__FILE__,'users','users_nick, users_active, users_delete',$who);
$cs_users_nick cs_secure($cs_users['users_nick']);
$data['replays']['user'] = cs_user($cs_replays['users_id'],$cs_users['users_nick'], $cs_users['users_active'], $cs_users['users_delete']);

$data['replays']['since'] = cs_date('unix',$cs_replays['replays_since'],1);

$where "categories_id = '" $cs_replays['categories_id'] . "'";
$cs_cat cs_sql_select(__FILE__,'categories','categories_name, categories_id',$where);
$data['replays']['category'] = cs_link($cs_cat['categories_name'],'categories','view','id=' $cs_cat['categories_id']);

if(!empty(
$cs_replays['games_id'])) {
  
$img cs_html_img('uploads/games/' $cs_replays['games_id'] . '.gif') . ' ';
  
$where "games_id = '" $cs_replays['games_id'] . "'";
  
$cs_game cs_sql_select(__FILE__,'games','games_name, games_id',$where);
  
$data['replays']['game_img'] = $img cs_link($cs_game['games_name'],'games','view','id=' $cs_game['games_id']);
}
else {
  
$data['replays']['game_img'] = ' - ';
}

$data['replays']['version'] = cs_secure($cs_replays['replays_version']);
$data['replays']['team1'] = cs_secure($cs_replays['replays_team1']);
$data['replays']['team2'] = cs_secure($cs_replays['replays_team2']);
$data['replays']['date'] = cs_date('date',$cs_replays['replays_date']);
$data['replays']['map'] = cs_secure($cs_replays['replays_map']);

$data['if']['vote'] = false;

$data['if']['unvoted'] = false;

if(!empty(
$cs_replays['replays_vote'])) {
  
$data['if']['vote'] = true;
  
$data['votes'] = array();
  if(empty(
$check_user_voted)) {  
    
$data['if']['unvoted'] = true;
    for(
$l 1;$l 7;$l++) {
      
$data['votes'][$l-1]['name'] = $l ' - ' $cs_lang['vote_' $l];
      
$data['votes'][$l-1]['value'] = $l;
    }   
  }
  else
  {
    
$replays_votes 0;
    for(
$run=0$run<$voted_loop$run++) 
    {
      
$a cs_secure($cs_voted[$run]['voted_answer']);
      
$replays_votes += $a;
    }  
    
$replays_votes $replays_votes $voted_loop;
    
$replays_votes round($replays_votes,2);
    
$replays_votes round($replays_votes,0);
    
$stars '';
    for(
$run=6$run>$replays_votes$run--) 
    {
      
$stars .= cs_icon('favorites');
    }
    for(
$run=1$run<$replays_votes$run++) 
    {
      
$stars .= cs_icon('favorites1');
    }
    
$data['vote']['stars'] = $stars;
  }
}


if(empty(
$cs_replays['replays_mirrors'])) {
  
$data['replays']['mirrors'] = ' - ';
}
else {
  
$mirror explode("\n"$cs_replays['replays_mirrors']); 
  foreach(
$mirror AS $load) {
    
$data['replays']['mirrors'] = cs_html_link($load,$load) . cs_html_br(1);
  }
}

$data['replays']['info'] = cs_secure($cs_replays['replays_info'],1,1);

echo 
cs_subtemplate(__FILE__,$data,'replays','view');

$where_com "comments_mod = 'replays' AND comments_fid = '" $cs_replays['replays_id'] . "'";
$count_com cs_sql_count(__FILE__,'comments',$where_com);
include_once(
'mods/comments/functions.php');

if(!empty(
$count_com)) {
  echo 
cs_html_br(1);
  echo 
cs_comments_view($cs_replays_id,'replays','view',$count_com);
}

echo 
cs_comments_add($cs_replays_id,'replays',$cs_replays['replays_close']);



das problem ist, ich kann bewerten, allerdings lande ich danach auf ner seite mit der url: index.php?mod=replays&action=view&id= (also ohne id hinter dem gleichzeichen) außerdem wird in der datenbank unter voted_fid eine 0 gespeichert und nicht die id das replays


Zuletzt editiert von malice am 10.11.2009 um 00:12 Uhr (10x Editiert)
Inaktiv
|
SCHIRI ClanSphere Team


Weltmeister



Herkunft: Hamburg
Beiträge: 5299
# Antwort: 3 - 10.11.2009 um 17:53 Uhr
problem per msn gelöst. der fehler war, dass der {replays:id}-Platzhalter nicht definiert war.


------------------
www.laszlokorte.de

Zuletzt editiert von SCHIRI ClanSphere Team am 10.11.2009 um 17:54 Uhr (1x Editiert)
Inaktiv
|
malice
Thread-Ersteller


Try to beat me




Beiträge: 122
# Antwort: 4 - 10.11.2009 um 18:56 Uhr
hier die fertigen dateien, falls es noch wen anders interessiert:

view.php http://pastie.org/692251
view.tpl http://www.pastie.org/692253


zusätzlich muss man in der db bei replays noch ne replay_vote tabelle einfügen, eigenschaften gnauso wie bei den files in der db


danke für den super support hier


Inaktiv
|
Antworten: 4
Seite [1]


Sie müssen sich registrieren, um zu antworten.


ClanSphere Project - Mailus - Imprint - Disclaimer - Scriptinfo