Example #1
0
function print_html_body_begin($parameters=null){
	global $config, $sess, $auth, $errors, $message;

	if (!$parameters) $parameters=null;

	// call user defined function at html body begin
	if (isset($parameters['run_at_html_body_begin']) and function_exists($parameters['run_at_html_body_begin']))
		$parameters['run_at_html_body_begin']($parameters);
	
	//virtual(multidomain_get_file($config->html_prolog));
	if (isset($parameters['title']) and $parameters['title']) echo $parameters['title'];
	//virtual(multidomain_get_file($config->html_separator));

?>

	<?if (isset($parameters['tab_collection']) and $parameters['tab_collection']) { 
		print_tabs($parameters['tab_collection'], 
					isset($parameters['path_to_pages'])?$parameters['path_to_pages']:null, 
					isset($parameters['selected_tab'])?$parameters['selected_tab']:null);

		//count tabs
		$num_of_tabs=0;
		foreach($parameters['tab_collection'] as $tab)
			if ($tab->enabled) $num_of_tabs++;
					
					?>
	<div id="swContent">

	<!-- contenet of div must be sufficient wide in order to tabs displays in one line -->
	<div style="height:1px; width:<?echo ($num_of_tabs*100)- 50;?>px;">&nbsp;</div>
	
	<?}?>

<?	
	print_errors($errors);                    // Display error
	print_message($message);

	if ($errors or $message) echo "<br />";
} //end function print_html_body_begin
Example #2
0
    /**
     * Loop thru all the patch files that will be overwitten or altered, 
     * to find out if they are modified by user. If it's modified, warn user.
     * @access  private
     * @return  true  if there are files being modified
     *          false if no file is modified
     * @author  Cindy Qi Li
     */
    function hasFilesModified()
    {
        $overwrite_modified_files = $alter_modified_files = $has_not_exist_files = false;
        $files = $this->patch_array[files];
        $separator = '<br />';
        // no file action is defined, return nothing is modified (false)
        if (!is_array($files)) {
            return false;
        }
        foreach ($files as $row_num => $patch_file) {
            $fileName = $patch_file['name'];
            $fileLocation = $patch_file['location'];
            $file = $fileLocation . $fileName;
            $action = $patch_file['action'];
            if ($action == 'alter' || $action == 'overwrite') {
                if (!file_exists($file)) {
                    // If the same message exists then skip it
                    if (strpos($not_exist_files, $file) !== false) {
                        continue;
                    }
                    $not_exist_files .= $file . $separator;
                    $has_not_exist_files = true;
                } else {
                    if ($this->isFileModified($fileLocation, $fileName)) {
                        $fileRealPath = realpath($file);
                        if ($action == 'overwrite') {
                            // If the same message exists then skip it
                            if (strpos($overwrite_files, $fileRealPath) !== false) {
                                continue;
                            }
                            $overwrite_files .= $fileRealPath . $separator;
                            $overwrite_modified_files = true;
                        } else {
                            if ($action == 'alter') {
                                // If the same message exists then skip it
                                if (strpos($alter_files, $fileRealPath) !== false) {
                                    continue;
                                }
                                $alter_files .= $fileRealPath . $separator;
                                $alter_modified_files = true;
                            }
                        }
                    }
                }
            }
        }
        if ($has_not_exist_files) {
            $this->errors[] = _AT('patch_local_file_not_exist') . $not_exist_files;
        }
        if ($overwrite_modified_files) {
            $this->errors[] = _AT('patcher_overwrite_modified_files') . $overwrite_files;
        }
        if ($alter_modified_files) {
            $this->errors[] = _AT('patcher_alter_modified_files') . $alter_files;
        }
        if (count($this->errors) > 0) {
            if ($has_not_exist_files) {
                $notes = '';
            } else {
                $notes = '
			  <form action="' . $_SERVER['PHP_SELF'] . '?id=' . $_POST['id'] . '&who=' . $_POST['who'] . '" method="post" name="skip_files_modified">
			  <div class="row buttons">
					<input type="submit" name="yes" value="' . _AT('yes') . '" accesskey="y" />
					<input type="submit" name="no" value="' . _AT('no') . '" />
					<input type="hidden" name="install" value="' . $_POST['install'] . '" />
					<input type="hidden" name="install_upload" value="' . $_POST['install_upload'] . '" />
					<input type="hidden" name="ignore_version" value="' . $_POST['ignore_version'] . '" />
				</div>
				</form>';
            }
            print_errors($this->errors, $notes);
            unset($this->errors);
            return true;
        }
        return false;
    }
