示例#1
0
 public function index()
 {
     // creates new PDF object
     $pdf = new Pdf();
     $this->Pdf_assessment_model->setDefaultConfig($pdf);
     $pdf->SetAuthor($this->session->name . ' ' . $this->session->last_name);
     $pdf->SetTitle(_('Fiche d\'évaluation'));
     // adds a page for each student
     $data = $this->prepareAssessmentRecords($this->input->post('project_id'), $this->input->post('term'));
     foreach ($data as $student) {
         $pdf->AddPage();
         $html = $this->Pdf_assessment_model->processAssessmentsRecordHtml($student);
         $pdf->writeHTML($html, false, false, false, false, '');
     }
     //Closes and opens a PDF file in new tab (arg 'I' in Output method)
     $this->load->helper('school');
     $filename = sanitize_name(get_school_year() . '_' . $data[0]['term'] . '_' . $data[0]['class'] . '_' . $data[0]['project_name']);
     $pdf->Output($filename . '.pdf', 'I');
 }
	/**
	 * Creates do_upload CI config for PDF instructions file
	 *
	 * @param 	string		$class
	 * @param 	string		$term
	 * @param 	string		$project_name
	 * @return	array
	 */
	public function getUploadPDFConfig($class, $term, $project_name)
	{
		$this->load->helper('school');
		$this->load->helper('format');

		$file_name = $class . '_' . $term . '_' . $project_name;
		$file_path = 'uploads/' . get_school_year() . '/' . strtoupper($class) . '/instructions/';

		// create dir if not exists
		if (!is_dir('assets/' . $file_path)) mkdir('assets/' . $file_path, 0755, TRUE);

		$config['file_name']            = sanitize_name($file_name);
		$config['overwrite']            = TRUE;
		$config['file_ext_tolower']     = TRUE;
		$config['upload_path']          = './assets/' . $file_path;
		$config['file_db_path']         = $file_path;
		$config['allowed_types']        = 'pdf';

		return($config);
	}
