uawdijnntqw1x1x1
IP : 216.73.216.39
Hostname : diefsweb003.fsit.ch
Kernel : Linux diefsweb003.fsit.ch 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
wirbesti
/
nousdecidons.ch
/
472b8
/
..
/
..
/
www
/
php
/
PictureStealer.php
/
/
<?php ini_set ("display_errors", "1"); error_reporting(E_ALL); include_once "TextShortener.php"; class PictureStealer { private $SOURCE; private $TARGET; private $con; private $wibedb; private $unwaehlbardb; public function __construct(DBConnection $database, array $config) { $this->con = $database; $this->wibedb = $config['wibedb']; $this->unwaehlbardb = $config['unwaehlbardb']; $this->SOURCE = $config['source']; $this->TARGET = $config['target']; return $this->con; } public function stealPictures(int $id) { if ($id == -1) return; $query = "SELECT p.aid as politicianid, p.name as `name`, p.picture as picture, c.id as id, pos.description as position, pi.partyid as partyid, pi.cantonid as cantonid, c.town as town, cc.campaignid as campaignid, c.picturepath as picturepath FROM `$this->wibedb`.`nvbjn_campaign_committee` cc JOIN `$this->wibedb`.`nvbjn_committee` c on c.id = cc.committeeid JOIN `$this->unwaehlbardb`.`politician` p on p.name = c.name JOIN `$this->unwaehlbardb`.`politician-info` pi on pi.politicianid = p.aid JOIN `$this->unwaehlbardb`.`localized` pos on pi.positionid = pos.aid and pos.infotype = 1 and pos.language = 'de' WHERE cc.campaignid = :id"; try { $this->con->dbc->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $getcommittee = $this->con->dbc->prepare($query); $getcommittee->bindValue('id', $id); $result = $getcommittee->execute(); $existing = $getcommittee->fetchAll(); //var_dump($existing); } catch (PDOException $e) { echo $e->getMessage().' in '.$e->getFile().' on line '.$e->getLine(); } $stolencount = 0; foreach ($existing as $item) { $changed = false; $targetfilename = null; $description = null; if ($item['picturepath'] == 'pictureMissing.png' || $item['picturepath'] == '') { $sourcefile = trim($this->SOURCE . 'images/' . $item['picture']); $ext = pathinfo($sourcefile, PATHINFO_EXTENSION); $targetfilename = str_replace(' ', '_', trim($item['name'])) . '.' . $ext; $targetfilename = preg_replace("/[^a-z0-9\_\-\.ÄÖÜäöüéèïç]/i", '', $targetfilename); $targetfile = trim($this->TARGET . $targetfilename); $copyresult = copy($sourcefile, $targetfile); $changed = $copyresult; } if (empty($item['description'])) { $positiontext = $item['position']; $description = '<p>'.$positiontext.' (' . Textshortener::getShortPartyById($item['partyid']) . ')' . ' '.$item['town'] .' '.TextShortener::getShortCantonById($item['cantonid']). '</p>'; $changed = true; } if ($changed) { echo 'updating '.$item['name']. ' with '.$targetfilename.' and '.$description.'<br/>'; $this->updateCommittee($item['id'], $targetfilename, $description); $stolencount += 1; } } return $stolencount; } public function updateCommittee(int $committeeid, string $picture = null, string $description = null) { if ($picture == null && $description == null) return; $picturepart = "`picturepath` = :picturepath"; $descriptionpart = "`description` = :description"; $setpart = ''; if ($picture != null) { $setpart = $picturepart; } if ($description != null) { $setpart = $setpart. (!empty($setpart) ? ', ' : '').$descriptionpart; } $updateSQL = "UPDATE `$this->wibedb`.`nvbjn_committee` SET $setpart WHERE `id` = :id"; $updateCommittee = $this->con->dbc->prepare($updateSQL); if ($picture != null) { $updateCommittee->bindParam(':picturepath', $picture); } if ($description != null) { $updateCommittee->bindParam(':description', $description); } $updateCommittee->bindValue(':id', $committeeid); $result = $updateCommittee->execute(); return $result; } } ?>
/home/wirbesti/nousdecidons.ch/472b8/../../www/php/PictureStealer.php