Example #3
0
function tzs_front_end_distance_calculator_handler($atts)
{
    ob_start();
    $errors = array();
    $city = null;
    $map = false;
    $form = true;
    if ($_SERVER['REQUEST_METHOD'] == 'GET' && isset($_GET['calc'])) {
        if (!isset($_GET['city']) || !is_array($_GET['city']) || count($_GET['city']) < 2) {
            array_push($errors, 'Недостаточно данных для расчета расстояния');
        } else {
            $city = array_filter(array_map('trim', $_GET['city']));
            if (count($city) < 2) {
                array_push($errors, 'Недостаточно данных для расчета расстояния');
            } elseif (count($city) > 10) {
                array_push($errors, 'Слишком много точек для расчета расстояния');
            } else {
                //$res = tzs_calculate_distance($city);
                $res = array();
                /*$errors = array_merge($errors, $res['errors']);
                		print_errors($errors);*/
                $errors = null;
                /* if ($res['results'] > 0) {
                			?>
                				<div id="calc_result">
                					<div id="distance_result">
                						Расстояние по маршруту <?php echo tzs_cities_to_str($city);?> <?php echo tzs_convert_distance_to_str($res['distance'], true);?>,
                					</div>
                					<div id="duration_result">
                						примерное время в пути <?php echo tzs_convert_time_to_str($res['time']);?>
                					</div>
                				</div>
                			<?php
                			} */
                $map = true;
                $form = false;
                print_distance_calculator_form($errors, $city, $map, $form);
            }
        }
        print_errors($errors);
    } else {
        print_distance_calculator_form($errors, $city, $map, $form);
    }
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}
Example #4
0
function tzs_front_end_following_handler($atts)
{
    ob_start();
    $sp = tzs_validate_search_parameters();
    $s_sql = tzs_search_parameters_to_sql($sp, 'sh');
    $s_title = tzs_search_parameters_to_str($sp);
    $errors = $sp['errors'];
    $show_table = true;
    if (strlen($s_title) == 0 && count($errors) == 0) {
        $show_table = false;
        //$errors = array("Укажите параметры поиска");
    }
    if (count($errors) > 0) {
        print_errors($errors);
    }
    ?>
	<a href="javascript:showSearchDialog();" id="edit_search">Изменить параметры поиска</a>
	<?php 
    if (count($errors) == 0 && $show_table) {
        if (strlen($s_title) > 0) {
            ?>
			<div id="search_info">Попутные грузы <?php 
            echo $s_title;
            ?>
</div>
		<?php 
        } else {
            ?>
			<div id="search_info">Параметры поиска не заданы</div>
		<?php 
        }
        $page = current_page_number();
        ?>
	<a tag="page" id="realod_btn" href="<?php 
        echo build_page_url($page);
        ?>
">Обновить</a>
	<?php 
        global $wpdb;
        $url = current_page_url();
        $pp = TZS_RECORDS_PER_PAGE;
        $sql = "SELECT COUNT(*) as cnt FROM " . TZS_SHIPMENT_TABLE . " WHERE active=1 {$s_sql};";
        $res = $wpdb->get_row($sql);
        if (count($res) == 0 && $wpdb->last_error != null) {
            print_error('Не удалось отобразить список грузов. Свяжитесь, пожалуйста, с администрацией сайта');
        } else {
            $records = $res->cnt;
            $pages = ceil($records / $pp);
            if ($pages == 0) {
                $pages = 1;
            }
            if ($page > $pages) {
                $page = $pages;
            }
            $from = ($page - 1) * $pp;
            $sql = "SELECT * FROM " . TZS_SHIPMENT_TABLE . " WHERE active=1 {$s_sql} ORDER BY time DESC LIMIT {$from},{$pp};";
            $res = $wpdb->get_results($sql);
            if (count($res) == 0 && $wpdb->last_error != null) {
                print_error('Не удалось отобразить список грузов. Свяжитесь, пожалуйста, с администрацией сайта');
            } else {
                if (count($res) == 0) {
                    ?>
					<div id="info">По Вашему запросу ничего не найдено.</div>
				<?php 
                } else {
                    ?>
			<script src="/wp-content/plugins/tzs/assets/js/distance.js"></script>
			<table id="tbl_shipments">
			<tr>
				<th id="numb">Номер заявки</th>
				<th id="adds">Дата размещения</th>
				<th id="date-load">Дата погрузки<br>Дата выгрузки</th>
				<th id="numb-unload" nonclickable="true">Пункт погрузки<br>Пункт выгрузки</th>
				<th id="desc">Описание груза</th>
				<th id="wight">Вес</th>
				<th id="vol">Объем</th>
				<th id="type">Тип транспорта</th>
				<th id="cost">Цена</th>
				<th id="comm">Комментарии</th>
			</tr>
			<?php 
                    foreach ($res as $row) {
                        $type = isset($GLOBALS['tzs_tr_types'][$row->trans_type]) ? $GLOBALS['tzs_tr_types'][$row->trans_type] : "";
                        ?>
				<tr rid="<?php 
                        echo $row->id;
                        ?>
">
				<td><?php 
                        echo $row->id;
                        ?>
</td>
				<td><b><?php 
                        echo convert_date_no_year($row->time);
                        ?>
</b><br/><?php 
                        echo convert_time_only($row->time);
                        ?>
</td>
				<td><?php 
                        echo convert_date_no_year($row->sh_date_from);
                        ?>
<br/><?php 
                        echo convert_date_no_year($row->sh_date_to);
                        ?>
</td>
				<td>
					<?php 
                        echo tzs_city_to_str($row->from_cid, $row->from_rid, $row->from_sid, $row->sh_city_from);
                        ?>
<br/><?php 
                        echo tzs_city_to_str($row->to_cid, $row->to_rid, $row->to_sid, $row->sh_city_to);
                        ?>
					<?php 
                        if ($row->distance > 0) {
                            ?>
						<br/>
						<?php 
                            echo tzs_make_distance_link($row->distance, false, array($row->sh_city_from, $row->sh_city_to));
                            ?>
					<?php 
                        }
                        ?>
				</td>
				
				<td><?php 
                        echo htmlspecialchars($row->sh_descr);
                        ?>
</td>
				
				<?php 
                        if ($row->sh_weight > 0) {
                            ?>
					<td><?php 
                            echo remove_decimal_part($row->sh_weight);
                            ?>
 т</td>
				<?php 
                        } else {
                            ?>
					<td>&nbsp;</td>
				<?php 
                        }
                        ?>
				
				<?php 
                        if ($row->sh_volume > 0) {
                            ?>
					<td><?php 
                            echo remove_decimal_part($row->sh_volume);
                            ?>
 м³</td>
				<?php 
                        } else {
                            ?>
					<td>&nbsp;</td>
				<?php 
                        }
                        ?>
				
				<td><?php 
                        echo $type;
                        ?>
</td>
				<td><?php 
                        echo tzs_cost_to_str($row->cost);
                        ?>
</td>
				<td><?php 
                        echo htmlspecialchars($row->comment);
                        ?>
</td>
				</tr>
				<?php 
                    }
                    ?>
			</table>
			
			<?php 
                }
                build_pages_footer($page, $pages);
            }
        }
    }
    ?>
		<script src="/wp-content/plugins/tzs/assets/js/search.js"></script>
		<script>
			var post = [];
			<?php 
    echo "// POST dump here\n";
    foreach ($_POST as $key => $value) {
        echo "post[" . tzs_encode2($key) . "] = " . tzs_encode2($value) . ";\n";
    }
    ?>
			
			function showSearchDialog() {
				doSearchDialog('cargo', post, null, true);
			}
			
			jQuery(document).ready(function(){
				jQuery('#tbl_shipments').on('click', 'td', function(e) {  
					var nonclickable = 'true' == e.delegateTarget.rows[0].cells[this.cellIndex].getAttribute('nonclickable');
					var id = this.parentNode.getAttribute("rid");
					if (!nonclickable)
						document.location = "/account/view-shipment/?id="+id;
				});
				hijackLinks(post);
				<?php 
    if (strlen($s_title) == 0) {
        ?>
showSearchDialog();<?php 
    }
    ?>
			});
		</script>
	<?php 
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}
/**
 * Handle shutdown
 */
