Ejemplo n.º 1
0
function JB_save_sitemap_data()
{
    $main_priority = stripslashes($_REQUEST['main_priority']);
    $jobs_priority = stripslashes($_REQUEST['jobs_priority']);
    $emp_priority = stripslashes($_REQUEST['emp_priority']);
    $cat_priority = stripslashes($_REQUEST['cat_priority']);
    $extra_urls = stripslashes($_REQUEST['extra_urls']);
    $jobs_max = stripslashes($_REQUEST['jobs_max']);
    $sql = "REPLACE INTO jb_variables (`key`, `val`) VALUES ('SMAP_MAIN_PRIORITY', '" . JB_escape_sql($main_priority) . "') ";
    JB_mysql_query($sql);
    $sql = "REPLACE INTO jb_variables (`key`, `val`) VALUES ('SMAP_JOBS_PRIORITY', '" . JB_escape_sql($jobs_priority) . "') ";
    JB_mysql_query($sql);
    $sql = "REPLACE INTO jb_variables (`key`, `val`) VALUES ('SMAP_EMP_PRIORITY', '" . JB_escape_sql($emp_priority) . "') ";
    JB_mysql_query($sql);
    $sql = "REPLACE INTO jb_variables (`key`, `val`) VALUES ('SMAP_CAT_PRIORITY', '" . JB_escape_sql($cat_priority) . "') ";
    JB_mysql_query($sql);
    $sql = "REPLACE INTO jb_variables (`key`, `val`) VALUES ('SMAP_JOBS_MAX', '" . JB_escape_sql($jobs_max) . "') ";
    JB_mysql_query($sql);
    if ($extra_urls != '') {
        $lines = explode("\n", $extra_urls);
    }
    $sql = "DELETE FROM sitemaps_urls";
    JB_mysql_query($sql);
    if (sizeof($lines) > 0) {
        foreach ($lines as $line) {
            $values = preg_split('#[\\s]#', $line);
            if ($values[0] != '') {
                $sql = "REPLACE INTO sitemaps_urls (`url`, `priority`, `changefreq`) VALUES ('" . JB_escape_sql($values[0]) . "', '" . JB_escape_sql($values[1]) . "', '" . JB_escape_sql($values[2]) . "') ";
                //echo $sql.'<br>';
                JB_mysql_query($sql);
            }
        }
    }
}
Ejemplo n.º 2
0
    function config_form()
    {
        //
        ?>
		<form method="post" action="<?php 
        echo htmlentities($_SERVER['PHP_SELF']);
        ?>
">
		<table border="0" cellpadding="5" cellspacing="2" style="border-style:groove" id="AutoNumber1" width="100%" bgcolor="#FFFFFF">
		
		<tr>
			<td  colspan="2" bgcolor="#e6f2ea">
				<b>Jobs Filler - Configuration</b></td>
			
		</tr>

		<tr>
			<td  width="20%" bgcolor="#e6f2ea">
				<b>API key</b></td>
			<td  bgcolor="#e6f2ea"><input size="20" type="text" name='id' value="<?php 
        echo $this->config['id'];
        ?>
"> (Your api.jamit.com key, get it from http://api.jamit.com)
			</td>
		</tr>
		<!--
		<tr>
			<td  width="20%" bgcolor="#e6f2ea">
				<b>Country</b></td>
			<td  bgcolor="#e6f2ea"><select  name="c" value="<?php 
        echo $this->config['c'];
        ?>
">
			<option value="us" <?php 
        if ($this->config['c'] == "us") {
            echo ' selected ';
        }
        ?>
>US</option>
			<option value="ca" <?php 
        if ($this->config['c'] == "ca") {
            echo ' selected ';
        }
        ?>
>Canada</option>
			<option value="gb" <?php 
        if ($this->config['c'] == "gb") {
            echo ' selected ';
        }
        ?>
>Great Britain</option>
			<option value="de" <?php 
        if ($this->config['c'] == "de") {
            echo ' selected ';
        }
        ?>
>Germany</option>
			<option value="fr" <?php 
        if ($this->config['c'] == "fr") {
            echo ' selected ';
        }
        ?>
>France</option>
			<option value="es" <?php 
        if ($this->config['c'] == "es") {
            echo ' selected ';
        }
        ?>
>Spain</option>
			<option value="in" <?php 
        if ($this->config['c'] == "in") {
            echo ' selected ';
        }
        ?>
>India</option>
			<option value="ie" <?php 
        if ($this->config['c'] == "ie") {
            echo ' selected ';
        }
        ?>
>Ireland</option>
			<option value="nl" <?php 
        if ($this->config['c'] == "nl") {
            echo ' selected ';
        }
        ?>
>Netherlands</option>
			</select>
			</td>
		</tr>
		-->
		<tr>
			<td  width="20%" bgcolor="#e6f2ea">
				<b>Sources</b></td>
			<td  bgcolor="#e6f2ea">

		<?php 
        $this->api_cache_flush(1);
        // flush older than one day
        $params = array('pub' => $this->config['id']);
        $countries = $this->api_call_cached('get_country_list', $params);
        $params = array('pub' => $this->config['id']);
        $sources = $this->api_call_cached('get_source_list', $params);
        $params = array('pub' => $this->config['id']);
        $types = $this->api_call_cached('get_type_list', $params);
        echo '<p><b>Countries:</b> ';
        $pipe = '';
        if ('ALL' == $this->config['cnt']) {
            $sel = ' checked ';
        } else {
            $sel = '';
        }
        echo '<input ' . $sel . 'type="radio" name="cnt" value="ALL"> All, &nbsp;';
        foreach ($countries as $c) {
            //if (in_array($c, $this->config['cnt'])) {
            if ($c == $this->config['cnt']) {
                $sel = ' checked ';
            } else {
                $sel = '';
            }
            //echo $pipe.'<input '.$sel.' type="checkbox" name="cnt[]" value="'.$c.'"> '.$c;
            echo $pipe . '<input ' . $sel . ' type="radio" name="cnt" value="' . $c . '"> ' . $c;
            $pipe = ', &nbsp;';
        }
        echo '</p>';
        echo '<p><b>Sources:</b> ';
        $pipe = '';
        if ('ALL' == $this->config['src']) {
            $sel = ' checked ';
        } else {
            $sel = '';
        }
        echo '<input ' . $sel . 'type="radio" name="src" value="ALL"> All, &nbsp;';
        foreach ($sources as $s) {
            if ($s == $this->config['src']) {
                //if (in_array($s, $this->config['src'])) {
                $sel = ' checked ';
            } else {
                $sel = '';
            }
            //echo $pipe.'<input '.$sel.'type="checkbox" name="src[]" value="'.$s.'"> '.$s;
            echo $pipe . '<input ' . $sel . 'type="radio" name="src" value="' . $s . '"> ' . $s;
            $pipe = ', &nbsp;';
        }
        echo '</p>';
        echo '<p><b>Job Types:</b> ';
        $pipe = '';
        if ('ALL' == $this->config['typ']) {
            $sel = ' checked ';
        } else {
            $sel = '';
        }
        echo '<input ' . $sel . 'type="radio" name="typ" value="ALL"> All, &nbsp;';
        foreach ($types as $c) {
            //if (in_array($c, $this->config['cnt'])) {
            if ($c == $this->config['typ']) {
                $sel = ' checked ';
            } else {
                $sel = '';
            }
            //echo $pipe.'<input '.$sel.' type="checkbox" name="cnt[]" value="'.$c.'"> '.$c;
            echo $pipe . '<input ' . $sel . ' type="radio" name="typ" value="' . $c . '"> ' . $c;
            $pipe = ', &nbsp;';
        }
        echo '</p>';
        ?>
			</td>
		</tr>

				<tr>
			<td  width="20%" bgcolor="#e6f2ea">
				<b>Default Keyword(s)</b></td>
			<td  bgcolor="#e6f2ea"><input size="20" type="text" name='k' value="<?php 
        echo $this->config['k'];
        ?>
"> (By default the terms are AND'ed.)
			</td>
		</tr>
		<tr>
			<td  width="20%" bgcolor="#e6f2ea">
				<b>Default City</b></td>
			<td  bgcolor="#e6f2ea"><input size="20" type="text" name='l' value="<?php 
        echo $this->config['l'];
        ?>
"> (City is optional. e.g. Sydney)
			</td>
		</tr>
		<tr>
			<td  width="20%" bgcolor="#e6f2ea">
				<b>Search Field(s) for Keyword</b></td>
			<td  bgcolor="#e6f2ea">
			<select name="k_tag[]" multiple size="5">
				<!--<option value="">[Select]</option>-->
				<?php 
        echo $this->echo_tt_options($this->config['k_tag']);
        ?>
				</select> (The selected search parameters will be combined and used as the keywords for the search query sent to Indeed. If not selected or no keyword is searched, then it will default to the Main Keyword. Hold down the Ctrl key to select/unselect multiple items)
			</td>
		</tr>
		<tr>
			<td  width="20%" bgcolor="#e6f2ea">
				<b>Search Field(s) for Location</b></td>
			<td  bgcolor="#e6f2ea">
			<select name="l_tag[]" multiple size="5" >
				<!--<option value="">[Select]</option>-->
				<?php 
        echo $this->echo_tt_options($this->config['l_tag']);
        ?>
			</select> (The selected search parameters will be combined and used as the location for the search query sent to Indeed. If not selected or no location is searched, then it will default to the Main Location. Hold down the Ctrl key to select/unselect multiple items)
			</td>
		</tr>
		<td colspan="2" bgcolor="#e6f2ea">

			<table width="100%" border="0" cellSpacing="1" cellPadding="3" bgColor="#d9d9d9"  >

			<tr bgcolor="#e6f2ea">

					<h4>Source to Local field mappings</h4>

					<td width="10%" valign="top">
					<b>Local Fields</b> - Fields your job posting form. Fields marked with * are required.
					</td>

					<td valign="top">
					<b>Source Fields</b> - These fields are the original fields that are coming in from the feed
					</td>

				</tr>
			<?php 
        require_once "../include/posts.inc.php";
        $PForm =& JB_get_DynamicFormObject(1, 'global');
        $params = array('pub' => $this->config['id']);
        $in_fields = $this->api_call('get_field_list', $params);
        sort($in_fields);
        $sql = "SELECT *, t1.field_label AS FLABEL FROM form_field_translations as t1, form_fields as t2 WHERE t2.form_id=1 AND t2.field_id=t1.field_id AND field_type!='BLANK' AND field_type != 'SEPERATOR' AND lang='" . JB_escape_sql($_SESSION['LANG']) . "' order by section asc, field_sort asc  ";
        $result = jb_mysql_query($sql);
        while ($field = mysql_fetch_array($result, MYSQL_ASSOC)) {
            if ($field['template_tag'] == 'EMAIL') {
                continue;
            }
            ?>

				

				<tr bgcolor="e6f2ea">

					<td width="10%" nowrap valign="top">
						<span style="font-weight: bold; font-size: 10pt"><?php 
            echo $field['field_label'];
            if ($field['is_required'] == 'Y') {
                echo '<span style="color:red; font-size:18pt">*</span>';
            }
            ?>
</span> <?php 
            echo $field['field_type'] . ' (#' . $field['field_id'];
            ?>
)
					</td>

					<td >
						&lt;---<select <?php 
            if ($this->config['map'][$field['field_id']]) {
                ?>
 style="color:#008080; font-weight: bold" <?php 
            }
            ?>
 style="font-size: 12pt" type="select" name="map[]">
						<option value="" style="color:#008080; font-weight: bold">[Select Field]</option>
						<?php 
            foreach ($in_fields as $in_key => $in_field) {
                if ($this->config['map'][$field['field_id']] == $in_field) {
                    $sel = ' selected ';
                } else {
                    $sel = '';
                }
                echo '<option style="color:#008080; font-weight: bold" ' . $sel . 'value="' . $field['field_id'] . '=' . $in_field . '">' . $in_field . '</option>' . "\n";
            }
            ?>
						</select>
					</td>
				</tr>

			<?php 
        }
        ?>
			</table>


		</td>

		<tr>
			<td  width="20%" bgcolor="#e6f2ea">
				<b>Ad Code</b></td>
			<td  bgcolor="#e6f2ea">
				<small>Paste in the ad code HTML here, eg. Google Adsense</small>
				<textarea rows="10" style="width:100%" name="ad"><?php 
        echo htmlentities($this->config['ad']);
        ?>
