Jump to content

I need help with my PHP Code

- - - - -

  • Please log in to reply
No replies to this topic

#1
DesignerLost

DesignerLost

    Newbie

  • Members
  • Pip
  • 4 posts
When i put this through Add.php it doesn't show the drop down menu to see the Files Uploaded only shows the Images I Uploaded.
I put up 3 files one is add.php and the other 2 are what it reads.
Thanks for the help in advanced :)

Sb_texteditor.php
<?php



  // ------------------

  // Text Editor

  // ------------------

  function sb_editor( $mode='entry' ) {

    // The "Text Editor Interface" 

    //

    // This is used on the "add.php", "preview_cgi.php", "add_static.php", "preview_static_cgi.php" pages. I'm planning on using it for static and comments pages also...

    global $lang_string, $user_colors, $DL_config, $theme_vars;

    

    // Include Supporting Java Script

    require_once('scripts/sb_editor.php');

    

    // Default Form Values

    $default_subject = null; // Value for Subject input field

    $default_content = null; // Value for Entry input field

    $default_tb_ping = null; // Only when DL_trackback_enabled = true

    $default_categories = null; // Field not required...

    $default_relatedlink = null; // Field not required...

    $default_time = time(); // Defaults to "now"

    $default_y = null; // Only in "Edit" mode...

    $default_m = null; // Only in "Edit" mode...

    $default_entry = null; // Only in "Edit" mode...

    $default_filename = null; // Only for Static Entries

    

    if ( $mode == 'static' ) {

      // ------------

      // Add Static Mode

      // ------------

    

      if ( array_key_exists( 'entry', $_GET ) ) {

        // -------------------

        // Edit Existing Static Entry

        // -------------------

        $default_entry = $_GET[ 'entry' ];

    

        // Read Saved Static Entry

        if ( file_exists( CONTENT_DIR.'static/' . $default_entry . '.txt' ) ) {

          $filename = CONTENT_DIR.'static/' . $default_entry . '.txt';

        } elseif ( file_exists( CONTENT_DIR.'static/' . $default_entry . '.txt.gz' ) ) {

          $filename = CONTENT_DIR.'static/' . $default_entry . '.txt.gz';

        }

        $DL_entry_data = static_entry_to_array( $filename );

        

        // Store Data for Form Use

        $default_subject = htmlDecode( $DL_entry_data[ 'SUBJECT' ] );

        $default_content = $DL_entry_data[ 'CONTENT' ];

        $default_filename = $default_entry;

        $default_menu_visible = $DL_entry_data[ 'MENU_VISIBLE' ];

        

        // Display Current Entry

        $entry_content = get_static_entry_by_file( $default_entry );

        echo( $entry_content );


      } else if ( array_key_exists( 'DL_subject', $_POST ) == true ) {

        // ----------------

        // Preview Static Entry

        // ----------------

        

        // (These will only be set if previewing an existing entry that your are editing...)

        $default_entry = array_key_exists( 'entry', $_POST ) ? $_POST[ 'entry' ] : $default_entry;


        // Store Data for Form Use

        $default_subject = sb_stripslashes( $_POST[ 'DL_subject' ] );

        $default_content = sb_stripslashes( $_POST[ 'DL_text' ] );

        $default_filename = sb_stripslashes( $_POST[ 'file_name' ] );

        $default_menu_visible = true;

        // Display Preview Entry  

        $entry_content = preview_static_entry( $default_subject, $default_content );

        echo( $entry_content );

        

      } else {

        // -------------

        // New Static Entry

        // -------------

        $default_filename = 'static' . date('ymd-His');

        $default_menu_visible = true;

      }

      

    }

    

    if ( $mode == 'entry' ) {

      // ------------

      // Add Entry Mode

      // ------------

    

      if ( array_key_exists( 'entry', $_GET ) == true && array_key_exists( 'y', $_GET ) == true && array_key_exists( 'm', $_GET ) == true ) {

        // --------------

        // Edit Existing Entry

        // --------------

        $default_y = $_GET[ 'y' ];

        $default_m = $_GET[ 'm' ];

        $default_entry = $_GET[ 'entry' ];

      

        $entry = CONTENT_DIR.$_GET[ 'y' ].'/'.$_GET[ 'm' ].'/'.$_GET[ 'entry' ];

        

        // Read Saved Entry

        if ( file_exists( $entry . ".txt" ) ) {

          $filename = $entry . ".txt";

        } else if ( file_exists( $entry . ".txt.gz" ) ) {

          $filename = $entry . ".txt.gz";

        }

        $DL_entry_data = DL_entry_to_array( $filename );

        

        // Store Data for Form Use

        $default_subject = htmlDecode( $DL_entry_data[ 'SUBJECT' ] );

        $default_content = $DL_entry_data[ 'CONTENT' ];

        $default_tb_ping = htmlDecode( $DL_entry_data[ 'TB_PING' ] );

        if ( array_key_exists( "CATEGORIES", $DL_entry_data ) ) {

          $default_categories = explode( ',', $DL_entry_data[ 'CATEGORIES' ] );

        }

        $default_relatedlink = htmlDecode( $DL_entry_data[ 'relatedlink'] );

        

        // Split up Date Information

        $temp_date = substr($_GET['entry'],-13,6);

        $temp_time = substr($_GET['entry'],-6,6);

        $dd = substr($temp_date,-2,2);

        $mt = substr($temp_date,-4,2);

        $yy = substr($temp_date,-6,2);

        if ($yy >= 95) {

          $yy = '19' . $yy;

        } else {

          $yy = '20' . $yy;

        }

        $hh = substr($temp_time,-6,2);

        $mm = substr($temp_time,-4,2);

        $ss = substr($temp_time,-2,2);

        

        // Create Time

        $default_time = mktime($hh, $mm, $ss, $mt, $dd, $yy );

        

        // Display Current Entry

        $entry_content = read_entry_from_file( $entry );

        echo( $entry_content );

        

      } else if ( array_key_exists( 'DL_subject', $_POST ) == true ) {

        // -----------

        // Preview Entry

        // -----------

        

        // (These will only be set if previewing an existing entry that your are editing...)

        $default_y = array_key_exists( 'y', $_POST ) ? $_POST[ 'y' ] : $default_y;

        $default_m = array_key_exists( 'm', $_POST ) ? $_POST[ 'm' ] : $default_m;

        $default_entry = array_key_exists( 'entry', $_POST ) ? $_POST[ 'entry' ] : $default_entry;

        

        // Store Data for Form Use

        $default_subject = sb_stripslashes( $_POST[ 'DL_subject' ] );

        $default_content = sb_stripslashes( $_POST[ 'DL_text' ] );

        $default_tb_ping = array_key_exists( 'tb_ping', $_POST ) ? sb_stripslashes( $_POST[ 'tb_ping' ] ): $default_tb_ping;

        $default_categories = array_key_exists( 'catlist', $_POST ) ? $_POST[ 'catlist' ]: $default_categories;

        $default_relatedlink = array_key_exists( 'DL_relatedlink', $_POST ) ? sb_stripslashes( $_POST[ 'DL_relatedlink' ] ): $default_relatedlink;

        

        // Create Time

        $default_time = mktime($_POST['hour'], $_POST['minute'], $_POST['second'], $_POST['month'], $_POST['day'], $_POST['year'] ); // Required

        

        // Display Preview Entry      

        $entry_content = preview_entry( $default_subject, $default_content, $default_tb_ping, $default_relatedlink, $default_time );

        echo( $entry_content );

        

      } else {

        // --------

        // New Entry

        // --------

      }

      

    }

    

    // --------------

    // Misc. Form Values

    // --------------

    switch ( $mode ) {

      case 'entry' :

        $submit_page = 'add_cgi.php';

        $preview_page = 'preview_cgi.php';

        $validate_script = 'validate';

        break;

      case 'static' :

        $submit_page = 'add_static_cgi.php';

        $preview_page = 'preview_static_cgi.php';

        $validate_script = 'validate_static';

        break;

    }

    

    

    // --------

    // Begin Form

    // --------

    ?>

    <form action='<?php echo( $submit_page ); ?>' method="post" name="editor" id="editor" onsubmit="return <?php echo( $validate_script ); ?>(this)">

      <?php

      

        // Hidden Fields

        if ( $mode == 'entry' ) {

          if ( isset($default_y) && isset($default_m) && isset($default_entry) ) {

            echo( HTML_input( false, "y", $default_y, false, 'hidden' ) );

            echo( HTML_input( false, "m", $default_m, false, 'hidden' ) );

            echo( HTML_input( false, "entry", $default_entry, false, 'hidden' ) );

          }

        }

        if ( $mode == 'static' ) {

          if ( isset($default_entry) ) {

            echo( HTML_input( false, "entry", $default_entry, false, 'hidden' ) );

          }

        }

        

        // Subject Input

        // HTML_input( $label=false, $id, $value=null, $add_returns=true, $type='text', $size=null, $maxlength=null, $onchange=null, $width=0, $disabled=false, $autocomplete=false );

        echo( HTML_input( $lang_string[ 'label_subject' ], 'DL_subject', $default_subject, true, 'text', 0, null, null, $theme_vars[ 'max_image_width' ] ) );

        

        // Date Selection Block

        if ( $mode == 'entry' ) {

          editor_date_select( $default_time );

        }

        

        // Style Tag Buttons

        editor_style_buttons( $mode );

        

        // Style Tag Dropdown

        editor_style_dropdown();

        

        // Emoticon Selection

        emoticons_show();

        

        // Image Selection Dropdown

        editor_image_dropdown();

        

		//File Selection Dropdown

		editor_files_dropdown();

		

        // Content Text Area



        // Static File Name

        if ( $mode == 'static' ) {

           echo( '<input type="checkbox" id="check_visiblemenu" name="check_visiblemenu"' );

           if ( $default_menu_visible == true ) { echo ( ' checked' ); }

           echo( '> ' . $lang_string[ 'chk_visiblemenu' ] . '<p />' );

        }

      ?>


      <label for="DL_text"><?php echo( $lang_string[ 'label_entry' ] ); ?></label><br />

      <textarea style="width: <?php echo( $theme_vars[ 'max_image_width' ] ); ?>px;" id="DL_text" name="DL_text" rows="20" cols="50" autocomplete="OFF" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);"><?php echo( $default_content ); ?></textarea><p />

      <?php

      

        // Related Link Input

        if ( $mode == 'entry' ) {

          echo( HTML_input( $lang_string[ 'label_relatedlink' ], 'DL_relatedlink', $default_relatedlink, true, 'text', null, null, null, $theme_vars[ 'max_image_width' ] ) );

        }

          

        // Trackback Input

        if ( $mode == 'entry' ) {

          if ( $DL_config[ 'DL_trackback_enabled' ] ) {

            $value = $default_tb_ping;

            if ( $DL_config[ 'DL_trackback_auto_discovery' ] ) {

              if ( $default_tb_ping ) {

                $value = $default_tb_ping;

              } else {

                $value = $lang_string[ 'label_tb_autodiscovery' ];

              }

            }

            echo( HTML_input( $lang_string[ 'label_tb_ping' ], 'tb_ping', $value, true, 'text', null, null, null, $theme_vars[ 'max_image_width' ] ) );

          }

        }

          

        // Category Selection Box

        if ( $mode == 'entry' ) {

          category_selection_box( $default_categories );

        }


        // Static File Name

        if ( $mode == 'static' ) {

          editor_static_file( $default_filename );

        }

      ?>

      

      <input type="submit" name="preview" value="<?php echo( $lang_string[ 'btn_preview' ] ); ?>" onclick="this.form.action='<?php echo( $preview_page ); ?>';" />

      <input type="submit" name="submit" value="<?php echo( $lang_string[ 'btn_post' ] ); ?>" onclick="this.form.action='<?php echo( $submit_page ); ?>';" /><p />

    </form>

    <?php

  }

  

  function editor_static_file( $filename ) {

    // Static File Name

    global $lang_string;

  

    ?>

      <label for="file_name"><?php echo( $lang_string[ 'file_name' ] ); ?></label><br/>

      <input type="text" name="file_name" autocomplete="OFF" size="40" value="<?php echo $filename; ?>"><br /><br />

    <?php

  }

  

  function editor_style_buttons( $mode ) {

    // Style Tag Buttons

    global $lang_string;

    

    echo( $lang_string[ 'label_insert' ] . '<br />' );

    ?>

      <input type="button" class="bginput" value="<?php echo( $lang_string[ 'btn_bold' ] ); ?>" onclick="ins_styles(this.form.DL_text,'b','');" />

      <input type="button" class="bginput" value="<?php echo( $lang_string[ 'btn_italic' ] ); ?>" onclick="ins_styles(this.form.DL_text,'i','');" />

			<input type="button" class="bginput" value="Center" onclick="ins_styles(this.form.DL_text,'center','');" />

      <input type="button" class="bginput" value="<?php echo( $lang_string[ 'btn_url' ] ); ?>" onclick="ins_url(this.form.DL_text);" />

      <input type="button" class="bginput" value="<?php echo( $lang_string[ 'btn_image' ] ); ?>" onclick="ins_image_v2(this.form.DL_text);"/>			

    <?php

    if ( $mode == 'entry' ) {

    ?>

      <input type="button" class="bginput" value="<?php echo( $lang_string[ 'btn_readmore' ] ); ?>" onclick="insertAtCaret(this.form.DL_text,'[more]');"/>

    <?php

    }

  }

  

  function editor_style_dropdown() {

    // Style Tag Dropdown

    global $lang_string;


    ?><br />

      <select name="style_dropdown" onchange="ins_style_dropdown(this.form.DL_text,this.form.style_dropdown.value);">

        <option label="--" value="--">--</option>

        <option label="[blockquote]xxx[/blockquote]" value="blockquote">[blockquote]xxx[/blockquote]</option>

        <option label="[pre]xxx[/pre]" value="pre">[pre]xxx[/pre]</option>

        <option label="[code]xxx[/code]" value="code"></option>

        <option label="[strong]xxx[/strong]" value="strong">[strong]xxx[/strong]</option>

        <option label="[b]xxx[/b]" value="b">[b]xxx[/b]</option>

        <option label="[em]xxx[/em]" value="em">[em]xxx[/em]</option>

        <option label="[i]xxx[/i]" value="i">[i]xxx[/i]</option>

        <option label="[h?]xxx[/h?] (?=1-6)" value="h?">[h?]xxx[/h?] (?=1-6)</option>

        <option label="" value="html"></option>

        <option label="[del]xxx[/del]" value="del">[del]xxx[/del]</option>

        <option label="[ins]xxx[/ins]" value="ins">[ins]xxx[/ins]</option>

        <option label="[strike]xxx[/strike]" value="strike">[strike]xxx[/strike]</option>

      </select>

      <input type="button" class="bginput" value="ok" onclick="ins_style_dropdown(this.form.DL_text,this.form.style_dropdown.value);"/><p />

    <?php

  }


  function editor_image_dropdown () {

    // Image Selection Dropdown

    global $lang_string, $theme_vars;

    

    $str = image_dropdown();

    if ( $str !== NULL ) {

      echo( '<a href="javascript:openpopup(\'image_list.php\',' . $theme_vars[ 'popup_window' ][ 'width' ] . ',' . $theme_vars[ 'popup_window' ][ 'height' ] . ',true);">' . $lang_string[ 'view_images' ] . '</a><br />' . $str . '<p />' );

    }

  }

  

  

  function image_dropdown () {

    // Get a list of images in the image folder. Return HTML.

    //

    global $theme_vars;

    

    // Changed this to only display Image files. This function

    // is used in comment.php if the DL owner has img tag

    // enabled for comments. (09/08/05 - alex)

    $dir = IMAGES_DIR;

    $contents = sb_folder_listing( $dir, array( '.jpg', '.jpeg', '.gif', '.png' ) );

    

    $str = NULL;

    if ($contents) {

      if ( count( $contents ) > 0 ) {

      

        $itemArray = array();

        $item = array( 'label' => '--', 'value' => '--' );

        array_push( $itemArray, $item );

        

        for ( $i = 0; $i < count( $contents ); $i++ ) {

          $str_url = $dir.$contents[$i];

          $img_size = @getimagesize( $str_url );

          if ( $img_size == false ) {

            // Image is invalid...

          } else {

            $width = $img_size[0];

            $height = $img_size[1];

            $max_image_width = $theme_vars[ 'max_image_width' ];

            /*

            if ( $width > $max_image_width ) {

              $height_resized = round( $height * ( $max_image_width / $width ) );

              $width_resized = $max_image_width;

            }

            */

            $temp_label = $contents[$i].' - '.$width.' x '.$height;

            $temp_value = '[img='.$dir.$contents[$i].' popup=false]';

            $temp_string = $contents[$i];

            

            $item = array( 'label' => $temp_label, 'value' => $temp_value, 'string' => $temp_string );

            array_push( $itemArray, $item );

          }

        }

        $str = HTML_dropdown( false, 'image_list', $itemArray, false, 'ins_image_dropdown(this.form.DL_text,this.form.image_list);' );

      }

    }

    

    return ( $str );

  }

  

  //test down

  function editor_files_dropdown () {

    // File Selection Dropdown

    global $lang_string, $theme_vars;

    

    $str = files_dropdown();

    if ( $str !== NULL ) {

      echo( '<a href="javascript:openpopup(\'files_list.php\',' . $theme_vars[ 'popup_window' ][ 'width' ] . ',' . $theme_vars[ 'popup_window' ][ 'height' ] . ',true);">' . $lang_string[ 'view_files' ] . '</a><br />' . $str . '<p />' );

    }

  }

  

  function files_dropdown () {

    // Get a list of files in the files folder. Return HTML.

    //

    global $theme_vars;

    

    // Changed this to only display the files. This function

    // is used in comment.php if the DL owner has img tag

    // enabled for comments. (03/30/2010 - DesignerLost)

    $dir = FILES_DIR;

    $contents = sb_folder_listing( $dir, array( ".pdf", ".doc", ".docx" ) );

    

    $str = NULL;

    if ($contents) {

      if ( count( $contents ) > 0 ) {

      

        $itemArray = array();

        $item = array( 'label' => '--', 'value' => '--' );

        array_push( $itemArray, $item );

        

        for ( $i = 0; $i < count( $contents ); $i++ ) {

          $str_url = $dir.$contents[$i];

          $files_size = @getfilesize( $str_url );

          if ( $files_size == false ) {

            // file is invalid...

          } else {

       

          

            

            $temp_value = '[url='.$dir.$contents[$i].' new=true]';

            $temp_string = $contents[$i];

            

            $item = array( 'label' => $temp_label, 'value' => $temp_value, 'string' => $temp_string );

            array_push( $itemArray, $item );

          }

        }

        $str = HTML_dropdown( false, 'files_list', $itemArray, false, 'ins_files_dropdown(this.form.DL_text,this.form.files_list);' );

      }

    }

    

    return ( $str );

  }

  

   // test up

  function editor_date_select( $default_time ) {

    // Date Selection Block

    global $lang_string;

    

    // Edit / Select Date

    $default_time = isset( $default_time ) ? $default_time : time();

    

    $e_day = date('d', $default_time);

    $e_month = date('n', $default_time);

    $e_year = date('Y', $default_time);

    $e_hour = date('G', $default_time);

    $e_minute = date('i', $default_time);

    $e_second = date('s', $default_time);

    

    // Day Drop Down

    $itemArray = array();

    for ( $i = 31; $i >= 1; $i-- ) {

      $item = array( 'label' => $i, 'value' => $i );

      if ( $i == $e_day ) {

        $item['selected'] = true;

      }

      array_push( $itemArray, $item );

    }

    $dd_day = HTML_dropdown( $lang_string[ 'day' ], 'day', $itemArray, false );

    

    // Month Drop Down

    $itemArray = array();

    for ( $i = 12; $i >= 1; $i-- ) {

      $timestamp = mktime(0, 0, 0, $i, date('d'), date('Y'));

      

      $item = array( 'label' => strftime('%B', $timestamp), 'value' => date('m', $timestamp) );

      if ( $i == $e_month ) {

        $item['selected'] = true;

      }

      array_push( $itemArray, $item );

    }

    $dd_month = HTML_dropdown( $lang_string[ 'month' ], 'month', $itemArray, false );

    

    // Year Drop Down

    $itemArray = array();

    for ( $i = 1  ; $i >= -10; $i-- ) {

      $timestamp = mktime(0, 0, 0, date('m'), date('d'), date('Y')+$i);

      

      $item = array( 'label' => strftime('%Y', $timestamp), 'value' => date('Y', $timestamp) );

      if ( date('Y', $timestamp) == $e_year ) {

        $item['selected'] = true;

      }

      array_push( $itemArray, $item );

    }

    $dd_year = HTML_dropdown( $lang_string[ 'year' ], 'year', $itemArray, false );

    

    echo($dd_day . ' ' . $dd_month . ' ' . $dd_year . '<p />');

    

    // $timestamp = mktime(date('H'), date('i'), date('s'), date('m'), date('d'), date('Y'));

    

    // Hour

    $itemArray = array();

    for ( $i = 24; $i >= 1; $i-- ) {

      $timestamp = mktime($i, date('i'), date('s'), date('m'), date('d'), date('Y'));

      if ( $i < 12) {

        $item = array( 'label' => date('h \a\m / H', $timestamp), 'value' => date('H', $timestamp) );

      } else {

        $item = array( 'label' => date('h \p\m / H', $timestamp), 'value' => date('H', $timestamp) );

      }

        

      if ( $i == $e_hour ) {

        $item['selected'] = true;

      }

      array_push( $itemArray, $item );

    }

    $dd_hour = HTML_dropdown( $lang_string[ 'hour' ], 'hour', $itemArray, false );

    $dd_minute = '<label for="mm">'.$lang_string[ 'minute' ].'</label> <input name="minute" id="minute" type="text" value="'.$e_minute.'" size="2" maxlength="2" />';

    $dd_second = '<label for="mm">'.$lang_string[ 'second' ].'</label> <input name="second" id="second" type="text" value="'.$e_second.'" size="2" maxlength="2" />';

      

    echo($dd_hour . ' ' . $dd_minute . ' ' . $dd_second . '<p />');

  }

  

  function category_selection_box ( $selected_cat_array=array() ) {

    // Returns categories HTML.

    global $lang_string;

    

    $str = NULL;

    $catArray = get_category_array();

    if ( count($catArray) > 0) {

      $itemArray = array();

      for ( $i = 0; $i < count( $catArray ); $i++ ) {

        $id_number = $catArray[$i][0];

        $name_str = $catArray[$i][1];

        $space_count = $catArray[$i][2];

        

        $label = '';

        for ( $j = 0; $j < $space_count; $j++ ) {

          $label  .= ' ';

        }

        $label  .= $name_str;

        

        $selected = false;

        for ( $j=0; $j < count( $selected_cat_array ); $j++) {

          if ( $selected_cat_array[$j] == $id_number ) {

            $selected = true;

            break;

          }

        }

        

        $item = array( 'label' => $label, 'value' => $id_number, 'selected' => $selected );

        array_push( $itemArray, $item );

      }

      // HTML_dropdown( $label=false, $id, $itemArray, $add_returns=true, $onchange=null, $width=0, $size=0, $multiple=false, $disabled=false )

      $str = HTML_dropdown( $lang_string[ 'label_categories' ], 'catlist[]', $itemArray, true, null, 0, min( 8, count($catArray) ), true );

    }

    

    echo( $str );

  }

	

	function category_combo_box ( $fieldname, $selected_item ) {

    // Returns categories HTML.

    global $lang_string;

    

		$str = NULL;

    $catArray = get_category_array();

    if ( count($catArray) > 0) {

      $itemArray = array();

      for ( $i = 0; $i < count( $catArray ); $i++ ) {

        $id_number = $catArray[$i][0];

        $name_str = $catArray[$i][1];

        $space_count = $catArray[$i][2];

        

        $label = '';

        for ( $j = 0; $j < $space_count; $j++ ) {

          $label  .= ' ';

        }

        $label  .= $name_str;

        

        $selected = false;

        if ( $selected_item == $id_number ) {

						$selected = true;

            //break;

        }

        

        $item = array( 'label' => $label, 'value' => $id_number, 'selected' => $selected );

        array_push( $itemArray, $item );

      }

      $str = HTML_dropdown( false, $fieldname, $itemArray);

    }

    

    echo( $str );

  }