function handle_shutdown()
{
    global $C;
    echo "<!-- end of document -->";
    print_errors();
}
Example #6
0
    }
    ?>
				</table>
			<!--</div>-->
			
			
			
			<?php 
} else {
    // If not logged in
    ?>
			
			<div id="title">Meetup</div>
			
			<?php 
    print_errors($error, $success);
    ?>
			
			<table cellspacing="0">
				<tr>
					<th class="table_header">Welcome to Meetup!</th>
				</tr>
				
				<tr>
					<th class="table_header">New here?  <a href="register.php">Register</a> an account now!</th>
				</tr>
				
				<tr>
					<th class="table_header">Returning user?  <a href="login.php">Login</a>!</th>
				</tr>
				
Example #7
0
function tzs_front_end_tables_reload()
{
    // Возвращаемые переменные
    $output_info = '';
    $output_error = '';
    $output_tbody = '';
    $output_pnav = '';
    $lastrecid = 0;
    $form_type = get_param_def('form_type', '');
    $type_id = get_param_def('type_id', '0');
    $rootcategory = get_param_def('rootcategory', '0');
    $cur_type_id = get_param_def('cur_type_id', '0');
    $cur_post_name = get_param_def('cur_post_name', '');
    $p_title = get_param_def('p_title', '');
    $page = get_param_def('page', '1');
    $records_per_page = get_param_def('records_per_page', '' . TZS_RECORDS_PER_PAGE);
    $record_pickup_time = get_option('t3s_setting_record_pickup_time', '30');
    //$p_id = get_the_ID();
    //$p_title = the_title('', '', false);
    // Если указан параметр rootcategory, то выводим все товары раздела
    // Иначе - товары категории
    if ($rootcategory === '1' && $type_id === '0') {
        $sql1 = ' AND type_id IN (' . tzs_build_product_types_id_str($cur_type_id) . ')';
        $p_name = '';
    } else {
        //$sql1 = ' AND type_id='.$type_id;
        $sql1 = '';
        $p_name = get_post_field('post_name', $type_id);
    }
    if ($form_type === 'products') {
        $sp = tzs_validate_pr_search_parameters();
    } else {
        $sp = tzs_validate_search_parameters();
    }
    $errors = $sp['errors'];
    switch ($form_type) {
        case 'products':
            $pr_type_array = tzs_get_children_pages(TZS_PR_ROOT_CATEGORY_PAGE_ID);
            $table_name = TZS_PRODUCTS_TABLE;
            $table_error_msg = 'товаров';
            $table_order_by = 'created';
            $order_table_prefix = 'PR';
            break;
        case 'trucks':
            $table_name = TZS_TRUCK_TABLE;
            $table_error_msg = 'транспорта';
            $table_order_by = 'time';
            $table_prefix = 'tr';
            $order_table_prefix = 'TR';
            break;
        case 'shipments':
            $table_name = TZS_SHIPMENT_TABLE;
            $table_error_msg = 'грузов';
            $table_order_by = 'time';
            $table_prefix = 'sh';
            $order_table_prefix = 'SH';
            break;
        default:
            array_push($errors, "Неверно указан тип формы");
    }
    if (count($errors) > 0) {
        $output_error = print_errors($errors);
    }
    if (count($errors) == 0) {
        if ($form_type === 'products') {
            $s_sql = tzs_search_pr_parameters_to_sql($sp, '');
            $s_title = tzs_search_pr_parameters_to_str($sp);
        } else {
            $s_sql = tzs_search_parameters_to_sql($sp, $table_prefix);
            $s_title = tzs_search_parameters_to_str($sp);
        }
        $output_info = $p_title;
        if (strlen($s_title) > 0) {
            $output_info .= ' * ' . $s_title;
        }
        //$page = current_page_number();
        global $wpdb;
        //$url = current_page_url();
        $pp = floatval($records_per_page);
        $sql = "SELECT COUNT(*) as cnt FROM " . $table_name . " a WHERE active=1 {$sql1} {$s_sql};";
        $res = $wpdb->get_row($sql);
        if (count($res) == 0 && $wpdb->last_error != null) {
            $output_error .= '<div>Не удалось отобразить список ' . $table_error_msg . '. Свяжитесь, пожалуйста, с администрацией сайта.<br>' . $sql . '<br>' . $wpdb->last_error . '</div>';
        } else {
            $records = $res->cnt;
            $pages = ceil($records / $pp);
            if ($pages == 0) {
                $pages = 1;
            }
            if ($page > $pages) {
                $page = $pages;
            }
            $from = ($page - 1) * $pp;
            //$sql = "SELECT * FROM ".$table_name." WHERE active=1 $sql1 $s_sql ORDER BY ".$table_order_by." DESC LIMIT $from,$pp;";
            // Хитрый запрос для отбора ТОП
            $sql = "SELECT a.*,";
            $sql .= " b.number AS order_number,";
            $sql .= " b.status AS order_status,";
            $sql .= " b.dt_pay AS order_dt_pay,";
            $sql .= " b.dt_expired AS order_dt_expired,";
            $sql .= " IFNULL(b.dt_pay, a." . $table_order_by . ") AS dt_sort,";
            $sql .= " IF(b.status IS NOT NULL, 2, IF(ROUND((UNIX_TIMESTAMP() - UNIX_TIMESTAMP(a.dt_pickup))/60, 0) <= " . $record_pickup_time . ", 1, 0)) AS top_status,";
            $sql .= " LOWER(c.code) AS from_code";
            if ($form_type != 'products') {
                $sql .= ", LOWER(d.code) AS to_code";
            }
            $sql .= " FROM " . $table_name . " a";
            $sql .= " LEFT OUTER JOIN wp_tzs_orders b ON (b.tbl_type = '" . $order_table_prefix . "' AND a.id = b.tbl_id AND b.status = 1 AND b.dt_expired > NOW())";
            $sql .= " LEFT OUTER JOIN wp_tzs_countries c ON (a.from_cid = c.country_id)";
            if ($form_type != 'products') {
                $sql .= " LEFT OUTER JOIN wp_tzs_countries d ON (a.to_cid = d.country_id)";
            }
            $sql .= " WHERE active=1 {$sql1} {$s_sql}";
            $sql .= " ORDER BY top_status DESC, order_status DESC, dt_sort DESC";
            $sql .= " LIMIT {$from},{$pp};";
            $res = $wpdb->get_results($sql);
            if (count($res) == 0 && $wpdb->last_error != null) {
                $output_error .= '<div>Не удалось отобразить список ' . $table_error_msg . '. Свяжитесь, пожалуйста, с администрацией сайта.<br>' . $sql . '<br>' . $wpdb->last_error . '</div>';
            } else {
                if (count($res) == 0) {
                    $output_error .= '<div>По Вашему запросу ничего не найдено.</div>';
                } else {
                    foreach ($res as $row) {
                        if ($form_type === 'products') {
                            $output_tbody .= tzs_products_table_record_out($row, $form_type, $pr_type_array);
                        } else {
                            $output_tbody .= tzs_tr_sh_table_record_out($row, $form_type);
                        }
                        $lastrecid = $row->id;
                    }
                }
                // Пагинация
                if ($pages > 1) {
                    if ($page > 1) {
                        $page0 = $page - 1;
                        $output_pnav .= '<a tag="page" page="' . $page0 . '" href="javascript:TblTbodyReload(' . $page0 . ')">« Предыдущая</a>&nbsp;';
                    }
                    $start = 1;
                    $stop = $pages;
                    for ($i = $start; $i <= $stop; $i++) {
                        if ($i == $page) {
                            $output_pnav .= '&nbsp;&nbsp;<span>' . $i . '</span>&nbsp;';
                        } else {
                            $output_pnav .= '&nbsp;&nbsp;<a tag="page" page="' . $i . '" href="javascript:TblTbodyReload(' . $i . ')">' . $i . '</a>&nbsp;';
                        }
                    }
                    if ($page < $pages) {
                        $page1 = $page + 1;
                        $output_pnav .= '&nbsp;&nbsp;<a tag="page" page="' . $page1 . '" href="javascript:TblTbodyReload(' . $page1 . ')">Следующая »</a>';
                    }
                }
            }
        }
    }
    $output = array('output_info' => $output_info, 'output_error' => $output_error, 'output_tbody' => $output_tbody, 'output_pnav' => $output_pnav, 'output_tbody_cnt' => count($res), 'lastrecid' => $lastrecid, 'type_id' => $type_id, 'rootcategory' => $rootcategory, 'sql' => $sql, 'sql1' => $sql1, 's_sql' => $s_sql);
    //echo json_encode($output);
    // print_r($output_tbody);
    return $output;
}
Example #8
0
    echo '<p>' . $lang['i_problems'] . '</p>';
    print_errors();
    print_retry();
} elseif (!check_configs()) {
    echo '<p>' . $lang['i_modified'] . '</p>';
    print_errors();
} elseif (check_data($_REQUEST['d'])) {
    // check_data has sanitized all input parameters
    if (!store_data($_REQUEST['d'])) {
        echo '<p>' . $lang['i_failure'] . '</p>';
        print_errors();
    } else {
        echo '<p>' . $lang['i_success'] . '</p>';
    }
} else {
    print_errors();
    print_form($_REQUEST['d']);
}
?>
    </div>