</textarea>
			</td>
		</tr>
	<!--	
		<tr>
			<td  width="20%" bgcolor="#e6f2ea">
				<b>Channel</b></td>
			<td  bgcolor="#e6f2ea"><input size="15" type="text" name='ch' value="<?php 
        echo $this->config['ch'];
        ?>
"> (Optional. Used to track performance if you have more than one web site. Add a new channel in your Indeed publisher account by going to the XML Feed page)
			</td>
		</tr>
		
	--><!--	<tr>
			<td  width="20%" bgcolor="#e6f2ea">
				<b>Sort</b></td>
			<td  bgcolor="#e6f2ea"><input type="radio" name="so" <?php 
        if ($this->config['so'] == 'date') {
            echo ' checked ';
        }
        ?>
 value="date"> By Date Posted (default)<br>
			<input type="radio" name="so" <?php 
        if ($this->config['so'] == 'relevance') {
            echo ' checked ';
        }
        ?>
 value="relevance"> By Relevance<br>
			<input type="radio" name="so" <?php 
        if ($this->config['so'] == 'custom') {
            echo ' checked ';
        }
        ?>
 value="custom"> By relevance + Date Sorted (Jamit does additional sorting so that the relevant results are sorted by date. CPU intensive)
			</td>
		</tr>
	--><!--	<tr>
			<td  width="20%" bgcolor="#e6f2ea">
				<b>Site Type</b></td>
			<td  bgcolor="#e6f2ea"><input type="radio" name="st" <?php 
        if ($this->config['st'] == 'jobsite') {
            echo ' checked ';
        }
        ?>
 value="jobsite"> Job Site: To show jobs only from job board sites<br>
			<input type="radio" name="st" <?php 
        if ($this->config['st'] == 'employer') {
            echo ' checked ';
        }
        ?>
 value="employer">Show jobs only direct from employer sites<br>
			<input type="radio" name="st" <?php 
        if ($this->config['st'] == '') {
            echo ' checked ';
        }
        ?>
 value="">Show from all<br>
			</td>
		</tr>
	--><!--	<tr>
			<td  width="20%" bgcolor="#e6f2ea">
				<b>Job Type</b></td>
			<td  bgcolor="#e6f2ea">
			<input type="radio" name="jt" <?php 
        if ($this->config['jt'] == 'fulltime') {
            echo ' checked ';
        }
        ?>
 value="fulltime"> Get Full Time jobs<br>
			<input type="radio" name="jt" <?php 
        if ($this->config['jt'] == 'parttime') {
            echo ' checked ';
        }
        ?>
 value="parttime"> Get Part Time jobs<br>
			<input type="radio" name="jt" <?php 
        if ($this->config['jt'] == 'contract') {
            echo ' checked ';
        }
        ?>
 value="contract"> Get Contract jobs<br>
			<input type="radio" name="jt" <?php 
        if ($this->config['jt'] == 'internship') {
            echo ' checked ';
        }
        ?>
 value="internship"> Get Intership jobs<br>
			<input type="radio" name="jt" <?php 
        if ($this->config['jt'] == 'temporary') {
            echo ' checked ';
        }
        ?>
 value="temporary"> Get temporary jobs<br>
			<input type="radio" name="jt" <?php 
        if ($this->config['jt'] == '') {
            echo ' checked ';
        }
        ?>
 value=""> Get all types of jobs
			</td>
		</tr>
	--><!--	<tr>
			<td  width="20%" bgcolor="#e6f2ea">
				<b>Radius</b></td>
			<td  bgcolor="#e6f2ea"><input size="3" type="text" name='r' value="<?php 
        echo $this->config['r'];
        ?>
"> Distance from search location ("as the crow flies"). Default is 25.
			</td>
		</tr>
		--><!--<tr>
			<td  width="20%" bgcolor="#e6f2ea">
				<b>From Age</b></td>
			<td  bgcolor="#e6f2ea"><input size="3" type="text" name='age' value="<?php 
        echo $this->config['age'];
        ?>
"> (Number of days back to search. Default/Max is 30)
			</td>
		</tr>
--><!--
		<tr>
			<td  width="20%" bgcolor="#e6f2ea">
				<b>highlight</b></td>
			<td  bgcolor="#e6f2ea"><input type="radio" name="h" <?php 
        if ($this->config['h'] == '1') {
            echo ' checked ';
        }
        ?>
 value="1"> Yes, highlight keywords<br>
			<input type="radio" name="h" <?php 
        if ($this->config['h'] == '0') {
            echo ' checked ';
        }
        ?>
 value="0"> No)
			</td>
		</tr>
	--><!--
		<tr>
			<td  width="20%" bgcolor="#e6f2ea">
				<b>Filter Results</b></td>
			<td  bgcolor="#e6f2ea"><input type="radio" name="f" <?php 
        if ($this->config['f'] == '1') {
            echo ' checked ';
        }
        ?>
 value="1"> Yes, filter duplicate results<br>
			<input type="radio" name="f" <?php 
        if ($this->config['f'] == '0') {
            echo ' checked ';
        }
        ?>
 value="0"> No
			</td>
		</tr>
	--><!--
		<tr>
			<td  width="20%" bgcolor="#e6f2ea">
				<b>How to Back-fill?</b></td>
			<td  bgcolor="#e6f2ea">
			<input type="radio" name="fill" <?php 
        if ($this->config['fill'] == 'S') {
            echo ' checked ';
        }
        ?>
 value="S"> Stop after filling the first page<br>
			<input type="radio" name="fill" <?php 
        if ($this->config['fill'] == 'C') {
            echo ' checked ';
        }
        ?>
 value="C"> Continue to futher pages (if more results are available)
			</td>
		</tr>
