View file moduls/visual/function.php

File size: 2.59Kb
<?php
function vis_typ($line,$cms)
{
 $line_ex = explode('|',trim($line));
 $dostup = $line_ex[0];
 if ( $dostup == 'user' && $_SESSION['user_login'] != '')
 $desc = 1;
 elseif ( $dostup == 'user' && $_SESSION['user_login'] == '')
 $desc = 0;
 elseif ( $dostup != 'user' && $_SESSION['user_login'] != '')
 $desc = 1;
 elseif ( $dostup != 'user' && $_SESSION['user_login'] == '')
 $desc = 1;
 if ($desc == 1)
 {
  $typ = $line_ex[1];
  // работа интерпретатора
  if ($typ == 'link')
  {
   $href = ($line_ex[2]);
   $mess1 = trim(($line_ex[3]));
   include($vis.'set_q.php');
   $name = $mess1;
   echo '<a href="'.$href.'">'.($name).'</a><br>';
  }
  elseif ($typ == 'polosa')
  {
   echo '<hr>';
  }
  elseif ($typ == 'ramka')
  {
   $mess1 = $line_ex[2];
   include($vis.'set_q.php');
   $text = $mess1;
   echo '<div class="ramka">'.($text).'</div>';
  }
  elseif ($typ == 'area')
  {
   $mess1 = $line_ex[4];
   include($vis.'set_q.php');
   $text = $mess1;
   $str = trim($line_ex[2]);
   echo '<textarea style="width: 80%;" rows='.$str.'>'.($text).'</textarea><br>';
   }
  elseif ($typ == 'error')
  {
   $mess1 = $line_ex[2];
   include($vis.'set_q.php');
   $text = $mess1;
   echo '<div class="error">'.($text).'</div>';
  }
  elseif ($typ == 'zagolovok')
  {
   $text = $line_ex[2];
   echo '<div class="mess1">'.($text).'</div>';
  }
  elseif ($typ == 'image')
  {
   $scr = $line_ex[2];
   $width = $line_ex[3];
   $height = $line_ex[4];
   $alt = htmlspecialchars($line_ex[5]);
   $border = trim($line_ex[6]);
   echo '<img src="'.$scr.'" width="'.$width.'" height="'.$height.'" alt="'.$alt.'" border="'.$border.'">';
  }
  elseif ($typ == 'modul')
  {
  $moduls = htmlspecialchars($line_ex[2]);
  if (is_file($cms.'str/'.$moduls.''))
  include($cms.'str/'.$moduls.'');
  else
  echo '<div class="error">Модуль не найден.</div>';
  }
  elseif ($typ == 'text')
  {
   $mess1 = $line_ex[2];
   include($vis.'set_q.php');
   $text = $mess1;
   echo '<div class="mess2">'.($text).'</div>';
  }
  elseif ($typ == 'knopka')
  {
   $mess1 = $line_ex[2];
   include($vis.'set_q.php');
   $name = $mess1;
   $href = htmlspecialchars($line_ex[3]);
   echo '<a class="knopka" href="'.$href.'">'.($name).'</a><br>';
   }
  echo '
  ';
  // закончили работу интерпретатора
 }
 else
 {
  echo '
  <div class="error">Для просмотра скрытого текста необходимо авторизоваться либо зарегистрироваться.</div>
  ';
 }

}
?>