<div style="clear: both">
  <a href="http://dokuwiki.org/"><img src="lib/tpl/default/images/button-dw.png" alt="driven by DokuWiki" /></a>
  <a href="http://www.php.net"><img src="lib/tpl/default/images/button-php.gif" alt="powered by PHP" /></a>
</div>
</body>
</html>
<?php 
/**
 * Print the input form
Example #9
0
<?php

$endpoint = 'sandbox';
require_once './mturk.php';
// Calculate the request authentication parameters
$operation = "CreateHIT";
$title = "How's the weather?";
$description = 'Write a paragraph about the weather in your area.';
$keywords = "weather, fun, writing, vtcs5774";
$url = 'http://contextslices.kurtluther.com/weather.php';
$frame_height = 400;
// height of window, in pixels
$timestamp = generate_timestamp(time());
$signature = generate_signature($SERVICE_NAME, $operation, $timestamp, $AWS_SECRET_ACCESS_KEY);
// Construct the request
$url2 = $SERVICE_ENDPOINT . "?Service=" . urlencode($SERVICE_NAME) . "&Operation=" . urlencode($operation) . "&Title=" . urlencode($title) . "&Description=" . urlencode($description) . "&Keywords=" . urlencode($keywords) . "&Reward.1.Amount=0.25" . "&Reward.1.CurrencyCode=USD" . "&Question=" . urlencode(constructQuestion($url, $frame_height)) . "&AssignmentDurationInSeconds=3600" . "&LifetimeInSeconds=3600" . "&AutoApprovalDelayInSeconds=86400" . "&MaxAssignments=10" . "&Version=" . urlencode($SERVICE_VERSION) . "&Timestamp=" . urlencode($timestamp) . "&AWSAccessKeyId=" . urlencode($AWS_ACCESS_KEY_ID) . "&ResponseGroup.0=Minimal" . "&ResponseGroup.1=HITDetail" . "&QualificationRequirement.1.QualificationTypeId=00000000000000000071" . "&QualificationRequirement.1.Comparator=EqualTo" . "&QualificationRequirement.1.LocaleValue.Country=US" . "&QualificationRequirement.2.QualificationTypeId=000000000000000000L0" . "&QualificationRequirement.2.Comparator=GreaterThan" . "&QualificationRequirement.2.IntegerValue=90" . "&QualificationRequirement.3.QualificationTypeId=00000000000000000040" . "&QualificationRequirement.3.Comparator=GreaterThan" . "&QualificationRequirement.3.IntegerValue=50" . "&Signature=" . urlencode($signature);
// Make the request
$xml = simplexml_load_file($url2);
// Print any errors
if ($xml->OperationRequest->Errors) {
    print_errors($xml->OperationRequest->Errors->Error);
}
$hitID = strval($xml->HIT->HITId);
if ($hitID != '') {
    print "Created HIT " . $hitID . " on Amazon Mechanical Turk (" . $endpoint . ")...<br/>\n";
}
print "====================<br/>\n";
Example #10
0
function send_blast_email($binding, $req_info)
{
    $delivery = create_delivery($req_info);
    $handler = array();
    $handler['mode'] = "insert";
    $params = array("deliveries" => $delivery, "handler" => $handler);
    try {
        $res = $binding->writeDeliveries($params);
        $res = normalize_result($res);
        if (count($res) != 1) {
            echo "Expecting only one result for writeDeliveries(), since we sent only one delivery.";
        }
        $res = $res[0];
        if ($res->success) {
            return true;
        } else {
            print_errors($res->errors);
            return false;
        }
    } catch (SoapFault $ex) {
        print_exception($binding, $ex);
        return false;
    }
}
Example #11
0
            <div class="custom-error" id="input-txtfield-error">
                <?php 
print_errors('input-txtfield-error');
?>
            </div>

            <div class="form-group">
                <label for="input-textarea">Textarea</label>
                <textarea name="input-textarea" placeholder="Textarea" class="form-control" id="input-textarea"><?php 
echo set_value('input-textarea') ? set_value('input-textarea') : "";
?>
</textarea>
            </div>
            <div class="custom-error" id="input-textarea-error">
                <?php 
print_errors('input-textarea-error');
?>
            </div>

            <div class="form-group">
                <label>Radio button</label>
                <br/>
                <label>
                    <input type="radio" name="input-radio" value="1" <?php 
echo set_radio('input-radio', 1);
?>
>R1
                </label>
                &nbsp;&nbsp;&nbsp;
                <label>
                    <input type="radio" name="input-radio" value="2" <?php 
Example #12
0
function tzs_print_edit_image_form($errors)
{
    $php_max_file_uploads = (int) ini_get('max_file_uploads');
    if ($php_max_file_uploads > TZS_PR_MAX_IMAGES) {
        $php_max_file_uploads = TZS_PR_MAX_IMAGES;
    }
    if (isset($_POST['image_id_lists']) && $_POST['image_id_lists'] !== '') {
        $img_names = explode(';', $_POST['image_id_lists']);
    } else {
        $img_names = array();
    }
    $form_type = get_param('form_type');
    $form_type_info = array('product' => array('product', TZS_PRODUCTS_TABLE, 'Товар/услуга', 'товаре/услуге', 'товар/услугу', 'товара/услуги'), 'auction' => array('auction', TZS_AUCTIONS_TABLE, 'Тендер', 'тендере', 'тендер', 'тендера'));
    echo '<div style="clear: both;"></div>';
    print_errors($errors);
    ?>
    <div style="clear: both;"></div>
    <div id="images_edit" style="width: 100%;">
    
    <form enctype="multipart/form-data" method="post" id="fpost" class="pr_edit_form post-form" action="">
        <div id="">
            <!--h3>Изменение прикрепленных изображений</h3>
            <hr/-->
            <p>Наименование <?php 
    echo $_POST['form_type'] == 'product' ? 'товара/услуги' : 'тендера';
    ?>
: <strong>"<?php 
    echo $_POST['title'];
    ?>
"</strong> (Id=<?php 
    echo $_POST['id'];
    ?>
)</p>
            <p>Допустимое кол-во изображений: <strong><?php 
    echo $php_max_file_uploads;
    ?>
</strong></p>
            <p>Допустимый размер одного изображения: <strong>2 Мб</strong></p>
        </div>
        <div id="">
            <table id="tbl_products" border='0'>
                <tr>
                    <th id="wight">Номер изображения</th>
                    <th>Прикрепленное изображение</th>
                    <th id="wight">Удалить изображение</th>
                    <th>Новое изображение</th>
                    <th>Главное изображение</th>
                </tr>
                <?php 
    for ($i = 0; $i < $php_max_file_uploads; $i++) {
        ?>
                    <tr>
                        <td><?php 
        echo $i + 1;
        ?>
</td>
                    <?php 
        if (count($img_names) > 0 && $img_names[$i] !== null && $img_names[$i] !== '') {
            $main_image_disabled = '';
            $img_info = wp_get_attachment_image_src($img_names[$i], 'thumbnail');
            ?>
                        <td><img src="<?php 
            echo $img_info[0];
            ?>
" name="image_<?php 
            echo $i;
            ?>
" alt="Изображение №<?php 
            echo $i + 1;
            ?>
"></td>
                        <td><input type="checkbox" id="" name="del_image_<?php 
            echo $i;
            ?>
" <?php 
            if (isset($_POST["del_image_{$i}"])) {
                echo 'checked="checked"';
            }
            ?>
></td>
                        <td><input type="file" id="chg_image" name="chg_image_<?php 
            echo $i;
            ?>
" multiple="false" accept="image/*"></td>
                    <?php 
        } else {
            $main_image_disabled = 'disabled="disabled"';
            ?>
                        <td><input type="file" id="add_image" name="add_image_<?php 
            echo $i;
            ?>
" multiple="false" accept="image/*"></td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    <?php 
        }
        ?>
                        <td>
                            <input type="radio" <?php 
        echo $main_image_disabled;
        ?>
 tag="main_image_'.$i.'" id="main_image" name="main_image" value="<?php 
        echo $i;
        ?>
" <?php 
        if (isset($_POST['main_image']) && $_POST['main_image'] == "{$i}") {
            echo 'checked="checked"';
        }
        ?>
>
                            <?php 
        if ($i === 0) {
            wp_nonce_field('image_0', 'image_0_nonce');
        }
        ?>
                        </td>
                    </tr>
                <?php 
    }
    ?>
            </table>
        </div>
            <input type="hidden" name="action" value="editimages"/>
            <input type="hidden" name="id" value="<?php 
    echo_val('id');
    ?>
"/>
            <input type="hidden" name="image_id_lists" value="<?php 
    echo_val('image_id_lists');
    ?>
"/>
            <?php 
    if (isset($_POST['main_image'])) {
        ?>
                <input type="hidden" name="old_main_image" value="<?php 
        echo_val('main_image');
        ?>
"/>
            <?php 
    }
    ?>
            <input type="hidden" name="formName" value="<?php 
    echo_val('form_type');
    ?>
images" />
        <table>
            <tr>
                <td width="130px">&nbsp;</td>
                <td>
                    <input name="addpost" type="submit" id="addpostsub" class="submit_button" value="Загрузить/обновить изображения"/>
                </td>
                <td width="15px">&nbsp;</td>
                <td>
                    <a href="/view-<?php 
    echo $form_type_info[$form_type][0];
    ?>
/?id=<?php 
    echo_val('id');
    ?>
&spis=new" id="edit_images">Просмотреть <?php 
    echo $form_type_info[$form_type][4];
    ?>
</a>
                </td>
            </tr>
        </table>
    </form>
    </div>
    
	
    <script>
        function onMainImageRadioStatus(e) {
            fname = e.target.name;
            fname_ar = fname.split('_');
            i = fname_ar[2];
            s3 = 'input:radio[name=main_image]:nth(' + i + ')';
            if (e.target.files.length > 0) {
                jQuery(s3).removeAttr('disabled');
            } else {
                jQuery(s3).attr('disabled', 'disabled');
            }
        }

        jQuery(document).ready(function(){
            jQuery('input[type=file]').change(function(e) {
                onMainImageRadioStatus(e);
            });
            
            jQuery('#fpost').submit(function() {
                jQuery('#addpostsub').attr('disabled','disabled');
                jQuery('#images_edit').after('<div id="fpost_status"><h4>Идет загрузка файлов, подождите...</h4></div>');
                return true;
            });
        });
    </script>
    <?php 
}
Example #13
0
File: lib.php Project: rrusso/EARS
function finished_content($params)
{
    list($changed_prefs, $new_prefs, $errors) = $params;
    // Give user some feedback; maybe something went down
    $html = print_errors($errors);
    if (empty($changed_prefs) && empty($new_prefs)) {
        $html .= '<span class="label">There are no changes</span>';
    } else {
        $html .= print_changes('Change settings:', $changed_prefs);
        $html .= print_changes('New settings:', $new_prefs);
    }
    return $html;
}
Example #14
0
    /**
     * Loop thru all the patch files that will be overwitten or altered, 
     * to find out if they are modified by user. If it's modified, warn user.
     * @access  private
     * @return  true  if there are files being modified
     *          false if no file is modified
     * @author  Cindy Qi Li
     */
    function hasFilesModified()
    {
        $overwrite_modified_files = false;
        $alter_modified_files = false;
        $has_not_exist_files = false;
        // no file action is defined, return nothing is modified (false)
        if (!is_array($this->patch_array[files])) {
            return false;
        }
        foreach ($this->patch_array[files] as $row_num => $patch_file) {
            if ($patch_file["action"] == 'alter' || $patch_file["action"] == 'overwrite') {
                if (!file_exists($patch_file['location'] . $patch_file['name'])) {
                    $not_exist_files .= $patch_file['location'] . $patch_file['name'] . '<br />';
                    $has_not_exist_files = true;
                } else {
                    if ($this->isFileModified($patch_file['location'], $patch_file['name'])) {
                        if ($patch_file['action'] == 'overwrite') {
                            $overwrite_files .= realpath($patch_file['location'] . $patch_file['name']) . '<br />';
                            $overwrite_modified_files = true;
                        }
                        if ($patch_file['action'] == 'alter') {
                            $alter_files .= realpath($patch_file['location'] . $patch_file['name']) . '<br />';
                            $alter_modified_files = true;
                        }
                    }
                }
            }
        }
        if ($has_not_exist_files) {
            $this->errors[] = _AC('update_local_file_not_exist') . $not_exist_files;
        }
        if ($overwrite_modified_files) {
            $this->errors[] = _AC('updater_overwrite_modified_files') . $overwrite_files;
        }
        if ($alter_modified_files) {
            $this->errors[] = _AC('updater_alter_modified_files') . $alter_files;
        }
        if (count($this->errors) > 0) {
            if ($has_not_exist_files) {
                $notes = '';
            } else {
                $notes = '
			  <form action="' . $_SERVER['PHP_SELF'] . '?id=' . $_POST['id'] . '&who=' . $_POST['who'] . '" method="post" name="skip_files_modified">
			  <div class="row buttons">
					<input type="submit" name="yes" value="' . _AC('yes') . '" accesskey="y" />
					<input type="submit" name="no" value="' . _AC('no') . '" />
					<input type="hidden" name="install" value="' . $_POST['install'] . '" />
					<input type="hidden" name="install_upload" value="' . $_POST['install_upload'] . '" />
					<input type="hidden" name="ignore_version" value="' . $_POST['ignore_version'] . '" />
				</div>
				</form>';
            }
            print_errors($this->errors, $notes);
            unset($this->errors);
            return true;
        }
        return false;
    }
