rendered paste body<?php
/**
*
* @package phpBB3
* @version $Id: index.php,v 1.176 2007/10/05 14:30:06 acydburn Exp $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('');
$sql = "SELECT * FROM phpbb_rating";
$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result))
{
// okay looping through the old ratings, now obtain topic id and copy.
$sql = "SELECT topic_id FROM " . POSTS_TABLE . " WHERE post_id = '" . $row['post_id'] . "'";
$new_result = $db->sql_query($sql);
$new_row = $db->sql_fetchrow($new_result);
/*
16 = 0
15 = 5
14 = 4
13 = 2
12 = 3
11 = 1
*/
switch($row['option_id'])
{
case "16":
case "11":
$ev = 1;
break;
case "15":
$ev = 5;
break;
case "14":
$ev = 4;
break;
case "13":
$ev = 2;
break;
case "12":
$ev = 3;
break;
}
// insert
$sql = "INSERT INTO phpbb_topics_evaluation (topic_id, evaluation, user_id) VALUES ('" . $new_row['topic_id'] . "', '" . $ev . "', '" . $row['user_id'] . "');";
$db->sql_query($sql);
}
?>