function addTicket($sujet, $corps, $cat, $notify) { global $lvlUser, $nuked, $user; if (is_nan($cat) or is_null(getCatName($cat))) { ?> <div style="text-align:center;"><h2><?php echo _UNKNCAT; ?> </h2></div><?php redirect("index.php?file=Support", 3); } else { if (empty($sujet) or empty($corps)) { ?> <div style="text-align:center;"><h2><?php echo _UNKSUJETCORPS; ?> </h2></div><?php redirect("index.php?file=Support", 3); } else { $time = time(); $sql = mysql_query("INSERT INTO " . mysql_real_escape_string($nuked["prefix"]) . "_support_threads (titre, date, closed, auteur, auteur_id, cat_id, notify) VALUES ('" . mysql_real_escape_string(secu_html(html_entity_decode($sujet, ENT_QUOTES))) . "', '" . $time . "', '0', '" . mysql_real_escape_string(secu_html(html_entity_decode($user[2], ENT_QUOTES))) . "', '" . mysql_real_escape_string($user[0]) . "', '" . mysql_real_escape_string($cat) . "', '" . $notify . "') "); if (!$sql) { ?> <div style="text-align:center;"><h2><?php echo _ERREUR . " " . mysql_error($sql); ?> </h2></div><?php } else { $sql = mysql_query("SELECT id FROM " . mysql_real_escape_string($nuked["prefix"]) . "_support_threads WHERE date = '" . $time . "' AND closed = '0' AND auteur_id = '" . $user[0] . "' LIMIT 0,1 "); $sql = mysql_fetch_assoc($sql); if ($sql) { reply($sql["id"], $corps, 1); } else { die(_ERREUR); } ?> <div style="text-align:center;"> <h2><?php echo _SUPPORT; ?> </h2> <h3><?php echo $thread["titre"]; ?> </h3> <br /><br /> <?php echo _TICKETSUCCESS; ?> <br /><br /><a href="javascript:history.back()"><b>[ <?php echo _BACK; ?> ]</b></a><br /> </div> <?php redirect("javascript:history.back()", 2); } } } }
function field_form($NEW_FIELD, $prams, $form_id) { if ($_REQUEST['save'] == '' && $_REQUEST[field_id] != '' && $prams['error'] == '') { // load in the values //echo "loading values...<br>"; $sql = "SELECT *, t2.field_comment AS FCOMMENT, t2.field_label AS LABEL, t2.error_message AS ERRMSG FROM form_fields AS t1, form_field_translations AS t2 WHERE t1.field_id=t2.field_id AND lang='" . $_SESSION['MDS_LANG'] . "' AND t1.field_id='" . $_REQUEST['field_id'] . "'"; //echo $sql; $result = mysql_query($sql) or die(mysql_error()); $prams = mysql_fetch_array($result, MYSQL_ASSOC); $prams['field_comment'] = $prams['FCOMMENT']; $prams['field_label'] = $prams['LABEL']; $prams['error_message'] = $prams['ERRMSG']; //echo "fieldc:".$prams['field_comment']; } else { $prams['field_id'] = $_REQUEST[field_id]; $prams['form_id'] = $_REQUEST[form_id]; $prams['field_label'] = $_REQUEST[field_label]; $prams['field_sort'] = $_REQUEST[field_sort]; $prams['field_type'] = $_REQUEST[field_type]; $prams['is_required'] = $_REQUEST[is_required]; $prams['display_in_list'] = $_REQUEST[display_in_list]; $prams['reg_expr'] = $_REQUEST[reg_expr]; $prams['error_message'] = $_REQUEST[error_message]; $prams['field_init'] = $_REQUEST[field_init]; $prams['field_width'] = $_REQUEST[field_width]; $prams['field_height'] = $_REQUEST[field_height]; $prams['is_in_search'] = $_REQUEST[is_in_search]; $prams['template_tag'] = $_REQUEST[template_tag]; $prams['section'] = $_REQUEST[section]; $prams['list_sort_order'] = $_REQUEST[list_sort_order]; $prams['search_sort_order'] = $_REQUEST[search_sort_order]; $prams['field_comment'] = $_REQUEST[field_comment]; $prams['is_hidden'] = $_REQUEST[is_hidden]; $prams['is_anon'] = $_REQUEST[is_anon]; $prams['is_blocked'] = $_REQUEST[is_blocked]; $prams['is_prefill'] = $_REQUEST[is_prefill]; $prams['multiple_sel_all'] = $_REQUEST[multiple_sel_all]; $prams['category_init_id'] = $_REQUEST[category_init_id]; $prams['is_cat_multiple'] = $_REQUEST[is_cat_multiple]; $prams['cat_multiple_rows'] = $_REQUEST[cat_multiple_rows]; } ?> <?php if ($prams['template_tag'] == '') { // try to get template tag from the database (It could be blank because it was reserved) $sql = "SELECT * FROM form_fields AS t1, form_field_translations AS t2 WHERE t1.field_id=t2.field_id AND lang='" . $_SESSION['MDS_LANG'] . "' AND t1.field_id='" . $_REQUEST['field_id'] . "'"; $temp_result = mysql_query($sql) or die(mysql_error()); $temp_row = mysql_fetch_array($temp_result, MYSQL_ASSOC); $prams['template_tag'] = $temp_row['template_tag']; } if (is_reserved_template_tag($prams['template_tag'])) { $disabled = " disabled "; } ?> <form method="POST" name="form2" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?> " method="post" > <input type="hidden" name="form_id" value="<?php echo $form_id; ?> "/> <input type="hidden" name="NEW_FIELD" value="<?php echo $_REQUEST[NEW_FIELD]; ?> "/> <input type="hidden" name="field_id" value="<?php echo $prams[field_id]; ?> "/> <input type="hidden" name="mode" value="<?php echo $_REQUEST['mode']; ?> "/> <table border="0" cellSpacing="1" cellPadding="3" bgColor="#d9d9d9" > <tr> <td colspan="2"><?php if ($NEW_FIELD == 'NO') { echo "<font face='Arial' size='2'><b>[EDIT FIELD]</b></font>"; } else { echo "<font face='Arial' size='2'><b>[ADD NEW FIELD]</b></font>"; } ?> <br><input class="form_submit_button" type="submit" value="Save" name="save"><?php if ($NEW_FIELD == 'NO') { ?> <input type="submit" value="Delete" name="delete" onClick="return confirmLink(this, 'Delete this field, are you sure?')"><?php } //echo "** ** *** ".$_REQUEST['allow_anyway']; if ($_REQUEST['allow_anyway'] != '') { echo "<br><input type='checkbox' name='do_alter'><font color='red'>Change the field's Database Type</font> (This will delete any previous data stored in the field)"; } ?> </td> </tr> <tr bgColor="#ffffff"> <td><font face="Arial" size="2"><b>Field label</b></font></td> <td> <input type="text" name="field_label" size="27" value="<?php echo $prams[field_label]; ?> " /></td> </tr> <tr bgcolor="#ffffff"> <td><font face="Arial" size="2" ><b>Type<font color="#ff0000"><b>*</b></font></b></font></td> <td><select size="5" name="field_type" > <option value="BLANK" <?php if ($prams[field_type] == 'BLANK') { echo " selected "; } ?> >Blank Space</option> <option value="CATEGORY" <?php if ($prams[field_type] == 'CATEGORY') { echo " selected "; } ?> >Category</option> <option value="CHECK" <?php if ($prams[field_type] == 'CHECK') { echo " selected "; } ?> >Check Boxes</option> <option value="DATE" <?php if ($prams[field_type] == 'DATE') { echo " selected "; } ?> >Date</option> <!--<option value="DATE_CAL" <?php if ($prams[field_type] == 'DATE_CAL') { echo " selected "; } ?> >Date - Calendar</option>--> <!--<option value="FILE" <?php if ($prams[field_type] == 'FILE') { echo " selected "; } ?> >File</option>--> <option value="IMAGE" <?php if ($prams[field_type] == 'IMAGE') { echo " selected "; } ?> >Image</option> <?php //if ($form_id==1) { // HTML editor is for job posts only. ?> <option value="EDITOR" <?php if ($prams[field_type] == 'EDITOR') { echo " selected "; } ?> >HTML Editor</option> <?php // } ?> <option value="MSELECT" <?php if ($prams['field_type'] == 'MSELECT') { echo " selected "; } ?> >Multiple Select</option> <option value="NOTE" <?php if ($prams['field_type'] == 'NOTE') { echo " selected "; } ?> >Note</option> <option value="RADIO" <?php if ($prams['field_type'] == 'RADIO') { echo " selected "; } ?> >Radio Buttons</option> <option value="SEPERATOR" <?php if ($prams['field_type'] == 'SEPERATOR') { echo " selected "; } ?> >Seperator</option> <option value="SELECT" <?php if ($prams['field_type'] == 'SELECT') { echo " selected "; } ?> >Single Select</option> <?php if ($form_id == 2) { // skill matrix is for resumes only. ?> <!--<option value="SKILL_MATRIX" <?php if ($prams['field_type'] == 'SKILL_MATRIX') { echo " selected "; } ?> >Skill Matrix</option>--> <?php } ?> <option value="TEXTAREA" <?php if ($prams[field_type] == 'TEXTAREA') { echo " selected "; } ?> >Text Editor</option> <option value="TEXT" <?php if ($prams[field_type] == 'TEXT') { echo " selected "; } ?> >Text Field</option> </select></td> </tr> <tr bgcolor="#ffffff"> <td><font face="Arial" size="2"><b>Initial Value</b></font></td> <td> <input type="text" name="field_init" value="<?php echo $prams[field_init]; ?> " size="3"/><font size='2'> (Default value for text fields, can be left blank.) </font></td> </tr> <!-- tr bgcolor="#ffffff"> <td><font face="Arial" size="2"><b>Sort order<font color="#ff0000"><b>*</b></font></b></font></td> <td> <input type="text" name="field_sort" value="<?php echo $prams[field_sort]; ?> " size="3"/><font size='2'> (1=first, 2=2nd, etc) </font></td> </tr--> <input type="hidden" name="section" value='1'> <!-- <tr bgcolor="#ffffff"> <td><font face="Arial" size="2"><b>Section<font color="#ff0000"><b>*</b></font></b></font></td> <td> <select name="section"> <option value='1' <?php if ($prams[section] == '1') { echo " selected "; } ?> >1</option> <option value='2' <?php if ($prams[section] == '2') { echo " selected "; } ?> >2</option> <?php if ($form_id < 4) { ?> <option value='3' <?php if ($prams[section] == '3') { echo " selected "; } ?> >3</option> <?php } ?> </select> --> </td> </tr> <tr bgColor="#eaeaea"> <td colspan="2">Validation (only required fields are validated)</td> </tr> <tr bgcolor="#ffffff"> <td><font face="Arial" size="2"><b>Is Required?</b></font></td> <td><input type="checkbox" name="is_required" value="Y" <?php if ($prams[is_required] == 'Y') { echo " checked "; } ?> ></td> </tr> <tr bgcolor="#ffffff"> <td><font face="Arial" size="2"><b>Type of check</b></font></td> <td> <select name="reg_expr"> <option value="" <?php if ($prams[reg_expr] == '') { echo " selected "; } ?> >[Select]</option> <option value="not_empty" <?php if ($prams[reg_expr] == 'not_empty') { echo " selected "; } ?> >Must not be empty</option> <option value="email" <?php if ($prams[reg_expr] == 'email') { echo " selected "; } ?> >Valid Email</option> <option value="date" <?php if ($prams[reg_expr] == 'date') { echo " selected "; } ?> >Valid Date</option> <option value="url" <?php if ($prams[reg_expr] == 'url') { echo " selected "; } ?> >Valid URL</option> </select> </td> </tr> <tr bgcolor="#ffffff"> <td><font face="Arial" size="2"><b>Error message</b></font></td> <td> <input type="text" name="error_message" size="27" value="<?php echo $prams[error_message]; ?> "/>(The reason for the error. Eg: <i>was not filled in</i> or <i>was invalid</i> for email.)</td> </tr> <tr bgColor="#eaeaea"> <td colspan="2">Display</td> </tr> <!-- tr bgcolor="#ffffff"> <td><font face="Arial" size="2"><b>Display in list?</b></font></td> <td><input type="checkbox" name="display_in_list" value="Y" <?php if ($prams[display_in_list] == 'Y') { echo " checked "; } ?> > <font face="Arial" size="2">Column Order:</font><input type="text" name="list_sort_order" value="<?php echo $prams[list_sort_order]; ?> " size="2"></td> </tr --> <!-- <tr bgcolor="#ffffff"> <td><font face="Arial" size="2"><b>Is on search form?</b></font></td> <td><input type="checkbox" name="is_in_search" value="Y" <?php if ($prams[is_in_search] == 'Y') { echo " checked "; } ?> > <font face="Arial" size="2">Sort Order:</font><input type="text" name="search_sort_order" value="<?php echo $prams[search_sort_order]; ?> " size="2"/>(1=first)</td> </tr> --> <tr bgcolor="#ffffff"> <td><font face="Arial" size="2"><b>Template Tag <font color="#ff0000"><b>*</b></font></b></font></td> <td> <input type="text" name="template_tag" <?php echo $disabled; ?> size="20" value="<?php echo $prams[template_tag]; ?> "> (a unique identifier for this field)</td> </tr> <tr bgColor="#eaeaea"> <td colspan="2">Parameters</td> </tr> <tr bgcolor="#ffffff"> <td><font face="Arial" size="2"><b>Width</b></font></td> <td> <input type="text" name="field_width" size="3" value="<?php echo $prams[field_width]; ?> "/></td> </tr> <tr bgcolor="#ffffff"> <td><font face="Arial" size="2"><b>Height</b></font></td> <td> <input type="text" name="field_height" size="3" value="<?php echo $prams[field_height]; ?> "/><font size='2'>(for textareas or multiple selects)</font></td> </tr> <!-- <tr bgcolor="#ffffff"> <td><font face="Arial" size="2"><b>Is hidden from website?</b></font> </td> <td><input type="checkbox" name="is_hidden" <?php if ($prams[is_hidden] == 'Y') { echo " checked "; } ?> value="Y"><font size='2'>Is hidden from website. Only Administrators can view this field.</font></td> </tr> <?php if ($form_id == 2) { // only resumes ?> <tr bgcolor="#ffffff"> <td><font face="Arial" size="2"><b>Can be anonymous?</b></font> </td> <td><input type="checkbox" name="is_anon" <?php if ($prams[is_anon] == 'Y') { echo " checked "; } ?> value="Y"><font size='2'>(Can be anonymous on resumes. If this feature is enabled, users can hide this field and reveal after responding to Employer's request.)</font></td> </tr> <?php } ?> <?php if ($form_id == 2) { // only resumes ?> <tr bgcolor="#ffffff"> <td><font face="Arial" size="2"><b>Is blocked?</b></font> </td> <td><input type="checkbox" name="is_blocked" <?php if ($prams[is_blocked] == 'Y') { echo " checked "; } ?> value="Y"><font size='2'>(Can be subjected to blocking. Blocking options are set in Main Config. )</font></td> </tr> <?php } ?> <?php if ($form_id == 1) { // only job posts can be pre-filled ?> <tr bgcolor="#ffffff"> <td><font face="Arial" size="2"><b>Pre-fill?</b></font> </td> <td><input type="checkbox" name="is_prefill" <?php if ($prams[is_prefill] == 'Y') { echo " checked "; } ?> value="Y"><font size='2'>(Attempt to pre-fill the field with data from the previous record)</font></td> </tr> --> <?php } ?> <tr bgcolor="#ffffff"> <td><font face="Arial" size="2"><b>Field Comment</b></font> </td> <td><input type="text" name="field_comment" value="<?php echo $prams['field_comment']; ?> "/><font size='2'>(Comment to be displayed next to the field, like the one you are reading now.)</font></td> </tr> <tr bgcolor="#ffffff"> <td><font face="Arial" size="2"><b>Category</b></font></td> <td> <input type="button" onclick="window.open('selectcat_window.php?field_id=<?php echo $row[field_id]; ?> &form_id=<?php echo $form_id; ?> ', '', 'toolbar=no,scrollbars=yes,location=no,statusbar=no,menubar=no,resizable=1,width=500,height=500,left = 50,top = 50');return false;" value="Select Category..." > <input type="hidden" name="category_init_id" value="<?php echo $prams[category_init_id]; ?> " size="3"/><font size='2'> (If field is a category, select the initial category) </font> Currently Selected:<br><input type="text" disabled name="category_init_name" value="<?php echo getCatName($prams[category_init_id]) . " (#" . $prams[category_init_id] . ")"; ?> " size="30"/><br> <input type="checkbox" name="is_cat_multiple" <?php if ($prams[is_cat_multiple] == 'Y') { echo " checked "; } ?> value="Y"><font size='2'>Multiple Categories can be selected when searching, with <input type="text" value="<?php echo $prams['cat_multiple_rows']; ?> " size='1' name='cat_multiple_rows'> rows showing on the search form.</font> And, <input type="checkbox" name="multiple_sel_all" <?php if ($prams[multiple_sel_all] == 'Y') { echo " checked "; } ?> value="Y"> the first option selects all. </td> </tr> </table> <input class="form_submit_button" type="submit" value="Save" name="save"> </form> <?php }