You are not logged in.
Pages: 1
Thanks, Tim, we're exploring further. Thanks so much!! Have a super day.
Good morning, Tim,
The file throwing the error sits in our /www/core/admin/ajax/file-browser/upload.php
Mozilla FireBug says...
Error (path = /admin/...upload/ (line 1) = SyntaxError: expected expression, got '<'
<br>
Any ideas, Tim? Absolutely no rush, as we choose to work with SFTP uploading of files for now, since the photo files require art work by my team anyways.
Warm greetings, and patiently awaiting your thoughts,
Hans
<?
$storage = new BigTreeStorage;
// If we're replacing an existing file, find out its name
if (isset($_POST["replace"])) {
$admin->requireLevel(1);
$replacing = $admin->getResource($_POST["replace"]);
$pinfo = BigTree::pathInfo($replacing["file"]);
$replacing = $pinfo["basename"];
// Set a recently replaced cookie so we don't use cached images
setcookie('bigtree_admin[recently_replaced_file]',true,time()+300,str_replace(DOMAIN,"",WWW_ROOT));
} else {
$replacing = false;
}
$folder = isset($_POST["folder"]) ? sqlescape($_POST["folder"]) : false;
$errors = array();
$successes = 0;
// This is an iFrame, so we're going to call the parent from it.
echo '<html><body><script>';
// If the user doesn't have permission to upload to this folder, throw an error.
$perm = $admin->getResourceFolderPermission($folder);
if ($perm != "p") {
echo 'parent.BigTreeFileManager.uploadError("You do not have permission to upload to this folder.");';
} else {
foreach ($_FILES["files"]["tmp_name"] as $number => $temp_name) {
$error = $_FILES["files"]["error"][$number];
$file_name = $replacing ? $replacing : $_FILES["files"]["name"][$number];
// Throw a growl error
if ($error) {
$file_name = htmlspecialchars($file_name);
if ($error == 2 || $error == 1) {
$errors[] = $file_name." was too large ".BigTree::formatBytes(BigTree::uploadMaxFileSize())." max)";
} else {
$errors[] = "Uploading $file_name failed (unknown error)";
}
// File successfully uploaded
} elseif ($temp_name) {
// See if this file already exists
if ($replacing || !$admin->matchResourceMD5($temp_name,$_POST["folder"])) {
$md5 = md5_file($temp_name);
// Get the name and file extension
$n = strrev($file_name);
$extension = strtolower(strrev(substr($n,0,strpos($n,"."))));
// See if it's an image
list($iwidth,$iheight,$itype,$iattr) = getimagesize($temp_name);
// It's a regular file
if ($itype != IMAGETYPE_GIF && $itype != IMAGETYPE_JPEG && $itype != IMAGETYPE_PNG) {
$type = "file";
if ($replacing) {
$file = $storage->replace($temp_name,$file_name,"files/resources/");
} else {
$file = $storage->store($temp_name,$file_name,"files/resources/");
}
// If we failed, either cloud storage upload failed, directory permissions are bad, or the file type isn't permitted
if (!$file) {
if ($storage->DisabledFileError) {
$errors[] = "$file_name has a disallowed extension: $extension.";
} else {
$errors[] = "Uploading $file_name failed (unknown error).";
}
// Otherwise make the database entry for the file we uplaoded.
} else {
if (!$replacing) {
$admin->createResource($folder,$file,$md5,$file_name,$extension);
}
}
// It's an image
} else {
$type = "image";
// We're going to create a list view and detail view thumbnail plus whatever we're requesting to have through Settings
$thumbnails_to_create = array(
"bigtree_internal_list" => array("width" => 100, "height" => 100, "prefix" => "bigtree_list_thumb_"),
"bigtree_internal_detail" => array("width" => 190, "height" => 145, "prefix" => "bigtree_detail_thumb_")
);
$more_thumb_types = $cms->getSetting("bigtree-file-manager-thumbnail-sizes");
if (is_array($more_thumb_types)) {
foreach ($more_thumb_types as $thumb) {
$thumbnails_to_create[$thumb["title"]] = $thumb;
}
}
// Do lots of image awesomesauce.
$itype_exts = array(IMAGETYPE_PNG => ".png", IMAGETYPE_JPEG => ".jpg", IMAGETYPE_GIF => ".gif");
$first_copy = $temp_name;
list($iwidth,$iheight,$itype,$iattr) = getimagesize($first_copy);
foreach ($thumbnails_to_create as $thumb) {
// We don't want to add multiple errors and we also don't want to waste effort getting thumbnail sizes if we already failed.
if (!$error) {
$sizes = BigTree::getThumbnailSizes($first_copy,$thumb["width"],$thumb["height"]);
if (!BigTree::imageManipulationMemoryAvailable($first_copy,$sizes[3],$sizes[4],$iwidth,$iheight)) {
$errors[] = "$file_name is too large for the server to manipulate. Please upload a smaller version of this image.";
unlink($first_copy);
}
}
}
if (!$error) {
// Now let's make the thumbnails we need for the image manager
$thumbs = array();
$pinfo = BigTree::pathInfo($file_name);
// Create a bunch of thumbnails
foreach ($thumbnails_to_create as $key => $thumb) {
if ($iwidth > $thumb["width"] || $iheight > $thumb["height"]) {
$temp_thumb = SITE_ROOT."files/".uniqid("temp-").$itype_exts[$itype];
BigTree::createThumbnail($first_copy,$temp_thumb,$thumb["width"],$thumb["height"]);
if ($replacing) {
$file = $storage->replace($temp_thumb,$thumb["prefix"].$pinfo["basename"],"files/resources/");
} else {
$file = $storage->store($temp_thumb,$thumb["prefix"].$pinfo["basename"],"files/resources/");
}
$thumbs[$key] = $file;
}
}
// Upload the original to the proper place.
if ($replacing) {
$file = $storage->replace($first_copy,$file_name,"files/resources/");
} else {
$file = $storage->store($first_copy,$file_name,"files/resources/");
}
if (!$file) {
$errors[] = "Uploading ".htmlspecialchars($file_name)." failed (unknown error).";
} else {
if (!$replacing) {
$admin->createResource($folder,$file,$md5,$file_name,$extension,"on",$iheight,$iwidth,$thumbs);
} else {
$admin->updateResource($_POST["replace"],array(
"date" => date("Y-m-d H:i:s"),
"md5" => $md5,
"height" => $iheight,
"width" => $iwidth,
"thumbs" => BigTree::json($thumbs)
));
}
}
}
}
}
}
}
}
if (count($errors)) {
$uploaded = count($_FILES["files"]["tmp_name"]) - count($errors);
$success_message = "$uploaded file".($uploaded != 1 ? "s" : "")." uploaded successfully.";
echo 'parent.BigTreeFileManager.uploadError("'.implode("<br />",$errors).'","'.$success_message.'");</script></body></html>';
} else {
echo 'parent.BigTreeFileManager.finishedUpload('.json_encode($errors).');</script></body></html>';
}
?>
Hi Tim,
Thanks for responding :-) Awesome! Hope you are well!
We're running Version 4.2.8
I'll share your info with our tasked engineer and will get back to you.
Thanks!
Hans
Dear BigTree users,
We have build another BigTree driven site, and we feel 100% comfortable and seasoned with BigTree. We've developed custom modules, etc.
BUT... we had never used the insert image > upload a file of the WYSIWYG interface. Simply never had a need for it.
On our latest site we do have that need, and it isn't working. Click upload and it stalls right there. Folder permissions on the server are fine.
Any idea where we can hunt to solve this?
Hope to hear from you, with warm regards,
Hans
Thanks, Tim. I guess our best bet than is to place the sitemap generator in /site/, as you seem to suggest it should render. A quick test resulted in this https://www.--bla bla--.com/generator/ showing Hello
So we should be in business :-)
Thanks so much, Tim. Still enjoying BigTree. Hope all is well on the East Coast.
Warm greetings,
Hans
Hello Tim and colleagues,
We bumped into two small issues on new client site https://www.---bla bla bla--.com/
We have completed SEO optimization for a number of pages and were unable to upload a google verification .html, as it immediately directs the visitor to a Page not Found, as that url https://www.---bla bla bla---.com/12121 … nFile.html cannot be found.
Likewise, we have a sitemap generator running under https://www.---bla bla bla---.com/generator/ and this too gets redirected as "cannot be found"
Our htaccess is this
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://www.--- bla bla bla ---.com/$1 [R=301,L]
</IfModule>
RewriteEngine On
RewriteRule ^favicon.ico - [L]
RewriteRule ^PDF/* - [L]
RewriteRule ^assets/* - [L]
RewriteRule ^frontend/* - [L]
RewriteRule ^$ site/ [L]
Any ideas?
Thanks :-)
Hans
Hello Tim:
Turned out, the problem was in our own BigTree coding/deployment. Our Senior Engineer wrote this...
Hans, I understand the cause of this issue, and learned about the new Bigtree variable “bigtree_htaccess_url.” I now use that to identify homepage. Earlier we were comparing to WWW_ROOT url, which triggered the issue.
Hope this will be helpful for other developers too, Tim. You didn't see the problem anymore, because it has been resolved overnight.
Thanks so much for coaching us: Very much appreciated. We love BigTree. It is a most flexible and super clean platform,
Hans
You can test yourself. I left the /site/index.php you provided on the server...
www.thissite.com/site/index.php RESULTS = Array ( [bigtree_htaccess_url] => ) Array ( [0] => )
thissite.com/site/index.php RESULTS = Array ( [bigtree_htaccess_url] => ) Array ( [0] => )
Sadly not much difference here, Tim...
Yes, Tim, you can see it here...
*** You have to config your hosts file
== URLs REMOVED ==
Thanks for checking up on this. Eager to hear your thoughts...
Hans
Dear Team and BigTreeCMS Colleagues:
We have configured the /environment.php to reference $bigtree["config"]["domain"] = "http://www.examplesite.com"; everywhere.
When we call http://www.examplesite.com, BigTree will nicely serve the homepage, with homepage layout/styling.
But when we call http://examplesite.com, BigTree serves the contents inside our regular contents template layout/styling.
How can we fix this?
Hope to hear from you, with warm regards,
Hans
Thank you, Tim, for this detailed and well-motivated reply. I'm sure other users will benefit from this as well. Many thanks!
Dear Tim and Forum Colleagues:
After careful research we set our hearts on BigTreeCMS. We studied the code in our team, played around with several things, and then went ahead developing a low-risk web site. Normally we work with a development, QA, and production environment (all strictly separate and individual), but this time around only a dev and prod server. All files get committed into GIT. Except the obvious /custom/settings.php and /custom/environment.php. We further set up a mySQL data sync protocol, to sync source=dev to target=prod. All sounds logical, I hope.
JUST FOR YOUR INFO, OUR PROBLEM SCENARIO (FEEL FREE TO SKIP AND SCROLL DOWN TO MY GENERAL QUESTION)
For some internal reason, we first made a copy of dev to prod (manually via SFTP and a database copy process). This brought us to a more or less empty dev web site and 100% identical production web site. Both running nicely, including /admin areas.
Next thing that happens? We continue development on dev, and then complete development on dev > commit to Git > deploy to production > sync mySQL (sourceDEV to targetPROD), and??? dev and prod are not the same.
CSS differs
Images missing
How is this possible??
I do the CTO tasks in my team but was not around when our two engineers worked on this. But they do consistently experienced development work with all our development components (incl. version control).
MY GENERAL QUESTION
What is the recommended protocol to work with BigTreeCMS in a version controlled environment across several independent server instances (dev, qa, prod)?
What files/dirs to keep out of GIT?
What tables to sync?
What to also do and not forget?
How about this CSS compilation? Anything particularly to keep in mind when pushing/deploying BigTreeCMS across servers?
Hope to learn from you :-)
With warm regards,
Hans
PS.
Since posting my original question, our own research culminated in the following. Please correct and/or add your wisdom. Your input is much appreciated.
Keep the following files outside of Version Control
/custom/environmental.php
/custom/settings.php
Syncing mySQL
You can safely sync the BigTree mySQL data across different servers: Development; QA; Production.
Apache File Permissions
We experienced that without file permissions 775, releasing new GIT versions would render old contents (previous to current new release) onto the browser, unless we set the file permissions to 775.
Pages: 1