-->
		

		
		<tr><td colspan="2">Advanced Settings</td>
		</tr>


	<tr>
      <td  bgcolor="#e6f2ea"><font face="Verdana" size="1">Use cURL (Y/N)</font></td>
      <td  bgcolor="#e6f2ea"><font face="Verdana" size="1">
       <br>
	   <?php 
        if (!function_exists('curl_init')) {
            echo ' Note: Your host does not suppor cURL. Options currently disabled <br>';
        }
        ?>
	  <input type="radio" name="curl" value="N" <?php 
        if (!function_exists('curl_init')) {
            echo ' disabled ';
        }
        ?>
 <?php 
        if ($this->config['curl'] == 'N') {
            echo " checked ";
        }
        ?>
 >No - Normally this option is best<br>
	  <input type="radio" name="curl" value="Y" <?php 
        if (!function_exists('curl_init')) {
            echo ' disabled ';
        }
        ?>
 <?php 
        if ($this->config['curl'] == 'Y') {
            echo " checked ";
        }
        ?>
 >Yes - If your hosting company blocked fsockopen() and has cURL, then use this option</font></td>
    </tr>

	<tr>
      <td  bgcolor="#e6f2ea"><font face="Verdana" size="1">cURL 
      Proxy URL</font></td>
      <td  bgcolor="#e6f2ea"><font face="Verdana" size="1">
      <input <?php 
        if (!function_exists('curl_init')) {
            echo ' disabled ';
        }
        ?>
 type="text" name="proxy" size="50" value="<?php 
        echo $this->config['proxy'];
        ?>
">Leave blank if your server does not need one. Contact your hosting company if you are not sure about which option to use. For GoDaddy it is: http://proxy.shr.secureserver.net:3128<br></font></td>
    </tr>
		<tr>
			<td  bgcolor="#e6f2ea" colspan="2"><font face="Verdana" size="1"><input type="submit" value="Save">
		</td>
		</tr>
		</table>
		<input type="hidden" name="plugin" value="<?php 
        echo jb_escape_html($_REQUEST['plugin']);
        ?>
">
		<input type="hidden" name="action" value="save">

		</form>
		<?php 
        if ($this->bug_test()) {
            echo "<p><font color='red'>PHP Bug warning: The system detected that your PHP version has a bug in the XML parser. This is not a bug in the Jamit Job Board, but a bug in 'libxml' that comes built in to PHP itself. An upgrade of PHP with the latest version of 'libxml' with  is recommended. This plugin contains a workaround for this bug - so it should still work...</font> For details about the bug, please see <a href='http://bugs.php.net/bug.php?id=45996'>http://bugs.php.net/bug.php?id=45996</a></p> ";
        }
        // check if fsockopen is disabled
        if (stristr(ini_get('disable_functions'), "fsockopen")) {
            JB_pp_mail_error("<p>fsockopen is disabled on this server. You can try to set this plugin to use cURL instead</p>");
        }
        ?>
		<b>Important:</b> After configuring Go here to <a href="p.php?p=JobsFiller&action=kw">Configure Category Keywords</a>
<p>
TROUBLE SHOOTING
<p>
> Keywords do not return any results?
Try your keyword on indeed.com first, before putting them in the job board.
<p>
> Page times out / does not fetch any results?
Your server must be able to make external connections to api.indeed.com
through port 80 (HTTP). This means that fsockopen must be enabled on
your host, and must be allowed to make external connections.
<p>
- I see warning/errors messages saying that 'argument 2' is missing.
This has been reported and can be fixed if you open the include/lists.inc.php
file and locate the following code:
<p>
JBPLUG_do_callback('job_list_data_val', $val, $template_tag);
<p>
and change to:
<p>
JBPLUG_do_callback('job_list_data_val', $val, $template_tag, $a);
<p>
- Can I make the links open in a new window?
<p>
Nope.. Indeed rules are that in order to record the click, it must use their 
onmousedown event to call their javascript, and the javascripts 
prevents the link from opening in a new window.
<p>
- It still does not work
<p>
Please check the requirements - requires Jamit Job Board 3.5.0 or higher
Please also check with your hosting company that your server
is allowed to use fsockopen or Curl
		 <?php 
    }
