File: copyfilter.php

package info (click to toggle)
spotweb 20130826%2Bdfsg2-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 5,132 kB
  • ctags: 11,281
  • sloc: php: 31,367; xml: 1,009; sh: 148; makefile: 83
file content (22 lines) | stat: -rwxr-xr-x 643 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
error_reporting(E_ALL & ~8192 & ~E_USER_WARNING);       # 8192 == E_DEPRECATED maar PHP < 5.3 heeft die niet
require_once "lib/SpotClassAutoload.php";
#- main() -
        
require_once "settings.php";
        
# database object
$db = new SpotDb($settings['db']);
$db->connect();

$db->getDbHandle()->rawExec("DELETE FROM filters WHERE userid <> 1");
$userList = $db->getUserList("", 0, 9999999);

# loop through every user and fix it 
foreach($userList as $user) {
	if ($user['userid'] != 1) {
		echo "Copying filter from userid 1 to userid: " . $user['userid'] . PHP_EOL;
		$db->copyFilterList(1, $user['userid']);
	} # if
} # foreach