?>


Add.php
<?php

  // ---------------

  // INITIALIZE PAGE

  // ---------------

  require_once('scripts/sb_functions.php');

  global $logged_in;

  $logged_in = logged_in( true, true );

  

  read_config();

  

  require_once('languages/' . $DL_config[ 'DL_language' ] . '/strings.php');

  sb_language( 'add' );

  

  // ---------------

  // POST PROCESSING

  // ---------------

  

  // ------------

  // PAGE CONTENT

  // ------------

  function page_content() {

    global $lang_string, $DL_config;

    

    // SUBJECT

    $entry_array = array();

    $entry_array[ 'subject' ] = $lang_string[ 'title' ];

    

    // PAGE CONTENT BEGIN

    ob_start();

    

    echo( $lang_string[ 'instructions' ] . '<p />' );

    echo( '<hr />' );

    sb_editor();

    

    // PAGE CONTENT END

    $entry_array[ 'entry' ] = ob_get_clean();

    

    // THEME ENTRY

    echo( theme_staticentry( $entry_array ) );

  }

  

  // ----

  // HTML

  // ----

?>

  <?php echo( get_init_code() ); ?>

  <?php require_once('themes/' . $DL_theme . '/user_style.php'); ?>

  

  <?php require_once('scripts/sb_editor.php'); ?>

  <title><?php echo($DL_config[ 'DL_title' ]); ?> - <?php echo( $lang_string[ 'title' ] ); ?></title>

