本文整理汇总了PHP中remove_lastchar函数的典型用法代码示例。如果您正苦于以下问题:PHP remove_lastchar函数的具体用法?PHP remove_lastchar怎么用?PHP remove_lastchar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了remove_lastchar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: replaceQueryStringArray
function replaceQueryStringArray($query_string, $to_remove)
{
// we are only interested in anything after the ?, if there is one.
if (strstr($query_string, '?')) {
$parts = explode('?', $query_string);
$filename = $parts[0];
$query_string = $parts[1];
}
$query_string = str_replace('&', '&', $query_string);
parse_str($query_string, $haystack);
foreach ($haystack as $key => $val) {
if (in_array($key, $to_remove)) {
unset($haystack[$key]);
} else {
$output .= $key . '=' . $val . '&';
}
}
if ($filename) {
$filename .= '?';
}
return $filename . remove_lastchar($output, "&");
//http_build_query($haystack);
}
示例2: ptype2
function ptype2($_ptype = NULL, $_psubtype = NULL, $_querystring = NULL)
{
// add onload statement
$output['onload'] = 'init(document.forms[0].dea_psubtype); ';
// if subtype is supplied, get js to select it onload
// not used. instead we build manual list, which is replaced by js list onChange (first list)
if ($_psubtype) {
$output['onload'] .= '';
}
// get ptype types to populate javascript drop downs (select current ptype, use js to select subtype)
$sql = "SELECT pty_id,pty_title,pty_type FROM ptype ORDER BY pty_title";
$_result = mysql_query($sql);
if (!$_result) {
die("MySQL Error: " . mysql_error() . "<pre>ptype: " . $sql . "</pre>");
}
while ($row = mysql_fetch_array($_result)) {
if (!$row["pty_type"]) {
$render_ptype .= '<option value="' . $row["pty_id"] . '"';
if ($_ptype == $row["pty_id"]) {
$render_ptype .= ' selected';
}
$render_ptype .= '>' . $row["pty_title"] . '</option>' . "\n";
} elseif ($row["pty_type"] == "1") {
$_js1 .= "'" . $row["pty_title"] . "','" . $row["pty_id"] . "',";
} elseif ($row["pty_type"] == "2") {
$_js2 .= "'" . $row["pty_title"] . "','" . $row["pty_id"] . "',";
} elseif ($row["pty_type"] == "3") {
$_js3 .= "'" . $row["pty_title"] . "','" . $row["pty_id"] . "',";
}
}
// create master type drop down
$output['dd1'] = '<select name="dea_ptype" onchange="populate(document.forms[0].dea_ptype,document.forms[0].dea_psubtype)">' . "\n";
$output['dd1'] .= '<option value="0"></option>' . "\n";
$output['dd1'] .= $render_ptype;
$output['dd1'] .= '</select>' . "\n";
// create subtype drop down (with populated list if a subtype is present)
if ($_psubtype) {
$sql = "SELECT pty_id,pty_type,pty_title FROM ptype WHERE pty_type = " . $_ptype;
$_result = mysql_query($sql);
if (!$_result) {
die("MySQL Error: " . mysql_error() . "<pre>ptype: " . $sql . "</pre>");
}
while ($row = mysql_fetch_array($_result)) {
$render_psubtype .= '<option value="' . $row["pty_id"] . '"';
if ($row["pty_id"] == $_psubtype) {
$render_psubtype .= ' selected';
}
$render_psubtype .= '>' . $row["pty_title"] . '</option>' . "\n";
}
} else {
$render_psubtype .= '<option></option>' . "\n";
}
$output['dd2'] = '<select name="dea_psubtype" style="width:140px">' . "\n";
$output['dd2'] .= $render_psubtype . "\n";
$output['dd2'] .= '</select>' . "\n";
// format javascript arrays
$_js1 = "'(select)',''," . remove_lastchar($_js1, ",");
$_js2 = "'(select)',''," . remove_lastchar($_js2, ",");
$_js3 = "'(select)',''," . remove_lastchar($_js3, ",");
$output['js'] = '
var thelist = new Array();
thelist[0] = new Array(' . $_js0 . ');
thelist[1] = new Array(' . $_js1 . ');
thelist[2] = new Array(' . $_js2 . ');
thelist[3] = new Array(' . $_js3 . ');
function init(dd1) {
optionTest = true;
lgth = dd1.options.length;
dd1.options[lgth] = null;
if (dd1.options[lgth]) optionTest = false;
}
// dd1 is the first drop down, dd2 is the second
function populate(dd1,dd2) {
if (!optionTest) return;
var box = dd1;
var number = box.options[box.selectedIndex].value;
if (!number) return;
var list = thelist[number];
var box2 = dd2;
box2.options.length = 0;
for(i=0;i<list.length;i+=2) {
box2.options[i/2] = new Option(list[i],list[i+1]);
}
dd2.focus();
}
';
return $output;
}
示例3: top20
function top20($dept = 'sales')
{
global $db, $CONFIG;
// unset last search
unset($_SESSION['searchPage']);
if ($dept == 'sales') {
$type = 'Sales';
} elseif ($dept == 'lettings') {
$type = 'Lettings';
} else {
return;
}
// most viewed property from preceeding sunday for 7 previous days
$endDate = strtotime('last Sunday');
$startDate = $endDate - 7 * 24 * 60 * 60;
$sql = "SELECT COUNT(*) as hits, deal.* ,CONCAT(pro_addr3,', ',area.are_title,' ',LEFT(pro_postcode, 4)) AS pro_addr, media.*\n\tFROM propertyviews\n\tLEFT JOIN deal ON propertyviews.dea_id = deal.dea_id\n\tLEFT JOIN property ON deal.dea_prop = property.pro_id\n\tLEFT JOIN area ON property.pro_area = area.are_id\n\tLEFT JOIN media ON deal.dea_id = media.med_row AND media.med_table = 'deal' AND med_order = 1 AND med_type= 'Photograph'\n\tWHERE\n\tdatetime > '" . date('Y-m-d H:i:s', $startDate) . "' AND datetime < '" . date('Y-m-d H:i:s', $endDate) . "' AND\n\tdea_type = '{$type}' AND\n\t(deal.dea_status = 'Available')\n\tGROUP BY propertyviews.dea_id\n\tORDER BY hits DESC\n\tLIMIT 20";
$q = $db->query($sql);
while ($row = $q->fetchRow()) {
if (!$first) {
$first = '<a href="' . $CONFIG['SITE_URL'] . 'details/' . $row['dea_id'] . '.html"><img src="' . IMAGE_URL_PROPERTY . $row['dea_id'] . '/' . str_replace('.jpg', '_full.jpg', $row['med_file']) . '" alt="' . $row['pro_addr'] . '" /></a>';
$selected = ' class="selected"';
} else {
unset($selected);
}
if ($row['dea_type'] == 'Lettings') {
$suffix = 'p/w';
} else {
unset($suffix);
}
if ($row['dea_status'] == 'Under Offer') {
$class = ' class="uo"';
} else {
unset($class);
}
$list .= '<li' . $selected . ' id="deal_' . $row['dea_id'] . '"><a href="' . $CONFIG['SITE_URL'] . 'details/' . $row['dea_id'] . '.html"' . $class . '>' . $row['pro_addr'] . ' ' . format_price($row['dea_marketprice']) . $suffix . '</a></li>' . "\n";
$preload .= '"' . IMAGE_URL_PROPERTY . $row['dea_id'] . '/' . str_replace('.jpg', '_full.jpg', $row['med_file']) . '",';
}
$output = '
<script type="text/javascript">
jQuery.preLoadImages(' . remove_lastchar($preload, ",") . ');
</script>
<div id="top20Image">' . $first . '</div>
<h3>Most Viewed : Top 20 ' . $type . '</h3>
<ol>
' . $list . '</ol>
<p><a href="' . $CONFIG['SITE_URL'] . $dept . '.html?o=Date">Full ' . $type . ' List</a></p>';
return $output;
}
示例4: http_build_query
if ($return) {
$returnLink = '?' . http_build_query($return);
}
if ($sql1) {
$sql1 = remove_lastchar($sql1, "AND");
$sql1 = remove_lastchar($sql1, "OR");
$sql1 = "AND {$sql1} ";
}
if ($sql2) {
$sql2 = remove_lastchar($sql2, "AND");
$sql2 = remove_lastchar($sql2, "OR");
$sql2 = "AND {$sql2} ";
}
if ($sql3) {
$sql3 = remove_lastchar($sql3, "AND");
$sql3 = remove_lastchar($sql3, "OR");
$sql3 = "AND {$sql3} ";
}
$searchLink = $_SERVER['PHP_SELF'] . urlencode('?' . $_SERVER['QUERY_STRING']);
$sql = "\nSELECT com_id,com_title,\nGROUP_CONCAT(DISTINCT CONCAT(e.con_fname,' ',e.con_sname,'(',e.con_id,')') ORDER BY e.con_fname ASC SEPARATOR ', ') AS con_name,\ncon_id,cty_title,\ncom_title AS ord\nFROM contact AS e\nLEFT OUTER JOIN company ON com_id = e.con_company\nLEFT JOIN ctype ON con_type = ctype.cty_id\nWHERE (con_company > 0) {$sql1}\nGROUP BY com_id\n\nUNION ALL\n\nSELECT con_id,'' AS empty,\nCONCAT(e.con_fname,' ',e.con_sname) AS con_name,\ncon_id,cty_title,\ncon_fname AS ord\nFROM contact AS e\nLEFT JOIN ctype ON con_type = ctype.cty_id\nWHERE (con_company = 0) {$sql2}\nGROUP BY con_id\n\nUNION ALL\n\nSELECT com_id,com_title,'' AS empty,'' AS empty2,cty_title,\ncom_title AS ord\nFROM company as sc\nLEFT JOIN ctype ON com_type = ctype.cty_id\nWHERE com_id NOT IN ( SELECT con_company from contact ) {$sql3}\nGROUP BY com_id\n\nORDER BY ord\n\n";
$q = $db->query($sql);
if (DB::isError($q)) {
die("db error: " . $q->getMessage() . $sql);
}
$numRows = $q->numRows();
if ($numRows !== 0) {
while ($row = $q->fetchRow()) {
$row["con_name"] = preg_replace("/\\([a-z0-9\\ ]+\\)/", "", $row["con_name"]);
if (!$row["com_title"]) {
$row["com_title"] = $row["con_name"];
$row["con_name"] = '';
示例5: str_replace
$render .= str_replace(',', ',', $row["dea_description"]) . "{$d}";
//furnished
$render .= $furnishedId . "{$d}";
//image_url
if ($row["photos"]) {
$photo_array = explode("~", $row["photos"]);
}
foreach ($photo_array as $val) {
//$render .= 'http://www.woosterstock.co.uk/v3/images/p/'.$row["dea_id"].'/'.str_replace(".jpg","_large.jpg",$val)."|";
if (file_exists(WS_PATH_IMAGES . '/' . $row["dea_id"] . '/' . str_replace(".jpg", "_large.jpg", $val))) {
$render .= WS_URL_IMAGES . '/' . $row["dea_id"] . '/' . str_replace(".jpg", "_large.jpg", $val) . "|";
} else {
$render .= WS_URL_IMAGES . '/' . $row["dea_id"] . '/' . str_replace(".jpg", "_small.jpg", $val) . "|";
}
}
$render = remove_lastchar($render, "|") . $d;
//ip_address
$render .= $_SERVER['SERVER_ADDR'] . "{$d}";
//price
$render .= $row["dea_marketprice"] . "{$d}";
//registration
$render .= "no";
$render .= "\n";
unset($features, $furnishedId);
}
$strPath = dirname(__FILE__) . '/oodle';
// name of textfile (date.blm)
$strTextFile = "oodle.csv";
$local_file = $strPath . "/" . $strTextFile;
// if the file already exists, delet before re-writing
if (file_exists($local_file)) {
示例6: die
if ($_GET["pro_pro_id"]) {
$sqlP = "SELECT * FROM property WHERE pro_id = " . $_GET["pro_pro_id"] . " LIMIT 1";
$qP = $db->query($sqlP);
if (DB::isError($qP)) {
die("db error: " . $q->getMessage() . "sqlP<br>" . $sqlP);
}
while ($row = $qP->fetchRow()) {
$formData2 = array('pro_pro_id' => array('type' => 'hidden', 'value' => $row["pro_id"]), 'pro_pcid' => array('type' => 'hidden', 'value' => $row["pro_pcid"]), 'pro_addr1' => array('type' => 'text', 'label' => 'House Number', 'value' => $row["pro_addr1"], 'required' => 1, 'attributes' => array('class' => 'addr', 'readonly' => 'readonly'), 'function' => 'format_street'), 'pro_addr2' => array('type' => 'text', 'label' => 'Building Name', 'value' => $row["pro_addr2"], 'required' => 1, 'attributes' => array('class' => 'addr', 'readonly' => 'readonly'), 'function' => 'format_street'), 'pro_addr3' => array('type' => 'text', 'label' => 'Street', 'value' => $row["pro_addr3"], 'required' => 1, 'attributes' => array('class' => 'addr', 'readonly' => 'readonly'), 'function' => 'format_street'), 'pro_addr5' => array('type' => 'text', 'label' => 'City or County', 'value' => $row["pro_addr5"], 'required' => 1, 'attributes' => array('class' => 'addr', 'readonly' => 'readonly'), 'function' => 'format_street'), 'pro_postcode' => array('type' => 'text', 'label' => 'Postcode', 'value' => $row["pro_postcode"], 'required' => 1, 'attributes' => array('class' => 'pc', 'maxlength' => 9, 'readonly' => 'readonly'), 'function' => 'format_postcode', 'group' => 'Postcode'), 'pro_postcode_change' => array('type' => 'button', 'label' => 'Postcode', 'value' => 'Change Address', 'group' => 'Postcode', 'attributes' => array('class' => 'button', 'onClick' => 'javascript:document.location.href = \'' . $_SERVER['SCRIPT_NAME'] . '?' . replaceQueryString($_SERVER['QUERY_STRING'], 'pro_pro_id') . '\';'), 'last_in_group' => 1));
}
// manually inputted address
} else {
$formData2 = array('pro_addr1' => array('type' => 'text', 'label' => 'House Number', 'value' => $pro_addr1, 'required' => 2, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), 'pro_addr2' => array('type' => 'text', 'label' => 'Building Name', 'value' => $pro_addr2, 'required' => 1, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), 'pro_addr3' => array('type' => 'text', 'label' => 'Street', 'value' => $pro_addr3, 'required' => 2, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), 'pro_addr4' => array('type' => 'text', 'label' => 'Town or Area', 'value' => $pro_addr4, 'required' => 3, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), 'pro_addr5' => array('type' => 'text', 'label' => 'City or County', 'value' => $pro_addr5, 'required' => 2, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), 'pro_postcode' => array('type' => 'text', 'label' => 'Postcode', 'value' => $pro_postcode, 'required' => 2, 'attributes' => array('class' => 'pc', 'maxlength' => 9), 'function' => 'format_postcode'), 'pro_country' => array('type' => 'select', 'label' => 'Country', 'value' => $pro_country, 'required' => 2, 'options' => db_lookup("cli_country", "country", "array"), 'attributes' => array('class' => 'addr')));
}
if (!$_POST["action"]) {
$sql_1 = remove_lastchar(trim($sql_1), "OR");
$sql_2 = remove_lastchar(trim($sql_2), "OR");
if (!$_GET["return"]) {
$return = $_SERVER['SCRIPT_NAME'] . '?' . http_build_query(array('cli_name' => $_GET["cli_name"], 'cli_email' => $_GET["cli_email"], 'dest' => $_GET["dest"], 'dea_id' => $_GET["dea_id"]));
} else {
$return = $_GET["return"];
}
if ($sql_1) {
// first, match both first AND surnames and put at top of list
$sql = "SELECT cli_id,cli_fname,cli_sname,pro_addr1,pro_addr2,pro_addr3,pro_postcode FROM client\n\tLEFT JOIN property ON property.pro_id = client.cli_pro\n\tWHERE " . $sql_1 . "\n\tORDER BY cli_fname ASC, cli_sname ASC";
$q = $db->query($sql);
if (DB::isError($q)) {
die("db error: " . $q->getMessage() . "sql_1<br>" . $sql);
}
$numRows = $q->numRows();
if ($numRows !== 0) {
while ($row = $q->fetchRow()) {
示例7: explode
$use_colour = '<span class="use_col" style="background-color: #FFFFFF;"><img src="/images/sys/admin/blank.gif" width="10" height="10"></span> ';
}
if (!$row["use_name"]) {
$row["use_name"] = '(unassigned)';
}
$use_name = $use_colour . $row["use_name"];
$cli_names = explode(",", $row["cli_name"]);
foreach ($cli_names as $name) {
$cli_name_parts = explode("|", $name);
$cli_name_render .= '<a href="client_edit.php?cli_id=' . $cli_name_parts[1] . '&searchLink=' . $_SERVER['SCRIPT_NAME'] . urlencode('?' . replaceQueryString($_SERVER['QUERY_STRING'], 'viewForm') . '&viewForm=6') . '">' . $cli_name_parts[0] . '</a>, ';
}
$viewings_table .= '
<tr>
<td width="20%" valign="top">' . $row["app_date"] . '</td>
<td width="25%" valign="top">' . $use_name . '</td>
<td width="35%" valign="top">' . remove_lastchar($cli_name_render, ",") . '</td>
<td width="15%" valign="top">' . $feedback . '</td>
<td width="5%" align="right" valign="top">
<a href="appointment_edit.php?app_id=' . $row["app_id"] . '&searchLink=' . $_SERVER['SCRIPT_NAME'] . urlencode('?' . replaceQueryString($_SERVER['QUERY_STRING'], 'viewForm') . '&viewForm=5') . '"><img src="/images/sys/admin/icons/edit-icon.png" width="16" height="16" border="0" alt="View/Edit Appointment"/></a>
</td>
</tr>';
$countViewing++;
} elseif ($row["app_type"] == 'Valuation') {
$countValuation++;
} elseif ($row["app_type"] == 'Production') {
$countProduction++;
} elseif ($row["app_type"] == 'Inspection') {
$countInspection++;
}
unset($cli_name_render);
}
示例8: db_query
function db_query($_data, $_action, $_table, $_field, $_row = "temp_row_id")
{
global $current_user_id;
// update - select existing values for comparison
if ($_action == "UPDATE") {
foreach ($_data as $_key => $_val) {
$_fields .= $_key . ",";
$_newvalues[] = format_data("{$_val}");
}
$_fields = remove_lastchar(trim($_fields), ",");
if ($_fields) {
$_sql_select = "SELECT " . $_fields . " FROM " . $_table . " WHERE " . $_field . " = " . $_row . " LIMIT 1";
$_result = mysql_query($_sql_select);
if (!$_result) {
die("MySQL Error: " . mysql_error() . "<pre>db_query: " . $_sql_select . "</pre>");
}
while ($_row_select = mysql_fetch_array($_result)) {
foreach ($_data as $_key => $_val) {
// format old values to make sure sql works
$_oldvalues[$_key] = format_data($_row_select[$_key]);
}
}
mysql_free_result($_result);
}
} elseif ($_action == "INSERT") {
foreach ($_data as $_key => $_val) {
$_newvalues[] = format_data($_val);
$_oldvalues[$_key] = "NULL";
}
}
/* // delete
elseif ($_action == "DELETE") {
foreach($_data as $_key=>$_val) {
$_newvalues[] = "NULL";
$_oldvalues[$_key] = trim("$_val");
}
}*/
// we should now have 2 arrarys of fieldnames as keys and new and old values
if (count($_data) !== count($_oldvalues)) {
echo 'db_query: array count not matched<p>';
exit;
}
// construct sql for $_table AND changelog table, single query with multiple inserts
$_sql_log = "INSERT INTO changelog \n\t(cha_user,cha_session,cha_action,cha_table,cha_row,cha_field,cha_old,cha_new)\n\tVALUES \n\t";
// loop _data, check if current(old) value is different to new, and create sql statements accordingly
foreach ($_data as $_key => $_val) {
if ($_oldvalues[$_key] !== $_val) {
// enter NULL value without quotes (09/05/06)
if ($_val == "NULL") {
$_sql_update .= $_key . "=NULL,";
} elseif ($_val == "") {
$_sql_update .= $_key . "='',";
} else {
$_sql_update .= $_key . "='" . format_data($_val) . "',";
}
$_sql_insert1 .= $_key . ",";
$_sql_insert2 .= "'" . format_data($_val) . "',";
$_sql_log .= "('" . $current_user_id . "','" . session_id() . "','" . $_action . "','" . $_table . "','" . $_row . "','" . format_data($_key) . "','" . format_data($_oldvalues[$_key]) . "','" . format_data($_val) . "'),\n";
$_msg .= $_key . " was changed from " . $_oldvalues[$_key] . " to " . $_val . "\n";
$_changecount++;
}
}
$_sql_log = remove_lastchar(trim($_sql_log), ",");
$_sql_update = remove_lastchar(trim($_sql_update), ",");
$_sql_insert1 = remove_lastchar(trim($_sql_insert1), ",");
$_sql_insert2 = remove_lastchar(trim($_sql_insert2), ",");
if ($_action == "UPDATE") {
$_sql_return = "UPDATE " . $_table . " SET " . $_sql_update . " WHERE " . $_field . " = " . $_row;
} elseif ($_action == "INSERT") {
$_sql_return = "INSERT INTO " . $_table . " (" . $_sql_insert1 . ") VALUES (" . $_sql_insert2 . ")";
}
/* elseif ($_action == "DELETE") {
$_sql_return = "DELETE FROM ".$_table." WHERE ".$_field." = ".$_row;
}*/
if ($_changecount) {
// only execute the sql queries if a change has been made
$_result_return = mysql_query($_sql_return);
if (!$_result_return) {
die("MySQL Error: " . mysql_error() . "<pre>db_query RETURN: " . $_sql_return . "</pre>");
}
if ($_action == "UPDATE") {
$_insert_id = $_row;
} elseif ($_action == "INSERT") {
$_insert_id = mysql_insert_id();
$_sql_log = str_replace("temp_row_id", $_insert_id, $_sql_log);
// replace temp_row_id with insert_id
}
//mysql_free_result($_result_return);
$_result_log = mysql_query($_sql_log);
if (!$_result_log) {
die("MySQL Error: " . mysql_error() . "<pre>db_query LOG: " . $_sql_log . "</pre>");
}
//mysql_free_result($_result_log);
}
/* // dubug info
echo "<pre><b>Current values</b>\n";
print_r($_oldvalues);
echo "<pre><b>New values</b>\n";
print_r($_data);
echo "<hr>sql_log: ".$_sql_log;
//.........这里部分代码省略.........
示例9: remove_lastchar
$render .= remove_lastchar($render2, ",") . '</p>' . "\n";
}
$render .= '<hr />';
break;
case "Note":
$app["type"] = $app["subtype"] . ' ' . $app["type"];
$render .= '<p>' . $app["subject"] . '</p>';
$render .= renderNotes('appointment', $app_id, array('label' => 'Appointment Notes:', 'layout' => 'simple'));
if ($attendees) {
$render2 .= '<hr>' . "\n";
$render2 .= '<h2>Attendees:</h2>
<p>';
foreach ($attendees as $attendee) {
$render2 .= $attendee . ', ';
}
$render .= remove_lastchar($render2, ",") . '</p>' . "\n";
}
$render .= '<hr />';
break;
default:
//$render = "<p>No further printable information available</p>";
}
$sql = "SELECT address.searchString AS `address`, address.lat lat, address.lng lng FROM appointment a\nINNER JOIN link_deal_to_appointment l ON a.app_id = l.d2a_app\nINNER JOIN deal d ON d.dea_id = l.d2a_dea\nINNER JOIN property p ON d.dea_prop = p.pro_id\nINNER JOIN address ON address.id = p.addressId\n WHERE a.app_id = '{$_GET['app_id']}'\n AND address.lat != '' AND address.lng != '' AND address.lat IS NOT NULL AND address.lng IS NOT NULL ORDER BY l.d2a_ord DESC";
$q = $db->query($sql);
$showMap = false;
$markers = [];
while ($row = $q->fetchRow()) {
$showMap = true;
$lat = $row['lat'];
$lng = $row['lng'];
$markers[] = $lat . ',' . $lng;
示例10: source
function source($_source = NULL, $_querystring)
{
// if a source is supplied, don't show the muti drop downs.
if ($_source) {
$ref = '?' . replaceQueryString($_querystring, 'cli_source');
$sql = "SELECT sou_id,sou_title,sou_type FROM source WHERE sou_id = {$_source} LIMIT 1";
$_result = mysql_query($sql);
if (!$_result) {
die("MySQL Error: " . mysql_error() . "<pre>source: " . $sql . "</pre>");
}
while ($row = mysql_fetch_array($_result)) {
$output['dd1'] = '<input type="text" readonly="readonly" value="' . $row["sou_title"] . ' (' . $row["sou_type"] . ')" class="inputInvisible">' . "\n";
$output['dd1'] .= '<input type="button" value="Change" class="button" onClick="javascript:document.location.href=\'' . $ref . '\';">' . "\n";
$output['dd1'] .= '<input type="hidden" name="cli_source" value="' . $row["sou_id"] . '">';
}
} else {
// only add onload statement if source is not specified
$output['onload'] = 'init(document.forms[0].cli_source)';
// get source types to populate javascript drop downs
$sql = "SELECT sou_id,sou_title,sou_type FROM source ORDER BY sou_title";
$_result = mysql_query($sql);
if (!$_result) {
die("MySQL Error: " . mysql_error() . "<pre>source: " . $sql . "</pre>");
}
while ($row = mysql_fetch_array($_result)) {
if (!$row["sou_type"]) {
$render_source .= '<option value="' . $row["sou_id"] . '"';
if ($cli_source1 == $row["sou_id"]) {
$render_source .= ' selected';
}
$render_source .= '>' . $row["sou_title"] . '</option>' . "\n";
// array of types to loop through later
$types[] = $row["sou_id"];
} else {
${'_js' . $row["sou_type"]} .= "'" . $row["sou_title"] . "','" . $row["sou_id"] . "',";
}
/*~
elseif ($row["sou_type"] == "Portal") {
$_js1 .= "'".$row["sou_title"]."','".$row["sou_id"]."',";
}
elseif ($row["sou_type"] == "Press") {
$_js2 .= "'".$row["sou_title"]."','".$row["sou_id"]."',";
}
elseif ($row["sou_type"] == "Search Engine") {
$_js3 .= "'".$row["sou_title"]."','".$row["sou_id"]."',";
}
elseif ($row["sou_type"] == "Referral") {
$_js4 .= "'".$row["sou_title"]."','".$row["sou_id"]."',";
}*/
}
// create master type drop down
$output['dd1'] = '<select name="cli_source1" style="width:200px" onchange="populate(document.forms[0].cli_source1,document.forms[0].cli_source)">' . "\n";
$output['dd1'] .= '<option value="0">(click here)</option>' . "\n";
$output['dd1'] .= $render_source;
$output['dd1'] .= '</select>' . "\n";
$output['dd2'] = '<select name="cli_source" style="width:200px;display:none;">' . "\n";
$output['dd2'] .= '<option></option>' . "\n";
$output['dd2'] .= '</select>' . "\n";
// format javascript arrays (add "other" option to each?)
foreach ($types as $type) {
if (${'_js' . $type}) {
${'_js' . $type} = "'(select)',''," . remove_lastchar(${'_js' . $type}, ",");
$render_js .= 'thelist[' . $type . '] = new Array(' . ${'_js' . $type} . ');' . "\n";
}
}
$output['js'] = '
var thelist = new Array();
thelist[0] = new Array();
' . $render_js . '
function init(dd1) {
optionTest = true;
lgth = dd1.options.length;
dd1.options[lgth] = null;
if (dd1.options[lgth]) optionTest = false;
}
// dd1 is the first drop down, dd2 is the second
function populate(dd1,dd2) {
if (!optionTest) return;
dd2.style.display = "";
/* dd1.style.display = "none"; */
var box = dd1;
var number = box.options[box.selectedIndex].value;
if (!number) return;
var list = thelist[number];
var box2 = dd2;
box2.options.length = 0;
for(i=0;i<list.length;i+=2) {
box2.options[i/2] = new Option(list[i],list[i+1]);
}
dd2.focus();
}
';
}
return $output;
}
示例11: remove_lastchar
$owner = 'Landlord';
}
$render = '<table cellpadding="2" cellspacing="2" border="0">
<tr>
<td class="label" valign="top">Property</td>
<td><a href="/admin4/instruction/summary/id/' . $dea_id . '">' . $pro_addr . '</a></td>
</tr>
<tr>
<td class="label" valign="top">' . $owner . '(s)</td>
<td class="spaced">' . remove_lastchar($vendor_name, '<br />') . '</td>
</tr>';
if ($tenant_name) {
$render .= '
<tr>
<td class="label" valign="top">Tenant(s)</td>
<td class="spaced">' . remove_lastchar($tenant_name, '<br />') . '</td>
</tr>';
}
$render .= '
<tr>
<td class="label" valign="top">Key</td>
<td>' . $key_info . '</td>
</tr>
</table>
' . renderNotes('viewing_arrangements', $dea_id, array('layout' => 'readonly', 'label' => 'View Times and Info'));
$formData1 = array('d2a_cv' => array('type' => 'radio', 'label' => 'Confirm Status', 'value' => $d2a_cv, 'options' => db_enum("link_deal_to_appointment", "d2a_cv", "array")), 'notes' => array('type' => 'textarea', 'label' => 'Add Confirmation Note', 'attributes' => array('class' => 'noteInput'), 'tooltip' => 'Notes relating to the confirmation of this property only'));
if (!$_GET["action"]) {
$form = new Form();
$form->addForm("app_form", "GET", $PHP_SELF);
$form->addHtml("<div id=\"standard_form\">\n");
$form->addField("hidden", "action", "", "update");
示例12: define
define("FEED_NAME", "trovit");
require_once dirname(__FILE__) . "/../../../../../config/config_feed.inc.php";
$sql = "SELECT\n\tdeal.*,\n\tarea.are_title,\n\tpro_addr1,pro_addr3,pro_addr5,LEFT(pro_postcode,4) as pro_postcode,\n\tCONCAT(pro_addr3,' ',area.are_title,' ',LEFT(pro_postcode,4)) as pro_address,\n\tpro_east,pro_north,pro_latitude,pro_longitude,\n\tbranch.bra_id,branch.bra_title,branch.bra_tel,branch.bra_fax,branch.bra_email,\n\tT.pty_title AS ptype,\n\tST.pty_title AS psubtype,\n\tGROUP_CONCAT(DISTINCT CONCAT(photos.med_file,'|',photos.med_title) ORDER BY photos.med_order ASC SEPARATOR '~') AS photos,\n\tGROUP_CONCAT(DISTINCT CONCAT(floorplans.med_file,'|',floorplans.med_title) ORDER BY floorplans.med_order ASC SEPARATOR '~') AS floorplans\n\nFROM deal\n\nLEFT JOIN property ON deal.dea_prop = property.pro_id\nLEFT JOIN area ON property.pro_area = area.are_id\nLEFT JOIN branch ON deal.dea_branch = branch.bra_id\n\nLEFT JOIN ptype AS T ON deal.dea_ptype = T.pty_id\nLEFT JOIN ptype AS ST ON deal.dea_psubtype = ST.pty_id\n\nLEFT JOIN media AS photos ON deal.dea_id = photos.med_row AND photos.med_table = 'deal' AND photos.med_type = 'Photograph'\nLEFT JOIN media AS floorplans ON deal.dea_id = floorplans.med_row AND floorplans.med_table = 'deal' AND floorplans.med_type = 'Floorplan'\n\n\nWHERE\n(deal.dea_status = 'Available' OR deal.dea_status = 'Under Offer' OR deal.dea_status = 'Under Offer with Other')\nAND (deal.noPortalFeed <> 1 AND deal.underTheRadar <> 1)\nGROUP BY dea_id\n";
//echo $sql;
$q = $db->query($sql);
if (DB::isError($q)) {
die("error: " . $q->getMessage());
}
$numRows = $q->numRows();
// header
$render = '<?xml version="1.0" encoding="utf-8"?>' . "\n";
$render .= '<trovit>' . "\n";
while ($row = $q->fetchRow()) {
// description
$description = str_replace(array("é", "’", "£", "‘", "–"), array("é", "’", "£", "‘", "–"), $row["dea_description"]);
$description = remove_lastchar($description, "<p>");
// remove all tags except <p>
$description = strip_tags($description, '<p>');
// remove any attributes from tags
$description = preg_replace('/<\\s*(\\w+)[^>]+>/i', '<$1>', $description);
$render .= '<ad>' . "\n";
$render .= '<id><![CDATA[' . $row["dea_id"] . ']]></id>' . "\n";
$render .= '<url><![CDATA[http://' . WS_HOSTNAME . '/Detail.php?id=' . $row["dea_id"] . ']]></url>' . "\n";
$render .= '<title><![CDATA[' . $row["pro_address"] . ']]></title>' . "\n";
if ($row["dea_type"] == 'Sales') {
$render .= '<type><![CDATA[For sale]]></type>' . "\n";
} else {
$render .= '<type><![CDATA[For rent]]></type>' . "\n";
}
$render .= '<agency><![CDATA[Wooster & Stock]]></agency>' . "\n";
$render .= '<content><![CDATA[<h1>' . $row["dea_strapline"] . '</h1>' . $description . ']]></content>' . "\n";
示例13: explode
$cli_ptype .= $row["pty_id"] . '|';
}
}
}
if ($_POST["cli_price_bracket"]) {
$parts = explode('-', $_POST["cli_price_bracket"]);
$minprice = $parts[0];
$maxprice = $parts[1];
}
$db_data["cli_deposit"] = $_POST["cli_deposit"];
// dept specific //
$db_data["cli_salestatus"] = $_POST["cli_saleletstatus"];
$db_data["cli_salebed"] = $_POST["cli_salebed"];
$db_data["cli_saleemail"] = $_POST["cli_saleemail"];
$db_data["cli_sales"] = 'Yes';
$db_data["cli_saleptype"] = remove_lastchar($cli_ptype, '|');
$db_data["cli_salemin"] = $minprice;
$db_data["cli_salemax"] = $maxprice;
// office $form6 //
$db_data["cli_branch"] = $_POST["cli_branch"];
$db_data["cli_neg"] = $_POST["cli_neg"];
// notes...
// other
$db_data["cli_regd"] = $_SESSION["auth"]["use_id"];
$db_data["cli_reviewed"] = date('Y-m-d H:i:s');
if ($_POST["activate"]) {
$db_data["cli_status"] = 'Active';
}
//print_r($db_data);
db_query($db_data, "UPDATE", "client", "cli_id", $cli_id);
unset($db_data);
示例14: format_price
$price = format_price($dea_valueprice) . ' (Valuation)';
} else {
if ($dea_qualifier !== 'None') {
$qual = ' (' . $dea_qualifier . ')';
}
if ($dea_type == 'Sales') {
$price = format_price($dea_marketprice) . ' ' . $dea_tenure;
} elseif ($dea_type == 'Lettings') {
$price .= format_price($dea_marketprice, 'GBP', true) . ' per week / ' . format_price(pw2pcm($dea_marketprice), 'GBP', true) . ' per month';
}
$price .= $qual;
}
foreach ($vendors as $ven_id => $ven_name) {
$vendor_summary .= $ven_name . ', ';
}
$vendor_summary = remove_lastchar($vendor_summary, ",");
// moved summary table lower down page to catch offer info
// deal table, positioned above formData
$deal_table = '
<table cellpadding="2" cellspacing="2" border="0">
<tr>
<td class="label" valign="top">' . $owner . '(s)</td>
<td>' . $vendor_table . '</td>
</tr>
</table>
';
// get state of trade, and history
$sql = "SELECT\nsot_id,sot_status,sot_nextdate,\nCONCAT(use_fname,' ',use_sname) AS use_name,\nDATE_FORMAT(sot_date, '%D %M %Y %l:%i%p') AS date\nFROM\nsot\nLEFT JOIN user ON user.use_id = sot.sot_user\nWHERE\nsot_deal = {$dea_id}\nORDER BY sot_date DESC";
$q = $db->query($sql);
if (DB::isError($q)) {
die("db error: " . $q->getMessage());
示例15: elseif
$_js1 .= "'" . $row["pty_title"] . "','" . $row["pty_id"] . "',";
} elseif ($row["pty_type"] == 2) {
$_js2 .= "'" . $row["pty_title"] . "','" . $row["pty_id"] . "',";
} elseif ($row["pty_type"] == 3) {
$_js3 .= "'" . $row["pty_title"] . "','" . $row["pty_id"] . "',";
}
}
// create master type drop down
$render_ptype = '<select name="pro_ptype" onchange="populate(document.forms[0].pro_ptype,document.forms[0].pro_psubtype)">
<option value="0"></option>
' . $render_ptype . '
</select>';
// format javascript arrays
$_js1 = "'(select)',''," . remove_lastchar($_js1, ",");
$_js2 = "'(select)',''," . remove_lastchar($_js2, ",");
$_js3 = "'(select)',''," . remove_lastchar($_js3, ",");
// if the property already has a subtype, manually make the drop down
if ($pro_psubtype) {
$render_ptype .= '
<select name="pro_psubtype" style="width:150px">';
$sql = "SELECT pty_id,pty_type,pty_title FROM ptype WHERE pty_type = " . $pro_ptype;
$q = $db->query($sql);
if (DB::isError($q)) {
die("db error: " . $q->getMessage());
}
while ($row = $q->fetchRow()) {
$render_ptype .= '<option value="' . $row["pty_id"] . '"';
if ($row["pty_id"] == $pro_psubtype) {
$render_ptype .= ' selected';
}
$render_ptype .= '>' . $row["pty_title"] . '</option>