Ejemplo n.º 3
0
function JB_payment_log_clear_db($module)
{
    $sql = "DELETE FROM payment_log WHERE module='" . JB_escape_sql($module) . "' ";
    $result = JB_mysql_query($sql) or die(mysql_error());
    $sql = "ALTER table payment_log auto_increment = 0; ";
    $result = JB_mysql_query($sql) or die(mysql_error());
}
Ejemplo n.º 4
0
 function generate_search_sql($_SEARCH_INPUT = null)
 {
     global $label;
     // from the languages file.
     if (!is_array($_SEARCH_INPUT)) {
         $_SEARCH_INPUT = $_REQUEST;
         // get the search input that was posted
     }
     JBPLUG_do_callback('generate_search_sql_before', $where_sql, $this->form_id, $_SEARCH_INPUT);
     if ($where_sql) {
         return $where_sql;
     }
     // $where_sql was generated by a plugin
     if ($_SEARCH_INPUT['action'] == 'search') {
         foreach ($this->tag_to_search as $key => $val) {
             $name = $this->tag_to_search[$key]['field_id'];
             switch ($this->tag_to_search[$key]['field_type']) {
                 case 'IMAGE':
                 case 'FILE':
                 case 'YOUTUBE':
                     if ($_SEARCH_INPUT[$name] != '') {
                         $where_sql .= " AND (`" . $name . "`) != '' ";
                     }
                     break;
                 case 'SELECT':
                     if ($_SEARCH_INPUT[$name] != '') {
                         $where_sql .= "  AND (\t`" . $name . "` = '" . JB_escape_sql($_SEARCH_INPUT[$name]) . "') ";
                     }
                     break;
                 case 'CHECK':
                     $tmp = '';
                     $comma = '';
                     ## process all possible options
                     $sql = "SELECT * from codes where field_id='" . JB_escape_sql($name) . "' ";
                     $code_result = JB_mysql_query($sql) or die(mysql_error());
                     $i = 0;
                     while ($code = mysql_fetch_array($code_result, MYSQL_ASSOC)) {
                         $val = $code['field_id'] . "-" . $code['code'];
                         if ($_SEARCH_INPUT[$val] != '') {
                             if ($i > 0) {
                                 $comma = 'OR';
                             }
                             $tmp .= $comma . " `{$name}` LIKE '%" . JB_escape_sql($code['code']) . "%' ";
                             $i++;
                         }
                     }
                     if ($i > 0) {
                         $where_sql .= "  AND (" . $tmp . ") ";
                     }
                     break;
                 case 'MSELECT':
                     $tmp = '';
                     $comma = '';
                     $selected_codes = array();
                     $selected_codes = $_SEARCH_INPUT[$name];
                     for ($i = 0; $i < sizeof($selected_codes); $i++) {
                         if ($i > 0) {
                             $comma = 'OR';
                         }
                         $tmp .= $comma . " `{$name}` LIKE '%" . JB_escape_sql($selected_codes[$i]) . "%' ";
                     }
                     if ($i > 0) {
                         $where_sql .= "  AND (" . $tmp . ") ";
                     }
                     break;
                 case 'CATEGORY':
                     $where_range = '';
                     $range_or = '';
                     //$_SEARCH_INPUT[$name] can either be an array of numbers & string 'all',
                     // or a scalar string all or scalar number
                     if (!is_array($_SEARCH_INPUT[$name]) && trim($_SEARCH_INPUT[$name]) == '') {
                         break;
                     }
                     // init the $search-set & $cat_ids_str as strings
                     // similar to: JB_search_category_tree_for_posts()
                     $search_set = '';
                     if (is_array($_SEARCH_INPUT[$name])) {
                         // if the category is a multiple select!
                         foreach ($_SEARCH_INPUT[$name] as $key => $val) {
                             if (!is_numeric($val) && $val != 'all') {
                                 // validate
                                 break;
                             }
                         }
                         $cat_ids_str = implode(',', $_SEARCH_INPUT[$name]);
                     } else {
                         $cat_ids_str = (int) $_SEARCH_INPUT[$name];
                     }
                     if (strpos($cat_ids_str, 'all') !== false) {
                         // return all categories
                         break;
                         // no need to filter
                     }
                     $sql = "SELECT search_set FROM categories WHERE category_id IN(" . jb_escape_sql($cat_ids_str) . ") ";
                     $result2 = JB_mysql_query($sql) or die(mysql_error());
                     $search_set = $cat_ids_str;
                     // search_set does not include the current category
                     while ($row2 = mysql_fetch_row($result2)) {
                         $search_set .= ',' . $row2[0];
                     }
                     // optimize the search set: remove duplicates & range it
                     $set = explode(',', $search_set);
                     sort($set, SORT_NUMERIC);
                     $prev = '';
                     // this removes duplicates
                     foreach ($set as $key => $val) {
                         if ($val == $prev) {
                             unset($set[$key]);
                         }
                         $prev = $val;
                     }
                     // sort again because after removing
                     // duplicates the keys were like swiss cheeze
                     sort($set, SORT_NUMERIC);
                     // Now this is the fun part!
                     // The code below summarizes the $set array
                     // which is a list of numbers in to rangers
                     for ($i = 0; $i < sizeof($set); $i++) {
                         $start = $set[$i];
                         // 6
                         //$end = $set[$i];
                         for ($j = $i + 1; $j < sizeof($set); $j++) {
                             // advance the array index $j if the sequnce
                             // is +1
                             if ($set[$j - 1] != $set[$j] - 1) {
                                 // is it in sequence
                                 $end = $set[$j - 1];
                                 break;
                             }
                             $i++;
                             $end = $set[$i];
                         }
                         if ($end == '') {
                             $end = $set[$i];
                         }
                         if ($start != $end && $end != '') {
                             $where_range .= " {$range_or}  ((`" . $name . "` >= {$start}) AND (`" . $name . "` <= {$end})) ";
                         } elseif ($start != '') {
                             $where_range .= " {$range_or}  (`" . $name . "` = {$start} ) ";
                         }
                         $start = '';
                         $end = '';
                         $range_or = "OR";
                     }
                     $where_sql .= " AND ({$where_range}) ";
                     break;
                 case 'SKILL_MATRIX':
                     if (trim($_SEARCH_INPUT[$name . 'name']) != '') {
                         if (!is_numeric($_SEARCH_INPUT[$name . 'rating'])) {
                             $_SEARCH_INPUT[$name . 'rating'] = '0';
                         }
                         if (!is_numeric($_SEARCH_INPUT[$name . 'years'])) {
                             $_SEARCH_INPUT[$name . 'years'] = '0';
                         }
                         $where_sql .= " AND t2.name LIKE '" . JB_escape_sql(trim($_SEARCH_INPUT[$name . 'name'])) . "' AND t2.years >= " . JB_escape_sql($_SEARCH_INPUT[$name . 'years']) . " AND t2.rating >= " . JB_escape_sql($_SEARCH_INPUT[$name . 'rating']) . " ";
                     }
                     break;
                 case 'DATE':
                     $day = $_REQUEST[$name . "d"];
                     $month = $_REQUEST[$name . "m"];
                     $year = $_REQUEST[$name . "y"];
                     if ($year != '' && $month != '' && $day != '') {
                         // convert to ISO format
                         $value = "{$year}-{$month}-{$day}";
                         $where_sql .= " AND (`{$name}` >= '" . JB_escape_sql($value) . "') ";
                     }
                     break;
                 case 'DATE_CAL':
                     $value = $_SEARCH_INPUT[$name];
                     if ($value != '') {
                         // convert to ISO format before putting it through a search
                         $value = JB_SCWDate_to_ISODate($value);
                         $where_sql .= " AND (`{$name}` >= '" . JB_escape_sql($value) . " 00:00:00') ";
                     }
                     break;
                 case 'TIME':
                     $value = $_SEARCH_INPUT[$name];
                     $time = strtotime($value);
                     // gmt
                     $time = $time - 3600 * JB_GMT_DIF;
                     $later_time = $time + 3600 * 24;
                     // 24 hours later
                     $where_sql .= " AND ( \n\t\t\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t\t\t`{$name}` > '" . gmdate("Y-m-d H:i:s", $time) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t) \n\t\t\t\t\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t\t\t`{$name}` < '" . gmdate("Y-m-d H:i:s", $later_time) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t)\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t ";
                     break;
                 default:
                     $custom_sql = '';
                     $value = $_SEARCH_INPUT[$name];
                     JBPLUG_do_callback('generate_search_sql', $custom_sql, $this->tag_to_search[$key], $value);
                     if ($custom_sql != '') {
                         $where_sql .= $custom_sql;
                     } else {
                         if ($value != '') {
                             $list = preg_split("/[\\s,]+/", $value);
                             for ($i = 1; $i < sizeof($list); $i++) {
                                 $or .= " AND (`{$name}` like '%" . JB_escape_sql($list[$i]) . "%')  ";
                             }
                             $where_sql .= " AND ((`{$name}` like '%" . JB_escape_sql($list[0]) . "%')  {$or})";
                         }
                     }
                     break;
             }
             // end switch
         }
         // end foreach
     }
     // end serach
     JBPLUG_do_callback('generate_search_sql_after', $where_sql, $this->form_id, $_SEARCH_INPUT);
     return $where_sql;
 }
Ejemplo n.º 5
0
function JB_get_list_template_value($field, $val, $admin, $form_id = 1)
{
    $LM =& JB_get_ListMarkupObject($form_id);
    $Form =& JB_get_DynamicFormObject($form_id);
    // it is assumed that this function is called in 'view' mode
    // the viewer id and type is unknown so null is passed
    if ($Form->process_field_restrictions($field, null, null, $admin)) {
        // Its a restricted field, eg anonymous, blocked or member's only
        return $Form->get_value($field['field_id']);
    }
    switch ($field['field_type']) {
        case 'TIME':
            // convert timestamp to local time zone
            // using the raw value stored in the record
            if ($val != '0000-00-00 00:00:00') {
                $val = JB_get_local_time($Form->get_value($field['field_id']) . ' GMT');
            }
            break;
        case 'EDITOR':
            $val = strip_tags($val);
            $val = jb_escape_html($val);
            if (!$admin) {
                $val = JB_email_at_replace($val);
            }
            break;
        case 'IMAGE':
            if (JB_image_thumb_file_exists($Form->get_value($field['field_id']))) {
                $val = $LM->get_img_html($Form->get_value($field['field_id']));
            }
            break;
        case "CURRENCY":
            if ($val > 0) {
                $val = JB_escape_html(JB_format_currency($Form->get_value($field['field_id']), JB_get_default_currency()));
            } else {
                $val = '';
            }
            break;
        case "CATEGORY":
            $val = jb_escape_html(JB_getCatName($Form->get_value($field['field_id'])));
            break;
        case "RADIO":
            $val = jb_escape_html(JB_getCodeDescription($field['field_id'], $Form->get_value($field['field_id'])));
            break;
        case "SELECT":
            $val = jb_escape_html(JB_getCodeDescription($field['field_id'], $Form->get_value($field['field_id'])));
            break;
        case "MSELECT":
        case "CHECK":
            $vals = explode(",", $Form->get_value($field['field_id']));
            $comma = '';
            $str = '';
            if (sizeof($vals) > 0) {
                foreach ($vals as $v) {
                    $str .= $comma . jb_escape_html(JB_getCodeDescription($field['field_id'], $v));
                    $comma = ", ";
                }
            }
            $val = $str;
            break;
        case "DATE":
        case "DATE_CAL":
            if ($val != '0000-00-00 00:00:00') {
                $val = JB_get_local_time($Form->get_value($field['field_id']) . " GMT");
                $val = JB_get_formatted_date($val);
            } else {
                $val = '';
            }
            break;
        case "SKILL_MATRIX":
            $sql = "SELECT name FROM skill_matrix_data where object_id='" . JB_escape_sql($Form->get_value('resume_id')) . "' ";
            $result = JB_mysql_query($sql) or die(mysql_error());
            $val = '';
            $comma = '';
            while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
                $val .= $comma . $row['name'];
                $comma = ", ";
            }
            break;
        default:
            // plugins can alter the data in the cell to be
            // be presented on the list in a custom manner
            $args = array('val' => &$val, 'has_changed' => false, 'field' => &$field, 'form_id' => $form_id, 'data' => $Form->get_values());
            JBPLUG_do_callback('get_list_template_value', $args);
            // This hook was added in 3.6, allows plugins to modify the cell data based on $field, eg. $field['field_type'], the plugin should set 'has_changed' to true if the data in 'val' was changed.
            if ($args['has_changed']) {
                // has it changed?
                return $val;
            }
            // if not modified by plugin
            $val = jb_escape_html($val);
            if (!$admin) {
                $val = JB_email_at_replace($val);
            }
    }
    return $val;
}
Ejemplo n.º 6
0
function JB_is_table_unsaved($tname)
{
    // load cols
    $sql = " show columns from `" . JB_escape_sql($tname) . "` ";
    $result = JB_mysql_query($sql) or die(mysql_error());
    while ($row = mysql_fetch_row($result)) {
        if (preg_match("/^\\d+\$/", $row[0])) {
            $cols[$row[0]] = $row[0];
        }
    }
    $form_id = JB_get_form_id_by_table_name($tname);
    // load fields (do not cache this query!)
    $sql = "SELECT * FROM `form_fields` where form_id='" . JB_escape_sql($form_id) . "' AND field_type != 'BLANK' AND field_type !='SEPERATOR' AND field_type !='NOTE'  ";
    $result = JB_mysql_query($sql) or die(mysql_error());
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $fields[$row['field_id']] = $row['field_id'];
    }
    // check table
    if (sizeof($cols) > 0) {
        foreach ($cols as $c) {
            if ($fields[$c] == '') {
                return $c;
            }
        }
    }
    // check fields
    if (sizeof($fields) > 0) {
        foreach ($fields as $f) {
            if ($cols[$f] == '') {
                return $f;
            }
        }
    }
    return false;
}
Ejemplo n.º 7
0
	<textarea name="csv_codes" rows="10" cols="45"><?php 
    echo jb_escape_html($_REQUEST['csv_codes']);
    ?>