Example #15
0
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="images/ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="images/ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="images/ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="images/ico/apple-touch-icon-57-precomposed.png">
</head><!--/head-->

<body>
<?php 
include_once 'header.php';
?>
		
	<section id="form"><!--form-->
		<div class="container">
			<div class="row">
				<?php 
echo print_errors();
?>
 
				<div class="col-sm-4 col-sm-offset-1">
					<div class="login-form"><!--login form-->
						<h2>Login to your account</h2>
						<form action="login-validation" method="post">
							<input name="email" type="email" placeholder="Email Address" />
							<input name="password" type="password" placeholder="Password" />
							<span>
								<input type="checkbox" class="checkbox"> 
								Keep me signed in
							</span>
							<button name="signin" type="submit" class="btn btn-default">Login</button>
						</form>
					</div><!--/login form-->
Example #16
0
function tzs_front_end_del_product_handler($attrs)
{
    ob_start();
    $errors = array();
    $user_id = get_current_user_id();
    $sh_id = isset($_GET['id']) && is_numeric($_GET['id']) ? intval($_GET['id']) : 0;
    if (!is_user_logged_in()) {
        print_error("Вход в систему обязателен");
    } else {
        if ($sh_id <= 0) {
            print_error('Товар/услуга не найден');
        } else {
            global $wpdb;
            // Вначале попытаемся удалить изображения
            $sql = "SELECT * FROM " . TZS_PRODUCTS_TABLE . " WHERE id={$sh_id} AND user_id={$user_id};";
            $row = $wpdb->get_row($sql);
            if (count($row) === 0 && $wpdb->last_error != null) {
                array_push($errors, 'Не удалось получить список товаров. Свяжитесь, пожалуйста, с администрацией сайта');
                array_push($errors, $wpdb->last_error);
                print_errors($errors);
            } else {
                if ($row === null) {
                    print_error("Товар/услуга не найден (id={$sh_id} AND user_id={$user_id})");
                } else {
                    if (strlen($row->image_id_lists) > 0) {
                        $img_names = explode(';', $row->image_id_lists);
                        for ($i = 0; $i < count($img_names); $i++) {
                            if (false === wp_delete_attachment($img_names[$i], true)) {
                                array_push($errors, "Не удалось удалить файл с изображением: " . $img_names[$i]->get_error_message());
                            }
                        }
                    }
                    if (count($errors) > 0) {
                        print_errors($errors);
                    } else {
                        // Удаление записи
                        $sql = "DELETE FROM " . TZS_PRODUCTS_TABLE . " WHERE id={$sh_id} AND user_id={$user_id};";
                        if (false === $wpdb->query($sql)) {
                            $errors = array();
                            array_push($errors, "Не удалось удалить Ваш товар/услугу. Свяжитесь, пожалуйста, с администрацией сайта");
                            array_push($errors, $wpdb->last_error);
                            print_errors($errors);
                        } else {
                            echo "Товар/услуга удален";
                        }
                    }
                }
            }
        }
    }
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}
Example #17
0
                $msg->printInfos('PATCH_INSTALLED_AND_REMOVE_PERMISSION');
            }
            $feedbacks[] = _AT('remove_write_permission');
            foreach ($remove_permission_files as $remove_permission_file) {
                if ($remove_permission_file != "") {
                    $feedbacks[count($feedbacks) - 1] .= "<strong>" . $remove_permission_file . "</strong><br />";
                }
            }
            $notes = '<form action="' . $_SERVER['PHP_SELF'] . '?patch_id=' . $patch_id . '" method="post" name="remove_permission">
		  <div class="row buttons">
				<input type="hidden" name="patch_id" value="' . $patch_id . '" />
				<input type="submit" name="done" value="' . _AT('done') . '" accesskey="d" />
			</div>
			</form>';
        }
        print_errors($feedbacks, $notes);
    }
    // display backup file info after remove permission step
    if ($row["remove_permission_files"] == "") {
        $msg->printFeedbacks('PATCH_INSTALLED_SUCCESSFULLY');
        if ($row["backup_files"] != "") {
            $backup_files = get_array_by_delimiter($row["backup_files"], "|");
            if (count($backup_files) > 0) {
                $feedbacks[] = _AT('patcher_show_backup_files');
                foreach ($backup_files as $backup_file) {
                    if ($backup_file != "") {
                        $feedbacks[count($feedbacks) - 1] .= "<strong>" . $backup_file . "</strong><br />";
                    }
                }
            }
        }
Example #18
0
function tzs_front_end_del_truck_handler($attrs)
{
    ob_start();
    $user_id = get_current_user_id();
    $tr_id = isset($_GET['id']) && is_numeric($_GET['id']) ? intval($_GET['id']) : 0;
    if (!is_user_logged_in()) {
        print_error("Вход в систему обязателен");
    } else {
        if ($tr_id <= 0) {
            print_error('Груз не найден');
        } else {
            global $wpdb;
            $sql = "DELETE FROM " . TZS_TRUCK_TABLE . " WHERE id={$tr_id} AND user_id={$user_id};";
            if (false === $wpdb->query($sql)) {
                $errors = array();
                array_push($errors, "Не удалось удалить Ваш транспорт. Свяжитесь, пожалуйста, с администрацией сайта");
                array_push($errors, $wpdb->last_error);
                print_errors($errors);
            } else {
                echo "Груз удален";
            }
        }
    }
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}
Example #19
0
    ?>
" />
		</div>
		<div>
			<?php 
    print_errors($errors, 'question');
    ?>
			<label for="question">Question secrète :</label>
			<input type="text" name="question" id="question" value="<?php 
    echo $fields['question'];
    ?>
" />
		</div>
		<div>
			<?php 
    print_errors($errors, 'answer');
    ?>
			<label for="answer">Réponse secrète :</label>
			<input type="text" name="answer" id="answer" value="<?php 
    echo $fields['answer'];
    ?>
" />
		</div>
		<input type="submit" />
	</form>
<?php 
}
?>

