function renderizar($vista, $datos) { if (!is_array($datos)) { http_response_code(404); die("Error de renderizador: datos no es un arreglo"); } //union de los dos arreglos global $global_context; $datos = array_merge($global_context, $datos); $viewsPath = "views/"; $fileTemplate = $vista . ".view.tpl"; $layoutFile = "layout.view.tpl"; $htmlContent = ""; if (file_exists($viewsPath . $layoutFile)) { $htmlContent = file_get_contents($viewsPath . $layoutFile); if (file_exists($viewsPath . $fileTemplate)) { $tmphtml = file_get_contents($viewsPath . $fileTemplate); $htmlContent = str_replace("{{{page_content}}}", $tmphtml, $htmlContent); //Limpiar Saltos de Pagina $htmlContent = str_replace("\n", "", $htmlContent); $htmlContent = str_replace("\r", "", $htmlContent); $htmlContent = str_replace("\t", "", $htmlContent); $htmlContent = str_replace(" ", "", $htmlContent); //obtiene un arreglo separando lo distintos tipos de nodos $template_code = parseTemplate($htmlContent); $htmlResult = renderTemplate($template_code, $datos); echo $htmlResult; } } }
<?php $GLOBALS["KAV4PROXY_NOSESSION"] = true; $GLOBALS["RELOAD"] = false; $_GET["LOGFILE"] = "/var/log/artica-postfix/dansguardian.compile.log"; if (posix_getuid() != 0) { parseTemplate(); die; } include_once dirname(__FILE__) . "/ressources/class.user.inc"; include_once dirname(__FILE__) . "/ressources/class.groups.inc"; include_once dirname(__FILE__) . "/ressources/class.ldap.inc"; include_once dirname(__FILE__) . "/ressources/class.system.network.inc"; include_once dirname(__FILE__) . "/ressources/class.dansguardian.inc"; include_once dirname(__FILE__) . "/ressources/class.squid.inc"; include_once dirname(__FILE__) . "/ressources/class.squidguard.inc"; include_once dirname(__FILE__) . "/ressources/class.mysql.inc"; include_once dirname(__FILE__) . '/framework/class.unix.inc'; include_once dirname(__FILE__) . "/framework/frame.class.inc"; if (posix_getuid() != 0) { die("Cannot be used in web server mode\n\n"); } if (count($argv) > 0) { $imploded = implode(" ", $argv); if (preg_match("#--verbose#", $imploded)) { $GLOBALS["VERBOSE"] = true; $GLOBALS["debug"] = true; ini_set_verbosed(); } if (preg_match("#--reload#", $imploded)) { $GLOBALS["RELOAD"] = true;
function GetContent($part, &$attachments, $post_id, $config) { global $charset, $encoding; /* if (!function_exists(imap_mime_header_decode)) echo "you need to install the php-imap extension for full functionality, including mime header decoding\n"; */ $meta_return = NULL; echo "primary= " . $part->ctype_primary . ", secondary = " . $part->ctype_secondary . "\n"; DecodeBase64Part($part); if (BannedFileName($part->ctype_parameters['name'], $config['BANNED_FILES_LIST'])) { return NULL; } if ($part->ctype_primary == "application" && $part->ctype_secondary == "octet-stream") { if ($part->disposition == "attachment") { $image_endings = array("jpg", "png", "gif", "jpeg", "pjpeg"); foreach ($image_endings as $type) { if (eregi(".{$type}\$", $part->d_parameters["filename"])) { $part->ctype_primary = "image"; $part->ctype_secondary = $type; break; } } } else { $mimeDecodedEmail = DecodeMIMEMail($part->body); FilterTextParts($mimeDecodedEmail, $config['PREFER_TEXT_TYPE']); foreach ($mimeDecodedEmail->parts as $section) { $meta_return .= GetContent($section, $attachments, $post_id, $config); } } } if ($part->ctype_primary == "multipart" && $part->ctype_secondary == "appledouble") { $mimeDecodedEmail = DecodeMIMEMail("Content-Type: multipart/mixed; boundary=" . $part->ctype_parameters["boundary"] . "\n" . $part->body); FilterTextParts($mimeDecodedEmail, $config['PREFER_TEXT_TYPE']); FilterAppleFile($mimeDecodedEmail); foreach ($mimeDecodedEmail->parts as $section) { $meta_return .= GetContent($section, $attachments, $post_id, $config); } } else { switch (strtolower($part->ctype_primary)) { case 'multipart': FilterTextParts($part, $config['PREFER_TEXT_TYPE']); foreach ($part->parts as $section) { $meta_return .= GetContent($section, $attachments, $post_id, $config); } break; case 'text': $tmpcharset = trim($part->ctype_parameters['charset']); if ($tmpcharset != '') { $charset = $tmpcharset; } $tmpencoding = trim($part->headers['content-transfer-encoding']); if ($tmpencoding != '') { $encoding = $tmpencoding; } $part->body = HandleMessageEncoding($part->headers["content-transfer-encoding"], $part->ctype_parameters["charset"], $part->body, $config['MESSAGE_ENCODING'], $config['MESSAGE_DEQUOTE']); //go through each sub-section if ($part->ctype_secondary == 'enriched') { //convert enriched text to HTML $meta_return .= etf2HTML($part->body) . "\n"; } elseif ($part->ctype_secondary == 'html') { //strip excess HTML //$meta_return .= HTML2HTML($part->body ) . "\n"; $meta_return .= $part->body . "\n"; } else { //regular text, so just strip the pgp signature if (ALLOW_HTML_IN_BODY) { $meta_return .= $part->body . "\n"; } else { $meta_return .= htmlentities($part->body) . "\n"; } $meta_return = StripPGP($meta_return); } break; case 'image': echo "looking at an image\n"; $file_id = postie_media_handle_upload($part, $post_id); $file = wp_get_attachment_url($file_id); $cid = trim($part->headers["content-id"], "<>"); //cids are in <cid> $the_post = get_post($file_id); /* TODO make these options */ $attachments["html"][] = parseTemplate($file_id, $part->ctype_primary, $config['IMAGETEMPLATE']); if ($cid) { $attachments["cids"][$cid] = array($file, count($attachments["html"]) - 1); } break; case 'audio': $file_id = postie_media_handle_upload($part, $post_id); $file = wp_get_attachment_url($file_id); $cid = trim($part->headers["content-id"], "<>"); //cids are in <cid> if (in_array($part->ctype_secondary, $config['AUDIOTYPES'])) { $audioTemplate = $config['AUDIOTEMPLATE']; } else { $icon = chooseAttachmentIcon($file, $part->ctype_primary, $part->ctype_secondary, $config['ICON_SET'], $config['ICON_SIZE']); $audioTemplate = '<a href="{FILELINK}">' . $icon . '{FILENAME}</a>'; } $attachments["html"][] = parseTemplate($file_id, $part->ctype_primary, $audioTemplate); break; case 'video': $file_id = postie_media_handle_upload($part, $post_id); $file = wp_get_attachment_url($file_id); $cid = trim($part->headers["content-id"], "<>"); //cids are in <cid> if (in_array($part->ctype_secondary, $config['VIDEO1TYPES'])) { $videoTemplate = $config['VIDEO1TEMPLATE']; } else { if (in_array($part->ctype_secondary, $config['VIDEO2TYPES'])) { $videoTemplate = $config['VIDEO2TEMPLATE']; } else { $icon = chooseAttachmentIcon($file, $part->ctype_primary, $part->ctype_secondary, $config['ICON_SET'], $config['ICON_SIZE']); $videoTemplate = '<a href="{FILELINK}">' . $icon . '{FILENAME}</a>'; } } $attachments["html"][] = parseTemplate($file_id, $part->ctype_primary, $videoTemplate); break; default: if (in_array(strtolower($part->ctype_primary), $config["SUPPORTED_FILE_TYPES"])) { //pgp signature - then forget it if ($part->ctype_secondary == 'pgp-signature') { break; } $file_id = postie_media_handle_upload($part, $post_id); $file = wp_get_attachment_url($file_id); echo "file={$file}\n"; $cid = trim($part->headers["content-id"], "<>"); //cids are in <cid> $icon = chooseAttachmentIcon($file, $part->ctype_primary, $part->ctype_secondary, $config['ICON_SET'], $config['ICON_SIZE']); $attachments["html"][] = '<a href="' . $file . '" style="text-decoration:none">' . $icon . $part->ctype_parameters['name'] . '</a>' . "\n"; if ($cid) { $attachments["cids"][$cid] = array($file, count($attachments["html"]) - 1); } } break; } } return $meta_return; }
function parseTemplate($subject, $template, $language = NULL) { // If template/subTemplate is listed as ignored, return false if (isIgnored($template, $tplName)) { return false; } // Find subtemplates and remove Subtemplates, which are listed as ignored! preg_match_all('~\\{((?>[^{}]+)|(?R))*\\}~x', $template, $subTemplates); foreach ($subTemplates[0] as $key => $subTemplate) { $subTemplate = preg_replace("/(^\\{\\{)|(\\}\\}\$)/", "", $subTemplate); // Cut Brackets / {} if (isIgnored($subTemplate, $tplName)) { $template = str_replace('{{' . $subTemplate . '}}', '', $template); } } // Replace "|" inside subtemplates with "\\" to avoid splitting them like triples $template = preg_replace_callback("/(\\{{2})([^\\}\\|]+)(\\|)([^\\}]+)(\\}{2})/", 'replaceBarInSubtemplate', $template); $equal = preg_match('~=~', $template); // Gruppe=[[Gruppe-3-Element|3]] ersetzt durch Gruppe=[[Gruppe-3-Element***3]] do { $template = preg_replace('/\\[\\[([^\\]]+)\\|([^\\]]*)\\]\\]/', '[[\\1***\\2]]', $template, -1, $count); } while ($count); $triples = explode('|', $template); if (count($triples) <= $GLOBALS['W2RCFG']['minAttributeCount']) { return false; } $templateName = strtolower(trim(array_shift($triples))); // if(!isBlanknote($subject) && !$GLOBALS['onefile']) // $GLOBALS['filename']=urlencode($templateName).'.'.$GLOBALS['outputFormat']; // Array containing URIs to subtemplates. If the same URI is in use already, add a number to it $knownSubTemplateURI = array(); // subject $s = $subject; $z = 0; foreach ($triples as $triple) { if ($equal) { $split = explode('=', $triple, 2); if (count($split) < 2) { continue; } list($p, $o) = $split; $p = trim($p); } else { $p = "property" . ++$z; $o = $triple; } $o = trim($o); //if property date and object an timespan we extract it with following special case if ($p == "date") { $o = str_replace("[", "", str_replace("]", "", $o)); $o = str_replace("–", "-", $o); } // Do not allow empty Properties if (strlen($p) < 1) { continue; } if (in_array($p, $GLOBALS['W2RCFG']['ignoreProperties'])) { continue; } if ($o !== '' & $o !== NULL) { $pred = $p; // if(!$GLOBALS['templateStatistics'] && $GLOBALS['propertyStat'][$p]['count']<10) //continue; // predicate // Write properties CamelCase, no underscores, no hyphens. If first char is digit, add _ at the beginning $p = propertyToCamelCase($p); // Add prefixProperties if set true in config.inc.php if ($GLOBALS['prefixPropertiesWithTemplateName']) { $p = propertyToCamelCase($templateName) . '_' . $p; } else { if (!$equal) { $p = propertyToCamelCase($templateName . "_" . $p); } } // object $o = str_replace('***', '|', $o); // Remove HTML Markup for whitespaces $o = str_replace(' ', ' ', $o); //remove <ref> Content</ref> //$o = preg_replace('/(<ref>.+?<\/ref>)/s','',$o); // Parse Subtemplates (only parse Subtemplates with values!) if (preg_match_all("/(\\{{2})([^\\}]+)(\\}{2})/", $o, $subTemplates, PREG_SET_ORDER)) { foreach ($subTemplates as $subTemplate) { // Replace #### back to |, in order to parse subtemplate properly $tpl = str_replace("####", "|", $subTemplate[2]); // If subtemplate contains values, the subject is only the first word if (preg_match("/(^[^\\|]+)(\\|)/", $tpl, $match)) { $subTemplateSubject = $subject . '/' . $p . '/' . $match[1]; } else { $subTemplateSubject = $subject . '/' . $p . '/' . $tpl; } // Look up URI in Array containing known URIs, if found add counter to URI. // e.g. http://dbpedia.org/United_Kingdom/footnote/cite_web // ==> http://dbpedia.org/United_Kingdom/footnote/cite_web1 ... if (!isset($knownSubTemplateURI[$subTemplateSubject])) { // array_push( $knownSubTemplateURI, $subTemplateSubject ); $knownSubTemplateURI[$subTemplateSubject] = 0; } else { $knownSubTemplateURI[$subTemplateSubject]++; $subTemplateSubject .= $knownSubTemplateURI[$subTemplateSubject]; } // If subtemplate contained real values, write the corresponding triple if (parseTemplate($subTemplateSubject, $tpl)) { writeTripel($s, $GLOBALS['W2RCFG']['propertyBase'] . $p, $subTemplateSubject, 'main', 'r', null, null); } } } // Remove subTemplates from Strings $o = str_replace("####", "|", $o); $o = preg_replace("/\\{{2}[^\\}]+\\}{2}/", "", $o); // Sometimes only whitespace remain, then continue with next triple if (preg_match("/^[\\s]*\$/", $o)) { continue; } //replace predicate if necessary to make them unambiguous $p = replacePredicate($p); // Add URI prefixes to property names $p = $GLOBALS['W2RCFG']['propertyBase'] . $p; if (isBlanknoteList($o)) { printList($s, $p, $o); } else { list($o, $o_is, $dtype, $lang) = parseAttributeValue($o, $s, $p, $language); // special newline handling $br = array('<br>', '<br/>', '<br />'); if ($o_is == 'l') { $o = str_replace($br, "\n", $o); } else { if ($o_is == 'r') { $o = str_replace($br, '', $o); } } if ($o !== NULL) { writeTripel($s, $p, $o, 'main', $o_is, $dtype, $lang); } } //if($GLOBALS['templateStatistics'] && $o!=NULL && $equal) { // $GLOBALS['propertyStat'][$pred]['count']++; // $GLOBALS['propertyStat'][$pred]['maxCountPerTemplate']=max($GLOBALS['propertyStat'][$pred]['maxCountPerTemplate'],++$pc[$pred]); // if(!$GLOBALS['propertyStat'][$pred]['inTemplates'] || !in_array($templateName,$GLOBALS['propertyStat'][$pred]['inTemplates'])) // $GLOBALS['propertyStat'][$pred]['inTemplates'][]=$templateName; //} $extracted = true; } } if (isset($extracted) && $extracted) { //writeTripel($s,$GLOBALS['W2RCFG']['templateProperty'],$GLOBALS['W2RCFG']['wikipediaBase'].$GLOBALS['templateLabel'].':'.encodeLocalName($templateName),$GLOBALS['filedecisionTemplate']); writeTripel($s, $GLOBALS['W2RCFG']['templateProperty'], $GLOBALS['W2RCFG']['wikipediaBase'] . $GLOBALS['templateLabel'] . ':' . $templateName); //if ($GLOBALS['addExplicitTypeTriples']) // printexplicitTyping($templateName,$GLOBALS['filename'],'t'); } if (isset($extracted)) { return $extracted; } else { return false; } }
function sendNotificationEmail($type) { jTipsLogger::_log('preparing to send ' . $type . ' notification email', 'INFO'); global $jTips, $database; $subject = stripslashes($jTips["UserNotify" . $type . "Subject"]); $message = stripslashes($jTips["UserNotify" . $type . "Message"]); $from_name = $jTips['UserNotifyFromName']; $from_email = $jTips['UserNotifyFromEmail']; $variables = array(); $values = array(); foreach (get_object_vars($this) as $key => $val) { if (is_string($key)) { array_push($variables, $key); $values[$key] = $val; } } if (isJoomla15()) { $user = new JUser(); } else { $user = new mosUser($database); } $user->load($this->user_id); foreach (get_object_vars($user) as $key => $val) { if (is_string($key)) { array_push($variables, $key); $values[$key] = $val; } } // find out which season this is for an add it to the avaialble variables $query = "SELECT name FROM #__jtips_seasons WHERE id = '" . $this->season_id . "'"; $database->setQuery($query); $season = $database->loadResult(); $values['competition'] = $season; $values['season'] = $season; $body = parseTemplate($message, $variables, $values); jTipsLogger::_log('sending email: ' . $body, 'INFO'); if (jTipsMail($from_email, $from_name, $this->getUserField('email'), $subject, $body)) { jTipsLogger::_log('notification email sent successfully', 'INFO'); return TRUE; } else { jTipsLogger::_log('sending notification email failed', 'ERROR'); return FALSE; } }
$query = "SELECT ju.*, u.email, u.name, u.username FROM #__jtips_users ju JOIN #__users u ON ju.user_id = u.id WHERE ju.status = 1 AND season_id = {$season_id} AND ju.id NOT IN ('" . implode("', '", $user_ids) . "') AND u.block = 0"; //echo $query; $database->setQuery($query); $rows = (array) $database->loadAssocList(); jTipsLogger::_log('found ' . count($rows) . ' users to try to send to ', 'info'); foreach ($rows as $user) { ksort($user); $jTipsUser = new jTipsUser($database); $jTipsUser->load($user['id']); //jTipsLogger::_log($jTipsUser); if ($jTipsUser->getPreference('email_reminder')) { $recipient = $user['email']; $user['round'] = $round[0]['round']; $user['competition'] = $round[0]['season']; $user['season'] = $round[0]['season']; $body = parseTemplate($body, $variables, $user); $record = array('round_id' => $round[0]['id'], 'user_id' => $user['id'], 'notified' => 0); $attempted++; if (jTipsMail($from, $fromname, $recipient, $subject, $body)) { $record['notified'] = 1; jTipsLogger::_log('sent reminder email to ' . $recipient . ' subject: ' . $subject . ' from: ' . $fromname . ' <' . $from . '>', 'info'); $sent++; } else { jTipsLogger::_log('failed to send reminder email to ' . $recipient, 'error'); } $jRemind = new jRemind($database); $jRemindParams = array('round_id' => $record['round_id'], 'user_id' => $record['user_id']); $jRemind->loadByParams($jRemindParams); $jRemind->attempts++; $jRemind->bind($record); $jRemind->save();
function parseCommand($line, $vars, $handle) { global $ignore, $ignorestack, $ignorelevel, $config, $listing, $vars; // process content of included file if (strncmp(trim($line), '[websvn-include:', 16) == 0) { if (!$ignore) { $line = trim($line); $file = substr($line, 16, -1); parseTemplate($config->getTemplatePath() . $file, $vars, $listing); } return true; } // Check for test conditions if (strncmp(trim($line), '[websvn-test:', 13) == 0) { if (!$ignore) { $line = trim($line); $var = substr($line, 13, -1); $neg = $var[0] == '!'; if ($neg) { $var = substr($var, 1); } if (empty($vars[$var]) ^ $neg) { array_push($ignorestack, $ignore); $ignore = true; } } else { $ignorelevel++; } return true; } if (strncmp(trim($line), '[websvn-else]', 13) == 0) { if ($ignorelevel == 0) { $ignore = !$ignore; } return true; } if (strncmp(trim($line), '[websvn-endtest]', 16) == 0) { if ($ignorelevel > 0) { $ignorelevel--; } else { $ignore = array_pop($ignorestack); } return true; } if (strncmp(trim($line), '[websvn-getlisting]', 19) == 0) { global $svnrep, $path, $rev, $peg; if (!$ignore) { $svnrep->listFileContents($path, $rev, $peg); } return true; } if (strncmp(trim($line), '[websvn-defineicons]', 19) == 0) { global $icons; if (!isset($icons)) { $icons = array(); } // Read all the lines until we reach the end of the definition, storing // each one... if (!$ignore) { while (!feof($handle)) { $line = trim(fgets($handle)); if (strncmp($line, '[websvn-enddefineicons]', 22) == 0) { return true; } $eqsign = strpos($line, '='); $match = substr($line, 0, $eqsign); $def = substr($line, $eqsign + 1); $icons[$match] = $def; } } return true; } if (strncmp(trim($line), '[websvn-icon]', 13) == 0) { global $icons, $vars; if (!$ignore) { // The current filetype should be defined my $vars['filetype'] if (!empty($icons[$vars['filetype']])) { echo parseTags($icons[$vars['filetype']], $vars); } else { if (!empty($icons['*'])) { echo parseTags($icons['*'], $vars); } } } return true; } if (strncmp(trim($line), '[websvn-treenode]', 17) == 0) { global $icons, $vars; if (!$ignore) { if (!empty($icons['i-node']) && !empty($icons['t-node']) && !empty($icons['l-node'])) { for ($n = 1; $n < $vars['level']; $n++) { if ($vars['last_i_node'][$n]) { echo parseTags($icons['e-node'], $vars); } else { echo parseTags($icons['i-node'], $vars); } } if ($vars['level'] != 0) { if ($vars['node'] == 0) { echo parseTags($icons['t-node'], $vars); } else { echo parseTags($icons['l-node'], $vars); $vars['last_i_node'][$vars['level']] = true; } } } } return true; } return false; }
$listing[$i]['projectlink'] = null; // Because template.php won't unset this $i++; // Causes the subsequent lines to store data in the next array slot. $listing[$i]['groupid'] = null; // Because template.php won't unset this } $listing[$i]['clientrooturl'] = $project->clientRootURL; // Create project (repository) listing $url = str_replace('&', '', $config->getURL($project, '', 'dir')); $name = $config->flatIndex ? $project->getDisplayName() : $project->name; $listing[$i]['projectlink'] = '<a href="' . $url . '">' . $name . '</a>'; $listing[$i]['rowparity'] = $parity % 2; $parity++; $listing[$i]['groupparity'] = $groupparity % 2; $groupparity++; $i++; } if (empty($listing) && !empty($projects)) { $vars['error'] = $lang['NOACCESS']; } $vars['flatview'] = $config->flatIndex; $vars['treeview'] = !$config->flatIndex; $vars['opentree'] = $config->openTree; $vars['groupcount'] = $groupcount; // Indicates whether any groups were present. $vars['template'] = 'index'; parseTemplate($config->getTemplatePath() . 'header.tmpl', $vars, $listing); parseTemplate($config->getTemplatePath() . 'index.tmpl', $vars, $listing); parseTemplate($config->getTemplatePath() . 'footer.tmpl', $vars, $listing);
$vars['showalllink'] = '<a href="' . $diff . $passIgnoreWhitespace . '&all=1' . '">' . $lang['SHOWENTIREFILE'] . '</a>'; } $passShowAll = $all ? '&all=1' : ''; if ($ignoreWhitespace) { $vars['regardwhitespacelink'] = '<a href="' . $diff . $passShowAll . '">' . $lang['REGARDWHITESPACE'] . '</a>'; } else { $vars['ignorewhitespacelink'] = '<a href="' . $diff . $passShowAll . '&ignorews=1">' . $lang['IGNOREWHITESPACE'] . '</a>'; } // Get the contents of the two files $newerFile = tempnam($config->getTempDir(), ''); $highlightedNew = $svnrep->getFileContents($history->entries[0]->path, $newerFile, $history->entries[0]->rev, $peg, '', true); $olderFile = tempnam($config->getTempDir(), ''); $highlightedOld = $svnrep->getFileContents($history->entries[1]->path, $olderFile, $history->entries[1]->rev, $peg, '', true); // TODO: Figured out why diffs across a move/rename are currently broken. $ent = !$highlightedNew && !$highlightedOld; $listing = do_diff($all, $ignoreWhitespace, $ent, $newerFile, $olderFile); // Remove our temporary files @unlink($newerFile); @unlink($olderFile); } } if (!$rep->hasReadAccess($path, false)) { $vars['error'] = $lang['NOACCESS']; } } $vars['template'] = 'diff'; $template = $rep ? $rep->getTemplatePath() : $config->getTemplatePath(); parseTemplate($template . 'header.tmpl', $vars, $listing); parseTemplate($template . 'diff.tmpl', $vars, $listing); parseTemplate($template . 'footer.tmpl', $vars, $listing);
public function requestResources($format = 'json') { $accountId = $this->input->get_post('account_id', TRUE); $gameId = $this->input->get_post('game_id', TRUE); if (!empty($accountId)) { /* * 检测参数合法性 */ $authToken = $this->authKey[$gameId]['auth_key']; $check = array($accountId, $gameId); //$this->load->helper('security'); //exit(do_hash(do_hash(implode('|||', $check) . '|||' . $authToken, 'md5'))); if (!$this->param_check->check($check, $authToken)) { $jsonData = array('flag' => 0x1, 'message' => 0); echo $this->return_format->format($jsonData, $format); $logParameter = array('log_action' => 'PARAM_INVALID', 'account_guid' => '', 'account_name' => $accountId); $this->logs->write($logParameter); exit; } /* * 检查完毕 */ $this->load->model('data/resources', 'resource'); $this->load->helper('template'); $this->load->config('game_init_data'); $sql = $this->config->item('sql_update_resource_amount'); $parser = array('update_time' => $this->config->item('resource_update_time'), 'account_id' => $accountId); $this->resource->query(parseTemplate($sql, $parser)); $result = $this->resource->get($accountId); if ($result != FALSE) { $jsonData = array('flag' => 0x1, 'message' => 1, 'resource_list' => $result); echo $this->return_format->format($jsonData, $format); $logParameter = array('log_action' => 'ACCOUNT_REQUEST_RESOURCE_SUCCESS', 'account_guid' => '', 'account_name' => $accountId); $this->logs->write($logParameter); } else { $jsonData = array('flag' => 0x1, 'message' => -1); echo $this->return_format->format($jsonData, $format); $logParameter = array('log_action' => 'ACCOUNT_ERROR_NO_ACCOUNTID', 'account_guid' => '', 'account_name' => $accountId); $this->logs->write($logParameter); } } else { $jsonData = array('flag' => 0x1, 'message' => -99); echo $this->return_format->format($jsonData, $format); $logParameter = array('log_action' => 'ACCOUNT_ERROR_NO_PARAM', 'account_guid' => '', 'account_name' => ''); $this->logs->write($logParameter); } }
function wikiplugin_showreference($data, $params) { global $prefs; $params['title'] = trim($params['title']); $params['showtitle'] = trim($params['showtitle']); $params['hlevel'] = trim($params['hlevel']); $title = 'Bibliography'; if (isset($params['title']) && $params['title'] != '') { $title = $params['title']; } if (isset($params['showtitle'])) { $showtitle = $params['showtitle']; } if ($showtitle == 'yes' || $showtitle == '') { $showtitle = 1; } else { $showtitle = 0; } $hlevel_start = '<h1>'; $hlevel_end = '</h1>'; if (isset($params['hlevel']) && $params['hlevel'] != '') { if ($params['hlevel'] != '0') { $hlevel_start = '<h' . $params['hlevel'] . '>'; $hlevel_end = '</h' . $params['hlevel'] . '>'; } else { $hlevel_start = ''; $hlevel_end = ''; } } else { $hlevel_start = '<h1>'; $hlevel_end = '</h1>'; } if ($prefs['wikiplugin_showreference'] == 'y') { $page_id = $GLOBALS['info']['page_id']; $tags = array('~biblio_code~' => 'biblio_code', '~author~' => 'author', '~title~' => 'title', '~year~' => 'year', '~part~' => 'part', '~uri~' => 'uri', '~code~' => 'code', '~publisher~' => 'publisher', '~location~' => 'location'); $htm = ''; $referenceslib = TikiLib::lib('references'); $references = $referenceslib->list_assoc_references($page_id); $referencesData = array(); $is_global = 1; if (isset($GLOBALS['referencesData']) && is_array($GLOBALS['referencesData'])) { $referencesData = $GLOBALS['referencesData']; $is_global = 1; } else { foreach ($references['data'] as $data) { array_push($referencesData, $data['biblio_code']); } $is_global = 0; } if (is_array($referencesData)) { $referencesData = array_unique($referencesData); $htm .= '<div class="references">'; if ($showtitle) { $htm .= $hlevel_start . $title . $hlevel_end; } $htm .= '<hr>'; $htm .= '<ul style="list-style: none outside none;">'; if (count($referencesData)) { $values = $referenceslib->get_reference_from_code_and_page($referencesData, $page_id); } else { $values = array(); } if ($is_global) { $excluded = array(); foreach ($references['data'] as $key => $value) { if (!array_key_exists($key, $values['data'])) { $excluded[$key] = $references['data'][$key]['biblio_code']; } } foreach ($excluded as $ex) { array_push($referencesData, $ex); } } foreach ($referencesData as $index => $ref) { $ref_no = $index + 1; $text = ''; $cssClass = ''; if (array_key_exists($ref, $values['data'])) { if ($values['data'][$ref]['style'] != '') { $cssClass = $values['data'][$ref]['style']; } $text = parseTemplate($tags, $ref, $values['data']); } else { if (array_key_exists($ref, $excluded)) { $text = parseTemplate($tags, $ref, $references['data']); } } $anchor = "<a name='" . $ref . "'> </a>"; if (strlen($text)) { $htm .= "<li class='" . $cssClass . "'>" . $anchor . $ref_no . ". " . $text . '</li>'; } else { $htm .= "<li class='" . $cssClass . "' style='font-style:italic'>" . $anchor . $ref_no . '. missing bibliography definition' . '</li>'; } } $htm .= '</ul>'; $htm .= '<hr>'; $htm .= '</div>'; } return $htm; } }
// Hook supported. $base_hook = array('hook_entity_presave' => 'entity_presave', 'hook_entity_update' => 'entity_update', 'hook_entity_view' => 'entity_view', 'hook_node_load' => 'node_load', 'hook_node_presave' => 'node_presave', 'hook_node_update' => 'node_update', 'hook_node_insert' => 'node_insert', 'hook_node_view' => 'node_view', 'hook_user_insert' => 'user_insert', 'hook_user_presave' => 'user_presave', 'hook_user_update' => 'user_update', 'hook_menu' => 'menu', 'hook_action_info' => 'action_info'); // Special case for 'model.module' file. if (!isset($_POST['hooks'])) { $data = str_replace('%HOOKS%', '', $data); } else { $hook_info = ''; foreach ($_POST['hooks'] as $key => $hook) { $hook_info .= "module_load_include('inc', '" . $_POST['machine_name'] . "', '" . $_POST['machine_name'] . "." . $base_hook[$hook] . "');" . PHP_EOL; parseTemplate('model.' . $base_hook[$hook] . '.inc', $dir, $replace_tokens); } $data = str_replace('%HOOKS%', $hook_info, $data); } file_put_contents($destination, $data); $files = array('model.install', 'model.features.inc', 'model.views_default.inc', 'model_modelentity.admin.inc', 'model_modelentity_type.admin.inc', 'templates/entities/modelentity.tpl.php', 'includes/Modelentity.inc', 'includes/ModelentityController.inc', 'includes/ModelentityType.inc', 'includes/ModelentityTypeController.inc', 'includes/views/model.views.inc', 'includes/views/modelentity_handler_link_field.inc', 'includes/views/modelentity_handler_modelentity_operations_field.inc', 'includes/views/modelentity_handler_edit_link_field.inc', 'includes/views/modelentity_handler_delete_link_field.inc'); foreach ($files as $file) { parseTemplate($file, $dir, $replace_tokens); } // Create and send zip file. $file = createZipFile($dir, $dir . '.zip', true); $file_name = basename($dir . '.zip'); header('Content-Type: application/zip'); header("Content-Disposition: attachment; filename={$file_name}"); header('Content-Length: ' . filesize($dir . '.zip')); readfile($dir . '.zip'); exit; } // Detect language. $language = detectLanguage(array('en', 'fr'), 'en'); // Display form generator. include 'generator/index.html';
<?php $GLOBALS["KAV4PROXY_NOSESSION"]=true; $GLOBALS["RELOAD"]=false; $_GET["LOGFILE"]="/var/log/artica-postfix/dansguardian.compile.log"; if(posix_getuid()<>0){parseTemplate();die();} include_once(dirname(__FILE__)."/ressources/class.user.inc"); include_once(dirname(__FILE__)."/ressources/class.groups.inc"); include_once(dirname(__FILE__)."/ressources/class.ldap.inc"); include_once(dirname(__FILE__)."/ressources/class.system.network.inc"); include_once(dirname(__FILE__)."/ressources/class.dansguardian.inc"); include_once(dirname(__FILE__)."/ressources/class.squid.inc"); include_once(dirname(__FILE__)."/ressources/class.squidguard.inc"); include_once(dirname(__FILE__)."/ressources/class.mysql.inc"); include_once(dirname(__FILE__).'/framework/class.unix.inc'); include_once(dirname(__FILE__)."/framework/frame.class.inc"); if(posix_getuid()<>0){die("Cannot be used in web server mode\n\n");} if(count($argv)>0){ $imploded=implode(" ",$argv); if(preg_match("#--verbose#",$imploded)){$GLOBALS["VERBOSE"]=true;$GLOBALS["debug"]=true;ini_set_verbosed(); } if(preg_match("#--reload#",$imploded)){$GLOBALS["RELOAD"]=true;} if(preg_match("#--shalla#",$imploded)){$GLOBALS["SHALLA"]=true;} if(preg_match("#--catto=(.+?)\s+#",$imploded,$re)){$GLOBALS["CATTO"]=$re[1];} if($argv[1]=="--inject"){echo inject($argv[2],$argv[3]);exit;} if($argv[1]=="--conf"){echo conf();exit;} if($argv[1]=="--ufdbguard-compile"){echo UFDBGUARD_COMPILE_SINGLE_DB($argv[2]);exit;} if($argv[1]=="--ufdbguard-dbs"){echo UFDBGUARD_COMPILE_DB();exit;} if($argv[1]=="--ufdbguard-miss-dbs"){echo ufdbguard_recompile_missing_dbs();exit;} if($argv[1]=="--ufdbguard-recompile-dbs"){echo ufdbguard_recompile_dbs();exit;}
function processData($data, $path, $file) { // Check if the file contained a class definition if ($data[0]['type'] === 'class') { $outFile = OUT_FOLDER . '/' . $data[0]['name'] . '.html'; foreach ($data as $key => $item) { //var_dump($item); switch ($item['type']) { case 'class': // Write the class header details file_put_contents($outFile, parseTemplate(file_get_contents(TEMPLATES_FOLDER . '/classHeader.html'), $item, $path, $file)); file_put_contents($outFile, parseTemplate(file_get_contents(TEMPLATES_FOLDER . '/classBody.html'), $item, $path, $file), FILE_APPEND); break; case 'function': file_put_contents($outFile, parseTemplate(file_get_contents(TEMPLATES_FOLDER . '/functionBody.html'), $item, $path, $file), FILE_APPEND); break; } } file_put_contents($outFile, parseTemplate(file_get_contents(TEMPLATES_FOLDER . '/classFooter.html'), $item, $path, $file), FILE_APPEND); } else { $outFile = OUT_FOLDER . '/globals.html'; } }
function GetContent($part, &$attachments, $post_id, $poster, $config) { extract($config); global $charset, $encoding; /* if (!function_exists(imap_mime_header_decode)) echo "you need to install the php-imap extension for full functionality, including mime header decoding\n"; */ $meta_return = NULL; echo "primary= " . $part->ctype_primary . ", secondary = " . $part->ctype_secondary . "\n"; DecodeBase64Part($part); if (BannedFileName($part->ctype_parameters['name'], $banned_files_list)) { return NULL; } if ($part->ctype_primary == "application" && $part->ctype_secondary == "octet-stream") { if ($part->disposition == "attachment") { $image_endings = array("jpg", "png", "gif", "jpeg", "pjpeg"); foreach ($image_endings as $type) { if (eregi(".{$type}\$", $part->d_parameters["filename"])) { $part->ctype_primary = "image"; $part->ctype_secondary = $type; break; } } } else { $mimeDecodedEmail = DecodeMIMEMail($part->body); FilterTextParts($mimeDecodedEmail, $prefer_text_type); foreach ($mimeDecodedEmail->parts as $section) { $meta_return .= GetContent($section, $attachments, $post_id, $poster, $config); } } } if ($part->ctype_primary == "multipart" && $part->ctype_secondary == "appledouble") { $mimeDecodedEmail = DecodeMIMEMail("Content-Type: multipart/mixed; boundary=" . $part->ctype_parameters["boundary"] . "\n" . $part->body); FilterTextParts($mimeDecodedEmail, $prefer_text_type); FilterAppleFile($mimeDecodedEmail); foreach ($mimeDecodedEmail->parts as $section) { $meta_return .= GetContent($section, $attachments, $post_id, $poster, $config); } } else { // fix filename (remove non-standard characters) $filename = preg_replace("/[^\t\n\r -]/", "", $part->ctype_parameters['name']); switch (strtolower($part->ctype_primary)) { case 'multipart': FilterTextParts($part, $prefer_text_type); foreach ($part->parts as $section) { $meta_return .= GetContent($section, $attachments, $post_id, $poster, $config); } break; case 'text': $tmpcharset = trim($part->ctype_parameters['charset']); if ($tmpcharset != '') { $charset = $tmpcharset; } $tmpencoding = trim($part->headers['content-transfer-encoding']); if ($tmpencoding != '') { $encoding = $tmpencoding; } $part->body = HandleMessageEncoding($part->headers["content-transfer-encoding"], $part->ctype_parameters["charset"], $part->body, $message_encoding, $message_dequote); //go through each sub-section if ($part->ctype_secondary == 'enriched') { //convert enriched text to HTML $meta_return .= etf2HTML($part->body) . "\n"; } elseif ($part->ctype_secondary == 'html') { //strip excess HTML //$meta_return .= HTML2HTML($part->body ) . "\n"; $meta_return .= $part->body . "\n"; } else { //regular text, so just strip the pgp signature if (ALLOW_HTML_IN_BODY) { $meta_return .= $part->body . "\n"; } else { $meta_return .= htmlentities($part->body) . "\n"; } $meta_return = StripPGP($meta_return); } break; case 'image': $file_id = postie_media_handle_upload($part, $post_id, $poster); $file = wp_get_attachment_url($file_id); $cid = trim($part->headers["content-id"], "<>"); //cids are in <cid> $the_post = get_post($file_id); $attachments["html"][$filename] = parseTemplate($file_id, $part->ctype_primary, $imagetemplate); if ($cid) { $attachments["cids"][$cid] = array($file, count($attachments["html"]) - 1); } break; case 'audio': $file_id = postie_media_handle_upload($part, $post_id, $poster); $file = wp_get_attachment_url($file_id); $cid = trim($part->headers["content-id"], "<>"); //cids are in <cid> if (in_array($part->ctype_secondary, $audiotypes)) { $audioTemplate = $audiotemplate; } else { $icon = chooseAttachmentIcon($file, $part->ctype_primary, $part->ctype_secondary, $icon_set, $icon_size); $audioTemplate = '<a href="{FILELINK}">' . $icon . '{FILENAME}</a>'; } $attachments["html"][$filename] = parseTemplate($file_id, $part->ctype_primary, $audioTemplate); break; case 'video': $file_id = postie_media_handle_upload($part, $post_id, $poster); $file = wp_get_attachment_url($file_id); $cid = trim($part->headers["content-id"], "<>"); //cids are in <cid> if (in_array(strtolower($part->ctype_secondary), $video1types)) { $videoTemplate = $video1template; } elseif (in_array(strtolower($part->ctype_secondary), $video2types)) { $videoTemplate = $video2template; } else { $icon = chooseAttachmentIcon($file, $part->ctype_primary, $part->ctype_secondary, $icon_set, $icon_size); $videoTemplate = '<a href="{FILELINK}">' . $icon . '{FILENAME}</a>'; } $attachments["html"][$filename] = parseTemplate($file_id, $part->ctype_primary, $videoTemplate); //echo "videoTemplate = $videoTemplate\n"; break; default: if (in_array(strtolower($part->ctype_primary), $supported_file_types)) { //pgp signature - then forget it if ($part->ctype_secondary == 'pgp-signature') { break; } $file_id = postie_media_handle_upload($part, $post_id, $poster); $file = wp_get_attachment_url($file_id); $cid = trim($part->headers["content-id"], "<>"); //cids are in <cid> $icon = chooseAttachmentIcon($file, $part->ctype_primary, $part->ctype_secondary, $icon_set, $icon_size); $attachments["html"][$filename] = "<a href='{$file}'>" . $icon . $filename . '</a>' . "\n"; if ($cid) { $attachments["cids"][$cid] = array($file, count($attachments["html"]) - 1); } } break; } } return $meta_return; }
function GetContent($part, &$attachments, $post_id, $poster, $config) { extract($config); //global $charset, $encoding; DebugEcho('----'); $meta_return = ''; if (property_exists($part, "ctype_primary")) { DebugEcho("GetContent: primary= " . $part->ctype_primary . ", secondary = " . $part->ctype_secondary); //DebugDump($part); } DecodeBase64Part($part); //look for banned file names if (property_exists($part, 'ctype_parameters') && is_array($part->ctype_parameters) && array_key_exists('name', $part->ctype_parameters)) { if (isBannedFileName($part->ctype_parameters['name'], $banned_files_list)) { return NULL; } } if (property_exists($part, "ctype_primary") && $part->ctype_primary == "application" && $part->ctype_secondary == "octet-stream") { if (property_exists($part, 'disposition') && $part->disposition == "attachment") { //nothing } else { DebugEcho("GetContent: decoding application/octet-stream"); $mimeDecodedEmail = DecodeMIMEMail($part->body); filter_PreferedText($mimeDecodedEmail, $prefer_text_type); foreach ($mimeDecodedEmail->parts as $section) { $meta_return .= GetContent($section, $attachments, $post_id, $poster, $config); } } } if (property_exists($part, "ctype_primary") && $part->ctype_primary == "multipart" && $part->ctype_secondary == "appledouble") { DebugEcho("multipart appledouble"); $mimeDecodedEmail = DecodeMIMEMail("Content-Type: multipart/mixed; boundary=" . $part->ctype_parameters["boundary"] . "\n" . $part->body); filter_PreferedText($mimeDecodedEmail, $prefer_text_type); filter_AppleFile($mimeDecodedEmail); foreach ($mimeDecodedEmail->parts as $section) { $meta_return .= GetContent($section, $attachments, $post_id, $poster, $config); } } else { $filename = ""; if (property_exists($part, 'ctype_parameters') && is_array($part->ctype_parameters) && array_key_exists('name', $part->ctype_parameters)) { $filename = $part->ctype_parameters['name']; } elseif (property_exists($part, 'd_parameters') && is_array($part->d_parameters) && array_key_exists('filename', $part->d_parameters)) { $filename = $part->d_parameters['filename']; } $filename = sanitize_file_name($filename); $fileext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); DebugEcho("GetContent: file name '{$filename}'"); DebugEcho("GetContent: extension '{$fileext}'"); $mimetype_primary = ""; $mimetype_secondary = ""; if (property_exists($part, "ctype_primary")) { $mimetype_primary = strtolower($part->ctype_primary); } if (property_exists($part, "ctype_secondary")) { $mimetype_secondary = strtolower($part->ctype_secondary); } $typeinfo = wp_check_filetype($filename); //DebugDump($typeinfo); if (!empty($typeinfo['type'])) { DebugEcho("GetContent: secondary lookup found " . $typeinfo['type']); $mimeparts = explode('/', strtolower($typeinfo['type'])); $mimetype_primary = $mimeparts[0]; $mimetype_secondary = $mimeparts[1]; } else { DebugEcho("GetContent: secondary lookup failed, checking configured extensions"); if (in_array($fileext, $audiotypes)) { DebugEcho("GetContent: found audio extension"); $mimetype_primary = 'audio'; $mimetype_secondary = $fileext; } elseif (in_array($fileext, array_merge($video1types, $video2types))) { DebugEcho("GetContent: found video extension"); $mimetype_primary = 'video'; $mimetype_secondary = $fileext; } else { DebugEcho("GetContent: found no extension"); } } DebugEcho("GetContent: mimetype {$mimetype_primary}/{$mimetype_secondary}"); switch ($mimetype_primary) { case 'multipart': DebugEcho("multipart: " . count($part->parts)); //DebugDump($part); filter_PreferedText($part, $prefer_text_type); foreach ($part->parts as $section) { //DebugDump($section->headers); $meta_return .= GetContent($section, $attachments, $post_id, $poster, $config); } break; case 'text': DebugEcho("ctype_primary: text"); //DebugDump($part); $charset = ""; if (property_exists($part, 'ctype_parameters') && array_key_exists('charset', $part->ctype_parameters) && !empty($part->ctype_parameters['charset'])) { $charset = $part->ctype_parameters['charset']; DebugEcho("charset: {$charset}"); } $encoding = ""; if (array_key_exists('content-transfer-encoding', $part->headers) && !empty($part->headers['content-transfer-encoding'])) { $encoding = $part->headers['content-transfer-encoding']; DebugEcho("encoding: {$encoding}"); } if (array_key_exists('content-transfer-encoding', $part->headers)) { //DebugDump($part); $part->body = HandleMessageEncoding($encoding, $charset, $part->body, $message_encoding, $message_dequote); if (!empty($charset)) { $part->ctype_parameters['charset'] = ""; //reset so we don't double decode } //DebugDump($part); } if (array_key_exists('disposition', $part) && $part->disposition == 'attachment') { DebugEcho("text Attachement: {$filename}"); if (!preg_match('/ATT\\d\\d\\d\\d\\d.txt/i', $filename)) { $file_id = postie_media_handle_upload($part, $post_id, $poster, $generate_thumbnails); if (!is_wp_error($file_id)) { $file = wp_get_attachment_url($file_id); $icon = chooseAttachmentIcon($file, $mimetype_primary, $mimetype_secondary, $icon_set, $icon_size); $attachments["html"][$filename] = "<a href='{$file}'>" . $icon . $filename . '</a>' . "\n"; DebugEcho("text attachment: adding '{$filename}'"); } else { LogInfo($file_id->get_error_message()); } } else { DebugEcho("text attachment: skipping '{$filename}'"); } } else { //go through each sub-section if ($mimetype_secondary == 'enriched') { //convert enriched text to HTML DebugEcho("enriched"); $meta_return .= filter_Etf2HTML($part->body) . "\n"; } elseif ($mimetype_secondary == 'html') { //strip excess HTML DebugEcho("html"); $meta_return .= filter_CleanHtml($part->body) . "\n"; } elseif ($mimetype_secondary == 'plain') { DebugEcho("plain text"); //DebugDump($part); DebugEcho("body text"); if ($allow_html_in_body) { DebugEcho("html allowed"); $meta_return .= $part->body; //$meta_return = "<div>$meta_return</div>\n"; } else { DebugEcho("html not allowed (htmlentities)"); $meta_return .= htmlentities($part->body); } $meta_return = filter_StripPGP($meta_return); //DebugEcho("meta return: $meta_return"); } else { DebugEcho("text Attachement wo disposition: {$filename}"); $file_id = postie_media_handle_upload($part, $post_id, $poster); if (!is_wp_error($file_id)) { $file = wp_get_attachment_url($file_id); $icon = chooseAttachmentIcon($file, $mimetype_primary, $mimetype_secondary, $icon_set, $icon_size); $attachments["html"][$filename] = "<a href='{$file}'>" . $icon . $filename . '</a>' . "\n"; } else { LogInfo($file_id->get_error_message()); } } } break; case 'image': DebugEcho("image Attachement: {$filename}"); $file_id = postie_media_handle_upload($part, $post_id, $poster, $generate_thumbnails); if (!is_wp_error($file_id)) { //featured image logic //set the first image we come across as the featured image DebugEcho("has_post_thumbnail: " . has_post_thumbnail($post_id)); //DebugEcho("get_the_post_thumbnail: " .get_the_post_thumbnail($post_id)); if ($featured_image && !has_post_thumbnail($post_id)) { DebugEcho("featured image: {$file_id}"); set_post_thumbnail($post_id, $file_id); } $file = wp_get_attachment_url($file_id); $cid = ""; if (array_key_exists('content-id', $part->headers)) { $cid = trim($part->headers["content-id"], "<>"); DebugEcho("found cid: {$cid}"); } $the_post = get_post($file_id); $attachments["html"][$filename] = parseTemplate($file_id, $mimetype_primary, $imagetemplate, $filename); if ($cid) { $attachments["cids"][$cid] = array($file, count($attachments["html"]) - 1); DebugEcho("CID Attachement: {$cid}"); } } else { LogInfo("image error: " . $file_id->get_error_message()); } break; case 'audio': //DebugDump($part->headers); DebugEcho("audio Attachement: {$filename}"); $file_id = postie_media_handle_upload($part, $post_id, $poster, $generate_thumbnails); if (!is_wp_error($file_id)) { $file = wp_get_attachment_url($file_id); $cid = ""; if (array_key_exists('content-id', $part->headers)) { $cid = trim($part->headers["content-id"], "<>"); DebugEcho("audio Attachement cid: {$cid}"); } if (in_array($fileext, $audiotypes)) { DebugEcho("using audio template: {$mimetype_secondary}"); $audioTemplate = $audiotemplate; } else { DebugEcho("using default audio template: {$mimetype_secondary}"); $icon = chooseAttachmentIcon($file, $mimetype_primary, $mimetype_secondary, $icon_set, $icon_size); $audioTemplate = '<a href="{FILELINK}">' . $icon . '{FILENAME}</a>'; } $attachments["html"][$filename] = parseTemplate($file_id, $mimetype_primary, $audioTemplate, $filename); } else { LogInfo("audio error: " . $file_id->get_error_message()); } break; case 'video': DebugEcho("video Attachement: {$filename}"); $file_id = postie_media_handle_upload($part, $post_id, $poster, $generate_thumbnails); if (!is_wp_error($file_id)) { $file = wp_get_attachment_url($file_id); $cid = ""; if (array_key_exists('content-id', $part->headers)) { $cid = trim($part->headers["content-id"], "<>"); DebugEcho("video Attachement cid: {$cid}"); } //DebugDump($part); if (in_array($fileext, $video1types)) { DebugEcho("using video1 template: {$fileext}"); $videoTemplate = $video1template; } elseif (in_array($fileext, $video2types)) { DebugEcho("using video2 template: {$fileext}"); $videoTemplate = $video2template; } else { DebugEcho("using default template: {$fileext}"); $icon = chooseAttachmentIcon($file, $mimetype_primary, $mimetype_secondary, $icon_set, $icon_size); $videoTemplate = '<a href="{FILELINK}">' . $icon . '{FILENAME}</a>'; } $attachments["html"][$filename] = parseTemplate($file_id, $mimetype_primary, $videoTemplate, $filename); //echo "videoTemplate = $videoTemplate\n"; } else { LogInfo($file_id->get_error_message()); } break; default: DebugEcho("found file type: " . $mimetype_primary); if (in_array($mimetype_primary, $supported_file_types)) { //pgp signature - then forget it if ($mimetype_secondary == 'pgp-signature') { DebugEcho("found pgp-signature - done"); break; } $file_id = postie_media_handle_upload($part, $post_id, $poster, $generate_thumbnails); if (!is_wp_error($file_id)) { $file = wp_get_attachment_url($file_id); DebugEcho("uploaded {$file_id} ({$file})"); $icon = chooseAttachmentIcon($file, $mimetype_primary, $mimetype_secondary, $icon_set, $icon_size); DebugEcho("default: {$icon} {$filename}"); $attachments["html"][$filename] = parseTemplate($file_id, $mimetype_primary, $generaltemplate, $filename, $icon); if (array_key_exists('content-id', $part->headers)) { $cid = trim($part->headers["content-id"], "<>"); if ($cid) { $attachments["cids"][$cid] = array($file, count($attachments["html"]) - 1); } } else { DebugEcho("No content-id"); } } else { LogInfo($file_id->get_error_message()); } } else { DebugEcho("Not in supported filetype list"); DebugDump($supported_file_types); } break; } } DebugEcho("meta_return: " . substr($meta_return, 0, 500)); DebugEcho("===="); return $meta_return; }
} foreach (get_object_vars($my) as $key => $val) { if (is_string($key)) { array_push($variables, $key); $values[$key] = $val; } } // add the season name to the email variables $query = "SELECT name FROM #__jtips_seasons WHERE id = '" . $this->season_id . "'"; $database->setQuery($query); $season = $database->loadResult(); $values['competition'] = $season; $values['season'] = $season; /** * BUG 76: the parseTemplate function was taking * the AdminNotifySubject as the first parameter. * Changed to be the actual message body */ $body = parseTemplate($jTips['AdminNotifyMessage'], $variables, $values); if (jTipsMail($jTips['AdminNotifyFromEmail'], $jTips['AdminNotifyFromName'], $jTips['AdminNotifyToEmail'], $jTips['AdminNotifySubject'], $body)) { jTipsLogger::_log('email sent to administration', 'INFO'); } else { jTipsLogger::_log('failed to send email to administration', 'ERROR'); } } if ($jTips['AutoReg']) { $message = $jLang['_COM_JOIN_COMPLETE']; } else { $message = $jLang['_COM_JOIN_PENDING']; } jTipsRedirect('index.php?option=com_jtips&Itemid=' . jTipsGetParam($_REQUEST, 'Itemid', '') . '&season=' . $season_id, $message);