2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

Merging the updated Limesurvey 1.92+ branch of queXS to trunk

This commit is contained in:
azammitdcarf
2012-11-21 04:04:39 +00:00
parent 153fc8ca0d
commit c569559964
856 changed files with 254260 additions and 819988 deletions
+13 -8
View File
@@ -274,14 +274,19 @@ if ($questionnaire_id != false)
print "<h1>" . T_("Enter the details for creating the row quota:") . "</h1>";
print "<h2>" . T_("Pre defined values for this question:") . "</h2>";
$qid = explode("X", $sgqa);
$qid = $qid[2];
$sql = "SELECT l.code,l.answer as title
FROM `" . LIME_PREFIX . "answers` as l
WHERE l.qid = '$qid'";
$rs = $db->GetAll($sql);
$rs = "";
if ($sgqa != -2 && $sgqa != -1 && !empty($sgqa))
{
$qid = explode("X", $sgqa);
$qid = $qid[2];
$sql = "SELECT l.code,l.answer as title
FROM `" . LIME_PREFIX . "answers` as l
WHERE l.qid = '$qid'";
$rs = $db->GetAll($sql);
}
if (!isset($rs) || empty($rs))
print "<p>" . T_("No labels defined for this question") ."</p>";
+1 -1
View File
@@ -53,7 +53,7 @@ $js = false;
if (AUTO_LOGOUT_MINUTES !== false)
$js = array("include/jquery-ui/js/jquery-1.4.2.min.js","js/childnap.js");
xhtml_head(T_("Appointment List"),true,array("css/table.css"),$js,false,15);
xhtml_head(T_("Appointment List"),true,array("css/table.css"),$js,false,60);
//List the case appointment
// display in respondent time so that the operator will be able to
+1 -1
View File
@@ -53,7 +53,7 @@ $js = false;
if (AUTO_LOGOUT_MINUTES !== false)
$js = array("include/jquery-ui/js/jquery-1.4.2.min.js","js/childnap.js");
xhtml_head(T_("Case History List"),true,array("css/table.css"),$js,false,15);
xhtml_head(T_("Case History List"),true,array("css/table.css"),$js,false,60);
//List the case call history
// display in respondent time so that the operator will be able to
+1 -1
View File
@@ -53,7 +53,7 @@ $js = false;
if (AUTO_LOGOUT_MINUTES !== false)
$js = array("include/jquery-ui/js/jquery-1.4.2.min.js","js/childnap.js");
xhtml_head(T_("Call List"),true,array("css/table.css"),$js,false,15);
xhtml_head(T_("Call List"),true,array("css/table.css"),$js,false,60);
//List the case call history
// display in respondent time so that the operator will be able to
+1 -1
View File
@@ -161,7 +161,7 @@ if (!defined('PHP_EXEC')) define('PHP_EXEC', "php");
/**
* Path to ADODB
*/
if (!defined('ADODB_PATH')) define('ADODB_PATH',dirname(__FILE__).'/../adodb/');
if (!defined('ADODB_PATH')) define('ADODB_PATH',dirname(__FILE__).'/include/limesurvey/classes/adodb/');
/**
* Path to the HTPASSWD file read/writable by the web server user for htpasswd integration
-5
View File
@@ -63,11 +63,6 @@ define('AUTO_POPUP',false);
*/
define('QUEXS_PATH', '/quexs/');
/**
* Path to ADODB
*/
define('ADODB_PATH',dirname(__FILE__).'/../adodb/');
/**
* Database configuration for queXS
*/
+186 -24
View File
@@ -3,9 +3,9 @@
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Sep 07, 2011 at 02:42 PM
-- Generation Time: Nov 16, 2012 at 12:35 PM
-- Server version: 5.0.51
-- PHP Version: 5.2.6-1+lenny13
-- PHP Version: 5.2.6-1+lenny16
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
@@ -18,7 +18,6 @@ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Database: `quexs`
--
-- --------------------------------------------------------
--
@@ -472,6 +471,31 @@ CREATE TABLE `lime_defaultvalues` (
--
-- --------------------------------------------------------
--
-- Table structure for table `lime_expression_errors`
--
CREATE TABLE `lime_expression_errors` (
`id` int(9) NOT NULL auto_increment,
`errortime` varchar(50) collate utf8_unicode_ci default NULL,
`sid` int(11) default NULL,
`gid` int(11) default NULL,
`qid` int(11) default NULL,
`gseq` int(11) default NULL,
`qseq` int(11) default NULL,
`type` varchar(50) collate utf8_unicode_ci default NULL,
`eqn` text collate utf8_unicode_ci,
`prettyprint` text collate utf8_unicode_ci,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `lime_expression_errors`
--
-- --------------------------------------------------------
--
@@ -504,6 +528,8 @@ CREATE TABLE `lime_groups` (
`group_order` int(11) NOT NULL default '0',
`description` text collate utf8_unicode_ci,
`language` varchar(20) collate utf8_unicode_ci NOT NULL default 'en',
`randomization_group` varchar(20) collate utf8_unicode_ci NOT NULL default '',
`grelevance` text collate utf8_unicode_ci,
PRIMARY KEY (`gid`,`language`),
KEY `groups_idx2` (`sid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
@@ -553,6 +579,119 @@ CREATE TABLE `lime_labelsets` (
--
-- --------------------------------------------------------
--
-- Table structure for table `lime_participants`
--
CREATE TABLE `lime_participants` (
`participant_id` varchar(50) collate utf8_unicode_ci NOT NULL,
`firstname` varchar(40) collate utf8_unicode_ci default NULL,
`lastname` varchar(40) collate utf8_unicode_ci default NULL,
`email` varchar(80) collate utf8_unicode_ci default NULL,
`language` varchar(40) collate utf8_unicode_ci default NULL,
`blacklisted` varchar(1) collate utf8_unicode_ci NOT NULL,
`owner_uid` int(20) NOT NULL,
PRIMARY KEY (`participant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `lime_participants`
--
-- --------------------------------------------------------
--
-- Table structure for table `lime_participant_attribute`
--
CREATE TABLE `lime_participant_attribute` (
`participant_id` varchar(50) collate utf8_unicode_ci NOT NULL,
`attribute_id` int(11) NOT NULL,
`value` varchar(50) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`participant_id`,`attribute_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `lime_participant_attribute`
--
-- --------------------------------------------------------
--
-- Table structure for table `lime_participant_attribute_names`
--
CREATE TABLE `lime_participant_attribute_names` (
`attribute_id` int(11) NOT NULL auto_increment,
`attribute_type` varchar(4) collate utf8_unicode_ci NOT NULL,
`visible` char(5) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`attribute_id`,`attribute_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `lime_participant_attribute_names`
--
-- --------------------------------------------------------
--
-- Table structure for table `lime_participant_attribute_names_lang`
--
CREATE TABLE `lime_participant_attribute_names_lang` (
`attribute_id` int(11) NOT NULL,
`attribute_name` varchar(30) collate utf8_unicode_ci NOT NULL,
`lang` varchar(20) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`attribute_id`,`lang`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `lime_participant_attribute_names_lang`
--
-- --------------------------------------------------------
--
-- Table structure for table `lime_participant_attribute_values`
--
CREATE TABLE `lime_participant_attribute_values` (
`value_id` int(11) NOT NULL auto_increment,
`attribute_id` int(11) NOT NULL,
`value` varchar(20) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`value_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `lime_participant_attribute_values`
--
-- --------------------------------------------------------
--
-- Table structure for table `lime_participant_shares`
--
CREATE TABLE `lime_participant_shares` (
`participant_id` varchar(50) collate utf8_unicode_ci NOT NULL,
`share_uid` int(11) NOT NULL,
`date_added` datetime NOT NULL,
`can_edit` varchar(5) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`participant_id`,`share_uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `lime_participant_shares`
--
-- --------------------------------------------------------
--
@@ -575,6 +714,7 @@ CREATE TABLE `lime_questions` (
`language` varchar(20) collate utf8_unicode_ci NOT NULL default 'en',
`scale_id` tinyint(4) NOT NULL default '0',
`same_default` tinyint(4) NOT NULL default '0' COMMENT 'Saves if user set to use the same default value across languages in default options dialog',
`relevance` text collate utf8_unicode_ci,
PRIMARY KEY (`qid`,`language`),
KEY `questions_idx2` (`sid`),
KEY `questions_idx3` (`gid`),
@@ -598,8 +738,10 @@ CREATE TABLE `lime_question_attributes` (
`qid` int(11) NOT NULL default '0',
`attribute` varchar(50) collate utf8_unicode_ci default NULL,
`value` text collate utf8_unicode_ci,
`language` varchar(20) collate utf8_unicode_ci default NULL,
PRIMARY KEY (`qaid`),
KEY `question_attributes_idx2` (`qid`)
KEY `question_attributes_idx2` (`qid`),
KEY `question_attributes_idx3` (`attribute`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
@@ -741,14 +883,9 @@ CREATE TABLE `lime_settings_global` (
-- Dumping data for table `lime_settings_global`
--
INSERT INTO `lime_settings_global` (`stg_name`, `stg_value`) VALUES('DBVersion', '146');
INSERT INTO `lime_settings_global` (`stg_name`, `stg_value`) VALUES('force_ssl', '');
INSERT INTO `lime_settings_global` (`stg_name`, `stg_value`) VALUES('SessionName', 'ls28629164789259281352');
INSERT INTO `lime_settings_global` (`stg_name`, `stg_value`) VALUES('showgroupinfo', 'choose');
INSERT INTO `lime_settings_global` (`stg_name`, `stg_value`) VALUES('showqnumcode', 'choose');
INSERT INTO `lime_settings_global` (`stg_name`, `stg_value`) VALUES('showXquestions', 'choose');
INSERT INTO `lime_settings_global` (`stg_name`, `stg_value`) VALUES('updateavailable', '0');
INSERT INTO `lime_settings_global` (`stg_name`, `stg_value`) VALUES('updatelastcheck', '2011-09-07 14:38:57');
INSERT INTO `lime_settings_global` (`stg_name`, `stg_value`) VALUES
('DBVersion', '155.6'),
('SessionName', 'ls28629164789259281352');
-- --------------------------------------------------------
@@ -795,7 +932,7 @@ CREATE TABLE `lime_surveys` (
`emailresponseto` text collate utf8_unicode_ci,
`emailnotificationto` text collate utf8_unicode_ci,
`tokenlength` tinyint(2) default '15',
`showXquestions` char(1) collate utf8_unicode_ci default 'Y',
`showxquestions` char(1) collate utf8_unicode_ci default 'Y',
`showgroupinfo` char(1) collate utf8_unicode_ci default 'B',
`shownoanswer` char(1) collate utf8_unicode_ci default 'Y',
`showqnumcode` char(1) collate utf8_unicode_ci default 'X',
@@ -812,6 +949,8 @@ CREATE TABLE `lime_surveys` (
`navigationdelay` tinyint(2) default '0',
`nokeyboard` char(1) collate utf8_unicode_ci default 'N',
`alloweditaftercompletion` char(1) collate utf8_unicode_ci default 'N',
`googleanalyticsstyle` char(1) collate utf8_unicode_ci default NULL,
`googleanalyticsapikey` varchar(25) collate utf8_unicode_ci default NULL,
PRIMARY KEY (`sid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
@@ -827,7 +966,7 @@ CREATE TABLE `lime_surveys` (
--
CREATE TABLE `lime_surveys_languagesettings` (
`surveyls_survey_id` int(10) unsigned NOT NULL default '0',
`surveyls_survey_id` int(11) NOT NULL default '0',
`surveyls_language` varchar(45) collate utf8_unicode_ci NOT NULL default 'en',
`surveyls_title` varchar(200) collate utf8_unicode_ci NOT NULL,
`surveyls_description` text collate utf8_unicode_ci,
@@ -844,11 +983,11 @@ CREATE TABLE `lime_surveys_languagesettings` (
`surveyls_email_confirm_subj` varchar(255) collate utf8_unicode_ci default NULL,
`surveyls_email_confirm` text collate utf8_unicode_ci,
`surveyls_dateformat` int(10) unsigned NOT NULL default '1',
`surveyls_numberformat` int(11) NOT NULL default '0',
`email_admin_notification_subj` varchar(255) collate utf8_unicode_ci default NULL,
`email_admin_notification` text collate utf8_unicode_ci,
`email_admin_responses_subj` varchar(255) collate utf8_unicode_ci default NULL,
`email_admin_responses` text collate utf8_unicode_ci,
`surveyls_numberformat` int(11) NOT NULL default '0',
PRIMARY KEY (`surveyls_survey_id`,`surveyls_language`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
@@ -857,6 +996,25 @@ CREATE TABLE `lime_surveys_languagesettings` (
--
-- --------------------------------------------------------
--
-- Table structure for table `lime_survey_links`
--
CREATE TABLE `lime_survey_links` (
`participant_id` varchar(50) collate utf8_unicode_ci NOT NULL,
`token_id` int(11) NOT NULL,
`survey_id` int(11) NOT NULL,
`date_created` datetime NOT NULL,
PRIMARY KEY (`participant_id`,`token_id`,`survey_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `lime_survey_links`
--
-- --------------------------------------------------------
--
@@ -864,8 +1022,8 @@ CREATE TABLE `lime_surveys_languagesettings` (
--
CREATE TABLE `lime_survey_permissions` (
`sid` int(10) unsigned NOT NULL,
`uid` int(10) unsigned NOT NULL,
`sid` int(11) NOT NULL,
`uid` int(11) NOT NULL,
`permission` varchar(20) collate utf8_unicode_ci NOT NULL,
`create_p` tinyint(1) NOT NULL default '0',
`read_p` tinyint(1) NOT NULL default '0',
@@ -927,19 +1085,22 @@ CREATE TABLE `lime_users` (
`users_name` varchar(64) collate utf8_unicode_ci NOT NULL default '',
`password` blob NOT NULL,
`full_name` varchar(50) collate utf8_unicode_ci NOT NULL,
`parent_id` int(10) unsigned NOT NULL,
`parent_id` int(11) NOT NULL,
`lang` varchar(20) collate utf8_unicode_ci default NULL,
`email` varchar(320) collate utf8_unicode_ci default NULL,
`create_survey` tinyint(1) NOT NULL default '0',
`create_user` tinyint(1) NOT NULL default '0',
`participant_panel` tinyint(1) NOT NULL default '0',
`delete_user` tinyint(1) NOT NULL default '0',
`superadmin` tinyint(1) NOT NULL default '0',
`configurator` tinyint(1) NOT NULL default '0',
`manage_template` tinyint(1) NOT NULL default '0',
`manage_label` tinyint(1) NOT NULL default '0',
`htmleditormode` varchar(7) collate utf8_unicode_ci default 'default',
`templateeditormode` varchar(7) collate utf8_unicode_ci default 'default',
`questionselectormode` varchar(7) collate utf8_unicode_ci default 'default',
`one_time_pw` blob,
`dateformat` int(10) unsigned NOT NULL default '1',
`dateformat` int(11) NOT NULL default '1',
PRIMARY KEY (`uid`),
UNIQUE KEY `users_name` (`users_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
@@ -948,7 +1109,8 @@ CREATE TABLE `lime_users` (
-- Dumping data for table `lime_users`
--
INSERT INTO `lime_users` (`uid`, `users_name`, `password`, `full_name`, `parent_id`, `lang`, `email`, `create_survey`, `create_user`, `delete_user`, `superadmin`, `configurator`, `manage_template`, `manage_label`, `htmleditormode`, `one_time_pw`, `dateformat`) VALUES(1, 'admin', 0x35653838343839386461323830343731353164306535366638646336323932373733363033643064366161626264643632613131656637323164313534326438, 'Your Name', 0, 'en', 'your@email.org', 1, 1, 1, 1, 1, 1, 1, 'default', NULL, 1);
INSERT INTO `lime_users` (`uid`, `users_name`, `password`, `full_name`, `parent_id`, `lang`, `email`, `create_survey`, `create_user`, `participant_panel`, `delete_user`, `superadmin`, `configurator`, `manage_template`, `manage_label`, `htmleditormode`, `templateeditormode`, `questionselectormode`, `one_time_pw`, `dateformat`) VALUES
(1, 'admin', 0x35653838343839386461323830343731353164306535366638646336323932373733363033643064366161626264643632613131656637323164313534326438, 'Your Name', 0, 'en', 'your-email@example.net', 1, 1, 0, 1, 1, 1, 1, 1, 'default', 'default', 'default', NULL, 1);
-- --------------------------------------------------------
@@ -957,10 +1119,10 @@ INSERT INTO `lime_users` (`uid`, `users_name`, `password`, `full_name`, `parent_
--
CREATE TABLE `lime_user_groups` (
`ugid` int(10) unsigned NOT NULL auto_increment,
`ugid` int(11) NOT NULL auto_increment,
`name` varchar(20) collate utf8_unicode_ci NOT NULL,
`description` text collate utf8_unicode_ci NOT NULL,
`owner_id` int(10) unsigned NOT NULL,
`owner_id` int(11) NOT NULL,
PRIMARY KEY (`ugid`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
@@ -977,8 +1139,8 @@ CREATE TABLE `lime_user_groups` (
--
CREATE TABLE `lime_user_in_groups` (
`ugid` int(10) unsigned NOT NULL,
`uid` int(10) unsigned NOT NULL,
`ugid` int(11) NOT NULL,
`uid` int(11) NOT NULL,
PRIMARY KEY (`ugid`,`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+2
View File
@@ -0,0 +1,2 @@
/upload/surveys/*
+3 -3
View File
@@ -10,15 +10,15 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: access_denied.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: access_denied.php 11607 2011-12-06 23:19:52Z tmswhite $
*/
if (!isset($dbprefix) || isset($_REQUEST['dbprefix'])) {die("Cannot run this script directly (access_denied)");}
include_once("login_check.php"); //Login Check dies also if the script is started directly
if (isset($_SESSION['loginID']))
{
include('html.php'); // For showadminmenu
$accesssummary = "<p><strong>".$clang->gT("Access denied!")."</strong><br />\n";
$action=returnglobal('action');
+2 -1
View File
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: activate.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: activate.php 11607 2011-12-06 23:19:52Z tmswhite $
*/
@@ -88,3 +88,4 @@ else
include('tokens.php');
}
}
File diff suppressed because it is too large Load Diff
+170 -52
View File
@@ -1,31 +1,22 @@
<?php
/*
* LimeSurvey
* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: admin.php 10925 2011-09-02 14:12:02Z c_schmitz $
*/
* LimeSurvey
* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: admin.php 12082 2012-01-17 04:55:39Z tmswhite $
*/
// Security Checked: POST, GET, SESSION, REQUEST, returnglobal, DB
require_once(dirname(__FILE__).'/../classes/core/startup.php');
// XML code for LS1.70 is based on the experimental PHP4 domxml
// extension. PHP5 uses the PHP5/dom extension unless the old domxml is activated
// the following file is a wrapper to use PHP4/domxml scripts
// with PHP5/dom or PHP6/dom
// see http://alexandre.alapetite.net/doc-alex/domxml-php4-php5/index.en.html#licence
if (version_compare(PHP_VERSION,'5','>=')&& !(function_exists('domxml_new_doc')))
{
require_once(dirname(__FILE__).'/classes/core/domxml-php4-to-php5.php');
}
require_once(dirname(__FILE__).'/../config-defaults.php');
require_once(dirname(__FILE__).'/../common.php');
@@ -45,6 +36,19 @@ if (!isset($action)) {$action=returnglobal('action');} //Desired action
if (!isset($subaction)) {$subaction=returnglobal('subaction');} //Desired subaction
if (!isset($editedaction)) {$editedaction=returnglobal('editedaction');} // for html editor integration
if (isset($_SERVER['HTTP_REFERER']))
{
$refurl = $_SERVER['HTTP_REFERER']; //store referer. Can be used for other screens and not just GlobalSettings
}
else
{
$refurl = "";
}
LimeExpressionManager::SetSurveyId($surveyid); // must be called early - it clears internal cache if a new survey is being used
if (!is_null($surveyid)) {
$sinfo = getSurveyInfo($surveyid);
LimeExpressionManager::SetEMLanguage($sinfo['surveyls_language']);
}
if ($action != 'showprintablesurvey' && substr($action,0,4)!= 'ajax')
{
@@ -85,15 +89,15 @@ if(isset($_SESSION['loginID']))
sendcacheheaders();
/* Check user right actions for validity
Currently existing user rights:
`configurator`
`create_survey`
`create_user`
`delete_user`
`manage_label`
`manage_template`
`superadmin`
*/
Currently existing user rights:
`configurator`
`create_survey`
`create_user`
`delete_user`
`manage_label`
`manage_template`
`superadmin`
*/
if ($action == 'importsurvey' || $action == 'copysurvey')
{
@@ -102,7 +106,7 @@ if(isset($_SESSION['loginID']))
}
elseif ($action == 'dumpdb')
{
if ($_SESSION['USER_RIGHT_CONFIGURATOR']==1) {include('dumpdb.php');}
if ($_SESSION['USER_RIGHT_SUPERADMIN']==1) {include('dumpdb.php');}
else { include('access_denied.php');}
}
elseif ($action == 'dumplabel')
@@ -149,14 +153,14 @@ if(isset($_SESSION['loginID']))
/* Check survey right actions for validity
Currently existing survey rights:
`edit_survey_property`
`define_questions`
`browse_response`
`export`
`delete_survey`
`activate_survey`
*/
Currently existing survey rights:
`edit_survey_property`
`define_questions`
`browse_response`
`export`
`delete_survey`
`activate_survey`
*/
if ($action == 'activate')
{
@@ -255,6 +259,25 @@ if(isset($_SESSION['loginID']))
exit;
}
elseif ($action == 'showlogicfile')
{
if(bHasSurveyPermission($surveyid,'translations','read'))
{
$surveyid = sanitize_int($surveyid);
$thissurvey = getSurveyInfo($surveyid);
$_POST['sid'] = $surveyid . '|N';
$_POST['LEM_PRETTY_PRINT_ALL_SYNTAX'] = 'Y';
$_POST['surveyMode'] = 'survey';
$_POST['LEMcalledFromAdmin'] = 'Y';
$_POST['assessments'] = $thissurvey['assessments'];
LimeExpressionManager::SetDirtyFlag();
if (isset($_GET['gid'])) { $_POST['gid'] = $_GET['gid']; }
if (isset($_GET['qid'])) { $_POST['qid'] = $_GET['qid']; }
include($rootdir . '/classes/expressions/test/survey_logic_file.php');
exit;
}
else { include('access_denied.php');}
}
elseif ($action=='addgroup' || $action=='editgroup' || $action=='ordergroups')
{
if(bHasSurveyPermission($surveyid,'surveycontent','read')) {$_SESSION['FileManagerContext']="edit:group:$surveyid"; include('questiongrouphandling.php');}
@@ -265,13 +288,13 @@ if(isset($_SESSION['loginID']))
if(bHasSurveyPermission($surveyid,'responses','read')) {include('saved.php');}
else { include('access_denied.php');}
}
//<AdV>
//<AdV>
elseif ($action == 'translate')
{
if(bHasSurveyPermission($surveyid,'translations','read')) {$_SESSION['FileManagerContext']="edit:translate:$surveyid"; include('translate.php');}
else { include('access_denied.php'); }
}
//</AdV>
//</AdV>
elseif ($action == 'tokens')
{
if(bHasSurveyPermission($surveyid,'tokens','read'))
@@ -437,11 +460,11 @@ if(isset($_SESSION['loginID']))
include('surveylist.php');
}
if (!isset($assessmentsoutput) && !isset($statisticsoutput) && !isset($browseoutput) &&
!isset($savedsurveyoutput) && !isset($listcolumnoutput) && !isset($conditionsoutput) &&
!isset($importoldresponsesoutput) && !isset($exportroutput) && !isset($vvoutput) &&
!isset($tokenoutput) && !isset($exportoutput) && !isset($templatesoutput) && !isset($translateoutput) && //<AdV>
!isset($iteratesurveyoutput) && (substr($action,0,4)!= 'ajax') && ($action!='update') &&
(isset($surveyid) || $action == "" || preg_match('/^(personalsettings|statistics|copysurvey|importsurvey|editsurveysettings|editsurveylocalesettings|updatesurveysettings|updatesurveysettingsandeditlocalesettings|updatedefaultvalues|ordergroups|dataentry|newsurvey|globalsettings|editusergroups|editusergroup|exportspss|surveyrights|quotas|editusers|login|browse|vvimport|vvexport|setuserrights|modifyuser|setusertemplates|deluser|adduser|userrights|usertemplates|moduser|addusertogroup|deleteuserfromgroup|globalsettingssave|savepersonalsettings|addusergroup|editusergroupindb|usergroupindb|finaldeluser|delusergroup|mailusergroup|mailsendusergroup)$/',$action)))
!isset($savedsurveyoutput) && !isset($listcolumnoutput) && !isset($conditionsoutput) &&
!isset($importoldresponsesoutput) && !isset($exportroutput) && !isset($vvoutput) &&
!isset($tokenoutput) && !isset($exportoutput) && !isset($templatesoutput) && !isset($translateoutput) && //<AdV>
!isset($iteratesurveyoutput) && (substr($action,0,4)!= 'ajax') && ($action!='update') &&
(isset($surveyid) || $action == "" || preg_match('/^(personalsettings|statistics|copysurvey|importsurvey|editsurveysettings|editsurveylocalesettings|updatesurveysettings|updatesurveysettingsandeditlocalesettings|updatedefaultvalues|ordergroups|dataentry|newsurvey|globalsettings|editusergroups|editusergroup|exportspss|surveyrights|quotas|editusers|login|browse|vvimport|vvexport|setuserrights|modifyuser|setusertemplates|deluser|adduser|userrights|usertemplates|moduser|addusertogroup|deleteuserfromgroup|globalsettingssave|savepersonalsettings|addusergroup|editusergroupindb|usergroupindb|finaldeluser|delusergroup|mailusergroup|mailsendusergroup)$/',$action)))
{
if ($action=='editsurveysettings' || $action=='editsurveylocalesettings')
{
@@ -520,8 +543,103 @@ if(isset($_SESSION['loginID']))
if(bHasSurveyPermission($surveyid,'responses','create')) {include('vvimport.php');}
else { include('access_denied.php');}
}
elseif ($action == 'EMtest') {
switch ($subaction) {
case 'functions':
if(bHasSurveyPermission($surveyid,'surveycontent','read')) {
include('../classes/expressions/test/functions.php');
}
else {
include('access_denied.php');
}
break;
case 'stringsplit':
if(bHasSurveyPermission($surveyid,'surveycontent','read')) {
include('../classes/expressions/test/stringsplit.php');
}
else {
include('access_denied.php');
}
break;
case 'tokenizer':
if(bHasSurveyPermission($surveyid,'surveycontent','read')) {
include('../classes/expressions/test/tokenizer.php');
}
else {
include('access_denied.php');
}
break;
case 'unit':
if(bHasSurveyPermission($surveyid,'surveycontent','read')) {
include('../classes/expressions/test/unit.php');
}
else {
include('access_denied.php');
}
break;
case 'strings_with_expressions':
if(bHasSurveyPermission($surveyid,'surveycontent','read')) {
include('../classes/expressions/test/strings_with_expressions.php');
}
else {
include('access_denied.php');
}
break;
case 'relevance':
if(bHasSurveyPermission($surveyid,'surveycontent','read')) {
include('../classes/expressions/test/relevance.php');
}
else {
include('access_denied.php');
}
break;
case 'conditions2relevance':
if (bHasSurveyPermission($surveyid, 'surveycontent', 'read'))
{
include('../classes/expressions/test/conditions2relevance.php');
}
else
{
include('access_denied.php');
}
break;
case 'navigation_test':
if($_SESSION['USER_RIGHT_CONFIGURATOR']==1) {
include('../classes/expressions/test/navigation_test.php');
}
else {
include('access_denied.php');
}
break;
case 'survey_logic_file':
if($_SESSION['USER_RIGHT_CONFIGURATOR']==1) {
include('../classes/expressions/test/survey_logic_file.php');
}
else {
include('access_denied.php');
}
break;
case 'upgrade_conditions2relevance':
if($_SESSION['USER_RIGHT_CONFIGURATOR']==1) {
include('../classes/expressions/test/upgrade_conditions2relevance.php');
}
else {
include('access_denied.php');
}
break;
default:
if(bHasSurveyPermission($surveyid,'surveycontent','read')) {
include('../classes/expressions/test/test.php');
}
else {
include('access_denied.php');
}
break;
}
exit;
}
if ($action=='addquestion' || $action=='copyquestion' || $action=='editquestion' || $action=='editdefaultvalues' ||
$action=='orderquestions' || $action=='ajaxquestionattributes' || $action=='ajaxlabelsetpicker' || $action=='ajaxlabelsetdetails')
$action=='orderquestions' || $action=='ajaxquestionattributes' || $action=='ajaxlabelsetpicker' || $action=='ajaxlabelsetdetails')
{
if(bHasSurveyPermission($surveyid,'surveycontent','read'))
{
@@ -674,11 +792,11 @@ if(isset($_SESSION['loginID']))
else
{ //not logged in
sendcacheheaders();
if (!isset($_SESSION['metaHeader'])) {$_SESSION['metaHeader']='';}
$adminoutput = getAdminHeader($_SESSION['metaHeader']).$adminoutput.$loginsummary; // All future output is written into this and then outputted at the end of file
unset($_SESSION['metaHeader']);
$adminoutput.= "</div>\n".getAdminFooter("http://docs.limesurvey.org", $clang->gT("LimeSurvey online manual"));
sendcacheheaders();
if (!isset($_SESSION['metaHeader'])) {$_SESSION['metaHeader']='';}
$adminoutput = getAdminHeader($_SESSION['metaHeader']).$adminoutput.$loginsummary; // All future output is written into this and then outputted at the end of file
unset($_SESSION['metaHeader']);
$adminoutput.= "</div>\n".getAdminFooter("http://docs.limesurvey.org", $clang->gT("LimeSurvey online manual"));
}
if (($action=='showphpinfo') && ($_SESSION['USER_RIGHT_CONFIGURATOR'] == 1))
{
+3 -2
View File
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: admin_functions.php 9586 2010-12-06 03:08:07Z c_schmitz $
* $Id: admin_functions.php 11664 2011-12-16 05:19:42Z tmswhite $
* Files Purpose:
*/
@@ -339,6 +339,7 @@ function getAdminHeader($meta=false)
$strAdminHeader.= "<script type=\"text/javascript\" src=\"{$homeurl}/scripts/tabpane/js/tabpane.js\"></script>\n"
. "<script type=\"text/javascript\" src=\"{$rooturl}/scripts/jquery/jquery.js\"></script>\n"
. "<script type=\"text/javascript\" src=\"{$rooturl}/scripts/jquery/jquery-ui.js\"></script>\n"
. "<script type=\"text/javascript\" src=\"".$rooturl."/scripts/jquery/jquery.ui.touch-punch.min.js\"></script>\n"
. "<script type=\"text/javascript\" src=\"{$rooturl}/scripts/jquery/jquery.qtip.js\"></script>\n"
. "<script type=\"text/javascript\" src=\"{$rooturl}/scripts/jquery/jquery.notify.js\"></script>\n"
. "<script type=\"text/javascript\" src=\"{$homeurl}/scripts/admin_core.js\"></script>\n";
@@ -404,4 +405,4 @@ function getAdminHeader($meta=false)
// Standard header
$strAdminHeader .="<div class='maintitle'>{$sitename}</div>\n";
return $strAdminHeader;
}
}
+30 -27
View File
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: assessments.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: assessments.php 11664 2011-12-16 05:19:42Z tmswhite $
*/
@@ -115,7 +115,7 @@ if (bHasSurveyPermission($surveyid, 'assessments','read'))
$assessmentsoutput.= "\t</div>\n"
. "\t<div class='menubar-main'>\n"
. "<div class='menubar-left'>\n"
. "\t<a href=\"#\" onclick=\"window.open('$scriptname?sid=$surveyid', '_self')\" title='".$clang->gTview("Return to survey administration")."'>"
. "\t<a href=\"#\" onclick=\"window.open('$scriptname?sid=$surveyid', '_self')\" title='".$clang->gTview("Return to survey administration")."'>"
. "<img name='Administration' src='$imageurl/home.png' alt='".$clang->gT("Return to survey administration")."' /></a>\n"
. "\t<img src='$imageurl/blank.gif' alt='' width='11' />\n"
. "\t<img src='$imageurl/seperator.gif' alt='' />\n";
@@ -171,10 +171,11 @@ if (bHasSurveyPermission($surveyid, 'assessments','read'))
$assessmentsoutput.= "<th>$head</th>\n";
}
$assessmentsoutput.= "<th>".$clang->gT("Title")."</th><th>".$clang->gT("Message")."</th>";
$assessmentsoutput.= "</tr></thead>\n<tbody>\n";
$assessmentsoutput.= "</tr></thead>\n";
$flipflop=true;
foreach($assessments as $assess) {
$flipflop=!$flipflop;
$assessmentsoutput.= "<tbody>\n";
if ($flipflop==true){$assessmentsoutput.= "<tr class='oddrow'>\n";}
else {$assessmentsoutput.= "<tr class='evenrow'>\n";}
$assessmentsoutput.= "<td>".$assess['id']."</td>\n";
@@ -226,32 +227,33 @@ if (bHasSurveyPermission($surveyid, 'assessments','read'))
$assessmentsoutput.= "<br /><form method='post' class='form30' id='assessmentsform' name='assessmentsform' action='$scriptname?sid=$surveyid'><div class='header ui-widget-header'>\n";
$assessmentsoutput.= "$actiontitle</div>\n";
$assessmentsoutput.="<ul><li><label>".$clang->gT("Scope")."</label><input type='radio' id='radiototal' name='scope' value='T' ";
$assessmentsoutput.="<ul>\n"
."<li><label>".$clang->gT("Scope")."</label><input type='radio' id='radiototal' name='scope' value='T' ";
if (!isset($editdata) || $editdata['scope'] == "T") {$assessmentsoutput .= " checked='checked' ";}
$assessmentsoutput.=" /><label for='radiototal'>".$clang->gT("Total")."</label>
<input type='radio' id='radiogroup' name='scope' value='G'";
if (isset($editdata) && $editdata['scope'] == "G") {$assessmentsoutput .= " checked='checked' ";}
$assessmentsoutput.="/><label for='radiogroup'>".$clang->gT("Group")."</label></li>";
$assessmentsoutput.="<li><label for='gid'>".$clang->gT("Question group")."</label>$groupselect</li>"
$assessmentsoutput.="/><label for='radiogroup'>".$clang->gT("Group")."</label></li>\n";
$assessmentsoutput.="<li><label for='gid'>".$clang->gT("Question group")."</label>$groupselect</li>\n"
."<li><label for='minimum'>".$clang->gT("Minimum")."</label><input type='text' id='minimum' name='minimum' class='numbersonly'";
if (isset($editdata)) {$assessmentsoutput .= " value='{$editdata['minimum']}' ";}
$assessmentsoutput.="/></li>"
$assessmentsoutput.="/></li>\n"
."<li><label for='maximum'>".$clang->gT("Maximum")."</label><input type='text' id='maximum' name='maximum' class='numbersonly'";
if (isset($editdata)) {$assessmentsoutput .= " value='{$editdata['maximum']}' ";}
$assessmentsoutput.="/></li>";
$assessmentsoutput.="/></li>\n"
."</ul>";
// start tabs
$assessmentsoutput.= "<tr><td>&nbsp;</td><td>&nbsp;</td></tr>\n";
$assessmentsoutput.='</table><div id="languagetabs">'
.'<ul>';
$assessmentsoutput.= "<div id=\"languagetabs\">"
."<ul>\n";
foreach ($assessmentlangs as $assessmentlang)
{
$position=0;
$assessmentsoutput .= '<li><a href="#tablang'.$assessmentlang.'"><span>'.getLanguageNameFromCode($assessmentlang, false);
if ($assessmentlang==$baselang) {$assessmentsoutput .= ' ('.$clang->gT("Base language").')';}
$assessmentsoutput .='</span></a></li>';
$assessmentsoutput .="</span></a></li>\n";
}
$assessmentsoutput.= '</ul>';
$assessmentsoutput.= "</ul>\n";
foreach ($assessmentlangs as $assessmentlang)
{
$heading=''; $message='';
@@ -265,28 +267,29 @@ if (bHasSurveyPermission($surveyid, 'assessments','read'))
$heading=htmlspecialchars($editdata['name'],ENT_QUOTES);
$message=htmlspecialchars($editdata['message']);
}
$assessmentsoutput .= '<div id="tablang'.$assessmentlang.'">';
$assessmentsoutput .= $clang->gT("Heading")."<br/>"
."<input type='text' name='name_$assessmentlang' size='80' value='$heading'/><br /><br />"
.$clang->gT("Message")
."<textarea name='assessmentmessage_$assessmentlang' id='assessmentmessage_$assessmentlang' rows='10' cols='80'>$message</textarea >";
$assessmentsoutput .='</div>';
$assessmentsoutput .= "<div id=\"tablang".$assessmentlang."\">\n"
."\t<div class='settingrow'>\n"
."\t\t<span class=\"settingcaption\">".$clang->gT("Heading")."</span>\n"
."\t\t<span class=\"settingentry\"><input type='text' name='name_$assessmentlang' size='80' value='$heading'/></span>\n"
."\t</div>\n"
."\t<div class='settingrow'>\n"
."\t\t<span class=\"settingcaption\">".$clang->gT("Message")."</span>\n"
."\t\t<span class=\"settingentry\">\n\t\t\t<textarea name='assessmentmessage_$assessmentlang' id='assessmentmessage_$assessmentlang' rows='10' cols='80'>$message</textarea >\n";
$assessmentsoutput.=getEditor("assessment-text","assessmentmessage_$assessmentlang", "[".$clang->gT("Message:", "js")."]",$surveyid,$gid,$qid,$action);
$assessmentsoutput .="</span>\n\t</div>\n"
."\t<div style='clear:both'></div>\n"
."</div>";
}
$assessmentsoutput .='</div>';
$assessmentsoutput.= "<p><input type='submit' value='".$clang->gT("Save")."' />\n";
$assessmentsoutput.= "<p>\n"
."<input type='submit' value='".$clang->gT("Save")."' />\n";
if ($action == "assessmentedit") $assessmentsoutput.= "&nbsp;&nbsp;&nbsp;&nbsp;<input type='submit' value='".$clang->gT("Cancel")."' onclick=\"document.assessmentsform.action.value='assessments'\" />\n";
$assessmentsoutput.= "<input type='hidden' name='sid' value='$surveyid' />\n"
."<input type='hidden' name='action' value='$actionvalue' />\n"
."<input type='hidden' name='id' value='$thisid' />\n"
."</div>\n"
."</p>\n"
."</form>\n";
foreach ($assessmentlangs as $assessmentlang)
{
$assessmentsoutput.=getEditor("assessment-text","assessmentmessage_$assessmentlang", "[".$clang->gT("Message:", "js")."]",$surveyid,$gid,$qid,$action);
}
}
}
+38 -32
View File
@@ -10,14 +10,13 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: browse.php 10925 2011-09-02 14:12:02Z c_schmitz $
*/
include_once("login_check.php"); //Login Check dies also if the script is started directly
if (!isset($limit)) {$limit=returnglobal('limit');}
if (!isset($limit)) {$limit=(int)returnglobal('limit');}
if (!isset($surveyid)) {$surveyid=returnglobal('sid');}
if (!isset($id)) {$id=returnglobal('id');}
if (!isset($id)) {$id=(int)returnglobal('id');}
if (!isset($order)) {$order=returnglobal('order');}
if (!isset($browselang)) {$browselang=returnglobal('browselang');}
@@ -121,7 +120,7 @@ if ($subaction == "id")
$dateformatdetails=getDateFormatData($_SESSION['dateformat']);
//SHOW HEADER
if (!isset($_POST['sql']) || !$_POST['sql']) {$browseoutput .= $surveyoptions;} // Don't show options if coming from tokens/statistics script
if (!isset($_SESSION['sql']) || !$_SESSION['sql']) {$browseoutput .= $surveyoptions;} // Don't show options if coming from tokens/statistics script
//FIRST LETS GET THE NAMES OF THE QUESTIONS AND MATCH THEM TO THE FIELD NAMES FOR THE DATABASE
$fncount = 0;
@@ -188,20 +187,22 @@ if ($subaction == "id")
$nfncount = count($fnames)-1;
//SHOW INDIVIDUAL RECORD
$idquery = "SELECT * FROM $surveytable ";
$idquery = "SELECT * FROM {$surveytable} s";
if ($surveyinfo['anonymized'] == "N" && db_tables_exist($tokentable))
$idquery .= "LEFT JOIN $tokentable ON $surveytable.token = $tokentable.token ";
$idquery .= " LEFT JOIN {$tokentable} t ON s.token = t.token ";
//queXS Addition
$qfs = questionnaireSampleFilterstate();
if ($qfs != false)
{
//Limit responses by questionnaire and/or sample
$query .= " JOIN `case` AS c ON ($surveytable.token = c.case_id AND c.questionnaire_id = '{$qfs[0]}') ";
$query .= " JOIN `case` AS c ON (s.token = c.case_id AND c.questionnaire_id = '{$qfs[0]}') ";
if ($qfs[1] != 0) //if a sample is selected
$query .= " JOIN `sample` AS s ON (s.sample_id = c.sample_id AND s.import_id = '{$qfs[1]}') ";
$query .= " JOIN `sample` AS ss ON (ss.sample_id = c.sample_id AND ss.import_id = '{$qfs[1]}') ";
}
if (incompleteAnsFilterstate() == "inc")
$idquery .= " WHERE (submitdate = ".$connect->DBDate('1980-01-01'). " OR submitdate IS NULL) AND ";
elseif (incompleteAnsFilterstate() == "filter")
@@ -209,12 +210,7 @@ if ($subaction == "id")
else
$idquery .= " WHERE ";
if ($id < 1) { $id = 1; }
if (isset($_POST['sql']) && $_POST['sql'])
{
if (get_magic_quotes_gpc()) {$idquery .= stripslashes($_POST['sql']);}
else {$idquery .= "{$_POST['sql']}";}
}
else {$idquery .= "$surveytable.id = $id";}
$idquery .= " s.id = $id";
$idresult = db_execute_assoc($idquery) or safe_die ("Couldn't get entry<br />\n$idquery<br />\n".$connect->ErrorMsg());
while ($idrow = $idresult->FetchRow())
{
@@ -273,6 +269,10 @@ if ($subaction == "id")
$highlight=false;
for ($i = 0; $i < $nfncount+1; $i++)
{
if ($fnames[$i][0] != 'completed' && is_null($idrow[$fnames[$i][0]]))
{
continue; // irrelevant, so don't show
}
$inserthighlight='';
if ($highlight)
$inserthighlight="class='highlight'";
@@ -329,20 +329,21 @@ elseif ($subaction == "all")
var noFilesSelectedForDeletion = '".$clang->gT('Please select at least one file for deletion','js')."';
var noFilesSelectedForDnld = '".$clang->gT('Please select at least one file for download','js')."';
</script>\n";
if (!isset($_POST['sql']))
{$browseoutput .= $surveyoptions;} //don't show options when called from another script with a filter on
else
$browseoutput .= $surveyoptions;
$bClearFilter=returnglobal('clearfilter');
if ($bClearFilter)
{
$browseoutput .= "\t<tr><td colspan='2' height='4'><strong>".$clang->gT("Browse Responses").":</strong> $surveyname</td></tr>\n"
."\n<tr><td><table width='100%' align='center' border='0' bgcolor='#EFEFEF'>\n"
."\t<tr>\n"
."<td align='center'>\n"
."".$clang->gT("Showing Filtered Results")."<br />\n"
."&nbsp;[<a href=\"javascript:window.close()\">".$clang->gT("Close")."</a>]"
."</font></td>\n"
."\t</tr>\n"
."</table></td></tr>\n";
unset($_SESSION['sql']);
}
if (isset($_SESSION['sql']))
{
$browseoutput .= "<form action='$scriptname?clearfilter=1' method='post'>
<p>".$clang->gT("Note:").'&nbsp;'.$clang->gT("Showing Filtered Results")." "
."&nbsp;<input type='submit' value='".$clang->gT("Remove filter")."'>
<input type='hidden' name='sid' value='$surveyid' />
<input type='hidden' name='action' value='browse' />
<input type='hidden' name='subaction' value='all' />
</p></form>\n";
}
//Delete Individual answer using inrow delete buttons/links - checked
@@ -597,6 +598,7 @@ elseif ($subaction == "all")
}
$selectedgroup = returnglobal('selectgroup'); // group token id
$sql_where = "";
@@ -624,9 +626,9 @@ elseif ($subaction == "all")
if ($limit > $dtcount) {$limit=$dtcount;}
//NOW LETS SHOW THE DATA
if (isset($_POST['sql']))
if (isset($_SESSION['sql']))
{
if ($_POST['sql'] == "NULL" )
if ($_SESSION['sql'] == "NULL" )
{
if ($surveyinfo['anonymized'] == "N" && db_tables_exist($tokentable))
$dtquery = "SELECT * FROM $surveytable LEFT JOIN $tokentable ON $surveytable.token = $tokentable.token ";
@@ -657,6 +659,7 @@ elseif ($subaction == "all")
}
else
{
if ($surveytable['anonymized'] == "N" && db_tables_exist($tokentable))
$dtquery = "SELECT * FROM $surveytable LEFT JOIN $tokentable ON $surveytable.token = $tokentable.token WHERE 1=1 ";
else
@@ -681,9 +684,9 @@ elseif ($subaction == "all")
{
$dtquery .= " AND submitdate IS NOT NULL ";
}
if (stripcslashes($_POST['sql']) !== "")
if ($_SESSION['sql'] !== "")
{
$dtquery .= ' AND '.stripcslashes($_POST['sql'])." ";
$dtquery .= ' AND '.$_SESSION['sql']." ";
}
$dtquery .= " ORDER BY {$surveytable}.id";
}
@@ -704,6 +707,7 @@ elseif ($subaction == "all")
$dtquery .= " JOIN `sample` AS s ON (s.sample_id = c.sample_id AND s.import_id = '{$qfs[1]}') ";
}
if (incompleteAnsFilterstate() == "inc")
{
$dtquery .= " WHERE submitdate IS NULL ";
@@ -772,13 +776,14 @@ elseif ($subaction == "all")
$browseoutput .="<form action='$scriptname?action=browse' id='browseresults' method='post'><font size='1' face='verdana'>\n"
."<img src='$imageurl/blank.gif' width='31' height='20' border='0' hspace='0' align='right' alt='' />\n"
."&nbsp;&nbsp; ".$clang->gT("Display:")."<select name='filterinc' onchange='javascript:document.getElementById(\"limit\").value=\"\";submit();'>\n"
."&nbsp;&nbsp; ".$clang->gT("Display:")."<select name='filterinc' onchange='javascript:document.getElementById(\"limit\").value=\"\";submit();'>\n"
."\t<option value='show' $selectshow>".$clang->gT("All responses")."</option>\n"
."\t<option value='filter' $selecthide>".$clang->gT("Completed responses only")."</option>\n"
."\t<option value='incomplete' $selectinc>".$clang->gT("Incomplete responses only")."</option>\n"
."</select>\n";
$quexsfilterstate = questionnaireSampleFilterstate();
//queXS Addition
@@ -793,6 +798,7 @@ $quexsfilterstate = questionnaireSampleFilterstate();
."&nbsp;&nbsp; <input type='submit' value='".$clang->gT("Show")."' />\n";
$browseoutput .= "</font>\n"
."<input type='hidden' name='sid' value='$surveyid' />\n"
."<input type='hidden' name='action' value='browse' />\n"
File diff suppressed because it is too large Load Diff
@@ -1,54 +1,54 @@
<?php
final class SettingsStorage extends ArrayObject
{
protected static $_instance = null;
public function __construct($array = array(), $flags = parent::ARRAY_AS_PROPS)
{
parent::__construct($array, $flags);
}
public static function getInstance()
{
if( self::$_instance === NULL ) {
self::$_instance = new self();
}
return self::$_instance;
}
public static function get($index)
{
$instance = self::getInstance();
if (!$instance->offsetExists($index)) {
throw new Exception("No entry is registered for key '$index'");
}
return $instance->offsetGet($index);
}
public static function set($index, $value)
{
$instance = self::getInstance();
$instance->offsetSet($index, $value);
}
public static function isRegistered($index)
{
if (self::$_instance === null) {
return false;
}
return self::$_instance->offsetExists($index);
}
/**
* Workaround for http://bugs.php.net/bug.php?id=40442 (ZF-960).
*/
public function offsetExists($index)
{
return array_key_exists($index, $this);
}
}
<?php
final class SettingsStorage extends ArrayObject
{
protected static $_instance = null;
public function __construct($array = array(), $flags = parent::ARRAY_AS_PROPS)
{
parent::__construct($array, $flags);
}
public static function getInstance()
{
if( self::$_instance === NULL ) {
self::$_instance = new self();
}
return self::$_instance;
}
public static function get($index)
{
$instance = self::getInstance();
if (!$instance->offsetExists($index)) {
throw new Exception("No entry is registered for key '$index'");
}
return $instance->offsetGet($index);
}
public static function set($index, $value)
{
$instance = self::getInstance();
$instance->offsetSet($index, $value);
}
public static function isRegistered($index)
{
if (self::$_instance === null) {
return false;
}
return self::$_instance->offsetExists($index);
}
/**
* Workaround for http://bugs.php.net/bug.php?id=40442 (ZF-960).
*/
public function offsetExists($index)
{
return array_key_exists($index, $this);
}
}
?>
File diff suppressed because it is too large Load Diff
@@ -1,325 +1,320 @@
<?php
/**
* GTranslate - A class to comunicate with Google Translate(TM) Service
* Google Translate(TM) API Wrapper
* More info about Google(TM) service can be found on http://code.google.com/apis/ajaxlanguage/documentation/reference.html
* This code has o affiliation with Google (TM) , its a PHP Library that allows to comunicate with public a API
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author Jose da Silva <jose@josedasilva.net>
* @since 2009/11/18
* @version 0.7.4
* @licence LGPL v3
*
* <code>
* <?
* require_once("GTranslate.php");
* try{
* $gt = new Gtranslate;
* echo $gt->english_to_german("hello world");
* } catch (GTranslateException $ge)
* {
* echo $ge->getMessage();
* }
* ?>
* </code>
*/
/**
* Exception class for GTranslated Exceptions
*/
class GTranslateException extends Exception
{
public function __construct($string) {
parent::__construct($string, 0);
}
public function __toString() {
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
}
}
class GTranslate
{
/**
* Google Translate(TM) Api endpoint
* @access private
* @var String
*/
private $url = "http://ajax.googleapis.com/ajax/services/language/translate";
/**
* Google Translate (TM) Api Version
* @access private
* @var String
*/
private $api_version = "1.0";
/**
* Comunication Transport Method
* Available: http / curl
* @access private
* @var String
*/
private $request_type = "http";
/**
* Path to available languages file
* @access private
* @var String
*/
private $available_languages_file = "languages.ini";
/**
* Holder to the parse of the ini file
* @access private
* @var Array
*/
private $available_languages = array();
/**
* Google Translate api key
* @access private
* @var string
*/
private $api_key = null;
/**
* Google request User IP
* @access private
* @var string
*/
private $user_ip = null;
/**
* Constructor sets up {@link $available_languages}
*/
public function __construct()
{
$this->available_languages = parse_ini_file("languages.ini");
}
/**
* URL Formater to use on request
* @access private
* @param array $lang_pair
* @param array $string
* "returns String $url
*/
private function urlFormat($lang_pair,$string)
{
$parameters = array(
"v" => $this->api_version,
"q" => $string,
"langpair"=> implode("|",$lang_pair)
);
if(!empty($this->api_key))
{
$parameters["key"] = $this->api_key;
}
if( empty($this->user_ip) )
{
if( !empty($_SERVER["REMOTE_ADDR"]) )
{
$parameters["userip"] = $_SERVER["REMOTE_ADDR"];
}
} else
{
$parameters["userip"] = $this->user_ip;
}
$url = "";
foreach($parameters as $k=>$p)
{
$url .= $k."=".urlencode($p)."&";
}
return $url;
}
/**
* Define the request type
* @access public
* @param string $request_type
* return boolean
*/
public function setRequestType($request_type = 'http') {
if (!empty($request_type)) {
$this->request_type = $request_type;
return true;
}
return false;
}
/**
* Define the Google Translate Api Key
* @access public
* @param string $api_key
* return boolean
*/
public function setApiKey($api_key) {
if (!empty($api_key)) {
$this->api_key = $api_key;
return true;
}
return false;
}
/**
* Define the User Ip for the query
* @access public
* @param string $ip
* return boolean
*/
public function setUserIp($ip) {
if (!empty($ip)) {
$this->user_ip = $ip;
return true;
}
return false;
}
/**
* Query the Google(TM) endpoint
* @access private
* @param array $lang_pair
* @param array $string
* returns String $response
*/
public function query($lang_pair,$string)
{
$query_url = $this->urlFormat($lang_pair,$string);
$response = $this->{"request".ucwords($this->request_type)}($query_url);
return $response;
}
/**
* Query Wrapper for Http Transport
* @access private
* @param String $url
* returns String $response
*/
private function requestHttp($url)
{
return GTranslate::evalResponse(json_decode(file_get_contents($this->url."?".$url)));
}
/**
* Query Wrapper for Curl Transport
* @access private
* @param String $url
* returns String $response
*/
private function requestCurl($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, !empty($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $url);
$body = curl_exec($ch);
curl_close($ch);
return GTranslate::evalResponse(json_decode($body));
}
/**
* Response Evaluator, validates the response
* Throws an exception on error
* @access private
* @param String $json_response
* returns String $response
*/
private function evalResponse($json_response)
{
switch($json_response->responseStatus)
{
case 200:
return $json_response->responseData->translatedText;
break;
default:
throw new GTranslateException("Unable to perform Translation:".$json_response->responseDetails);
break;
}
}
/**
* Validates if the language pair is valid
* Throws an exception on error
* @access private
* @param Array $languages
* returns Array $response Array with formated languages pair
*/
private function isValidLanguage($languages)
{
$language_list = $this->available_languages;
$languages = array_map( "strtolower", $languages );
$language_list_v = array_map( "strtolower", array_values($language_list) );
$language_list_k = array_map( "strtolower", array_keys($language_list) );
$valid_languages = false;
if( TRUE == in_array($languages[0],$language_list_v) AND TRUE == in_array($languages[1],$language_list_v) )
{
$valid_languages = true;
}
if( FALSE === $valid_languages AND TRUE == in_array($languages[0],$language_list_k) AND TRUE == in_array($languages[1],$language_list_k) )
{
$languages = array($language_list[strtoupper($languages[0])],$language_list[strtoupper($languages[1])]);
$valid_languages = true;
}
if( FALSE === $valid_languages )
{
throw new GTranslateException("Unsupported languages");
}
return $languages;
}
/**
* Magic method to understande translation comman
* Evaluates methods like language_to_language
* @access public
* @param String $name
* @param Array $args
* returns String $response Translated Text
*/
public function __call($name,$args)
{
$languages_list = explode("_to_",strtolower($name));
$languages = $this->isValidLanguage($languages_list);
$string = $args[0];
return $this->query($languages,$string);
}
}
?>
<?php
/**
* GTranslate - A class to comunicate with Google Translate(TM) Service
* Google Translate(TM) API Wrapper
* More info about Google(TM) service can be found on http://code.google.com/apis/ajaxlanguage/documentation/reference.html
* This code has o affiliation with Google (TM) , its a PHP Library that allows to comunicate with public a API
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author Jose da Silva <jose@josedasilva.net>
* @since 2009/11/18
* @version 0.7.4
* @licence LGPL v3
*
* <code>
* <?
* require_once("GTranslate.php");
* try{
* $gt = new Gtranslate;
* echo $gt->english_to_german("hello world");
* } catch (GTranslateException $ge)
* {
* echo $ge->getMessage();
* }
* ?>
* </code>
*/
/**
* Exception class for GTranslated Exceptions
*/
class GTranslateException extends Exception
{
public function __construct($string) {
parent::__construct($string, 0);
}
public function __toString() {
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
}
}
class GTranslate
{
/**
* Google Translate(TM) Api endpoint
* @access private
* @var String
*/
private $url = "https://www.googleapis.com/language/translate/v2";
/**
* Google Translate (TM) Api Version
* @access private
* @var String
*/
private $api_version = "2";
/**
* Comunication Transport Method
* Available: http / curl
* @access private
* @var String
*/
private $request_type = "http";
/**
* Path to available languages file
* @access private
* @var String
*/
private $available_languages_file = "languages.ini";
/**
* Holder to the parse of the ini file
* @access private
* @var Array
*/
private $available_languages = array();
/**
* Google Translate api key
* @access private
* @var string
*/
private $api_key = null;
/**
* Google request User IP
* @access private
* @var string
*/
private $user_ip = null;
/**
* Constructor sets up {@link $available_languages}
*/
public function __construct()
{
$this->available_languages = parse_ini_file("languages.ini");
}
/**
* URL Formater to use on request
* @access private
* @param array $lang_pair
* @param array $string
* "returns String $url
*/
private function urlFormat($lang_pair,$string)
{
$parameters = array(
"q" => $string,
"source" => $lang_pair[0],
"target" => $lang_pair[1],
);
if(!empty($this->api_key))
{
$parameters["key"] = $this->api_key;
}
else
{
$parameters["key"] = getGlobalSetting('googletranslateapikey');
}
$url = "";
foreach($parameters as $k=>$p)
{
$url .= $k."=".urlencode($p)."&";
}
return $url;
}
/**
* Define the request type
* @access public
* @param string $request_type
* return boolean
*/
public function setRequestType($request_type = 'http') {
if (!empty($request_type)) {
$this->request_type = $request_type;
return true;
}
return false;
}
/**
* Define the Google Translate Api Key
* @access public
* @param string $api_key
* return boolean
*/
public function setApiKey($api_key) {
if (!empty($api_key)) {
$this->api_key = $api_key;
return true;
}
return false;
}
/**
* Define the User Ip for the query
* @access public
* @param string $ip
* return boolean
*/
public function setUserIp($ip) {
if (!empty($ip)) {
$this->user_ip = $ip;
return true;
}
return false;
}
/**
* Query the Google(TM) endpoint
* @access private
* @param array $lang_pair
* @param array $string
* returns String $response
*/
public function query($lang_pair,$string)
{
$query_url = $this->urlFormat($lang_pair,$string);
$response = $this->{"request".ucwords($this->request_type)}($query_url);
return $response;
}
/**
* Query Wrapper for Http Transport
* @access private
* @param String $url
* returns String $response
*/
private function requestHttp($url)
{
$fullurl = $this->url."?".$url;
$return = file_get_contents($fullurl);
$json = json_decode($return);
return GTranslate::evalResponse($json);
}
/**
* Query Wrapper for Curl Transport
* @access private
* @param String $url
* returns String $response
*/
private function requestCurl($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, !empty($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $url);
$body = curl_exec($ch);
curl_close($ch);
return GTranslate::evalResponse(json_decode($body));
}
/**
* Response Evaluator, validates the response
* Throws an exception on error
* @access private
* @param String $json_response
* returns String $response
*/
private function evalResponse($json_response)
{
if (isset($json_response->data->translations))
{
return $json_response->data->translations[0]->translatedText;
}
else
{
throw new GTranslateException("Unable to perform Translation:".$json_response->data);
}
}
/**
* Validates if the language pair is valid
* Throws an exception on error
* @access private
* @param Array $languages
* returns Array $response Array with formated languages pair
*/
private function isValidLanguage($languages)
{
$language_list = $this->available_languages;
$languages = array_map( "strtolower", $languages );
$language_list_v = array_map( "strtolower", array_values($language_list) );
$language_list_k = array_map( "strtolower", array_keys($language_list) );
$valid_languages = false;
if( TRUE == in_array($languages[0],$language_list_v) AND TRUE == in_array($languages[1],$language_list_v) )
{
$valid_languages = true;
}
if( FALSE === $valid_languages AND TRUE == in_array($languages[0],$language_list_k) AND TRUE == in_array($languages[1],$language_list_k) )
{
$languages = array($language_list[strtoupper($languages[0])],$language_list[strtoupper($languages[1])]);
$valid_languages = true;
}
if( FALSE === $valid_languages )
{
throw new GTranslateException("Unsupported languages");
}
return $languages;
}
/**
* Magic method to understande translation comman
* Evaluates methods like language_to_language
* @access public
* @param String $name
* @param Array $args
* returns String $response Translated Text
*/
public function __call($name,$args)
{
$languages_list = explode("_to_",strtolower($name));
$languages = $this->isValidLanguage($languages_list);
$string = $args[0];
return $this->query($languages,$string);
}
}
?>
@@ -1,110 +1,110 @@
AFRIKAANS = af
ALBANIAN = sq
AMHARIC = am
ARABIC = ar
ARMENIAN = hy
AZERBAIJANI = az
BASQUE = eu
BELARUSIAN = be
BENGALI = bn
BIHARI = bh
BRETON = br
BULGARIAN = bg
BURMESE = my
CATALAN = ca
CHEROKEE = chr
CHINESE = zh
CHINESE_SIMPLIFIED = zh-Hans
CHINESE_TRADITIONAL = zh-Hant
CORSICAN = co
CROATIAN = hr
CZECH = cs
DANISH = da
DHIVEHI = dv
DUTCH = nl
ENGLISH = en
ESPERANTO = eo
ESTONIAN = et
FAROESE = fo
FILIPINO = tl
FINNISH = fi
FRENCH = fr
FRISIAN = fy
GALICIAN = gl
GEORGIAN = ka
GERMAN = de
GERMAN INFORMAL= de-informal
GREEK = el
GUJARATI = gu
HAITIAN_CREOLE = ht
HEBREW = iw
HINDI = hi
HUNGARIAN = hu
ICELANDIC = is
INDONESIAN = id
INUKTITUT = iu
IRISH = ga
ITALIAN = it
JAPANESE = ja
JAVANESE = jw
KANNADA = kn
KAZAKH = kk
KHMER = km
KOREAN = ko
KURDISH = ku
KYRGYZ = ky
LAO = lo
LATIN = la
LATVIAN = lv
LITHUANIAN = lt
LUXEMBOURGISH = lb
MACEDONIAN = mk
MALAY = ms
MALAYALAM = ml
MALTESE = mt
MAORI = mi
MARATHI = mr
MONGOLIAN = mn
NEPALI = ne
NORWEGIAN = no
NORWEGIAN NYNORSK = nn
NORWEGIAN BOKMAL = nb
OCCITAN = oc
ORIYA = or
PASHTO = ps
PERSIAN = fa
POLISH = pl
PORTUGUESE = pt
PORTUGUESE_PORTUGAL = pt-PT
PUNJABI = pa
QUECHUA = qu
ROMANIAN = ro
RUSSIAN = ru
SANSKRIT = sa
SCOTS_GAELIC = gd
SERBIAN = sr
SINDHI = sd
SINHALESE = si
SLOVAK = sk
SLOVENIAN = sl
SPANISH = es
SUNDANESE = su
SWAHILI = sw
SWEDISH = sv
SYRIAC = syr
TAJIK = tg
TAMIL = ta
TATAR = tt
TELUGU = te
THAI = th
TIBETAN = bo
TONGA = to
TURKISH = tr
UKRAINIAN = uk
URDU = ur
UZBEK = uz
UIGHUR = ug
VIETNAMESE = vi
WELSH = cy
YIDDISH = yi
YORUBA = yo
AFRIKAANS = af
ALBANIAN = sq
AMHARIC = am
ARABIC = ar
ARMENIAN = hy
AZERBAIJANI = az
BASQUE = eu
BELARUSIAN = be
BENGALI = bn
BIHARI = bh
BRETON = br
BULGARIAN = bg
BURMESE = my
CATALAN = ca
CHEROKEE = chr
CHINESE = zh
CHINESE_SIMPLIFIED = zh-Hans
CHINESE_TRADITIONAL = zh-Hant
CORSICAN = co
CROATIAN = hr
CZECH = cs
DANISH = da
DHIVEHI = dv
DUTCH = nl
ENGLISH = en
ESPERANTO = eo
ESTONIAN = et
FAROESE = fo
FILIPINO = tl
FINNISH = fi
FRENCH = fr
FRISIAN = fy
GALICIAN = gl
GEORGIAN = ka
GERMAN = de
GERMAN INFORMAL= de-informal
GREEK = el
GUJARATI = gu
HAITIAN_CREOLE = ht
HEBREW = iw
HINDI = hi
HUNGARIAN = hu
ICELANDIC = is
INDONESIAN = id
INUKTITUT = iu
IRISH = ga
ITALIAN = it
JAPANESE = ja
JAVANESE = jw
KANNADA = kn
KAZAKH = kk
KHMER = km
KOREAN = ko
KURDISH = ku
KYRGYZ = ky
LAO = lo
LATIN = la
LATVIAN = lv
LITHUANIAN = lt
LUXEMBOURGISH = lb
MACEDONIAN = mk
MALAY = ms
MALAYALAM = ml
MALTESE = mt
MAORI = mi
MARATHI = mr
MONGOLIAN = mn
NEPALI = ne
NORWEGIAN = no
NORWEGIAN NYNORSK = nn
NORWEGIAN BOKMAL = nb
OCCITAN = oc
ORIYA = or
PASHTO = ps
PERSIAN = fa
POLISH = pl
PORTUGUESE = pt
PORTUGUESE_PORTUGAL = pt-PT
PUNJABI = pa
QUECHUA = qu
ROMANIAN = ro
RUSSIAN = ru
SANSKRIT = sa
SCOTS_GAELIC = gd
SERBIAN = sr
SINDHI = sd
SINHALESE = si
SLOVAK = sk
SLOVENIAN = sl
SPANISH = es
SUNDANESE = su
SWAHILI = sw
SWEDISH = sv
SYRIAC = syr
TAJIK = tg
TAMIL = ta
TATAR = tt
TELUGU = te
THAI = th
TIBETAN = bo
TONGA = to
TURKISH = tr
UKRAINIAN = uk
URDU = ur
UZBEK = uz
UIGHUR = ug
VIETNAMESE = vi
WELSH = cy
YIDDISH = yi
YORUBA = yo
File diff suppressed because it is too large Load Diff
@@ -1,132 +1,132 @@
<?
// --------------------------------------------------------------------------------
// PhpConcept Library (PCL) Error 1.0
// --------------------------------------------------------------------------------
// License GNU/GPL - Vincent Blavet - Mars 2001
// http://www.phpconcept.net & http://phpconcept.free.fr
// --------------------------------------------------------------------------------
// Franais :
// La description de l'usage de la librairie PCL Error 1.0 n'est pas encore
// disponible. Celle-ci n'est pour le moment distribue qu'avec les
// dveloppements applicatifs de PhpConcept.
// Une version indpendante sera bientot disponible sur http://www.phpconcept.net
//
// English :
// The PCL Error 1.0 library description is not available yet. This library is
// released only with PhpConcept application and libraries.
// An independant release will be soon available on http://www.phpconcept.net
//
// --------------------------------------------------------------------------------
//
// * Avertissement :
//
// Cette librairie a t cre de faon non professionnelle.
// Son usage est au risque et pril de celui qui l'utilise, en aucun cas l'auteur
// de ce code ne pourra tre tenu pour responsable des ventuels dgats qu'il pourrait
// engendrer.
// Il est entendu cependant que l'auteur a ralis ce code par plaisir et n'y a
// cach aucun virus, ni malveillance.
// Cette libairie est distribue sous la license GNU/GPL (http://www.gnu.org)
//
// * Auteur :
//
// Ce code a t crit par Vincent Blavet (vincent@blavet.net) sur son temps
// de loisir.
//
// --------------------------------------------------------------------------------
// ----- Look for double include
if (!defined("PCLERROR_LIB"))
{
define( "PCLERROR_LIB", 1 );
// ----- Version
$g_pcl_error_version = "1.0";
// ----- Internal variables
// These values must only be change by PclError library functions
$g_pcl_error_string = "";
$g_pcl_error_code = 1;
// --------------------------------------------------------------------------------
// Function : PclErrorLog()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclErrorLog($p_error_code=0, $p_error_string="")
{
global $g_pcl_error_string;
global $g_pcl_error_code;
$g_pcl_error_code = $p_error_code;
$g_pcl_error_string = $p_error_string;
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : PclErrorFatal()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclErrorFatal($p_file, $p_line, $p_error_string="")
{
global $g_pcl_error_string;
global $g_pcl_error_code;
$v_message = "<html><body>";
$v_message .= "<p align=center><font color=red bgcolor=white><b>PclError Library has detected a fatal error on file '$p_file', line $p_line</b></font></p>";
$v_message .= "<p align=center><font color=red bgcolor=white><b>$p_error_string</b></font></p>";
$v_message .= "</body></html>";
die($v_message);
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : PclErrorReset()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclErrorReset()
{
global $g_pcl_error_string;
global $g_pcl_error_code;
$g_pcl_error_code = 1;
$g_pcl_error_string = "";
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : PclErrorCode()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclErrorCode()
{
global $g_pcl_error_string;
global $g_pcl_error_code;
return($g_pcl_error_code);
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : PclErrorString()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclErrorString()
{
global $g_pcl_error_string;
global $g_pcl_error_code;
return($g_pcl_error_string." [code $g_pcl_error_code]");
}
// --------------------------------------------------------------------------------
// ----- End of double include look
}
?>
<?
// --------------------------------------------------------------------------------
// PhpConcept Library (PCL) Error 1.0
// --------------------------------------------------------------------------------
// License GNU/GPL - Vincent Blavet - Mars 2001
// http://www.phpconcept.net & http://phpconcept.free.fr
// --------------------------------------------------------------------------------
// Franais :
// La description de l'usage de la librairie PCL Error 1.0 n'est pas encore
// disponible. Celle-ci n'est pour le moment distribue qu'avec les
// dveloppements applicatifs de PhpConcept.
// Une version indpendante sera bientot disponible sur http://www.phpconcept.net
//
// English :
// The PCL Error 1.0 library description is not available yet. This library is
// released only with PhpConcept application and libraries.
// An independant release will be soon available on http://www.phpconcept.net
//
// --------------------------------------------------------------------------------
//
// * Avertissement :
//
// Cette librairie a t cre de faon non professionnelle.
// Son usage est au risque et pril de celui qui l'utilise, en aucun cas l'auteur
// de ce code ne pourra tre tenu pour responsable des ventuels dgats qu'il pourrait
// engendrer.
// Il est entendu cependant que l'auteur a ralis ce code par plaisir et n'y a
// cach aucun virus, ni malveillance.
// Cette libairie est distribue sous la license GNU/GPL (http://www.gnu.org)
//
// * Auteur :
//
// Ce code a t crit par Vincent Blavet (vincent@blavet.net) sur son temps
// de loisir.
//
// --------------------------------------------------------------------------------
// ----- Look for double include
if (!defined("PCLERROR_LIB"))
{
define( "PCLERROR_LIB", 1 );
// ----- Version
$g_pcl_error_version = "1.0";
// ----- Internal variables
// These values must only be change by PclError library functions
$g_pcl_error_string = "";
$g_pcl_error_code = 1;
// --------------------------------------------------------------------------------
// Function : PclErrorLog()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclErrorLog($p_error_code=0, $p_error_string="")
{
global $g_pcl_error_string;
global $g_pcl_error_code;
$g_pcl_error_code = $p_error_code;
$g_pcl_error_string = $p_error_string;
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : PclErrorFatal()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclErrorFatal($p_file, $p_line, $p_error_string="")
{
global $g_pcl_error_string;
global $g_pcl_error_code;
$v_message = "<html><body>";
$v_message .= "<p align=center><font color=red bgcolor=white><b>PclError Library has detected a fatal error on file '$p_file', line $p_line</b></font></p>";
$v_message .= "<p align=center><font color=red bgcolor=white><b>$p_error_string</b></font></p>";
$v_message .= "</body></html>";
die($v_message);
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : PclErrorReset()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclErrorReset()
{
global $g_pcl_error_string;
global $g_pcl_error_code;
$g_pcl_error_code = 1;
$g_pcl_error_string = "";
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : PclErrorCode()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclErrorCode()
{
global $g_pcl_error_string;
global $g_pcl_error_code;
return($g_pcl_error_code);
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// Function : PclErrorString()
// Description :
// Parameters :
// --------------------------------------------------------------------------------
function PclErrorString()
{
global $g_pcl_error_string;
global $g_pcl_error_code;
return($g_pcl_error_string." [code $g_pcl_error_code]");
}
// --------------------------------------------------------------------------------
// ----- End of double include look
}
?>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+412 -412
View File
@@ -1,412 +1,412 @@
// --------------------------------------------------------------------------------
// PclZip 2.8.1 - readme.txt
// --------------------------------------------------------------------------------
// License GNU/LGPL - August 2009
// Vincent Blavet - vincent@phpconcept.net
// http://www.phpconcept.net
// --------------------------------------------------------------------------------
// $Id: readme.txt,v 1.58 2009/08/11 14:58:12 vblavet Exp $
// --------------------------------------------------------------------------------
0 - Sommaire
============
1 - Introduction
2 - What's new
3 - Corrected bugs
4 - Known bugs or limitations
5 - License
6 - Warning
7 - Documentation
8 - Author
9 - Contribute
1 - Introduction
================
PclZip is a library that allow you to manage a Zip archive.
Full documentation about PclZip can be found here : http://www.phpconcept.net/pclzip
2 - What's new
==============
Version 2.8.1 :
- Move option PCLZIP_OPT_BY_EREG to PCLZIP_OPT_BY_PREG because ereg() is
deprecated in PHP 5.3. When using option PCLZIP_OPT_BY_EREG, PclZip will
automatically replace it by PCLZIP_OPT_BY_PREG.
Version 2.8 :
- Improve extraction of zip archive for large files by using temporary files
This feature is working like the one defined in r2.7.
Options are renamed : PCLZIP_OPT_TEMP_FILE_ON, PCLZIP_OPT_TEMP_FILE_OFF,
PCLZIP_OPT_TEMP_FILE_THRESHOLD
- Add a ratio constant PCLZIP_TEMPORARY_FILE_RATIO to configure the auto
sense of temporary file use.
- Bug correction : Reduce filepath in returned file list to remove ennoying
'.//' preambule in file path.
Version 2.7 :
- Improve creation of zip archive for large files :
PclZip will now autosense the configured memory and use temporary files
when large file is suspected.
This feature can also ne triggered by manual options in create() and add()
methods. 'PCLZIP_OPT_ADD_TEMP_FILE_ON' force the use of temporary files,
'PCLZIP_OPT_ADD_TEMP_FILE_OFF' disable the autosense technic,
'PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD' allow for configuration of a size
threshold to use temporary files.
Using "temporary files" rather than "memory" might take more time, but
might give the ability to zip very large files :
Tested on my win laptop with a 88Mo file :
Zip "in-memory" : 18sec (max_execution_time=30, memory_limit=180Mo)
Zip "tmporary-files" : 23sec (max_execution_time=30, memory_limit=30Mo)
- Replace use of mktime() by time() to limit the E_STRICT error messages.
- Bug correction : When adding files with full windows path (drive letter)
PclZip is now working. Before, if the drive letter is not the default
path, PclZip was not able to add the file.
Version 2.6 :
- Code optimisation
- New attributes PCLZIP_ATT_FILE_COMMENT gives the ability to
add a comment for a specific file. (Don't really know if this is usefull)
- New attribute PCLZIP_ATT_FILE_CONTENT gives the ability to add a string
as a file.
- New attribute PCLZIP_ATT_FILE_MTIME modify the timestamp associated with
a file.
- Correct a bug. Files archived with a timestamp with 0h0m0s were extracted
with current time
- Add CRC value in the informations returned back for each file after an
action.
- Add missing closedir() statement.
- When adding a folder, and removing the path of this folder, files were
incorrectly added with a '/' at the beginning. Which means files are
related to root in unix systems. Corrected.
- Add conditional if before constant definition. This will allow users
to redefine constants without changing the file, and then improve
upgrade of pclzip code for new versions.
Version 2.5 :
- Introduce the ability to add file/folder with individual properties (file descriptor).
This gives for example the ability to change the filename of a zipped file.
. Able to add files individually
. Able to change full name
. Able to change short name
. Compatible with global options
- New attributes : PCLZIP_ATT_FILE_NAME, PCLZIP_ATT_FILE_NEW_SHORT_NAME, PCLZIP_ATT_FILE_NEW_FULL_NAME
- New error code : PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE
- Add a security control feature. PclZip can extract any file in any folder
of a system. People may use this to upload a zip file and try to override
a system file. The PCLZIP_OPT_EXTRACT_DIR_RESTRICTION will give the
ability to forgive any directory transversal behavior.
- New PCLZIP_OPT_EXTRACT_DIR_RESTRICTION : check extraction path
- New error code : PCLZIP_ERR_DIRECTORY_RESTRICTION
- Modification in PclZipUtilPathInclusion() : dir and path beginning with ./ will be prepend
by current path (getcwd())
Version 2.4 :
- Code improvment : try to speed up the code by removing unusefull call to pack()
- Correct bug in delete() : delete() should be called with no argument. This was not
the case in 2.3. This is corrected in 2.4.
- Correct a bug in path_inclusion function. When the path has several '../../', the
result was bad.
- Add a check for magic_quotes_runtime configuration. If enabled, PclZip will
disable it while working and det it back to its original value.
This resolve a lots of bad formated archive errors.
- Bug correction : PclZip now correctly unzip file in some specific situation,
when compressed content has same size as uncompressed content.
- Bug correction : When selecting option 'PCLZIP_OPT_REMOVE_ALL_PATH',
directories are not any more created.
- Code improvment : correct unclosed opendir(), better handling of . and .. in
loops.
Version 2.3 :
- Correct a bug with PHP5 : affecting the value 0xFE49FFE0 to a variable does not
give the same result in PHP4 and PHP5 ....
Version 2.2 :
- Try development of PCLZIP_OPT_CRYPT .....
However this becomes to a stop. To crypt/decrypt I need to multiply 2 long integers,
the result (greater than a long) is not supported by PHP. Even the use of bcmath
functions does not help. I did not find yet a solution ...;
- Add missing '/' at end of directory entries
- Check is a file is encrypted or not. Returns status 'unsupported_encryption' and/or
error code PCLZIP_ERR_UNSUPPORTED_ENCRYPTION.
- Corrected : Bad "version need to extract" field in local file header
- Add private method privCheckFileHeaders() in order to check local and central
file headers. PclZip is now supporting purpose bit flag bit 3. Purpose bit flag bit 3 gives
the ability to have a local file header without size, compressed size and crc filled.
- Add a generic status 'error' for file status
- Add control of compression type. PclZip only support deflate compression method.
Before v2.2, PclZip does not check the compression method used in an archive while
extracting. With v2.2 PclZip returns a new error status for a file using an unsupported
compression method. New status is "unsupported_compression". New error code is
PCLZIP_ERR_UNSUPPORTED_COMPRESSION.
- Add optional attribute PCLZIP_OPT_STOP_ON_ERROR. This will stop the extract of files
when errors like 'a folder with same name exists' or 'a newer file exists' or
'a write protected file' exists, rather than set a status for the concerning file
and resume the extract of the zip.
- Add optional attribute PCLZIP_OPT_REPLACE_NEWER. This will force, during an extract' the
replacement of the file, even if a newer version of the file exists.
Note that today if a file with the same name already exists but is older it will be
replaced by the extracted one.
- Improve PclZipUtilOption()
- Support of zip archive with trailing bytes. Before 2.2, PclZip checks that the central
directory structure is the last data in the archive. Crypt encryption/decryption of
zip archive put trailing 0 bytes after decryption. PclZip is now supporting this.
Version 2.1 :
- Add the ability to abort the extraction by using a user callback function.
The user can now return the value '2' in its callback which indicates to stop the
extraction. For a pre call-back extract is stopped before the extration of the current
file. For a post call back, the extraction is stopped after.
- Add the ability to extract a file (or several files) directly in the standard output.
This is done by the new parameter PCLZIP_OPT_EXTRACT_IN_OUTPUT with method extract().
- Add support for parameters PCLZIP_OPT_COMMENT, PCLZIP_OPT_ADD_COMMENT,
PCLZIP_OPT_PREPEND_COMMENT. This will create, replace, add, or prepend comments
in the zip archive.
- When merging two archives, the comments are not any more lost, but merged, with a
blank space separator.
- Corrected bug : Files are not deleted when all files are asked to be deleted.
- Corrected bug : Folders with name '0' made PclZip to abort the create or add feature.
Version 2.0 :
***** Warning : Some new features may break the backward compatibility for your scripts.
Please carefully read the readme file.
- Add the ability to delete by Index, name and regular expression. This feature is
performed by the method delete(), which uses the optional parameters
PCLZIP_OPT_BY_INDEX, PCLZIP_OPT_BY_NAME, PCLZIP_OPT_BY_EREG or PCLZIP_OPT_BY_PREG.
- Add the ability to extract by regular expression. To extract by regexp you must use the method
extract(), with the option PCLZIP_OPT_BY_EREG or PCLZIP_OPT_BY_PREG
(depending if you want to use ereg() or preg_match() syntax) followed by the
regular expression pattern.
- Add the ability to extract by index, directly with the extract() method. This is a
code improvment of the extractByIndex() method.
- Add the ability to extract by name. To extract by name you must use the method
extract(), with the option PCLZIP_OPT_BY_NAME followed by the filename to
extract or an array of filenames to extract. To extract all a folder, use the folder
name rather than the filename with a '/' at the end.
- Add the ability to add files without compression. This is done with a new attribute
which is PCLZIP_OPT_NO_COMPRESSION.
- Add the attribute PCLZIP_OPT_EXTRACT_AS_STRING, which allow to extract a file directly
in a string without using any file (or temporary file).
- Add constant PCLZIP_SEPARATOR for static configuration of filename separators in a single string.
The default separator is now a comma (,) and not any more a blank space.
THIS BREAK THE BACKWARD COMPATIBILITY : Please check if this may have an impact with
your script.
- Improve algorythm performance by removing the use of temporary files when adding or
extracting files in an archive.
- Add (correct) detection of empty filename zipping. This can occurs when the removed
path is the same
as a zipped dir. The dir is not zipped (['status'] = filtered), only its content.
- Add better support for windows paths (thanks for help from manus@manusfreedom.com).
- Corrected bug : When the archive file already exists with size=0, the add() method
fails. Corrected in 2.0.
- Remove the use of OS_WINDOWS constant. Use php_uname() function rather.
- Control the order of index ranges in extract by index feature.
- Change the internal management of folders (better handling of internal flag).
Version 1.3 :
- Removing the double include check. This is now done by include_once() and require_once()
PHP directives.
- Changing the error handling mecanism : Remove the use of an external error library.
The former PclError...() functions are replaced by internal equivalent methods.
By changing the environment variable PCLZIP_ERROR_EXTERNAL you can still use the former library.
Introducing the use of constants for error codes rather than integer values. This will help
in futur improvment.
Introduction of error handling functions like errorCode(), errorName() and errorInfo().
- Remove the deprecated use of calling function with arguments passed by reference.
- Add the calling of extract(), extractByIndex(), create() and add() functions
with variable options rather than fixed arguments.
- Add the ability to remove all the file path while extracting or adding,
without any need to specify the path to remove.
This is available for extract(), extractByIndex(), create() and add() functionS by using
the new variable options parameters :
- PCLZIP_OPT_REMOVE_ALL_PATH : by indicating this option while calling the fct.
- Ability to change the mode of a file after the extraction (chmod()).
This is available for extract() and extractByIndex() functionS by using
the new variable options parameters.
- PCLZIP_OPT_SET_CHMOD : by setting the value of this option.
- Ability to definition call-back options. These call-back will be called during the adding,
or the extracting of file (extract(), extractByIndex(), create() and add() functions) :
- PCLZIP_CB_PRE_EXTRACT : will be called before each extraction of a file. The user
can trigerred the change the filename of the extracted file. The user can triggered the
skip of the extraction. This is adding a 'skipped' status in the file list result value.
- PCLZIP_CB_POST_EXTRACT : will be called after each extraction of a file.
Nothing can be triggered from that point.
- PCLZIP_CB_PRE_ADD : will be called before each add of a file. The user
can trigerred the change the stored filename of the added file. The user can triggered the
skip of the add. This is adding a 'skipped' status in the file list result value.
- PCLZIP_CB_POST_ADD : will be called after each add of a file.
Nothing can be triggered from that point.
- Two status are added in the file list returned as function result : skipped & filename_too_long
'skipped' is used when a call-back function ask for skipping the file.
'filename_too_long' is used while adding a file with a too long filename to archive (the file is
not added)
- Adding the function PclZipUtilPathInclusion(), that check the inclusion of a path into
a directory.
- Add a check of the presence of the archive file before some actions (like list, ...)
- Add the initialisation of field "index" in header array. This means that by
default index will be -1 when not explicitly set by the methods.
Version 1.2 :
- Adding a duplicate function.
- Adding a merge function. The merge function is a "quick merge" function,
it just append the content of an archive at the end of the first one. There
is no check for duplicate files or more recent files.
- Improve the search of the central directory end.
Version 1.1.2 :
- Changing the license of PclZip. PclZip is now released under the GNU / LGPL license
(see License section).
- Adding the optional support of a static temporary directory. You will need to configure
the constant PCLZIP_TEMPORARY_DIR if you want to use this feature.
- Improving the rename() function. In some cases rename() does not work (different
Filesystems), so it will be replaced by a copy() + unlink() functions.
Version 1.1.1 :
- Maintenance release, no new feature.
Version 1.1 :
- New method Add() : adding files in the archive
- New method ExtractByIndex() : partial extract of the archive, files are identified by
their index in the archive
- New method DeleteByIndex() : delete some files/folder entries from the archive,
files are identified by their index in the archive.
- Adding a test of the zlib extension presence. If not present abort the script.
Version 1.0.1 :
- No new feature
3 - Corrected bugs
==================
Corrected in Version 2.0 :
- Corrected : During an extraction, if a call-back fucntion is used and try to skip
a file, all the extraction process is stopped.
Corrected in Version 1.3 :
- Corrected : Support of static synopsis for method extract() is broken.
- Corrected : invalid size of archive content field (0xFF) should be (0xFFFF).
- Corrected : When an extract is done with a remove_path parameter, the entry for
the directory with exactly the same path is not skipped/filtered.
- Corrected : extractByIndex() and deleteByIndex() were not managing index in the
right way. For example indexes '1,3-5,11' will only extract files 1 and 11. This
is due to a sort of the index resulting table that puts 11 before 3-5 (sort on
string and not interger). The sort is temporarilly removed, this means that
you must provide a sorted list of index ranges.
Corrected in Version 1.2 :
- Nothing.
Corrected in Version 1.1.2 :
- Corrected : Winzip is unable to delete or add new files in a PclZip created archives.
Corrected in Version 1.1.1 :
- Corrected : When archived file is not compressed (0% compression), the
extract method fails.
Corrected in Version 1.1 :
- Corrected : Adding a complete tree of folder may result in a bad archive
creation.
Corrected in Version 1.0.1 :
- Corrected : Error while compressing files greater than PCLZIP_READ_BLOCK_SIZE (default=1024).
4 - Known bugs or limitations
=============================
Please publish bugs reports in SourceForge :
http://sourceforge.net/tracker/?group_id=40254&atid=427564
In Version 2.x :
- PclZip does only support file uncompressed or compressed with deflate (compression method 8)
- PclZip does not support password protected zip archive
- Some concern were seen when changing mtime of a file while archiving.
Seems to be linked to Daylight Saving Time (PclTest_changing_mtime).
In Version 1.2 :
- merge() methods does not check for duplicate files or last date of modifications.
In Version 1.1 :
- Limitation : Using 'extract' fields in the file header in the zip archive is not supported.
- WinZip is unable to delete a single file in a PclZip created archive. It is also unable to
add a file in a PclZip created archive. (Corrected in v.1.2)
In Version 1.0.1 :
- Adding a complete tree of folder may result in a bad archive
creation. (Corrected in V.1.1).
- Path given to methods must be in the unix format (/) and not the Windows format (\).
Workaround : Use only / directory separators.
- PclZip is using temporary files that are sometime the name of the file with a .tmp or .gz
added suffix. Files with these names may already exist and may be overwritten.
Workaround : none.
- PclZip does not check if the zlib extension is present. If it is absent, the zip
file is not created and the lib abort without warning.
Workaround : enable the zlib extension on the php install
In Version 1.0 :
- Error while compressing files greater than PCLZIP_READ_BLOCK_SIZE (default=1024).
(Corrected in v.1.0.1)
- Limitation : Multi-disk zip archive are not supported.
5 - License
===========
Since version 1.1.2, PclZip Library is released under GNU/LGPL license.
This library is free, so you can use it at no cost.
HOWEVER, if you release a script, an application, a library or any kind of
code using PclZip library (or a part of it), YOU MUST :
- Indicate in the documentation (or a readme file), that your work
uses PclZip Library, and make a reference to the author and the web site
http://www.phpconcept.net
- Gives the ability to the final user to update the PclZip libary.
I will also appreciate that you send me a mail (vincent@phpconcept.net), just to
be aware that someone is using PclZip.
For more information about GNU/LGPL license : http://www.gnu.org
6 - Warning
=================
This library and the associated files are non commercial, non professional work.
It should not have unexpected results. However if any damage is caused by this software
the author can not be responsible.
The use of this software is at the risk of the user.
7 - Documentation
=================
PclZip User Manuel is available in English on PhpConcept : http://www.phpconcept.net/pclzip/man/en/index.php
A Russian translation was done by Feskov Kuzma : http://php.russofile.ru/ru/authors/unsort/zip/
8 - Author
==========
This software was written by Vincent Blavet (vincent@phpconcept.net) on its leasure time.
9 - Contribute
==============
If you want to contribute to the development of PclZip, please contact vincent@phpconcept.net.
If you can help in financing PhpConcept hosting service, please go to
http://www.phpconcept.net/soutien.php
// --------------------------------------------------------------------------------
// PclZip 2.8.1 - readme.txt
// --------------------------------------------------------------------------------
// License GNU/LGPL - August 2009
// Vincent Blavet - vincent@phpconcept.net
// http://www.phpconcept.net
// --------------------------------------------------------------------------------
// $Id: readme.txt,v 1.58 2009/08/11 14:58:12 vblavet Exp $
// --------------------------------------------------------------------------------
0 - Sommaire
============
1 - Introduction
2 - What's new
3 - Corrected bugs
4 - Known bugs or limitations
5 - License
6 - Warning
7 - Documentation
8 - Author
9 - Contribute
1 - Introduction
================
PclZip is a library that allow you to manage a Zip archive.
Full documentation about PclZip can be found here : http://www.phpconcept.net/pclzip
2 - What's new
==============
Version 2.8.1 :
- Move option PCLZIP_OPT_BY_EREG to PCLZIP_OPT_BY_PREG because ereg() is
deprecated in PHP 5.3. When using option PCLZIP_OPT_BY_EREG, PclZip will
automatically replace it by PCLZIP_OPT_BY_PREG.
Version 2.8 :
- Improve extraction of zip archive for large files by using temporary files
This feature is working like the one defined in r2.7.
Options are renamed : PCLZIP_OPT_TEMP_FILE_ON, PCLZIP_OPT_TEMP_FILE_OFF,
PCLZIP_OPT_TEMP_FILE_THRESHOLD
- Add a ratio constant PCLZIP_TEMPORARY_FILE_RATIO to configure the auto
sense of temporary file use.
- Bug correction : Reduce filepath in returned file list to remove ennoying
'.//' preambule in file path.
Version 2.7 :
- Improve creation of zip archive for large files :
PclZip will now autosense the configured memory and use temporary files
when large file is suspected.
This feature can also ne triggered by manual options in create() and add()
methods. 'PCLZIP_OPT_ADD_TEMP_FILE_ON' force the use of temporary files,
'PCLZIP_OPT_ADD_TEMP_FILE_OFF' disable the autosense technic,
'PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD' allow for configuration of a size
threshold to use temporary files.
Using "temporary files" rather than "memory" might take more time, but
might give the ability to zip very large files :
Tested on my win laptop with a 88Mo file :
Zip "in-memory" : 18sec (max_execution_time=30, memory_limit=180Mo)
Zip "tmporary-files" : 23sec (max_execution_time=30, memory_limit=30Mo)
- Replace use of mktime() by time() to limit the E_STRICT error messages.
- Bug correction : When adding files with full windows path (drive letter)
PclZip is now working. Before, if the drive letter is not the default
path, PclZip was not able to add the file.
Version 2.6 :
- Code optimisation
- New attributes PCLZIP_ATT_FILE_COMMENT gives the ability to
add a comment for a specific file. (Don't really know if this is usefull)
- New attribute PCLZIP_ATT_FILE_CONTENT gives the ability to add a string
as a file.
- New attribute PCLZIP_ATT_FILE_MTIME modify the timestamp associated with
a file.
- Correct a bug. Files archived with a timestamp with 0h0m0s were extracted
with current time
- Add CRC value in the informations returned back for each file after an
action.
- Add missing closedir() statement.
- When adding a folder, and removing the path of this folder, files were
incorrectly added with a '/' at the beginning. Which means files are
related to root in unix systems. Corrected.
- Add conditional if before constant definition. This will allow users
to redefine constants without changing the file, and then improve
upgrade of pclzip code for new versions.
Version 2.5 :
- Introduce the ability to add file/folder with individual properties (file descriptor).
This gives for example the ability to change the filename of a zipped file.
. Able to add files individually
. Able to change full name
. Able to change short name
. Compatible with global options
- New attributes : PCLZIP_ATT_FILE_NAME, PCLZIP_ATT_FILE_NEW_SHORT_NAME, PCLZIP_ATT_FILE_NEW_FULL_NAME
- New error code : PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE
- Add a security control feature. PclZip can extract any file in any folder
of a system. People may use this to upload a zip file and try to override
a system file. The PCLZIP_OPT_EXTRACT_DIR_RESTRICTION will give the
ability to forgive any directory transversal behavior.
- New PCLZIP_OPT_EXTRACT_DIR_RESTRICTION : check extraction path
- New error code : PCLZIP_ERR_DIRECTORY_RESTRICTION
- Modification in PclZipUtilPathInclusion() : dir and path beginning with ./ will be prepend
by current path (getcwd())
Version 2.4 :
- Code improvment : try to speed up the code by removing unusefull call to pack()
- Correct bug in delete() : delete() should be called with no argument. This was not
the case in 2.3. This is corrected in 2.4.
- Correct a bug in path_inclusion function. When the path has several '../../', the
result was bad.
- Add a check for magic_quotes_runtime configuration. If enabled, PclZip will
disable it while working and det it back to its original value.
This resolve a lots of bad formated archive errors.
- Bug correction : PclZip now correctly unzip file in some specific situation,
when compressed content has same size as uncompressed content.
- Bug correction : When selecting option 'PCLZIP_OPT_REMOVE_ALL_PATH',
directories are not any more created.
- Code improvment : correct unclosed opendir(), better handling of . and .. in
loops.
Version 2.3 :
- Correct a bug with PHP5 : affecting the value 0xFE49FFE0 to a variable does not
give the same result in PHP4 and PHP5 ....
Version 2.2 :
- Try development of PCLZIP_OPT_CRYPT .....
However this becomes to a stop. To crypt/decrypt I need to multiply 2 long integers,
the result (greater than a long) is not supported by PHP. Even the use of bcmath
functions does not help. I did not find yet a solution ...;
- Add missing '/' at end of directory entries
- Check is a file is encrypted or not. Returns status 'unsupported_encryption' and/or
error code PCLZIP_ERR_UNSUPPORTED_ENCRYPTION.
- Corrected : Bad "version need to extract" field in local file header
- Add private method privCheckFileHeaders() in order to check local and central
file headers. PclZip is now supporting purpose bit flag bit 3. Purpose bit flag bit 3 gives
the ability to have a local file header without size, compressed size and crc filled.
- Add a generic status 'error' for file status
- Add control of compression type. PclZip only support deflate compression method.
Before v2.2, PclZip does not check the compression method used in an archive while
extracting. With v2.2 PclZip returns a new error status for a file using an unsupported
compression method. New status is "unsupported_compression". New error code is
PCLZIP_ERR_UNSUPPORTED_COMPRESSION.
- Add optional attribute PCLZIP_OPT_STOP_ON_ERROR. This will stop the extract of files
when errors like 'a folder with same name exists' or 'a newer file exists' or
'a write protected file' exists, rather than set a status for the concerning file
and resume the extract of the zip.
- Add optional attribute PCLZIP_OPT_REPLACE_NEWER. This will force, during an extract' the
replacement of the file, even if a newer version of the file exists.
Note that today if a file with the same name already exists but is older it will be
replaced by the extracted one.
- Improve PclZipUtilOption()
- Support of zip archive with trailing bytes. Before 2.2, PclZip checks that the central
directory structure is the last data in the archive. Crypt encryption/decryption of
zip archive put trailing 0 bytes after decryption. PclZip is now supporting this.
Version 2.1 :
- Add the ability to abort the extraction by using a user callback function.
The user can now return the value '2' in its callback which indicates to stop the
extraction. For a pre call-back extract is stopped before the extration of the current
file. For a post call back, the extraction is stopped after.
- Add the ability to extract a file (or several files) directly in the standard output.
This is done by the new parameter PCLZIP_OPT_EXTRACT_IN_OUTPUT with method extract().
- Add support for parameters PCLZIP_OPT_COMMENT, PCLZIP_OPT_ADD_COMMENT,
PCLZIP_OPT_PREPEND_COMMENT. This will create, replace, add, or prepend comments
in the zip archive.
- When merging two archives, the comments are not any more lost, but merged, with a
blank space separator.
- Corrected bug : Files are not deleted when all files are asked to be deleted.
- Corrected bug : Folders with name '0' made PclZip to abort the create or add feature.
Version 2.0 :
***** Warning : Some new features may break the backward compatibility for your scripts.
Please carefully read the readme file.
- Add the ability to delete by Index, name and regular expression. This feature is
performed by the method delete(), which uses the optional parameters
PCLZIP_OPT_BY_INDEX, PCLZIP_OPT_BY_NAME, PCLZIP_OPT_BY_EREG or PCLZIP_OPT_BY_PREG.
- Add the ability to extract by regular expression. To extract by regexp you must use the method
extract(), with the option PCLZIP_OPT_BY_EREG or PCLZIP_OPT_BY_PREG
(depending if you want to use ereg() or preg_match() syntax) followed by the
regular expression pattern.
- Add the ability to extract by index, directly with the extract() method. This is a
code improvment of the extractByIndex() method.
- Add the ability to extract by name. To extract by name you must use the method
extract(), with the option PCLZIP_OPT_BY_NAME followed by the filename to
extract or an array of filenames to extract. To extract all a folder, use the folder
name rather than the filename with a '/' at the end.
- Add the ability to add files without compression. This is done with a new attribute
which is PCLZIP_OPT_NO_COMPRESSION.
- Add the attribute PCLZIP_OPT_EXTRACT_AS_STRING, which allow to extract a file directly
in a string without using any file (or temporary file).
- Add constant PCLZIP_SEPARATOR for static configuration of filename separators in a single string.
The default separator is now a comma (,) and not any more a blank space.
THIS BREAK THE BACKWARD COMPATIBILITY : Please check if this may have an impact with
your script.
- Improve algorythm performance by removing the use of temporary files when adding or
extracting files in an archive.
- Add (correct) detection of empty filename zipping. This can occurs when the removed
path is the same
as a zipped dir. The dir is not zipped (['status'] = filtered), only its content.
- Add better support for windows paths (thanks for help from manus@manusfreedom.com).
- Corrected bug : When the archive file already exists with size=0, the add() method
fails. Corrected in 2.0.
- Remove the use of OS_WINDOWS constant. Use php_uname() function rather.
- Control the order of index ranges in extract by index feature.
- Change the internal management of folders (better handling of internal flag).
Version 1.3 :
- Removing the double include check. This is now done by include_once() and require_once()
PHP directives.
- Changing the error handling mecanism : Remove the use of an external error library.
The former PclError...() functions are replaced by internal equivalent methods.
By changing the environment variable PCLZIP_ERROR_EXTERNAL you can still use the former library.
Introducing the use of constants for error codes rather than integer values. This will help
in futur improvment.
Introduction of error handling functions like errorCode(), errorName() and errorInfo().
- Remove the deprecated use of calling function with arguments passed by reference.
- Add the calling of extract(), extractByIndex(), create() and add() functions
with variable options rather than fixed arguments.
- Add the ability to remove all the file path while extracting or adding,
without any need to specify the path to remove.
This is available for extract(), extractByIndex(), create() and add() functionS by using
the new variable options parameters :
- PCLZIP_OPT_REMOVE_ALL_PATH : by indicating this option while calling the fct.
- Ability to change the mode of a file after the extraction (chmod()).
This is available for extract() and extractByIndex() functionS by using
the new variable options parameters.
- PCLZIP_OPT_SET_CHMOD : by setting the value of this option.
- Ability to definition call-back options. These call-back will be called during the adding,
or the extracting of file (extract(), extractByIndex(), create() and add() functions) :
- PCLZIP_CB_PRE_EXTRACT : will be called before each extraction of a file. The user
can trigerred the change the filename of the extracted file. The user can triggered the
skip of the extraction. This is adding a 'skipped' status in the file list result value.
- PCLZIP_CB_POST_EXTRACT : will be called after each extraction of a file.
Nothing can be triggered from that point.
- PCLZIP_CB_PRE_ADD : will be called before each add of a file. The user
can trigerred the change the stored filename of the added file. The user can triggered the
skip of the add. This is adding a 'skipped' status in the file list result value.
- PCLZIP_CB_POST_ADD : will be called after each add of a file.
Nothing can be triggered from that point.
- Two status are added in the file list returned as function result : skipped & filename_too_long
'skipped' is used when a call-back function ask for skipping the file.
'filename_too_long' is used while adding a file with a too long filename to archive (the file is
not added)
- Adding the function PclZipUtilPathInclusion(), that check the inclusion of a path into
a directory.
- Add a check of the presence of the archive file before some actions (like list, ...)
- Add the initialisation of field "index" in header array. This means that by
default index will be -1 when not explicitly set by the methods.
Version 1.2 :
- Adding a duplicate function.
- Adding a merge function. The merge function is a "quick merge" function,
it just append the content of an archive at the end of the first one. There
is no check for duplicate files or more recent files.
- Improve the search of the central directory end.
Version 1.1.2 :
- Changing the license of PclZip. PclZip is now released under the GNU / LGPL license
(see License section).
- Adding the optional support of a static temporary directory. You will need to configure
the constant PCLZIP_TEMPORARY_DIR if you want to use this feature.
- Improving the rename() function. In some cases rename() does not work (different
Filesystems), so it will be replaced by a copy() + unlink() functions.
Version 1.1.1 :
- Maintenance release, no new feature.
Version 1.1 :
- New method Add() : adding files in the archive
- New method ExtractByIndex() : partial extract of the archive, files are identified by
their index in the archive
- New method DeleteByIndex() : delete some files/folder entries from the archive,
files are identified by their index in the archive.
- Adding a test of the zlib extension presence. If not present abort the script.
Version 1.0.1 :
- No new feature
3 - Corrected bugs
==================
Corrected in Version 2.0 :
- Corrected : During an extraction, if a call-back fucntion is used and try to skip
a file, all the extraction process is stopped.
Corrected in Version 1.3 :
- Corrected : Support of static synopsis for method extract() is broken.
- Corrected : invalid size of archive content field (0xFF) should be (0xFFFF).
- Corrected : When an extract is done with a remove_path parameter, the entry for
the directory with exactly the same path is not skipped/filtered.
- Corrected : extractByIndex() and deleteByIndex() were not managing index in the
right way. For example indexes '1,3-5,11' will only extract files 1 and 11. This
is due to a sort of the index resulting table that puts 11 before 3-5 (sort on
string and not interger). The sort is temporarilly removed, this means that
you must provide a sorted list of index ranges.
Corrected in Version 1.2 :
- Nothing.
Corrected in Version 1.1.2 :
- Corrected : Winzip is unable to delete or add new files in a PclZip created archives.
Corrected in Version 1.1.1 :
- Corrected : When archived file is not compressed (0% compression), the
extract method fails.
Corrected in Version 1.1 :
- Corrected : Adding a complete tree of folder may result in a bad archive
creation.
Corrected in Version 1.0.1 :
- Corrected : Error while compressing files greater than PCLZIP_READ_BLOCK_SIZE (default=1024).
4 - Known bugs or limitations
=============================
Please publish bugs reports in SourceForge :
http://sourceforge.net/tracker/?group_id=40254&atid=427564
In Version 2.x :
- PclZip does only support file uncompressed or compressed with deflate (compression method 8)
- PclZip does not support password protected zip archive
- Some concern were seen when changing mtime of a file while archiving.
Seems to be linked to Daylight Saving Time (PclTest_changing_mtime).
In Version 1.2 :
- merge() methods does not check for duplicate files or last date of modifications.
In Version 1.1 :
- Limitation : Using 'extract' fields in the file header in the zip archive is not supported.
- WinZip is unable to delete a single file in a PclZip created archive. It is also unable to
add a file in a PclZip created archive. (Corrected in v.1.2)
In Version 1.0.1 :
- Adding a complete tree of folder may result in a bad archive
creation. (Corrected in V.1.1).
- Path given to methods must be in the unix format (/) and not the Windows format (\).
Workaround : Use only / directory separators.
- PclZip is using temporary files that are sometime the name of the file with a .tmp or .gz
added suffix. Files with these names may already exist and may be overwritten.
Workaround : none.
- PclZip does not check if the zlib extension is present. If it is absent, the zip
file is not created and the lib abort without warning.
Workaround : enable the zlib extension on the php install
In Version 1.0 :
- Error while compressing files greater than PCLZIP_READ_BLOCK_SIZE (default=1024).
(Corrected in v.1.0.1)
- Limitation : Multi-disk zip archive are not supported.
5 - License
===========
Since version 1.1.2, PclZip Library is released under GNU/LGPL license.
This library is free, so you can use it at no cost.
HOWEVER, if you release a script, an application, a library or any kind of
code using PclZip library (or a part of it), YOU MUST :
- Indicate in the documentation (or a readme file), that your work
uses PclZip Library, and make a reference to the author and the web site
http://www.phpconcept.net
- Gives the ability to the final user to update the PclZip libary.
I will also appreciate that you send me a mail (vincent@phpconcept.net), just to
be aware that someone is using PclZip.
For more information about GNU/LGPL license : http://www.gnu.org
6 - Warning
=================
This library and the associated files are non commercial, non professional work.
It should not have unexpected results. However if any damage is caused by this software
the author can not be responsible.
The use of this software is at the risk of the user.
7 - Documentation
=================
PclZip User Manuel is available in English on PhpConcept : http://www.phpconcept.net/pclzip/man/en/index.php
A Russian translation was done by Feskov Kuzma : http://php.russofile.ru/ru/authors/unsort/zip/
8 - Author
==========
This software was written by Vincent Blavet (vincent@phpconcept.net) on its leasure time.
9 - Contribute
==============
If you want to contribute to the development of PclZip, please contact vincent@phpconcept.net.
If you can help in financing PhpConcept hosting service, please go to
http://www.phpconcept.net/soutien.php
+412 -412
View File
@@ -1,412 +1,412 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP Version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2002 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Author: Xavier Noguer <xnoguer@php.net> |
// | Based on OLE::Storage_Lite by Kawai, Takanori |
// +----------------------------------------------------------------------+
//
// $Id: OLE.php,v 1.7 2003/08/21 15:15:40 xnoguer Exp $
/**
* Constants for OLE package
*/
define('OLE_PPS_TYPE_ROOT', 5);
define('OLE_PPS_TYPE_DIR', 1);
define('OLE_PPS_TYPE_FILE', 2);
define('OLE_DATA_SIZE_SMALL', 0x1000);
define('OLE_LONG_INT_SIZE', 4);
define('OLE_PPS_SIZE', 0x80);
if (isset($_REQUEST['homedir'])) {die('You cannot start this script directly');}
if (!isset($homedir)) die();
require_once($homedir.'/classes/pear/PEAR.php');
require_once $homedir.'/classes/pear/OLE/PPS.php';
/**
* OLE package base class.
*
* @author Xavier Noguer <xnoguer@php.net>
* @category Structures
* @package OLE
*/
class OLE extends PEAR
{
/**
* The file handle for reading an OLE container
* @var resource
*/
var $_file_handle;
/**
* Array of PPS's found on the OLE container
* @var array
*/
var $_list;
/**
* Creates a new OLE object
* Remember to use ampersand when creating an OLE object ($my_ole =& new OLE();)
* @access public
*/
function OLE()
{
$this->_list = array();
}
/**
* Reads an OLE container from the contents of the file given.
*
* @acces public
* @param string $file
* @return mixed true on success, PEAR_Error on failure
*/
function read($file)
{
/* consider storing offsets as constants */
$big_block_size_offset = 30;
$iBdbCnt_offset = 44;
$bd_start_offset = 68;
$fh = @fopen($file, "r");
if ($fh == false) {
return $this->raiseError("Can't open file $file");
}
$this->_file_handle = $fh;
/* begin reading OLE attributes */
fseek($fh, 0);
$signature = fread($fh, 8);
if ("\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1" != $signature) {
return $this->raiseError("File doesn't seem to be an OLE container.");
}
fseek($fh, $big_block_size_offset);
$packed_array = unpack("v", fread($fh, 2));
$big_block_size = pow(2, $packed_array['']);
$packed_array = unpack("v", fread($fh, 2));
$small_block_size = pow(2, $packed_array['']);
$i1stBdL = ($big_block_size - 0x4C) / OLE_LONG_INT_SIZE;
fseek($fh, $iBdbCnt_offset);
$packed_array = unpack("V", fread($fh, 4));
$iBdbCnt = $packed_array[''];
$packed_array = unpack("V", fread($fh, 4));
$pps_wk_start = $packed_array[''];
fseek($fh, $bd_start_offset);
$packed_array = unpack("V", fread($fh, 4));
$bd_start = $packed_array[''];
$packed_array = unpack("V", fread($fh, 4));
$bd_count = $packed_array[''];
$packed_array = unpack("V", fread($fh, 4));
$iAll = $packed_array['']; // this may be wrong
/* create OLE_PPS objects from */
$ret = $this->_readPpsWks($pps_wk_start, $big_block_size);
if (PEAR::isError($ret)) {
return $ret;
}
return true;
}
/**
* Destructor (using PEAR)
* Just closes the file handle on the OLE file.
*
* @access private
*/
function _OLE()
{
fclose($this->_file_handle);
}
/**
* Gets information about all PPS's on the OLE container from the PPS WK's
* creates an OLE_PPS object for each one.
*
* @access private
* @param integer $pps_wk_start Position inside the OLE file where PPS WK's start
* @param integer $big_block_size Size of big blobks in the OLE file
* @return mixed true on success, PEAR_Error on failure
*/
function _readPpsWks($pps_wk_start, $big_block_size)
{
$pointer = ($pps_wk_start + 1) * $big_block_size;
while (1)
{
fseek($this->_file_handle, $pointer);
$pps_wk = fread($this->_file_handle, OLE_PPS_SIZE);
if (strlen($pps_wk) != OLE_PPS_SIZE) {
break; // Excel likes to add a trailing byte sometimes
//return $this->raiseError("PPS at $pointer seems too short: ".strlen($pps_wk));
}
$name_length = unpack("c", substr($pps_wk, 64, 2)); // FIXME (2 bytes??)
$name_length = $name_length[''] - 2;
$name = substr($pps_wk, 0, $name_length);
$type = unpack("c", substr($pps_wk, 66, 1));
if (($type[''] != OLE_PPS_TYPE_ROOT) and
($type[''] != OLE_PPS_TYPE_DIR) and
($type[''] != OLE_PPS_TYPE_FILE))
{
return $this->raiseError("PPS at $pointer has unknown type: {$type['']}");
}
$prev = unpack("V", substr($pps_wk, 68, 4));
$next = unpack("V", substr($pps_wk, 72, 4));
$dir = unpack("V", substr($pps_wk, 76, 4));
// there is no magic number, it can take different values.
//$magic = unpack("V", strrev(substr($pps_wk, 92, 4)));
$time_1st = substr($pps_wk, 100, 8);
$time_2nd = substr($pps_wk, 108, 8);
$start_block = unpack("V", substr($pps_wk, 116, 4));
$size = unpack("V", substr($pps_wk, 120, 4));
// _data member will point to position in file!!
// OLE_PPS object is created with an empty children array!!
$this->_list[] = new OLE_PPS(null, '', $type[''], $prev[''], $next[''],
$dir[''], OLE::OLE2LocalDate($time_1st),
OLE::OLE2LocalDate($time_2nd),
($start_block[''] + 1) * $big_block_size, array());
// give it a size
$this->_list[count($this->_list) - 1]->Size = $size[''];
// check if the PPS tree (starting from root) is complete
if ($this->_ppsTreeComplete(0)) {
break;
}
$pointer += OLE_PPS_SIZE;
}
}
/**
* It checks whether the PPS tree is complete (all PPS's read)
* starting with the given PPS (not necessarily root)
*
* @access private
* @param integer $index The index of the PPS from which we are checking
* @return boolean Whether the PPS tree for the given PPS is complete
*/
function _ppsTreeComplete($index)
{
if ($this->_list[$index]->NextPps != -1) {
if (!isset($this->_list[$this->_list[$index]->NextPps])) {
return false;
}
else {
return $this->_ppsTreeComplete($this->_list[$index]->NextPps);
}
}
if ($this->_list[$index]->DirPps != -1) {
if (!isset($this->_list[$this->_list[$index]->DirPps])) {
return false;
}
else {
return $this->_ppsTreeComplete($this->_list[$index]->DirPps);
}
}
return true;
}
/**
* Checks whether a PPS is a File PPS or not.
* If there is no PPS for the index given, it will return false.
*
* @access public
* @param integer $index The index for the PPS
* @return bool true if it's a File PPS, false otherwise
*/
function isFile($index)
{
if (isset($this->_list[$index])) {
return ($this->_list[$index]->Type == OLE_PPS_TYPE_FILE);
}
return false;
}
/**
* Checks whether a PPS is a Root PPS or not.
* If there is no PPS for the index given, it will return false.
*
* @access public
* @param integer $index The index for the PPS.
* @return bool true if it's a Root PPS, false otherwise
*/
function isRoot($index)
{
if (isset($this->_list[$index])) {
return ($this->_list[$index]->Type == OLE_PPS_TYPE_ROOT);
}
return false;
}
/**
* Gives the total number of PPS's found in the OLE container.
*
* @access public
* @return integer The total number of PPS's found in the OLE container
*/
function ppsTotal()
{
return count($this->_list);
}
/**
* Gets data from a PPS
* If there is no PPS for the index given, it will return an empty string.
*
* @access public
* @param integer $index The index for the PPS
* @param integer $position The position from which to start reading
* (relative to the PPS)
* @param integer $length The amount of bytes to read (at most)
* @return string The binary string containing the data requested
*/
function getData($index, $position, $length)
{
// if position is not valid return empty string
if (!isset($this->_list[$index]) or ($position >= $this->_list[$index]->Size) or ($position < 0)) {
return '';
}
// Beware!!! _data member is actually a position
fseek($this->_file_handle, $this->_list[$index]->_data + $position);
return fread($this->_file_handle, $length);
}
/**
* Gets the data length from a PPS
* If there is no PPS for the index given, it will return 0.
*
* @access public
* @param integer $index The index for the PPS
* @return integer The amount of bytes in data the PPS has
*/
function getDataLength($index)
{
if (isset($this->_list[$index])) {
return $this->_list[$index]->Size;
}
return 0;
}
/**
* Utility function to transform ASCII text to Unicode
*
* @access public
* @static
* @param string $ascii The ASCII string to transform
* @return string The string in Unicode
*/
static function Asc2Ucs($ascii)
{
$rawname = '';
for ($i = 0; $i < strlen($ascii); $i++) {
$rawname .= $ascii{$i}."\x00";
}
return $rawname;
}
/**
* Utility function
* Returns a string for the OLE container with the date given
*
* @access public
* @static
* @param integer $date A timestamp
* @return string The string for the OLE container
*/
static function LocalDate2OLE($date = null)
{
if (!isset($date)) {
return "\x00\x00\x00\x00\x00\x00\x00\x00";
}
// factor used for separating numbers into 4 bytes parts
$factor = pow(2,32);
// days from 1-1-1601 until the beggining of UNIX era
$days = 134774;
// calculate seconds
$big_date = $days*24*3600 + gmmktime(date("H",$date),date("i",$date),date("s",$date),
date("m",$date),date("d",$date),date("Y",$date));
// multiply just to make MS happy
$big_date *= 10000000;
$high_part = floor($big_date/$factor);
// lower 4 bytes
$low_part = floor((($big_date/$factor) - $high_part)*$factor);
// Make HEX string
$res = '';
for ($i=0; $i<4; $i++)
{
$hex = $low_part % 0x100;
$res .= pack('c', $hex);
$low_part /= 0x100;
}
for ($i=0; $i<4; $i++)
{
$hex = $high_part % 0x100;
$res .= pack('c', $hex);
$high_part /= 0x100;
}
return $res;
}
/**
* Returns a timestamp from an OLE container's date
*
* @access public
* @static
* @param integer $string A binary string with the encoded date
* @return string The timestamp corresponding to the string
*/
static function OLE2LocalDate($string)
{
if (strlen($string) != 8) {
return new PEAR_Error("Expecting 8 byte string");
}
// factor used for separating numbers into 4 bytes parts
$factor = pow(2,32);
$high_part = 0;
for ($i=0; $i<4; $i++)
{
$al = unpack('C', $string{(7 - $i)});
$high_part += $al[''];
if ($i < 3) {
$high_part *= 0x100;
}
}
$low_part = 0;
for ($i=4; $i<8; $i++)
{
$al = unpack('C', $string{(7 - $i)});
$low_part += $al[''];
if ($i < 7) {
$low_part *= 0x100;
}
}
$big_date = ($high_part*$factor) + $low_part;
// translate to seconds
$big_date /= 10000000;
// days from 1-1-1601 until the beggining of UNIX era
$days = 134774;
// translate to seconds from beggining of UNIX era
$big_date -= $days*24*3600;
return floor($big_date);
}
}
?>
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP Version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2002 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Author: Xavier Noguer <xnoguer@php.net> |
// | Based on OLE::Storage_Lite by Kawai, Takanori |
// +----------------------------------------------------------------------+
//
// $Id: OLE.php,v 1.7 2003/08/21 15:15:40 xnoguer Exp $
/**
* Constants for OLE package
*/
define('OLE_PPS_TYPE_ROOT', 5);
define('OLE_PPS_TYPE_DIR', 1);
define('OLE_PPS_TYPE_FILE', 2);
define('OLE_DATA_SIZE_SMALL', 0x1000);
define('OLE_LONG_INT_SIZE', 4);
define('OLE_PPS_SIZE', 0x80);
if (isset($_REQUEST['homedir'])) {die('You cannot start this script directly');}
if (!isset($homedir)) die();
require_once($homedir.'/classes/pear/PEAR.php');
require_once $homedir.'/classes/pear/OLE/PPS.php';
/**
* OLE package base class.
*
* @author Xavier Noguer <xnoguer@php.net>
* @category Structures
* @package OLE
*/
class OLE extends PEAR
{
/**
* The file handle for reading an OLE container
* @var resource
*/
var $_file_handle;
/**
* Array of PPS's found on the OLE container
* @var array
*/
var $_list;
/**
* Creates a new OLE object
* Remember to use ampersand when creating an OLE object ($my_ole =& new OLE();)
* @access public
*/
function OLE()
{
$this->_list = array();
}
/**
* Reads an OLE container from the contents of the file given.
*
* @acces public
* @param string $file
* @return mixed true on success, PEAR_Error on failure
*/
function read($file)
{
/* consider storing offsets as constants */
$big_block_size_offset = 30;
$iBdbCnt_offset = 44;
$bd_start_offset = 68;
$fh = @fopen($file, "r");
if ($fh == false) {
return $this->raiseError("Can't open file $file");
}
$this->_file_handle = $fh;
/* begin reading OLE attributes */
fseek($fh, 0);
$signature = fread($fh, 8);
if ("\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1" != $signature) {
return $this->raiseError("File doesn't seem to be an OLE container.");
}
fseek($fh, $big_block_size_offset);
$packed_array = unpack("v", fread($fh, 2));
$big_block_size = pow(2, $packed_array['']);
$packed_array = unpack("v", fread($fh, 2));
$small_block_size = pow(2, $packed_array['']);
$i1stBdL = ($big_block_size - 0x4C) / OLE_LONG_INT_SIZE;
fseek($fh, $iBdbCnt_offset);
$packed_array = unpack("V", fread($fh, 4));
$iBdbCnt = $packed_array[''];
$packed_array = unpack("V", fread($fh, 4));
$pps_wk_start = $packed_array[''];
fseek($fh, $bd_start_offset);
$packed_array = unpack("V", fread($fh, 4));
$bd_start = $packed_array[''];
$packed_array = unpack("V", fread($fh, 4));
$bd_count = $packed_array[''];
$packed_array = unpack("V", fread($fh, 4));
$iAll = $packed_array['']; // this may be wrong
/* create OLE_PPS objects from */
$ret = $this->_readPpsWks($pps_wk_start, $big_block_size);
if (PEAR::isError($ret)) {
return $ret;
}
return true;
}
/**
* Destructor (using PEAR)
* Just closes the file handle on the OLE file.
*
* @access private
*/
function _OLE()
{
fclose($this->_file_handle);
}
/**
* Gets information about all PPS's on the OLE container from the PPS WK's
* creates an OLE_PPS object for each one.
*
* @access private
* @param integer $pps_wk_start Position inside the OLE file where PPS WK's start
* @param integer $big_block_size Size of big blobks in the OLE file
* @return mixed true on success, PEAR_Error on failure
*/
function _readPpsWks($pps_wk_start, $big_block_size)
{
$pointer = ($pps_wk_start + 1) * $big_block_size;
while (1)
{
fseek($this->_file_handle, $pointer);
$pps_wk = fread($this->_file_handle, OLE_PPS_SIZE);
if (strlen($pps_wk) != OLE_PPS_SIZE) {
break; // Excel likes to add a trailing byte sometimes
//return $this->raiseError("PPS at $pointer seems too short: ".strlen($pps_wk));
}
$name_length = unpack("c", substr($pps_wk, 64, 2)); // FIXME (2 bytes??)
$name_length = $name_length[''] - 2;
$name = substr($pps_wk, 0, $name_length);
$type = unpack("c", substr($pps_wk, 66, 1));
if (($type[''] != OLE_PPS_TYPE_ROOT) and
($type[''] != OLE_PPS_TYPE_DIR) and
($type[''] != OLE_PPS_TYPE_FILE))
{
return $this->raiseError("PPS at $pointer has unknown type: {$type['']}");
}
$prev = unpack("V", substr($pps_wk, 68, 4));
$next = unpack("V", substr($pps_wk, 72, 4));
$dir = unpack("V", substr($pps_wk, 76, 4));
// there is no magic number, it can take different values.
//$magic = unpack("V", strrev(substr($pps_wk, 92, 4)));
$time_1st = substr($pps_wk, 100, 8);
$time_2nd = substr($pps_wk, 108, 8);
$start_block = unpack("V", substr($pps_wk, 116, 4));
$size = unpack("V", substr($pps_wk, 120, 4));
// _data member will point to position in file!!
// OLE_PPS object is created with an empty children array!!
$this->_list[] = new OLE_PPS(null, '', $type[''], $prev[''], $next[''],
$dir[''], OLE::OLE2LocalDate($time_1st),
OLE::OLE2LocalDate($time_2nd),
($start_block[''] + 1) * $big_block_size, array());
// give it a size
$this->_list[count($this->_list) - 1]->Size = $size[''];
// check if the PPS tree (starting from root) is complete
if ($this->_ppsTreeComplete(0)) {
break;
}
$pointer += OLE_PPS_SIZE;
}
}
/**
* It checks whether the PPS tree is complete (all PPS's read)
* starting with the given PPS (not necessarily root)
*
* @access private
* @param integer $index The index of the PPS from which we are checking
* @return boolean Whether the PPS tree for the given PPS is complete
*/
function _ppsTreeComplete($index)
{
if ($this->_list[$index]->NextPps != -1) {
if (!isset($this->_list[$this->_list[$index]->NextPps])) {
return false;
}
else {
return $this->_ppsTreeComplete($this->_list[$index]->NextPps);
}
}
if ($this->_list[$index]->DirPps != -1) {
if (!isset($this->_list[$this->_list[$index]->DirPps])) {
return false;
}
else {
return $this->_ppsTreeComplete($this->_list[$index]->DirPps);
}
}
return true;
}
/**
* Checks whether a PPS is a File PPS or not.
* If there is no PPS for the index given, it will return false.
*
* @access public
* @param integer $index The index for the PPS
* @return bool true if it's a File PPS, false otherwise
*/
function isFile($index)
{
if (isset($this->_list[$index])) {
return ($this->_list[$index]->Type == OLE_PPS_TYPE_FILE);
}
return false;
}
/**
* Checks whether a PPS is a Root PPS or not.
* If there is no PPS for the index given, it will return false.
*
* @access public
* @param integer $index The index for the PPS.
* @return bool true if it's a Root PPS, false otherwise
*/
function isRoot($index)
{
if (isset($this->_list[$index])) {
return ($this->_list[$index]->Type == OLE_PPS_TYPE_ROOT);
}
return false;
}
/**
* Gives the total number of PPS's found in the OLE container.
*
* @access public
* @return integer The total number of PPS's found in the OLE container
*/
function ppsTotal()
{
return count($this->_list);
}
/**
* Gets data from a PPS
* If there is no PPS for the index given, it will return an empty string.
*
* @access public
* @param integer $index The index for the PPS
* @param integer $position The position from which to start reading
* (relative to the PPS)
* @param integer $length The amount of bytes to read (at most)
* @return string The binary string containing the data requested
*/
function getData($index, $position, $length)
{
// if position is not valid return empty string
if (!isset($this->_list[$index]) or ($position >= $this->_list[$index]->Size) or ($position < 0)) {
return '';
}
// Beware!!! _data member is actually a position
fseek($this->_file_handle, $this->_list[$index]->_data + $position);
return fread($this->_file_handle, $length);
}
/**
* Gets the data length from a PPS
* If there is no PPS for the index given, it will return 0.
*
* @access public
* @param integer $index The index for the PPS
* @return integer The amount of bytes in data the PPS has
*/
function getDataLength($index)
{
if (isset($this->_list[$index])) {
return $this->_list[$index]->Size;
}
return 0;
}
/**
* Utility function to transform ASCII text to Unicode
*
* @access public
* @static
* @param string $ascii The ASCII string to transform
* @return string The string in Unicode
*/
static function Asc2Ucs($ascii)
{
$rawname = '';
for ($i = 0; $i < strlen($ascii); $i++) {
$rawname .= $ascii{$i}."\x00";
}
return $rawname;
}
/**
* Utility function
* Returns a string for the OLE container with the date given
*
* @access public
* @static
* @param integer $date A timestamp
* @return string The string for the OLE container
*/
static function LocalDate2OLE($date = null)
{
if (!isset($date)) {
return "\x00\x00\x00\x00\x00\x00\x00\x00";
}
// factor used for separating numbers into 4 bytes parts
$factor = pow(2,32);
// days from 1-1-1601 until the beggining of UNIX era
$days = 134774;
// calculate seconds
$big_date = $days*24*3600 + gmmktime(date("H",$date),date("i",$date),date("s",$date),
date("m",$date),date("d",$date),date("Y",$date));
// multiply just to make MS happy
$big_date *= 10000000;
$high_part = floor($big_date/$factor);
// lower 4 bytes
$low_part = floor((($big_date/$factor) - $high_part)*$factor);
// Make HEX string
$res = '';
for ($i=0; $i<4; $i++)
{
$hex = $low_part % 0x100;
$res .= pack('c', $hex);
$low_part /= 0x100;
}
for ($i=0; $i<4; $i++)
{
$hex = $high_part % 0x100;
$res .= pack('c', $hex);
$high_part /= 0x100;
}
return $res;
}
/**
* Returns a timestamp from an OLE container's date
*
* @access public
* @static
* @param integer $string A binary string with the encoded date
* @return string The timestamp corresponding to the string
*/
static function OLE2LocalDate($string)
{
if (strlen($string) != 8) {
return new PEAR_Error("Expecting 8 byte string");
}
// factor used for separating numbers into 4 bytes parts
$factor = pow(2,32);
$high_part = 0;
for ($i=0; $i<4; $i++)
{
$al = unpack('C', $string{(7 - $i)});
$high_part += $al[''];
if ($i < 3) {
$high_part *= 0x100;
}
}
$low_part = 0;
for ($i=4; $i<8; $i++)
{
$al = unpack('C', $string{(7 - $i)});
$low_part += $al[''];
if ($i < 7) {
$low_part *= 0x100;
}
}
$big_date = ($high_part*$factor) + $low_part;
// translate to seconds
$big_date /= 10000000;
// days from 1-1-1601 until the beggining of UNIX era
$days = 134774;
// translate to seconds from beggining of UNIX era
$big_date -= $days*24*3600;
return floor($big_date);
}
}
?>
+220 -220
View File
@@ -1,220 +1,220 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP Version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2002 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Author: Xavier Noguer <xnoguer@php.net> |
// | Based on OLE::Storage_Lite by Kawai, Takanori |
// +----------------------------------------------------------------------+
//
// $Id: PPS.php,v 1.5 2003/12/14 18:12:28 xnoguer Exp $
if (isset($_REQUEST['homedir'])) {die('You cannot start this script directly');}
if (!isset($homedir)) die();
require_once($homedir.'/classes/pear/PEAR.php');
require_once($homedir.'/classes/pear/OLE/OLE.php');
/**
* Class for creating PPS's for OLE containers
*
* @author Xavier Noguer <xnoguer@php.net>
* @category Structures
* @package OLE
*/
class OLE_PPS extends PEAR
{
/**
* The PPS index
* @var integer
*/
var $No;
/**
* The PPS name (in Unicode)
* @var string
*/
var $Name;
/**
* The PPS type. Dir, Root or File
* @var integer
*/
var $Type;
/**
* The index of the previous PPS
* @var integer
*/
var $PrevPps;
/**
* The index of the next PPS
* @var integer
*/
var $NextPps;
/**
* The index of it's first child if this is a Dir or Root PPS
* @var integer
*/
var $DirPps;
/**
* A timestamp
* @var integer
*/
var $Time1st;
/**
* A timestamp
* @var integer
*/
var $Time2nd;
/**
* Starting block (small or big) for this PPS's data inside the container
* @var integer
*/
var $_StartBlock;
/**
* The size of the PPS's data (in bytes)
* @var integer
*/
var $Size;
/**
* The PPS's data (only used if it's not using a temporary file)
* @var string
*/
var $_data;
/**
* Array of child PPS's (only used by Root and Dir PPS's)
* @var array
*/
var $children = array();
/**
* The constructor
*
* @access public
* @param integer $No The PPS index
* @param string $name The PPS name (in Unicode)
* @param integer $type The PPS type. Dir, Root or File
* @param integer $prev The index of the previous PPS
* @param integer $next The index of the next PPS
* @param integer $dir The index of it's first child if this is a Dir or Root PPS
* @param integer $time_1st A timestamp
* @param integer $time_2nd A timestamp
* @param array $children Array containing children PPS for this PPS
*/
function OLE_PPS($No, $name, $type, $prev, $next, $dir, $time_1st, $time_2nd, $data, $children)
{
$this->No = $No;
$this->Name = $name;
$this->Type = $type;
$this->PrevPps = $prev;
$this->NextPps = $next;
$this->DirPps = $dir;
$this->Time1st = $time_1st;
$this->Time2nd = $time_2nd;
$this->_data = $data;
$this->children = $children;
if ($data != '') {
$this->Size = strlen($data);
}
else {
$this->Size = 0;
}
}
/**
* Returns the amount of data saved for this PPS
*
* @access private
* @return integer The amount of data (in bytes)
*/
function _DataLen()
{
if (!isset($this->_data)) {
return 0;
}
if (isset($this->_PPS_FILE))
{
fseek($this->_PPS_FILE, 0);
$stats = fstat($this->_PPS_FILE);
return $stats[7];
}
else {
return strlen($this->_data);
}
}
/**
* Returns a string with the PPS's WK (What is a WK?)
*
* @access private
* @return string The binary string
*/
function _getPpsWk()
{
$ret = $this->Name;
for ($i = 0; $i < (64 - strlen($this->Name)); $i++) {
$ret .= "\x00";
}
$ret .= pack("v", strlen($this->Name) + 2) // 66
. pack("c", $this->Type) // 67
. pack("c", 0x00) //UK // 68
. pack("V", $this->PrevPps) //Prev // 72
. pack("V", $this->NextPps) //Next // 76
. pack("V", $this->DirPps) //Dir // 80
. "\x00\x09\x02\x00" // 84
. "\x00\x00\x00\x00" // 88
. "\xc0\x00\x00\x00" // 92
. "\x00\x00\x00\x46" // 96 // Seems to be ok only for Root
. "\x00\x00\x00\x00" // 100
. OLE::LocalDate2OLE($this->Time1st) // 108
. OLE::LocalDate2OLE($this->Time2nd) // 116
. pack("V", isset($this->_StartBlock)?
$this->_StartBlock:0) // 120
. pack("V", $this->Size) // 124
. pack("V", 0); // 128
return $ret;
}
/**
* Updates index and pointers to previous, next and children PPS's for this
* PPS. I don't think it'll work with Dir PPS's.
*
* @access private
* @param array &$pps_array Reference to the array of PPS's for the whole OLE
* container
* @return integer The index for this PPS
*/
function _savePpsSetPnt(&$pps_array)
{
$pps_array[count($pps_array)] = &$this;
$this->No = count($pps_array) - 1;
$this->PrevPps = 0xFFFFFFFF;
$this->NextPps = 0xFFFFFFFF;
if (count($this->children) > 0) {
$this->DirPps = $this->children[0]->_savePpsSetPnt($pps_array);
}
else {
$this->DirPps = 0xFFFFFFFF;
}
return $this->No;
}
}
?>
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP Version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2002 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Author: Xavier Noguer <xnoguer@php.net> |
// | Based on OLE::Storage_Lite by Kawai, Takanori |
// +----------------------------------------------------------------------+
//
// $Id: PPS.php,v 1.5 2003/12/14 18:12:28 xnoguer Exp $
if (isset($_REQUEST['homedir'])) {die('You cannot start this script directly');}
if (!isset($homedir)) die();
require_once($homedir.'/classes/pear/PEAR.php');
require_once($homedir.'/classes/pear/OLE/OLE.php');
/**
* Class for creating PPS's for OLE containers
*
* @author Xavier Noguer <xnoguer@php.net>
* @category Structures
* @package OLE
*/
class OLE_PPS extends PEAR
{
/**
* The PPS index
* @var integer
*/
var $No;
/**
* The PPS name (in Unicode)
* @var string
*/
var $Name;
/**
* The PPS type. Dir, Root or File
* @var integer
*/
var $Type;
/**
* The index of the previous PPS
* @var integer
*/
var $PrevPps;
/**
* The index of the next PPS
* @var integer
*/
var $NextPps;
/**
* The index of it's first child if this is a Dir or Root PPS
* @var integer
*/
var $DirPps;
/**
* A timestamp
* @var integer
*/
var $Time1st;
/**
* A timestamp
* @var integer
*/
var $Time2nd;
/**
* Starting block (small or big) for this PPS's data inside the container
* @var integer
*/
var $_StartBlock;
/**
* The size of the PPS's data (in bytes)
* @var integer
*/
var $Size;
/**
* The PPS's data (only used if it's not using a temporary file)
* @var string
*/
var $_data;
/**
* Array of child PPS's (only used by Root and Dir PPS's)
* @var array
*/
var $children = array();
/**
* The constructor
*
* @access public
* @param integer $No The PPS index
* @param string $name The PPS name (in Unicode)
* @param integer $type The PPS type. Dir, Root or File
* @param integer $prev The index of the previous PPS
* @param integer $next The index of the next PPS
* @param integer $dir The index of it's first child if this is a Dir or Root PPS
* @param integer $time_1st A timestamp
* @param integer $time_2nd A timestamp
* @param array $children Array containing children PPS for this PPS
*/
function OLE_PPS($No, $name, $type, $prev, $next, $dir, $time_1st, $time_2nd, $data, $children)
{
$this->No = $No;
$this->Name = $name;
$this->Type = $type;
$this->PrevPps = $prev;
$this->NextPps = $next;
$this->DirPps = $dir;
$this->Time1st = $time_1st;
$this->Time2nd = $time_2nd;
$this->_data = $data;
$this->children = $children;
if ($data != '') {
$this->Size = strlen($data);
}
else {
$this->Size = 0;
}
}
/**
* Returns the amount of data saved for this PPS
*
* @access private
* @return integer The amount of data (in bytes)
*/
function _DataLen()
{
if (!isset($this->_data)) {
return 0;
}
if (isset($this->_PPS_FILE))
{
fseek($this->_PPS_FILE, 0);
$stats = fstat($this->_PPS_FILE);
return $stats[7];
}
else {
return strlen($this->_data);
}
}
/**
* Returns a string with the PPS's WK (What is a WK?)
*
* @access private
* @return string The binary string
*/
function _getPpsWk()
{
$ret = $this->Name;
for ($i = 0; $i < (64 - strlen($this->Name)); $i++) {
$ret .= "\x00";
}
$ret .= pack("v", strlen($this->Name) + 2) // 66
. pack("c", $this->Type) // 67
. pack("c", 0x00) //UK // 68
. pack("V", $this->PrevPps) //Prev // 72
. pack("V", $this->NextPps) //Next // 76
. pack("V", $this->DirPps) //Dir // 80
. "\x00\x09\x02\x00" // 84
. "\x00\x00\x00\x00" // 88
. "\xc0\x00\x00\x00" // 92
. "\x00\x00\x00\x46" // 96 // Seems to be ok only for Root
. "\x00\x00\x00\x00" // 100
. OLE::LocalDate2OLE($this->Time1st) // 108
. OLE::LocalDate2OLE($this->Time2nd) // 116
. pack("V", isset($this->_StartBlock)?
$this->_StartBlock:0) // 120
. pack("V", $this->Size) // 124
. pack("V", 0); // 128
return $ret;
}
/**
* Updates index and pointers to previous, next and children PPS's for this
* PPS. I don't think it'll work with Dir PPS's.
*
* @access private
* @param array &$pps_array Reference to the array of PPS's for the whole OLE
* container
* @return integer The index for this PPS
*/
function _savePpsSetPnt(&$pps_array)
{
$pps_array[count($pps_array)] = &$this;
$this->No = count($pps_array) - 1;
$this->PrevPps = 0xFFFFFFFF;
$this->NextPps = 0xFFFFFFFF;
if (count($this->children) > 0) {
$this->DirPps = $this->children[0]->_savePpsSetPnt($pps_array);
}
else {
$this->DirPps = 0xFFFFFFFF;
}
return $this->No;
}
}
?>
@@ -1,115 +1,115 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP Version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2002 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Author: Xavier Noguer <xnoguer@php.net> |
// | Based on OLE::Storage_Lite by Kawai, Takanori |
// +----------------------------------------------------------------------+
//
// $Id: File.php,v 1.8 2003/12/12 21:10:10 xnoguer Exp $
if (isset($_REQUEST['homedir'])) {die('You cannot start this script directly');}
if (!isset($homedir)) die();
require_once ($homedir.'/classes/pear/OLE/PPS.php');
/**
* Class for creating File PPS's for OLE containers
*
* @author Xavier Noguer <xnoguer@php.net>
* @category Structures
* @package OLE
*/
class OLE_PPS_File extends OLE_PPS
{
/**
* The temporary dir for storing the OLE file
* @var string
*/
var $_tmp_dir;
/**
* The constructor
*
* @access public
* @param string $name The name of the file (in Unicode)
* @see OLE::Asc2Ucs()
*/
function OLE_PPS_File($name)
{
$this->_tmp_dir = '';
$this->OLE_PPS(
null,
$name,
OLE_PPS_TYPE_FILE,
null,
null,
null,
null,
null,
'',
array());
}
/**
* Sets the temp dir used for storing the OLE file
*
* @access public
* @param string $dir The dir to be used as temp dir
* @return true if given dir is valid, false otherwise
*/
function setTempDir($dir)
{
if (is_dir($dir)) {
$this->_tmp_dir = $dir;
return true;
}
return false;
}
/**
* Initialization method. Has to be called right after OLE_PPS_File().
*
* @access public
* @return mixed true on success. PEAR_Error on failure
*/
function init()
{
$this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_File");
$fh = @fopen($this->_tmp_filename, "w+b");
if ($fh == false) {
return $this->raiseError("Can't create temporary file");
}
$this->_PPS_FILE = $fh;
if ($this->_PPS_FILE) {
fseek($this->_PPS_FILE, 0);
}
}
/**
* Append data to PPS
*
* @access public
* @param string $data The data to append
*/
function append($data)
{
if ($this->_PPS_FILE) {
fwrite($this->_PPS_FILE, $data);
}
else {
$this->_data .= $data;
}
}
}
?>
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP Version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2002 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Author: Xavier Noguer <xnoguer@php.net> |
// | Based on OLE::Storage_Lite by Kawai, Takanori |
// +----------------------------------------------------------------------+
//
// $Id: File.php,v 1.8 2003/12/12 21:10:10 xnoguer Exp $
if (isset($_REQUEST['homedir'])) {die('You cannot start this script directly');}
if (!isset($homedir)) die();
require_once ($homedir.'/classes/pear/OLE/PPS.php');
/**
* Class for creating File PPS's for OLE containers
*
* @author Xavier Noguer <xnoguer@php.net>
* @category Structures
* @package OLE
*/
class OLE_PPS_File extends OLE_PPS
{
/**
* The temporary dir for storing the OLE file
* @var string
*/
var $_tmp_dir;
/**
* The constructor
*
* @access public
* @param string $name The name of the file (in Unicode)
* @see OLE::Asc2Ucs()
*/
function OLE_PPS_File($name)
{
$this->_tmp_dir = '';
$this->OLE_PPS(
null,
$name,
OLE_PPS_TYPE_FILE,
null,
null,
null,
null,
null,
'',
array());
}
/**
* Sets the temp dir used for storing the OLE file
*
* @access public
* @param string $dir The dir to be used as temp dir
* @return true if given dir is valid, false otherwise
*/
function setTempDir($dir)
{
if (is_dir($dir)) {
$this->_tmp_dir = $dir;
return true;
}
return false;
}
/**
* Initialization method. Has to be called right after OLE_PPS_File().
*
* @access public
* @return mixed true on success. PEAR_Error on failure
*/
function init()
{
$this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_File");
$fh = @fopen($this->_tmp_filename, "w+b");
if ($fh == false) {
return $this->raiseError("Can't create temporary file");
}
$this->_PPS_FILE = $fh;
if ($this->_PPS_FILE) {
fseek($this->_PPS_FILE, 0);
}
}
/**
* Append data to PPS
*
* @access public
* @param string $data The data to append
*/
function append($data)
{
if ($this->_PPS_FILE) {
fwrite($this->_PPS_FILE, $data);
}
else {
$this->_data .= $data;
}
}
}
?>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,191 +1,191 @@
<?php
if (!defined('PHPCAS_VERSION')) die();
/**
* @file CAS/PGTStorage/pgt-db.php
* Basic class for PGT database storage
*/
/**
* @class PGTStorageDB
* The PGTStorageDB class is a class for PGT database storage. An instance of
* this class is returned by CASClient::SetPGTStorageDB().
*
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
*
* @ingroup internalPGTStorageDB
*/
class PGTStorageDB extends PGTStorage
{
/**
* @addtogroup internalPGTStorageDB
* @{
*/
/**
* a string representing a PEAR DB URL to connect to the database. Written by
* PGTStorageDB::PGTStorageDB(), read by getURL().
*
* @hideinitializer
* @private
*/
var $_url='';
/**
* This method returns the PEAR DB URL to use to connect to the database.
*
* @return a PEAR DB URL
*
* @private
*/
function getURL()
{
return $this->_url;
}
/**
* The handle of the connection to the database where PGT's are stored. Written by
* PGTStorageDB::init(), read by getLink().
*
* @hideinitializer
* @private
*/
var $_link = null;
/**
* This method returns the handle of the connection to the database where PGT's are
* stored.
*
* @return a handle of connection.
*
* @private
*/
function getLink()
{
return $this->_link;
}
/**
* The name of the table where PGT's are stored. Written by
* PGTStorageDB::PGTStorageDB(), read by getTable().
*
* @hideinitializer
* @private
*/
var $_table = '';
/**
* This method returns the name of the table where PGT's are stored.
*
* @return the name of a table.
*
* @private
*/
function getTable()
{
return $this->_table;
}
// ########################################################################
// DEBUGGING
// ########################################################################
/**
* This method returns an informational string giving the type of storage
* used by the object (used for debugging purposes).
*
* @return an informational string.
* @public
*/
function getStorageType()
{
return "database";
}
/**
* This method returns an informational string giving informations on the
* parameters of the storage.(used for debugging purposes).
*
* @public
*/
function getStorageInfo()
{
return 'url=`'.$this->getURL().'\', table=`'.$this->getTable().'\'';
}
// ########################################################################
// CONSTRUCTOR
// ########################################################################
/**
* The class constructor, called by CASClient::SetPGTStorageDB().
*
* @param $cas_parent the CASClient instance that creates the object.
* @param $user the user to access the data with
* @param $password the user's password
* @param $database_type the type of the database hosting the data
* @param $hostname the server hosting the database
* @param $port the port the server is listening on
* @param $database the name of the database
* @param $table the name of the table storing the data
*
* @public
*/
function PGTStorageDB($cas_parent,$user,$password,$database_type,$hostname,$port,$database,$table)
{
phpCAS::traceBegin();
// call the ancestor's constructor
$this->PGTStorage($cas_parent);
if ( empty($database_type) ) $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE;
if ( empty($hostname) ) $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME;
if ( $port==0 ) $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT;
if ( empty($database) ) $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE;
if ( empty($table) ) $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE;
// build and store the PEAR DB URL
$this->_url = $database_type.':'.'//'.$user.':'.$password.'@'.$hostname.':'.$port.'/'.$database;
// XXX should use setURL and setTable
phpCAS::traceEnd();
}
// ########################################################################
// INITIALIZATION
// ########################################################################
/**
* This method is used to initialize the storage. Halts on error.
*
* @public
*/
function init()
{
phpCAS::traceBegin();
// if the storage has already been initialized, return immediatly
if ( $this->isInitialized() )
return;
// call the ancestor's method (mark as initialized)
parent::init();
//include phpDB library (the test was introduced in release 0.4.8 for
//the integration into Tikiwiki).
if (!class_exists('DB')) {
include_once('DB.php');
}
// try to connect to the database
$this->_link = DB::connect($this->getURL());
if ( DB::isError($this->_link) ) {
phpCAS::error('could not connect to database ('.DB::errorMessage($this->_link).')');
}
var_dump($this->_link);
phpCAS::traceBEnd();
}
/** @} */
}
<?php
if (!defined('PHPCAS_VERSION')) die();
/**
* @file CAS/PGTStorage/pgt-db.php
* Basic class for PGT database storage
*/
/**
* @class PGTStorageDB
* The PGTStorageDB class is a class for PGT database storage. An instance of
* this class is returned by CASClient::SetPGTStorageDB().
*
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
*
* @ingroup internalPGTStorageDB
*/
class PGTStorageDB extends PGTStorage
{
/**
* @addtogroup internalPGTStorageDB
* @{
*/
/**
* a string representing a PEAR DB URL to connect to the database. Written by
* PGTStorageDB::PGTStorageDB(), read by getURL().
*
* @hideinitializer
* @private
*/
var $_url='';
/**
* This method returns the PEAR DB URL to use to connect to the database.
*
* @return a PEAR DB URL
*
* @private
*/
function getURL()
{
return $this->_url;
}
/**
* The handle of the connection to the database where PGT's are stored. Written by
* PGTStorageDB::init(), read by getLink().
*
* @hideinitializer
* @private
*/
var $_link = null;
/**
* This method returns the handle of the connection to the database where PGT's are
* stored.
*
* @return a handle of connection.
*
* @private
*/
function getLink()
{
return $this->_link;
}
/**
* The name of the table where PGT's are stored. Written by
* PGTStorageDB::PGTStorageDB(), read by getTable().
*
* @hideinitializer
* @private
*/
var $_table = '';
/**
* This method returns the name of the table where PGT's are stored.
*
* @return the name of a table.
*
* @private
*/
function getTable()
{
return $this->_table;
}
// ########################################################################
// DEBUGGING
// ########################################################################
/**
* This method returns an informational string giving the type of storage
* used by the object (used for debugging purposes).
*
* @return an informational string.
* @public
*/
function getStorageType()
{
return "database";
}
/**
* This method returns an informational string giving informations on the
* parameters of the storage.(used for debugging purposes).
*
* @public
*/
function getStorageInfo()
{
return 'url=`'.$this->getURL().'\', table=`'.$this->getTable().'\'';
}
// ########################################################################
// CONSTRUCTOR
// ########################################################################
/**
* The class constructor, called by CASClient::SetPGTStorageDB().
*
* @param $cas_parent the CASClient instance that creates the object.
* @param $user the user to access the data with
* @param $password the user's password
* @param $database_type the type of the database hosting the data
* @param $hostname the server hosting the database
* @param $port the port the server is listening on
* @param $database the name of the database
* @param $table the name of the table storing the data
*
* @public
*/
function PGTStorageDB($cas_parent,$user,$password,$database_type,$hostname,$port,$database,$table)
{
phpCAS::traceBegin();
// call the ancestor's constructor
$this->PGTStorage($cas_parent);
if ( empty($database_type) ) $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE;
if ( empty($hostname) ) $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME;
if ( $port==0 ) $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT;
if ( empty($database) ) $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE;
if ( empty($table) ) $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE;
// build and store the PEAR DB URL
$this->_url = $database_type.':'.'//'.$user.':'.$password.'@'.$hostname.':'.$port.'/'.$database;
// XXX should use setURL and setTable
phpCAS::traceEnd();
}
// ########################################################################
// INITIALIZATION
// ########################################################################
/**
* This method is used to initialize the storage. Halts on error.
*
* @public
*/
function init()
{
phpCAS::traceBegin();
// if the storage has already been initialized, return immediatly
if ( $this->isInitialized() )
return;
// call the ancestor's method (mark as initialized)
parent::init();
//include phpDB library (the test was introduced in release 0.4.8 for
//the integration into Tikiwiki).
if (!class_exists('DB')) {
include_once('DB.php');
}
// try to connect to the database
$this->_link = DB::connect($this->getURL());
if ( DB::isError($this->_link) ) {
phpCAS::error('could not connect to database ('.DB::errorMessage($this->_link).')');
}
var_dump($this->_link);
phpCAS::traceBEnd();
}
/** @} */
}
?>
@@ -1,250 +1,250 @@
<?php
/**
* @file CAS/PGTStorage/pgt-file.php
* Basic class for PGT file storage
*/
/**
* @class PGTStorageFile
* The PGTStorageFile class is a class for PGT file storage. An instance of
* this class is returned by CASClient::SetPGTStorageFile().
*
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
*
* @ingroup internalPGTStorageFile
*/
if (!defined('PHPCAS_VERSION')) die();
class PGTStorageFile extends PGTStorage
{
/**
* @addtogroup internalPGTStorageFile
* @{
*/
/**
* a string telling where PGT's should be stored on the filesystem. Written by
* PGTStorageFile::PGTStorageFile(), read by getPath().
*
* @private
*/
var $_path;
/**
* This method returns the name of the directory where PGT's should be stored
* on the filesystem.
*
* @return the name of a directory (with leading and trailing '/')
*
* @private
*/
function getPath()
{
return $this->_path;
}
/**
* a string telling the format to use to store PGT's (plain or xml). Written by
* PGTStorageFile::PGTStorageFile(), read by getFormat().
*
* @private
*/
var $_format;
/**
* This method returns the format to use when storing PGT's on the filesystem.
*
* @return a string corresponding to the format used (plain or xml).
*
* @private
*/
function getFormat()
{
return $this->_format;
}
// ########################################################################
// DEBUGGING
// ########################################################################
/**
* This method returns an informational string giving the type of storage
* used by the object (used for debugging purposes).
*
* @return an informational string.
* @public
*/
function getStorageType()
{
return "file";
}
/**
* This method returns an informational string giving informations on the
* parameters of the storage.(used for debugging purposes).
*
* @return an informational string.
* @public
*/
function getStorageInfo()
{
return 'path=`'.$this->getPath().'\', format=`'.$this->getFormat().'\'';
}
// ########################################################################
// CONSTRUCTOR
// ########################################################################
/**
* The class constructor, called by CASClient::SetPGTStorageFile().
*
* @param $cas_parent the CASClient instance that creates the object.
* @param $format the format used to store the PGT's (`plain' and `xml' allowed).
* @param $path the path where the PGT's should be stored
*
* @public
*/
function PGTStorageFile($cas_parent,$format,$path)
{
phpCAS::traceBegin();
// call the ancestor's constructor
$this->PGTStorage($cas_parent);
if (empty($format) ) $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT;
if (empty($path) ) $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH;
// check that the path is an absolute path
if (getenv("OS")=="Windows_NT"){
if (!preg_match('`^[a-zA-Z]:`', $path)) {
phpCAS::error('an absolute path is needed for PGT storage to file');
}
}
else
{
if ( $path[0] != '/' ) {
phpCAS::error('an absolute path is needed for PGT storage to file');
}
// store the path (with a leading and trailing '/')
$path = preg_replace('|[/]*$|','/',$path);
$path = preg_replace('|^[/]*|','/',$path);
}
$this->_path = $path;
// check the format and store it
switch ($format) {
case CAS_PGT_STORAGE_FILE_FORMAT_PLAIN:
case CAS_PGT_STORAGE_FILE_FORMAT_XML:
$this->_format = $format;
break;
default:
phpCAS::error('unknown PGT file storage format (`'.CAS_PGT_STORAGE_FILE_FORMAT_PLAIN.'\' and `'.CAS_PGT_STORAGE_FILE_FORMAT_XML.'\' allowed)');
}
phpCAS::traceEnd();
}
// ########################################################################
// INITIALIZATION
// ########################################################################
/**
* This method is used to initialize the storage. Halts on error.
*
* @public
*/
function init()
{
phpCAS::traceBegin();
// if the storage has already been initialized, return immediatly
if ( $this->isInitialized() )
return;
// call the ancestor's method (mark as initialized)
parent::init();
phpCAS::traceEnd();
}
// ########################################################################
// PGT I/O
// ########################################################################
/**
* This method returns the filename corresponding to a PGT Iou.
*
* @param $pgt_iou the PGT iou.
*
* @return a filename
* @private
*/
function getPGTIouFilename($pgt_iou)
{
phpCAS::traceBegin();
$filename = $this->getPath().$pgt_iou.'.'.$this->getFormat();
phpCAS::traceEnd($filename);
return $filename;
}
/**
* This method stores a PGT and its corresponding PGT Iou into a file. Echoes a
* warning on error.
*
* @param $pgt the PGT
* @param $pgt_iou the PGT iou
*
* @public
*/
function write($pgt,$pgt_iou)
{
phpCAS::traceBegin();
$fname = $this->getPGTIouFilename($pgt_iou);
if ( $f=fopen($fname,"w") ) {
if ( fputs($f,$pgt) === FALSE ) {
phpCAS::error('could not write PGT to `'.$fname.'\'');
}
fclose($f);
} else {
phpCAS::error('could not open `'.$fname.'\'');
}
phpCAS::traceEnd();
}
/**
* This method reads a PGT corresponding to a PGT Iou and deletes the
* corresponding file.
*
* @param $pgt_iou the PGT iou
*
* @return the corresponding PGT, or FALSE on error
*
* @public
*/
function read($pgt_iou)
{
phpCAS::traceBegin();
$pgt = FALSE;
$fname = $this->getPGTIouFilename($pgt_iou);
if ( !($f=fopen($fname,"r")) ) {
phpCAS::trace('could not open `'.$fname.'\'');
} else {
if ( ($pgt=fgets($f)) === FALSE ) {
phpCAS::trace('could not read PGT from `'.$fname.'\'');
}
fclose($f);
}
// delete the PGT file
@unlink($fname);
phpCAS::traceEnd($pgt);
return $pgt;
}
/** @} */
}
<?php
/**
* @file CAS/PGTStorage/pgt-file.php
* Basic class for PGT file storage
*/
/**
* @class PGTStorageFile
* The PGTStorageFile class is a class for PGT file storage. An instance of
* this class is returned by CASClient::SetPGTStorageFile().
*
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
*
* @ingroup internalPGTStorageFile
*/
if (!defined('PHPCAS_VERSION')) die();
class PGTStorageFile extends PGTStorage
{
/**
* @addtogroup internalPGTStorageFile
* @{
*/
/**
* a string telling where PGT's should be stored on the filesystem. Written by
* PGTStorageFile::PGTStorageFile(), read by getPath().
*
* @private
*/
var $_path;
/**
* This method returns the name of the directory where PGT's should be stored
* on the filesystem.
*
* @return the name of a directory (with leading and trailing '/')
*
* @private
*/
function getPath()
{
return $this->_path;
}
/**
* a string telling the format to use to store PGT's (plain or xml). Written by
* PGTStorageFile::PGTStorageFile(), read by getFormat().
*
* @private
*/
var $_format;
/**
* This method returns the format to use when storing PGT's on the filesystem.
*
* @return a string corresponding to the format used (plain or xml).
*
* @private
*/
function getFormat()
{
return $this->_format;
}
// ########################################################################
// DEBUGGING
// ########################################################################
/**
* This method returns an informational string giving the type of storage
* used by the object (used for debugging purposes).
*
* @return an informational string.
* @public
*/
function getStorageType()
{
return "file";
}
/**
* This method returns an informational string giving informations on the
* parameters of the storage.(used for debugging purposes).
*
* @return an informational string.
* @public
*/
function getStorageInfo()
{
return 'path=`'.$this->getPath().'\', format=`'.$this->getFormat().'\'';
}
// ########################################################################
// CONSTRUCTOR
// ########################################################################
/**
* The class constructor, called by CASClient::SetPGTStorageFile().
*
* @param $cas_parent the CASClient instance that creates the object.
* @param $format the format used to store the PGT's (`plain' and `xml' allowed).
* @param $path the path where the PGT's should be stored
*
* @public
*/
function PGTStorageFile($cas_parent,$format,$path)
{
phpCAS::traceBegin();
// call the ancestor's constructor
$this->PGTStorage($cas_parent);
if (empty($format) ) $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT;
if (empty($path) ) $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH;
// check that the path is an absolute path
if (getenv("OS")=="Windows_NT"){
if (!preg_match('`^[a-zA-Z]:`', $path)) {
phpCAS::error('an absolute path is needed for PGT storage to file');
}
}
else
{
if ( $path[0] != '/' ) {
phpCAS::error('an absolute path is needed for PGT storage to file');
}
// store the path (with a leading and trailing '/')
$path = preg_replace('|[/]*$|','/',$path);
$path = preg_replace('|^[/]*|','/',$path);
}
$this->_path = $path;
// check the format and store it
switch ($format) {
case CAS_PGT_STORAGE_FILE_FORMAT_PLAIN:
case CAS_PGT_STORAGE_FILE_FORMAT_XML:
$this->_format = $format;
break;
default:
phpCAS::error('unknown PGT file storage format (`'.CAS_PGT_STORAGE_FILE_FORMAT_PLAIN.'\' and `'.CAS_PGT_STORAGE_FILE_FORMAT_XML.'\' allowed)');
}
phpCAS::traceEnd();
}
// ########################################################################
// INITIALIZATION
// ########################################################################
/**
* This method is used to initialize the storage. Halts on error.
*
* @public
*/
function init()
{
phpCAS::traceBegin();
// if the storage has already been initialized, return immediatly
if ( $this->isInitialized() )
return;
// call the ancestor's method (mark as initialized)
parent::init();
phpCAS::traceEnd();
}
// ########################################################################
// PGT I/O
// ########################################################################
/**
* This method returns the filename corresponding to a PGT Iou.
*
* @param $pgt_iou the PGT iou.
*
* @return a filename
* @private
*/
function getPGTIouFilename($pgt_iou)
{
phpCAS::traceBegin();
$filename = $this->getPath().$pgt_iou.'.'.$this->getFormat();
phpCAS::traceEnd($filename);
return $filename;
}
/**
* This method stores a PGT and its corresponding PGT Iou into a file. Echoes a
* warning on error.
*
* @param $pgt the PGT
* @param $pgt_iou the PGT iou
*
* @public
*/
function write($pgt,$pgt_iou)
{
phpCAS::traceBegin();
$fname = $this->getPGTIouFilename($pgt_iou);
if ( $f=fopen($fname,"w") ) {
if ( fputs($f,$pgt) === FALSE ) {
phpCAS::error('could not write PGT to `'.$fname.'\'');
}
fclose($f);
} else {
phpCAS::error('could not open `'.$fname.'\'');
}
phpCAS::traceEnd();
}
/**
* This method reads a PGT corresponding to a PGT Iou and deletes the
* corresponding file.
*
* @param $pgt_iou the PGT iou
*
* @return the corresponding PGT, or FALSE on error
*
* @public
*/
function read($pgt_iou)
{
phpCAS::traceBegin();
$pgt = FALSE;
$fname = $this->getPGTIouFilename($pgt_iou);
if ( !($f=fopen($fname,"r")) ) {
phpCAS::trace('could not open `'.$fname.'\'');
} else {
if ( ($pgt=fgets($f)) === FALSE ) {
phpCAS::trace('could not read PGT from `'.$fname.'\'');
}
fclose($f);
}
// delete the PGT file
@unlink($fname);
phpCAS::traceEnd($pgt);
return $pgt;
}
/** @} */
}
?>
@@ -1,188 +1,188 @@
<?php
/**
* @file CAS/PGTStorage/pgt-main.php
* Basic class for PGT storage
*/
/**
* @class PGTStorage
* The PGTStorage class is a generic class for PGT storage. This class should
* not be instanciated itself but inherited by specific PGT storage classes.
*
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
*
* @ingroup internalPGTStorage
*/
class PGTStorage
{
/**
* @addtogroup internalPGTStorage
* @{
*/
// ########################################################################
// CONSTRUCTOR
// ########################################################################
/**
* The constructor of the class, should be called only by inherited classes.
*
* @param $cas_parent the CASclient instance that creates the current object.
*
* @protected
*/
function PGTStorage($cas_parent)
{
phpCAS::traceBegin();
if ( !$cas_parent->isProxy() ) {
phpCAS::error('defining PGT storage makes no sense when not using a CAS proxy');
}
phpCAS::traceEnd();
}
// ########################################################################
// DEBUGGING
// ########################################################################
/**
* This virtual method returns an informational string giving the type of storage
* used by the object (used for debugging purposes).
*
* @public
*/
function getStorageType()
{
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
}
/**
* This virtual method returns an informational string giving informations on the
* parameters of the storage.(used for debugging purposes).
*
* @public
*/
function getStorageInfo()
{
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
}
// ########################################################################
// ERROR HANDLING
// ########################################################################
/**
* string used to store an error message. Written by PGTStorage::setErrorMessage(),
* read by PGTStorage::getErrorMessage().
*
* @hideinitializer
* @private
* @deprecated not used.
*/
var $_error_message=FALSE;
/**
* This method sets en error message, which can be read later by
* PGTStorage::getErrorMessage().
*
* @param $error_message an error message
*
* @protected
* @deprecated not used.
*/
function setErrorMessage($error_message)
{
$this->_error_message = $error_message;
}
/**
* This method returns an error message set by PGTStorage::setErrorMessage().
*
* @return an error message when set by PGTStorage::setErrorMessage(), FALSE
* otherwise.
*
* @public
* @deprecated not used.
*/
function getErrorMessage()
{
return $this->_error_message;
}
// ########################################################################
// INITIALIZATION
// ########################################################################
/**
* a boolean telling if the storage has already been initialized. Written by
* PGTStorage::init(), read by PGTStorage::isInitialized().
*
* @hideinitializer
* @private
*/
var $_initialized = FALSE;
/**
* This method tells if the storage has already been intialized.
*
* @return a boolean
*
* @protected
*/
function isInitialized()
{
return $this->_initialized;
}
/**
* This virtual method initializes the object.
*
* @protected
*/
function init()
{
$this->_initialized = TRUE;
}
// ########################################################################
// PGT I/O
// ########################################################################
/**
* This virtual method stores a PGT and its corresponding PGT Iuo.
* @note Should never be called.
*
* @param $pgt the PGT
* @param $pgt_iou the PGT iou
*
* @protected
*/
function write($pgt,$pgt_iou)
{
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
}
/**
* This virtual method reads a PGT corresponding to a PGT Iou and deletes
* the corresponding storage entry.
* @note Should never be called.
*
* @param $pgt_iou the PGT iou
*
* @protected
*/
function read($pgt_iou)
{
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
}
/** @} */
}
// include specific PGT storage classes
include_once(dirname(__FILE__).'/pgt-file.php');
include_once(dirname(__FILE__).'/pgt-db.php');
<?php
/**
* @file CAS/PGTStorage/pgt-main.php
* Basic class for PGT storage
*/
/**
* @class PGTStorage
* The PGTStorage class is a generic class for PGT storage. This class should
* not be instanciated itself but inherited by specific PGT storage classes.
*
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
*
* @ingroup internalPGTStorage
*/
class PGTStorage
{
/**
* @addtogroup internalPGTStorage
* @{
*/
// ########################################################################
// CONSTRUCTOR
// ########################################################################
/**
* The constructor of the class, should be called only by inherited classes.
*
* @param $cas_parent the CASclient instance that creates the current object.
*
* @protected
*/
function PGTStorage($cas_parent)
{
phpCAS::traceBegin();
if ( !$cas_parent->isProxy() ) {
phpCAS::error('defining PGT storage makes no sense when not using a CAS proxy');
}
phpCAS::traceEnd();
}
// ########################################################################
// DEBUGGING
// ########################################################################
/**
* This virtual method returns an informational string giving the type of storage
* used by the object (used for debugging purposes).
*
* @public
*/
function getStorageType()
{
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
}
/**
* This virtual method returns an informational string giving informations on the
* parameters of the storage.(used for debugging purposes).
*
* @public
*/
function getStorageInfo()
{
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
}
// ########################################################################
// ERROR HANDLING
// ########################################################################
/**
* string used to store an error message. Written by PGTStorage::setErrorMessage(),
* read by PGTStorage::getErrorMessage().
*
* @hideinitializer
* @private
* @deprecated not used.
*/
var $_error_message=FALSE;
/**
* This method sets en error message, which can be read later by
* PGTStorage::getErrorMessage().
*
* @param $error_message an error message
*
* @protected
* @deprecated not used.
*/
function setErrorMessage($error_message)
{
$this->_error_message = $error_message;
}
/**
* This method returns an error message set by PGTStorage::setErrorMessage().
*
* @return an error message when set by PGTStorage::setErrorMessage(), FALSE
* otherwise.
*
* @public
* @deprecated not used.
*/
function getErrorMessage()
{
return $this->_error_message;
}
// ########################################################################
// INITIALIZATION
// ########################################################################
/**
* a boolean telling if the storage has already been initialized. Written by
* PGTStorage::init(), read by PGTStorage::isInitialized().
*
* @hideinitializer
* @private
*/
var $_initialized = FALSE;
/**
* This method tells if the storage has already been intialized.
*
* @return a boolean
*
* @protected
*/
function isInitialized()
{
return $this->_initialized;
}
/**
* This virtual method initializes the object.
*
* @protected
*/
function init()
{
$this->_initialized = TRUE;
}
// ########################################################################
// PGT I/O
// ########################################################################
/**
* This virtual method stores a PGT and its corresponding PGT Iuo.
* @note Should never be called.
*
* @param $pgt the PGT
* @param $pgt_iou the PGT iou
*
* @protected
*/
function write($pgt,$pgt_iou)
{
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
}
/**
* This virtual method reads a PGT corresponding to a PGT Iou and deletes
* the corresponding storage entry.
* @note Should never be called.
*
* @param $pgt_iou the PGT iou
*
* @protected
*/
function read($pgt_iou)
{
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
}
/** @} */
}
// include specific PGT storage classes
include_once(dirname(__FILE__).'/pgt-file.php');
include_once(dirname(__FILE__).'/pgt-db.php');
?>
File diff suppressed because it is too large Load Diff
@@ -1,277 +1,277 @@
<?php
/**
* @file domxml-php4-php5.php
* Require PHP5, uses built-in DOM extension.
* To be used in PHP4 scripts using DOMXML extension.
* Allows PHP4/DOMXML scripts to run on PHP5/DOM.
* (Requires PHP5/XSL extension for domxml_xslt functions)
*
* Typical use:
* <pre>
* {
* if (version_compare(PHP_VERSION,'5','>='))
* require_once('domxml-php4-to-php5.php');
* }
* </pre>
*
* Version 1.5.5, 2005-01-18, http://alexandre.alapetite.net/doc-alex/domxml-php4-php5/
*
* ------------------------------------------------------------------<br>
* Written by Alexandre Alapetite, http://alexandre.alapetite.net/cv/
*
* Copyright 2004, Licence: Creative Commons "Attribution-ShareAlike 2.0 France" BY-SA (FR),
* http://creativecommons.org/licenses/by-sa/2.0/fr/
* http://alexandre.alapetite.net/divers/apropos/#by-sa
* - Attribution. You must give the original author credit
* - Share Alike. If you alter, transform, or build upon this work,
* you may distribute the resulting work only under a license identical to this one
* - The French law is authoritative
* - Any of these conditions can be waived if you get permission from Alexandre Alapetite
* - Please send to Alexandre Alapetite the modifications you make,
* in order to improve this file for the benefit of everybody
*
* If you want to distribute this code, please do it as a link to:
* http://alexandre.alapetite.net/doc-alex/domxml-php4-php5/
*/
function domxml_new_doc($version) {return new php4DOMDocument('');}
function domxml_open_file($filename) {return new php4DOMDocument($filename);}
function domxml_open_mem($str)
{
$dom=new php4DOMDocument('');
$dom->myDOMNode->loadXML($str);
return $dom;
}
function xpath_eval($xpath_context,$eval_str,$contextnode=null) {return $xpath_context->query($eval_str,$contextnode);}
function xpath_new_context($dom_document) {return new php4DOMXPath($dom_document);}
class php4DOMAttr extends php4DOMNode
{
function php4DOMAttr($aDOMAttr) {$this->myDOMNode=$aDOMAttr;}
function Name() {return $this->myDOMNode->name;}
function Specified() {return $this->myDOMNode->specified;}
function Value() {return $this->myDOMNode->value;}
}
class php4DOMDocument extends php4DOMNode
{
function php4DOMDocument($filename='')
{
$this->myDOMNode=new DOMDocument();
if ($filename!='') $this->myDOMNode->load($filename);
}
function create_attribute($name,$value)
{
$myAttr=$this->myDOMNode->createAttribute($name);
$myAttr->value=$value;
return new php4DOMAttr($myAttr,$this);
}
function create_cdata_section($content) {return new php4DOMNode($this->myDOMNode->createCDATASection($content),$this);}
function create_comment($data) {return new php4DOMNode($this->myDOMNode->createComment($data),$this);}
function create_element($name) {return new php4DOMElement($this->myDOMNode->createElement($name),$this);}
function create_text_node($content) {return new php4DOMNode($this->myDOMNode->createTextNode($content),$this);}
function document_element() {return new php4DOMElement($this->myDOMNode->documentElement,$this);}
function dump_file($filename,$compressionmode=false,$format=false) {return $this->myDOMNode->save($filename);}
function dump_mem($format=false,$encoding=false) {return $this->myDOMNode->saveXML();}
function get_element_by_id($id) {return new php4DOMElement($this->myDOMNode->getElementById($id),$this);}
function get_elements_by_tagname($name)
{
$myDOMNodeList=$this->myDOMNode->getElementsByTagName($name);
$nodeSet=array();
$i=0;
if (isset($myDOMNodeList))
while ($node=$myDOMNodeList->item($i))
{
$nodeSet[]=new php4DOMElement($node,$this);
$i++;
}
return $nodeSet;
}
function html_dump_mem() {return $this->myDOMNode->saveHTML();}
function root() {return new php4DOMElement($this->myDOMNode->documentElement,$this);}
}
class php4DOMElement extends php4DOMNode
{
function get_attribute($name) {return $this->myDOMNode->getAttribute($name);}
function get_elements_by_tagname($name)
{
$myDOMNodeList=$this->myDOMNode->getElementsByTagName($name);
$nodeSet=array();
$i=0;
if (isset($myDOMNodeList))
while ($node=$myDOMNodeList->item($i))
{
$nodeSet[]=new php4DOMElement($node,$this->myOwnerDocument);
$i++;
}
return $nodeSet;
}
function has_attribute($name) {return $this->myDOMNode->hasAttribute($name);}
function remove_attribute($name) {return $this->myDOMNode->removeAttribute($name);}
function set_attribute($name,$value) {return $this->myDOMNode->setAttribute($name,$value);}
function tagname() {return $this->myDOMNode->tagName;}
}
class php4DOMNode
{
var $myDOMNode;
var $myOwnerDocument;
function php4DOMNode($aDomNode,$aOwnerDocument)
{
$this->myDOMNode=$aDomNode;
$this->myOwnerDocument=$aOwnerDocument;
}
function __get($name)
{
if ($name=='type') return $this->myDOMNode->nodeType;
elseif ($name=='tagname') return $this->myDOMNode->tagName;
elseif ($name=='content') return $this->myDOMNode->textContent;
else
{
$myErrors=debug_backtrace();
trigger_error('Undefined property: '.get_class($this).'::$'.$name.' ['.$myErrors[0]['file'].':'.$myErrors[0]['line'].']',E_USER_NOTICE);
return false;
}
}
function append_child($newnode) {return new php4DOMElement($this->myDOMNode->appendChild($newnode->myDOMNode),$this->myOwnerDocument);}
function append_sibling($newnode) {return new php4DOMElement($this->myDOMNode->parentNode->appendChild($newnode->myDOMNode),$this->myOwnerDocument);}
function attributes()
{
$myDOMNodeList=$this->myDOMNode->attributes;
$nodeSet=array();
$i=0;
if (isset($myDOMNodeList))
while ($node=$myDOMNodeList->item($i))
{
$nodeSet[]=new php4DOMAttr($node,$this->myOwnerDocument);
$i++;
}
return $nodeSet;
}
function child_nodes()
{
$myDOMNodeList=$this->myDOMNode->childNodes;
$nodeSet=array();
$i=0;
if (isset($myDOMNodeList))
while ($node=$myDOMNodeList->item($i))
{
$nodeSet[]=new php4DOMElement($node,$this->myOwnerDocument);
$i++;
}
return $nodeSet;
}
function children() {return $this->child_nodes();}
function clone_node($deep=false) {return new php4DOMElement($this->myDOMNode->cloneNode($deep),$this->myOwnerDocument);}
function first_child() {return new php4DOMElement($this->myDOMNode->firstChild,$this->myOwnerDocument);}
function get_content() {return $this->myDOMNode->textContent;}
function has_attributes() {return $this->myDOMNode->hasAttributes();}
function has_child_nodes() {return $this->myDOMNode->hasChildNodes();}
function insert_before($newnode,$refnode) {return new php4DOMElement($this->myDOMNode->insertBefore($newnode->myDOMNode,$refnode->myDOMNode),$this->myOwnerDocument);}
function is_blank_node()
{
$myDOMNodeList=$this->myDOMNode->childNodes;
$i=0;
if (isset($myDOMNodeList))
while ($node=$myDOMNodeList->item($i))
{
if (($node->nodeType==XML_ELEMENT_NODE)||
(($node->nodeType==XML_TEXT_NODE)&&!preg_match('/^([[:cntrl:]]|[[:space:]])*$/',$node->nodeValue)))
return false;
$i++;
}
return true;
}
function last_child() {return new php4DOMElement($this->myDOMNode->lastChild,$this->myOwnerDocument);}
function new_child($name,$content)
{
$mySubNode=$this->myDOMNode->ownerDocument->createElement($name);
$mySubNode->appendChild($this->myDOMNode->ownerDocument->createTextNode($content));
$this->myDOMNode->appendChild($mySubNode);
return new php4DOMElement($mySubNode,$this->myOwnerDocument);
}
function next_sibling() {return new php4DOMElement($this->myDOMNode->nextSibling,$this->myOwnerDocument);}
function node_name() {return $this->myDOMNode->localName;}
function node_type() {return $this->myDOMNode->nodeType;}
function node_value() {return $this->myDOMNode->nodeValue;}
function owner_document() {return $this->myOwnerDocument;}
function parent_node() {return new php4DOMElement($this->myDOMNode->parentNode,$this->myOwnerDocument);}
function prefix() {return $this->myDOMNode->prefix;}
function previous_sibling() {return new php4DOMElement($this->myDOMNode->previousSibling,$this->myOwnerDocument);}
function remove_child($oldchild) {return new php4DOMElement($this->myDOMNode->removeChild($oldchild->myDOMNode),$this->myOwnerDocument);}
function replace_child($oldnode,$newnode) {return new php4DOMElement($this->myDOMNode->replaceChild($oldnode->myDOMNode,$newnode->myDOMNode),$this->myOwnerDocument);}
function set_content($text)
{
if (($this->myDOMNode->hasChildNodes())&&($this->myDOMNode->firstChild->nodeType==XML_TEXT_NODE))
$this->myDOMNode->removeChild($this->myDOMNode->firstChild);
return $this->myDOMNode->appendChild($this->myDOMNode->ownerDocument->createTextNode($text));
}
}
class php4DOMNodelist
{
var $myDOMNodelist;
var $nodeset;
function php4DOMNodelist($aDOMNodelist,$aOwnerDocument)
{
$this->myDOMNodelist=$aDOMNodelist;
$this->nodeset=array();
$i=0;
if (isset($this->myDOMNodelist))
while ($node=$this->myDOMNodelist->item($i))
{
$this->nodeset[]=new php4DOMElement($node,$aOwnerDocument);
$i++;
}
}
}
class php4DOMXPath
{
var $myDOMXPath;
var $myOwnerDocument;
function php4DOMXPath($dom_document)
{
$this->myOwnerDocument=$dom_document;
$this->myDOMXPath=new DOMXPath($dom_document->myDOMNode);
}
function query($eval_str,$contextnode)
{
if (isset($contextnode)) return new php4DOMNodelist($this->myDOMXPath->query($eval_str,$contextnode->myDOMNode),$this->myOwnerDocument);
else return new php4DOMNodelist($this->myDOMXPath->query($eval_str),$this->myOwnerDocument);
}
function xpath_register_ns($prefix,$namespaceURI) {return $this->myDOMXPath->registerNamespace($prefix,$namespaceURI);}
}
if (extension_loaded('xsl'))
{//See also: http://alexandre.alapetite.net/doc-alex/xslt-php4-php5/
function domxml_xslt_stylesheet($xslstring) {return new php4DomXsltStylesheet(DOMDocument::loadXML($xslstring));}
function domxml_xslt_stylesheet_doc($dom_document) {return new php4DomXsltStylesheet($dom_document);}
function domxml_xslt_stylesheet_file($xslfile) {return new php4DomXsltStylesheet(DOMDocument::load($xslfile));}
class php4DomXsltStylesheet
{
var $myxsltProcessor;
function php4DomXsltStylesheet($dom_document)
{
$this->myxsltProcessor=new xsltProcessor();
$this->myxsltProcessor->importStyleSheet($dom_document);
}
function process($dom_document,$xslt_parameters=array(),$param_is_xpath=false)
{
foreach ($xslt_parameters as $param=>$value)
$this->myxsltProcessor->setParameter('',$param,$value);
$myphp4DOMDocument=new php4DOMDocument();
$myphp4DOMDocument->myDOMNode=$this->myxsltProcessor->transformToDoc($dom_document->myDOMNode);
return $myphp4DOMDocument;
}
function result_dump_file($dom_document,$filename)
{
$html=$dom_document->myDOMNode->saveHTML();
file_put_contents($filename,$html);
return $html;
}
function result_dump_mem($dom_document) {return $dom_document->myDOMNode->saveHTML();}
}
}
<?php
/**
* @file domxml-php4-php5.php
* Require PHP5, uses built-in DOM extension.
* To be used in PHP4 scripts using DOMXML extension.
* Allows PHP4/DOMXML scripts to run on PHP5/DOM.
* (Requires PHP5/XSL extension for domxml_xslt functions)
*
* Typical use:
* <pre>
* {
* if (version_compare(PHP_VERSION,'5','>='))
* require_once('domxml-php4-to-php5.php');
* }
* </pre>
*
* Version 1.5.5, 2005-01-18, http://alexandre.alapetite.net/doc-alex/domxml-php4-php5/
*
* ------------------------------------------------------------------<br>
* Written by Alexandre Alapetite, http://alexandre.alapetite.net/cv/
*
* Copyright 2004, Licence: Creative Commons "Attribution-ShareAlike 2.0 France" BY-SA (FR),
* http://creativecommons.org/licenses/by-sa/2.0/fr/
* http://alexandre.alapetite.net/divers/apropos/#by-sa
* - Attribution. You must give the original author credit
* - Share Alike. If you alter, transform, or build upon this work,
* you may distribute the resulting work only under a license identical to this one
* - The French law is authoritative
* - Any of these conditions can be waived if you get permission from Alexandre Alapetite
* - Please send to Alexandre Alapetite the modifications you make,
* in order to improve this file for the benefit of everybody
*
* If you want to distribute this code, please do it as a link to:
* http://alexandre.alapetite.net/doc-alex/domxml-php4-php5/
*/
function domxml_new_doc($version) {return new php4DOMDocument('');}
function domxml_open_file($filename) {return new php4DOMDocument($filename);}
function domxml_open_mem($str)
{
$dom=new php4DOMDocument('');
$dom->myDOMNode->loadXML($str);
return $dom;
}
function xpath_eval($xpath_context,$eval_str,$contextnode=null) {return $xpath_context->query($eval_str,$contextnode);}
function xpath_new_context($dom_document) {return new php4DOMXPath($dom_document);}
class php4DOMAttr extends php4DOMNode
{
function php4DOMAttr($aDOMAttr) {$this->myDOMNode=$aDOMAttr;}
function Name() {return $this->myDOMNode->name;}
function Specified() {return $this->myDOMNode->specified;}
function Value() {return $this->myDOMNode->value;}
}
class php4DOMDocument extends php4DOMNode
{
function php4DOMDocument($filename='')
{
$this->myDOMNode=new DOMDocument();
if ($filename!='') $this->myDOMNode->load($filename);
}
function create_attribute($name,$value)
{
$myAttr=$this->myDOMNode->createAttribute($name);
$myAttr->value=$value;
return new php4DOMAttr($myAttr,$this);
}
function create_cdata_section($content) {return new php4DOMNode($this->myDOMNode->createCDATASection($content),$this);}
function create_comment($data) {return new php4DOMNode($this->myDOMNode->createComment($data),$this);}
function create_element($name) {return new php4DOMElement($this->myDOMNode->createElement($name),$this);}
function create_text_node($content) {return new php4DOMNode($this->myDOMNode->createTextNode($content),$this);}
function document_element() {return new php4DOMElement($this->myDOMNode->documentElement,$this);}
function dump_file($filename,$compressionmode=false,$format=false) {return $this->myDOMNode->save($filename);}
function dump_mem($format=false,$encoding=false) {return $this->myDOMNode->saveXML();}
function get_element_by_id($id) {return new php4DOMElement($this->myDOMNode->getElementById($id),$this);}
function get_elements_by_tagname($name)
{
$myDOMNodeList=$this->myDOMNode->getElementsByTagName($name);
$nodeSet=array();
$i=0;
if (isset($myDOMNodeList))
while ($node=$myDOMNodeList->item($i))
{
$nodeSet[]=new php4DOMElement($node,$this);
$i++;
}
return $nodeSet;
}
function html_dump_mem() {return $this->myDOMNode->saveHTML();}
function root() {return new php4DOMElement($this->myDOMNode->documentElement,$this);}
}
class php4DOMElement extends php4DOMNode
{
function get_attribute($name) {return $this->myDOMNode->getAttribute($name);}
function get_elements_by_tagname($name)
{
$myDOMNodeList=$this->myDOMNode->getElementsByTagName($name);
$nodeSet=array();
$i=0;
if (isset($myDOMNodeList))
while ($node=$myDOMNodeList->item($i))
{
$nodeSet[]=new php4DOMElement($node,$this->myOwnerDocument);
$i++;
}
return $nodeSet;
}
function has_attribute($name) {return $this->myDOMNode->hasAttribute($name);}
function remove_attribute($name) {return $this->myDOMNode->removeAttribute($name);}
function set_attribute($name,$value) {return $this->myDOMNode->setAttribute($name,$value);}
function tagname() {return $this->myDOMNode->tagName;}
}
class php4DOMNode
{
var $myDOMNode;
var $myOwnerDocument;
function php4DOMNode($aDomNode,$aOwnerDocument)
{
$this->myDOMNode=$aDomNode;
$this->myOwnerDocument=$aOwnerDocument;
}
function __get($name)
{
if ($name=='type') return $this->myDOMNode->nodeType;
elseif ($name=='tagname') return $this->myDOMNode->tagName;
elseif ($name=='content') return $this->myDOMNode->textContent;
else
{
$myErrors=debug_backtrace();
trigger_error('Undefined property: '.get_class($this).'::$'.$name.' ['.$myErrors[0]['file'].':'.$myErrors[0]['line'].']',E_USER_NOTICE);
return false;
}
}
function append_child($newnode) {return new php4DOMElement($this->myDOMNode->appendChild($newnode->myDOMNode),$this->myOwnerDocument);}
function append_sibling($newnode) {return new php4DOMElement($this->myDOMNode->parentNode->appendChild($newnode->myDOMNode),$this->myOwnerDocument);}
function attributes()
{
$myDOMNodeList=$this->myDOMNode->attributes;
$nodeSet=array();
$i=0;
if (isset($myDOMNodeList))
while ($node=$myDOMNodeList->item($i))
{
$nodeSet[]=new php4DOMAttr($node,$this->myOwnerDocument);
$i++;
}
return $nodeSet;
}
function child_nodes()
{
$myDOMNodeList=$this->myDOMNode->childNodes;
$nodeSet=array();
$i=0;
if (isset($myDOMNodeList))
while ($node=$myDOMNodeList->item($i))
{
$nodeSet[]=new php4DOMElement($node,$this->myOwnerDocument);
$i++;
}
return $nodeSet;
}
function children() {return $this->child_nodes();}
function clone_node($deep=false) {return new php4DOMElement($this->myDOMNode->cloneNode($deep),$this->myOwnerDocument);}
function first_child() {return new php4DOMElement($this->myDOMNode->firstChild,$this->myOwnerDocument);}
function get_content() {return $this->myDOMNode->textContent;}
function has_attributes() {return $this->myDOMNode->hasAttributes();}
function has_child_nodes() {return $this->myDOMNode->hasChildNodes();}
function insert_before($newnode,$refnode) {return new php4DOMElement($this->myDOMNode->insertBefore($newnode->myDOMNode,$refnode->myDOMNode),$this->myOwnerDocument);}
function is_blank_node()
{
$myDOMNodeList=$this->myDOMNode->childNodes;
$i=0;
if (isset($myDOMNodeList))
while ($node=$myDOMNodeList->item($i))
{
if (($node->nodeType==XML_ELEMENT_NODE)||
(($node->nodeType==XML_TEXT_NODE)&&!preg_match('/^([[:cntrl:]]|[[:space:]])*$/',$node->nodeValue)))
return false;
$i++;
}
return true;
}
function last_child() {return new php4DOMElement($this->myDOMNode->lastChild,$this->myOwnerDocument);}
function new_child($name,$content)
{
$mySubNode=$this->myDOMNode->ownerDocument->createElement($name);
$mySubNode->appendChild($this->myDOMNode->ownerDocument->createTextNode($content));
$this->myDOMNode->appendChild($mySubNode);
return new php4DOMElement($mySubNode,$this->myOwnerDocument);
}
function next_sibling() {return new php4DOMElement($this->myDOMNode->nextSibling,$this->myOwnerDocument);}
function node_name() {return $this->myDOMNode->localName;}
function node_type() {return $this->myDOMNode->nodeType;}
function node_value() {return $this->myDOMNode->nodeValue;}
function owner_document() {return $this->myOwnerDocument;}
function parent_node() {return new php4DOMElement($this->myDOMNode->parentNode,$this->myOwnerDocument);}
function prefix() {return $this->myDOMNode->prefix;}
function previous_sibling() {return new php4DOMElement($this->myDOMNode->previousSibling,$this->myOwnerDocument);}
function remove_child($oldchild) {return new php4DOMElement($this->myDOMNode->removeChild($oldchild->myDOMNode),$this->myOwnerDocument);}
function replace_child($oldnode,$newnode) {return new php4DOMElement($this->myDOMNode->replaceChild($oldnode->myDOMNode,$newnode->myDOMNode),$this->myOwnerDocument);}
function set_content($text)
{
if (($this->myDOMNode->hasChildNodes())&&($this->myDOMNode->firstChild->nodeType==XML_TEXT_NODE))
$this->myDOMNode->removeChild($this->myDOMNode->firstChild);
return $this->myDOMNode->appendChild($this->myDOMNode->ownerDocument->createTextNode($text));
}
}
class php4DOMNodelist
{
var $myDOMNodelist;
var $nodeset;
function php4DOMNodelist($aDOMNodelist,$aOwnerDocument)
{
$this->myDOMNodelist=$aDOMNodelist;
$this->nodeset=array();
$i=0;
if (isset($this->myDOMNodelist))
while ($node=$this->myDOMNodelist->item($i))
{
$this->nodeset[]=new php4DOMElement($node,$aOwnerDocument);
$i++;
}
}
}
class php4DOMXPath
{
var $myDOMXPath;
var $myOwnerDocument;
function php4DOMXPath($dom_document)
{
$this->myOwnerDocument=$dom_document;
$this->myDOMXPath=new DOMXPath($dom_document->myDOMNode);
}
function query($eval_str,$contextnode)
{
if (isset($contextnode)) return new php4DOMNodelist($this->myDOMXPath->query($eval_str,$contextnode->myDOMNode),$this->myOwnerDocument);
else return new php4DOMNodelist($this->myDOMXPath->query($eval_str),$this->myOwnerDocument);
}
function xpath_register_ns($prefix,$namespaceURI) {return $this->myDOMXPath->registerNamespace($prefix,$namespaceURI);}
}
if (extension_loaded('xsl'))
{//See also: http://alexandre.alapetite.net/doc-alex/xslt-php4-php5/
function domxml_xslt_stylesheet($xslstring) {return new php4DomXsltStylesheet(DOMDocument::loadXML($xslstring));}
function domxml_xslt_stylesheet_doc($dom_document) {return new php4DomXsltStylesheet($dom_document);}
function domxml_xslt_stylesheet_file($xslfile) {return new php4DomXsltStylesheet(DOMDocument::load($xslfile));}
class php4DomXsltStylesheet
{
var $myxsltProcessor;
function php4DomXsltStylesheet($dom_document)
{
$this->myxsltProcessor=new xsltProcessor();
$this->myxsltProcessor->importStyleSheet($dom_document);
}
function process($dom_document,$xslt_parameters=array(),$param_is_xpath=false)
{
foreach ($xslt_parameters as $param=>$value)
$this->myxsltProcessor->setParameter('',$param,$value);
$myphp4DOMDocument=new php4DOMDocument();
$myphp4DOMDocument->myDOMNode=$this->myxsltProcessor->transformToDoc($dom_document->myDOMNode);
return $myphp4DOMDocument;
}
function result_dump_file($dom_document,$filename)
{
$html=$dom_document->myDOMNode->saveHTML();
file_put_contents($filename,$html);
return $html;
}
function result_dump_mem($dom_document) {return $dom_document->myDOMNode->saveHTML();}
}
}
?>
@@ -1,28 +1,28 @@
<?php
if (!defined('PHPCAS_VERSION')) die();
/**
* @file languages/spanish.php
* @author Iván-Benjamín García Torà <ivaniclixx AT gmail DOT com
* @sa @link internalLang Internationalization @endlink
* @ingroup internalLang
*/
$this->_strings = array(
CAS_STR_USING_SERVER
=> 'usant servidor',
CAS_STR_AUTHENTICATION_WANTED
=> 'Autentificació CAS necessària!',
CAS_STR_LOGOUT
=> 'Sortida de CAS necessària!',
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
=> 'Ja hauria d\ haver estat redireccionat al servidor CAS. Feu click <a href="%s">aquí</a> per a continuar.',
CAS_STR_AUTHENTICATION_FAILED
=> 'Autentificació CAS fallida!',
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
=> '<p>No estàs autentificat.</p><p>Pots tornar a intentar-ho fent click <a href="%s">aquí</a>.</p><p>Si el problema persisteix hauría de contactar amb l\'<a href="mailto:%s">administrador d\'aquest llocc</a>.</p>',
CAS_STR_SERVICE_UNAVAILABLE
=> 'El servei `<b>%s</b>\' no està disponible (<b>%s</b>).'
);
?>
<?php
if (!defined('PHPCAS_VERSION')) die();
/**
* @file languages/spanish.php
* @author Iván-Benjamín García Torà <ivaniclixx AT gmail DOT com
* @sa @link internalLang Internationalization @endlink
* @ingroup internalLang
*/
$this->_strings = array(
CAS_STR_USING_SERVER
=> 'usant servidor',
CAS_STR_AUTHENTICATION_WANTED
=> 'Autentificació CAS necessària!',
CAS_STR_LOGOUT
=> 'Sortida de CAS necessària!',
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
=> 'Ja hauria d\ haver estat redireccionat al servidor CAS. Feu click <a href="%s">aquí</a> per a continuar.',
CAS_STR_AUTHENTICATION_FAILED
=> 'Autentificació CAS fallida!',
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
=> '<p>No estàs autentificat.</p><p>Pots tornar a intentar-ho fent click <a href="%s">aquí</a>.</p><p>Si el problema persisteix hauría de contactar amb l\'<a href="mailto:%s">administrador d\'aquest llocc</a>.</p>',
CAS_STR_SERVICE_UNAVAILABLE
=> 'El servei `<b>%s</b>\' no està disponible (<b>%s</b>).'
);
?>
@@ -1,28 +1,28 @@
<?php
if (!defined('PHPCAS_VERSION')) die();
/**
* @file languages/english.php
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
* @sa @link internalLang Internationalization @endlink
* @ingroup internalLang
*/
$this->_strings = array(
CAS_STR_USING_SERVER
=> 'using server',
CAS_STR_AUTHENTICATION_WANTED
=> 'CAS Authentication wanted!',
CAS_STR_LOGOUT
=> 'CAS logout wanted!',
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
=> 'You should already have been redirected to the CAS server. Click <a href="%s">here</a> to continue.',
CAS_STR_AUTHENTICATION_FAILED
=> 'CAS Authentication failed!',
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
=> '<p>You were not authenticated.</p><p>You may submit your request again by clicking <a href="%s">here</a>.</p><p>If the problem persists, you may contact <a href="mailto:%s">the administrator of this site</a>.</p>',
CAS_STR_SERVICE_UNAVAILABLE
=> 'The service `<b>%s</b>\' is not available (<b>%s</b>).'
);
<?php
if (!defined('PHPCAS_VERSION')) die();
/**
* @file languages/english.php
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
* @sa @link internalLang Internationalization @endlink
* @ingroup internalLang
*/
$this->_strings = array(
CAS_STR_USING_SERVER
=> 'using server',
CAS_STR_AUTHENTICATION_WANTED
=> 'CAS Authentication wanted!',
CAS_STR_LOGOUT
=> 'CAS logout wanted!',
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
=> 'You should already have been redirected to the CAS server. Click <a href="%s">here</a> to continue.',
CAS_STR_AUTHENTICATION_FAILED
=> 'CAS Authentication failed!',
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
=> '<p>You were not authenticated.</p><p>You may submit your request again by clicking <a href="%s">here</a>.</p><p>If the problem persists, you may contact <a href="mailto:%s">the administrator of this site</a>.</p>',
CAS_STR_SERVICE_UNAVAILABLE
=> 'The service `<b>%s</b>\' is not available (<b>%s</b>).'
);
?>
@@ -1,29 +1,29 @@
<?php
if (!defined('PHPCAS_VERSION')) die();
/**
* @file languages/english.php
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
* @sa @link internalLang Internationalization @endlink
* @ingroup internalLang
*/
$this->_strings = array(
CAS_STR_USING_SERVER
=> 'utilisant le serveur',
CAS_STR_AUTHENTICATION_WANTED
=> 'Authentication CAS ncessaire&nbsp;!',
CAS_STR_LOGOUT
=> 'Dconnexion demande&nbsp;!',
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
=> 'Vous auriez du etre redirig(e) vers le serveur CAS. Cliquez <a href="%s">ici</a> pour continuer.',
CAS_STR_AUTHENTICATION_FAILED
=> 'Authentification CAS infructueuse&nbsp;!',
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
=> '<p>Vous n\'avez pas t authentifi(e).</p><p>Vous pouvez soumettre votre requete nouveau en cliquant <a href="%s">ici</a>.</p><p>Si le problme persiste, vous pouvez contacter <a href="mailto:%s">l\'administrateur de ce site</a>.</p>',
CAS_STR_SERVICE_UNAVAILABLE
=> 'Le service `<b>%s</b>\' est indisponible (<b>%s</b>)'
);
<?php
if (!defined('PHPCAS_VERSION')) die();
/**
* @file languages/english.php
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
* @sa @link internalLang Internationalization @endlink
* @ingroup internalLang
*/
$this->_strings = array(
CAS_STR_USING_SERVER
=> 'utilisant le serveur',
CAS_STR_AUTHENTICATION_WANTED
=> 'Authentication CAS ncessaire&nbsp;!',
CAS_STR_LOGOUT
=> 'Dconnexion demande&nbsp;!',
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
=> 'Vous auriez du etre redirig(e) vers le serveur CAS. Cliquez <a href="%s">ici</a> pour continuer.',
CAS_STR_AUTHENTICATION_FAILED
=> 'Authentification CAS infructueuse&nbsp;!',
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
=> '<p>Vous n\'avez pas t authentifi(e).</p><p>Vous pouvez soumettre votre requete nouveau en cliquant <a href="%s">ici</a>.</p><p>Si le problme persiste, vous pouvez contacter <a href="mailto:%s">l\'administrateur de ce site</a>.</p>',
CAS_STR_SERVICE_UNAVAILABLE
=> 'Le service `<b>%s</b>\' est indisponible (<b>%s</b>)'
);
?>
@@ -1,28 +1,28 @@
<?php
if (!defined('PHPCAS_VERSION')) die();
/**
* @file languages/german.php
* @author Henrik Genssen <hg at mediafactory.de>
* @sa @link internalLang Internationalization @endlink
* @ingroup internalLang
*/
$this->_strings = array(
CAS_STR_USING_SERVER
=> 'via Server',
CAS_STR_AUTHENTICATION_WANTED
=> 'CAS Authentifizierung erforderlich!',
CAS_STR_LOGOUT
=> 'CAS Abmeldung!',
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
=> 'eigentlich h&auml;ten Sie zum CAS Server weitergeleitet werden sollen. Dr&uuml;cken Sie <a href="%s">hier</a> um fortzufahren.',
CAS_STR_AUTHENTICATION_FAILED
=> 'CAS Anmeldung fehlgeschlagen!',
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
=> '<p>Sie wurden nicht angemeldet.</p><p>Um es erneut zu versuchen klicken Sie <a href="%s">hier</a>.</p><p>Wenn das Problem bestehen bleibt, kontkatieren Sie den <a href="mailto:%s">Administrator</a> dieser Seite.</p>',
CAS_STR_SERVICE_UNAVAILABLE
=> 'Der Dienst `<b>%s</b>\' ist nicht verf&uuml;gbar (<b>%s</b>).'
);
<?php
if (!defined('PHPCAS_VERSION')) die();
/**
* @file languages/german.php
* @author Henrik Genssen <hg at mediafactory.de>
* @sa @link internalLang Internationalization @endlink
* @ingroup internalLang
*/
$this->_strings = array(
CAS_STR_USING_SERVER
=> 'via Server',
CAS_STR_AUTHENTICATION_WANTED
=> 'CAS Authentifizierung erforderlich!',
CAS_STR_LOGOUT
=> 'CAS Abmeldung!',
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
=> 'eigentlich h&auml;ten Sie zum CAS Server weitergeleitet werden sollen. Dr&uuml;cken Sie <a href="%s">hier</a> um fortzufahren.',
CAS_STR_AUTHENTICATION_FAILED
=> 'CAS Anmeldung fehlgeschlagen!',
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
=> '<p>Sie wurden nicht angemeldet.</p><p>Um es erneut zu versuchen klicken Sie <a href="%s">hier</a>.</p><p>Wenn das Problem bestehen bleibt, kontkatieren Sie den <a href="mailto:%s">Administrator</a> dieser Seite.</p>',
CAS_STR_SERVICE_UNAVAILABLE
=> 'Der Dienst `<b>%s</b>\' ist nicht verf&uuml;gbar (<b>%s</b>).'
);
?>
@@ -1,28 +1,28 @@
<?php
if (!defined('PHPCAS_VERSION')) die();
/**
* @file languages/greek.php
* @author Vangelis Haniotakis <haniotak at ucnet.uoc.gr>
* @sa @link internalLang Internationalization @endlink
* @ingroup internalLang
*/
$this->_strings = array(
CAS_STR_USING_SERVER
=> ' ',
CAS_STR_AUTHENTICATION_WANTED
=> ' CAS!',
CAS_STR_LOGOUT
=> ' CAS!',
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
=> ' CAS. <a href="%s"></a> .',
CAS_STR_AUTHENTICATION_FAILED
=> ' CAS !',
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
=> '<p> .</p><p> , <a href="%s"></a>.</p><p> , <a href="mailto:%s"></a>.</p>',
CAS_STR_SERVICE_UNAVAILABLE
=> ' `<b>%s</b>\' (<b>%s</b>).'
);
<?php
if (!defined('PHPCAS_VERSION')) die();
/**
* @file languages/greek.php
* @author Vangelis Haniotakis <haniotak at ucnet.uoc.gr>
* @sa @link internalLang Internationalization @endlink
* @ingroup internalLang
*/
$this->_strings = array(
CAS_STR_USING_SERVER
=> ' ',
CAS_STR_AUTHENTICATION_WANTED
=> ' CAS!',
CAS_STR_LOGOUT
=> ' CAS!',
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
=> ' CAS. <a href="%s"></a> .',
CAS_STR_AUTHENTICATION_FAILED
=> ' CAS !',
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
=> '<p> .</p><p> , <a href="%s"></a>.</p><p> , <a href="mailto:%s"></a>.</p>',
CAS_STR_SERVICE_UNAVAILABLE
=> ' `<b>%s</b>\' (<b>%s</b>).'
);
?>
@@ -1,24 +1,24 @@
<?php
/**
* @file languages/languages.php
* Internationalization constants
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
* @sa @link internalLang Internationalization @endlink
* @ingroup internalLang
*/
//@{
/**
* a phpCAS string index
*/
define("CAS_STR_USING_SERVER", 1);
define("CAS_STR_AUTHENTICATION_WANTED", 2);
define("CAS_STR_LOGOUT", 3);
define("CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED", 4);
define("CAS_STR_AUTHENTICATION_FAILED", 5);
define("CAS_STR_YOU_WERE_NOT_AUTHENTICATED", 6);
define("CAS_STR_SERVICE_UNAVAILABLE", 7);
//@}
<?php
/**
* @file languages/languages.php
* Internationalization constants
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
* @sa @link internalLang Internationalization @endlink
* @ingroup internalLang
*/
//@{
/**
* a phpCAS string index
*/
define("CAS_STR_USING_SERVER", 1);
define("CAS_STR_AUTHENTICATION_WANTED", 2);
define("CAS_STR_LOGOUT", 3);
define("CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED", 4);
define("CAS_STR_AUTHENTICATION_FAILED", 5);
define("CAS_STR_YOU_WERE_NOT_AUTHENTICATED", 6);
define("CAS_STR_SERVICE_UNAVAILABLE", 7);
//@}
?>
@@ -1,28 +1,28 @@
<?php
if (!defined('PHPCAS_VERSION')) die();
/**
* @file languages/spanish.php
* @author Iván-Benjamín García Torà <ivaniclixx AT gmail DOT com
* @sa @link internalLang Internationalization @endlink
* @ingroup internalLang
*/
$this->_strings = array(
CAS_STR_USING_SERVER
=> 'usando servidor',
CAS_STR_AUTHENTICATION_WANTED
=> '¡Autentificación CAS necesaria!',
CAS_STR_LOGOUT
=> '¡Salida CAS necesaria!',
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
=> 'Ya debería haber sido redireccionado al servidor CAS. Haga click <a href="%s">aquí</a> para continuar.',
CAS_STR_AUTHENTICATION_FAILED
=> '¡Autentificación CAS fallida!',
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
=> '<p>No estás autentificado.</p><p>Puedes volver a intentarlo haciendo click <a href="%s">aquí</a>.</p><p>Si el problema persiste debería contactar con el <a href="mailto:%s">administrador de este sitio</a>.</p>',
CAS_STR_SERVICE_UNAVAILABLE
=> 'El servicio `<b>%s</b>\' no está disponible (<b>%s</b>).'
);
?>
<?php
if (!defined('PHPCAS_VERSION')) die();
/**
* @file languages/spanish.php
* @author Iván-Benjamín García Torà <ivaniclixx AT gmail DOT com
* @sa @link internalLang Internationalization @endlink
* @ingroup internalLang
*/
$this->_strings = array(
CAS_STR_USING_SERVER
=> 'usando servidor',
CAS_STR_AUTHENTICATION_WANTED
=> '¡Autentificación CAS necesaria!',
CAS_STR_LOGOUT
=> '¡Salida CAS necesaria!',
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
=> 'Ya debería haber sido redireccionado al servidor CAS. Haga click <a href="%s">aquí</a> para continuar.',
CAS_STR_AUTHENTICATION_FAILED
=> '¡Autentificación CAS fallida!',
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
=> '<p>No estás autentificado.</p><p>Puedes volver a intentarlo haciendo click <a href="%s">aquí</a>.</p><p>Si el problema persiste debería contactar con el <a href="mailto:%s">administrador de este sitio</a>.</p>',
CAS_STR_SERVICE_UNAVAILABLE
=> 'El servicio `<b>%s</b>\' no está disponible (<b>%s</b>).'
);
?>
File diff suppressed because it is too large Load Diff
+122 -122
View File
@@ -1,122 +1,122 @@
Sentences that contain all letters commonly used in a language
--------------------------------------------------------------
Markus Kuhn <http://www.cl.cam.ac.uk/~mgk25/> -- 2001-09-02
This file is UTF-8 encoded.
Danish (da)
---------
Quizdeltagerne spiste jordbær med fløde, mens cirkusklovnen
Wolther spillede på xylofon.
(= Quiz contestants were eating strawbery with cream while Wolther
the circus clown played on xylophone.)
German (de)
-----------
Falsches Üben von Xylophonmusik quält jeden größeren Zwerg
(= Wrongful practicing of xylophone music tortures every larger dwarf)
Zwölf Boxkämpfer jagten Eva quer über den Sylter Deich
(= Twelve boxing fighters hunted Eva across the dike of Sylt)
Heizölrückstoßabdämpfung
(= fuel oil recoil absorber)
(jqvwxy missing, but all non-ASCII letters in one word)
English (en)
------------
The quick brown fox jumps over the lazy dog
Spanish (es)
------------
El pingüino Wenceslao hizo kilómetros bajo exhaustiva lluvia y
frío, añoraba a su querido cachorro.
(Contains every letter and every accent, but not every combination
of vowel + acute.)
French (fr)
-----------
Portez ce vieux whisky au juge blond qui fume sur son île intérieure, à
côté de l'alcôve ovoïde, où les bûches se consument dans l'âtre, ce
qui lui permet de penser à la cænogenèse de l'être dont il est question
dans la cause ambiguë entendue à Moÿ, dans un capharnaüm qui,
pense-t-il, diminue çà et là la qualité de son œuvre.
l'île exiguë
Où l'obèse jury mûr
Fête l'haï volapük,
Âne ex aéquo au whist,
Ôtez ce vœu déçu.
Le cœur déçu mais l'âme plutôt naïve, Louÿs rêva de crapaüter en
canoë au delà des îles, près du mälström où brûlent les novæ.
Irish Gaelic (ga)
-----------------
D'fhuascail Íosa, Úrmhac na hÓighe Beannaithe, pór Éava agus Ádhaimh
Hungarian (hu)
--------------
Árvíztűrő tükörfúrógép
(= flood-proof mirror-drilling machine, only all non-ASCII letters)
Icelandic (is)
--------------
Kæmi ný öxi hér ykist þjófum nú bæði víl og ádrepa
Sævör grét áðan því úlpan var ónýt
(some ASCII letters missing)
Greek (el)
-------------
Γαζέες καὶ μυρτιὲς δὲν θὰ βρῶ πιὰ στὸ χρυσαφὶ ξέφωτο
(= No more shall I see acacias or myrtles in the golden clearing)
Ξεσκεπάζω τὴν ψυχοφθόρα βδελυγμία
(= I uncover the soul-destroying abhorrence)
Hebrew (iw)
-----------
? דג סקרן שט בים מאוכזב ולפתע מצא לו חברה איך הקליטה
Polish (pl)
-----------
Pchnąć w tę łódź jeża lub osiem skrzyń fig
(= To push a hedgehog or eight bins of figs in this boat)
Zażółć gęślą jaźń
Russian (ru)
------------
В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!
(= Would a citrus live in the bushes of south? Yes, but only a fake one!)
Thai (th)
---------
[--------------------------|------------------------]
๏ เป็นมนุษย์สุดประเสริฐเลิศคุณค่า กว่าบรรดาฝูงสัตว์เดรัจฉาน
จงฝ่าฟันพัฒนาวิชาการ อย่าล้างผลาญฤๅเข่นฆ่าบีฑาใคร
ไม่ถือโทษโกรธแช่งซัดฮึดฮัดด่า หัดอภัยเหมือนกีฬาอัชฌาสัย
ปฏิบัติประพฤติกฎกำหนดใจ พูดจาให้จ๊ะๆ จ๋าๆ น่าฟังเอย ฯ
[The copyright for the Thai example is owned by The Computer
Association of Thailand under the Royal Patronage of His Majesty the
King.]
Please let me know if you find others! Special thanks to the people
from all over the world who contributed these sentences.
Sentences that contain all letters commonly used in a language
--------------------------------------------------------------
Markus Kuhn <http://www.cl.cam.ac.uk/~mgk25/> -- 2001-09-02
This file is UTF-8 encoded.
Danish (da)
---------
Quizdeltagerne spiste jordbær med fløde, mens cirkusklovnen
Wolther spillede på xylofon.
(= Quiz contestants were eating strawbery with cream while Wolther
the circus clown played on xylophone.)
German (de)
-----------
Falsches Üben von Xylophonmusik quält jeden größeren Zwerg
(= Wrongful practicing of xylophone music tortures every larger dwarf)
Zwölf Boxkämpfer jagten Eva quer über den Sylter Deich
(= Twelve boxing fighters hunted Eva across the dike of Sylt)
Heizölrückstoßabdämpfung
(= fuel oil recoil absorber)
(jqvwxy missing, but all non-ASCII letters in one word)
English (en)
------------
The quick brown fox jumps over the lazy dog
Spanish (es)
------------
El pingüino Wenceslao hizo kilómetros bajo exhaustiva lluvia y
frío, añoraba a su querido cachorro.
(Contains every letter and every accent, but not every combination
of vowel + acute.)
French (fr)
-----------
Portez ce vieux whisky au juge blond qui fume sur son île intérieure, à
côté de l'alcôve ovoïde, où les bûches se consument dans l'âtre, ce
qui lui permet de penser à la cænogenèse de l'être dont il est question
dans la cause ambiguë entendue à Moÿ, dans un capharnaüm qui,
pense-t-il, diminue çà et là la qualité de son œuvre.
l'île exiguë
Où l'obèse jury mûr
Fête l'haï volapük,
Âne ex aéquo au whist,
Ôtez ce vœu déçu.
Le cœur déçu mais l'âme plutôt naïve, Louÿs rêva de crapaüter en
canoë au delà des îles, près du mälström où brûlent les novæ.
Irish Gaelic (ga)
-----------------
D'fhuascail Íosa, Úrmhac na hÓighe Beannaithe, pór Éava agus Ádhaimh
Hungarian (hu)
--------------
Árvíztűrő tükörfúrógép
(= flood-proof mirror-drilling machine, only all non-ASCII letters)
Icelandic (is)
--------------
Kæmi ný öxi hér ykist þjófum nú bæði víl og ádrepa
Sævör grét áðan því úlpan var ónýt
(some ASCII letters missing)
Greek (el)
-------------
Γαζέες καὶ μυρτιὲς δὲν θὰ βρῶ πιὰ στὸ χρυσαφὶ ξέφωτο
(= No more shall I see acacias or myrtles in the golden clearing)
Ξεσκεπάζω τὴν ψυχοφθόρα βδελυγμία
(= I uncover the soul-destroying abhorrence)
Hebrew (iw)
-----------
? דג סקרן שט בים מאוכזב ולפתע מצא לו חברה איך הקליטה
Polish (pl)
-----------
Pchnąć w tę łódź jeża lub osiem skrzyń fig
(= To push a hedgehog or eight bins of figs in this boat)
Zażółć gęślą jaźń
Russian (ru)
------------
В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!
(= Would a citrus live in the bushes of south? Yes, but only a fake one!)
Thai (th)
---------
[--------------------------|------------------------]
๏ เป็นมนุษย์สุดประเสริฐเลิศคุณค่า กว่าบรรดาฝูงสัตว์เดรัจฉาน
จงฝ่าฟันพัฒนาวิชาการ อย่าล้างผลาญฤๅเข่นฆ่าบีฑาใคร
ไม่ถือโทษโกรธแช่งซัดฮึดฮัดด่า หัดอภัยเหมือนกีฬาอัชฌาสัย
ปฏิบัติประพฤติกฎกำหนดใจ พูดจาให้จ๊ะๆ จ๋าๆ น่าฟังเอย ฯ
[The copyright for the Thai example is owned by The Computer
Association of Thailand under the Royal Patronage of His Majesty the
King.]
Please let me know if you find others! Special thanks to the people
from all over the world who contributed these sentences.
@@ -1,108 +1,108 @@
<?php
require_once('tcpdf.php');
class PDF extends TCPDF
{
function PDF($orientation='L', $unit='mm', $format='A4')
{
parent::__construct($orientation,$unit,$format);
$this->SetAutoPageBreak(true,10);
$this->AliasNbPages();
}
function intopdf($text,$format='',$bStripHTML=true)
{
if ($bStripHTML)
{
$text = $this->delete_html($text);
}
$oldformat = $this->FontStyle;
$this->SetFont('',$format,$this->FontSizePt);
$this->Write(5,$text);
$this->ln(5);
$this->SetFont('',$oldformat,$this->FontSizePt);
}
function helptextintopdf($text)
{
$oldsize = $this->FontSizePt;
$this->SetFontSize($oldsize-2);
$this->Write(5,$this->delete_html($text));
$this->ln(5);
$this->SetFontSize($oldsize);
}
function titleintopdf($title,$description='')
{
if(!empty($title))
{
$title = $this->delete_html($title);
$oldsize = $this->FontSizePt;
$this->SetFontSize($oldsize+4);
$this->Line(5,$this->y,($this->w-5),$this->y);
$this->ln(3);
$this->MultiCell('','',$title,'','C',0);
if(!empty($description) && isset($description))
{
$description = $this->delete_html($description);
$this->ln(7);
$this->SetFontSize($oldsize+2);
$this->MultiCell('','',$description,'','C',0);
$this->ln(2);
}
else
{
$this->ln(4);
}
$this->Line(5,$this->y,($this->w-5),$this->y);
$this->ln(5);
$this->SetFontSize($oldsize);
}
}
function tableintopdf($array)
{
$maxwidth = array();
$maxwidth = $this->getmaxwidth($array);
for($a=0;$a<sizeof($array);$a++)
{
for($b=0;$b<sizeof($array[$a]);$b++)
{
$this->Cell($maxwidth[$b]*($this->FontSize),4,$this->delete_html($array[$a][$b]),0,0,'C');
}
$this->ln();
}
$this->ln(5);
}
function getmaxwidth($array)
{
for($i=0;$i<sizeof($array);$i++)
{
for($j=0;$j<sizeof($array[$i]);$j++)
{
if(($i-1)>=0)
{
if(strlen($array[($i-1)][$j]) < strlen($array[$i][$j]))
{
$width[$j] = strlen($array[$i][$j]);
}
}
else
{
$width[$j]=strlen($array[$i][$j]);
}
}
}
return ($width);
}
function write_out($name)
{
$this->Output($name,"D");
}
function delete_html($text)
{
$text = html_entity_decode($text);
return strip_tags($text);
}
}
<?php
require_once('tcpdf.php');
class PDF extends TCPDF
{
function PDF($orientation='L', $unit='mm', $format='A4')
{
parent::__construct($orientation,$unit,$format);
$this->SetAutoPageBreak(true,10);
$this->AliasNbPages();
}
function intopdf($text,$format='',$bStripHTML=true)
{
if ($bStripHTML)
{
$text = $this->delete_html($text);
}
$oldformat = $this->FontStyle;
$this->SetFont('',$format,$this->FontSizePt);
$this->Write(5,$text);
$this->ln(5);
$this->SetFont('',$oldformat,$this->FontSizePt);
}
function helptextintopdf($text)
{
$oldsize = $this->FontSizePt;
$this->SetFontSize($oldsize-2);
$this->Write(5,$this->delete_html($text));
$this->ln(5);
$this->SetFontSize($oldsize);
}
function titleintopdf($title,$description='')
{
if(!empty($title))
{
$title = $this->delete_html($title);
$oldsize = $this->FontSizePt;
$this->SetFontSize($oldsize+4);
$this->Line(5,$this->y,($this->w-5),$this->y);
$this->ln(3);
$this->MultiCell('','',$title,'','C',0);
if(!empty($description) && isset($description))
{
$description = $this->delete_html($description);
$this->ln(7);
$this->SetFontSize($oldsize+2);
$this->MultiCell('','',$description,'','C',0);
$this->ln(2);
}
else
{
$this->ln(4);
}
$this->Line(5,$this->y,($this->w-5),$this->y);
$this->ln(5);
$this->SetFontSize($oldsize);
}
}
function tableintopdf($array)
{
$maxwidth = array();
$maxwidth = $this->getmaxwidth($array);
for($a=0;$a<sizeof($array);$a++)
{
for($b=0;$b<sizeof($array[$a]);$b++)
{
$this->Cell($maxwidth[$b]*($this->FontSize),4,$this->delete_html($array[$a][$b]),0,0,'C');
}
$this->ln();
}
$this->ln(5);
}
function getmaxwidth($array)
{
for($i=0;$i<sizeof($array);$i++)
{
for($j=0;$j<sizeof($array[$i]);$j++)
{
if(($i-1)>=0)
{
if(strlen($array[($i-1)][$j]) < strlen($array[$i][$j]))
{
$width[$j] = strlen($array[$i][$j]);
}
}
else
{
$width[$j]=strlen($array[$i][$j]);
}
}
}
return ($width);
}
function write_out($name)
{
$this->Output($name,"D");
}
function delete_html($text)
{
$text = html_entity_decode($text);
return strip_tags($text);
}
}
?>
@@ -1,102 +1,102 @@
<?php
$type='TrueTypeUnicode';
$name='AlMohanad';
$desc=array('Ascent'=>1093,'Descent'=>-509,'CapHeight'=>1093,'Flags'=>32,'FontBBox'=>'[-278 -507 1124 1093]','ItalicAngle'=>0,'StemV'=>70,'MissingWidth'=>600);
$up=-136;
$ut=64;
$dw=600;
$cw=array(
0=>0,32=>139,33=>185,34=>308,35=>278,36=>278,37=>556,38=>463,39=>154,40=>185,41=>185,42=>278,43=>317,44=>139,45=>185,46=>139,
47=>154,48=>278,49=>278,50=>278,51=>278,52=>278,53=>278,54=>278,55=>278,56=>278,57=>278,58=>185,59=>185,60=>317,61=>317,62=>317,
63=>278,64=>517,65=>401,66=>371,67=>401,68=>402,69=>371,70=>339,71=>432,72=>430,73=>214,74=>278,75=>424,76=>369,77=>524,78=>401,
79=>432,80=>339,81=>432,82=>396,83=>309,84=>371,85=>401,86=>401,87=>556,88=>401,89=>401,90=>371,91=>185,92=>154,93=>185,94=>323,
95=>278,96=>185,97=>278,98=>309,99=>247,100=>309,101=>247,102=>185,103=>278,104=>309,105=>154,106=>185,107=>309,108=>154,109=>463,110=>309,
111=>278,112=>309,113=>309,114=>247,115=>216,116=>185,117=>309,118=>278,119=>401,120=>278,121=>278,122=>247,123=>219,124=>122,125=>219,126=>289,
8364=>278,1027=>339,8218=>185,1107=>254,8222=>278,8230=>556,8224=>278,8225=>278,710=>185,8240=>556,352=>309,8249=>185,338=>556,1036=>432,381=>371,1039=>432,
8216=>185,8217=>185,8220=>278,8221=>278,8226=>194,8211=>278,8212=>556,732=>185,8482=>556,353=>216,8250=>185,339=>401,1116=>297,382=>247,376=>401,161=>185,
162=>278,163=>278,164=>278,165=>278,166=>122,167=>278,168=>185,169=>415,170=>167,171=>278,172=>317,174=>415,175=>185,176=>222,177=>317,178=>167,
179=>167,180=>185,181=>309,182=>300,183=>139,184=>185,185=>167,186=>183,187=>278,188=>417,189=>417,190=>417,191=>278,192=>401,193=>401,194=>401,
195=>401,196=>401,197=>401,198=>556,199=>401,200=>371,201=>371,202=>371,203=>371,204=>216,205=>216,206=>216,207=>216,208=>401,209=>401,210=>432,
211=>432,212=>432,213=>432,214=>432,215=>317,216=>432,217=>401,218=>401,219=>401,220=>401,221=>401,222=>339,223=>309,224=>278,225=>278,226=>278,
227=>278,228=>278,229=>278,230=>401,231=>247,232=>247,233=>247,234=>247,235=>247,236=>154,237=>154,238=>154,239=>154,240=>278,241=>309,242=>278,
243=>278,244=>278,245=>278,246=>278,247=>317,248=>278,249=>309,250=>309,251=>309,252=>309,253=>278,254=>309,255=>278,256=>401,257=>278,258=>401,
259=>278,260=>401,261=>278,262=>401,263=>247,264=>401,265=>247,266=>401,267=>247,268=>401,269=>247,270=>401,271=>309,272=>401,273=>309,274=>371,
275=>247,276=>371,277=>247,278=>371,279=>247,280=>371,281=>247,282=>371,283=>247,284=>432,285=>278,286=>432,287=>278,288=>432,289=>278,290=>432,
291=>278,292=>432,293=>309,294=>432,295=>309,296=>216,297=>154,298=>216,299=>154,300=>216,301=>154,302=>216,303=>154,304=>216,305=>154,306=>490,
307=>270,308=>278,309=>185,310=>432,311=>309,312=>297,313=>371,314=>154,315=>371,316=>154,317=>371,318=>154,319=>371,320=>293,321=>371,322=>154,
323=>401,324=>309,325=>401,326=>309,327=>401,328=>309,329=>391,330=>401,331=>309,332=>432,333=>278,334=>432,335=>278,336=>432,337=>278,340=>401,
341=>247,342=>401,343=>247,344=>401,345=>247,346=>309,347=>216,348=>309,349=>216,350=>309,351=>216,354=>371,355=>185,356=>371,357=>185,358=>371,
359=>185,360=>401,361=>309,362=>401,363=>309,364=>401,365=>309,366=>401,367=>309,368=>401,369=>309,370=>401,371=>309,372=>556,373=>401,374=>401,
375=>278,377=>371,378=>247,379=>371,380=>247,383=>185,450=>317,477=>247,484=>432,485=>278,536=>309,537=>216,538=>371,539=>185,658=>282,711=>185,
728=>185,729=>185,730=>185,731=>185,733=>185,768=>0,769=>0,770=>0,771=>0,772=>0,773=>0,774=>0,775=>0,776=>0,777=>0,778=>0,
779=>0,780=>0,781=>0,782=>0,783=>0,784=>0,785=>0,786=>0,787=>0,788=>0,789=>0,790=>0,791=>0,792=>0,793=>0,794=>0,
795=>0,796=>0,797=>0,798=>0,799=>0,800=>0,801=>0,802=>0,803=>0,804=>0,805=>0,806=>0,807=>0,808=>0,809=>0,810=>0,
811=>0,812=>0,813=>0,814=>0,815=>0,816=>0,817=>0,818=>0,819=>0,820=>0,821=>0,822=>0,823=>0,824=>0,825=>0,826=>0,
827=>0,828=>0,829=>0,830=>0,831=>0,864=>0,865=>0,884=>111,885=>111,890=>0,894=>185,900=>100,901=>183,902=>401,903=>139,904=>451,
905=>532,906=>316,908=>451,910=>501,911=>451,912=>183,913=>401,914=>371,915=>339,916=>422,917=>371,918=>371,919=>432,920=>432,921=>216,922=>432,
923=>401,924=>524,925=>401,926=>361,927=>432,928=>451,929=>339,931=>361,932=>371,933=>401,934=>482,935=>401,936=>482,937=>451,938=>0,939=>401,
940=>336,941=>244,942=>336,943=>183,944=>306,945=>336,946=>306,947=>306,948=>306,949=>244,950=>275,951=>336,952=>306,953=>183,954=>338,955=>275,
956=>336,957=>275,958=>275,959=>306,960=>336,961=>306,962=>244,963=>306,964=>244,965=>306,966=>367,967=>275,968=>397,969=>397,970=>183,971=>306,
972=>306,973=>306,974=>397,976=>306,977=>306,978=>401,979=>401,980=>401,981=>367,982=>336,986=>283,987=>237,988=>339,989=>261,1024=>371,1025=>371,
1026=>371,1028=>401,1029=>309,1030=>216,1031=>216,1032=>278,1033=>573,1034=>573,1035=>449,1037=>432,1038=>401,1040=>401,1041=>371,1042=>371,1043=>328,1044=>432,
1045=>371,1046=>615,1047=>313,1048=>429,1049=>429,1050=>424,1051=>432,1052=>524,1053=>432,1054=>432,1055=>430,1056=>339,1057=>401,1058=>371,1059=>401,1060=>444,
1061=>401,1062=>429,1063=>432,1064=>618,1065=>618,1066=>482,1067=>539,1068=>350,1069=>401,1070=>619,1071=>408,1072=>278,1073=>278,1074=>279,1075=>246,1076=>309,
1077=>247,1078=>417,1079=>227,1080=>319,1081=>319,1082=>297,1083=>302,1084=>376,1085=>309,1086=>278,1087=>309,1088=>309,1089=>247,1090=>274,1091=>278,1092=>458,
1093=>278,1094=>309,1095=>309,1096=>454,1097=>454,1098=>340,1099=>423,1100=>284,1101=>247,1102=>439,1103=>284,1104=>247,1105=>247,1106=>309,1108=>247,1109=>216,
1110=>154,1111=>154,1112=>185,1113=>440,1114=>437,1115=>309,1117=>309,1118=>278,1119=>309,1164=>339,1165=>284,1166=>339,1167=>309,1168=>339,1169=>254,1170=>339,
1171=>254,1172=>339,1173=>254,1174=>615,1175=>417,1176=>322,1177=>216,1178=>432,1179=>297,1180=>432,1181=>297,1182=>432,1183=>297,1184=>537,1185=>352,1186=>432,
1187=>309,1188=>563,1189=>408,1190=>432,1191=>461,1192=>401,1193=>247,1194=>401,1195=>247,1196=>371,1197=>274,1198=>401,1199=>278,1200=>401,1201=>278,1202=>401,
1203=>278,1204=>581,1205=>432,1206=>432,1207=>309,1208=>432,1209=>309,1210=>432,1211=>309,1212=>367,1213=>247,1214=>367,1215=>247,1216=>216,1217=>615,1218=>417,
1219=>432,1220=>297,1223=>432,1224=>309,1227=>432,1228=>309,1232=>401,1233=>278,1234=>401,1235=>278,1236=>556,1237=>401,1238=>371,1239=>247,1240=>367,1241=>247,
1242=>367,1243=>247,1244=>615,1245=>417,1246=>313,1247=>227,1248=>322,1249=>216,1250=>432,1251=>309,1252=>432,1253=>309,1254=>432,1255=>278,1256=>432,1257=>278,
1258=>432,1259=>278,1260=>401,1261=>247,1262=>401,1263=>278,1264=>401,1265=>278,1266=>401,1267=>278,1268=>432,1269=>309,1272=>548,1273=>423,1488=>280,1489=>280,
1490=>174,1491=>280,1492=>280,1493=>158,1494=>158,1495=>280,1496=>280,1497=>158,1498=>287,1499=>280,1500=>280,1501=>280,1502=>280,1503=>156,1504=>158,1505=>280,
1506=>280,1507=>292,1508=>280,1509=>273,1510=>280,1511=>305,1512=>285,1513=>299,1514=>280,1548=>195,1563=>246,1567=>340,1569=>392,1570=>306,1571=>247,1572=>447,
1573=>247,1574=>602,1575=>192,1576=>635,1577=>369,1578=>635,1579=>635,1580=>548,1581=>1173,1582=>548,1583=>363,1584=>363,1585=>439,1586=>442,1587=>875,1588=>875,
1589=>1061,1590=>1061,1591=>811,1592=>811,1593=>549,1594=>547,1600=>389,1601=>755,1602=>574,1603=>717,1604=>555,1605=>423,1606=>532,1607=>371,1608=>454,1609=>633,
1610=>643,1611=>-19,1612=>-26,1613=>-20,1614=>-19,1615=>-18,1616=>-19,1617=>-19,1618=>-15,1632=>383,1633=>383,1634=>383,1635=>383,1636=>383,1637=>383,1638=>383,
1639=>383,1640=>383,1641=>383,1642=>383,1645=>398,7936=>336,7937=>336,7938=>336,7939=>336,7940=>336,7941=>336,7942=>336,7943=>336,7944=>401,7945=>401,7946=>401,
7947=>401,7948=>401,7949=>401,7950=>401,7951=>401,7952=>244,7953=>244,7954=>244,7955=>244,7956=>244,7957=>244,7960=>371,7961=>371,7962=>371,7963=>371,7964=>371,
7965=>371,7968=>336,7969=>336,7970=>336,7971=>336,7972=>336,7973=>336,7974=>336,7975=>336,7976=>432,7977=>432,7978=>432,7979=>432,7980=>432,7981=>432,7982=>432,
7983=>432,7984=>183,7985=>183,7986=>183,7987=>183,7988=>183,7989=>183,7990=>183,7991=>183,7992=>216,7993=>216,7994=>216,7995=>216,7996=>216,7997=>216,7998=>216,
7999=>216,8000=>306,8001=>306,8002=>306,8003=>306,8004=>306,8005=>306,8008=>432,8009=>432,8010=>432,8011=>432,8012=>432,8013=>432,8016=>306,8017=>306,8018=>306,
8019=>306,8020=>306,8021=>306,8022=>306,8023=>306,8025=>401,8027=>401,8029=>401,8031=>401,8032=>397,8033=>397,8034=>397,8035=>397,8036=>397,8037=>397,8038=>397,
8039=>397,8040=>451,8041=>451,8042=>451,8043=>451,8044=>451,8045=>451,8046=>451,8047=>451,8048=>336,8049=>336,8050=>244,8051=>244,8052=>336,8053=>336,8054=>183,
8055=>183,8056=>306,8057=>306,8058=>306,8059=>306,8060=>397,8061=>397,8064=>336,8065=>336,8066=>336,8067=>336,8068=>336,8069=>336,8070=>336,8071=>336,8072=>401,
8073=>401,8074=>401,8075=>401,8076=>401,8077=>401,8078=>401,8079=>401,8080=>336,8081=>336,8082=>336,8083=>336,8084=>336,8085=>336,8086=>336,8087=>336,8088=>432,
8089=>432,8090=>432,8091=>432,8092=>432,8093=>432,8094=>432,8095=>432,8096=>397,8097=>397,8098=>397,8099=>397,8100=>397,8101=>397,8102=>397,8103=>397,8104=>451,
8105=>451,8106=>451,8107=>451,8108=>451,8109=>451,8110=>451,8111=>451,8112=>336,8113=>336,8114=>336,8115=>336,8116=>336,8118=>336,8119=>336,8120=>401,8121=>401,
8122=>401,8123=>401,8124=>401,8125=>278,8126=>0,8127=>278,8128=>278,8129=>306,8130=>336,8131=>336,8132=>336,8134=>336,8135=>336,8136=>371,8137=>371,8138=>432,
8139=>432,8140=>432,8141=>278,8142=>278,8143=>278,8144=>183,8145=>183,8146=>183,8147=>183,8150=>183,8151=>183,8152=>216,8153=>216,8154=>216,8155=>216,8157=>278,
8158=>278,8159=>278,8160=>306,8161=>306,8162=>306,8163=>306,8164=>306,8165=>306,8166=>306,8167=>306,8168=>401,8169=>401,8170=>401,8171=>401,8172=>339,8173=>306,
8174=>306,8175=>278,8178=>397,8179=>397,8180=>397,8182=>397,8183=>397,8184=>432,8185=>432,8186=>451,8187=>451,8188=>451,8189=>278,8190=>278,8208=>185,8209=>185,
8219=>185,8223=>278,8227=>311,8241=>1011,8248=>261,8251=>404,8253=>386,8255=>529,8256=>529,8257=>188,8258=>517,8259=>185,8260=>93,8261=>184,8262=>184,8267=>300,
8308=>167,8309=>556,8321=>167,8322=>167,8323=>167,8324=>167,8352=>394,8353=>401,8354=>435,8355=>339,8356=>278,8357=>463,8358=>401,8359=>389,8361=>556,8470=>530,
8471=>415,8479=>401,8483=>401,8486=>451,8487=>451,8494=>306,8498=>339,8543=>417,8706=>274,8710=>340,8721=>396,8722=>317,8730=>305,8734=>418,8800=>317,8804=>317,
8805=>317,9674=>274,12353=>556,12354=>556,12355=>556,12356=>556,12357=>556,12358=>556,12359=>556,12360=>556,12361=>556,12362=>556,12363=>556,12364=>556,12365=>556,12366=>556,
12367=>556,12368=>556,12369=>556,12370=>556,12371=>556,12372=>556,12373=>556,12374=>556,12375=>556,12376=>556,12377=>556,12378=>556,12379=>556,12380=>556,12381=>556,12382=>556,
12383=>556,12384=>556,12385=>556,12386=>556,12387=>556,12388=>556,12389=>556,12390=>556,12391=>556,12392=>556,12393=>556,12394=>556,12395=>556,12396=>556,12397=>556,12398=>556,
12399=>556,12400=>556,12401=>556,12402=>556,12403=>556,12404=>556,12405=>556,12406=>556,12407=>556,12408=>556,12409=>556,12410=>556,12411=>556,12412=>556,12413=>556,12414=>556,
12415=>556,12416=>556,12417=>556,12418=>556,12419=>556,12420=>556,12421=>556,12422=>556,12423=>556,12424=>556,12425=>556,12426=>556,12427=>556,12428=>556,12429=>556,12430=>556,
12431=>556,12432=>556,12433=>556,12434=>556,12435=>556,12449=>556,12450=>556,12451=>556,12452=>556,12453=>556,12454=>556,12455=>556,12456=>556,12457=>556,12458=>556,12459=>556,
12460=>556,12461=>556,12462=>556,12463=>556,12464=>556,12465=>556,12466=>556,12467=>556,12468=>556,12469=>556,12470=>556,12471=>556,12472=>556,12473=>556,12474=>556,12475=>556,
12476=>556,12477=>556,12478=>556,12479=>556,12480=>556,12481=>556,12482=>556,12483=>556,12484=>556,12485=>556,12486=>556,12487=>556,12488=>556,12489=>556,12490=>556,12491=>556,
12492=>556,12493=>556,12494=>556,12495=>556,12496=>556,12497=>556,12498=>556,12499=>556,12500=>556,12501=>556,12502=>556,12503=>556,12504=>556,12505=>556,12506=>556,12507=>556,
12508=>556,12509=>556,12510=>556,12511=>556,12512=>556,12513=>556,12514=>556,12515=>556,12516=>556,12517=>556,12518=>556,12519=>556,12520=>556,12521=>556,12522=>556,12523=>556,
12524=>556,12525=>556,12526=>556,12527=>556,12528=>556,12529=>556,12530=>556,12531=>556,12532=>556,12533=>556,12534=>556,63033=>278,63034=>278,63035=>278,63036=>278,63037=>278,
63038=>278,63039=>278,63040=>278,63041=>278,63171=>185,63196=>278,64256=>309,64257=>309,64258=>309,64259=>463,64260=>463,64262=>402,64606=>0,64607=>0,64608=>0,64609=>0,
64610=>0,64830=>467,64831=>467,65010=>814,65152=>392,65153=>306,65154=>281,65155=>247,65156=>250,65157=>447,65158=>412,65159=>247,65160=>222,65161=>602,65162=>535,65163=>360,
65164=>329,65165=>192,65166=>220,65167=>635,65168=>644,65169=>338,65170=>321,65171=>369,65172=>419,65173=>635,65174=>644,65175=>345,65176=>336,65177=>635,65178=>644,65179=>393,
65180=>345,65181=>548,65182=>553,65183=>637,65184=>652,65185=>548,65186=>546,65187=>637,65188=>656,65189=>548,65190=>544,65191=>637,65192=>656,65193=>363,65194=>439,65195=>363,
65196=>439,65197=>440,65198=>471,65199=>439,65200=>474,65201=>875,65202=>871,65203=>608,65204=>588,65205=>875,65206=>871,65207=>609,65208=>587,65209=>1061,65210=>1033,65211=>794,
65212=>758,65213=>1061,65214=>1033,65215=>794,65216=>761,65217=>811,65218=>793,65219=>659,65220=>647,65221=>811,65222=>793,65223=>659,65224=>642,65225=>549,65226=>481,65227=>512,
65228=>409,65229=>547,65230=>476,65231=>512,65232=>409,65233=>755,65234=>748,65235=>416,65236=>442,65237=>574,65238=>550,65239=>416,65240=>442,65241=>717,65242=>687,65243=>883,
65244=>409,65245=>555,65246=>511,65247=>338,65248=>297,65249=>423,65250=>478,65251=>489,65252=>476,65253=>532,65254=>548,65255=>336,65256=>326,65257=>371,65258=>391,65259=>524,
65260=>412,65261=>454,65262=>412,65263=>633,65264=>566,65265=>643,65266=>560,65267=>357,65268=>333,65269=>623,65270=>617,65271=>603,65272=>621,65273=>576,65274=>617,65275=>576,
65276=>625);
$enc='';
$diff='';
$file='almohanad.z';
$ctg='almohanad.ctg.z';
$originalsize=227760;
// --- EOF ---
<?php
$type='TrueTypeUnicode';
$name='AlMohanad';
$desc=array('Ascent'=>1093,'Descent'=>-509,'CapHeight'=>1093,'Flags'=>32,'FontBBox'=>'[-278 -507 1124 1093]','ItalicAngle'=>0,'StemV'=>70,'MissingWidth'=>600);
$up=-136;
$ut=64;
$dw=600;
$cw=array(
0=>0,32=>139,33=>185,34=>308,35=>278,36=>278,37=>556,38=>463,39=>154,40=>185,41=>185,42=>278,43=>317,44=>139,45=>185,46=>139,
47=>154,48=>278,49=>278,50=>278,51=>278,52=>278,53=>278,54=>278,55=>278,56=>278,57=>278,58=>185,59=>185,60=>317,61=>317,62=>317,
63=>278,64=>517,65=>401,66=>371,67=>401,68=>402,69=>371,70=>339,71=>432,72=>430,73=>214,74=>278,75=>424,76=>369,77=>524,78=>401,
79=>432,80=>339,81=>432,82=>396,83=>309,84=>371,85=>401,86=>401,87=>556,88=>401,89=>401,90=>371,91=>185,92=>154,93=>185,94=>323,
95=>278,96=>185,97=>278,98=>309,99=>247,100=>309,101=>247,102=>185,103=>278,104=>309,105=>154,106=>185,107=>309,108=>154,109=>463,110=>309,
111=>278,112=>309,113=>309,114=>247,115=>216,116=>185,117=>309,118=>278,119=>401,120=>278,121=>278,122=>247,123=>219,124=>122,125=>219,126=>289,
8364=>278,1027=>339,8218=>185,1107=>254,8222=>278,8230=>556,8224=>278,8225=>278,710=>185,8240=>556,352=>309,8249=>185,338=>556,1036=>432,381=>371,1039=>432,
8216=>185,8217=>185,8220=>278,8221=>278,8226=>194,8211=>278,8212=>556,732=>185,8482=>556,353=>216,8250=>185,339=>401,1116=>297,382=>247,376=>401,161=>185,
162=>278,163=>278,164=>278,165=>278,166=>122,167=>278,168=>185,169=>415,170=>167,171=>278,172=>317,174=>415,175=>185,176=>222,177=>317,178=>167,
179=>167,180=>185,181=>309,182=>300,183=>139,184=>185,185=>167,186=>183,187=>278,188=>417,189=>417,190=>417,191=>278,192=>401,193=>401,194=>401,
195=>401,196=>401,197=>401,198=>556,199=>401,200=>371,201=>371,202=>371,203=>371,204=>216,205=>216,206=>216,207=>216,208=>401,209=>401,210=>432,
211=>432,212=>432,213=>432,214=>432,215=>317,216=>432,217=>401,218=>401,219=>401,220=>401,221=>401,222=>339,223=>309,224=>278,225=>278,226=>278,
227=>278,228=>278,229=>278,230=>401,231=>247,232=>247,233=>247,234=>247,235=>247,236=>154,237=>154,238=>154,239=>154,240=>278,241=>309,242=>278,
243=>278,244=>278,245=>278,246=>278,247=>317,248=>278,249=>309,250=>309,251=>309,252=>309,253=>278,254=>309,255=>278,256=>401,257=>278,258=>401,
259=>278,260=>401,261=>278,262=>401,263=>247,264=>401,265=>247,266=>401,267=>247,268=>401,269=>247,270=>401,271=>309,272=>401,273=>309,274=>371,
275=>247,276=>371,277=>247,278=>371,279=>247,280=>371,281=>247,282=>371,283=>247,284=>432,285=>278,286=>432,287=>278,288=>432,289=>278,290=>432,
291=>278,292=>432,293=>309,294=>432,295=>309,296=>216,297=>154,298=>216,299=>154,300=>216,301=>154,302=>216,303=>154,304=>216,305=>154,306=>490,
307=>270,308=>278,309=>185,310=>432,311=>309,312=>297,313=>371,314=>154,315=>371,316=>154,317=>371,318=>154,319=>371,320=>293,321=>371,322=>154,
323=>401,324=>309,325=>401,326=>309,327=>401,328=>309,329=>391,330=>401,331=>309,332=>432,333=>278,334=>432,335=>278,336=>432,337=>278,340=>401,
341=>247,342=>401,343=>247,344=>401,345=>247,346=>309,347=>216,348=>309,349=>216,350=>309,351=>216,354=>371,355=>185,356=>371,357=>185,358=>371,
359=>185,360=>401,361=>309,362=>401,363=>309,364=>401,365=>309,366=>401,367=>309,368=>401,369=>309,370=>401,371=>309,372=>556,373=>401,374=>401,
375=>278,377=>371,378=>247,379=>371,380=>247,383=>185,450=>317,477=>247,484=>432,485=>278,536=>309,537=>216,538=>371,539=>185,658=>282,711=>185,
728=>185,729=>185,730=>185,731=>185,733=>185,768=>0,769=>0,770=>0,771=>0,772=>0,773=>0,774=>0,775=>0,776=>0,777=>0,778=>0,
779=>0,780=>0,781=>0,782=>0,783=>0,784=>0,785=>0,786=>0,787=>0,788=>0,789=>0,790=>0,791=>0,792=>0,793=>0,794=>0,
795=>0,796=>0,797=>0,798=>0,799=>0,800=>0,801=>0,802=>0,803=>0,804=>0,805=>0,806=>0,807=>0,808=>0,809=>0,810=>0,
811=>0,812=>0,813=>0,814=>0,815=>0,816=>0,817=>0,818=>0,819=>0,820=>0,821=>0,822=>0,823=>0,824=>0,825=>0,826=>0,
827=>0,828=>0,829=>0,830=>0,831=>0,864=>0,865=>0,884=>111,885=>111,890=>0,894=>185,900=>100,901=>183,902=>401,903=>139,904=>451,
905=>532,906=>316,908=>451,910=>501,911=>451,912=>183,913=>401,914=>371,915=>339,916=>422,917=>371,918=>371,919=>432,920=>432,921=>216,922=>432,
923=>401,924=>524,925=>401,926=>361,927=>432,928=>451,929=>339,931=>361,932=>371,933=>401,934=>482,935=>401,936=>482,937=>451,938=>0,939=>401,
940=>336,941=>244,942=>336,943=>183,944=>306,945=>336,946=>306,947=>306,948=>306,949=>244,950=>275,951=>336,952=>306,953=>183,954=>338,955=>275,
956=>336,957=>275,958=>275,959=>306,960=>336,961=>306,962=>244,963=>306,964=>244,965=>306,966=>367,967=>275,968=>397,969=>397,970=>183,971=>306,
972=>306,973=>306,974=>397,976=>306,977=>306,978=>401,979=>401,980=>401,981=>367,982=>336,986=>283,987=>237,988=>339,989=>261,1024=>371,1025=>371,
1026=>371,1028=>401,1029=>309,1030=>216,1031=>216,1032=>278,1033=>573,1034=>573,1035=>449,1037=>432,1038=>401,1040=>401,1041=>371,1042=>371,1043=>328,1044=>432,
1045=>371,1046=>615,1047=>313,1048=>429,1049=>429,1050=>424,1051=>432,1052=>524,1053=>432,1054=>432,1055=>430,1056=>339,1057=>401,1058=>371,1059=>401,1060=>444,
1061=>401,1062=>429,1063=>432,1064=>618,1065=>618,1066=>482,1067=>539,1068=>350,1069=>401,1070=>619,1071=>408,1072=>278,1073=>278,1074=>279,1075=>246,1076=>309,
1077=>247,1078=>417,1079=>227,1080=>319,1081=>319,1082=>297,1083=>302,1084=>376,1085=>309,1086=>278,1087=>309,1088=>309,1089=>247,1090=>274,1091=>278,1092=>458,
1093=>278,1094=>309,1095=>309,1096=>454,1097=>454,1098=>340,1099=>423,1100=>284,1101=>247,1102=>439,1103=>284,1104=>247,1105=>247,1106=>309,1108=>247,1109=>216,
1110=>154,1111=>154,1112=>185,1113=>440,1114=>437,1115=>309,1117=>309,1118=>278,1119=>309,1164=>339,1165=>284,1166=>339,1167=>309,1168=>339,1169=>254,1170=>339,
1171=>254,1172=>339,1173=>254,1174=>615,1175=>417,1176=>322,1177=>216,1178=>432,1179=>297,1180=>432,1181=>297,1182=>432,1183=>297,1184=>537,1185=>352,1186=>432,
1187=>309,1188=>563,1189=>408,1190=>432,1191=>461,1192=>401,1193=>247,1194=>401,1195=>247,1196=>371,1197=>274,1198=>401,1199=>278,1200=>401,1201=>278,1202=>401,
1203=>278,1204=>581,1205=>432,1206=>432,1207=>309,1208=>432,1209=>309,1210=>432,1211=>309,1212=>367,1213=>247,1214=>367,1215=>247,1216=>216,1217=>615,1218=>417,
1219=>432,1220=>297,1223=>432,1224=>309,1227=>432,1228=>309,1232=>401,1233=>278,1234=>401,1235=>278,1236=>556,1237=>401,1238=>371,1239=>247,1240=>367,1241=>247,
1242=>367,1243=>247,1244=>615,1245=>417,1246=>313,1247=>227,1248=>322,1249=>216,1250=>432,1251=>309,1252=>432,1253=>309,1254=>432,1255=>278,1256=>432,1257=>278,
1258=>432,1259=>278,1260=>401,1261=>247,1262=>401,1263=>278,1264=>401,1265=>278,1266=>401,1267=>278,1268=>432,1269=>309,1272=>548,1273=>423,1488=>280,1489=>280,
1490=>174,1491=>280,1492=>280,1493=>158,1494=>158,1495=>280,1496=>280,1497=>158,1498=>287,1499=>280,1500=>280,1501=>280,1502=>280,1503=>156,1504=>158,1505=>280,
1506=>280,1507=>292,1508=>280,1509=>273,1510=>280,1511=>305,1512=>285,1513=>299,1514=>280,1548=>195,1563=>246,1567=>340,1569=>392,1570=>306,1571=>247,1572=>447,
1573=>247,1574=>602,1575=>192,1576=>635,1577=>369,1578=>635,1579=>635,1580=>548,1581=>1173,1582=>548,1583=>363,1584=>363,1585=>439,1586=>442,1587=>875,1588=>875,
1589=>1061,1590=>1061,1591=>811,1592=>811,1593=>549,1594=>547,1600=>389,1601=>755,1602=>574,1603=>717,1604=>555,1605=>423,1606=>532,1607=>371,1608=>454,1609=>633,
1610=>643,1611=>-19,1612=>-26,1613=>-20,1614=>-19,1615=>-18,1616=>-19,1617=>-19,1618=>-15,1632=>383,1633=>383,1634=>383,1635=>383,1636=>383,1637=>383,1638=>383,
1639=>383,1640=>383,1641=>383,1642=>383,1645=>398,7936=>336,7937=>336,7938=>336,7939=>336,7940=>336,7941=>336,7942=>336,7943=>336,7944=>401,7945=>401,7946=>401,
7947=>401,7948=>401,7949=>401,7950=>401,7951=>401,7952=>244,7953=>244,7954=>244,7955=>244,7956=>244,7957=>244,7960=>371,7961=>371,7962=>371,7963=>371,7964=>371,
7965=>371,7968=>336,7969=>336,7970=>336,7971=>336,7972=>336,7973=>336,7974=>336,7975=>336,7976=>432,7977=>432,7978=>432,7979=>432,7980=>432,7981=>432,7982=>432,
7983=>432,7984=>183,7985=>183,7986=>183,7987=>183,7988=>183,7989=>183,7990=>183,7991=>183,7992=>216,7993=>216,7994=>216,7995=>216,7996=>216,7997=>216,7998=>216,
7999=>216,8000=>306,8001=>306,8002=>306,8003=>306,8004=>306,8005=>306,8008=>432,8009=>432,8010=>432,8011=>432,8012=>432,8013=>432,8016=>306,8017=>306,8018=>306,
8019=>306,8020=>306,8021=>306,8022=>306,8023=>306,8025=>401,8027=>401,8029=>401,8031=>401,8032=>397,8033=>397,8034=>397,8035=>397,8036=>397,8037=>397,8038=>397,
8039=>397,8040=>451,8041=>451,8042=>451,8043=>451,8044=>451,8045=>451,8046=>451,8047=>451,8048=>336,8049=>336,8050=>244,8051=>244,8052=>336,8053=>336,8054=>183,
8055=>183,8056=>306,8057=>306,8058=>306,8059=>306,8060=>397,8061=>397,8064=>336,8065=>336,8066=>336,8067=>336,8068=>336,8069=>336,8070=>336,8071=>336,8072=>401,
8073=>401,8074=>401,8075=>401,8076=>401,8077=>401,8078=>401,8079=>401,8080=>336,8081=>336,8082=>336,8083=>336,8084=>336,8085=>336,8086=>336,8087=>336,8088=>432,
8089=>432,8090=>432,8091=>432,8092=>432,8093=>432,8094=>432,8095=>432,8096=>397,8097=>397,8098=>397,8099=>397,8100=>397,8101=>397,8102=>397,8103=>397,8104=>451,
8105=>451,8106=>451,8107=>451,8108=>451,8109=>451,8110=>451,8111=>451,8112=>336,8113=>336,8114=>336,8115=>336,8116=>336,8118=>336,8119=>336,8120=>401,8121=>401,
8122=>401,8123=>401,8124=>401,8125=>278,8126=>0,8127=>278,8128=>278,8129=>306,8130=>336,8131=>336,8132=>336,8134=>336,8135=>336,8136=>371,8137=>371,8138=>432,
8139=>432,8140=>432,8141=>278,8142=>278,8143=>278,8144=>183,8145=>183,8146=>183,8147=>183,8150=>183,8151=>183,8152=>216,8153=>216,8154=>216,8155=>216,8157=>278,
8158=>278,8159=>278,8160=>306,8161=>306,8162=>306,8163=>306,8164=>306,8165=>306,8166=>306,8167=>306,8168=>401,8169=>401,8170=>401,8171=>401,8172=>339,8173=>306,
8174=>306,8175=>278,8178=>397,8179=>397,8180=>397,8182=>397,8183=>397,8184=>432,8185=>432,8186=>451,8187=>451,8188=>451,8189=>278,8190=>278,8208=>185,8209=>185,
8219=>185,8223=>278,8227=>311,8241=>1011,8248=>261,8251=>404,8253=>386,8255=>529,8256=>529,8257=>188,8258=>517,8259=>185,8260=>93,8261=>184,8262=>184,8267=>300,
8308=>167,8309=>556,8321=>167,8322=>167,8323=>167,8324=>167,8352=>394,8353=>401,8354=>435,8355=>339,8356=>278,8357=>463,8358=>401,8359=>389,8361=>556,8470=>530,
8471=>415,8479=>401,8483=>401,8486=>451,8487=>451,8494=>306,8498=>339,8543=>417,8706=>274,8710=>340,8721=>396,8722=>317,8730=>305,8734=>418,8800=>317,8804=>317,
8805=>317,9674=>274,12353=>556,12354=>556,12355=>556,12356=>556,12357=>556,12358=>556,12359=>556,12360=>556,12361=>556,12362=>556,12363=>556,12364=>556,12365=>556,12366=>556,
12367=>556,12368=>556,12369=>556,12370=>556,12371=>556,12372=>556,12373=>556,12374=>556,12375=>556,12376=>556,12377=>556,12378=>556,12379=>556,12380=>556,12381=>556,12382=>556,
12383=>556,12384=>556,12385=>556,12386=>556,12387=>556,12388=>556,12389=>556,12390=>556,12391=>556,12392=>556,12393=>556,12394=>556,12395=>556,12396=>556,12397=>556,12398=>556,
12399=>556,12400=>556,12401=>556,12402=>556,12403=>556,12404=>556,12405=>556,12406=>556,12407=>556,12408=>556,12409=>556,12410=>556,12411=>556,12412=>556,12413=>556,12414=>556,
12415=>556,12416=>556,12417=>556,12418=>556,12419=>556,12420=>556,12421=>556,12422=>556,12423=>556,12424=>556,12425=>556,12426=>556,12427=>556,12428=>556,12429=>556,12430=>556,
12431=>556,12432=>556,12433=>556,12434=>556,12435=>556,12449=>556,12450=>556,12451=>556,12452=>556,12453=>556,12454=>556,12455=>556,12456=>556,12457=>556,12458=>556,12459=>556,
12460=>556,12461=>556,12462=>556,12463=>556,12464=>556,12465=>556,12466=>556,12467=>556,12468=>556,12469=>556,12470=>556,12471=>556,12472=>556,12473=>556,12474=>556,12475=>556,
12476=>556,12477=>556,12478=>556,12479=>556,12480=>556,12481=>556,12482=>556,12483=>556,12484=>556,12485=>556,12486=>556,12487=>556,12488=>556,12489=>556,12490=>556,12491=>556,
12492=>556,12493=>556,12494=>556,12495=>556,12496=>556,12497=>556,12498=>556,12499=>556,12500=>556,12501=>556,12502=>556,12503=>556,12504=>556,12505=>556,12506=>556,12507=>556,
12508=>556,12509=>556,12510=>556,12511=>556,12512=>556,12513=>556,12514=>556,12515=>556,12516=>556,12517=>556,12518=>556,12519=>556,12520=>556,12521=>556,12522=>556,12523=>556,
12524=>556,12525=>556,12526=>556,12527=>556,12528=>556,12529=>556,12530=>556,12531=>556,12532=>556,12533=>556,12534=>556,63033=>278,63034=>278,63035=>278,63036=>278,63037=>278,
63038=>278,63039=>278,63040=>278,63041=>278,63171=>185,63196=>278,64256=>309,64257=>309,64258=>309,64259=>463,64260=>463,64262=>402,64606=>0,64607=>0,64608=>0,64609=>0,
64610=>0,64830=>467,64831=>467,65010=>814,65152=>392,65153=>306,65154=>281,65155=>247,65156=>250,65157=>447,65158=>412,65159=>247,65160=>222,65161=>602,65162=>535,65163=>360,
65164=>329,65165=>192,65166=>220,65167=>635,65168=>644,65169=>338,65170=>321,65171=>369,65172=>419,65173=>635,65174=>644,65175=>345,65176=>336,65177=>635,65178=>644,65179=>393,
65180=>345,65181=>548,65182=>553,65183=>637,65184=>652,65185=>548,65186=>546,65187=>637,65188=>656,65189=>548,65190=>544,65191=>637,65192=>656,65193=>363,65194=>439,65195=>363,
65196=>439,65197=>440,65198=>471,65199=>439,65200=>474,65201=>875,65202=>871,65203=>608,65204=>588,65205=>875,65206=>871,65207=>609,65208=>587,65209=>1061,65210=>1033,65211=>794,
65212=>758,65213=>1061,65214=>1033,65215=>794,65216=>761,65217=>811,65218=>793,65219=>659,65220=>647,65221=>811,65222=>793,65223=>659,65224=>642,65225=>549,65226=>481,65227=>512,
65228=>409,65229=>547,65230=>476,65231=>512,65232=>409,65233=>755,65234=>748,65235=>416,65236=>442,65237=>574,65238=>550,65239=>416,65240=>442,65241=>717,65242=>687,65243=>883,
65244=>409,65245=>555,65246=>511,65247=>338,65248=>297,65249=>423,65250=>478,65251=>489,65252=>476,65253=>532,65254=>548,65255=>336,65256=>326,65257=>371,65258=>391,65259=>524,
65260=>412,65261=>454,65262=>412,65263=>633,65264=>566,65265=>643,65266=>560,65267=>357,65268=>333,65269=>623,65270=>617,65271=>603,65272=>621,65273=>576,65274=>617,65275=>576,
65276=>625);
$enc='';
$diff='';
$file='almohanad.z';
$ctg='almohanad.ctg.z';
$originalsize=227760;
// --- EOF ---
File diff suppressed because it is too large Load Diff
@@ -1,32 +1,32 @@
<?php
// core font definition file for TCPDF (www.tcpdf.org)
$type='core';
$dw=500;
$cw=array(0=>250,1=>250,2=>250,3=>250,4=>250,5=>250,6=>250,7=>250,8=>250,9=>250,
10=>250,11=>250,12=>250,13=>250,14=>250,15=>250,16=>250,17=>250,18=>250,19=>250,
20=>250,21=>250,22=>250,23=>250,24=>250,25=>250,26=>250,27=>250,28=>250,29=>250,
30=>250,31=>250,32=>250,33=>333,34=>713,35=>500,36=>549,37=>833,38=>778,39=>439,
40=>333,41=>333,42=>500,43=>549,44=>250,45=>549,46=>250,47=>278,48=>500,49=>500,
50=>500,51=>500,52=>500,53=>500,54=>500,55=>500,56=>500,57=>500,58=>278,59=>278,
60=>549,61=>549,62=>549,63=>444,64=>549,65=>722,66=>667,67=>722,68=>612,69=>611,
70=>763,71=>603,72=>722,73=>333,74=>631,75=>722,76=>686,77=>889,78=>722,79=>722,
80=>768,81=>741,82=>556,83=>592,84=>611,85=>690,86=>439,87=>768,88=>645,89=>795,
90=>611,91=>333,92=>863,93=>333,94=>658,95=>500,96=>500,97=>631,98=>549,99=>549,
100=>494,101=>439,102=>521,103=>411,104=>603,105=>329,106=>603,107=>549,108=>549,
109=>576,110=>521,111=>549,112=>549,113=>521,114=>549,115=>603,116=>439,117=>576,
118=>713,119=>686,120=>493,121=>686,122=>494,123=>480,124=>200,125=>480,126=>549,
127=>0,128=>0,129=>0,130=>0,131=>0,132=>0,133=>0,134=>0,135=>0,136=>0,137=>0,
138=>0,139=>0,140=>0,141=>0,142=>0,143=>0,144=>0,145=>0,146=>0,147=>0,148=>0,
149=>0,150=>0,151=>0,152=>0,153=>0,154=>0,155=>0,156=>0,157=>0,158=>0,159=>0,
160=>750,161=>620,162=>247,163=>549,164=>167,165=>713,166=>500,167=>753,168=>753,
169=>753,170=>753,171=>1042,172=>987,173=>603,174=>987,175=>603,176=>400,177=>549,
178=>411,179=>549,180=>549,181=>713,182=>494,183=>460,184=>549,185=>549,186=>549,
187=>549,188=>1000,189=>603,190=>1000,191=>658,192=>823,193=>686,194=>795,195=>987,
196=>768,197=>768,198=>823,199=>768,200=>768,201=>713,202=>713,203=>713,204=>713,
205=>713,206=>713,207=>713,208=>768,209=>713,210=>790,211=>790,212=>890,213=>823,
214=>549,215=>250,216=>713,217=>603,218=>603,219=>1042,220=>987,221=>603,222=>987,
223=>603,224=>494,225=>329,226=>790,227=>790,228=>786,229=>713,230=>384,231=>384,
232=>384,233=>384,234=>384,235=>384,236=>494,237=>494,238=>494,239=>494,240=>0,
241=>329,242=>274,243=>686,244=>686,245=>686,246=>384,247=>384,248=>384,249=>384,
250=>384,251=>384,252=>494,253=>494,254=>494,255=>0);
// --- EOF ---
<?php
// core font definition file for TCPDF (www.tcpdf.org)
$type='core';
$dw=500;
$cw=array(0=>250,1=>250,2=>250,3=>250,4=>250,5=>250,6=>250,7=>250,8=>250,9=>250,
10=>250,11=>250,12=>250,13=>250,14=>250,15=>250,16=>250,17=>250,18=>250,19=>250,
20=>250,21=>250,22=>250,23=>250,24=>250,25=>250,26=>250,27=>250,28=>250,29=>250,
30=>250,31=>250,32=>250,33=>333,34=>713,35=>500,36=>549,37=>833,38=>778,39=>439,
40=>333,41=>333,42=>500,43=>549,44=>250,45=>549,46=>250,47=>278,48=>500,49=>500,
50=>500,51=>500,52=>500,53=>500,54=>500,55=>500,56=>500,57=>500,58=>278,59=>278,
60=>549,61=>549,62=>549,63=>444,64=>549,65=>722,66=>667,67=>722,68=>612,69=>611,
70=>763,71=>603,72=>722,73=>333,74=>631,75=>722,76=>686,77=>889,78=>722,79=>722,
80=>768,81=>741,82=>556,83=>592,84=>611,85=>690,86=>439,87=>768,88=>645,89=>795,
90=>611,91=>333,92=>863,93=>333,94=>658,95=>500,96=>500,97=>631,98=>549,99=>549,
100=>494,101=>439,102=>521,103=>411,104=>603,105=>329,106=>603,107=>549,108=>549,
109=>576,110=>521,111=>549,112=>549,113=>521,114=>549,115=>603,116=>439,117=>576,
118=>713,119=>686,120=>493,121=>686,122=>494,123=>480,124=>200,125=>480,126=>549,
127=>0,128=>0,129=>0,130=>0,131=>0,132=>0,133=>0,134=>0,135=>0,136=>0,137=>0,
138=>0,139=>0,140=>0,141=>0,142=>0,143=>0,144=>0,145=>0,146=>0,147=>0,148=>0,
149=>0,150=>0,151=>0,152=>0,153=>0,154=>0,155=>0,156=>0,157=>0,158=>0,159=>0,
160=>750,161=>620,162=>247,163=>549,164=>167,165=>713,166=>500,167=>753,168=>753,
169=>753,170=>753,171=>1042,172=>987,173=>603,174=>987,175=>603,176=>400,177=>549,
178=>411,179=>549,180=>549,181=>713,182=>494,183=>460,184=>549,185=>549,186=>549,
187=>549,188=>1000,189=>603,190=>1000,191=>658,192=>823,193=>686,194=>795,195=>987,
196=>768,197=>768,198=>823,199=>768,200=>768,201=>713,202=>713,203=>713,204=>713,
205=>713,206=>713,207=>713,208=>768,209=>713,210=>790,211=>790,212=>890,213=>823,
214=>549,215=>250,216=>713,217=>603,218=>603,219=>1042,220=>987,221=>603,222=>987,
223=>603,224=>494,225=>329,226=>790,227=>790,228=>786,229=>713,230=>384,231=>384,
232=>384,233=>384,234=>384,235=>384,236=>494,237=>494,238=>494,239=>494,240=>0,
241=>329,242=>274,243=>686,244=>686,245=>686,246=>384,247=>384,248=>384,249=>384,
250=>384,251=>384,252=>494,253=>494,254=>494,255=>0);
// --- EOF ---
File diff suppressed because it is too large Load Diff
@@ -1,69 +1,69 @@
<?php
//============================================================+
// File name : makeallttffonts.php
// Begin : 2008-12-07
// Last Update : 2010-08-08
//
// Description : Process all TTF files on current directory to
// build TCPDF compatible font files.
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com S.r.l.
// Via della Pace, 11
// 09044 Quartucciu (CA)
// ITALY
// www.tecnick.com
// info@tecnick.com
//
// License:
// Copyright (C) 2004-2010 Nicola Asuni - Tecnick.com S.r.l.
//
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
//============================================================+
/**
* Process all TTF files on current directory to build TCPDF compatible font files.
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @copyright Copyright &copy; 2004-2009, Nicola Asuni - Tecnick.com S.r.l. - ITALY - www.tecnick.com - info@tecnick.com
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @link www.tecnick.com
* @since 2008-12-07
*/
/**
*/
// read directory for files (only graphics files).
$handle = opendir('.');
while($file = readdir($handle)) {
$path_parts = pathinfo($file);
$file_ext = strtolower($path_parts['extension']);
if ($file_ext == 'ttf') {
exec('./ttf2ufm -a -F '.$path_parts['basename'].'');
exec('php -q makefont.php '.$path_parts['basename'].' '.$path_parts['filename'].'.ufm');
}
}
closedir($handle);
//============================================================+
// END OF FILE
//============================================================+
<?php
//============================================================+
// File name : makeallttffonts.php
// Begin : 2008-12-07
// Last Update : 2010-08-08
//
// Description : Process all TTF files on current directory to
// build TCPDF compatible font files.
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com S.r.l.
// Via della Pace, 11
// 09044 Quartucciu (CA)
// ITALY
// www.tecnick.com
// info@tecnick.com
//
// License:
// Copyright (C) 2004-2010 Nicola Asuni - Tecnick.com S.r.l.
//
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
//============================================================+
/**
* Process all TTF files on current directory to build TCPDF compatible font files.
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @copyright Copyright &copy; 2004-2009, Nicola Asuni - Tecnick.com S.r.l. - ITALY - www.tecnick.com - info@tecnick.com
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @link www.tecnick.com
* @since 2008-12-07
*/
/**
*/
// read directory for files (only graphics files).
$handle = opendir('.');
while($file = readdir($handle)) {
$path_parts = pathinfo($file);
$file_ext = strtolower($path_parts['extension']);
if ($file_ext == 'ttf') {
exec('./ttf2ufm -a -F '.$path_parts['basename'].'');
exec('php -q makefont.php '.$path_parts['basename'].' '.$path_parts['filename'].'.ufm');
}
}
closedir($handle);
//============================================================+
// END OF FILE
//============================================================+
@@ -1,17 +1,17 @@
To embed TrueType and OpenType font files, you need to extract the
font metrics from the font files and build the required tables using
the utility TTF2UFM.
TTF2UFM is a modified version of Mark Heath's TTF 2 PT1 converter
(http://ttf2pt1.sourceforge.net/) by Steven Wittens <steven@acko.net>
(http://www.acko.net/blog/ufpdf). That version has been further
modified by Ulrich Telle for use with the wxWidgets component
wxPdfDocument.
Following changes where made:
1) Generated AFM files contain the glyph number for each character.
2) Generated UFM files contain the bounding box for each character.
3) OpenType support has been activated for the Windows binary,
and the generated AFM/UFM files contain the associated
original Unicode codes for each character.
To embed TrueType and OpenType font files, you need to extract the
font metrics from the font files and build the required tables using
the utility TTF2UFM.
TTF2UFM is a modified version of Mark Heath's TTF 2 PT1 converter
(http://ttf2pt1.sourceforge.net/) by Steven Wittens <steven@acko.net>
(http://www.acko.net/blog/ufpdf). That version has been further
modified by Ulrich Telle for use with the wxWidgets component
wxPdfDocument.
Following changes where made:
1) Generated AFM files contain the glyph number for each character.
2) Generated UFM files contain the bounding box for each character.
3) OpenType support has been activated for the Windows binary,
and the generated AFM/UFM files contain the associated
original Unicode codes for each character.
@@ -1,32 +1,32 @@
<?php
// core font definition file for TCPDF (www.tcpdf.org)
$type='core';
$dw=788;
$cw=array(0=>0,1=>0,2=>0,3=>0,4=>0,5=>0,6=>0,7=>0,8=>0,9=>0,10=>0,11=>0,12=>0,
13=>0,14=>0,15=>0,16=>0,17=>0,18=>0,19=>0,20=>0,21=>0,22=>0,23=>0,24=>0,25=>0,
26=>0,27=>0,28=>0,29=>0,30=>0,31=>0,32=>278,33=>974,34=>961,35=>974,36=>980,
37=>719,38=>789,39=>790,40=>791,41=>690,42=>960,43=>939,44=>549,45=>855,46=>911,
47=>933,48=>911,49=>945,50=>974,51=>755,52=>846,53=>762,54=>761,55=>571,56=>677,
57=>763,58=>760,59=>759,60=>754,61=>494,62=>552,63=>537,64=>577,65=>692,66=>786,
67=>788,68=>788,69=>790,70=>793,71=>794,72=>816,73=>823,74=>789,75=>841,76=>823,
77=>833,78=>816,79=>831,80=>923,81=>744,82=>723,83=>749,84=>790,85=>792,86=>695,
87=>776,88=>768,89=>792,90=>759,91=>707,92=>708,93=>682,94=>701,95=>826,96=>815,
97=>789,98=>789,99=>707,100=>687,101=>696,102=>689,103=>786,104=>787,105=>713,
106=>791,107=>785,108=>791,109=>873,110=>761,111=>762,112=>762,113=>759,114=>759,
115=>892,116=>892,117=>788,118=>784,119=>438,120=>138,121=>277,122=>415,123=>392,
124=>392,125=>668,126=>668,127=>0,128=>390,129=>390,130=>317,131=>317,132=>276,
133=>276,134=>509,135=>509,136=>410,137=>410,138=>234,139=>234,140=>334,141=>334,
142=>0,143=>0,144=>0,145=>0,146=>0,147=>0,148=>0,149=>0,150=>0,151=>0,152=>0,
153=>0,154=>0,155=>0,156=>0,157=>0,158=>0,159=>0,160=>0,161=>732,162=>544,163=>544,
164=>910,165=>667,166=>760,167=>760,168=>776,169=>595,170=>694,171=>626,172=>788,
173=>788,174=>788,175=>788,176=>788,177=>788,178=>788,179=>788,180=>788,181=>788,
182=>788,183=>788,184=>788,185=>788,186=>788,187=>788,188=>788,189=>788,190=>788,
191=>788,192=>788,193=>788,194=>788,195=>788,196=>788,197=>788,198=>788,199=>788,
200=>788,201=>788,202=>788,203=>788,204=>788,205=>788,206=>788,207=>788,208=>788,
209=>788,210=>788,211=>788,212=>894,213=>838,214=>1016,215=>458,216=>748,217=>924,
218=>748,219=>918,220=>927,221=>928,222=>928,223=>834,224=>873,225=>828,226=>924,
227=>924,228=>917,229=>930,230=>931,231=>463,232=>883,233=>836,234=>836,235=>867,
236=>867,237=>696,238=>696,239=>874,240=>0,241=>874,242=>760,243=>946,244=>771,
245=>865,246=>771,247=>888,248=>967,249=>888,250=>831,251=>873,252=>927,253=>970,
254=>918,255=>0);
// --- EOF ---
<?php
// core font definition file for TCPDF (www.tcpdf.org)
$type='core';
$dw=788;
$cw=array(0=>0,1=>0,2=>0,3=>0,4=>0,5=>0,6=>0,7=>0,8=>0,9=>0,10=>0,11=>0,12=>0,
13=>0,14=>0,15=>0,16=>0,17=>0,18=>0,19=>0,20=>0,21=>0,22=>0,23=>0,24=>0,25=>0,
26=>0,27=>0,28=>0,29=>0,30=>0,31=>0,32=>278,33=>974,34=>961,35=>974,36=>980,
37=>719,38=>789,39=>790,40=>791,41=>690,42=>960,43=>939,44=>549,45=>855,46=>911,
47=>933,48=>911,49=>945,50=>974,51=>755,52=>846,53=>762,54=>761,55=>571,56=>677,
57=>763,58=>760,59=>759,60=>754,61=>494,62=>552,63=>537,64=>577,65=>692,66=>786,
67=>788,68=>788,69=>790,70=>793,71=>794,72=>816,73=>823,74=>789,75=>841,76=>823,
77=>833,78=>816,79=>831,80=>923,81=>744,82=>723,83=>749,84=>790,85=>792,86=>695,
87=>776,88=>768,89=>792,90=>759,91=>707,92=>708,93=>682,94=>701,95=>826,96=>815,
97=>789,98=>789,99=>707,100=>687,101=>696,102=>689,103=>786,104=>787,105=>713,
106=>791,107=>785,108=>791,109=>873,110=>761,111=>762,112=>762,113=>759,114=>759,
115=>892,116=>892,117=>788,118=>784,119=>438,120=>138,121=>277,122=>415,123=>392,
124=>392,125=>668,126=>668,127=>0,128=>390,129=>390,130=>317,131=>317,132=>276,
133=>276,134=>509,135=>509,136=>410,137=>410,138=>234,139=>234,140=>334,141=>334,
142=>0,143=>0,144=>0,145=>0,146=>0,147=>0,148=>0,149=>0,150=>0,151=>0,152=>0,
153=>0,154=>0,155=>0,156=>0,157=>0,158=>0,159=>0,160=>0,161=>732,162=>544,163=>544,
164=>910,165=>667,166=>760,167=>760,168=>776,169=>595,170=>694,171=>626,172=>788,
173=>788,174=>788,175=>788,176=>788,177=>788,178=>788,179=>788,180=>788,181=>788,
182=>788,183=>788,184=>788,185=>788,186=>788,187=>788,188=>788,189=>788,190=>788,
191=>788,192=>788,193=>788,194=>788,195=>788,196=>788,197=>788,198=>788,199=>788,
200=>788,201=>788,202=>788,203=>788,204=>788,205=>788,206=>788,207=>788,208=>788,
209=>788,210=>788,211=>788,212=>894,213=>838,214=>1016,215=>458,216=>748,217=>924,
218=>748,219=>918,220=>927,221=>928,222=>928,223=>834,224=>873,225=>828,226=>924,
227=>924,228=>917,229=>930,230=>931,231=>463,232=>883,233=>836,234=>836,235=>867,
236=>867,237=>696,238=>696,239=>874,240=>0,241=>874,242=>760,243=>946,244=>771,
245=>865,246=>771,247=>888,248=>967,249=>888,250=>831,251=>873,252=>927,253=>970,
254=>918,255=>0);
// --- EOF ---
@@ -1,47 +1,47 @@
<?php
/* Mohammad Ali Golkar
m.a.golkar@gmail.com
http://www.30minonline.com
LICENSE : GPLv2 */
$type='TrueTypeUnicode';
$name='ZarBold';
$desc=array('Ascent'=>733,'Descent'=>-317,'CapHeight'=>733,'Flags'=>32,'FontBBox'=>'[-126 -535 1164 1046]','ItalicAngle'=>0,'StemV'=>120,'MissingWidth'=>600);
$up=-356;
$ut=49;
$dw=600;
$cw=array(
0=>0,32=>227,33=>235,34=>282,35=>667,36=>458,37=>493,38=>635,39=>156,40=>303,41=>303,42=>489,43=>489,44=>237,45=>489,46=>231,47=>277,
48=>552,49=>552,50=>552,51=>552,52=>552,53=>552,54=>552,55=>552,56=>552,57=>552,58=>231,59=>237,60=>667,61=>489,62=>667,63=>448,
64=>917,65=>604,66=>542,67=>615,68=>708,69=>479,70=>427,71=>667,72=>688,73=>302,74=>292,75=>583,76=>469,77=>885,78=>677,79=>729,
80=>479,81=>729,82=>542,83=>448,84=>521,85=>677,86=>615,87=>969,88=>604,89=>583,90=>594,91=>208,92=>510,93=>208,94=>469,95=>500,
96=>333,97=>469,98=>510,99=>448,100=>521,101=>438,102=>313,103=>500,104=>552,105=>271,106=>260,107=>500,108=>271,109=>802,110=>552,111=>490,
112=>531,113=>521,114=>396,115=>365,116=>292,117=>552,118=>479,119=>750,120=>521,121=>469,122=>448,123=>479,124=>510,125=>479,126=>667,8218=>240,
402=>531,8222=>458,8230=>1000,8224=>438,8225=>438,710=>333,8240=>1010,352=>448,8249=>250,338=>865,8216=>240,8217=>240,8220=>317,8221=>317,8226=>281,8211=>500,
8212=>1000,8482=>906,353=>365,8250=>250,339=>823,376=>583,160=>244,161=>317,162=>448,163=>583,164=>500,165=>583,166=>200,167=>417,168=>333,169=>765,
170=>313,171=>417,172=>667,173=>564,174=>765,175=>333,176=>375,177=>462,178=>354,179=>354,180=>333,181=>510,182=>438,183=>198,184=>333,185=>354,
186=>323,187=>417,188=>854,189=>854,190=>854,191=>448,192=>604,711=>333,215=>462,224=>469,226=>469,231=>448,232=>438,233=>438,234=>438,235=>438,
238=>271,239=>271,244=>490,305=>271,247=>483,249=>552,251=>552,252=>552,255=>469,9249=>781,1548=>237,1563=>237,1567=>340,1569=>426,1570=>416,1571=>238,
1572=>429,1573=>260,1574=>817,1575=>238,1576=>853,1577=>439,1578=>853,1579=>853,1580=>720,1581=>720,1582=>720,1583=>485,1584=>485,1585=>423,1586=>423,1587=>1016,
1588=>1016,1589=>1128,1590=>1128,1591=>794,1592=>794,1593=>685,1594=>685,1600=>371,1601=>840,1602=>696,1603=>1148,1604=>744,1605=>514,1606=>686,1607=>439,1608=>429,
1609=>817,1610=>817,1611=>0,1612=>0,1613=>0,1614=>0,1615=>0,1616=>0,1617=>0,1618=>0,1632=>479,1633=>479,1634=>479,1635=>479,1636=>479,1637=>479,
1638=>479,1639=>479,1640=>479,1641=>483,1642=>493,1645=>563,1648=>227,1649=>363,1652=>227,1662=>853,1670=>720,1688=>423,1700=>840,1705=>1148,1711=>1149,1740=>817,
1749=>439,1764=>227,1776=>479,1777=>479,1778=>479,1779=>479,1780=>479,1781=>479,1782=>479,1783=>479,1784=>479,1785=>483,8204=>22,8205=>22,8206=>22,8207=>22,
59424=>227,59425=>227,59426=>227,59427=>227,59428=>227,59429=>227,59430=>227,59431=>227,59432=>227,59433=>227,59434=>227,59435=>227,59436=>227,59416=>227,59437=>227,59442=>227,
59443=>227,59444=>227,59445=>227,59446=>227,64336=>363,64337=>263,64342=>853,64343=>967,64344=>267,64345=>271,64362=>840,64363=>959,64364=>305,64365=>341,64378=>720,64379=>725,
64380=>630,64381=>652,64394=>423,64395=>450,64398=>1148,64399=>1089,64400=>522,64401=>461,64402=>1149,64403=>1084,64404=>525,64405=>462,64508=>817,64509=>784,64606=>227,64607=>227,
64608=>227,64609=>227,64610=>227,64754=>371,64755=>371,64756=>371,64828=>331,64829=>276,64830=>303,64831=>303,65010=>866,65136=>227,65137=>371,65138=>227,65140=>227,65142=>227,
65143=>371,65144=>227,65145=>371,65146=>227,65147=>371,65148=>227,65149=>371,65150=>227,65151=>371,65152=>426,65153=>416,65154=>354,65155=>238,65156=>282,65157=>429,65158=>507,
65159=>260,65160=>286,65161=>817,65162=>784,65163=>190,65164=>276,65165=>238,65166=>263,65167=>853,65168=>967,65169=>186,65170=>271,65171=>439,65172=>452,65173=>853,65174=>967,
65175=>256,65176=>271,65177=>853,65178=>967,65179=>267,65180=>271,65181=>720,65182=>725,65183=>630,65184=>652,65185=>720,65186=>725,65187=>630,65188=>652,65189=>720,65190=>725,
65191=>630,65192=>652,65193=>485,65194=>608,65195=>485,65196=>608,65197=>423,65198=>450,65199=>423,65200=>450,65201=>1016,65202=>1041,65203=>498,65204=>475,65205=>1016,65206=>1041,
65207=>498,65208=>475,65209=>1128,65210=>1150,65211=>633,65212=>655,65213=>1128,65214=>1150,65215=>633,65216=>655,65217=>794,65218=>814,65219=>566,65220=>588,65221=>794,65222=>814,
65223=>566,65224=>588,65225=>685,65226=>655,65227=>414,65228=>330,65229=>685,65230=>655,65231=>414,65232=>330,65233=>840,65234=>959,65235=>305,65236=>341,65237=>696,65238=>780,
65239=>305,65240=>341,65241=>1148,65242=>1089,65243=>522,65244=>461,65245=>744,65246=>741,65247=>202,65248=>259,65249=>514,65250=>585,65251=>345,65252=>477,65253=>686,65254=>764,
65255=>186,65256=>271,65257=>439,65258=>452,65259=>501,65260=>381,65261=>429,65262=>507,65263=>817,65264=>784,65265=>817,65266=>784,64510=>265,64511=>271,65269=>610,65270=>652,
65271=>539,65272=>611,65273=>539,65274=>611,65275=>539,65276=>611,65279=>0,64486=>408,64487=>408);
$enc='';
$diff='';
$file='zarbold.z';
$ctg='zarbold.ctg.z';
$originalsize=73296;
// --- EOF ---
<?php
/* Mohammad Ali Golkar
m.a.golkar@gmail.com
http://www.30minonline.com
LICENSE : GPLv2 */
$type='TrueTypeUnicode';
$name='ZarBold';
$desc=array('Ascent'=>733,'Descent'=>-317,'CapHeight'=>733,'Flags'=>32,'FontBBox'=>'[-126 -535 1164 1046]','ItalicAngle'=>0,'StemV'=>120,'MissingWidth'=>600);
$up=-356;
$ut=49;
$dw=600;
$cw=array(
0=>0,32=>227,33=>235,34=>282,35=>667,36=>458,37=>493,38=>635,39=>156,40=>303,41=>303,42=>489,43=>489,44=>237,45=>489,46=>231,47=>277,
48=>552,49=>552,50=>552,51=>552,52=>552,53=>552,54=>552,55=>552,56=>552,57=>552,58=>231,59=>237,60=>667,61=>489,62=>667,63=>448,
64=>917,65=>604,66=>542,67=>615,68=>708,69=>479,70=>427,71=>667,72=>688,73=>302,74=>292,75=>583,76=>469,77=>885,78=>677,79=>729,
80=>479,81=>729,82=>542,83=>448,84=>521,85=>677,86=>615,87=>969,88=>604,89=>583,90=>594,91=>208,92=>510,93=>208,94=>469,95=>500,
96=>333,97=>469,98=>510,99=>448,100=>521,101=>438,102=>313,103=>500,104=>552,105=>271,106=>260,107=>500,108=>271,109=>802,110=>552,111=>490,
112=>531,113=>521,114=>396,115=>365,116=>292,117=>552,118=>479,119=>750,120=>521,121=>469,122=>448,123=>479,124=>510,125=>479,126=>667,8218=>240,
402=>531,8222=>458,8230=>1000,8224=>438,8225=>438,710=>333,8240=>1010,352=>448,8249=>250,338=>865,8216=>240,8217=>240,8220=>317,8221=>317,8226=>281,8211=>500,
8212=>1000,8482=>906,353=>365,8250=>250,339=>823,376=>583,160=>244,161=>317,162=>448,163=>583,164=>500,165=>583,166=>200,167=>417,168=>333,169=>765,
170=>313,171=>417,172=>667,173=>564,174=>765,175=>333,176=>375,177=>462,178=>354,179=>354,180=>333,181=>510,182=>438,183=>198,184=>333,185=>354,
186=>323,187=>417,188=>854,189=>854,190=>854,191=>448,192=>604,711=>333,215=>462,224=>469,226=>469,231=>448,232=>438,233=>438,234=>438,235=>438,
238=>271,239=>271,244=>490,305=>271,247=>483,249=>552,251=>552,252=>552,255=>469,9249=>781,1548=>237,1563=>237,1567=>340,1569=>426,1570=>416,1571=>238,
1572=>429,1573=>260,1574=>817,1575=>238,1576=>853,1577=>439,1578=>853,1579=>853,1580=>720,1581=>720,1582=>720,1583=>485,1584=>485,1585=>423,1586=>423,1587=>1016,
1588=>1016,1589=>1128,1590=>1128,1591=>794,1592=>794,1593=>685,1594=>685,1600=>371,1601=>840,1602=>696,1603=>1148,1604=>744,1605=>514,1606=>686,1607=>439,1608=>429,
1609=>817,1610=>817,1611=>0,1612=>0,1613=>0,1614=>0,1615=>0,1616=>0,1617=>0,1618=>0,1632=>479,1633=>479,1634=>479,1635=>479,1636=>479,1637=>479,
1638=>479,1639=>479,1640=>479,1641=>483,1642=>493,1645=>563,1648=>227,1649=>363,1652=>227,1662=>853,1670=>720,1688=>423,1700=>840,1705=>1148,1711=>1149,1740=>817,
1749=>439,1764=>227,1776=>479,1777=>479,1778=>479,1779=>479,1780=>479,1781=>479,1782=>479,1783=>479,1784=>479,1785=>483,8204=>22,8205=>22,8206=>22,8207=>22,
59424=>227,59425=>227,59426=>227,59427=>227,59428=>227,59429=>227,59430=>227,59431=>227,59432=>227,59433=>227,59434=>227,59435=>227,59436=>227,59416=>227,59437=>227,59442=>227,
59443=>227,59444=>227,59445=>227,59446=>227,64336=>363,64337=>263,64342=>853,64343=>967,64344=>267,64345=>271,64362=>840,64363=>959,64364=>305,64365=>341,64378=>720,64379=>725,
64380=>630,64381=>652,64394=>423,64395=>450,64398=>1148,64399=>1089,64400=>522,64401=>461,64402=>1149,64403=>1084,64404=>525,64405=>462,64508=>817,64509=>784,64606=>227,64607=>227,
64608=>227,64609=>227,64610=>227,64754=>371,64755=>371,64756=>371,64828=>331,64829=>276,64830=>303,64831=>303,65010=>866,65136=>227,65137=>371,65138=>227,65140=>227,65142=>227,
65143=>371,65144=>227,65145=>371,65146=>227,65147=>371,65148=>227,65149=>371,65150=>227,65151=>371,65152=>426,65153=>416,65154=>354,65155=>238,65156=>282,65157=>429,65158=>507,
65159=>260,65160=>286,65161=>817,65162=>784,65163=>190,65164=>276,65165=>238,65166=>263,65167=>853,65168=>967,65169=>186,65170=>271,65171=>439,65172=>452,65173=>853,65174=>967,
65175=>256,65176=>271,65177=>853,65178=>967,65179=>267,65180=>271,65181=>720,65182=>725,65183=>630,65184=>652,65185=>720,65186=>725,65187=>630,65188=>652,65189=>720,65190=>725,
65191=>630,65192=>652,65193=>485,65194=>608,65195=>485,65196=>608,65197=>423,65198=>450,65199=>423,65200=>450,65201=>1016,65202=>1041,65203=>498,65204=>475,65205=>1016,65206=>1041,
65207=>498,65208=>475,65209=>1128,65210=>1150,65211=>633,65212=>655,65213=>1128,65214=>1150,65215=>633,65216=>655,65217=>794,65218=>814,65219=>566,65220=>588,65221=>794,65222=>814,
65223=>566,65224=>588,65225=>685,65226=>655,65227=>414,65228=>330,65229=>685,65230=>655,65231=>414,65232=>330,65233=>840,65234=>959,65235=>305,65236=>341,65237=>696,65238=>780,
65239=>305,65240=>341,65241=>1148,65242=>1089,65243=>522,65244=>461,65245=>744,65246=>741,65247=>202,65248=>259,65249=>514,65250=>585,65251=>345,65252=>477,65253=>686,65254=>764,
65255=>186,65256=>271,65257=>439,65258=>452,65259=>501,65260=>381,65261=>429,65262=>507,65263=>817,65264=>784,65265=>817,65266=>784,64510=>265,64511=>271,65269=>610,65270=>652,
65271=>539,65272=>611,65273=>539,65274=>611,65275=>539,65276=>611,65279=>0,64486=>408,64487=>408);
$enc='';
$diff='';
$file='zarbold.z';
$ctg='zarbold.ctg.z';
$originalsize=73296;
// --- EOF ---
+337 -337
View File
@@ -1,337 +1,337 @@
<?php
require_once('tcpdf.php');
class MyPDF extends TCPDF
{
function MyPDF($orientation='P', $unit='mm', $format='A4')
{
parent::__construct($orientation,$unit,$format);
$this->SetAutoPageBreak(true,10);
$this->AliasNbPages();
}
/**
*
* obsolete
* @param $text
* @param $format
* @return unknown_type
*/
function intopdf($text,$format='')
{
$text = $this->delete_html($text);
$oldformat = $this->FontStyle;
$this->SetFont('',$format,$this->FontSizePt);
$this->Write(5,$text);
$this->ln(5);
$this->SetFont('',$oldformat,$this->FontSizePt);
}
/**
*
* obsolete
* @param $text
* @return unknown_type
*/
function helptextintopdf($text)
{
$oldsize = $this->FontSizePt;
$this->SetFontSize($oldsize-2);
$this->Write(5,$this->delete_html($text));
$this->ln(5);
$this->SetFontSize($oldsize);
}
/**
*
* writes a big title in the page + description
* @param $title
* @param $description
* @return unknown_type
*/
function titleintopdf($title,$description='')
{
if(!empty($title))
{
$title = $this->delete_html($title);
$oldsize = $this->FontSizePt;
$this->SetFontSize($oldsize+4);
$this->Line(5,$this->y,($this->w-5),$this->y);
$this->ln(3);
$this->MultiCell('','',$title,'','C',0);
if(!empty($description) && isset($description))
{
$description = $this->delete_html($description);
$this->ln(7);
$this->SetFontSize($oldsize+2);
$this->MultiCell('','',$description,'','C',0);
$this->ln(2);
}
else
{
$this->ln(4);
}
$this->Line(5,$this->y,($this->w-5),$this->y);
$this->ln(5);
$this->SetFontSize($oldsize);
}
}
/**
*
* Creates a Table with equal cell width and Bold text. Used as Head for equalTable()
* @param $array(0=>)
* @return unknown_type
*/
function tablehead($array)
{
//$maxwidth = array();
$maxwidth = $this->getEqualWidth($array);
$oldStyle = $this->FontStyle;
$this->SetFont($this->FontFamily, 'B', $this->FontSizePt);
for($a=0;$a<sizeof($array);$a++)
{
for($b=0;$b<sizeof($array[$a]);$b++)
{
$this->Cell($maxwidth,4,$this->delete_html($array[$a][$b]),0,0,'L');
}
$this->ln();
}
$this->ln(5);
$this->SetFont($this->FontFamily, $oldStyle, $this->FontSizePt);
}
/**
*
* Creates a Table with equal cell width.
* @param $array - table array( 0=> array("td", "td", "td"),
* 1=> array("td", "td", "td"))
* @param $modulo - fills each second row with a light-grey for better visibility. Default is on turn off with 0
* @return unknown_type
*/
function equalTable($array, $modulo=1)
{
//$maxwidth = array();
$maxwidth = $this->getEqualWidth($array);
$this->SetFillColor(220, 220, 220);
for($a=0;$a<sizeof($array);$a++)
{
if($modulo){
if($a%2 === 0){$fill=0;}
else{$fill=1;}
}
else{$fill=0;}
for($b=0;$b<sizeof($array[$a]);$b++)
{
$this->Cell($maxwidth,4,$this->delete_html($array[$a][$b]),0,0,'L',$fill);
}
$this->ln();
}
$this->ln(5);
}
/**
*
* creates a table using the full width of page
* @param $array - table array( 0=> array("td", "td", "td"),
* 1=> array("td", "td", "td"))
* @param $modulo - fills each second row with a light-grey for better visibility. Default is off, turn on with 1
* @return unknown_type
*/
function tableintopdf($array, $modulo=1 )
{
$maxwidth = array();
$maxwidth = $this->getFullWidth($array);
$this->SetFillColor(220, 220, 220);
for($a=0;$a<sizeof($array);$a++)
{
if($modulo){
if($a%2 === 0){$fill=0;}
else{$fill=1;}
}
else{$fill=0;}
for($b=0;$b<sizeof($array[$a]);$b++)
{
//echo $maxwidth[$b]." max $b.Spalte<br/>";
$this->Cell($maxwidth[$b],4,$this->delete_html($array[$a][$b]),0,0,'L',$fill);
}
$this->ln();
}
$this->ln(5);
}
/**
*
* creates a table with a bold head using the full width of page
* @param $head - head array( 0=> array("th", "th", "th"))
* @param $table - table array( 0=> array("td", "td", "td"),
* 1=> array("td", "td", "td"))
* @param $modulo - fills each second row with a light-grey for better visibility. Default is on, turn off with 0
* @return unknown_type
*/
function headTable($head, $table, $modulo=1 )
{
$array = array_merge_recursive($head, $table);
//print_r($array);
$maxwidth = array();
$maxwidth = $this->getFullWidth($array);
$this->SetFillColor(220, 220, 220);
for($a=0;$a<sizeof($array);$a++)
{
if($modulo){
if($a%2 === 0){$fill=1;}
else{$fill=0;}
}
else{$fill=0;}
for($b=0;$b<sizeof($array[$a]);$b++)
{
$bEndOfCell=0;
if ($b==sizeof($array[$a])-1)
{
$bEndOfCell=1;
}
if($a==0)
{
$oldStyle = $this->FontStyle;
$this->SetFont($this->FontFamily, 'B', $this->FontSizePt);
if ($maxwidth[$b] > 140) $maxwidth[$b]=130;
if ($maxwidth[$b] < 20) $maxwidth[$b]=20;
$this->MultiCell($maxwidth[$b],6,$this->delete_html($array[$a][$b]),0,'L',1,$bEndOfCell);
$this->SetFont($this->FontFamily, $oldStyle, $this->FontSizePt);
}
else
{
if ($a==1)
{
$this->SetFillColor(250, 250, 250);
}
//echo $maxwidth[$b]." max $b.Spalte<br/>";
if ($maxwidth[$b] > 140) $maxwidth[$b]=130;
if ($b==0)
{
$iLines=$this->MultiCell($maxwidth[$b],6,$this->delete_html($array[$a][$b]),0,'L',$fill,$bEndOfCell);
}
else
{
$this->MultiCell($maxwidth[$b],$iLines,$this->delete_html($array[$a][$b]),0,'L',$fill,$bEndOfCell);
}
}
}
}
$this->ln(5);
}
function getminwidth($array)
{
$width = array();
for($i=0;$i<sizeof($array);$i++)
{
for($j=0;$j<sizeof($array[$i]);$j++)
{
$stringWidth=0;
$chars = str_split($this->delete_html($array[$i][$j]),1);
foreach($chars as $char)
{
$stringWidth = $stringWidth+$this->GetCharWidth($char);
//echo $stringWidth.": ".$char."<br/>";
}
if($stringWidth!=0 && $stringWidth<8)
$stringWidth = $stringWidth*3;
if(!isset($width[$j])|| $stringWidth>$width[$j])
{
$width[$j] = $stringWidth;
}
}
}
return $width;
}
function getmaxwidth($array)
{
for($i=0;$i<sizeof($array);$i++)
{
for($j=0;$j<sizeof($array[$i]);$j++)
{
if(($i-1)>=0)
{
if(strlen($this->delete_html($array[($i-1)][$j])) < strlen($this->delete_html($array[$i][$j])))
{
$width[$j] = strlen($this->delete_html($array[$i][$j]));
}
}
else
{
$width[$j]=strlen($this->delete_html($array[$i][$j]));
}
}
}
return ($width);
}
/**
*
* Gets the width for columns in a table based on their Stringlength and the width of the page...
* @param $array
* @return array with column width
*/
function getFullWidth($array)
{
$maxlength = array();
$width = array();
$width = $this->getminwidth($array);
$margins = $this->getMargins();
$deadSpace = $margins['left']+$margins['right'];
$fullWidth = ($this->GetLineWidth()*1000)-$deadSpace;
$faktor = $fullWidth/array_sum($width);
for($i=0;$i<sizeof($width);$i++)
{
$maxlength[$i]=$faktor*$width[$i];
}
return $maxlength;
}
/**
*
* gets the width for each column in tables, based on pagewidth and count of columns.
* Good for static tables with equal value String-length
* @param $array
* @return unknown_type
*/
function getEqualWidth($array)
{
$margins = $this->getMargins();
$deadSpace = $margins['left']+$margins['right'];
$width = ($this->GetLineWidth()*1000)-$deadSpace;
$count = 0;
for($i=0;$i<sizeof($array);$i++)
{
for($j=0;$j<sizeof($array[$i]);$j++)
{
if(sizeof($array[$i])>$count)
{
$count = sizeof($array[$i]);
}
}
}
if($count!=0)
return ($width/$count);
else
return FALSE;
}
function write_out($name)
{
$this->Output($name,"D");
}
function delete_html($text)
{
$text = html_entity_decode($text);
return strip_tags($text);
}
}
?>
<?php
require_once('tcpdf.php');
class MyPDF extends TCPDF
{
function MyPDF($orientation='P', $unit='mm', $format='A4')
{
parent::__construct($orientation,$unit,$format);
$this->SetAutoPageBreak(true,10);
$this->AliasNbPages();
}
/**
*
* obsolete
* @param $text
* @param $format
* @return unknown_type
*/
function intopdf($text,$format='')
{
$text = $this->delete_html($text);
$oldformat = $this->FontStyle;
$this->SetFont('',$format,$this->FontSizePt);
$this->Write(5,$text);
$this->ln(5);
$this->SetFont('',$oldformat,$this->FontSizePt);
}
/**
*
* obsolete
* @param $text
* @return unknown_type
*/
function helptextintopdf($text)
{
$oldsize = $this->FontSizePt;
$this->SetFontSize($oldsize-2);
$this->Write(5,$this->delete_html($text));
$this->ln(5);
$this->SetFontSize($oldsize);
}
/**
*
* writes a big title in the page + description
* @param $title
* @param $description
* @return unknown_type
*/
function titleintopdf($title,$description='')
{
if(!empty($title))
{
$title = $this->delete_html($title);
$oldsize = $this->FontSizePt;
$this->SetFontSize($oldsize+4);
$this->Line(5,$this->y,($this->w-5),$this->y);
$this->ln(3);
$this->MultiCell('','',$title,'','C',0);
if(!empty($description) && isset($description))
{
$description = $this->delete_html($description);
$this->ln(7);
$this->SetFontSize($oldsize+2);
$this->MultiCell('','',$description,'','C',0);
$this->ln(2);
}
else
{
$this->ln(4);
}
$this->Line(5,$this->y,($this->w-5),$this->y);
$this->ln(5);
$this->SetFontSize($oldsize);
}
}
/**
*
* Creates a Table with equal cell width and Bold text. Used as Head for equalTable()
* @param $array(0=>)
* @return unknown_type
*/
function tablehead($array)
{
//$maxwidth = array();
$maxwidth = $this->getEqualWidth($array);
$oldStyle = $this->FontStyle;
$this->SetFont($this->FontFamily, 'B', $this->FontSizePt);
for($a=0;$a<sizeof($array);$a++)
{
for($b=0;$b<sizeof($array[$a]);$b++)
{
$this->Cell($maxwidth,4,$this->delete_html($array[$a][$b]),0,0,'L');
}
$this->ln();
}
$this->ln(5);
$this->SetFont($this->FontFamily, $oldStyle, $this->FontSizePt);
}
/**
*
* Creates a Table with equal cell width.
* @param $array - table array( 0=> array("td", "td", "td"),
* 1=> array("td", "td", "td"))
* @param $modulo - fills each second row with a light-grey for better visibility. Default is on turn off with 0
* @return unknown_type
*/
function equalTable($array, $modulo=1)
{
//$maxwidth = array();
$maxwidth = $this->getEqualWidth($array);
$this->SetFillColor(220, 220, 220);
for($a=0;$a<sizeof($array);$a++)
{
if($modulo){
if($a%2 === 0){$fill=0;}
else{$fill=1;}
}
else{$fill=0;}
for($b=0;$b<sizeof($array[$a]);$b++)
{
$this->Cell($maxwidth,4,$this->delete_html($array[$a][$b]),0,0,'L',$fill);
}
$this->ln();
}
$this->ln(5);
}
/**
*
* creates a table using the full width of page
* @param $array - table array( 0=> array("td", "td", "td"),
* 1=> array("td", "td", "td"))
* @param $modulo - fills each second row with a light-grey for better visibility. Default is off, turn on with 1
* @return unknown_type
*/
function tableintopdf($array, $modulo=1 )
{
$maxwidth = array();
$maxwidth = $this->getFullWidth($array);
$this->SetFillColor(220, 220, 220);
for($a=0;$a<sizeof($array);$a++)
{
if($modulo){
if($a%2 === 0){$fill=0;}
else{$fill=1;}
}
else{$fill=0;}
for($b=0;$b<sizeof($array[$a]);$b++)
{
//echo $maxwidth[$b]." max $b.Spalte<br/>";
$this->Cell($maxwidth[$b],4,$this->delete_html($array[$a][$b]),0,0,'L',$fill);
}
$this->ln();
}
$this->ln(5);
}
/**
*
* creates a table with a bold head using the full width of page
* @param $head - head array( 0=> array("th", "th", "th"))
* @param $table - table array( 0=> array("td", "td", "td"),
* 1=> array("td", "td", "td"))
* @param $modulo - fills each second row with a light-grey for better visibility. Default is on, turn off with 0
* @return unknown_type
*/
function headTable($head, $table, $modulo=1 )
{
$array = array_merge_recursive($head, $table);
//print_r($array);
$maxwidth = array();
$maxwidth = $this->getFullWidth($array);
$this->SetFillColor(220, 220, 220);
for($a=0;$a<sizeof($array);$a++)
{
if($modulo){
if($a%2 === 0){$fill=1;}
else{$fill=0;}
}
else{$fill=0;}
for($b=0;$b<sizeof($array[$a]);$b++)
{
$bEndOfCell=0;
if ($b==sizeof($array[$a])-1)
{
$bEndOfCell=1;
}
if($a==0)
{
$oldStyle = $this->FontStyle;
$this->SetFont($this->FontFamily, 'B', $this->FontSizePt);
if ($maxwidth[$b] > 140) $maxwidth[$b]=130;
if ($maxwidth[$b] < 20) $maxwidth[$b]=20;
$this->MultiCell($maxwidth[$b],6,$this->delete_html($array[$a][$b]),0,'L',1,$bEndOfCell);
$this->SetFont($this->FontFamily, $oldStyle, $this->FontSizePt);
}
else
{
if ($a==1)
{
$this->SetFillColor(250, 250, 250);
}
//echo $maxwidth[$b]." max $b.Spalte<br/>";
if ($maxwidth[$b] > 140) $maxwidth[$b]=130;
if ($b==0)
{
$iLines=$this->MultiCell($maxwidth[$b],6,$this->delete_html($array[$a][$b]),0,'L',$fill,$bEndOfCell);
}
else
{
$this->MultiCell($maxwidth[$b],$iLines,$this->delete_html($array[$a][$b]),0,'L',$fill,$bEndOfCell);
}
}
}
}
$this->ln(5);
}
function getminwidth($array)
{
$width = array();
for($i=0;$i<sizeof($array);$i++)
{
for($j=0;$j<sizeof($array[$i]);$j++)
{
$stringWidth=0;
$chars = str_split($this->delete_html($array[$i][$j]),1);
foreach($chars as $char)
{
$stringWidth = $stringWidth+$this->GetCharWidth($char);
//echo $stringWidth.": ".$char."<br/>";
}
if($stringWidth!=0 && $stringWidth<8)
$stringWidth = $stringWidth*3;
if(!isset($width[$j])|| $stringWidth>$width[$j])
{
$width[$j] = $stringWidth;
}
}
}
return $width;
}
function getmaxwidth($array)
{
for($i=0;$i<sizeof($array);$i++)
{
for($j=0;$j<sizeof($array[$i]);$j++)
{
if(($i-1)>=0)
{
if(strlen($this->delete_html($array[($i-1)][$j])) < strlen($this->delete_html($array[$i][$j])))
{
$width[$j] = strlen($this->delete_html($array[$i][$j]));
}
}
else
{
$width[$j]=strlen($this->delete_html($array[$i][$j]));
}
}
}
return ($width);
}
/**
*
* Gets the width for columns in a table based on their Stringlength and the width of the page...
* @param $array
* @return array with column width
*/
function getFullWidth($array)
{
$maxlength = array();
$width = array();
$width = $this->getminwidth($array);
$margins = $this->getMargins();
$deadSpace = $margins['left']+$margins['right'];
$fullWidth = ($this->GetLineWidth()*1000)-$deadSpace;
$faktor = $fullWidth/array_sum($width);
for($i=0;$i<sizeof($width);$i++)
{
$maxlength[$i]=$faktor*$width[$i];
}
return $maxlength;
}
/**
*
* gets the width for each column in tables, based on pagewidth and count of columns.
* Good for static tables with equal value String-length
* @param $array
* @return unknown_type
*/
function getEqualWidth($array)
{
$margins = $this->getMargins();
$deadSpace = $margins['left']+$margins['right'];
$width = ($this->GetLineWidth()*1000)-$deadSpace;
$count = 0;
for($i=0;$i<sizeof($array);$i++)
{
for($j=0;$j<sizeof($array[$i]);$j++)
{
if(sizeof($array[$i])>$count)
{
$count = sizeof($array[$i]);
}
}
}
if($count!=0)
return ($width/$count);
else
return FALSE;
}
function write_out($name)
{
$this->Output($name,"D");
}
function delete_html($text)
{
$text = html_entity_decode($text);
return strip_tags($text);
}
}
?>
@@ -6234,10 +6234,10 @@ class TCPDF {
$this->y = $y;
$this->SetX($x + $w + $mc_margin['L'] + $mc_margin['R']);
}
$this->setContentMark();
$this->cell_padding = $prev_cell_padding;
$this->cell_margin = $prev_cell_margin;
return $currentY-$this->y;
$this->setContentMark();
$this->cell_padding = $prev_cell_padding;
$this->cell_margin = $prev_cell_margin;
return $currentY-$this->y;
}
/**
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: cmdline_importsurvey.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: cmdline_importsurvey.php 11607 2011-12-06 23:19:52Z tmswhite $
*/
File diff suppressed because it is too large Load Diff
@@ -1,13 +1,13 @@
<?php
$_SERVER['HTTP_HOST']="127.0.1.1";
include_once(dirname(__FILE__).'/../../config-defaults.php');
$use_firebug_lite="";
include_once(dirname(__FILE__).'/../../common.php');
include_once($rootdir.'/classes/core/language.php');
$cron='1';
$clang = new limesurvey_lang("en");
$_SESSION['loginID']='1';
$surveyidoriginal=$argv[1];
$subaction="bounceprocessing";
require_once(dirname(__FILE__).'/../bounceprocessing.php');
?>
<?php
$_SERVER['HTTP_HOST']="127.0.1.1";
include_once(dirname(__FILE__).'/../../config-defaults.php');
$use_firebug_lite="";
include_once(dirname(__FILE__).'/../../common.php');
include_once($rootdir.'/classes/core/language.php');
$cron='1';
$clang = new limesurvey_lang("en");
$_SESSION['loginID']='1';
$surveyidoriginal=$argv[1];
$subaction="bounceprocessing";
require_once(dirname(__FILE__).'/../bounceprocessing.php');
?>
+86 -71
View File
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: database.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: database.php 12242 2012-01-27 23:41:13Z c_schmitz $
*/
//Last security audit on 2009-10-11
@@ -75,8 +75,8 @@ if(isset($surveyid))
//Clean XSS
if ($filterxsshtml)
{
$_POST['group_name_'.$grouplang]=$myFilter->process($_POST['group_name_'.$grouplang]);
$_POST['description_'.$grouplang]=$myFilter->process($_POST['description_'.$grouplang]);
$_POST['group_name_'.$grouplang]=$myFilter->process(html_entity_decode($_POST['group_name_'.$grouplang], ENT_QUOTES, "UTF-8"));
$_POST['description_'.$grouplang]=$myFilter->process(html_entity_decode($_POST['description_'.$grouplang], ENT_QUOTES, "UTF-8"));
}
else
{
@@ -87,18 +87,19 @@ if(isset($surveyid))
// Fix bug with FCKEditor saving strange BR types
$_POST['group_name_'.$grouplang]=fix_FCKeditor_text($_POST['group_name_'.$grouplang]);
$_POST['description_'.$grouplang]=fix_FCKeditor_text($_POST['description_'.$grouplang]);
$grelevance = (isset($_POST['grelevance']) ? $_POST['grelevance'] : 1);
if ($first)
{
$query = "INSERT INTO ".db_table_name('groups')." (sid, group_name, description,group_order,language) VALUES ('".db_quote($postsid)."', '".db_quote($_POST['group_name_'.$grouplang])."', '".db_quote($_POST['description_'.$grouplang])."',".getMaxgrouporder(returnglobal('sid')).",'{$grouplang}')";
$query = "INSERT INTO ".db_table_name('groups')." (sid, group_name, description, grelevance, group_order, language) VALUES ('".db_quote($postsid)."', '".db_quote($_POST['group_name_'.$grouplang])."', '".db_quote($_POST['description_'.$grouplang])."','".db_quote($grelevance)."',".getMaxgrouporder(returnglobal('sid')).",'{$grouplang}')";
$result = $connect->Execute($query); // Checked
$groupid=$connect->Insert_Id(db_table_name_nq('groups'),"gid");
$first=false;
}
else{
db_switchIDInsert('groups',true);
$query = "INSERT INTO ".db_table_name('groups')." (gid, sid, group_name, description,group_order,language) VALUES ('{$groupid}','".db_quote($postsid)."', '".db_quote($_POST['group_name_'.$grouplang])."', '".db_quote($_POST['description_'.$grouplang])."',".getMaxgrouporder(returnglobal('sid')).",'{$grouplang}')";
$query = "INSERT INTO ".db_table_name('groups')." (gid, sid, group_name, description, grelevance, group_order, language) VALUES ('{$groupid}','".db_quote($postsid)."', '".db_quote($_POST['group_name_'.$grouplang])."', '".db_quote($_POST['description_'.$grouplang])."','".db_quote($grelevance)."',".getMaxgrouporder(returnglobal('sid')).",'{$grouplang}')";
$result = $connect->Execute($query) or safe_die("Error<br />".$query."<br />".$connect->ErrorMsg()); // Checked
db_switchIDInsert('groups',false);
}
@@ -147,7 +148,7 @@ if(isset($surveyid))
// don't use array_map db_quote on POST
// since this is iterated for each language
//$_POST = array_map('db_quote', $_POST);
$ugquery = "UPDATE ".db_table_name('groups')." SET group_name='".db_quote($_POST['group_name_'.$grplang])."', description='".db_quote($_POST['description_'.$grplang])."' WHERE sid=".db_quote($postsid)." AND gid=".db_quote($postgid)." AND language='{$grplang}'";
$ugquery = "UPDATE ".db_table_name('groups')." SET group_name='".db_quote($_POST['group_name_'.$grplang])."', description='".db_quote($_POST['description_'.$grplang])."', grelevance='".db_quote($_POST['grelevance'])."' WHERE sid=".db_quote($postsid)." AND gid=".db_quote($postgid)." AND language='{$grplang}'";
$ugresult = $connect->Execute($ugquery); // Checked
if ($ugresult)
{
@@ -166,6 +167,8 @@ if(isset($surveyid))
elseif ($action == "delgroup" && bHasSurveyPermission($surveyid, 'surveycontent','delete'))
{
LimeExpressionManager::RevertUpgradeConditionsToRelevance($surveyid);
if (!isset($gid)) $gid=returnglobal('gid');
$query = "SELECT qid FROM ".db_table_name('groups')." g, ".db_table_name('questions')." q WHERE g.gid=q.gid AND g.gid=$gid AND q.parent_qid=0 group by qid";
if ($result = db_execute_assoc($query)) // Checked
@@ -196,6 +199,7 @@ if(isset($surveyid))
{
$databaseoutput .= "<script type=\"text/javascript\">\n<!--\n alert(\"".$clang->gT("Group could not be deleted","js")."\n$error\")\n //-->\n</script>\n";
}
LimeExpressionManager::UpgradeConditionsToRelevance($surveyid);
}
elseif ($action == "insertquestion" && bHasSurveyPermission($surveyid, 'surveycontent','create'))
@@ -244,9 +248,9 @@ if(isset($surveyid))
$_POST['help_'.$baselang]=fix_FCKeditor_text($_POST['help_'.$baselang]);
$_POST = array_map('db_quote', $_POST);
$query = "INSERT INTO ".db_table_name('questions')." (sid, gid, type, title, question, preg, help, other, mandatory, question_order, language)"
$query = "INSERT INTO ".db_table_name('questions')." (sid, gid, type, title, question, preg, help, other, mandatory, question_order, relevance, language)"
." VALUES ('{$postsid}', '{$postgid}', '{$_POST['type']}', '{$_POST['title']}',"
." '{$_POST['question_'.$baselang]}', '{$_POST['preg']}', '{$_POST['help_'.$baselang]}', '{$_POST['other']}', '{$_POST['mandatory']}', $question_order,'{$baselang}')";
." '{$_POST['question_'.$baselang]}', '{$_POST['preg']}', '{$_POST['help_'.$baselang]}', '{$_POST['other']}', '{$_POST['mandatory']}', $question_order,'".db_quote($_POST['relevance'])."','{$baselang}')";
$result = $connect->Execute($query); // Checked
// Get the last inserted questionid for other languages
$qid=$connect->Insert_ID(db_table_name_nq('questions'),"qid");
@@ -304,13 +308,16 @@ if(isset($surveyid))
//include("surveytable_functions.php");
//surveyFixColumns($surveyid);
}
LimeExpressionManager::SetDirtyFlag(); // so refreshes syntax highlighting
}
elseif ($action == "renumberquestions" && bHasSurveyPermission($surveyid, 'surveycontent','update'))
{
//Automatically renumbers the "question codes" so that they follow
//a methodical numbering method
$style = ((isset($_POST['style']) && $_POST['style']=="bygroup") ? 'bygroup' : 'straight');
$question_number=1;
$group_number=0;
$gseq=0;
$gselect="SELECT a.qid, a.gid\n"
."FROM ".db_table_name('questions')." as a, ".db_table_name('groups')."\n"
."WHERE a.gid=".db_table_name('groups').".gid AND a.sid=$surveyid AND a.parent_qid=0 "
@@ -322,13 +329,16 @@ if(isset($surveyid))
foreach($grows as $grow)
{
//Go through all the questions
if ((isset($_POST['style']) && $_POST['style']=="bygroup") && (!isset($group_number) || $group_number != $grow['gid']))
if ($style == 'bygroup' && (!isset($group_number) || $group_number != $grow['gid']))
{ //If we're doing this by group, restart the numbering when the group number changes
$question_number=1;
$group_number++;
$group_number = $grow['gid'];
$gseq++;
}
$usql="UPDATE ".db_table_name('questions')."\n"
."SET title='".str_pad($question_number, 4, "0", STR_PAD_LEFT)."'\n"
."SET title='"
.(($style == 'bygroup') ? ('G' . $gseq . '_') : '')
."Q".str_pad($question_number, 4, "0", STR_PAD_LEFT)."'\n"
."WHERE qid=".$grow['qid'];
//$databaseoutput .= "[$sql]";
$uresult=$connect->Execute($usql) or safe_die("Error: ".$connect->ErrorMsg()); // Checked
@@ -336,7 +346,8 @@ if(isset($surveyid))
$group_number=$grow['gid'];
}
$_SESSION['flashmessage'] = $clang->gT("Question codes were successfully regenerated.");
}
LimeExpressionManager::SetDirtyFlag(); // so refreshes syntax highlighting
}
elseif ($action == "updatedefaultvalues" && bHasSurveyPermission($surveyid, 'surveycontent','update'))
@@ -408,12 +419,25 @@ if(isset($surveyid))
}
}
}
if ($qtproperties[$questiontype]['answerscales']==0 && $qtproperties[$questiontype]['subquestions']==0)
{
foreach ($questlangs as $language)
{
if (isset($_POST['defaultanswerscale_0_'.$language.'_0']))
{
Updatedefaultvalues($postqid,0,0,'',$language,$_POST['defaultanswerscale_0_'.$language.'_0'],true);
}
}
}
$_SESSION['flashmessage'] = $clang->gT("Default value settings were successfully saved.");
LimeExpressionManager::SetDirtyFlag();
}
elseif ($action == "updatequestion" && bHasSurveyPermission($surveyid, 'surveycontent','update'))
{
LimeExpressionManager::RevertUpgradeConditionsToRelevance($surveyid);
$cqquery = "SELECT type, gid FROM ".db_table_name('questions')." WHERE qid={$postqid}";
$cqresult=db_execute_assoc($cqquery) or safe_die ("Couldn't get question type to check for change<br />".$cqquery."<br />".$connect->ErrorMsg()); // Checked
$cqr=$cqresult->FetchRow();
@@ -425,7 +449,7 @@ if(isset($surveyid))
require_once("../classes/inputfilter/class.inputfilter_clean.php");
$myFilter = new InputFilter('','',1,1,1);
}
// Remove invalid question attributes on saving
$qattributes=questionAttributes();
$attsql="delete from ".db_table_name('question_attributes')." where qid='{$postqid}' and ";
@@ -447,23 +471,32 @@ if(isset($surveyid))
if (isset($_POST[$validAttribute['name']]))
{
if ($filterxsshtml)
{
$_POST[$validAttribute['name']]=$myFilter->process($_POST[$validAttribute['name']]);
$sAttributeValue=$myFilter->process($_POST[$validAttribute['name']]);
}
else
{
$sAttributeValue=$_POST[$validAttribute['name']];
}
if ($validAttribute['name']=='multiflexible_step' && trim($sAttributeValue)!='') {
$sAttributeValue=floatval($sAttributeValue);
if ($sAttributeValue==0) $sAttributeValue=1;
};
$query = "select qaid from ".db_table_name('question_attributes')."
WHERE attribute='".$validAttribute['name']."' AND qid=".$qid;
$result = $connect->Execute($query) or safe_die("Error updating attribute value<br />".$query."<br />".$connect->ErrorMsg()); // Checked
if ($result->Recordcount()>0)
{
$query = "UPDATE ".db_table_name('question_attributes')."
SET value='".db_quote($_POST[$validAttribute['name']])."' WHERE attribute='".$validAttribute['name']."' AND qid=".$qid;
SET value='".db_quote($sAttributeValue)."' WHERE attribute='".$validAttribute['name']."' AND qid=".$qid;
$result = $connect->Execute($query) or safe_die("Error updating attribute value<br />".$query."<br />".$connect->ErrorMsg()); // Checked
}
else
{
$query = "INSERT into ".db_table_name('question_attributes')."
(qid, value, attribute) values ($qid,'".db_quote($_POST[$validAttribute['name']])."','{$validAttribute['name']}')";
(qid, value, attribute) values ($qid,'".db_quote($sAttributeValue)."','{$validAttribute['name']}')";
$result = $connect->Execute($query) or safe_die("Error updating attribute value<br />".$query."<br />".$connect->ErrorMsg()); // Checked
}
}
@@ -483,7 +516,7 @@ if(isset($surveyid))
// These are the questions types that have no validation - so zap it accordingly
if ($_POST['type']== "!" || $_POST['type']== "L" || $_POST['type']== "M" || $_POST['type']== "P" ||
$_POST['type']== "F" || $_POST['type']== "H" || $_POST['type']== ":" || $_POST['type']== ";" ||
$_POST['type']== "F" || $_POST['type']== "H" ||
$_POST['type']== "X" || $_POST['type']== "")
{
$_POST['preg']='';
@@ -514,11 +547,6 @@ if(isset($surveyid))
if (isset($postgid) && $postgid != "")
{
$array_result=checkMovequestionConstraintsForConditions(sanitize_int($postsid),sanitize_int($postqid), sanitize_int($postgid));
// If there is no blocking conditions that could prevent this move
if (is_null($array_result['notAbove']) && is_null($array_result['notBelow']))
{
$questlangs = GetAdditionalLanguagesFromSurveyID($postsid);
$baselang = GetBaseLanguageFromSurveyID($postsid);
array_push($questlangs,$baselang);
@@ -538,8 +566,8 @@ if(isset($surveyid))
{
if ($filterxsshtml)
{
$_POST['question_'.$qlang]=$myFilter->process($_POST['question_'.$qlang]);
$_POST['help_'.$qlang]=$myFilter->process($_POST['help_'.$qlang]);
$_POST['question_'.$qlang]=$myFilter->process(html_entity_decode($_POST['question_'.$qlang], ENT_QUOTES, "UTF-8"));
$_POST['help_'.$qlang]=$myFilter->process(html_entity_decode($_POST['help_'.$qlang], ENT_QUOTES, "UTF-8"));
}
else
{
@@ -556,7 +584,8 @@ if(isset($surveyid))
. "SET type='".db_quote($_POST['type'])."', title='".db_quote($_POST['title'])."', "
. "question='".db_quote($_POST['question_'.$qlang])."', preg='".db_quote($_POST['preg'])."', help='".db_quote($_POST['help_'.$qlang])."', "
. "gid='".db_quote($postgid)."', other='".db_quote($_POST['other'])."', "
. "mandatory='".db_quote($_POST['mandatory'])."'";
. "mandatory='".db_quote($_POST['mandatory'])."'"
. ", relevance='".db_quote($_POST['relevance'])."'";;
if ($oldgid!=$postgid)
{
if ( getGroupOrder(returnglobal('sid'),$oldgid) > getGroupOrder(returnglobal('sid'),returnglobal('gid')) )
@@ -609,44 +638,13 @@ if(isset($surveyid))
$_SESSION['flashmessage'] = $clang->gT("Question was successfully saved.");
}
else
{
// There are conditions constraints: alert the user
$errormsg="";
if (!is_null($array_result['notAbove']))
{
$errormsg.=$clang->gT("This question relies on other question's answers and can't be moved above groupId:","js")
. " " . $array_result['notAbove'][0][0] . " " . $clang->gT("in position","js")." ".$array_result['notAbove'][0][1]."\\n"
. $clang->gT("See conditions:")."\\n";
foreach ($array_result['notAbove'] as $notAboveCond)
{
$errormsg.="- cid:". $notAboveCond[3]."\\n";
}
}
if (!is_null($array_result['notBelow']))
{
$errormsg.=$clang->gT("Some questions rely on this question's answers. You can't move this question below groupId:","js")
. " " . $array_result['notBelow'][0][0] . " " . $clang->gT("in position","js")." ".$array_result['notBelow'][0][1]."\\n"
. $clang->gT("See conditions:")."\\n";
foreach ($array_result['notBelow'] as $notBelowCond)
{
$errormsg.="- cid:". $notBelowCond[3]."\\n";
}
}
$databaseoutput .= "<script type=\"text/javascript\">\n<!--\n alert(\"$errormsg\")\n //-->\n</script>\n";
$gid= $oldgid; // group move impossible ==> keep display on oldgid
}
}
else
{
$databaseoutput .= "<script type=\"text/javascript\">\n<!--\n alert(\"".$clang->gT("Question could not be updated","js")."\")\n //-->\n</script>\n";
}
}
LimeExpressionManager::UpgradeConditionsToRelevance($surveyid);
}
elseif ($action == "copynewquestion" && bHasSurveyPermission($surveyid, 'surveycontent','create'))
@@ -686,8 +684,8 @@ if(isset($surveyid))
$_POST['question_'.$baselang]=fix_FCKeditor_text($_POST['question_'.$baselang]);
$_POST['help_'.$baselang]=fix_FCKeditor_text($_POST['help_'.$baselang]);
$_POST = array_map('db_quote', $_POST);
$query = "INSERT INTO {$dbprefix}questions (sid, gid, type, title, question, preg, help, other, mandatory, question_order, language)
VALUES ({$postsid}, {$postgid}, '{$_POST['type']}', '{$_POST['title']}', '".$_POST['question_'.$baselang]."', '{$_POST['preg']}', '".$_POST['help_'.$baselang]."', '{$_POST['other']}', '{$_POST['mandatory']}', $max,".db_quoteall($baselang).")";
$query = "INSERT INTO {$dbprefix}questions (sid, gid, type, title, question, preg, help, other, mandatory, relevance, question_order, language)
VALUES ({$postsid}, {$postgid}, '{$_POST['type']}', '{$_POST['title']}', '".$_POST['question_'.$baselang]."', '{$_POST['preg']}', '".$_POST['help_'.$baselang]."', '{$_POST['other']}', '{$_POST['mandatory']}', '{$_POST['relevance']}', $max,".db_quoteall($baselang).")";
$result = $connect->Execute($query) or safe_die($connect->ErrorMsg()); // Checked
$newqid = $connect->Insert_ID("{$dbprefix}questions","qid");
if (!$result)
@@ -714,8 +712,8 @@ if(isset($surveyid))
$_POST['help_'.$qlanguage]=fix_FCKeditor_text($_POST['help_'.$qlanguage]);
db_switchIDInsert('questions',true);
$query = "INSERT INTO {$dbprefix}questions (qid, sid, gid, type, title, question, help, other, mandatory, question_order, language)
VALUES ($newqid,{$postsid}, {$postgid}, '{$_POST['type']}', '{$_POST['title']}', '".$_POST['question_'.$qlanguage]."', '".$_POST['help_'.$qlanguage]."', '{$_POST['other']}', '{$_POST['mandatory']}', $max,".db_quoteall($qlanguage).")";
$query = "INSERT INTO {$dbprefix}questions (qid, sid, gid, type, title, question, help, other, mandatory, relevance, question_order, language)
VALUES ($newqid,{$postsid}, {$postgid}, '{$_POST['type']}', '{$_POST['title']}', '".$_POST['question_'.$qlanguage]."', '".$_POST['help_'.$qlanguage]."', '{$_POST['other']}', '{$_POST['mandatory']}', '{$_POST['relevance']}', $max,".db_quoteall($qlanguage).")";
$result = $connect->Execute($query) or safe_die($connect->ErrorMsg()); // Checked
db_switchIDInsert('questions',false);
}
@@ -769,10 +767,10 @@ if(isset($surveyid))
while ($qr1 = $r1->FetchRow())
{
$qr1 = array_map('db_quote', $qr1);
$i1 = "INSERT INTO {$dbprefix}answers (qid, code, answer, sortorder, language, scale_id) "
$i1 = "INSERT INTO {$dbprefix}answers (qid, code, answer, sortorder, language, scale_id, assessment_value) "
. "VALUES ('$newqid', '{$qr1['code']}', "
. "'{$qr1['answer']}', "
. "'{$qr1['sortorder']}', '{$qr1['language']}', '{$qr1['scale_id']}')";
. "'{$qr1['sortorder']}', '{$qr1['language']}', '{$qr1['scale_id']}', '{$qr1['assessment_value']}')";
$ir1 = $connect->Execute($i1); // Checked
}
@@ -799,12 +797,15 @@ if(isset($surveyid))
$qid=$newqid; //Sets the qid so that admin.php displays the newly created question
$_SESSION['flashmessage'] = $clang->gT("Question was successfully copied.");
LimeExpressionManager::SetDirtyFlag(); // so refreshes syntax highlighting
}
}
elseif ($action == "delquestion" && bHasSurveyPermission($surveyid, 'surveycontent','delete'))
{
if (!isset($qid)) {$qid=returnglobal('qid');}
//check if any other questions have conditions which rely on this question. Don't delete if there are.
LimeExpressionManager::RevertUpgradeConditionsToRelevance(NULL,$qid);
$ccquery = "SELECT * FROM {$dbprefix}conditions WHERE cqid=$qid";
$ccresult = db_execute_assoc($ccquery) or safe_die ("Couldn't get list of cqids for this question<br />".$ccquery."<br />".$connect->ErrorMsg()); // Checked
$cccount=$ccresult->RecordCount();
@@ -860,6 +861,8 @@ if(isset($surveyid))
$query = "delete from ".db_table_name('answers')." where qid=".db_quote($qid);
$result = $connect->Execute($query); // Checked
LimeExpressionManager::RevertUpgradeConditionsToRelevance($surveyid);
for ($scale_id=0;$scale_id<$scalecount;$scale_id++)
{
$maxcount=(int)$_POST['answercount_'.$scale_id];
@@ -908,6 +911,8 @@ if(isset($surveyid))
} // for ($sortorderid=0;$sortorderid<$maxcount;$sortorderid++)
} // for ($scale_id=0;
LimeExpressionManager::UpgradeConditionsToRelevance($surveyid);
if ($invalidCode == 1) $databaseoutput .= "<script type=\"text/javascript\">\n<!--\n alert(\"".$clang->gT("Answers with a code of 0 (zero) or blank code are not allowed, and will not be saved","js")."\")\n //-->\n</script>\n";
if ($duplicateCode == 1) $databaseoutput .= "<script type=\"text/javascript\">\n<!--\n alert(\"".$clang->gT("Duplicate codes found, these entries won't be updated","js")."\")\n //-->\n</script>\n";
@@ -933,6 +938,8 @@ if(isset($surveyid))
// First delete any deleted ids
$deletedqids=explode(' ', trim($_POST['deletedqids']));
LimeExpressionManager::RevertUpgradeConditionsToRelevance($surveyid);
foreach ($deletedqids as $deletedqid)
{
$deletedqid=(int)$deletedqid;
@@ -987,7 +994,8 @@ if(isset($surveyid))
$myFilter = new InputFilter('','',1,1,1);
$insertqids=array();
//$insertqids=array(); //?
$insertqid = array();
for ($scale_id=0;$scale_id<$scalecount;$scale_id++)
{
foreach ($anslangs as $language)
@@ -1010,18 +1018,18 @@ if(isset($surveyid))
}
else
{
if (!isset($insertqid[$position]))
if (!isset($insertqid[$scale_id][$position]))
{
$query='INSERT into '.db_table_name('questions').' (sid, gid, question_order, title, question, parent_qid, language, scale_id) values ('.$surveyid.','.$gid.','.($position+1).','.db_quoteall($codes[$scale_id][$position]).','.db_quoteall($subquestionvalue).','.$qid.','.db_quoteall($language).','.$scale_id.')';
$connect->execute($query);
$insertqid[$position]=$connect->Insert_Id(db_table_name_nq('questions'),"qid");
$insertqid[$scale_id][$position]=$connect->Insert_Id(db_table_name_nq('questions'),"qid");
}
else
{
db_switchIDInsert('questions',true);
$query='INSERT into '.db_table_name('questions').' (qid, sid, gid, question_order, title, question, parent_qid, language, scale_id) values ('.$insertqid[$position].','.$surveyid.','.$gid.','.($position+1).','.db_quoteall($codes[$scale_id][$position]).','.db_quoteall($subquestionvalue).','.$qid.','.db_quoteall($language).','.$scale_id.')';
$query='INSERT into '.db_table_name('questions').' (qid, sid, gid, question_order, title, question, parent_qid, language, scale_id) values ('.$insertqid[$scale_id][$position].','.$surveyid.','.$gid.','.($position+1).','.db_quoteall($codes[$scale_id][$position]).','.db_quoteall($subquestionvalue).','.$qid.','.db_quoteall($language).','.$scale_id.')';
$connect->execute($query);
db_switchIDInsert('questions',true);
db_switchIDInsert('questions',false);
}
}
$position++;
@@ -1029,6 +1037,8 @@ if(isset($surveyid))
}
}
LimeExpressionManager::UpgradeConditionsToRelevance($surveyid);
//include("surveytable_functions.php");
//surveyFixColumns($surveyid);
$_SESSION['flashmessage'] = $clang->gT("Subquestions were successfully saved.");
@@ -1100,7 +1110,7 @@ if(isset($surveyid))
'printanswers'=>$_POST['printanswers'],
'publicstatistics'=>$_POST['publicstatistics'],
'autoredirect'=>$_POST['autoredirect'],
'showXquestions'=>$_POST['showXquestions'],
'showxquestions'=>$_POST['showxquestions'],
'showgroupinfo'=>$_POST['showgroupinfo'],
'showqnumcode'=>$_POST['showqnumcode'],
'shownoanswer'=>$_POST['shownoanswer'],
@@ -1116,6 +1126,8 @@ if(isset($surveyid))
'usecaptcha'=>$_POST['usecaptcha'],
'emailresponseto'=>trim($_POST['emailresponseto']),
'emailnotificationto'=>trim($_POST['emailnotificationto']),
'googleanalyticsapikey'=>trim($_POST['googleanalyticsapikey']),
'googleanalyticsstyle'=>trim($_POST['googleanalyticsstyle']),
'tokenlength'=>$_POST['tokenlength']
);
@@ -1399,7 +1411,7 @@ elseif ($action == "insertsurvey" && $_SESSION['USER_RIGHT_CREATE_SURVEY'])
'allowsave'=>$_POST['allowsave'],
'navigationdelay'=>$_POST['navigationdelay'],
'autoredirect'=>$_POST['autoredirect'],
'showXquestions'=>$_POST['showXquestions'],
'showxquestions'=>$_POST['showxquestions'],
'showgroupinfo'=>$_POST['showgroupinfo'],
'showqnumcode'=>$_POST['showqnumcode'],
'shownoanswer'=>$_POST['shownoanswer'],
@@ -1474,6 +1486,7 @@ elseif ($action == "insertsurvey" && $_SESSION['USER_RIGHT_CREATE_SURVEY'])
// Update survey permissions
GiveAllSurveyPermissions($_SESSION['loginID'],$surveyid);
LimeExpressionManager::SetSurveyId($surveyid);
$surveyselect = getsurveylist();
@@ -1490,11 +1503,13 @@ elseif ($action == "insertsurvey" && $_SESSION['USER_RIGHT_CREATE_SURVEY'])
elseif ($action == "savepersonalsettings")
{
$_POST = array_map('db_quote', $_POST);
$uquery = "UPDATE {$dbprefix}users SET lang='{$_POST['lang']}', dateformat='{$_POST['dateformat']}', htmleditormode= '{$_POST['htmleditormode']}'
$uquery = "UPDATE {$dbprefix}users SET lang='{$_POST['lang']}', dateformat='{$_POST['dateformat']}', htmleditormode= '{$_POST['htmleditormode']}', questionselectormode= '{$_POST['questionselectormode']}', templateeditormode= '{$_POST['templateeditormode']}'
WHERE uid={$_SESSION['loginID']}";
$uresult = $connect->Execute($uquery) or safe_die ($uquery."<br />".$connect->ErrorMsg()); // Checked
$_SESSION['adminlang']=$_POST['lang'];
$_SESSION['htmleditormode']=$_POST['htmleditormode'];
$_SESSION['questionselectormode']=$_POST['questionselectormode'];
$_SESSION['templateeditormode']=$_POST['templateeditormode'];
$_SESSION['dateformat']= $_POST['dateformat'];
$_SESSION['flashmessage'] = $clang->gT("Your personal settings were successfully saved.");
}
+507 -199
View File
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: dataentry.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: dataentry.php 12452 2012-02-14 11:33:25Z maziminke $
*/
/*
@@ -267,7 +267,7 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
}
$columns[] .= db_quote_id($fieldname);
$values[] .= db_quoteall(json_encode($phparray), true);
$values[] .= db_quoteall(ls_json_encode($phparray), true);
}
else
{
@@ -351,7 +351,7 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
"identifier"=>$saver['identifier'],
"access_code"=>$password,
"email"=>$saver['email'],
"ip"=>$_SERVER['REMOTE_ADDR'],
"ip"=>getIPAddress(),
"refurl"=>getenv("HTTP_REFERER"),
'saved_thisstep' => 0,
"status"=>"S",
@@ -553,6 +553,10 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
//$dataentryoutput .= "<pre>"; print_r($fname);$dataentryoutput .= "</pre>";
if (isset($idrow[$fname['fieldname']])) $answer = $idrow[$fname['fieldname']];
$question=$fname['question'];
//get survey details
$thissurvey=getSurveyInfo($surveyid);
$dataentryoutput .= "\t<tr";
if ($highlight) $dataentryoutput .=" class='odd'";
else $dataentryoutput .=" class='even'";
@@ -596,7 +600,7 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
case "Q":
case "K":
$dataentryoutput .= "\t{$fname['subquestion']}&nbsp;<input type='text' name='{$fname['fieldname']}' value='"
.$idrow[$fname['fieldname']] . "' />\n";
.htmlspecialchars($idrow[$fname['fieldname']],ENT_QUOTES) . "' />\n";
break;
case "id":
$dataentryoutput .= "<span style='font-weight:bold;'>&nbsp;{$idrow[$fname['fieldname']]}</span>";
@@ -605,7 +609,7 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
for ($x=1; $x<=5; $x++)
{
$dataentryoutput .= "\t<input type='radio' class='radiobtn' name='{$fname['fieldname']}' value='$x'";
if ($idrow[$fname['fieldname']] == $x) {$dataentryoutput .= " checked";}
if ($idrow[$fname['fieldname']] == $x) {$dataentryoutput .= " checked='checked'";}
$dataentryoutput .= " />$x \n";
}
break;
@@ -925,7 +929,7 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
else
{
$dataentryoutput .= "\t<input type='checkbox' class='checkboxbtn' name='{$fname['fieldname']}' value='Y'";
if ($idrow[$fname['fieldname']] == "Y") {$dataentryoutput .= " checked";}
if ($idrow[$fname['fieldname']] == "Y") {$dataentryoutput .= " checked='checked'";}
$dataentryoutput .= " />{$fname['subquestion']}<br />\n";
}
@@ -987,7 +991,7 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
{
$dataentryoutput .= "\t<tr>\n"
."<td><input type='checkbox' class='checkboxbtn' name=\"{$fname['fieldname']}\" value='Y'";
if ($idrow[$fname['fieldname']] == "Y") {$dataentryoutput .= " checked";}
if ($idrow[$fname['fieldname']] == "Y") {$dataentryoutput .= " checked='checked'";}
$dataentryoutput .= " />{$fname['subquestion']}</td>\n";
}
$fname=next($fnames);
@@ -1014,7 +1018,7 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
.'<tr><td></td><td><input type="hidden" class="'.$fname['fieldname'].'" id="'.$fname['fieldname'].'_ext_'.$i .'" name="ext" size=50 value="'.htmlspecialchars($metadata[$i]["ext"]) .'" /></td></tr>'
.'<tr><td></td><td><input type="hidden" class="'.$fname['fieldname'].'" id="'.$fname['fieldname'].'_filename_'.$i .'" name="filename" size=50 value="'.htmlspecialchars(rawurldecode($metadata[$i]["filename"])) .'" /></td></tr>';
}
$dataentryoutput .= '<tr><td></td><td><input type="hidden" id="'.$fname['fieldname'].'" name="'.$fname['fieldname'].'" size=50 value="'.htmlspecialchars($idrow[$fname['fieldname']]).'" /></td></tr>';
$dataentryoutput .= '<tr><td></td><td><input type="hidden" id="'.$fname['fieldname'].'" name="'.$fname['fieldname'].'" size=50 value="'.htmlspecialchars($idrow[$fname['fieldname']],ENT_QUOTES).'" /></td></tr>';
$dataentryoutput .= '</table>';
$dataentryoutput .= '<script type="text/javascript">
$(function() {
@@ -1042,25 +1046,233 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
}
else
{//file count
$dataentryoutput .= '<input readonly id="'.$fname['fieldname'].'" name="'.$fname['fieldname'].'" value ="'.htmlspecialchars($idrow[$fname['fieldname']]).'" /></td></table>';
$dataentryoutput .= '<input readonly id="'.$fname['fieldname'].'" name="'.$fname['fieldname'].'" value ="'.htmlspecialchars($idrow[$fname['fieldname']],ENT_QUOTES).'" /></td></table>';
}
break;
case "N": //NUMERICAL TEXT
$dataentryoutput .= "\t<input type='text' name='{$fname['fieldname']}' value='{$idrow[$fname['fieldname']]}' "
."onkeypress=\"return goodchars(event,'0123456789.,')\" />\n";
//get question attributes to change some style and validation settings
$qidattributes = getQuestionAttributes($fname['qid']);
if (isset($qidattributes['prefix']) && trim($qidattributes['prefix'])!='') {
$prefix=$qidattributes['prefix'];
}
else
{
$prefix = '';
}
if (isset($qidattributes['suffix']) && trim($qidattributes['suffix'])!='')
{
$suffix=$qidattributes['suffix'];
}
else
{
$suffix = '';
}
if (intval(trim($qidattributes['maximum_chars']))>0 && intval(trim($qidattributes['maximum_chars']))<20) // Limt to 20 chars for numeric
{
$maximum_chars= intval(trim($qidattributes['maximum_chars']));
$maxlength= "maxlength='{$maximum_chars}' ";
}
else
{
$maxlength= "maxlength='20' ";
}
if (trim($qidattributes['text_input_width'])!='')
{
$tiwidth=$qidattributes['text_input_width'];
}
else
{
$tiwidth=10;
}
if (trim($qidattributes['num_value_int_only'])==1)
{
$acomma="";
}
else
{
$acomma=getRadixPointData($thissurvey['surveyls_numberformat']);
$acomma = $acomma['seperator'];
}
$sSeperator = getRadixPointData($thissurvey['surveyls_numberformat']);
$dataentryoutput .= $prefix. "<input type='text' size='".$tiwidth."' name='{$fname['fieldname']}' value='".htmlspecialchars($idrow[$fname['fieldname']],ENT_QUOTES)."'
title='".$clang->gT('Only numbers may be entered in this field')."' $maxlength onkeypress=\"return goodchars(event,'-0123456789{$acomma}')\" />".$suffix;
break;
case "S": //SHORT FREE TEXT
$dataentryoutput .= "\t<input type='text' name='{$fname['fieldname']}' value='"
.htmlspecialchars($idrow[$fname['fieldname']], ENT_QUOTES) . "' />\n";
//get question attributes to change some style and validation settings
$qidattributes = getQuestionAttributes($fname['qid']);
if ($qidattributes['numbers_only']==1)
{
$sSeperator = getRadixPointData($thissurvey['surveyls_numberformat']);
$sSeperator = $sSeperator['seperator'];
$numbersonly = 'onkeypress="return goodchars(event,\'-0123456789'.$sSeperator.'\')"';
}
else
{
$numbersonly = '';
}
if (intval(trim($qidattributes['maximum_chars']))>0)
{
// Only maxlength attribute, use textarea[maxlength] jquery selector for textarea
$maximum_chars= intval(trim($qidattributes['maximum_chars']));
$maxlength= "maxlength='{$maximum_chars}' ";
}
else
{
$maxlength= "";
}
if (trim($qidattributes['text_input_width'])!='')
{
$tiwidth=$qidattributes['text_input_width'];
}
else
{
$tiwidth=50;
}
if (isset($qidattributes['prefix']) && trim($qidattributes['prefix'])!='')
{
$prefix=$qidattributes['prefix'];
}
else
{
$prefix = '';
}
if (isset($qidattributes['suffix']) && trim($qidattributes['suffix'])!='')
{
$suffix=$qidattributes['suffix'];
}
else
{
$suffix = '';
}
if (trim($qidattributes['display_rows'])!='')
{
//question attribute "display_rows" is set -> we need a textarea to be able to show several rows
$drows=$qidattributes['display_rows'];
//if a textarea should be displayed we make it equal width to the long text question
//this looks nicer and more continuous
if($tiwidth == 50)
{
$tiwidth=40;
}
$dataentryoutput .= $prefix."<textarea $numbersonly name='{$fname['fieldname']}' rows='".$drows."' cols='".$tiwidth."' >";
$dataentryoutput .= htmlspecialchars($idrow[$fname['fieldname']], ENT_QUOTES) ."</textarea>$suffix\n";
}
else
{
//no question attribute set, use common input text field
$dataentryoutput .= $prefix."<input type=\"text\" size=\"$tiwidth\"
name='{$fname['fieldname']}' value='"
.htmlspecialchars($idrow[$fname['fieldname']], ENT_QUOTES) . "' ";
$dataentryoutput .=" {$maxlength} $numbersonly />\n\t$suffix\n\n";
}
break;
case "T": //LONG FREE TEXT
$dataentryoutput .= "\t<textarea rows='5' cols='45' name='{$fname['fieldname']}'>"
.htmlspecialchars($idrow[$fname['fieldname']], ENT_QUOTES) . "</textarea>\n";
//get question attributes to change some style and validation settings
$qidattributes=getQuestionAttributes($fname['qid']);
if (trim($qidattributes['display_rows'])!='')
{
$drows=$qidattributes['display_rows'];
}
else
{
$drows=5;
}
if (trim($qidattributes['text_input_width'])!='')
{
$tiwidth=$qidattributes['text_input_width'];
}
else
{
$tiwidth=40;
}
if (isset($qidattributes['prefix']) && trim($qidattributes['prefix'])!='')
{
$prefix=$qidattributes['prefix'];
}
else
{
$prefix = '';
}
if (isset($qidattributes['suffix']) && trim($qidattributes['suffix'])!='')
{
$suffix=$qidattributes['suffix'];
}
else
{
$suffix = '';
}
$dataentryoutput .= $prefix."<textarea name='{$fname['fieldname']}' rows='$drows' cols='$tiwidth' >"
.htmlspecialchars($idrow[$fname['fieldname']], ENT_QUOTES) ."</textarea>$suffix\n";
break;
case "U": //HUGE FREE TEXT
$dataentryoutput .= "\t<textarea rows='50' cols='70' name='{$fname['fieldname']}'>"
.htmlspecialchars($idrow[$fname['fieldname']], ENT_QUOTES) . "</textarea>\n";
//get question attributes to change some style and validation settings
$qidattributes=getQuestionAttributes($fname['qid']);
if (trim($qidattributes['display_rows'])!='')
{
$drows=$qidattributes['display_rows'];
}
else
{
$drows=70;
}
if (trim($qidattributes['text_input_width'])!='')
{
$tiwidth=$qidattributes['text_input_width'];
}
else
{
$tiwidth=50;
}
if (isset($qidattributes['prefix']) && trim($qidattributes['prefix'])!='') {
$prefix=$qidattributes['prefix'];
}
else
{
$prefix = '';
}
if (isset($qidattributes['suffix']) && trim($qidattributes['suffix'])!='') {
$suffix=$qidattributes['suffix'];
}
else
{
$suffix = '';
}
$dataentryoutput .= $prefix.'<textarea name="'.$fname['fieldname'].'" rows="'.$drows.'" cols="'.$tiwidth.'">';
$dataentryoutput .= htmlspecialchars($idrow[$fname['fieldname']], ENT_QUOTES) . "</textarea>$suffix\n";
break;
case "Y": //YES/NO radio-buttons
$dataentryoutput .= "\t<select name='{$fname['fieldname']}'>\n"
."<option value=''";
@@ -1085,7 +1297,7 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
for ($j=1; $j<=5; $j++)
{
$dataentryoutput .= "\t<input type='radio' class='radiobtn' name='{$fname['fieldname']}' value='$j'";
if ($idrow[$fname['fieldname']] == $j) {$dataentryoutput .= " checked";}
if ($idrow[$fname['fieldname']] == $j) {$dataentryoutput .= " checked='checked'";}
$dataentryoutput .= " />$j&nbsp;\n";
}
$dataentryoutput .= "</td>\n"
@@ -1107,7 +1319,7 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
for ($j=1; $j<=10; $j++)
{
$dataentryoutput .= "\t<input type='radio' class='radiobtn' name='{$fname['fieldname']}' value='$j'";
if ($idrow[$fname['fieldname']] == $j) {$dataentryoutput .= " checked";}
if ($idrow[$fname['fieldname']] == $j) {$dataentryoutput .= " checked='checked'";}
$dataentryoutput .= " />$j&nbsp;\n";
}
$dataentryoutput .= "</td>\n"
@@ -1127,13 +1339,13 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
."<td align='right'>{$fname['subquestion']}</td>\n"
."<td>\n"
."\t<input type='radio' class='radiobtn' name='{$fname['fieldname']}' value='Y'";
if ($idrow[$fname['fieldname']] == "Y") {$dataentryoutput .= " checked";}
if ($idrow[$fname['fieldname']] == "Y") {$dataentryoutput .= " checked='checked'";}
$dataentryoutput .= " />".$clang->gT("Yes")."&nbsp;\n"
."\t<input type='radio' class='radiobtn' name='{$fname['fieldname']}' value='U'";
if ($idrow[$fname['fieldname']] == "U") {$dataentryoutput .= " checked";}
if ($idrow[$fname['fieldname']] == "U") {$dataentryoutput .= " checked='checked'";}
$dataentryoutput .= " />".$clang->gT("Uncertain")."&nbsp;\n"
."\t<input type='radio' class='radiobtn' name='{$fname['fieldname']}' value='N'";
if ($idrow[$fname['fieldname']] == "N") {$dataentryoutput .= " checked";}
if ($idrow[$fname['fieldname']] == "N") {$dataentryoutput .= " checked='checked'";}
$dataentryoutput .= " />".$clang->gT("No")."&nbsp;\n"
."</td>\n"
."\t</tr>\n";
@@ -1152,13 +1364,13 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
."<td align='right'>{$fname['subquestion']}</td>\n"
."<td>\n"
."\t<input type='radio' class='radiobtn' name='{$fname['fieldname']}' value='I'";
if ($idrow[$fname['fieldname']] == "I") {$dataentryoutput .= " checked";}
if ($idrow[$fname['fieldname']] == "I") {$dataentryoutput .= " checked='checked'";}
$dataentryoutput .= " />Increase&nbsp;\n"
."\t<input type='radio' class='radiobtn' name='{$fname['fieldname']}' value='S'";
if ($idrow[$fname['fieldname']] == "I") {$dataentryoutput .= " checked";}
if ($idrow[$fname['fieldname']] == "I") {$dataentryoutput .= " checked='checked'";}
$dataentryoutput .= " />Same&nbsp;\n"
."\t<input type='radio' class='radiobtn' name='{$fname['fieldname']}' value='D'";
if ($idrow[$fname['fieldname']] == "D") {$dataentryoutput .= " checked";}
if ($idrow[$fname['fieldname']] == "D") {$dataentryoutput .= " checked='checked'";}
$dataentryoutput .= " />Decrease&nbsp;\n"
."</td>\n"
."\t</tr>\n";
@@ -1190,12 +1402,12 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
while ($frow=$fresult->FetchRow())
{
$dataentryoutput .= "\t<input type='radio' class='radiobtn' name='{$fname['fieldname']}' value='{$frow['code']}'";
if ($idrow[$fname['fieldname']] == $frow['code']) {$dataentryoutput .= " checked";}
if ($idrow[$fname['fieldname']] == $frow['code']) {$dataentryoutput .= " checked='checked'";}
$dataentryoutput .= " />".$frow['answer']."&nbsp;\n";
}
//Add 'No Answer'
$dataentryoutput .= "\t<input type='radio' class='radiobtn' name='{$fname['fieldname']}' value=''";
if ($idrow[$fname['fieldname']] == '') {$dataentryoutput .= " checked";}
if ($idrow[$fname['fieldname']] == '') {$dataentryoutput .= " checked='checked'";}
$dataentryoutput .= " />".$clang->gT("No answer")."&nbsp;\n";
$dataentryoutput .= "</td>\n"
@@ -1247,17 +1459,18 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
$dataentryoutput .= "<td>\n";
if ($qidattributes['input_boxes']!=0) {
$dataentryoutput .= "\t<input type='text' name='{$fname['fieldname']}' value='";
if (!empty($idrow[$fname['fieldname']])) {$datentryoutput .= $idrow[$fname['fieldname']];}
$dataentryoutput .= "' size=4 />";
if (!empty($idrow[$fname['fieldname']])) {$dataentryoutput .= htmlspecialchars($idrow[$fname['fieldname']],ENT_QUOTES);}
$dataentryoutput .= "' size=\"4\" />";
} else {
$dataentryoutput .= "\t<select name='{$fname['fieldname']}'>\n";
$dataentryoutput .= "<option value=''>...</option>\n";
for($ii=$minvalue;$ii<=$maxvalue;$ii+=$stepvalue)
{
$dataentryoutput .= "<option value='$ii'";
if($idrow[$fname['fieldname']] == $ii) {$dataentryoutput .= " selected";}
if($idrow[$fname['fieldname']] == $ii) {$dataentryoutput .= " selected='selected'";}
$dataentryoutput .= ">$ii</option>\n";
}
$dataentryoutput .= "</select>\n";
}
$dataentryoutput .= "</td>\n"
@@ -1277,7 +1490,7 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
. "<td align='right' valign='top'>{$fname['subquestion1']}:{$fname['subquestion2']}</td>\n";
$dataentryoutput .= "<td>\n";
$dataentryoutput .= "\t<input type='text' name='{$fname['fieldname']}' value='";
if(!empty($idrow[$fname['fieldname']])) {$dataentryoutput .= $idrow[$fname['fieldname']];}
if(!empty($idrow[$fname['fieldname']])) {$dataentryoutput .= htmlspecialchars($idrow[$fname['fieldname']],ENT_QUOTES);}
$dataentryoutput .= "' /></td>\n"
."\t</tr>\n";
$fname=next($fnames);
@@ -1296,19 +1509,19 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
} while ($fname=next($fnames));
}
$dataentryoutput .= "</table>\n"
."<p>\n";
."\n";
if (!bHasSurveyPermission($surveyid, 'responses','update'))
{ // if you are not survey owner or super admin you cannot modify responses
$dataentryoutput .= "<input type='button' value='".$clang->gT("Save")."' disabled='disabled'/>\n";
$dataentryoutput .= "<p><input type='button' value='".$clang->gT("Save")."' disabled='disabled'/></p>\n";
}
elseif ($subaction == "edit" && bHasSurveyPermission($surveyid,'responses','update'))
{
$dataentryoutput .= "
$dataentryoutput .= "<p>
<input type='submit' value='".$clang->gT("Save")."' />
<input type='hidden' name='id' value='$id' />
<input type='hidden' name='sid' value='$surveyid' />
<input type='hidden' name='subaction' value='update' />
<input type='hidden' name='language' value='".$sDataEntryLanguage."' />";
<input type='hidden' name='language' value='".$sDataEntryLanguage."' /></p>";
}
elseif ($subaction == "editsaved" && bHasSurveyPermission($surveyid,'responses','update'))
{
@@ -1333,11 +1546,11 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
//-->
</script>\n";
$dataentryoutput .= "<table><tr><td align='left'>\n";
$dataentryoutput .= "\t<input type='checkbox' class='checkboxbtn' name='closerecord' id='closerecord' /><label for='closerecord'>".$clang->gT("Finalize response submission")."</label></td></tr>\n";
$dataentryoutput .="<input type='hidden' name='closedate' value='".date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", $timeadjust)."' />\n";
$dataentryoutput .= "\t<input type='checkbox' class='checkboxbtn' name='closerecord' id='closerecord' /><label for='closerecord'>".$clang->gT("Finalize response submission")."</label></td></tr>\n";
$dataentryoutput .= "\t<tr><td align='left'><input type='checkbox' class='checkboxbtn' name='save' id='save' onclick='saveshow(this.id)' /><label for='save'>".$clang->gT("Save for further completion by survey user")."</label>\n";
$dataentryoutput .= "</td></tr></table>\n";
$dataentryoutput .= "<div name='saveoptions' id='saveoptions' style='display: none'>\n";
$dataentryoutput .= "<div id='saveoptions' style='display: none'>\n";
$dataentryoutput .= "<table align='center' class='outlinetable' cellspacing='0'>
<tr><td align='right'>".$clang->gT("Identifier:")."</td>
<td><input type='text' name='save_identifier'";
@@ -1493,6 +1706,10 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
$thissurvey=getSurveyInfo($surveyid);
//This is the default, presenting a blank dataentry form
$fieldmap=createFieldMap($surveyid);
LimeExpressionManager::StartSurvey($surveyid, 'survey',NULL,false,LEM_PRETTY_PRINT_ALL_SYNTAX);
$moveResult = LimeExpressionManager::NavigateForwards();
// PRESENT SURVEY DATAENTRY SCREEN
$dataentryoutput .= $surveyoptions;
@@ -1604,159 +1821,34 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
//GET ANY CONDITIONS THAT APPLY TO THIS QUESTION
$explanation = ""; //reset conditions explanation
$s=0;
$scenarioquery="SELECT DISTINCT scenario FROM ".db_table_name("conditions")." WHERE ".db_table_name("conditions").".qid={$deqrow['qid']} ORDER BY scenario";
$scenarioresult=db_execute_assoc($scenarioquery);
while ($scenariorow=$scenarioresult->FetchRow())
{
if ($s == 0 && $scenarioresult->RecordCount() > 1) { $explanation .= " <br />-------- <i>Scenario {$scenariorow['scenario']}</i> --------<br />";}
if ($s > 0) { $explanation .= " <br />-------- <i>".$clang->gT("OR")." Scenario {$scenariorow['scenario']}</i> --------<br />";}
$x=0;
$distinctquery="SELECT DISTINCT cqid, ".db_table_name("questions").".title FROM ".db_table_name("conditions").", ".db_table_name("questions")." WHERE ".db_table_name("conditions").".cqid=".db_table_name("questions").".qid AND ".db_table_name("conditions").".qid={$deqrow['qid']} AND ".db_table_name("conditions").".scenario={$scenariorow['scenario']} ORDER BY cqid";
$distinctresult=db_execute_assoc($distinctquery);
while ($distinctrow=$distinctresult->FetchRow())
{
if ($x > 0) {$explanation .= " <i>".$blang->gT("AND")."</i><br />";}
$conquery="SELECT cid, cqid, cfieldname, ".db_table_name("questions").".title, ".db_table_name("questions").".question, value, ".db_table_name("questions").".type, method FROM ".db_table_name("conditions").", ".db_table_name("questions")." WHERE ".db_table_name("conditions").".cqid=".db_table_name("questions").".qid AND ".db_table_name("conditions").".cqid={$distinctrow['cqid']} AND ".db_table_name("conditions").".qid={$deqrow['qid']} AND ".db_table_name("conditions").".scenario={$scenariorow['scenario']}";
$conresult=db_execute_assoc($conquery);
while ($conrow=$conresult->FetchRow())
{
if ($conrow['method']=="==") {$conrow['method']="= ";} else {$conrow['method']=$conrow['method']." ";}
switch($conrow['type'])
{
case "Y":
switch ($conrow['value'])
{
case "Y": $conditions[]=$conrow['method']."'".$blang->gT("Yes")."'"; break;
case "N": $conditions[]=$conrow['method']."'".$blang->gT("No")."'"; break;
}
break;
case "G":
switch($conrow['value'])
{
case "M": $conditions[]=$conrow['method']."'".$blang->gT("Male")."'"; break;
case "F": $conditions[]=$conrow['method']."'".$blang->gT("Female")."'"; break;
} // switch
break;
case "A":
case "B":
$conditions[]=$conrow['method']."'".$conrow['value']."'";
break;
case "C":
switch($conrow['value'])
{
case "Y": $conditions[]=$conrow['method']."'".$blang->gT("Yes")."'"; break;
case "U": $conditions[]=$conrow['method']."'".$blang->gT("Uncertain")."'"; break;
case "N": $conditions[]=$conrow['method']."'".$blang->gT("No")."'"; break;
} // switch
break;
case "1":
$value=substr($conrow['cfieldname'], strpos($conrow['cfieldname'], "X".$conrow['cqid'])+strlen("X".$conrow['cqid']), strlen($conrow['cfieldname']));
$fquery = "SELECT * FROM ".db_table_name("labels")."\n"
. "WHERE lid='{$conrow['lid']}'\n and language='$sDataEntryLanguage' "
. "AND code='{$conrow['value']}'";
$fresult=db_execute_assoc($fquery) or safe_die("$fquery<br />".$connect->ErrorMsg());
while($frow=$fresult->FetchRow())
{
$postans=$frow['title'];
$conditions[]=$conrow['method']."'".$frow['title']."'";
} // while
break;
case "E":
switch($conrow['value'])
{
case "I": $conditions[]=$conrow['method']."'".$blang->gT("Increase")."'"; break;
case "D": $conditions[]=$conrow['method']."'".$blang->gT("Decrease")."'"; break;
case "S": $conditions[]=$conrow['method']."'".$blang->gT("Same")."'"; break;
}
break;
case "F":
case "H":
default:
$value=substr($conrow['cfieldname'], strpos($conrow['cfieldname'], "X".$conrow['cqid'])+strlen("X".$conrow['cqid']), strlen($conrow['cfieldname']));
$fquery = "SELECT * FROM ".db_table_name("questions")."\n"
. "WHERE qid='{$conrow['cqid']}'\n and language='$sDataEntryLanguage' "
. "AND title='{$conrow['title']}' and scale_id=0";
$fresult=db_execute_assoc($fquery) or safe_die("$fquery<br />".$connect->ErrorMsg());
if ($fresult->RecordCount() <= 0) die($fquery);
while($frow=$fresult->FetchRow())
{
$postans=$frow['title'];
$conditions[]=$conrow['method']."'".$frow['title']."'";
} // while
break;
} // switch
$answer_section="";
switch($conrow['type'])
{
case "1":
$ansquery="SELECT answer FROM ".db_table_name("answers")." WHERE qid='{$conrow['cqid']}' AND code='{$conrow['value']}' AND language='{$baselang}'";
$ansresult=db_execute_assoc($ansquery);
while ($ansrow=$ansresult->FetchRow())
{
$conditions[]=$conrow['method']."'".$ansrow['answer']."'";
}
$operator=$clang->gT("OR");
if (isset($conditions)) $conditions = array_unique($conditions);
break;
case "A":
case "B":
case "C":
case "E":
case "F":
case "H":
case ":":
case ";":
$thiscquestion=$fieldmap[$conrow['cfieldname']];
$ansquery="SELECT answer FROM ".db_table_name("answers")." WHERE qid='{$conrow['cqid']}' AND code='{$thiscquestion['aid']}' AND language='{$sDataEntryLanguage}'";
$ansresult=db_execute_assoc($ansquery);
$i=0;
while ($ansrow=$ansresult->FetchRow())
{
if (isset($conditions) && count($conditions) > 0)
{
$conditions[sizeof($conditions)-1]="(".$ansrow['answer'].") : ".end($conditions);
}
}
$operator=$blang->gT("AND"); // this is a dirty, DIRTY fix but it works since only array questions seem to be ORd
break;
default:
$ansquery="SELECT answer FROM ".db_table_name("answers")." WHERE qid='{$conrow['cqid']}' AND code='{$conrow['value']}' AND language='{$sDataEntryLanguage}'";
$ansresult=db_execute_assoc($ansquery);
while ($ansrow=$ansresult->FetchRow())
{
$conditions[]=$conrow['method']."'".$ansrow['answer']."'";
}
$operator=$blang->gT("OR");
if (isset($conditions)) $conditions = array_unique($conditions);
break;
}
}
if (isset($conditions) && count($conditions) > 1)
{
$conanswers = implode(" ".$operator." ", $conditions);
$explanation .= " -" . str_replace("{ANSWER}", $conanswers, $blang->gT("to question {QUESTION}, answer {ANSWER}"));
}
else
{
if(empty($conditions[0])) $conditions[0] = "'".$blang->gT("No Answer")."'";
$explanation .= " -" . str_replace("{ANSWER}", $conditions[0], $blang->gT("to question {QUESTION}, answer {ANSWER}"));
}
unset($conditions);
$explanation = str_replace("{QUESTION}", "'{$distinctrow['title']}$answer_section'", $explanation);
$x++;
}
$s++;
}
if ($explanation)
$qinfo = LimeExpressionManager::GetQuestionStatus($deqrow['qid']);
$relevance = trim($qinfo['info']['relevance']);
$explanation = trim($qinfo['relEqn']);
$validation = trim($qinfo['prettyValidTip']);
$qidattributes=getQuestionAttributes($deqrow['qid']);
$array_filter_help = FlattenText(array_filter_help($qidattributes, $sDataEntryLanguage, $surveyid));
if (($relevance != '' && $relevance != '1') || ($validation != '') || ($array_filter_help != ''))
{
$showme = '';
if ($bgc == "even") {$bgc = "odd";} else {$bgc = "even";} //Do no alternate on explanation row
$explanation = "[".$blang->gT("Only answer this if the following conditions are met:")."]<br />$explanation\n";
$dataentryoutput .= "<tr class ='data-entry-explanation'><td class='data-entry-small-text' colspan='3' align='left'>$explanation</td></tr>\n";
if ($relevance != '' && $relevance != '1') {
$showme = "[".$blang->gT("Only answer this if the following conditions are met:")."]<br />$explanation\n";
}
if ($showme != '' && $validation != '') {
$showme .= '<br/>';
}
if ($validation != '') {
$showme .= "[".$blang->gT("The answer(s) must meet these validation criteria:")."]<br />$validation\n";
}
if ($showme != '' && $array_filter_help != '') {
$showme .= '<br/>';
}
if ($array_filter_help != '') {
$showme .= "[".$blang->gT("The answer(s) must meet these array_filter criteria:")."]<br />$array_filter_help\n";
}
$dataentryoutput .= "<tr class ='data-entry-explanation'><td class='data-entry-small-text' colspan='3' align='left'>$showme</td></tr>\n";
}
//END OF GETTING CONDITIONS
@@ -1772,6 +1864,7 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
$dataentryoutput .= "\t<tr class='$bgc'>\n"
."<td class='data-entry-small-text' valign='top' width='1%'>{$deqrow['title']}</td>\n"
."<td valign='top' align='right' width='30%'>";
// TMSW - Mandatory->EM
if ($deqrow['mandatory']=="Y") //question is mandatory
{
$dataentryoutput .= "<font color='red'>*</font>";
@@ -1873,7 +1966,8 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
.$clang->gT("Other").":"
."<input type='text' name='{$fieldname}other' value='' />\n";
}
$dataentryoutput .= "</tr></table>";
//OLD: invalid HTML -> $dataentryoutput .= "</tr></table>";
$dataentryoutput .= "</table>";
break;
case "L": //LIST drop-down/radio-button list
@@ -2190,7 +2284,7 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
while ($mearow = $mearesult->FetchRow())
{
$dataentryoutput .= "\t<input type='checkbox' class='checkboxbtn' name='$fieldname{$mearow['code']}' id='answer$fieldname{$mearow['code']}' value='Y'";
if ($mearow['default_value'] == "Y") {$dataentryoutput .= " checked";}
if ($mearow['default_value'] == "Y") {$dataentryoutput .= " checked='checked'";}
$dataentryoutput .= " /><label for='$fieldname{$mearow['code']}'>{$mearow['answer']}</label><br />\n";
}
if ($deqrow['other'] == "Y")
@@ -2220,7 +2314,7 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
break;
case "P": //Multiple choice with comments checkbox + text
$dataentryoutput .= "<table border='0'>\n";
$meaquery = "SELECT * FROM ".db_table_name("questions")." WHERE parent_qid={$deqrow['qid']} AND language='{$sDataEntryLanguage}' ORDER BY question_order, question";
$meaquery = "SELECT * FROM ".db_table_name("questions")." WHERE parent_qid={$deqrow['qid']} AND language='{$sDataEntryLanguage}' ORDER BY question_order";
$mearesult = db_execute_assoc($meaquery);
while ($mearow = $mearesult->FetchRow())
{
@@ -2277,7 +2371,13 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
else
$dataentryoutput .= "jsonstr += '\"comment\":\"\",';";
$dataentryoutput .= "jsonstr += '\"name\":\"'+$('#".$fieldname."_file_'+i).val()+'\"}';";
$dataentryoutput .= "filename = $('#".$fieldname."_file_'+i).val();";
$dataentryoutput .= "if( filename.indexOf('\\\') != '-1' ) {
file = filename.split('\\\');
var max = file.length;
filename = file[max-1];
}";
$dataentryoutput .= "jsonstr += '\"name\":\"'+filename+'\"}';";
$dataentryoutput .= "jsonstr += ',';\n
filecount++;
@@ -2321,17 +2421,198 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
$dataentryoutput .= "<tr><td align='center'><input type='hidden' name='".$fieldname."_filecount' id='".$fieldname."_filecount' value='' /></td>\n</tr>\n";
$dataentryoutput .= "</table>\n";
break;
case "N": //NUMERICAL TEXT
$dataentryoutput .= "\t<input type='text' name='$fieldname' onkeypress=\"return goodchars(event,'0123456789.,')\" />";
//get question attributes to change some style and validation settings
$qidattributes = getQuestionAttributes($qid);
if (isset($qidattributes['prefix']) && trim($qidattributes['prefix'])!='') {
$prefix=$qidattributes['prefix'];
}
else
{
$prefix = '';
}
if (isset($qidattributes['suffix']) && trim($qidattributes['suffix'])!='')
{
$suffix=$qidattributes['suffix'];
}
else
{
$suffix = '';
}
if (intval(trim($qidattributes['maximum_chars']))>0 && intval(trim($qidattributes['maximum_chars']))<20) // Limt to 20 chars for numeric
{
$maximum_chars= intval(trim($qidattributes['maximum_chars']));
$maxlength= "maxlength='{$maximum_chars}' ";
}
else
{
$maxlength= "maxlength='20' ";
}
if (trim($qidattributes['text_input_width'])!='')
{
$tiwidth=$qidattributes['text_input_width'];
}
else
{
$tiwidth=10;
}
if (trim($qidattributes['num_value_int_only'])==1)
{
$acomma="";
}
else
{
$acomma=getRadixPointData($thissurvey['surveyls_numberformat']);
$acomma = $acomma['seperator'];
}
$sSeperator = getRadixPointData($thissurvey['surveyls_numberformat']);
$dataentryoutput .= $prefix. "<input type='text' size='".$tiwidth."' name='".$fieldname."'
title='".$clang->gT('Only numbers may be entered in this field')."' $maxlength onkeypress=\"return goodchars(event,'-0123456789{$acomma}')\" />".$suffix;
break;
case "S": //SHORT FREE TEXT
$dataentryoutput .= "\t<input type='text' name='$fieldname' />\n";
//get question attributes to change some style and validation settings
$qidattributes = getQuestionAttributes($qid);
if ($qidattributes['numbers_only']==1)
{
$sSeperator = getRadixPointData($thissurvey['surveyls_numberformat']);
$sSeperator = $sSeperator['seperator'];
$numbersonly = 'onkeypress="return goodchars(event,\'-0123456789'.$sSeperator.'\')"';
}
else
{
$numbersonly = '';
}
if (intval(trim($qidattributes['maximum_chars']))>0)
{
// Only maxlength attribute, use textarea[maxlength] jquery selector for textarea
$maximum_chars= intval(trim($qidattributes['maximum_chars']));
$maxlength= "maxlength='{$maximum_chars}' ";
}
else
{
$maxlength= "";
}
if (trim($qidattributes['text_input_width'])!='')
{
$tiwidth=$qidattributes['text_input_width'];
}
else
{
$tiwidth=50;
}
if (isset($qidattributes['prefix']) && trim($qidattributes['prefix'])!='') {
$prefix=$qidattributes['prefix'];
}
else
{
$prefix = '';
}
if (isset($qidattributes['suffix']) && trim($qidattributes['suffix'])!='') {
$suffix=$qidattributes['suffix'];
}
else
{
$suffix = '';
}
if (trim($qidattributes['display_rows'])!='')
{
//question attribute "display_rows" is set -> we need a textarea to be able to show several rows
$drows=$qidattributes['display_rows'];
//if a textarea should be displayed we make it equal width to the long text question
//this looks nicer and more continuous
if($tiwidth == 50)
{
$tiwidth=40;
}
$dataentryoutput .= $prefix."<textarea $numbersonly name='".$fieldname."' rows='".$drows."'
cols='".$tiwidth."' >";
$dataentryoutput .= "</textarea>$suffix\n";
}
else
{
//no question attribute set, use common input text field
$dataentryoutput .= $prefix."<input type=\"text\" size=\"$tiwidth\" name=\"$fieldname\" ";
$dataentryoutput .=" {$maxlength} $numbersonly />\n\t$suffix\n\n";
}
break;
case "T": //LONG FREE TEXT
$dataentryoutput .= "\t<textarea cols='40' rows='5' name='$fieldname'></textarea>\n";
$qidattributes=getQuestionAttributes($qid);
if (trim($qidattributes['display_rows'])!='')
{
$drows=$qidattributes['display_rows'];
}
else
{
$drows=5;
}
if (trim($qidattributes['text_input_width'])!='')
{
$tiwidth=$qidattributes['text_input_width'];
}
else
{
$tiwidth=40;
}
if (isset($qidattributes['prefix']) && trim($qidattributes['prefix'])!='') {
$prefix=$qidattributes['prefix'];
}
else
{
$prefix = '';
}
if (isset($qidattributes['suffix']) && trim($qidattributes['suffix'])!='') {
$suffix=$qidattributes['suffix'];
}
else
{
$suffix = '';
}
$dataentryoutput .= $prefix.'<textarea name="'.$fieldname.'" rows="'.$drows.'" cols="'.$tiwidth.'" >';
$dataentryoutput .= "</textarea>$suffix\n";
break;
case "U": //LONG FREE TEXT
$dataentryoutput .= "\t<textarea cols='50' rows='70' name='$fieldname'></textarea>\n";
case "U": //HUGE FREE TEXT
$qidattributes=getQuestionAttributes($qid);
if (trim($qidattributes['display_rows'])!='')
{
$drows=$qidattributes['display_rows'];
}
else
{
$drows=70;
}
if (trim($qidattributes['text_input_width'])!='')
{
$tiwidth=$qidattributes['text_input_width'];
}
else
{
$tiwidth=50;
}
if (isset($qidattributes['prefix']) && trim($qidattributes['prefix'])!='') {
$prefix=$qidattributes['prefix'];
}
else
{
$prefix = '';
}
if (isset($qidattributes['suffix']) && trim($qidattributes['suffix'])!='') {
$suffix=$qidattributes['suffix'];
}
else
{
$suffix = '';
}
$dataentryoutput .= $prefix.'<textarea name="'.$fieldname.'" rows="'.$drows.'" cols="'.$tiwidth.'">';
$dataentryoutput .= "</textarea>$suffix\n";
break;
case "Y": //YES/NO radio-buttons
$dataentryoutput .= "\t<select name='$fieldname'>\n";
@@ -2489,7 +2770,7 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
{
$dataentryoutput .= "<td>\n";
if ($qidattributes['input_boxes']!=0) {
$dataentryoutput .= "\t<input type='text' name='$fieldname{$mearow['title']}_$ld' size=4 />";
$dataentryoutput .= "\t<input type='text' name='$fieldname{$mearow['title']}_$ld' size='4' />";
} else {
$dataentryoutput .= "\t<select name='$fieldname{$mearow['title']}_$ld'>\n";
$dataentryoutput .= "<option value=''>...</option>\n";
@@ -2625,7 +2906,7 @@ if (bHasSurveyPermission($surveyid, 'responses','read') || bHasSurveyPermission(
//Show Save Option
$dataentryoutput .= "\t<tr><td align='left'><input type='checkbox' class='checkboxbtn' name='save' id='save' onclick='saveshow(this.id)' /><label for='save'>".$clang->gT("Save for further completion by survey user")."</label>\n";
$dataentryoutput .= "</td></tr></table>\n";
$dataentryoutput .= "<div name='saveoptions' id='saveoptions' style='display: none'>\n";
$dataentryoutput .= "<div id='saveoptions' style='display: none'>\n";
$dataentryoutput .= "<table align='center' class='outlinetable' cellspacing='0'>
<tr><td align='right'>".$clang->gT("Identifier:")."</td>
<td><input type='text' name='save_identifier' /></td></tr>
@@ -2719,4 +3000,31 @@ function array_in_array($needle, $haystack)
return false;
}
/*
* This is a duplicate of the array_filter_help function in printablesurvey.php
*/
function array_filter_help($qidattributes, $surveyprintlang, $surveyid) {
global $clang;
$output = "";
if(!empty($qidattributes['array_filter']))
{
$newquery="SELECT question FROM ".db_table_name("questions")." WHERE title='{$qidattributes['array_filter']}' AND language='{$surveyprintlang}' AND sid = '$surveyid'";
$newresult=db_execute_assoc($newquery);
$newquestiontext=$newresult->fetchRow();
$output .= "\n<p class='extrahelp'>
".sprintf($clang->gT("Only answer this question for the items you selected in question *%s* ('%s')"),$qidattributes['array_filter'], FlattenText(br2nl($newquestiontext['question'])))."
</p>\n";
}
if(!empty($qidattributes['array_filter_exclude']))
{
$newquery="SELECT question FROM ".db_table_name("questions")." WHERE title='{$qidattributes['array_filter_exclude']}' AND language='{$surveyprintlang}' AND sid = '$surveyid'";
$newresult=db_execute_assoc($newquery);
$newquestiontext=$newresult->fetchRow();
$output .= "\n <p class='extrahelp'>
".sprintf($clang->gT("Only answer this question for the items you did not select in question *%s* ('%s')"),$qidattributes['array_filter_exclude'], br2nl($newquestiontext['question']))."
</p>\n";
}
return $output;
}
?>
+1 -1
View File
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: deactivate.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: deactivate.php 11664 2011-12-16 05:19:42Z tmswhite $
*/
include_once("login_check.php"); //Login Check dies also if the script is started directly
+1 -1
View File
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: deletesurvey.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: deletesurvey.php 11664 2011-12-16 05:19:42Z tmswhite $
*/
//Ensure script is not run directly, avoid path disclosure
+1 -1
View File
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: dumpdb.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: dumpdb.php 11664 2011-12-16 05:19:42Z tmswhite $
*/
include_once("login_check.php"); //Login Check dies also if the script is started directly
+1 -1
View File
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: dumpgroup.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: dumpgroup.php 11607 2011-12-06 23:19:52Z tmswhite $
*/
+1 -1
View File
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: dumplabel.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: dumplabel.php 11607 2011-12-06 23:19:52Z tmswhite $
*/
+1 -1
View File
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: dumpquestion.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: dumpquestion.php 11607 2011-12-06 23:19:52Z tmswhite $
*/
+10 -9
View File
@@ -107,7 +107,7 @@
// Insert some Javascript variables
$surveysummary .= "\n<script type='text/javascript'>
var languagecount=".count($anslangs).";\n
var languagecount=".count($anslangs).";
var scalecount=".$scalecount.";
var assessmentvisible=".($assessmentvisible?'true':'false').";
var newansweroption_text='".$clang->gT('New answer option','js')."';
@@ -118,6 +118,7 @@
var quickaddtitle='".$clang->gT('Quick-add answers','js')."';
var sAssessmentValue='".$clang->gT('Assessment value','js')."';
var duplicateanswercode='".$clang->gT('Error: You are trying to use duplicate answer codes.','js')."';
var strNoLabelSet='".$clang->gT('There are no label sets which match the survey default language','js')."';
var langs='".implode(';',$anslangs)."';</script>\n";
foreach ($anslangs as $anslang)
@@ -239,20 +240,20 @@
}
// Label set browser
// <br/><input type='checkbox' checked='checked' id='languagefilter' /><label for='languagefilter'>".$clang->gT('Match language')."</label>
$vasummary .= "<div id='labelsetbrowser' style='display:none;'><div style='float:left;width:260px;'>
$vasummary .= "<div id='labelsetbrowser' class='labelsets-update' style='display:none;'><div class='labelset-list' style='float:left;width:260px;'>
<label for='labelsets'>".$clang->gT('Available label sets:')."</label>
<br /><select id='labelsets' size='10' style='width:250px;'><option>&nbsp;</option></select>
<br /><button id='btnlsreplace' type='button'>".$clang->gT('Replace')."</button>
<select id='labelsets' size='10' style='width:250px;'><option>&nbsp;</option></select>
<p class='button-list'><button id='btnlsreplace' type='button'>".$clang->gT('Replace')."</button>
<button id='btnlsinsert' type='button'>".$clang->gT('Add')."</button>
<button id='btncancel' type='button'>".$clang->gT('Cancel')."</button></div>
<button id='btncancel' type='button'>".$clang->gT('Cancel')."</button></p></div>
<div id='labelsetpreview' style='float:right;width:500px;'></div></div> ";
$vasummary .= "<div id='quickadd' style='display:none;'><div style='float:left;'>
$vasummary .= "<div id='quickadd' class='labelsets-update' style='display:none;'><div class='labelset-list' style='float:left;'>
<label for='quickadd'>".$clang->gT('Enter your answers:')."</label>
<br /><textarea id='quickaddarea' class='tipme' title='".$clang->gT('Enter one answer per line. You can provide a code by separating code and answer text with a semikolon or tab. For multilingual surveys you add the translation(s) on the same line separated with a semikolon/tab.')."' rows='30' style='width:570px;'></textarea>
<br /><button id='btnqareplace' type='button'>".$clang->gT('Replace')."</button>
<textarea id='quickaddarea' class='tipme' title='".$clang->gT('Enter one answer per line. You can provide a code by separating code and answer text with a semikolon or tab. For multilingual surveys you add the translation(s) on the same line separated with a semikolon/tab.')."' rows='30' style='width:570px;'></textarea>
<p class='button-list'><button id='btnqareplace' type='button'>".$clang->gT('Replace')."</button>
<button id='btnqainsert' type='button'>".$clang->gT('Add')."</button>
<button id='btnqacancel' type='button'>".$clang->gT('Cancel')."</button></div>
<button id='btnqacancel' type='button'>".$clang->gT('Cancel')."</button></p></div>
</div> ";
// Save button
$vasummary .= "<p><input type='submit' id='saveallbtn_$anslang' name='method' value='".$clang->gT("Save changes")."' />\n";
+10 -9
View File
@@ -73,6 +73,7 @@
var lsbrowsertitle='".$clang->gT('Label set browser','js')."';
var quickaddtitle='".$clang->gT('Quick-add subquestions','js')."';
var duplicateanswercode='".$clang->gT('Error: You are trying to use duplicate subquestion codes.','js')."';
var strNoLabelSet='".$clang->gT('There are no label sets which match the survey default language','js')."';
var langs='".implode(';',$anslangs)."';</script>\n";
@@ -195,7 +196,7 @@
}
elseif ($activated != 'Y' && $first) // If survey is decactivated
{
$vasummary .= "<img class='handle' src='$imageurl/handle.png' /></td><td><input type='hidden' class='oldcode' id='oldcode_{$row['qid']}_{$row['scale_id']}' name='oldcode_{$row['qid']}_{$row['scale_id']}' value=\"{$row['title']}\" /><input type='text' id='code_{$row['qid']}_{$row['scale_id']}' class='code' name='code_{$row['qid']}_{$row['scale_id']}' value=\"{$row['title']}\" maxlength='5' size='5'"
$vasummary .= "<img class='handle' src='$imageurl/handle.png' /></td><td><input type='hidden' class='oldcode' id='oldcode_{$row['qid']}_{$row['scale_id']}' name='oldcode_{$row['qid']}_{$row['scale_id']}' value=\"{$row['title']}\" /><input type='text' id='code_{$row['qid']}_{$row['scale_id']}' class='code' name='code_{$row['qid']}_{$row['scale_id']}' value=\"{$row['title']}\" maxlength='20' size='5'"
." onkeypress=\" if(event.keyCode==13) {if (event && event.preventDefault) event.preventDefault(); document.getElementById('saveallbtn_$anslang').click(); return false;} return goodchars(event,'1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWZYZ_')\""
." />";
@@ -239,19 +240,19 @@
// Label set browser
// <br/><input type='checkbox' checked='checked' id='languagefilter' /><label for='languagefilter'>".$clang->gT('Match language')."</label>
$vasummary .= "<div id='labelsetbrowser' style='display:none;'><div style='float:left; width:260px;'>
$vasummary .= "<div id='labelsetbrowser' style='display:none;'><div class='labelset-list' style='float:left; width:260px;'>
<label for='labelsets'>".$clang->gT('Available label sets:')."</label>
<br /><select id='labelsets' size='10' style='width:250px;'><option>&nbsp;</option></select>
<br /><button id='btnlsreplace' type='button'>".$clang->gT('Replace')."</button>
<select id='labelsets' size='10' style='width:250px;'><option>&nbsp;</option></select>
<p class=button-list'><button id='btnlsreplace' type='button'>".$clang->gT('Replace')."</button>
<button id='btnlsinsert' type='button'>".$clang->gT('Add')."</button>
<button id='btncancel' type='button'>".$clang->gT('Cancel')."</button></div>
<button id='btncancel' type='button'>".$clang->gT('Cancel')."</button></p></div>
<div id='labelsetpreview' style='float:right;width:500px;'></div></div> ";
$vasummary .= "<div id='quickadd' style='display:none;'><div style='float:left;'>
$vasummary .= "<div id='quickadd' class='labelsets-update' style='display:none;'><div style='float:left;'>
<label for='quickadd'>".$clang->gT('Enter your subquestions:')."</label>
<br /><textarea id='quickaddarea' class='tipme' title='".$clang->gT('Enter one subquestion per line. You can provide a code by separating code and subquestion text with a semikolon or tab. For multilingual surveys you add the translation(s) on the same line separated with a semikolon/tab.')."' rows='30' style='width:570px;'></textarea>
<br /><button id='btnqareplace' type='button'>".$clang->gT('Replace')."</button>
<textarea id='quickaddarea' class='tipme' title='".$clang->gT('Enter one subquestion per line. You can provide a code by separating code and subquestion text with a semikolon or tab. For multilingual surveys you add the translation(s) on the same line separated with a semikolon/tab.')."' rows='30' style='width:570px;'></textarea>
<p class=button-list'><button id='btnqareplace' type='button'>".$clang->gT('Replace')."</button>
<button id='btnqainsert' type='button'>".$clang->gT('Add')."</button>
<button id='btnqacancel' type='button'>".$clang->gT('Cancel')."</button></div>
<button id='btnqacancel' type='button'>".$clang->gT('Cancel')."</button></p></div>
</div> ";
$vasummary .= "<p>"
."<input type='submit' id='saveallbtn_$anslang' name='method' value='".$clang->gT("Save changes")."' />\n";
File diff suppressed because it is too large Load Diff
@@ -1,118 +1,118 @@
<?php
/*
* LimeSurvey
* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id:
*
*/
include_once("login_check.php"); //Login Check dies also if the script is started directly
if(bHasSurveyPermission($surveyid,'surveylocale','read'))
{
$grplangs = GetAdditionalLanguagesFromSurveyID($surveyid);
$baselang = GetBaseLanguageFromSurveyID($surveyid);
array_unshift($grplangs,$baselang);
$editsurvey = PrepareEditorScript();
$editsurvey .="<div class='header ui-widget-header'>".$clang->gT("Edit survey text elements")."</div>\n";
$editsurvey .= "<form id='addnewsurvey' class='form30' name='addnewsurvey' action='$scriptname' method='post'>\n"
. '<div id="tabs">';
$i = 0;
foreach ($grplangs as $grouplang)
{
// this one is created to get the right default texts fo each language
$bplang = new limesurvey_lang($grouplang);
$esquery = "SELECT * FROM ".db_table_name("surveys_languagesettings")." WHERE surveyls_survey_id=$surveyid and surveyls_language='$grouplang'";
$esresult = db_execute_assoc($esquery); //Checked
$esrow = $esresult->FetchRow();
$tab_title[$i] = getLanguageNameFromCode($esrow['surveyls_language'],false);
if ($esrow['surveyls_language']==GetBaseLanguageFromSurveyID($surveyid))
$tab_title[$i] .= '('.$clang->gT("Base language").')';
$esrow = array_map('htmlspecialchars', $esrow);
$tab_content[$i] = "<ul>\n"
. "<li><label for=''>".$clang->gT("Survey title").":</label>\n"
. "<input type='text' size='80' name='short_title_".$esrow['surveyls_language']."' value=\"{$esrow['surveyls_title']}\" /></li>\n"
. "<li><label for=''>".$clang->gT("Description:")."</label>\n"
. "<textarea cols='80' rows='15' name='description_".$esrow['surveyls_language']."'>{$esrow['surveyls_description']}</textarea>\n"
. getEditor("survey-desc","description_".$esrow['surveyls_language'], "[".$clang->gT("Description:", "js")."](".$esrow['surveyls_language'].")",$surveyid,'','',$action)
. "</li>\n"
. "<li><label for=''>".$clang->gT("Welcome message:")."</label>\n"
. "<textarea cols='80' rows='15' name='welcome_".$esrow['surveyls_language']."'>{$esrow['surveyls_welcometext']}</textarea>\n"
. getEditor("survey-welc","welcome_".$esrow['surveyls_language'], "[".$clang->gT("Welcome:", "js")."](".$esrow['surveyls_language'].")",$surveyid,'','',$action)
. "</li>\n"
. "<li><label for=''>".$clang->gT("End message:")."</label>\n"
. "<textarea cols='80' rows='15' name='endtext_".$esrow['surveyls_language']."'>{$esrow['surveyls_endtext']}</textarea>\n"
. getEditor("survey-endtext","endtext_".$esrow['surveyls_language'], "[".$clang->gT("End message:", "js")."](".$esrow['surveyls_language'].")",$surveyid,'','',$action)
. "</li>\n"
. "<li><label for=''>".$clang->gT("End URL:")."</label>\n"
. "<input type='text' size='80' name='url_".$esrow['surveyls_language']."' value=\"{$esrow['surveyls_url']}\" />\n"
. "</li>"
. "<li><label for=''>".$clang->gT("URL description:")."</label>\n"
. "<input type='text' size='80' name='urldescrip_".$esrow['surveyls_language']."' value=\"{$esrow['surveyls_urldescription']}\" />\n"
. "</li>"
. "<li><label for=''>".$clang->gT("Date format:")."</label>\n"
. "<select size='1' name='dateformat_".$esrow['surveyls_language']."'>\n";
foreach (getDateFormatData() as $index=>$dateformatdata)
{
$tab_content[$i].= "<option value='{$index}'";
if ($esrow['surveyls_dateformat']==$index) {
$tab_content[$i].=" selected='selected'";
}
$tab_content[$i].= ">".$dateformatdata['dateformat'].'</option>';
}
$tab_content[$i].= "</select></li>"
. "<li><label for=''>".$clang->gT("Decimal separator:")."</label>\n";
$tab_content[$i].="<select size='1' name='numberformat_".$esrow['surveyls_language']."'>\n";
foreach (getRadixPointData() as $index=>$radixptdata)
{
$tab_content[$i].= "<option value='{$index}'";
if ($esrow['surveyls_numberformat']==$index) {
$tab_content[$i].=" selected='selected'";
}
$tab_content[$i].= ">".$radixptdata['desc'].'</option>';
}
$tab_content[$i].= "</select></li></ul>";
$i++;
}
$editsurvey .= "<ul>";
foreach($tab_title as $i=>$eachtitle){
$editsurvey .= "<li style='clear:none'><a href='#edittxtele$i'>$eachtitle</a></li>";
}
$editsurvey .= "</ul>";
foreach ($tab_content as $i=>$eachcontent){
$editsurvey .= "<div id='edittxtele$i'>$eachcontent</div>";
}
$editsurvey .= "</div>";
if(bHasSurveyPermission($surveyid,'surveylocale','update'))
{
$editsurvey .= "<p><input type='submit' class='standardbtn' value='".$clang->gT("Save")."' />\n"
. "<input type='hidden' name='action' value='updatesurveylocalesettings' />\n"
. "<input type='hidden' name='sid' value=\"{$surveyid}\" />\n"
. "<input type='hidden' name='language' value=\"{$esrow['surveyls_language']}\" />\n"
. "</p>\n"
. "</form>\n";
}
}
else
{
include("access_denied.php");
}
?>
<?php
/*
* LimeSurvey
* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id:
*
*/
include_once("login_check.php"); //Login Check dies also if the script is started directly
if(bHasSurveyPermission($surveyid,'surveylocale','read'))
{
$grplangs = GetAdditionalLanguagesFromSurveyID($surveyid);
$baselang = GetBaseLanguageFromSurveyID($surveyid);
array_unshift($grplangs,$baselang);
$editsurvey = PrepareEditorScript();
$editsurvey .="<div class='header ui-widget-header'>".$clang->gT("Edit survey text elements")."</div>\n";
$editsurvey .= "<form id='addnewsurvey' class='form30' name='addnewsurvey' action='$scriptname' method='post'>\n"
. '<div id="tabs">';
$i = 0;
foreach ($grplangs as $grouplang)
{
// this one is created to get the right default texts fo each language
$bplang = new limesurvey_lang($grouplang);
$esquery = "SELECT * FROM ".db_table_name("surveys_languagesettings")." WHERE surveyls_survey_id=$surveyid and surveyls_language='$grouplang'";
$esresult = db_execute_assoc($esquery); //Checked
$esrow = $esresult->FetchRow();
if($esrow['surveyls_url']==""){$esrow['surveyls_url']="http://";}
$tab_title[$i] = getLanguageNameFromCode($esrow['surveyls_language'],false);
if ($esrow['surveyls_language']==GetBaseLanguageFromSurveyID($surveyid))
$tab_title[$i] .= '('.$clang->gT("Base language").')';
$esrow = array_map('htmlspecialchars', $esrow);
$tab_content[$i] = "<ul>\n"
. "<li><label for=''>".$clang->gT("Survey title").":</label>\n"
. "<input type='text' size='80' name='short_title_".$esrow['surveyls_language']."' value=\"{$esrow['surveyls_title']}\" /></li>\n"
. "<li><label for=''>".$clang->gT("Description:")."</label>\n"
. "<textarea cols='80' rows='15' name='description_".$esrow['surveyls_language']."'>{$esrow['surveyls_description']}</textarea>\n"
. getEditor("survey-desc","description_".$esrow['surveyls_language'], "[".$clang->gT("Description:", "js")."](".$esrow['surveyls_language'].")",$surveyid,'','',$action)
. "</li>\n"
. "<li><label for=''>".$clang->gT("Welcome message:")."</label>\n"
. "<textarea cols='80' rows='15' name='welcome_".$esrow['surveyls_language']."'>{$esrow['surveyls_welcometext']}</textarea>\n"
. getEditor("survey-welc","welcome_".$esrow['surveyls_language'], "[".$clang->gT("Welcome:", "js")."](".$esrow['surveyls_language'].")",$surveyid,'','',$action)
. "</li>\n"
. "<li><label for=''>".$clang->gT("End message:")."</label>\n"
. "<textarea cols='80' rows='15' name='endtext_".$esrow['surveyls_language']."'>{$esrow['surveyls_endtext']}</textarea>\n"
. getEditor("survey-endtext","endtext_".$esrow['surveyls_language'], "[".$clang->gT("End message:", "js")."](".$esrow['surveyls_language'].")",$surveyid,'','',$action)
. "</li>\n"
. "<li><label for=''>".$clang->gT("End URL:")."</label>\n"
. "<input type='text' size='80' name='url_".$esrow['surveyls_language']."' value=\"{$esrow['surveyls_url']}\" />\n"
. "</li>"
. "<li><label for=''>".$clang->gT("URL description:")."</label>\n"
. "<input type='text' size='80' name='urldescrip_".$esrow['surveyls_language']."' value=\"{$esrow['surveyls_urldescription']}\" />\n"
. "</li>"
. "<li><label for=''>".$clang->gT("Date format:")."</label>\n"
. "<select size='1' name='dateformat_".$esrow['surveyls_language']."'>\n";
foreach (getDateFormatData() as $index=>$dateformatdata)
{
$tab_content[$i].= "<option value='{$index}'";
if ($esrow['surveyls_dateformat']==$index) {
$tab_content[$i].=" selected='selected'";
}
$tab_content[$i].= ">".$dateformatdata['dateformat'].'</option>';
}
$tab_content[$i].= "</select></li>"
. "<li><label for=''>".$clang->gT("Decimal separator:")."</label>\n";
$tab_content[$i].="<select size='1' name='numberformat_".$esrow['surveyls_language']."'>\n";
foreach (getRadixPointData() as $index=>$radixptdata)
{
$tab_content[$i].= "<option value='{$index}'";
if ($esrow['surveyls_numberformat']==$index) {
$tab_content[$i].=" selected='selected'";
}
$tab_content[$i].= ">".$radixptdata['desc'].'</option>';
}
$tab_content[$i].= "</select></li></ul>";
$i++;
}
$editsurvey .= "<ul>";
foreach($tab_title as $i=>$eachtitle){
$editsurvey .= "<li style='clear:none'><a href='#edittxtele$i'>$eachtitle</a></li>";
}
$editsurvey .= "</ul>";
foreach ($tab_content as $i=>$eachcontent){
$editsurvey .= "<div id='edittxtele$i'>$eachcontent</div>";
}
$editsurvey .= "</div>";
if(bHasSurveyPermission($surveyid,'surveylocale','update'))
{
$editsurvey .= "<p><input type='submit' class='standardbtn' value='".$clang->gT("Save")."' />\n"
. "<input type='hidden' name='action' value='updatesurveylocalesettings' />\n"
. "<input type='hidden' name='sid' value=\"{$surveyid}\" />\n"
. "<input type='hidden' name='language' value=\"{$esrow['surveyls_language']}\" />\n"
. "</p>\n"
. "</form>\n";
}
}
else
{
include("access_denied.php");
}
?>
File diff suppressed because it is too large Load Diff
+309 -305
View File
@@ -1,305 +1,309 @@
<?php
/*
* LimeSurvey
* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: export_data_r.php 10925 2011-09-02 14:12:02Z c_schmitz $
*/
// Security Checked: POST, GET, SESSION, REQUEST, returnglobal, DB
/*
* The SPSS DATA LIST / BEGIN DATA parser is rather simple minded, the number after the type
* specifier identifies the field width (maximum number of characters to scan)
* It will stop short of that number of characters, honouring quote delimited
* space separated strings, however if the width is too small the remaining data in the current
* line becomes part of the next column. Since we want to restrict this script to ONE scan of
* the data (scan & output at same time), the information needed to construct the
* DATA LIST is held in the $fields array, while the actual data is written to a
* to a temporary location, updating length (size) values in the $fields array as
* the tmp file is generated (uses @fwrite's return value rather than strlen).
* Final output renders $fields to a DATA LIST, and then stitches in the tmp file data.
*
* Optimization opportunities remain in the VALUE LABELS section, which runs a query / column
*/
$length_vallabel = '120'; // Set the max text length of Value Labels
$length_data = '25500'; // Set the max text length of Text Data
$length_varlabel = '25500'; // Set the max text length of Variable Labels
$headerComment = '';
$tempFile = '';
include_once('login_check.php');
//for scale 1=nominal, 2=ordinal, 3=scale
$typeMap = array(
'5'=>Array('name'=>'5 Point Choice','size'=>1,'SPSStype'=>'F','Scale'=>3),
'B'=>Array('name'=>'Array (10 Point Choice)','size'=>1,'SPSStype'=>'F','Scale'=>3),
'A'=>Array('name'=>'Array (5 Point Choice)','size'=>1,'SPSStype'=>'F','Scale'=>3),
'F'=>Array('name'=>'Array (Flexible Labels)','size'=>1,'SPSStype'=>'F'),
'1'=>Array('name'=>'Array (Flexible Labels) Dual Scale','size'=>1,'SPSStype'=>'F'),
'H'=>Array('name'=>'Array (Flexible Labels) by Column','size'=>1,'SPSStype'=>'F'),
'E'=>Array('name'=>'Array (Increase, Same, Decrease)','size'=>1,'SPSStype'=>'F','Scale'=>2),
'C'=>Array('name'=>'Array (Yes/No/Uncertain)','size'=>1,'SPSStype'=>'F'),
'X'=>Array('name'=>'Boilerplate Question','size'=>1,'SPSStype'=>'A','hide'=>1),
'D'=>Array('name'=>'Date','size'=>10,'SPSStype'=>'SDATE'),
'G'=>Array('name'=>'Gender','size'=>1,'SPSStype'=>'F'),
'U'=>Array('name'=>'Huge Free Text','size'=>1,'SPSStype'=>'A'),
'I'=>Array('name'=>'Language Switch','size'=>1,'SPSStype'=>'A'),
'!'=>Array('name'=>'List (Dropdown)','size'=>1,'SPSStype'=>'F'),
'W'=>Array('name'=>'List (Flexible Labels) (Dropdown)','size'=>1,'SPSStype'=>'F'),
'Z'=>Array('name'=>'List (Flexible Labels) (Radio)','size'=>1,'SPSStype'=>'F'),
'L'=>Array('name'=>'List (Radio)','size'=>1,'SPSStype'=>'F'),
'O'=>Array('name'=>'List With Comment','size'=>1,'SPSStype'=>'F'),
'T'=>Array('name'=>'Long free text','size'=>1,'SPSStype'=>'A'),
'K'=>Array('name'=>'Multiple Numerical Input','size'=>1,'SPSStype'=>'F'),
'M'=>Array('name'=>'Multiple choice','size'=>1,'SPSStype'=>'F'),
'P'=>Array('name'=>'Multiple choice with comments','size'=>1,'SPSStype'=>'F'),
'Q'=>Array('name'=>'Multiple Short Text','size'=>1,'SPSStype'=>'F'),
'N'=>Array('name'=>'Numerical Input','size'=>3,'SPSStype'=>'F','Scale'=>3),
'R'=>Array('name'=>'Ranking','size'=>1,'SPSStype'=>'F'),
'S'=>Array('name'=>'Short free text','size'=>1,'SPSStype'=>'F'),
'Y'=>Array('name'=>'Yes/No','size'=>1,'SPSStype'=>'F'),
':'=>Array('name'=>'Multi flexi numbers','size'=>1,'SPSStype'=>'F','Scale'=>3),
';'=>Array('name'=>'Multi flexi text','size'=>1,'SPSStype'=>'A'),
);
if (!isset($surveyid)) {$surveyid=returnglobal('sid');}
$filterstate = incompleteAnsFilterstate();
$quexsfilterstate = questionnaireSampleFilterstate();
$headerComment = '#$Rev: 10925 $' . " $filterstate.\n";
if (isset($_GET['dldata'])) $subaction = "dldata";
if (isset($_GET['dlstructure'])) $subaction = "dlstructure";
if (!isset($subaction))
{
$exportroutput = browsemenubar($clang->gT('Export results'));
$exportroutput = browsemenubar($clang->gT('Export results'));
$exportroutput .= "<div class='header ui-widget-header'>".$clang->gT("Export result data to R")."</div>\n";
$selecthide="";
$selectshow="";
$selectinc="";
switch ($filterstate) {
case "inc":
$selectinc="selected='selected'";
break;
case "filter":
$selecthide="selected='selected'";
break;
default:
$selectshow="selected='selected'";
}
$exportroutput .= "<form action='$scriptname' id='exportspss' method='get'><ul>\n"
."<li><label for='filterinc'>".$clang->gT("Data selection:")."</label><select id='filterinc' name='filterinc' onchange='this.form.submit();'>\n"
."\t<option value='filter' $selecthide>".$clang->gT("Completed responses only")."</option>\n"
."\t<option value='show' $selectshow>".$clang->gT("All responses")."</option>\n"
."\t<option value='incomplete' $selectinc>".$clang->gT("Incomplete responses only")."</option>\n"
."</select></li>\n";
//queXS Addition
include_once("../quexs.php");
$exportroutput .= "<li><label for='quexsfilterinc'>".$clang->gT("Questionnaire and Sample selection:")."</label><select id='quexsfilterinc' name='quexsfilterinc' onchange='this.form.submit();'>\n"
."\t<option value='all' >".$clang->gT("All queXS questionnaires and samples associated with this instrument")."</option>\n"
. get_questionnaire_sample_list($surveyid,$quexsfilterstate)
."</select></li>\n";
$filename = "survey_".$surveyid."_R_syntax_file.R";
$exportroutput .= "<input type='hidden' name='sid' value='$surveyid' />\n"
."<input type='hidden' name='action' value='exportr' /></li>\n"
."<li><label for='dlstructure'>" . $clang->gT("Step 1:") . "</label><input type='submit' name='dlstructure' id='dlstructure' value='" . $clang->gT("Export R syntax file") . "'/></li>\n"
."<li><label for='dldata'/>" . $clang->gT("Step 2:") . "</label><input type='submit' name='dldata' id='dldata' value='" . $clang->gT("Export .csv data file") . "'/></li></ul>\n"
."</form>\n"
."<p><div class='messagebox ui-corner-all'><div class='header ui-widget-header'>".$clang->gT("Instructions for the impatient")."</div>"
."<br/><ol style='margin:0 auto; font-size:8pt;'>"
."<li>".$clang->gT("Download the data and the syntax file.")."</li>"
."<li>".$clang->gT("Save both of them on the R working directory (use getwd() and setwd() on the R command window to get and set it)").".</li>"
."<li>".sprintf($clang->gT("digit: source(\"%s\", encoding = \"UTF-8\") on the R command window"), $filename)."</li>"
."</ol><br />"
.$clang->gT("Your data should be imported now, the data.frame is named \"data\", the variable.labels are attributes of data (\"attributes(data)\$variable.labels\"), like for foreign:read.spss.")
."</div>";
}
else
{
// Get Base language:
$language = GetBaseLanguageFromSurveyID($surveyid);
$clang = new limesurvey_lang($language);
require_once ("export_data_functions.php");
}
if ($subaction=='dldata')
{
header("Content-Disposition: attachment; filename=survey_".$surveyid."_R_data_file.csv");
header("Content-type: text/comma-separated-values; charset=UTF-8");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: public");
$na=""; //change to empty string instead of two double quotes to fix warnings on NA
spss_export_data($na);
exit;
}
if ($subaction=='dlstructure')
{
header("Content-Disposition: attachment; filename=survey_".$surveyid."_R_syntax_file.R");
header("Content-type: application/download; charset=UTF-8");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: public");
echo $headerComment;
echo "data <- read.table(\"survey_".$surveyid
."_R_data_file.csv\", sep=\",\", quote = \"'\", "
."na.strings=c(\"\",\"\\\"\\\"\"), "
."stringsAsFactors=FALSE)\n\n";
// echo "names(data) <- paste(\"V\",1:dim(data)[2],sep=\"\")\n\n";
// Build array that has to be returned
$fields = spss_fieldmap("V");
//Now get the query string with all fields to export
$query = spss_getquery();
$result=db_execute_num($query) or safe_die("Couldn't get results<br />$query<br />".$connect->ErrorMsg()); //Checked
$num_fields = $result->FieldCount();
//Now we check if we need to adjust the size of the field or the type of the field
while ($row = $result->FetchRow()) {
$fieldno = 0;
while ($fieldno < $num_fields)
{
//Performance improvement, don't recheck fields that have valuelabels
if (!isset($fields[$fieldno]['answers'])) {
$strTmp=mb_substr(strip_tags_full($row[$fieldno]), 0, $length_data);
$len = mb_strlen($strTmp);
if($len > $fields[$fieldno]['size']) $fields[$fieldno]['size'] = $len;
if (trim($strTmp) != ''){
if ($fields[$fieldno]['SPSStype']=='F' && (my_is_numeric($strTmp)===false || $fields[$fieldno]['size']>16))
{
$fields[$fieldno]['SPSStype']='A';
}
}
}
$fieldno++;
}
}
$errors = "";
$i = 1;
foreach ($fields as $field)
{
if($field['SPSStype'] == 'DATETIME23.2') $field['size']='';
if($field['LStype'] == 'N' || $field['LStype']=='K')
{
$field['size'].='.'.($field['size']-1);
}
switch ($field['SPSStype'])
{
case 'F':
$type="numeric";
break;
case 'A':
$type="character";
break;
case 'DATETIME23.2':
case 'SDATE':
$type="character";
//@TODO set $type to format for date
break;
}
if (!$field['hide'])
{
echo "data[, " . $i . "] <- "
."as.$type(data[, " . $i . "])\n";
echo 'attributes(data)$variable.labels[' . $i . '] <- "'
. addslashes(
htmlspecialchars_decode(
mb_substr(
strip_tags_full(
$field['VariableLabel']),0,$length_varlabel))) // <AdV> added htmlspecialchars_decode
. '"' . "\n";
// Create the value Labels!
if (isset($field['answers']))
{
$answers = $field['answers'];
//print out the value labels!
// data$V14=factor(data$V14,levels=c(1,2,3),labels=c("Yes","No","Uncertain"))
echo 'data[, ' . $i .'] <- factor(data[, ' . $i . '], levels=c(';
$str="";
foreach ($answers as $answer) {
if ($field['SPSStype']=="F" && my_is_numeric($answer['code'])) {
$str .= ",{$answer['code']}";
} else {
$str .= ",\"{$answer['code']}\"";
}
}
$str = mb_substr($str,1);
echo $str . '),labels=c(';
$str="";
foreach ($answers as $answer) {
$str .= ",\"{$answer['value']}\"";
}
$str = mb_substr($str,1);
if($field['scale']!=='' && $field['scale'] == 2 ) {
$scale = ",ordered=TRUE";
} else {
$scale = "";
}
echo "$str)$scale)\n";
}
//Rename the Variables (in case somethings goes wrong, we still have the OLD values
if (isset($field['sql_name']))
{
$ftitle = $field['title'];
if (!preg_match ("/^([a-z]|[A-Z])+.*$/", $ftitle))
{
$ftitle = "q_" . $ftitle;
}
$ftitle = str_replace(array("-",":",";","!"), array("_hyph_","_dd_","_dc_","_excl_"), $ftitle);
if (!$field['hide'])
{
if ($ftitle != $field['title'])
{
$errors .= "# Variable name was incorrect and was changed from {$field['title']} to $ftitle .\n";
}
echo "names(data)[" . $i . "] <- "
. "\"". $ftitle . "\"\n"; // <AdV> added \n
}
$i++;
}
else
{
echo "#sql_name not set\n";
}
}
else
{
echo "#Field hidden\n";
}
echo "\n";
} // end foreach
echo $errors;
exit;
}
?>
<?php
/*
* LimeSurvey
* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: export_data_r.php 12179 2012-01-24 13:27:31Z adevries $
*/
// Security Checked: POST, GET, SESSION, REQUEST, returnglobal, DB
/*
* The SPSS DATA LIST / BEGIN DATA parser is rather simple minded, the number after the type
* specifier identifies the field width (maximum number of characters to scan)
* It will stop short of that number of characters, honouring quote delimited
* space separated strings, however if the width is too small the remaining data in the current
* line becomes part of the next column. Since we want to restrict this script to ONE scan of
* the data (scan & output at same time), the information needed to construct the
* DATA LIST is held in the $fields array, while the actual data is written to a
* to a temporary location, updating length (size) values in the $fields array as
* the tmp file is generated (uses @fwrite's return value rather than strlen).
* Final output renders $fields to a DATA LIST, and then stitches in the tmp file data.
*
* Optimization opportunities remain in the VALUE LABELS section, which runs a query / column
*/
$length_vallabel = '120'; // Set the max text length of Value Labels
$length_data = '25500'; // Set the max text length of Text Data
$length_varlabel = '25500'; // Set the max text length of Variable Labels
$headerComment = '';
$tempFile = '';
include_once('login_check.php');
//for scale 1=nominal, 2=ordinal, 3=scale
$typeMap = array(
'5'=>Array('name'=>'5 Point Choice','size'=>1,'SPSStype'=>'F','Scale'=>3),
'B'=>Array('name'=>'Array (10 Point Choice)','size'=>1,'SPSStype'=>'F','Scale'=>3),
'A'=>Array('name'=>'Array (5 Point Choice)','size'=>1,'SPSStype'=>'F','Scale'=>3),
'F'=>Array('name'=>'Array (Flexible Labels)','size'=>1,'SPSStype'=>'F'),
'1'=>Array('name'=>'Array (Flexible Labels) Dual Scale','size'=>1,'SPSStype'=>'F'),
'H'=>Array('name'=>'Array (Flexible Labels) by Column','size'=>1,'SPSStype'=>'F'),
'E'=>Array('name'=>'Array (Increase, Same, Decrease)','size'=>1,'SPSStype'=>'F','Scale'=>2),
'C'=>Array('name'=>'Array (Yes/No/Uncertain)','size'=>1,'SPSStype'=>'F'),
'X'=>Array('name'=>'Boilerplate Question','size'=>1,'SPSStype'=>'A','hide'=>1),
'D'=>Array('name'=>'Date','size'=>10,'SPSStype'=>'SDATE'),
'G'=>Array('name'=>'Gender','size'=>1,'SPSStype'=>'F'),
'U'=>Array('name'=>'Huge Free Text','size'=>1,'SPSStype'=>'A'),
'I'=>Array('name'=>'Language Switch','size'=>1,'SPSStype'=>'A'),
'!'=>Array('name'=>'List (Dropdown)','size'=>1,'SPSStype'=>'F'),
'W'=>Array('name'=>'List (Flexible Labels) (Dropdown)','size'=>1,'SPSStype'=>'F'),
'Z'=>Array('name'=>'List (Flexible Labels) (Radio)','size'=>1,'SPSStype'=>'F'),
'L'=>Array('name'=>'List (Radio)','size'=>1,'SPSStype'=>'F'),
'O'=>Array('name'=>'List With Comment','size'=>1,'SPSStype'=>'F'),
'T'=>Array('name'=>'Long free text','size'=>1,'SPSStype'=>'A'),
'K'=>Array('name'=>'Multiple Numerical Input','size'=>1,'SPSStype'=>'F'),
'M'=>Array('name'=>'Multiple choice','size'=>1,'SPSStype'=>'F'),
'P'=>Array('name'=>'Multiple choice with comments','size'=>1,'SPSStype'=>'F'),
'Q'=>Array('name'=>'Multiple Short Text','size'=>1,'SPSStype'=>'F'),
'N'=>Array('name'=>'Numerical Input','size'=>3,'SPSStype'=>'F','Scale'=>3),
'R'=>Array('name'=>'Ranking','size'=>1,'SPSStype'=>'F'),
'S'=>Array('name'=>'Short free text','size'=>1,'SPSStype'=>'F'),
'Y'=>Array('name'=>'Yes/No','size'=>1,'SPSStype'=>'F'),
':'=>Array('name'=>'Multi flexi numbers','size'=>1,'SPSStype'=>'F'),
';'=>Array('name'=>'Multi flexi text','size'=>1,'SPSStype'=>'A'),
'*'=>Array('name'=>'Equation','size'=>1,'SPSStype'=>'A'),
);
if (!isset($surveyid)) {$surveyid=returnglobal('sid');}
$filterstate = incompleteAnsFilterstate();
$quexsfilterstate = questionnaireSampleFilterstate();
$headerComment = '#$Rev: 12179 $' . " $filterstate.\n";
if (isset($_GET['dldata'])) $subaction = "dldata";
if (isset($_GET['dlstructure'])) $subaction = "dlstructure";
if (!isset($subaction))
{
$exportroutput = browsemenubar($clang->gT('Export results'));
$exportroutput = browsemenubar($clang->gT('Export results'));
$exportroutput .= "<div class='header ui-widget-header'>".$clang->gT("Export result data to R")."</div>\n";
$selecthide="";
$selectshow="";
$selectinc="";
switch ($filterstate) {
case "inc":
$selectinc="selected='selected'";
break;
case "filter":
$selecthide="selected='selected'";
break;
default:
$selectshow="selected='selected'";
}
$exportroutput .= "<form action='$scriptname' id='exportspss' method='get'><ul>\n"
."<li><label for='filterinc'>".$clang->gT("Data selection:")."</label><select id='filterinc' name='filterinc' onchange='this.form.submit();'>\n"
."\t<option value='filter' $selecthide>".$clang->gT("Completed responses only")."</option>\n"
."\t<option value='show' $selectshow>".$clang->gT("All responses")."</option>\n"
."\t<option value='incomplete' $selectinc>".$clang->gT("Incomplete responses only")."</option>\n"
."</select></li>\n";
//queXS Addition
include_once("../quexs.php");
$exportroutput .= "<li><label for='quexsfilterinc'>".$clang->gT("Questionnaire and Sample selection:")."</label><select id='quexsfilterinc' name='quexsfilterinc' onchange='this.form.submit();'>\n"
."\t<option value='all' >".$clang->gT("All queXS questionnaires and samples associated with this instrument")."</option>\n"
. get_questionnaire_sample_list($surveyid,$quexsfilterstate)
."</select></li>\n";
$filename = "survey_".$surveyid."_R_syntax_file.R";
$exportroutput .= "<input type='hidden' name='sid' value='$surveyid' />\n"
."<input type='hidden' name='action' value='exportr' /></li>\n"
."<li><label for='dlstructure'>" . $clang->gT("Step 1:") . "</label><input type='submit' name='dlstructure' id='dlstructure' value='" . $clang->gT("Export R syntax file") . "'/></li>\n"
."<li><label for='dldata'/>" . $clang->gT("Step 2:") . "</label><input type='submit' name='dldata' id='dldata' value='" . $clang->gT("Export .csv data file") . "'/></li></ul>\n"
."</form>\n"
."<p><div class='messagebox ui-corner-all'><div class='header ui-widget-header'>".$clang->gT("Instructions for the impatient")."</div>"
."<br/><ol style='margin:0 auto; font-size:8pt;'>"
."<li>".$clang->gT("Download the data and the syntax file.")."</li>"
."<li>".$clang->gT("Save both of them on the R working directory (use getwd() and setwd() on the R command window to get and set it)").".</li>"
."<li>".sprintf($clang->gT("digit: source(\"%s\", encoding = \"UTF-8\") on the R command window"), $filename)."</li>"
."</ol><br />"
.$clang->gT("Your data should be imported now, the data.frame is named \"data\", the variable.labels are attributes of data (\"attributes(data)\$variable.labels\"), like for foreign:read.spss.")
."</div>";
}
else
{
// Get Base language:
$language = GetBaseLanguageFromSurveyID($surveyid);
$clang = new limesurvey_lang($language);
require_once ("export_data_functions.php");
}
if ($subaction=='dldata')
{
header("Content-Disposition: attachment; filename=survey_".$surveyid."_R_data_file.csv");
header("Content-type: text/comma-separated-values; charset=UTF-8");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: public");
$na=""; //change to empty string instead of two double quotes to fix warnings on NA
spss_export_data($na);
exit;
}
if ($subaction=='dlstructure')
{
header("Content-Disposition: attachment; filename=survey_".$surveyid."_R_syntax_file.R");
header("Content-type: application/download; charset=UTF-8");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: public");
echo $headerComment;
echo "data <- read.table(\"survey_".$surveyid
."_R_data_file.csv\", sep=\",\", quote = \"'\", "
."na.strings=c(\"\",\"\\\"\\\"\"), "
."stringsAsFactors=FALSE)\n\n";
// echo "names(data) <- paste(\"V\",1:dim(data)[2],sep=\"\")\n\n";
// Build array that has to be returned
$fields = spss_fieldmap("V");
//Now get the query string with all fields to export
$query = spss_getquery();
$result=db_execute_num($query) or safe_die("Couldn't get results<br />$query<br />".$connect->ErrorMsg()); //Checked
$num_fields = $result->FieldCount();
//Now we check if we need to adjust the size of the field or the type of the field
while ($row = $result->FetchRow()) {
$fieldno = 0;
while ($fieldno < $num_fields)
{
//Performance improvement, don't recheck fields that have valuelabels
if (!isset($fields[$fieldno]['answers'])) {
$strTmp=mb_substr(strip_tags_full($row[$fieldno]), 0, $length_data);
$len = mb_strlen($strTmp);
if($len > $fields[$fieldno]['size']) $fields[$fieldno]['size'] = $len;
if (trim($strTmp) != ''){
if ($fields[$fieldno]['SPSStype']=='F' && (my_is_numeric($strTmp)===false || $fields[$fieldno]['size']>16))
{
$fields[$fieldno]['SPSStype']='A';
}
}
}
$fieldno++;
}
}
$errors = "";
$i = 1;
foreach ($fields as $field)
{
if($field['SPSStype'] == 'DATETIME23.2') $field['size']='';
if($field['LStype'] == 'N' || $field['LStype']=='K')
{
$field['size'].='.'.($field['size']-1);
}
switch ($field['SPSStype'])
{
case 'F':
$type="numeric";
break;
case 'A':
$type="character";
break;
case 'DATETIME23.2':
case 'SDATE':
$type="character";
//@TODO set $type to format for date
break;
}
if (!$field['hide'])
{
echo "data[, " . $i . "] <- "
."as.$type(data[, " . $i . "])\n";
echo 'attributes(data)$variable.labels[' . $i . '] <- "'
. addslashes(
htmlspecialchars_decode(
mb_substr(
strip_tags_full(
$field['VariableLabel']),0,$length_varlabel)))
. '"' . "\n";
// Create the value Labels!
if (isset($field['answers']))
{
$answers = $field['answers'];
//print out the value labels!
if($field['LStype'] != ':') // Exclude array (numeric) type questions. There must be a better way of doing this, but I can't find it. (AdV)
{
echo 'data[, ' . $i .'] <- factor(data[, ' . $i . '], levels=c(';
$str="";
foreach ($answers as $answer) {
if ($field['SPSStype']=="F" && my_is_numeric($answer['code'])) {
$str .= ",{$answer['code']}";
} else {
$str .= ",\"{$answer['code']}\"";
}
}
$str = mb_substr($str,1);
echo $str . '),labels=c(';
$str="";
foreach ($answers as $answer) {
$str .= ",\"{$answer['value']}\"";
}
$str = mb_substr($str,1);
if($field['scale']!=='' && $field['scale'] == 2 ) {
$scale = ",ordered=TRUE";
} else {
$scale = "";
}
echo "$str)$scale)\n";
}
}
//Rename the Variables (in case somethings goes wrong, we still have the OLD values
if (isset($field['sql_name']))
{
$ftitle = $field['title'];
if (!preg_match ("/^([a-z]|[A-Z])+.*$/", $ftitle))
{
$ftitle = "q_" . $ftitle;
}
$ftitle = str_replace(array("-",":",";","!"), array("_hyph_","_dd_","_dc_","_excl_"), $ftitle);
if (!$field['hide'])
{
if ($ftitle != $field['title'])
{
$errors .= "# Variable name was incorrect and was changed from {$field['title']} to $ftitle .\n";
}
echo "names(data)[" . $i . "] <- "
. "\"". $ftitle . "\"\n"; // <AdV> added \n
}
$i++;
}
else
{
echo "#sql_name not set\n";
}
}
else
{
echo "#Field hidden\n";
}
echo "\n";
} // end foreach
echo $errors;
exit;
}
?>
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: export_data_spss.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: export_data_spss.php 11664 2011-12-16 05:19:42Z tmswhite $
*/
// Security Checked: POST, GET, SESSION, REQUEST, returnglobal, DB
@@ -63,11 +63,14 @@ $typeMap = array(
':'=>Array('name'=>'Multi flexi numbers','size'=>1,'SPSStype'=>'F','Scale'=>3),
';'=>Array('name'=>'Multi flexi text','size'=>1,'SPSStype'=>'A'),
'|'=>Array('name'=>'File upload','size'=>1,'SPSStype'=>'A'),
'*'=>Array('name'=>'Equation','size'=>1,'SPSStype'=>'A'),
);
if (!isset($surveyid)) {$surveyid=returnglobal('sid');}
$filterstate = incompleteAnsFilterstate();
$quexsfilterstate = questionnaireSampleFilterstate();
$spssver = returnglobal('spssver');
if (is_null($spssver)) {
if (!isset($_SESSION['spssversion'])) {
@@ -93,7 +96,7 @@ switch ($spssver) {
}
$headerComment = '*$Rev: 10925 $' . " $quexsfilterstate $filterstate $spssver.\n";
$headerComment = '*$Rev: 11664 $' . " $quexsfilterstate $filterstate $spssver.\n";
if (isset($_GET['dldata'])) $subaction = "dldata";
if (isset($_GET['dlstructure'])) $subaction = "dlstructure";
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: export_resources_zip.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: export_resources_zip.php 11664 2011-12-16 05:19:42Z tmswhite $
*/
+172 -172
View File
@@ -1,172 +1,172 @@
<?php
/*
* LimeSurvey
* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: export_structure_lsrc.php 9586 2010-12-06 03:08:07Z c_schmitz $
*/
// DUMP THE RELATED DATA FOR A SINGLE SURVEY INTO A SQL FILE FOR IMPORTING LATER ON OR ON ANOTHER SURVEY SETUP
// DUMP ALL DATA WITH RELATED SID FROM THE FOLLOWING TABLES
// 1. Surveys
// 2. Surveys Language Table
// 3. Groups
// 4. Questions
// 5. Answers
// 6. Conditions
// 7. Label Sets
// 8. Labels
// 9. Question Attributes
// 10. Assessments
// 11. Quota
// 12. Quota Members
include_once("login_check.php");
if (!isset($surveyid)) {$surveyid=returnglobal('sid');}
if (!$surveyid)
{
echo $htmlheader
."<br />\n"
."<table width='350' align='center' style='border: 1px solid #555555' cellpadding='1' cellspacing='0'>\n"
."\t<tr bgcolor='#555555'><td colspan='2' height='4'><font size='1' face='verdana' color='white'><strong>"
.$clang->gT("Export Survey")."</strong></td></tr>\n"
."\t<tr><td align='center'>\n"
."<br /><strong><font color='red'>"
.$clang->gT("Error")."</font></strong><br />\n"
.$clang->gT("No SID has been provided. Cannot dump survey")."<br />\n"
."<br /><input type='submit' value='"
.$clang->gT("Main Admin Screen")."' onclick=\"window.open('$scriptname', '_self')\">\n"
."\t</td></tr>\n"
."</table>\n"
."</body></html>\n";
exit;
}
$dumphead = "# LimeSurvey Survey Dump\n"
. "# DBVersion $dbversionnumber\n"
. "# This is a dumped survey from the LimeSurvey Script\n"
. "# http://www.limesurvey.org/\n"
. "# Do not change this header!\n";
//1: Surveys table
$squery = "SELECT *
FROM {$dbprefix}surveys
WHERE sid=$surveyid";
$sdump = BuildCSVFromQuery($squery);
//2: Surveys Languagsettings table
$slsquery = "SELECT *
FROM {$dbprefix}surveys_languagesettings
WHERE surveyls_survey_id=$surveyid";
$slsdump = BuildCSVFromQuery($slsquery);
//3: Groups Table
$gquery = "SELECT *
FROM {$dbprefix}groups
WHERE sid=$surveyid
ORDER BY gid";
$gdump = BuildCSVFromQuery($gquery);
//4: Questions Table
$qquery = "SELECT *
FROM {$dbprefix}questions
WHERE sid=$surveyid
ORDER BY qid";
$qdump = BuildCSVFromQuery($qquery);
//5: Answers table
$aquery = "SELECT {$dbprefix}answers.*
FROM {$dbprefix}answers, {$dbprefix}questions
WHERE {$dbprefix}answers.language={$dbprefix}questions.language
AND {$dbprefix}answers.qid={$dbprefix}questions.qid
AND {$dbprefix}questions.sid=$surveyid";
$adump = BuildCSVFromQuery($aquery);
//6: Conditions table
$cquery = "SELECT DISTINCT {$dbprefix}conditions.*
FROM {$dbprefix}conditions, {$dbprefix}questions
WHERE {$dbprefix}conditions.qid={$dbprefix}questions.qid
AND {$dbprefix}questions.sid=$surveyid";
$cdump = BuildCSVFromQuery($cquery);
//7: Label Sets
$lsquery = "SELECT DISTINCT {$dbprefix}labelsets.lid, label_name, {$dbprefix}labelsets.languages
FROM {$dbprefix}labelsets, {$dbprefix}questions
WHERE ({$dbprefix}labelsets.lid={$dbprefix}questions.lid or {$dbprefix}labelsets.lid={$dbprefix}questions.lid1)
AND type IN ('F', 'H', 'W', 'Z', '1', ':', ';')
AND sid=$surveyid";
$lsdump = BuildCSVFromQuery($lsquery);
//8: Labels
$lquery = "SELECT {$dbprefix}labels.lid, {$dbprefix}labels.code, {$dbprefix}labels.title, {$dbprefix}labels.sortorder,{$dbprefix}labels.language
FROM {$dbprefix}labels, {$dbprefix}questions
WHERE ({$dbprefix}labels.lid={$dbprefix}questions.lid or {$dbprefix}labels.lid={$dbprefix}questions.lid1)
AND type in ('F', 'W', 'H', 'Z', '1', ':', ';')
AND sid=$surveyid
GROUP BY {$dbprefix}labels.lid, {$dbprefix}labels.code, {$dbprefix}labels.title, {$dbprefix}labels.sortorder,{$dbprefix}labels.language";
$ldump = BuildCSVFromQuery($lquery);
//9: Question Attributes
$query = "SELECT DISTINCT {$dbprefix}question_attributes.*
FROM {$dbprefix}question_attributes, {$dbprefix}questions
WHERE {$dbprefix}question_attributes.qid={$dbprefix}questions.qid
AND {$dbprefix}questions.sid=$surveyid";
$qadump = BuildCSVFromQuery($query);
//10: Assessments;
$query = "SELECT {$dbprefix}assessments.*
FROM {$dbprefix}assessments
WHERE {$dbprefix}assessments.sid=$surveyid";
$asdump = BuildCSVFromQuery($query);
//11: Quota;
$query = "SELECT {$dbprefix}quota.*
FROM {$dbprefix}quota
WHERE {$dbprefix}quota.sid=$surveyid";
$quotadump = BuildCSVFromQuery($query);
//12: Quota Members;
$query = "SELECT {$dbprefix}quota_members.*
FROM {$dbprefix}quota_members
WHERE {$dbprefix}quota_members.sid=$surveyid";
$quotamemdump = BuildCSVFromQuery($query);
$fn = "limesurvey_survey_$surveyid.csv";
//header("Content-Type: application/download");
//header("Content-Disposition: attachment; filename=$fn");
//header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
//header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
//header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
//header("Pragma: cache"); // HTTP/1.0
//include("../config.php");
include_once("../config-defaults.php");
include_once("../common.php");
include("remotecontrol/lsrc.config.php");
$lsrcString = $dumphead. $sdump. $gdump. $qdump. $adump. $cdump. $lsdump. $ldump. $qadump. $asdump. $slsdump. $quotadump. $quotamemdump."\n";
//Select title as Filename and save
$surveyTitleSql = "SELECT surveyls_title
FROM {$dbprefix}surveys_languagesettings
WHERE surveyls_survey_id=$surveyid";
$surveyTitleRs = db_execute_assoc($surveyTitleSql);
$surveyTitle = $surveyTitleRs->FetchRow();
file_put_contents("remotecontrol/".$coreDir.$surveyTitle['surveyls_title'].".csv",$lsrcString);
header("Location: $scriptname?sid=$surveyid");
exit;
?>
<?php
/*
* LimeSurvey
* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: export_structure_lsrc.php 11607 2011-12-06 23:19:52Z tmswhite $
*/
// DUMP THE RELATED DATA FOR A SINGLE SURVEY INTO A SQL FILE FOR IMPORTING LATER ON OR ON ANOTHER SURVEY SETUP
// DUMP ALL DATA WITH RELATED SID FROM THE FOLLOWING TABLES
// 1. Surveys
// 2. Surveys Language Table
// 3. Groups
// 4. Questions
// 5. Answers
// 6. Conditions
// 7. Label Sets
// 8. Labels
// 9. Question Attributes
// 10. Assessments
// 11. Quota
// 12. Quota Members
include_once("login_check.php");
if (!isset($surveyid)) {$surveyid=returnglobal('sid');}
if (!$surveyid)
{
echo $htmlheader
."<br />\n"
."<table width='350' align='center' style='border: 1px solid #555555' cellpadding='1' cellspacing='0'>\n"
."\t<tr bgcolor='#555555'><td colspan='2' height='4'><font size='1' face='verdana' color='white'><strong>"
.$clang->gT("Export Survey")."</strong></td></tr>\n"
."\t<tr><td align='center'>\n"
."<br /><strong><font color='red'>"
.$clang->gT("Error")."</font></strong><br />\n"
.$clang->gT("No SID has been provided. Cannot dump survey")."<br />\n"
."<br /><input type='submit' value='"
.$clang->gT("Main Admin Screen")."' onclick=\"window.open('$scriptname', '_self')\">\n"
."\t</td></tr>\n"
."</table>\n"
."</body></html>\n";
exit;
}
$dumphead = "# LimeSurvey Survey Dump\n"
. "# DBVersion $dbversionnumber\n"
. "# This is a dumped survey from the LimeSurvey Script\n"
. "# http://www.limesurvey.org/\n"
. "# Do not change this header!\n";
//1: Surveys table
$squery = "SELECT *
FROM {$dbprefix}surveys
WHERE sid=$surveyid";
$sdump = BuildCSVFromQuery($squery);
//2: Surveys Languagsettings table
$slsquery = "SELECT *
FROM {$dbprefix}surveys_languagesettings
WHERE surveyls_survey_id=$surveyid";
$slsdump = BuildCSVFromQuery($slsquery);
//3: Groups Table
$gquery = "SELECT *
FROM {$dbprefix}groups
WHERE sid=$surveyid
ORDER BY gid";
$gdump = BuildCSVFromQuery($gquery);
//4: Questions Table
$qquery = "SELECT *
FROM {$dbprefix}questions
WHERE sid=$surveyid
ORDER BY qid";
$qdump = BuildCSVFromQuery($qquery);
//5: Answers table
$aquery = "SELECT {$dbprefix}answers.*
FROM {$dbprefix}answers, {$dbprefix}questions
WHERE {$dbprefix}answers.language={$dbprefix}questions.language
AND {$dbprefix}answers.qid={$dbprefix}questions.qid
AND {$dbprefix}questions.sid=$surveyid";
$adump = BuildCSVFromQuery($aquery);
//6: Conditions table
$cquery = "SELECT DISTINCT {$dbprefix}conditions.*
FROM {$dbprefix}conditions, {$dbprefix}questions
WHERE {$dbprefix}conditions.qid={$dbprefix}questions.qid
AND {$dbprefix}questions.sid=$surveyid";
$cdump = BuildCSVFromQuery($cquery);
//7: Label Sets
$lsquery = "SELECT DISTINCT {$dbprefix}labelsets.lid, label_name, {$dbprefix}labelsets.languages
FROM {$dbprefix}labelsets, {$dbprefix}questions
WHERE ({$dbprefix}labelsets.lid={$dbprefix}questions.lid or {$dbprefix}labelsets.lid={$dbprefix}questions.lid1)
AND type IN ('F', 'H', 'W', 'Z', '1', ':', ';')
AND sid=$surveyid";
$lsdump = BuildCSVFromQuery($lsquery);
//8: Labels
$lquery = "SELECT {$dbprefix}labels.lid, {$dbprefix}labels.code, {$dbprefix}labels.title, {$dbprefix}labels.sortorder,{$dbprefix}labels.language
FROM {$dbprefix}labels, {$dbprefix}questions
WHERE ({$dbprefix}labels.lid={$dbprefix}questions.lid or {$dbprefix}labels.lid={$dbprefix}questions.lid1)
AND type in ('F', 'W', 'H', 'Z', '1', ':', ';')
AND sid=$surveyid
GROUP BY {$dbprefix}labels.lid, {$dbprefix}labels.code, {$dbprefix}labels.title, {$dbprefix}labels.sortorder,{$dbprefix}labels.language";
$ldump = BuildCSVFromQuery($lquery);
//9: Question Attributes
$query = "SELECT DISTINCT {$dbprefix}question_attributes.*
FROM {$dbprefix}question_attributes, {$dbprefix}questions
WHERE {$dbprefix}question_attributes.qid={$dbprefix}questions.qid
AND {$dbprefix}questions.sid=$surveyid";
$qadump = BuildCSVFromQuery($query);
//10: Assessments;
$query = "SELECT {$dbprefix}assessments.*
FROM {$dbprefix}assessments
WHERE {$dbprefix}assessments.sid=$surveyid";
$asdump = BuildCSVFromQuery($query);
//11: Quota;
$query = "SELECT {$dbprefix}quota.*
FROM {$dbprefix}quota
WHERE {$dbprefix}quota.sid=$surveyid";
$quotadump = BuildCSVFromQuery($query);
//12: Quota Members;
$query = "SELECT {$dbprefix}quota_members.*
FROM {$dbprefix}quota_members
WHERE {$dbprefix}quota_members.sid=$surveyid";
$quotamemdump = BuildCSVFromQuery($query);
$fn = "limesurvey_survey_$surveyid.csv";
//header("Content-Type: application/download");
//header("Content-Disposition: attachment; filename=$fn");
//header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
//header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
//header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
//header("Pragma: cache"); // HTTP/1.0
//include("../config.php");
include_once("../config-defaults.php");
include_once("../common.php");
include("remotecontrol/lsrc.config.php");
$lsrcString = $dumphead. $sdump. $gdump. $qdump. $adump. $cdump. $lsdump. $ldump. $qadump. $asdump. $slsdump. $quotadump. $quotamemdump."\n";
//Select title as Filename and save
$surveyTitleSql = "SELECT surveyls_title
FROM {$dbprefix}surveys_languagesettings
WHERE surveyls_survey_id=$surveyid";
$surveyTitleRs = db_execute_assoc($surveyTitleSql);
$surveyTitle = $surveyTitleRs->FetchRow();
file_put_contents("remotecontrol/".$coreDir.$surveyTitle['surveyls_title'].".csv",$lsrcString);
header("Location: $scriptname?sid=$surveyid");
exit;
?>
File diff suppressed because it is too large Load Diff
+209 -209
View File
@@ -1,209 +1,209 @@
<?php
/*
* LimeSurvey
* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: export_structure_xml.php 9607 2010-12-08 22:59:51Z azammitdcarf $
*/
// DUMP THE RELATED DATA FOR A SINGLE SURVEY INTO AN XML FILE FOR IMPORTING LATER ON OR ON ANOTHER SURVEY SETUP
// DUMP ALL DATA FOR RELATED SID FROM THE FOLLOWING TABLES:
// Answers
// Assessments
// Conditions
// Default values
// Groups
// Questions
// Question attributes
// Quota
// Quota Members
// Surveys
// Surveys language settings
include_once("login_check.php");
require_once ("export_data_functions.php");
if (!isset($surveyid))
{
$surveyid=returnglobal('sid');
}
if (!$surveyid)
{
echo $htmlheader
."<br />\n"
."<table width='350' align='center' style='border: 1px solid #555555' cellpadding='1' cellspacing='0'>\n"
."\t<tr bgcolor='#555555'><td colspan='2' height='4'><font size='1' face='verdana' color='white'><strong>"
.$clang->gT("Export Survey")."</strong></td></tr>\n"
."\t<tr><td align='center'>\n"
."<br /><strong><font color='red'>"
.$clang->gT("Error")."</font></strong><br />\n"
.$clang->gT("No SID has been provided. Cannot dump survey")."<br />\n"
."<br /><input type='submit' value='"
.$clang->gT("Main Admin Screen")."' onclick=\"window.open('$scriptname', '_self')\">\n"
."\t</td></tr>\n"
."</table>\n"
."</body></html>\n";
exit;
}
function getXMLStructure($xmlwriter, $exclude=array())
{
global $dbprefix, $surveyid, $connect;
$sdump = "";
if ((!isset($exclude) && $exclude['answers'] !== true) || empty($exclude))
{
//Answers table
$aquery = "SELECT {$dbprefix}answers.*
FROM {$dbprefix}answers, {$dbprefix}questions
WHERE {$dbprefix}answers.language={$dbprefix}questions.language
AND {$dbprefix}answers.qid={$dbprefix}questions.qid
AND {$dbprefix}questions.sid=$surveyid";
BuildXMLFromQuery($xmlwriter,$aquery);
}
// Assessments
$query = "SELECT {$dbprefix}assessments.*
FROM {$dbprefix}assessments
WHERE {$dbprefix}assessments.sid=$surveyid";
BuildXMLFromQuery($xmlwriter,$query);
if ((!isset($exclude) && $exclude['conditions'] !== true) || empty($exclude))
{
//Conditions table
$cquery = "SELECT DISTINCT {$dbprefix}conditions.*
FROM {$dbprefix}conditions, {$dbprefix}questions
WHERE {$dbprefix}conditions.qid={$dbprefix}questions.qid
AND {$dbprefix}questions.sid=$surveyid";
BuildXMLFromQuery($xmlwriter,$cquery);
}
//Default values
$query = "SELECT {$dbprefix}defaultvalues.*
FROM {$dbprefix}defaultvalues JOIN {$dbprefix}questions ON {$dbprefix}questions.qid = {$dbprefix}defaultvalues.qid AND {$dbprefix}questions.sid=$surveyid AND {$dbprefix}questions.language={$dbprefix}defaultvalues.language ";
BuildXMLFromQuery($xmlwriter,$query);
// Groups
$gquery = "SELECT *
FROM {$dbprefix}groups
WHERE sid=$surveyid
ORDER BY gid";
BuildXMLFromQuery($xmlwriter,$gquery);
//Questions
$qquery = "SELECT *
FROM {$dbprefix}questions
WHERE sid=$surveyid and parent_qid=0
ORDER BY qid";
BuildXMLFromQuery($xmlwriter,$qquery);
//Subquestions
$qquery = "SELECT *
FROM {$dbprefix}questions
WHERE sid=$surveyid and parent_qid>0
ORDER BY qid";
BuildXMLFromQuery($xmlwriter,$qquery,'subquestions');
//Question attributes
$sBaseLanguage=GetBaseLanguageFromSurveyID($surveyid);
if ($connect->databaseType == 'odbc_mssql' || $connect->databaseType == 'odbtp' || $connect->databaseType == 'mssql_n' || $connect->databaseType =='mssqlnative')
{
$query="SELECT qa.qid, qa.attribute, cast(qa.value as varchar(4000)) as value
FROM {$dbprefix}question_attributes qa JOIN {$dbprefix}questions q ON q.qid = qa.qid AND q.sid={$surveyid}
where q.language='{$sBaseLanguage}' group by qa.qid, qa.attribute, cast(qa.value as varchar(4000))";
}
else {
$query="SELECT qa.qid, qa.attribute, qa.value
FROM {$dbprefix}question_attributes qa JOIN {$dbprefix}questions q ON q.qid = qa.qid AND q.sid={$surveyid}
where q.language='{$sBaseLanguage}' group by qa.qid, qa.attribute, qa.value";
}
BuildXMLFromQuery($xmlwriter,$query,'question_attributes');
if ((!isset($exclude) && $exclude['quotas'] !== true) || empty($exclude))
{
//Quota
$query = "SELECT {$dbprefix}quota.*
FROM {$dbprefix}quota
WHERE {$dbprefix}quota.sid=$surveyid";
BuildXMLFromQuery($xmlwriter,$query);
//1Quota members
$query = "SELECT {$dbprefix}quota_members.*
FROM {$dbprefix}quota_members
WHERE {$dbprefix}quota_members.sid=$surveyid";
BuildXMLFromQuery($xmlwriter,$query);
//Quota languagesettings
$query = "SELECT {$dbprefix}quota_languagesettings.*
FROM {$dbprefix}quota_languagesettings, {$dbprefix}quota
WHERE {$dbprefix}quota.id = {$dbprefix}quota_languagesettings.quotals_quota_id
AND {$dbprefix}quota.sid=$surveyid";
BuildXMLFromQuery($xmlwriter,$query);
}
// Surveys
$squery = "SELECT *
FROM {$dbprefix}surveys
WHERE sid=$surveyid";
//Exclude some fields from the export
BuildXMLFromQuery($xmlwriter,$squery,'',array('owner_id','active','datecreated'));
// Survey language settings
$slsquery = "SELECT *
FROM {$dbprefix}surveys_languagesettings
WHERE surveyls_survey_id=$surveyid";
BuildXMLFromQuery($xmlwriter,$slsquery);
}
function getXMLData($exclude = array())
{
global $dbversionnumber,$surveyid;
$xml = getXMLWriter();
$xml->openMemory();
$xml->setIndent(true);
$xml->startDocument('1.0', 'UTF-8');
$xml->startElement('document');
$xml->writeElement('LimeSurveyDocType','Survey');
$xml->writeElement('DBVersion',$dbversionnumber);
$xml->startElement('languages');
$surveylanguages=GetAdditionalLanguagesFromSurveyID($surveyid);
$surveylanguages[]=GetBaseLanguageFromSurveyID($surveyid);
foreach ($surveylanguages as $surveylanguage)
{
$xml->writeElement('language',$surveylanguage);
}
$xml->endElement();
getXMLStructure($xml,$exclude);
$xml->endElement(); // close columns
$xml->endDocument();
return $xml->outputMemory(true);
}
if (!isset($copyfunction))
{
$fn = "limesurvey_survey_$surveyid.lss";
header("Content-Type: text/xml");
header("Content-Disposition: attachment; filename=$fn");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: public"); // HTTP/1.0
echo getXMLData();
exit;
}
?>
<?php
/*
* LimeSurvey
* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: export_structure_xml.php 11607 2011-12-06 23:19:52Z tmswhite $
*/
// DUMP THE RELATED DATA FOR A SINGLE SURVEY INTO AN XML FILE FOR IMPORTING LATER ON OR ON ANOTHER SURVEY SETUP
// DUMP ALL DATA FOR RELATED SID FROM THE FOLLOWING TABLES:
// Answers
// Assessments
// Conditions
// Default values
// Groups
// Questions
// Question attributes
// Quota
// Quota Members
// Surveys
// Surveys language settings
include_once("login_check.php");
require_once ("export_data_functions.php");
if (!isset($surveyid))
{
$surveyid=returnglobal('sid');
}
if (!$surveyid)
{
echo $htmlheader
."<br />\n"
."<table width='350' align='center' style='border: 1px solid #555555' cellpadding='1' cellspacing='0'>\n"
."\t<tr bgcolor='#555555'><td colspan='2' height='4'><font size='1' face='verdana' color='white'><strong>"
.$clang->gT("Export Survey")."</strong></td></tr>\n"
."\t<tr><td align='center'>\n"
."<br /><strong><font color='red'>"
.$clang->gT("Error")."</font></strong><br />\n"
.$clang->gT("No SID has been provided. Cannot dump survey")."<br />\n"
."<br /><input type='submit' value='"
.$clang->gT("Main Admin Screen")."' onclick=\"window.open('$scriptname', '_self')\">\n"
."\t</td></tr>\n"
."</table>\n"
."</body></html>\n";
exit;
}
function getXMLStructure($xmlwriter, $exclude=array())
{
global $dbprefix, $surveyid, $connect;
$sdump = "";
if ((!isset($exclude) && $exclude['answers'] !== true) || empty($exclude))
{
//Answers table
$aquery = "SELECT {$dbprefix}answers.*
FROM {$dbprefix}answers, {$dbprefix}questions
WHERE {$dbprefix}answers.language={$dbprefix}questions.language
AND {$dbprefix}answers.qid={$dbprefix}questions.qid
AND {$dbprefix}questions.sid=$surveyid";
BuildXMLFromQuery($xmlwriter,$aquery);
}
// Assessments
$query = "SELECT {$dbprefix}assessments.*
FROM {$dbprefix}assessments
WHERE {$dbprefix}assessments.sid=$surveyid";
BuildXMLFromQuery($xmlwriter,$query);
if ((!isset($exclude) && $exclude['conditions'] !== true) || empty($exclude))
{
//Conditions table
$cquery = "SELECT DISTINCT {$dbprefix}conditions.*
FROM {$dbprefix}conditions, {$dbprefix}questions
WHERE {$dbprefix}conditions.qid={$dbprefix}questions.qid
AND {$dbprefix}questions.sid=$surveyid";
BuildXMLFromQuery($xmlwriter,$cquery);
}
//Default values
$query = "SELECT {$dbprefix}defaultvalues.*
FROM {$dbprefix}defaultvalues JOIN {$dbprefix}questions ON {$dbprefix}questions.qid = {$dbprefix}defaultvalues.qid AND {$dbprefix}questions.sid=$surveyid AND {$dbprefix}questions.language={$dbprefix}defaultvalues.language ";
BuildXMLFromQuery($xmlwriter,$query);
// Groups
$gquery = "SELECT *
FROM {$dbprefix}groups
WHERE sid=$surveyid
ORDER BY gid";
BuildXMLFromQuery($xmlwriter,$gquery);
//Questions
$qquery = "SELECT *
FROM {$dbprefix}questions
WHERE sid=$surveyid and parent_qid=0
ORDER BY qid";
BuildXMLFromQuery($xmlwriter,$qquery);
//Subquestions
$qquery = "SELECT *
FROM {$dbprefix}questions
WHERE sid=$surveyid and parent_qid>0
ORDER BY qid";
BuildXMLFromQuery($xmlwriter,$qquery,'subquestions');
//Question attributes
$sBaseLanguage=GetBaseLanguageFromSurveyID($surveyid);
if ($connect->databaseType == 'odbc_mssql' || $connect->databaseType == 'odbtp' || $connect->databaseType == 'mssql_n' || $connect->databaseType =='mssqlnative')
{
$query="SELECT qa.qid, qa.attribute, cast(qa.value as varchar(4000)) as value
FROM {$dbprefix}question_attributes qa JOIN {$dbprefix}questions q ON q.qid = qa.qid AND q.sid={$surveyid}
where q.language='{$sBaseLanguage}' group by qa.qid, qa.attribute, cast(qa.value as varchar(4000))";
}
else {
$query="SELECT qa.qid, qa.attribute, qa.value
FROM {$dbprefix}question_attributes qa JOIN {$dbprefix}questions q ON q.qid = qa.qid AND q.sid={$surveyid}
where q.language='{$sBaseLanguage}' group by qa.qid, qa.attribute, qa.value";
}
BuildXMLFromQuery($xmlwriter,$query,'question_attributes');
if ((!isset($exclude) && $exclude['quotas'] !== true) || empty($exclude))
{
//Quota
$query = "SELECT {$dbprefix}quota.*
FROM {$dbprefix}quota
WHERE {$dbprefix}quota.sid=$surveyid";
BuildXMLFromQuery($xmlwriter,$query);
//1Quota members
$query = "SELECT {$dbprefix}quota_members.*
FROM {$dbprefix}quota_members
WHERE {$dbprefix}quota_members.sid=$surveyid";
BuildXMLFromQuery($xmlwriter,$query);
//Quota languagesettings
$query = "SELECT {$dbprefix}quota_languagesettings.*
FROM {$dbprefix}quota_languagesettings, {$dbprefix}quota
WHERE {$dbprefix}quota.id = {$dbprefix}quota_languagesettings.quotals_quota_id
AND {$dbprefix}quota.sid=$surveyid";
BuildXMLFromQuery($xmlwriter,$query);
}
// Surveys
$squery = "SELECT *
FROM {$dbprefix}surveys
WHERE sid=$surveyid";
//Exclude some fields from the export
BuildXMLFromQuery($xmlwriter,$squery,'',array('owner_id','active','datecreated'));
// Survey language settings
$slsquery = "SELECT *
FROM {$dbprefix}surveys_languagesettings
WHERE surveyls_survey_id=$surveyid";
BuildXMLFromQuery($xmlwriter,$slsquery);
}
function getXMLData($exclude = array())
{
global $dbversionnumber,$surveyid;
$xml = getXMLWriter();
$xml->openMemory();
$xml->setIndent(true);
$xml->startDocument('1.0', 'UTF-8');
$xml->startElement('document');
$xml->writeElement('LimeSurveyDocType','Survey');
$xml->writeElement('DBVersion',$dbversionnumber);
$xml->startElement('languages');
$surveylanguages=GetAdditionalLanguagesFromSurveyID($surveyid);
$surveylanguages[]=GetBaseLanguageFromSurveyID($surveyid);
foreach ($surveylanguages as $surveylanguage)
{
$xml->writeElement('language',$surveylanguage);
}
$xml->endElement();
getXMLStructure($xml,$exclude);
$xml->endElement(); // close columns
$xml->endDocument();
return $xml->outputMemory(true);
}
if (!isset($copyfunction))
{
$fn = "limesurvey_survey_$surveyid.lss";
header("Content-Type: text/xml");
header("Content-Disposition: attachment; filename=$fn");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: public"); // HTTP/1.0
echo getXMLData();
exit;
}
?>
+59 -64
View File
@@ -1,17 +1,17 @@
<?php
/*
* LimeSurvey
* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: exportresults.php 10925 2011-09-02 14:12:02Z c_schmitz $
*/
* LimeSurvey
* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: exportresults.php 11664 2011-12-16 05:19:42Z tmswhite $
*/
//Ensure script is not run directly, avoid path disclosure
@@ -44,7 +44,7 @@ if (!$exportstyle)
{
//FIND OUT HOW MANY FIELDS WILL BE NEEDED - FOR 255 COLUMN LIMIT
$excesscols=createFieldMap($surveyid);
$excesscols=createFieldMap($surveyid,'full',false,false,$surveybaselang);
if ($thissurvey['savetimings'] === "Y") {
//Append survey timings to the fieldmap array
$excesscols = $excesscols + createTimingsFieldMap($surveyid);
@@ -110,6 +110,7 @@ $quexsfilterstate = questionnaireSampleFilterstate();
$exportoutput .='<fieldset><legend>'
.$clang->gT("Questions")."</legend>\n"
."<ul>\n"
."<li><input type='radio' class='radiobtn' name='exportstyle' value='abrev' id='headabbrev' />"
@@ -292,13 +293,15 @@ switch ( $_POST["type"] ) {
$workbook->send('results-survey'.$surveyid.'.xls');
// Creating the first worksheet
$query="SELECT * FROM {$dbprefix}surveys_languagesettings WHERE surveyls_survey_id=".$surveyid;
$query="SELECT * FROM {$dbprefix}surveys_languagesettings WHERE surveyls_survey_id={$surveyid} AND surveyls_language='{$surveybaselang}'" ;
$result=db_execute_assoc($query) or safe_die("Couldn't get privacy data<br />$query<br />".$connect->ErrorMsg());
$row = $result->FetchRow();
$row['surveyls_title']=substr(str_replace(array('*', ':', '/', '\\', '?', '[', ']'),array(' '),$row['surveyls_title']),0,31); // Remove invalid characters
$sheet =& $workbook->addWorksheet($row['surveyls_title']); // do not translate/change this - the library does not support any special chars in sheet name
$sheet =& $workbook->addWorksheet(); // do not translate/change this - the library does not support any special chars in sheet name
// $row['surveyls_title']
$sheet->setInputEncoding('utf-8');
$sheet->name=$row['surveyls_title'] ;
$separator="~|";
break;
case "csv":
@@ -311,7 +314,7 @@ switch ( $_POST["type"] ) {
$pdf->SetFont($pdfdefaultfont,'',$pdffontsize);
$pdf->AddPage();
$pdf->intopdf("PDF Export ".date("Y.m.d-H:i",time()));
$query="SELECT * FROM {$dbprefix}surveys_languagesettings WHERE surveyls_survey_id=".$surveyid;
$query="SELECT * FROM {$dbprefix}surveys_languagesettings WHERE surveyls_survey_id={$surveyid} AND surveyls_language='{$surveybaselang}'" ;
$result=db_execute_assoc($query) or safe_die("Couldn't get privacy data<br />$query<br />".$connect->ErrorMsg());
while ($row = $result->FetchRow())
{
@@ -421,6 +424,7 @@ if ($tokenTableExists && $thissurvey['anonymized']=='N')
. " ON $surveytable.token = {$dbprefix}tokens_$surveyid.token";
}
$qfs = questionnaireSampleFilterstate();
if ($qfs != false)
{
@@ -507,57 +511,48 @@ for ($i=0; $i<$fieldcount; $i++)
}
else
{
//Data field heading!
// Prepare the header line
$fielddata=$fieldmap[$fieldinfo];
$fqid=$fielddata['qid'];
$ftype=$fielddata['type'];
$fsid=$fielddata['sid'];
$fgid=$fielddata['gid'];
$faid=$fielddata['aid'];
$question=$fielddata['question'];
if (isset($fielddata['scale'])) $question = "[{$fielddata['scale']}] ". $question;
if (isset($fielddata['subquestion'])) $question = "[{$fielddata['subquestion']}] ". $question;
if (isset($fielddata['subquestion2'])) $question = "[{$fielddata['subquestion2']}] ". $question;
if (isset($fielddata['subquestion1'])) $question = "[{$fielddata['subquestion1']}] ". $question;
if ($exportstyle == "abrev")
switch ($exportstyle)
{
$qname=strip_tags_full($question);
$qname=mb_substr($qname, 0, 15)."..";
$firstline = str_replace("\n", "", $firstline);
$firstline = str_replace("\r", "", $firstline);
if ($type == "csv") {$firstline .= "\"$qname";}
else {$firstline .= "$qname";}
if (isset($faid)) {$firstline .= " [{$faid}]"; $faid="";}
if ($type == "csv") {$firstline .= "\"";}
$firstline .= "$separator";
}
else //headcode or full answer
{
if ($exportstyle == "headcodes")
{
case 'headcodes': // only question codes
$fquest=$fielddata['title'];
if (!empty($fielddata['aid'])) $fquest .= ' [' . $fielddata['aid'] . ']';
}
else
{
$fquest=$question;
}
$fquest=FlattenText($fquest,true);
if ($type == "csv")
{
$firstline .="\"$fquest\"$separator";
}
else
{
$firstline .= $fquest.$separator;
}
if (isset($fielddata['scale_id'])) $fquest = $fquest."[{$fielddata['scale_id']}]";
$fquest=FlattenText($fquest,true);
break;
case 'abrev': // Abbreviated question text
$fquest=FlattenText($fielddata['question']);
$fquest=mb_substr($fquest, 0, 15);
if (strlen($fquest)==15) $fquest.='...';
if (isset($faid)) {$fquest .= " [{$faid}]";}
if (isset($fielddata['scale_id'])) $fquest = $fquest."[{$fielddata['scale_id']}]";
break;
default: // Full question text
$fquest=$fielddata['question'];
if (isset($fielddata['scale_id'])) $fquest = "[{$fielddata['scale_id']}] ". $fquest;
if (isset($fielddata['subquestion'])) $fquest = "[{$fielddata['subquestion']}] ". $fquest;
if (isset($fielddata['subquestion2'])) $fquest = "[{$fielddata['subquestion2']}] ". $fquest;
if (isset($fielddata['subquestion1'])) $fquest = "[{$fielddata['subquestion1']}] ". $fquest;
$fquest=FlattenText($fquest,true);
break;
}
if($convertspacetous == "Y")
if($convertspacetous == "Y")
{
$firstline=str_replace(" ", "_", $firstline);
$fquest=str_replace(" ", "_", $fquest);
}
if ($type == "csv") {$fquest = "\"$fquest\"";}
$firstline .= $fquest.$separator;
}
}
if ($type == "csv") { $firstline = mb_substr(trim($firstline),0,strlen($firstline)-1);}
else
{
@@ -582,8 +577,8 @@ if ($type == "doc" || $type == "pdf")
</style>';
}
else
if ($type == "xls")
{
if ($type == "xls")
{
//var_dump ($firstline);
$flarray=explode($separator, $firstline);
$fli=0;
@@ -593,9 +588,9 @@ if ($type == "xls")
$fli++;
}
//print_r($fieldmap);
}
else
{
}
else
{
$exportoutput .= $firstline; //Sending the header row
}
@@ -627,7 +622,7 @@ if (isset($_POST['answerid']) && $_POST['answerid'] != "NULL") //this applies if
{
$where[] = "$surveytable.id=".stripcslashes($_POST['answerid']);
}
if (count($where)>0) $dquery .= ' WHERE ' . join(' AND ', $where);
if (count($where)>0) $dquery .= ' WHERE ' . join(' AND ', $where);
$dquery .= " ORDER BY $surveytable.id";
@@ -1115,15 +1110,15 @@ elseif ($answers == "long") //chose complete answers
}
if ($type=='xls')
{
// echo memory_get_peak_usage(true); die();
// echo memory_get_peak_usage(true); die();
$workbook->close();
}
else if($type=='pdf')
{
{
$pdf->Output($clang->gT($surveyname)." ".$surveyid.".pdf","D");
}
else
{
}
else
{
echo $exportoutput;
}
exit;
@@ -1,446 +1,446 @@
<?php
/*
* LimeSurvey
* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: fck_LimeReplacementFields.php 10925 2011-09-02 14:12:02Z c_schmitz $
*/
include_once("login_check.php");
if(!isset($_SESSION['loginID']))
{
die ("Unauthenticated Access Forbiden");
}
$surveyid=returnglobal('sid');
if (!isset($gid)) {$gid=returnglobal('gid');}
if (!isset($qid)) {$qid=returnglobal('qid');}
$fieldtype=preg_replace("/[^_.a-zA-Z0-9-]/", "",$_GET['fieldtype']);
$action=preg_replace("/[^_.a-zA-Z0-9-]/", "",$_GET['editedaction']);
//$InsertansUnsupportedtypes=Array('TEST-A','TEST-B','TEST-C','TEST-D');
$InsertansUnsupportedtypes=Array(); // Currently all question types are supported
$replFields=Array();
$isInstertansEnabled=false;
$limereplacementoutput="\t\t<script language=\"javascript\">\n"
. "\t\t\$(document).ready(function ()\n"
. "\t\t\t{\n"
. "\t\t\t\tLoadSelected() ;\n"
. "\t\t\t\tmydialog.SetOkButton( true ) ;\n"
. "\n"
. "SelectField( 'cquestions' ) ;\n"
. "\t});\n"
. "\n";
/**$limereplacementoutput="\n"
. "if (! oEditor.FCKBrowserInfo.IsIE)\n"
. "{\n"
. "\tinnertext = '' + dialog.EditorWindow.getSelection() + '' ;\n"
. "}\n"
. "else\n"
. "{\n"
. "\tinnertext = '' + dialog.EditorDocument.selection.createRange().text + '' ;\n"
. "}\n";
**/
$limereplacementoutput .= ""
. "\tvar eSelected = dialog.Selection.GetSelectedElement() ;\n"
. "\n";
/**
$limereplacementoutput="\n"
. "function LoadSelected()\n"
. "{\n"
. "\tif ( innertext == '' )\n"
. "return ;\n"
. "var replcode=innertext.substring(innertext.indexOf('{')+1,innertext.lastIndexOf('}'));\n"
. "document.getElementById('cquestions').value = replcode;\n"
. "}\n";
**/
$limereplacementoutput .= ""
. "\tfunction LoadSelected()\n"
. "\t{\n"
. "if ( !eSelected )\n"
. "\treturn ;\n"
. "if ( eSelected.tagName == 'SPAN' && eSelected._fckLimeReplacementFields )\n"
. "\t document.getElementById('cquestions').value = eSelected._fckLimeReplacementFields ;\n"
. "else\n"
. "\teSelected == null ;\n"
. "\t}\n";
$limereplacementoutput .= ""
. "\tfunction Ok()\n"
. "\t{\n"
. "var sValue = document.getElementById('cquestions').value ;\n"
. "FCKLimeReplacementFieldss.Add( sValue ) ;\n"
. "return true ;\n"
. "\t}\n";
$limereplacementoutput .= ""
. "\t</script>\n"
. "</head>\n";
$limereplacementoutput .= "\t<body scroll=\"no\" style=\"OVERFLOW: hidden;\">\n"
. "<table height=\"100%\" cellSpacing=\"0\" cellPadding=\"0\" width=\"100%\" border=\"0\">\n"
. "\t<tr>\n"
. "<td>\n";
switch ($fieldtype)
{
case 'survey-desc':
case 'survey-welc':
case 'survey-endtext':
case 'edittitle': // for translation
case 'editdescription': // for translation
case 'editwelcome': // for translation
case 'editend': // for translation
$replFields[]=array('TOKEN:FIRSTNAME',$clang->gT("First name from token"));
$replFields[]=array('TOKEN:LASTNAME',$clang->gT("Last name from token"));
$replFields[]=array('TOKEN:EMAIL',$clang->gT("Email from the token"));
$replFields[]=array('TOKEN:USESLEFT',$clang->gT("Uses left"));
$attributes=GetTokenFieldsAndNames($surveyid,true);
foreach ($attributes as $attributefield=>$attributedescription)
{
$replFields[]=array('TOKEN:'.strtoupper($attributefield), sprintf($clang->gT("Token attribute: %s"),$attributedescription));
}
$replFields[]=array('EXPIRY',$clang->gT("Survey expiration date"));
break;
case 'email-admin-notification':
$replFields[]=array('RELOADURL',$clang->gT("Reload URL"));
$replFields[]=array('VIEWRESPONSEURL',$clang->gT("View response URL"));
$replFields[]=array('EDITRESPONSEURL',$clang->gT("Edit response URL"));
$replFields[]=array('STATISTICSURL',$clang->gT("Statistics URL"));
$replFields[]=array('TOKEN',$clang->gT("Token code for this participant"));
$replFields[]=array('TOKEN:FIRSTNAME',$clang->gT("First name from token"));
$replFields[]=array('TOKEN:LASTNAME',$clang->gT("Last name from token"));
$replFields[]=array('TOKEN:USESLEFT',$clang->gT("Uses left"));
$replFields[]=array('SURVEYNAME',$clang->gT("Name of the survey"));
$replFields[]=array('SURVEYDESCRIPTION',$clang->gT("Description of the survey"));
$attributes=GetTokenFieldsAndNames($surveyid,true);
foreach ($attributes as $attributefield=>$attributedescription)
{
$replFields[]=array(strtoupper($attributefield), sprintf($clang->gT("Token attribute: %s"),$attributedescription));
}
$replFields[]=array('ADMINNAME',$clang->gT("Name of the survey administrator"));
$replFields[]=array('ADMINEMAIL',$clang->gT("Email address of the survey administrator"));
break;
case 'email-admin-resp':
$replFields[]=array('RELOADURL',$clang->gT("Reload URL"));
$replFields[]=array('VIEWRESPONSEURL',$clang->gT("View response URL"));
$replFields[]=array('EDITRESPONSEURL',$clang->gT("Edit response URL"));
$replFields[]=array('STATISTICSURL',$clang->gT("Statistics URL"));
$replFields[]=array('ANSWERTABLE',$clang->gT("Answers from this response"));
$replFields[]=array('TOKEN',$clang->gT("Token code for this participant"));
$replFields[]=array('TOKEN:FIRSTNAME',$clang->gT("First name from token"));
$replFields[]=array('TOKEN:LASTNAME',$clang->gT("Last name from token"));
$replFields[]=array('TOKEN:USESLEFT',$clang->gT("Uses left"));
$replFields[]=array('SURVEYNAME',$clang->gT("Name of the survey"));
$replFields[]=array('SURVEYDESCRIPTION',$clang->gT("Description of the survey"));
$attributes=GetTokenFieldsAndNames($surveyid,true);
foreach ($attributes as $attributefield=>$attributedescription)
{
$replFields[]=array(strtoupper($attributefield), sprintf($clang->gT("Token attribute: %s"),$attributedescription));
}
$replFields[]=array('ADMINNAME',$clang->gT("Name of the survey administrator"));
$replFields[]=array('ADMINEMAIL',$clang->gT("Email address of the survey administrator"));
break;
case 'email-inv':
case 'email-rem':
// these 3 fields are supported by email-inv and email-rem
// but not email-reg for the moment
$replFields[]=array('EMAIL',$clang->gT("Email from the token"));
$replFields[]=array('USESLEFT',$clang->gT("Uses left"));
$replFields[]=array('OPTOUTURL',$clang->gT("URL for a respondent to opt-out this survey"));
case 'email-reg':
$replFields[]=array('FIRSTNAME',$clang->gT("First name from token"));
$replFields[]=array('LASTNAME',$clang->gT("Last name from token"));
$replFields[]=array('SURVEYNAME',$clang->gT("Name of the survey"));
$replFields[]=array('SURVEYDESCRIPTION',$clang->gT("Description of the survey"));
$replFields[]=array('TOKEN',$clang->gT("Token code for this participant"));
$replFields[]=array('SURVEYID',$clang->gT("ID of the survey"));
$attributes=GetTokenFieldsAndNames($surveyid,true);
foreach ($attributes as $attributefield=>$attributedescription)
{
$replFields[]=array(strtoupper($attributefield), sprintf($clang->gT("Token attribute: %s"),$attributedescription));
}
$replFields[]=array('ADMINNAME',$clang->gT("Name of the survey administrator"));
$replFields[]=array('ADMINEMAIL',$clang->gT("Email address of the survey administrator"));
$replFields[]=array('SURVEYURL',$clang->gT("URL of the survey"));
$replFields[]=array('EXPIRY',$clang->gT("Survey expiration date"));
break;
case 'email-conf':
$replFields[]=array('TOKEN',$clang->gT("Token code for this participant"));
$replFields[]=array('FIRSTNAME',$clang->gT("First name from token"));
$replFields[]=array('LASTNAME',$clang->gT("Last name from token"));
$replFields[]=array('SURVEYNAME',$clang->gT("Name of the survey"));
$replFields[]=array('SURVEYDESCRIPTION',$clang->gT("Description of the survey"));
$attributes=GetTokenFieldsAndNames($surveyid,true);
foreach ($attributes as $attributefield=>$attributedescription)
{
$replFields[]=array(strtoupper($attributefield), sprintf($clang->gT("Token attribute: %s"),$attributedescription));
}
$replFields[]=array('ADMINNAME',$clang->gT("Name of the survey administrator"));
$replFields[]=array('ADMINEMAIL',$clang->gT("Email address of the survey administrator"));
$replFields[]=array('SURVEYURL',$clang->gT("URL of the survey"));
$replFields[]=array('EXPIRY',$clang->gT("Survey expiration date"));
// email-conf can accept insertans fields for non anonymous surveys
if (isset($surveyid))
{
$surveyInfo = getSurveyInfo($surveyid);
if ($surveyInfo['anonymized'] == "N")
{
$isInstertansEnabled=true;
}
}
break;
case 'group-desc':
case 'question-text':
case 'question-help':
case 'editgroup': // for translation
case 'editgroup_desc': // for translation
case 'editquestion': // for translation
case 'editquestion_help': // for translation
$replFields[]=array('TOKEN:FIRSTNAME',$clang->gT("First name from token"));
$replFields[]=array('TOKEN:LASTNAME',$clang->gT("Last name from token"));
$replFields[]=array('TOKEN:EMAIL',$clang->gT("Email from the token"));
$replFields[]=array('TOKEN:USESLEFT',$clang->gT("Uses left"));
$attributes=GetTokenFieldsAndNames($surveyid,true);
foreach ($attributes as $attributefield=>$attributedescription)
{
$replFields[]=array('TOKEN:'.strtoupper($attributefield), sprintf($clang->gT("Token attribute: %s"),$attributedescription));
}
$replFields[]=array('EXPIRY',$clang->gT("Survey expiration date"));
case 'editanswer':
$isInstertansEnabled=true;
break;
case 'assessment-text':
$replFields[]=array('TOTAL',$clang->gT("Overall assessment score"));
$replFields[]=array('PERC',$clang->gT("Assessment group score"));
break;
}
if ($isInstertansEnabled===true)
{
if (empty($surveyid)) {safe_die("No SID provided.");}
//2: Get all other questions that occur before this question that are pre-determined answer types
$fieldmap = createFieldMap($surveyid, 'full');
$surveyInfo = getSurveyInfo($surveyid);
$surveyformat = $surveyInfo['format'];// S, G, A
$prevquestion=null;
$previouspagequestion = true;
//Go through each question until we reach the current one
//error_log(print_r($qrows,true));
$questionlist=array();
foreach ($fieldmap as $field)
{
if (empty($field['qid'])) continue;
$AddQuestion=True;
switch ($action)
{
case 'addgroup':
$AddQuestion=True;
break;
case 'editgroup':
case 'editgroup_desc':
case 'translategroup':
if (empty($gid)) {safe_die("No GID provided.");}
if ($field['gid'] == $gid)
{
$AddQuestion=False;
}
break;
case 'addquestion':
if (empty($gid)) {safe_die("No GID provided.");}
if ( !is_null($prevquestion) &&
$prevquestion['gid'] == $gid &&
$field['gid'] != $gid)
{
$AddQuestion=False;
}
break;
case 'editanswer':
case 'copyquestion':
case 'editquestion':
case 'translatequestion':
case 'translateanswer':
if (empty($gid)) {safe_die("No GID provided.");}
if (empty($qid)) {safe_die("No QID provided.");}
if ($field['gid'] == $gid &&
$field['qid'] == $qid)
{
$AddQuestion=False;
}
break;
case 'emailtemplates':
// this is the case for email-conf
$AddQuestion=True;
break;
default:
safe_die("No Action provided.");
break;
}
if ( $AddQuestion===True)
{
if ($action == 'tokens' && $fieldtype == 'email-conf')
{
//For confirmation email all fields are valid
$previouspagequestion = true;
}
elseif ($surveyformat == "S")
{
$previouspagequestion = true;
}
elseif ($surveyformat == "G")
{
if ($previouspagequestion === true)
{ // Last question was on a previous page
if ($field["gid"] == $gid)
{ // This question is on same page
$previouspagequestion = false;
}
}
}
elseif ($surveyformat == "A")
{
$previouspagequestion = false;
}
$questionlist[]=array_merge($field,Array( "previouspage" => $previouspagequestion));
$prevquestion=$field;
}
else
{
break;
}
}
$questionscount=count($questionlist);
if ($questionscount > 0)
{
foreach($questionlist as $rows)
{
$question = $rows['question'];
if (isset($rows['subquestion'])) $question = "[{$rows['subquestion']}] " . $question;
if (isset($rows['subquestion1'])) $question = "[{$rows['subquestion1']}] " . $question;
if (isset($rows['subquestion2'])) $question = "[{$rows['subquestion2']}] " . $question;
$shortquestion=$rows['title'].": ".FlattenText($question);
$cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['fieldname'],$rows['previouspage']);
} //foreach questionlist
} //if questionscount > 0
// Now I´ll add a hack to add the questions before as option
// if they are date type
}
if (count($replFields) > 0 || isset($cquestions) )
{
$limereplacementoutput .= "\t<select name='cquestions' id='cquestions' style='font-family:verdana; background-color: #FFFFFF; font-size:10; border: 0px;width:99%;' size='15' ondblclick='Ok();'>\n";
$noselection = false;
}
else
{
$limereplacementoutput .= $clang->gT("No replacement variable available for this field");
$noselection = true;
}
if (count($replFields) > 0)
{
$limereplacementoutput .= "<optgroup label='".$clang->gT("Standard Fields")."'>\n";
foreach ($replFields as $stdfield)
{
$limereplacementoutput .= "\t<option value='".$stdfield[0]."' title='".$stdfield[1]."'";
$limereplacementoutput .= ">".$stdfield[1]."</option>\n";
}
$limereplacementoutput .= "</optgroup>\n";
}
if (isset($cquestions))
{
$limereplacementoutput .= "<optgroup label='".$clang->gT("Previous Answers Fields")."'>\n";
foreach ($cquestions as $cqn)
{
$isDisabled="";
if (in_array($cqn[2],$InsertansUnsupportedtypes))
{
$isDisabled=" disabled='disabled'";
}
elseif ($cqn[4] === false)
{
$isDisabled=" disabled='disabled'";
}
$limereplacementoutput .= "\t<option value='INSERTANS:$cqn[3]' title='".$cqn[0]."'";
$limereplacementoutput .= " $isDisabled >$cqn[0]</option>\n";
}
$limereplacementoutput .= "</optgroup>\n";
}
if ($noselection === false)
{
$limereplacementoutput .= "\t</select>\n";
}
$limereplacementoutput .= "</td>\n"
. "\t</tr>\n";
if (isset($surveyformat))
{
switch ($surveyformat)
{
case 'A':
$limereplacementoutput .= "\t<tr>\n"
. "<td>\n";
$limereplacementoutput .= "\t<br />\n"
. "\t<font color='orange'>".$clang->gT("Some Question have been disabled")."</font>\n";
$limereplacementoutput .= "\t<br />\n"
. "\t".sprintf($clang->gT("Survey Format is %s:"), $clang->gT("All in one"))
. "\t<br />\n"
. "\t<i>".$clang->gT("Only Previous pages answers are available")."</i>\n"
. "\t<br />\n";
$limereplacementoutput .= "</td>\n"
. "\t</tr>\n";
break;
case 'G':
$limereplacementoutput .= "\t<tr>\n"
. "<td>\n";
$limereplacementoutput .= "\t<br /><font color='orange'>".$clang->gT("Some Question have been disabled")."</font>";
$limereplacementoutput .= "<br />".sprintf($clang->gT("Survey mode is set to %s:"), $clang->gT("Group by Group"))."<br/><i>".$clang->gT("Only Previous pages answers are available")."</i><br />";
$limereplacementoutput .= "</td>\n"
. "\t</tr>\n";
break;
}
}
$limereplacementoutput .= "</table>\n";
echo $limereplacementoutput;
exit;
?>
<?php
/*
* LimeSurvey
* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: fck_LimeReplacementFields.php 11664 2011-12-16 05:19:42Z tmswhite $
*/
include_once("login_check.php");
if(!isset($_SESSION['loginID']))
{
die ("Unauthenticated Access Forbiden");
}
$surveyid=returnglobal('sid');
if (!isset($gid)) {$gid=returnglobal('gid');}
if (!isset($qid)) {$qid=returnglobal('qid');}
$fieldtype=preg_replace("/[^_.a-zA-Z0-9-]/", "",$_GET['fieldtype']);
$action=preg_replace("/[^_.a-zA-Z0-9-]/", "",$_GET['editedaction']);
//$InsertansUnsupportedtypes=Array('TEST-A','TEST-B','TEST-C','TEST-D');
$InsertansUnsupportedtypes=Array(); // Currently all question types are supported
$replFields=Array();
$isInstertansEnabled=false;
$limereplacementoutput="\t\t<script language=\"javascript\">\n"
. "\t\t\$(document).ready(function ()\n"
. "\t\t\t{\n"
. "\t\t\t\tLoadSelected() ;\n"
. "\t\t\t\tmydialog.SetOkButton( true ) ;\n"
. "\n"
. "SelectField( 'cquestions' ) ;\n"
. "\t});\n"
. "\n";
/**$limereplacementoutput="\n"
. "if (! oEditor.FCKBrowserInfo.IsIE)\n"
. "{\n"
. "\tinnertext = '' + dialog.EditorWindow.getSelection() + '' ;\n"
. "}\n"
. "else\n"
. "{\n"
. "\tinnertext = '' + dialog.EditorDocument.selection.createRange().text + '' ;\n"
. "}\n";
**/
$limereplacementoutput .= ""
. "\tvar eSelected = dialog.Selection.GetSelectedElement() ;\n"
. "\n";
/**
$limereplacementoutput="\n"
. "function LoadSelected()\n"
. "{\n"
. "\tif ( innertext == '' )\n"
. "return ;\n"
. "var replcode=innertext.substring(innertext.indexOf('{')+1,innertext.lastIndexOf('}'));\n"
. "document.getElementById('cquestions').value = replcode;\n"
. "}\n";
**/
$limereplacementoutput .= ""
. "\tfunction LoadSelected()\n"
. "\t{\n"
. "if ( !eSelected )\n"
. "\treturn ;\n"
. "if ( eSelected.tagName == 'SPAN' && eSelected._fckLimeReplacementFields )\n"
. "\t document.getElementById('cquestions').value = eSelected._fckLimeReplacementFields ;\n"
. "else\n"
. "\teSelected == null ;\n"
. "\t}\n";
$limereplacementoutput .= ""
. "\tfunction Ok()\n"
. "\t{\n"
. "var sValue = document.getElementById('cquestions').value ;\n"
. "FCKLimeReplacementFieldss.Add( sValue ) ;\n"
. "return true ;\n"
. "\t}\n";
$limereplacementoutput .= ""
. "\t</script>\n"
. "</head>\n";
$limereplacementoutput .= "\t<body scroll=\"no\" style=\"OVERFLOW: hidden;\">\n"
. "<table height=\"100%\" cellSpacing=\"0\" cellPadding=\"0\" width=\"100%\" border=\"0\">\n"
. "\t<tr>\n"
. "<td>\n";
switch ($fieldtype)
{
case 'survey-desc':
case 'survey-welc':
case 'survey-endtext':
case 'edittitle': // for translation
case 'editdescription': // for translation
case 'editwelcome': // for translation
case 'editend': // for translation
$replFields[]=array('TOKEN:FIRSTNAME',$clang->gT("First name from token"));
$replFields[]=array('TOKEN:LASTNAME',$clang->gT("Last name from token"));
$replFields[]=array('TOKEN:EMAIL',$clang->gT("Email from the token"));
$replFields[]=array('TOKEN:USESLEFT',$clang->gT("Uses left"));
$attributes=GetTokenFieldsAndNames($surveyid,true);
foreach ($attributes as $attributefield=>$attributedescription)
{
$replFields[]=array('TOKEN:'.strtoupper($attributefield), sprintf($clang->gT("Token attribute: %s"),$attributedescription));
}
$replFields[]=array('EXPIRY',$clang->gT("Survey expiration date"));
break;
case 'email-admin-notification':
$replFields[]=array('RELOADURL',$clang->gT("Reload URL"));
$replFields[]=array('VIEWRESPONSEURL',$clang->gT("View response URL"));
$replFields[]=array('EDITRESPONSEURL',$clang->gT("Edit response URL"));
$replFields[]=array('STATISTICSURL',$clang->gT("Statistics URL"));
$replFields[]=array('TOKEN',$clang->gT("Token code for this participant"));
$replFields[]=array('TOKEN:FIRSTNAME',$clang->gT("First name from token"));
$replFields[]=array('TOKEN:LASTNAME',$clang->gT("Last name from token"));
$replFields[]=array('TOKEN:USESLEFT',$clang->gT("Uses left"));
$replFields[]=array('SURVEYNAME',$clang->gT("Name of the survey"));
$replFields[]=array('SURVEYDESCRIPTION',$clang->gT("Description of the survey"));
$attributes=GetTokenFieldsAndNames($surveyid,true);
foreach ($attributes as $attributefield=>$attributedescription)
{
$replFields[]=array(strtoupper($attributefield), sprintf($clang->gT("Token attribute: %s"),$attributedescription));
}
$replFields[]=array('ADMINNAME',$clang->gT("Name of the survey administrator"));
$replFields[]=array('ADMINEMAIL',$clang->gT("Email address of the survey administrator"));
break;
case 'email-admin-resp':
$replFields[]=array('RELOADURL',$clang->gT("Reload URL"));
$replFields[]=array('VIEWRESPONSEURL',$clang->gT("View response URL"));
$replFields[]=array('EDITRESPONSEURL',$clang->gT("Edit response URL"));
$replFields[]=array('STATISTICSURL',$clang->gT("Statistics URL"));
$replFields[]=array('ANSWERTABLE',$clang->gT("Answers from this response"));
$replFields[]=array('TOKEN',$clang->gT("Token code for this participant"));
$replFields[]=array('TOKEN:FIRSTNAME',$clang->gT("First name from token"));
$replFields[]=array('TOKEN:LASTNAME',$clang->gT("Last name from token"));
$replFields[]=array('TOKEN:USESLEFT',$clang->gT("Uses left"));
$replFields[]=array('SURVEYNAME',$clang->gT("Name of the survey"));
$replFields[]=array('SURVEYDESCRIPTION',$clang->gT("Description of the survey"));
$attributes=GetTokenFieldsAndNames($surveyid,true);
foreach ($attributes as $attributefield=>$attributedescription)
{
$replFields[]=array(strtoupper($attributefield), sprintf($clang->gT("Token attribute: %s"),$attributedescription));
}
$replFields[]=array('ADMINNAME',$clang->gT("Name of the survey administrator"));
$replFields[]=array('ADMINEMAIL',$clang->gT("Email address of the survey administrator"));
break;
case 'email-inv':
case 'email-rem':
// these 3 fields are supported by email-inv and email-rem
// but not email-reg for the moment
$replFields[]=array('EMAIL',$clang->gT("Email from the token"));
$replFields[]=array('USESLEFT',$clang->gT("Uses left"));
$replFields[]=array('OPTOUTURL',$clang->gT("URL for a respondent to opt-out this survey"));
case 'email-reg':
$replFields[]=array('FIRSTNAME',$clang->gT("First name from token"));
$replFields[]=array('LASTNAME',$clang->gT("Last name from token"));
$replFields[]=array('SURVEYNAME',$clang->gT("Name of the survey"));
$replFields[]=array('SURVEYDESCRIPTION',$clang->gT("Description of the survey"));
$replFields[]=array('TOKEN',$clang->gT("Token code for this participant"));
$replFields[]=array('SURVEYID',$clang->gT("ID of the survey"));
$attributes=GetTokenFieldsAndNames($surveyid,true);
foreach ($attributes as $attributefield=>$attributedescription)
{
$replFields[]=array(strtoupper($attributefield), sprintf($clang->gT("Token attribute: %s"),$attributedescription));
}
$replFields[]=array('ADMINNAME',$clang->gT("Name of the survey administrator"));
$replFields[]=array('ADMINEMAIL',$clang->gT("Email address of the survey administrator"));
$replFields[]=array('SURVEYURL',$clang->gT("URL of the survey"));
$replFields[]=array('EXPIRY',$clang->gT("Survey expiration date"));
break;
case 'email-conf':
$replFields[]=array('TOKEN',$clang->gT("Token code for this participant"));
$replFields[]=array('FIRSTNAME',$clang->gT("First name from token"));
$replFields[]=array('LASTNAME',$clang->gT("Last name from token"));
$replFields[]=array('SURVEYNAME',$clang->gT("Name of the survey"));
$replFields[]=array('SURVEYDESCRIPTION',$clang->gT("Description of the survey"));
$attributes=GetTokenFieldsAndNames($surveyid,true);
foreach ($attributes as $attributefield=>$attributedescription)
{
$replFields[]=array(strtoupper($attributefield), sprintf($clang->gT("Token attribute: %s"),$attributedescription));
}
$replFields[]=array('ADMINNAME',$clang->gT("Name of the survey administrator"));
$replFields[]=array('ADMINEMAIL',$clang->gT("Email address of the survey administrator"));
$replFields[]=array('SURVEYURL',$clang->gT("URL of the survey"));
$replFields[]=array('EXPIRY',$clang->gT("Survey expiration date"));
// email-conf can accept insertans fields for non anonymous surveys
if (isset($surveyid))
{
$surveyInfo = getSurveyInfo($surveyid);
if ($surveyInfo['anonymized'] == "N")
{
$isInstertansEnabled=true;
}
}
break;
case 'group-desc':
case 'question-text':
case 'question-help':
case 'editgroup': // for translation
case 'editgroup_desc': // for translation
case 'editquestion': // for translation
case 'editquestion_help': // for translation
$replFields[]=array('TOKEN:FIRSTNAME',$clang->gT("First name from token"));
$replFields[]=array('TOKEN:LASTNAME',$clang->gT("Last name from token"));
$replFields[]=array('TOKEN:EMAIL',$clang->gT("Email from the token"));
$replFields[]=array('TOKEN:USESLEFT',$clang->gT("Uses left"));
$attributes=GetTokenFieldsAndNames($surveyid,true);
foreach ($attributes as $attributefield=>$attributedescription)
{
$replFields[]=array('TOKEN:'.strtoupper($attributefield), sprintf($clang->gT("Token attribute: %s"),$attributedescription));
}
$replFields[]=array('EXPIRY',$clang->gT("Survey expiration date"));
case 'editanswer':
$isInstertansEnabled=true;
break;
case 'assessment-text':
$replFields[]=array('TOTAL',$clang->gT("Overall assessment score"));
$replFields[]=array('PERC',$clang->gT("Assessment group score"));
break;
}
if ($isInstertansEnabled===true)
{
if (empty($surveyid)) {safe_die("No SID provided.");}
//2: Get all other questions that occur before this question that are pre-determined answer types
$fieldmap = createFieldMap($surveyid, 'full');
$surveyInfo = getSurveyInfo($surveyid);
$surveyformat = $surveyInfo['format'];// S, G, A
$prevquestion=null;
$previouspagequestion = true;
//Go through each question until we reach the current one
//error_log(print_r($qrows,true));
$questionlist=array();
foreach ($fieldmap as $field)
{
if (empty($field['qid'])) continue;
$AddQuestion=True;
switch ($action)
{
case 'addgroup':
$AddQuestion=True;
break;
case 'editgroup':
case 'editgroup_desc':
case 'translategroup':
if (empty($gid)) {safe_die("No GID provided.");}
if ($field['gid'] == $gid)
{
$AddQuestion=False;
}
break;
case 'addquestion':
if (empty($gid)) {safe_die("No GID provided.");}
if ( !is_null($prevquestion) &&
$prevquestion['gid'] == $gid &&
$field['gid'] != $gid)
{
$AddQuestion=False;
}
break;
case 'editanswer':
case 'copyquestion':
case 'editquestion':
case 'translatequestion':
case 'translateanswer':
if (empty($gid)) {safe_die("No GID provided.");}
if (empty($qid)) {safe_die("No QID provided.");}
if ($field['gid'] == $gid &&
$field['qid'] == $qid)
{
$AddQuestion=False;
}
break;
case 'emailtemplates':
// this is the case for email-conf
$AddQuestion=True;
break;
default:
safe_die("No Action provided.");
break;
}
if ( $AddQuestion===True)
{
if ($action == 'tokens' && $fieldtype == 'email-conf')
{
//For confirmation email all fields are valid
$previouspagequestion = true;
}
elseif ($surveyformat == "S")
{
$previouspagequestion = true;
}
elseif ($surveyformat == "G")
{
if ($previouspagequestion === true)
{ // Last question was on a previous page
if ($field["gid"] == $gid)
{ // This question is on same page
$previouspagequestion = false;
}
}
}
elseif ($surveyformat == "A")
{
$previouspagequestion = false;
}
$questionlist[]=array_merge($field,Array( "previouspage" => $previouspagequestion));
$prevquestion=$field;
}
else
{
break;
}
}
$questionscount=count($questionlist);
if ($questionscount > 0)
{
foreach($questionlist as $rows)
{
$question = $rows['question'];
if (isset($rows['subquestion'])) $question = "[{$rows['subquestion']}] " . $question;
if (isset($rows['subquestion1'])) $question = "[{$rows['subquestion1']}] " . $question;
if (isset($rows['subquestion2'])) $question = "[{$rows['subquestion2']}] " . $question;
$shortquestion=$rows['title'].": ".FlattenText($question);
$cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['fieldname'],$rows['previouspage']);
} //foreach questionlist
} //if questionscount > 0
// Now I´ll add a hack to add the questions before as option
// if they are date type
}
if (count($replFields) > 0 || isset($cquestions) )
{
$limereplacementoutput .= "\t<select name='cquestions' id='cquestions' style='font-family:verdana; background-color: #FFFFFF; font-size:10; border: 0px;width:99%;' size='15' ondblclick='Ok();'>\n";
$noselection = false;
}
else
{
$limereplacementoutput .= $clang->gT("No replacement variable available for this field");
$noselection = true;
}
if (count($replFields) > 0)
{
$limereplacementoutput .= "<optgroup label='".$clang->gT("Standard Fields")."'>\n";
foreach ($replFields as $stdfield)
{
$limereplacementoutput .= "\t<option value='".$stdfield[0]."' title='".$stdfield[1]."'";
$limereplacementoutput .= ">".$stdfield[1]."</option>\n";
}
$limereplacementoutput .= "</optgroup>\n";
}
if (isset($cquestions))
{
$limereplacementoutput .= "<optgroup label='".$clang->gT("Previous Answers Fields")."'>\n";
foreach ($cquestions as $cqn)
{
$isDisabled="";
if (in_array($cqn[2],$InsertansUnsupportedtypes))
{
$isDisabled=" disabled='disabled'";
}
elseif ($cqn[4] === false)
{
$isDisabled=" disabled='disabled'";
}
$limereplacementoutput .= "\t<option value='INSERTANS:$cqn[3]' title='".$cqn[0]."'";
$limereplacementoutput .= " $isDisabled >$cqn[0]</option>\n";
}
$limereplacementoutput .= "</optgroup>\n";
}
if ($noselection === false)
{
$limereplacementoutput .= "\t</select>\n";
}
$limereplacementoutput .= "</td>\n"
. "\t</tr>\n";
if (isset($surveyformat))
{
switch ($surveyformat)
{
case 'A':
$limereplacementoutput .= "\t<tr>\n"
. "<td>\n";
$limereplacementoutput .= "\t<br />\n"
. "\t<font color='orange'>".$clang->gT("Some Question have been disabled")."</font>\n";
$limereplacementoutput .= "\t<br />\n"
. "\t".sprintf($clang->gT("Survey Format is %s:"), $clang->gT("All in one"))
. "\t<br />\n"
. "\t<i>".$clang->gT("Only Previous pages answers are available")."</i>\n"
. "\t<br />\n";
$limereplacementoutput .= "</td>\n"
. "\t</tr>\n";
break;
case 'G':
$limereplacementoutput .= "\t<tr>\n"
. "<td>\n";
$limereplacementoutput .= "\t<br /><font color='orange'>".$clang->gT("Some Question have been disabled")."</font>";
$limereplacementoutput .= "<br />".sprintf($clang->gT("Survey mode is set to %s:"), $clang->gT("Group by Group"))."<br/><i>".$clang->gT("Only Previous pages answers are available")."</i><br />";
$limereplacementoutput .= "</td>\n"
. "\t</tr>\n";
break;
}
}
$limereplacementoutput .= "</table>\n";
echo $limereplacementoutput;
exit;
?>
File diff suppressed because it is too large Load Diff
+303 -225
View File
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: html.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: html.php 12398 2012-02-07 20:02:56Z tmswhite $
*/
//Security Checked: POST, GET, SESSION, DB, REQUEST, returnglobal
@@ -43,6 +43,48 @@ if ($action == "personalsettings")
$edmod1="selected='selected'";
break;
}
// prepare data for the questionselectormode preference
$qsmod1='';
$qsmod2='';
$qsmod3='';
$qsmod="default";
if( isset($_SESSION['questionselectormode']))
{
$qsmod=$_SESSION['questionselectormode'];
}
switch ($qsmod)
{
case 'full':
$qsmod2="selected='selected'";
break;
case 'none':
$qsmod3="selected='selected'";
break;
default:
$qsmod1="selected='selected'";
break;
}
// prepare data for the templateeditormode preference
$temod1='';
$temod2='';
$temod3='';
$temod="default";
if( isset($_SESSION['templateeditormode']))
{
$temod=$_SESSION['templateeditormode'];
}
switch ($temod)
{
case 'full':
$temod2="selected='selected'";
break;
case 'none':
$temod3="selected='selected'";
break;
default:
$temod1="selected='selected'";
break;
}
$cssummary = "<div class='formheader'>"
. "<strong>".$clang->gT("Your personal settings")."</strong>\n"
@@ -80,6 +122,26 @@ if ($action == "personalsettings")
$cssummary .= "</select>\n"
. "</li>\n";
// Current questionselectormode
$cssummary .= "<li>\n"
. "<label for='questionselectormode'>".$clang->gT("Question type selector").":</label>\n"
. "<select id='questionselectormode' name='questionselectormode'>\n"
. "<option value='default' {$qsmod1}>".$clang->gT("Default")."</option>\n"
. "<option value='full' {$qsmod2}>".$clang->gT("Full selector")."</option>\n"
. "<option value='none' {$qsmod3}>".$clang->gT("Simple selector")."</option>\n";
$cssummary .= "</select>\n"
. "</li>\n";
// Current templateeditormode
$cssummary .= "<li>\n"
. "<label for='templateeditormode'>".$clang->gT("Template editor mode").":</label>\n"
. "<select id='templateeditormode' name='templateeditormode'>\n"
. "<option value='default' {$temod1}>".$clang->gT("Default")."</option>\n"
. "<option value='full' {$temod2}>".$clang->gT("Full template editor")."</option>\n"
. "<option value='none' {$temod3}>".$clang->gT("Simple template editor")."</option>\n";
$cssummary .= "</select>\n"
. "</li>\n";
// Date format
$cssummary .= "<li>\n"
. "<label for='dateformat'>".$clang->gT("Date format").":</label>\n"
@@ -213,7 +275,10 @@ $action!='vvimport' && $action!='vvexport' && $action!='exportresults')
$icontext2=$clang->gTview("Execute This Survey");
}
$baselang = GetBaseLanguageFromSurveyID($surveyid);
if (count(GetAdditionalLanguagesFromSurveyID($surveyid)) == 0)
$tmp_survlangs = GetAdditionalLanguagesFromSurveyID($surveyid);
$tmp_survlangs[] = $baselang;
rsort($tmp_survlangs);
if (count($tmp_survlangs) == 1)
{
$surveysummary .= "<li><a href='#' accesskey='d' onclick=\"window.open('"
. $publicurl."/index.php?sid={$surveyid}&amp;newtest=Y&amp;lang={$baselang}', '_blank')\" title=\"{$icontext2}\" >"
@@ -227,9 +292,6 @@ $action!='vvimport' && $action!='vvexport' && $action!='exportresults')
. "</a><ul>\n";
$surveysummary .= "<li><a accesskey='d' target='_blank' href='{$publicurl}/index.php?sid=$surveyid&amp;newtest=Y'>"
. "<img src='{$imageurl}/do_30.png' /> $icontext </a><ul>";
$tmp_survlangs = GetAdditionalLanguagesFromSurveyID($surveyid);
$tmp_survlangs[] = $baselang;
rsort($tmp_survlangs);
// Test Survey Language Selection Popup
foreach ($tmp_survlangs as $tmp_lang)
{
@@ -262,7 +324,7 @@ $action!='vvimport' && $action!='vvexport' && $action!='exportresults')
}
// Survey permission item
if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $surveyinfo['owner_id'] == $_SESSION['loginID'])
if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $surveyinfo['owner_id'] == $_SESSION['loginID'] || bHasSurveyPermission($surveyid,'surveysecurity','read'))
{
$surveysummary .= "<li><a href='{$scriptname}?action=surveysecurity&amp;sid={$surveyid}'>"
. "<img src='{$imageurl}/survey_security_30.png' name='SurveySecurity'/> ".$clang->gT("Survey permissions")."</a></li>\n";
@@ -309,12 +371,38 @@ $action!='vvimport' && $action!='vvexport' && $action!='exportresults')
. "<img src='{$imageurl}/emailtemplates_30.png' name='EditEmailTemplates' /> ".$clang->gT("Email templates")."</a></li>\n";
}
// QUALITY ASSURANCE BUTTON - SHOW LOGIC FILE
if(bHasSurveyPermission($surveyid,'translations','read'))
{
$icontext = $clang->gT("Survey Logic File");
}
if (count($tmp_survlangs) == 1)
{
$surveysummary .= "<li><a href='#' onclick=\"window.open('{$scriptname}?action=showlogicfile&amp;sid={$surveyid}', '_blank')\" title=\"{$icontext}\" >"
. "<img src='{$imageurl}/quality_assurance.png' alt='$icontext' />$icontext"
. "</a></li>\n";
} else {
$surveysummary .= "<li><a href='#' "
. "title='{$icontext}'>"
. "<img src='{$imageurl}/quality_assurance.png' alt='{$icontext}' />$icontext"
. "</a><ul>\n";
// Test Survey Language Selection Popup
foreach ($tmp_survlangs as $tmp_lang)
{
$surveysummary .= "<li><a target='_blank' href='{$scriptname}?action=showlogicfile&amp;sid={$surveyid}&amp;lang={$tmp_lang}'>"
. "<img src='{$imageurl}/quality_assurance.png' /> ".getLanguageNameFromCode($tmp_lang,false)."</a></li>";
}
$surveysummary .= "</ul></li>";
}
$surveysummary .='</ul></li>'; // End if survey properties
// Tools menu item
$surveysummary .= "<li><a href=\"#\">"
. "<img src='{$imageurl}/tools.png' name='SorveyTools' alt='".$clang->gT("Tools")."' /></a><ul>\n";
. "<img src='{$imageurl}/tools.png' name='SurveyTools' alt='".$clang->gT("Tools")."' /></a><ul>\n";
// Delete survey item
@@ -357,6 +445,14 @@ $action!='vvimport' && $action!='vvexport' && $action!='exportresults')
. "<img src='{$imageurl}/resetsurveylogic_disabled_30.png' name='ResetSurveyLogic' /> ".$clang->gT("Reset Survey Logic")."</a></li>\n";
}
}
// EXPRESSION MANAGER TEST SUITE
if (bHasSurveyPermission($surveyid,'surveycontent','update'))
{
$surveysummary .= "<li><a target='_blank' href='{$scriptname}?action=EMtest'>"
. "<img src='{$imageurl}/expressionManager_30.png' name='ExpressionManager' /> ".$clang->gT("Expression Manager")."</a></li>\n";
}
$surveysummary .='</ul></li>' ;
@@ -645,10 +741,10 @@ $action!='vvimport' && $action!='vvexport' && $action!='exportresults')
{
$surveysummary2 .= $clang->gT("Regenerate question codes:")
. " [<a href='#' "
. "onclick=\"if (confirm('".$clang->gT("Are you sure you want regenerate the question codes?","js")."')) {".get2post("$scriptname?action=renumberquestions&amp;sid=$surveyid&amp;style=straight")."}\" "
. "onclick=\"if (confirm('".$clang->gT("Are you sure you want to regenerate the question codes?\n\nWARNING:\nThis is safe if you only use the Conditions editor.\n\nHOWEVER, if you manually specified any relevance equations, regenerating the question codes will break all of that survey logic.","js")."')) {".get2post("$scriptname?action=renumberquestions&amp;sid=$surveyid&amp;style=straight")."}\" "
. ">".$clang->gT("Straight")."</a>] "
. " [<a href='#' "
. "onclick=\"if (confirm('".$clang->gT("Are you sure you want regenerate the question codes?","js")."')) {".get2post("$scriptname?action=renumberquestions&amp;sid=$surveyid&amp;style=bygroup")."}\" "
. "onclick=\"if (confirm('".$clang->gT("Are you sure you want to regenerate the question codes?\n\nWARNING:\nThis is safe if you only use the Conditions editor.\n\nHOWEVER, if you manually specified any relevance equations, regenerating the question codes will break all of that survey logic.","js")."')) {".get2post("$scriptname?action=renumberquestions&amp;sid=$surveyid&amp;style=bygroup")."}\" "
. ">".$clang->gT("By Group")."</a>]";
$surveysummary2 .= "</td></tr>\n";
}
@@ -674,12 +770,36 @@ $action!='vvimport' && $action!='vvexport' && $action!='exportresults')
$surveysummary .= "</td></tr>\n"
. "<tr><td align='right' valign='top'><strong>"
. $clang->gT("Description:")."</strong></td>\n<td align='left'>";
if (trim($surveyinfo['surveyls_description'])!='') {$surveysummary .= " {$surveyinfo['surveyls_description']}";}
LimeExpressionManager::StartProcessingPage(false,$rooturl,true); // so can click on syntax highlighting to edit questions
if (trim($surveyinfo['surveyls_description'])!='')
{
templatereplace($surveyinfo['surveyls_description']);
$surveysummary .= LimeExpressionManager::GetLastPrettyPrintExpression();
}
$surveysummary .= "</td></tr>\n"
. "<tr >\n"
. "<td align='right' valign='top'><strong>"
. $clang->gT("Welcome:")."</strong></td>\n"
. "<td align='left'> {$surveyinfo['surveyls_welcometext']}</td></tr>\n"
. "<td align='left'>";
templatereplace($surveyinfo['surveyls_welcometext']);
$surveysummary .= LimeExpressionManager::GetLastPrettyPrintExpression();
if (trim($surveyinfo['surveyls_endtext'])!='')
{
$surveysummary .= "</td></tr>\n"
. "<tr >\n"
. "<td align='right' valign='top'><strong>"
. $clang->gT("End message:")."</strong></td>\n"
. "<td align='left'>";
templatereplace($surveyinfo['surveyls_endtext']);
$surveysummary .= LimeExpressionManager::GetLastPrettyPrintExpression();
}
$surveysummary .= "</td></tr>\n"
. "<tr ><td align='right' valign='top'><strong>"
. $clang->gT("Administrator:")."</strong></td>\n"
. "<td align='left'> {$surveyinfo['admin']} ({$surveyinfo['adminemail']})</td></tr>\n";
@@ -753,7 +873,11 @@ $action!='vvimport' && $action!='vvexport' && $action!='exportresults')
. "<td align='left'>";
if ($surveyinfo['surveyls_url']!="")
{
$surveysummary .=" <a target='_blank' href=\"".htmlspecialchars($surveyinfo['surveyls_url'])."\" title=\"".htmlspecialchars($surveyinfo['surveyls_url'])."\">{$surveyinfo['surveyls_urldescription']}</a>";
templatereplace($surveyinfo['surveyls_url']);
$_url = htmlspecialchars(strip_tags(LimeExpressionManager::GetLastPrettyPrintExpression()));
templatereplace($surveyinfo['surveyls_urldescription']);
$_desc = LimeExpressionManager::GetLastPrettyPrintExpression();
$surveysummary .=" <a target='_blank' href=\"".$_url."\" title=\"".$_url."\">{$_desc}</a>";
}
else
{
@@ -815,9 +939,6 @@ if (isset($surveyid) && $surveyid && $gid ) // Show the group toolbar
language='".$baselang."' ORDER BY ".db_table_name('groups').".group_order";
$grpresult = db_execute_assoc($grpquery); //Checked
// Check if other questions/groups are dependent upon this group
$condarray=GetGroupDepsForConditions($surveyid,"all",$gid,"by-targgid");
$groupsummary = "<div class='menubar'>\n"
. "<div class='menubar-title ui-widget-header'>\n";
@@ -860,6 +981,14 @@ if (isset($surveyid) && $surveyid && $gid ) // Show the group toolbar
. "<img src='$imageurl/edit.png' alt='".$clang->gT("Edit current question group")."' name='EditGroup' /></a>\n" ;
}
// QUALITY ASSURANCE BUTTON - SHOW LOGIC FILE FOR THIS QUESTION GROUP
if(bHasSurveyPermission($surveyid,'translations','read'))
{
$groupsummary .= "<img src='$imageurl/seperator.gif' alt='' />\n"
. "<a href=\"#\" onclick=\"window.open('$scriptname?action=showlogicfile&amp;sid=$surveyid&amp;gid=$gid','_blank')\""
. " title=\"".$clang->gTview("Survey logic file for current question group")."\">"
. "<img src='$imageurl/quality_assurance.png' alt='".$clang->gT("Survey logic file for current question group")."' name='ShowGroupLogicFile' /></a>\n" ;
}
// DELETE CURRENT QUESTION GROUP BUTTON
@@ -867,20 +996,9 @@ if (isset($surveyid) && $surveyid && $gid ) // Show the group toolbar
{
if ((($sumcount4 == 0 && $activated != "Y") || $activated != "Y"))
{
if (is_null($condarray))
{
// $groupsummary .= "<a href='$scriptname?action=delgroup&amp;sid=$surveyid&amp;gid=$gid' onclick=\"return confirm('".$clang->gT("Deleting this group will also delete any questions and answers it contains. Are you sure you want to continue?","js")."')\""
$groupsummary .= "<a href='#' onclick=\"if (confirm('".$clang->gT("Deleting this group will also delete any questions and answers it contains. Are you sure you want to continue?","js")."')) {".get2post("$scriptname?action=delgroup&amp;sid=$surveyid&amp;gid=$gid")."}\""
. " title=\"".$clang->gTview("Delete current question group")."\">"
. "<img src='$imageurl/delete.png' alt='".$clang->gT("Delete current question group")."' name='DeleteWholeGroup' title='' /></a>\n";
//get2post("$scriptname?action=delgroup&amp;sid=$surveyid&amp;gid=$gid");
}
else
{
$groupsummary .= "<a href='$scriptname?sid=$surveyid&amp;gid=$gid' onclick=\"alert('".$clang->gT("Impossible to delete this group because there is at least one question having a condition on its content","js")."')\""
. " title=\"".$clang->gTview("Delete current question group")."\">"
. "<img src='$imageurl/delete_disabled.png' alt='".$clang->gT("Delete current question group")."' name='DeleteWholeGroup' /></a>\n";
}
}
else
{
@@ -906,8 +1024,6 @@ if (isset($surveyid) && $surveyid && $gid ) // Show the group toolbar
$groupsummary .= "<img src='$imageurl/seperator.gif' alt='' />\n";
if($activated!="Y" && getQuestionSum($surveyid, $gid)>1)
{
// $groupsummary .= "<img src='$imageurl/blank.gif' alt='' width='40' />\n";
// $groupsummary .= "<img src='$imageurl/seperator.gif' alt='' />\n";
$groupsummary .= "<a href='$scriptname?action=orderquestions&amp;sid=$surveyid&amp;gid=$gid' title=\"".$clang->gTview("Change Question Order")."\" >"
. "<img src='$imageurl/reorder.png' alt='".$clang->gT("Change Question Order")."' name='updatequestionorder' /></a>\n" ;
}
@@ -1010,25 +1126,20 @@ if (isset($surveyid) && $surveyid && $gid ) // Show the group toolbar
. "{$grow['group_name']} ({$grow['gid']})</td></tr>\n"
. "<tr><td valign='top' align='right'><strong>"
. $clang->gT("Description:")."</strong></td>\n<td align='left'>";
if (trim($grow['description'])!='') {$groupsummary .=$grow['description'];}
if (trim($grow['description'])!='')
{
templatereplace($grow['description']);
$groupsummary .= LimeExpressionManager::GetLastPrettyPrintExpression();
}
if (trim($grow['grelevance'])!='')
{
$groupsummary .= "</td><tr><td valign='top' align='right'><strong>";
$groupsummary .= $clang->gT("Relevance:")."</td>\n<td align='left'>";
templatereplace('{' . $grow['grelevance'] . '}');
$groupsummary .= LimeExpressionManager::GetLastPrettyPrintExpression();
}
$groupsummary .= "</td></tr>\n";
if (!is_null($condarray))
{
$groupsummary .= "<tr><td align='right'><strong>"
. $clang->gT("Questions with conditions to this group").":</strong></td>\n"
. "<td valign='bottom' align='left'>";
foreach ($condarray[$gid] as $depgid => $deprow)
{
foreach ($deprow['conditions'] as $depqid => $depcid)
{
//$groupsummary .= "[QID: ".$depqid."]";
$listcid=implode("-",$depcid);
$groupsummary .= " <a href='#' onclick=\"window.open('admin.php?sid=".$surveyid."&amp;gid=".$depgid."&amp;qid=".$depqid."&amp;action=conditions&amp;markcid=".$listcid."','_self')\">[QID: ".$depqid."]</a>";
}
}
$groupsummary .= "</td></tr>";
}
}
$groupsummary .= "\n</table>\n";
}
@@ -1055,18 +1166,12 @@ if (isset($surveyid) && $surveyid && $gid && $qid) // Show the question toolbar
$qrresult = db_execute_assoc($qrquery) or safe_die($qrquery."<br />".$connect->ErrorMsg()); //Checked
$questionsummary = "<div class='menubar'>\n";
// Check if other questions in the Survey are dependent upon this question
$condarray=GetQuestDepsForConditions($surveyid,"all","all",$qid,"by-targqid","outsidegroup");
// PREVIEW THIS QUESTION BUTTON
while ($qrrow = $qrresult->FetchRow())
{
$qrrow = array_map('FlattenText', $qrrow);
//$qrrow = array_map('htmlspecialchars', $qrrow);
$questionsummary .= "<div class='menubar-title ui-widget-header'>\n"
. "<strong>". $clang->gT("Question")."</strong> <span class='basic'>{$qrrow['question']} (".$clang->gT("ID").":$qid)</span>\n"
. "<strong>". $clang->gT("Question")."</strong> <span class='basic'>".FlattenText($qrrow['question'])." (".$clang->gT("ID").":$qid)</span>\n"
. "</div>\n"
. "<div class='menubar-main'>\n"
. "<div class='menubar-left'>\n"
@@ -1101,41 +1206,34 @@ if (isset($surveyid) && $surveyid && $gid && $qid) // Show the question toolbar
}
}
// SEPARATOR
// $questionsummary .= "<img src='$imageurl/blank.gif' alt='' width='117' height='20' />\n";
// EDIT CURRENT QUESTION BUTTON
if(bHasSurveyPermission($surveyid,'surveycontent','update'))
{
$questionsummary .= ""
// ."<img src='$imageurl/seperator.gif' alt='' />\n"
. "<a href='$scriptname?action=editquestion&amp;sid=$surveyid&amp;gid=$gid&amp;qid=$qid'"
. " title=\"".$clang->gTview("Edit current question")."\">"
. "<img src='$imageurl/edit.png' alt='".$clang->gT("Edit Current Question")."' name='EditQuestion' /></a>\n" ;
}
// QUALITY ASSURANCE BUTTON - SHOW LOGIC FILE FOR THIS QUESTION GROUP
if(bHasSurveyPermission($surveyid,'translations','read'))
{
$questionsummary .= "<img src='$imageurl/seperator.gif' alt='' />\n"
. "<a href=\"#\" onclick=\"window.open('$scriptname?action=showlogicfile&amp;sid=$surveyid&amp;gid=$gid&amp;qid=$qid','_blank')\""
. " title=\"".$clang->gTview("Survey logic file for current question")."\">"
. "<img src='$imageurl/quality_assurance.png' alt='".$clang->gT("Survey logic file for current question")."' name='ShowQuestionLogicFile' /></a>\n" ;
}
// DELETE CURRENT QUESTION BUTTON
if ((($qct == 0 && $activated != "Y") || $activated != "Y") && bHasSurveyPermission($surveyid,'surveycontent','delete'))
{
if (is_null($condarray))
{
$questionsummary .= "<a href='#'" .
"onclick=\"if (confirm('".$clang->gT("Deleting this question will also delete any answer options and subquestions it includes. Are you sure you want to continue?","js")."')) {".get2post("$scriptname?action=delquestion&amp;sid=$surveyid&amp;gid=$gid&amp;qid=$qid")."}\">"
. "<img src='$imageurl/delete.png' name='DeleteWholeQuestion' alt='".$clang->gT("Delete current question")."' "
. "border='0' hspace='0' /></a>\n";
}
else
{
$questionsummary .= "<a href='$scriptname?sid=$surveyid&amp;gid=$gid&amp;qid=$qid'" .
"onclick=\"alert('".$clang->gT("It's impossible to delete this question because there is at least one question having a condition on it.","js")."')\""
. "title=\"".$clang->gTview("Disabled - Delete current question")."\">"
. "<img src='$imageurl/delete_disabled.png' name='DeleteWholeQuestion' alt='".$clang->gT("Disabled - Delete current question")."' /></a>\n";
}
}
else {$questionsummary .= "<img src='$imageurl/blank.gif' alt='' width='40' />\n";}
@@ -1265,11 +1363,22 @@ if (isset($surveyid) && $surveyid && $gid && $qid) // Show the question toolbar
else {$questionsummary .= ": (<i>".$clang->gT("Optional Question")."</i>)";}
}
$questionsummary .= "</td></tr>\n"
. "<tr><td align='right' valign='top'><strong>"
. $clang->gT("Question:")."</strong></td>\n<td align='left'>".$qrrow['question']."</td></tr>\n"
. "<tr><td align='right' valign='top'><strong>";
$questionsummary .= $clang->gT("Question:") . "</strong></td>\n<td align='left'>";
// Color code the question, help, and relevance
templatereplace($qrrow['question'],false,false,$qid);
$questionsummary .= FlattenText(LimeExpressionManager::GetLastPrettyPrintExpression(), false, 'UTF-8', true, true);
$questionsummary .= "</td></tr>\n"
. "<tr><td align='right' valign='top'><strong>"
. $clang->gT("Help:")."</strong></td>\n<td align='left'>";
if (trim($qrrow['help'])!=''){$questionsummary .= $qrrow['help'];}
if (trim($qrrow['help'])!='')
{
templatereplace($qrrow['help'],false,false,$qid);
$questionsummary .= FlattenText(LimeExpressionManager::GetLastPrettyPrintExpression(), false, 'UTF-8', true, true);
}
$questionsummary .= "</td></tr>\n";
if ($qrrow['preg'])
{
@@ -1318,22 +1427,25 @@ if (isset($surveyid) && $surveyid && $gid && $qid) // Show the question toolbar
$questionsummary .= ($qrrow['mandatory'] == "Y") ? ($clang->gT("Yes")) : ($clang->gT("No")) ;
$questionsummary .= "</td></tr>\n";
}
if (!is_null($condarray))
if (is_null($qrrow['relevance']) || trim($qrrow['relevance']) == '')
{
$rel2show = 1;
}
else
{
LimeExpressionManager::ProcessString("{" . $qrrow['relevance'] . "}", $qid); // tests Relevance equation so can pretty-print it
$rel2show = LimeExpressionManager::GetLastPrettyPrintExpression();
$questionsummary .= "<tr>"
. "<td align='right' valign='top'><strong>"
. $clang->gT("Other questions having conditions on this question:")
. "</strong></td>\n<td align='left' valign='bottom'>\n";
foreach ($condarray[$qid] as $depqid => $depcid)
{
$listcid=implode("-",$depcid);
$questionsummary .= " <a href='#' onclick=\"window.open('admin.php?sid=".$surveyid."&amp;qid=".$depqid."&amp;action=conditions&amp;markcid=".$listcid."','_self')\">[QID: ".$depqid."]</a>";
}
$questionsummary .= "</td></tr>";
. $clang->gT("Relevance:")."</strong></td>\n"
. "<td align='left'>";
$questionsummary .= $rel2show;
$questionsummary .= "</td></tr>\n";
}
$questionsummary .= "</table>";
}
}
LimeExpressionManager::FinishProcessingPage();
// ============= EDIT ANSWER OPTIONS=====================================
@@ -1362,12 +1474,6 @@ if($action == "addsurveysecurity")
$addsummary = "<div class='header ui-widget-header'>".$clang->gT("Add User")."</div>\n";
$addsummary .= "<div class=\"messagebox ui-corner-all\">\n";
$query = "SELECT sid, owner_id FROM ".db_table_name('surveys')." WHERE sid = {$surveyid} AND owner_id = ".$_SESSION['loginID']." AND owner_id != ".$postuserid;
$result = db_execute_assoc($query); //Checked
if( ($result->RecordCount() > 0 && in_array($postuserid,getuserlist('onlyuidarray'))) ||
$_SESSION['USER_RIGHT_SUPERADMIN'] == 1)
{
if($postuserid > 0){
$isrquery = "INSERT INTO {$dbprefix}survey_permissions (sid,uid,permission,read_p) VALUES ({$surveyid},{$postuserid},'survey',1)";
@@ -1396,11 +1502,6 @@ if($action == "addsurveysecurity")
. "<br />" . $clang->gT("No Username selected.")."<br />\n";
$addsummary .= "<br/><input type=\"submit\" onclick=\"window.open('$scriptname?sid={$surveyid}&amp;action=surveysecurity', '_self')\" value=\"".$clang->gT("Continue")."\"/>\n";
}
}
else
{
include("access_denied.php");
}
$addsummary .= "</div>\n";
}
@@ -1410,57 +1511,48 @@ if($action == "addusergroupsurveysecurity")
$addsummary = "<div class=\"header\">".$clang->gT("Add user group")."</div>\n";
$addsummary .= "<div class=\"messagebox ui-corner-all\" >\n";
$query = "SELECT sid, owner_id FROM ".db_table_name('surveys')." WHERE sid = {$surveyid} AND owner_id = ".$_SESSION['loginID'];
$result = db_execute_assoc($query); //Checked
if( ($result->RecordCount() > 0 && in_array($postusergroupid,getsurveyusergrouplist('simpleugidarray'))) || $_SESSION['USER_RIGHT_SUPERADMIN'] == 1)
{
if($postusergroupid > 0){
$query2 = "SELECT b.uid FROM (SELECT uid FROM ".db_table_name('survey_permissions')." WHERE sid = {$surveyid}) AS c RIGHT JOIN ".db_table_name('user_in_groups')." AS b ON b.uid = c.uid WHERE c.uid IS NULL AND b.ugid = {$postusergroupid}";
$result2 = db_execute_assoc($query2); //Checked
if($result2->RecordCount() > 0)
if($postusergroupid > 0){
$query2 = "SELECT b.uid FROM (SELECT uid FROM ".db_table_name('survey_permissions')." WHERE sid = {$surveyid}) AS c RIGHT JOIN ".db_table_name('user_in_groups')." AS b ON b.uid = c.uid WHERE c.uid IS NULL AND b.ugid = {$postusergroupid}";
$result2 = db_execute_assoc($query2); //Checked
if($result2->RecordCount() > 0)
{
while ($row2 = $result2->FetchRow())
{
while ($row2 = $result2->FetchRow())
{
$uid_arr[] = $row2['uid'];
$isrquery = "INSERT INTO {$dbprefix}survey_permissions (sid,uid,permission,read_p) VALUES ({$surveyid}, {$row2['uid']},'survey',1) ";
$isrresult = $connect->Execute($isrquery); //Checked
if (!$isrresult) break;
}
$uid_arr[] = $row2['uid'];
$isrquery = "INSERT INTO {$dbprefix}survey_permissions (sid,uid,permission,read_p) VALUES ({$surveyid}, {$row2['uid']},'survey',1) ";
$isrresult = $connect->Execute($isrquery); //Checked
if (!$isrresult) break;
}
if($isrresult)
{
$addsummary .= "<div class=\"successheader\">".$clang->gT("User Group added.")."</div>\n";
$_SESSION['uids'] = $uid_arr;
$addsummary .= "<br /><form method='post' action='$scriptname?sid={$surveyid}'>"
if($isrresult)
{
$addsummary .= "<div class=\"successheader\">".$clang->gT("User Group added.")."</div>\n";
$_SESSION['uids'] = $uid_arr;
$addsummary .= "<br /><form method='post' action='$scriptname?sid={$surveyid}'>"
."<input type='submit' value='".$clang->gT("Set Survey Rights")."' />"
."<input type='hidden' name='action' value='setusergroupsurveysecurity' />"
."<input type='hidden' name='ugid' value='{$postusergroupid}' />"
."</form>\n";
}
else
{
// Error while adding user to the database
$addsummary .= "<div class=\"warningheader\">".$clang->gT("Failed to add User Group.")."</div>\n";
$addsummary .= "<br/><input type=\"submit\" onclick=\"window.open('$scriptname?action=surveysecurity&amp;sid={$surveyid}', '_self')\" value=\"".$clang->gT("Continue")."\"/>\n";
}
}
else
{
// no user to add
// Error while adding user to the database
$addsummary .= "<div class=\"warningheader\">".$clang->gT("Failed to add User Group.")."</div>\n";
$addsummary .= "<br/><input type=\"submit\" onclick=\"window.open('$scriptname?action=surveysecurity&amp;sid={$surveyid}', '_self')\" value=\"".$clang->gT("Continue")."\"/>\n";
}
}
else
{
$addsummary .= "<div class=\"warningheader\">".$clang->gT("Failed to add user.")."</div>\n"
. "<br />" . $clang->gT("No Username selected.")."<br />\n";
// no user to add
$addsummary .= "<div class=\"warningheader\">".$clang->gT("Failed to add User Group.")."</div>\n";
$addsummary .= "<br/><input type=\"submit\" onclick=\"window.open('$scriptname?action=surveysecurity&amp;sid={$surveyid}', '_self')\" value=\"".$clang->gT("Continue")."\"/>\n";
}
}
else
{
include("access_denied.php");
$addsummary .= "<div class=\"warningheader\">".$clang->gT("Failed to add user.")."</div>\n"
. "<br />" . $clang->gT("No Username selected.")."<br />\n";
$addsummary .= "<br/><input type=\"submit\" onclick=\"window.open('$scriptname?action=surveysecurity&amp;sid={$surveyid}', '_self')\" value=\"".$clang->gT("Continue")."\"/>\n";
}
$addsummary .= "</div>\n";
}
@@ -1470,57 +1562,40 @@ if($action == "delsurveysecurity")
$addsummary = "<div class=\"header\">".$clang->gT("Deleting User")."</div>\n";
$addsummary .= "<div class=\"messagebox\">\n";
$query = "SELECT sid, owner_id FROM ".db_table_name('surveys')." WHERE sid = {$surveyid} AND owner_id = ".$_SESSION['loginID']." AND owner_id != ".$postuserid;
$result = db_execute_assoc($query); //Checked
if($result->RecordCount() > 0 || $_SESSION['USER_RIGHT_SUPERADMIN'] == 1)
if (isset($postuserid))
{
if (isset($postuserid))
{
$dquery="DELETE FROM".db_table_name('survey_permissions')." WHERE uid={$postuserid} AND sid={$surveyid}"; // added by Dennis
$dresult=$connect->Execute($dquery); //Checked
$dquery="DELETE FROM".db_table_name('survey_permissions')." WHERE uid={$postuserid} AND sid={$surveyid}"; // added by Dennis
$dresult=$connect->Execute($dquery); //Checked
$addsummary .= "<br />".$clang->gT("Username").": ".sanitize_xss_string($_POST['user'])."<br /><br />\n";
$addsummary .= "<div class=\"successheader\">".$clang->gT("Success!")."</div>\n";
}
else
{
$addsummary .= "<div class=\"warningheader\">".$clang->gT("Could not delete user. User was not supplied.")."</div>\n";
}
$addsummary .= "<br/><input type=\"submit\" onclick=\"window.open('$scriptname?sid={$surveyid}&amp;action=surveysecurity', '_self')\" value=\"".$clang->gT("Continue")."\"/>\n";
$addsummary .= "<br />".$clang->gT("Username").": ".sanitize_xss_string($_POST['user'])."<br /><br />\n";
$addsummary .= "<div class=\"successheader\">".$clang->gT("Success!")."</div>\n";
}
else
{
include("access_denied.php");
$addsummary .= "<div class=\"warningheader\">".$clang->gT("Could not delete user. User was not supplied.")."</div>\n";
}
$addsummary .= "<br/><input type=\"submit\" onclick=\"window.open('$scriptname?sid={$surveyid}&amp;action=surveysecurity', '_self')\" value=\"".$clang->gT("Continue")."\"/>\n";
$addsummary .= "</div>\n";
}
if($action == "setsurveysecurity" || $action == "setusergroupsurveysecurity")
{
$query = "SELECT sid, owner_id FROM ".db_table_name('surveys')." WHERE sid = {$surveyid} AND owner_id = ".$_SESSION['loginID'];
$js_admin_includes[]='../scripts/jquery/jquery.tablesorter.min.js';
$js_admin_includes[]='scripts/surveysecurity.js';
if ($action == "setsurveysecurity")
{
$query.= " AND owner_id != ".$postuserid;
$sUsername=$connect->GetOne("select users_name from ".db_table_name('users')." where uid={$postuserid}");
$usersummary = "<div class='header ui-widget-header'>".sprintf($clang->gT("Edit survey permissions for user %s"),"<span style='font-style:italic'>".$sUsername."</span>")."</div>";
}
$result = db_execute_assoc($query); //Checked
if($result->RecordCount() > 0 || $_SESSION['USER_RIGHT_SUPERADMIN'] == 1)
else
{
$js_admin_includes[]='../scripts/jquery/jquery.tablesorter.min.js';
$js_admin_includes[]='scripts/surveysecurity.js';
if ($action == "setsurveysecurity")
{
$sUsername=$connect->GetOne("select users_name from ".db_table_name('users')." where uid={$postuserid}");
$usersummary = "<div class='header ui-widget-header'>".sprintf($clang->gT("Edit survey permissions for user %s"),"<span style='font-style:italic'>".$sUsername."</span>")."</div>";
}
else
{
$sUsergroupName=$connect->GetOne("select name from ".db_table_name('user_groups')." where ugid={$postusergroupid}");
$usersummary = "<div class='header ui-widget-header'>".sprintf($clang->gT("Edit survey permissions for group %s"),"<span style='font-style:italic'>".$sUsergroupName."</span>")."</div>";
}
$usersummary .= "<br /><form action='$scriptname?sid={$surveyid}' method='post'>\n"
$sUsergroupName=$connect->GetOne("select name from ".db_table_name('user_groups')." where ugid={$postusergroupid}");
$usersummary = "<div class='header ui-widget-header'>".sprintf($clang->gT("Edit survey permissions for group %s"),"<span style='font-style:italic'>".$sUsergroupName."</span>")."</div>";
}
$usersummary .= "<br /><form action='$scriptname?sid={$surveyid}' method='post'>\n"
. "<table style='margin:0 auto;' border='0' class='usersurveypermissions'><thead>\n";
$usersummary .= ""
$usersummary .= ""
. "<tr><th></th><th align='center'>".$clang->gT("Permission")."</th>\n"
. "<th align='center'><input type='button' id='btnToggleAdvanced' value='&gt;&gt;' /></th>\n"
. "<th align='center' class='extended'>".$clang->gT("Create")."</th>\n"
@@ -1533,54 +1608,49 @@ if($action == "setsurveysecurity" || $action == "setusergroupsurveysecurity")
//content
$aBasePermissions=aGetBaseSurveyPermissions();
$oddcolumn=false;
foreach($aBasePermissions as $sPermissionKey=>$aCRUDPermissions)
$aBasePermissions=aGetBaseSurveyPermissions();
$oddcolumn=false;
foreach($aBasePermissions as $sPermissionKey=>$aCRUDPermissions)
{
$oddcolumn=!$oddcolumn;
$usersummary .= "<tr><td align='center'><img src='{$imageurl}/{$aCRUDPermissions['img']}_30.png' /></td>";
$usersummary .= "<td align='right'>{$aCRUDPermissions['title']}</td>";
$usersummary .= "<td align='center'><input type=\"checkbox\" class=\"markrow\" name='all_{$sPermissionKey}' /></td>";
foreach ($aCRUDPermissions as $sCRUDKey=>$CRUDValue)
{
$oddcolumn=!$oddcolumn;
$usersummary .= "<tr><td align='center'><img src='{$imageurl}/{$aCRUDPermissions['img']}_30.png' /></td>";
$usersummary .= "<td align='right'>{$aCRUDPermissions['title']}</td>";
$usersummary .= "<td align='center'><input type=\"checkbox\" class=\"markrow\" name='all_{$sPermissionKey}' /></td>";
foreach ($aCRUDPermissions as $sCRUDKey=>$CRUDValue)
if (!in_array($sCRUDKey,array('create','read','update','delete','import','export'))) continue;
$usersummary .= "<td class='extended' align='center'>";
if ($CRUDValue)
{
if (!in_array($sCRUDKey,array('create','read','update','delete','import','export'))) continue;
$usersummary .= "<td class='extended' align='center'>";
if ($CRUDValue)
if (!($sPermissionKey=='survey' && $sCRUDKey=='read'))
{
if (!($sPermissionKey=='survey' && $sCRUDKey=='read'))
{
$usersummary .= "<input type=\"checkbox\" class=\"checkboxbtn\" name='perm_{$sPermissionKey}_{$sCRUDKey}' ";
if($action=='setsurveysecurity' && bHasSurveyPermission( $surveyid,$sPermissionKey,$sCRUDKey,$postuserid)) {
$usersummary .= ' checked="checked" ';
}
$usersummary .=" />";
$usersummary .= "<input type=\"checkbox\" class=\"checkboxbtn\" name='perm_{$sPermissionKey}_{$sCRUDKey}' ";
if($action=='setsurveysecurity' && bHasSurveyPermission( $surveyid,$sPermissionKey,$sCRUDKey,$postuserid)) {
$usersummary .= ' checked="checked" ';
}
$usersummary .=" />";
}
$usersummary .= "</td>";
}
$usersummary .= "</tr>";
$usersummary .= "</td>";
}
$usersummary .= "</tr>";
}
$usersummary .= "\n</table>"
."<p><input type='submit' value='".$clang->gT("Save Now")."' />"
."<input type='hidden' name='perm_survey_read' value='1' />"
."<input type='hidden' name='action' value='surveyrights' />";
$usersummary .= "\n</table>"
."<p><input type='submit' value='".$clang->gT("Save Now")."' />"
."<input type='hidden' name='perm_survey_read' value='1' />"
."<input type='hidden' name='action' value='surveyrights' />";
if ($action=='setsurveysecurity')
{
$usersummary .="<input type='hidden' name='uid' value='{$postuserid}' />";
}
else
{
$usersummary .="<input type='hidden' name='ugid' value='{$postusergroupid}' />";
}
$usersummary .= "</form>\n";
if ($action=='setsurveysecurity')
{
$usersummary .="<input type='hidden' name='uid' value='{$postuserid}' />";
}
else
{
include("access_denied.php");
$usersummary .="<input type='hidden' name='ugid' value='{$postusergroupid}' />";
}
$usersummary .= "</form>\n";
}
// This is the action to export the structure of a complete survey
@@ -1792,18 +1862,24 @@ if($action == "surveysecurity")
$surveysecurity .= "<tr>\n";
$surveysecurity .= "<td>\n";
$surveysecurity .= "<form style='display:inline;' method='post' action='$scriptname?sid={$surveyid}'>"
."<input type='image' src='{$imageurl}/token_edit.png' title='".$clang->gT("Edit permissions")."' />"
."<input type='hidden' name='action' value='setsurveysecurity' />"
."<input type='hidden' name='user' value='{$PermissionRow['users_name']}' />"
."<input type='hidden' name='uid' value='{$PermissionRow['uid']}' />"
."</form>\n";
$surveysecurity .= "<form style='display:inline;' method='post' action='$scriptname?sid={$surveyid}'>"
."<input type='image' src='{$imageurl}/token_delete.png' title='".$clang->gT("Delete")."' onclick='return confirm(\"".$clang->gT("Are you sure you want to delete this entry?","js")."\")' />"
."<input type='hidden' name='action' value='delsurveysecurity' />"
."<input type='hidden' name='user' value='{$PermissionRow['users_name']}' />"
."<input type='hidden' name='uid' value='{$PermissionRow['uid']}' />"
."</form>";
if (bHasSurveyPermission($surveyid, 'surveysecurity', 'update'))
{
$surveysecurity .= "<form style='display:inline;' method='post' action='$scriptname?sid={$surveyid}'>"
."<input type='image' src='{$imageurl}/token_edit.png' title='".$clang->gT("Edit permissions")."' />"
."<input type='hidden' name='action' value='setsurveysecurity' />"
."<input type='hidden' name='user' value='{$PermissionRow['users_name']}' />"
."<input type='hidden' name='uid' value='{$PermissionRow['uid']}' />"
."</form>\n";
}
if (bHasSurveyPermission($surveyid, 'surveysecurity', 'delete'))
{
$surveysecurity .= "<form style='display:inline;' method='post' action='$scriptname?sid={$surveyid}'>"
."<input type='image' src='{$imageurl}/token_delete.png' title='".$clang->gT("Delete")."' onclick='return confirm(\"".$clang->gT("Are you sure you want to delete this entry?","js")."\")' />"
."<input type='hidden' name='action' value='delsurveysecurity' />"
."<input type='hidden' name='user' value='{$PermissionRow['users_name']}' />"
."<input type='hidden' name='uid' value='{$PermissionRow['uid']}' />"
."</form>";
}
$surveysecurity .= "</td>\n";
@@ -1856,21 +1932,24 @@ if($action == "surveysecurity")
$surveysecurity .= "<tr><td colspan='18'></td></tr>"; //fix error on empty table
}
$surveysecurity .= "</tbody>\n"
. "</table>\n"
. "<form class='form44' action='$scriptname?sid={$surveyid}' method='post'><ul>\n"
. "<li><label for='uidselect'>".$clang->gT("User").": </label><select id='uidselect' name='uid'>\n"
. sGetSurveyUserlist(false,false)
. "</select>\n"
. "<input style='width: 15em;' type='submit' value='".$clang->gT("Add User")."' onclick=\"if (document.getElementById('uidselect').value == -1) {alert('".$clang->gT("Please select a user first","js")."'); return false;}\"/>"
. "<input type='hidden' name='action' value='addsurveysecurity' />"
. "</li></ul></form>\n"
. "<form class='form44' action='$scriptname?sid={$surveyid}' method='post'><ul><li>\n"
. "<label for='ugidselect'>".$clang->gT("Groups").": </label><select id='ugidselect' name='ugid'>\n"
. getsurveyusergrouplist()
. "</select>\n"
. "<input style='width: 15em;' type='submit' value='".$clang->gT("Add User Group")."' onclick=\"if (document.getElementById('ugidselect').value == -1) {alert('".$clang->gT("Please select a user group first","js")."'); return false;}\" />"
. "<input type='hidden' name='action' value='addusergroupsurveysecurity' />\n"
. "</li></ul></form>";
. "</table>\n";
if (bHasSurveyPermission($surveyid, 'surveysecurity', 'delete'))
{
$surveysecurity.= "<form class='form44' action='$scriptname?sid={$surveyid}' method='post'><ul>\n"
. "<li><label for='uidselect'>".$clang->gT("User").": </label><select id='uidselect' name='uid'>\n"
. sGetSurveyUserlist(false,false)
. "</select>\n"
. "<input style='width: 15em;' type='submit' value='".$clang->gT("Add User")."' onclick=\"if (document.getElementById('uidselect').value == -1) {alert('".$clang->gT("Please select a user first","js")."'); return false;}\"/>"
. "<input type='hidden' name='action' value='addsurveysecurity' />"
. "</li></ul></form>\n"
. "<form class='form44' action='$scriptname?sid={$surveyid}' method='post'><ul><li>\n"
. "<label for='ugidselect'>".$clang->gT("Groups").": </label><select id='ugidselect' name='ugid'>\n"
. getsurveyusergrouplist()
. "</select>\n"
. "<input style='width: 15em;' type='submit' value='".$clang->gT("Add User Group")."' onclick=\"if (document.getElementById('ugidselect').value == -1) {alert('".$clang->gT("Please select a user group first","js")."'); return false;}\" />"
. "<input type='hidden' name='action' value='addusergroupsurveysecurity' />\n"
. "</li></ul></form>";
}
}
else
@@ -2038,13 +2117,12 @@ function showadminmenu()
. "</strong>\n";
}
$adminmenu .="</div>\n";
/*
//queXS Disable
if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 && isset($updatelastcheck) && $updatelastcheck>0 && isset($updateavailable) && $updateavailable==1)
/* queXS Disable
if($_SESSION['USER_RIGHT_CONFIGURATOR'] == 1 && isset($updatelastcheck) && $updatelastcheck>0 && isset($updateavailable) && $updateavailable==1)
{
$adminmenu .="<div class='menubar-title-right'><a href='{$scriptname}?action=globalsettings'>".sprintf($clang->gT('Update available: %s'),$updateversion."($updatebuild)").'</a></div>';
}
*/
end queXS Disable */
$adminmenu .= "</div>\n"
. "<div class='menubar-main'>\n"
. "<div class='menubar-left'>\n"
@@ -2061,7 +2139,7 @@ function showadminmenu()
$adminmenu .="<a href=\"#\" onclick=\"window.open('{$scriptname}?action=editusergroups', '_self')\" title=\"".$clang->gTview("Create/Edit Groups")."\" >"
."<img src='{$imageurl}/usergroup.png' alt='".$clang->gT("Create/Edit Groups")."' /></a>\n" ;
if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1)
if($_SESSION['USER_RIGHT_CONFIGURATOR'] == 1)
{
$adminmenu .= "<a href=\"#\" onclick=\"window.open('{$scriptname}?action=globalsettings', '_self')\" title=\"".$clang->gTview("Global settings")."\" >"
. "<img src='{$imageurl}/global.png' name='GlobalSettings' alt='". $clang->gT("Global settings")."' /></a>"
@@ -2079,8 +2157,8 @@ function showadminmenu()
."<img src='$imageurl/surveylist.png' name='ListSurveys' alt='".$clang->gT("List Surveys")."' />"
."</a>" ;
// db backup & label editor
if($_SESSION['USER_RIGHT_CONFIGURATOR'] == 1)
// db backup : limit only to SUPERADMIN, else user have all access to whole survey's and user information.
if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1)
{
if ($databasetype=='mysql' || $databasetype=='mysqli')
{
+13 -2
View File
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: html_functions.php 9668 2010-12-21 00:49:44Z c_schmitz $
* $Id: html_functions.php 12211 2012-01-26 17:02:27Z shnoulle $
*/
function browsemenubar($title='')
{
@@ -147,4 +147,15 @@ function browsemenubar($title='')
return $browsemenubar;
}
function getQuestionlistMode(){
global $defaultquestionselectormode;
//TODO : put it on globalsettings $defaultquestionselectormode=getGlobalSetting('defaultquestionselectormode');
if (isset($_SESSION['questionselectormode']) && ($_SESSION['questionselectormode']=='full' || $_SESSION['questionselectormode']=='none'))
{
return $_SESSION['questionselectormode'];
}
else
{
return $defaultquestionselectormode;
}
}
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: htmleditor-functions.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: htmleditor-functions.php 11664 2011-12-16 05:19:42Z tmswhite $
*/
//include_once("login_check.php");
+14 -8
View File
@@ -10,14 +10,15 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: htmleditor-popup.php 10925 2011-09-02 14:12:02Z c_schmitz $
*/
//Ensure script is not run directly, avoid path disclosure
//include_once("login_check.php");
require_once(dirname(__FILE__).'/../classes/core/startup.php');
require_once(dirname(__FILE__).'/../config-defaults.php');
require_once(dirname(__FILE__).'/../common.php');
require_once('login_check.php');
if (!isset($_SESSION['loginID'])) die();
if (!isset($_GET['lang']))
{
@@ -28,6 +29,7 @@ else
$clang = new limesurvey_lang($_GET['lang']);
}
if (!isset($_GET['fieldname']) || !isset($_GET['fieldtext']))
{
$output = '
@@ -45,8 +47,8 @@ if (!isset($_GET['fieldname']) || !isset($_GET['fieldtext']))
LimeSurvey '.$clang->gT("HTML Editor").'
</div>
<hr />
<tr><td align="center"><br /><span style="color:red;"><strong>
<tr><td align="center"><br /><span style="color:red;"><strong>
</strong></span><br />
</table>
<form onsubmit="self.close()">
@@ -57,8 +59,11 @@ if (!isset($_GET['fieldname']) || !isset($_GET['fieldtext']))
</html>';
}
else {
$fieldname=$_GET['fieldname'];
$fieldtext=$_GET['fieldtext'];
require_once("../classes/inputfilter/class.inputfilter_clean.php");
$oFilter = new InputFilter('','',1,1,1);
$fieldname=$oFilter->process($_GET['fieldname']);
$fieldtext=$oFilter->process($_GET['fieldtext']);
if (get_magic_quotes_gpc()) $fieldtext = stripslashes($fieldtext);
$controlidena=$_GET['fieldname'].'_popupctrlena';
$controliddis=$_GET['fieldname'].'_popupctrldis';
@@ -186,4 +191,5 @@ else {
}
echo $output;
?>
// Yes, closing PHP tag was intentionally left out
+18 -18
View File
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: http_importsurvey.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: http_importsurvey.php 11607 2011-12-06 23:19:52Z tmswhite $
*/
// Ensure script is not run directly, avoid path disclosure
@@ -19,7 +19,7 @@ include_once("login_check.php");
// Enable 'Convert resource links and INSERTANS fields?' if selected
if ( (isset($_POST['copysurveytranslinksfields']) && $_POST['copysurveytranslinksfields'] == "on") || (isset($_POST['translinksfields']) && $_POST['translinksfields'] == "on"))
{
$sTransLinks = true;
$sTransLinks = true;
}
// Start the HTML
@@ -40,14 +40,14 @@ $importerror=false; // Put a var for continue
if ($action == 'importsurvey')
{
$the_full_file_path = $tempdir . "/" . $_FILES['the_file']['name'];
$the_full_file_path = $tempdir . "/" . sRandomChars(20).'_'.$_FILES['the_file']['name'];
if (!@move_uploaded_file($_FILES['the_file']['tmp_name'], $the_full_file_path))
{
$importsurvey .= "<div class='errorheader'>".$clang->gT("Error")."</div>\n";
$importsurvey .= sprintf ($clang->gT("An error occurred uploading your file. This may be caused by incorrect permissions in your %s folder."),$tempdir)."<br /><br />\n";
$importsurvey .= "<input type='submit' value='".$clang->gT("Main Admin Screen")."' onclick=\"window.open('$scriptname', '_self')\"><br /><br />\n";
$importerror=true;
}
}
else
{
$importsurvey .= "<div class='successheader'>".$clang->gT("Success")."</div>&nbsp;<br />\n";
@@ -145,13 +145,13 @@ if (!$importerror)
$importsurvey .= "<br />\n<div class='successheader'>".$clang->gT("Success")."</div><br /><br />\n";
if ($action == 'importsurvey')
{
$importsurvey .= "<strong>".$clang->gT("Survey copy summary")."</strong><br />\n";
$importsurvey .= "<strong>".$clang->gT("Survey copy summary")."</strong><br />\n";
}
elseif($action == 'copysurvey')
{
$importsurvey .= "<strong>".$clang->gT("Survey import summary")."</strong><br />\n";
$importsurvey .= "<strong>".$clang->gT("Survey import summary")."</strong><br />\n";
}
$importsurvey .= "<ul style=\"text-align:left;\">\n\t<li>".$clang->gT("Surveys").": {$aImportResults['surveys']}</li>\n";
$importsurvey .= "\t<li>".$clang->gT("Languages").": {$aImportResults['languages']}</li>\n";
$importsurvey .= "\t<li>".$clang->gT("Question groups").": {$aImportResults['groups']}</li>\n";
@@ -159,15 +159,15 @@ if (!$importerror)
$importsurvey .= "\t<li>".$clang->gT("Answers").": {$aImportResults['answers']}</li>\n";
if (isset($aImportResults['subquestions']))
{
$importsurvey .= "\t<li>".$clang->gT("Subquestions").": {$aImportResults['subquestions']}</li>\n";
$importsurvey .= "\t<li>".$clang->gT("Subquestions").": {$aImportResults['subquestions']}</li>\n";
}
if (isset($aImportResults['defaultvalues']))
{
$importsurvey .= "\t<li>".$clang->gT("Default answers").": {$aImportResults['defaultvalues']}</li>\n";
$importsurvey .= "\t<li>".$clang->gT("Default answers").": {$aImportResults['defaultvalues']}</li>\n";
}
if (isset($aImportResults['conditions']))
{
$importsurvey .= "\t<li>".$clang->gT("Conditions").": {$aImportResults['conditions']}</li>\n";
$importsurvey .= "\t<li>".$clang->gT("Conditions").": {$aImportResults['conditions']}</li>\n";
}
if (isset($aImportResults['labelsets']))
{
@@ -180,8 +180,8 @@ if (!$importerror)
$importsurvey .= "\t<li>".$clang->gT("Question attributes").": {$aImportResults['question_attributes']}</li>\n";
$importsurvey .= "\t<li>".$clang->gT("Assessments").": {$aImportResults['assessments']}</li>\n";
$importsurvey .= "\t<li>".$clang->gT("Quotas").": {$aImportResults['quota']} ({$aImportResults['quotamembers']} ".$clang->gT("quota members")." ".$clang->gT("and")." {$aImportResults['quotals']} ".$clang->gT("quota language settings").")</li>\n</ul><br />\n";
if (count($aImportResults['importwarnings'])>0)
if (count($aImportResults['importwarnings'])>0)
{
$importsurvey .= "<div class='warningheader'>".$clang->gT("Warnings").":</div><ul style=\"text-align:left;\">";
foreach ($aImportResults['importwarnings'] as $warning)
@@ -190,23 +190,23 @@ if (!$importerror)
}
$importsurvey .= "</ul><br />\n";
}
if ($action == 'importsurvey')
{
$importsurvey .= "<strong>".$clang->gT("Import of Survey is completed.")."</strong><br />\n"
. "<a href='$scriptname?sid={$aImportResults['newsid']}'>".$clang->gT("Go to survey")."</a><br />\n";
. "<a href='$scriptname?sid={$aImportResults['newsid']}'>".$clang->gT("Go to survey")."</a><br />\n";
}
elseif($action == 'copysurvey')
{
$importsurvey .= "<strong>".$clang->gT("Copy of survey is completed.")."</strong><br />\n"
. "<a href='$scriptname?sid={$aImportResults['newsid']}'>".$clang->gT("Go to survey")."</a><br />\n";
}
. "<a href='$scriptname?sid={$aImportResults['newsid']}'>".$clang->gT("Go to survey")."</a><br />\n";
}
if ($action == 'importsurvey')
{
unlink($sFullFilepath);
unlink($sFullFilepath);
}
}
// end of traitment an close message box
$importsurvey .= "</div><br />\n";
+11 -3
View File
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: import_functions.php 9586 2010-12-06 03:08:07Z c_schmitz $
* $Id: import_functions.php 11664 2011-12-16 05:19:42Z tmswhite $
* Files Purpose:
*/
@@ -1061,6 +1061,9 @@ function CSVImportSurvey($sFullFilepath,$iDesiredSurveyId=NULL)
}
}
LimeExpressionManager::RevertUpgradeConditionsToRelevance($newsid);
LimeExpressionManager::UpgradeConditionsToRelevance($newsid);
$importresults['importversion']=$importversion;
$importresults['newsid']=$newsid;
$importresults['oldsid']=$oldsid;
@@ -1078,6 +1081,7 @@ function XMLImportSurvey($sFullFilepath,$sXMLdata=NULL,$sNewSurveyName=NULL,$iDe
{
global $connect, $dbprefix, $clang, $timeadjust;
$iDesiredSurveyId=intval($iDesiredSurveyId);
$results['error']=false;
if ($sXMLdata == NULL)
{
@@ -1098,7 +1102,7 @@ function XMLImportSurvey($sFullFilepath,$sXMLdata=NULL,$sNewSurveyName=NULL,$iDe
//echo $clang->gT("This is VALID LimeSurvey survey structure XML file.");
//return $results;
}
$dbversion = (int) $xml->DBVersion;
$dbversion = (float) $xml->DBVersion;
$aQIDReplacements=array();
$aQuotaReplacements=array();
$results['defaultvalues']=0;
@@ -1468,7 +1472,7 @@ function XMLImportSurvey($sFullFilepath,$sXMLdata=NULL,$sNewSurveyName=NULL,$iDe
}
}
// now translate any links
@@ -1578,6 +1582,10 @@ function XMLImportSurvey($sFullFilepath,$sXMLdata=NULL,$sNewSurveyName=NULL,$iDe
TranslateInsertansTags($newsid,$oldsid,$aOldNewFieldmap);
}
LimeExpressionManager::RevertUpgradeConditionsToRelevance($newsid);
LimeExpressionManager::UpgradeConditionsToRelevance($newsid);
LimeExpressionManager::SetSurveyId($newsid);
return $results;
}
File diff suppressed because it is too large Load Diff
+143 -128
View File
@@ -10,10 +10,10 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: importgroup.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: importgroup.php 11664 2011-12-16 05:19:42Z tmswhite $
*/
//Ensure script is not run directly, avoid path disclosure
//Ensure script is not run directly, avoid path disclosure
include_once("login_check.php");
$importgroup = "<div class='header ui-widget-header'>".$clang->gT("Import question group")."</div>\n";
@@ -96,13 +96,13 @@ unlink($sFullFilepath);
/**
* This function imports an old-school question group file (*.csv,*.sql)
*
*
* @param mixed $sFullFilepath Full file patch to the import file
* @param mixed $newsid Survey ID to which the question is attached
*/
function CSVImportGroup($sFullFilepath, $newsid)
function CSVImportGroup($sFullFilepath, $newsid)
{
global $dbprefix, $connect, $clang;
global $dbprefix, $connect, $clang;
$aLIDReplacements=array();
$aQIDReplacements = array(); // this array will have the "new qid" for the questions, the key will be the "old qid"
$aGIDReplacements = array();
@@ -117,7 +117,7 @@ function CSVImportGroup($sFullFilepath, $newsid)
if (substr($bigarray[0], 0, 23) != "# LimeSurvey Group Dump")
{
$results['fatalerror'] = $clang->gT("This file is not a LimeSurvey question file. Import failed.");
$importversion=0;
$importversion=0;
}
else
{
@@ -128,7 +128,7 @@ function CSVImportGroup($sFullFilepath, $newsid)
{
$results['fatalerror'] = $clang->gT("This file is too old. Only files from LimeSurvey version 1.50 (DBVersion 112) and newer are supported.");
}
for ($i=0; $i<9; $i++) //skipping the first lines that are not needed
{
unset($bigarray[$i]);
@@ -337,7 +337,7 @@ function CSVImportGroup($sFullFilepath, $newsid)
return $results;
}
}
if (count($labelsetsarray) > 1)
@@ -422,7 +422,7 @@ function CSVImportGroup($sFullFilepath, $newsid)
$query2 = "SELECT code, title, sortorder, language, assessment_value
FROM {$dbprefix}labels
WHERE lid=".$newlid."
ORDER BY language, sortorder, code";
ORDER BY language, sortorder, code";
$result2 = db_execute_num($query2) or safe_die("Died querying labelset $lid<br />$query2<br />".$connect->ErrorMsg());
while($row2=$result2->FetchRow())
{
@@ -527,7 +527,7 @@ function CSVImportGroup($sFullFilepath, $newsid)
// GROUPS is DONE
// Import questions
if (isset($questionarray) && $questionarray)
if (isset($questionarray) && $questionarray)
{
foreach ($questionarray as $qa)
{
@@ -578,9 +578,9 @@ function CSVImportGroup($sFullFilepath, $newsid)
elseif ($questionrowdata['type']=='Z')
{
$questionrowdata['type']='L';
}
}
if (!isset($questionrowdata["question_order"]) || $questionrowdata["question_order"]=='') {$questionrowdata["question_order"]=0;}
if (!isset($questionrowdata["question_order"]) || $questionrowdata["question_order"]=='') {$questionrowdata["question_order"]=0;}
$questionrowdata=array_map('convertCsvreturn2return', $questionrowdata);
@@ -591,7 +591,7 @@ function CSVImportGroup($sFullFilepath, $newsid)
$newvalues=array_values($questionrowdata);
$newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly
if (isset($questionrowdata['qid']))
{
db_switchIDInsert('questions',true);
@@ -606,17 +606,17 @@ function CSVImportGroup($sFullFilepath, $newsid)
//GET NEW QID .... if is not done before and we count a question if a new qid is required
if (isset($questionrowdata['qid']))
{
$saveqid=$questionrowdata['qid'];
$saveqid=$questionrowdata['qid'];
}
else
{
$aQIDReplacements[$oldqid]=$connect->Insert_ID("{$dbprefix}questions",'qid');
$saveqid=$aQIDReplacements[$oldqid];
}
$qtypes = getqtypelist("" ,"array");
$qtypes = getqtypelist("" ,"array");
$aSQIDReplacements=array();
db_switchIDInsert('questions',false);
db_switchIDInsert('questions',false);
// Now we will fix up old label sets where they are used as answers
if ((isset($oldlid1) || isset($oldlid2)) && ($qtypes[$questionrowdata['type']]['answerscales']>0 || $qtypes[$questionrowdata['type']]['subquestions']>1))
{
@@ -626,11 +626,11 @@ function CSVImportGroup($sFullFilepath, $newsid)
{
if (in_array($labelrow['language'],$aLanguagesSupported))
{
if ($qtypes[$questionrowdata['type']]['subquestions']<2)
{
$qinsert = "insert INTO ".db_table_name('answers')." (qid,code,answer,sortorder,language,assessment_value)
VALUES ({$aQIDReplacements[$oldqid]},".db_quoteall($labelrow['code']).",".db_quoteall($labelrow['title']).",".db_quoteall($labelrow['sortorder']).",".db_quoteall($labelrow['language']).",".db_quoteall($labelrow['assessment_value']).")";
VALUES ({$aQIDReplacements[$oldqid]},".db_quoteall($labelrow['code']).",".db_quoteall($labelrow['title']).",".db_quoteall($labelrow['sortorder']).",".db_quoteall($labelrow['language']).",".db_quoteall($labelrow['assessment_value']).")";
$qres = $connect->Execute($qinsert) or safe_die ($clang->gT("Error").": Failed to insert answer (lid1) <br />\n$qinsert<br />\n".$connect->ErrorMsg());
}
else
@@ -638,19 +638,19 @@ function CSVImportGroup($sFullFilepath, $newsid)
if (isset($aSQIDReplacements[$labelrow['code'].'_'.$saveqid])){
$fieldname='qid,';
$data=$aSQIDReplacements[$labelrow['code'].'_'.$saveqid].',';
}
}
else
{
$fieldname='' ;
$data='';
}
$qinsert = "insert INTO ".db_table_name('questions')." ($fieldname parent_qid,title,question,question_order,language,scale_id,type, sid, gid)
VALUES ($data{$aQIDReplacements[$oldqid]},".db_quoteall($labelrow['code']).",".db_quoteall($labelrow['title']).",".db_quoteall($labelrow['sortorder']).",".db_quoteall($labelrow['language']).",1,'{$questionrowdata['type']}',{$questionrowdata['sid']},{$questionrowdata['gid']})";
VALUES ($data{$aQIDReplacements[$oldqid]},".db_quoteall($labelrow['code']).",".db_quoteall($labelrow['title']).",".db_quoteall($labelrow['sortorder']).",".db_quoteall($labelrow['language']).",1,'{$questionrowdata['type']}',{$questionrowdata['sid']},{$questionrowdata['gid']})";
$qres = $connect->Execute($qinsert) or safe_die ($clang->gT("Error").": Failed to insert question <br />\n$qinsert<br />\n".$connect->ErrorMsg());
if ($fieldname=='')
{
$aSQIDReplacements[$labelrow['code'].'_'.$saveqid]=$connect->Insert_ID("{$dbprefix}questions","qid");
$aSQIDReplacements[$labelrow['code'].'_'.$saveqid]=$connect->Insert_ID("{$dbprefix}questions","qid");
}
}
}
@@ -662,12 +662,12 @@ function CSVImportGroup($sFullFilepath, $newsid)
while($labelrow=$oldlabelsresult->FetchRow())
{
$qinsert = "insert INTO ".db_table_name('answers')." (qid,code,answer,sortorder,language,assessment_value,scale_id)
VALUES ({$aQIDReplacements[$oldqid]},".db_quoteall($labelrow['code']).",".db_quoteall($labelrow['title']).",".db_quoteall($labelrow['sortorder']).",".db_quoteall($labelrow['language']).",".db_quoteall($labelrow['assessment_value']).",1)";
VALUES ({$aQIDReplacements[$oldqid]},".db_quoteall($labelrow['code']).",".db_quoteall($labelrow['title']).",".db_quoteall($labelrow['sortorder']).",".db_quoteall($labelrow['language']).",".db_quoteall($labelrow['assessment_value']).",1)";
$qres = $connect->Execute($qinsert) or safe_die ($clang->gT("Error").": Failed to insert answer (lid2)<br />\n$qinsert<br />\n".$connect->ErrorMsg());
}
}
}
}
}
}
//Do answers
@@ -701,12 +701,12 @@ function CSVImportGroup($sFullFilepath, $newsid)
$oldquestion['newtype']=$questiontemp['type'];
$oldquestion['gid']=$questiontemp['gid'];
if ($answerrowdata['default_value']=='Y' && ($oldquestion['newtype']=='L' || $oldquestion['newtype']=='O' || $oldquestion['newtype']=='!'))
{
$insertdata=array();
{
$insertdata=array();
$insertdata['qid']=$newqid;
$insertdata['language']=$answerrowdata['language'];
$insertdata['defaultvalue']=$answerrowdata['answer'];
$query=$connect->GetInsertSQL($dbprefix.'defaultvalues',$insertdata);
$insertdata['defaultvalue']=$answerrowdata['answer'];
$query=$connect->GetInsertSQL($dbprefix.'defaultvalues',$insertdata);
$qres = $connect->Execute($query) or safe_die ("Error: Failed to insert defaultvalue <br />{$query}<br />\n".$connect->ErrorMsg());
}
@@ -720,52 +720,52 @@ function CSVImportGroup($sFullFilepath, $newsid)
$questionrowdata=array();
if (isset($aSQIDReplacements[$answerrowdata['code'].$answerrowdata['qid']])){
$questionrowdata['qid']=$aSQIDReplacements[$answerrowdata['code'].$answerrowdata['qid']];
}
}
$questionrowdata['parent_qid']=$answerrowdata['qid'];;
$questionrowdata['sid']=$newsid;
$questionrowdata['gid']=$oldquestion['gid'];
$questionrowdata['gid']=$oldquestion['gid'];
$questionrowdata['title']=$answerrowdata['code'];
$questionrowdata['question']=$answerrowdata['answer'];
$questionrowdata['question_order']=$answerrowdata['sortorder'];
$questionrowdata['language']=$answerrowdata['language'];
$questionrowdata['type']=$oldquestion['newtype'];
$tablename=$dbprefix.'questions';
$query=$connect->GetInsertSQL($tablename,$questionrowdata);
$tablename=$dbprefix.'questions';
$query=$connect->GetInsertSQL($tablename,$questionrowdata);
if (isset($questionrowdata['qid'])) db_switchIDInsert('questions',true);
$qres = $connect->Execute($query) or safe_die ("Error: Failed to insert subquestion <br />{$query}<br />".$connect->ErrorMsg());
if (!isset($questionrowdata['qid']))
{
$aSQIDReplacements[$answerrowdata['code'].$answerrowdata['qid']]=$connect->Insert_ID("{$dbprefix}questions","qid");
$aSQIDReplacements[$answerrowdata['code'].$answerrowdata['qid']]=$connect->Insert_ID("{$dbprefix}questions","qid");
}
else
{
db_switchIDInsert('questions',false);
db_switchIDInsert('questions',false);
}
$results['subquestions']++;
// also convert default values subquestions for multiple choice
if ($answerrowdata['default_value']=='Y' && ($oldquestion['newtype']=='M' || $oldquestion['newtype']=='P'))
{
$insertdata=array();
{
$insertdata=array();
$insertdata['qid']=$newqid;
$insertdata['sqid']=$aSQIDReplacements[$answerrowdata['code']];
$insertdata['language']=$answerrowdata['language'];
$insertdata['defaultvalue']='Y';
$tablename=$dbprefix.'defaultvalues';
$query=$connect->GetInsertSQL($tablename,$insertdata);
$tablename=$dbprefix.'defaultvalues';
$query=$connect->GetInsertSQL($tablename,$insertdata);
$qres = $connect->Execute($query) or safe_die ("Error: Failed to insert defaultvalue <br />{$query}<br />\n".$connect->ErrorMsg());
}
}
else // insert answers
{
unset($answerrowdata['default_value']);
$tablename=$dbprefix.'answers';
$query=$connect->GetInsertSQL($tablename,$answerrowdata);
$tablename=$dbprefix.'answers';
$query=$connect->GetInsertSQL($tablename,$answerrowdata);
$ares = $connect->Execute($query) or safe_die ("Error: Failed to insert answer<br />{$query}<br />\n".$connect->ErrorMsg());
$results['answers']++;
}
$results['answers']++;
}
}
}
// ANSWERS is DONE
@@ -784,7 +784,7 @@ function CSVImportGroup($sFullFilepath, $newsid)
$results['question_attributes']=0;
// Finally the question attributes - it is called just once and only if there was a question
if (isset($question_attributesarray) && $question_attributesarray)
if (isset($question_attributesarray) && $question_attributesarray)
{//ONLY DO THIS IF THERE ARE QUESTION_ATTRIBUES
$fieldorders=convertCSVRowToArray($question_attributesarray[0],',','"');
unset($question_attributesarray[0]);
@@ -863,17 +863,20 @@ function CSVImportGroup($sFullFilepath, $newsid)
$results['conditions']++;
}
}
LimeExpressionManager::RevertUpgradeConditionsToRelevance($newsid);
LimeExpressionManager::UpgradeConditionsToRelevance($newsid);
$results['groups']=1;
$results['newgid']=$newgid;
return $results;
return $results;
}
/**
* This function imports a LimeSurvey .lsg question group XML file
*
*
* @param mixed $sFullFilepath The full filepath of the uploaded file
* @param mixed $newsid The new survey id - the group will always be added after the last group in the survey
* @param mixed $newsid The new survey id - the group will always be added after the last group in the survey
*/
function XMLImportGroup($sFullFilepath, $newsid)
{
@@ -883,28 +886,28 @@ function XMLImportGroup($sFullFilepath, $newsid)
$sBaseLanguage = GetBaseLanguageFromSurveyID($newsid);
$aLanguagesSupported[]=$sBaseLanguage; // adds the base language to the list of supported languages
$aLanguagesSupported=array_merge($aLanguagesSupported,GetAdditionalLanguagesFromSurveyID($newsid));
$xml = @simplexml_load_file($sFullFilepath);
$xml = @simplexml_load_file($sFullFilepath);
if ($xml==false || $xml->LimeSurveyDocType!='Group') safe_die('This is not a valid LimeSurvey group structure XML file.');
$dbversion = (int) $xml->DBVersion;
$aQIDReplacements=array();
$dbversion = (float) $xml->DBVersion;
$aQIDReplacements=array();
$results['defaultvalues']=0;
$results['answers']=0;
$results['question_attributes']=0;
$results['subquestions']=0;
$results['conditions']=0;
$results['groups']=0;
$importlanguages=array();
foreach ($xml->languages->language as $language)
{
$importlanguages[]=(string)$language;
}
}
if (!in_array($sBaseLanguage,$importlanguages))
{
$results['fatalerror'] = $clang->gT("The languages of the imported group file must at least include the base language of this survey.");
return;
return $results;
}
// First get an overview of fieldnames - it's not useful for the moment but might be with newer versions
/*
@@ -913,14 +916,14 @@ function XMLImportGroup($sFullFilepath, $newsid)
{
$fieldnames[]=(string)$fieldname;
};*/
// Import group table ===================================================================================
$tablename=$dbprefix.'groups';
$newgrouporder=$connect->GetOne("SELECT MAX(group_order) AS maxqo FROM ".db_table_name('groups')." WHERE sid=$newsid");
if (is_null($newgrouporder))
if (is_null($newgrouporder))
{
$newgrouporder=0;
}
@@ -929,7 +932,7 @@ function XMLImportGroup($sFullFilepath, $newsid)
}
foreach ($xml->groups->rows->row as $row)
{
$insertdata=array();
$insertdata=array();
foreach ($row as $key=>$value)
{
$insertdata[(string)$key]=(string)$value;
@@ -942,16 +945,16 @@ function XMLImportGroup($sFullFilepath, $newsid)
// now translate any links
$insertdata['group_name']=translink('survey', $oldsid, $newsid, $insertdata['group_name']);
$insertdata['description']=translink('survey', $oldsid, $newsid, $insertdata['description']);
// Insert the new question
// Insert the new question
if (isset($aGIDReplacements[$oldgid]))
{
$insertdata['gid']=$aGIDReplacements[$oldgid];
$insertdata['gid']=$aGIDReplacements[$oldgid];
db_switchIDInsert('groups',true);
}
$query=$connect->GetInsertSQL($tablename,$insertdata);
}
$query=$connect->GetInsertSQL($tablename,$insertdata);
$result = $connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data<br />{$query}<br />\n".$connect->ErrorMsg());
$results['groups']++;
if (!isset($aGIDReplacements[$oldgid]))
{
$newgid=$connect->Insert_ID($tablename,"gid"); // save this for later
@@ -962,58 +965,61 @@ function XMLImportGroup($sFullFilepath, $newsid)
db_switchIDInsert('groups',false);
}
}
// Import questions table ===================================================================================
// We have to run the question table data two times - first to find all main questions
// then for subquestions (because we need to determine the new qids for the main questions first)
$tablename=$dbprefix.'questions';
$results['questions']=0;
foreach ($xml->questions->rows->row as $row)
if (isset($xml->questions))
{
$insertdata=array();
foreach ($row as $key=>$value)
foreach ($xml->questions->rows->row as $row)
{
$insertdata[(string)$key]=(string)$value;
}
$oldsid=$insertdata['sid'];
$insertdata['sid']=$newsid;
if (!isset($aGIDReplacements[$insertdata['gid']]) || trim($insertdata['title'])=='') continue; // Skip questions with invalid group id
$insertdata['gid']=$aGIDReplacements[$insertdata['gid']];
$oldqid=$insertdata['qid']; unset($insertdata['qid']); // save the old qid
$insertdata=array();
foreach ($row as $key=>$value)
{
$insertdata[(string)$key]=(string)$value;
}
$oldsid=$insertdata['sid'];
$insertdata['sid']=$newsid;
if (!isset($aGIDReplacements[$insertdata['gid']]) || trim($insertdata['title'])=='') continue; // Skip questions with invalid group id
$insertdata['gid']=$aGIDReplacements[$insertdata['gid']];
$oldqid=$insertdata['qid']; unset($insertdata['qid']); // save the old qid
// now translate any links
$insertdata['title']=translink('survey', $oldsid, $newsid, $insertdata['title']);
$insertdata['question']=translink('survey', $oldsid, $newsid, $insertdata['question']);
$insertdata['help']=translink('survey', $oldsid, $newsid, $insertdata['help']);
// Insert the new question
if (isset($aQIDReplacements[$oldqid]))
{
$insertdata['qid']=$aQIDReplacements[$oldqid];
db_switchIDInsert('questions',true);
}
$query=$connect->GetInsertSQL($tablename,$insertdata);
$result = $connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data<br />{$query}<br />\n".$connect->ErrorMsg());
if (!isset($aQIDReplacements[$oldqid]))
{
$newqid=$connect->Insert_ID($tablename,"qid"); // save this for later
$aQIDReplacements[$oldqid]=$newqid; // add old and new qid to the mapping array
$results['questions']++;
}
else
{
db_switchIDInsert('questions',false);
// now translate any links
$insertdata['title']=translink('survey', $oldsid, $newsid, $insertdata['title']);
$insertdata['question']=translink('survey', $oldsid, $newsid, $insertdata['question']);
$insertdata['help']=translink('survey', $oldsid, $newsid, $insertdata['help']);
// Insert the new question
if (isset($aQIDReplacements[$oldqid]))
{
$insertdata['qid']=$aQIDReplacements[$oldqid];
db_switchIDInsert('questions',true);
}
$query=$connect->GetInsertSQL($tablename,$insertdata);
$result = $connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data<br />{$query}<br />\n".$connect->ErrorMsg());
if (!isset($aQIDReplacements[$oldqid]))
{
$newqid=$connect->Insert_ID($tablename,"qid"); // save this for later
$aQIDReplacements[$oldqid]=$newqid; // add old and new qid to the mapping array
$results['questions']++;
}
else
{
db_switchIDInsert('questions',false);
}
}
}
// Import subquestions --------------------------------------------------------------
if (isset($xml->subquestions))
{
foreach ($xml->subquestions->rows->row as $row)
{
$insertdata=array();
$insertdata=array();
foreach ($row as $key=>$value)
{
$insertdata[(string)$key]=(string)$value;
@@ -1028,18 +1034,18 @@ function XMLImportGroup($sFullFilepath, $newsid)
// now translate any links
$insertdata['title']=translink('survey', $oldsid, $newsid, $insertdata['title']);
$insertdata['question']=translink('survey', $oldsid, $newsid, $insertdata['question']);
$insertdata['help']=translink('survey', $oldsid, $newsid, $insertdata['help']);
$insertdata['help']=(isset($insertdata['help']) ? translink('survey', $oldsid, $newsid, $insertdata['help']) : '');
if (isset($aQIDReplacements[$oldsqid])){
$insertdata['qid']=$aQIDReplacements[$oldsqid];
db_switchIDInsert('questions',true);
}
$query=$connect->GetInsertSQL($tablename,$insertdata);
$query=$connect->GetInsertSQL($tablename,$insertdata);
$result = $connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data<br />{$query}<br />\n".$connect->ErrorMsg());
$newsqid=$connect->Insert_ID($tablename,"qid"); // save this for later
if (!isset($insertdata['qid']))
{
$aQIDReplacements[$oldsqid]=$newsqid; // add old and new qid to the mapping array
$aQIDReplacements[$oldsqid]=$newsqid; // add old and new qid to the mapping array
}
else
{
@@ -1054,33 +1060,33 @@ function XMLImportGroup($sFullFilepath, $newsid)
if(isset($xml->answers))
{
$tablename=$dbprefix.'answers';
foreach ($xml->answers->rows->row as $row)
{
$insertdata=array();
$insertdata=array();
foreach ($row as $key=>$value)
{
$insertdata[(string)$key]=(string)$value;
}
if (!isset($aQIDReplacements[(int)$insertdata['qid']])) continue; // Skip questions with invalid group id
$insertdata['qid']=$aQIDReplacements[(int)$insertdata['qid']]; // remap the parent_qid
// now translate any links
$query=$connect->GetInsertSQL($tablename,$insertdata);
$query=$connect->GetInsertSQL($tablename,$insertdata);
$result=$connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data<br />{$query}<br />\n".$connect->ErrorMsg());
$results['answers']++;
}
}
}
// Import questionattributes --------------------------------------------------------------
if(isset($xml->question_attributes))
{
$tablename=$dbprefix.'question_attributes';
foreach ($xml->question_attributes->rows->row as $row)
{
$insertdata=array();
$insertdata=array();
foreach ($row as $key=>$value)
{
$insertdata[(string)$key]=(string)$value;
@@ -1090,44 +1096,51 @@ function XMLImportGroup($sFullFilepath, $newsid)
$insertdata['qid']=$aQIDReplacements[(int)$insertdata['qid']]; // remap the parent_qid
// now translate any links
$query=$connect->GetInsertSQL($tablename,$insertdata);
$query=$connect->GetInsertSQL($tablename,$insertdata);
$result=$connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data<br />{$query}<br />\n".$connect->ErrorMsg());
$results['question_attributes']++;
}
}
}
// Import defaultvalues --------------------------------------------------------------
if(isset($xml->defaultvalues))
{
$tablename=$dbprefix.'defaultvalues';
$results['defaultvalues']=0;
foreach ($xml->defaultvalues->rows->row as $row)
{
$insertdata=array();
$insertdata=array();
foreach ($row as $key=>$value)
{
$insertdata[(string)$key]=(string)$value;
}
$insertdata['qid']=$aQIDReplacements[(int)$insertdata['qid']]; // remap the qid
$insertdata['sqid']=$aQIDReplacements[(int)$insertdata['sqid']]; // remap the subqeustion id
if (!isset($aQIDReplacements[(int)$insertdata['sqid']]) || is_null($aQIDReplacements[(int)$insertdata['sqid']]))
{
$insertdata['sqid'] = 0; // defaults for non-array types
}
else
{
$insertdata['sqid']=$aQIDReplacements[(int)$insertdata['sqid']]; // remap the subqeustion id
}
// now translate any links
$query=$connect->GetInsertSQL($tablename,$insertdata);
$result=$connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data<br />\$query<br />\n".$connect->ErrorMsg());
$query=$connect->GetInsertSQL($tablename,$insertdata);
$result=$connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data<br />". $query. "<br />\n".$connect->ErrorMsg());
$results['defaultvalues']++;
}
}
}
// Import conditions --------------------------------------------------------------
if(isset($xml->conditions))
{
$tablename=$dbprefix.'conditions';
foreach ($xml->conditions->rows->row as $row)
{
$insertdata=array();
$insertdata=array();
foreach ($row as $key=>$value)
{
$insertdata[(string)$key]=(string)$value;
@@ -1165,16 +1178,18 @@ function XMLImportGroup($sFullFilepath, $newsid)
if (trim($insertdata["method"])=='')
{
$insertdata["method"]='==';
}
}
// now translate any links
$query=$connect->GetInsertSQL($tablename,$insertdata);
$query=$connect->GetInsertSQL($tablename,$insertdata);
$result=$connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data<br />\$query<br />\n".$connect->ErrorMsg());
$results['conditions']++;
}
}
}
LimeExpressionManager::RevertUpgradeConditionsToRelevance($newsid);
LimeExpressionManager::UpgradeConditionsToRelevance($newsid);
$results['newgid']=$newgid;
$results['labelsets']=0;
$results['labels']=0;
+50 -49
View File
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: importlabel.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: importlabel.php 11607 2011-12-06 23:19:52Z tmswhite $
*/
//Ensure script is not run directly, avoid path disclosure
@@ -57,39 +57,38 @@ elseif (strtolower($sExtension)=='lsl')
$importlabeloutput .= "<input type='submit' value='".$clang->gT("Return to label set administration")."' onclick=\"window.open('$scriptname?action=labels', '_self')\" />\n";
$importlabeloutput .= "</div><br />\n";
}
unlink($sFullFilepath);
unlink($sFullFilepath);
if (isset($aImportResults))
{
if (count($aImportResults['warnings'])>0)
{
$importlabeloutput .= "<br />\n<div class='warningheader'>".$clang->gT("Warnings")."</div><ul>\n";
foreach ($aImportResults['warnings'] as $warning)
if (isset($aImportResults['fatalerror']))
{
$importlabeloutput .= '<li>'.$warning.'</li>';
}
$importlabeloutput .= "</ul>\n";
$importlabeloutput .= "<br />\n<div class='warningheader'>".$clang->gT("Error")."</div>
<p>{$aImportResults['fatalerror']}<br>";
}
else
{
if (count($aImportResults['warnings'])>0)
{
$importlabeloutput .= "<br />\n<div class='warningheader'>".$clang->gT("Warnings")."</div><ul>\n";
foreach ($aImportResults['warnings'] as $warning)
{
$importlabeloutput .= '<li>'.$warning.'</li>';
}
$importlabeloutput .= "</ul>\n";
}
$importlabeloutput .= "<br />\n<div class='successheader'>".$clang->gT("Success")."</div><br />\n";
$importlabeloutput .= "<strong><u>".$clang->gT("Label set import summary")."</u></strong><br />\n";
$importlabeloutput .= "<ul style=\"text-align:left;\">\n\t<li>".$clang->gT("Label sets").": {$aImportResults['labelsets']}</li>\n";
$importlabeloutput .= "\t<li>".$clang->gT("Labels").": {$aImportResults['labels']}</li></ul>\n";
$importlabeloutput .= "<p><strong>".$clang->gT("Import of label set(s) is completed.")."</strong><br /><br />\n";
}
$importlabeloutput .= "<input type='submit' value='".$clang->gT("Return to label set administration")."' onclick=\"window.open('$scriptname?action=labels', '_self')\" />\n";
$importlabeloutput .= "</p></div><br />\n";
}
$importlabeloutput .= "<br />\n<div class='successheader'>".$clang->gT("Success")."</div><br />\n";
$importlabeloutput .= "<strong><u>".$clang->gT("Label set import summary")."</u></strong><br />\n";
$importlabeloutput .= "<ul style=\"text-align:left;\">\n\t<li>".$clang->gT("Label sets").": {$aImportResults['labelsets']}</li>\n";
$importlabeloutput .= "\t<li>".$clang->gT("Labels").": {$aImportResults['labels']}</li></ul>\n";
$importlabeloutput .= "<p><strong>".$clang->gT("Import of label set(s) is completed.")."</strong><br /><br />\n";
$importlabeloutput .= "<input type='submit' value='".$clang->gT("Return to label set administration")."' onclick=\"window.open('$scriptname?action=labels', '_self')\" />\n";
$importlabeloutput .= "</div><br />\n";
}
$importlabeloutput .= "<br />\n<div class='successheader'>".$clang->gT("Success")."</div><br />\n";
$importlabeloutput .= "<strong><u>".$clang->gT("Label set import summary")."</u></strong><br />\n";
$importlabeloutput .= "<ul style=\"text-align:left;\">\n\t<li>".$clang->gT("Label sets").": {$aImportResults['labelsets']}</li>\n";
$importlabeloutput .= "\t<li>".$clang->gT("Labels").": {$aImportResults['labels']}</li></ul>\n";
$importlabeloutput .= "<p><strong>".$clang->gT("Import of label set(s) is completed.")."</strong><br /><br />\n";
$importlabeloutput .= "<input type='submit' value='".$clang->gT("Return to label set administration")."' onclick=\"window.open('$scriptname?action=labels', '_self')\" />\n";
$importlabeloutput .= "</div><br />\n";
// IF WE GOT THIS FAR, THEN THE FILE HAS BEEN UPLOADED SUCCESFULLY
function CSVImportLabelset($sFullFilepath, $options)
@@ -110,7 +109,8 @@ function CSVImportLabelset($sFullFilepath, $options)
fclose($handle);
if (substr($bigarray[0], 0, 27) != "# LimeSurvey Label Set Dump" && substr($bigarray[0], 0, 28) != "# PHPSurveyor Label Set Dump")
{
return $results['fatalerror']=$clang->gT("This file is not a LimeSurvey label set file. Import failed.");
$results['fatalerror']=$clang->gT("This file is not a LimeSurvey label set file. Import failed.");
return $results;
}
for ($i=0; $i<9; $i++) //skipping the first lines that are not needed
@@ -178,7 +178,7 @@ function CSVImportLabelset($sFullFilepath, $options)
$newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly
$lsainsert = "insert INTO {$dbprefix}labelsets (".implode(',',array_keys($labelsetrowdata)).") VALUES (".implode(',',$newvalues).")"; //handle db prefix
$lsiresult=$connect->Execute($lsainsert);
$results['labelsets']++;
$results['labelsets']++;
// Get the new insert id for the labels inside this labelset
$newlid=$connect->Insert_ID("{$dbprefix}labelsets",'lid');
@@ -193,7 +193,7 @@ function CSVImportLabelset($sFullFilepath, $options)
// Combine into one array with keys and values since its easier to handle
$labelrowdata=array_combine($lfieldorders,$lfieldcontents);
$labellid=$labelrowdata['lid'];
if ($labellid == $oldlid) {
$labelrowdata['lid']=$newlid;
@@ -251,7 +251,7 @@ function CSVImportLabelset($sFullFilepath, $options)
$result=$connect->Execute($query) or safe_die("Couldn't delete labelset<br />$query<br />".$connect->ErrorMsg());
$newlid=$lsmatch;
$results['warnings'][]=$clang->gT("Label set was not imported because the same label set already exists.")." ".sprintf($clang->gT("Existing LID: %s"),$newlid);
}
//END CHECK FOR DUPLICATES
}
@@ -265,23 +265,23 @@ function CSVImportLabelset($sFullFilepath, $options)
function XMLImportLabelsets($sFullFilepath, $options)
{
global $connect, $dbprefix, $clang;
$xml = simplexml_load_file($sFullFilepath);
$xml = simplexml_load_file($sFullFilepath);
if ($xml->LimeSurveyDocType!='Label set') safe_die('This is not a valid LimeSurvey label set structure XML file.');
$dbversion = (int) $xml->DBVersion;
$dbversion = (float) $xml->DBVersion;
$csarray=buildLabelSetCheckSumArray();
$aLSIDReplacements=array();
$aLSIDReplacements=array();
$results['labelsets']=0;
$results['labels']=0;
$results['warnings']=array();
// Import labels table ===================================================================================
$tablename=$dbprefix.'labelsets';
foreach ($xml->labelsets->rows->row as $row)
{
$insertdata=array();
$insertdata=array();
foreach ($row as $key=>$value)
{
$insertdata[(string)$key]=(string)$value;
@@ -289,32 +289,33 @@ function XMLImportLabelsets($sFullFilepath, $options)
$oldlsid=$insertdata['lid'];
unset($insertdata['lid']); // save the old qid
// Insert the new question
$query=$connect->GetInsertSQL($tablename,$insertdata);
// Insert the new question
$query=$connect->GetInsertSQL($tablename,$insertdata);
$result = $connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data<br />{$query}<br />\n".$connect->ErrorMsg());
$results['labelsets']++;
$newlsid=$connect->Insert_ID($tablename,"lid"); // save this for later
$aLSIDReplacements[$oldlsid]=$newlsid; // add old and new lsid to the mapping array
}
// Import labels table ===================================================================================
$tablename=$dbprefix.'labels';
if (isset($xml->labels->rows->row))
foreach ($xml->labels->rows->row as $row)
{
$insertdata=array();
$insertdata=array();
foreach ($row as $key=>$value)
{
$insertdata[(string)$key]=(string)$value;
}
$insertdata['lid']=$aLSIDReplacements[$insertdata['lid']];
$query=$connect->GetInsertSQL($tablename,$insertdata);
$query=$connect->GetInsertSQL($tablename,$insertdata);
$result = $connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data<br />{$query}<br />\n".$connect->ErrorMsg());
$results['labels']++;
}
//CHECK FOR DUPLICATE LABELSETS
if (isset($_POST['checkforduplicates']))
@@ -356,12 +357,12 @@ function XMLImportLabelsets($sFullFilepath, $options)
$results['labelsets']--;
$newlid=$lsmatch;
$results['warnings'][]=$clang->gT("Label set was not imported because the same label set already exists.")." ".sprintf($clang->gT("Existing LID: %s"),$newlid);
}
}
//END CHECK FOR DUPLICATES
}
}
return $results;
}
// Closing PHP tag intentionall left out
// Closing PHP tag intentionall left out
+11 -11
View File
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: importoldresponses.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: importoldresponses.php 11664 2011-12-16 05:19:42Z tmswhite $
*/
@@ -50,7 +50,7 @@ if (!$subaction == "import")
<div class='header ui-widget-header'>
".$clang->gT("Import responses from a deactivated survey table")."
</div>
<form id='personalsettings' method='post'>
<form id='personalsettings' method='post'>
<ul>
<li><label for='spansurveyid'>".$clang->gT("Target survey ID:")."</label>
<span id='spansurveyid'> $surveyid<input type='hidden' value='$surveyid' name='sid'></span>
@@ -89,9 +89,9 @@ elseif (isset($surveyid) && $surveyid && isset($oldtable))
);
$aFieldsOldTable=array_values($connect->MetaColumnNames($oldtable, true));
$aFieldsNewTable=array_values($connect->MetaColumnNames($activetable, true));
$aFieldsOldTable=array_values($connect->MetaColumnNames($oldtable, true));
$aFieldsNewTable=array_values($connect->MetaColumnNames($activetable, true));
// Only import fields where the fieldnames are matching
$aValidFields=array_intersect($aFieldsOldTable,$aFieldsNewTable);
@@ -113,17 +113,17 @@ elseif (isset($surveyid) && $surveyid && isset($oldtable))
$aSRIDConversions[$iOldID]=$connect->Insert_Id($activetable,"id");
}
$_SESSION['flashmessage'] = sprintf($clang->gT("%s old response(s) were successfully imported."),$iRecordCount);
$_SESSION['flashmessage'] = sprintf($clang->gT("%s old response(s) were successfully imported."),$iRecordCount);
$sOldTimingsTable=substr($oldtable,0,strrpos($oldtable,'_')).'_timings'.substr($oldtable,strrpos($oldtable,'_'));
$sNewTimingsTable=db_table_name_nq("survey_{$surveyid}_timings");
if (tableExists(sStripDBPrefix($sOldTimingsTable)) && tableExists(sStripDBPrefix($sNewTimingsTable)) && returnglobal('importtimings')=='Y')
{
// Import timings
$aFieldsOldTimingTable=array_values($connect->MetaColumnNames($sOldTimingsTable, true));
$aFieldsNewTimingTable=array_values($connect->MetaColumnNames($sNewTimingsTable, true));
$aFieldsOldTimingTable=array_values($connect->MetaColumnNames($sOldTimingsTable, true));
$aFieldsNewTimingTable=array_values($connect->MetaColumnNames($sNewTimingsTable, true));
$aValidTimingFields=array_intersect($aFieldsOldTimingTable,$aFieldsNewTimingTable);
$queryOldValues = "SELECT ".implode(", ",$aValidTimingFields)." FROM {$sOldTimingsTable} ";
$resultOldValues = db_execute_assoc($queryOldValues) or safe_die("Error:<br />$queryOldValues<br />".$connect->ErrorMsg());
$iRecordCountT=$resultOldValues->RecordCount();
@@ -132,12 +132,12 @@ elseif (isset($surveyid) && $surveyid && isset($oldtable))
{
if (isset($aSRIDConversions[$row['id']]))
{
$row['id']=$aSRIDConversions[$row['id']];
$row['id']=$aSRIDConversions[$row['id']];
}
$sInsertSQL="INSERT into {$sNewTimingsTable} (".implode(",",array_map("db_quote_id",array_keys($row))).") VALUES (".implode(",",array_map("db_quoteall",array_values($row))).")";
$result = $connect->Execute($sInsertSQL) or safe_die("Error:<br />$sInsertSQL<br />".$connect->ErrorMsg());
}
$_SESSION['flashmessage'] = sprintf($clang->gT("%s old response(s) and according timings were successfully imported."),$iRecordCount,$iRecordCountT);
$_SESSION['flashmessage'] = sprintf($clang->gT("%s old response(s) and according timings were successfully imported."),$iRecordCount,$iRecordCountT);
}
$importoldresponsesoutput = browsemenubar($clang->gT("Quick statistics"));
}
+98 -94
View File
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: importquestion.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: importquestion.php 11664 2011-12-16 05:19:42Z tmswhite $
*/
//Ensure script is not run directly, avoid path disclosure
@@ -21,7 +21,7 @@ $importquestion .= "<div class='messagebox ui-corner-all'>\n";
$sFullFilepath = $tempdir . DIRECTORY_SEPARATOR . $_FILES['the_file']['name'];
$aPathInfo = pathinfo($sFullFilepath);
$sExtension = $aPathInfo['extension'];
$sExtension = $aPathInfo['extension'];
if (!@move_uploaded_file($_FILES['the_file']['tmp_name'], $sFullFilepath))
{
@@ -105,7 +105,7 @@ unlink($sFullFilepath);
/**
* This function imports an old-school question file (*.csv,*.sql)
*
*
* @param mixed $sFullFilepath Full file patch to the import file
* @param mixed $newsid Survey ID to which the question is attached
* @param mixed $newgid Group ID top which the question is attached
@@ -115,10 +115,10 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid)
global $dbprefix, $connect, $clang;
$aLIDReplacements=array();
$aQIDReplacements=array(); // this array will have the "new qid" for the questions, the key will be the "old qid"
$aSQIDReplacements=array();
$aSQIDReplacements=array();
$results['labelsets']=0;
$results['labels']=0;
$handle = fopen($sFullFilepath, "r");
while (!feof($handle))
{
@@ -141,7 +141,7 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid)
$results['fatalerror'] = $clang->gT("This file is not a LimeSurvey question file. Import failed.");
return $results;
}
if ((int)$importversion<112)
{
$results['fatalerror'] = $clang->gT("This file is too old. Only files from LimeSurvey version 1.50 (DBVersion 112) and newer are supported.");
@@ -270,7 +270,7 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid)
// Let's check that imported objects support at least the survey's baselang
if (isset($questionarray))
{
$langfieldnum = array_search("language", $questionfieldnames);
@@ -294,9 +294,9 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid)
{
$results['fatalerror']=$clang->gT("You can't import answers which doesn't support at least the survey base language.");
return $results;
}
}
if ($countlabelsets > 0)
@@ -374,7 +374,7 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid)
$query2 = "SELECT code, title, sortorder, language, assessment_value
FROM {$dbprefix}labels
WHERE lid=".$newlid."
ORDER BY language, sortorder, code";
ORDER BY language, sortorder, code";
$result2 = db_execute_num($query2) or safe_die("Died querying labelset $lid<br />$query2<br />".$connect->ErrorMsg());
while($row2=$result2->FetchRow())
{
@@ -423,16 +423,16 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid)
{
$newquestionorder=0;
}
else
else
{
$newquestionorder++;
}
foreach ($questionarray as $qa)
foreach ($questionarray as $qa)
{
$qacfieldcontents=convertCSVRowToArray($qa,',','"');
$questionrowdata=array_combine($questionfieldnames,$qacfieldcontents);
// Skip not supported languages
if (!in_array($questionrowdata['language'],$aLanguagesSupported))
continue;
@@ -467,7 +467,7 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid)
$oldquestion['lid2']=(int)$questionrowdata['lid1'];
}
$oldquestion['oldtype']=$questionrowdata['type'];
// Unset label set IDs and convert question types
unset($questionrowdata['lid']);
unset($questionrowdata['lid1']);
@@ -478,16 +478,16 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid)
elseif ($questionrowdata['type']=='Z')
{
$questionrowdata['type']='L';
}
}
$oldquestion['newtype']=$questionrowdata['type'];
$questionrowdata=array_map('convertCsvreturn2return', $questionrowdata);
// translate internal links
$questionrowdata['title']=translink('survey', $oldsid, $newsid, $questionrowdata['title']);
$questionrowdata['question']=translink('survey', $oldsid, $newsid, $questionrowdata['question']);
$questionrowdata['help']=translink('survey', $oldsid, $newsid, $questionrowdata['help']);
$newvalues=array_values($questionrowdata);
$newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly
$qinsert = "INSERT INTO {$dbprefix}questions (".implode(',',array_keys($questionrowdata)).") VALUES (".implode(',',$newvalues).")";
@@ -502,13 +502,13 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid)
{
db_switchIDInsert('questions',false);
}
}
$qtypes = getqtypelist("" ,"array");
$qtypes = getqtypelist("" ,"array");
$results['answers']=0;
$results['subquestions']=0;
// Now we will fix up old label sets where they are used as answers
if ((isset($oldquestion['lid1']) || isset($oldquestion['lid2'])) && ($qtypes[$oldquestion['newtype']]['answerscales']>0 || $qtypes[$oldquestion['newtype']]['subquestions']>1))
{
@@ -517,13 +517,13 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid)
while($labelrow=$oldlabelsresult->FetchRow())
{
if (in_array($labelrow['language'],$aLanguagesSupported)){
if ($qtypes[$oldquestion['newtype']]['subquestions']<2)
{
$qinsert = "insert INTO ".db_table_name('answers')." (qid,code,answer,sortorder,language,assessment_value,scale_id)
VALUES ($newqid,".db_quoteall($labelrow['code']).",".db_quoteall($labelrow['title']).",".db_quoteall($labelrow['sortorder']).",".db_quoteall($labelrow['language']).",".db_quoteall($labelrow['assessment_value']).",0)";
VALUES ($newqid,".db_quoteall($labelrow['code']).",".db_quoteall($labelrow['title']).",".db_quoteall($labelrow['sortorder']).",".db_quoteall($labelrow['language']).",".db_quoteall($labelrow['assessment_value']).",0)";
$qres = $connect->Execute($qinsert) or safe_die ("Error: Failed to insert answer <br />\n$qinsert<br />\n".$connect->ErrorMsg());
$results['answers']++;
$results['answers']++;
}
else
{
@@ -531,28 +531,28 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid)
$fieldname='qid,';
$data=$aSQIDReplacements[$labelrow['code']].',';
db_switchIDInsert('questions',true);
}
}
else{
$fieldname='' ;
$data='';
}
$qinsert = "insert INTO ".db_table_name('questions')." ($fieldname sid,gid,parent_qid,title,question,question_order,language,scale_id,type)
VALUES ($data $newsid,$newgid,$newqid,".db_quoteall($labelrow['code']).",".db_quoteall($labelrow['title']).",".db_quoteall($labelrow['sortorder']).",".db_quoteall($labelrow['language']).",1,".db_quoteall($oldquestion['newtype']).")";
VALUES ($data $newsid,$newgid,$newqid,".db_quoteall($labelrow['code']).",".db_quoteall($labelrow['title']).",".db_quoteall($labelrow['sortorder']).",".db_quoteall($labelrow['language']).",1,".db_quoteall($oldquestion['newtype']).")";
$qres = $connect->Execute($qinsert) or safe_die ("Error: Failed to insert subquestion <br />\n$qinsert<br />\n".$connect->ErrorMsg());
if ($fieldname=='')
{
$aSQIDReplacements[$labelrow['code']]=$connect->Insert_ID("{$dbprefix}questions","qid");
$aSQIDReplacements[$labelrow['code']]=$connect->Insert_ID("{$dbprefix}questions","qid");
}
else
{
{
db_switchIDInsert('questions',false);
}
}
}
}
if (isset($oldquestion['lid2']) && $qtypes[$oldquestion['newtype']]['answerscales']>1)
{
$query="select * from ".db_table_name('labels')." where lid={$aLIDReplacements[$oldquestion['lid2']]}";
@@ -561,17 +561,17 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid)
{
if (in_array($labelrow['language'],$aLanguagesSupported)){
$qinsert = "insert INTO ".db_table_name('answers')." (qid,code,answer,sortorder,language,assessment_value,scale_id)
VALUES ($newqid,".db_quoteall($labelrow['code']).",".db_quoteall($labelrow['title']).",".db_quoteall($labelrow['sortorder']).",".db_quoteall($labelrow['language']).",".db_quoteall($labelrow['assessment_value']).",1)";
VALUES ($newqid,".db_quoteall($labelrow['code']).",".db_quoteall($labelrow['title']).",".db_quoteall($labelrow['sortorder']).",".db_quoteall($labelrow['language']).",".db_quoteall($labelrow['assessment_value']).",1)";
$qres = $connect->Execute($qinsert) or safe_die ($clang->gT("Error").": Failed to insert answer <br />\n$qinsert<br />\n".$connect->ErrorMsg());
}
}
}
}
}
//Do answers
if (isset($answerarray) && $answerarray)
if (isset($answerarray) && $answerarray)
{
foreach ($answerarray as $aa)
foreach ($answerarray as $aa)
{
$answerfieldcontents=convertCSVRowToArray($aa,',','"');
$answerrowdata=array_combine($answerfieldnames,$answerfieldcontents);
@@ -581,7 +581,7 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid)
}
// Skip not supported languages
if (!in_array($answerrowdata['language'],$aLanguagesSupported))
continue;
continue;
$code=$answerrowdata["code"];
$thisqid=$answerrowdata["qid"];
$answerrowdata["qid"]=$newqid;
@@ -594,14 +594,14 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid)
// Convert default values for single select questions
if ($answerrowdata['default_value']=='Y' && ($oldquestion['newtype']=='L' || $oldquestion['newtype']=='O' || $oldquestion['newtype']=='!'))
{
$insertdata=array();
{
$insertdata=array();
$insertdata['qid']=$newqid;
$insertdata['language']=$answerrowdata['language'];
$insertdata['defaultvalue']=$answerrowdata['answer'];
$query=$connect->GetInsertSQL($dbprefix.'defaultvalues',$insertdata);
$insertdata['defaultvalue']=$answerrowdata['answer'];
$query=$connect->GetInsertSQL($dbprefix.'defaultvalues',$insertdata);
$qres = $connect->Execute($query) or safe_die ("Error: Failed to insert defaultvalue <br />{$query}<br />\n".$connect->ErrorMsg());
}
// translate internal links
$answerrowdata['answer']=translink('survey', $oldsid, $newsid, $answerrowdata['answer']);
@@ -614,7 +614,7 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid)
if (isset($aSQIDReplacements[$answerrowdata['code'].$answerrowdata['qid']])){
$questionrowdata['qid']=$aSQIDReplacements[$answerrowdata['code'].$answerrowdata['qid']];
db_switchIDInsert('questions',true);
}
}
$questionrowdata['parent_qid']=$answerrowdata['qid'];
$questionrowdata['sid']=$newsid;
$questionrowdata['gid']=$newgid;
@@ -623,13 +623,13 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid)
$questionrowdata['question_order']=$answerrowdata['sortorder'];
$questionrowdata['language']=$answerrowdata['language'];
$questionrowdata['type']=$oldquestion['newtype'];
$tablename=$dbprefix.'questions';
$query=$connect->GetInsertSQL($tablename,$questionrowdata);
$tablename=$dbprefix.'questions';
$query=$connect->GetInsertSQL($tablename,$questionrowdata);
$qres = $connect->Execute($query) or safe_die ("Error: Failed to insert question <br />{$query}<br />\n".$connect->ErrorMsg());
if (!isset($questionrowdata['qid']))
{
$aSQIDReplacements[$answerrowdata['code'].$answerrowdata['qid']]=$connect->Insert_ID("{$dbprefix}questions","qid");
$aSQIDReplacements[$answerrowdata['code'].$answerrowdata['qid']]=$connect->Insert_ID("{$dbprefix}questions","qid");
}
else
{
@@ -638,32 +638,32 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid)
$results['subquestions']++;
// also convert default values subquestions for multiple choice
if ($answerrowdata['default_value']=='Y' && ($oldquestion['newtype']=='M' || $oldquestion['newtype']=='P'))
{
$insertdata=array();
{
$insertdata=array();
$insertdata['qid']=$newqid;
$insertdata['sqid']=$aSQIDReplacements[$answerrowdata['code']];
$insertdata['language']=$answerrowdata['language'];
$insertdata['defaultvalue']='Y';
$tablename=$dbprefix.'defaultvalues';
$query=$connect->GetInsertSQL($tablename,$insertdata);
$tablename=$dbprefix.'defaultvalues';
$query=$connect->GetInsertSQL($tablename,$insertdata);
$qres = $connect->Execute($query) or safe_die ("Error: Failed to insert defaultvalue <br />{$query}<br />\n".$connect->ErrorMsg());
}
}
else // insert answers
{
unset($answerrowdata['default_value']);
$tablename=$dbprefix.'answers';
$query=$connect->GetInsertSQL($tablename,$answerrowdata);
$tablename=$dbprefix.'answers';
$query=$connect->GetInsertSQL($tablename,$answerrowdata);
$ares = $connect->Execute($query) or safe_die ("Error: Failed to insert answer<br />{$query}<br />\n".$connect->ErrorMsg());
$results['answers']++;
$results['answers']++;
}
}
}
$results['question_attributes']=0;
// Finally the question attributes - it is called just once and only if there was a question
if (isset($question_attributesarray) && $question_attributesarray)
if (isset($question_attributesarray) && $question_attributesarray)
{//ONLY DO THIS IF THERE ARE QUESTION_ATTRIBUES
$fieldorders =convertCSVRowToArray($question_attributesarray[0],',','"');
unset($question_attributesarray[0]);
@@ -677,24 +677,26 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid)
$qainsert=$connect->GetInsertSQL($tablename,$qarowdata);
$result=$connect->Execute($qainsert) or safe_die ("Couldn't insert question_attribute<br />$qainsert<br />".$connect->ErrorMsg());
$results['question_attributes']++;
}
}
}
LimeExpressionManager::SetDirtyFlag(); // so refreshes syntax highlighting
$results['newqid']=$newqid;
$results['questions']=1;
$results['newqid']=$newqid;
return $results;
return $results;
}
/**
* This function imports a LimeSurvey .lsq question XML file
*
*
* @param mixed $sFullFilepath The full filepath of the uploaded file
* @param mixed $newsid The new survey id
* @param mixed $newsid The new survey id
* @param mixed $newgid The new question group id -the question will always be added after the last question in the group
*/
function XMLImportQuestion($sFullFilepath, $newsid, $newgid)
@@ -705,22 +707,22 @@ function XMLImportQuestion($sFullFilepath, $newsid, $newgid)
$sBaseLanguage = GetBaseLanguageFromSurveyID($newsid);
$aLanguagesSupported[]=$sBaseLanguage; // adds the base language to the list of supported languages
$aLanguagesSupported=array_merge($aLanguagesSupported,GetAdditionalLanguagesFromSurveyID($newsid));
$xml = simplexml_load_file($sFullFilepath);
$xml = simplexml_load_file($sFullFilepath);
if ($xml->LimeSurveyDocType!='Question') safe_die('This is not a valid LimeSurvey question structure XML file.');
$dbversion = (int) $xml->DBVersion;
$aQIDReplacements=array();
$dbversion = (float) $xml->DBVersion;
$aQIDReplacements=array();
$aSQIDReplacements=array(0=>0);
$results['defaultvalues']=0;
$results['answers']=0;
$results['question_attributes']=0;
$results['subquestions']=0;
$importlanguages=array();
foreach ($xml->languages->language as $language)
{
$importlanguages[]=(string)$language;
}
}
if (!in_array($sBaseLanguage,$importlanguages))
{
@@ -734,8 +736,8 @@ function XMLImportQuestion($sFullFilepath, $newsid, $newgid)
{
$fieldnames[]=(string)$fieldname;
};*/
// Import questions table ===================================================================================
// We have to run the question table data two times - first to find all main questions
@@ -751,7 +753,7 @@ function XMLImportQuestion($sFullFilepath, $newsid, $newgid)
}
foreach ($xml->questions->rows->row as $row)
{
$insertdata=array();
$insertdata=array();
foreach ($row as $key=>$value)
{
$insertdata[(string)$key]=(string)$value;
@@ -766,13 +768,13 @@ function XMLImportQuestion($sFullFilepath, $newsid, $newgid)
$insertdata['title']=translink('survey', $oldsid, $newsid, $insertdata['title']);
$insertdata['question']=translink('survey', $oldsid, $newsid, $insertdata['question']);
$insertdata['help']=translink('survey', $oldsid, $newsid, $insertdata['help']);
// Insert the new question
// Insert the new question
if (isset($aQIDReplacements[$oldqid]))
{
$insertdata['qid']=$aQIDReplacements[$oldqid];
$insertdata['qid']=$aQIDReplacements[$oldqid];
db_switchIDInsert('questions',true);
}
$query=$connect->GetInsertSQL($tablename,$insertdata);
}
$query=$connect->GetInsertSQL($tablename,$insertdata);
$result = $connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data<br />{$query}<br />\n".$connect->ErrorMsg());
if (!isset($aQIDReplacements[$oldqid]))
{
@@ -788,10 +790,10 @@ function XMLImportQuestion($sFullFilepath, $newsid, $newgid)
// Import subquestions --------------------------------------------------------------
if (isset($xml->subquestions))
{
foreach ($xml->subquestions->rows->row as $row)
{
$insertdata=array();
$insertdata=array();
foreach ($row as $key=>$value)
{
$insertdata[(string)$key]=(string)$value;
@@ -809,13 +811,13 @@ function XMLImportQuestion($sFullFilepath, $newsid, $newgid)
$insertdata['qid']=$aQIDReplacements[$oldsqid];
db_switchIDInsert('questions',true);
}
$query=$connect->GetInsertSQL($tablename,$insertdata);
$query=$connect->GetInsertSQL($tablename,$insertdata);
$result = $connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data<br />{$query}<br />\n".$connect->ErrorMsg());
$newsqid=$connect->Insert_ID($tablename,"qid"); // save this for later
if (!isset($insertdata['qid']))
{
$aQIDReplacements[$oldsqid]=$newsqid; // add old and new qid to the mapping array
$aQIDReplacements[$oldsqid]=$newsqid; // add old and new qid to the mapping array
}
else
{
@@ -828,10 +830,10 @@ function XMLImportQuestion($sFullFilepath, $newsid, $newgid)
if(isset($xml->answers))
{
$tablename=$dbprefix.'answers';
foreach ($xml->answers->rows->row as $row)
{
$insertdata=array();
$insertdata=array();
foreach ($row as $key=>$value)
{
$insertdata[(string)$key]=(string)$value;
@@ -839,21 +841,21 @@ function XMLImportQuestion($sFullFilepath, $newsid, $newgid)
$insertdata['qid']=$aQIDReplacements[(int)$insertdata['qid']]; // remap the parent_qid
// now translate any links
$query=$connect->GetInsertSQL($tablename,$insertdata);
$query=$connect->GetInsertSQL($tablename,$insertdata);
$result=$connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data<br />{$query}<br />\n".$connect->ErrorMsg());
$results['answers']++;
}
}
}
// Import questionattributes --------------------------------------------------------------
if(isset($xml->question_attributes))
{
$tablename=$dbprefix.'question_attributes';
foreach ($xml->question_attributes->rows->row as $row)
{
$insertdata=array();
$insertdata=array();
foreach ($row as $key=>$value)
{
$insertdata[(string)$key]=(string)$value;
@@ -862,22 +864,22 @@ function XMLImportQuestion($sFullFilepath, $newsid, $newgid)
$insertdata['qid']=$aQIDReplacements[(integer)$insertdata['qid']]; // remap the parent_qid
// now translate any links
$query=$connect->GetInsertSQL($tablename,$insertdata);
$query=$connect->GetInsertSQL($tablename,$insertdata);
$result=$connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data<br />{$query}<br />\n".$connect->ErrorMsg());
$results['question_attributes']++;
}
}
}
// Import defaultvalues --------------------------------------------------------------
if(isset($xml->defaultvalues))
{
$tablename=$dbprefix.'defaultvalues';
$results['defaultvalues']=0;
foreach ($xml->defaultvalues->rows->row as $row)
{
$insertdata=array();
$insertdata=array();
foreach ($row as $key=>$value)
{
$insertdata[(string)$key]=(string)$value;
@@ -886,12 +888,14 @@ function XMLImportQuestion($sFullFilepath, $newsid, $newgid)
$insertdata['sqid']=$aSQIDReplacements[(int)$insertdata['sqid']]; // remap the subquestion id
// now translate any links
$query=$connect->GetInsertSQL($tablename,$insertdata);
$query=$connect->GetInsertSQL($tablename,$insertdata);
$result=$connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data<br />\$query<br />\n".$connect->ErrorMsg());
$results['defaultvalues']++;
}
}
}
LimeExpressionManager::SetDirtyFlag(); // so refreshes syntax highlighting
$results['newqid']=$newqid;
$results['questions']=1;
$results['labelsets']=0;
+21 -23
View File
@@ -10,15 +10,13 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: importsurvey.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: importsurvey.php 11607 2011-12-06 23:19:52Z tmswhite $
*/
//Ensure script is not run directly, avoid path disclosure
//importsurvey.php should be called from cmdline_importsurvey.php or http_importsurvey.php, they set the $importingfrom variable
if ((!isset($importingfrom) && !isset($copyfunction)) || isset($_REQUEST['importingfrom']))
{
die("Cannot run this script directly");
}
if (!isset($dbprefix) || isset($_REQUEST['dbprefix'])) {safe_die("Cannot run this script directly");}
require_once('import_functions.php');
if (!isset($copyfunction))
@@ -27,8 +25,8 @@ if (!isset($copyfunction))
$aPathInfo = pathinfo($sFullFilepath);
$sExtension = $aPathInfo['extension'];
}
$bImportFailed=false;
$bImportFailed=false;
if (isset($sExtension) && strtolower($sExtension)=='csv')
{
$aImportResults=CSVImportSurvey($sFullFilepath);
@@ -46,18 +44,18 @@ else
}
// Create old fieldnames
if ((!$bImportFailed && isset($importingfrom) && $importingfrom == "http") || isset($copyfunction))
{
$importsurvey .= "<br />\n<div class='successheader'>".$clang->gT("Success")."</div><br /><br />\n";
if (isset($copyfunction))
{
$importsurvey .= "<strong><u>".$clang->gT("Survey copy summary")."</u></strong><br />\n";
$importsurvey .= "<strong><u>".$clang->gT("Survey copy summary")."</u></strong><br />\n";
} else
{
$importsurvey .= "<strong><u>".$clang->gT("Survey import summary")."</u></strong><br />\n";
}
$importsurvey .= "<strong><u>".$clang->gT("Survey import summary")."</u></strong><br />\n";
}
$importsurvey .= "<ul style=\"text-align:left;\">\n\t<li>".$clang->gT("Surveys").": {$aImportResults['surveys']}</li>\n";
$importsurvey .= "\t<li>".$clang->gT("Languages").": {$aImportResults['languages']}</li>\n";
$importsurvey .= "\t<li>".$clang->gT("Question groups").": {$aImportResults['groups']}</li>\n";
@@ -65,15 +63,15 @@ if ((!$bImportFailed && isset($importingfrom) && $importingfrom == "http") || is
$importsurvey .= "\t<li>".$clang->gT("Answers").": {$aImportResults['answers']}</li>\n";
if (isset($aImportResults['subquestions']))
{
$importsurvey .= "\t<li>".$clang->gT("Subquestions").": {$aImportResults['subquestions']}</li>\n";
$importsurvey .= "\t<li>".$clang->gT("Subquestions").": {$aImportResults['subquestions']}</li>\n";
}
if (isset($aImportResults['defaultvalues']))
{
$importsurvey .= "\t<li>".$clang->gT("Default answers").": {$aImportResults['defaultvalues']}</li>\n";
$importsurvey .= "\t<li>".$clang->gT("Default answers").": {$aImportResults['defaultvalues']}</li>\n";
}
if (isset($aImportResults['conditions']))
{
$importsurvey .= "\t<li>".$clang->gT("Conditions").": {$aImportResults['conditions']}</li>\n";
$importsurvey .= "\t<li>".$clang->gT("Conditions").": {$aImportResults['conditions']}</li>\n";
}
if (isset($aImportResults['labelsets']))
{
@@ -86,7 +84,7 @@ if ((!$bImportFailed && isset($importingfrom) && $importingfrom == "http") || is
$importsurvey .= "\t<li>".$clang->gT("Question attributes").": {$aImportResults['question_attributes']}</li>\n";
$importsurvey .= "\t<li>".$clang->gT("Assessments").": {$aImportResults['assessments']}</li>\n";
$importsurvey .= "\t<li>".$clang->gT("Quotas").": {$aImportResults['quota']} ({$aImportResults['quotamembers']} ".$clang->gT("quota members")." ".$clang->gT("and")." {$aImportResults['quotals']} ".$clang->gT("quota language settings").")</li>\n</ul><br />\n";
if (count($aImportResults['importwarnings'])>0)
if (count($aImportResults['importwarnings'])>0)
{
$importsurvey .= "<div class='warningheader'>".$clang->gT("Warnings").":</div><ul style=\"text-align:left;\">";
foreach ($aImportResults['importwarnings'] as $warning)
@@ -98,23 +96,23 @@ if ((!$bImportFailed && isset($importingfrom) && $importingfrom == "http") || is
if (isset($copyfunction))
{
$importsurvey .= "<strong>".$clang->gT("Copy of survey is completed.")."</strong><br />\n"
. "<a href='$scriptname?sid={$aImportResults['newsid']}'>".$clang->gT("Go to survey")."</a><br />\n";
. "<a href='$scriptname?sid={$aImportResults['newsid']}'>".$clang->gT("Go to survey")."</a><br />\n";
} else
{
$importsurvey .= "<strong>".$clang->gT("Import of Survey is completed.")."</strong><br />\n"
. "<a href='$scriptname?sid={$aImportResults['newsid']}'>".$clang->gT("Go to survey")."</a><br />\n";
. "<a href='$scriptname?sid={$aImportResults['newsid']}'>".$clang->gT("Go to survey")."</a><br />\n";
}
$importsurvey .= "</div><br />\n";
if (!isset($copyfunction))
{
unlink($sFullFilepath);
unlink($sFullFilepath);
}
}
elseif (isset($bImportFailed) && $bImportFailed==true)
{
echo "\n".$clang->gT("Error")."\n\n";
echo $clang->gT("Import failed. You specified an invalid file.")."\n";
}
else
{
@@ -130,15 +128,15 @@ else
echo $clang->gT("Answers").": {$aImportResults['answers']}\n";
if (isset($aImportResults['subquestions']))
{
echo $clang->gT("Subquestions").": {$aImportResults['subquestions']}\n";
echo $clang->gT("Subquestions").": {$aImportResults['subquestions']}\n";
}
if (isset($aImportResults['defaultvalues']))
{
echo $clang->gT("Default answers").": {$aImportResults['defaultvalues']}\n";
echo $clang->gT("Default answers").": {$aImportResults['defaultvalues']}\n";
}
if (isset($aImportResults['conditions']))
{
echo $clang->gT("Conditions").": {$aImportResults['conditions']}\n";
echo $clang->gT("Conditions").": {$aImportResults['conditions']}\n";
}
if (isset($aImportResults['labelsets']))
{
+2 -2
View File
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: integritycheck.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: integritycheck.php 11664 2011-12-16 05:19:42Z tmswhite $
*/
@@ -44,7 +44,7 @@ if($_SESSION['USER_RIGHT_CONFIGURATOR'] == 1)
while ($aRow=$aResult->FetchRow())
{
$tablename=substr($aRow[0],strlen($dbprefix));
if ($tablename=='survey_permissions') continue;
if ($tablename=='survey_permissions' || $tablename=='survey_links') continue;
$iSurveyID=substr($tablename,strpos($tablename,'_')+1);
$qquery="SELECT sid FROM {$dbprefix}surveys WHERE sid='{$iSurveyID}'";
$qresult=$connect->Execute($qquery) or safe_die ("Couldn't check questions table for qids<br />$qquery<br />".$connect->ErrorMsg());
+4 -5
View File
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: iterate_survey.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: iterate_survey.php 11664 2011-12-16 05:19:42Z tmswhite $
*/
/*
* Set completed answers to the incomplete state and reset the tokens to 'not used' so that
@@ -54,13 +54,12 @@ if ($subaction=='unfinalizeanswers')
$updateqr = "UPDATE $surveytable SET submitdate=NULL, lastpage=NULL;\n";
$updateres = $connect->Execute($updateqr) or safe_die("UnFinilize answers failed:<br />\n" . $connect->ErrorMsg() . "<br />$updateqr");
// Finally, reset the token completed and sent status
$updateqr="UPDATE ".db_table_name("tokens_$surveyid")." SET sent='N', remindersent='N', remindercount=0, completed='N', usesleft=1";
$updateqr="UPDATE ".db_table_name("tokens_$surveyid")." SET sent='N', remindersent='N', remindercount=0, completed='N', usesleft=1 where usesleft=0";
$updateres=$connect->Execute($updateqr) or safe_die ("Couldn't reset token completed state<br />$updateqr<br />".$connect->ErrorMsg());
$iteratesurveyoutput .= "<br />\n";
$iteratesurveyoutput .= "<div class='header ui-widget-header'>".$clang->gT("Iterate survey")."</div>\n";
$iteratesurveyoutput .= "<p style='width:100%;'>\n"
$iteratesurveyoutput .= "<p>\n"
. "<font class='successtitle'>".$clang->gT("Success")."</font><br />\n"
. $clang->gT("Answers and tokens have been re-opened.")."<br />\n"
. "</p>\n"
. "<table><tr><td>";
. "</p>\n";
}
+158 -284
View File
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: labels.php 10934 2011-09-02 22:12:07Z c_schmitz $
* $Id: labels.php 11675 2011-12-18 02:27:59Z tmswhite $
*/
include_once("login_check.php"); //Login Check dies also if the script is started directly
@@ -40,7 +40,7 @@ if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $_SESSION['USER_RIGHT_MANAGE_LABEL
//DO DATABASE UPDATESTUFF
if ($action == "updateset") {updateset($lid);}
if ($action == "insertlabelset") {$lid=insertlabelset();}
if ($action == "modlabelsetanswers") {modlabelsetanswers($lid);}
if (($action == "modlabelsetanswers")||($action == "ajaxmodlabelsetanswers")) {modlabelsetanswers($lid);}
if ($action == "deletelabelset") {if (deletelabelset($lid)) {$lid=0;}}
if ($action == "importlabels")
{
@@ -155,7 +155,7 @@ if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $_SESSION['USER_RIGHT_MANAGE_LABEL
."<input type='image' src='$imageurl/close.gif' align='right' "
."onclick=\"window.open('admin.php?action=labels&amp;lid=$lid', '_self')\" />\n";
if ($action == "newlabelset") {$labelsoutput.= $clang->gT("Create or import new label set(s)"); $langids=$_SESSION['adminlang']; $tabitem=$clang->gT("Create New Label Set");}
else {$labelsoutput.= $clang->gT("Edit label set"); $tabitem=$clang->gT("Edit label set");}
else {$labelsoutput.= $clang->gT("Edit Label Set"); $tabitem=$clang->gT("Edit label set");}
$langidsarray=explode(" ",trim($langids)); //Make an array of it
$labelsoutput.= "\n\t</div>\n";
@@ -272,7 +272,7 @@ if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $_SESSION['USER_RIGHT_MANAGE_LABEL
"<img src='$imageurl/dumplabel.png' alt='".$clang->gT("Export this label set")."' align='left' /></a>"
."\t</div>\n"
."\t<div class='menubar-right'>\n"
."\t<input type='image' src='$imageurl/close.gif' title='".$clang->gT("Close")."'"
."\t<input type='image' src='$imageurl/close.gif' title='".$clang->gT("Close Window")."'"
."onclick=\"window.open('admin.php?action=labels', '_self')\" />\n"
."\t</div>\n"
."\t</div>\n"
@@ -283,6 +283,7 @@ if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $_SESSION['USER_RIGHT_MANAGE_LABEL
//LABEL ANSWERS - SHOW THE MASK FOR EDITING THE LABELS
$js_admin_includes[]='scripts/updateset.js';
$qulabelset = "SELECT * FROM ".db_table_name('labelsets')." WHERE lid=$lid";
$rslabelset = db_execute_assoc($qulabelset) or safe_die($connect->ErrorMsg());
@@ -296,9 +297,9 @@ if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $_SESSION['USER_RIGHT_MANAGE_LABEL
$msorow=$maxresult->FetchRow();
$maxsortorder=$msorow['maxsortorder']+1;
// KP
// labels table
$labelsoutput.= "\t<div class='header ui-widget-header'>".$clang->gT("Labels")."\t</div>\n";
$labelsoutput.= "<form method='post' action='admin.php' onsubmit=\"return codeCheck('code_',$maxsortorder,'".$clang->gT("Error: You are trying to use duplicate label codes.",'js')."','".$clang->gT("Error: 'other' is a reserved keyword.",'js')."');\">\n"
$labelsoutput.= "<form method='post' id='mainform' action='admin.php' onsubmit=\"return codeCheck('code_',$maxsortorder,'".$clang->gT("Error: You are trying to use duplicate label codes.",'js')."','".$clang->gT("Error: 'other' is a reserved keyword.",'js')."');\">\n"
."<input type='hidden' name='sortorder' value='{$row['sortorder']}' />\n"
."<input type='hidden' name='lid' value='$lid' />\n"
."<input type='hidden' name='action' value='modlabelsetanswers' />\n";
@@ -312,145 +313,82 @@ if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $_SESSION['USER_RIGHT_MANAGE_LABEL
$result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
$labelcount = $result->RecordCount();
$tab_title[$i] = getLanguageNameFromCode($lslanguage,false);
$tab_content[$i] = "<table class='answertable' align='center'>\n"
."<thead align='center'>"
."<tr>\n"
."\t<th align='right' class='settingcaption'>\n"
.$clang->gT("Code")
."\t</th>\n";
$tab_content[$i].="<th align='right' class='settingcaption'>".$clang->gT("Assessment value").'</th>';
$tab_content[$i].="\t<th class='settingcaption'>\n"
.$clang->gT("Title")
."\t</th>\n"
."\t<th align='center' class='settingcaption'>\n"
.$clang->gT("Action")
."\t</th>\n"
."\t<th align='center' class='settingcaption'>\n"
.$clang->gT("Order")
."\t</th>\n"
."</tr></thead>"
."<tbody align='center'>";
$tab_content[$i] = "
<input type='hidden' class='lslanguage' value='{$lslanguage}'>
<table class='answertable' align='center'>
<thead align='center'>
<tr>";
if ($first)
$tab_content[$i] .= "<th>&nbsp;</th>";
$tab_content[$i] .= "<th class='settingcaption'>{$clang->gT("Code")}</th>
<th class='settingcaption'>{$clang->gT("Assessment value")}</th>
<th class='settingcaption'>{$clang->gT("Title")}</th>";
if ($first)
$tab_content[$i] .= "<th class='settingcaption'>{$clang->gT("Action")}</th>";
$tab_content[$i] .= "</tr>
</thead>
<tbody align='center'>
";
$alternate=false;
while ($row=$result->FetchRow())
{
$sortorderids=$sortorderids.' '.$row['language'].'_'.$row['sortorder'];
if ($first) {$codeids=$codeids.' '.$row['sortorder'];}
$tab_content[$i].= "<tr style='white-space: nowrap;' ";
$tab_content[$i].= "<tr style='white-space: nowrap;' name='{$row['sortorder']}'";
if ($alternate==true)
{
$tab_content[$i].=' class="highlight" ';
$alternate=false;
}
$tab_content[$i].=' class = "highlight" ';
else
{
$alternate=true;
}
$tab_content[$i].="><td align='right'>\n";
$tab_content[$i] .= ">";
if (!$first)
{
$tab_content[$i].= "\t{$row['code']}";
}
$tab_content[$i].= "<td>{$row['code']}</td><td>{$row['assessment_value']}</td>";
else
{
$tab_content[$i].= "\t<input type='hidden' name='oldcode_{$row['sortorder']}' value=\"{$row['code']}\" />\n";
$tab_content[$i].= "\t<input type='text' id='code_{$row['sortorder']}' name='code_{$row['sortorder']}' maxlength='5' size='5' value=\"{$row['code']}\" onkeypress=\"if(event.keyCode!=13) {return goodchars(event,'1234567890abcdefghijklmnopqrstuvwxyz');}; return catchenter(event,'saveallbtn_$lslanguage');\" />\n";
}
$tab_content[$i].= "
<td><img src='$imageurl/handle.png' /></td>
<td>
<input type='hidden' class='hiddencode' value='{$row['code']}' />
<input type='text' class='codeval'id='code_{$row['sortorder']}' name='code_{$row['sortorder']}' maxlength='5'
size='6' value='{$row['code']}'/>
</td>
<td>
<input type='text' class='assessmentval' id='assessmentvalue_{$row['sortorder']}' style='text-align: right;' name='assessmentvalue_{$row['sortorder']}' maxlength='5' size='6' value='{$row['assessment_value']}' />
</td>
";
$tab_content[$i].= "
<td>
<input type='text' name='title_{$row['language']}_{$row['sortorder']}' maxlength='3000' size='80' value=\"".html_escape($row['title'])."\" />"
.getEditor("editlabel", "title_{$row['language']}_{$row['sortorder']}", "[".$clang->gT("Label:", "js")."](".$row['language'].")",'','','',$action)
."</td>";
if ($first)
$tab_content[$i] .= "
<td style='text-align:center;'>
<img src='$imageurl/addanswer.png' class='btnaddanswer' /><img src='$imageurl/deleteanswer.png' class='btndelanswer' />
</td>
</tr>";
$tab_content[$i].= "\t</td>\n"
."\t<td style='text-align:center;'>\n";
if ($first)
{
$tab_content[$i].= "\t<input type='text' id='assessmentvalue_{$row['sortorder']}' style='text-align: right;' name='assessmentvalue_{$row['sortorder']}' maxlength='5' size='5' value=\"{$row['assessment_value']}\" "
." onkeypress=\"if(event.keyCode==13) {if (event && event.preventDefault) event.preventDefault(); document.getElementById('saveallbtn_$lslanguage').click(); return false;} return goodchars(event,'1234567890-')\" />";
}
else
{
$tab_content[$i].= $row['assessment_value'];
}
$tab_content[$i].= "\t</td>\n"
."\t<td>\n"
."\t<input type='text' name='title_{$row['language']}_{$row['sortorder']}' maxlength='3000' size='75' value=\"".html_escape($row['title'])."\" onkeypress=\"return catchenter(event,'saveallbtn_$lslanguage');\"/>\n"
. getEditor("editlabel", "title_{$row['language']}_{$row['sortorder']}", "[".$clang->gT("Label:", "js")."](".$row['language'].")",'','','',$action)
."\t</td>\n"
."\t<td style='text-align:center;'>\n";
$tab_content[$i].= "\t<input type='submit' name='method' value='".$clang->gT("Del")."' onclick=\"this.form.sortorder.value='{$row['sortorder']}'\" />\n";
$tab_content[$i].= "\t</td>\n"
."\t<td>\n";
if ($position > 0)
{
$tab_content[$i].= "\t<input type='submit' name='method' value='".$clang->gT("Up")."' onclick=\"this.form.sortorder.value='{$row['sortorder']}'\" />\n";
};
if ($position < $labelcount-1)
{
// Fill the sortorder hiddenfield so we know what field is moved down
$tab_content[$i].= "\t<input type='submit' name='method' value='".$clang->gT("Dn")."' onclick=\"this.form.sortorder.value='{$row['sortorder']}'\" />\n";
}
$tab_content[$i].= "\t</td></tr>\n";
$position++;
}
if ($labelcount>0)
{
$tab_content[$i].= "\t<tr><td colspan='5'><center><input type='submit' name='method' value='".$clang->gT("Save Changes")."' id='saveallbtn_$lslanguage' />"
."</center></td></tr>\n";
}
$position=sprintf("%05d", $position);
if (!isset($_SESSION['nextlabelcode'])) $_SESSION['nextlabelcode']='';
if ($first)
{ $tab_content[$i].= "<tr><td><br /></td></tr><tr><td align='right'>"
."<input type='hidden' name='sortorderids' value='$sortorderids' />\n"
."<input type='hidden' name='codeids' value='$codeids' />\n"
."<strong>".$clang->gT("New label").":</strong> <input type='text' maxlength='5' name='insertcode' size='6' value='".$_SESSION['nextlabelcode']."' id='code_$maxsortorder' onkeypress=\"if(event.keyCode!=13) {return goodchars(event,'1234567890abcdefghijklmnopqrstuvwxyz');}; return catchenter(event,'addnewlabelbtn');\" />\n"
."\t</td>\n"
."<td style='text-align:center;'>"
."<input style='text-align:right;' type='text' maxlength='5' name='insertassessmentvalue' size='6' id='insertassessmentvalue' value='0' "
."onkeypress=\"if(event.keyCode==13) {if (event && event.preventDefault) event.preventDefault(); document.getElementById('addnewlabelbtn').click(); return false;} return goodchars(event,'1234567890-')\" />"
."\t</td>\n"
."\t<td>\n"
."\t<input type='text' maxlength='3000' name='inserttitle' size='75' onkeypress=\"return catchenter(event,'addnewlabelbtn');\"/>\n"
. getEditor("addlabel", "inserttitle", "[".$clang->gT("Label:", "js")."](".$lslanguage.")",'','','',$action)
."\t</td>\n"
."\t<td colspan='2'>\n"
."\t<input type='submit' name='method' value='".$clang->gT("Add new label")."' id='addnewlabelbtn' />\n"
."<script type='text/javascript'>\n"
."<!--\n"
."document.getElementById('code_$maxsortorder').focus();\n"
."function catchenter(evt, btnid)\n"
."{\n"
."\tvar mykey = window.event ? evt.keyCode : evt.which;\n"
."\tif (mykey == 13)\n"
."\t{\n"
."\t\tvar mybtn = document.getElementById(btnid);\n"
."\t\tmybtn.click();\n"
."\t\treturn false;\n"
."\t}\n"
."\treturn true;\n"
."}\n"
."//-->\n"
."</script>\n"
."\t</td>\n"
."</tr>\n";
$tab_content[$i] .= "</tbody></table>";
$tab_content[$i] .= "<button class='btnquickadd' id='btnquickadd' type='button'>".$clang->gT('Quick add...')."</button>";
$tab_content[$i].= "<p><input type='submit' name='method' value='".$clang->gT("Save Changes")."' id='saveallbtn_$lslanguage' /></p>";
}
else
{
$tab_content[$i].= "<tr>\n"
."\t<td colspan='4' align='center'>\n"
."<span style='font-color:green; font-size:8px; font-weight:bold; font-style: italic;'>"
.$clang->gT("Note: Inserting new labels must be done on the first language tab.")."</span>\n"
."\t</td>\n"
."</tr>\n";
}
unset($_SESSION['nextlabelcode']);
$first=false;
$tab_content[$i].="</tbody></table>\n";
$i++;
}
@@ -466,6 +404,8 @@ if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $_SESSION['USER_RIGHT_MANAGE_LABEL
$labelsoutput .= "<div id='neweditlblset$i'>$eachcontent</div>";
}
$labelsoutput .="</form>";
$disabledIfNoResources = '';
if (hasResources($lid,'label') === false)
{
@@ -495,6 +435,14 @@ if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $_SESSION['USER_RIGHT_MANAGE_LABEL
$labelsoutput .= "</div>";
$labelsoutput .= "<div id='quickadd' name='{$clang->gT('Quick add')}'style='display:none;'><div style='float:left;'>
<label for='quickadd'>".$clang->gT('Enter your labels:')."</label>
<br /><textarea id='quickaddarea' class='tipme' title='".$clang->gT('Enter one label per line. You can provide a code by separating code and label text with a semikolon or tab. For multilingual surveys you add the translation(s) on the same line separated with a semikolon or tab.')."' rows='30' style='width:570px;'></textarea>
<br /><button id='btnqareplace' type='button'>".$clang->gT('Replace')."</button>
<button id='btnqainsert' type='button'>".$clang->gT('Add')."</button>
<button id='btnqacancel' type='button'>".$clang->gT('Cancel')."</button></div>
</div> ";
}
}
@@ -638,174 +586,100 @@ function insertlabelset()
}
function modlabelsetanswers($lid)
{
global $dbprefix, $connect, $clang, $labelsoutput, $databasetype, $filterxsshtml,$postsortorder;
$qulabelset = "SELECT * FROM ".db_table_name('labelsets')." WHERE lid='$lid'";
$rslabelset = db_execute_assoc($qulabelset) or safe_die($connect->ErrorMsg());
$rwlabelset=$rslabelset->FetchRow();
$lslanguages=explode(" ", trim($rwlabelset['languages']));
$ajax = false;
if (isset($_POST['ajax']) && $_POST['ajax'] == "1"){
$ajax = true;
}
if (!isset($_POST['method'])) {
$_POST['method'] = $clang->gT("Save");
}
switch($_POST['method'])
$sPostData=html_entity_decode($_POST['dataToSend'], ENT_QUOTES, "UTF-8");
$sPostData=str_replace("\t", '', $sPostData);
if (get_magic_quotes_gpc())
{
case $clang->gT("Add new label", "unescaped"):
if (isset($_POST['insertcode']) && $_POST['insertcode']!='')
{
$_SESSION['nextlabelcode']=getNextCode($_POST['insertcode']);
$_POST['insertcode'] = db_quoteall($_POST['insertcode'],true);
// check that the code doesn't exist yet
$query = "SELECT code FROM ".db_table_name('labels')." WHERE lid='$lid' AND code=".$_POST['insertcode'];
$result = $connect->Execute($query);
$codeoccurences=$result->RecordCount();
if ($codeoccurences == 0)
{
$query = "select max(sortorder) as maxorder from ".db_table_name('labels')." where lid='$lid'";
$result = $connect->Execute($query);
$newsortorder=sprintf("%05d", $result->fields['maxorder']+1);
if ($filterxsshtml)
{
require_once("../classes/inputfilter/class.inputfilter_clean.php");
$myFilter = new InputFilter('','',1,1,1);
$_POST['inserttitle']=$myFilter->process($_POST['inserttitle']);
}
else
{
$_POST['inserttitle'] = html_entity_decode($_POST['inserttitle'], ENT_QUOTES, "UTF-8");
}
// Fix bug with FCKEditor saving strange BR types
$_POST['inserttitle']=fix_FCKeditor_text($_POST['inserttitle']);
$_POST['inserttitle'] = db_quoteall($_POST['inserttitle'],true);
$_POST['insertassessmentvalue']=(int)$_POST['insertassessmentvalue'];
foreach ($lslanguages as $lslanguage)
{
db_switchIDInsert('labels',true);
$query = "INSERT INTO ".db_table_name('labels')." (lid, code, title, sortorder,language, assessment_value) VALUES ($lid, {$_POST['insertcode']}, {$_POST['inserttitle']}, '$newsortorder','$lslanguage',{$_POST['insertassessmentvalue']})";
if (!$result = $connect->Execute($query))
{
$labelsoutput.= "<script type=\"text/javascript\">\n<!--\n alert(\"".$clang->gT("Failed to insert label", "js")." - ".$query." - ".$connect->ErrorMsg()."\")\n //-->\n</script>\n";
}
db_switchIDInsert('labels',false);
}
}
else
{
$labelsoutput.= "<script type=\"text/javascript\">\n<!--\n alert(\"".$clang->gT("This label code is already used in this labelset. Please choose another code or rename the existing one.", "js")."\")\n //-->\n</script>\n";
}
}
break;
// Save all labels with one button
case $clang->gT("Save Changes", "unescaped"):
//Determine autoids by evaluating the hidden field
$sortorderids=explode(' ', trim($_POST['sortorderids']));
$codeids=explode(' ', trim($_POST['codeids']));
$count=0;
// Quote each code_codeid first
foreach ($codeids as $codeid)
{
$_POST['code_'.$codeid] = db_quoteall($_POST['code_'.$codeid],true);
if (isset($_POST['oldcode_'.$codeid])) $_POST['oldcode_'.$codeid] = db_quoteall($_POST['oldcode_'.$codeid],true);
// Get the code values to check for duplicates
$codevalues[] = $_POST['code_'.$codeid];
}
// Check that there is no code duplicate
if (count(array_unique($codevalues)) == count($codevalues))
{
if ($filterxsshtml)
{
require_once("../classes/inputfilter/class.inputfilter_clean.php");
$myFilter = new InputFilter('','',1,1,1);
}
foreach ($sortorderids as $sortorderid)
{
$orderid=substr($sortorderid,strrpos($sortorderid,'_')+1,20);
foreach ($lslanguages as $langid)
{
$sortorderid = $langid . '_' . $orderid;
if ($filterxsshtml)
{
$_POST['title_'.$sortorderid]=$myFilter->process($_POST['title_'.$sortorderid]);
}
else
{
$_POST['title_'.$sortorderid] = html_entity_decode($_POST['title_'.$sortorderid], ENT_QUOTES, "UTF-8");
}
// Fix bug with FCKEditor saving strange BR types
$_POST['title_'.$sortorderid]=fix_FCKeditor_text($_POST['title_'.$sortorderid]);
$_POST['title_'.$sortorderid] = db_quoteall($_POST['title_'.$sortorderid],true);
$query = "UPDATE ".db_table_name('labels')." SET code=".$_POST['code_'.$codeids[$count]].", title={$_POST['title_'.$sortorderid]}, assessment_value={$_POST['assessmentvalue_'.$codeids[$count]]} WHERE lid=$lid AND sortorder=$orderid AND language='$langid'";
if (!$result = $connect->Execute($query))
// if update didn't work we assume the label does not exist and insert it
{
$query = "insert into ".db_table_name('labels')." (code,title,lid,sortorder,language) VALUES (".$_POST['code_'.$codeids[$count]].", {$_POST['title_'.$sortorderid]}, $lid , $orderid , '$langid')";
if (!$result = $connect->Execute($query))
{
$labelsoutput.= "<script type=\"text/javascript\">\n<!--\n alert(\"".$clang->gT("Failed to update label","js")." - ".$query." - ".$connect->ErrorMsg()."\")\n //-->\n</script>\n";
}
}
}
$count++;
if ($count>count($codeids)-1) {$count=0;}
}
fixorder($lid);
}
else
{
$labelsoutput.= "<script type=\"text/javascript\">\n<!--\n alert(\"".$clang->gT("Can't update labels because you are using duplicated codes","js")."\")\n //-->\n</script>\n";
}
break;
// Pressing the Up button
case $clang->gT("Up", "unescaped"):
$newsortorder=$postsortorder-1;
$oldsortorder=$postsortorder;
$cdquery = "UPDATE ".db_table_name('labels')." SET sortorder=-1 WHERE lid=$lid AND sortorder=$newsortorder";
$cdresult=$connect->Execute($cdquery) or safe_die($connect->ErrorMsg());
$cdquery = "UPDATE ".db_table_name('labels')." SET sortorder=$newsortorder WHERE lid=$lid AND sortorder=$oldsortorder";
$cdresult=$connect->Execute($cdquery) or safe_die($connect->ErrorMsg());
$cdquery = "UPDATE ".db_table_name('labels')." SET sortorder='$oldsortorder' WHERE lid=$lid AND sortorder=-1";
$cdresult=$connect->Execute($cdquery) or safe_die($connect->ErrorMsg());
break;
// Pressing the Down button
case $clang->gT("Dn", "unescaped"):
$newsortorder=$postsortorder+1;
$oldsortorder=$postsortorder;
$cdquery = "UPDATE ".db_table_name('labels')." SET sortorder=-1 WHERE lid=$lid AND sortorder='$newsortorder'";
$cdresult=$connect->Execute($cdquery) or safe_die($connect->ErrorMsg());
$cdquery = "UPDATE ".db_table_name('labels')." SET sortorder='$newsortorder' WHERE lid=$lid AND sortorder=$oldsortorder";
$cdresult=$connect->Execute($cdquery) or safe_die($connect->ErrorMsg());
$cdquery = "UPDATE ".db_table_name('labels')." SET sortorder=$oldsortorder WHERE lid=$lid AND sortorder=-1";
$cdresult=$connect->Execute($cdquery) or safe_die($connect->ErrorMsg());
break;
// Delete Button
case $clang->gT("Del", "unescaped"):
$query = "DELETE FROM ".db_table_name('labels')." WHERE lid=$lid AND sortorder='{$postsortorder}'";
if (!$result = $connect->Execute($query))
{
$labelsoutput.= "<script type=\"text/javascript\">\n<!--\n alert(\"".$clang->gT("Failed to delete label","js")." - ".$query." - ".$connect->ErrorMsg()."\")\n //-->\n</script>\n";
}
fixorder($lid);
break;
$data = json_decode(stripslashes($sPostData));
}
else
{
$data = json_decode($sPostData);
}
if ($ajax){
$lid = insertlabelset();
}
if (count(array_unique($data->{'codelist'})) == count($data->{'codelist'}))
{
if ($filterxsshtml)
{
require_once("../classes/inputfilter/class.inputfilter_clean.php");
$myFilter = new InputFilter('','',1,1,1);
}
$query = "DELETE FROM ".db_table_name('labels')." WHERE lid = {$lid}";
$result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
foreach($data->{'codelist'} as $index=>$codeid){
$codeObj = $data->$codeid;
$actualcode = db_quoteall($codeObj->{'code'},true);
$codeid = db_quoteall($codeid,true);
$assessmentvalue = (int)($codeObj->{'assessmentvalue'});
foreach($data->{'langs'} as $lang){
$strTemp = 'text_'.$lang;
$title = $codeObj->$strTemp;
if ($filterxsshtml)
$title=$myFilter->process($title);
else
$title = html_entity_decode($title, ENT_QUOTES, "UTF-8");
// Fix bug with FCKEditor saving strange BR types
$title =fix_FCKeditor_text($title);
$title = db_quoteall($title,true);
$sort_order = db_quoteall($index);
$lang = db_quoteall($lang);
$title = trim($title, "'");
if (get_magic_quotes_gpc())
{
$title = str_replace("'","\'",$title);
}
$query = "INSERT INTO ".db_table_name('labels')." (lid,code,title,sortorder, assessment_value, language)
VALUES({$lid},{$actualcode},'".$title."',{$sort_order},{$assessmentvalue},{$lang})";
$result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
}
}
$_SESSION['flashmessage']=$clang->gT("Labels sucessfully updated");
}
else
{
$labelsoutput.= "<script type=\"text/javascript\">\n<!--\n alert(\"".$clang->gT("Can't update labels because you are using duplicated codes","js")."\")\n //-->\n</script>\n";
}
if ($ajax){ die(); }
}
/**
+1 -1
View File
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: listcolumn.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: listcolumn.php 11664 2011-12-16 05:19:42Z tmswhite $
*/
include_once("login_check.php");
+5 -3
View File
@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: login_check.php 10925 2011-09-02 14:12:02Z c_schmitz $
* $Id: login_check.php 12211 2012-01-26 17:02:27Z shnoulle $
*/
@@ -51,7 +51,7 @@ if(isset($_GET['user']) && isset($_GET['onepass']))
else
{
//check if user exists in DB
$query = "SELECT uid, users_name, password, one_time_pw, dateformat, full_name, htmleditormode FROM ".db_table_name('users')." WHERE users_name=".$connect->qstr($user);
$query = "SELECT uid, users_name, password, one_time_pw, dateformat, full_name, htmleditormode, questionselectormode, templateeditormode FROM ".db_table_name('users')." WHERE users_name=".$connect->qstr($user);
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; //Checked
$result = $connect->SelectLimit($query, 1) or safe_die ($query."<br />".$connect->ErrorMsg());
if(!$result)
@@ -101,6 +101,8 @@ if(isset($_GET['user']) && isset($_GET['onepass']))
$_SESSION['loginID'] = $srow['uid'];
$_SESSION['dateformat'] = $srow['dateformat'];
$_SESSION['htmleditormode'] = $srow['htmleditormode'];
$_SESSION['questionselectormode'] = $srow['questionselectormode'];
$_SESSION['templateeditormode'] = $srow['templateeditormode'];
$_SESSION['full_name'] = $srow['full_name'];
GetSessionUserRights($_SESSION['loginID']);
@@ -181,7 +183,7 @@ if(!isset($_SESSION['loginID']) && $action != "forgotpass" && ($action != "logou
//include("database.php");
$sIp = $_SERVER['REMOTE_ADDR'];
$sIp = getIPAddress();
$query = "SELECT * FROM ".db_table_name('failed_login_attempts'). " WHERE ip='$sIp';";
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
$result = $connect->query($query) or safe_die ($query."<br />".$connect->ErrorMsg());

Some files were not shown because too many files have changed in this diff Show More