<?php 
if (DEBUG) {
Example #20
0
    if (isset($progress)) {
        print_feedback($progress);
    }
    print_errors($errors);
    echo '<input type="hidden" name="step" value="' . $step . '" />';
    unset($_POST['step']);
    unset($_POST['action']);
    unset($errors);
    print_hidden($step);
    echo '<p><strong>Note:</strong> To change permissions on Unix use <kbd>chmod a+rw</kbd> then the file name.</p>';
    echo '<p align="center"><input type="submit" class="button" value=" Try Again " name="retry" />';
} else {
    if (!copy('../../' . $_POST['step1']['old_path'] . '/include/config.inc.php', '../include/config.inc.php')) {
        echo '<input type="hidden" name="step" value="' . $step . '" />';
        print_feedback($progress);
        $errors[] = 'include/config.inc.php cannot be written! Please verify that the file exists and is writeable. On Unix issue the command <kbd>chmod a+rw include/config.inc.php</kbd> to make the file writeable. On Windows edit the file\'s properties ensuring that the <kbd>Read-only</kbd> attribute is <em>not</em> checked and that <kbd>Everyone</kbd> access permissions are given to that file.';
        print_errors($errors);
        echo '<p><strong>Note:</strong> To change permissions on Unix use <kbd>chmod a+rw</kbd> then the file name.</p>';
        echo '<p align="center"><input type="submit" class="button" value=" Try Again " name="retry" />';
    } else {
        echo '<input type="hidden" name="step" value="' . $step . '" />';
        print_hidden($step);
        $progress[] = 'Data has been saved successfully.';
        @chmod('../include/config.inc.php', 0444);
        print_feedback($progress);
        echo '<p align="center"><input type="submit" class="button" value=" Next &raquo; " name="submit" /></p>';
    }
}
?>

