die(''); } require_once $homedir . "/classes/core/sha256.php"; $adminoutput = ""; // just to avoid notices include "database.php"; $query = "SELECT uid, password, lang FROM " . db_table_name('users') . " WHERE users_name=" . $connect->qstr($username); $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $result = $connect->SelectLimit($query, 1) or die($query . "\n" . $connect->ErrorMsg()); if ($result->RecordCount() < 1) { // wrong or unknown username and/or email echo "\n" . $clang->gT("User name invalid!") . "\n"; exit; } else { $fields = $result->FetchRow(); if (SHA256::hashing($userpass) == $fields['password']) { $_SESSION['loginID'] = intval($fields['uid']); $clang = new limesurvey_lang($fields['lang']); GetSessionUserRights($_SESSION['loginID']); if (!$_SESSION['USER_RIGHT_CREATE_SURVEY']) { // no permission to create survey! echo "\n" . $clang->gT("You are not allowed to import a survey!") . "\n"; exit; } } else { // password don't match username echo "\n" . $clang->gT("User name and password do not match!") . "\n"; exit; } } echo "\n";
$sPassword = html_entity_decode($_POST['pass'], ENT_QUOTES, 'UTF-8'); if ($sPassword == '%%unchanged%%') { $sPassword = ''; } $full_name = html_entity_decode($postfull_name, ENT_QUOTES, 'UTF-8'); $valid_email = true; if (!validate_email($email)) { $valid_email = false; $failed = true; $addsummary .= "<div class=\"warningheader\">" . $clang->gT("Could not modify user data.") . "</div><br />\n" . " " . $clang->gT("Email address is not valid.") . "<br />\n"; } elseif ($valid_email) { $failed = false; if (empty($sPassword)) { $uquery = "UPDATE " . db_table_name('users') . " SET email='" . db_quote($email) . "', full_name='" . db_quote($full_name) . "' WHERE uid=" . $postuserid; } else { $uquery = "UPDATE " . db_table_name('users') . " SET email='" . db_quote($email) . "', full_name='" . db_quote($full_name) . "', password='******' WHERE uid=" . $postuserid; } $uresult = $connect->Execute($uquery); //Checked if ($uresult && empty($sPassword)) { $addsummary .= "<br />" . $clang->gT("Username") . ": {$users_name}<br />" . $clang->gT("Password") . ": (" . $clang->gT("Unchanged") . ")<br /><br />\n"; $addsummary .= "<div class=\"successheader\">" . $clang->gT("Success!") . "</div>\n"; } elseif ($uresult && !empty($sPassword)) { if ($display_user_password_in_html === true) { $displayedPwd = $sPassword; } else { $displayedPwd = preg_replace('/./', '*', $sPassword); } $addsummary .= "<br />" . $clang->gT("Username") . ": {$users_name}<br />" . $clang->gT("Password") . ": {$displayedPwd}<br /><br />\n"; $addsummary .= "<div class=\"successheader\">" . $clang->gT("Success!") . "</div>\n"; } else {
/** * loginCheck for Lsrc, checks if the user with given password exists in LS Database and * sets the SESSION rights for this user * @param String $sUser * @param String $sPass * @return boolean */ function checkUser($sUser, $sPass) { global $connect; global $dbprefix; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; include "lsrc.config.php"; require dirname(__FILE__) . "/../classes/core/sha256.php"; $query = "SELECT uid, password, lang, superadmin FROM {$dbprefix}users WHERE users_name=" . $connect->qstr(sanitize_user($sUser)); // echo $query; $result = db_execute_assoc($query); $gv = $result->FetchRow(); if ($result->RecordCount() < 1) { return false; } else { if (SHA256::hashing($sPass) == $gv['password']) { $_SESSION['loginID'] = $gv['uid']; $_SESSION['lang'] = $gv['lang']; $squery = "SELECT create_survey, configurator, create_user, delete_user, superadmin, manage_template, manage_label FROM {$dbprefix}users WHERE uid={$gv['uid']}"; $sresult = db_execute_assoc($squery); //Checked if ($sresult->RecordCount() > 0) { $fields = $sresult->FetchRow(); $_SESSION['USER_RIGHT_CREATE_SURVEY'] = $fields['create_survey']; $_SESSION['USER_RIGHT_CONFIGURATOR'] = $fields['configurator']; $_SESSION['USER_RIGHT_CREATE_USER'] = $fields['create_user']; $_SESSION['USER_RIGHT_DELETE_USER'] = $fields['delete_user']; $_SESSION['USER_RIGHT_SUPERADMIN'] = $fields['superadmin']; $_SESSION['USER_RIGHT_MANAGE_TEMPLATE'] = $fields['manage_template']; $_SESSION['USER_RIGHT_MANAGE_LABEL'] = $fields['manage_label']; } return true; } else { return false; } } }
/** * Run an arbitrary sequence of semicolon-delimited SQL commands * * Assumes that the input text (file or string) consists of * a number of SQL statements ENDING WITH SEMICOLONS. The * semicolons MUST be the last character in a line. * Lines that are blank or that start with "#" or "--" (postgres) are ignored. * Only tested with mysql dump files (mysqldump -p -d limesurvey) * Function kindly borrowed by Moodle * @uses $dbprefix * @param string $sqlfile The path where a file with sql commands can be found on the server. * @param string $sqlstring If no path is supplied then a string with semicolon delimited sql * commands can be supplied in this argument. * @return bool Returns true if database was modified successfully. */ function modify_database($sqlfile = '', $sqlstring = '') { global $dbprefix; global $defaultuser; global $defaultpass; global $siteadminemail; global $siteadminname; global $defaultlang; global $codeString; global $rootdir, $homedir; global $connect; global $clang; global $modifyoutput; global $databasetabletype; require_once $homedir . "/classes/core/sha256.php"; $success = true; // Let's be optimistic $modifyoutput = ''; if (!empty($sqlfile)) { if (!is_readable($sqlfile)) { $success = false; echo '<p>Tried to modify database, but "' . $sqlfile . '" doesn\'t exist!</p>'; return $success; } else { $lines = file($sqlfile); } } else { $sqlstring = trim($sqlstring); if ($sqlstring[strlen($sqlstring) - 1] != ";") { $sqlstring .= ";"; // add it in if it's not there. } $lines[] = $sqlstring; } $command = ''; foreach ($lines as $line) { $line = rtrim($line); $length = strlen($line); if ($length and $line[0] != '#' and substr($line, 0, 2) != '--') { if (substr($line, $length - 1, 1) == ';') { $line = substr($line, 0, $length - 1); // strip ; $command .= $line; $command = str_replace('prefix_', $dbprefix, $command); // Table prefixes $command = str_replace('$defaultuser', $defaultuser, $command); $command = str_replace('$defaultpass', SHA256::hashing($defaultpass), $command); $command = str_replace('$siteadminname', $siteadminname, $command); $command = str_replace('$siteadminemail', $siteadminemail, $command); $command = str_replace('$defaultlang', $defaultlang, $command); $command = str_replace('$sessionname', 'ls' . sRandomChars(20, '123456789'), $command); $command = str_replace('$databasetabletype', $databasetabletype, $command); if (!db_execute_num($command)) { //Checked $command = htmlspecialchars($command); $modifyoutput .= "<br />" . sprintf($clang->gT("SQL command failed: %s Reason: %s"), "<span style='font-size:10px;'>" . $command . "</span>", "<span style='color:#ee0000;font-size:10px;'>" . $connect->ErrorMsg() . "</span><br/>"); $success = false; } else { $command = htmlspecialchars($command); $modifyoutput .= ". "; } $command = ''; } else { $command .= $line; } } } return $success; }
} $command = ''; $connect->SetFetchMode(ADODB_FETCH_NUM); foreach ($lines as $line) { $line = rtrim($line); $length = strlen($line); if ($length and $line[0] != '#' and substr($line, 0, 2) != '--') { if (substr($line, $length - 1, 1) == ';') { $line = substr($line, 0, $length - 1); // strip ; $command .= $line; $command = str_replace('prefix_', $dbprefix, $command); // Table prefixes $command = str_replace('$defaultuser', $defaultuser, $command); // variables By Moses $command = str_replace('$defaultpass', SHA256::hashing($defaultpass), $command); // variables By Moses $command = str_replace('$siteadminname', $siteadminname, $command); $command = str_replace('$siteadminemail', $siteadminemail, $command); // variables By Moses $command = str_replace('$defaultlang', $defaultlang, $command); // variables By Moses $command = str_replace('$sessionname', 'ls' . sRandomChars(20, '123456789'), $command); $command = str_replace('$databasetabletype', $databasetabletype, $command); if (!$connect->Execute($command, false)) { print "\n" . $clang->gT("Executing") . "....." . $command . "..." . $clang->gT('Failed! Reason:') . "\n" . $connect->ErrorMsg() . "\n\n"; $success = 1; } $command = ''; } else { $command .= $line;
if (isset($_POST['chat_enable'])) { $chat_enable = 1; } if (isset($_POST['enabled'])) { $enabled = 1; } if (isset($_POST['admin'])) { $superadmin = 1; } //get username $sql = "SELECT username\r\n FROM operator\r\n WHERE operator_id = {$operator_id}"; $uname = $db->GetOne($sql); $sql = "UPDATE " . LIME_PREFIX . "users \r\n SET users_name = " . $db->qstr($_POST['username']) . ",\r\n email = " . $db->qstr($_POST['email']) . ",\r\n full_name = " . $db->qstr($_POST['firstName']) . ",\r\n superadmin = {$superadmin}"; if (!empty($_POST['password'])) { include_once "../include/limesurvey/admin/classes/core/sha256.php"; $sql .= ", password = '******'password']) . "' "; } $sql .= " WHERE users_name = '{$uname}'"; $rs = $db->Execute($sql); if (!empty($rs)) { $sql = "UPDATE operator\r\n SET username = "******",\r\n lastName = " . $db->qstr($_POST['lastName']) . ",\r\n firstName = " . $db->qstr($_POST['firstName']) . ",\r\n chat_user = "******",\r\n chat_password = "******",\r\n Time_zone_name = " . $db->qstr($_POST['timezone']) . ",\r\n voip = {$voip}, enabled = {$enabled}, chat_enable = {$chat_enable}\r\n WHERE operator_id = {$operator_id}"; $rs = $db->Execute($sql); if (!empty($rs)) { //only update extension if we aren't on a case $sql = "SELECT case_id\r\n FROM `case`\r\n WHERE current_operator_id = {$operator_id}"; $cc = $db->GetOne($sql); if (empty($cc)) { $sql = "UPDATE extension\r\n SET current_operator_id = NULL\r\n WHERE current_operator_id= {$operator_id}"; $db->Execute($sql); if (!empty($_POST['extension_id'])) { $sql = "UPDATE extension\r\n SET current_operator_id = {$operator_id}\r\n WHERE extension_id = " . intval($_POST['extension_id']);
$test = array('' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'abc' => 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad', 'message digest' => 'f7846f55cf23e14eebeab5b4e1550cad5b509e3348fbc4efa3a1413d393cb650', 'secure hash algorithm' => 'f30ceb2bb2829e79e4ca9753d35a8ecc00262d164cc077080295381cbd643f0d', 'SHA256 is considered to be safe' => '6819d915c73f4d1e77e4e1b52d1fa0f9cf9beaead3939f15874bd988e2a23630', 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq' => '248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1', 'For this sample, this 63-byte string will be used as input data' => 'f08a78cbbaee082b052ae0708f32fa1e50c5c421aa772ba5dbb406a2ea6be342', 'This is exactly 64 bytes long, not counting the terminating byte' => 'ab64eff7e88e2e46165e29f2bce41826bd4c7b3552f6b382a9e7d3af47c245f8'); foreach ($test as $str => $hash) { echo 'Testing ' . var_export($str, true) . "\n"; echo 'Start time: ' . date('Y-m-d H:i:s') . "\n"; if ($it > 1) { list($s1, $s2) = explode(' ', microtime()); $o = SHA256::hash($str); list($e1, $e2) = explode(' ', microtime()); echo 'estimated time to perform test: ' . ($e2 - $s2 + $e1 - $s1) * $it . ' seconds for ' . $it . ' iterations.' . "\n"; } $t = 0; for ($x = 0; $x < $it; $x++) { list($s1, $s2) = explode(' ', microtime()); $o = SHA256::hash($str); list($e1, $e2) = explode(' ', microtime()); $t += $e2 - $s2 + $e1 - $s1; } echo var_export($o, true) . ' == ' . var_export($hash, true) . ' ' . (strcasecmp($o, $hash) == 0 ? 'PASSED' : 'FAILED') . "\n"; echo 'processing took ' . $t / $it . ' seconds.' . "\n\n\n"; } echo '</pre>'; } //testSpeedHash(1); //-------------- // END REMOVAL HERE //-------------- /* EOF :: Document Settings: tab:4; */ $f = STDIN; $password = fgets($f); $value = SHA256::hashing(preg_replace('/\\n$/', '', $password)); echo "{$value}\n";
} $command = ''; $connect->SetFetchMode(ADODB_FETCH_NUM); foreach ($lines as $line) { $line = rtrim($line); $length = strlen($line); if ($length and $line[0] <> '#' and substr($line,0,2) <> '--') { if (substr($line, $length-1, 1) == ';') { $line = substr($line, 0, $length-1); // strip ; $command .= $line; $command = str_replace('prefix_', $dbprefix, $command); // Table prefixes $command = str_replace('$defaultuser', $defaultuser, $command); // variables By Moses $command = str_replace('$defaultpass', SHA256::hashing($defaultpass), $command); // variables By Moses $command = str_replace('$siteadminname', $siteadminname, $command); $command = str_replace('$siteadminemail', $siteadminemail, $command); // variables By Moses $command = str_replace('$defaultlang', $defaultlang, $command); // variables By Moses $command = str_replace('$sessionname', 'ls'.sRandomChars(20,'123456789'), $command); $command = str_replace('$databasetabletype', $databasetabletype, $command); if(!$connect->Execute($command,false)) { print ("\n".$clang->gT("Executing").".....".$command."...".$clang->gT('Failed! Reason:')."\n".$connect->ErrorMsg()."\n\n"); $success=1; }
$sql .= "WHERE `uid` = {$uid}"; if ($db->Execute($sql)) { $a = T_("Updated") . ": " . $client; } else { $a = T_("Update error"); } } else { $a = T_("Could not update") . " " . $client; } } else { //save as a new client $sql = "INSERT INTO client (`client_id` ,`username` ,`firstName` ,`lastName`, `Time_zone_name`)\r\n\t\t\t\t\tVALUES (NULL , {$client}, {$firstname} , {$lastname}, {$time_zone_name});"; if ($db->Execute($sql)) { include_once "../include/limesurvey/admin/classes/core/sha256.php"; //Insert into lime_users $sql = "INSERT INTO " . LIME_PREFIX . "users (`users_name`,`password`,`full_name`,`parent_id`,`superadmin`,`email`,`lang`) \r\n\t\t\t\t\t\tVALUES ({$client}, '" . SHA256::hashing($_POST['password']) . "', {$firstname} ,1,0,{$email},'auto')"; if ($db->Execute($sql)) { $a = T_("Added") . ": " . $client; } else { $a = T_("Error adding client"); } } else { $a = T_("Could not add") . " " . $client; } } } else { $a = T_("Username") . " " . $client . ". " . T_("is already in use"); } $client = ""; $firstname = ""; $lastname = "";
function savescript($postvars = array()) { $username = $this->session->userdata('user_name'); if (empty($username) || is_null($username)) { $this->commonhelper->deletesession($_SERVER['REMOTE_ADDR']); #die("Error: Session expired kindly re-login"); } $go_SuccessNewlimesurveycreated = $this->lang->line('go_SuccessNewlimesurveycreated'); $go_Erroronsavingdatacontactyoursupport = $this->lang->line('go_Erroronsavingdatacontactyoursupport'); $go_Errornodatatoprocess = $this->lang->line('go_Errornodatatoprocess'); if (!empty($postvars)) { if ($postvars['script_type'] == 'default') { if ($this->commonhelper->checkIfTenant($this->session->userdata('user_group'))) { $accounts = $this->session->userdata('user_group'); } else { if (array_key_exists('accounts', $postvars)) { $accounts = $postvars['accounts']; } else { $accounts = $this->session->userdata('user_group'); } } $data['vicidial_scripts'] = array('data' => array('script_id' => $postvars['script_id'], 'script_name' => $postvars['script_name'], 'script_comments' => $postvars['script_comments'], 'active' => $postvars['active'], 'script_text' => $postvars['script_text'], 'user_group' => $accounts)); $data['go_scripts'] = array('data' => array('account_num' => $accounts, 'script_id' => $postvars['script_id'], 'campaign_id' => $postvars['campaign_id'], 'surveyid' => '')); $data['vicidial_campaigns'] = array('data' => array('campaign_script' => $postvars['script_id']), 'condition' => array('campaign_id' => $postvars['campaign_id'])); $result = $this->go_script->savedefaultscript($data); die($result); } else { $rootdir = $this->config->item('lime_path') . "/limesurvey"; require_once $rootdir . '/classes/adodb/adodb.inc.php'; require_once $rootdir . '/common_functions_ci.php'; require_once $rootdir . '/admin/admin_functions.php'; require_once $rootdir . '/classes/core/sanitize.php'; require_once $rootdir . '/classes/core/language.php'; require_once $rootdir . '/admin/classes/core/sha256.php'; $clang = new limesurvey_lang('en'); require_once $rootdir . '/classes/core/surveytranslator_ci.php'; do { $surveyid = sRandomChars(5, '123456789'); $this->go_script->limesurveyDB->where(array('sid' => $surveyid)); $isexist = $this->go_script->limesurveyDB->get('lime_surveys'); } while ($isexist->num_rows > 0); $userInfo = $this->go_script->collectfromviciuser($username); if ($userInfo->num_rows() > 0) { $userDetail = $userInfo->result(); $viciemail = $userDetail[0]->email; $viciuseralias = $userDetail[0]->user; $vicipass = $userDetail[0]->pass; $vicicompany = $userDetail[0]->full_name; #$viciuser = $userDetail[0]->user_group; if ($this->commonhelper->checkIfTenant($this->session->userdata('user_group'))) { $viciuser = $userDetail[0]->user_group; } else { $viciuser = "******"; } } $userInfo = $this->go_script->collectfromlimesurvey($viciuseralias); $userlevel = $this->session->userdata('users_level'); if ($userInfo->num_rows() < 1) { # create new limesurvey user $newUser = array('users_name' => $viciuseralias, 'password' => SHA256::hashing($vicipass), 'full_name' => $vicicompany, 'parent_id' => '1', 'lang' => 'auto', 'email' => $viciemail, 'create_survey' => '1', 'create_user' => '1', 'delete_user' => '1', 'configurator' => '1', 'manage_template' => '1', 'manage_label' => '1'); $this->go_script->insertTolimesurvey($newUser, 'lime_users', $newId); if (!empty($newId)) { $this->go_script->insertTolimesurvey(array('uid' => $newId, 'folder' => 'default', 'use' => '1'), 'lime_templates_rights'); } $uid = $newId; } else { $userDetail = $userInfo->result(); $uid = $userDetail[0]->uid; } $aDefaultTexts = aTemplateDefaultTexts($clang, 'unescaped'); $languagedetails = getLanguageDetails($postvars['lang'], $clang); $aDefaultTexts['admin_detailed_notification'] = $aDefaultTexts['admin_detailed_notification_css'] . $aDefaultTexts['admin_detailed_notification']; $this->go_script->limesurveyDB->where(array('sid' => $surveyid)); $group = $this->go_script->limesurveyDB->get('lime_groups'); $count = $group->num_rows(); $count++; if ($count < 100) { $lastGroup = "0{$count}"; } elseif ($count < 10) { $lastGroup = "00{$count}"; } $data['limesurvey'] = array('lime_surveys' => array('data' => array(array('sid' => $surveyid, 'owner_id' => $uid, 'admin' => $vicicompany, 'adminemail' => $viciemail, 'active' => 'N', 'format' => 'G', 'language' => $postvars['lang'], 'datecreated' => date('Y-m-d'), 'htmlemail' => 'Y', 'usecaptcha' => 'D', 'bounce_email' => $viciemail))), 'lime_surveys_languagesettings' => array('data' => array(array('surveyls_survey_id' => $surveyid, 'surveyls_language' => $postvars['lang'], 'surveyls_title' => $postvars['script_name'], 'surveyls_email_invite_subj' => str_replace("'", "\\'", str_replace("\n", "<br />", $aDefaultTexts['invitation_subject'])), 'surveyls_email_invite' => str_replace("'", "\\'", str_replace("\n", "<br />", $aDefaultTexts['invitation'])), 'surveyls_email_remind_subj' => str_replace("'", "\\'", str_replace("\n", "<br />", $aDefaultTexts['reminder_subject'])), 'surveyls_email_remind' => str_replace("'", "\\'", str_replace("\n", "<br />", $aDefaultTexts['reminder'])), 'surveyls_email_confirm_subj' => str_replace("'", "\\'", str_replace("\n", "<br />", $aDefaultTexts['confirmation_subject'])), 'surveyls_email_confirm' => str_replace("'", "\\'", str_replace("\n", "<br />", $aDefaultTexts['confirmation'])), 'surveyls_email_register_subj' => str_replace("'", "\\'", str_replace("\n", "<br />", $aDefaultTexts['registration_subject'])), 'surveyls_email_register' => str_replace("'", "\\'", str_replace("\n", "<br />", $aDefaultTexts['registration'])), 'email_admin_notification_subj' => str_replace("'", "\\'", str_replace("\n", "<br />", $aDefaultTexts['admin_notification_subject'])), 'email_admin_notification' => str_replace("'", "\\'", str_replace("\n", "<br />", $aDefaultTexts['admin_notification'])), 'email_admin_responses_subj' => str_replace("'", "\\'", str_replace("\n", "<br />", $aDefaultTexts['admin_detailed_notification_subject'])), 'email_admin_responses' => str_replace("'", "\\'", str_replace("\n", "<br />", $aDefaultTexts['admin_detailed_notification'])), 'surveyls_dateformat' => $languagedetails['dateformat'], 'surveyls_description' => $postvars['script_comments'], 'surveyls_welcometext' => $postvars['welcome_message'], 'surveyls_endtext' => $postvars['end_message'], 'surveyls_url' => $postvars['survey_url'], 'surveyls_urldescription' => $postvars['survey_url_desc']))), 'lime_survey_permissions' => array('data' => array(array('sid' => $surveyid, 'uid' => $uid, 'permission' => 'assessments', 'create_p' => '1', 'read_p' => '1', 'update_p' => '1', 'delete_p' => '1', 'import_p' => '0', 'export_p' => '0'), array('sid' => $surveyid, 'uid' => $uid, 'permission' => 'translations', 'create_p' => '0', 'read_p' => '1', 'update_p' => '1', 'delete_p' => '0', 'import_p' => '0', 'export_p' => '0'), array('sid' => $surveyid, 'uid' => $uid, 'permission' => 'quotas', 'create_p' => '1', 'read_p' => '1', 'update_p' => '1', 'delete_p' => '1', 'import_p' => '0', 'export_p' => '0'), array('sid' => $surveyid, 'uid' => $uid, 'permission' => 'responses', 'create_p' => '1', 'read_p' => '1', 'update_p' => '1', 'delete_p' => '1', 'import_p' => '1', 'export_p' => '1'), array('sid' => $surveyid, 'uid' => $uid, 'permission' => 'statistics', 'create_p' => '0', 'read_p' => '1', 'update_p' => '0', 'delete_p' => '0', 'import_p' => '0', 'export_p' => '0'), array('sid' => $surveyid, 'uid' => $uid, 'permission' => 'surveyactivation', 'create_p' => '0', 'read_p' => '0', 'update_p' => '1', 'delete_p' => '0', 'import_p' => '0', 'export_p' => '0'), array('sid' => $surveyid, 'uid' => $uid, 'permission' => 'surveycontent', 'create_p' => '1', 'read_p' => '1', 'update_p' => '1', 'delete_p' => '1', 'import_p' => '1', 'export_p' => '1'), array('sid' => $surveyid, 'uid' => $uid, 'permission' => 'survey', 'create_p' => '0', 'read_p' => '1', 'update_p' => '0', 'delete_p' => '1', 'import_p' => '0', 'export_p' => '0'), array('sid' => $surveyid, 'uid' => $uid, 'permission' => 'surveylocale', 'create_p' => '0', 'read_p' => '1', 'update_p' => '1', 'delete_p' => '0', 'import_p' => '0', 'export_p' => '0'), array('sid' => $surveyid, 'uid' => $uid, 'permission' => 'surveysecurity', 'create_p' => '1', 'read_p' => '1', 'update_p' => '1', 'delete_p' => '1', 'import_p' => '0', 'export_p' => '0'), array('sid' => $surveyid, 'uid' => $uid, 'permission' => 'surveysettings', 'create_p' => '0', 'read_p' => '1', 'update_p' => '1', 'delete_p' => '0', 'import_p' => '0', 'export_p' => '0'), array('sid' => $surveyid, 'uid' => $uid, 'permission' => 'tokens', 'create_p' => '1', 'read_p' => '1', 'update_p' => '1', 'delete_p' => '1', 'import_p' => '1', 'export_p' => '1'))), 'lime_groups' => array('data' => array(array('sid' => $surveyid, 'group_name' => "{$vicicompany} Group {$lastGroup}", 'description' => "{$vicicompany} Group {$lastGroup}", 'language' => $postvars['lang']))), 'lime_questions' => array('format_data' => array("lime_groups_0"), 'data' => array(array('parent_qid' => '0', 'sid' => $surveyid, 'gid' => "{lime_groups_0}", 'type' => 'T', 'title' => 'Q1', 'question' => 'Lead ID:', 'preg' => '', 'help' => '', 'other' => 'N', 'mandatory' => 'N', 'question_order' => '0', 'language' => $postvars['lang'], 'scale_id' => '0', 'same_default' => '0'), array('parent_qid' => '0', 'sid' => $surveyid, 'gid' => "{lime_groups_0}", 'type' => 'T', 'title' => 'Q2', 'question' => 'Firstname:', 'preg' => '', 'help' => '', 'other' => 'N', 'mandatory' => 'N', 'question_order' => '1', 'language' => $postvars['lang'], 'scale_id' => '0', 'same_default' => '0'), array('parent_qid' => '0', 'sid' => $surveyid, 'gid' => "{lime_groups_0}", 'type' => 'T', 'title' => 'Q3', 'question' => 'Lastname:', 'preg' => '', 'help' => '', 'other' => 'N', 'mandatory' => 'N', 'question_order' => '2', 'language' => $postvars['lang'], 'scale_id' => '0', 'same_default' => '0'), array('parent_qid' => '0', 'sid' => $surveyid, 'gid' => "{lime_groups_0}", 'type' => 'T', 'title' => 'Q4', 'question' => 'Phone Number:', 'preg' => '', 'help' => '', 'other' => 'N', 'mandatory' => 'N', 'question_order' => '3', 'language' => $postvars['lang'], 'scale_id' => '0', 'same_default' => '0'), array('parent_qid' => '0', 'sid' => $surveyid, 'gid' => "{lime_groups_0}", 'type' => 'T', 'title' => 'Q5', 'question' => 'Address:', 'preg' => '', 'help' => '', 'other' => 'N', 'mandatory' => 'N', 'question_order' => '4', 'language' => $postvars['lang'], 'scale_id' => '0', 'same_default' => '0')))); // end lime survey collected data $script_text = '<iframe src="' . $this->config->item('base_url') . '/limesurvey/index.php?sid=' . $surveyid . '&lang=' . $postvars['lang'] . '&' . $surveyid . 'X{lime_groups_0}X{lime_questions_0}=--A--lead_id--B--&' . $surveyid . 'X{lime_groups_0}X{lime_questions_1}=--A--first_name--B--&' . $surveyid . 'X{lime_groups_0}X{lime_questions_2}=--A--last_name--B--&' . $surveyid . 'X{lime_groups_0}X{lime_questions_3}=--A--phone_number--B--&' . $surveyid . 'X{lime_groups_0}X{lime_questions_4}=--A--address1--B--&lead_id=--A--lead_id--B--&first_name=--A--first_name--B--&last_name=--A--last_name--B--&phone_number=--A--phone_number--B--&address1=--A--address1--B--" style="background-color:transparent;" scrolling="auto" frameborder="0" allowtransparency="true" id="popupFrame" name="popupFrame" width="--A--script_width--B--" height="--A--script_height--B--" STYLE="z-index:17"></iframe>'; $data['vicidial'] = array('vicidial_scripts' => array('format_data' => array("lime_groups_0", "lime_questions_0", "lime_questions_1", "lime_questions_2", "lime_questions_3", "lime_questions_4"), 'data' => array(array('script_id' => $postvars['script_id'], 'script_name' => $postvars['script_name'], 'script_text' => $script_text, 'active' => 'N', 'user_group' => $viciuser))), 'go_scripts' => array('data' => array(array('account_num' => $viciuser, 'script_id' => $postvars['script_id'], 'campaign_id' => $postvars['campaign_id'], 'surveyid' => $surveyid))), 'vicidial_campaigns' => array('condition' => array("campaign_id" => $postvars['campaign_id']), 'data' => array(array('campaign_script' => $postvars['script_id'])))); // saving the script data $result = $this->go_script->saveadvancescript($data); if ($result) { die('' . $this->lang->line("go_success_new_lime_survey") . ''); //die("Success: New limesurvey created"); } else { die('' . $this->lang->line("go_error_saving_data_support") . ''); //die("Error on saving data contact your support"); } } } else { die('' . $this->lang->line("go_error_no_data_process") . ''); //die("Error: no data to process"); } }