</textarea>
	<input type="hidden" name="field_id" value="<?php 
    echo jb_escape_html($_REQUEST['field_id']);
    ?>
">
	<input type="hidden" name="bulk" value="1"><br>
	<input type="submit" name="bulk_submit" value="Submit">
	</form>
	
	<?php 
}
if ($_REQUEST['export']) {
    $sql = "SELECT * FROM `codes_translations` WHERE `field_id`='" . JB_escape_sql($field_id) . "' and lang='" . JB_escape_sql($_SESSION['LANG']) . "' order by description ";
    ?>
Exported list: copy from below:<br>
	<textarea cols="45" rows=10><?php 
    $result = jb_mysql_query($sql);
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        echo $row['code'] . ', ' . $row['description'] . "\n";
    }
    ?>
	</textarea>
	<?php 
}
?>
<form method="POST" action="<?php 
echo htmlentities($_SERVER['PHP_SELF']);
?>
Ejemplo n.º 8
0
function JB_delete_image_from_field_id($table_name, $primary_key_name, $primary_key_id, $field_id)
{
    $sql = "SELECT `{$field_id}` FROM `{$table_name}` WHERE `{$primary_key_name}`='" . JB_escape_sql($primary_key_id) . "'";
    $result = JB_mysql_query($sql) or die(mysql_error() . $sql);
    $row = mysql_fetch_array($result, MYSQL_ASSOC);
    if ($row[$field_id] != '') {
        JB_delete_image($row[$field_id]);
    }
}
Ejemplo n.º 9
0
function JB_fix_form_field_translations()
{
    $sql = "DELETE from form_fields WHERE (form_id=4 OR form_id=5) AND section=3 ";
    JB_mysql_query($sql) or die($sql . mysql_error());
    $sql = "SELECT field_id from form_field_translations";
    $result = JB_mysql_query($sql) or die($sql . mysql_error());
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $sql = "SELECT field_id from form_fields";
        $result2 = JB_mysql_query($sql) or die($sql . mysql_error());
        if (mysql_num_rows($result2) == 0) {
            $sql = "DELETE FORM form_field_translations WHERE field_id=" . JB_escape_sql($row['field_id']);
            JB_mysql_query($sql) or die($sql . mysql_error());
        }
    }
}
Ejemplo n.º 10
0
function jb_display_field_setup_form($load_fmd = true)
{
    $feed_id = (int) $_REQUEST['feed_id'];
    $feed = JB_XMLIMP_load_feed_row($feed_id);
    if ($load_fmd) {
        // prefill the $_REQUEST[] with all the options from the database
        $feed['FMD']->fillRequestFromOptions();
    } else {
        $feed['FMD']->fillOptionsFromRequest();
    }
    ?>

	<h3>Map fields</h3>

	<?php 
    //$sql = "SELECT * FROM form_fields WHERE form_id=1 anD field_type!='BLANK' AND field_type != 'SEPERATOR' ORDER BY section, list_sort_order";
    $sql = "SELECT *, t1.field_label AS FLABEL FROM form_field_translations as t1, form_fields as t2 WHERE t2.form_id=1 AND t2.field_id=t1.field_id AND field_type!='BLANK' AND field_type != 'SEPERATOR' AND lang='" . JB_escape_sql($_SESSION['LANG']) . "' order by section, field_sort";
    $result = jb_mysql_query($sql);
    ?>

	<form method="post" action="<?php 
    echo htmlentities($_SERVER['PHP_SELF']);
    ?>
">

	<input type="hidden" name="feed_id" value="<?php 
    echo htmlentities($feed_id);
    ?>
">
	<input type="hidden" name="action" value="setupfields">
	<input type="hidden" name="seq" value="<?php 
    echo $feed["FMD"]->seq;
    ?>
">

	<table  border="0" cellSpacing="1" cellPadding="3" bgColor="#d9d9d9"  >

		<tr bgColor="#eaeaea">
			<td colspan="3" style="background-color: #5296DE; color:white;"><b>Job Importing - Account Options</b></td>
		</tr>
		<?php 
    $_REQUEST['account_create'] = $_REQUEST['account_create'] == false ? 'ONLY_DEFAULT' : $_REQUEST['account_create'];
    ?>
		<tr bgcolor="white">
			<td colspan="1"><span style="font-weight: bold; font-size: 10pt">How to associate the jobs with employer's accounts?</span></td>
			<td colspan="2"><input type="radio" name="account_create" value="IMPORT_REJECT" <?php 
    echo $_REQUEST['account_create'] == 'IMPORT_REJECT' ? 'checked' : '';
    ?>
 > Insert using the employer's account details provided with the feed. Reject if a user/pass does not authenticate<br>
			<input type="radio" name="account_create" value="IMPORT_DEFAULT" <?php 
    echo $_REQUEST['account_create'] == 'IMPORT_DEFAULT' ? 'checked' : '';
    ?>
> Insert using the employer's account, but insert using the <b>default username</b> if user/pass do not authenticate<br>
			<input type="radio" name="account_create" value="IMPORT_CREATE" <?php 
    echo $_REQUEST['account_create'] == 'IMPORT_CREATE' ? 'checked' : '';
    ?>
> Insert using the employer's username, create a new account from the account data present in the feed. Allows blank passwords.<br>
			<input type="radio" name="account_create" value="ONLY_DEFAULT" <?php 
    echo $_REQUEST['account_create'] == 'ONLY_DEFAULT' ? 'checked' : '';
    ?>
> Always import the jobs under the <b>default username.</b> Allows blank passwords.<br>
			
			<b>Default Username</b><span class="is_required_mark">*</span>: <input type="text" size="20" name="default_user" value="<?php 
    echo jb_escape_html($_REQUEST['default_user']);
    ?>
"><br>
			
			</td>
		</tr>
		<tr bgcolor="white">
			<td colspan="1"><span style="font-weight: bold; font-size: 10pt">How many credits to deduct?</span></td>
			<td colspan="2"><input type="text" name="deduct_credits" size="5" value="<?php 
    if ($_REQUEST['deduct_credits'] == false) {
        $_REQUEST['deduct_credits'] = 0;
    }
    echo $_REQUEST['deduct_credits'];
    ?>
">
			</td>
		</tr>
		<tr bgcolor="white">
			<td colspan="1"><span style="font-weight: bold; font-size: 10pt">Account details</span></td>
			<td colspan="2"><span class="is_required_mark">*</span>If you selected any of the first three options above, then you will need to setup your account data fields: (The following are required: Username, password, Email, First name, Last name)<br>
			<table border="0" cellSpacing="1" cellPadding="3" bgColor="#d9d9d9" >
				<tr bgcolor="white">
					<td>Username:<span class="is_required_mark">*</span></td>
					<td><select <?php 
    if ($_REQUEST['ac_Username'] != '') {
        ?>
 style="color:#008080; font-weight: bold" <?php 
    }
    ?>
 type="select" name="ac_Username">
						<option value="">[Select Field]</option>
						<?php 
    JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['ac_Username']);
    ?>
						</select>
					</td>
				</tr>
				<tr bgcolor="white">
					<td>Password:<span class="is_required_mark">*</span></td>
					<td><select <?php 
    if ($_REQUEST['ac_Password'] != '') {
        ?>
 style="color:#008080; font-weight: bold" <?php 
    }
    ?>
 type="select" name="ac_Password">
						<option value="">[Select Field]</option>
						<?php 
    JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['ac_Password']);
    ?>
						</select> <input type="checkbox" name="pass_md5" <?php 
    if ($_REQUEST['pass_md5'] == 'Y') {
        echo ' checked ';
    }
    ?>
 value="Y">Passwords are encrypted using MD5 Hash
					</td>
				</tr>
				<tr bgcolor="white">
					<td>Account Email:<span class="is_required_mark">*</span></td>
					<td><select <?php 
    if ($_REQUEST['ac_Email'] != '') {
        ?>
 style="color:#008080; font-weight: bold" <?php 
    }
    ?>
 type="select" name="ac_Email">
						<option value="">[Select Field]</option>
						<?php 
    JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['ac_Email']);
    ?>
						</select>
					</td>
				</tr>
				<tr bgcolor="white">
					<td>First Name:<span class="is_required_mark">*</span></td>
					<td><select type="select" <?php 
    if ($_REQUEST['ac_FirstName'] != '') {
        ?>
 style="color:#008080; font-weight: bold" <?php 
    }
    ?>
 name="ac_FirstName">
						<option value="">[Select Field]</option>
						<?php 
    JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['ac_FirstName']);
    ?>
						</select>
					</td>
				</tr>
				<tr bgcolor="white">
					<td>Last Name:<span class="is_required_mark">*</span></td>
					<td><select <?php 
    if ($_REQUEST['ac_LastName'] != '') {
        ?>
 style="color:#008080; font-weight: bold" <?php 
    }
    ?>
 type="select" name="ac_LastName">
						<option value="">[Select Field]</option>
						<?php 
    JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['ac_LastName']);
    ?>
						</select>
					</td></tr>
				<tr bgcolor="white">
					<td>Company Name:</td>
					<td><select <?php 
    if ($_REQUEST['ac_CompName'] != '') {
        ?>
 style="color:#008080; font-weight: bold" <?php 
    }
    ?>
 type="select" name="ac_CompName">
						<option value="">[Select Field]</option>
						<?php 
    JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['ac_CompName']);
    ?>
						</select>
					</td>
				</tr>

				<?php 
    //$sql = "SELECT * FROM form_fields WHERE form_id=4 AND field_type!='BLANK' AND field_type != 'SEPERATOR'  ";
    $sql = "SELECT *, t1.field_label AS FLABEL FROM form_field_translations as t1, form_fields as t2 WHERE t2.form_id=4 AND t2.field_id=t1.field_id AND field_type!='BLANK' AND field_type != 'SEPERATOR' AND lang='" . JB_escape_sql($_SESSION['LANG']) . "' order by section, field_sort ";
    $result2 = jb_mysql_query($sql);
    if (mysql_num_rows($result2) > 0) {
        while ($ac_row = mysql_fetch_array($result2)) {
            ?>
						<tr bgcolor="white">
							<td><?php 
            echo $ac_row['FLABEL'];
            ?>
:</td>
							<td><select <?php 
            if ($_REQUEST['ac_' . $ac_row['field_id']] != '') {
                ?>
 style="color:#008080; font-weight: bold" <?php 
            }
            ?>
 type="select" name="ac_<?php 
            echo $ac_row['field_id'];
            ?>
">
								<option value="">[Select Field]</option>
								<?php 
            JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['ac_' . $row['field_id']]);
            ?>
								</select>
							</td>
						</tr>
						<?php 
        }
    }
    ?>
					
			</table>
			
			</td>
		</tr>
		<tr bgColor="#eaeaea">
			<td colspan="3" style="background-color: #5296DE; color:white;"><b>Job Importing - Feed Commands</b></td>
		</tr>
		<tr bgcolor="white">
			<td colspan="1"><span style="font-weight: bold; font-size: 10pt">Command field</span></td>
			<td colspan="2"><select <?php 
    if ($_REQUEST['command_field'] != '') {
        ?>
 style="color:#008080; font-weight: bold" <?php 
    }
    ?>
 style="font-size: 10pt" type="select" name="command_field">
				<option  value="">[Select Field]</option>
				<?php 
    JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['command_field']);
    ?>
				</select> - Does the feed have a field which tells the system what to do with the data? eg a command may be Add, Delete, Update. If no field is selected here, then all records are assumed as to be added.
			</td>
		</tr>

		<tr bgColor="#eaeaea">
			<td colspan="1" bgColor="white"></td>
			<td colspan="1"><b>Command</b></td>
			<td colspan="1"><b>Command name</b></td>
		</tr>
		<?php 
    if ($_REQUEST['insert_command'] == false) {
        $_REQUEST['insert_command'] = 'Add';
    }
    if ($_REQUEST['update_command'] == false) {
        $_REQUEST['update_command'] = 'Update';
    }
    if ($_REQUEST['delete_command'] == false) {
        $_REQUEST['delete_command'] = 'Delete';
    }
    ?>
		<tr bgcolor="white">
			<td colspan="1"></td>
			<td colspan="1">Insert a new job</td>
			<td colspan="1">Look for this command: <input type="text" name="insert_command" value="<?php 
    echo jb_escape_html($_REQUEST['insert_command']);
    ?>