</head>

  <?php 

    // ------------

    // BEGIN OUTPUT

    // ------------

    theme_pagelayout();

  ?>

</html>


sb_editor.php

<script type="text/javascript">

	<!--

	

	// Insert Style Tags

	function ins_styles(theform,sb_code,prompt_text,tag_prompt) {

		// Insert [x]yyy[/x] style markup

		

		// Get selected text

		var selected_text = getSelectedText(theform);

		

		if (selected_text == '') {

			// Display prompt if no text is selected

			var inserttext = prompt( '<?php echo( $lang_string[ 'insert_styles' ] ); ?>'+"\n["+sb_code+"]xxx[/"+sb_code+"]", '' );

			if ( (inserttext != null) ) {

				insertAtCaret(theform, "["+sb_code+"]"+inserttext+"[/"+sb_code+"]");

				theform.focus();

			}

		} else {

			// Insert text automatically around selection

			insertAtCaret(theform, "["+sb_code+"]"+selected_text+"[/"+sb_code+"]");

			theform.focus();

		}

	}

	

	// Insert Style Tags

	function ins_style_dropdown(theform, sb_code) {

		// Insert [sb_code]xxx[/sb_code] style markup

		

		if ( sb_code != '-'+'-' ) {

			// Get selected text

			var selected_text = getSelectedText(theform);

		

			if (selected_text == '') {

				prompt_text = '[' + sb_code + ']xxx[/' + sb_code + ']';

				user_input = prompt( prompt_text, '' );

				if ( (user_input != null) ) {

					insertAtCaret(theform, '['+sb_code+']'+user_input+'[/'+sb_code+']');

					theform.focus();

				}

			} else {

				// Insert text automatically around selection

				insertAtCaret(theform, "["+sb_code+"]"+selected_text+"[/"+sb_code+"]");

				theform.focus();

			}				

		}

	}

	

	// Insert Image Tag

	function ins_image(theform,prompt_text) {

		// Insert [x]yyy[/x] style markup

		inserttext = prompt('<?php echo( $lang_string[ 'insert_image' ] ); ?>'+"\n[img="+prompt_text+"xxx]",prompt_text);

		if ((inserttext != null) && (inserttext != "")) {

			insertAtCaret(theform, "[img="+inserttext+"]");

		}

		theform.focus();

	}

	

	// Insert Image Tag

	function ins_image_v2(theform) {

		image_url = prompt('<?php echo( $lang_string[ 'insert_image' ] ); ?>'+'\n[img=http://xxx] or [img=xxx]\n\n<?php echo( $lang_string[ 'insert_image_optional' ] ); ?>\nwidth=xxx height=xxx popup=true/false float=left/right','http://');

		if ((image_url != null) && (image_url != '')) {

			// Optional

			image_width = prompt('<?php echo( $lang_string[ 'insert_image_width' ] ); ?>'+'\n[img=xxx width=xxx]','');

			image_height = prompt('<?php echo( $lang_string[ 'insert_image_height' ] ); ?>'+'\n[img=xxx height=xxx]','');

			image_popup = prompt('<?php echo( $lang_string[ 'insert_image_popup' ] ); ?>'+'\n[img=xxx popup=true/false]', '');

			image_float = prompt('<?php echo( $lang_string[ 'insert_image_float' ] ); ?>'+'\n[img=xxx float=left/right]','');

			

			str = '[img='+image_url;

			if ((image_width != null) && (image_width != '')) {

				str += ' width='+image_width;

			}

			if ((image_height != null) && (image_height != '')) {

				str += ' height='+image_height;

			}

			if ((image_popup != null) && (image_popup != '')) {

				image_popup.toLowerCase;

				if ( image_popup == 'true' || image_popup == 'false' ) {

					str += ' popup='+image_popup;

				}

			}

			if ((image_float != null) && (image_float != '')) {

				image_float.toLowerCase;

				if ( image_float == 'left' || image_float == 'right' ) {

					str += ' float='+image_float;

				}

			}

			str += ']';

			

			insertAtCaret(theform, str);

			theform.focus();

		

		}

	}

	

	// Insert Image Dropdown Menu

	function ins_image_dropdown(theform,theImage) {

		if (theImage.value != '-'+'-') {

			insertAtCaret(theform, theImage.value);

			theform.focus();

		}

	}

	

	

	// Insert files Dropdown Menu

	function ins_files_dropdown(theform,thefiles) {

		if (thefiles.value != '-'+'-') {

			insertAtCaret(theform, thefiles.value);

			theform.focus();

		}

	}

	

	

	// Insert URL Tag

	function ins_url(theform) {

	

		// inserts named url link - [url=mylink new=true]text[/url]

		link_url = prompt('<?php echo( $lang_string[ 'insert_url2' ] ); ?>'+'\n[url=xxx][/url]',"http://");

		if ( (link_url != null) ) {

		

			// Get selected text

			var link_text = getSelectedText(theform);

			if (link_text == '') {

				// Display prompt if no text is selected

				link_text = prompt('<?php echo( $lang_string[ 'insert_url1' ] ); ?>'+'\n[url=]xxx[/url]',"");

			}

			if ( (link_text == null) || (link_text == '') ) {

				link_text = link_url;

			}

			link_target = prompt('<?php echo( $lang_string[ 'insert_url3' ] ); ?>'+'\n[url= new=true/false][/url]','');

			str = '[url='+link_url;

			if ((link_target != null) && (link_target != '')) {

				link_target.toLowerCase;

				if ( link_target == 'true' || link_target == 'false' ) {

					str += ' new='+link_target;

					

				}

			}

			str += ']'+link_text+'[/url]';

			

			insertAtCaret(theform, str);

			theform.focus();

		}

	}

	

	// Insert URL Tag

	function ins_url_no_options(theform) {

		// inserts named url link - [url=mylink new=true]text[/url]

		link_url = prompt('<?php echo( $lang_string[ 'insert_url2' ] ); ?>'+'\n[url=xxx][/url]',"http://");

		if ( (link_url != null) ) {

			// Get selected text

			var link_text = getSelectedText(theform);

			if (link_text == '') {

				// Display prompt if no text is selected

				link_text = prompt('<?php echo( $lang_string[ 'insert_url1' ] ); ?>'+'\n[url=]xxx[/url]',"");

			}

			if ( (link_text == null) || (link_text == '') ) {

				link_text = link_url;

			}

			str = '[url='+link_url+']'+link_text+'[/url]';

			

			insertAtCaret(theform, str);

			theform.focus();

		}

	}

	

	//Insert Emoticon

	function ins_emoticon(theform, emoticon) {

		insertAtCaret(theform, emoticon);

		theform.focus();

	}

	

	// Validate the Form

	function validate(theform) {

		if (theform.DL_text.value=="" || theform.DL_subject.value=="") {

			alert("<?php echo( $lang_string[ 'form_error' ] ); ?>");

			return false;

		} else {

			return true;

		}

	}

	

	// Validate the Form

	function validate_static(theform) {

		if (theform.DL_text.value=="" || theform.DL_subject.value=="" || theform.files_name.value=="" ) {

			alert("<?php echo( $lang_string[ 'form_error' ] ); ?>");

			return false;

		} else {

			return true;

		}

	}


	// From:

	// [url=http://parentnode.org/javascript/working-with-the-cursor-position/]parentNode.org  Working with the Cursor Position[/url]

	function insertAtCaret2(obj, text) {

		if (document.selection && document.selection.createRange) {

			// Internet Explorer 4.0x

			

			obj.focus();

			var orig = obj.value.replace(/\r\n/g, "\n"); // IE Bug

			var range = document.selection.createRange();

	

			if(range.parentElement() != obj) {

				return false;

			}

	

			range.text = text;

			

			var actual = tmp = obj.value.replace(/\r\n/g, "\n");

	

			for(var diff = 0; diff < orig.length; diff++) {

				if(orig.charAt(diff) != actual.charAt(diff)) break;

			}

	

			for(var index = 0, start = 0; 

				tmp.match(text.toString()) 

					&& (tmp = tmp.replace(text.toString(), "")) 

					&& index <= diff; 

				index = start + text.toString().length

			) {

				start = actual.indexOf(text.toString(), index);

			}

		} else if (obj.selectionStart >= 0) {

			// FireFox & Safari

			var start = obj.selectionStart;

			var end   = obj.selectionEnd;

	

			obj.value = obj.value.substr(0, start) 

				+ text 

				+ obj.value.substr(end, obj.value.length);

		}

		

		if (start != null) {

			setCaretTo(obj, start + text.length);

		} else {

			obj.value += text;

		}

	}

	

	function getSelectedText(obj) {

		if (document.selection && document.selection.createRange) {

			// Internet Explorer 4.0x

			

			obj.focus();

			var orig = obj.value.replace(/\r\n/g, "\n"); // IE Bug

			var range = document.selection.createRange();

			

			if (range.parentElement() != obj) {

				return '';

			}

			

			txt = range.text;

			

			return txt;

		} else if (obj.selectionStart >= 0) {

			// FireFox & Safari

			var start = obj.selectionStart;

			var end    = obj.selectionEnd;

			var txt    = obj.value.substr(start, end-start);

			

			return txt;

		} else {

			return '';

		}

	}

	

	function setCaretTo(obj, pos) {

		if(obj.createTextRange) {

			var range = obj.createTextRange();

			range.move('character', pos);

			range.select();

		} else if(obj.selectionStart) {

			obj.focus();

			obj.setSelectionRange(pos, pos);

		}

	}

	

	function getSel() {

		var txt = '';

		var foundIn = '';

		if (window.getSelection) {

			// the alternative code

			txt = window.getSelection();

			foundIn = 'window.getSelection()';

		} else if (document.getSelection) {

			// Navigator 4.0x

			txt = document.getSelection();

			foundIn = 'document.getSelection()';

		} else if (document.selection) {

			// Internet Explorer 4.0x

			txt = document.selection.createRange().text;

			foundIn = 'document.selection.createRange()';

		} else {

			return;

		}

		return txt;

	}


	function insertAtCaret(obj, text) {

		var mytext;

		obj.focus();

		

		if (document.selection) {

			// 'Code For IE'

			text = ' ' + text + ' ';

			if (obj.createTextRange && obj.caretPos) {

				var caretPos = obj.caretPos;

				caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;

				return;

			}

		} else if (obj.selectionStart!==false) {

			// 'Code for Gecko'

			var start = obj.selectionStart;

			var end   = obj.selectionEnd;

			

			obj.value = obj.value.substr(0, start) + text + obj.value.substr(end, obj.value.length);

		}

		

		if (start != null) {

			setCaretTo(obj, start + text.length);

		} else {

			obj.focus();

			obj.value += text;

		}

	}


	// Insert at Caret position. Code from

	// [url=http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130]FAQTs - Knowledge Base - View Entry - How can I store the caret(cursor) position of a text field/text area?[/url]

	function storeCaret(textEl) {

		if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();

	}


	// Validate the Form for Blocks

	function validate_block(theform) {

		if (theform.text.value=="" || theform.block_name.value=="") {

			alert("<?php echo( $lang_string[ 'form_error' ] ); ?>");

			return false;

		} else {

			return true;

		}

	}

	

	


	<!--

	

	// Insert Style Tags

	function ins_styles(theform,sb_code,prompt_text,tag_prompt) {

		// Insert [x]yyy[/x] style markup

		

		// Get selected text

		var selected_text = getSelectedText(theform);

		

		if (selected_text == '') {

			// Display prompt if no text is selected

			var inserttext = prompt( '<?php echo( $lang_string[ 'insert_styles' ] ); ?>'+"\n["+sb_code+"]xxx[/"+sb_code+"]", '' );

			if ( (inserttext != null) ) {

				insertAtCaret(theform, "["+sb_code+"]"+inserttext+"[/"+sb_code+"]");

				theform.focus();

			}

		} else {

			// Insert text automatically around selection

			insertAtCaret(theform, "["+sb_code+"]"+selected_text+"[/"+sb_code+"]");

			theform.focus();

		}

	}

	

	// Insert Style Tags

	function ins_style_dropdown(theform, sb_code) {

		// Insert [sb_code]xxx[/sb_code] style markup

		

		if ( sb_code != '-'+'-' ) {

			// Get selected text

			var selected_text = getSelectedText(theform);

		

			if (selected_text == '') {

				prompt_text = '[' + sb_code + ']xxx[/' + sb_code + ']';

				user_input = prompt( prompt_text, '' );

				if ( (user_input != null) ) {

					insertAtCaret(theform, '['+sb_code+']'+user_input+'[/'+sb_code+']');

					theform.focus();

				}

			} else {

				// Insert text automatically around selection

				insertAtCaret(theform, "["+sb_code+"]"+selected_text+"[/"+sb_code+"]");

				theform.focus();

			}				

		}

	}

	

	// Insert Image Tag

	function ins_image(theform,prompt_text) {

		// Insert [x]yyy[/x] style markup

		inserttext = prompt('<?php echo( $lang_string[ 'insert_image' ] ); ?>'+"\n[img="+prompt_text+"xxx]",prompt_text);

		if ((inserttext != null) && (inserttext != "")) {

			insertAtCaret(theform, "[img="+inserttext+"]");

		}

		theform.focus();

	}

	

	// Insert Image Tag

	function ins_image_v2(theform) {

		image_url = prompt('<?php echo( $lang_string[ 'insert_image' ] ); ?>'+'\n[img=http://xxx] or [img=xxx]\n\n<?php echo( $lang_string[ 'insert_image_optional' ] ); ?>\nwidth=xxx height=xxx popup=true/false float=left/right','http://');

		if ((image_url != null) && (image_url != '')) {

			// Optional

			image_width = prompt('<?php echo( $lang_string[ 'insert_image_width' ] ); ?>'+'\n[img=xxx width=xxx]','');

			image_height = prompt('<?php echo( $lang_string[ 'insert_image_height' ] ); ?>'+'\n[img=xxx height=xxx]','');

			image_popup = prompt('<?php echo( $lang_string[ 'insert_image_popup' ] ); ?>'+'\n[img=xxx popup=true/false]', '');

			image_float = prompt('<?php echo( $lang_string[ 'insert_image_float' ] ); ?>'+'\n[img=xxx float=left/right]','');

			

			str = '[img='+image_url;

			if ((image_width != null) && (image_width != '')) {

				str += ' width='+image_width;

			}

			if ((image_height != null) && (image_height != '')) {

				str += ' height='+image_height;

			}

			if ((image_popup != null) && (image_popup != '')) {

				image_popup.toLowerCase;

				if ( image_popup == 'true' || image_popup == 'false' ) {

					str += ' popup='+image_popup;

				}

			}

			if ((image_float != null) && (image_float != '')) {

				image_float.toLowerCase;

				if ( image_float == 'left' || image_float == 'right' ) {

					str += ' float='+image_float;

				}

			}

			str += ']';

			

			insertAtCaret(theform, str);

			theform.focus();

		

		}

	}

	

	// Insert Image Dropdown Menu

	function ins_image_dropdown(theform,theImage) {

		if (theImage.value != '-'+'-') {

			insertAtCaret(theform, theImage.value);

			theform.focus();

		}

	}

	//

	



	// Insert Style Tags

	function ins_styles(theform,sb_code,prompt_text,tag_prompt) {

		// Insert [x]yyy[/x] style markup

		

		// Get selected text

		var selected_text = getSelectedText(theform);

		

		if (selected_text == '') {

			// Display prompt if no text is selected

			var inserttext = prompt( '<?php echo( $lang_string[ 'insert_styles' ] ); ?>'+"\n["+sb_code+"]xxx[/"+sb_code+"]", '' );

			if ( (inserttext != null) ) {

				insertAtCaret(theform, "["+sb_code+"]"+inserttext+"[/"+sb_code+"]");

				theform.focus();

			}

		} else {

			// Insert text automatically around selection

			insertAtCaret(theform, "["+sb_code+"]"+selected_text+"[/"+sb_code+"]");

			theform.focus();

		}

	}

	

	// Insert Style Tags

	function ins_style_dropdown(theform, sb_code) {

		// Insert [sb_code]xxx[/sb_code] style markup

		

		if ( sb_code != '-'+'-' ) {

			// Get selected text

			var selected_text = getSelectedText(theform);

		

			if (selected_text == '') {

				prompt_text = '[' + sb_code + ']xxx[/' + sb_code + ']';

				user_input = prompt( prompt_text, '' );

				if ( (user_input != null) ) {

					insertAtCaret(theform, '['+sb_code+']'+user_input+'[/'+sb_code+']');

					theform.focus();

				}

			} else {

				// Insert text automatically around selection

				insertAtCaret(theform, "["+sb_code+"]"+selected_text+"[/"+sb_code+"]");

				theform.focus();

			}				

		}

	}

	

	// Insert files Tag

	function ins_files(theform,prompt_text) {

		// Insert [x]yyy[/x] style markup

		inserttext = prompt('<?php echo( $lang_string[ 'insert_files' ] ); ?>'+"\n[url="+prompt_text+"xxx]",prompt_text);

		if ((inserttext != null) && (inserttext != "")) {

			insertAtCaret(theform, "[url="+inserttext+"]");

		}

		theform.focus();

	}

	

	// Insert files Tag

	function ins_files_v2(theform) {

		files_url = prompt('<?php echo( $lang_string[ 'insert_files' ] ); ?>'+'\n[url=http://xxx] or [urk=xxx]\n\n<?php echo( $lang_string[ 'insert_files_optional' ] ); ?>\nwidth=xxx height=xxx popup=true/false float=left/right','http://');

		if ((files_url != null) && (files_url != '')) {

			// Optional

			

			

			

			str = '[url='+files_url;

		

			str += ']';

			

			insertAtCaret(theform, str);

			theform.focus();

		

		}

	}

	

	// Insert files Dropdown Menu

	function ins_files_dropdown(theform,thefiles) {

		if (thefiles.value != '-'+'-') {

			insertAtCaret(theform, thefiles.value);

			theform.focus();

		}

	}

	//

	// Insert URL Tag

	function ins_url(theform) {

	

		// inserts named url link - [url=mylink new=true]text[/url]

		link_url = prompt('<?php echo( $lang_string[ 'insert_url2' ] ); ?>'+'\n[url=xxx][/url]',"http://");

		if ( (link_url != null) ) {

		

			// Get selected text

			var link_text = getSelectedText(theform);

			if (link_text == '') {

				// Display prompt if no text is selected

				link_text = prompt('<?php echo( $lang_string[ 'insert_url1' ] ); ?>'+'\n[url=]xxx[/url]',"");

			}

			if ( (link_text == null) || (link_text == '') ) {

				link_text = link_url;

			}

			link_target = prompt('<?php echo( $lang_string[ 'insert_url3' ] ); ?>'+'\n[url= new=true/false][/url]','');

			str = '[url='+link_url;

			if ((link_target != null) && (link_target != '')) {

				link_target.toLowerCase;

				if ( link_target == 'true' || link_target == 'false' ) {

					str += ' new='+link_target;

					

				}

			}

			str += ']'+link_text+'[/url]';

			

			insertAtCaret(theform, str);

			theform.focus();

		}

	}

	

	// Insert URL Tag

	function ins_url_no_options(theform) {

		// inserts named url link - [url=mylink new=true]text[/url]

		link_url = prompt('<?php echo( $lang_string[ 'insert_url2' ] ); ?>'+'\n[url=xxx][/url]',"http://");

		if ( (link_url != null) ) {

			// Get selected text

			var link_text = getSelectedText(theform);

			if (link_text == '') {

				// Display prompt if no text is selected

				link_text = prompt('<?php echo( $lang_string[ 'insert_url1' ] ); ?>'+'\n[url=]xxx[/url]',"");

			}

			if ( (link_text == null) || (link_text == '') ) {

				link_text = link_url;

			}

			str = '[url='+link_url+']'+link_text+'[/url]';

			

			insertAtCaret(theform, str);

			theform.focus();

		}

	}

	

	//Insert Emoticon

	function ins_emoticon(theform, emoticon) {

		insertAtCaret(theform, emoticon);

		theform.focus();

	}

	

	// Validate the Form

	function validate(theform) {

		if (theform.DL_text.value=="" || theform.DL_subject.value=="") {

			alert("<?php echo( $lang_string[ 'form_error' ] ); ?>");

			return false;

		} else {

			return true;

		}

	}

	

	// Validate the Form

	function validate_static(theform) {

		if (theform.DL_text.value=="" || theform.DL_subject.value=="" || theform.files_name.value=="" ) {

			alert("<?php echo( $lang_string[ 'form_error' ] ); ?>");

			return false;

		} else {

			return true;

		}

	}


	// From:

	// [url=http://parentnode.org/javascript/working-with-the-cursor-position/]parentNode.org  Working with the Cursor Position[/url]

	function insertAtCaret2(obj, text) {

		if (document.selection && document.selection.createRange) {

			// Internet Explorer 4.0x

			

			obj.focus();

			var orig = obj.value.replace(/\r\n/g, "\n"); // IE Bug

			var range = document.selection.createRange();

	

			if(range.parentElement() != obj) {

				return false;

			}

	

			range.text = text;

			

			var actual = tmp = obj.value.replace(/\r\n/g, "\n");

	

			for(var diff = 0; diff < orig.length; diff++) {

				if(orig.charAt(diff) != actual.charAt(diff)) break;

			}

	

			for(var index = 0, start = 0; 

				tmp.match(text.toString()) 

					&& (tmp = tmp.replace(text.toString(), "")) 

					&& index <= diff; 

				index = start + text.toString().length

			) {

				start = actual.indexOf(text.toString(), index);

			}

		} else if (obj.selectionStart >= 0) {

			// FireFox & Safari

			var start = obj.selectionStart;

			var end   = obj.selectionEnd;

	

			obj.value = obj.value.substr(0, start) 

				+ text 

				+ obj.value.substr(end, obj.value.length);

		}

		

		if (start != null) {

			setCaretTo(obj, start + text.length);

		} else {

			obj.value += text;

		}

	}

	

	function getSelectedText(obj) {

		if (document.selection && document.selection.createRange) {

			// Internet Explorer 4.0x

			

			obj.focus();

			var orig = obj.value.replace(/\r\n/g, "\n"); // IE Bug

			var range = document.selection.createRange();

			

			if (range.parentElement() != obj) {

				return '';

			}

			

			txt = range.text;

			

			return txt;

		} else if (obj.selectionStart >= 0) {

			// FireFox & Safari

			var start = obj.selectionStart;

			var end    = obj.selectionEnd;

			var txt    = obj.value.substr(start, end-start);

			

			return txt;

		} else {

			return '';

		}

	}

	

	function setCaretTo(obj, pos) {

		if(obj.createTextRange) {

			var range = obj.createTextRange();

			range.move('character', pos);

			range.select();

		} else if(obj.selectionStart) {

			obj.focus();

			obj.setSelectionRange(pos, pos);

		}

	}

	

	function getSel() {

		var txt = '';

		var foundIn = '';

		if (window.getSelection) {

			// the alternative code

			txt = window.getSelection();

			foundIn = 'window.getSelection()';

		} else if (document.getSelection) {

			// Navigator 4.0x

			txt = document.getSelection();

			foundIn = 'document.getSelection()';

		} else if (document.selection) {

			// Internet Explorer 4.0x

			txt = document.selection.createRange().text;

			foundIn = 'document.selection.createRange()';

		} else {

			return;

		}

		return txt;

	}


	function insertAtCaret(obj, text) {

		var mytext;

		obj.focus();

		

		if (document.selection) {

			// 'Code For IE'

			text = ' ' + text + ' ';

			if (obj.createTextRange && obj.caretPos) {

				var caretPos = obj.caretPos;

				caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;

				return;

			}

		} else if (obj.selectionStart!==false) {

			// 'Code for Gecko'

			var start = obj.selectionStart;

			var end   = obj.selectionEnd;

			

			obj.value = obj.value.substr(0, start) + text + obj.value.substr(end, obj.value.length);

		}

		

		if (start != null) {

			setCaretTo(obj, start + text.length);

		} else {

			obj.focus();

			obj.value += text;

		}

	}


	// Insert at Caret position. Code from

	// [url=http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130]FAQTs - Knowledge Base - View Entry - How can I store the caret(cursor) position of a text field/text area?[/url]

	function storeCaret(textEl) {

		if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();

	}


	// Validate the Form for Blocks

	function validate_block(theform) {

		if (theform.text.value=="" || theform.block_name.value=="") {

			alert("<?php echo( $lang_string[ 'form_error' ] ); ?>");

			return false;

		} else {

			return true;

		}

	}

	-->



	

	

</script>






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users