As I said here some months ago, Debian is migrating away from Smarty 2.x to 3.x. Well, even though I was postponing looking into this for Collabtive, this week the change happened. I know Collabtive ships with a full Smarty install in it, but for Debian packages we have the policy to limit as much as possible code duplication. Smarty 3 is, as far as I understand, a complete rewrite which improves mainly on speed and security issues – But requires being stricter in some declarations.
I am basically not familiar with Smarty, but it took me only a couple of hours to get Collabtive to properly work with it, and I'm about to upload it to Debian. I'm including here the patch (as the Forum software does not allow me to attach it). Before it, I'll highlight the main changes I do:
- Smarty 3 does no longer allow you to blindly use an __autoload function; proper registration is needed. So, I added a spl_autoload_register('__autoload'); call just after the function definition. It would be better to name it i.e. collabtive_autload, to avoid clashes, but I tried to be as non-invasive as possible.
- Strings require to be quoted in the templates, so I quoted 'lng.conf' in header.tpl (both in standard/ and in winter/)
- The comment syntax for configuration files is prepending a hash (#), not the {* syntax used in templates *}. Fixed both the Spanish and Lituanian translations.
- As Smarty no longer "lives" inside Collabtive's directory, I'm explicitly requiring Smarty.class.php from init.php. I'm also setting some include paths which will not be required for your setup, ignore those.
I hope you can include those changes for the next release!
- Code: Select all
Index: collabtive/include/initfunctions.php
===================================================================
--- collabtive.orig/include/initfunctions.php 2012-03-13 11:24:38.000000000 -0600
+++ collabtive/include/initfunctions.php 2012-03-13 11:24:39.000000000 -0600
@@ -14,6 +14,8 @@
}
}
+spl_autoload_register('__autoload');
+
function chkproject($user, $project)
{
$user = (int) $user;
Index: collabtive/templates/standard/header.tpl
===================================================================
--- collabtive.orig/templates/standard/header.tpl 2012-03-13 11:23:45.000000000 -0600
+++ collabtive/templates/standard/header.tpl 2012-03-13 11:24:39.000000000 -0600
@@ -1,4 +1,4 @@
-{config_load file=lng.conf section = "strings" scope="global" }
+{config_load file='lng.conf' section = "strings" scope="global" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
Index: collabtive/templates/winter/header.tpl
===================================================================
--- collabtive.orig/templates/winter/header.tpl 2012-03-13 11:23:45.000000000 -0600
+++ collabtive/templates/winter/header.tpl 2012-03-13 11:24:39.000000000 -0600
@@ -1,4 +1,4 @@
-{config_load file=lng.conf section = "strings" scope="global" }
+{config_load file='lng.conf' section = "strings" scope="global" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
Index: collabtive/language/en/lng.conf
===================================================================
--- collabtive.orig/language/en/lng.conf 2012-03-13 11:23:45.000000000 -0600
+++ collabtive/language/en/lng.conf 2012-03-13 11:24:39.000000000 -0600
@@ -59,7 +59,7 @@
welcomeback = Welcome back
zip = Postcode
-{* Project *}
+# Project
access = Access
addproject = Add project
@@ -86,7 +86,7 @@
report = Report
start = Start
-{* Task / Tasklist *}
+# Task / Tasklist
addtask = Add task
addtasklist = Add tasklist
@@ -123,7 +123,7 @@
text = Text
todaytasks = Tasks for today
-{* Milestone *}
+# Milestone
addmilestone = Add milestone
donemilestones = Done milestones
@@ -141,7 +141,7 @@
newmilestones = New milestones
todaystones = Today's milestones
-{* Messages *}
+# Messages
addmessage = Add message
answer = Answer
@@ -161,7 +161,7 @@
replywasedited = Reply was edited
title = Title
-{* eMails *}
+# eMails
hello = Hello
mailfrommail = Sender e-mail
@@ -181,7 +181,7 @@
taskassignedsubject = Collabtive notification – Task assigned
taskassignedtext = a new task has been assigned to you:
-{* Files *}
+# Files
addfile = Add file
addfiles = Add files
@@ -210,7 +210,7 @@
rootdir = Root directory
visibility = Visible for
-{* Search *}
+# Search
advancedsearch = Advanced search
didyoumean = Did you mean
@@ -225,7 +225,7 @@
searching = Searching...
searchitem = Search item
-{* Languages *}
+# Languages
al = Albanian
ar = Arabic
@@ -262,7 +262,7 @@
uk = Ukranian
zh = Chinese
-{* Calendar *}
+# Calendar
calendar = Calendar
dateformat = Date format
@@ -289,7 +289,7 @@
november = November
december = December
-{* Errors *}
+# Errors
accessdenied = Access denied
confirmdel = Really delete this item?\nDeleting cannot be undone.
@@ -301,7 +301,7 @@
wrongfields = Please enter valid values for:\n\n
wrongselect = Please select a valid value in \"%FIELDNAME%\".
-{* Installation *}
+# Installation
createadmin = Create the first user. This user will be the administrator and cannot be deleted.
clickcontinue = Click "continue" to pursue the installation.
@@ -327,7 +327,7 @@
phpversion = You need at least PHP version 5.1 to run Collabtive.
proceedtologin = Proceed to the login page.
-{* Timetracker *}
+# Timetracker
comment = Comment
edittimetracker = Edit timetracker entry
@@ -346,7 +346,7 @@
timetracker = Timetracker
timetrackeradded = Time was added
-{* Roles / Permissions *}
+# Roles / Permissions
add = Add
addrole = Add role
@@ -362,7 +362,7 @@
roleedited = Role was edited
roles = Roles
-{* Miscellaneous *}
+# Miscellaneous
active = Active
activity = Activity
@@ -424,4 +424,4 @@
was = was
were = were
yes = Yes
-zipexport = ZIP
\ No newline at end of file
+zipexport = ZIP
Index: collabtive/language/lt/lng.conf
===================================================================
--- collabtive.orig/language/lt/lng.conf 2012-03-13 11:23:45.000000000 -0600
+++ collabtive/language/lt/lng.conf 2012-03-13 11:24:39.000000000 -0600
@@ -1,4 +1,4 @@
-{* Credits: Arūnas Simonaitis - arunas@simonaitis.lt *}
+# Credits: Arūnas Simonaitis - arunas@simonaitis.lt
address = Adresas
adduser = Pridėti vartotoją
@@ -55,7 +55,7 @@
welcomeback = Sveiki sugrįžę
zip = Pašto kodas
-{* Project *}
+# Project
access = Prieiga
addproject = Pridėto projektą
@@ -82,7 +82,7 @@
report = Ataskaita
start = Pradėta
-{* Task / Tasklist *}
+# Task / Tasklist
addtask = Pridėti užduotį
addtasklist = Pridėti užduočių sąrašą
@@ -119,7 +119,7 @@
text = Tekstas
todaytasks = Šiandienos užduotys
-{* Milestone *}
+# Milestone
addmilestone = Pridėti etapą
donemilestones = Įvykdyti etapai
@@ -137,7 +137,7 @@
newmilestones = Nauji etapai
todaystones = Šiandienos etapai
-{* Messages *}
+# Messages
addmessage = Pridėti žinutę
answer = Atsakyti
@@ -157,7 +157,7 @@
replywasedited = Atsakymas buvo paredaguotas
title = Pavadinimas
-{* eMails *}
+# eMails
mailfrommail = Siuntėjo el. paštas
mailfromname = Siuntėjas
@@ -175,7 +175,7 @@
taskassignedsubject = Pranešimas – Užduoties priskyrimas
taskassignedtext = Jums buvo priskirta nauja užduotis:
-{* Files *}
+# Files
addfile = Pridėti bylą
addfiles = Pridėti bylas
@@ -204,7 +204,7 @@
rootdir = Pagrindinė direktorija
visibility = Gali matyti
-{* Search *}
+# Search
advancedsearch = Išplėstinė paieška
didyoumean = Gal ieškojote
@@ -219,7 +219,7 @@
searching = Ieškoma...
searchitem = Paieškos punktai
-{* Languages *}
+# Languages
al = Albanų
ar = Arabų
@@ -254,7 +254,7 @@
uk = Ukrainų
zh = Kinų
-{* Calendar *}
+# Calendar
calendar = Kalendorius
dateformat = Datos formatas
@@ -281,7 +281,7 @@
november = Lapkritis
december = Gruodis
-{* Errors *}
+# Errors
accessdenied = Prieiga uždrausta
confirmdel = Tikrai norite ištrinti?\nVeiksmas negalės būti atšauktas.
@@ -293,7 +293,7 @@
wrongfields = Prašome įvesti teisingas reikšmes:\n\n
wrongselect = Pasirinkite teisingą reikšmę: \"%FIELDNAME%\".
-{* Installation *}
+# Installation
createadmin = Sukurkite pirmą vartotoją. Šis vartotojas bus administratorius ir negalės būti pašalintas.
clickcontinue = Paspauskite "Tęsti" norėdami įdiegti programą.
@@ -319,7 +319,7 @@
mb_string_enabled = mb_string plėtinys įjungtas
enable_mb_string = Įjunkite mb_string plėtinį
-{* Timetracker *}
+# Timetracker
comment = Komentaras
edittimetracker = Redaguoti laikos stebėjimo įrašą
@@ -338,7 +338,7 @@
timetracker = Laiko stebėjimas
timetrackeradded = Laikas pridėtas
-{* Roles / Permissions *}
+# Roles / Permissions
add = Pridėti
addrole = Pridėti rolę
@@ -354,7 +354,7 @@
roleedited = Rolė buvo paredaguota
roles = Rolės
-{* Miscellaneous *}
+# Miscellaneous
active = Aktyvus
activity = Aktyvumas
@@ -415,4 +415,4 @@
was = buvo
were = buvo
yes = Taip
-zipexport = ZIP
\ No newline at end of file
+zipexport = ZIP
Index: collabtive/init.php
===================================================================
--- collabtive.orig/init.php 2012-03-13 11:24:34.000000000 -0600
+++ collabtive/init.php 2012-03-13 11:24:46.000000000 -0600
@@ -1,4 +1,10 @@
<?php
+// Add some paths and requires needed for an installation with a
+// systemwide Smarty3 setup (i.e. as distributed in Debian)
+set_include_path(get_include_path() . PATH_SEPARATOR . '/usr/share/collabtive/www/include');
+set_include_path(get_include_path() . PATH_SEPARATOR . "/usr/share/php/smarty3");
+require "Smarty.class.php";
+
ini_set("arg_separator.output", "&");
ini_set('default_charset', 'utf-8');
// Start output buffering with gzip compression and start the session
