/** * Log errors to a file * * @param string The error message to be placed within the log * @param string The type of error that occured. php, database, security, etc. * * @return boolean */ function log_vbulletin_error($errstring, $type = 'database') { global $vbulletin; $options = vB::getDatastore()->getValue('options'); // do different things depending on the error log type switch ($type) { // log PHP E_USER_ERROR, E_USER_WARNING, E_WARNING to file case 'php': if (!empty($options['errorlogphp'])) { $errfile = $options['errorlogphp']; $errstring .= "\r\nDate: " . date('l dS \\o\\f F Y h:i:s A') . "\r\n"; $errstring .= "Username: {$vbulletin->userinfo['username']}\r\n"; $errstring .= 'IP Address: ' . IPADDRESS . "\r\n"; } break; // log database error to file // log database error to file case 'database': if (!empty($options['errorlogdatabase'])) { $errstring = preg_replace("#(\r\n|\r|\n)#s", "\r\n", $errstring); $errfile = $options['errorlogdatabase']; } break; // log admin panel login failure to file // log admin panel login failure to file case 'security': if (!empty($options['errorlogsecurity'])) { $errfile = $options['errorlogsecurity']; $username = $errstring; $errstring = 'Failed admin logon in ' . $vbulletin->db->appname . ' ' . $vbulletin->options['templateversion'] . "\r\n\r\n"; $errstring .= 'Date: ' . date('l dS \\o\\f F Y h:i:s A') . "\r\n"; $errstring .= "Script: http://{$_SERVER['HTTP_HOST']}" . unhtmlspecialchars($vbulletin->scriptpath) . "\r\n"; $errstring .= 'Referer: ' . REFERRER . "\r\n"; $errstring .= "Username: {$username}\r\n"; $errstring .= 'IP Address: ' . IPADDRESS . "\r\n"; $errstring .= "Strikes: {$GLOBALS['strikes']}/5\r\n"; } break; } // if no filename is specified, exit this function if (!isset($errfile) or !($errfile = trim($errfile)) or defined('DEMO_MODE') and DEMO_MODE == true) { return false; } // rotate the log file if filesize is greater than $vbulletin->options[errorlogmaxsize] if ($vbulletin->options['errorlogmaxsize'] != 0 and $filesize = @filesize("{$errfile}.log") and $filesize >= $vbulletin->options['errorlogmaxsize']) { @copy("{$errfile}.log", $errfile . TIMENOW . '.log'); @unlink("{$errfile}.log"); } // write the log into the appropriate file if ($fp = @fopen("{$errfile}.log", 'a+')) { @fwrite($fp, "{$errstring}\r\n=====================================================\r\n\r\n"); @fclose($fp); return true; } else { return false; } }
function api_result_prewhitelist_1(&$value) { if ($value['response']) { $value['response']['layout']['content']['contents'] = $value['response']['layout']['content']['content_rendered']['contents']; foreach ($value['response']['layout']['content']['contents'] as $k => &$v) { $v['title'] = unhtmlspecialchars($v['title']); } } }
function api_result_prewhitelist(&$value) { if (is_array($value['response']['activitybits']['activitybits'])) { $value['response']['activitybits'] = $value['response']['activitybits']['activitybits']; } foreach ($value['response']['activitybits'] as $k => &$v) { if (isset($v['threadinfo'])) { $v['threadinfo']['title'] = unhtmlspecialchars($v['threadinfo']['title']); $v['threadinfo']['preview'] = unhtmlspecialchars($v['threadinfo']['preview']); } if (isset($v['albuminfo'])) { $v['albuminfo']['title'] = unhtmlspecialchars($v['albuminfo']['title']); } if (isset($v['articleinfo'])) { $v['articleinfo']['preview'] = unhtmlspecialchars($v['articleinfo']['preview']); } if (isset($v['bloginfo'])) { $v['bloginfo']['title'] = unhtmlspecialchars($v['bloginfo']['title']); $v['bloginfo']['blog_title'] = unhtmlspecialchars($v['bloginfo']['blog_title']); $v['bloginfo']['preview'] = unhtmlspecialchars($v['bloginfo']['preview']); } if (isset($v['blogtextinfo'])) { $v['blogtextinfo']['preview'] = unhtmlspecialchars($v['blogtextinfo']['preview']); } if (isset($v['calendarinfo'])) { $v['calendarinfo']['preview'] = unhtmlspecialchars($v['calendarinfo']['preview']); } if (isset($v['commentinfo'])) { $v['commentinfo']['preview'] = unhtmlspecialchars($v['commentinfo']['preview']); } if (isset($v['discussioninfo'])) { $v['discussioninfo']['title'] = unhtmlspecialchars($v['discussioninfo']['title']); $v['discussioninfo']['preview'] = unhtmlspecialchars($v['discussioninfo']['preview']); } if (isset($v['eventinfo'])) { $v['eventinfo']['title'] = unhtmlspecialchars($v['eventinfo']['title']); $v['eventinfo']['preview'] = unhtmlspecialchars($v['eventinfo']['preview']); } if (isset($v['foruminfo'])) { $v['foruminfo']['title'] = unhtmlspecialchars($v['foruminfo']['title']); } if (isset($v['groupinfo'])) { $v['groupinfo']['name'] = unhtmlspecialchars($v['groupinfo']['name']); } if (isset($v['messageinfo'])) { $v['messageinfo']['preview'] = unhtmlspecialchars($v['messageinfo']['preview']); } if (isset($v['nodeinfo'])) { $v['nodeinfo']['title'] = unhtmlspecialchars($v['nodeinfo']['title']); $v['nodeinfo']['parenttitle'] = unhtmlspecialchars($v['nodeinfo']['parenttitle']); } if (isset($v['postinfo'])) { $v['postinfo']['preview'] = unhtmlspecialchars($v['postinfo']['preview']); } } }
/** * This function is used for drawing the html-code out to the templates. * It just returns the code * @param string Optional parameters for the draw-function. There are none supported. * @return string HTML-CODE to be written into the template. */ function draw($param = "") { global $cds, $c; if ($cds->is_development) { $content = '<div style="border:1px solid black; background-color:#e0e0e0;align:center;vertical-align:middle;padding:10px;">Adsene Placeholder. <br>Avoids influences to your adsense statistics.</div>'; } else { $content = unhtmlspecialchars(getDBCell("pgn_adsense", "ADTEXT", "FKID = $this->fkid")); $content.= '<script type="text/javascript">bug = new Image(); bug.src=\''.$c["livedocroot"]."sys/hit.php?id=".$this->fkid.'&scope=adsense\';</script>'; } return $content; }
function parse_wysiwyg_html($html, $ishtml = 0, $forumid = 0, $allowsmilie = 1) { global $vbulletin; if ($ishtml) { // parse HTML into vbcode // I DON'T THINK THIS IS EVER USED NOW - KIER $html = convert_wysiwyg_html_to_bbcode($html); } else { $html = unhtmlspecialchars($html, 0); } // parse the message back into WYSIWYG-friendly HTML require_once DIR . '/includes/class_bbcode_alt.php'; $wysiwyg_parser =& new vB_BbCodeParser_Wysiwyg($vbulletin, fetch_tag_list()); $wysiwyg_parser->set_parse_userinfo($vbulletin->userinfo); return $wysiwyg_parser->parse($html, $forumid, $allowsmilie); }
function api_result_prerender($t, &$r) { switch ($t) { case 'threadbit_announcement': $r['announcement']['postdate'] = $r['announcement']['startdate']; break; case 'FORUMDISPLAY': if ($r['threadbits'][0]) { foreach ($r['threadbits'] as $k => &$v) { $v['thread']['threadtitle'] = unhtmlspecialchars($v['thread']['threadtitle']); } } else { $r['threadbits']['thread']['threadtitle'] = unhtmlspecialchars($r['threadbits']['thread']['threadtitle']); } break; } }
function api_result_prerender($t, &$r) { switch ($t) { case 'showthread_similarthreadbit': $r['simthread']['lastreplytime'] = $r['simthread']['lastpost']; break; case 'SHOWTHREAD': $r['thread']['title'] = unhtmlspecialchars($r['thread']['title']); if ($r['postbits'][0]) { foreach ($r['postbits'] as $k => &$v) { $v['post']['title'] = unhtmlspecialchars($v['post']['title']); } } else { $r['postbits']['post']['title'] = unhtmlspecialchars($r['postbits']['post']['title']); } break; } }
function admin_login_error($error, array $args = array()) { global $vbulletin; if ($vbulletin->GPC['logintype'] === 'cplogin' or $vbulletin->GPC['logintype'] === 'modcplogin') { require_once DIR . '/includes/adminfunctions.php'; $url = unhtmlspecialchars($vbulletin->url); $urlarr = vB_String::parseUrl($url); $urlquery = $urlarr['query']; $oldargs = array(); if ($urlquery) { parse_str($urlquery, $oldargs); } $args = array_merge($oldargs, $args); unset($args['loginerror']); $argstr = http_build_query($args); $url = "/{$urlarr['path']}?loginerror=" . $error; if ($argstr) { $url .= '&' . $argstr; } print_cp_redirect($url); } }
protected function processregistered(&$value, $charset) { global $VB_API_REQUESTS; if (is_array($value)) { foreach ($value as &$el) { $this->processregistered($el, $charset); } } if (is_string($value)) { $value = to_utf8($value, $charset, true); if ($VB_API_REQUESTS['api_version'] < 4) { $value = unhtmlspecialchars($value, true); } } if ($VB_API_REQUESTS['api_version'] > 1 and is_bool($value)) { if ($value) { $value = 1; } else { $value = 0; } } }
function smileys($text, $specialchars = 0, $calledfrom = 'root') { if ($specialchars) { $text = unhtmlspecialchars($text); } $splits = preg_split("/(\\[[\\/]{0,1}code\\])/si", $text, -1, PREG_SPLIT_DELIM_CAPTURE); $anz = count($splits); for ($i = 0; $i < $anz; $i++) { $opentags = 0; $closetags = 0; $match = false; if (strtolower($splits[$i]) == "[code]") { $opentags++; for ($z = $i + 1; $z < $anz; $z++) { if (strtolower($splits[$z]) == "[code]") { $opentags++; } if (strtolower($splits[$z]) == "[/code]") { $closetags++; } if ($closetags == $opentags) { $match = true; break; } } } if ($match == false) { $splits[$i] = replace_smileys($splits[$i], $calledfrom); } else { $i = $z; } } $text = implode("", $splits); if ($specialchars) { $text = htmlspecialchars($text); } return $text; }
/** * Fetches the tagbits for display in an entry * * @param array Blog info * * @return string Tag bits */ function fetch_entry_tagbits($bloginfo, &$userinfo) { global $vbulletin, $vbphrase, $show, $template_hook; if ($bloginfo['taglist']) { $tag_array = explode(',', $bloginfo['taglist']); $tag_list = array(); foreach ($tag_array AS $tag) { $tag = trim($tag); if ($tag === '') { continue; } $tag_url = urlencode(unhtmlspecialchars($tag)); $tag = fetch_word_wrapped_string($tag); ($hook = vBulletinHook::fetch_hook('blog_tag_fetchbit')) ? eval($hook) : false; $templater = vB_Template::create('blog_tagbit'); $templater->register('tag', $tag); $templater->register('tag_url', $tag_url); $templater->register('userinfo', $userinfo); $templater->register('pageinfo', array('tag' => $tag_url)); $tag_list[] = trim($templater->render()); } } else { $tag_list = array(); } ($hook = vBulletinHook::fetch_hook('blog_tag_fetchbit_complete')) ? eval($hook) : false; return implode(", ", $tag_list); }
/** * Delivers the HTML for a given media tag. * This is the BBCode callback function (wrapped in a public callback, rather). * * @param string URL to deliver * @param string Options to customize delivery * * @return string HTML output */ public function deliver($url, $options) { global $vbphrase, $stylevar; $url = unhtmlspecialchars($url); if (!($info = $this->media[$url])) { if ($this->debug) { goldbrick_debug('Media Cache', $this->media); goldbrick_debug('Requested URL', $url); trigger_error('URL not pre-cached!', E_USER_WARNING); } $url = htmlspecialchars_uni($url); return "<a href=\"{$url}\" target=\"_blank\">{$url}</a>"; } $info['unique'] = substr($info['hash'], 0, 8); if ($info['site'] !== 0) { //$info['profile'] = $this->get_config_profile($info['site']); } else { $info['profile'] = $this->get_config_ext_profile($info['profile']); } if (is_integer($url)) { $info = array_merge($info, $this->parse_media_options($options)); } eval('$content = "' . fetch_template('gb_player') . '";'); if ($this->debug) { goldbrick_debug('Delivering Media', $url); echo $content . '<hr />'; } $cutoff = 1; #$this->registry->options['gb_expiration_period'] * 86400; // cleanup if ($info['dateline'] + $cutoff < TIMENOW) { if (empty($this->expired)) { goldbrick_inject_plugin('global_complete', "require_once(DIR . '/goldbrick/plugins/global_complete.php');"); } $this->expired[] = md5($url); } return $content; }
function page($p = '', $id = 0) { $whereSQL = empty($p) && $id ? "`id`='{$id}'" : "`dir`='{$p}'"; $cp = $this->db->getRow("SELECT * FROM `#iCMS@__catalog` WHERE {$whereSQL}"); if (empty($cp)) { $this->error('error:page'); } else { $_urlArray = array('link' => $cp->dir, 'url' => $cp->url); $this->jumptohtml($this->iurl('page', $_urlArray, '', iPATH)); $pd = $this->db->getRow("SELECT * FROM `#iCMS@__page` WHERE cid='{$cp->id}'", ARRAY_A); if ($pd) { $this->assign('page', $pd); $this->assign(array('title' => $pd['title'], 'keywords' => $pd['keyword'], 'description' => $pd['description'], 'body' => unhtmlspecialchars($pd['body']), 'creater' => $pd['creater'], 'updater' => $pd['updater'], 'createtime' => $pd['createtime'], 'updatetime' => $pd['updatetime'])); $this->get['title'] = $pd['title']; } if ($this->config['linkmode'] == 'id' || $id) { $this->iList($cp->id, false); } elseif ($this->config['linkmode'] == 'title') { $this->iList($cp->dir, false); } return $this->iPrint($cp->tpl_index, 'page'); } }
/** * Fetches and prepares posts for quoting. Returned text is BB code. * * @param array Array of post IDs to pull from * @param integer The ID of the thread that is being quoted into * @param integer Returns the number of posts that were unquoted because of the value of the next argument * @param array Returns the IDs of the posts that were actually quoted * @param string Controls what posts are successfully quoted: all, only (only the thread ID), other (only other thread IDs) * @param boolean Whether to undo the htmlspecialchars calls; useful when returning HTML to be entered via JS */ function fetch_quotable_posts($quote_postids, $threadid, &$unquoted_posts, &$quoted_post_ids, $limit_thread = 'only', $unhtmlspecialchars = false) { global $vbulletin; $unquoted_posts = 0; $quoted_post_ids = array(); $quote_postids = array_diff_assoc(array_unique(array_map('intval', $quote_postids)), array(0)); // limit to X number of posts if ($vbulletin->options['mqlimit'] > 0) { $quote_postids = array_slice($quote_postids, 0, $vbulletin->options['mqlimit']); } if (empty($quote_postids)) { // nothing to quote return ''; } $hook_query_fields = $hook_query_joins = ''; ($hook = vBulletinHook::fetch_hook('quotable_posts_query')) ? eval($hook) : false; $quote_post_data = $vbulletin->db->query_read_slave("\n\t\tSELECT post.postid, post.title, post.pagetext, post.dateline, post.userid, post.visible AS postvisible,\n\t\t\tIF(user.username <> '', user.username, post.username) AS username,\n\t\t\tthread.threadid, thread.title AS threadtitle, thread.postuserid, thread.visible AS threadvisible,\n\t\t\tforum.forumid, forum.password\n\t\t\t{$hook_query_fields}\n\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (post.userid = user.userid)\n\t\tINNER JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)\n\t\tINNER JOIN " . TABLE_PREFIX . "forum AS forum ON (thread.forumid = forum.forumid)\n\t\t{$hook_query_joins}\n\t\tWHERE post.postid IN (" . implode(',', $quote_postids) . ")\n\t"); $quote_posts = array(); while ($quote_post = $vbulletin->db->fetch_array($quote_post_data)) { if ((!$quote_post['postvisible'] or $quote_post['postvisible'] == 2) and !can_moderate($quote_post['forumid']) or (!$quote_post['threadvisible'] or $quote_post['threadvisible'] == 2) and !can_moderate($quote_post['forumid'])) { // no permission to view this post continue; } $forumperms = fetch_permissions($quote_post['forumid']); if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) and ($quote_post['postuserid'] != $vbulletin->userinfo['userid'] or $vbulletin->userinfo['userid'] == 0) or !verify_forum_password($quote_post['forumid'], $quote_post['password'], false) or in_coventry($quote_post['postuserid']) and !can_moderate($quote_post['forumid']) or in_coventry($quote_post['userid']) and !can_moderate($quote_post['forumid'])) { // no permission to view this post continue; } if ($limit_thread == 'only' and $quote_post['threadid'] != $threadid or $limit_thread == 'other' and $quote_post['threadid'] == $threadid or $limit_thread == 'all') { $unquoted_posts++; continue; } $skip_post = false; ($hook = vBulletinHook::fetch_hook('quotable_posts_logic')) ? eval($hook) : false; if ($skip_post) { continue; } $quote_posts["{$quote_post['postid']}"] = $quote_post; } $message = ''; foreach ($quote_postids as $quote_postid) { if (!isset($quote_posts["{$quote_postid}"])) { continue; } $quote_post =& $quote_posts["{$quote_postid}"]; $originalposter = fetch_quote_username($quote_post['username'] . ";{$quote_post['postid']}"); $postdate = vbdate($vbulletin->options['dateformat'], $quote_post['dateline']); $posttime = vbdate($vbulletin->options['timeformat'], $quote_post['dateline']); $pagetext = htmlspecialchars_uni($quote_post['pagetext']); $pagetext = trim(strip_quotes($pagetext)); ($hook = vBulletinHook::fetch_hook('newreply_quote')) ? eval($hook) : false; eval('$message .= "' . fetch_template('newpost_quote', 0, false) . '\\n";'); $quoted_post_ids[] = $quote_postid; } if ($unhtmlspecialchars) { $message = unhtmlspecialchars($message); } return $message; }
function combinar_csv($dependencia, $codusuario, $usua_doc, $usua_nomb, $depe_codi_territorial, $codiTRD, $TipoRad) { $odt = new OpenDocText(); $b = new CLASS_GEN(); //Var que contiene el arreglo de radicados genrados a partir de la masiva $arrRadicados = array(); //echo "<hr> TipoRas es $TipoRad <hr>"; //Instancia de la dependencia $objDependecia = new Dependencia($this->conexion); $objDependecia->Dependencia_codigo($dependencia); //Almacena la secuencia de radicacion para esta dependencia $secRadicacion = "secr_tp" . $TipoRad . "_" . $objDependecia->getSecRadicTipDepe($dependencia, $TipoRad); // $this->conexion->conn->debug = true; $archivo = $this->arcFinal; $archivo = trim(substr($archivo, strpos($archivo, $this->carpetaBodega) + strlen($this->carpetaBodega), strlen($archivo) - strpos($archivo, $this->carpetaBodega) + strlen($this->carpetaBodega))); // INICIALIZA EL PDF $this->pdf = new Cezpdf("LETTER", "landscape"); $objHist = new Historico($this->conexion); $year = date("Y"); $day = date("d"); $month = date("m"); // orientaci�n izquierda $orientCentro = array("left" => 0); // justificaci�n centrada $justCentro = array("justification" => "center"); $estilo1 = array("justification" => "left", "leading" => 8); $estilo2 = array("left" => 0, "leading" => 12); $estilo3 = array("left" => 0, "leading" => 15); $this->pdf->ezSetCmMargins(1, 1, 3, 2); //top,botton,left,right /* Se establece la fuente que se utilizara para el texto. */ $this->pdf->selectFont($this->ruta_raiz . "/include/pdf/fonts/Times-Roman.afm"); $this->pdf->ezText("LISTADO DE RADICACION MASIVA\n", 15, $justCentro); $this->pdf->ezText("Dependencia: {$dependencia} \n", 12, $estilo2); $this->pdf->ezText("Usuario Responsable: {$usua_nomb} \n", 12, $estilo2); $this->pdf->ezText("Fecha: {$day}-{$month}-{$day} \n", 12, $estilo2); $this->pdf->ezText($txtformat, 12, $estilo2); $data = array(); $columna = array(); $contador = 0; require_once $this->ruta_raiz . "/class_control/class_control.php"; $this->btt = new CONTROL_ORFEO($this->conexion); echo "<table border=0 width 80% cellpadding='0' cellspacing='5' class='borde_tab' >"; echo "<tr><td class='titulos4'>Registro</td><td class='titulos4'>Radicado</td><td class='titulos4' >Nombre</td><td class='titulos4'>Direccion</td><td class='titulos4'>Depto</td><td class='titulos4'>Municipio</td><td class='titulos4'>Expediente</td></tr>"; //Referencia el archivo a abrir $ruta = $this->ruta_raiz . "/" . $this->carpetaBodega . "/masiva/" . $this->archivo_insumo; clearstatcache(); unlink($ruta); $fp = fopen($ruta, 'wb'); if ($fp) { fputs($fp, "plantilla={$this->arcPlantilla}" . "\n"); fputs($fp, "csv={$this->arcCSV}" . "\n"); fputs($fp, "archFinal={$this->arcFinal}" . "\n"); fputs($fp, "archTmp={$this->arcTmp}" . "\n"); // Comentariada por HLP. Cambiar , por ; fputs($fp, implode(",", $this->encabezado[0]) . ",*RAD_S*,*F_RAD_S*,*F_HOY*" . "\n"); //fputs ($fp,implode( ";", $this->encabezado[0]).";*RAD_S*;*F_RAD_S*"."\n"); //Recorre el arrego de los datos for ($ii = 0; $ii < count($this->datos); $ii++) { $i = 0; $numeroExpediente = ""; // Aqui se accede a la clase class_control para actualizar expedientes. $ruta_raiz = $this->ruta_raiz; // Por cada etiqueta de los campos del encabezado del CSV efect�a un reemplazo foreach ($this->encabezado[0] as $campos_d) { if (strlen(trim($this->datos[$ii][$i])) < 1) { $this->datos[$ii][$i] = ""; } $dato_r = str_replace("'", "''", trim($this->datos[$ii][$i])); $texto_tmp = str_replace($campos_d, $dato_r, $texto_tmp); if ($campos_d == "*TIPO*") { $tip_doc = $dato_r; } if ($campos_d == "*NOMBRE*") { $nombre = $dato_r; } if ($campos_d == "*DOCUMENTO*") { $doc_us1 = $dato_r; } if ($campos_d == "*NOMBRE*") { $nombre_us1 = $dato_r; } if ($campos_d == "*PRIM_APEL*") { $prim_apell_us1 = $dato_r; } if ($campos_d == "*SEG_APEL*") { $seg_apell_us1 = $dato_r; } if ($campos_d == "*DIGNATARIO*") { $otro_us1 = $dato_r; } if ($campos_d == "*CARGO*") { $cargo_us1 = $dato_r; } if ($campos_d == "*DIR*") { $direccion_us1 = $dato_r; } if ($campos_d == "*TELEFONO*") { $telefono_us1 = $dato_r; } if ($campos_d == "*MUNI*") { $muni_codi = $dato_r; } if ($campos_d == "*DEPTO*") { $dpto_codi = $dato_r; } if ($campos_d == "*ASUNTO*") { $asu = $dato_r; } if ($campos_d == "*ID*") { $sgd_esp_codigo = $dato_r; } if ($campos_d == "*DESC_ANEXOS*") { $desc_anexos = $dato_r; } if ($campos_d == "*MUNI_NOMBRE*") { $muni_nombre = $dato_r; } if ($campos_d == "*DEPTO_NOMBRE*") { $dpto_nombre = $dato_r; } if ($campos_d == "*PAIS_NOMBRE*") { $pais = $dato_r; } if ($campos_d == "*TIPO_DOC*") { $tdoc = trim($dato_r); } if ($campos_d == "*NUM_EXPEDIENTE*") { $numeroExpediente = trim($dato_r); } if ($campos_d == "*ESP_CODIGO*") { $codigoESP = $dato_r; if ($codigoESP == "") { $codigoESP = null; } } if ($campos_d == "*RAD_ANEXO*") { $radicadopadre = $dato_r; $tipoanexo = 0; if ($radicadopadre == "") { $radicadopadre = ""; $tipoanexo = ""; } } else { $radicadopadre = ""; } $tipo_anexo = "0"; $cuentai = ""; $documento_us3 = ""; $med = ""; $fec = ""; $ane = ""; //$pais="COLOMBIA"; $carp_codi = "12"; $i++; } $tip_rem = "1"; // Si no se especifico el tipo de documento if (!$tdoc) { $tdoc = 0; } // $this->validarLugar(); $pais_codi = $this->arrCodPais[$pais . $dpto_nombre . $muni_nombre]; if ($pais_codi == '') { $pais_codi = '170'; } $dpto_codi = $pais_codi . "-" . $this->arrCodDepto[$dpto_nombre]; $muni_codi = $dpto_codi . "-" . $this->arrCodMuni[$dpto_nombre . $muni_nombre]; $tmp_objMuni = new Municipio($this->conexion); //Creamos esto para traer el codigo del continente y transmitirlo $tmp_objMuni->municipio_codigo($dpto_codi, $muni_codi); //por las diferentes tablas. $cont_codi = $tmp_objMuni->get_cont_codi(); $muni_codi = $cont_codi . "-" . $muni_codi; //Se agregan las dos variables siguientes, para corregir el error que se estaba presentando en la radicación masiva $codigo_depto = $this->arrCodDepto[$dpto_nombre]; $codigo_muni = $this->arrCodMuni[$dpto_nombre . $muni_nombre]; //Fin Variables agregadas $muni_us1 = $muni_codi; $codep_us1 = $dpto_codi; $nombre_us = "{$nombre_us1} {$prim_apell_us1} {$seg_apell_us1}"; unset($tmp_objMuni); $documento_us3 = $codigoESP; if (!$documento_us3) { $documento_us3 = null; } //Si se trata de una combinacion de correspondencia definitiva if ($this->definitivo == "si") { // Segun el tipo de remitente se graba en la tabla respectiva. // 0 - ESP 1 - OTRA EMPRESA 2 - PERSONA NATURAL $nurad = $this->btt->radicar_salida_masiva($tipoanexo, $cuentai, $documento_us3, $med, $fec, $radicadopadre, $codusuario, $tip_doc, $ane, $pais, $asu, $dependencia, $tip_rem, $usua_doc, $this->tipoDocto, $muni_codi, $archivo, $usua_doc, $depe_codi_territorial, $secRadicacion, $numeroExpediente, $TipoRad); //include_once("$this->ruta_raiz/include/tx/Expediente.php"); //$this->objExp = new Expediente($this->conexion); if (strlen($numeroExpediente) >= 10) { $this->objExp = new Expediente($this->conexion); $resultadoExp = $this->objExp->insertar_expediente($numeroExpediente, $nurad, $dependencia, $codusuario, $usua_doc); $observa = "Por Rad. Masiva."; if ($this->codProceso) { $radicados[] = $nurad; $tipoTx = 50; $objFlujo = new Flujo($this->conexion, $this->codProceso, $usua_doc); $expEstadoActual = $objFlujo->actualNodoExpediente($numeroExpediente); $objFlujo->cambioNodoExpediente($numeroExpediente, $nurad, $this->codFlujo, $this->codArista, 1, $observa, $this->codProceso); } } $nombre_us1 = trim($nombre_us1); $direccion_us1 = trim($direccion_us1); if ($tip_doc == 2) { $codigo_us = $this->btt->grabar_usuario($doc_us1, $nombre_us1, $direccion_us1, $prim_apell_us1, $seg_apell_us1, $telefono_us1, $mail_us1, $muni_us1); $tipo_emp_us1 = 0; $documento_us1 = $codigo_us; } if ($tip_doc == 1) { $codigo_oem = $this->btt->grabar_oem($doc_us1, $nombre_us1, $direccion_us1, $prim_apell_us1, $seg_apell_us1, $telefono_us1, $mail_us1, $muni_us1); $tipo_emp_us1 = 2; $documento_us1 = $codigo_oem; } if ($tip_doc == 0) { $sgd_esp_codigo = $this->arregloEsp[$nombre_us1]; $tipo_emp_us1 = 1; $documento_us1 = $sgd_esp_codigo; } $documento_us2 = ""; $documento_us3 = ""; $mail_us1; $cc_documento_us1 = "documento"; $grbNombresUs1 = trim($nombre_us1) . " " . trim($prim_apel_us1) . " " . trim($seg_apel_us1); $conexion =& $this->conexion; include "{$ruta_raiz}/radicacion/grb_direcciones.php"; // En esta parte registra el envio en la tabla SGD_RENV_REGENVIO if (!$this->codigo_envio) { $isql = "select max(SGD_RENV_CODIGO) as MAX FROM SGD_RENV_REGENVIO"; $rs = $this->conexion->query($isql); if (!$rs->EOF) { $nextval = $rs->fields['MAX']; } $nextval++; $this->codigo_envio = $nextval; $this->radi_nume_grupo = $nurad; $radi_nume_grupo = $this->radi_nume_grupo; } else { $nextval = $this->codigo_envio; } $dep_radicado = substr($verrad_sal, 4, 3); $carp_codi = substr($dep_radicado, 0, 2); $dir_tipo = 1; $nombre_us = substr(trim($nombre_us), 0, 49); $direccion_us1 = substr(trim($direccion_us1), 0, 29); if (!$muni_nomb) { $muni_nomb = $muni_tmp1; } if (!$valor_unit) { $valor_unit = 0; } // $isql = "INSERT INTO SGD_RENV_REGENVIO (USUA_DOC, SGD_RENV_CODIGO, SGD_FENV_CODIGO, SGD_RENV_FECH,\n\t\t\t\t\t\tRADI_NUME_SAL, SGD_RENV_DESTINO, SGD_RENV_TELEFONO, SGD_RENV_MAIL, SGD_RENV_PESO, SGD_RENV_VALOR,\n\t\t\t\t\t\tSGD_RENV_CERTIFICADO, SGD_RENV_ESTADO, SGD_RENV_NOMBRE, SGD_DIR_CODIGO, DEPE_CODI, SGD_DIR_TIPO,\n\t\t\t\t\t\tRADI_NUME_GRUPO, SGD_RENV_PLANILLA, SGD_RENV_DIR, SGD_RENV_PAIS, SGD_RENV_DEPTO, SGD_RENV_MPIO,\n\t\t\t\t\t\tSGD_RENV_TIPO, SGD_RENV_OBSERVA,SGD_DEPE_GENERA)\n\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t({$usua_doc}, {$nextval}, 101, " . $this->btt->sqlFechaHoy . ", {$nurad}, '{$muni_nomb}', '{$telefono_us1}', '{$mail}','',\n\t\t\t\t\t\t'{$valor_unit}', 0, 1, '{$nombre_us}', NULL, {$dependencia}, '{$dir_tipo}', " . $this->radi_nume_grupo . ", '00',\n\t\t\t\t\t\t'{$direccion_us1}', '{$pais}','{$dpto_nombre}', '{$muni_nombre}', 1, 'Masiva grupo " . $this->radi_nume_grupo . "',\n\t\t\t\t\t\t{$dependencia}) "; $rs = $this->conexion->conn->Execute($isql); if (!$rs) { $this->conexion->conn->RollbackTrans(); die("<span class='etextomenu'>No se ha podido insertar la información en SGD_RENV_REGENVIO."); } /* * Registro de la clasificacion TRD */ $isql = "INSERT INTO SGD_RDF_RETDOCF(USUA_DOC, SGD_MRD_CODIGO, SGD_RDF_FECH, RADI_NUME_RADI, DEPE_CODI, USUA_CODI)\n\t\t\t\t\t\tVALUES({$usua_doc}, {$codiTRD}," . $this->btt->sqlFechaHoy . ", {$nurad}, '{$dependencia}', {$codusuario} )"; $rs = $this->conexion->query($isql); if (!$rs) { $this->conexion->conn->RollbackTrans(); die("<span class='etextomenu'>No se ha podido insertar la informaci&ocute;n en SGD_RENV_REGENVIO"); } } else { $sec = $ii; $sec = str_pad($sec, 5, "X", STR_PAD_LEFT); $nurad = date("Y") . $dependencia . $sec . "1X"; } // Comentariada por HLP. Cambiar , por ; fputs($fp, implode(",", $this->datos[$ii]) . ",{$nurad}," . date("d/m/Y") . "," . str_ireplace(",", " ", $b->traducefecha(date("m/d/Y"))) . " \n"); //fputs ($fp,implode( ";", $this->datos[$ii]).";$nurad;".date("d/m/Y")."\n"); $contador = $ii + 1; echo "<tr><td class='listado2'>{$contador}</td><td class='listado2' >{$nurad}</td>\n\t\t \t <td class='listado2'>" . unhtmlspecialchars($nombre_us) . "</td><td class='listado2'>" . unhtmlspecialchars($direccion_us1) . "</td>\n\t\t \t<td class='listado2' >{$dpto_nombre}</td><td class='listado2'>{$muni_nombre}</td>\n\t\t \t<td class='listado2'>{$numeroExpediente}</td></tr>"; if (connection_status() != 0) { echo "<h1>Error de conexión</h1>"; $objError = new CombinaError(NO_DEFINIDO); echo $objError->getMessage(); die; } $nombPdf = iconv($odt->codificacion($nombre_us), 'ISO-8859-1', $nombre_us); $dirPdf = iconv($odt->codificacion($direccion_us1), 'ISO-8859-1', $direccion_us1); $dptoPdf = iconv($odt->codificacion($dpto_nombre), 'ISO-8859-1', $dpto_nombre); $muniPdf = iconv($odt->codificacion($muni_nombre), 'ISO-8859-1', $muni_nombre); $data = array_merge($data, array(array('#' => $contador, 'Radicado' => $nurad, 'Nombre' => $nombPdf, 'Direccion' => $dirPdf, 'Departamento' => $dptoPdf, 'Municipio' => $muniPdf))); $arrRadicados[] = $nurad; } fclose($fp); echo "</table>"; echo "<span class='info'>Número de registros {$contador}</span>"; $this->pdf->ezTable($data); $this->pdf->ezText("\n", 15, $justCentro); $this->pdf->ezText("Total Registros {$contador} \n", 15, $justCentro); $pdfcode = $this->pdf->ezOutput(); $fp = fopen($this->arcPDF, 'wb'); fwrite($fp, $pdfcode); fclose($fp); if ($this->definitivo == "si") { $objHist->insertarHistorico($arrRadicados, $dependencia, $codusuario, $dependencia, $codusuario, "Radicado insertado del grupo de masiva {$radi_nume_grupo}", 30); } $this->resulComb = $data; } else { exit("No se pudo crear el archivo {$this->archivo_insumo}"); } }
require_once DIR . '/includes/class_postbit.php'; require_once DIR . '/includes/functions_bigthree.php'; $vbulletin->input->clean_gpc('r', 'pmid', TYPE_UINT); ($hook = vBulletinHook::fetch_hook('private_showpm_start')) ? eval($hook) : false; $pm = $db->query_first_slave("\n\t\tSELECT\n\t\t\tpm.*, pmtext.*,\n\t\t\t" . iif($vbulletin->options['privallowicons'], "icon.title AS icontitle, icon.iconpath,") . "\n\t\t\tIF(ISNULL(pmreceipt.pmid), 0, 1) AS receipt, pmreceipt.readtime, pmreceipt.denied,\n\t\t\tsigpic.userid AS sigpic, sigpic.dateline AS sigpicdateline, sigpic.width AS sigpicwidth, sigpic.height AS sigpicheight\n\t\tFROM " . TABLE_PREFIX . "pm AS pm\n\t\tLEFT JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON(pmtext.pmtextid = pm.pmtextid)\n\t\t" . iif($vbulletin->options['privallowicons'], "LEFT JOIN " . TABLE_PREFIX . "icon AS icon ON(icon.iconid = pmtext.iconid)") . "\n\t\tLEFT JOIN " . TABLE_PREFIX . "pmreceipt AS pmreceipt ON(pmreceipt.pmid = pm.pmid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "sigpic AS sigpic ON(sigpic.userid = pmtext.fromuserid)\n\t\tWHERE pm.userid=" . $vbulletin->userinfo['userid'] . " AND pm.pmid=" . $vbulletin->GPC['pmid'] . "\n\t"); if (!$pm) { eval(standard_error(fetch_error('invalidid', $vbphrase['private_message'], $vbulletin->options['contactuslink']))); } $folderjump = construct_folder_jump(0, $pm['folderid']); // do read receipt $show['receiptprompt'] = $show['receiptpopup'] = false; if ($pm['receipt'] == 1 and $pm['readtime'] == 0 and $pm['denied'] == 0) { if ($permissions['pmpermissions'] & $vbulletin->bf_ugp_pmpermissions['candenypmreceipts']) { // set it to denied just now as some people might have ad blocking that stops the popup appearing $show['receiptprompt'] = $show['receiptpopup'] = true; $receipt_question_js = addslashes_js(construct_phrase($vbphrase['x_has_requested_a_read_receipt'], unhtmlspecialchars($pm['fromusername'])), '"'); $db->shutdown_query("UPDATE " . TABLE_PREFIX . "pmreceipt SET denied = 1 WHERE pmid = {$pm['pmid']}"); } else { // they can't deny pm receipts so do not show a popup or prompt $db->shutdown_query("UPDATE " . TABLE_PREFIX . "pmreceipt SET readtime = " . TIMENOW . " WHERE pmid = {$pm['pmid']}"); } } else { if ($pm['receipt'] == 1 and $pm['denied'] == 1) { $show['receiptprompt'] = true; } } $postbit_factory =& new vB_Postbit_Factory(); $postbit_factory->registry =& $vbulletin; $postbit_factory->cache = array(); $postbit_factory->bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list()); $postbit_obj =& $postbit_factory->fetch_postbit('pm');
function parse_template($template, $item, $unhtmlspecialchars = true) { if (preg_match_all('#\\{(?:feed|rss):([\\w:\\[\\]]+)\\}#siU', $template, $matches)) { foreach ($matches[0] as $match_number => $field) { $replace = $this->fetch_replacement($matches[1][$match_number], $item); $template = str_replace($field, $replace, $template); } } if ($unhtmlspecialchars) { $template = unhtmlspecialchars($template); } return $template; }
function page($p) { $cp = $this->db->get_row("SELECT * FROM `#DC@__catalog` WHERE dir='{$p}'"); if (empty($cp)) { $this->error('error:page'); } else { $this->jumptohtml($this->config['htmdir'] . $cp->dir); $pd = $this->db->get_row("SELECT * FROM `#DC@__page` WHERE cid='{$cp->id}'", ARRAY_A); if ($pd) { $this->assign('title', $pd['title']); $this->assign('keywords', $pd['keyword']); $this->assign('description', $pd['description']); $this->assign('body', unhtmlspecialchars($pd['body'])); $this->assign('creater', $pd['creater']); $this->assign('updater', $pd['updater']); $this->assign('createtime', $pd['createtime']); $this->assign('updatetime', $pd['updatetime']); } if ($this->config['linkmode'] == 'id') { $this->_List($cp->id, false); } elseif ($this->config['linkmode'] == 'title') { $this->_List($cp->dir, false); } return $this->DCPrint($cp->tpl_index, 'page'); } }
/** * Fetches the tagbits for display in a thread. * * @param array Tags * * @return string Tag bits, including a none word and progress image */ function fetch_tagbits($tags) { global $vbulletin, $vbphrase, $show, $template_hook; if ($tags) { $tag_array = explode(',', $tags); $tag_list = ''; foreach ($tag_array AS $tag) { $tag = trim($tag); if ($tag === '') { continue; } $tag_url = urlencode(unhtmlspecialchars($tag)); $tag = fetch_word_wrapped_string($tag); ($hook = vBulletinHook::fetch_hook('tag_fetchbit')) ? eval($hook) : false; // $tag_list .= ($tag_list != '' ? ', ' : ''); $templater = vB_Template::create('tagbit'); $templater->register('tag', $tag); $templater->register('tag_url', $tag_url); $tag_list .= trim($templater->render()); } } else { $tag_list = ''; } ($hook = vBulletinHook::fetch_hook('tag_fetchbit_complete')) ? eval($hook) : false; $templater = vB_Template::create('tagbit_wrapper'); $templater->register('tag_list', $tag_list); $wrapped = $templater->render(); return $wrapped; }
construct_hidden_code('infractionlevelid', $vbulletin->GPC['infractionlevelid']); print_submit_row(); } else { print_stop_message('no_matches_found'); } } // ###################### Start Details ####################### if ($_REQUEST['do'] == 'details') { $vbulletin->input->clean_array_gpc('r', array('infractionid' => TYPE_UINT)); if ($infraction = $db->query_first("\n\t\tSELECT infraction.*,\n\t\t\tuser.username AS whoadded_username,\n\t\t\tuser2.username,\n\t\t\tuser3.username AS action_username\n\t\tFROM " . TABLE_PREFIX . "infraction AS infraction\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (infraction.whoadded = user.userid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user2 ON (infraction.userid = user2.userid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user3 ON (infraction.actionuserid = user3.userid)\n\t\tWHERE infractionid = " . $vbulletin->GPC['infractionid'])) { print_form_header('', ''); print_table_header($vbphrase['view_infraction']); print_label_row($vbphrase['user_name'], $infraction['username']); print_label_row($vbphrase['left_by'], $infraction['whoadded_username']); print_label_row($vbphrase['date'], vbdate($vbulletin->options['logdateformat'], $infraction['dateline'])); $title = !empty($vbphrase['infractionlevel' . $infraction['infractionlevelid'] . '_title']) ? $vbphrase['infractionlevel' . $infraction['infractionlevelid'] . '_title'] : (!empty($infraction['customreason']) ? unhtmlspecialchars($infraction['customreason']) : $vbphrase['n_a']); if ($infraction['points']) { print_label_row($infraction['action'] == 0 ? construct_phrase($vbphrase['active_infraction_x_points'], $infraction['points']) : construct_phrase($vbphrase['expired_infraction_x_points'], $infraction['points']), htmlspecialchars_uni($title)); } else { print_label_row($infraction['action'] == 0 ? $vbphrase['active_warning'] : $vbphrase['expired_warning'], $title); } if ($infraction['action'] == 0) { print_label_row($vbphrase['expires'], $infraction['expires'] ? vbdate($vbulletin->options['logdateformat'], $infraction['expires']) : $vbphrase['never']); } else { if ($infraction['action'] == 1) { print_label_row($vbphrase['expired'], vbdate($vbulletin->options['logdateformat'], $infraction['actiondateline'])); } } if (!empty($infraction['note'])) { print_label_row($vbphrase['administrative_note'], $infraction['note']); }
/** * Fetches the HTML for the tag cloud. * * @param string Type of cloud. Supports search, usage * * @return string Tag cloud HTML (nothing if no cloud) */ function fetch_tagcloud($type = 'usage') { global $vbulletin, $stylevar, $vbphrase, $show, $template_hook; if ($vbulletin->options['tagcloud_usergroup'] > 0 and !isset($vbulletin->usergroupcache[$vbulletin->options['tagcloud_usergroup']])) { // handle a usergroup being deleted: default to live permission checking $vbulletin->options['tagcloud_usergroup'] = -1; } $cacheable = $vbulletin->options['tagcloud_usergroup'] != -1; if (!$cacheable) { $cloud = null; } else { switch ($type) { case 'search': $cloud = $vbulletin->searchcloud; break; case 'usage': default: $cloud = $vbulletin->tagcloud; break; } } if (!is_array($cloud) or $cloud['dateline'] < TIMENOW - 60 * $vbulletin->options['tagcloud_cachetime']) { if ($type == 'search') { $tags_result = $vbulletin->db->query_read_slave("\n\t\t\t\tSELECT tagsearch.tagid, tag.tagtext, COUNT(*) AS searchcount\n\t\t\t\tFROM " . TABLE_PREFIX . "tagsearch AS tagsearch\n\t\t\t\tINNER JOIN " . TABLE_PREFIX . "tag AS tag ON (tagsearch.tagid = tag.tagid)\n\t\t\t\t" . ($vbulletin->options['tagcloud_searchhistory'] ? "WHERE tagsearch.dateline > " . (TIMENOW - 60 * 60 * 24 * $vbulletin->options['tagcloud_searchhistory']) : '') . "\n\t\t\t\tGROUP BY tagsearch.tagid, tag.tagtext\n\t\t\t\tORDER BY searchcount DESC\n\t\t\t\tLIMIT " . $vbulletin->options['tagcloud_tags']); } else { if (!$vbulletin->options['tagcloud_usergroup']) { $perm_limit = false; } else { $forums = array(); $perm_limit = true; foreach ($vbulletin->forumcache as $forumid => $forum) { // -1 for live permission checking $perm_array = $vbulletin->options['tagcloud_usergroup'] == -1 ? $vbulletin->userinfo['forumpermissions']["{$forumid}"] : $forum['permissions'][$vbulletin->options['tagcloud_usergroup']]; if ($perm_array & $vbulletin->bf_ugp_forumpermissions['canview'] and $perm_array & $vbulletin->bf_ugp_forumpermissions['canviewthreads'] and $perm_array & $vbulletin->bf_ugp_forumpermissions['canviewothers']) { $forums[] = intval($forumid); } } } if (!$perm_limit or $forums) { $tags_result = $vbulletin->db->query_read_slave("\n\t\t\t\t\tSELECT tagthread.tagid, tag.tagtext, COUNT(*) AS searchcount\n\t\t\t\t\tFROM " . TABLE_PREFIX . "tagthread AS tagthread\n\t\t\t\t\tINNER JOIN " . TABLE_PREFIX . "tag AS tag ON (tagthread.tagid = tag.tagid)\n\t\t\t\t\tINNER JOIN " . TABLE_PREFIX . "thread AS thread ON (tagthread.threadid = thread.threadid)\n\t\t\t\t\tWHERE thread.open <> 10\n\t\t\t\t\t\tAND thread.visible = 1\n\t\t\t\t\t" . ($perm_limit ? "AND thread.forumid IN (" . implode(',', $forums) . ")" : '') . "\n\t\t\t\t\t" . ($vbulletin->options['tagcloud_usagehistory'] ? "AND tagthread.dateline > " . (TIMENOW - 60 * 60 * 24 * $vbulletin->options['tagcloud_usagehistory']) : '') . "\n\t\t\t\t\tGROUP BY tagthread.tagid, tag.tagtext\n\t\t\t\t\tORDER BY searchcount DESC\n\t\t\t\t\tLIMIT " . $vbulletin->options['tagcloud_tags']); } } $total = 0; $count = 0; if (!empty($tags_result)) { $count = $vbulletin->db->num_rows($tags_result); while ($currenttag = $vbulletin->db->fetch_array($tags_result)) { $tags["{$currenttag['tagtext']}"] = $currenttag; $total += $currenttag['searchcount']; } $vbulletin->db->free_result($tags_result); } $final_tags = array(); if ($count > 0) { // calculate the standard deviation $mean = $total / $count; $summation = 0; foreach ($tags as $tagtext => $tagvalue) { $summation += pow($tagvalue['searchcount'] - $mean, 2); } $sd = sqrt($summation / $count); uksort($tags, 'strnatcasecmp'); if ($sd) { $sdtags = array(); $lowestsds = 0; $highestsds = 0; // find the max and min standard deviations foreach ($tags as $tagtext => $currenttag) { $tags["{$tagtext}"]['deviation'] = $currenttag['searchcount'] - $mean; $tags["{$tagtext}"]['sds'] = $tags["{$tagtext}"]['deviation'] / $sd; $sdtags[] = $tags["{$tagtext}"]; if ($tags["{$tagtext}"]['sds'] < $lowestsds) { $lowestsds = $tags["{$tagtext}"]['sds']; } if ($tags["{$tagtext}"]['sds'] > $highestsds) { $highestsds = $tags["{$tagtext}"]['sds']; } } $levels = $vbulletin->options['tagcloud_levels']; foreach ($sdtags as $thistag) { // normalize the std devs to 0 - 1, then map back to 1 - #levls $thistag['level'] = round(($thistag['sds'] - $lowestsds) / ($highestsds - $lowestsds) * ($levels - 1)) + 1; $thistag['tagtext_url'] = urlencode(unhtmlspecialchars($thistag['tagtext'])); $final_tags[] = $thistag; } } else { foreach ($tags as $tagtext => $tagarr) { $final_tags[] = array('tagid' => $tagarr['tagid'], 'tagtext' => $tagtext, 'tagtext_url' => urlencode(unhtmlspecialchars($tagtext)), 'level' => round($vbulletin->options['tagcloud_levels'] / 2)); } } } $cloud = array('tags' => $final_tags, 'count' => sizeof($final_tags), 'dateline' => TIMENOW); if ($cacheable) { if ($type == 'search') { $vbulletin->searchcloud = $cloud; build_datastore('searchcloud', serialize($cloud), 1); } else { $vbulletin->tagcloud = $cloud; build_datastore('tagcloud', serialize($cloud), 1); } } } if (empty($cloud['tags'])) { return ''; } $cloud['links'] = ''; foreach ($cloud['tags'] as $thistag) { ($hook = vBulletinHook::fetch_hook('tag_cloud_bit')) ? eval($hook) : false; eval('$cloud[\'links\'] .= "' . fetch_template('tag_cloud_link') . '";'); } $cloud['count'] = vb_number_format($cloud['count']); if ($type == 'search') { eval('$cloud_html .= "' . fetch_template('tag_cloud_box_search') . '";'); } else { eval('$cloud_html .= "' . fetch_template('tag_cloud_box') . '";'); } return $cloud_html; }
$threadinfo['threadview'] = intval($threadview); $displayed_dateline = 0; ################################################################################ ############################### SHOW POLL ###################################### ################################################################################ $poll = ''; if ($thread['pollid']) { $pollbits = ''; $counter = 1; $pollid = $thread['pollid']; $show['editpoll'] = iif(can_moderate($threadinfo['forumid'], 'caneditpoll'), true, false); // get poll info $pollinfo = $db->query_first_slave("\n\t\tSELECT *\n\t\tFROM " . TABLE_PREFIX . "poll\n\t\tWHERE pollid = {$pollid}\n\t"); require_once DIR . '/includes/class_bbcode.php'; $bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list()); $pollinfo['question'] = $bbcode_parser->parse(unhtmlspecialchars($pollinfo['question']), $forum['forumid'], true); $splitoptions = explode('|||', $pollinfo['options']); $splitoptions = array_map('rtrim', $splitoptions); $splitvotes = explode('|||', $pollinfo['votes']); $showresults = 0; $uservoted = 0; if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canvote'])) { $nopermission = 1; } if (!$pollinfo['active'] or !$thread['open'] or $pollinfo['dateline'] + $pollinfo['timeout'] * 86400 < TIMENOW and $pollinfo['timeout'] != 0 or $nopermission) { //thread/poll is closed, ie show results no matter what $showresults = 1; } else { //get userid, check if user already voted $voted = intval(fetch_bbarray_cookie('poll_voted', $pollid)); if ($voted) {
function unhtmlspecialchars($string) { if (is_array($string)) { foreach ($string as $key => $val) { $string[$key] = unhtmlspecialchars($val); } } else { $string = str_replace(array('&', ''', '"', '<', '>'), array('&', '\'', '\\"', '<', '>'), $string); } return $string; }
public function dialog($arg = "", $js = 'js:', $callback = "ok", $s = 2) { $arg = (array) $arg; empty($arg[1]) && ($arg[1] = '提示信息'); $script = '<script type="text/JavaScript">'; $A = explode(':', $js); if ($A[0] == 'js') { $A[1] && ($fn = $A[1]); } elseif ($A[0] == 'url') { $A[1] == "1" && ($A[1] = unhtmlspecialchars(__REF__)); $fn = empty($A[1]) ? "parent.location.reload();" : "parent.location.href='" . $A[1] . "';"; } elseif ($A[0] == 'src') { //src:url $A[1] == "1" && ($A[1] = unhtmlspecialchars(__REF__)); $fn = "parent.\$('#iCMS_FRAME').attr('src','" . $A[1] . "');"; } if (is_array($callback)) { foreach ($callback as $key => $val) { $func = empty($val['url']) ? 'parent.iCMS.closeDialog();' : "parent.location.href='{$val['url']}';"; if ($val['o']) { $func = "top.window.open('{$val['url']}','_blank');"; } $b[] = '"' . $val['text'] . '": function(){' . $func . '}'; //$(this).dialog("close"); } empty($fn) && ($fn = 'parent.location.reload();'); $buttons = implode(',', (array) $b); $script .= 'window.buttons={' . $buttons . '};'; $script .= 'window.fn=function(){' . $fn . '};'; $script .= 'parent.iCMS.CDB("' . $arg[0] . '","iCMS - ' . $arg[1] . '",window);'; } else { empty($fn) && ($fn = 'parent.iCMS.closeDialog();'); $script .= 'window.fn=function(){' . $fn . '};parent.iCMS.' . $callback . '("' . $arg[0] . '","iCMS - ' . $arg[1] . '",window);'; } $s != '-1' && ($script .= 'setTimeout(window.fn,' . $s . '*1000);'); echo $script . '</script>'; exit; }
if ($showemail) { if (empty($vbulletin->GPC['message']) and $vbulletin->options['uimessage'] and !$nocontact) { $errors[] = 'nomessagetouser'; } if (!empty($errors)) { // include useful functions require_once DIR . '/includes/functions_newpost.php'; $postpreview = construct_errors(array_map('fetch_error', $errors)); define('PMPREVIEW', 1); $postmessage = htmlspecialchars_uni($vbulletin->GPC['message']); } else { // Email User require_once DIR . '/includes/class_bbcode_alt.php'; $plaintext_parser =& new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list()); $plaintext_parser->set_parsing_language($touserinfo['languageid']); $infraction = array('username' => unhtmlspecialchars($userinfo['username']), 'reason' => $infractionlevel['infractionlevelid'] ? fetch_phrase('infractionlevel' . $infractionlevel['infractionlevelid'] . '_title', 'infractionlevel', '', true, true, $userinfo['languageid']) : $vbulletin->GPC['customreason'], 'message' => &$vbulletin->GPC['message'], 'points' => $infdata->fetch_field('points')); $emailsubphrase = $infraction['points'] > 0 ? 'infraction_received' : 'warning_received'; // if we have a specific post we can link to, link to it if (!empty($postinfo)) { $infraction['post'] = $vbulletin->options['bburl'] . "/showthread.php?p={$postinfo['postid']}#post{$postinfo['postid']}"; $infraction['pagetext'] =& $postinfo['pagetext']; $emailphrase = $emailsubphrase . '_post'; } else { $infraction['post'] = ''; $emailphrase = $emailsubphrase . '_profile'; } eval(fetch_email_phrases($emailphrase, $userinfo['languageid'], $emailsubphrase)); $message = $plaintext_parser->parse($message, 'privatemessage'); vbmail($userinfo['email'], $subject, $message); } } else {
function email_moderators($fields) { if ($this->info['skip_moderator_email'] or !$this->info['forum'] or in_coventry($this->fetch_field('userid', 'post'), true)) { return; } $mod_emails = fetch_moderator_newpost_emails($fields, $this->info['forum']['parentlist'], $newpost_lang); if (!empty($mod_emails)) { $foruminfo = $this->info['forum']; $foruminfo['title_clean'] = unhtmlspecialchars($foruminfo['title_clean']); $threadinfo = fetch_threadinfo($this->fetch_field('threadid')); require_once DIR . '/includes/class_bbcode_alt.php'; $plaintext_parser =& new vB_BbCodeParser_PlainText($this->registry, fetch_tag_list()); $email = $this->info['user']['email'] ? $this->info['user']['email'] : $this->registry->userinfo['email']; $browsing_user = $this->registry->userinfo['username']; // ugly hack -- should be fixed in the future $this->registry->userinfo['username'] = unhtmlspecialchars($this->info['user']['username'] ? $this->info['user']['username'] : $this->registry->userinfo['username']); $post = array_merge($this->existing, $this->post); if (!$post['postid']) { $post['postid'] = $this->thread['firstpostid']; } require_once DIR . '/includes/functions_misc.php'; foreach ($mod_emails as $toemail) { if ($toemail != $email) { $plaintext_parser->set_parsing_language(isset($newpost_lang["{$toemail}"]) ? $newpost_lang["{$toemail}"] : 0); $post['message'] = $plaintext_parser->parse($this->post['pagetext'], $foruminfo['forumid']); if ($threadinfo['prefixid']) { // need prefix in correct language $threadinfo['prefix_plain'] = fetch_phrase("prefix_{$threadinfo['prefixid']}_title_plain", 'global', '', false, true, isset($newpost_lang["{$toemail}"]) ? $newpost_lang["{$toemail}"] : 0, false) . ' '; } else { $threadinfo['prefix_plain'] = ''; } eval(fetch_email_phrases('moderator', iif(isset($newpost_lang["{$toemail}"]), $newpost_lang["{$toemail}"], 0))); vbmail($toemail, $subject, $message); } } // back to normal $this->registry->userinfo['username'] = htmlspecialchars_uni($browsing_user); } }
/** * Sets information regarding the report * * @param array Information regarding the report * */ function set_reportinfo(&$reportinfo) { $reportinfo = array_merge($reportinfo, array('pusername' => unhtmlspecialchars($this->iteminfo['postusername']), 'puserid' => $this->iteminfo['postuserid'], 'commenturl' => $this->extrainfo['picture']['albumid'] ? "album.php?" . $this->registry->session->vars['sessionurl'] . "albumid=" . $this->extrainfo['picture']['albumid'] . "&pictureid={$this->iteminfo['pictureid']}&commentid={$this->iteminfo['commentid']}#picturecomment{$this->iteminfo['commentid']}" : "group.php?" . $this->registry->session->vars['sessionurl'] . "do=picture&groupid=" . $this->extrainfo['group']['groupid'] . "&pictureid={$this->iteminfo['pictureid']}&commentid={$this->iteminfo['commentid']}#picturecomment{$this->iteminfo['commentid']}", 'pagetext' => $this->iteminfo['pagetext'])); }
if (!empty($updateids)) { $vbulletin->db->query_write("\n\t\tUPDATE " . TABLE_PREFIX . "subscribeevent\n\t\tSET lastreminder =\n\t\tCASE\n\t\t " . implode(" \r\n", $sql) . "\n\t\tELSE lastreminder\n\t\tEND\n\t\tWHERE subscribeeventid IN (" . implode(', ', $updateids) . ")\n\t"); } vbmail_start(); $usernames = ''; $reminderbits = ''; foreach ($eventlist as $userid => $event) { $usernames .= iif($usernames, ', '); $usernames .= $userinfo["{$userid}"]['username']; $reminderbits = ''; foreach ($event as $eventid => $hour) { $eventinfo =& $eventcache["{$eventid}"]; eval(fetch_email_phrases('reminderbit', $userinfo["{$userid}"]['languageid'])); $reminderbits .= $message; } $username = unhtmlspecialchars($userinfo["{$userid}"]['username']); eval(fetch_email_phrases('reminder', $userinfo["{$userid}"]['languageid'])); vbmail($userinfo["{$userid}"]['email'], $subject, $message, true); if ($vbulletin->debug and VB_AREA == 'AdminCP') { "<pre>"; echo $subject; echo "</pre>"; echo "<pre>"; echo $message; echo "</pre><br />"; } } vbmail_end(); if (!empty($usernames)) { log_cron_action($usernames, $nextitem, 1); }
// set the email field to be updated $userdata->set('email', $vbulletin->GPC['email']); // generate an activation ID if required if ($vbulletin->options['verifyemail'] and !can_moderate()) { $userdata->set('usergroupid', 3); $userdata->set_info('override_usergroupid', true); $activate = true; // wait lets check if we have an entry first! $activation_exists = $db->query_first("\n\t\t\t\tSELECT * FROM " . TABLE_PREFIX . "useractivation\n\t\t\t\tWHERE userid = " . $vbulletin->userinfo['userid'] . "\n\t\t\t\tAND type = 0\n\t\t\t"); if (!empty($activation_exists['usergroupid']) and $vbulletin->userinfo['usergroupid'] == 3) { $usergroupid = $activation_exists['usergroupid']; } else { $usergroupid = $vbulletin->userinfo['usergroupid']; } $activateid = build_user_activation_id($vbulletin->userinfo['userid'], $usergroupid, 0, 1); $username = unhtmlspecialchars($vbulletin->userinfo['username']); $userid = $vbulletin->userinfo['userid']; eval(fetch_email_phrases('activateaccount_change')); vbmail($vbulletin->GPC['email'], $subject, $message, true); } else { $activate = false; } } else { $userdata->verify_useremail($vbulletin->userinfo['email']); } ($hook = vBulletinHook::fetch_hook('profile_updatepassword_complete')) ? eval($hook) : false; // save the data $userdata->save(); if ($activate) { $vbulletin->url = 'usercp.php' . $vbulletin->session->vars['sessionurl_q']; eval(print_standard_redirect('redirect_updatethanks_newemail', true, true));
function highlight_php($string) { $border = BORDER; $bg1 = BG_1; $string = unhtmlspecialchars($string[1]); $string = highlight_string($string, true); $string = '<div style="background:' . $bg1 . '; border:1px solid ' . $border . '; padding:3px;">PHP Code:<br />' . $string . '</div>'; return $string; }