"></td>
		</tr>
		<tr bgcolor="white">
			<td colspan="1"></td>
			<td colspan="1">Update existing job</td>
			<td colspan="1">Look for this command: <input type="text" name="update_command" value="<?php 
    echo jb_escape_html($_REQUEST['update_command']);
    ?>
"></td>
		</tr>
		<tr bgcolor="white">
			<td colspan="1"></td>
			<td colspan="1">Delete existing job</td>
			<td colspan="2">Look for this command: <input type="text" name="delete_command" value="<?php 
    echo jb_escape_html($_REQUEST['delete_command']);
    ?>
"></td>
		</tr>

		<tr bgColor="#eaeaea">
			<td colspan="3" style="background-color: #5296DE; color:white;"><b>Job Importing - Special Attributes</b></td>
		</tr>

		<tr bgcolor="white">
			<td colspan="1"><b>Application URL field</b></td>
			<td colspan="2"><select <?php 
    if ($_REQUEST['app_url'] != '') {
        ?>
 style="color:#008080; font-weight: bold" <?php 
    }
    ?>
 style="font-size: 10pt" type="select" name="app_url">
				<option value="">[Select Field]</option>
				<?php 
    JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['app_url']);
    ?>
				</select>
				<br>When the 'apply' button is pressed, Jamit will redirect the candidate to the 'Application URL'.
				<br>If no application URL present, Jamit should: <input type="radio" value="O" name="default_app_type" <?php 
    if ($_REQUEST['default_app_type'] == 'O') {
        echo ' checked ';
    }
    ?>
> <i>Accept applications for that posting on your site<i> or, <input type="radio" name="default_app_type" value="N" <?php 
    if (!$_REQUEST['default_app_type'] || $_REQUEST['default_app_type'] == 'N') {
        echo ' checked ';
    }
    ?>
