Просмотр файла www/flud/js/add_smyle.php

Размер файла: 1.39Kb
<?php
session_start();
$cms = $_SESSION['cms_2'];
$ms_pol = $_GET['ms_pol'];
echo '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><body onLoad="parent.opt();">';
?>
<script type="text/javascript">
function add_smyle(smyle)
{
var area=parent.document.getElementsByName('<?php echo $ms_pol?>').item(0);

if ((area.selectionStart)||(area.selectionStart=='0'))
{
  var p_start=area.selectionStart;
  var p_end=area.selectionEnd;
  area.value=area.value.substring(0,p_start)+smyle+area.value.substring(p_end,area.value.length);
}
else
{

if (document.selection)
{
  area.focus();
  sel=parent.document.selection.createRange();
  sel.text=smyle;
}
}
  if(typeof parent.Change == 'function')
 {
  parent.Change();
 }
}
</script>
<table><tr>
<?php

         $dire = opendir ($cms.'flud/smyles');
         $tr = 0;
          while ($filee = readdir ($dire))
         { if (( $filee != ".") && ($filee != "..") && ($filee != 'index.html'))
          {
           $tr+=1;
           if ($tr > 5) {echo '</tr><tr>'; $tr = 1;}
           echo '
           <td>
           <input onClick="add_smyle(\'[smyle=/flud/smyles/'.$filee.'=smyle]\')" type="image" src="/flud/smyles/'.$filee.'" name="sub">
           </td>
           ';
           }
         }
          closedir ($dire);

?>
</tr></table>
</body></html>