teEdu Development team – New Template Engine
After a lot of work I success to complete new template engine as a part of goodCMS project. I started this new CMS system with Smarty, but somewhere it doesn't fit mine needs. I use too many loops and conditionals in mine template files so it was so slow. So for few days I will released new Template Engine with codename TempEngine
Curl Ftp remote uploads (download/upload)
This function is part of teCommunication Server class that I decide to change and remove from class. So it would be sad not to publish it because someone would need it. Also there are educational purpose. Reason that I will remove this function from teCommunication Server class is problem with large files because this function use file_get_contents() PHP function to get remote file content. I will now try to explain code.
This is how you call function :
ftpCurlUploader(array('protocol', 'host/server', 'path', 'user_name', 'password', 'port'),
array('protocol', 'host/server', 'path', 'name', 'password', 'port'), 'file_to_upload');
protocol = ftp, ftps
host/server = server/host name or IP address
path = file path to folder where is file we download or upload eg. http://host/folder/file.txt
user_name = user name to login to server
password = password to login to server
port = port : ftp-21, ftps-990 or 21 (implicit or explicit ftps)
file_to_upload = file name on remote server with extension
ftpCurlUploader(array('protocol', 'host/server', 'path', 'user_name', 'password', 'port'),
'path_to_local_file', 'file_to_upload');
path_to_local_file = if you want to upload local file just set server path to local file.
function ftpCurlUploader($uploadPath, $filePath, $fileName){
if(extension_loaded('curl')) {
echo "PHP do not have curl extensions loaded. Please enable: curl extension.";
exit();
}
We just check if cURL extension is enabled on our server if not exit after error message.
if(is_array($filePath)){
$wFile = file_get_contents("".$filePath[0]."://".$filePath[3].":
".$filePath[4]."@".$filePath[1].":
".$filePath[5]."/".$filePath[2]."/".$fileName);
$chSize = filesize($tempFile);
Here we read entire external file into a string. And check file size. This is for remote file download/upload.
$tempFile = tempnam("tmp/", "test");
We make temporary file with name test. We can make folder tmp and set path to it or if path do not exist tempnam() will use system temporary folder. We use this file to put external file content in it.
$writeTempFile = fopen($tempFile, "w"); fwrite($writeTempFile, $wFile);
Open temporary file and write remote file content in it.
fclose($writeTempFile);
Close file.
}else{
$wFile = fopen($filePath.$fileName,'rb');
$chSize = filesize($filePath.$fileName);
}
This is option if we want just to upload local file to FTP.
if(!empty($uploadPath[2])){
$uploadPath[2] = $uploadPath[2]."/";
}else{
$uploadPath[2] = "";
}
If we have FTP access to domain root not server root.
Now we set up curl session for FTP upload I will explain some stuff but not all:
$curl_init = curl_init();
curl_setopt($curl_init, CURLOPT_URL, "".$uploadPath[0]."://". // ftp or ftps
$uploadPath[3].":". // ftp user name
$uploadPath[4]."@". // ftp password
$uploadPath[1].":". // ftp server
$uploadPath[5]."/". // ftp port ftp:21 ftps: 443
$uploadPath[2]. // ftp path eg. if you have direct access no needed just leave "" whan you call function
$fileName);
if( $uploadPath[0] == 'ftps'){
curl_setopt($curl_init, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_init, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl_init, CURLOPT_FTP_SSL, CURLOPT_FTPSSLAUTH);
curl_setopt($curl_init, CURLOPT_SSLVERSION, 3);
}
curl_setopt($curl_init, CURLOPT_UPLOAD, 1);
curl_setopt($curl_init, CURLOPT_INFILE, $wFile);
curl_setopt($curl_init, CURLOPT_INFILESIZE, $chSize);
curl_exec ($curl_init);
$curl_error = curl_error($curl_init);
curl_close ($curl_init);
if(!empty($curl_error)) {
$this->errorMessage($curl_error);
}
fclose($wFile);
}
Just concat code in some sections because I must break lines to be able to fit to screen. This is tested code working with ftp and ftps (ftp over ssl).
Script on sale – teCommunication Server
PHP based download, upload and remote download/upload data script.
Features:
REMOTE FILE TRANSFER:
- Support http, https, ftp, ftps protocols.
- Remote transfer files between different servers and protocols.
- Support remote login for all protocols.
- Support SSL certificates.
FILE SERVER:EMOTE FILE TRANSFER:
- Download data without accessing them 100% security.
- Serve data from other sources on your server. Also store remote data on your server and if same
data is needed serve from your server.
- Download, inline display, streaming, byte serving.
- On fly gzip compression. Support for zip, rar, bzip compression.
This is some features of this script. For now this is just PHP class. All features are in function.
This script is on sale for now price is 4000 dollars. As I continue developing this script with more features price will be higher.
teModal beta version
teModal beta version
At last I manage to almost finish teModal as part of teCMS system.
This is just testing version and there are a lot of bugs, mistakes, unoptimized code and performance issues, also lot of features must be added. But I decide to publish source code.Sorry if there are mistakes in this post, but I handle a lot of stuff and this is working version, also examples and source isn't perfect but you can use it for demonstration.
teModal is released under the MIT License.
History:
teModal is build on Prototype and Scriptaculous Frameworks as whole teCMS system. Good or bad I do not have time to build mine JS Framework and I work for some time with them.
Features:
For now teModal can handle:
- inline data from title tag
- inline data from hidden element
- external files content
- PHP requests, on same host and cross site over CURL
- external web pages in iframe
- images
Few things more. I guess interesting. After you open teModal page in background is static it's not possible to scroll page content. Also modal window have auto dimensions, means always fit to actual browser window dimensions. Complete content is adjusting and teModal is always on the browser screen center. teModal is resizing with browser window resize. There are feature that prevent cutting your text in teModal so your text will always be 100% visible.
teCMS features
If anyone read this. But doesn't matter I am working as one man band. So As you know I'm working on new CMS, and must say what is done and what I intend to do. I would like to ask all PHP, Javascript programers Web designers to help me to deal with this project. Help are welcome.
1. admin login system with new features. Nothing new login system, but I must say some new things implemented.
* Cross browser optimized layout 100% I must just style input fields for Chrome.
* New verification and security feature. I replace all captchas and build new verification system called teVerify.
teVerify is Javascript-PHP verification system based on Scriptaulous slider, with my PHP class called teEncryption. Simply you have matching word in blocked input field and you must scroll that word and filled nick and pass fields to be able to deblock submit button.There are also IP check illegal login IP ban etc, etc...
OK someone would say what if user disable Javascript, he can not login anyway. But I intend to implement Javascript emulation for that, but I am just one man.
2. Templating system - if you see it you would say that is too complicated. I split every header, content and menu is separate files for all pages, and for admin and user selection of CMS. Why i do not know but you have possibility to style everything as you like. I like this idea because you have freedom to do every detail for yourself.
New feature I implement is separate CSS styles based on browser detection PHP script. Generally when you access page scriot detect your browser and include (if needed) CSS browser specific. That is mine answer to CSS cross browser incompatibility. Also all CSS are incorporated in one and compressed on fly.
3. Navigarion system - I spend a lot of time working on this. What I want is to get two things DEEP LINKING and PHP NAVIGATION. So I must say that is working. Every page detect is acces is over Ajax request or not so you can access to categories.php in three ways:
/admin.php#Categories
/categories.php
/Categories -->and with .htaccess file enabled
Also you have Slide bar navigation menu for general site navigation with submenus in it. Javascript based.
3. Structure - I decide to allow user to build complete site structure. So there are nothing after installation. Structure is based on CATEGORIES-->SUBCATEGORIES relation. You create CATEGORY and child SUBCATEGORIES in each category.
*TO DO - add more nesting levels means CATEGORIES-->SUBCATEGORIES-->SUBSUBCATEGORIES .....
4. Category manipulation - everything is build in Javascript. You change category and subcategory names with EDIT IN PLACE. Move subcategories between categories and change category order with SORTABLE LISTS. Expand/collapse subcategory tree. Delete edit with Javascript. Create category/ subcategory and update category list with Ajax....
There are too many features so I will stop here or not.
I need modal window options for teCMS so I'm building mine called teModal:
Why I do not user some existing MODAL. Well I do not like few things.
-When you open modal window in all existing modal windows page is scrolling. So I solve that with screen detection etc.
-I do not like single Appear and Fade effects in modal windows, so I write Script.aculo.us warper so you are able now to use and combine multiple effects on screen overlay and teModal window show and hide.
-Also I implemented overlay window and modal window scaling during browser resize.
Then I get new idea CSS based on screen dimensions so I will make soon. With that approach Ths CMS will be same in all browser resolution even for mobile browsers. Because CSS values numbers will be changed depending of screen size.
That is part of features for now
New CMS Features and test link
CATEGORY-SUBCATEGORY STRUCTURE OF CMS. This is just code that reads data from database ind output with PHP print_r command. Feel free to comment and ive some suggestions. This is PHP class called classThemeHandler and function called AdminCategories:

As Wp-Sunlight do work well with this theme I use quote.
Building new CMS System
Few weeks ago I start building new CMS System called teCMS. There are a lot of work so I need a development team. Web designers, PHP coders... No need to be pro just willing to work. All future members will get ownership on this CMS. So everybody interested can contact me on mine e-mail: admin@te-edu.info
This bolg will get alive this days
After long time I decide to start posting to this blo, site or what ever...
Get meta tags from any website
There is function build in PHP that give you this possibility get_meta_tags. Extracted meta tags can be output calling print_r() function, because all metatags are placed in array.
// Get meta information of “http://te-edu.com”
$meta_tags = get_meta_tags(‘http://www.te-edu.com’);// outputthe array
print_r(‘<pre>’);
print_r($metaTags);
print_r(‘</pre>’);
you will get output:
Array
(
[keywords] => some data
[description] => some data
[author] => some data
[robots] => some data
)
Ajax multifile upload-mine copied way-part two…
OK we continue now staring explain JavaScript file.
1. max number of files-you can modify this number but look for server timeout if you can change timeout value in php.ini file that ok
var max = 5;
2, delete button image-relative path to image depending of where is multifile.js located.
var delete_btn = 'images/dcirc.gif';
If you have multifile.js in same folder with file where you have form you have path:
var delete_btn = 'your-file.gif'
if this file is in some folder inside folder where is file with your form located eg.folder img:
var delete_btn = 'img/your-file.gif'
if this file is in some folder up level folder from where is file with your form located
eg.every level up is one --> ../ <--
means file with your form is 3 levels up you have ../../../your-file.gif
var delete_btn = '../your-file.gif'
3. start files at zero, n o need to modify anything.
var upload_number = 0;
4. Now you can play with design if you do not like mine (look for Ajax doom CSS reference on net):
var container = document.createElement( 'div' ); -create div
container.style.border = "1px solid #000000"; -CSS div border
container.style.float = "left"; -CSS div float left
container.style.overflow = "hidden"; -CSS div overflow for long filenames
you can use wordwarp but command
is not supported for some browsers
container.style.backgroundColor = "#ffffff"; -CSS div background color
container.style.padding = "3px"; -CSS div input filename padding
container.style.paddingLeft = "10px"; -CSS div input filename padding
container.style.width = "350px"; -CSS div container width
container.appendChild(document.createTextNode(' upload image'));
-upload image you can change this
container.appendChild(document.createElement('br'));
container.appendChild(document.createTextNode(filename)); -filename output
container.appendChild(document.createElement('br'));
DELETE IMAGE CONTAINER:
var new_img_container = document.createElement( 'div' ); -create container
new_img_container.style.position = "relative"; -container possition
new_img_container.style.left = "270px"; -container possition LEFT
new_img_container.style.top = "-1px";var new_row_button = document.createElement( 'img' );
new_row_button.src = delete_btn; -variable defined var delete_btn = 'yourfile.gif'
new_row_button.style.verticalAlign = "middle"; -align of delete image
new_row_button.alt = 'remove '+filename+' from list';
You can play with this code and change look and position. I copy this code from mine work so it can be that do not fit to your needs so test a little you will get what you need.
Download working source code: multi-upload.
In next post I will add progres bar and explain and add all complete code for uploading and image processing.
ultimate learning place
TIDEngine Template System Support Site
warungplus