public function testBr2nl() { $text = 'This<br />is some<br>text.'; $result = br2nl($text); $expected = 'This' . PHP_EOL . 'is some' . PHP_EOL . 'text.'; $this->assertEqual($result, $expected); }
public function getinfoAction() { $db = front::og('db'); $one_news = $db->select('SELECT tp.*, tg.title as group_name FROM team_people tp JOIN team_groups tg on tg.id = tp.groupid WHERE tp.id = ?n LIMIT 1;', front::$_req['id'])->fetchRow(); $one_news = front::toUtf($one_news); $one_news['additional'] = br2nl($one_news['additional']); echo json_encode(array('form' => $one_news)); }
function getinfoAction() { $db = front::og("db"); $one_news = $db->select("SELECT tp.*, tg.title as group_name FROM team_people tp JOIN team_groups tg on tg.id = tp.groupid WHERE tp.id = ?n LIMIT 1;", front::$_req["id"])->fetchRow(); $one_news = front::toUtf($one_news); $one_news["additional"] = br2nl($one_news["additional"]); echo json_encode(array("form" => $one_news)); }
public function edit($pid) { $data['title'] = '修改页面'; if ($_POST) { $str = array('title' => $this->input->post('title'), 'content' => nl2br($this->input->post('content')), 'go_url' => $this->input->post('go_url'), 'is_hidden' => $this->input->post('is_hidden'), 'add_time' => time()); if ($this->page_m->update_page($pid, $str)) { show_message('修改页面成功!', site_url('admin/page'), 1); } } $data['page'] = $this->page_m->get_page_content($pid); $this->load->helper('br2nl'); $data['page']['content'] = br2nl($data['page']['content']); $data['csrf_name'] = $this->security->get_csrf_token_name(); $data['csrf_token'] = $this->security->get_csrf_hash(); $this->load->view('page_edit', $data); }
function update_order_messages() { $step = 3000; $count_messages = Db::getInstance()->getValue('SELECT count(id_message) FROM ' . _DB_PREFIX_ . 'message'); $nb_loop = $start = 0; $pattern = '<br|&[a-zA-Z]{1,8};'; if ($count_messages > 0) { $nb_loop = ceil($count_messages / $step); } for ($i = 0; $i < $nb_loop; $i++) { $sql = 'SELECT id_message, message FROM `' . _DB_PREFIX_ . 'message` WHERE message REGEXP \'' . pSQL($pattern, true) . '\' LIMIT ' . (int) $start . ', ' . (int) $step; $start = intval(($i + 1) * $step); if ($messages = Db::getInstance()->query($sql)) { while ($message = Db::getInstance()->nextRow($messages)) { if (is_array($message)) { Db::getInstance()->execute(' UPDATE `' . _DB_PREFIX_ . 'message` SET message = \'' . pSQL(preg_replace('/' . $pattern . '/', '', Tools::htmlentitiesDecodeUTF8(br2nl($message['message'])))) . '\' WHERE id_message = ' . (int) $message['id_message']); } } } } $nb_loop = $start = 0; if ($count_messages > 0) { $nb_loop = ceil($count_messages / $step); } for ($i = 0; $i < $nb_loop; $i++) { $sql = 'SELECT id_customer_message, message FROM `' . _DB_PREFIX_ . 'customer_message` WHERE message REGEXP \'' . pSQL($pattern, true) . '\' LIMIT ' . (int) $start . ', ' . (int) $step; $start = intval(($i + 1) * $step); if ($messages = Db::getInstance()->query($sql)) { while ($message = Db::getInstance()->nextRow($messages)) { if (is_array($message)) { Db::getInstance()->execute(' UPDATE `' . _DB_PREFIX_ . 'customer_message` SET message = \'' . pSQL(preg_replace('/' . $pattern . '/', '', Tools::htmlentitiesDecodeUTF8(str_replace('&', '&', $message['message'])))) . '\' WHERE id_customer_message = ' . (int) $message['id_customer_message']); } } } } }
function update_order_messages() { $step = 3000; $count_messages = Db::getInstance()->getValue('SELECT count(id_message) FROM ' . _DB_PREFIX_ . 'message'); $nb_loop = $start = 0; if ($count_messages > 0) { $nb_loop = ceil($count_messages / $step); } for ($i = 0; $i < $nb_loop; $i++) { $sql = 'SELECT id_message, message FROM ' . _DB_PREFIX_ . 'message LIMIT ' . (int) $start . ', ' . (int) $step; if ($messages = Db::getInstance()->executeS($sql)) { if (is_array($messages)) { foreach ($messages as $message) { $sql = 'UPDATE ' . _DB_PREFIX_ . 'message SET message = \'' . pSQL(Tools::htmlentitiesDecodeUTF8(br2nl($message['message']))) . '\' WHERE id_message = ' . (int) $message['id_message']; $result = Db::getInstance()->execute($sql); } } $start += $step + 1; } } $count_messages = Db::getInstance()->getValue('SELECT count(id_customer_message) FROM ' . _DB_PREFIX_ . 'customer_message'); $nb_loop = $start = 0; if ($count_messages > 0) { $nb_loop = ceil($count_messages / $step); } for ($i = 0; $i < $nb_loop; $i++) { $sql = 'SELECT id_customer_message, message FROM ' . _DB_PREFIX_ . 'customer_message LIMIT ' . (int) $start . ', ' . (int) $step; if ($messages = Db::getInstance()->executeS($sql)) { if (is_array($messages)) { foreach ($messages as $message) { $sql = 'UPDATE ' . _DB_PREFIX_ . 'customer_message SET message = \'' . pSQL(Tools::htmlentitiesDecodeUTF8(str_replace('&', '&', $message['message']))) . '\' WHERE id_customer_message = ' . (int) $message['id_customer_message']; Db::getInstance()->execute($sql); } } $start += $step + 1; } } }
public function getDefinition($term) { $data = array('term' => $term); $html = libHTTP::GET('http://www.urbandictionary.com/define.php?term=' . urlencode($term)); if ($html === false) { $data['timeout'] = true; return $data; } if (strstr($html, "isn't defined.<br/>")) { $data['undefined'] = true; return $data; } preg_match('#<div class=\'meaning\'>(.+?)</div>.*?<div class=\'example\'>(.*?)</div>#s', $html, $arr); $definition = trim(html_entity_decode(strip_tags(br2nl($arr[1])))); $definition = strtr($definition, array("\r" => ' ', "\n" => ' ')); $definition = preg_replace_callback('/&#([a-z0-9]+);/i', create_function('$a', 'return chr(hexdec($a[0]));'), $definition); while (false !== strstr($definition, ' ')) { $definition = str_replace(' ', ' ', $definition); } if (strlen($definition) > 800) { $definition = substr($definition, 0, 800) . '...'; } $data['definition'] = $definition; if (!empty($arr[2])) { $example = trim(html_entity_decode(strip_tags(br2nl($arr[2])))); $example = strtr($example, array("\r" => ' | ', "\n" => ' | ')); $example = preg_replace_callback('/&#([a-z0-9]+);/i', create_function('$a', 'return chr(hexdec($a[0]));'), $example); while (false !== strstr($example, ' | | ')) { $example = str_replace(' | | ', ' | ', $example); } while (false !== strstr($example, ' ')) { $example = str_replace(' ', ' ', $example); } if (strlen($example) > 800) { $example = substr($example, 0, 800) . '...'; } $data['example'] = $example; } return $data; }
function customers_update($selected_id) { global $Translation; if ($_GET['update_x'] != '') { $_POST = $_GET; } // mm: can member edit record? $arrPerm = getTablePermissions('customers'); $ownerGroupID = sqlValue("select groupID from membership_userrecords where tableName='customers' and pkValue='" . makeSafe($selected_id) . "'"); $ownerMemberID = sqlValue("select lcase(memberID) from membership_userrecords where tableName='customers' and pkValue='" . makeSafe($selected_id) . "'"); if ($arrPerm[3] == 1 && $ownerMemberID == getLoggedMemberID() || $arrPerm[3] == 2 && $ownerGroupID == getLoggedGroupID() || $arrPerm[3] == 3) { // allow update? // update allowed, so continue ... } else { return false; } $data['CustomerID'] = makeSafe($_POST['CustomerID']); if ($data['CustomerID'] == empty_lookup_value) { $data['CustomerID'] = ''; } $data['CompanyName'] = makeSafe($_POST['CompanyName']); if ($data['CompanyName'] == empty_lookup_value) { $data['CompanyName'] = ''; } $data['ContactName'] = makeSafe($_POST['ContactName']); if ($data['ContactName'] == empty_lookup_value) { $data['ContactName'] = ''; } $data['ContactTitle'] = makeSafe($_POST['ContactTitle']); if ($data['ContactTitle'] == empty_lookup_value) { $data['ContactTitle'] = ''; } $data['Address'] = br2nl(makeSafe($_POST['Address'])); $data['City'] = makeSafe($_POST['City']); if ($data['City'] == empty_lookup_value) { $data['City'] = ''; } $data['Region'] = makeSafe($_POST['Region']); if ($data['Region'] == empty_lookup_value) { $data['Region'] = ''; } $data['PostalCode'] = makeSafe($_POST['PostalCode']); if ($data['PostalCode'] == empty_lookup_value) { $data['PostalCode'] = ''; } $data['Country'] = makeSafe($_POST['Country']); if ($data['Country'] == empty_lookup_value) { $data['Country'] = ''; } $data['Phone'] = makeSafe($_POST['Phone']); if ($data['Phone'] == empty_lookup_value) { $data['Phone'] = ''; } $data['Fax'] = makeSafe($_POST['Fax']); if ($data['Fax'] == empty_lookup_value) { $data['Fax'] = ''; } $data['selectedID'] = makeSafe($selected_id); // hook: customers_before_update if (function_exists('customers_before_update')) { $args = array(); if (!customers_before_update($data, getMemberInfo(), $args)) { return false; } } $o = array('silentErrors' => true); sql('update `customers` set `CustomerID`=' . ($data['CustomerID'] !== '' && $data['CustomerID'] !== NULL ? "'{$data['CustomerID']}'" : 'NULL') . ', `CompanyName`=' . ($data['CompanyName'] !== '' && $data['CompanyName'] !== NULL ? "'{$data['CompanyName']}'" : 'NULL') . ', `ContactName`=' . ($data['ContactName'] !== '' && $data['ContactName'] !== NULL ? "'{$data['ContactName']}'" : 'NULL') . ', `ContactTitle`=' . ($data['ContactTitle'] !== '' && $data['ContactTitle'] !== NULL ? "'{$data['ContactTitle']}'" : 'NULL') . ', `Address`=' . ($data['Address'] !== '' && $data['Address'] !== NULL ? "'{$data['Address']}'" : 'NULL') . ', `City`=' . ($data['City'] !== '' && $data['City'] !== NULL ? "'{$data['City']}'" : 'NULL') . ', `Region`=' . ($data['Region'] !== '' && $data['Region'] !== NULL ? "'{$data['Region']}'" : 'NULL') . ', `PostalCode`=' . ($data['PostalCode'] !== '' && $data['PostalCode'] !== NULL ? "'{$data['PostalCode']}'" : 'NULL') . ', `Country`=' . ($data['Country'] !== '' && $data['Country'] !== NULL ? "'{$data['Country']}'" : 'NULL') . ', `Phone`=' . ($data['Phone'] !== '' && $data['Phone'] !== NULL ? "'{$data['Phone']}'" : 'NULL') . ', `Fax`=' . ($data['Fax'] !== '' && $data['Fax'] !== NULL ? "'{$data['Fax']}'" : 'NULL') . " where `CustomerID`='" . makeSafe($selected_id) . "'", $o); if ($o['error'] != '') { echo $o['error']; echo '<a href="customers_view.php?SelectedID=' . urlencode($selected_id) . "\">{$Translation['< back']}</a>"; exit; } $data['selectedID'] = $data['CustomerID']; // hook: customers_after_update if (function_exists('customers_after_update')) { $res = sql("SELECT * FROM `customers` WHERE `CustomerID`='{$data['selectedID']}' LIMIT 1", $eo); if ($row = db_fetch_assoc($res)) { $data = array_map('makeSafe', $row); } $data['selectedID'] = $data['CustomerID']; $args = array(); if (!customers_after_update($data, getMemberInfo(), $args)) { return; } } // mm: update ownership data sql("update membership_userrecords set dateUpdated='" . time() . "', pkValue='{$data['CustomerID']}' where tableName='customers' and pkValue='" . makeSafe($selected_id) . "'", $eo); }
} //// END UPGRADE UPGRADEWIZARD /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// //// MAKE SURE PATCH IS COMPATIBLE if (is_file("{$unzip_dir}/manifest.php")) { // provides $manifest array include "{$unzip_dir}/manifest.php"; if (!isset($manifest)) { fwrite(STDERR, "\nThe patch did not contain a proper manifest.php file. Cannot continue.\n\n"); exit(1); } else { copy("{$unzip_dir}/manifest.php", $sugar_config['upload_dir'] . "/upgrades/patch/{$zip_from_dir}-manifest.php"); $error = validate_manifest($manifest); if (!empty($error)) { $error = strip_tags(br2nl($error)); fwrite(STDERR, "\n{$error}\n\nFAILURE\n"); exit(1); } } } else { fwrite(STDERR, "\nThe patch did not contain a proper manifest.php file. Cannot continue.\n\n"); exit(1); } $ce_to_pro_ent = isset($manifest['name']) && ($manifest['name'] == 'SugarCE to SugarPro' || $manifest['name'] == 'SugarCE to SugarEnt' || $manifest['name'] == 'SugarCE to SugarCorp' || $manifest['name'] == 'SugarCE to SugarUlt'); $_SESSION['upgrade_from_flavor'] = $manifest['name']; global $sugar_config; global $sugar_version; global $sugar_flavor; //// END MAKE SURE PATCH IS COMPATIBLE ///////////////////////////////////////////////////////////////////////////////
$drawing->setOffsetX(10); $drawing->setOffsetY(10); } $vn_width = floor(intval($va_info['PROPERTIES']['width']) * $vn_ratio_pixels_to_excel_width); $vn_height = floor(intval($va_info['PROPERTIES']['height']) * $vn_ratio_pixels_to_excel_height); // set the calculated withs for the current row and column, // but make sure we don't make either smaller than they already are if ($vn_width > $o_sheet->getColumnDimension($vs_supercol . $vs_column)->getWidth()) { $o_sheet->getColumnDimension($vs_supercol . $vs_column)->setWidth($vn_width); } if ($vn_height > $o_sheet->getRowDimension($vn_line)->getRowHeight()) { $o_sheet->getRowDimension($vn_line)->setRowHeight($vn_height); } } } elseif ($vs_display_text = $t_display->getDisplayValue($vo_result, $vn_placement_id, array_merge(array('request' => $this->request, 'purify' => true), is_array($va_info['settings']) ? $va_info['settings'] : array()))) { $o_sheet->setCellValue($vs_supercol . $vs_column . $vn_line, html_entity_decode(strip_tags(br2nl($vs_display_text)), ENT_QUOTES | ENT_HTML5)); // We trust the autosizing up to a certain point, but // we want column widths to be finite :-). // Since Arial is not fixed-with and font rendering // is different from system to system, this can get a // little dicey. The values come from experimentation. if ($o_sheet->getColumnDimension($vs_supercol . $vs_column)->getWidth() == -1) { // don't overwrite existing settings if (strlen($vs_display_text) > 55) { $o_sheet->getColumnDimension($vs_supercol . $vs_column)->setWidth(50); } } } if (!($vs_column = next($va_a_to_z))) { $vs_supercol = array_shift($va_supercol_a_to_z); $vs_column = reset($va_a_to_z);
$db->query($query); $db->next_record(); // przypisanie zmiennych $id = $db->f('id'); $title = $db->f('title'); $text = $db->f('text'); $author = $db->f('author'); if ((bool) $rewrite) { $perma_link = '1,' . $id . ',1,item.html'; $form_link = '1,3,item.html'; } else { $perma_link = 'index.php?p=1&id=' . $id; $form_link = 'index.php?p=3&action=add'; } // przypisanie tablicy szablonów::ft $ft->assign(array('NEWS_TITLE' => $title, 'NEWS_ID' => $id, 'NEWS_TEXT' => $text, 'NEWS_AUTHOR' => $author, 'COMMENT_AUTHOR' => $comment_author, 'QUOTE' => sprintf('[quote]%s[/quote]', strip_tags(br2nl($cite))), 'STRING' => $page_string, 'PERMA_LINK' => $perma_link, 'FORM_LINK' => $form_link)); } else { $query = sprintf("\r\n SELECT\r\n *\r\n FROM\r\n %s\r\n WHERE\r\n id = '%d'\r\n LIMIT 1", TABLE_MAIN, $_GET['id']); $db->query($query); $db->next_record(); // przypisanie zmiennych $id = $db->f('id'); $title = $db->f('title'); $text = $db->f('text'); $author = $db->f('author'); if ((bool) $rewrite) { $perma_link = sprintf('1,%s,1,item.html', $id); $form_link = '1,3,item.html'; } else { $perma_link = 'index.php?p=1&id=' . $id; $form_link = 'index.php?p=3&action=add';
$infotext = trim($sql3['infotext']); function br2nl($text) { return str_replace('<br />', '', $text); } $isOwnProfile = FALSE; if ($_GET['id'] == $cookie_id && $cookie_id != CONFIG_DEMO_USER) { $isOwnProfile = TRUE; if (isset($_POST['infotext'])) { $infotext = nl2br(mb_substr(strip_tags(trim($_POST['infotext'])), 0, 10000)); $infotext1 = "UPDATE " . $prefix . "users SET infotext = '" . mysql_real_escape_string($infotext) . "' WHERE ids = '" . $cookie_id . "'"; $infotext2 = mysql_query($infotext1); } } echo '<h1 id="anker_infotext">' . _('Infotext') . ($isOwnProfile ? ' (' . __('%s Zeichen', '<span id="infotext_counter">0</span>/5000') . ')' : '') . '</h1>'; if ($isOwnProfile) { // eigenes Profil echo '<form action="/manager.php?id=' . $_GET['id'] . '" method="post" accept-charset="utf-8">'; echo '<p><textarea rows="15" cols="12" id="infotext" name="infotext" style="width:100%; height:300px" maxlength="5000" onkeyup="updateTextLength(this);">' . br2nl($infotext) . '</textarea></p>'; echo '<p><input type="submit" value="' . _('Speichern') . '"' . noDemoClick($cookie_id) . ' /></p>'; } else { // fremdes Profil if (strlen($infotext) == 0) { echo '<p>' . __('%s hat noch keinen Text über sich und den Verein geschrieben.', $sql3['username']) . '</p>'; } else { echo '<p>' . $infotext . '</p>'; } } } // INFOTEXT ENDE include 'zz3.php';
function getEmailDetails($email) { $details = ""; if (!empty($email->to_addrs)) { $details .= "To: " . $email->to_addrs . "<br>"; } if (!empty($email->from_addr)) { $details .= "From: " . $email->from_addr . "<br>"; } if (!empty($email->cc_addrs)) { $details .= "CC: " . $email->cc_addrs . "<br>"; } if (!empty($email->from_addr) || !empty($email->cc_addrs) || !empty($email->to_addrs)) { $details .= "<br>"; } // cn: bug 8433 - history does not distinguish b/t text/html emails $details .= empty($email->description_html) ? $this->formatDescription($email->description) : $this->formatDescription(strip_tags(br2nl(from_html($email->description_html)))); return $details; }
} elseif ($pmodule == 'Leads') { require_once 'modules/Leads/Leads.php'; $myfocus = new Leads(); $myfocus->retrieve_entity_info($mycrmid, "Leads"); } elseif ($pmodule == 'Vendors') { require_once 'modules/Vendors/Vendors.php'; $myfocus = new Vendors(); $myfocus->retrieve_entity_info($mycrmid, "Vendors"); } else { // vtlib customization: Enabling mail send from other modules $myfocus = CRMEntity::getInstance($pmodule); $myfocus->retrieve_entity_info($mycrmid, $pmodule); // END } $fldname = $adb->query_result($fresult, 0, "columnname"); $emailadd = br2nl($myfocus->column_fields[$fldname]); //This is to convert the html encoded string to original html entities so that in mail description contents will be displayed correctly //$focus->column_fields['description'] = from_html($focus->column_fields['description']); if ($emailadd != '') { $description = getMergedDescription($_REQUEST['description'], $mycrmid, $pmodule); //Email Open Tracking global $site_URL, $application_unique_key; $emailid = $focus->id; $track_URL = "{$site_URL}/modules/Emails/TrackAccess.php?record={$mycrmid}&mailid={$emailid}&app_key={$application_unique_key}"; $description = "<img src='{$track_URL}' alt='' width='1' height='1'>{$description}"; // END $pos = strpos($description, '$logo$'); if ($pos !== false) { $description = str_replace('$logo$', '<img src="cid:logo" />', $description); $logo = 1; }
* these Appropriate Legal Notices must retain the display of the "Powered by * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not * reasonably feasible for technical reasons, the Appropriate Legal Notices must * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". ********************************************************************************/ require_once 'modules/Users/UserSignature.php'; global $current_user; $us = new UserSignature(); if (isset($_REQUEST['record']) && !empty($_REQUEST['record'])) { $us->retrieve($_REQUEST['record']); } else { $us->id = create_guid(); $us->new_with_id = true; } $us->name = $_REQUEST['name']; $us->signature = strip_tags(br2nl(from_html($_REQUEST['description']))); $us->signature_html = $_REQUEST['description']; if (empty($us->user_id) && isset($_REQUEST['the_user_id'])) { $us->user_id = $_REQUEST['the_user_id']; } else { $us->user_id = $current_user->id; } //_pp($_REQUEST); //_pp($us); $us->save(); $js = ' <script type="text/javascript"> function refreshTemplates() { window.opener.refresh_signature_list("' . $us->id . '","' . $us->name . '"); window.close(); }
echo "<br>Einschränkung nach " . $newsletter_interesse; } else { $sql = "SELECT email, delstamp FROM {$newsletter_table}"; echo "<br>Schickt an alle " . $newsletter_interesse; } $result = mysql_query($sql); while ($row = mysql_fetch_row($result)) { $linked_austragen = "\n\n{$austragen}: http://www.lcmeilen.ch/manager/newsletter_austragen.php?mail={$row['0']}&&delid={$row['1']}"; $nachricht = "{$inhalt}{$linked_austragen}"; // mail($row[0],$betreff,$nachricht,"FROM:newsletter@lcmeilen.ch"); echo "schicke an:" . $row[0] . ", " . $row[3]; } echo "<script language='JavaScript'>alert(\"Die Newsletter wurden erfolgreich abgeschickt.\");window.close();</script>"; } if ($probemail) { $inhalt = br2nl($inhalt); $linked_austragen = "\n\nAus dem Newsletter austragen: --in einem Probemail wird der Löschlink nicht angezeigt--"; $nachricht = "{$inhalt} {$linked_austragen}"; mail($probeaddresse, $betreff, $nachricht, "FROM:newsletter@lcmeilen.ch"); echo "<script language='JavaScript'>alert(\"Die Probemail wurde abgeschickt.\");</script>"; } ?> </form> <form method="post" action="" name="probemail_senden"> <INPUT type="submit" name="probemail" value="Probemail senden an:" class="button"> <INPUT type="text" name="probeaddresse" class="input"> <INPUT TYPE='hidden' name='eintragid' value='<?php echo "{$eintragid}"; ?> '>
function popup_decode_html($str) { global $default_charset; $slashes_str = popup_from_html($str); $slashes_str = htmlspecialchars($slashes_str, ENT_QUOTES, $default_charset); return decode_html(br2nl($slashes_str)); }
<td><b> <input type="checkbox" name="tangible" value="1"' . $chkt . '> Keep checked if this product needs physical pickup/delivery.</b><br> <font size=-2>Some products (like reservations) do not require any handling.</font> </td> </tr> <tr' . $norm_bg . '> <td>' . format_help_link('product_name') . 'Product Name</a></td> <td> <input name="product_name" size="60" maxlength="75" value="' . htmlspecialchars($product_info['product_name'], ENT_QUOTES) . '"><br> <font size="-2">(max. length 75 characters)</font> </td> </tr> <tr' . $norm_bg . '> <td>' . format_help_link('product_description') . 'Description</a></td> <td><textarea name="product_description" cols="60" rows="7">' . htmlspecialchars(br2nl($product_info['product_description']), ENT_QUOTES) . '</textarea><br>(not required)</td> </tr> <tr' . $norm_bg . '> <td>' . format_help_link('subcategory_id') . 'Subcategory</a></td> <td> <select id="subcategory_id" name="subcategory_id" onChange="lookup(document.getElementById("subcategory_id").value);"> ' . $subcat_first . ' ' . $display_subcat . ' </select> </td> </tr> <tr' . $norm_bg . '> <td>' . format_help_link('inventory_pull') . 'Inventory Rate</a><br>' . format_help_link('inventory_id') . 'Inventory Name</a></td> <td>Each item purchased will pull <input type="text" name="inventory_pull" value="' . $product_info['inventory_pull'] . '" size=3 maxlength="6"> unit(s) of...<br> ' . $inventory_select . '<span id="inventory_pull"> from inventory.</span> </div>
/** * given a podio field object -> returns a human readable format of the field value (or app reference as array (app_id, item_id) * @param type $field should be of type PodioItemField * @return string */ public static function getFieldValue($field) { $value = ""; if ($field->type == "text" || $field->type == "number" || $field->type == "progress" || $field->type == "duration" || $field->type == "state") { if (is_string($field->values)) { // TODO refactor $value = $field->values; $value = str_ireplace('</p>', '</p><br>', $value); $value = preg_replace('/\\<br(\\s*)?\\/?\\>/i', "\n", $value); $value = strip_tags(br2nl($value)); $value = str_replace(' ', ' ', $value); $value = str_replace('&', '&', $value); } else { if (is_numeric($field->values)) { $value = $field->values; } else { echo "WARN expected string or number, but found: "; var_dump($field->values); } } return $value; } if ($field->type == "category") { $selected_categories = array(); foreach ($field->values as $category) { array_push($selected_categories, $category['text']); } return HumanFormat::implodeStrings(", ", $selected_categories); } if ($field->type == "date") { return HumanFormat::parseDate($field->values['start']) . " - " . HumanFormat::parseDate($field->values['end']); } if ($field->type == "money") { return "" . $field->values['value'] . " " . $field->values['currency']; } if ($field->type == "contact") { if (is_array($field->values) || $field->values instanceof Traversable) { foreach ($field->values as $contact) { $value .= "\nUserid: {$contact->user_id}, name: {$contact->name}, email: " . HumanFormat::implodeStrings(', ', $contact->mail) . ", phone: " . HumanFormat::implodeStrings(", ", $contact->phone); } } else { echo "WARN unexpected contact type:"; var_dump($field); } return $value; } if ($field->type == "embed") { if (is_array($field->values) || $field->values instanceof Traversable) { foreach ($field->values as $embed) { //TODO implode (general function..) $value .= "\nurl: " . $embed->original_url; } } else { echo "WARN unexpected embed type:"; var_dump($field); } return $value; } if ($field->type == "app") { if (is_array($field->values) || $field->values instanceof Traversable) { foreach ($field->values as $app) { //TODO implode (general function..) $value .= "\napp: " . $app->app->name . ", item_name: " . $app->item_name . ", title: " . $app->title; //TODO more info?! } } else { echo "WARN unexpected app type:"; var_dump($field); } return $value; } if ($field->type == "image") { $images = array(); foreach ($field->values as $image) { array_push($images, "fileid: " . $image->file_id . ", name: " . $image->name); } return HumanFormat::implodeStrings(" | ", $images); } if ($field->type == "location") { $locations = array(); foreach ($field->values as $location) { array_push($locations, $location); } return HumanFormat::implodeStrings(" | ", $locations); } echo "WARN unexpected type: "; var_dump($field); return $field->values; }
function build_mail() { $ret = false; $this->importance(); $this->headers(); if ($this->importance != '' && strlen($this->from) > 0) { // headers $this->body .= $this->headers; // priorité $this->body .= $this->importance . "\n"; $this->body .= "Date: " . date('r', time()) . "\n"; $this->body .= "From: " . $this->from . "\n"; // on ajoute les To, Cc, Cci: if (strlen($this->to) > 0) { $this->body .= "To: " . $this->to . "\n"; } if (strlen($this->cc) > 0) { $this->body .= "Cc: " . $this->cc . "\n"; } if (strlen($this->cci) > 0) { $this->body .= "Bcc: " . $this->cci . "\n"; } if (strlen($this->reply_to) != 0) { $this->body .= "Reply-To: " . $this->reply_to . "\n"; } if (strlen($this->subject) > 0) { $this->body .= 'Subject: ' . encodeHeader($this->subject) . "\n"; } else { $this->body .= ""; } // qu a t on en fait a envoyer ? $this->formatTexte = false; $this->formatHTML = false; if (isset($this->text)) { // que du texte $this->formatTexte = true; $this->text .= "\n\n"; } else { // on avait une partie html : on genere la partie texte : dans ce cas, on a deux parties $this->text = str_replace("</p>", "\n", $this->html); $this->text = strip_tags(br2nl($this->text)); $this->text = html_entity_decode($this->text, ENT_QUOTES, 'UTF-8'); $this->formatHTML = true; } if (isset($this->html)) { $this->formatHTML = $this->formatTexte = true; } $this->body .= "MIME-Version: 1.0\n"; // on genere un boundary general $boundary_general = $this->boundary(); $is_mail_complete = false; if (!$this->formatHTML && !isset($this->attachments)) { // que du texte : aucun multipart $this->body .= "Content-Type: text/plain; charset=\"utf-8\"\n"; $this->body .= "Content-Transfer-Encoding: base64\n"; $this->body .= "\n"; $this->body .= chunk_split(base64_encode($this->text)); $is_mail_complete = true; } elseif (!$this->formatHTML && isset($this->attachments) && $this->attachments) { // texte + attachement : mixed $this->body .= "Content-Type: multipart/mixed;\n"; } elseif ($this->formatHTML && !isset($this->attachments)) { // texte + html : alternative $this->body .= "Content-Type: multipart/alternative;\n"; } elseif ($this->formatHTML && isset($this->attachments) && $this->attachments) { // texte + html + attachement : mixed $this->body .= "Content-Type: multipart/mixed;\n"; } if (!$is_mail_complete) { // on blute la fin de l'entete générale $this->body .= " boundary=\"" . $boundary_general . "\"\n"; $this->body .= "\n"; $this->body .= "This is a multi-part message in MIME format.\n\n"; $this->body .= "--" . $boundary_general . "\n"; // Si on a des pj, on annonce la partie texte et la partie html avec un multipart/alternative if (isset($this->attachments) && $this->attachments) { // on blute une partie alternative $boundary_alternative = $this->boundary(); $this->body .= "Content-Type: multipart/alternative;\n"; $this->body .= " boundary=\"" . $boundary_alternative . "\"\n"; $this->body .= "\n"; $this->body .= "\n"; $this->body .= "--" . $boundary_alternative . "\n"; } // on blute la partie texte $this->body .= "Content-Type: text/plain; charset=\"utf-8\"\n"; $this->body .= "Content-Transfer-Encoding: base64\n"; $this->body .= "\n"; $this->body .= chunk_split(base64_encode($this->text)); $this->body .= "\n"; if (isset($boundary_alternative)) { $this->body .= "--" . $boundary_alternative . "\n"; } else { $this->body .= "--" . $boundary_general . "\n"; } // Si on a du inline, on blute du related if (isset($this->inline) && $this->inline) { // on se genere un boundary $boundary_related = $this->boundary(); $this->body .= "Content-Type: multipart/related;\n"; $this->body .= " boundary=\"" . $boundary_related . "\"\n"; $this->body .= "\n"; $this->body .= "--" . $boundary_related . "\n"; } // on blute la partie html $this->body .= "Content-Type: text/html; charset=\"utf-8\"\n"; $this->body .= "Content-Transfer-Encoding: base64\n"; $this->body .= "\n"; $this->body .= chunk_split(base64_encode($this->html)) . "\n"; // Si on a du inline, on blute les images inline if (isset($this->inline) && $this->inline) { for ($a = 0; $a < count($this->files); $a++) { if ($this->files[$a]->cid != '') { $this->body .= "--" . $boundary_related . "\n"; $this->body .= "Content-Type: " . $this->files[$a]->type . "\n"; $this->body .= ' name="' . $this->files[$a]->nom . '"' . "\n"; $this->body .= "Content-Transfer-Encoding: base64\n"; $this->body .= "Content-ID: <" . $this->files[$a]->cid . ">\n"; $this->body .= "Content-Disposition: inline;\n"; $this->body .= ' filename="' . $this->files[$a]->nom . '"' . "\n"; $this->body .= "\n"; $this->body .= chunk_split(base64_encode($this->files[$a]->file)); $this->body .= "\n"; } } // On cloture la partie INLINE $this->body .= "--" . $boundary_related . "--\n\n"; } if (isset($boundary_alternative)) { $this->body .= "--" . $boundary_alternative . "--\n"; } elseif (!isset($this->attachments)) { $this->body .= "--" . $boundary_general . "--\n\n"; } // pieces jointes if (isset($this->attachments) && $this->attachments) { for ($a = 0; $a < count($this->files); $a++) { if ($this->files[$a]->cid == '') { $this->body .= "--" . $boundary_general . "\n"; $this->body .= "Content-Type: " . $this->files[$a]->type . "\n"; $this->body .= ' name="' . $this->files[$a]->nom . '"' . "\n"; $this->body .= "Content-Transfer-Encoding: base64\n"; $this->body .= "Content-Disposition: attachment;\n"; $this->body .= ' filename="' . $this->files[$a]->nom . '"' . "\n"; $this->body .= "\n"; $this->body .= chunk_split(base64_encode($this->files[$a]->file)); $this->body .= "\n"; } } // On cloture le mail $this->body .= "--" . $boundary_general . "--\n\n"; } } // on efface tous les \r que le mec a pu balancer dans son mail $this->body = str_replace("\r", "", $this->body); // on calcule le nombre de \n $nb_backslash_n = substr_count($this->body, "\n"); // on calcule la taille du mail en octets $this->size = strlen($this->body); $this->rfcsize = $this->size + $nb_backslash_n; $ret = true; } return $ret; }
function array_filter_help($qidattributes, $surveyprintlang, $surveyid) { global $clang; $output = ""; if (!empty($qidattributes['array_filter'])) { $newquery = "SELECT question FROM " . db_table_name("questions") . " WHERE title='{$qidattributes['array_filter']}' AND language='{$surveyprintlang}' AND sid = '{$surveyid}'"; $newresult = db_execute_assoc($newquery); $newquestiontext = $newresult->fetchRow(); $output .= "\n<p class='extrahelp'>\n\t\t " . sprintf($clang->gT("Only answer this question for the items you selected in question %d ('%s')"), $qidattributes['array_filter'], br2nl($newquestiontext['question'])) . "\n\t\t</p>\n"; } if (!empty($qidattributes['array_filter_exclude'])) { $newquery = "SELECT question FROM " . db_table_name("questions") . " WHERE title='{$qidattributes['array_filter_exclude']}' AND language='{$surveyprintlang}' AND sid = '{$surveyid}'"; $newresult = db_execute_assoc($newquery); $newquestiontext = $newresult->fetchRow(); $output .= "\n <p class='extrahelp'>\n\t\t " . sprintf($clang->gT("Only answer this question for the items you did not select in question %d ('%s')"), $qidattributes['array_filter_exclude'], br2nl($newquestiontext['question'])) . "\n\t\t</p>\n"; } return $output; }
</div> </div> </div> </div> '; $modal_desc = '<div class="modal fade" id="Desc" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-toggle="validator"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title">Talk about yourself in detail (displayed on profile-page)</h4> </div> <div class="modal-body"> <form role="form" class="form-horizontal" id="desc_form" data-toggle="validator"> <div class="form-group"> <div class="col-sm-12"><textarea name ="desc" class="form-control" rows="4">' . br2nl($desc) . '</textarea><input type="hidden" name="flag" value="Desc"></div> </div> </form> </div> <div class="modal-footer"><div id="loading"><img src="img/loading.gif"></img></div> <button type="submit" class="btn btn-primary" id = "submitDesc">Update</button> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div> </div> </div> '; $modal_addContact = '<div class="modal fade" id="addContact" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-toggle="validator">
/** * Retrieve function from handlebody() to unit test easily * @param $mail * @return formatted $mail body */ function handleBodyInHTMLformat($mail) { global $current_user; global $sugar_config; // wp: if body is html, then insert new lines at 996 characters. no effect on client side // due to RFC 2822 which limits email lines to 998 $mail->IsHTML(true); $body = from_html(wordwrap($this->description_html, 996)); $mail->Body = $body; // cn: bug 9725 // new plan is to use the selected type (html or plain) to fill the other $plainText = from_html($this->description_html); $plainText = strip_tags(br2nl($plainText)); $mail->AltBody = $plainText; $this->description = $plainText; $fileBasePath = "{$sugar_config['cache_dir']}images/"; $filePatternSearch = "{$sugar_config['cache_dir']}"; $filePatternSearch = str_replace("/", "\\/", $filePatternSearch); $filePatternSearch = $filePatternSearch . "images\\/"; if (strpos($mail->Body, "\"{$fileBasePath}") !== FALSE) { //cache/images $matches = array(); preg_match_all("/{$filePatternSearch}.+?\"/i", $mail->Body, $matches); foreach ($matches[0] as $match) { $filename = str_replace($fileBasePath, '', $match); $filename = urldecode(substr($filename, 0, -1)); $cid = $filename; $file_location = clean_path(getcwd() . "/{$sugar_config['cache_dir']}images/{$filename}"); $mime_type = "image/" . strtolower(substr($filename, strrpos($filename, ".") + 1, strlen($filename))); if (file_exists($file_location)) { $mail->AddEmbeddedImage($file_location, $cid, $filename, 'base64', $mime_type); } } //replace references to cache with cid tag $mail->Body = str_replace("/" . $fileBasePath, 'cid:', $mail->Body); $mail->Body = str_replace($fileBasePath, 'cid:', $mail->Body); // remove bad img line from outbound email $regex = '#<img[^>]+src[^=]*=\\"\\/([^>]*?[^>]*)>#sim'; $mail->Body = preg_replace($regex, '', $mail->Body); } $fileBasePath = "{$sugar_config['upload_dir']}"; $filePatternSearch = "{$sugar_config['upload_dir']}"; $filePatternSearch = str_replace("/", "\\/", $filePatternSearch); if (strpos($mail->Body, "\"{$fileBasePath}") !== FALSE) { $matches = array(); preg_match_all("/{$filePatternSearch}.+?\"/i", $mail->Body, $matches); foreach ($matches[0] as $match) { $filename = str_replace($fileBasePath, '', $match); $filename = urldecode(substr($filename, 0, -1)); $cid = $filename; $file_location = clean_path(getcwd() . "/{$sugar_config['upload_dir']}{$filename}"); $mime_type = "image/" . strtolower(substr($filename, strrpos($filename, ".") + 1, strlen($filename))); if (file_exists($file_location)) { $mail->AddEmbeddedImage($file_location, $cid, $filename, 'base64', $mime_type); } } //replace references to cache with cid tag $mail->Body = str_replace("/" . $fileBasePath, 'cid:', $mail->Body); $mail->Body = str_replace($fileBasePath, 'cid:', $mail->Body); // remove bad img line from outbound email $regex = '#<img[^>]+src[^=]*=\\"\\/([^>]*?[^>]*)>#sim'; $mail->Body = preg_replace($regex, '', $mail->Body); } //Replace any embeded images using the secure entryPoint for src url. $noteImgRegex = "/<img[^>]*[\\s]+src[^=]*=\"index.php\\?entryPoint=download\\&id=([^\\&]*)[^>]*>/im"; $embededImageMatches = array(); preg_match_all($noteImgRegex, $mail->Body, $embededImageMatches, PREG_SET_ORDER); foreach ($embededImageMatches as $singleMatch) { $fullMatch = $singleMatch[0]; $noteId = $singleMatch[1]; $cid = $noteId; $filename = $noteId; //Retrieve note for mimetype $tmpNote = new Note(); $tmpNote->retrieve($noteId); //Replace the src part of img tag with new cid tag $cidRegex = "/src=\"([^\"]*)\"/im"; $replaceMatch = preg_replace($cidRegex, "src=\"cid:{$noteId}\"", $fullMatch); //Replace the body, old tag for new tag $mail->Body = str_replace($fullMatch, $replaceMatch, $mail->Body); //Attach the file $file_location = clean_path(getcwd() . "/{$sugar_config['upload_dir']}{$noteId}"); if (file_exists($file_location)) { $mail->AddEmbeddedImage($file_location, $cid, $filename, 'base64', $tmpNote->file_mime_type); } } //End Replace $mail->Body = from_html($mail->Body); }
$contentCell->addText($va_info['display'] . ': ', $styleBundleNameFont); // Fetching version asked & corresponding file $vs_version = str_replace("ca_object_representations.media.", "", $va_info['bundle_name']); $va_info = $vo_result->getMediaInfo('ca_object_representations.media', $vs_version); // If it's a JPEG, print it (basic filter to avoid non handled media version) if ($va_info['MIMETYPE'] == 'image/jpeg') { // don't try to insert anything non-jpeg into an Excel file $vs_path = $vo_result->getMediaPath('ca_object_representations.media', $vs_version); if (is_file($vs_path)) { $contentCell->addImage($vs_path); } } } elseif ($vs_display_text = $t_display->getDisplayValue($vo_result, $vn_placement_id, array_merge(array('request' => $this->request, 'purify' => true), is_array($va_info['settings']) ? $va_info['settings'] : array()))) { $textrun = $contentCell->createTextRun(); $textrun->addText($va_info['display'] . ': ', $styleBundleNameFont); $textrun->addText(html_entity_decode(strip_tags(br2nl($vs_display_text)), ENT_QUOTES | ENT_HTML5), $styleContentFont); } } $vn_line++; // Two text break $section->addTextBreak(2); } // Finally, write the document: $objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007'); header("Content-Type:application/vnd.openxmlformats-officedocument.wordprocessingml.document"); header('Content-Disposition:inline;filename=Export.docx '); //$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'RTF'); //header("Content-type: application/rtf"); //header('Content-Disposition:inline;filename=Export.rtf '); //$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'ODText'); //header('Content-Type: application/vnd.oasis.opendocument.text');
$action = empty($_GET['action']) ? '' : $_GET['action']; // definicja szablonow parsujacych wyniki bledow. $ft->define("error_reporting", "error_reporting.tpl"); $ft->define_dynamic("error_row", "error_reporting"); switch ($action) { case "show": // wy¶wietlanie wpisu pobranego do modyfikacji $query = sprintf("\r\n SELECT\r\n id,\r\n DATE_FORMAT(date, '%%d-%%m-%%Y %%T') AS date,\r\n comments_id,\r\n author,\r\n author_ip,\r\n email,\r\n text\r\n FROM \r\n %1\$s \r\n WHERE \r\n id = '%2\$d'", TABLE_COMMENTS, $_GET['id']); $db->query($query); $db->next_record(); $date = $db->f("date"); $title = $db->f("title"); $text = $db->f("text"); $author = $db->f("author"); $published = $db->f("published"); $ft->assign(array('AUTHOR' => $author, 'DATE' => $date, 'ID' => $_GET['id'], 'TEXT' => br2nl($text))); $ft->define('form_commentsedit', "form_commentsedit.tpl"); $ft->parse('ROWS', ".form_commentsedit"); break; case "edit": // edycja wybranego wpisu $text = parse_markers($_POST['text'], 1); $author = $_POST['author']; //sprawdzania daty if (isset($_POST['now']) || !preg_match('#^([0-9][0-9])-([0-9][0-9])-([0-9][0-9][0-9][0-9]) ([0-9][0-9]:[0-9][0-9]:[0-9][0-9])$#', $_POST['date'], $matches)) { $date = date("Y-m-d H:i:s"); } else { $date = sprintf('%s-%s-%s %s', $matches[3], $matches[2], $matches[1], $matches[4]); } $query = sprintf("\r\n UPDATE \r\n %1\$s \r\n SET \r\n author\t= '%2\$s', \r\n text\t= '%3\$s',\r\n date = '%4\$s'\r\n WHERE \r\n id = '%5\$d'", TABLE_COMMENTS, $author, $text, $date, $_GET['id']); $db->query($query);
/** * 自动回复 */ function _getAutoByKeyword($keyword) { $content = $this->db->where(array('keyword' => "{$keyword}"))->get('wx_auto')->row_array(); if ($content) { $resultStr = sprintf($this->textTpl, $this->fromUsername, $this->toUsername, time(), br2nl(htmlspecialchars_decode($content['message']))); } else { $resultStr = ''; } return $resultStr; }
/** * Function to get instance by using XML node * @param <XML DOM> $extensionXMLNode * @return <Settings_ModuleManager_Extension_Model> $extensionModel */ public static function getInstanceFromXMLNodeObject($extensionXMLNode) { $extensionModel = new self(); $objectProperties = get_object_vars($extensionXMLNode); foreach ($objectProperties as $propertyName => $propertyValue) { $propertyValue = (string) $propertyValue; if ($propertyName === 'description') { $propertyValue = nl2br(str_replace(array('<', '>'), array('<', '>'), br2nl(trim($propertyValue)))); } $extensionModel->set($propertyName, $propertyValue); } $label = $extensionModel->get('label'); if (!$label) { $extensionModel->set('label', $extensionModel->getName()); } return $extensionModel; }
function getValue($uitype, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, $mode, $popuptype, $returnset = '', $viewid = '') { global $log; global $app_strings; //changed by dingjianting on 2007-11-05 for php5.2.x $log->debug("Entering getValue() method ..."); global $adb, $current_user; if ($uitype == 10) { $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname); if ($temp_val != "") { $value = ""; $module_entityname = ""; $modulename_lower = substr($fieldname, 0, -2); $modulename = ucfirst($modulename_lower); $modulesid = $modulename_lower . "id"; $tablename = "ec_" . $modulename_lower; $entityname = substr($fieldname, 0, -3) . "name"; $query = "SELECT {$entityname} FROM {$tablename} WHERE {$modulesid}='" . $temp_val . "' and deleted=0"; $fldmod_result = $adb->query($query); $rownum = $adb->num_rows($fldmod_result); if ($rownum > 0) { $value = $adb->query_result($fldmod_result, 0, $entityname); } } else { $value = ''; } } elseif ($uitype == 52 || $uitype == 53 || $uitype == 77) { $value = $adb->query_result($list_result, $list_result_count, 'user_name'); } elseif ($uitype == 5 || $uitype == 6 || $uitype == 23 || $uitype == 70) { $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname); if (isValidDate($temp_val)) { $value = getDisplayDate($temp_val); } else { $value = ''; } } elseif ($uitype == 33) { $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname); $value = str_ireplace(' |##| ', ', ', $temp_val); } elseif ($uitype == 17) { $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname); $value = '<a href="http://' . $temp_val . '" target="_blank">' . $temp_val . '</a>'; } elseif ($uitype == 13 || $uitype == 104) { $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname); $value = '<a href="' . getComposeMailUrl($temp_val) . '" target="_blank">' . $temp_val . '</a>'; } elseif ($uitype == 56) { $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname); if ($temp_val == 1) { $value = 'yes'; } else { $value = 'no'; } //changed by dingjianting on 2006-10-15 for simplized chinese if (isset($app_strings[$value])) { $value = $app_strings[$value]; } } elseif ($uitype == 51 || $uitype == 73 || $uitype == 50) { $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname); if ($temp_val != '') { $value = getAccountName($temp_val); } else { $value = ''; } } elseif ($uitype == 59) { $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname); if ($temp_val != '') { $value = getProductName($temp_val); } else { $value = ''; } } elseif ($uitype == 76) { $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname); if ($temp_val != '') { $value = getPotentialName($temp_val); } else { $value = ''; } } elseif ($uitype == 80) { $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname); if ($temp_val != '') { $value = getSoName($temp_val); } else { $value = ''; } } elseif ($uitype == 1004) { $value = $adb->query_result($list_result, $list_result_count, 'smcreatorid'); $value = getUserName($value); } elseif ($uitype == 1007) { $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname); $value = getApproveStatusById($temp_val); } elseif ($uitype == 1008) { $value = $adb->query_result($list_result, $list_result_count, 'approvedby'); $value = getUserName($value); } elseif ($uitype == 1004) { $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname); $value = getUserName($temp_val); } elseif ($uitype == 1007) { $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname); if ($temp_val == '1') { $value = $app_strings["already_approved"]; } elseif ($temp_val == '-1') { $value = $app_strings["unapproved"]; } elseif ($temp_val == '-2') { $value = $app_strings["Rejected"]; } else { $value = $app_strings["approving"]; } } elseif ($uitype == 1008) { $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname); $value = getUserName($temp_val); } else { $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname); if ($fieldname != $focus->list_link_field) { $value = $temp_val; } else { if ($mode == "list") { $tabname = getParentTab(); $value = '<a href="index.php?action=DetailView&module=' . $module . '&record=' . $entity_id . '&parenttab=' . $tabname . '">' . $temp_val . '</a>'; } elseif ($mode == "search") { if ($popuptype == "specific") { $temp_val = str_replace("'", '\\"', $temp_val); $temp_val = popup_from_html($temp_val); //Added to avoid the error when select SO from Invoice through AjaxEdit if ($module == 'Salesorders') { $value = '<a href="javascript:window.close();" onclick=\'set_return_specific("' . $entity_id . '", "' . br2nl($temp_val) . '","' . $_REQUEST['form'] . '");\'>' . $temp_val . '</a>'; } else { $value = '<a href="javascript:window.close();" onclick=\'set_return_specific("' . $entity_id . '", "' . br2nl($temp_val) . '");\'>' . $temp_val . '</a>'; } } elseif ($popuptype == "detailview") { $temp_val = popup_from_html($temp_val); $focus->record_id = $_REQUEST['recordid']; if ($_REQUEST['return_module'] == "Calendar") { $value = '<a href="javascript:window.close();" id="calendarCont' . $entity_id . '" LANGUAGE=javascript onclick=\'add_data_to_relatedlist_incal("' . $entity_id . '","' . $temp_val . '");\'>' . $temp_val . '</a>'; } else { $value = '<a href="javascript:window.close();" onclick=\'add_data_to_relatedlist("' . $entity_id . '","' . $focus->record_id . '","' . $module . '");\'>' . $temp_val . '</a>'; } } elseif ($popuptype == "formname_specific") { $temp_val = popup_from_html($temp_val); $value = '<a href="javascript:window.close();" onclick=\'set_return_formname_specific("' . $_REQUEST['form'] . '", "' . $entity_id . '", "' . br2nl($temp_val) . '");\'>' . $temp_val . '</a>'; } elseif ($popuptype == "inventory_prod") { $row_id = $_REQUEST['curr_row']; //To get all the tax types and values and pass it to product details $tax_str = ''; $unitprice = $adb->query_result($list_result, $list_result_count, 'unit_price'); $qty_stock = $adb->query_result($list_result, $list_result_count, 'qtyinstock'); $productcode = $adb->query_result($list_result, $list_result_count, 'productcode'); $temp_val = popup_from_html($temp_val); $value = '<a href="javascript:window.close();" onclick=\'set_return_inventory("' . $entity_id . '", "' . br2nl($temp_val) . '", "' . $unitprice . '", "' . $qty_stock . '","' . $tax_str . '","' . $row_id . '","' . $productcode . '");\'>' . $temp_val . '</a>'; } elseif ($popuptype == "inventory_prods") { $unitprice = $adb->query_result($list_result, $list_result_count, 'unit_price'); $qty_stock = $adb->query_result($list_result, $list_result_count, 'qtyinstock'); $productcode = $adb->query_result($list_result, $list_result_count, 'productcode'); $serialno = $adb->query_result($list_result, $list_result_count, 'serialno'); $temp_val = popup_from_html($temp_val); $value = $temp_val . '<input type="hidden" name="productname_' . $entity_id . '" id="productname_' . $entity_id . '" value="' . $temp_val . '"><input type="hidden" name="listprice_' . $entity_id . '" id="listprice_' . $entity_id . '" value="' . $unitprice . '"><input type="hidden" name="qtyinstock_' . $entity_id . '" id="qtyinstock_' . $entity_id . '" value="' . $qty_stock . '"><input type="hidden" id="productcode_' . $entity_id . '" name="productcode_' . $entity_id . '" value="' . $productcode . '"><input type="hidden" id="serialno_' . $entity_id . '" name="serialno_' . $entity_id . '" value="' . $serialno . '">'; } elseif ($popuptype == "salesorder_prod") { $row_id = $_REQUEST['curr_row']; $unitprice = $adb->query_result($list_result, $list_result_count, 'unit_price'); $temp_val = popup_from_html($temp_val); $producttype = $_REQUEST['producttype']; $value = '<a href="javascript:window.close();" onclick=\'set_return_inventory_so("' . $entity_id . '", "' . br2nl($temp_val) . '", "' . $unitprice . '", "' . $row_id . '","' . $producttype . '");\'>' . $temp_val . '</a>'; } elseif ($popuptype == "inventory_prod_po") { $row_id = $_REQUEST['curr_row']; $unitprice = $adb->query_result($list_result, $list_result_count, 'unit_price'); $productcode = $adb->query_result($list_result, $list_result_count, 'productcode'); $temp_val = popup_from_html($temp_val); $value = '<a href="javascript:window.close();" onclick=\'set_return_inventory_po("' . $entity_id . '", "' . br2nl($temp_val) . '", "' . $unitprice . '", "' . $productcode . '","' . $row_id . '"); \'>' . $temp_val . '</a>'; } elseif ($popuptype == "inventory_prod_noprice") { $row_id = $_REQUEST['curr_row']; $temp_val = popup_from_html($temp_val); $qtyinstock = $adb->query_result($list_result, $list_result_count, 'qtyinstock'); $productcode = $adb->query_result($list_result, $list_result_count, 'productcode'); $value = '<a href="javascript:window.close();" onclick=\'set_return_inventory_noprice("' . $entity_id . '", "' . br2nl($temp_val) . '","' . $row_id . '","' . $qtyinstock . '","' . $productcode . '");\'>' . $temp_val . '</a>'; } elseif ($popuptype == "inventory_prod_check") { $row_id = $_REQUEST['curr_row']; $temp_val = popup_from_html($temp_val); $productcode = $adb->query_result($list_result, $list_result_count, 'productcode'); $usageunit = $adb->query_result($list_result, $list_result_count, 'usageunit'); $qtyinstock = $adb->query_result($list_result, $list_result_count, 'qtyinstock'); $value = '<a href="javascript:window.close();" onclick=\'set_return_inventory_check("' . $entity_id . '", "' . br2nl($temp_val) . '","' . $row_id . '","' . $productcode . '","' . $usageunit . '","' . $qtyinstock . '"); \'>' . $temp_val . '</a>'; } elseif ($popuptype == "specific_account_address") { require_once 'modules/Accounts/Accounts.php'; $acct_focus = new Accounts(); $acct_focus->retrieve_entity_info($entity_id, "Accounts"); $temp_val = popup_from_html($temp_val); $value = '<a href="javascript:window.close();" onclick=\'set_return_address("' . $entity_id . '", "' . br2nl($temp_val) . '", "' . br2nl($acct_focus->column_fields['bill_street']) . '", "' . br2nl($acct_focus->column_fields['ship_street']) . '", "' . br2nl($acct_focus->column_fields['bill_city']) . '", "' . br2nl($acct_focus->column_fields['ship_city']) . '", "' . br2nl($acct_focus->column_fields['bill_state']) . '", "' . br2nl($acct_focus->column_fields['ship_state']) . '", "' . br2nl($acct_focus->column_fields['bill_code']) . '", "' . br2nl($acct_focus->column_fields['ship_code']) . '", "' . br2nl($acct_focus->column_fields['bill_country']) . '", "' . br2nl($acct_focus->column_fields['ship_country']) . '","' . br2nl($acct_focus->column_fields['bill_pobox']) . '", "' . br2nl($acct_focus->column_fields['ship_pobox']) . '");\'>' . $temp_val . '</a>'; } elseif ($popuptype == "specific_contact_account_address") { require_once 'modules/Accounts/Accounts.php'; $acct_focus = new Accounts(); $acct_focus->retrieve_entity_info($entity_id, "Accounts"); $temp_val = popup_from_html($temp_val); $value = '<a href="javascript:window.close();" onclick=\'set_return_contact_address("' . $entity_id . '", "' . br2nl($temp_val) . '", "' . br2nl($acct_focus->column_fields['bill_street']) . '", "' . br2nl($acct_focus->column_fields['ship_street']) . '", "' . br2nl($acct_focus->column_fields['bill_city']) . '", "' . br2nl($acct_focus->column_fields['ship_city']) . '", "' . br2nl($acct_focus->column_fields['bill_state']) . '", "' . br2nl($acct_focus->column_fields['ship_state']) . '", "' . br2nl($acct_focus->column_fields['bill_code']) . '", "' . br2nl($acct_focus->column_fields['ship_code']) . '", "' . br2nl($acct_focus->column_fields['bill_country']) . '", "' . br2nl($acct_focus->column_fields['ship_country']) . '","' . br2nl($acct_focus->column_fields['bill_pobox']) . '", "' . br2nl($acct_focus->column_fields['ship_pobox']) . '");\'>' . $temp_val . '</a>'; } elseif ($popuptype == "specific_potential_account_address") { $acntid = $adb->query_result($list_result, $list_result_count, "accountid"); if ($acntid != "") { //require_once('modules/Accounts/Accounts.php'); //$acct_focus = new Accounts(); //$acct_focus->retrieve_entity_info($acntid,"Accounts"); $account_name = getAccountName($acntid); $temp_val = popup_from_html($temp_val); $value = '<a href="javascript:window.close();" onclick=\'set_return_address("' . $entity_id . '", "' . br2nl($temp_val) . '", "' . $acntid . '", "' . br2nl($account_name) . '");\'>' . $temp_val . '</a>'; } else { $temp_val = popup_from_html($temp_val); $value = '<a href="javascript:window.close();" >' . $temp_val . '</a>'; } } elseif ($popuptype == "set_return_emails") { $name = $adb->query_result($list_result, $list_result_count, "lastname"); $emailaddress = $adb->query_result($list_result, $list_result_count, "email"); if ($emailaddress == '') { $emailaddress = $adb->query_result($list_result, $list_result_count, "msn"); } $where = isset($_REQUEST['where']) ? $_REQUEST['where'] : ""; $value = '<a href="javascript:;" onclick=\'return set_return_emails("' . $where . '","' . $name . '","' . $emailaddress . '"); \'>' . $name . '</a>'; } elseif ($popuptype == "set_return_mobiles") { //$firstname=$adb->query_result($list_result,$list_result_count,"first_name"); $contactname = $adb->query_result($list_result, $list_result_count, "lastname"); $mobile = $adb->query_result($list_result, $list_result_count, "mobile"); //changed by dingjianting on 2006-11-9 for simplized chinese $value = '<a href="#" onclick=\'return set_return_mobiles(' . $entity_id . ',"' . $contactname . '","' . $mobile . '"); \'>' . $contactname . '</a>'; } elseif ($popuptype == "set_return_usermobiles") { //$firstname=$adb->query_result($list_result,$list_result_count,"first_name"); $lastname = $adb->query_result($list_result, $list_result_count, "last_name"); $mobile = $adb->query_result($list_result, $list_result_count, "phone_mobile"); //changed by dingjianting on 2006-11-9 for simplized chinese $value = '<a href="#" onclick=\'return set_return_mobiles(' . $entity_id . ',"' . $lastname . '","' . $mobile . '"); \'>' . $lastname . '</a>'; } else { $temp_val = str_replace("'", '\\"', $temp_val); $temp_val = popup_from_html($temp_val); $value = '<a href="javascript:window.close();" onclick=\'set_return("' . $entity_id . '", "' . br2nl($temp_val) . '");\'>' . $temp_val . '</a>'; } } } } $log->debug("Exiting getValue method ..."); return $value; }
<h1>Apple Store Listing Copy</h1> <h3>Title</h3> <pre contenteditable="true"><?php echo htmlspecialchars($app_title($translate)); ?> </pre> <h3>Description</h3> <pre contenteditable="true"><?php echo strip_tags($description($translate)); ?> </pre> <h3>Screenshots text</h3> <pre contenteditable="true" style="text-align: center;"><?php echo br2nl($screenshots($translate)); ?> </pre> <h3>Keywords — <?php echo $keywords_warning; ?> </h3> <pre contenteditable="true"><?php echo htmlspecialchars($keywords($translate)); ?> </pre> <h3>Other</h3> <pre contenteditable="true"><?php echo htmlspecialchars($other($translate));
} $ft->parse('ROWS', "error_reporting"); } } else { $query = sprintf("\r\n SELECT\r\n id,\r\n DATE_FORMAT(date, '%%d-%%m-%%Y %%T') AS date,\r\n title,\r\n author,\r\n text,\r\n image,\r\n comments_allow,\r\n published, \r\n only_in_category\r\n FROM \r\n %1\$s \r\n WHERE \r\n id = '%2\$d'", TABLE_MAIN, $_GET['id']); $db->query($query); $db->next_record(); $date = $db->f('date'); $title = $db->f('title'); $text = $db->f('text'); $author = $db->f('author'); $published = $db->f('published'); $image = $db->f('image'); $comments_allow = $db->f('comments_allow'); $only_in_cat = $db->f('only_in_category'); $ft->assign(array('SESSION_LOGIN' => $_SESSION['login'], 'AUTHOR' => $author, 'DATE' => $date, 'ID' => $_GET['id'], 'TITLE' => !empty($_POST['title']) ? stripslashes($_POST['title']) : $title, 'TEXT' => !empty($_POST['text']) ? stripslashes(br2nl($_POST['text'])) : br2nl($text))); if ($comments_allow == 1) { $ft->assign('COMMENTS_YES', 'checked="checked"'); } else { if ($comments_allow == -1) { $ft->assign('COMMENTS_LOGGED', 'checked="checked"'); } else { $ft->assign('COMMENTS_NO', 'checked="checked"'); } } if ($only_in_cat == "1") { $ft->assign('ONLYINCAT_YES', 'checked="checked"'); } else { $ft->assign('ONLYINCAT_NO', 'checked="checked"'); } if ($published == "1") {