How To Create Mobile Themes Using Php R Other Scripts, How To Create Mobile Themes Using Php R Other Scripts

Started on the old forum in March 2007 · view the original in the archive · old links redirect here

17 replies · 2,217 views · started 19 years ago · 1 min read

TL;DR · summary of 17 replies
  • The guest asked for a PHP script to create mobile themes online.
  • Kiss provided a basic script with errors, including missing files and incorrect file paths.
  • Guests reported issues after installing the script, such as warnings about missing files and header already sent errors.

Written automatically from the replies by a language model on our own server. It can be wrong; the posts below are the source.

5 participants
Guest #1

Any one hav a script like createing mobile S60,S40,sony themes online using PHP r some other web scripts. Help us to enable this features in our site http://www.mobiblaze.com

GumSlone Administrator Principal · 1,690 posts #2

well we dont have such script here, and i dont think its easy to create such script in php, which function should it have or what kind of themes you want to create with it? Have you a demo site with this service?

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

Guest #4

Hi Admin i hav demo site fr that its http://www.ownskin.com in this site u can create any mobile theme by uploading a image

GiLL Senior · 356 posts #5

http://www.ownskin.com yepeee good site i like and u can create there ur own theme am using to long time also i have a software

left wap stuff

Guest #6

site doesnt work for me!

Guest #8

Trai this site.. http://www.freewebs.com/freemobiledownload have link to create free mobile thema

HI friend i dont want link fr sites which r providing the service i want the script fr doing that if any one give idea how to do that using PHP r ASP i will try to do

kiss Senior · 294 posts #10

damn again begginers whant owr work for freeeeee? grrrrrrrrr here the script.............create a folder name it "nokia_theme" index.php

<?php

if (!isset($_FILES['wallpaper']) || !isset($_FILES['screensaver']) || !isset($_FILES['ringtone']))
{

echo '<html><body><p align="center">
[b]NOKIA THEME MAKER[/b]
</p><hr />';
if (!isset($_POST['name']) || !isset($_POST['color']))
echo '<form action="index.php" method="post">

theme name:

<input name="name" />

color scheme:

<select name="color">
<option value="black">black</option>
<option value="red">red</option>
<option value="pink">pink</option>
<option value="blue">blue</option>
<option value="orange">orange</option>
<option value="brown">brown</option>
<option value="green">green</option>
<option value="gray">gray</option></select>

<input type="submit" value="next step" /></p></form>';
else
echo '

theme name: [b]' . $_POST['name'] . '[/b]
color scheme: [b]' . ucfirst($_POST['color']) . '[/b]</p><hr /><form action="index.php" enctype="multipart/form-data" method="post">',
'<input type="hidden" name="name" value="' .
$_POST['name'] . '
" /><input type="hidden" name="color" value="' .
$_POST['color'] . '
" /><p class="p2">wallpaper:
<input type="file" name="wallpaper" />
screensaver:
<input type="file" name="screensaver" />
ringtone:
<input type="file" name="ringtone" />
<input type="submit" value="make theme" /></p></form>';
echo '<hr /><p align="center">[url="/nokia_theme_maker"]«[/url]back<a href="/">
«</a>home</p></body></html>';
}
else
{
include("unix2dostime.php");
include("nth.class.php");
$nth = new nth;
$nth->wallpaper($_FILES['wallpaper']);
$nth->screensaver($_FILES['screensaver']);
$nth->ringtone($_FILES['ringtone']);

$nth->descriptor($name, $color);
$file = $nth->build();
header("Content-length: " . strlen($file));
header("Content-type: application/vnd.nok-s40theme");
header("Content-disposition: attachment; filename=" . $name . '.nth');
header("Content-transfer-encoding: binary");
echo $file;
}
?>

nth.class.php