> <i>Do not display the 'apply' button for that posting</i>
			</td>
		</tr>
	
		<tr bgcolor="white">
			<td colspan="1"><b>GUID</b><span class="is_required_mark">*</span> - Global Unique ID</td>
			<td colspan="2"><select <?php 
    if ($_REQUEST['guid'] != '') {
        ?>
 style="color:#008080; font-weight: bold" <?php 
    }
    ?>
 style="font-size: 10pt" type="select" name="guid">
				<option value="">[Select Field]</option>
				<?php 
    JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['guid']);
    ?>
				</select> (This is a Global Unique Identifier for the job post. This ID is not just local, but used accross all possible job boards and databases. A URL is an excellent choice for a GUID.)
			</td>
		</tr>

		<tr bgcolor="white">
			<td colspan="1"><b>Post Date</b></td>
			<td colspan="2"><select <?php 
    if ($_REQUEST['post_date'] != '') {
        ?>
 style="color:#008080; font-weight: bold" <?php 
    }
    ?>
 style="font-size: 10pt" type="select" name="post_date">
				<option value="">[Select Field]</option>
				<?php 
    JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['post_date']);
    ?>
				</select> (Date and Time, Formatted to the specification of <a href="http://www.faqs.org/rfcs/rfc2822">RFC 2822</a> or YYYY-MM-DD. If date is invalid or not selected, the job will be imported with the current date and time.)
			</td>
		</tr>

		

		<tr bgcolor="white">
			<td colspan="1"><b>Post Mode</b></td>
			<td colspan="2"><select <?php 
    if ($_REQUEST['post_mode'] != '') {
        ?>
 style="color:#008080; font-weight: bold" <?php 
    }
    ?>
 style="font-size: 10pt" type="select" name="post_mode">
				<option value="">[Select Field]</option>
				<?php 
    JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['post_mode']);
    ?>
				</select> (Optional. This field represents the <i>post_mode field</i>. It can have one of the following values: 'free', 'normal', 'premium'. If not mapped, the post will be posted as 'normal')
			</td>
		</tr>

		<tr bgcolor="white">
			<td colspan="1"><b>Approval Status</b></td>
			<td colspan="2"><select <?php 
    if ($_REQUEST['approved'] != '') {
        ?>
 style="color:#008080; font-weight: bold" <?php 
    }
    ?>
 style="font-size: 10pt" type="select" name="Approval">
				<option value="">[Select Field]</option>
				<?php 
    JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['approved']);
    ?>
				</select> (Optional. This field represents the <i>approved</i> field. It can have one of the following values: 'Y' for approved posts or 'N' for not approved posts. If not mapped, the post will be posted as: <select style="font-weight: bold" name="default_approved" <?php 
    if ($_REQUEST['default_approved'] == 'Y') {
        echo 'selected';
    }
    ?>
><option value="Y">'Y - Approved'</option><option value="N" <?php 
    if ($_REQUEST['default_approved'] == 'N') {
        echo 'selected';
    }
    ?>
 >'N - Not Approved'</option></select>)
			</td>
		</tr>


		<tr><td colspan="3" style="background-color: #5296DE; color:white;"><b>Jobs Feed - Map your fields to the XML attributes<b></td></tr>
		
		<tr bgColor="#eaeaea">
			<td><b>Name</b></td>
			<td><b>XML Field</b></td>
			<td><b>Options</b></td>
			
		</tr>
		


		<?php 
    $code = "\t//The following are examples showing how to set the data\n" . "\t//structure with custom values. set_data_value() takes 3 arguments:\n" . "\t// (string) value, (string) field_id, and optionally (int) form_id.\n";
    $code2 = "//\tThe Feed Meta Data object is accessable like this:\n";
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        ?>

			<tr bgcolor="white">

				<td>
					<span style="font-weight: bold; font-size: 10pt"><?php 
        echo $row['FLABEL'];
        if ($row['is_required'] == 'Y') {
            echo '<span class="is_required_mark">*</span>';
        }
        ?>
</span> <?php 
        echo $row['field_type'] . ' (#' . $row['field_id'];
        ?>
)
				</td>
				<td width="10%">
					<select <?php 
        if ($_REQUEST['xml_element_' . $row['field_id']] != '') {
            ?>
 style="color:#008080; font-weight: bold" <?php 
        }
        ?>
 style="font-size: 10pt" type="select" name="xml_element_<?php 
        echo $row['field_id'];
        ?>
">
					<option value="">[Select Field]</option>
					<?php 
        JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['xml_element_' . $row['field_id']]);
        ?>
					</select>
				</td>
				<td>

				<div style="font-size: 8pt;padding-left:50px;padding-right:auto">
		
					Validate? <?php 
        JB_XMLIMP_echo_validation_select('validate' . $row['field_id'], $_REQUEST['validate' . $row['field_id']]);
        ?>
					
					<?php 
        if ($row['field_type'] == 'MSELECT' || $row['field_type'] == 'RADIO' || $row['field_type'] == 'SELECT' || $row['field_type'] == 'CHECK') {
            if ($_REQUEST['code_mode' . $row['field_id']] == false) {
                $_REQUEST['code_mode' . $row['field_id']] = 'ADD_NEW';
            }
            ?>
<br>
						
						<span style="color: black; font-size:10pt">If the imported value does <b>not exist</b> as an <b>option</b> in your database, then:</span><br>
						<input type="radio" name="code_mode<?php 
            echo $row['field_id'];
            ?>
" value="ADD_NEW" <?php 
            if ($_REQUEST['code_mode' . $row['field_id']] == 'ADD_NEW') {
                echo 'checked';
            }
            ?>
 > - Add the value as a new option, using first three letters as the code<br>
						<input type="radio" name="code_mode<?php 
            echo $row['field_id'];
            ?>
" value="ADD_PAIR" <?php 
            if ($_REQUEST['code_mode' . $row['field_id']] == 'ADD_PAIR') {
                echo 'checked';
            }
            ?>
 > - Add the value as a new option, using <select style="font-weight: bold" type="select" name="code_pair<?php 
            echo $row['field_id'];
            ?>
">
					<option value="">[Select Field]</option>
					<?php 
            JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['code_pair' . $row['field_id']]);
            ?>
					</select> for the code.<br>
						<input type="radio" name="code_mode<?php 
            echo $row['field_id'];
            ?>
" value="ERROR" <?php 
            if ($_REQUEST['code_mode' . $row['field_id']] == 'ERROR') {
                echo 'checked';
            }
            ?>
 > - Throw an error & skip the whole record<br>
						<input type="radio" name="code_mode<?php 
            echo $row['field_id'];
            ?>
" value="IGNORE" <?php 
            if ($_REQUEST['code_mode' . $row['field_id']] == 'IGNORE') {
                echo 'checked';
            }
            ?>
 > - Don't do anything, import anyway<br>

						<?php 
        } elseif ($row['field_type'] == 'CATEGORY') {
            if ($_REQUEST['cat_mode' . $row['field_id']] == false) {
                $_REQUEST['cat_mode' . $row['field_id']] = 'ADD_MATCH';
            }
            ?>
<br>
						<span style="color: black; font-size:10pt;">If the imported value does <b>not exist</b> as a <b>category</b> on your database, then:</span><br>
						<input type="radio" name="cat_mode<?php 
            echo $row['field_id'];
            ?>
" value="ADD_NEW" <?php 
            if ($_REQUEST['cat_mode' . $row['field_id']] == 'ADD_NEW') {
                echo 'checked';
            }
            ?>
 > - Add the value as a new category, under the category of: 
						<select style="font-weight: bold" name="parent_category<?php 
            echo $row['field_id'];
            ?>
">
						<?php 
            JB_category_option_list2(0, $_REQUEST['parent_category' . $row['field_id']], 1);
            ?>
						</select>
						<br>
						<input type="radio" name="cat_mode<?php 
            echo $row['field_id'];
            ?>
" value="ADD_MATCH" <?php 
            if ($_REQUEST['cat_mode' . $row['field_id']] == 'ADD_MATCH') {
                echo 'checked';
            }
            ?>
 > - Attempt to match the category name with text from <select style="font-weight: bold" type="select" name="cat_match<?php 
            echo $row['field_id'];
            ?>
">
					<option value="">[Select Field]</option>
					<?php 
            JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['cat_match' . $row['field_id']]);
            ?>
					</select><br>
						<input type="radio" name="cat_mode<?php 
            echo $row['field_id'];
            ?>
" value="ERROR" <?php 
            if ($_REQUEST['cat_mode' . $row['field_id']] == 'ERROR') {
                echo 'checked';
            }
            ?>
 > - Throw an error & skip the whole record<br>
						<input type="radio" name="cat_mode<?php 
            echo $row['field_id'];
            ?>
" value="IGNORE" <?php 
            if ($_REQUEST['cat_mode' . $row['field_id']] == 'IGNORE') {
                echo 'checked';
            }
            ?>
 > - Don't do anything, import anyway<br>
						<?php 
        } else {
            if ($row['field_type'] == 'EDITOR') {
                if ($_REQUEST['allow_html' . $row['field_id']] == '') {
                    $_REQUEST['allow_html' . $row['field_id']] = 'Y';
                }
            }
            ?>
						<br>
						or, <input type="checkbox" name="ignore<?php 
            echo $row['field_id'];
            ?>
" <?php 
            if ($_REQUEST['ignore' . $row['field_id']] == 'Y') {
                echo ' checked ';
            }
            ?>
 value="Y" style="font-size: 8pt"> Ignore field & Replace with: <input style="font-size: 8pt" name="replace<?php 
            echo $row['field_id'];
            ?>
" value="<?php 
            echo jb_escape_html($_REQUEST['replace' . $row['field_id']]);
            ?>
" size="20" type="text"><br>
						<input type="checkbox" name="allow_html<?php 
            echo $row['field_id'];
            ?>
" value="Y"  <?php 
            if ($_REQUEST['allow_html' . $row['field_id']] == 'Y') {
                echo 'checked';
            }
            ?>
 > - Allow limited HTML<br>
<?php 
        }
        ?>
				</div>
				</td>
				
			</tr>

			<tr bgColor="#EFF3FF">
				<td colspan="3">&nbsp;</td>
			</tr>

			<?php 
        if ($_REQUEST['xml_element_' . $row['field_id']]) {
            $tag = ", <<-- mapped to <" . $_REQUEST['xml_element_' . $row['field_id']] . ">";
        } else {
            $tag = '';
        }
        $field_list .= "- Field id:" . $row['field_id'] . ", Label: '" . $row['FLABEL'] . "', Field Type:" . $row['field_type'] . " {$tag} \n";
    }
    ?>

		<tr><td colspan="3" bgcolor="white">
		<input type="submit" name="submit_field_setup" value="Save" style="font-size:14pt;">
		</td>
		</tr>
		<tr><td colspan="3">
				Advanced: Summary of field mappings. The following box displays a summary of the fields and which elements they have been mapped to thus far.
				<textaREA rows="5" style="width:100%; font-size:10px"><?php 
    echo htmlentities($field_list);
    ?>