</form>
Example #21
0
function tzs_front_end_auctions_handler($atts)
{
    // Определяем атрибуты
    // [tzs-view-auctions rootcategory="1"] - указываем на странице раздела
    // [tzs-view-auctions] - указываем на страницах подразделов
    extract(shortcode_atts(array('rootcategory' => '0'), $atts, 'tzs-view-auctions'));
    ob_start();
    $p_id = get_the_ID();
    $p_title = the_title('', '', false);
    // Если указан параметр rootcategory, то выводим все товары раздела
    // Иначе - товары категории
    if ($rootcategory === '1') {
        $sql1 = ' AND type_id IN (' . tzs_build_product_types_id_str($p_id) . ')';
        $p_name = '';
    } else {
        $sql1 = ' AND type_id=' . $p_id;
        $p_name = get_post_field('post_name', $p_id);
    }
    $sp = tzs_validate_pr_search_parameters();
    $errors = $sp['errors'];
    if (count($errors) > 0) {
        print_errors($errors);
    }
    ?>
	<a href="javascript:showSearchDialog();" id="edit_search">Изменить параметры поиска</a>
    <?php 
    if (count($errors) == 0) {
        $s_sql = tzs_search_pr_parameters_to_sql($sp, '');
        $s_title = tzs_search_pr_parameters_to_str($sp);
        ?>
            <div id="search_info"><?php 
        echo $p_title;
        echo strlen($s_title) > 0 ? ' * ' . $s_title : '';
        ?>
</div>
	<?php 
        $page = current_page_number();
        ?>
	<a tag="page" id="realod_btn" href="<?php 
        echo build_page_url($page);
        ?>
">Обновить</a>
	<?php 
        global $wpdb;
        $url = current_page_url();
        $pp = TZS_RECORDS_PER_PAGE;
        $sql = "SELECT COUNT(*) as cnt FROM " . TZS_AUCTIONS_TABLE . " WHERE active=1 {$sql1} {$s_sql};";
        $res = $wpdb->get_row($sql);
        if (count($res) == 0 && $wpdb->last_error != null) {
            print_error('Не удалось отобразить список тендеров. Свяжитесь, пожалуйста, с администрацией сайта');
        } else {
            $records = $res->cnt;
            $pages = ceil($records / $pp);
            if ($pages == 0) {
                $pages = 1;
            }
            if ($page > $pages) {
                $page = $pages;
            }
            $from = ($page - 1) * $pp;
            $sql = "SELECT a.*,(SELECT COUNT(*) FROM " . TZS_AUCTION_RATES_TABLE . " c WHERE c.auction_id = a.id) AS rate_count FROM " . TZS_AUCTIONS_TABLE . " a  WHERE a.active=1 {$sql1} {$s_sql} ORDER BY a.created DESC LIMIT {$from},{$pp};";
            $res = $wpdb->get_results($sql);
            if (count($res) == 0 && $wpdb->last_error != null) {
                print_error('Не удалось отобразить список тендеров. Свяжитесь, пожалуйста, с администрацией сайта.');
            } else {
                if (count($res) == 0) {
                    ?>
                    <div style="clear: both;"></div>
                    <div class="errors">
                        <div id="info error">По Вашему запросу ничего не найдено.</div>
                    </div>
                    <?php 
                } else {
                    ?>
                    <div>
                        <table id="tbl_products">
                        <tr>
                            <th id="tbl_products_id">Номер</th>
                            <th id="tbl_auctions_lot">Тип<br>Кол-во ставок</th>
                            <th id="tbl_products_img">Фото</th>
                            <th id="tbl_products_dtc">Дата размещения<br>Дата окончания</th>
                            <th id="tbl_auctions_title">Описание</th>
                            <th id="tbl_auctions_copies">Кол-во</th>
                            <th id="tbl_products_price">Цена за единицу</th>
                            <th id="tbl_products_payment">Форма оплаты</th>
                            <th id="tbl_products_cities">Город</th>
                            <th id="tbl_products_comm">Комментарии</th>
                        </tr>
                        <?php 
                    foreach ($res as $row) {
                        ?>
                            <tr rid="<?php 
                        echo $row->id;
                        ?>
" id="<?php 
                        echo $row->is_lot == 1 ? 'tbl_auctions_tr_lot_1' : 'tbl_auctions_tr_lot_0';
                        ?>
">
                                <td><?php 
                        echo $row->id;
                        ?>
</td>
                                <td><?php 
                        echo $row->is_lot == 1 ? 'Продам' : 'Куплю';
                        ?>
<br><br><?php 
                        echo 'Ставок-' . $row->rate_count;
                        ?>
</td>
                                <td>
                                    <?php 
                        if (strlen($row->image_id_lists) > 0) {
                            $main_image_id = $row->main_image_id;
                            // Вначале выведем главное изображение
                            $attachment_info = wp_get_attachment_image_src($main_image_id, 'full');
                            if ($attachment_info !== false) {
                                ?>
                                            <div class="ienlarger">
                                                <a href="#nogo">
                                                    <img src="<?php 
                                echo $attachment_info[0];
                                ?>
" alt="thumb" class="resize_thumb">
                                                    <span>
                                                        <?php 
                                echo htmlspecialchars($row->title);
                                ?>
<br/>
                                                        <img src="<?php 
                                echo $attachment_info[0];
                                ?>
" alt="large"/>
                                                    </span>
                                                </a>
                                            </div>
                                        <?php 
                            } else {
                                echo '&nbsp;';
                            }
                        } else {
                            echo '&nbsp;';
                        }
                        ?>
                                </td>
                                <td><?php 
                        echo convert_date($row->created);
                        ?>
<br><?php 
                        echo convert_date($row->expiration);
                        ?>
</td>
                                <td><?php 
                        echo htmlspecialchars($row->title);
                        ?>
</td>
                                <td><?php 
                        echo $row->copies . " " . $GLOBALS['tzs_au_unit'][$row->unit];
                        ?>
</td>
                                <td><?php 
                        echo $row->price . " " . $GLOBALS['tzs_pr_curr'][$row->currency];
                        ?>
</td>
                                <td><?php 
                        echo $GLOBALS['tzs_pr_payment'][$row->payment];
                        ?>
</td>
                                <td><?php 
                        echo tzs_city_to_str($row->from_cid, $row->from_rid, $row->from_sid, $row->city_from);
                        ?>
</td>
                                <td><?php 
                        echo htmlspecialchars($row->comment);
                        ?>
</td>
                            </tr>
                            <?php 
                    }
                    ?>
                        </table>
                    </div>
                <?php 
                }
                build_pages_footer($page, $pages);
            }
        }
    }
    ////
    ?>
        <script src="/wp-content/plugins/tzs/assets/js/search.js"></script>
        <script>
                var post = [];
                <?php 
    echo "// POST dump here\n";
    foreach ($_POST as $key => $value) {
        echo "post[" . tzs_encode2($key) . "] = " . tzs_encode2($value) . ";\n";
    }
    if (!isset($_POST['type_id'])) {
        echo "post[" . tzs_encode2("type_id") . "] = " . tzs_encode2($p_id) . ";\n";
    }
    if (!isset($_POST['cur_type_id'])) {
        echo "post[" . tzs_encode2("cur_type_id") . "] = " . tzs_encode2($p_id) . ";\n";
    }
    if (!isset($_POST['cur_post_name']) && $p_name !== '') {
        echo "post[" . tzs_encode2("cur_post_name") . "] = " . tzs_encode2($p_name) . ";\n";
    }
    ?>

                function showSearchDialog() {
                        doSearchDialog('auctions', post, null);
                }

                jQuery(document).ready(function(){
                        jQuery('#tbl_products').on('click', 'td', function(e) {  
                                var nonclickable = 'true' == e.delegateTarget.rows[0].cells[this.cellIndex].getAttribute('nonclickable');
                                var id = this.parentNode.getAttribute("rid");
                                if (!nonclickable)
                                        document.location = "/account/view-auction/?id="+id;
                        });
                        hijackLinks(post);
                });
        </script>
	<?php 
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}