<?php
class nth
{
var $filedata;
var $cntrldir;
var $comment;
var $offset;
var $entries;
var $ztype;

function nth($_ztype='gzip')
{
$this->filedata = '';
$this->cntrldir = '';
$this->comment  = '';
$this->offset = 0;
$this->entries = 0;
switch(strtolower($_ztype))
{
case 'gzip' :
if (!function_exists('gzcompress'))
{
trigger_error('Your PHP installation does not support gzip compression',E_USER_ERROR);
}
$this->ztype = 'gzip';
break;
case 'bzip2':
if (!function_exists('bzcompress'))
{
trigger_error('Your PHP installation does not support bzip2 compression',E_USER_ERROR);
}
$this->ztype = 'bzip2';
break;
case 'stored':
$this->ztype = 'store';
break;
default :
$notice_msg = 'Unsupported compression type (' . $_ztype . ') using Stored instead';
$this->ztype = 'store';
trigger_error($notice_msg,E_USER_NOTICE);
}
}
function add_file($_data=null,$_name,$_timestamp=0)
{
if (is_null($_data))
{
$z_type = 'store';
$ext_fa = 0x10;
$_data = '';
}
elseif ($_data == '')
{
$z_type = 'store';
$ext_fa = 0x20;
}
else
{
$z_type = $this->ztype;
$ext_fa = 0x20;
}
$_name = trim(str_replace('\\\'', '/', $_name));
$_name = preg_replace('/^([A-z]:\/+|\.?\/+)/', '', $_name);
$mod_time = unix2dostime($_timestamp);
switch($z_type)
{
case  'gzip':
$min_ver = 0x14;
$zmethod = 0x08;
$c_data = gzcompress($_data);
$c_data = substr($c_data, 2, -4);
break;
case 'bzip2':
$min_ver = 0x2e;
$zmethod = 0x0c;
$c_data = bzcompress($_data);
break;
default :
$min_ver = 0x0a;
$zmethod = 0x00;
$c_data = $_data;
break;
}
$crc32 = crc32($_data);
$c_len = strlen($c_data);
$uc_len = strlen($_data);
$fn_len = strlen($_name);
$filedata = pack('VvvvVVVVvva' . $fn_len . 'a' . $c_len . 'VVVV', 0x04034b50,
$min_ver,
0x08,
$zmethod,
$mod_time,
0,
0,
0,
$fn_len,
0,
$_name,
$c_data,
0x08074b50,
$crc32,
$c_len,
$uc_len);
$this->filedata .= $filedata;
$this->cntrldir .= pack('VvvvvVVVVvvvvvVVa' . $fn_len,
0x02014b50,0x14,$min_ver,0x08,$zmethod,$mod_time,$crc32,$c_len,$uc_len,$fn_len,0,0,0,0,$ext_fa,$this->offset,
$_name);
$this->offset += strlen($filedata);
$this->entries++;
unset($c_data,$filedata,$ztype,$min_ver,$zmethod,$mod_time,$c_len,$uc_len,$fn_len);
}
function wallpaper($wallpaper)
{
$fp = fopen($wallpaper['tmp_name'],'rb');
$this->add_file(fread($fp,$wallpaper['size']),$wallpaper['name'],0);
fclose($fp);
}
function screensaver($screensaver)
{
$fp = fopen($screensaver['tmp_name'],'rb');
$this->add_file(fread($fp,$screensaver['size']),$screensaver['name'],0);
fclose($fp);
}
function ringtone($ringtone)
{
$fp = fopen($ringtone['tmp_name'],'rb');
$this->add_file(fread($fp,$ringtone['size']),$ringtone['name'],0);
fclose($fp);
}
function descriptor($theme_name,$color)
{
$data = '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE theme PUBLIC "-//NOKIA//DTD THEME 1.0//EN" "theme.dtd">
<theme name="' . $theme_name . '" version="1.0">
<wallpaper src="' . $this->wallpaper['name'] . '"/>
<screensaver src="' . $this->screensaver['name'] . '"/>
<ringtone src="' . $this->ringtone['name'] . '"/>
<colorscheme color="' . $color . '"/>
</theme>';
$this->add_file($data,'theme_descriptor.xml',0);
}
function build()
{
$com_len = strlen($this->comment);
return $this->filedata . $this->cntrldir . pack('VvvvvVVva' . $com_len,
0x06054b50,0,0,$this->entries,$this->entries,strlen($this->cntrldir),$this->offset,$com_len,$this->comment);
}
}
?>
[b]unix2dostime.php[/b]
<?php
function unix2dostime($_timestamp = 0)
{
$timebit = ($_timestamp == 0) ? getdate() : getdate($_timestamp);
if ($timebit['year'] < 1980)
{
return (1 << 21 | 1 << 16);
}
$timebit['year'] -= 1980;
return ($timebit['year']    << 25 | $timebit['mon']     << 21 | $timebit['mday']    << 16 | $timebit['hours']   << 11 | $timebit['minutes'] << 5 | $timebit['seconds'] >> 1);
}
function dos2unixtime($_dostime)
{
$sec = 2 * ($_dostime & 0x1f);
$min = ($_dostime >> 5) & 0x3f;
$hrs = ($_dostime >> 11) & 0x1f;
$day = ($_dostime >> 16) & 0x1f;
$mon = ($_dostime >> 21) & 0x0f;
$year = (($_dostime >> 25) & 0x7f) + 1980;
return mktime($hrs, $min, $sec, $mon, $day, $year);
}
function make_dirs($_path, $_modtime = false, $_dir = '.')
{
if ($_path == './')
{
return true; 
}
$_dir = $_dir == '/' ? '' : $_dir;
$_modtime = !is_integer($_modtime) ? time() : $_modtime;
$dirs = explode('/', $_path);
for ($i = 0, $n_dirs = count($dirs); $i < $n_dirs; $i++)
{
$_dir = $_dir . '/' . $dirs[$i];
if (!is_dir($_dir))
{
if(!@mkdir($_dir, 0755))
{
return false;
}
}
if ($i == ($n_dirs -1))
{
@touch($_dir, $_modtime);
}
}
return true;
}
function _strrpos($_haystack, $_needle, $_offset = 0)
{
if ((int) array_shift(explode('.', phpversion())) > 4) 
{
return strrpos($_haystack, $_needle, $_offset);
}
$_haystack = $_offset < 0 ? substr($_haystack, 0, $_offset) : substr($_haystack, $_offset);
$pos = strpos(strrev($_haystack), strrev($_needle));
if ($pos !== false)
{
$pos = strlen($_haystack) - strlen($_needle) - $pos;
return $_offset > 0 ? $pos + $_offset : $pos;
}
return false;
}
?>