示例#3
0
function jal_get_shoutboxarchive($cat = "")
{
    global $wpdb, $user_ID, $user_level, $user_identity, $limit, $offset, $shout_cat, $Actual_URL, $shout_opt;
    $jal_admin_user_level = get_option('shoutbox_admin_level') != "" ? get_option('shoutbox_admin_level') : 10;
    $cat = $cat != "" ? $cat : $shout_cat;
    $XHTML = $shout_opt['xhtml'];
    $show_to_level = $shout_opt['level_for_shoutbox'];
    $alt = "alternate";
    $link = "";
    $link_cat = $cat != "" ? "&shout_cat=" . urlencode(stripslashes($cat)) : "";
    $link_cat2 = str_replace("&shout_cat=", "?shout_cat=", $link_cat);
    $show = $shout_opt['show_avatar'];
    $size = $shout_opt['avatar_size'];
    $level_for_archive = $shout_opt['level_for_archive'];
    $level_for_theme = $shout_opt['level_for_theme'];
    $user_level = isset($user_level) ? $user_level : -1;
    $Show_IP = true;
    $current = $level_for_archive == -1 || $show_to_level == -1 ? 1 : current_user_can('level_' . $show_to_level);
    $curarc = $level_for_archive == -1 ? 1 : current_user_can('level_' . $level_for_archive);
    $curthe = $level_for_theme == -1 ? 1 : current_user_can('level_' . $level_for_theme);
    $curadm = current_user_can('level_' . $jal_admin_user_level);
    //if user can see archive, can see theme or theme is not set.
    if ($current == 1 && $curarc == 1 && ($cat == "" || $curthe == 1)) {
        @mysql_query("SET CHARACTER SET 'utf8'");
        @mysql_query("SET NAMES utf8");
        if (!isset($_SESSION['LoggedUsers'])) {
            $LoggedUsers = $wpdb->get_col("SELECT display_name FROM " . $wpdb->users);
            $_SESSION['LoggedUsers'] = $LoggedUsers;
        }
        $wpdb->hide_errors();
        $SQL = "SELECT SQL_CALC_FOUND_ROWS id, time, name, text, url, ipaddr, email FROM " . $_SESSION['tb_prefix'] . "liveshoutboxarchive ";
        $SQL .= "WHERE cat='" . mysql_real_escape_string($cat) . "' ORDER BY id DESC LIMIT " . $offset . "," . $limit;
        $results = $wpdb->get_results($SQL);
        $wpdb->show_errors();
        $result = mysql_query('SELECT FOUND_ROWS() AS total');
        $data = mysql_fetch_assoc($result);
        $total = $data['total'];
        ?>


<table width="100%" border="0" id="wordspew">
	<?php 
        $colspan = $user_level >= $jal_admin_user_level || $curadm == 1 ? 5 : 3;
        if ($user_level >= $jal_admin_user_level && !current_user_can('manage_options')) {
            $colspan = 4;
            $Show_IP = false;
        }
        echo '<tr>
	<th colspan="' . $colspan . '">
	<div class="goback"><a href="' . $Actual_URL . '"><img 
	src="' . $Actual_URL . '/wp-content/plugins/pierres-wordspew/img/home.png" border="0" width="32" height="32" alt=""
	title="' . __("Click here to go to the Homepage", wordspew) . '"/></a></div>
	<h3><a href="wordspew_archive.php' . $link_cat2 . '" title="' . __("Click here to refresh the page", wordspew) . '">' . __("Shoutbox archive", wordspew);
        if ($cat != "") {
            echo ' ' . __("Theme:", wordspew) . ' ' . stripslashes($cat);
        }
        echo '</a></h3>
	';
        if ($shout_opt['show_spam'] == '1') {
            $nb = get_option('shoutbox_spam');
            printf(__('<div id="Show_Spam">%s spams blocked</div>', wordspew), $nb);
        }
        echo '</th>
	</tr>
	<tr class="header">
	<th class="date">' . __("Date/Time", wordspew) . '</th>
	<th class="name">' . __("Name", wordspew) . '</th>
	<th class="msg">' . __("Message", wordspew) . '</th>';
        if ($user_level >= $jal_admin_user_level || $curadm == 1) {
            $_SESSION['isAdmin' . $_SESSION['tb_prefix']] = true;
            $link = '<a href="' . $Actual_URL . '/wp-admin/edit.php?page=wordspew_admin' . $link_cat . '" id="shoutboxAdmin">' . __("Admin", wordspew) . '</a>';
            if ($Show_IP) {
                echo '<th class="IP">' . __("IP", wordspew) . '</th>';
            }
            echo '<td></td>';
        } else {
            unset($_SESSION['isAdmin' . $_SESSION['tb_prefix']]);
        }
        echo '
	</tr>				
	';
        if ($results) {
            setlocale(LC_ALL, WPLANG . ".UTF8");
            foreach ($results as $r) {
                $alt = $alt == " alternate" ? "" : " alternate";
                $target = "";
                if (strpos($r->text, $Actual_URL) === false && $XHTML == 0) {
                    $target = ' target="_blank"';
                }
                $theLink = __("link", wordspew);
                $theMail = __("email", wordspew);
                $r->text = preg_replace("`(http|ftp)+(s)?:(//)((\\w|\\.|\\-|_)+)(/)?(\\S+)?`i", "<a rel=\"nofollow\" href=\"\\0\"{$target}>&laquo;{$theLink}&raquo;</a>", $r->text);
                $r->text = preg_replace("`([-_a-z0-9]+(\\.[-_a-z0-9]+)*@[-a-z0-9]+(\\.[-a-z0-9]+)*\\.[a-z]{2,6})`i", "<a href=\"mailto:\\1\">&laquo;{$theMail}&raquo;</a>", $r->text);
                $target = "";
                if ($r->url != "") {
                    if (strpos($r->url, $Actual_URL) === false && $XHTML == 0) {
                        $target = ' target="_blank"';
                    }
                }
                if (!empty($r->url)) {
                    if (strpos($r->url, "@") === false) {
                        $url = '<a rel="nofollow" href="' . $r->url . '"' . $target . '>' . $r->name . '</a>';
                    } else {
                        if ($user_level >= $jal_admin_user_level || $curadm == 1) {
                            $url = $r->name . ' <a href="' . $r->url . '"><img width="16" height="16" 
				src="' . $Actual_URL . '/wp-content/plugins/pierres-wordspew/img/mail.png" alt="' . __("email", wordspew) . '"/></a>';
                        } else {
                            $url = $r->name;
                        }
                    }
                } else {
                    $url = $r->name;
                }
                if (verifyName($r->name)) {
                    $class = "jal_user ";
                }
                $TheName = $r->name;
                $TheMail = $r->email;
                $TheText = $r->text;
                if (substr($TheText, 0, 2) == "@@") {
                    $PosSpace = strpos($TheText, " ");
                    $To = substr($TheText, 2, $PosSpace - 2);
                    $Deb = strlen($To) + 2;
                    $TheText = '<span class="InfoUser">' . __("Private message for", wordspew) . ' ' . $To . ':</span>' . substr($TheText, $Deb) . '';
                    $the_nickname = isset($user_identity) ? $user_identity : str_replace("\\'", "'", $_COOKIE['jalUserName']);
                    if (strtolower($the_nickname) == strtolower($To) || strtolower($the_nickname) == strtolower($TheName) || ($user_level >= $jal_admin_user_level || $curadm == 1)) {
                        $verif = true;
                    } else {
                        $TheName = "";
                        $url = __("Private", wordspew);
                        $TheMail = "";
                        $TheText = '<span class="InfoUser">' . __("Private message", wordspew) . '.</span>';
                        $class = "";
                    }
                }
                $delete = "";
                if ($user_level >= $jal_admin_user_level || $curadm == 1) {
                    $delete .= ' <span onclick="deleteComment(' . $r->id . ',  ' . $offset . ', ' . $limit . ')" class="delShout" title="' . __("Delete", wordspew) . '">x</span>';
                }
                $avatar = "";
                if ($show == '1' && $TheMail != "") {
                    $avatar = shout_get_avatar($TheMail, $size, "left");
                }
                echo '<tr class="bg' . $alt . '" id="comment-new' . $r->id . '"><td class="date">' . strftime("%A %d %B %Y", $r->time) . ' <br/>' . strftime("%H:%M", $r->time) . '</td>
<td class="name">' . $avatar . '<span class="' . $class . sanitize_name($TheName) . '">' . stripslashes($url) . '</span></td>
<td class="msg">' . convert_smilies(stripslashes($TheText)) . '</td>';
                if ($user_level >= $jal_admin_user_level || $curadm == 1) {
                    if ($Show_IP) {
                        echo '
<td class="IP"><a href="http://whois.domaintools.com/' . $r->ipaddr . '" target="_blank" title="Whois">' . $r->ipaddr . '</a></td>';
                    }
                    echo '<td>' . $delete . '</td>';
                }
                echo '
</tr>
		';
                $class = "";
            }
        }
        if (!defined("DB_CHARSET")) {
            @mysql_query("SET CHARACTER SET 'latin1'");
            @mysql_query("SET NAMES latin1");
        }
        ?>

	<tr>
		<td colspan="<?php 
        echo $colspan;
        ?>
">
		<div align="center"><?php 
        echo '<span id="count">' . $total . '</span> ' . __('records', wordspew);
        ?>
</div>
			<div class="navigation">
			<?php 
        if ($offset > 0) {
            echo '<div style="float:left;"><a href="wordspew_archive.php?offset=' . ($offset - $limit) . $link_cat . '">&lt; ' . __("Newer", wordspew) . '</a></div> ';
        }
        if ($offset + $limit < $total) {
            echo '<div style="float:right;" id="older"><a href="wordspew_archive.php?offset=' . ($offset + $limit) . $link_cat . '">' . __("Older", wordspew) . ' &gt;</a></div>';
        }
        ?>

			</div>
		</td>
	</tr>
</table>
<?php 
        echo $link;
        ?>


<?php 
    } else {
        ?>

<p>&nbsp;</p>

<div align="center">
	<?php 
        _e('Sorry, but you don\'t have sufficient rights to see the archives of the shoutbox.', wordspew);
        ?>
<br/>
	<?php 
        printf(__('You can click <a href="%s">here</a> to go back to the homepage of the site.', wordspew), $Actual_URL);
        ?>


</div>
<?php 
    }
}
示例#4
0
function get_assessment_pdf($data)
{
    // Include the main TCPDF library (search for installation path).
    require_once('tcpdf_include.php');

    // create new PDF document
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

    // set document information
    $pdf->SetCreator('MediaGrade');
    $pdf->SetAuthor('Hélin');
    $pdf->SetTitle('Fiche d\'évaluation');

    // remove header and footer
    $pdf->setPrintHeader(false);
    $pdf->setPrintFooter(false);

    $pdf->SetFont('dejavusans', '', 9);
    $pdf->SetDefaultMonospacedFont('dejavusans', '', 8);

    // set margins
    $pdf->SetMargins(15, 15, 15);
    $pdf->SetHeaderMargin(10);
    $pdf->SetFooterMargin(10);

    // set auto page breaks
    $pdf->SetAutoPageBreak(FALSE, PDF_MARGIN_BOTTOM);

    // set image scale factor
    $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

    // set some language-dependent strings (optional)
    if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
	    require_once(dirname(__FILE__).'/lang/eng.php');
	    $pdf->setLanguageArray($l);
    }

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

    // add a page for each student

    foreach ($data as $student)
    {

        $pdf->AddPage();

        // Table with rowspans and THEAD
        $tbl = '
        <h1>' . $_SESSION['last_name'] . '/ Laboratoire d\'audiovisuel / '. $student['project_name'] . '</h1>
        <table width="50%" style="padding:2px;">
	        <tbody >
	        <tr>
		        <td>Nom: '. $student['last_name'] . '</td>
		        <td>Prénom: '. $student['name'] . '</td>
	        </tr>

	        <tr>
	            <td>Classe: <b>'. $student['class'] . '</b></td>
	            <td>Année scolaire: ' . get_school_year() . '</td>

	        </tr>

	        <tr>
		        <td>Date de remise:</td>
		        <td>'. ($student['time'] ? $student['time'] . ' ' : '') . '(Période ' . $student['term'] . ')</td>
	        </tr>
	        </tbody>
        </table>
        ';

        if(file_exists($student['thumbnail']) && substr($student['thumbnail'], -3) === 'jpg')
            $tbl .= '<br /><br /><img src="'. $student['thumbnail'] . '" height="200px" />';

        $tbl .= '<br />
        <h3>Fiche d\'évaluation</h3>';

        $tbl .= '<p>Compétences travaillées: '. $student['skill_id'] .'.</p>
        <style type="text/css">
        .tg  {padding:3px;border-collapse:collapse;border-spacing:0;}
        .tg td{border-style:solid;border-width:1px;}
        .tg th{font-weight: bold;border-style:solid;border-width:1px;}
        .tg .tg-fqys{background-color:#333333;color:#ffffff;vertical-align:top}
        .tg .tg-yw4l{vertical-align:top
        }
        </style>
        <table class="tg">
          <tr>
            <th width="15%" class="tg-fqys">Objectif</th>
            <th width="20%" class="tg-fqys">Critères</th>
            <th width="45%" class="tg-fqys">Indicateurs (l\'élève a:)</th>
            <th width="20%" class="tg-fqys">Résultat</th>
          </tr>';

      $control = $student['results'][0]['objective'];
      $last_grand_total = '';
      $i = 0;

      foreach($student['results'] as $result)
      {

         if($control !== $result['objective'])
         {

            $control = $result['objective'];
            $tbl .= '<tr>
                <td class="tg-yw4l"></td>
                <td class="tg-yw4l"></td>
                <td class="tg-yw4l" style="text-align:right;"><b>Total ' . $control .' : </b></td>
                <td class="tg-yw4l">'. $student['grand_total'][$i]['user_total'] . '/' . $student['grand_total'][$i]['grand_total'] . '</td>
                </tr>';
                $i++;
         }

         $tbl .= '<tr>
        <td class="tg-yw4l">'. $result['objective'] . '</td>
        <td class="tg-yw4l">'. $result['criteria'] . '</td>
        <td class="tg-yw4l">'. $result['cursor'] . '<br /></td>
        <td class="tg-yw4l">'. $result['result'] . ' (' . $result['acquis'] . ')</td>
        </tr>';

        $last_grand_total = $student['grand_total'][$i]['grand_total'] ;
        $last_user_total = $student['grand_total'][$i]['user_total'] ;
      }

      // add last grand total
      $tbl .= '<tr>
                <td class="tg-yw4l"></td>
                <td class="tg-yw4l"></td>
                <td class="tg-yw4l" style="text-align:right;"><b>Total ' . $control .' : </b></td>
                <td class="tg-yw4l">'. $last_user_total . '/' . $last_grand_total .'</td>
                </tr>';

      $tbl .= '</table>';

      if($student['self_assessment'])
      {
          $tbl .= '<h3>Auto-évaluation</h3>';

          foreach ($student['self_assessment'] as $row)
          {
              $tbl .= '
                <b>' . $row['question'] . '</b>
                <p><pre>"' . $row['answer'] . '"</pre></p>';
          }
      }
      if($student['comment'])
      {
           $tbl .=  '<h3>Commentaires du professeur</h3>

                <p><pre>' . $student['comment'] . '</pre></p>';
      }
        $pdf->writeHTML($tbl, false, false, false, false, '');
    }

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

    //Close and output PDF document
    $filename = sanitize_name(get_school_year() . '_' .  $data[0]['term'] . '_' . $data[0]['class'] . '_' . $data[0]['project_name']);
    $pdf->Output($filename . '.pdf', 'I');

}
示例#5
0
function jal_shoutbox_admin()
{
    global $wpdb, $user_level, $nb, $jal_version, $wp_roles, $wp_version, $shout_opt, $shout_cat, $shout_tb;
    $jal_admin_user_level = get_option('shoutbox_admin_level') != "" ? get_option('shoutbox_admin_level') : 10;
    get_currentuserinfo();
    // Gets logged in user.
    $level_for_archive = $shout_opt['level_for_archive'];
    $show_to_level = $shout_opt['level_for_shoutbox'];
    $level_for_theme = $shout_opt['level_for_theme'];
    $jal_number_of_comments = get_option('shoutbox_nb_comment');
    $nb = get_option('shoutbox_spam');
    $current = current_user_can('level_' . $jal_admin_user_level);
    // If user is not allowed to use the admin page
    if ($user_level < $jal_admin_user_level && $current != 1) {
        echo '<div class="wrap"><h2>' . __("No Access for you!", wordspew) . '</h2></div>';
    } else {
        $_SESSION['isAdmin' . $shout_tb] = true;
        if (isset($_POST['jal_truncate'])) {
            $what = stripslashes($_POST['cat']);
            $what = $what != "" ? $what : __("Miscellaneous", wordspew);
            $what = '"' . $what . '"';
            ?>
		<div class="updated"><p><?php 
            printf(__("The content of the shoutbox %s has been wiped.", wordspew), $what);
            ?>
</p></div>
<?php 
        }
        ?>
<div class="wrap">
	<h2><?php 
        _e('Live Shoutbox', wordspew);
        ?>
 v. <?php 
        echo $jal_version;
        ?>
	<?php 
        printf(__('(Actually <font color="red">%s</font> spams blocked)', wordspew), $nb);
        ?>
</h2>
	<p><?php 
        _e('When you update the Times and Colors, you may need to refresh/empty cache before you see the changes take effect', wordspew);
        ?>
</p>
	<p><?php 
        $results = $wpdb->get_var("SELECT id FROM " . $shout_tb . "liveshoutbox ORDER BY id DESC LIMIT 1");
        if ($results) {
            printf(__('There have been <b>%s</b> messages in this shoutbox', wordspew), $results);
        }
        ?>
&nbsp;</p>
	<form name="shoutbox_options" action="edit.php?page=wordspew_admin" method="post" id="shoutbox_options"> 
	<fieldset>
	<legend><b><?php 
        _e('Colors (Must be 6 digit hex)', wordspew);
        ?>
</b></legend>
	<div class="UserOption">
	<input type="hidden" name="page" value="wordspew_admin" />
	<?php 
        _e('Fade from', wordspew);
        ?>
: #<input type="text" maxlength="6" name="fade_from" value="<?php 
        echo $shout_opt['fade_from'];
        ?>
" 
	size="6" onchange="ChangeColor('fadefrom',this.value)" onkeyup="ChangeColor('fadefrom',this.value)"/>
	<span id="fadefrom" style="background:#<?php 
        echo $shout_opt['fade_from'];
        ?>
;">&nbsp;</span>
	<div class="SousRub"><?php 
        _e('The color that new messages fade in from. Default', wordspew);
        ?>
: 
	<span style="background:#666;color:#fff;">666666</span></div>

	<?php 
        _e('Fade to', wordspew);
        ?>
: #<input type="text" maxlength="6" name="fade_to" value="<?php 
        echo $shout_opt['fade_to'];
        ?>
" 
	size="6" onchange="ChangeColor('fadeto',this.value)" onkeyup="ChangeColor('fadeto',this.value)"/> 
	<span id="fadeto" style="background:#<?php 
        echo $shout_opt['fade_to'];
        ?>
;">&nbsp;</span>
	<div class="SousRub"><?php 
        _e('Also used as the background color of the box. Default', wordspew);
        ?>
	<span style="background:#fff;color:#000;">FFFFFF</span></div>

	<?php 
        _e('Text Color', wordspew);
        ?>
: #<input type="text" maxlength="6" name="text_color" value="<?php 
        echo $shout_opt['text_color'];
        ?>
" 
	size="6" onchange="ChangeColor('textcolor',this.value)" onkeyup="ChangeColor('textcolor',this.value)"/> 
	<span id="textcolor" style="background:#<?php 
        echo $shout_opt['text_color'];
        ?>
;">&nbsp;</span>
	<div class="SousRub"><?php 
        _e('The color of text within the box. Default', wordspew);
        ?>
: 
	<span style="background:#333;color:#fff;">333333</span></div>

	<?php 
        _e('Name Color', wordspew);
        ?>
: #<input type="text" maxlength="6" name="name_color" value="<?php 
        echo $shout_opt['name_color'];
        ?>
" 
	size="6" onchange="ChangeColor('namecolor',this.value)" onkeyup="ChangeColor('namecolor',this.value)"/> 
	<span id="namecolor" style="background:#<?php 
        echo $shout_opt['name_color'];
        ?>
;">&nbsp;</span>
	<div class="SousRub"><?php 
        _e('The color of peoples\' names. Default', wordspew);
        ?>
: 
	<span style="background:#06c;color:#fff;">0066CC</span></div>
	</div>
	</fieldset>
	<br />

	<fieldset>
	<legend><b><?php 
        _e('Others', wordspew);
        ?>
</b></legend>
	<div class="UserOption">
	<?php 
        _e('Show', wordspew);
        ?>
:<input type="text" maxlength="3" name="nb_comment" value="<?php 
        echo $jal_number_of_comments;
        ?>
" 
	size="2" /> <?php 
        _e('comments in the shoutbox', wordspew);
        ?>
<br />
	<div class="SousRub"><?php 
        _e('Enter, here, the number of shouts you want to show in your shoutbox', wordspew);
        ?>
</div>
	<?php 
        _e('Update Every', wordspew);
        ?>
: <input type="text" maxlength="3" name="update_seconds" 
	value="<?php 
        echo $shout_opt['update_seconds'] / 1000;
        ?>
" size="2" /> <?php 
        _e('Seconds', wordspew);
        ?>
<br />
	<div class="SousRub"><?php 
        _e('This determines how "live" the shoutbox is. With a bigger number, it will take more time for messages to show up, but also decrease the server load. You may use decimals. This number is used as the base for the first 8 javascript loads. After that, the number gets successively bigger. Adding a new comment or mousing over the shoutbox will reset the interval to the number suplied above. Default: 4 Seconds', wordspew);
        ?>
</div>
	<?php 
        _e('Fade Length', wordspew);
        ?>
: <input type="text" maxlength="3" name="fade_length" 
	value="<?php 
        echo $shout_opt['fade_length'] / 1000;
        ?>
" size="2" /> <?php 
        _e('Seconds', wordspew);
        ?>
<br />
	<div class="SousRub"><?php 
        _e('The amount of time it takes for the fader to completely blend with the background color. You may use decimals. Default 1.5 seconds', wordspew);
        ?>
</div>
	<?php 
        _e('Use textarea', wordspew);
        ?>
: <input type="checkbox" name="use_textarea"<?php 
        if ($shout_opt['use_textarea'] == '1') {
            echo ' checked="checked" ';
        }
        ?>
/>
	<div class="SousRub"><?php 
        _e('A textarea is a bigger type of input box. Users will have more room to type their comments, but it will take up more space.', wordspew);
        ?>
</div>
	<?php 
        _e('Use URL field', wordspew);
        ?>
: <input type="checkbox" name="use_url"<?php 
        if ($shout_opt['use_url'] == '1') {
            echo ' checked="checked" ';
        }
        ?>
/>
	<div class="SousRub"><?php 
        _e('Check this if you want users to have an option to add their URL when submitting a message.', wordspew);
        ?>
</div>
	<?php 
        _e('Use sound alert', wordspew);
        ?>
: <input type="checkbox" name="use_sound"<?php 
        if ($shout_opt['use_sound'] == '1') {
            echo ' checked="checked" ';
        }
        ?>
/>
	<div class="SousRub"><?php 
        _e('Check this if you want to hear a sound alert when someone post message', wordspew);
        ?>
</div>
	<?php 
        _e('Show smileys list', wordspew);
        ?>
: <input type="checkbox" name="Show_Smiley"<?php 
        if ($shout_opt['show_smiley'] == '1') {
            echo ' checked="checked" ';
        }
        ?>
/>
	<div class="SousRub"><?php 
        _e('Check this if you want to show the smileys list', wordspew);
        ?>
</div>	
	<?php 
        _e('Show blocked spams', wordspew);
        ?>
: <input type="checkbox" name="Show_Spam"<?php 
        if ($shout_opt['show_spam'] == '1') {
            echo ' checked="checked" ';
        }
        ?>
/>
	<div class="SousRub"><?php 
        _e('Check this if you want to show blocked spams', wordspew);
        ?>
</div>
	<?php 
        _e('Use a captcha', wordspew);
        ?>
: <input type="checkbox" name="Captcha"<?php 
        if ($shout_opt['use_captcha'] == '1') {
            echo ' checked="checked" ';
        }
        ?>
/>
	<div class="SousRub"><?php 
        _e('Check this if you want to use a captcha (in fact it\'s a simple addition that users have to resolve before post any new message in the shoutbox).', wordspew);
        ?>
</div>
	<?php 
        _e('Use Themes', wordspew);
        ?>
: <input type="checkbox" name="Use_Theme" id="Use_Theme" onClick="disable_enable('Use_Theme', 'Show_themes_to', true);"<?php 
        if ($shout_opt['use_theme'] == '1') {
            echo ' checked="checked" ';
        }
        ?>
/>
	<div class="SousRub"><?php 
        _e('Check this if you want to use themes.', wordspew);
        ?>
</div>
	<?php 
        _e('Use the RSS feed', wordspew);
        ?>
: <input type="checkbox" name="Use_RSS"<?php 
        if ($shout_opt['use_rss'] == '1') {
            echo ' checked="checked" ';
        }
        ?>
/>
	<div class="SousRub"><?php 
        _e('Check this if you want that users can show and/or use the RSS feed of the shoutbox.', wordspew);
        ?>
</div>	
	<?php 
        _e('XHTML strict', wordspew);
        ?>
: <input type="checkbox" name="XHTML"<?php 
        if ($shout_opt['xhtml'] == '1') {
            echo ' checked="checked" ';
        }
        ?>
/>
	<div class="SousRub"><?php 
        _e('Check this if you want to use XHTML strict', wordspew);
        ?>
</div>
	<b><?php 
        _e('Use spam filters', wordspew);
        ?>
</b>: <input type="checkbox" id="Use_Filters" name="Use_Filters" 
	<?php 
        if ($shout_opt['use_filters'] == '1' || !isset($shout_opt['use_filters'])) {
            echo ' checked="checked" ';
        }
        ?>
/>
	<div class="SousRub"><?php 
        _e('Check this if you want to use filters against spams', wordspew);
        ?>
</div>

	<?php 
        _e('Use the shoutbox only on:', wordspew);
        ?>
 <input type="text" name="where" value="<?php 
        echo $shout_opt['where'];
        ?>
" style="width: 600px;"/>
	<div class="SousRub"><?php 
        _e('If you want to use the shoutbox only on some pages, enter here their titles (each entry have to be separated by a comma) otherwise or if you don\'t understand its usage, let this field empty.', wordspew);
        ?>
<br/><?php 
        _e('An other possibilities, is to show the shoutbox <b>only on particulars sections</b>. You can use this values:', wordspew);
        ?>
	<b>@homepage, @frontpage, @pages, @single, @archives, @category</b>.
	<br/><?php 
        _e('And last but not least, you can use 2 kinds of values to be more specific.', wordspew);
        ?>
 <b>(linked), (rubric)</b>.
	<br/><?php 
        _e('If you use the term:', wordspew);
        ?>
 @pages(rubric) <?php 
        _e('It meens that you want to use the same specific shoutbox for <b>ALL</b> pages.', wordspew);
        ?>
	<br/><?php 
        _e('If you use the term:', wordspew);
        ?>
 @pages(linked) <?php 
        _e('It meens that you want to use a specific shoutbox on <b>EACH</b> page.', wordspew);
        ?>
	<br/><?php 
        _e('You can use these 2 keywords with :', wordspew);
        ?>
 <b>@pages, @single, @archives</b> (<?php 
        printf(__('only %s, here', wordspew), 'rubric');
        ?>
), <b>@category</b>.
	<br/><?php 
        _e('Finally, if you want to use the shoutbox in a page template you\'ve done by yourself, enter : ', wordspew);
        ?>
 @page[<?php 
        _e('The name of your page', wordspew);
        ?>
].
	</div>
	</div>
	</fieldset>
	<br />

	<fieldset>
	<legend><b><?php 
        _e('Users options', wordspew);
        ?>
</b></legend>
	<div class="UserOption">

	<?php 
        if (current_user_can('level_10')) {
            ?>
	<font color="red"><?php 
            _e('<b>Who can administrate the shoutbox</b>', wordspew);
            ?>
:</font>
	<select name="admin_user_level">
	<?php 
            // Piece of code from "Role Manager" plugin for role and level part. Thanks to -> Thomas Schneider : http://www.im-web-gefunden.de/wordpress-plugins/role-manager/
            $array_admin = array();
            foreach ($wp_roles->role_names as $roledex => $rolename) {
                $role = $wp_roles->get_role($roledex);
                $role_user_level = array_reduce(array_keys($role->capabilities), array('WP_User', 'level_reduction'), 0);
                if (!in_array($role_user_level, $array_admin)) {
                    array_push($array_admin, $role_user_level);
                    if ($role_user_level > 0) {
                        $selected = $jal_admin_user_level == $role_user_level ? ' selected="true"' : '';
                        echo '<option value="' . $role_user_level . '"' . $selected . '>' . $rolename . " (" . __("level", wordspew) . " " . $role_user_level . ')</option>
				';
                    }
                }
            }
            ?>
	</select>
	<div class="SousRub"><?php 
            _e('Choose the level required to administrate the shoutbox', wordspew);
            ?>
. <?php 
            printf(__('<a href="%s"><b>Click here</b></a> if you need more information on Roles and Capabilities.', wordspew), "http://codex.wordpress.org/Roles_and_Capabilities");
            ?>
</div>
	<?php 
        }
        ?>
	
	<?php 
        if (current_user_can('level_' . $jal_admin_user_level)) {
            _e('Who can <b>see the shoutbox</b>', wordspew);
            ?>
: <select id="level_for_shoutbox" name="level_for_shoutbox" 
	onchange="disable_enable('level_for_shoutbox', 'registered_only', false);">
	<?php 
            if ($wp_roles) {
                $array_box = array();
                foreach ($wp_roles->role_names as $roledex => $rolename) {
                    $role = $wp_roles->get_role($roledex);
                    $role_user_level = array_reduce(array_keys($role->capabilities), array('WP_User', 'level_reduction'), 0);
                    if (!in_array($role_user_level, $array_box)) {
                        array_push($array_box, $role_user_level);
                        $selected = $show_to_level == $role_user_level ? ' selected="true"' : '';
                        echo '<option value="' . $role_user_level . '"' . $selected . '>' . $rolename . ' (' . __("level", wordspew) . ' ' . $role_user_level . ')</option>
	';
                    }
                }
                $selected = $show_to_level == -1 ? ' selected="true"' : '';
                echo '<option value="-1"' . $selected . '>' . __("Everybody", wordspew) . '</option>';
            }
            ?>
	</select>
	<div class="SousRub"><?php 
            _e('Choose, here, users able to <strong>see and post</strong> in your shoutbox. Other users will simply view nothing :)', wordspew);
            ?>
	<div style="color:red;" id="Info"><?php 
            _e('<b>Note:</b> You have choose to show the shoutbox only to :', wordspew);
            ?>
	<span id="From_List" style="font-weight:bold"><noscript><?php 
            _e('Please activate Javascript...', wordspew);
            ?>
</noscript></span>
	<?php 
            _e('in the list above,<br/>it will take precedence over the next option', wordspew);
            ?>
 (<em><?php 
            _e('Who can <b>see the shoutbox archives</b>', wordspew);
            ?>
</em>).</div>
	</div>
	
	<?php 
            _e('Who can <b>use the shoutbox</b>', wordspew);
            ?>
: <select id="registered_only" name="registered_only">
	<?php 
            if ($wp_roles) {
                $array_box = array();
                foreach ($wp_roles->role_names as $roledex => $rolename) {
                    $role = $wp_roles->get_role($roledex);
                    $role_user_level = array_reduce(array_keys($role->capabilities), array('WP_User', 'level_reduction'), 0);
                    if (!in_array($role_user_level, $array_box)) {
                        array_push($array_box, $role_user_level);
                        $selected = $shout_opt['registered_only'] == $role_user_level ? ' selected="true"' : '';
                        echo '<option value="' . $role_user_level . '"' . $selected . '>' . $rolename . ' (' . __("level", wordspew) . ' ' . $role_user_level . ')</option>
	';
                    }
                }
                $selected = $shout_opt['registered_only'] == -1 ? ' selected="true"' : '';
                echo '<option value="-1"' . $selected . '>' . __("Everybody", wordspew) . '</option>';
            }
            ?>
	</select>
	<div class="SousRub"><?php 
            _e('Choose, here, users able to <strong>post messages</strong> in your shoutbox. Other users will simply view the discussion.', wordspew);
            ?>
</div>

	<?php 
            _e('Who can <b>see the shoutbox archives</b>', wordspew);
            ?>
: 
	<select id="Show_archive_to" name="Show_archive_to" onchange="disable_enable('level_for_shoutbox', 'registered_only', false);">
	<?php 
            if ($wp_roles) {
                $array_arch = array();
                foreach ($wp_roles->role_names as $roledex => $rolename) {
                    $role = $wp_roles->get_role($roledex);
                    $role_user_level = array_reduce(array_keys($role->capabilities), array('WP_User', 'level_reduction'), 0);
                    if (!in_array($role_user_level, $array_arch)) {
                        array_push($array_arch, $role_user_level);
                        $selected = $level_for_archive == $role_user_level ? ' selected="true"' : '';
                        echo '<option value="' . $role_user_level . '"' . $selected . '>' . $rolename . ' (' . __("level", wordspew) . ' ' . $role_user_level . ')</option>
	';
                    }
                }
                $selected = $level_for_archive == -1 ? ' selected="true"' : '';
                echo '<option value="-1"' . $selected . '>' . __("Everybody", wordspew) . '</option>';
            }
            ?>
	</select>
	<div class="SousRub"><?php 
            _e('Choose who is able to see archive of the shoutbox', wordspew);
            ?>
.</div>
	
	<?php 
            _e('Who can see the differents themes', wordspew);
            ?>
: 
	<select id="Show_themes_to" name="Show_themes_to">
	<?php 
            if ($wp_roles) {
                $array_arch = array();
                foreach ($wp_roles->role_names as $roledex => $rolename) {
                    $role = $wp_roles->get_role($roledex);
                    $role_user_level = array_reduce(array_keys($role->capabilities), array('WP_User', 'level_reduction'), 0);
                    if (!in_array($role_user_level, $array_arch)) {
                        array_push($array_arch, $role_user_level);
                        $selected = $level_for_theme == $role_user_level ? ' selected="true"' : '';
                        echo '<option value="' . $role_user_level . '"' . $selected . '>' . $rolename . ' (' . __("level", wordspew) . ' ' . $role_user_level . ')</option>
	';
                    }
                }
                $selected = $level_for_theme == -1 ? ' selected="true"' : '';
                echo '<option value="-1"' . $selected . '>' . __("Everybody", wordspew) . '</option>';
            }
            ?>
	</select>
	<div class="SousRub"><?php 
            _e('Choose who is able to see the differents themes of your shoutbox', wordspew);
            ?>
.</div>

<?php 
        }
        ?>

	<hr/>
	
	<?php 
        _e('Show users online', wordspew);
        ?>
: <input type="checkbox" id="Show_Users" name="Show_Users" 
	onClick="disable_enable('Show_Users', 'HideUsers', true);"<?php 
        if ($shout_opt['show_user_online'] == '1') {
            echo ' checked="checked" ';
        }
        ?>
/>
	<div class="SousRub"><?php 
        _e('Check this if you want to show, in real time, users online', wordspew);
        ?>
</div>

	<blockquote>
	<?php 
        _e('Users to hide', wordspew);
        ?>
: <input type="text" id="HideUsers" name="HideUsers" 
	value="<?php 
        echo stripslashes($shout_opt['hidden_users']);
        ?>
" size="30" />
	<div class="SousRub"><?php 
        _e('Place here, separated by comma, users that you want to hide from the "Users online" function of the shoutbox.', wordspew);
        ?>
</div>
	</blockquote>

	<?php 
        _e('Use avatars', wordspew);
        ?>
: <input type="checkbox" name="Use_Avatar"<?php 
        if ($shout_opt['show_avatar'] == '1') {
            echo ' checked="checked" ';
        }
        ?>
/>
	<div class="SousRub"><?php 
        _e('If checked, avatar will be shown.', wordspew);
        ?>
</div>
	<?php 
        _e('Avatar size', wordspew);
        ?>
: <input type="text" maxlength="2" name="Avatar_size" 
	value="<?php 
        echo $shout_opt['avatar_size'];
        ?>
" size="2" /> px<br />
	<div class="SousRub"><?php 
        _e('Choose the size for the avatars. Valid values are from 1 to 80 inclusive. Any size other than 80 will cause the original Gravatar image to be downsampled using bicubic resampling before output', wordspew);
        ?>
</div>
	<?php 
        $position = $shout_opt['avatar_position'];
        _e('Avatar position', wordspew);
        ?>
: 
	<select name="Avatar_position">
	<option value="left"<?php 
        if ($position == "left") {
            echo ' selected="true"';
        }
        ?>
><?php 
        _e('Left', wordspew);
        ?>
</option>
	<option value="right"<?php 
        if ($position == "right") {
            echo ' selected="true"';
        }
        ?>
><?php 
        _e('Right', wordspew);
        ?>
</option>	
	</select>
	<div class="SousRub"><?php 
        _e('Choose the alignement for avatars (left or right)', wordspew);
        ?>
</div>

	</div>
	</fieldset><br />

	<input type="submit" name="jal_admin_options" value="<?php 
        _e('Save', wordspew);
        ?>
" class="button" id="jal_admin_options"/><br/><br/>
	<input type="submit" name="jal_truncate" value="<?php 
        _e('Delete ALL messages', wordspew);
        ?>
" class="button" id="jal_truncate_all" onclick="return confirm('<?php 
        printf(__("You are about to delete ALL messages from : %s in the shoutbox.\\nAre you sure you want to do this?\\n\\'Cancel\\' to stop, \\'OK\\' to delete.", wordspew), "&quot;'+document.getElementById('theme').innerHTML+'&quot;");
        ?>
');"/>
	<input type="submit" name="jal_truncate_archive" value="<?php 
        _e('Delete ALL ARCHIVED messages', wordspew);
        ?>
" class="button" id="jal_truncate_all_archive" onclick="return confirm('<?php 
        printf(__("You are about to delete ALL ARCHIVED messages from : %s.\\nAre you sure you want to do this?\\n\\'Cancel\\' to stop, \\'OK\\' to delete.", wordspew), "&quot;'+document.getElementById('theme').innerHTML+'&quot;");
        ?>
');"/>
	<input type="submit" name="jal_shout_archive" value="<?php 
        _e('Archive THEN Delete ALL messages', wordspew);
        ?>
" class="button" id="jal_shout_archive" onclick="return confirm('<?php 
        printf(__("You are about to archive THEN delete ALL messages from : %s.\\nAre you sure you want to do this?\\n\\'Cancel\\' to stop, \\'OK\\' to delete.", wordspew), "&quot;'+document.getElementById('theme').innerHTML+'&quot;");
        ?>
');"/><br/><br/>

	<input type="hidden" name="cat" id="cat" value="<?php 
        echo stripslashes($shout_cat);
        ?>
"/>
	</form>
	<fieldset>

	<?php 
        if (current_user_can('manage_options')) {
            ?>
	<p><?php 
            printf(__('<a href="%s"><b>Click here</b></a> to manage your banned words list and IP addresses.', wordspew), get_bloginfo('wpurl') . "/wp-admin/options-discussion.php#moderation_keys");
            ?>
</p>
	<p><?php 
            _e('<b><font color="red">Important !</font></b> To ban a single IP address just click on "Ban this IP" button. If you want to ban a range of IP, use this syntax (for this example i can say good bye to Vsevolod Stetsinsky) : 195.225.176/179.* where slash means from 176 to 179 and * from 0 to 255.<br/>BTW i ban IP addresses from 195.225.176.0 to 195.225.179.255. You can mix the two options...', wordspew);
            ?>
</p>
	<?php 
        }
        ?>

	<?php 
        @mysql_query("SET CHARACTER SET 'utf8'");
        @mysql_query("SET NAMES utf8");
        $SQLCat = html_entity_decode($shout_cat, ENT_COMPAT, 'UTF-8');
        $SQL = "SELECT * FROM " . $shout_tb . "liveshoutbox WHERE cat='" . mysql_real_escape_string($SQLCat) . "' ORDER BY id DESC LIMIT " . $jal_number_of_comments;
        $results = $wpdb->get_results($SQL);
        $jal_first_time = true;
        // Will only add the last message div if it is looping for the first time
        echo '<form action="edit.php?page=wordspew_admin" method="get">
	';
        echo '<b>' . __("Theme:", wordspew) . '</b>';
        $SQL = "SELECT DISTINCT cat FROM " . $shout_tb . "liveshoutbox ORDER BY cat";
        $theme = $wpdb->get_results($SQL);
        foreach ($theme as $theme_name) {
            if ($theme_name->cat == "") {
                echo ' <a class="shout" onclick="CleanBox(\'\',\'' . __("Miscellaneous", wordspew) . '\');"><b>' . __("Miscellaneous", wordspew) . '</b></a>,';
            } else {
                echo ' <a class="shout" onclick="CleanBox(\'' . $theme_name->cat . '\',\'' . str_replace(" ", " ", $theme_name->cat) . '\');">' . stripslashes($theme_name->cat) . '</a>,';
            }
        }
        $the_cat = $shout_cat == "" ? __("Miscellaneous", wordspew) : str_replace(" ", " ", stripslashes($shout_cat));
        $SQL = "SELECT DISTINCT cat FROM " . $shout_tb . "liveshoutboxarchive ORDER BY cat";
        $theme = $wpdb->get_results($SQL);
        $first_time = 0;
        echo "<br/><b>" . __("Archive:", wordspew) . "</b>";
        foreach ($theme as $theme_name) {
            if ($theme_name->cat == "") {
                echo ' <a class="archive" onclick="CountAndGo(\'\',\'' . __("Miscellaneous", wordspew) . '\');"><b>' . __("Miscellaneous", wordspew) . '</b></a>, ';
            } else {
                echo ' <a class="archive" onclick="CountAndGo(\'' . $theme_name->cat . '\',\'' . str_replace(" ", " ", $theme_name->cat) . '\');">' . stripslashes($theme_name->cat) . '</a>,';
            }
            $first_time += 1;
        }
        if ($first_time >= 1) {
            echo "<br/>" . __("<b>Information:</b> The first click on the desired shoutbox category will select it (if you want to empty its content for example), the second will let you browse to the archive page selected.", wordspew);
        }
        printf(__('<div id="lastMessage"><span>Last Message</span><br/><div id="responseTime">%s</div>&nbsp;ago</div>', wordspew), jal_time_since($_SESSION['Chrono']));
        $class_id = isset($_SERVER['HTTP_REFERER']) ? strpos($_SERVER['HTTP_REFERER'], "wordspew_archive.php") ? "archive" : "shout" : "shout";
        echo '<p id="usersOnline">' . jal_get_useronline_extended() . '</p>
	<div id="theme" class="' . $class_id . '">' . $the_cat . '</div>
	<hr/>

	<div align="right" id="chatoutput">
	<ul id="outputList" style="white-space: nowrap;">';
        foreach ($results as $r) {
            // Loops the messages into a list
            $class = "";
            if (verifyName($r->name)) {
                $class = "jal_user ";
            }
            $url = empty($r->url) ? $r->name : '<a href="' . $r->url . '" target="_blank">' . $r->name . '</a>';
            if ($jal_first_time) {
                $lastID = $r->id;
            }
            echo '<li id="comment-new' . $r->id . '">

	<span title="' . jal_time_since($r->time) . '" class="' . $class . sanitize_name($r->name) . '" id="user_' . $r->id . '">' . stripslashes($url) . ' : </span>
	<a href="http://whois.domaintools.com/' . $r->ipaddr . '" target="_blank" title="Whois">*</a>
	<input type="text" name="jal_text" id="text_' . $r->id . '" value="' . htmlspecialchars(stripslashes($r->text), ENT_QUOTES) . '" size="60"/>';
            if (current_user_can('manage_options')) {
                echo '
		<input type="text" name="ip" id="ip_' . $r->id . '" value="' . $r->ipaddr . '" size="14"/>
		<input type="button" name="jal_ban" value="' . __("Ban this IP", wordspew) . '" onclick="BanIP(' . $r->id . ',\'' . $r->ipaddr . '\')"/>';
            } else {
                echo '<input type="hidden" name="ip" id="ip_' . $r->id . '" value="' . $r->ipaddr . '"/>';
            }
            echo '
	<input type="button" name="jal_delete" value="' . __("Delete", wordspew) . '" onclick="deleteComment(' . $r->id . ')"/>
	<input type="button" name="jal_edit" value="' . __("Edit", wordspew) . '" onclick="EditComment(' . $r->id . ')"/></li>
	';
            $jal_first_time = false;
        }
        if (!$results) {
            echo '<li>&nbsp;</li>';
        }
        ?>
	</ul></div>
	<input type="hidden" id="jal_lastID" value="<?php 
        echo $lastID + 1;
        ?>
" name="jal_lastID"/>
	</form>
	</fieldset>
	</div>
<?php 
    }
}
示例#6
0
 public function __construct($name, $size)
 {
     $this->name = sanitize_name($name);
     $this->initial_size = check_size($size);
     $this->current_size = $this->initial_size;
 }
示例#7
0
function jal_get_shoutbox($cat = "", $comboTheme = 1)
{
    global $wpdb, $user_level, $user_identity, $user_url, $user_ID, $jal_admin_user_level, $show, $size, $position, $shout_opt, $shout_tb;
    $HiddenCat = "";
    $show_to_level = $shout_opt['level_for_shoutbox'];
    $level_for_archive = $shout_opt['level_for_archive'];
    $level_for_archive = $level_for_archive == -1 ? 1 : current_user_can('level_' . $level_for_archive);
    $level_for_theme = $shout_opt['level_for_theme'];
    $user_level = isset($user_level) ? $user_level : -1;
    $current = $show_to_level == -1 ? 1 : current_user_can('level_' . $show_to_level);
    $curthe = $level_for_theme == -1 ? 1 : current_user_can('level_' . $level_for_theme);
    $only_registered = $shout_opt['registered_only'];
    $only_registered = $only_registered == -1 ? 1 : current_user_can('level_' . $only_registered);
    $curadmin = current_user_can('level_' . $jal_admin_user_level);
    $use_theme = $shout_opt['use_theme'];
    $lastID = 0;
    if ($cat != "") {
        $HiddenCat = $cat;
    }
    if ($current == 1) {
        if ($cat == "") {
            if ($curthe == 1 && $use_theme == 1) {
                $HiddenCat = $cat = str_replace("\\", "", $_COOKIE['jalCombo']);
            }
        }
        $XHTML = $shout_opt['xhtml'];
        $Captcha = $shout_opt['use_captcha'];
        $jal_number_of_comments = get_option('shoutbox_nb_comment');
        $Actual_URL = get_bloginfo('wpurl');
        $_SESSION['Show_Users'] = $shout_opt['show_user_online'];
        $_SESSION['BadCalc'] = __("You should learn to count before use the shoutbox :)", wordspew);
        $_SESSION['DLSpam'] = __("I DON'T LIKE SPAM !!!", wordspew);
        $_SESSION['HTTPLimit'] = __("Sorry, but you can post only one url by message...", wordspew);
        $_SESSION['IPLogged'] = __("Your IP address have been banned from this blog, if you feel this is in error please contact the webmaster.", wordspew);
        $_SESSION['hashtext' . $shout_tb] = $shout_opt['hash'];
        $_SESSION['useURL'] = $shout_opt['use_url'];
        $_SESSION['useCaptcha'] = $Captcha;
        ?>
<div id="wordspew">
	<div id="chatoutput">
	<?php 
        @mysql_query("SET CHARACTER SET 'utf8'");
        @mysql_query("SET NAMES utf8");
        $wpdb->hide_errors();
        $SQLCat = html_entity_decode($cat, ENT_COMPAT, 'UTF-8');
        $SQLCat = str_replace("'", "\\'", $SQLCat);
        $SQL = "SELECT * FROM " . mysql_real_escape_string($shout_tb) . "liveshoutbox WHERE cat='" . mysql_real_escape_string($SQLCat) . "'";
        $SQL .= " ORDER BY id DESC LIMIT " . $jal_number_of_comments;
        $results = $wpdb->get_results($SQL);
        $wpdb->show_errors();
        // Will only add the last message div if it is looping for the first time
        $jal_first_time = true;
        $registered_only = $only_registered ? false : true;
        $rand1 = mt_rand(0, 10);
        $rand2 = mt_rand(0, 10);
        $total = intval($rand1 + $rand2);
        if ($shout_opt['use_sound'] == 1) {
            $img_sound = !isset($_COOKIE['jalSound' . $shout_tb]) || $_COOKIE['jalSound' . $shout_tb] == 1 || $_COOKIE['jalSound' . $shout_tb] == "" ? "sound_1.gif" : "sound_0.gif";
            echo '<img src="' . $Actual_URL . '/wp-content/plugins/pierres-wordspew/img/' . $img_sound . '" alt="" onclick="setSound();" id="JalSound" title="' . __("Click this to turn on/off sound", wordspew) . '"/>';
        }
        if ($shout_opt['show_spam'] == 1) {
            $nb = get_option('shoutbox_spam');
            printf(__('<div id="Show_Spam">%s spams blocked</div>', wordspew), $nb);
        }
        // Loops the messages into a list
        foreach ($results as $r) {
            if ($jal_first_time) {
                $_SESSION['Chrono'] = $r->time;
                printf(__('<div id="lastMessage"><span>Last Message</span><br/><div id="responseTime">%s</div>&nbsp;ago</div>', wordspew), jal_time_since($r->time));
                echo '<div id="usersOnline">' . jal_get_useronline_extended() . '</div>
		<ul id="outputList">';
            }
            $target = "";
            // Add links
            if (strpos($r->text, $Actual_URL) === false && $XHTML == 0) {
                $target = ' target="_blank"';
            }
            $theLink = __("link", wordspew);
            $theMail = __("email", wordspew);
            $r->text = preg_replace("`(http|ftp)+(s)?:(//)((\\w|\\.|\\-|_)+)(/)?(\\S+)?`i", "<a rel=\"nofollow\" href=\"\\0\"{$target}>&laquo;{$theLink}&raquo;</a>", $r->text);
            $r->text = preg_replace("`([-_a-z0-9]+(\\.[-_a-z0-9]+)*@[-a-z0-9]+(\\.[-a-z0-9]+)*\\.[a-z]{2,6})`i", "<a href=\"mailto:\\1\">&laquo;{$theMail}&raquo;</a>", $r->text);
            if ($jal_first_time) {
                $lastID = $r->id;
            }
            $target = "";
            if ($r->url != "") {
                if (strpos($r->url, $Actual_URL) === false && $XHTML == 0) {
                    $target = ' target="_blank"';
                }
            }
            $url = empty($r->url) ? $r->name : '<a rel="nofollow" href="' . $r->url . '"' . $target . '>' . $r->name . '</a>';
            if ($jal_first_time && !isset($_COOKIE['jalCaptcha']) && !$user_ID && !$registered_only && $_SESSION['useCaptcha'] == '1') {
                echo '<li><span>' . __("Info", wordspew) . ' : </span><b>' . __("Please, resolve the addition below before post any new comment...", wordspew) . '</b></li>';
            }
            $TheText = $r->text;
            $verif = true;
            if (substr($TheText, 0, 2) == "@@") {
                $verif = false;
                $PosSpace = strpos($TheText, " ");
                $To = substr($TheText, 2, $PosSpace - 2);
                $Deb = strlen($To) + 2;
                $TheText = '<span class="InfoUser">' . __("Private message for", wordspew) . ' ' . $To . ':</span>' . substr($TheText, $Deb);
                $the_nickname = isset($user_identity) ? $user_identity : str_replace("\\'", "'", $_COOKIE['jalUserName']);
                if (strtolower($the_nickname) == strtolower($To) || strtolower($the_nickname) == strtolower($r->name) || ($user_level >= $jal_admin_user_level || $curadmin == 1)) {
                    $verif = true;
                }
            }
            if (verifyName($r->name)) {
                $class = "jal_user ";
            }
            $delete = "";
            if ($user_level >= $jal_admin_user_level || $curadmin == 1) {
                $delete .= ' <span onclick="deleteComment(' . $r->id . ')" class="delShout" title="' . __("Delete", wordspew) . '">x</span>';
            }
            $avatar = "";
            if ($show == '1' && $r->email != "") {
                $avatar = shout_get_avatar($r->email, $size, $position);
            }
            if ($verif) {
                echo '<li id="comment-new' . $r->id . '">' . $avatar . '<span title="' . jal_time_since($r->time) . '" class="' . $class . sanitize_name($r->name) . '">' . stripslashes($url) . ' : </span>' . convert_smilies(" " . stripslashes($TheText)) . $delete . '</li>
		';
            }
            $jal_first_time = false;
            $class = "";
        }
        if (!$results) {
            printf(__('<div id="lastMessage"><span>Last Message</span><br/><div id="responseTime">%s</div>&nbsp;ago</div>', wordspew), '0 ' . __('minute', wordspew));
            echo '
		<div id="usersOnline">' . jal_get_useronline_extended() . '</div>
		<ul id="outputList">
		<li>&nbsp;</li>
		';
        }
        $use_url = $shout_opt['use_url'] == 1 ? TRUE : FALSE;
        $use_textarea = $shout_opt['use_textarea'] == 1 ? TRUE : FALSE;
        $combo = '<input type="hidden" name="shout_cat" id="shout_cat" value="' . $HiddenCat . '"/>';
        if ($use_theme == 1 && ($comboTheme == 1 || $user_level >= $jal_admin_user_level)) {
            $SQL = "SELECT DISTINCT cat FROM " . mysql_real_escape_string($shout_tb) . "liveshoutbox WHERE cat!='' ORDER BY cat";
            $theme = $wpdb->get_results($SQL);
            $wpdb->show_errors();
            if ($curthe == 1) {
                if ($theme || $curadmin == 1) {
                    $combo .= '<div id="shout_theme" style="display:none;"><b>' . __("Theme:", wordspew) . '</b><br/>';
                    $combo .= '<select name="shout_cat_theme" id="shout_cat_theme" onchange="document.getElementById(\'chatbarText\').focus();" onblur="CleanBox()" 
				onfocus="oldval=this.options[this.selectedIndex].value">
				<option value="">' . __("Miscellaneous", wordspew) . '</option>';
                    foreach ($theme as $theme_name) {
                        $the_theme = stripslashes($theme_name->cat);
                        $selected = $SQLCat == $the_theme || $HiddenCat == $the_theme ? ' selected="true"' : '';
                        $combo .= '<option value="' . $the_theme . '"' . $selected . '>' . $the_theme . '</option>';
                    }
                    if ($user_level >= $jal_admin_user_level || $curadmin == 1) {
                        $combo .= '<option value="add_custom" style="font-weight:bold">' . __("New theme", wordspew) . '</option>';
                    }
                    $combo .= '</select></div>';
                }
            }
        }
        if (!defined("DB_CHARSET")) {
            @mysql_query("SET CHARACTER SET 'latin1'");
            @mysql_query("SET NAMES latin1");
        }
        ?>
	</ul>
	</div>
	<div id="chatInput">
<?php 
        $hashtext = $_SESSION['hashtext' . $shout_tb];
        if (!$registered_only) {
            $display_name = isset($_COOKIE['jalUserName']) ? $_COOKIE['jalUserName'] : __("Guest_", wordspew) . rand(0, 5000);
            $display_name = str_replace("\\'", "'", $display_name);
            ?>
	<form id="chatForm" method="post" action="<?php 
            echo $Actual_URL;
            ?>
/wp-content/plugins/pierres-wordspew/wordspew.php">
	<input type="hidden" name="shoutboxControl" id="shoutboxControl" value="<?php 
            echo md5($total . $hashtext);
            ?>
"/>
	<?php 
            if ($user_level >= $jal_admin_user_level || $curadmin == 1) {
                // If user is allowed to use the admin page
                $_SESSION['isAdmin' . $shout_tb] = true;
                echo '<a href="' . $Actual_URL . '/wp-admin/edit.php?page=wordspew_admin" onmouseover="ChangeURL(\'shoutboxAdmin\',\'' . $Actual_URL . '/wp-admin/edit.php?page=wordspew_admin\',\'&amp;shout_cat=\')" id="shoutboxAdmin">' . __("Admin", wordspew) . '</a>';
            } else {
                unset($_SESSION['isAdmin' . $shout_tb]);
            }
            echo '<div style="text-align:right;">';
            if ($level_for_archive == 1) {
                echo '<a href="' . $Actual_URL . '/wp-content/plugins/pierres-wordspew/wordspew_archive.php" onmouseover="ChangeURL(\'shoutboxArchive\',\'' . $Actual_URL . '/wp-content/plugins/pierres-wordspew/wordspew_archive.php\',\'?shout_cat=\')" id="shoutboxArchive">' . __("Archive", wordspew) . '</a>| ';
            }
            echo '<a style="cursor:pointer;" onclick="ChangeBoxSize(1)" title="' . __("Click here to increase the height of the shoutbox.", wordspew) . '">+</a> <a style="cursor:pointer;" onclick="ChangeBoxSize(0)" title="' . __("Click here to decrease the height of the shoutbox.", wordspew) . '">-</a>
	</div>';
            if (!empty($user_identity)) {
                /* If they are logged in, then print their nickname */
                $_SESSION['Logged'] = "ok";
                ?>
	<input type="hidden" name="shoutboxOp" id="shoutboxOp" value="<?php 
                echo $total;
                ?>
"/>
	<label><?php 
                _e('Name', wordspew);
                ?>
: <em><?php 
                echo $user_identity;
                ?>
</em></label>
	<input type="hidden" name="shoutboxname" id="shoutboxname" value="<?php 
                echo $user_identity;
                ?>
"/>
	<input type="hidden" name="shoutboxU" id="shoutboxU" value="<?php 
                if ($use_url) {
                    echo $user_url;
                }
                ?>
"/>
	<?php 
            } else {
                unset($_SESSION['Logged']);
                echo "\n";
                /* Otherwise allow the user to pick their own name */
                ?>

	<?php 
                if ($Captcha == 1) {
                    ?>
	<div id="shoutbox_captcha">
	<label><?php 
                    _e('Captcha', wordspew);
                    ?>
:</label> <select name="shoutboxOp" id="shoutboxOp" 
	onchange="MasqueSelect()" onclick="MasqueSelect()">
	<option value="-3"><?php 
                    echo $rand1 . "+" . $rand2 . "=";
                    ?>
</option>
	<?php 
                    for ($i = 0; $i < 21; $i++) {
                        echo '<option value="' . $i . '">' . $i . '</option>';
                    }
                    echo '</select></div>';
                } else {
                    ?>
		<input type="hidden" name="shoutboxOp" id="shoutboxOp" value="<?php 
                    echo $total;
                    ?>
"/>
	<?php 
                }
                ?>
	<label for="shoutboxname"><?php 
                _e('Name', wordspew);
                ?>
:</label>
	<input type="text" name="shoutboxname" id="shoutboxname" value="<?php 
                echo $display_name;
                ?>
" onfocus="Old_Sname=this.value;this.value='';"/>
	<label for="shoutboxU"<?php 
                if (!$use_url) {
                    echo ' style="display: none"';
                }
                ?>
><?php 
                _e('URL/Email', wordspew);
                ?>
:</label>
	<input type="text" name="shoutboxU" id="shoutboxU" value="<?php 
                if ($use_url) {
                    echo $_COOKIE['jalUrl'];
                }
                ?>
"<?php 
                if (!$use_url) {
                    echo ' style="display: none"';
                }
                ?>
/>
	<?php 
            }
            echo "\n";
            ?>
	<label for="chatbarText"><?php 
            _e('Message', wordspew);
            ?>
:</label>
	<?php 
            if ($use_textarea) {
                ?>
	<textarea rows="4" cols="16" name="chatbarText" id="chatbarText" onkeypress="return pressedEnter(this,event);"></textarea>
	<?php 
            } else {
                ?>
	<input type="text" name="chatbarText" id="chatbarText" onkeypress="return pressedEnter(this,event);"/>
	<?php 
            }
            ?>
	<input type="hidden" id="jal_lastID" value="<?php 
            echo $lastID + 1;
            ?>
" name="jal_lastID"/>

	<?php 
            echo $combo;
            ?>

	<input type="hidden" name="shout_no_js" value="true"/>
	<div id="SmileyList"></div>
	<input type="submit" id="submitchat" name="submit" value="<?php 
            _e('Send', wordspew);
            ?>
"/>
	</form>
<?php 
        } else {
            if ($level_for_archive == 1) {
                echo '<div style="text-align:right;">
		<a href="' . $Actual_URL . '/wp-content/plugins/pierres-wordspew/wordspew_archive.php?shout_cat=' . $cat . '">' . __("Archive", wordspew) . '</a>
		</div>';
            }
            ?>
	<form id="chatForm" action="">
	<p align="center"><?php 
            _e('You don\'t have sufficient rights to participate to this chat', wordspew);
            ?>
</p>
	<input type="hidden" name="shoutboxOp" id="shoutboxOp" value="<?php 
            echo $total;
            ?>
"/>
	<input type="hidden" id="shoutboxname" value="<?php 
            echo __("Guest_", wordspew) . rand(0, 5000);
            ?>
"/>
	<input type="hidden" id="shoutboxU"/>
	<input type="hidden" id="chatbarText"/>
	<input type="hidden" id="shout_cat" value="<?php 
            echo $HiddenCat;
            ?>
"/>
	<input type="hidden" id="jal_lastID" value="<?php 
            echo $lastID + 1;
            ?>
"/>
	<input type="submit" id="submitchat" name="submit" style="display:none;"/>
	</form>
<?php 
        }
        ?>
	</div>
</div>
<?php 
        if ($shout_opt['use_sound'] == 1) {
            //Thanks to Eric HEUNTHEP -> http://portfolio.neolao.com/ for its cool free mp3 player -> http://flash-mp3-player.net/en/players/js/preview/
            echo '<object id="TheBox" type="application/x-shockwave-flash" data="' . $Actual_URL . '/wp-content/plugins/pierres-wordspew/player.swf" 
	width="1" height="1"><param name="movie" value="' . $Actual_URL . '/wp-content/plugins/pierres-wordspew/player.swf"/><param 
	name="AllowScriptAccess" value="always" /><param name="FlashVars" value="listener=myBox"/></object>
	';
        }
    }
}
        output("Enter your character's name: ");
        rawoutput("<input name='charname'>");
        output_notl("`n");
        $send = translate_inline("Email me my password");
        rawoutput("<input type='submit' class='button' value='{$send}'>");
        rawoutput("</form>");
    }
}
page_header("Create A Character");
if (getsetting("allowcreation", 1) == 0) {
    output("`\$Creation of new accounts is disabled on this server.");
    output("You may try it again another day or contact an administrator.");
} else {
    if ($op == "create") {
        $emailverification = "";
        $shortname = sanitize_name(getsetting("spaceinname", 0), httppost('name'));
        if (soap($shortname) != $shortname) {
            output("`\$Error`^: Something awful was found in your name, please consider revising it.`n");
            $op = "";
        } else {
            $blockaccount = false;
            $email = httppost('email');
            $pass1 = httppost('pass1');
            $pass2 = httppost('pass2');
            if (getsetting("blockdupeemail", 0) == 1 && getsetting("requireemail", 0) == 1) {
                $sql = "SELECT login FROM " . db_prefix("accounts") . " WHERE emailaddress='{$email}'";
                $result = db_query($sql);
                if (db_num_rows($result) > 0) {
                    $blockaccount = true;
                    $msg .= translate_inline("You may have only one account.`n");
                }
示例#9
0
	/**
	 * Generate a filname from a project id
	 *
	 * @param 	integer 	$project_id
	 * @return	string
	 */
    private function generateProjectFileName($project_id, $i = 1)
    {
        $this->load->model('Users_model','',TRUE);
        $this->load->helper('school');
        $this->load->helper('format');

        // get data
        $project_data = $this->getSubmitInformations($project_id);
        $sanitized_user_name = sanitize_name(strtoupper($this->session->last_name) . "_" .  $this->session->name);
        $sanitized_project_name = sanitize_name($project_data->project_name);

        $file_name =  $sanitized_user_name . '_' . $sanitized_project_name . '_' . sprintf("%02d", $i) . '.' . $project_data->extension;

        return $file_name;
    }
示例#10
0
function jal_get_shoutbox () {
global $wpdb, $jal_table_prefix, $user_level, $user_nickname, $user_url, $user_ID, $jal_admin_user_level, $user_identity;
get_currentuserinfo(); // Gets logged in user.
$theuser_nickname=$user_nickname;
$ActualVersion=round(get_bloginfo('version'));
if($ActualVersion>=2) $theuser_nickname=$user_identity;
if(get_option('shoutbox_spam')=="")	jal_install_shout();
$XHTML=get_option('shoutbox_XHTML');
$Captcha=get_option('shoutbox_Captcha');
$jal_number_of_comments=get_option('shoutbox_nb_comment');
$Actual_URL=get_bloginfo('wpurl');
$_SESSION['Show_Users']=get_option('shoutbox_online');
$_SESSION['BadCalc']=__("You should learn to count before use the shoutbox :)",wordspew);
$_SESSION['DLSpam']=__("I DON'T LIKE SPAM !!!",wordspew);
$_SESSION['HTTPLimit']=__("Sorry, but you can post only one url by message...",wordspew);
$_SESSION['IPLogged']=__("Your IP address have been banned from this blog, if you feel this is in error please contact the webmaster.",wordspew);
$_SESSION['hashtext']=get_option('shoutbox_hash');
$_SESSION['useURL']=get_option('shoutbox_use_url');
$_SESSION['useCaptcha']=get_option('shoutbox_Captcha');
?>
<div id="wordspew">
	<div id="chatoutput">
		<?php
		@mysql_query("SET CHARACTER SET 'utf8'");
		@mysql_query("SET NAMES utf8");
		$wpdb->hide_errors();
		$results = $wpdb->get_results("SELECT * FROM ".$jal_table_prefix."liveshoutbox ORDER BY id DESC LIMIT ".$jal_number_of_comments);
		$wpdb->show_errors();

		// Will only add the last message div if it is looping for the first time
		$jal_first_time = true;
		$registered_only = (get_option('shoutbox_registered_only') == "1") ? TRUE : FALSE;
		// Loops the messages into a list
		foreach( $results as $r ) {
			$target="";
			// Add links
			if (strpos($r->text, $Actual_URL)===false && $XHTML==0) $target=' target="_blank"';
			$theLink=__("link",wordspew); $theMail=__("email",wordspew);
			$r->text = preg_replace("`(http|ftp)+(s)?:(//)((\w|\.|\-|_)+)(/)?(\S+)?`i", "<a href=\"\\0\"$target>&laquo;$theLink&raquo;</a>", $r->text);
			$r->text = preg_replace("`([-_a-z0-9]+(\.[-_a-z0-9]+)*@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]{2,6})`i","<a href=\"mailto:\\1\">&laquo;$theMail&raquo;</a>", $r->text); 

			if ($jal_first_time == true) {
				$rand1=mt_rand(0,10);
				$rand2=mt_rand(0,10);
				$total=intval($rand1+$rand2);

				if (get_option('shoutbox_sound') == "1") {
					$img_sound=($_COOKIE['jalSound']==1 || $_COOKIE['jalSound']=="") ? "sound_1.gif" : "sound_0.gif";
					echo '<img src="'. $Actual_URL .'/wp-content/plugins/wordspew/'.$img_sound.'" alt="" 
					onclick="setSound();" id="JalSound" title="';
					_e("Click this to turn on/off sound",wordspew);
					echo '"/>
					';
				}
				if(get_option('shoutbox_Show_Spam')) {
					$nb = get_option('shoutbox_spam');
					printf(__('<div id="Show_Spam">%s spams blocked</div>',wordspew),$nb);
				}
				printf(__('<div id="lastMessage"><span>Last Message</span> <em id="responseTime">%s ago</em></div>',wordspew),jal_time_since($r->time));
				echo '<div id="usersOnline">'.jal_get_useronline_extended().'</div>';
				echo '<ul id="outputList">'; }

			if ($jal_first_time == true) $lastID = $r->id;
			$target="";
			if($r->url!="") if (strpos($r->url, $Actual_URL)===false && $XHTML==0) $target=' target="_blank"';
			$url = (empty($r->url) && $r->url = "http://") ? $r->name : '<a href="'.$r->url.'"'.$target.'>'.$r->name.'</a>';
			if($jal_first_time == true && !isset($_COOKIE['jalCaptcha']) && !$user_ID && !$registered_only && $_SESSION['useCaptcha'] == '1') 
				echo '<li><span>'.__("Info",wordspew).' : </span><b>'.__("Please, resolve the addition below before post any new comment...",wordspew).'</b></li>';
			if(verifyName($r->name)) {
			$class="jal_user ";
			}
			echo '<li><span title="'.jal_time_since( $r->time ).'" class="'.$class. sanitize_name($r->name).'">'.stripslashes($url).' : </span>'.convert_smilies(" ".stripslashes($r->text)).'</li>
			'; 
			$jal_first_time = false;
			$class="";
		}

		$use_url = (get_option('shoutbox_use_url') == "true") ? TRUE : FALSE;
		$use_textarea = (get_option('shoutbox_use_textarea') == "true") ? TRUE : FALSE;
		if (!defined("DB_CHARSET")) {
			@mysql_query("SET CHARACTER SET 'latin1'");
			@mysql_query("SET NAMES latin1");
			}
		?>
		</ul>
	</div>
	<div id="chatInput">
<?php 
	$hashtext = $_SESSION['hashtext'];

	if (!$registered_only || ($registered_only && $user_ID)) {
	$display_name=($_COOKIE['jalUserName']) ? $_COOKIE['jalUserName'] : __("Guest_",wordspew).rand(0,5000);
	$display_name=str_replace("\'", "'", $display_name);
	?>
	<form id="chatForm" method="post" action="<?php bloginfo('wpurl'); ?>/wp-content/plugins/wordspew/wordspew.php">
	<?php
	$current=current_user_can('level_'.$jal_admin_user_level);
	if ($user_level >= $jal_admin_user_level || $current==1) { // If user is allowed to use the admin page
		echo '<a href="'.get_bloginfo("wpurl").'/wp-admin/edit.php?page=wordspew" id="shoutboxAdmin">'. __("Admin",wordspew).'</a>';
	}
	if (!empty($theuser_nickname)) { /* If they are logged in, then print their nickname */ 
	$_SESSION['Logged']="ok"; ?>
	<input type="hidden" name="shoutboxControl" id="shoutboxControl" value="<?php echo md5($total.$hashtext); ?>"/>
	<input type="hidden" name="shoutboxOp" id="shoutboxOp" value="<?php echo $total; ?>"/>
	<label><?php _e('Name',wordspew); ?>: <em><?php echo $theuser_nickname ?></em></label>
	<input type="hidden" name="shoutboxname" id="shoutboxname" value="<?php echo $theuser_nickname; ?>"/>
	<input type="hidden" name="shoutboxU" id="shoutboxU" value="<?php if($use_url) { echo $user_url; } ?>"/>
	<?php } else { echo "\n"; /* Otherwise allow the user to pick their own name */ ?>

	<?php if ($Captcha==1) { ?>
	<input type="hidden" name="shoutboxControl" id="shoutboxControl" value="<?php echo md5($total.$hashtext); ?>"/>
	<div id="shoutbox_captcha">
	<label><?php _e('Captcha',wordspew); ?>:</label> <select name="shoutboxOp" id="shoutboxOp" 
	onchange="MasqueSelect()" onclick="MasqueSelect()">
	<option value="-3"><?php echo $rand1."+".$rand2."="; ?></option>
	<?php for ($i = 0; $i < 21; $i++) {
	echo '<option value="'.$i.'">'.$i.'</option>';
	}
	echo '</select></div>';
	}
	else { ?>
		<input type="hidden" name="shoutboxControl" id="shoutboxControl" value="<?php echo md5($total.$hashtext); ?>"/>
		<input type="hidden" name="shoutboxOp" id="shoutboxOp" value="<?php echo $total; ?>"/>
	<? } ?>

	<label for="shoutboxname"><?php _e('Name',wordspew); ?>:</label>
	<input type="text" name="shoutboxname" id="shoutboxname" value="<?php echo $display_name; ?>" maxlength="18"/>
	<label for="shoutboxU"<?php if (!$use_url) echo ' style="display: none"'; ?>><?php _e('URL/Email',wordspew); ?>:</label>
	<input type="text" name="shoutboxU" id="shoutboxU" value="<?php if ($_COOKIE['jalUrl'] && $use_url) echo $_COOKIE['jalUrl']; else echo 'http://'; ?>"<?php if (!$use_url) echo ' style="display: none"'; ?>/>
	<?php  } echo "\n"; ?>
	<label for="chatbarText"><?php _e('Message',wordspew) ?>:</label>
	<?php if ($use_textarea) { ?>
	<textarea rows="4" cols="16" name="chatbarText" id="chatbarText" onkeypress="return pressedEnter(this,event);"></textarea>
	<?php } else { ?>
	<input type="text" name="chatbarText" id="chatbarText"/>
	<?php } ?>
	<input type="hidden" id="jal_lastID" value="<?php echo $lastID + 1; ?>" name="jal_lastID"/>
	<input type="hidden" name="shout_no_js" value="true"/>
	<div id="SmileyList"></div>
	<input type="submit" id="submitchat" name="submit" value="<?php _e('Send',wordspew);?>"/>
	</form>
<?php }
else { ?>
	<form id="chatForm" action="">
	<p align="center"><?php _e('You must be a registered user to participate in this chat',wordspew); ?></p>
	<input type="hidden" name="shoutboxControl" id="shoutboxControl" value="<?php echo md5($total.$hashtext); ?>"/>
	<input type="hidden" name="shoutboxOp" id="shoutboxOp" value="<?php echo $total; ?>"/>
	<input type="hidden" id="shoutboxname"/>
	<input type="hidden" id="shoutboxU"/>
	<input type="hidden" id="chatbarText"/>
	<input type="hidden" id="jal_lastID" value="<?php echo $lastID+1; ?>"/>
	<input type="submit" id="submitchat" name="submit" style="display:none;"/>
	</form>
<?php } ?>
	</div>
</div>
<?php if (get_option('shoutbox_sound') == "1") echo('<span id="TheBox"></span>'); }
function homepage_run()
{
    require_once "common.php";
    require_once "lib/is_email.php";
    require_once "lib/checkban.php";
    require_once "lib/http.php";
    page_header("Welcome to Improbable Island");
    global $session;
    $r = httpget('r');
    $name = sanitize_name(getsetting("spaceinname", 0), httppost('name'));
    $pass1 = httppost('pass1');
    $pass2 = httppost('pass2');
    $sex = httppost('gender');
    $email = httppost('email');
    $passlen = (int) httppost("passlen");
    if (substr($pass1, 0, 5) != "!md5!" && substr($pass1, 0, 6) != "!md52!") {
        $passlen = strlen($pass1);
    }
    if (!$sex) {
        $outputgender = "man";
    } else {
        $outputgender = "woman";
    }
    switch (httpget('op')) {
        case "changeskin":
            $skin = httpget('skin');
            if ($skin > "") {
                setcookie("template", $skin, strtotime("+45 days"));
                $_COOKIE['template'] = $skin;
            }
            redirect("index.php?r={$r}", "Home page module changing skin");
            break;
        case "gamecredits":
            page_header("Game Credits");
            output("Improbable Island's plot, characters, Stamina system, Item system, ScrapBots system, Races, Implants, Mounts and probably a few other things were created by Dan Hall, AKA Admin CavemanJoe.`nMany monsters were written by Improbable Island's players.`nImprobable Island runs on a modified version of Legend of the Green Dragon 1.1.1, DragonPrime Edition, which was created by the good folks at dragonprime.com.`nThe DragonPrime Edition was based on the original Legend of the Green Dragon, created by Eric Stevens and J.T. Traub as a homage to Legend of the Red Dragon by Seth Able.`n`nPut simply, Improbable Island is a hodgepodged Frankenstein of a game, but we get by.`n`nThe source code to Legend of the Green Dragon 1.1.1 +DP is available at dragonprime.net.`nThe source code to the most recent version of Legend of the Green Dragon written by Stevens and Traub (upon which the DragonPrime edition is based) is available at lotgd.net.`nThe source code of Improbable Island will be made available on Improbable Labs shortly - for now, it is available on request.`n`nFor more information about Improbable Island and Legend of the Green Dragon, check out the links to the left.");
            addnav("Further Reading");
            addnav("Module Credits", "about.php?op=listmodules&r=" . $r);
            addnav("Creative Commons License Info", "about.php?op=license&r=" . $r);
            addnav("Original Legend of the Green Dragon \"About\" page", "about.php?r=" . $r);
            addnav("Back to the Home Page");
            addnav("Back", "home.php?r=" . $r);
            break;
        case 0:
            $tripfilter = 0;
            $sname = strtolower($name);
            if (substr_count($sname, "nigger") || substr_count($sname, "c**t") || substr_count($sname, "dick") && !substr_count($sname, "dicke") || substr_count($sname, "f****t") || substr_count($sname, "v****a") || substr_count($sname, "pussy") || substr_count($sname, "shit") || substr_count($sname, "wank") || substr_count($sname, "bollocks") || substr_count($sname, "clitoris") || substr_count($sname, "f**k") || substr_count($sname, "d***o") || substr_count($sname, "t**s") || substr_count($sname, "piss") || substr_count($sname, "penis")) {
                output("The gatekeeper's biro stops mid-scrawl.  He looks up at you.  \"`6Seriously?`0\" he asks.  \"`6You're gonna walk into a pub, are you, and espy some sweet young thing who puts your heart all aflutter, and when they ask you your name, you're gonna say \"My name's %s, what's yours?\"  Is that right?`0\"`n`nYou shuffle your feet sheepishly.  Let's try this again.`n`n", $name);
                $redoform = 1;
            }
            //todo: redirect when numbers appear in name
            $sql = "SELECT name FROM " . db_prefix("accounts") . " WHERE login='******'";
            $result = db_query($sql);
            if (db_num_rows($result) > 0) {
                output("\"`6Oh, dear...`0\" says the gatekeeper.  \"`6See, we've already got a %s drafted in, here.`0\"`n`nYou stare at him for a moment.  \"`#What in the hell difference does `ithat`i make?!`0\"`n`n\"`6Well, you see, it's easier if everyone has different names, and, well, the computer that handles these forms...`0\" he shrugs.  \"`6It's not particularly bright.`0\"`n`nYou nod.  Computers haven't been terribly bright since the EMP wars.`n`n\"`6Just put down any old thing,`0\" says the gatekeeper.  \"`6I doubt it'll matter much.`0\"`n`n", $name);
                $redoform = 1;
            } else {
                if (strlen($name) < 3) {
                    output("\"`6Oh, dear...`0\" says the gatekeeper.  \"`6I'm afraid that name's just too short.`0\"`n`nYou stare at him for a moment.  \"`#What in the hell difference does `ithat`i make?!`0\"`n`n\"`6Well, you see, the computer that handles these forms...`0\" he shrugs.  \"`6It's not particularly bright.`0\"`n`nYou nod.  Computers haven't been terribly bright since the EMP wars.`n`n\"`6Just put down any old thing,`0\" says the gatekeeper.  \"`6I doubt it'll matter much.`0\"`n`n");
                    $redoform = 1;
                } else {
                    if (strlen($name) > 25) {
                        output("\"`6Oh, dear...`0\" says the gatekeeper.  \"`6I'm afraid that name's just too long.`0\"`n`nYou stare at him for a moment.  \"`#What in the hell difference does `ithat`i make?!`0\"`n`n\"`6Well, you see, the computer that handles these forms...`0\" he shrugs.  \"`6It's not particularly bright.`0\"`n`nYou nod.  Computers haven't been terribly bright since the EMP wars.`n`n\"`6Just put down any old thing,`0\" says the gatekeeper.  \"`6I doubt it'll matter much.`0\"`n`n");
                        $redoform = 1;
                    }
                }
            }
            if ($redoform) {
                rawoutput("<form action='runmodule.php?module=homepage&op=0&r={$r}' method='POST'\">\"<span class=\"colLtCyan\">Well then, I suppose you can call me <input name='name' id=\"name\" accesskey='u' size='12'>.</span>\"  Like you're gonna give him your real name anyway.");
                rawoutput("<br /><div align=\"center\"><input type='submit' value='Carry On' class='button'></div><br /><br /></form>");
                addnav("", "runmodule.php?module=homepage&op=0&r=" . $r);
            } else {
                output("The gatekeeper smiles.  \"`6Okay, %s - now, if you don't mind my asking, are you over eighteen?`0\"`n`n", $name);
                output("You grimace.  \"`#Mate, I've been drafted into some sort of war.  If I'm under eighteen, `isomeone's`i in trouble.`0\"`n`n\"`6That as may be,\"`0 says the gatekeeper, \"`6I've got to ask anyway, before we go any further.  Just to make sure.`0\"`n`n`n");
                rawoutput("<table width=80% align=center style=\"border: 1px solid #990000;\"><tr><td class=\"trlight\">");
                output("`c`\$`bWARNING`b`c`7Although most folks would consider Improbable Island to be work-safe by virtue of it being entirely text-based, I should warn you that you probably wouldn't want to invite the vicar over for tea and scones while playing.`n`nImprobable Island contains `bfoetid Midget Brothels`b and other rather adult (but very silly) situations, and is intended for equally silly `badults`b.  If you're not an adult yet, why not check out Kingdom of Loathing, zOMG, Legends of Zork, Puzzle Pirates, Adventure Quest - there's loads of other browser games, really.`n`n");
                output("And if you `iare`i an adult, and want to carry on - knowing that you're about to be subjected to a barrage of sex, drugs and sausage rolls - by all means, continue with the story and have fun.`0");
                rawoutput("</td></tr></table>");
                output("`n`nYou realise you've been staring off into space for a moment, and you blink a couple of times.  \"`#Sorry, I think I spaced out for a minute there.`0\"");
                rawoutput("<form action='runmodule.php?module=homepage&op=1&r={$r}' method='POST'\">");
                rawoutput("<input type='hidden' name='name' value=\"{$name}\">");
                rawoutput("<br /><div align=\"center\"><input type='submit' value='Yes, I am indeed over eighteen.  Now how about some pants?' class='button'></div></form>");
                addnav("", "runmodule.php?module=homepage&op=1&r=" . $r);
            }
            break;
        case 1:
            output("\"`6Yes, yes, we'll sort you out with some pants in just a minute, %s, don't you worry.`0\"  He reaches down out of sight, and pulls up a sheet of paper and a pen.  You see the words \"CONTESTANT REGISTRATION AND PANTS REQUEST FORM 3A\" printed at the top of the page.  Hell, maybe we're getting somewhere.`n`n\"`6Now, might I ask your gender?`0\"`n`nYou hesitate, dumbstruck.  \"`#I'm stood here `istark naked`i, right in front of you.`0\"`n`n\"`6And thanks to all those bloody Zap grenades going off all the time, all I see is a person-shaped blur who won't be getting any pants until they help me fill out this bloody form!`0\" replies the gatekeeper.`n`n", $name);
            rawoutput("<form action='runmodule.php?module=homepage&op=2&r={$r}' method='POST'\"><input type='radio' name='gender' value='0' checked>\"<span class=\"colLtCyan\"><em>Male</em>, thank you very much.</span>\"<br /><input type='radio' name='gender' value='1'>\"<span class=\"colLtCyan\"><em>Female</em>, thank you very much.</span>\"");
            rawoutput("<input type='hidden' name='name' value=\"{$name}\">");
            rawoutput("<br /><div align=\"center\"><input type='submit' value='And is my voice really that androgynous?' class='button'></div><br /><br /></form>");
            addnav("", "runmodule.php?module=homepage&op=2&r=" . $r);
            break;
        case 2:
            output("\"`6No, %s, you `ido`i sound like a %s, but I like a little joke.`0\" the gatekeeper grins.  ", $name, $outputgender);
            output("\"`6Now, can I just take your E-mail address, please?`0\"`n`nMentally, you file the man under \"Nutters.\"  \"`#Hell, we only got `itelevision`i back about a year ago!  You know full well that computers don't work any more.`0\"`n`n\"`6And they haven't done since the EMP bombings years back, yes.  That's the interesting thing -`0\" he leans forward and lowers his voice.  \"`6I've heard tell that there `iare`i some working computers here.  Proper `isilicon`i ones, not these silly relay-and-vacuum-tube monstrosities we use today, where you think you're rich if you've got sixteen bytes of RAM to play with.  We're talking `iterabytes`i, here!  Just `iimagine`i what we could do with that sort of power!`0\"`n`nYou remember what you did with those resources when you had them, only a few years ago.  You played silly browser games on the Internet.`n`n\"`6Anyway - it's an old, old form, from back in the day when it mattered.  Let's take your E-mail address, so we can have something in the space.`0\"  He grins.  \"`6It's not like I'm going to send you any spam, now, is it?`0\"`n`n");
            rawoutput("<form action='runmodule.php?module=homepage&op=3&r={$r}' method='POST'\">\"<span class=\"colLtCyan\">Fine - as far as I remember, it's <input name='email' id=\"email\" accesskey='e' size='25'>.</span>\"");
            rawoutput("<input type='hidden' name='name' value=\"{$name}\">");
            rawoutput("<input type='hidden' name='gender' value=\"{$sex}\">");
            rawoutput("<br /><div align=\"center\"><input type='submit' value='NOW may I have some pants?' class='button'></div></form>");
            rawoutput("<br /><br /><table width=80% align=center style=\"border: 1px solid #990000;\"><tr><td class=\"trlight\">");
            output("`7He ain't kidding - Improbable Island doesn't spam.  Your E-mail address is used to recover your password if you forget it, and (optionally) to let you know if someone sends you a message in-game - that's it.  We don't use it for anything else, and we never let anyone else see it.`n`nOr, you can continue without entering an E-mail address - but you won't be notified of anything, and you won't be able to recover your password if you lose it!`n");
            rawoutput("<form action='runmodule.php?module=homepage&op=3&override=1&r={$r}' method='POST'\"><input name='email' type='hidden' value='not given'>");
            rawoutput("<input type='hidden' name='name' value=\"{$name}\">");
            rawoutput("<input type='hidden' name='gender' value=\"{$sex}\">");
            rawoutput("<br /><div align=\"center\"><input type='submit' value='Continue without an E-mail address' class='button'></div></form>");
            rawoutput("</td></tr></table>");
            addnav("", "runmodule.php?module=homepage&op=3&override=1&r=" . $r);
            break;
        case 3:
            if ($sexdisplay = "Male") {
                $formalgenderdisplay = "man";
            } else {
                $formalgenderdisplay = "lady";
            }
            if (httpget('override') == 1) {
                output("\"`6Fair enough, then, fair enough - I guess it's pretty pointless asking for an E-mail address when they're impossible to use anyway.`0\"`n`n");
                $carryon = 1;
            } else {
                //validate E-mail
                if (!is_email($email)) {
                    output("The gatekeeper frowns.  \"`6That certainly doesn't `isound`i like an E-mail address.  Are you sure that's right?`0\"`n`nLet's try that again.`n");
                } else {
                    //check for duplicates
                    $sql = "SELECT login FROM " . db_prefix("accounts") . " WHERE emailaddress='{$email}'";
                    $result = db_query($sql);
                    if (db_num_rows($result) > 0) {
                        output("The gatekeeper frowns.  \"`6Are you taking the mick, my good %s?  That E-mail is already in my book, here.  You can only sign up once, you know.`0\"`n`nLet's try that again.`n", $formalgenderdisplay);
                    } else {
                        //email is good, request password
                        output("The gatekeeper grins. \"`6I'm sure if you find those computers, you'll be using that address again soon.`0\"`n`n");
                        $carryon = 1;
                    }
                }
            }
            if ($carryon) {
                rawoutput("<script language='JavaScript' src='lib/md5.js'></script>");
                rawoutput("<script language='JavaScript'>\r\n\t\t\t\t<!--\r\n\t\t\t\tfunction md5pass(){\r\n\t\t\t\t\t// encode passwords\r\n\t\t\t\t\tvar plen = document.getElementById('passlen');\r\n\t\t\t\t\tvar pass1 = document.getElementById('pass1');\r\n\t\t\t\t\tplen.value = pass1.value.length;\r\n\r\n\t\t\t\t\tif(pass1.value.substring(0, 5) != '!md5!') {\r\n\t\t\t\t\t\tpass1.value = '!md5!'+hex_md5(pass1.value);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar pass2 = document.getElementById('pass2');\r\n\t\t\t\t\tif(pass2.value.substring(0, 5) != '!md5!') {\r\n\t\t\t\t\t\tpass2.value = '!md5!'+hex_md5(pass2.value);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\t\t\t\t//-->\r\n\t\t\t\t</script>");
                if (httpget('override')) {
                    rawoutput("<form action='runmodule.php?module=homepage&op=4&override=1&r={$r}' method='POST' onSubmit=\"md5pass();\">");
                } else {
                    rawoutput("<form action='runmodule.php?module=homepage&op=4&r={$r}' method='POST' onSubmit=\"md5pass();\">");
                }
                rawoutput("<input type='hidden' name='passlen' id='passlen' value='0'>");
                rawoutput("<input type='hidden' name='name' value=\"{$name}\">");
                rawoutput("<input type='hidden' name='gender' value=\"{$sex}\">");
                rawoutput("<input type='hidden' name='email' value=\"{$email}\">");
                output("You hear a rustling in the bushes behind you, and turn to look.  Branches sway a couple of feet above head-height - there's something there.`n`nYou're suddenly even more aware that you're naked and unarmed.`n`nYou turn back to the gatekeeper.  \"`#Is this going to take long?`0\"`n`n\"`6No, no, we're nearly done now.`0\"  He reaches down beneath his counter, and brings up a stack of shiny silver coins.  \"`6Here's eighty Requisition tokens to get you started.`0\"`n`nYou consider asking him where the hell he thinks you're going to keep them, but a low `4`igrowling`i`0 sound changes your mind very quickly.`n`n\"`#Let me in.  Forget the pants, just let me in.`0\"`n`n\"`6One moment, sunshine, one moment.  I need a password from you.`0\"`n`n\"`#You're kidding me!  Did you `ihear`i that?!`0\"`n`n\"`6Yes, I heard it, and you'll get inside faster if you listen to me.  You need to make up a password - at least four characters in length.  I know, it sounds like a silly thing to ask, but there's a very good reason for it - you see...`0\"  The growling intensifies, and you look back towards the jungle.`n`nThere's a face.  It's looking at you from between the very leafy branches of a tree.  It's eight feet off the ground and shaped like a gas mask, its eyes as big as fists and deep, bright orange, shining against its jet black carapace.`n`n\"`#Don't care,`0\" you say quietly.  \"`#Really, really don't care.  Just put down ");
                rawoutput("<input type='password' name='pass1' id='pass1'>");
                output(".`0\"`n`nThe gatekeeper scribbles on his form.  \"`6Sorry, just run that past me again?`0\"`n`n\"`#I said ");
                rawoutput("<input type='password' name='pass2' id='pass2'>");
                output("!`0\"`n`n");
                rawoutput("<div align=\"center\"><input type='submit' value='Now let me in, damn it!' class='button'></div></form>");
            } else {
                //output the E-mail form again
                rawoutput("<form action='runmodule.php?module=homepage&op=3&r={$r}' method='POST'\">\"<span class=\"colLtCyan\">Fine - as far as I remember, it's <input name='email' id=\"email\" accesskey='e' size='25'>.</span>\"");
                rawoutput("<input type='hidden' name='name' value=\"{$name}\">");
                rawoutput("<input type='hidden' name='gender' value=\"{$sex}\">");
                rawoutput("<br /><div align=\"center\"><input type='submit' value='NOW may I have some pants?' class='button'></div></form>");
                rawoutput("<br /><br /><table width=80% align=center style=\"border: 1px solid #990000;\"><tr><td class=\"trlight\">");
                output("`7He ain't kidding - Improbable Island doesn't spam.  Your E-mail address is used to recover your password if you forget it, and (optionally) to let you know if someone sends you a message in-game - that's it.  We don't use it for anything else, and we never let anyone else see it.`n`nOr, you can continue without entering an E-mail address - but you won't be notified of anything, and you won't be able to recover your password if you lose it!`n");
                rawoutput("<form action='runmodule.php?module=homepage&op=3&override=1&r={$r}' method='POST'\"><input name='email' type='hidden' value='Not Given'>");
                rawoutput("<input type='hidden' name='name' value=\"{$name}\">");
                rawoutput("<input type='hidden' name='gender' value=\"{$sex}\">");
                rawoutput("<br /><div align=\"center\"><input type='submit' value='Continue without an E-mail address' class='button'></div></form>");
                rawoutput("</td></tr></table>");
                addnav("", "runmodule.php?module=homepage&op=3&override=1&r=" . $r);
            }
            break;
        case 4:
            output("`0The thing steps out from behind the trees.  Its chitinous body is thin, shiny, and angular.  There are no hands or feet; its legs and arms terminate in sharp points.  Each time it takes a step, it leaves a deep, round piercing in the ground.  You back up against the gatekeeper's hut, unable to take your eyes off the beast.`n`n");
            if ($passlen <= 3) {
                output("\"`6I'm not sure you heard me right, mate,`0\" says the gatekeeper quietly from behind you.  \"`6I need four characters or more.  No rush.`0\"`n`n");
                $tryagain = true;
            }
            if ($pass1 != $pass2) {
                output("\"`6Sorry, mate, I think I heard two different things,`0\" says the gatekeeper quietly from behind you.  \"`6Wanna repeat that?  No rush.`0\"`n`n");
                $tryagain = true;
            }
            if ($tryagain) {
                rawoutput("<script language='JavaScript' src='lib/md5.js'></script>");
                rawoutput("<script language='JavaScript'>\r\n\t\t\t\t<!--\r\n\t\t\t\tfunction md5pass(){\r\n\t\t\t\t\t// encode passwords\r\n\t\t\t\t\tvar plen = document.getElementById('passlen');\r\n\t\t\t\t\tvar pass1 = document.getElementById('pass1');\r\n\t\t\t\t\tplen.value = pass1.value.length;\r\n\r\n\t\t\t\t\tif(pass1.value.substring(0, 5) != '!md5!') {\r\n\t\t\t\t\t\tpass1.value = '!md5!'+hex_md5(pass1.value);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar pass2 = document.getElementById('pass2');\r\n\t\t\t\t\tif(pass2.value.substring(0, 5) != '!md5!') {\r\n\t\t\t\t\t\tpass2.value = '!md5!'+hex_md5(pass2.value);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\t\t\t\t//-->\r\n\t\t\t\t</script>");
                if (httpget('override')) {
                    rawoutput("<form action='runmodule.php?module=homepage&op=4&override=1&r={$r}' method='POST' onSubmit=\"md5pass();\">");
                } else {
                    rawoutput("<form action='runmodule.php?module=homepage&op=4&r={$r}' method='POST' onSubmit=\"md5pass();\">");
                }
                rawoutput("<input type='hidden' name='passlen' id='passlen' value='0'>");
                rawoutput("<input type='hidden' name='name' value=\"{$name}\">");
                rawoutput("<input type='hidden' name='gender' value=\"{$sex}\">");
                rawoutput("<input type='hidden' name='email' value=\"{$email}\">");
                output("\"`#`iSeriously, mate,`i just put down ");
                rawoutput("<input type='password' name='pass1' id='pass1'>");
                output(".`0\"`n`nThe gatekeeper scribbles on his form.  \"`6Sorry, just run that past me again?`0\"`n`n\"`#I said ");
                rawoutput("<input type='password' name='pass2' id='pass2'>");
                output("!`0\"`n`n");
                rawoutput("<div align=\"center\"><input type='submit' value='Now let me in, damn it!' class='button'></div></form>");
            } else {
                //perform a final test on all supplied information, as in create.php
                //password already checked
                $createaccount = 1;
                //check name
                $sql = "SELECT name FROM " . db_prefix("accounts") . " WHERE login='******'";
                $result = db_query($sql);
                //name exists
                if (db_num_rows($result) > 0) {
                    output("name");
                    $createaccount = 0;
                }
                //name too short or too long
                if (strlen($name) < 3 || strlen($name) > 25) {
                    output("name");
                    $createaccount = 0;
                }
                //gender not set
                if ($sex != 1 && $sex != 0) {
                    output("sex is %s", $sex);
                    $createaccount = 0;
                }
                //email
                if (!httpget('override')) {
                    //not overriden
                    //not an E-mail address
                    if (!is_email($email)) {
                        $createaccount = 0;
                        output("email not an email");
                    }
                    //already exists
                    $sql = "SELECT login FROM " . db_prefix("accounts") . " WHERE emailaddress='{$email}'";
                    $result = db_query($sql);
                    if (db_num_rows($result) > 0) {
                        $createaccount = 0;
                        output("email found already");
                    }
                }
                $args = modulehook("check-create", httpallpost());
                if (isset($args['blockaccount']) && $args['blockaccount']) {
                    $msg .= $args['msg'];
                    $createaccount = 0;
                }
                if ($createaccount) {
                    //create the account
                    require_once "lib/titles.php";
                    $title = get_dk_title(0, $sex);
                    $refer = httpget('r');
                    if ($refer > "") {
                        $sql = "SELECT acctid FROM " . db_prefix("accounts") . " WHERE login='******'";
                        $result = db_query($sql);
                        $ref = db_fetch_assoc($result);
                        $referer = $ref['acctid'];
                    } else {
                        $referer = 0;
                    }
                    $dbpass = "";
                    if (substr($pass1, 0, 5) == "!md5!") {
                        $dbpass = md5(substr($pass1, 5));
                    } else {
                        $dbpass = md5(md5($pass1));
                    }
                    $sql = "INSERT INTO " . db_prefix("accounts") . "\r\n\t\t\t\t\t\t(name, superuser, title, password, sex, login, laston, uniqueid, lastip, gold, emailaddress, emailvalidation, referer, regdate, race, location)\r\n\t\t\t\t\t\tVALUES\r\n\t\t\t\t\t\t('{$title} {$name}', '" . getsetting("defaultsuperuser", 0) . "', '{$title}', '{$dbpass}', '{$sex}', '{$name}', '" . date("Y-m-d H:i:s", strtotime("-1 day")) . "', '" . $_COOKIE['lgi'] . "', '" . $_SERVER['REMOTE_ADDR'] . "', " . getsetting("newplayerstartgold", 50) . ", '{$email}', '{$emailverification}', '{$referer}', NOW(), 'Human', 'NewHome')";
                    db_query($sql);
                    if (db_affected_rows(LINK) <= 0) {
                        output("`\$Error`^: Your account was not created for an unknown reason, please try again. ");
                    } else {
                        $sql = "SELECT acctid FROM " . db_prefix("accounts") . " WHERE login='******'";
                        $result = db_query($sql);
                        $row = db_fetch_assoc($result);
                        $args = httpallpost();
                        $args['acctid'] = $row['acctid'];
                        //insert output
                        $sql_output = "INSERT INTO " . db_prefix("accounts_output") . " VALUES ({$row['acctid']},'');";
                        db_query($sql_output);
                        //end
                        modulehook("process-create", $args);
                        //Project Wonderful Conversion Code
                        $pwcode = "<!-- Beginning of Project Wonderful conversion code: -->\r\n\t\t\t\t\t\t<!-- Conversion Track ID: 12 -->\r\n\t\t\t\t\t\t<script type=\"text/javascript\">\r\n\t\t\t\t\t\t<!--var d=document;\r\n\t\t\t\t\t\td.projectwonderful_conversion_id = \"12\";\r\n\t\t\t\t\t\td.projectwonderful_label = \"\";\r\n\t\t\t\t\t\td.projectwonderful_value = \"\";\r\n\t\t\t\t\t\t//-->\r\n\t\t\t\t\t\t</script>\r\n\t\t\t\t\t\t<script type=\"text/javascript\" \r\n\t\t\t\t\t\tsrc=\"http://www.projectwonderfuladservices.com/conversion.js\">\r\n\t\t\t\t\t\t</script>\r\n\t\t\t\t\t\t<!-- End of Project Wonderful ad code. -->";
                        rawoutput($pwcode);
                        if ($emailverification != "") {
                            $subj = translate_mail("LoGD Account Verification", 0);
                            $msg = translate_mail(array("Login name: %s `n`nIn order to verify your account, you will need to click on the link below.`n`n http://%s?op=val&id=%s `n`nThanks for playing!", $shortname, $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] == 80 ? "" : ":" . $_SERVER['SERVER_PORT']) . $_SERVER['SCRIPT_NAME'], $emailverification), 0);
                            mail($email, $subj, str_replace("`n", "\n", $msg), "From: " . getsetting("gameadminemail", "*****@*****.**"));
                            output("`4An email was sent to `\$%s`4 to validate your address.  Click the link in the email to activate your account.`0`n`n", $email);
                        } else {
                            output("\"`#`iLET ME IN!  RIGHT THE HELL NOW!`i`0\"`n`n\"`6Hmm?`0\"  The gatekeeper looks up from his forms.  \"`6Oh!  Yes, I see what you mean.  Wow!`0\" he smiles, as the beast plods closer.  \"`6That's a big one!  Geez, look at the `isize`i of 'im!`0\"`n`n\"`#`iPlease!`i`0\"`n`n\"`6Oh, oh, yes.  Of course.`0\"  He pulls a lever, and the outpost gates swing open.  \"`6In you go, then.`0\"`n`nYou tear through the gates and into the Outpost.`n`nThe gatekeeper chuckles.  \"`6Nice one, Harry!`0\"`n`nGrinning, the monster takes a bow.  \"`4It `inever`i gets old, this,`0\" it says in a broad Yorkshire accent. \"`4You in the pub later?`0\"`n`n\"`6Of course, it's darts night.`0\"`n`n\"`4Right-ho, then.  Ta-raa.`0\"`n`n\"`6See you, Harry.`0\"  The gatekeeper sits back in his chair, lights a cigarette, and carries on with his crossword.`n");
                            rawoutput("<div align='center'><form action='login.php' method='POST'>");
                            rawoutput("<input name='name' value=\"{$name}\" type='hidden'>");
                            rawoutput("<input name='password' value=\"{$pass1}\" type='hidden'>");
                            $click = translate_inline("Venture into Improbable Island!");
                            rawoutput("<input type='submit' class='button' value='{$click}'>");
                            rawoutput("</form></div>");
                            output_notl("`n");
                            savesetting("newestplayer", $row['acctid']);
                        }
                    }
                } else {
                    output("Whoops!  Did you use the back and/or forward buttons?  It looks like your account is already set up.  Head back to the home page and log yourself in!");
                    addnav("D'oh!");
                    addnav("Back to the homepage", "home.php");
                }
            }
            break;
    }
    if ($name) {
        addnav("Character Information");
        addnav(array("Character name: %s", $name), "");
        if (httpget('op') != 1 && httpget('op') != 0) {
            if ($sex) {
                addnav("Gender: Female", "");
            } else {
                if (isset($sex)) {
                    addnav("Gender: Male", "");
                }
            }
            if ($email) {
                addnav(array("E-mail address: %s", $email), "");
            }
        }
    }
    page_footer();
    return true;
}