ilch Forum » Ilch Clan 1.1 » Fehlersuche und Probleme » Facebook problem

Geschlossen
  1. #1
    User Pic
    Thanatos-dm Mitglied
    Registriert seit
    24.06.2012
    Beiträge
    1
    Beitragswertungen
    0 Beitragspunkte
    Hallo erst mal!
    Bin schon eine Weile bei euch konnte meine probs bist jetzt immer mit der sufu lösen aber jetzt habe ich eines, wo ich nicht mehr ohne eure Hilfe weiter komme.

    Ich habe unser News mit dem gefällt mir Butten erweitert nicht installiert, sondern manuell eingetragen in die news.php, allg.php auch die Drei eintrage fürs adminmenü habe ich in der datenbank eingetragen. Da ich schon extended news drin habe.

    Die Funktionen sind da arbeiten aber nicht wie gewünscht
    wenn ich jetzt unterhalb einer News gefällt mir drücke habe ich den Inhalt eines shoutbox Eintrages das will ich ja nicht posten, sondern den Inhalt der News..

        <?php
        #   Copyright by Manuel
        #   Support www.ilch.de
         
        defined ('main') or die ( 'no direct access' );
         
        ##
        ###
        ####
        #####  W E I T E R L E I T U N G S   F U N K T I O N
        function wd ($wdLINK,$wdTEXT,$wdZEIT=3) {
                global $lang;
         
          if (!is_array($wdLINK)) {
                  $urls  = '<a href="'.$wdLINK.'">'.$lang['forward2'].'</a>';
                  $wdURL = $wdLINK;
                } else {
                  $urls  = '';
            $i = 0;
                        foreach($wdLINK as $k => $v) {
                          if ( $i == 0 ) {
                                  $wdURL = $v;
                                }
                                $urls .= '<a href="'.$v.'">'.$k.'</a><br />';
                          $i++;
                        }
                }
                $tpl = new tpl ( 'weiterleitung.htm' );
                $ar = array
                (
            'LINK' => $urls,
                  'URL'  => $wdURL,
                        'ZEIT' => $wdZEIT,
                        'TEXT' => $wdTEXT
                );
                $tpl->set_ar_out ( $ar, 0 );
                unset($tpl);
        }
         
        ##
        ###
        ####
        ##### g e t   R e c h t
        function getrecht ($RECHT, $USERRECHT) {
                if ( empty ( $USERRECHT ) ) {
                  return (false);
                } else {
                  if($USERRECHT <= $RECHT) {
                    return (true);
                  } else {
                    return (false);
                  }
          }
        }
         
        ##
        ###
        ####
        ##### g e t   U s e r   N a m e
        function get_n($uid) {
                $row = db_fetch_object(db_query("SELECT name FROM prefix_user WHERE id = '".$uid."'"));
                return $row->name;
        }
         
        ##
        ###
        ####
        ##### wochentage sonntag 0 samstag 6
        function wtage ($tag) {
          $wtage = array('Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag');
          return ($wtage[$tag]);
        }
         
        ##
        ###
        ####
        ##### monate in deutsch
        function getDmon ($mon) {
          $monate = array('Januar','Februar','M&auml;rz','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember');
          return($monate[$mon-1]);
        }
         
         
        ##
        ###
        ####
        ##### a l l g e m e i n e s   A r r a y
        function getAllgAr () {
         
                # v1 = schluessel
                # v2 = wert
                # v3 = feldtyp
          # v4 = kurze beschreibung wenn n&#65533;tig
         
                $ar = array();
                $abf = "SELECT schl, wert FROM `prefix_config`";
                $erg = db_query($abf);
                while($row = db_fetch_assoc($erg) ) {
                  $ar[$row['schl']] = $row['wert'];
                }
                return $ar;
        }
         
        ##
        ###
        ####
        ##### UserRang ermitteln
        function userrang ($post,$uid) {
          global $global_user_rang_array;
         
          if (!isset($global_user_rang_array[$uid])) {
            if (!isset($global_user_rang_array)) {
              $global_user_rang_array = array();
            }
            if ( empty($uid) ) {
              $rRang = 'Gast';
            } else {
              $rRang = @db_result(db_query("SELECT bez FROM prefix_user LEFT JOIN prefix_ranks ON prefix_ranks.id = prefix_user.spezrank WHERE prefix_user.id = ".$uid),0);
            }
            if ( empty($rRang) ) {
              $post = ( $post == 0 ? 1 : $post );
              $rRang = @db_result(db_query("SELECT bez FROM `prefix_ranks` WHERE spez = 0 AND min <= ".$post." ORDER BY min DESC LIMIT 1"),0);
            } elseif ( $rRang != 'Gast' ) {
              $rRang = '<i><b>'.$rRang.'</b></i>';
            }
            $global_user_rang_array[$uid] = $rRang;
          }
         
          return ($global_user_rang_array[$uid]);
        }
         
         
        ##
        ###
        ####
        ##### makiert suchwoerter
        function  markword($text,$such) {
          $erg  = '<span style="background-color: #EBF09B;">';
          $erg .= $such."</span>";
                $text = str_replace($such,$erg,$text);
          return $text;
        }
         
         
        ##
        ###
        ####
        ##### gibt die smiley lilste zurueck
        function getsmilies () {
          global $lang;
          $zeilen = 3; $i = 0;
                $b = '<script language="JavaScript" type="text/javascript">function moreSmilies () { var x = window.open("about:blank", "moreSmilies", "width=250,height=200,status=no,scrollbars=yes,resizable=yes"); ';
          $a = '';
          $erg = db_query('SELECT emo, ent, url FROM `prefix_smilies`');
                while ($row = db_fetch_object($erg) ) {
         
            $b .= 'x.document.write ("<a href=\"javascript:opener.put(\''.addslashes(addslashes($row->ent)).'\')\">");';
            $b .= 'x.document.write ("<img style=\"border: 0px; padding: 5px;\" src=\"include/images/smiles/'.$row->url.'\" title=\"'.$row->emo.'\"></a>");';
         
            if ($i<12) {
              # float einbauen
              if($i%$zeilen == 0 AND $i <> 0) { $a .= '<br /><br />'; }
              $a .= '<a href="javascript:put(\''.addslashes($row->ent).'\')">';
              $a .= '<img style="margin: 2px;" src="include/images/smiles/'.$row->url.'" border="0" title="'.$row->emo.'"></a>';
            }
            $i++;
                }
          $b .= ' x.document.write("<br /><br /><center><a href=\"javascript:window.close();\">'.$lang['close'].'</a></center>"); x.document.close(); }</script>';
          if ($i>12) { $a .= '<br /><br /><center><a href="javascript:moreSmilies();">'.$lang['more'].'</a></center>'; }
          $a = $b.$a;
          return ($a);
        }
         
         
         
        ##
        ###
        ####
        ##### generey key with x length
        function genkey ( $anz ) {
                $letterArray = array ('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9','0','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','1','2','3','4','5','6','7','8','9','0');
          $key = '';
                for ($i=0;$i < $anz ; $i ++)
                {
                    mt_srand((double)microtime()*1000000);
                    $zufallZahl = mt_rand(0,62);
              $key .= $letterArray[$zufallZahl];
          }
                return ( $key );
        }
         
        function icmail ($mail, $bet, $txt, $from = '', $html = false) {
                global $allgAr;
                include_once('include/includes/class/phpmailer/class.phpmailer.php');
                $mailer = new PHPMailer();
                if (empty($from)) {
                        $mailer->From = $allgAr['adminMail'];
                        $mailer->FromName = $allgAr['allg_default_subject'];
                } elseif ( preg_match('%(.*) <([\w\.-]*@[\w\.-]*)>%i', $from, $tmp) ) {
                        $mailer->From = trim($tmp[2]);
                        $mailer->FromName = trim($tmp[1]);
                } elseif (preg_match('%([\w\.-]*@[\w\.-]*)%i', $from, $tmp)) {
                        $mailer->From = trim($tmp[1]);
                        $mailer->FromName = '';
                }
                if ($allgAr['mail_smtp']) { //SMTP Versand
         
                        $smtpser = @db_result(db_query('SELECT `t1` FROM `prefix_allg` WHERE `k` = "smtpconf"'));
                        if (empty($smtpser)) {
                                echo '<span style="font-size: 2em; color: red;">Mailversand muss konfiguriert werden!</span><br />';
                        } else {
                                $smtp = unserialize($smtpser);
         
                                $mailer->IsSMTP();
                                $mailer->Host = $smtp['smtp_host'];
                                $mailer->SMTPAuth = ($smtp['smtp_auth'] == 'no' ? false : true);
                                if ($smtp['smtp_auth'] == 'ssl' or $smtp['smtp_auth'] == 'tls') {
                                        $mailer->SMTPSecure = $smtp['smtp_auth'];
                                }
                                if (!empty($smtp['smtp_port'])) {
                                        $mailer->Port = $smtp['smtp_port'];
                                }
                                $mailer->AddReplyTo($mailer->From, $mailer->FromName);
         
                                if ($smtp['smtp_changesubject'] and $mailer->From != $smtp['smtp_email']) {
                                        $bet = '(For ' .$mailer->FromName . ' - '. $mailer->From .') '. $bet;
                                        $mailer->From = $smtp['smtp_email'];
                                }
         
                                $mailer->Username = $smtp['smtp_login'];
         
                                require_once('include/includes/class/AzDGCrypt.class.inc.php');
                                $cr64 = new AzDGCrypt(DBDATE.DBUSER.DBPREF);
                                $mailer->Password = $cr64->decrypt($smtp['smtp_pass']);
         
                                if ($smtp['smtp_pop3beforesmtp'] == 1) {
                                        include_once('include/includes/class/phpmailer/class.pop3.php');
                                        $pop = new POP3();
                                        $pop3port = !empty($smpt['smtp_pop3port']) ? $smpt['smtp_pop3port'] : 110;
                                        $pop->Authorise($smpt['smtp_pop3host'], $pop3port, 5, $mailer->Username, $mailer->Password, 1);
                                }
                        }
                        //$mailer->SMTPDebug = true;
                }
                if (is_array($mail)) {
                        if ($mail[0] != 'bcc') {
                                array_shift($mail);
                                foreach ($mail as $m){
                                        $mailer->AddBCC(escape_for_email($m));
                                }
                                $mailer->AddAddress($mailer->From);
                        } else {
                                foreach ($mail as $m){
                                        $mailer->AddAddress(escape_for_email($m));
                                }
                        }
                } else {
                        $mailer->AddAddress(escape_for_email($mail));
                }
                $mailer->Subject = escape_for_email($bet, true);
                $txt = str_replace("\r", "\n", str_replace("\r\n", "\n", $txt));
                if ($html) {
                        $mailer->IsHTML(true);
                        $mailer->AltBody = strip_tags($txt);
                }
                $mailer->Body = $txt;
         
                if ($mailer->Send()) {
                        return true;
                } else {
                        if (is_coadmin()) {
                                echo "<h2 style=\"color:red;\">Mailer Error: " . $mailer->ErrorInfo . '</h2>';
                        }
                        return false;
                }
        }
         
         
        function html_enc_substr($text, $start, $length) {
           $trans_tbl = get_html_translation_table(HTML_ENTITIES);
           $trans_tbl = array_flip($trans_tbl);
           return(htmlentities(substr(strtr($text, $trans_tbl), $start, $length)));
        }
         
        function get_datum ($d) {
          if (strpos($d,'.') !== FALSE) { $d = str_replace('.','-',$d); }
          if (strpos($d,'/') !== FALSE) { $d = str_replace('/','-',$d); }
          if (is_numeric(substr($d,-4))) {
            list($t,$m,$j) = explode('-', $d);
          } elseif (is_numeric(substr($d,0,4))) {
            list($j,$m,$t) = explode('-', $d);
          }
          $d = $j.'-'.$m.'-'.$t;
          return ($d);
        }
         
        function get_homepage ($h) {
          $h = trim($h);
          if (!empty($h) AND substr($h, 0, 7) != 'http://') {
            $h = 'http://'.$h;
          }
          return ($h);
        }
         
        function iurlencode_help ($a) {
          if (preg_match("/(http:|https:|ftp:)/", $a[0])) {
            return ($a[0]);
          }
         
          return (rawurlencode($a[1]).substr($a[0], -1));
        }
         
        function iurlencode ($s) {
          return (preg_replace_callback("/([^\/]+|\/[^\.])[\.\/]/", 'iurlencode_help', $s));
          /*
          $x = 'false';
          if (preg_match ('/(http:|https:|ftp:)[^:]+:[^@]+@./', $s)) {
            $x = preg_replace('/([^:]+:[^@]+@)./',"\\1",$s);
                $s = str_replace($x,'',$s);
                } elseif (substr($s, 0, 7) == 'http://') {
                  $s = substr ($s, 7);
                        $x = 'http://';
                } elseif (substr($s, 0, 8) == 'https://') {
                  $s = substr ($s, 8);
                  $x = 'https://';
                } elseif (substr($s, 0, 6) == 'ftp://') {
                  $s = substr ($s, 6);
                  $x = 'ftp://';
                }
         
         
                $a = explode('/', $s);
          $r = '';
          for ($i=0;$i<count($a);$i++) {
            $r .= rawurlencode($a[$i]).'/';
          }
         
                if ($x !== 'false') {
                  $r = $x.$r;
                }
         
          $r = substr($r, 0, -1);
          return ($r);
          */
        }
         
        # antispam
        function chk_antispam ($m, $nopictures = false) {
                global $allgAr;
         
                if ($nopictures) {
                        return (bool) (isset($_POST['antispam_id']) and isset($_SESSION['antispam'][$_POST['antispam_id']]));
                }
         
                if (is_numeric($allgAr['antispam']) AND has_right($allgAr['antispam'])) {
                        return true;
                }
         
                if (isset($_POST['antispam']) AND isset($_POST['antispam_id']) AND isset($_SESSION['antispam'][$_POST['antispam_id']]) AND $_POST['antispam'] == $_SESSION['antispam'][$_POST['antispam_id']][$m][3]) {
                        unset ($_SESSION['antispam'][$_POST['antispam_id']]);
                        return (true);
                }
         
                return (false);
        }
         
        function get_antispam ($m, $t, $nopictures = false) {
                global $allgAr, $antispamId;
         
                mt_srand((double)microtime()*1000000);
                $i1 = mt_rand (1,9);
                $i2 = mt_rand (1,9);
                $i3 = mt_rand (1,9);
         
                if (isset($antispamId)) {
                        $id = $antispamId;
                } else {
                        $id = $antispamId = uniqid($m, true);
                }
         
                $rs = '<input type="hidden" name="antispam_id" value="'.$id.'" />';
         
                if ($nopictures) {
                        $_SESSION['antispam'][$id] = true;
                        return $rs;
                }
         
                if (is_numeric($allgAr['antispam']) and has_right($allgAr['antispam'])) {
                        return '';
                }
         
                if (!isset($_SESSION['antispam']) or (isset($_SESSION['antispam']) and !is_array($_SESSION['antispam']))) {
                        $_SESSION['antispam'] = array();
                }
         
                $_SESSION['antispam'][$m] = array();
                $i1 = mt_rand (1,9);
                $i2 = mt_rand (1,9);
                $i3 = mt_rand (1,9);
         
                $_SESSION['antispam'][$id][$m] = array($i1, $i2, $i3, $i1.$i2.$i3);
         
                $rs .= '<span style="display: inline; width: 100px; vertical-align: middle; text-align: center; background-color: #000000; border: 0px; padding: 2px; margin: 0px;">'.
                        '<img src="include/images/spam/z.php?m='.$m.'&amp;w=0&amp;'.session_name().'='.session_id().'&amp;id='.$id.'" alt="">'.
                        '<img src="include/images/spam/z.php?m='.$m.'&amp;w=1&amp;'.session_name().'='.session_id().'&amp;id='.$id.'" alt="">'.
                        '<img src="include/images/spam/z.php?m='.$m.'&amp;w=2&amp;'.session_name().'='.session_id().'&amp;id='.$id.'" alt="">'.
                        '<input name="antispam" size="3" maxlength="3" style="background-color: #FFFFFF; border: 0px; margin: 0px; padding: 0px;" /></span>';
                if ($t == 0) {
                        return ($rs);
                } elseif ($t == 1) {
                        return ('<tr><td class="Cmite">Antispam</td><td class="Cnorm">'.$rs.'</td></tr>');
                } elseif ($t > 10) {
                        return ('<label style="float:left; width: '.$t.'px; ">Antispam</label>'.$rs.'<br />');
                } else {
                        return ('');
                }
        }
        # antispam
         
        // Funktion scandir für PHP 4
        if (version_compare(phpversion(), '5.0.0') == -1) {
            function scandir($dir)
            {
                $dh = opendir($dir);
                while (false !== ($filename = readdir($dh))) $files[] = $filename;
                sort($files);
                return $files;
            }
        }
        // Funktion array_fill_keys < PHP 5.2
        if (version_compare(phpversion(), '5.2.0') == -1) {
                function array_fill_keys($target, $value = '') {
                        if(is_array($target)) {
                                foreach($target as $key => $val) {
                                        $filledArray[$val] = is_array($value) ? $value[$key] : $value;
                                }
                        }
                        return $filledArray;
                }
        }
         
        // Funktion, die die Größe aller Dateien im Ordner zusammenrechnet
        function dirsize($dir)
        {
            if (!is_dir($dir)) {
                return -1;
            }
            $size = 0;
            $files = array_slice(scandir($dir), 2);
            foreach ($files as $filenr => $file) {
                if (is_dir($dir . $file)) {
                    $size += dirsize($dir . $file . '/');
                } else {
                    $size += @filesize($dir . $file);
                }
            }
            return $size;
        }
         
        //Rechnet bytes in KB oder MB um
        function nicebytes($bytes){
            if ($bytes<1000000) {
                return round($bytes/1024,2).' KB';
            } else {
                return round($bytes/(1024*1024),2).' MB';
            }
        }
         
        function get_like_button() {
            global $allgAr;
            if ($allgAr['fb_active'] == 0) {
                return('');
            } else {
                $fb_send = 'true';
                $fb_width = $allgAr['fb_width'];
                $fb_faces = 'true';
                if ($allgAr['fb_send'] == 0) {
                    $fb_send = 'false';
                }
                if ($allgAr['fb_faces'] == 0) {
                    $fb_faces = 'false';
                }
                $like_button = '<div class="fb-like" data-href="http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/index.php?news-'.$row['id'].'" data-send="'.$fb_send.'" data-width="'.$fb_width.'" data-show-faces="'.$fb_faces.'"></div>';
                return($like_button);
            }
        }
         
        ?>


        <?php
        // Copyright by: Manuel Staechele
        // Support: www.ilch.de
        // Modded by Mairu für News Extended
        defined ('main') or die ('no direct access');
         
        $title = $allgAr['title'] . ' :: News';
        $hmenu = 'News';
        $design = new design ($title , $hmenu);
        $design->addheader('<link rel="alternate" type="application/atom+xml" title="News (Atom)" href="index.php?news-atom" />
        <link rel="alternate" type="application/rss+xml" title="News (RSS)" href="index.php?news-rss" />');
         
        function news_find_kat ($kat) {
            $katpfad = 'include/images/news/';
            $katjpg = $katpfad . $kat . '.jpg';
            $katgif = $katpfad . $kat . '.gif';
            $katpng = $katpfad . $kat . '.png';
         
            if (file_exists($katjpg)) {
                $pfadzumBild = $katjpg;
            } elseif (file_exists ($katgif)) {
                $pfadzumBild = $katgif;
            } elseif (file_exists ($katpng)) {
                $pfadzumBild = $katpng;
            }
         
            if (!empty($pfadzumBild)) {
                $kategorie = '<img style="" src="' . $pfadzumBild . '" alt="' . $kat . '">';
            } else {
                $kategorie = '<b>' . $kat . '</b><br /><br />';
            }
         
            return ($kategorie);
        }
        // Schaut ob ein Name so oder ähnlich in der Datenbank vorhanden ist
        // gibt true zurück falls der Name noch nicht verwendet ist
        function checkName($name) {
            if (db_count_query("SELECT COUNT(name) FROM prefix_user WHERE name LIKE '$name'")) {
                return false;
            } else {
                return true;
            }
        }
         
        function checkKomName($name) {
            $resp = new xajaxResponse();
            if (checkName($name) OR loggedin()) {
                $resp->script('document.forms["komform"].submit();');
            } else {
                $resp->assign('komname', 'value' , '');
                $resp->alert('Dieser Name ist bereits an einen User vergeben, benutze bitte einen anderen.');
                $resp->script("document.getElementById('komname').focus();");
            }
            return $resp;
        }
        // xajax für namencheck
        $xajax = new xajax();
        $xajax->configureMany(array('decodeUTF8Input' => true ,'characterEncoding' => 'ISO-8859-1', 'requestURI' => 'admin.php?news-ajax'));
        $xajax->register(XAJAX_FUNCTION, 'checkKomName');
        $xajax->processRequest();
         
        if ($menu->get(1) == 'ajax') {
            exit();
        }
         
        if (!is_numeric($menu->get(1))) {
            if ($menu->get(1) == 'rss' || $menu->get(1) == 'atom') {
                // ob_clean();
                $feed_type = $menu->get(1);
         
                $abf = "SELECT MAX(news_time) AS last_update FROM prefix_news";
                $erg = db_query($abf);
                $row = db_fetch_assoc($erg);
                $last_update = str_replace(' ', 'T', $row['last_update']) . 'Z';
         
                $tn_id = intval(@db_result($news_opts = db_query("SELECT v1 FROM prefix_allg WHERE k = 'news' LIMIT 1"), 0));
         
                $abf = "SELECT
              a.news_title as title,
              a.news_id as id,";
                $abf .= ($feed_type == 'atom') ? 'a.news_time as datum,' : "DATE_FORMAT(a.news_time,'%a, %e %b %y %H:%i:%s') as datum,";
                $abf .=
                "a.news_kat as kate,
              a.news_text as text,
              b.name as username,
              a.html
            FROM prefix_news as a
            LEFT JOIN prefix_user as b ON a.user_id = b.id
            WHERE (a.news_recht | 1) = a.news_recht AND a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND a.news_id != $tn_id AND a.`archiv` != 1 AND (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP())
            ORDER BY news_time DESC LIMIT 15";
                $erg = db_query($abf);
                $tpl = new tpl('news_' . $menu->get(1) . '.htm');
         
                header('Content-type: application/' . $menu->get(1) . '+xml');
         
                $tpl->set_ar_out(array('FEEDTITLE' => $allgAr['title'],
                        'UPDATED' => $last_update,
                        'SITEURL' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF'])), 0);
                while ($row = db_fetch_assoc($erg)) {
                    if ($feed_type == 'atom') {
                        $Z = (date('Z') > 0 ? '+' : '') . date('H:i:s', date('Z') + 23 * 3600);
                        $row['datum'] = str_replace(' ', 'T', $row['datum']) . $Z;
                    }
         
                    $a = explode('[PREVIEWENDE]', $row['text']);
                    $tpl->set_ar_out(array('TITLE' => $row['title'],
                            'TXT' => $row['html'] ? $a[0] : bbcode($a[0]),
                            'LINK' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/index.php?news-' . $row['id'],
                            'AUTHOR' => $row['username'],
                            'DATE' => $row['datum']
                            ), 1);
                }
                $tpl->out(2);
                exit;
            } else {
                $design->header();
                $limit = $allgAr['Nlimit'];
                $page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1);
         
                //Gruppenrechte
                $groups = getGroupRights();
         
                // Topnews ausgeben
                $tn_id = intval(@db_result($news_opts = db_query("SELECT v1, v2 FROM prefix_allg WHERE k = 'news' LIMIT 1"), 0, 0));
                $tn_koms = @db_result($news_opts, 0, 1);
                $tn_sql = db_query("SELECT a.news_title as title, a.news_text, a.news_kat, a.news_recht, a.news_groups, a.html,
                        DATE_FORMAT(a.news_time,'%d. %m. %Y - %H:%i Uhr') as datum,
                        DATE_FORMAT(a.news_time,'%W') as dayofweek,
                        b.name as username,
                        c.name as editorname,
                        a.html,
                        a.edit_time,
                        a.klicks,
                        b.id as uid
                    FROM prefix_news a
                    LEFT JOIN prefix_user as b ON a.user_id = b.id
                    LEFT JOIN prefix_user as c ON a.editor_id = c.id
                    WHERE a.news_id = $tn_id AND a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP()) AND
                    (((" . pow(2, abs($_SESSION['authright'])) . " | a.news_recht) = a.news_recht) OR
                        (a.news_groups != 0 AND ((a.news_groups ^ $groups) != (a.news_groups | $groups))))");
                if (db_num_rows($tn_sql) > 0) {
                    $tn_r = db_fetch_assoc($tn_sql);
         
                                $dontShow = false;
                                if ((pow(2, abs($_SESSION['authright'])) | $tn_r['news_recht']) != $tn_r['news_recht']) {
                                        $dontShow = true;
                                }
                                if ($dontShow) {
                                        foreach($_SESSION['authgrp'] as $id => $bool) {
                                                if ($bool and (pow(2, abs($id)) | $tn_r['news_groups'] == $tn_r['news_groups'])) {
                                                        $dontShow = false;
                                                        break;
                                                }
                                        }
                                }
                        if (!$dontShow) {
                                        $tn_tpl = new tpl ('news/top');
                        if ($tn_koms) {
                            $tn_r['kom'] = db_count_query("SELECT COUNT(id) FROM prefix_koms WHERE uid = $tn_id AND cat = 'NEWS'");
                        }
                            $tn_r['showkom'] = $tn_koms;
                        if (strpos ($tn_r['news_text'], '[PREVIEWENDE]') !== false) {
                            $a = explode('[PREVIEWENDE]' , $tn_r['news_text']);
                            $tn_r['news_text']= $a[0];
                            $tn_r['readwholenews'] = '<a href="index.php?news-' . $tn_id . '" alt="mehr lesen" title="mehr lesen"><img src="include/images/icons/news/more.gif" alt="mehr lesen" border="0"></a>';
                        } else {
                             $tn_r['readwholenews'] = '';
                        }
                        $tn_r['id'] = $tn_id;
                            $tn_r['klicks'] = '<img src="include/images/icons/news/counter.gif" alt="' . $tn_r['klicks']. ' mal gelesen" title="' . $tn_r['klicks']. ' mal gelesen" border="0">';
                        $tn_r['datum']  = $lang[$tn_r['dayofweek']] . ' ' . $tn_r['datum'];
                            $tn_r['edit']   = is_null($tn_r['edit_time']) ? '' : '<br /><i>zuletzt ge&auml;ndert am ' . date('d.m.Y - H:i', strtotime($tn_r['edit_time'])) . '&nbsp;Uhr';
                            if (!empty($tn_r['edit']) and $tn_r['editorname'] != $tn_r['username']) {
                                $tn_r['edit'].= ' von ' . $tn_r['editorname']. '</i>';
                            } elseif (!empty($tn_r['edit'])) {
                                $tn_r['edit'].= '</i>';
                            }
         
                        $tn_r['kate'] = news_find_kat($tn_r['news_kat']);
                            $tn_r['text'] = $tn_r['html']? $tn_r['news_text']: bbcode($tn_r['news_text']);
                        $tn_tpl->set_ar_out($tn_r, 0);
                                        unset($tn_tpl);
                        }
                }
         
                        //Kategorie einschränken
                        if ($menu->get(1) != '' and ($menu->getA(1) != 'p' or $menu->getE(1) == 0)) {
                                $kats = $katssql = array();  #collect given kats
                                $i = 1;
                                while($kat = escape($menu->get($i), 'string')){
                                        $kats[] = $kat;
                                        $katssql[] = '"' . $kat . '"';
                                        $i++;
                                }
                                $news_kat = 'news_kat IN ('.implode(',', $katssql).') AND';
                                $katmpl = '-'.implode('-', $kats);
                                $page = $menu->getE('p');
                                if ($page < 1) {
                                        $page = 1;
                                }
                                $katmpl = str_replace('-p'.$page, '', $katmpl);
                        } else {
                                $news_kat = $katmpl = '';
                                $page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1);
                        }
         
                $anfang = ($page - 1) * $limit;
         
                        $MPL = db_make_sites ($page , "WHERE (((" . pow(2, abs($_SESSION['authright'])) . " | news_recht) = news_recht) OR
                                (news_groups != 0 AND ((news_groups ^ $groups) != (news_groups | $groups)))) AND $news_kat `show` > 0 AND `show` <= UNIX_TIMESTAMP() AND news_id != $tn_id AND archiv != 1 AND (endtime IS NULL OR endtime > UNIX_TIMESTAMP())" , $limit , '?news'.$katmpl , 'news');
                // Normale News
                $tpl = new tpl ('news/news.htm');
         
                $abf = "SELECT
              a.news_title as title,
              a.news_id as id,
              DATE_FORMAT(a.news_time,'%d. %m. %Y - %H:%i Uhr') as datum,
              DATE_FORMAT(a.news_time,'%W') as dayofweek,
              a.news_kat as kate,
              a.news_text as text,
              b.name as username,
              c.name as editorname,
              a.html,
              a.edit_time,
              a.klicks,
              b.id as uid
            FROM prefix_news as a
            LEFT JOIN prefix_user as b ON a.user_id = b.id
            LEFT JOIN prefix_user as c ON a.editor_id = c.id
            WHERE (((" . pow(2, abs($_SESSION['authright'])) . " | a.news_recht) = a.news_recht) OR
                      (a.news_groups != 0 AND ((a.news_groups ^ $groups) != (a.news_groups | $groups)))) AND $news_kat
                        a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND news_id != $tn_id AND a.`archiv` != 1 AND
                        (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP())
            ORDER BY a.news_time DESC
            LIMIT " . $anfang . "," . $limit;
         
                // echo '<pre>'.$abf.'</pre>';
                $erg = db_query($abf);
                if (db_num_rows($erg) == 0 and !empty($news_kat)) {
                    echo 'Keine News in dieser Kategorie gefunden.<br />
                        <a href="index.php?news">News&uuml;bersichtsseite aufrufen</a>';
                    $design->footer(1);
                }
                while ($row = db_fetch_assoc($erg)) {
                    $k0m = db_query("SELECT COUNT(ID) FROM `prefix_koms` WHERE uid = " . $row['id'] . " AND cat = 'NEWS'");
                    $row['kom'] = db_result($k0m, 0);
                    $row['kate'] = news_find_kat($row['kate']);
                    $row['datum'] = $lang[$row['dayofweek']] . ' ' . $row['datum'];
                    if (strpos ($row['text'] , '[PREVIEWENDE]') !== false) {
                        $a = explode('[PREVIEWENDE]' , $row['text']);
                        $row['text'] = $a[0];
                        $row['readwholenews'] = '<a href="index.php?news-' . $row['id'] . '" alt="mehr lesen" title="mehr lesen"><img src="include/images/icons/news/more.gif" alt="mehr lesen" border="0"></a>';
                    } else {
                        $row['readwholenews'] = '';
                                        $row['like_button'] = get_like_button('news-'.$row['text']);
                    }
                               
                    $row['klicks'] = '<img src="include/images/icons/news/counter.gif" alt="' . $row['klicks'] . ' mal gelesen" title="' . $row['klicks'] . ' mal gelesen" border="0">';
                    if (!$row['html']) {
                        $row['text'] = bbcode($row['text']);
                    }
                    $row['edit'] = is_null($row['edit_time']) ? '' : '<br /><i>zuletzt ge&auml;ndert am ' . date('d.m.Y - H:i', strtotime($row['edit_time'])) . '&nbsp;Uhr';
                    if (!empty($row['edit']) and $row['editorname'] != $row['username']) {
                        $row['edit'] .= ' von ' . $row['editorname'] . '</i>';
                    } elseif (!empty($row['edit'])) {
                        $row['edit'] .= '</i>';
                    }
                               
                    $tpl->set_ar_out($row, 0);
                }
                $tpl->set_out('SITELINK', $MPL, 1);
                unset($tpl);
            }
        } else {
            $design->header();
            $xajax->printJavascript();
         
            $nid = escape($menu->get(1), 'integer');
            $erg = db_query("SELECT * FROM `prefix_news` WHERE `show` > 0 AND `show` <= UNIX_TIMESTAMP() AND news_id = '" . $nid . "'");
            if (db_num_rows($erg) == 0) {
                $dontShow = true;
                } else {
                        $dontShow = false;
                        $row = db_fetch_object($erg);
                        if ((pow(2, abs($_SESSION['authright'])) | $row->news_recht) != $row->news_recht) {
                                $dontShow = true;
                        }
                        if ($dontShow) {
                                foreach($_SESSION['authgrp'] as $id => $bool) {
                                        if ($bool and (pow(2, abs($id)) | $row->news_groups) == $row->news_groups) {
                                                $dontShow = false;
                                                break;
                                        }
                                }
                        }
                }
         
                if ($dontShow) {
                        echo 'News existiert nicht oder Sie haben keine Rechte sie zu sehen.  <a href="javascript:history.back();">zur&uuml;ck</a>';
                        $design->footer(1);
                }
         
            $komsOK = true;
            if ($allgAr['Ngkoms'] == 0) {
                if (loggedin()) {
                    $komsOK = true;
                } else {
                    $komsOK = false;
                }
            }
            if ($allgAr['Nukoms'] == 0) {
                $komsOK = false;
            }
         
            $kom_info = '';
            // kommentar add
            if ((loggedin() OR chk_antispam ('newskom')) AND $komsOK AND !empty($_POST['name']) AND !empty($_POST['txt'])) {
                $_POST['txt'] = escape($_POST['txt'], 'string');
                $_POST['name'] = escape($_POST['name'], 'string');
                if (checkName($_POST['name']) or loggedin()) {
                    if (loggedin()) {
                        $_POST['name'] = $_SESSION['authname'];
                    }
                    db_query("INSERT INTO `prefix_koms` (`uid`,`cat`,`name`,`text`) VALUES (" . $nid . ",'NEWS','" . $_POST['name'] . "','" . $_POST['txt'] . "')");
                } else {
                    $kom_info = '<span style="color:red;">Dieser Name ist bereits an einen User vergeben, benutze bitte einen anderen.</span><br />';
                }
            }
            // kommentar add
            // kommentar loeschen
            if ($menu->getA(2) == 'd' AND is_numeric($menu->getE(2)) AND has_right(- 7, 'news')) {
                $kommentar_id = escape($menu->getE(2), 'integer');
                db_query("DELETE FROM prefix_koms WHERE uid = " . $nid . " AND cat = 'NEWS' AND id = " . $kommentar_id);
            }
            // kommentar loeschen
            $kategorie = news_find_kat($row->news_kat);
         
            $textToShow = $row->html ? $row->news_text : bbcode($row->news_text);
            $textToShow = str_replace('[PREVIEWENDE]', '', $textToShow);
            if (!empty($such)) {
                $textToShow = markword($textToShow, $such);
            }
               
            // klicks zaehlen
            db_query("UPDATE prefix_news SET klicks = klicks + 1 WHERE news_id = " . $nid);
         
            $tpl = new tpl ('news/news.htm');
            $ar = array (
                'TEXT' => $textToShow,
                'KATE' => $kategorie,
                'NID' => $nid,
                'uname' => $_SESSION['authname'],
                'ANTISPAM' => (loggedin()?'':get_antispam ('newskom', 0)),
                'NAME' => $row->news_title,
                'info' => $kom_info
                );
            $tpl->set_ar_out($ar, 2);
         
            if ($komsOK) {
                $tpl->set_ar_out (array ('NAME' => $row->news_title , 'NID' => $nid, 'style' => loggedin() ? 'style="display:none;"' : ''), 3);
            }
            $erg1 = db_query("SELECT text, name, id FROM `prefix_koms` WHERE uid = " . $nid . " AND cat = 'NEWS' ORDER BY id DESC");
            $ergAnz1 = db_num_rows($erg1);
            if ($ergAnz1 == 0) {
                echo '<b>' . $lang['nocomments'] . '</b>';
            } else {
                $zahl = $ergAnz1;
                while ($row1 = db_fetch_assoc($erg1)) {
                    $row1['text'] = bbcode(trim($row1['text']));
                    if (has_right(- 7, 'news')) {
                        $row1['text'] .= '<a href="javascript:delkom(' . $nid . ',' . $row1['id'] . ')"><img src="include/images/icons/del.gif" alt="l&ouml;schen" border="0" title="l&ouml;schen" /></a>';
                    }
                    $tpl->set_ar_out(array('NAME' => $row1['name'], 'TEXT' => $row1['text'], 'ZAHL' => $zahl) , 4);
                    $zahl--;
                }
            }
            $tpl->out(5);
        }
         
        $design->footer();
         
        ?>

    mein allg und news php schaut mal einer drüber..

    Danke schon mal

    betroffene Homepage: externer Link


    Zuletzt modifiziert von Thanatos-dm am 17.10.2012 - 22:31:07
    0 Mitglieder finden den Beitrag gut.
Geschlossen

Zurück zu Fehlersuche und Probleme

Optionen: Bei einer Antwort zu diesem Thema eine eMail erhalten