Перейти к публикации

mircuist

Клиенты
  • Публикации

    38
  • Зарегистрирован

  • Посещение

Сообщения, опубликованные пользователем mircuist

  1. Здравствуйте,

    Кто мне может помочь с выводом ссылкой на новости где был написан комментарий.. Дело в том что ссылка генерируется без категорий (пример http://www.***********.ru/2019-************.html)

    Вот код:

    
    <?php
    
    if( ! defined( 'DATALIFEENGINE' ) ) {
    
    die( "Hacking attempt!" );
    
    }
    
        require_once (ROOT_DIR . '/engine/data/commcfg.php');
    
    
    
    function get_parent_ID($cat_info, $category_id) {
    
    foreach ( $cat_info as $cats ) {
    
      if( $cats['id'] == $category_id ) return $cats['parentid'];
    
    }
    
    return false;
    
    }   
    
        $comment_module = '';
    
    
    
        if ($commcfg['cat'] != '') {
    
    
        $catarr = split(',', $commcfg['cat']);
    
        $catcount = count($catarr);
    
        $an = '';
    
    	 if ($catcount > 1) {
    
    	  for ($i=0;$i<$catcount;$i++) {
    
    	    if ($i == $catcount-1){$an .= "t1.category regexp '[[:<:]](".$catarr[$i].")[[:>:]]' ";}
    
    	    else {$an .= "t1.category regexp '[[:<:]](".$catarr[$i].")[[:>:]]' OR ";}
    
    	  }
    
    	  $and = " AND (".$an.")";
    
    	 } else {
    
    	 $catarr = array();
    
    	 $parent = get_parent_ID($cat_info, $commcfg['cat']);
    
    
        if ($parent != '0') {
    
        $par_query = $db->query("SELECT id FROM ". PREFIX ."_category WHERE parentid = '".$parent."'");
    
        } else {
    
        $par_query = $db->query("SELECT id FROM ". PREFIX ."_category WHERE parentid = '".$commcfg['cat']."'");
    
        }
    
        while ($par = $db->get_row($par_query)) {
    
        $catarr[] = $par['id'];
    
        }	
    
    
        $catcount = count($catarr);
    
        $an = '';
    
    	 if ($catcount > 1) {
    
    	  for ($i=0;$i<$catcount;$i++) {
    
    	    if ($i == $catcount-1){$an .= "t1.category regexp '[[:<:]](".$catarr[$i].")[[:>:]]' ";}
    
    	    else {$an .= "t1.category regexp '[[:<:]](".$catarr[$i].")[[:>:]]' OR ";}
    
    	  }
    
    	  $and = " AND (".$an.")";
    
    	 } else {$and = " AND t1.category regexp '[[:<:]](".$catarr[0].")[[:>:]]'";}
    
    
    	 }
    
        }
    
    
        if ($commcfg['comments_from_this_cat'] == '1') {
    
        $catarr = array();
    
        $parent = get_parent_ID($cat_info, $category_id);
    
    
        if ($parent != '0') {
    
        $par_query = $db->query("SELECT id FROM ". PREFIX ."_category WHERE parentid = '".$parent."'");
    
        } else {
    
        $par_query = $db->query("SELECT id FROM ". PREFIX ."_category WHERE parentid = '".$category_id."'");
    
        }
    
        while ($par = $db->get_row($par_query)) {
    
        $catarr[] = $par['id'];
    
        }
    
    
        $catcount = count($catarr);
    
        $an = '';
    
    	 if ($catcount > 1) {
    
    	  for ($i=0;$i<$catcount;$i++) {
    
    	    if ($i == $catcount-1){$an .= "t1.category regexp '[[:<:]](".$catarr[$i].")[[:>:]]' ";}
    
    	    else {$an .= "t1.category regexp '[[:<:]](".$catarr[$i].")[[:>:]]' OR ";}
    
    	  }
    
    	  $and = " AND (".$an.")";
    
    	 } else {$and = " AND t1.category regexp '[[:<:]](".$category_id.")[[:>:]]'";}
    
        }
    
    
        if ($commcfg['only_in_cat'] != '') {
    
        $needcat = array();
    
        $needcat = split(',',$commcfg['only_in_cat']);
    
        }   
    
    
      if (@in_array($category_id, $needcat) || ($commcfg['only_in_cat'] == '') || (($commcfg['main'] == '1') && ($_SERVER['REQUEST_URI'] == '/'))) {
    
    
      if (($commcfg['main'] == '1') && ($_SERVER['REQUEST_URI'] == '/')) {
    
      $comm_query = $db->query("SELECT t0.*,t1.alt_name as alt_name, t1.title as news_title, t1.category as cat FROM ". PREFIX ."_comments t0
    
      LEFT JOIN ". PREFIX ."_post t1 on t1.id = t0.post_id
    
      WHERE t0.approve='1' ORDER BY t0.id DESC LIMIT ".$commcfg['limit']."");
    
      } else {
    
      $comm_query = $db->query("SELECT t0.*,t1.alt_name as alt_name, t1.title as news_title, t1.category as cat FROM ". PREFIX ."_comments t0
    
      LEFT JOIN ". PREFIX ."_post t1 on t1.id = t0.post_id
    
      WHERE t0.approve='1' $and ORDER BY t0.id DESC LIMIT ".$commcfg['limit'].""); 
    
      }
    
    
        while ($comm = $db->get_row($comm_query)) {
    
    
    	  $commtext = strip_tags($comm['text']);
    
    
    	  if ($commcfg['limittext'] != '')
    
    	  {
    
    	  $commtext = mb_substr(stripslashes($commtext), 0, $commcfg['limittext']).'...';
    
    	  }
    
    
      if( $config['allow_alt_url'] == "yes" ) {
    
       if( $config['seo_type'] ) {
    
        if( $category_id and $config['seo_type'] == 2 ) {
    
    	 $link = $config['http_home_url'] . get_url( $category_id ) . "/" . $comm['post_id'] . "-" . $comm['alt_name'] . ".html";
    
        } else {
    
    	 $link = $config['http_home_url'] . $comm['post_id'] . "-" . $comm['alt_name'] . ".html";
    
        }
    
       } else {
    
        $link = $config['http_home_url'] . "index.php?newsid=" . $comm['post_id'];
    
       }
    
      } else {
    
       $link = $config['http_home_url'] . "index.php?newsid=" . $comm['post_id'];
    
      }	 
    
    	  $tpl->load_template( 'comment_module.tpl' );
    
    	  $tpl->set('{commid}', $comm['id']);
    
    	  $tpl->set('{autor}', $comm['autor']);
    
    	  $tpl->set('{date}', $comm['date']);
    
    	  $tpl->set('{email}', $comm['email']);
    
    	  $tpl->set('{text}', $commtext);
    
    	  $tpl->set('{ip}', $comm['ip']); 
    
    	  $tpl->set('{news_title}', stripslashes($comm['news_title']));
    
    	  $tpl->set('{newsid}', $comm['post_id']);
    
    	  $tpl->set('{newslink}', $link);
    
    	 $tpl->compile( 'comm' );
    
    	 $tpl->clear();
    
    
       }
    
       }
    
       if ($commcfg['off'] == '0') {$comment_module = $tpl->result['comm'];}
    
       else {$comment_module = '';}
    
    
    ?> 
    
    

    сайт www.kinovolt.ru

  2. Hello,

    I see you are using an echo statement. As such your code should look like this:

    echo "<iframe frameborder="0" width="237" height="75" src="http://www2.cbox.ws/box/?boxid=2126402&boxtag=hcwwvr&sec=form&nme=".urlencode($name)."&nmekey=".md5('198g1ok9laai4o4o'.$name)."" marginheight="2" marginwidth="2" scrolling="no" allowtransparency="yes" name="cboxform2-2126402" style="border:#DBE2ED 1px solid;border-top:0px" id="cboxform2-2126402"></iframe>";

    Note I have removed the <? and ?> tags, which should not appear in this kind of string.

    urlencode() is a function which ensures that the $name string does not break the address by introducing special characters.

    Should you need any further assistance please let me know.

    Regards

    Thomas

    http://cbox.ws/

    это сообщение от них. Еще, жду ответа от хостера.

  3. В общем, создаете файл /engine/modules/cbox.php

    В нем пишите следующий код:

    <?php

    if( ! defined( 'DATALIFEENGINE' ) ) {

            die( "Hacking attempt!" );

    }

    if($is_logged == TRUE) {

        $name = $member_id['name'];

        #$name = mb_convert_encoding($login_name, 'utf-8', 'cp1251'); # раскомментировать (в начале) для передачи в чат русских ников

        echo "<iframe frameborder=\"0\" width=\"237\" height=\"75\" src=\"http://www2.cbox.ws/box/?boxid=2126402&boxtag=hcwwvr&sec=form&nme=<

    ?=urlencode($

    name)?>&nmekey=<?=md5('198g1ok9laai4o4o'.$name)\" marginheight=\"2\" marginwidth=\"2\" scrolling=\"no\" allowtransparency=\"yes\" name=\"cboxform2-2126402\" style=\"border:#DBE2ED 1px solid;border-top:0px\" id=\"cboxform2-2126402\"></iframe>";

    } else {

        echo 'только зарегистрированным';

    };

    ?>

    echo "<iframe frameborder=\"0\" width=\"237\" height=\"75\" src=\"http://www2.cbox.ws/box/?boxid=2126402&boxtag=hcwwvr&sec=form&nme=<

    ?=urlencode($

  4. Hello,

    When I look at your source I see <?=urlencode... ?> -- this must not be visible. It is supposed to be parsed out by the PHP parser, and the variable $name goes to that function urlencode() and returns the result. Your site is not parsing the PHP, possibly because you have pasted your code in a non-PHP area of your site.

    Regards

    Thomas

    http://cbox.ws/

    Что он имеет ввиду? :(

  5. если посмотреть в Source Code, то вместо $name появилась мое имя, но в чате все равно не можешь писать:

    "Отправка неудалась. У вас нет прав для отправки сообщений в этом Cbox. Cbox должен быть отконфигурирован."

    Отправил сообщение хозяину чата. Посмотрим что он скажет.

  6. 
    <iframe frameborder="0" width="237" height="75" src="http://www2.cbox.ws/box/?boxid=2126402&boxtag=hcwwvr&sec=form&nme=<?=urlencode($name)?>&nmekey=<?=md5('198g1ok9laai4o4o'.$name)" marginheight="2" marginwidth="2" scrolling="no" allowtransparency="yes" name="cboxform2-2126402" style="border:#DBE2ED 1px solid;border-top:0px" id="cboxform2-2126402"></iframe>
    
    

    Вот код чата. что ставить вместо $name ? Как работает чат можете посмотреть на www.cbox.ws или на onlyfilms.ru

  7. в index.php после

    $tpl->set ( '{speedbar}', $tpl->result['speedbar'] );

    вставьте

    $tpl->set ( '{name}', $member_id['user_id'] );

    и вставьте в шаблон {name} в нужное место, если не сработает чуть позже подумаю еще

    сперва сделать как на этой странице http://dle-news.ru/2006/06/15/ispolzovanie_ljubykh_php_vstavok_v_shablonakh.html ?

  8. Не работает так как файл .htaccess в папке temlates не позволяет использовать php код в файлах шаблона. Удаляйте его и пробуйте, но это все на свой страх и риск.

    Не, ну в принципе можно использовать php в шаблонах, на свой страх и риск: ;)

    http://dle-news.ru/2006/06/15/ispolzovanie_ljubykh_php_vstavok_v_shablonakh.html

    Если ставить этот хак, что вставить вместо $name в main.tpl для вывода юзера в чате www.cbox.ws ?

  9. Я не за шаблон говорю, а в каком php файле это все находится? Вы эту строчку просто так в шаб не всунете, она там не будет работать

    Вот код чата.

    
    <!-- BEGIN CBOX - www.cbox.ws - v001 -->
    
    <div id="cboxdiv" style="text-align: center; line-height: 0">
    
    <div><iframe frameborder="0" width="240" height="225" src="http://www2.cbox.ws/box/?boxid=2126402&amp;boxtag=hcwwvr&amp;sec=main" marginheight="2" marginwidth="2" scrolling="auto" allowtransparency="yes" name="cboxmain2-2126402" style="border:#ababab 1px solid;" id="cboxmain2-2126402"></iframe></div>
    
    <div><iframe frameborder="0" width="240" height="75" src="http://www2.cbox.ws/box/?boxid=2126402&amp;boxtag=hcwwvr&amp;sec=form" marginheight="2" marginwidth="2" scrolling="no" allowtransparency="yes" name="cboxform2-2126402" style="border:#ababab 1px solid;border-top:0px" id="cboxform2-2126402"></iframe></div>
    
    </div>
    
    <!-- END CBOX -->
    
    

    Чтобы интегрировать зарегистрировавшие на сайте люди в чат нужно ставить это в коде чата.

    If your site is PHP-based, alter your Cbox HTML code in the following way:

    ...&amp;sec=form&amp;nme=<?=urlencode($name)?>&amp;nmekey=<?=md5('198g1ok9laai4o4o'.$name)?>

    Where the variable $name appears, insert the variable that represents the user's name as retrieved from your userbase. This will vary depending on your CMS or forum system.

×
×
  • Создать...