Issues (1839)

html/ops/bbcode_convert_response2.php (1 issue)

1
<?php
2
// This file is part of BOINC.
3
// http://boinc.berkeley.edu
4
// Copyright (C) 2008 University of California
5
//
6
// BOINC is free software; you can redistribute it and/or modify it
7
// under the terms of the GNU Lesser General Public License
8
// as published by the Free Software Foundation,
9
// either version 3 of the License, or (at your option) any later version.
10
//
11
// BOINC is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
// See the GNU Lesser General Public License for more details.
15
//
16
// You should have received a copy of the GNU Lesser General Public License
17
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
18
19
$cli_only = true;
20
require_once("../inc/util_ops.inc");
21
require_once('../inc/bbcode_convert.inc');
22
23
db_init();
24
25
set_time_limit(0);
26
27
function fix_profile($profile) {
28
    $text = html_to_bbcode($profile->response2);
29
    if ($text != $profile->response2) {
30
        $query = "update profile set response2 = '"._mysql_escape_string($text)."' where userid=".$profile->userid;
31
        //echo "$profile->response2\n\n";
32
        //echo "$profile->thread $query\n\n";
33
        $retval = _mysql_query($query);
34
        if (!$retval) {
35
            echo _mysql_error();
36
            exit();
0 ignored issues
show
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
37
        }
38
    }
39
}
40
41
function fix_profiles() {
42
    $start_id = 0; //Set this to something else if you like
43
    $profiles = _mysql_query("select * from profile where userid>$start_id order by userid");
44
    echo _mysql_error();
45
    $i=0;
46
    while ($profile = _mysql_fetch_object($profiles)){
47
        $i++;
48
        if ($i%100 == 0) {                      //For every 100 profiles
49
            echo $profile->userid.". "; flush();   // print out where we are
50
            //usleep(200000);
51
        }
52
53
        if ($profile->userid > $start_id){
54
            fix_profile($profile);
55
        }
56
    }
57
}
58
59
// use this to patch problem cases; hand-edit
60
function fix_fix() {
61
    $profiles = _mysql_query("select * from profile where id=99");
62
    $profile = _mysql_fetch_object($profiles);
63
    fix_profile($profile);
64
}
65
66
fix_profiles();
67
//fix_fix();
68
69
?>
70