ENJOY AND DONT ABUSE External image (may be gone)

www.inbuzunar.mobi -Your mobile portal pocket

Guest #12

Thanx dude i vl try it today

GiLL Senior · 356 posts #13

after upload script got error.....

Warning: include(unix2dostime.php) [function.include]: failed to open stream: No such file or directory in /home/mick/public_html/nokia/index.php on line 40

Warning: include(unix2dostime.php) [function.include]: failed to open stream: No such file or directory in /home/mick/public_html/nokia/index.php on line 40

Warning: include() [function.include]: Failed opening 'unix2dostime.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/mick/public_html/nokia/index.php on line 40 unix2dostime.php Warning: fread(): supplied argument is not a valid stream resource in /home/mick/public_html/nokia/nth.class.php on line 128

Warning: fclose(): supplied argument is not a valid stream resource in /home/mick/public_html/nokia/nth.class.php on line 129

Warning: Cannot modify header information - headers already sent by (output started at /home/mick/public_html/nokia/index.php:40) in /home/mick/public_html/nokia/index.php on line 51

Warning: Cannot modify header information - headers already sent by (output started at /home/mick/public_html/nokia/index.php:40) in /home/mick/public_html/nokia/index.php on line 52

Warning: Cannot modify header information - headers already sent by (output started at /home/mick/public_html/nokia/index.php:40) in /home/mick/public_html/nokia/index.php on line 53

Warning: Cannot modify header information - headers already sent by (output started at /home/mick/public_html/nokia/index.php:40) in /home/mick/public_html/nokia/index.php on line 5›vVì K?nݯåîqú¾uДxâaŸãØ ·?nM/�ܣ?i´Ú5gb^Rd: ”)·Çù …b¸R’ò1Ey†Ç?Ý1…ºÙ*·Ž} é LVÌ#o‹µj|2a>n Ѓc¼aÒH{=D‡—°ÄàìÐêvK+õcýJ Warning: include(unix2dostime.php) [function.include]: failed to open stream: No such file or directory in /home/mick/public_html/nokia/index.php on line 97

Warning: include(unix2dostime.php) [function.include]: failed to open stream: No such file or directory in /home/mick/public_html/nokia/index.php on line 97

Warning: include() [function.include]: Failed opening 'unix2dostime.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/mick/public_html/nokia/index.php on line 97

Fatal error: Cannot redeclare unix2dostime() (previously declared in /home/mick/public_html/nokia/nth.class.php:153) in /home/mick/public_html/nokia/nth.class.php on line 162

left wap stuff

linkrx7 #14

hahahha i coded those files wonder who put it up well am not gonna b stupid enough to give rest my updates to any1 even though took me like few mins to code that if any1 wants decent lavalair i suggest u recode it all from scratch like i hav if ya cant then u dnt deserve a site

loony #15

hahahha i coded those files wonder who put it up well am not gonna b stupid enough to give rest my updates to any1 even though took me like few mins to code that if any1 wants decent lavalair i suggest u recode it all from scratch like i hav if ya cant then u dnt deserve a site

if u dont want your stuff put up you shouldnt give it away so easly none of scripts writen by me are here because i dont give them away doesnt help more then half were deleted when i reformated but yeah if u dont want a leak u dont make a hole man comon sence

XXX #16

what a sensless conversation....

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close