id = $id; $this->aid = $aid; /* Moodiin liittyvät (html/plain) */ if(empty($mode)) $this->mode = "html"; else $this->mode = $mode; if($this->mode != "html" && $this->mode != "plain") die("Wrong mode, error occured."); /* Jos ID:tä ei määritelty */ if(empty($this->id)) die("Virhe! Ei ID:tä."); /* Katsotaan montako löytyy */ $res = mysql_query("SELECT * FROM publishments WHERE id = " . $this->id); if(@mysql_num_rows($res)==0) die("No publishments with this ID."); /* Otetaan template */ $row = mysql_fetch_array($res); if($row["template"] == 0) die("No template chosen, error occured."); $this->template = $row["template"]; if($GLOBALS["rand"] != $row["random"]) die("Randomstring isn't right."); $this->random = $row["random"]; $this->mainid = $row["mainid"]; /* asetetaan julkaisukohtainen äänitiedosto */ $this->soundfile = (!empty($row["sound"]) ? $row["sound"] : false); /* Asetetaan kieli */ $GLOBALS["langid"] = $row["langid"]; getlangfile($row["langid"]); /* tarkistetaan tulostetaanko julkaisu (lista) vai yksisivuinen tiedote / artikkeli */ $res = mysql_query("select * from publishmentarticles where publishmentid = " . $this->id); $luku = mysql_num_rows($res); $this->luku = $luku; if(!empty($aid)) { $this->type = "article"; } else { if($luku > 1) { $this->type = "publishment"; } elseif($luku==1) { $this->type = "article"; $row = mysql_fetch_array($res); $this->aid = $row["articleid"]; } else { die("No articles chosen to the publishment."); } } if($this->type=="article" && isset($this->aid)) { /* nollataan julkaisukohtainen ääni */ $this->soundfile = false; $res = mysql_query("SELECT mainid, sound FROM articles WHERE id = $this->aid"); $row = mysql_fetch_array($res); if(mysql_num_rows($res)==0) die("Artikkelia ei löydy."); if($row["mainid"] != $this->mainid) die("Article doesn't belong to this publishment."); /* jos artikkelilla on ääni, asetetaan äänitiedosto */ if(!empty($row["sound"])) { /* asetetaan julkaisukohtainen äänitiedosto */ $this->soundfile = $row["sound"]; } } $row = mysql_fetch_array(mysql_query("select * from templates where id = " . $this->template)); if($this->type == "publishment" && $row["type"] == "yksisivuinen") die("Wrong templatetype."); } function showpage() { if($this->mode == "html") include($GLOBALS["templatepath"] . "/pohja" . $this->template . ".php3"); else $this->showmain(); } function showmain() { switch($this->type) { case "article": $this->showarticle(); break; case "publishment": $this->showarticles(); break; } } function subject() { $row = mysql_fetch_array(mysql_query("select subject from publishments where id = " . $this->id)); if(!empty($row["subject"])) return $row["subject"]; else return $GLOBALS["mailsubject"]; } function publishmentdate() { $row = mysql_fetch_array(mysql_query("select DATE_FORMAT(date,'%e.%c.%Y') as date from publishments where id = " . $this->id)); if($row["date"] != "0.0.0000") return $row["date"]; else return; } function showarticles() { $res = mysql_query("select * from publishmentarticles where publishmentid = " . $this->id . " order by position"); if($this->mode == "html") { print(""); while($row = mysql_fetch_array($res)) { $res2 = mysql_query("select *,DATE_FORMAT(added,'%e.%c.%Y') as added2 from articles where id = $row[articleid]"); if(mysql_num_rows($res2)>0) { $row2 = mysql_fetch_array($res2); print(""); } } print("
\n"); print("" . htmlspecialchars($row2["subject"]) . "
\n"); print("(" . getname($row2["user"]) . ", $row2[added2])

"); if(!empty($row2["photo1"])) print("\"kuva\"\n"); print("" . muotoile($row2["shortarticle"]) . "\n"); if(!empty($row2["longarticle"])) print("

\nrandom&aid=" . $row2["id"] . "\">" . l("moreinfo") . "\n

\n"); print("
"); } else { while($row = mysql_fetch_array($res)) { $res2 = mysql_query("select *,DATE_FORMAT(added,'%e.%c.%Y') as added2 from articles where id = $row[articleid]"); if(mysql_num_rows($res2)>0) { $row2 = mysql_fetch_array($res2); print($row2["subject"] . "\n"); print("(" . getname($row2["user"]) . ", $row2[added2])\n\n"); print($this->stripspecial($row2["shortarticle"]) . "\n\n"); print("[koko uutinen: ". $GLOBALS["baseurl"] . "/show.php3?id=" . $this->id . "&rand=$this->random&aid=" . $row2["id"] . " ]\n\n"); print("--------------------------------------------------------------\n"); } } } } function showarticle() { $res = mysql_query("select *,DATE_FORMAT(added,'%e.%c.%Y') as added2 from articles where id = " . $this->aid); if(mysql_num_rows($res)==0) return 0; $row = mysql_fetch_array($res); if($this->mode == "html") { print(""); print(""); print("
"); print("" . htmlspecialchars($row["subject"]) . "
"); print("(" . getname($row["user"]) . ", $row[added2])

"); /* Kuva3/4 hommat */ $longarticle = muotoile($row["longarticle"]); if(!empty($row["photo3file"])) $longarticle = ereg_replace("(\[(kuva3|photo3)\])", "", $longarticle); if(!empty($row["photo4file"])) $longarticle = ereg_replace("(\[(kuva4|photo4)\])", "", $longarticle); /* kuvahommat loppu */ print("" . muotoile($row["shortarticle"]) . "
"); print("$longarticle
"); if(!empty($row["info"])) print("
" . l("furtherinformations") . ":

" . muotoile($row["info"]) . "

"); if(!empty($row["file1"]) || !empty($row["file2"]) || !empty($row["file3"])) { // Ponsselle avataan liitetiedostot uuteen ikkunaan, Jari Rytkönen 4.7.2003 if ($this->mainid == 72 || $this->mainid == 73) $uuteen = "target=\"_blank\""; print("


" . l("attachments") . ":

"); } print("
"); } // if mode = html else // if mode = plain { print($row["subject"] . "\n"); print("(" . getname($row["user"]) . ", $row[added2])\n\n"); print($this->stripspecial($row["shortarticle"]) . "\n\n"); print($this->stripspecial($row["longarticle"]) . "\n\n"); if(!empty($row["info"])) print("LISÄINFOA:\n"); print($this->stripspecial($row["info"]) . "\n\n"); if(!empty($row["file1"]) || !empty($row["file2"]) || !empty($row["file3"])) { print("--------\n"); if(!empty($row["file1"])) print(l("attachment")." 1: $row[file1] (" . $GLOBALS["dataurl"] . "/$row[file1file])\n"); if(!empty($row["file2"])) print(l("attachment")." 2: $row[file2] (" . $GLOBALS["dataurl"] . "/$row[file2file])\n"); if(!empty($row["file3"])) print(l("attachment")." 3: $row[file3] (" . $GLOBALS["dataurl"] . "/$row[file3file])\n"); print("--------\n\n"); } } } function showright() { if($this->type == "article") { $res = mysql_query("select photo2file, photo2text from articles where id = " . $this->aid); if(@mysql_num_rows($res)>0) { $row = mysql_fetch_array($res); if(!empty($row["photo2file"])) { print("\"kuva2\""); print("
" . muotoile($row["photo2text"]) . "template . "_right.php3"); } } function showleft() { if($this->type == "publishment" || $this->luku > 1) { /* vasemmat linkkitekstit */ switch($this->template) { case 29: case 30: { $class = "ylaheaderbold"; $linkclass = "linkdatainfo"; break; } case 84: case 85: { $class = "ylaheader"; $linkclass = "linkit3ip"; break; } case 115: case 116: { $class = "yleheader"; $linkclass = "linkkansallistie"; break; } case 230: { $class = "linksavonvoima"; $linkclass = "linksavonvoima"; break; } case 343: case 345: { $class = "linksncc"; $linkclass = "linksncc"; break; } case 355: { $class = "linksluontomatkat"; $linkclass = "linksluontomatkat"; break; } case 356: case 357: { $class = "white"; $linkclass = "white"; break; } default: { $class = "ylaheader"; $linkclass = "link"; } } /* vasemmat linkkien väliset viivat */ switch($this->template) { case 115: case 116: { $hr = "
"; break; } case 343: case 345: { $hr = "

"; break; } case 351: { $hr = "
"; break; } case 356: case 357: { $hr = "
"; break; } default: { $hr = "
"; } } $res = mysql_query("select * from publishmentarticles where publishmentid = " . $this->id . " order by position"); while($row = mysql_fetch_array($res)) { $res2 = mysql_query("select id,subject from articles where id = " . $row["articleid"]); if(mysql_num_rows($res2)>0) { $row2 = mysql_fetch_array($res2); print("\nrandom&aid=" . $row2["id"] . "\">" . htmlspecialchars($row2["subject"]) . "\n"); print("
" . $hr); } } if($this->luku > 1 && $this->type != "publishment") { print("random\">" . l("tothemainpage") . ""); print("
" . $hr); } } } function showpoll() { $row = @mysql_fetch_row(mysql_query("select max(pollID) from vbooth_desc where mainid = $this->mainid")); $pollid = $row[0]; if(!$pollid) { print("" . l("nopoll") . "."); return 0; } $row = @mysql_fetch_array(mysql_query("select pollTitle from vbooth_desc where pollID = $pollid")); $title = $row["pollTitle"]; $forwardurl = $GLOBALS["baseurl"] . "/show.php3?id=" . $this->id . (!empty($aid) ? "&aid=" . $this->aid : "") . "&rand=$this->random"; print("$title

"); // Muutetaan vahvista-painikkeen teksti kielivalinnan mukaiseksi, Jari Rytkönen 15.9.2003 $pollauspainike = l("confirm"); poll_generateUI($pollid, $forwardurl, $pollauspainike); } function showsubmit() { print("" . l("jointolist") . ""); print("

"); print(""); print("mainid>"); if ($this->template == 356 || $this->template == 357) print("

"); else print("

"); print(""); print("
"); } // tämmönen linkkilähetys tänne pistettiin NCC:tä varten (Jansku@2004) function showjoinlink() { print("Voit liittyä postituslistalle allaolevasta linkistä"); print("

Liity postituslistalle

"); print("

"); } function showHeaders() { /* this function prints headers */ $this->showSound(); } function showSound() { /* if $this->soundfile is set, print it */ if(!$this->soundfile) { return false; } $file = $GLOBALS["dataurl"] . "/" . $this->soundfile; /* print(""); */ print("\n\n\n"); print("\n\n"); } // Uusi funktio, jolla lähetetään Canal Digitalin sähköposti. Jari Rytkönen 30.12.2003 function canal_laheta() { global $laheta; global $email; global $etunimi; global $sukunimi; if ($laheta) { mail("asiakaspalvelu@canaldigital.fi","En halua Canal Digitalin tiedotteita sähköpostitse","Asiakkaan nimi: $etunimi $sukunimi\r\nAsiakkaan sähköpostiosoite: $email","From: $email"); //mail("jani.vaisanen@ip-finland.com","En halua Canal Digitalin tiedotteita sähköpostitse","Asiakkaan nimi: $etunimi $sukunimi\r\nAsiakkaan sähköpostiosoite: $email","From: $email"); } } // Uusi funktio, jolla näytetään haluttu teksti Canal Digitalin tiedotteessa. Jari Rytkönen 30.12.2003 function canal_tulosta() { global $laheta; if ($laheta) print("Sinulle ei enää lähetetä Canal Digitalin tiedotteita sähköpostitse"); else print("Mikäli et enää jatkossa halua vastaanottaa Canal Digitalin tiedotteita sähköpostitse, kirjoita sähköpostiosoitteesi alla olevaan kenttään ja klikkaa Vahvista-painiketta."); } } require("common.php3"); require('poll/phpPollConfig.php3'); require('poll/phpPollUI.php3'); $nayta = new nayta($id, $aid, $mode); if($pre) print("
");
$nayta->showpage();
if($pre) print("
"); ?>