</textaREA>
			</td>
		</tr>

	</table>
	<?php 
}
Ejemplo n.º 11
0
 function get_sql_update_values($table_name, $primary_key_name, $primary_key_id, $user_id, &$assign)
 {
     $fields =& JB_schema_get_static_fields($this->form_id, JB_DB_MAP);
     foreach ($fields as $field) {
         if ($field['field_type'] == 'ID') {
             continue;
             // do not update the id
         }
         if (isset($assign[$field['field_id']])) {
             $str .= "{$comma} `" . $field['field_id'] . "` = '" . JB_escape_sql($assign[$field['field_id']]) . "' ";
             $comma = ',';
         }
     }
     foreach ($this->tag_to_field_id as $tag => $field) {
         if (!is_numeric($field['field_id']) || $field['field_type'] == 'BLANK' || $field['field_type'] == 'SEPERATOR' || $field['field_type'] == 'NOTE') {
             continue;
         }
         $tmp = '';
         $comma = '';
         switch ($field['field_type']) {
             case 'GMAP':
                 $str .= ", `" . $field['field_id'] . "_lat` = '" . JB_escape_sql($_REQUEST[$field['field_id'] . '_lat']) . "', `" . $field['field_id'] . "_lng` = '" . JB_escape_sql($_REQUEST[$field['field_id'] . '_lng']) . "', `" . $field['field_id'] . "` = '" . JB_escape_sql($_REQUEST[$field['field_id'] . '_zoom']) . "' ";
                 break;
             case 'IMAGE':
                 if ($_FILES[$field['field_id']]['name'] != '') {
                     $_REQUEST[$field['field_id']] = $file_name;
                     // delete the old image
                     if ($primary_key_id != '') {
                         JB_delete_image_from_field_id($table_name, $primary_key_name, $primary_key_id, $field['field_id']);
                     }
                     $file_name = JB_saveImage($field['field_id'], $user_id);
                     $str .= ", `" . $field['field_id'] . "` = '" . JB_escape_sql($file_name) . "' ";
                 }
                 break;
             case 'FILE':
                 if ($_FILES[$field['field_id']]['name'] != '') {
                     // delete the old file
                     if ($primary_key_id != '') {
                         JB_delete_file_from_field_id($table_name, $primary_key_name, $primary_key_id, $field['field_id']);
                     }
                     $file_name = JB_saveFile($field['field_id'], $user_id);
                     $str .= ", `" . $field['field_id'] . "` = '" . JB_escape_sql($file_name) . "' ";
                 }
                 break;
             case 'DATE':
                 $day = $_REQUEST[$field['field_id'] . "d"];
                 $month = $_REQUEST[$field['field_id'] . "m"];
                 $year = $_REQUEST[$field['field_id'] . "y"];
                 $temp_date = $year . "-" . $month . "-" . $day;
                 if ($temp_time = strtotime($temp_date . ' 00:00:00')) {
                     // convert the date timezone to GMT
                     $temp_time = $temp_time - 3600 * JB_GMT_DIF;
                     $temp_date = gmdate('Y-m-d H:i:s', $temp_time);
                 }
                 $str .= ", `" . $field['field_id'] . "` = '" . JB_escape_sql($temp_date) . "' ";
                 break;
             case 'DATE_CAL':
                 // Convert SCW Date to ISO Date format before saving in the DB
                 $temp_date = JB_SCWDate_to_ISODate($_REQUEST[$field['field_id']]);
                 $temp_date = trim($_REQUEST[$field['field_id']]);
                 if (strlen($temp_date) > 0) {
                     $temp_date = JB_SCWDate_to_ISODate($temp_date);
                     if ($temp_time = strtotime($temp_date . ' 23:59:59')) {
                         // convert the date timezone to GMT
                         $temp_time = $temp_time - 3600 * JB_GMT_DIF;
                         $temp_date = gmdate('Y-m-d H:i:s', $temp_time);
                     } else {
                         $temp_date = '';
                     }
                 }
                 $str .= ", `" . JB_escape_sql($field['field_id']) . "` = '" . JB_escape_sql($temp_date) . "' ";
                 break;
             case 'CHECK':
                 $comma = '';
                 $tmp = '';
                 $selected_codes = array();
                 $selected_codes = $_REQUEST[$field['field_id']];
                 // the field comes in as an array
                 for ($i = 0; $i < sizeof($selected_codes); $i++) {
                     if ($i > 0) {
                         $comma = ',';
                     }
                     $tmp .= $comma . $selected_codes[$i] . "";
                 }
                 $_REQUEST[$field['field_id']] = $tmp;
                 $str .= ", `" . $field['field_id'] . "` = '" . JB_escape_sql($_REQUEST[$field['field_id']]) . "' ";
                 break;
             case 'MSELECT':
                 $tmp = '';
                 $comma = '';
                 $selected_codes = array();
                 $selected_codes = $_REQUEST[$field['field_id']];
                 // the field comes in as an array
                 for ($i = 0; $i < sizeof($selected_codes); $i++) {
                     if ($i > 0) {
                         $comma = ',';
                     }
                     $tmp .= $comma . $selected_codes[$i] . "";
                 }
                 $str .= ", `" . $field['field_id'] . "` = '" . JB_escape_sql($tmp) . "' ";
                 break;
             case 'SKILL_MATRIX':
                 JB_save_skill_matrix_data($field['field_id'], $primary_key_id, $user_id);
                 $str .= ", `" . $field['field_id'] . "` = '" . JB_escape_sql($_REQUEST[$field['field_id']]) . "' ";
                 break;
             case 'TEXT':
             case 'EDITOR':
                 $str .= ", `" . $field['field_id'] . "` = '" . JB_escape_sql($_REQUEST[$field['field_id']]) . "' ";
                 break;
             case 'URL':
                 $str .= ", `" . $field['field_id'] . "` = '" . JB_escape_sql(strip_tags($_REQUEST[$field['field_id']])) . "' ";
                 break;
             case 'NUMERIC':
             case 'CURRENCY':
             case 'INTEGER':
                 // featch only the numerical part
                 preg_match('/[\\+-]?(\\d+(\\.)?(\\d+)?)/', $_REQUEST[$field['field_id']], $m);
                 if ($m[1] === '0') {
                     // string zero
                     $str .= ", `" . $field['field_id'] . "` = '0' ";
                 } elseif (!$m[1]) {
                     // empty
                     $str .= ", `" . $field['field_id'] . "` = NULL ";
                 } else {
                     $str .= ", `" . $field['field_id'] . "` = '" . JB_escape_sql($m[1]) . "' ";
                 }
                 break;
             case 'YOUTUBE':
                 // extract the video ID form the URL
                 // eg. http://www.youtube.com/watch?v=iuTNdHadwbk - extract iuTNdHadwbk
                 if (preg_match('/watch\\?v=([a-z0-9\\-_]+)/i', $_REQUEST[$field['field_id']], $m)) {
                     $str .= ", `" . $field['field_id'] . "` = '" . JB_escape_sql($m[1]) . "' ";
                 } elseif (preg_match('/src="http:\\/\\/www\\.youtube\\.com\\/v\\/([a-z0-9\\-_]+)/i', $_REQUEST[$field['field_id']], $m)) {
                     $str .= ", `" . $field['field_id'] . "` = '" . JB_escape_sql($m[1]) . "' ";
                 } elseif (preg_match('#http:\\/\\/youtu\\.be\\/([a-z0-9\\-_]+)\\/?#i', $_REQUEST[$field['field_id']], $m)) {
                     $str .= ", `" . $field['field_id'] . "` = '" . JB_escape_sql($m[1]) . "' ";
                 } else {
                     preg_match('/([a-z0-9\\-_]+)/i', $_REQUEST[$field['field_id']], $m);
                     $str .= ", `" . $field['field_id'] . "` = '" . JB_escape_sql($m[1]) . "' ";
                 }
                 break;
             default:
                 $custom_sql = false;
                 // your plugin would have to generate $custom_sql string like the one after the else { starement
                 JBPLUG_do_callback('append_sql_update_values', $custom_sql, $field, $table_name, $primary_key_name, $primary_key_id, $user_id);
                 if ($custom_sql !== false) {
                     $str .= $custom_sql;
                 } else {
                     $str .= ", `" . $field['field_id'] . "` = '" . JB_escape_sql($_REQUEST[$field['field_id']]) . "' ";
                 }
                 break;
         }
     }
     return $str;
 }