function RunModule() { if (isset($_GET['adv']) && (!isset($_GET['q']) && !isset(self::$types[$_GET['adv']]))) { // if we're using advanced search $_GET['q'] = $_REQUEST['q'] = $_GET['adv']; $_GET['adv'] = $_REQUEST['adv'] = ''; } $query = isset($_GET['q']) ? $_GET['q'] : ''; $adv = isset($_GET['adv']) ? $_GET['adv'] : ''; echo '<h1>Search</h1>'; $this->OutputForm(); echo '<p>Search Results for ' . $query . '</p>'; $scores = self::RunSearch($query, $adv); foreach ($scores as $row) { $score = $row[0]; $module = $row[1]; $pkVal = $row[2]; $info = $row[3]; $obj = utopia::GetInstance($module); $data = $obj->LookupRecord($pkVal); $url = $obj->GetURL($pkVal); $title = word_trim(html2txt($data[$info[1]]), 10, true); $desc = word_trim(html2txt($data[$info[2]]), 30, true); echo '<div class="searchResult"><a href="' . $url . '">' . $title . '</a><div>' . $desc . '</div></div>'; } }
public function fetch_thread_replies($count, $tid) { require_once libfile('function/discuzcode'); require_once './source/plugin/singcere_waterfall/singcere_waterfall.func.php'; $list = array(); $query = DB::query("SELECT * FROM %t WHERE first != 1 AND tid = %d AND invisible >= 0 ORDER BY dateline DESC LIMIT 0, %d", array('forum_post', $tid, $count)); while (($result = DB::fetch($query)) != false) { preg_match_all("/\\[attach\\](\\d+)\\[\\/attach\\]/i", $result['message'], $matchaids); $attachs = parseattach($result['tid'], $result['pid'], $matchaids, $result['message'], $skipaids); $k = $result['message'] = preg_replace("/\\[attach\\](\\d+)\\[\\/attach\\]/ ", "\$attachs[\\1]", $result['message']); eval("\$k=\"{$k}\";"); $k = discuzcode($k, FALSE, FALSE); $result['message'] = $k; $result['message'] = html2txt($result['message']); $list[] = $result; } return $list; }
public function find($page = 1) { $limit = 10; $vdata = array('status' => 0, 'msg' => '未输入关键词!'); if ($str = $this->input->get('w')) { // 元个数大于5 if (mstrlen($str) > 5) { $str = get_str_tags(html2txt($str)); } if ($data = $this->model->find_list($str, $limit, $limit * ($page - 1))) { $vdata = $data; $vdata['status'] = 1; $vdata['msg'] = "获取数据共" . $vdata['count'] . "条"; //分页 $this->load->library('pagination'); $this->pagination->initialize(page_config($limit, $vdata['count'], site_url('tags/find/'))); $vdata['pages'] = $this->pagination->create_links(); } } $this->output->set_content_type('application/json')->set_output(json_encode($vdata)); }
function search_output() { global $db, $opt; global $distance_unit, $startat, $count, $sql, $sqlLimit; $encoding = 'UTF-8'; $xmlLine = "\t<cache>\n\t\t<name><![CDATA[{cachename}]]></name>\n\t\t<owner id=\"{ownerid}\"><![CDATA[{owner}]]></owner>\n\t\t<id>{cacheid}</id>\n\t\t<waypoint>{waypoint}</waypoint>\n\t\t<hidden>{time}</hidden>\n\t\t<status id=\"{statusid}\">{status}</status>\n\t\t<lon value=\"{lonvalue}\">{lon}</lon>\n\t\t<lat value=\"{latvalue}\">{lat}</lat>\n\t\t<distance unit=\"" . $distance_unit . "\">{distance}</distance>\n\t\t<type id=\"{typeid}\">{type}</type>\n\t\t<difficulty>{difficulty}</difficulty>\n\t\t<terrain>{terrain}</terrain>\n\t\t<size id=\"{sizeid}\">{container}</size>\n\t\t<country id=\"{countryid}\">{country}</country>\n\t\t<link><![CDATA[" . $opt['page']['default_absolute_url'] . "viewcache.php?wp={waypoint}]]></link>\n\t\t<desc><![CDATA[{shortdesc}]]></desc>\n\t\t<hints><![CDATA[{hints}]]></hints>\n\t</cache>\n"; // create temporary table sql_temp_table_slave('searchtmp'); sql_slave('CREATE TEMPORARY TABLE &searchtmp SELECT SQL_BUFFER_RESULT SQL_CALC_FOUND_ROWS ' . $sql . $sqlLimit); $resultcount = sql_value_slave('SELECT FOUND_ROWS()', 0); $rsCount = sql_slave('SELECT COUNT(*) `count` FROM &searchtmp'); $rCount = sql_fetch_array($rsCount); mysql_free_result($rsCount); // start output if (!$db['debug']) { header("Content-type: application/xml; charset=" . $encoding); //header("Content-Disposition: attachment; filename=" . $sFilebasename . ".txt"); echo "<?xml version=\"1.0\" encoding=\"" . $encoding . "\"?>\n"; echo "<result>\n"; echo "\t<docinfo>\n"; echo "\t\t<results>" . $rCount['count'] . "</results>\n"; echo "\t\t<startat>" . $startat . "</startat>\n"; echo "\t\t<perpage>" . $count . "</perpage>\n"; echo "\t\t<total>" . $resultcount . "</total>\n"; echo "\t</docinfo>\n"; } $rs = sql_slave("SELECT &searchtmp.`cache_id` `cacheid`,\n &searchtmp.`longitude` `longitude`,\n &searchtmp.`latitude` `latitude`,\n `caches`.`wp_oc` `waypoint`,\n `caches`.`date_hidden` `date_hidden`,\n `caches`.`name` `name`,\n `caches`.`country` `countrycode`,\n `caches`.`terrain` `terrain`,\n `caches`.`difficulty` `difficulty`,\n `caches`.`desc_languages` `desc_languages`,\n `cache_size`.`name` `size`,\n `cache_size`.`id` `size_id`,\n `cache_type`.`name` `type`,\n `cache_type`.`id` `type_id`,\n `cache_status`.`name` `status`,\n `cache_status`.`id` `status_id`,\n `user`.`username` `username`,\n `user`.`user_id` `user_id`,\n `cache_desc`.`desc` `desc`,\n `cache_desc`.`short_desc` `short_desc`,\n `cache_desc`.`hint` `hint`,\n `cache_desc`.`desc_html` `html`,\n &searchtmp.`distance` `distance`,\n `sys_trans_text`.`text` `country`\n FROM &searchtmp\n INNER JOIN `caches` ON &searchtmp.`cache_id`=`caches`.`cache_id`\n INNER JOIN `user` ON &searchtmp.`user_id`=`user`.`user_id`\n INNER JOIN `cache_desc`\n ON `caches`.`cache_id`=`cache_desc`.`cache_id` \n AND `caches`.`default_desclang`=`cache_desc`.`language`\n INNER JOIN `cache_type` ON `caches`.`type`=`cache_type`.`id`\n INNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id`\n INNER JOIN `cache_size` ON `caches`.`size`=`cache_size`.`id`\n LEFT JOIN `countries` ON `countries`.`short`=`caches`.`country`\n LEFT JOIN `sys_trans_text` ON `sys_trans_text`.`trans_id`=`countries`.`trans_id`\n AND `sys_trans_text`.`lang`='&1'", $opt['template']['locale']); while ($r = sql_fetch_array($rs)) { if (strlen($r['desc_languages']) > 2) { $r = get_locale_desc($r); } $thisline = $xmlLine; $lat = sprintf('%01.5f', $r['latitude']); $thisline = str_replace('{lat}', help_latToDegreeStr($lat), $thisline); $thisline = str_replace('{latvalue}', $lat, $thisline); $lon = sprintf('%01.5f', $r['longitude']); $thisline = str_replace('{lon}', help_lonToDegreeStr($lon), $thisline); $thisline = str_replace('{lonvalue}', $lon, $thisline); $time = date('d.m.Y', strtotime($r['date_hidden'])); $thisline = str_replace('{time}', $time, $thisline); $thisline = str_replace('{waypoint}', $r['waypoint'], $thisline); $thisline = str_replace('{cacheid}', $r['cacheid'], $thisline); $thisline = str_replace('{cachename}', filterevilchars($r['name']), $thisline); $thisline = str_replace('{country}', text_xmlentities($r['country']), $thisline); $thisline = str_replace('{countryid}', $r['country'], $thisline); if ($r['hint'] == '') { $thisline = str_replace('{hints}', '', $thisline); } else { $thisline = str_replace('{hints}', str_rot13_gc(decodeEntities(filterevilchars(strip_tags($r['hint'])))), $thisline); } $thisline = str_replace('{shortdesc}', filterevilchars($r['short_desc']), $thisline); if ($r['html'] == 0) { $thisline = str_replace('{htmlwarn}', '', $thisline); $thisline = str_replace('{desc}', filterevilchars(strip_tags($r['desc'])), $thisline); } else { $thisline = str_replace('{htmlwarn}', ' (Text converted from HTML)', $thisline); $thisline = str_replace('{desc}', html2txt(filterevilchars($r['desc'])), $thisline); } $thisline = str_replace('{type}', $r['type'], $thisline); $thisline = str_replace('{typeid}', $r['type_id'], $thisline); $thisline = str_replace('{container}', $r['size'], $thisline); $thisline = str_replace('{sizeid}', $r['size_id'], $thisline); $thisline = str_replace('{status}', $r['status'], $thisline); $thisline = str_replace('{statusid}', $r['status_id'], $thisline); $difficulty = sprintf('%01.1f', $r['difficulty'] / 2); $thisline = str_replace('{difficulty}', $difficulty, $thisline); $terrain = sprintf('%01.1f', $r['terrain'] / 2); $thisline = str_replace('{terrain}', $terrain, $thisline); $thisline = str_replace('{owner}', filterevilchars($r['username']), $thisline); $thisline = str_replace('{ownerid}', filterevilchars($r['user_id']), $thisline); $thisline = str_replace('{distance}', text_xmlentities(sprintf("%01.1f", $r['distance'])), $thisline); $thisline = lf2crlf($thisline); if (!$db['debug']) { echo $thisline; } } mysql_free_result($rs); sql_drop_temp_table_slave('searchtmp'); if (!$db['debug']) { echo "</result>\n"; } }
} $page['page'][$i]['souspage'][$j]['image_url'] = ""; $page['page'][$i]['souspage'][$j]['image_largeur'] = ""; $page['page'][$i]['souspage'][$j]['image_hauteur'] = ""; $page['page'][$i]['souspage'][$j]['vignette_url'] = ""; $page['page'][$i]['souspage'][$j]['vignette_largeur'] = ""; $page['page'][$i]['souspage'][$j]['vignette_hauteur'] = ""; $j++; } } else { $page['page'][$i]['souspage'] = array(); } /* on recupere les infos de la premiere page pour les balises meta */ if ($i == "0") { $page['meta_description'] = html2txt($ligne['page_summary']); $page['meta_keyword'] = html2txt($ligne['page_title'] . " " . $ligne['page_summary']); $page['meta_date'] = $ligne['page_date_edit']; } $i++; } } sql_free_result($res_page); sql_close($sgbd); if ($right_user['add_information']) { $page['link_add'] = convert_url("index.php?r=" . $lang['general']['idurl_information'] . "&v1=form_page"); } else { $page['link_add'] = ""; } $_SESSION['menu_information'] = $page['page']; $page['L_add'] = $lang['information']['add_page']; $page['L_title'] = $lang['information']['information'];
function PageCodeOutbox() { global $memberID; global $dir; global $site; global $tmpl; global $date_format; $query = "\r\n\t\tSELECT\r\n\t\t\t`Messages`.`ID`,\r\n\t\t\tUNIX_TIMESTAMP( `Date` ) AS `timestamp`,\r\n\t\t\tDATE_FORMAT(`Date`, '{$date_format}') AS `Date`,\r\n\t\t\t`Recipient`,\r\n\t\t\t`Profiles`.`NickName` AS `RecipientNickName`,\r\n\t\t\t`Subject`,\r\n\t\t\t`New`\r\n\t\tFROM `Messages`\r\n\t\tLEFT JOIN `Profiles` ON\r\n\t\t\t`Profiles`.`ID` = `Recipient`\r\n\t\tWHERE `Sender` = {$memberID}\r\n\t\tORDER BY `Date` DESC\r\n\t\t"; $rMsgs = db_res($query); if (!mysql_num_rows($rMsgs)) { return '<div class="no_result"><div>' . _t("_No messages in Outbox") . '</div></div>'; } // --- get template and replace headers --- $aReplace = array(); $aReplace['mailbox_header_img'] = '<img src="' . getTemplateIcon('outbox.gif') . '" class="mailbox_header_img" />'; //$aReplace['summary'] = _t( $aReplace['flag'] = _t('_Flag'); $aReplace['from'] = _t('_Recipient'); $aReplace['date'] = _t('_Date'); $aReplace['subject'] = _t('_Subject'); $aReplace['click_to_sort'] = _t('_Click to sort'); $aReplace['actions_l'] = ''; $aReplace['actions'] = ''; $ret = file_get_contents("{$dir['root']}templates/tmpl_{$tmpl}/mail_box.html"); foreach ($aReplace as $key => $val) { $ret = str_replace("__{$key}__", $val, $ret); } $aMyTmpl = preg_split("/\\{\\/?InsertRows\\}/", $ret); $tmplRow = $aMyTmpl[1]; $ret = "{$aMyTmpl[0]}{InsertRows /}{$aMyTmpl[2]}"; $InsertRows = ''; $tr_class = 'odd'; while ($aMsg = mysql_fetch_assoc($rMsgs)) { $sSubject = process_line_output(html2txt($aMsg['Subject'])); $aReplace = array(); $aReplace['tr_class'] = $tr_class; $aReplace['new_add'] = $aMsg['New'] ? 'new' : ''; $aReplace['ID'] = $aMsg['ID']; $aReplace['CheckBox'] = ''; $aReplace['Flag'] = '<img class="mailbox_flag_img" src="' . getTemplateIcon($aMsg['New'] ? 'not_readed.gif' : 'readed.gif') . '" title="' . _t($aMsg['New'] ? '_Not Readed' : '_Readed') . '" />'; $aReplace['From'] = "<!--{$aMsg['RecipientNickName']}--> <a href=\"{$site['url']}{$aMsg['RecipientNickName']}\">{$aMsg['RecipientNickName']}</a>"; $aReplace['Date'] = "<!--{$aMsg['timestamp']}--> {$aMsg['Date']}"; $aReplace['Subject'] = "<!--{$sSubject}--> <a href=\"{$site['url']}messages_outbox.php?message={$aMsg['ID']}\">{$sSubject}</a>"; $sInsertRow = $tmplRow; foreach ($aReplace as $key => $val) { $sInsertRow = str_replace("{{$key}}", $val, $sInsertRow); } $sInsertRows .= $sInsertRow; $tr_class = $tr_class == 'odd' ? 'even' : 'odd'; } $ret = str_replace("{InsertRows /}", $sInsertRows, $ret); return $ret; }
/** * Send email function * * @param string $sRecipientEmail - Email where email should be send * @param string $sMailSubject - subject of the message * @param string $sMailBody - Body of the message * @param integer $iRecipientID - ID of recipient profile * @param array $aPlus - Array of additional information * * * @return boolean - trie if message was send * - false if not */ function sendMail($sRecipientEmail, $sMailSubject, $sMailBody, $iRecipientID = 0, $aPlus = array(), $sEmailFlag = 'html', $isDisableAlert = false, $bForceSend = false) { global $site; if (!$sRecipientEmail || preg_match('/\\(2\\)$/', $sRecipientEmail)) { return false; } if ($iRecipientID) { $aRecipientInfo = getProfileInfo($iRecipientID); } // don't send mail to the user if he/she decided to not receive any site's notifications, unless it is critical emails (like email confirmation) if (!$bForceSend) { $aRealRecipient = $GLOBALS['MySQL']->getRow("SELECT * FROM `Profiles` WHERE `Email`='" . process_db_input($sRecipientEmail, BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION) . "' LIMIT 1"); if ($aRealRecipient && 1 != $aRealRecipient['EmailNotify']) { return true; } } $sEmailNotify = isset($GLOBALS['site']['email_notify']) ? $GLOBALS['site']['email_notify'] : getParam('site_email_notify'); $sSiteTitle = isset($GLOBALS['site']['title']) ? $GLOBALS['site']['title'] : getParam('site_title'); $sMailHeader = "From: =?UTF-8?B?" . base64_encode($sSiteTitle) . "?= <{$sEmailNotify}>"; $sMailParameters = "-f{$sEmailNotify}"; if ($aPlus || $iRecipientID) { if (!is_array($aPlus)) { $aPlus = array(); } bx_import('BxDolEmailTemplates'); $oEmailTemplates = new BxDolEmailTemplates(); $sMailSubject = $oEmailTemplates->parseContent($sMailSubject, $aPlus, $iRecipientID); $sMailBody = $oEmailTemplates->parseContent($sMailBody, $aPlus, $iRecipientID); } $sMailSubject = '=?UTF-8?B?' . base64_encode($sMailSubject) . '?='; $sMailHeader = "MIME-Version: 1.0\r\n" . $sMailHeader; if (!$isDisableAlert && 'on' == getParam('bx_smtp_on')) { return BxDolService::call('smtpmailer', 'send', array($sRecipientEmail, $sMailSubject, $sMailBody, $sMailHeader, $sMailParameters, 'html' == $sEmailFlag, $aRecipientInfo)); } if ('html' == $sEmailFlag) { $sMailHeader = "Content-type: text/html; charset=UTF-8\r\n" . $sMailHeader; $iSendingResult = mail($sRecipientEmail, $sMailSubject, $sMailBody, $sMailHeader, $sMailParameters); } else { $sMailHeader = "Content-type: text/plain; charset=UTF-8\r\n" . $sMailHeader; $sMailBody = html2txt($sMailBody); $iSendingResult = mail($sRecipientEmail, $sMailSubject, html2txt($sMailBody), $sMailHeader, $sMailParameters); } if (!$isDisableAlert) { //--- create system event bx_import('BxDolAlerts'); $aAlertData = array('email' => $sRecipientEmail, 'subject' => $sMailSubject, 'body' => $sMailBody, 'header' => $sMailHeader, 'params' => $sMailParameters, 'html' => 'html' == $sEmailFlag ? true : false); $oZ = new BxDolAlerts('profile', 'send_mail', $aRecipientInfo['ID'], '', $aAlertData); $oZ->alert(); } return $iSendingResult; }
<?php /** * YoutubeGallery for Joomla! * @version 4.3.6 * @author Ivan Komlev< <*****@*****.**> * @link http://www.joomlaboat.com * @GNU General Public License **/ // No direct access to this file //defined('_JEXEC') or die('Restricted access'); //require_once(JPATH_SITE.DS.'components'.DS.'com_youtubegallery'.DS.'includes'.DS.'misc.php'); $videofile = urldecode($_GET['videofile']); $videofile = html2txt($videofile); //YouTubeGalleryMisc:: $videofile = '../../../' . $videofile; if (!file_exists($videofile)) { echo 'File not found.'; die; } require_once 'flv4php/FLV.php'; $flv = new FLV($videofile); echo $flv->getFlvThumb(); function html2txt($document) { $search = array('@<script[^>]*?>.*?</script>@si', '@<[\\/\\!]*?[^<>]*?>@si', '@<style[^>]*?>.*?</style>@siU', '@<![\\s\\S]*?--[ \\t\\n\\r]*>@'); $text = preg_replace($search, '', $document); return $text; }
function limit_words($string, $word_limit) { $words = explode(' ', $string); $toremove = array('—', '“', '"', ',', '.', '-', '?', '•', ',', '.', ':', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '-', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '.', ';', '{', '}', '[', ']', '|', '/', '<', '>', '+', '='); $words = str_replace($toremove, "", $words); $words = preg_replace('/[\\r\\n\\t\\s]+/s', ' ', $words); $words = html2txt($words); return implode(' ', array_splice($words, 0, $word_limit)); }
$page['value_text'] = ""; $page['value_id'] = ""; $page['value_topic'] = ""; $page['erreur'] = array(); $page['form_action'] = convert_url("index.php?r=" . $lang['general']['idurl_forum'] . "&v1=" . $forum['forum_idurl']); /* modification ou add */ if (isset($_POST) and !empty($_POST)) { /* we format datas */ $_POST['title'] = format_txt($_POST['title']); $_POST['text'] = trim($_POST['text']); /* verification des infos */ if (!isset($_POST['title']) or $_POST['title'] == "") { $page['erreur'][$nb_erreur]['message'] = $lang['forum']['E_empty_title']; $nb_erreur++; } if (!isset($_POST['text']) or trim(html2txt($_POST['text'])) == "") { $page['erreur'][$nb_erreur]['message'] = $lang['forum']['E_empty_message']; $nb_erreur++; } /* we format datas */ if (isset($_SESSION['session_member_id']) and !empty($_SESSION['session_member_id'])) { $_POST['member'] = $_SESSION['session_member_id']; } else { $_POST['member'] = 0; } $_POST['forum'] = $forum['forum_id']; $_POST['ip'] = $_SERVER['REMOTE_ADDR']; if (!isset($_POST['topic']) or $_POST['topic'] == "") { $_POST['topic'] = "0"; } # the field email must not be filled in otherwise it mey be a spam robot
function txtAlfabetico() { $txt = ucfirst(LABEL_Titulo) . ': ' . $_SESSION["CFGTitulo"] . "\r\n"; $txt .= ucfirst(LABEL_Autor) . ': ' . $_SESSION["CFGAutor"] . "\r\n"; $txt .= ucfirst(LABEL_Keywords) . ': ' . $_SESSION["CFGKeywords"] . "\r\n"; $txt .= ucfirst(LABEL_Cobertura) . ': ' . $_SESSION["CFGCobertura"] . "\r\n"; $txt .= LABEL_URI . ': ' . $_SESSION["CFGURL"] . "\r\n"; $txt .= ucfirst(LABEL_Version) . ': ' . $_SESSION["CFGVersion"] . "\r\n"; $txt .= "__________________________________________________________________________\r\n"; //Lista de todos los términos $sql = SQLlistaTemas(); while ($arrayTema = mysqli_fetch_array($sql[datos])) { #Mantener vivo el navegador $time_now = time(); if ($time_start >= $time_now + 10) { $time_start = $time_now; header('X-pmaPing: Pong'); } // Diferenciar entre términos preferidos y términos no preferidos o referencias if ($arrayTema[t_relacion]) { //Remisiones de equivalencias y no preferidos $sqlNoPreferidos = SQLterminosValidosUF($arrayTema[id]); while ($arrayNoPreferidos = mysqli_fetch_array($sqlNoPreferidos[datos])) { $acronimo = arrayReplace(array("4", "5", "7", "8"), array(USE_termino, EQ_acronimo, EQP_acronimo, NEQ_acronimo), $arrayNoPreferidos[t_relacion]); $referencia_mapeo = $arrayNoPreferidos[vocabulario_id] !== '1' ? ' (' . $arrayNoPreferidos[titulo] . ' / ' . $arrayNoPreferidos[idioma] . ')' : '' . "\r\n"; $txt .= "\n" . $arrayTema[tema] . $referencia_mapeo; $txt .= ' ' . $acronimo . ': ' . $arrayNoPreferidos[tema_pref] . "\r\n"; } } else { // Si es preferido: mostar notas y relaciones $txt .= "\n" . $arrayTema[tema] . "\r\n"; $txt .= LABEL_fecha_creacion . ': ' . $arrayTema[cuando] . "\r\n"; if ($arrayTema[cuando_final] > $arrayTema[cuando]) { $txt .= LABEL_fecha_modificacion . ': ' . $arrayTema[cuando_final] . "\r\n"; } //Notas $sqlNotas = SQLdatosTerminoNotas($arrayTema[id], array("NB", "NH", "NA", "NC")); while ($arrayNotas = mysqli_fetch_array($sqlNotas[datos])) { $acronimo = arrayReplace(array("NB", "NH", "NA", "NC"), array(NB_acronimo, NH_acronimo, NA_acronimo, NC_acronimo), $arrayNotas[tipo_nota]); $txt .= ' ' . $acronimo . ': ' . html2txt($arrayNotas[nota]) . "\r\n"; } //Relaciones $sqlRelaciones = SQLverTerminoRelaciones($arrayTema[id]); $arrayRelacionesVisibles = array("2", "3", "4"); // TG/TE/UP /TR while ($arrayRelaciones = mysqli_fetch_array($sqlRelaciones[datos])) { if (in_array($arrayRelaciones[t_relacion], $arrayRelacionesVisibles)) { $acronimo = arrayReplace($arrayRelacionesVisibles, array(TR_acronimo, TG_acronimo, UP_acronimo), $arrayRelaciones[t_relacion]); $txt .= ' ' . $acronimo . ': ' . $arrayRelaciones[tema] . "\r\n"; } } //Terminos especificos $SQLTerminosE = SQLverTerminosE($arrayTema[id]); while ($arrayTE = mysqli_fetch_array($SQLTerminosE[datos])) { $txt .= ' ' . TE_acronimo . ': ' . $arrayTE[tema] . "\r\n"; } } } $filname = string2url($_SESSION[CFGTitulo] . ' ' . MENU_ListaAbc) . '.txt'; return sendFile("{$txt}", "{$filname}"); }
$title = preg_replace('/[^(\\x20-\\x7F)]*/', '', trim(strip_tags($matches[0][0]))); } else { $title = ''; } // Turns out PHP has a function for extracting meta tags for us, the only // catch is that it works on files, so we fake a file by creating one using // base64 encode and string concaternation $tmp = get_meta_tags("data://{$mime};base64," . base64_encode($content)); if (isset($tmp['description'])) { $desc = preg_replace('/[^(\\x20-\\x7F)]*/', '', trim($tmp['description'])); } else { $desc = ''; } // This is the rest of the content. We try to clean it somewhat using // the custom function html2text which works 90% of the tiem $content = preg_replace('/[^(\\x20-\\x7F)]*/', '', trim(strip_tags(html2txt($content)))); // If values arent set lets try to set them here. Start with desc // using content and then try the title using desc if ($desc == '' && $content != '') { $desc = substr($content, 0, 200) . '...'; } if ($title == '' && $desc != '') { $title = substr($desc, 0, 50) . '...'; } $count++; // If we dont have a title, then we dont have desc or content // so lets not add it to the index if ($title != '') { $toindex[] = array($url, $title, $desc, $rank); echo 'INDEXING ' . $count . "\r\n"; } else {
function Answers_Info($user_data) { $arr = $user_data['parameters']['res']; $res = '<table class="data">' . "\n"; $p = $this->Problems_AllById($user_data['contest_id']); $tasks = $user_data['parameters']['tasks']; $opened = false; $n = count($arr); $i = 0; while ($i < $n) { $m = min(10, $n - $i); $res .= ' <tr>' . "\n "; for ($j = 0; $j < $m; $j++) { $pr = $p[$tasks[$i]['problem_id']]; $res .= '<th><span title="' . htmlspecialchars(html2txt($pr['description'])) . '">' . ($i + 1) . '</span></th>'; $i++; } for ($j = $m; $j < 10; $j++) { $res .= '<td class="void"></td>'; } $res .= ' </tr>' . "\n"; $i -= $m; $res .= ' <tr>' . "\n "; for ($j = 0; $j < $m; $j++) { $title = ''; $pr = $p[$tasks[$i]['problem_id']]; if (!$arr[$i]) { $lib = new $pr['settings']['anstype'](); $title = htmlspecialchars('Ответ участника: ' . $lib->GetUserAnswerText($pr, $user_data['parameters']['user_answers'][$i], $i)); $title .= htmlspecialchars(' | Верный ответ: ' . $lib->GetCorrectAnswerText($pr)); } $res .= '<td' . ($arr[$i] ? ' style="background: #cfc"' : '') . '>' . ($arr[$i] ? '+' : '<span title="' . $title . '">-</span>') . '</td>'; $i++; } for ($j = $m; $j < 10; $j++) { $res .= '<td class="void"></td>'; } $res .= ' </tr>' . "\n"; } $res .= '</table>' . "\n"; return $res; }
function txt4term($tema_id, $params = array()) { $arrayTema = ARRAYverTerminoBasico($tema_id); $txt .= "\n" . $arrayTema[tema] . "\r\n"; $label_target_vocabulary = ''; $txt .= $params["includeCreatedDate"] == 1 ? LABEL_fecha_creacion . ': ' . $arrayTema[cuando] . "\r\n" : ''; if ($arrayTema[cuando_final] > $arrayTema[cuando] && $params["includeModDate"] == 1) { $txt .= LABEL_fecha_modificacion . ': ' . $arrayTema[cuando_final] . "\r\n"; } //Notas $sqlNotas = SQLdatosTerminoNotas($arrayTema[tema_id]); while ($arrayNotas = $sqlNotas->FetchRow()) { $arrayNotas[label_tipo_nota] = in_array($arrayNotas[ntype_id], array(8, 9, 10, 11, 15)) ? arrayReplace(array(8, 9, 10, 11, 15), array(LABEL_NA, LABEL_NH, LABEL_NB, LABEL_NP, LABEL_NC), $arrayNotas[ntype_id]) : $arrayNotas[ntype_code]; if ($arrayNotas[tipo_nota] !== 'NP' && in_array($arrayNotas[tipo_nota], $params["includeNote"])) { $txt .= ' ' . $arrayNotas[label_tipo_nota] . ': ' . html2txt($arrayNotas[nota]) . "\r\n"; } } //Relaciones $sqlRelaciones = SQLverTerminoRelaciones($arrayTema[tema_id]); $arrayRelacionesVisibles = array(2, 3, 4, 5, 6, 7); // TG/TE/UP/TR while ($arrayRelaciones = $sqlRelaciones->FetchRow()) { if (in_array($arrayRelaciones[t_relacion], $arrayRelacionesVisibles)) { $acronimo = arrayReplace($arrayRelacionesVisibles, array(TR_acronimo, TG_acronimo, UP_acronimo, EQP_acronimo, EQ_acronimo, NEQ_acronimo), $arrayRelaciones[t_relacion]); if (in_array($arrayRelaciones[t_relacion], array(5, 6, 7))) { //términos equivalentes .. se concatenan después de los TE/NT $label_target_vocabulary .= ' ' . $acronimo . ': ' . $arrayRelaciones[tema] . ' (' . $arrayRelaciones[titulo] . ')' . "\r\n"; } else { $txt .= ' ' . $acronimo . $arrayRelaciones[rr_code] . ': ' . $arrayRelaciones[tema] . "\r\n"; } } } //Terminos especificos $SQLTerminosE = SQLverTerminosE($arrayTema[tema_id]); while ($arrayTE = $SQLTerminosE->FetchRow()) { $txt .= ' ' . TE_acronimo . $arrayTE[rr_code] . ': ' . $arrayTE[tema] . "\r\n"; } $txt .= $label_target_vocabulary; //Terminos equivalentes web services $SQLtargetTerms = SQLtargetTerms($arrayTema[tema_id]); while ($arrayTT = $SQLtargetTerms->FetchRow()) { $txt .= ' ' . FixEncoding(ucfirst($arrayTT[tvocab_label])) . ': ' . FixEncoding($arrayTT[tterm_string]) . "\r\n"; } return $txt; }
function test_ppt() { global $CONF; //don't run test if utility not on this machine if ($this->extractor->supported_formats['.ppt']['supported']) { $filename = $CONF['path_test'] . 'data/test.ppt'; $content = "\n" . $filename . "\n \nCreated with pptHtml\n\n"; //not happy with this - this is a watermark this version of ppthtml inserts $r = $this->extractor->extract($filename); $this->assertEqual($content, html2txt($r)); } }
function do_meta_tag($arrayTermino = "") { global $CFG; //Si hay algún tema de proveniente de algún proceso global $tema; if (secure_data($tema, "digit")) { //Si hay tema_id desde GET o PORS $tema_id = $_POST[tema] ? $_POST[tema] : $_GET[tema]; //Si hay tema_id desde algún proceso $tema_id = $tema ? $tema : $tema_id; } if (secure_data($tema_id, "digit")) { $ARRAYdatosTermino = ARRAYverDatosTermino(secure_data($tema_id, "digit")); $sub_title = '; ' . xmlentities($ARRAYdatosTermino[titTema]); $ver_sub_title = xmlentities($ARRAYdatosTermino[titTema]) . ' - '; $relMeta = '<link rel="Dublin Core metadata" type="application/xml" href="xml.php?dcTema=' . $ARRAYdatosTermino[idTema] . '" title="Dublin Core ' . xmlentities($datosTermino[titTema]) . '" />'; $relMeta .= '<link rel="MADS metadata" type="application/xml" href="xml.php?madsTema=' . $ARRAYdatosTermino[idTema] . '" title="MADS ' . xmlentities($datosTermino[titTema]) . '" />'; $relMeta .= '<link rel="Zthes metadata" type="application/xml" href="xml.php?zthesTema=' . $ARRAYdatosTermino[idTema] . '" title="Zthes ' . xmlentities($datosTermino[titTema]) . '" />'; $relMeta .= '<link rel="Skos metadata" type="application/rdf+xml" href="xml.php?skosTema=' . $ARRAYdatosTermino[idTema] . '" title="Skos Core ' . xmlentities($datosTermino[titTema]) . '" />'; $relMeta .= '<link rel="TopicMap metadata" type="application/xml" href="xml.php?xtmTema=' . $ARRAYdatosTermino[idTema] . '" title="TopicMap ' . xmlentities($datosTermino[titTema]) . '" />'; } elseif (secure_data($_GET[letra], "alnum")) { $sub_title = '; ' . MSG_ResultLetra . ' ' . xmlentities($_REQUEST[letra]); $ver_sub_title = ' :: ' . MENU_ListaAbc . ': ' . xmlentities($_REQUEST[letra]); } $meta_tag = '<title>' . xmlentities($ver_sub_title . ' ' . $_SESSION[CFGTitulo]) . '</title>'; /* * Error en verificación $meta_tag.='<meta http-equiv="content-language" content="'.LANG.'" />'; */ $meta_tag .= '<meta http-equiv="content-type" content="application/xhtml+xml; charset=' . $CFG["_CHAR_ENCODE"] . '" />'; $meta_tag .= '<meta name="generator" content="' . xmlentities($_SESSION[CFGVersion]) . '" />'; $meta_tag .= '<meta name="description" content="' . html2txt($ver_sub_title . $_SESSION[CFGCobertura]) . '" />'; $meta_tag .= '<meta name="keywords" content="' . xmlentities($_SESSION[CFGKeywords] . $sub_title) . '" />'; $meta_tag .= '<meta name="author" content="' . xmlentities($_SESSION[CFGAutor]) . '" />'; $meta_tag .= '<meta name="Creation_Date" content="' . $_SESSION[CFGCreacion] . '" />'; $meta_tag .= '<meta name="robots" content="index, follow" />'; $meta_tag .= '<meta name="revisit-after" content="15 days" />'; //$meta_tag.='<!-- Dublin Core -->'; $meta_tag .= '<meta name="DC.Title" content="' . xmlentities($ver_sub_title . ' ' . $_SESSION[CFGTitulo]) . '" />'; $meta_tag .= '<meta name="DC.Creator" content="' . xmlentities($_SESSION[CFGAutor]) . '" />'; $meta_tag .= '<meta name="DC.Subject" content="' . xmlentities($_SESSION[CFGKeywords] . $sub_title) . '" />'; $meta_tag .= '<meta name="DC.Description" content="' . html2txt($ver_sub_title . $_SESSION[CFGCobertura], true) . '" />'; $meta_tag .= '<meta name="DC.Publisher" content="' . xmlentities($_SESSION[CFGAutor]) . '" />'; $meta_tag .= '<meta name="DC.Date" content="' . $_SESSION[CFGCreacion] . '" />'; $meta_tag .= '<meta name="DC.Language" content="' . LANG . '" />'; $meta_tag .= '<link rel="' . MENU_Inicio . '" href="' . $_SESSION[CFGURL] . 'index.php" title="' . MENU_Inicio . '" />'; $meta_tag .= '<link rel="' . MENU_ListaSis . '" href="' . $_SESSION[CFGURL] . 'index.php" title="' . MENU_ListaSis . '" />'; $meta_tag .= '<link rel="' . MENU_ListaAbc . '" href="' . $_SESSION[CFGURL] . 'index.php?letra=?" title="' . MENU_ListaAbc . '" />'; $meta_tag .= '<link rel="' . MENU_Sobre . '" href="' . $_SESSION[CFGURL] . 'sobre.php" title="' . MENU_Sobre . '" />'; $meta_tag .= '<link rel="rss" type="application/rss+xml" href="xml.php?rss=true" title="RSS ' . xmlentities($_SESSION[CFGTitulo]) . '" />'; $meta_tag .= '<link rel="alternate" type="application/rss+xml" href="xml.php?rss=true" title="RSS ' . xmlentities($_SESSION[CFGTitulo]) . '" />'; $meta_tag .= $relMeta; return array("metadata" => $meta_tag, "arraydata" => $ARRAYdatosTermino); }
$tpl->display("string:" . $tploutput); } $smarty_output = ob_get_contents(); //接收快取頁面 ob_end_clean(); //--檔案授權參數 $_SESSION['file_auth']['jones_demo'] = '1'; $_SESSION["fileauth_array"]['jones_demo'] = array(); $_SESSION["fileauth_time_array"]['jones_demo'] = array(); //--seo處理 if (extension_loaded('zlib')) { ob_start('ob_gzhandler'); } header('Last-Modified: ' . gmdate('D, d M Y') . ' 00:00:00' . ' GMT', true, 200); //--最後頁面編輯時間 header('Date: ' . gmdate('D, d M Y H:i:s') . ' GMT', true, 200); header('Expires: ' . gmdate('D, d M Y H:i:s', mktime(0, 0, 0, 1, 1, 1998)) . ' GMT', true, 200); //--快取時間 echo html2txt($smarty_output); ob_end_flush(); $conn->close(); unset($design); unset($mail); unset($tpl); unset($conn); function html2txt($document) { $search = array('/<!--(.*)-->/Uis', '/\\/\\*(.*)\\*\\//'); $text = preg_replace($search, '', $document); return $text; }
sql_free_result($res_sous_page); sql_close($sgbd); # modification $page['link_edit'] = ""; $page['link_delete'] = ""; if ($right_user['edit_information']) { $page['link_edit'] = convert_url("index.php?r=" . $lang['general']['idurl_information'] . "&v1=form_page&v2=" . $page['page_id']); } if ($right_user['delete_information']) { $page['link_delete'] = convert_url("index.php?r=" . $lang['general']['idurl_information'] . "&v1=page_list&v2=delete&v3=" . $page['page_id']); } /* add de la visit */ $var['id'] = $page['page_id']; $sql_visit = sql_replace($sql['information']['edit_page_visit'], $var); $sgbd = sql_connect(); $res_visit = sql_query($sql_visit); sql_free_result($res_visit); sql_close($sgbd); /* end add visit */ # text $page['L_page'] = $lang['information']['information']; $page['L_date'] = $lang['information']['date_edit']; $page['L_author'] = $lang['information']['author']; $page['L_edit'] = $lang['information']['edit']; $page['L_delete'] = $lang['information']['delete']; # meta $page['meta_title'] = $page['title']; $page['meta_description'] = html2txt($page['summary']); $page['meta_keyword'] = html2txt($page['keyword']); $page['meta_date'] = $page['date_edit']; $page['template'] = $tpl['information']['view_page'];
<td><hr></td> </tr> </table> <p><iframe class="advertise" src="http://prosper202.com/ads/prosper202/" scrolling="no" frameborder="0"></iframe></p> <table cellspacing="0" cellpadding="0" class="section"> <tr> <td class="left" ><h2>Prosper202 Development Blog</h2></td> <td><hr></td> </tr> </table><?php $rss = fetch_rss('http://prosper202.com/blog/rss/'); if (isset($rss->items) && 0 != count($rss->items)) { $rss->items = array_slice($rss->items, 0, 5); foreach ($rss->items as $item) { $item['description'] = html2txt($item['description']); if (strlen($item['description']) > 350) { $item['description'] = substr($item['description'], 0, 350) . ' [...]'; } ?> <h4><a href='<?php echo $item['link']; ?> '><?php echo $item['title']; ?> </a> - <?php printf('%s ago', human_time_diff(strtotime($item['pubdate'], time()))); ?> </h4>
/** * Send email function * * @param string $sRecipientEmail - Email where email should be send * @param string $sMailSubject - subject of the message * @param string $sMailBody - Body of the message * @param integer $iRecipientID - ID of recipient profile * @param array $aPlus - Array of additional information * * * @return boolean - trie if message was send * - false if not */ function sendMail($sRecipientEmail, $sMailSubject, $sMailBody, $iRecipientID = '', $aPlus = '', $sEmailFlag = 'text') { global $site; if ($iRecipientID) { $aRecipientInfo = getProfileInfo($iRecipientID); } $sMailHeader = "From: =?UTF-8?B?" . base64_encode($site['title']) . "?= <{$site['email_notify']}>"; $sMailParameters = "-f{$site['email_notify']}"; $sMailSubject = str_replace("<SiteName>", $site['title'], $sMailSubject); $sMailBody = str_replace("<SiteName>", $site['title'], $sMailBody); $sMailBody = str_replace("<Domain>", $site['url'], $sMailBody); $sMailBody = str_replace("<recipientID>", $aRecipientInfo['ID'], $sMailBody); $sMailBody = str_replace("<RealName>", $aRecipientInfo['NickName'], $sMailBody); $sMailBody = str_replace("<NickName>", $aRecipientInfo['NickName'], $sMailBody); $sMailBody = str_replace("<Email>", $aRecipientInfo['Email'], $sMailBody); $sMailBody = str_replace("<Password>", $aRecipientInfo['Password'], $sMailBody); if (is_array($aPlus)) { foreach ($aPlus as $key => $value) { $sMailBody = str_replace('<' . $key . '>', $value, $sMailBody); } } $sMailSubject = '=?UTF-8?B?' . base64_encode($sMailSubject) . '?='; $sMailHeader = "MIME-Version: 1.0\r\n" . $sMailHeader; if ('html' == $sEmailFlag) { $sMailHeader = "Content-type: text/html; charset=UTF-8\r\n" . $sMailHeader; $iSendingResult = mail($sRecipientEmail, $sMailSubject, $sMailBody, $sMailHeader, $sMailParameters); } else { $sMailHeader = "Content-type: text/plain; charset=UTF-8\r\n" . $sMailHeader; $iSendingResult = mail($sRecipientEmail, $sMailSubject, html2txt($sMailBody), $sMailHeader, $sMailParameters); } return $iSendingResult; }
/** * Send email function * * @param $sRecipientEmail - Email where email should be send * @param $sMailSubject - subject of the message * @param $sMailBody - Body of the message * @param $iRecipientID - ID of recipient profile * @param $aPlus - Array of additional information * @param $iEmailType - email message type: BX_EMAIL_SYSTEM, BX_EMAIL_NOTIFY or BX_EMAIL_MASS * @return true if message was send or false otherwise */ function sendMail($sRecipientEmail, $sMailSubject, $sMailBody, $iRecipientID = 0, $aPlus = array(), $iEmailType = BX_EMAIL_NOTIFY, $sEmailFlag = 'html', $isDisableAlert = false) { // make sure that recipient's email is valid and message isn't empty if (!$sMailBody || !$sRecipientEmail || preg_match('/\\(2\\)$/', $sRecipientEmail)) { return false; } // get recipient account bx_import('BxDolAccount'); $oAccount = BxDolAccount::getInstance($sRecipientEmail); $aAccountInfo = $oAccount ? $oAccount->getInfo() : false; // don't send bulk emails if user didn't subscribed to site news or email is unconfirmed if ($aAccountInfo && BX_EMAIL_MASS == $iEmailType && (!$aAccountInfo['email_confirmed'] || !$aAccountInfo['receive_news'])) { return false; } // don't send email notifications if user didn't subscribed to notifications or email is unconfirmed if ($aAccountInfo && BX_EMAIL_NOTIFY == $iEmailType && (!$aAccountInfo['email_confirmed'] || !$aAccountInfo['receive_updates'])) { return false; } // if profile id is provided - get profile's info $aRecipientInfo = false; if ($iRecipientID) { bx_import('BxDolProfile'); $oProfile = BxDolProfile::getInstance($iRecipientID); if ($oProfile) { $aRecipientInfo = $oProfile->getInfo(); } } // get site vars $sEmailNotify = getParam('site_email_notify'); $sSiteTitle = getParam('site_title'); // add unsubscribe link if (empty($aPlus['unsubscribe'])) { $aPlus['unsubscribe'] = ''; if ($oAccount && (BX_EMAIL_MASS == $iEmailType || BX_EMAIL_NOTIFY == $iEmailType)) { $aPlus['unsubscribe'] = ($sLink = $oAccount->getUnsubscribeLink($iEmailType)) ? '<a href="' . BX_DOL_URL_ROOT . $sLink . '">' . _t('_sys_et_txt_unsubscribe') . '</a>' : ''; } } // parse template if ($aPlus || $iRecipientID) { if (!is_array($aPlus)) { $aPlus = array(); } bx_import('BxDolEmailTemplates'); $oEmailTemplates = BxDolEmailTemplates::getInstance(); $sMailSubject = $oEmailTemplates->parseContent($sMailSubject, $aPlus, $iRecipientID); $sMailBody = $oEmailTemplates->parseContent($sMailBody, $aPlus, $iRecipientID); } // email message headers $sMailHeader = "From: =?UTF-8?B?" . base64_encode($sSiteTitle) . "?= <{$sEmailNotify}>"; $sMailParameters = "-f{$sEmailNotify}"; $sMailSubject = '=?UTF-8?B?' . base64_encode($sMailSubject) . '?='; $sMailHeader = "MIME-Version: 1.0\r\n" . $sMailHeader; // build data for alert handler $bResult = null; $aAlert = array('email' => $sRecipientEmail, 'subject' => $sMailSubject, 'body' => $sMailBody, 'header' => $sMailHeader, 'params' => $sMailParameters, 'recipient' => $aRecipientInfo, 'html' => 'html' == $sEmailFlag ? true : false, 'override_result' => &$bResult); // system alert if (!$isDisableAlert) { bx_alert('system', 'before_send_mail', isset($aRecipientInfo['ID']) ? $aRecipientInfo['ID'] : 0, '', $aAlert); if ($bResult !== null) { return $bResult; } unset($aAlert['override_result']); } // send mail if ('html' == $sEmailFlag) { $sMailHeader = "Content-type: text/html; charset=UTF-8\r\n" . $sMailHeader; $iSendingResult = mail($sRecipientEmail, $sMailSubject, $sMailBody, $sMailHeader, $sMailParameters); } else { $sMailHeader = "Content-type: text/plain; charset=UTF-8\r\n" . $sMailHeader; $sMailBody = html2txt($sMailBody); $iSendingResult = mail($sRecipientEmail, $sMailSubject, html2txt($sMailBody), $sMailHeader, $sMailParameters); } // system alert if (!$isDisableAlert) { bx_alert('system', 'send_mail', isset($aRecipientInfo['ID']) ? $aRecipientInfo['ID'] : 0, '', $aAlert); } return $iSendingResult; }
$page['forum'][$i]['link_down'] = convert_url("index.php?r=" . $lang['general']['idurl_forum'] . "&v1=forum_list&v2=organize&v3=down&v4=" . $ligne['forum_order'] . "&v5=" . $ligne['forum_id']); } $page['forum'][$i]['link_edit'] = ""; $page['forum'][$i]['link_delete'] = ""; if ($right_user['edit_forum']) { $page['forum'][$i]['link_edit'] = convert_url("index.php?r=" . $lang['general']['idurl_forum'] . "&v1=form_forum&v2=" . $ligne['forum_id']); } if ($right_user['delete_forum']) { $page['forum'][$i]['link_delete'] = convert_url("index.php?r=" . $lang['general']['idurl_forum'] . "&v1=forum_list&v2=delete&v3=" . $ligne['forum_id']); } $i++; } } sql_free_result($res_forum); sql_close($sgbd); if ($right_user['add_forum']) { $page['link_add'] = convert_url("index.php?r=" . $lang['general']['idurl_forum'] . "&v1=form_forum"); } else { $page['link_add'] = ""; } $_SESSION['menu_forum'] = $page['forum']; $page['L_add'] = $lang['forum']['add_forum']; $page['L_forum_list'] = $lang['forum']['forum_list']; # meta $page['meta_title'] = $lang['forum']['forum_list']; if (isset($page['forum'][0]['description'])) { $page['meta_description'] = html2txt($page['forum'][0]['description']); $page['meta_keyword'] = html2txt($page['forum'][0]['name'] . " " . $page['forum'][0]['description']); } $page['meta_date'] = ""; $page['template'] = $tpl['forum']['forum_list'];
$thisline = mb_ereg_replace('{terrain}', $terrain, $thisline); $thisline = mb_ereg_replace('{owner}', $r['username'], $thisline); // logs ermitteln $logentries = ''; $rsLogs = sql_slave("SELECT `cache_logs`.`id`, `cache_logs`.`text_html`, `log_types`.`de` `type`, `cache_logs`.`date`, `cache_logs`.`text`, `user`.`username` FROM `cache_logs`, `user`, `log_types` WHERE `cache_logs`.`user_id`=`user`.`user_id` AND `cache_logs`.`type`=`log_types`.`id` AND `cache_logs`.`cache_id`=&1 ORDER BY `cache_logs`.`date` DESC LIMIT 20", $r['cacheid']); while ($rLog = sql_fetch_array($rsLogs)) { $thislog = $txtLogs; $thislog = mb_ereg_replace('{id}', $rLog['id'], $thislog); $thislog = mb_ereg_replace('{date}', date('d.m.Y', strtotime($rLog['date'])), $thislog); $thislog = mb_ereg_replace('{username}', $rLog['username'], $thislog); $logtype = $rLog['type']; $thislog = mb_ereg_replace('{type}', $logtype, $thislog); if ($rLog['text_html'] == 0) { $thislog = mb_ereg_replace('{text}', $rLog['text'], $thislog); } else { $thislog = mb_ereg_replace('{text}', html2txt($rLog['text']), $thislog); } $logentries .= $thislog . "\n"; } $thisline = mb_ereg_replace('{logs}', $logentries, $thisline); $thisline = lf2crlf($thisline); if ($rCount['count'] == 1 && $bUseZip == false) { echo $thisline; } else { $phpzip->add_data($r['waypoint'] . '.txt', $thisline); } } mysql_free_result($rs); if ($sqldebug == true) { sqldbg_end(); }
$thisline = str_replace('{mod_suffix}', '', $thisline); } $thisline = str_replace('{cachename}', filterevilchars($r['name']), $thisline); $thisline = str_replace('{country}', tr($r['country']), $thisline); if ($r['hint'] == '') { $thisline = str_replace('{hints}', '', $thisline); } else { $thisline = str_replace('{hints}', filterevilchars(strip_tags($r['hint'])), $thisline); } $thisline = str_replace('{shortdesc}', filterevilchars($r['short_desc']), $thisline); if ($r['html'] == 0) { $thisline = str_replace('{htmlwarn}', '', $thisline); $thisline = str_replace('{desc}', filterevilchars(strip_tags($r['desc'])), $thisline); } else { $thisline = str_replace('{htmlwarn}', ' (Text p�eveden z HTML)', $thisline); $thisline = str_replace('{desc}', html2txt(filterevilchars($r['desc'])), $thisline); } $thisline = str_replace('{type}', $r['type'], $thisline); $thisline = str_replace('{container}', $r['size'], $thisline); $thisline = str_replace('{status}', $r['status'], $thisline); $difficulty = sprintf('%01.1f', $r['difficulty'] / 2); $thisline = str_replace('{difficulty}', $difficulty, $thisline); $terrain = sprintf('%01.1f', $r['terrain'] / 2); $thisline = str_replace('{terrain}', $terrain, $thisline); $thisline = str_replace('{owner}', filterevilchars($r['username']), $thisline); $thisline = str_replace('{distance}', htmlspecialchars(sprintf("%01.1f", $r['distance'])), $thisline); // logs ermitteln $logentries = ''; $thisline = lf2crlf($thisline); echo $thisline; }
function cupid_email($profile) { global $ret; global $data; global $site; $profile = (int) $profile; $match_min = (int) getParam("match_percent"); $prof_arr = getProfileInfo($profile, true); if ((int) $prof_arr['ID'] <= 0) { return false; } $add = ''; if ('all' != $prof_arr['LookingFor']) { $add = "AND `Sex` = '{$prof_arr['LookingFor']}' "; } $add .= "AND ( `LookingFor` = '{$prof_arr['Sex']}' OR `LookingFor` = 'all' )"; $memb_res = db_res("SELECT ID, NickName, Email, EmailFlag\n\t\t\t\tFROM Profiles\n\t\t\t\tWHERE EmailNotify = 'NotifyMe' AND Status = 'Active' AND ID <> {$profile} {$add}"); if (mysql_num_rows($memb_res) < 1) { return false; } while ($memb_arr = mysql_fetch_array($memb_res)) { $match = match_profiles($memb_arr['ID'], $profile); if ($match < $match_min) { // If the profile matches less then predefined // percent then go to next iteration (i.e. next profile) continue; } $message = getParam("t_CupidMail"); $subject = getParam('t_CupidMail_subject'); $subject = addslashes($subject); $recipient = $memb_arr['Email']; $headers = "From: {$site['title']} <{$site['email_notify']}>"; $headers2 = "-f{$site['email_notify']}"; $message = str_replace("<SiteName>", $site['title'], $message); $message = str_replace("<Domain>", $site['url'], $message); $message = str_replace("<RealName>", $memb_arr['NickName'], $message); $message = str_replace("<StrID>", $memb_arr['ID'], $message); $message = str_replace("<MatchProfileLink>", getProfileLink($prof_arr['ID']), $message); $message = addslashes($message); if ('Text' == $memb_arr['EmailFlag']) { $message = html2txt($message); } if ('HTML' == $memb_arr['EmailFlag']) { $headers = "MIME-Version: 1.0\r\n" . "Content-type: text/html; charset=UTF-8\r\n" . $headers; } $sql = "INSERT INTO `NotifyQueue` SET `Email` = {$memb_arr['ID']}, Msg = 0, `From` = 'ProfilesMsgText', Creation = NOW(), MsgText = '{$message}', MsgSubj = '{$subject}'"; $res = db_res($sql); } return true; }
function UpdateMessage() { $query = "UPDATE `NotifyMsgs` SET `Subj` = '" . process_db_input($_POST['subj']) . "', `Text` = '" . process_db_input(html2txt($_POST['body_html'])) . "', `HTML` = '" . process_db_input($_POST['body_html']) . "' WHERE ID = '" . (int) $_POST['msgs_id'] . "'"; $res = db_res($query); return $res; }
function send_cupid_email($aAnyProf, $iSelCupID) { global $site; $message = getParam("t_CupidMail"); $subject = getParam('t_CupidMail_subject'); $subject = addslashes($subject); $recipient = $aAnyProf['Email']; $headers = "From: {$site['title']} <{$site['email_notify']}>"; $headers2 = "-f{$site['email_notify']}"; $message = str_replace("<SiteName>", $site['title'], $message); $message = str_replace("<Domain>", $site['url'], $message); $message = str_replace("<RealName>", $aAnyProf['NickName'], $message); $message = str_replace("<StrID>", $aAnyProf['ID'], $message); $message = str_replace("<MatchProfileLink>", getProfileLink($iSelCupID), $message); $message = addslashes($message); if ('Text' == $aAnyProf['EmailFlag']) { $message = html2txt($message); } if ('HTML' == $aAnyProf['EmailFlag']) { $headers = "MIME-Version: 1.0\r\n" . "Content-type: text/html; charset=UTF-8\r\n" . $headers; } $sql = "INSERT INTO `NotifyQueue` SET `Email` = {$aAnyProf['ID']}, Msg = 0, `From` = 'ProfilesMsgText', Creation = NOW(), MsgText = '{$message}', MsgSubj = '{$subject}'"; $res = db_res($sql); return true; }
function do_json($tema_id) { global $CFG; $datosTermino = ARRAYverDatosTermino($tema_id); if (!is_numeric($datosTermino["tema_id"])) { return null; } $ARRAYterm["tema_id"] = $datosTermino["tema_id"]; $ARRAYterm["string"] = $datosTermino["titTema"]; $ARRAYterm["created"] = $datosTermino["cuando"]; $ARRAYterm["code"] = $datosTermino["code"]; if ($datosTermino["cuando_final"]) { $ARRAYterm["modified"] = $datosTermino["cuando_final"]; } for ($iNota = 0; $iNota < count($datosTermino["notas"]); ++$iNota) { //there are note and is not private note if ($datosTermino["notas"][$iNota]["id"] && $datosTermino["notas"][$iNota]["tipoNota"] !== 'NP') { $tipoNota = in_array($datosTermino["notas"][$iNota]["tipoNota_id"], array(8, 9, 10, 11, 15)) ? arrayReplace(array(8, 9, 10, 11, 15), array(LABEL_NA, LABEL_NH, LABEL_NB, LABEL_NP, LABEL_NC), $datosTermino["notas"][$iNota]["tipoNota_id"]) : $datosTermino["notas"][$iNota]["tipoNotaLabel"]; $ARRAYterm["notes"][] = array("@type" => $tipoNota, "@lang" => $datosTermino[notas][$iNota][lang_nota], "@value" => html2txt($datosTermino["notas"][$iNota]["nota"])); } } return json_encode($ARRAYterm); }
function search_output() { global $opt, $translate, $txt_record; global $converted_from_html; global $phpzip, $bUseZip; $txtLine = $txt_record; $txtLogs = "<===================>\n{username} / {date} / {type}\n\n{text}\n"; $rs = sql_slave("SELECT SQL_BUFFER_RESULT\n &searchtmp.`cache_id` `cacheid`,\n &searchtmp.`longitude` `longitude`,\n &searchtmp.`latitude` `latitude`,\n `caches`.`wp_oc` `waypoint`,\n `caches`.`date_hidden` `date_hidden`,\n `caches`.`name` `name`,\n `caches`.`terrain` `terrain`,\n `caches`.`difficulty` `difficulty`,\n `caches`.`desc_languages` `desc_languages`,\n `caches`.`needs_maintenance`,\n `caches`.`listing_outdated`,\n IFNULL(`stt_country`.`text`,`countries`.`en`) AS `country`,\n IFNULL(`stt_size`.`text`,`cache_size`.`name`) `size`,\n IFNULL(`stt_type`.`text`,`cache_type`.`en`) `type`,\n IFNULL(`stt_status`.`text`,`cache_status`.`name`) `status`,\n `user`.`username` `username`,\n `cache_desc`.`desc` `desc`,\n `cache_desc`.`short_desc` `short_desc`,\n `cache_desc`.`language` `desc_language`,\n `cache_desc`.`hint` `hint`,\n `cache_desc`.`desc_html` `html`,\n `user`.`user_id`,\n `user`.`username`,\n `user`.`data_license`\n FROM\n &searchtmp\n INNER JOIN `caches` ON &searchtmp.`cache_id`=`caches`.`cache_id`\n INNER JOIN `cache_desc`\n ON `cache_desc`.`cache_id`=`caches`.`cache_id`\n AND `caches`.`default_desclang`=`cache_desc`.`language`\n INNER JOIN `cache_type` ON `cache_type`.`id`=`caches`.`type`\n INNER JOIN `cache_size` ON `cache_size`.`id`=`caches`.`size`\n INNER JOIN `cache_status` ON `cache_status`.`id`=`caches`.`status`\n INNER JOIN `user` ON `user`.`user_id`=`caches`.`user_id`\n LEFT JOIN `countries` ON `countries`.`short`=`caches`.`country`\n LEFT JOIN `sys_trans_text` `stt_type` ON `stt_type`.`trans_id`=`cache_type`.`trans_id` AND `stt_type`.`lang`='&1'\n LEFT JOIN `sys_trans_text` `stt_size` ON `stt_size`.`trans_id`=`cache_size`.`trans_id` AND `stt_size`.`lang`='&1'\n LEFT JOIN `sys_trans_text` `stt_status` ON `stt_status`.`trans_id`=`cache_status`.`trans_id` AND `stt_status`.`lang`='&1'\n LEFT JOIN `sys_trans_text` `stt_country` ON `stt_country`.`trans_id`=`countries`.`trans_id` AND `stt_country`.`lang`='&1'", $opt['template']['locale']); while ($r = sql_fetch_array($rs)) { if (strlen($r['desc_languages']) > 2) { $r = get_locale_desc($r); } $thisline = $txtLine; $lat = sprintf('%01.5f', $r['latitude']); $thisline = mb_ereg_replace('{lat}', help_latToDegreeStr($lat), $thisline); $lon = sprintf('%01.5f', $r['longitude']); $thisline = mb_ereg_replace('{lon}', help_lonToDegreeStr($lon), $thisline); $time = date('d.m.Y', strtotime($r['date_hidden'])); $thisline = mb_ereg_replace('{time}', $time, $thisline); $thisline = mb_ereg_replace('{waypoint}', $r['waypoint'], $thisline); $thisline = mb_ereg_replace('{cacheid}', $r['cacheid'], $thisline); $thisline = mb_ereg_replace('{cachename}', $r['name'], $thisline); $thisline = mb_ereg_replace('{country}', $r['country'], $thisline); if ($r['hint'] == '') { $thisline = mb_ereg_replace('{hints}', '', $thisline); } else { $thisline = mb_ereg_replace('{hints}', str_rot13_gc(decodeEntities(strip_tags($r['hint']))), $thisline); } $thisline = mb_ereg_replace('{shortdesc}', $r['short_desc'], $thisline); $license = getLicenseDisclaimer($r['user_id'], $r['username'], $r['data_license'], $r['cacheid'], $opt['template']['locale'], true, false, true); if ($license != "") { $license = "\r\n\r\n{$license}"; } if ($r['html'] == 0) { $thisline = mb_ereg_replace('{htmlwarn}', '', $thisline); $thisline = mb_ereg_replace('{desc}', decodeEntities(strip_tags($r['desc'])) . $license, $thisline); } else { $thisline = mb_ereg_replace('{htmlwarn}', " ({$converted_from_html})", $thisline); $thisline = mb_ereg_replace('{desc}', html2txt($r['desc']) . $license, $thisline); } $thisline = mb_ereg_replace('{type}', $r['type'], $thisline); $thisline = mb_ereg_replace('{container}', $r['size'], $thisline); $thisline = mb_ereg_replace('{status}', $r['status'], $thisline); $difficulty = sprintf('%01.1f', $r['difficulty'] / 2); $thisline = mb_ereg_replace('{difficulty}', $difficulty, $thisline); $terrain = sprintf('%01.1f', $r['terrain'] / 2); $thisline = mb_ereg_replace('{terrain}', $terrain, $thisline); $thisline = mb_ereg_replace('{siteurl}', $opt['page']['default_absolute_url'], $thisline); $thisline = mb_ereg_replace('{owner}', $r['username'], $thisline); $flags = array(); if ($r['needs_maintenance'] > 0 || $r['listing_outdated']) { if ($r['needs_maintenance'] > 0) { $flags[] = 'geocache needs maintenance'; } if ($r['listing_outdated'] > 0) { $flags[] = 'description is outdated'; } } else { $flags[] = 'ok'; } foreach ($flags as &$flag) { $flag = $translate->t($flag, '', basename(__FILE__), __LINE__); } $thisline = mb_ereg_replace('{condition}', implode(', ', $flags), $thisline); // logs ermitteln $logentries = ''; $rsLogs = sql_slave("SELECT\n `cache_logs`.`id`,\n `cache_logs`.`text_html`,\n IFNULL(`stt`.`text`, `log_types`.`en`) `type`,\n `cache_logs`.`date`,\n `cache_logs`.`text`,\n `user`.`username`\n FROM `cache_logs`\n JOIN `user` ON `cache_logs`.`user_id`=`user`.`user_id`\n JOIN `log_types` ON `cache_logs`.`type`=`log_types`.`id`\n LEFT JOIN `sys_trans_text` `stt` ON `stt`.`trans_id`=`log_types`.`trans_id` AND `stt`.`lang`='&2'\n WHERE `cache_logs`.`cache_id`=&1\n ORDER BY\n `cache_logs`.`order_date` DESC,\n `cache_logs`.`date_created` DESC,\n `cache_logs`.`id` DESC\n LIMIT 20", $r['cacheid'], $opt['template']['locale']); while ($rLog = sql_fetch_array($rsLogs)) { $thislog = $txtLogs; $thislog = mb_ereg_replace('{id}', $rLog['id'], $thislog); $dateformat = "d.m.Y H:i"; if (substr($rLog['date'], 11) == "00:00:00") { $dateformat = "d.m.Y"; } $thislog = mb_ereg_replace('{date}', date($dateformat, strtotime($rLog['date'])), $thislog); $thislog = mb_ereg_replace('{username}', $rLog['username'], $thislog); $logtype = $rLog['type']; $thislog = mb_ereg_replace('{type}', $logtype, $thislog); if ($rLog['text_html'] == 0) { $thislog = mb_ereg_replace('{text}', decodeEntities(strip_tags($rLog['text'])), $thislog); } else { $thislog = mb_ereg_replace('{text}', html2txt($rLog['text']), $thislog); } $logentries .= $thislog . "\n"; } $thisline = mb_ereg_replace('{logs}', $logentries, $thisline); $thisline = lf2crlf($thisline); if (!$bUseZip) { echo $thisline; } else { $phpzip->add_data($r['waypoint'] . '.txt', $thisline); } } mysql_free_result($rs); }
function PageCorespondence($memberID, $senderID) { global $site; global $date_format; $preview_leight = 25; $sender_nickname = getProfileInfo($senderID); //db_arr("SELECT `NickName` FROM `Profiles` WHERE `ID` = '$senderID'"); $member_to_sender_query = "SELECT `Profiles`.`ID` AS pID, `Profiles`.`NickName`, `Profiles`.`Status`, `Messages`.`ID` AS mID, `New`, DATE_FORMAT( `Date`, '{$date_format}') as 'Date', `Subject`, LEFT( `Text`, {$preview_leight} ) AS Preview FROM `Messages` LEFT JOIN `Profiles` ON `Messages`.`Recipient` = `Profiles`.`ID` WHERE `Sender` = '" . (int) $memberID . "' AND `Recipient` = '" . (int) $senderID . "' ORDER BY `Date` DESC"; $member_to_sender_res = db_res($member_to_sender_query); $member_to_sender_num = mysql_num_rows($member_to_sender_res); $sender_to_member_query = "SELECT `Messages`.`ID` AS mID, `New`, DATE_FORMAT( `Date`, '{$date_format}') as 'Date', `Subject`, LEFT( `Text`, {$preview_leight} ) AS Preview FROM `Messages` LEFT JOIN `Profiles` ON Messages.Sender = Profiles.ID WHERE `Sender` = '" . (int) $senderID . "' AND `Recipient` = '" . (int) $memberID . "' ORDER BY `Date` DESC"; $sender_to_member_res = db_res($sender_to_member_query); $sender_to_member_num = mysql_num_rows($sender_to_member_res); $ret = ''; $ret .= '<div class="member_to_sender">'; if ($member_to_sender_num > 0) { $ret .= '<table cellpadding="0" cellspacing="0" border="0" width="100%">'; $ret .= '<tr>'; $ret .= '<td colspan="3" class="cor_title">'; $ret .= _t('_messages_to', $sender_nickname['NickName']); $ret .= '</td>'; $ret .= '</tr>'; $ret .= '<tr>'; $ret .= '<td width="17">'; $ret .= '<img src="' . getTemplateIcon('convert.gif') . '" alt="" />'; $ret .= '</td>'; $ret .= '<td width="70">'; $ret .= _t('_Date'); $ret .= '</td>'; $ret .= '<td>'; $ret .= _t('_Subject'); $ret .= '</td>'; $ret .= '</tr>'; $j_out = '0'; while ($member_to_sender_arr = mysql_fetch_assoc($member_to_sender_res)) { if (strlen($member_to_sender_arr['Subject']) == 0) { $cor_subject_out = $member_to_sender_arr['Preview']; if (strlen($member_to_sender_arr['Preview']) >= $preview_length) { $cor_subject_out .= "..."; } } else { $cor_subject_out = $member_to_sender_arr['Subject']; if (strlen($member_to_sender_arr['Subject']) >= $preview_length) { $cor_subject_out .= "..."; } } if ('1' == $member_to_sender_arr['New']) { $new_out = 'not_readed.gif'; $style_add = 'style="font-weight:bold;"'; } else { $new_out = 'readed.gif'; $style_add = ''; } if ($j_out % 2 != '0') { $bgcolor = '#FFFFFF'; } else { $bgcolor = '#EAF6C6'; } $ret .= '<tr class="tr_hover" bgcolor="' . $bgcolor . '">'; $ret .= '<td height="20">'; $ret .= '<img src="' . getTemplateIcon($new_out) . '" alt="" />'; $ret .= '</td>'; $ret .= '<td ' . $style_add . '>'; $ret .= $member_to_sender_arr['Date']; $ret .= '</td>'; $ret .= '<td ' . $style_add . ' align="left">'; $ret .= '<a href="' . $site['url'] . 'messages_outbox.php?message=' . $member_to_sender_arr['mID'] . '">'; $ret .= process_line_output(html2txt($cor_subject_out)); $ret .= '</a>'; $ret .= '</td>'; $ret .= '</tr>'; $j_out++; } $ret .= '</table>'; } else { $ret .= '<div class="no_result"><div>'; $ret .= _t('_no_messages_to', $sender_nickname['NickName']); $ret .= '</div></div>'; } $ret .= '</div>'; //################################################################################# $ret .= '<div class="sender_to_member">'; if ($sender_to_member_num) { $ret .= '<table cellpadding="0" cellspacing="0" border="0" width="100%">'; $ret .= '<tr>'; $ret .= '<td colspan="3" class="cor_title">'; $ret .= _t('_messages_from', $sender_nickname['NickName']); $ret .= '</td>'; $ret .= '</tr>'; $ret .= '<tr>'; $ret .= '<td width="17">'; $ret .= '<img src="' . getTemplateIcon('convert.gif') . '" alt="" />'; $ret .= '</td>'; $ret .= '<td width="70">'; $ret .= _t('_Date'); $ret .= '</td>'; $ret .= '<td>'; $ret .= _t('_Subject'); $ret .= '</td>'; $ret .= '</tr>'; $j_in = '0'; while ($sender_to_member_arr = mysql_fetch_assoc($sender_to_member_res)) { if (strlen($sender_to_member_arr['Subject']) == 0) { $cor_subject_in = $sender_to_member_arr['Preview']; if (strlen($sender_to_member_arr['Preview']) >= $preview_length) { $cor_subject_in .= "..."; } } else { $cor_subject_in = $sender_to_member_arr['Subject']; if (strlen($sender_to_member_arr['Subject']) >= $preview_length) { $cor_subject_in .= "..."; } } if ($_GET['message'] == $sender_to_member_arr['mID']) { $new_in = 'current_mes.png'; $style_add_in = ''; } else { if ('1' == $sender_to_member_arr['New']) { $new_in = 'not_readed.gif'; $style_add_in = 'style="font-weight:bold;"'; } else { $new_in = 'readed.gif'; $style_add_in = ''; } } if ($j_in % 2 != '0') { $bgcolor = '#FFFFFF'; } else { $bgcolor = '#EAF6C6'; } $ret .= '<tr class="tr_hover" bgcolor="' . $bgcolor . '">'; $ret .= '<td height="20">'; $ret .= '<img src="' . getTemplateIcon($new_in) . '" alt="" />'; $ret .= '</td>'; $ret .= '<td ' . $style_add_in . '>'; $ret .= $sender_to_member_arr['Date']; $ret .= '</td>'; $ret .= '<td ' . $style_add_in . ' align="left">'; $ret .= '<a href="' . $site['url'] . 'messages_inbox.php?message=' . $sender_to_member_arr['mID'] . '">'; $ret .= process_line_output(html2txt($cor_subject_in)); $ret .= '</a>'; $ret .= '</td>'; $j_in++; } $ret .= '</table>'; } else { $ret .= '<div class="no_result"></div>'; $ret .= _t('_no_messages_from', $sender_nickname['NickName']); $ret .= '</div></div>'; } $ret .= '</div>'; return $ret; }