<?php

require_once 'vtlib/Vtiger/Package.php';
require_once 'vtlib/Vtiger/Module.php';
$package = new Vtiger_Package();
$package->export(Vtiger_Module::getInstance('Deliverynote'), 'test/vtlib', 'Deliverynote.zip', true);
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><title><?php 
    echo $title;
    ?>
</title>
<style type="text/css">@import url("themes/softed/style.css");br { display: block; margin: 2px; }</style>
</head><body class=small style="font-size: 12px; margin: 2px; padding: 2px;">
<?php 
}
set_time_limit(0);
ini_set('memory_limit', '1024M');
if (empty($_REQUEST['modulename'])) {
    echo '<br><br><b>Necessary Parameter {modulename} not present</b><br>';
} else {
    $modulename = vtlib_purify($_REQUEST['modulename']);
    $module = Vtiger_Module::getInstance($modulename);
    if ($module) {
        $pkg = new Vtiger_Package();
        $pkg->export($module, 'build', $modulename . '.zip', $dl);
        if ($dl) {
            die;
        }
        echo "<b>Package should be exported to the build directory of your install.</b><br>";
    } else {
        echo "<b>Failed to find " . $modulename . " module.</b><br>";
    }
}
?>
</body>
</html>
Пример #3
0
 function applyChange()
 {
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset cbupdate_example already applied!');
     } else {
         // do your magic here
         $this->ExecuteQuery('select 1 from vtiger_cbupdater');
         $this->ExecuteQuery('select 1 from vtiger_cbupder');
         $package = new Vtiger_Package();
         ob_start();
         $rdo = $package->importManifest('build/French/manifest.xml');
         $out = ob_get_contents();
         ob_end_clean();
         $this->sendMsg($out);
         if ($rdo) {
             $this->sendMsg('french installed!');
         } else {
             $this->sendMsg('NO french!');
         }
         $this->sendMsg('Changeset cbupdate_example applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
Пример #4
0
 public function updateUserModuleStep3(Vtiger_Request $request)
 {
     $importModuleName = $request->get('module_import_name');
     $uploadFile = $request->get('module_import_file');
     $uploadDir = Settings_ModuleManager_Extension_Model::getUploadDirectory();
     $uploadFileName = "{$uploadDir}/{$uploadFile}";
     checkFileAccess($uploadFileName);
     $importType = $request->get('module_import_type');
     if (strtolower($importType) == 'language') {
         $package = new Vtiger_Language();
     } else {
         if (strtolower($importType) == 'layout') {
             $package = new Vtiger_Layout();
         } else {
             $package = new Vtiger_Package();
         }
     }
     if (strtolower($importType) == 'language' || strtolower($importType) == 'layout') {
         $package->import($uploadFileName);
     } else {
         $package->update(Vtiger_Module::getInstance($importModuleName), $uploadFileName);
     }
     checkFileAccessForDeletion($uploadFileName);
     unlink($uploadFileName);
     $result = array('success' => true, 'importModuleName' => $importModuleName);
     $response = new Vtiger_Response();
     $response->setResult($result);
     $response->emit();
 }
Пример #5
0
	/**
	 * Function to get package of this instance
	 * @return <Vtiger_Package> package object
	 */
	public function getPackage() {
		$packageModel = new Vtiger_Package();
		$moduleName = $packageModel->getModuleNameFromZip(self::getUploadDirectory(). '/' .$this->getFileName());
		if ($moduleName) {
			return $packageModel;
		}
		return false;
	}
Пример #6
0
 function applyChange()
 {
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         $module = 'Mobile';
         if ($this->isModuleInstalled($module)) {
             //Update module
             $package = new Vtiger_Package();
             $moduleInstance = Vtiger_Module::getInstance($module);
             $package->loadManifestFromFile('modules/' . $module . '/manifest.xml');
             $rdo = $package->update_Module($moduleInstance);
             $this->sendMsg('Module updated: ' . $module);
         } else {
             $this->installManifestModule($module);
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
Пример #7
0
 public function importUserModuleStep2(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $uploadDir = Settings_ModuleManager_Extension_Model::getUploadDirectory();
     $qualifiedModuleName = $request->getModule(false);
     $uploadFile = 'usermodule_' . time() . '.zip';
     $uploadFileName = "{$uploadDir}/{$uploadFile}";
     checkFileAccess($uploadDir);
     if (!move_uploaded_file($_FILES['moduleZip']['tmp_name'], $uploadFileName)) {
         $viewer->assign('MODULEIMPORT_FAILED', true);
     } else {
         $package = new Vtiger_Package();
         $importModuleName = $package->getModuleNameFromZip($uploadFileName);
         $importModuleDepVtVersion = $package->getDependentVtigerVersion();
         if ($importModuleName == null) {
             $viewer->assign('MODULEIMPORT_FAILED', true);
             $viewer->assign("MODULEIMPORT_FILE_INVALID", true);
             checkFileAccessForDeletion($uploadFileName);
             unlink($uploadFileName);
         } else {
             // We need these information to push for Update if module is detected to be present.
             $moduleLicence = vtlib_purify($package->getLicense());
             $viewer->assign("MODULEIMPORT_FILE", $uploadFile);
             $viewer->assign("MODULEIMPORT_TYPE", $package->type());
             $viewer->assign("MODULEIMPORT_NAME", $importModuleName);
             $viewer->assign("MODULEIMPORT_DEP_VTVERSION", $importModuleDepVtVersion);
             $viewer->assign("MODULEIMPORT_LICENSE", $moduleLicence);
             if (!$package->isLanguageType() && !$package->isModuleBundle()) {
                 $moduleInstance = Vtiger_Module::getInstance($importModuleName);
                 $moduleimport_exists = $moduleInstance ? "true" : "false";
                 $moduleimport_dir_name = "modules/{$importModuleName}";
                 $moduleimport_dir_exists = is_dir($moduleimport_dir_name) ? "true" : "false";
                 $viewer->assign("MODULEIMPORT_EXISTS", $moduleimport_exists);
                 $viewer->assign("MODULEIMPORT_DIR", $moduleimport_dir_name);
                 $viewer->assign("MODULEIMPORT_DIR_EXISTS", $moduleimport_dir_exists);
             }
         }
     }
     $viewer->view('ImportUserModuleStep2.tpl', $qualifiedModuleName);
 }
Пример #8
0
$smarty->assign("APP", $app_strings);
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", "themes/{$theme}/images/");
global $modulemanager_uploaddir;
// Defined in modules/Settings/ModuleManager.php
if ($module_import_step == 'Step2') {
    if (!is_dir($modulemanager_uploaddir)) {
        mkdir($modulemanager_uploaddir);
    }
    $uploadfile = "usermodule_" . time() . ".zip";
    $uploadfilename = "{$modulemanager_uploaddir}/{$uploadfile}";
    checkFileAccess($modulemanager_uploaddir);
    if (!move_uploaded_file($_FILES['module_zipfile']['tmp_name'], $uploadfilename)) {
        $smarty->assign("MODULEIMPORT_FAILED", "true");
    } else {
        $package = new Vtiger_Package();
        $moduleimport_name = $package->getModuleNameFromZip($uploadfilename);
        if ($moduleimport_name == null) {
            $smarty->assign("MODULEIMPORT_FAILED", "true");
            $smarty->assign("MODULEIMPORT_FILE_INVALID", "true");
        } else {
            if (!$package->isLanguageType()) {
                $moduleInstance = Vtiger_Module::getInstance($moduleimport_name);
                $moduleimport_exists = $moduleInstance ? "true" : "false";
                $moduleimport_dir_name = "modules/{$moduleimport_name}";
                $moduleimport_dir_exists = is_dir($moduleimport_dir_name) ? "true" : "false";
                $smarty->assign("MODULEIMPORT_EXISTS", $moduleimport_exists);
                $smarty->assign("MODULEIMPORT_DIR", $moduleimport_dir_name);
                $smarty->assign("MODULEIMPORT_DIR_EXISTS", $moduleimport_dir_exists);
            }
            $moduleimport_dep_vtversion = $package->getDependentVtigerVersion();
include_once 'vtlib/Vtiger/Module.php';
global $current_user, $adb;
$dl = vtlib_purify($_REQUEST['download']);
$dl = !empty($dl);
if (!$dl) {
    header('Content-Type: text/html; charset=UTF8');
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><title><?php 
    echo $title;
    ?>
</title>
<style type="text/css">@import url("themes/softed/style.css");br { display: block; margin: 2px; }</style>
</head><body class=small style="font-size: 12px; margin: 2px; padding: 2px;">
<?php 
}
set_time_limit(0);
ini_set('memory_limit', '1024M');
if (empty($_REQUEST['modulename'])) {
    echo '<br><br><b>Necessary Parameter {modulename} not present</b><br>';
} else {
    $modulename = vtlib_purify($_REQUEST['modulename']);
    Vtiger_Package::packageFromFilesystem($modulename, false, $dl);
    if ($dl) {
        die;
    }
    echo "<b>Package should be exported to the packages/optional directory of your install.</b><br>";
}
?>
</body>
</html>
Пример #10
0
 public function installCurrentVersion()
 {
     $this->connect();
     $updateURL = $this->getUpdateUrl();
     $filename = sys_get_temp_dir() . "/autoupdater." . md5($updateURL) . ".zip";
     global $root_directory;
     if (!is_writeable(sys_get_temp_dir()) && is_writeable($root_directory . "/test/")) {
         $filename = $root_directory . "/test/autoupdater.zip";
     }
     if (!is_writeable(sys_get_temp_dir()) && !is_writeable($root_directory . "/test/")) {
         echo "<strong style='color:red;'>ERROR</strong> - You need to make the <b>test</b> directory inside vtiger root writable for webserver user!";
         return;
     }
     $data = $this->_client->call("downloadVersion", array(base64_encode($updateURL), sha1(base64_encode($updateURL) . "ASD,.2#*")));
     if (!empty($_REQUEST["stefanDebug"])) {
         /* ONLY DEBUG*/
         echo "<pre>";
         var_dump($this->_client->debug_str);
     }
     $data = base64_decode($data);
     file_put_contents($filename, $data);
     $package = new \Vtiger_Package();
     $package->update(\Vtiger_Module::getInstance($this->_extension), $filename);
 }
Пример #11
0
$taskManager->saveTask($task);
$task = $taskManager->createTask('VTEntityMethodTask', $helpDeskWorkflow->id);
$task->active = true;
$task->summary = 'Notify Related Customer on Ticket Change, which is not done from Portal';
$task->methodName = "NotifyParentOnTicketChange";
$taskManager->saveTask($task);
putMsg('Workflow "' . $helpDeskWorkflow->description . '" created!');
$delmods = array('EmailTemplates', 'Google');
foreach ($delmods as $module) {
    $mod = Vtiger_Module::getInstance($module);
    if ($mod) {
        $mod->deleteRelatedLists();
        $mod->deleteLinks();
        $mod->deinitWebservice();
        $mod->delete();
        echo "<b>Module {$module} EXTERMINATED!</b><br>";
    }
}
$delmods = array('ar_ae', 'sv_se', 'tr_tr', 'pl_pl', 'ro_ro', 'ru_ru');
require_once 'vtlib/Vtiger/Language.php';
foreach ($delmods as $prefix) {
    $languagePack = new Vtiger_Language();
    @$languagePack->deregister($prefix);
}
$insmods = array('CronTasks', 'ConfigEditor', 'PBXManager', 'cbupdater');
foreach ($insmods as $module) {
    $package = new Vtiger_Package();
    $rdo = $package->importManifest("modules/{$module}/manifest.xml");
}
$mod = Vtiger_Module::getInstance('ModTracker');
$mod->addLink('HEADERSCRIPT', 'ModTrackerCommon_JS', 'modules/ModTracker/ModTrackerCommon.js');
Пример #12
0
<?php

/*+********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 ********************************************************************************/
$module_export = vtlib_purify($_REQUEST['module_export']);
require_once "vtlib/Vtiger/Package.php";
require_once "vtlib/Vtiger/Module.php";
$package = new Vtiger_Package();
$module = Vtiger_Module::getInstance($module_export);
if ($module) {
    if (isset($_REQUEST['manifestfs'])) {
        Vtiger_Package::packageFromFilesystem($module_export, false, true);
    } else {
        $package->export($module, '', "{$module_export}.zip", true);
    }
} else {
    global $adb, $vtiger_current_version;
    $lngrs = $adb->pquery('select * from vtiger_language where prefix=?', array($module_export));
    if ($lngrs and $adb->num_rows($lngrs) == 1) {
        // we have a language file
        $lnginfo = $adb->fetch_array($lngrs);
        $lngxml = 'include/language/' . $lnginfo['prefix'] . '.manifest.xml';
        if (!file_exists($lngxml)) {
            $mnf = fopen($lngxml, 'w');
            fwrite($mnf, "<?xml version='1.0'?>\n");
<?php

@error_reporting(0);
@ini_set('display_errors', 'off');
@set_time_limit(0);
@ini_set('memory_limit', '1024M');
if (count($argv) == 3) {
    $module = $argv[1];
    $type = $argv[2];
    require_once 'vtlib/Vtiger/Module.php';
    require_once 'vtlib/Vtiger/Package.php';
    global $current_user, $adb;
    $Vtiger_Utils_Log = false;
    // Turn off debugging level
    $current_user = Users::getActiveAdminUser();
    $package = new Vtiger_Package();
    $tabrs = $adb->pquery('select count(*) from vtiger_tab where name=?', array($module));
    if ($tabrs and $adb->query_result($tabrs, 0, 0) == 1) {
        // it exists already so we are updating
        if (strtolower($type) == 'language') {
            // just copy files and activate
            vtlib_toggleModuleAccess($module, true);
        } else {
            $moduleInstance = Vtiger_Module::getInstance($module);
            $package->loadManifestFromFile('modules/' . $module . '/manifest.xml');
            $rdo = $package->update_Module($moduleInstance);
        }
        echo "Module updated: {$module} \n";
    } else {
        if (strtolower($type) == 'language') {
            $rdo = $package->importManifest('include/language/' . $module . '.manifest.xml');
Пример #14
0
/*+********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 *********************************************************************************/
//5.1.0 RC to 5.1.0 database changes
//we have to use the current object (stored in PatchApply.php) to execute the queries
$adb = $_SESSION['adodb_current_object'];
$conn = $_SESSION['adodb_current_object'];
$migrationlog->debug("\n\nDB Changes from 5.1.0 RC to 5.1.0 -------- Starts \n\n");
require_once 'vtlib/Vtiger/Package.php';
require_once 'vtlib/Vtiger/Module.php';
$package = new Vtiger_Package();
ExecuteQuery("DELETE vtiger_cvcolumnlist FROM vtiger_cvcolumnlist INNER JOIN vtiger_customview WHERE vtiger_cvcolumnlist.columnname LIKE '%vtiger_notes:filename%' AND vtiger_customview.cvid = vtiger_cvcolumnlist.cvid AND vtiger_customview.entitytype='HelpDesk'");
ExecuteQuery("DELETE vtiger_cvcolumnlist FROM vtiger_cvcolumnlist INNER JOIN vtiger_customview WHERE (vtiger_cvcolumnlist.columnname LIKE '%parent_id%' OR vtiger_cvcolumnlist.columnname LIKE '%vtiger_contactdetails%') AND vtiger_customview.cvid = vtiger_cvcolumnlist.cvid AND vtiger_customview.entitytype='Documents'");
ExecuteQuery("DELETE vtiger_cvadvfilter FROM vtiger_cvadvfilter INNER JOIN vtiger_customview WHERE vtiger_cvadvfilter.columnname LIKE '%vtiger_notes:filename%' AND vtiger_customview.cvid = vtiger_cvadvfilter.cvid AND vtiger_customview.entitytype='HelpDesk'");
ExecuteQuery("DELETE vtiger_cvadvfilter FROM vtiger_cvadvfilter INNER JOIN vtiger_customview WHERE (vtiger_cvadvfilter.columnname LIKE '%parent_id%' OR vtiger_cvadvfilter.columnname LIKE '%vtiger_contactdetails%') AND vtiger_customview.cvid = vtiger_cvadvfilter.cvid AND vtiger_customview.entitytype='Documents'");
// Update PBXManager module files
$moduleInstance = Vtiger_Module::getInstance('PBXManager');
$package->initUpdate($moduleInstance, 'packages/5.1.0/mandatory/PBXManager.zip', true);
// Update ServiceContracts module files
$moduleInstance = Vtiger_Module::getInstance('ServiceContracts');
$package->initUpdate($moduleInstance, 'packages/5.1.0/mandatory/ServiceContracts.zip', true);
// Update Services module files
$moduleInstance = Vtiger_Module::getInstance('Services');
$package->initUpdate($moduleInstance, 'packages/5.1.0/mandatory/Services.zip', true);
// Install/Update Optional modules
require_once 'include/utils/installVtlibSelectedModules.php';
Пример #15
0
 public static function installSelectedOptionalModules($selected_modules, $source_directory = '', $destination_directory = '')
 {
     require_once 'vtlib/Vtiger/Package.php';
     require_once 'vtlib/Vtiger/Module.php';
     require_once 'include/utils/utils.php';
     $selected_modules = explode(":", $selected_modules);
     $languagePacks = array();
     if ($handle = opendir('packages/vtiger/optional')) {
         while (false !== ($file = readdir($handle))) {
             $filename_arr = explode(".", $file);
             if ($filename_arr[count($filename_arr) - 1] != 'zip') {
                 continue;
             }
             $packagename = $filename_arr[0];
             $packagepath = "packages/vtiger/optional/{$file}";
             $package = new Vtiger_Package();
             $module = $package->getModuleNameFromZip($packagepath);
             if (!empty($packagename) && in_array($module, $selected_modules)) {
                 if ($package->isLanguageType($packagepath)) {
                     $languagePacks[$module] = $packagepath;
                     continue;
                 }
                 if ($module != null) {
                     if ($package->isModuleBundle()) {
                         $unzip = new Vtiger_Unzip($packagepath);
                         $unzip->unzipAllEx($package->getTemporaryFilePath());
                         $moduleInfoList = $package->getAvailableModuleInfoFromModuleBundle();
                         foreach ($moduleInfoList as $moduleInfo) {
                             $moduleInfo = (array) $moduleInfo;
                             $packagepath = $package->getTemporaryFilePath($moduleInfo['filepath']);
                             $subModule = new Vtiger_Package();
                             $subModuleName = $subModule->getModuleNameFromZip($packagepath);
                             $moduleInstance = Vtiger_Module::getInstance($subModuleName);
                             if ($moduleInstance) {
                                 updateVtlibModule($subModuleName, $packagepath);
                             } else {
                                 installVtlibModule($subModuleName, $packagepath);
                             }
                         }
                     } else {
                         $moduleInstance = Vtiger_Module::getInstance($module);
                         if ($moduleInstance) {
                             updateVtlibModule($module, $packagepath);
                         } else {
                             installVtlibModule($module, $packagepath);
                         }
                     }
                 }
             }
         }
         closedir($handle);
     }
     foreach ($languagePacks as $module => $packagepath) {
         installVtlibModule($module, $packagepath);
         continue;
     }
 }
Пример #16
0
<?php

/*+********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 ********************************************************************************/
$module_export = $_REQUEST['module_export'];
require_once "vtlib/Vtiger/Package.php";
require_once "vtlib/Vtiger/Module.php";
$package = new Vtiger_Package();
$package->export(Vtiger_Module::getInstance($module_export), '', "{$module_export}.zip", true);
exit;
Пример #17
0
<?php

// Turn on debugging level
$Vtiger_Utils_Log = true;
require_once 'vtlib/Vtiger/Module.php';
require_once 'vtlib/Vtiger/Package.php';
global $current_user, $adb;
set_time_limit(0);
ini_set('memory_limit', '1024M');
$current_user = new Users();
$current_user->retrieveCurrentUserInfoFromFile(1);
// admin
$package = new Vtiger_Package();
//$rdo = $package->importManifest('modules/cbupdater/manifest.xml');
//$rdo = $package->importManifest('modules/Webforms/manifest.xml');
//$package->initImport('TSEmail_540.zip', true);
$rdo = $package->importManifest('include/language/it_it.manifest.xml');
Пример #18
0
 /**
  * Function installs all the available modules
  */
 public static function installModules()
 {
     require_once 'vtlib/Vtiger/Package.php';
     require_once 'vtlib/Vtiger/Module.php';
     require_once 'include/utils/utils.php';
     $moduleFolders = array('packages/vtiger/mandatory', 'packages/vtiger/optional');
     foreach ($moduleFolders as $moduleFolder) {
         if ($handle = opendir($moduleFolder)) {
             while (false !== ($file = readdir($handle))) {
                 $packageNameParts = explode(".", $file);
                 if ($packageNameParts[count($packageNameParts) - 1] != 'zip') {
                     continue;
                 }
                 array_pop($packageNameParts);
                 $packageName = implode("", $packageNameParts);
                 if (!empty($packageName)) {
                     $packagepath = "{$moduleFolder}/{$file}";
                     $package = new Vtiger_Package();
                     $module = $package->getModuleNameFromZip($packagepath);
                     if ($module != null) {
                         $moduleInstance = Vtiger_Module::getInstance($module);
                         if ($moduleInstance) {
                             updateVtlibModule($module, $packagepath);
                         } else {
                             installVtlibModule($module, $packagepath);
                         }
                     }
                 }
             }
             closedir($handle);
         }
     }
 }
global $current_user, $adb;
$dl = vtlib_purify($_REQUEST['download']);
$dl = !empty($dl);
if (!$dl) {
    header('Content-Type: text/html; charset=UTF8');
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><title><?php 
    echo $title;
    ?>
</title>
<style type="text/css">@import url("themes/softed/style.css");br { display: block; margin: 2px; }</style>
</head><body class=small style="font-size: 12px; margin: 2px; padding: 2px;">
<?php 
}
set_time_limit(0);
ini_set('memory_limit', '1024M');
if (empty($_REQUEST['languagecode']) or empty($_REQUEST['languagename'])) {
    echo '<br><br><b>Necessary Parameters {languagecode} or {languagename} not present</b><br>';
} else {
    $languagecode = vtlib_purify($_REQUEST['languagecode']);
    $languagename = vtlib_purify($_REQUEST['languagename']);
    Vtiger_Package::languageFromFilesystem($languagecode, $languagename, $dl);
    if ($dl) {
        die;
    }
    echo "<b>Language Package should be exported to the packages/optional directory of your install.</b><br>";
}
?>
</body>
</html>
Пример #20
0
        echo '
		<tr width="100%">
		<td width="25%">' . $status . '</td>
		<td width="5%"><font color="red"> F </font></td>
		<td width="70%">' . $query . '</td>
		</tr>';
        $failure_query_array[$failure_query_count++] = $query;
        $log->debug("Query Failed ==> {$query} \n Error is ==> [" . $adb->database->ErrorNo() . "]" . $adb->database->ErrorMsg());
    }
}
function putMsg($msg)
{
    echo '<tr width="100%"><td colspan=3>' . $msg . '</td></tr>';
}
echo "<table width=80% align=center border=1>";
$package = new Vtiger_Package();
ob_start();
$rdo = $package->importManifest("modules/cbupdater/manifest.xml");
$out = ob_get_contents();
ob_end_clean();
putMsg($out);
if ($rdo) {
    putMsg("{$module} installed: <a href='index.php?module=cbupdater&action=getupdates'>proceed to the rest of the updates by clicking here</a>");
} else {
    putMsg("ERROR installing {$module}!");
}
?>
</table>
<br /><br />
<b style="color:#FF0000">Failed Queries Log</b>
<div id="failedLog" style="border:1px solid #666666;width:90%;position:relative;height:200px;overflow:auto;left:5%;top:10px;">
Пример #21
0
@error_reporting(0);
@ini_set('display_errors', 'off');
@set_time_limit(0);
@ini_set('memory_limit', '1024M');
if (count($argv) == 3) {
    $module = $argv[1];
    $type = $argv[2];
    require_once 'vtlib/Vtiger/Module.php';
    require_once 'vtlib/Vtiger/Package.php';
    global $current_user, $adb;
    $Vtiger_Utils_Log = false;
    // Turn off debugging level
    $current_user = new Users();
    $current_user->retrieveCurrentUserInfoFromFile(1);
    // admin
    $package = new Vtiger_Package();
    $tabrs = $adb->pquery('select count(*) from vtiger_tab where name=?', array($module));
    if ($tabrs and $adb->query_result($tabrs, 0, 0) == 1) {
        vtlib_toggleModuleAccess($module, true);
        echo "Module activated: {$module} \n";
    } else {
        if (strtolower($type) == 'language') {
            $rdo = $package->importManifest('include/language/' . $module . '.manifest.xml');
        } else {
            $rdo = $package->importManifest('modules/' . $module . '/manifest.xml');
        }
        echo "Module installed: {$module} \n";
    }
} else {
    echo "\n Incorrect amount of parameters \n";
}
Пример #22
0
function installOptionalModules($selected_modules)
{
    global $log;
    require_once 'vtlib/Vtiger/Package.php';
    require_once 'vtlib/Vtiger/Module.php';
    $selected_modules = split(":", $selected_modules);
    if ($handle = opendir('packages/5.1.0/optional')) {
        while (false !== ($file = readdir($handle))) {
            $filename_arr = explode(".", $file);
            $packagename = $filename_arr[0];
            if (!empty($packagename)) {
                $packagepath = "packages/5.1.0/optional/{$file}";
                $package = new Vtiger_Package();
                $module = $package->getModuleNameFromZip($packagepath);
                if ($module != null) {
                    $moduleInstance = Vtiger_Module::getInstance($module);
                    if (in_array($packagename, $selected_modules)) {
                        if ($moduleInstance) {
                            initUpdateVtlibModule($module, $packagepath);
                        } else {
                            installVtlibModule($packagename, $packagepath);
                        }
                    } elseif ($moduleInstance) {
                        initUpdateVtlibModule($module, $packagepath);
                        vtlib_toggleModuleAccess((string) $module, false);
                    }
                }
            }
        }
        closedir($handle);
    }
}
Пример #23
0
	public function handle() {
		if ($this->interactive) {
			echo "------------------------------------ >>> UPDATE MODULE <<< ---\n";
			do {
				$path = $this->prompt("Enter package path: ", self::PROMPT_PATH);
				if (file_exists($path)) {
					break;
				}
				echo "ERROR: " . $path . " - file not found, try another.\n";
			} while (true);
		} else {
			$path = array_shift($this->arguments);
		}
		
		if (file_exists($path)) {
			$package = new Vtiger_Package();
			$module  = $package->getModuleNameFromZip($path);
			
			$moduleInstance = Vtiger_Module::getInstance($module);
			if (!$moduleInstance) {
				echo "ERROR: Module $module not found!\n";
			} else {
				echo "Updating ...";
				$package->update($moduleInstance, $path);
				echo "DONE.\n";
			}			
			
		} else {
			throw new Exception("Package file $path not found.");
		}
		
		echo "----------------------------------\n\n";
	}
 /**
  * Constructor
  */
 function __construct()
 {
     parent::__construct();
 }
Пример #25
0
 public function updateUserModuleStep3(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $qualifiedModuleName = $request->getModule(false);
     $importModuleName = $request->get('module_import_name');
     $uploadFile = $request->get('module_import_file');
     $uploadDir = Settings_ModuleManager_Extension_Model::getUploadDirectory();
     $uploadFileName = "{$uploadDir}/{$uploadFile}";
     checkFileAccess($uploadFileName);
     $importType = $request->get('module_import_type');
     if (strtolower($importType) == 'language') {
         $package = new Vtiger_Language();
     } else {
         $package = new Vtiger_Package();
     }
     if (strtolower($importType) == 'language') {
         $package->import($uploadFileName);
     } else {
         $package->update(Vtiger_Module::getInstance($importModuleName), $uploadFileName);
     }
     checkFileAccessForDeletion($uploadFileName);
     unlink($uploadFileName);
     $viewer->assign("UPDATE_MODULE_NAME", $importModuleName);
     $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
     $viewer->view('UpdateUserModuleStep3.tpl', $qualifiedModuleName);
 }
Пример #26
0
 for ($i = 0; $i < $za->numFiles; $i++) {
     $entryName = $za->getNameIndex($i);
     $firstSlash = strpos($entryName, '/');
     if ($entryName === 'manifest.xml' || $entryName === './manifest.xml' || $firstSlash === false) {
         $za->unchangeAll();
         break;
     }
     $newEntryName = substr($entryName, $firstSlash + 1);
     if ($newEntryName !== false) {
         $za->renameIndex($i, $newEntryName);
     } else {
         $za->deleteIndex($i);
     }
 }
 $za->close();
 $package = new Vtiger_Package();
 $moduleupdate_name = $package->getModuleNameFromZip($uploadfilename);
 if ($moduleupdate_name == null) {
     $smarty->assign("MODULEUPDATE_FAILED", "true");
     $smarty->assign("MODULEUPDATE_FILE_INVALID", "true");
 } else {
     if (!$package->isLanguageType() && $moduleupdate_name != $target_modulename) {
         $smarty->assign("MODULEUPDATE_FAILED", "true");
         $smarty->assign("MODULEUPDATE_NAME_MISMATCH", "true");
     } else {
         if ($package->isLanguageType() && trim($package->xpath_value('prefix')) != $target_modulename) {
             $smarty->assign("MODULEUPDATE_FAILED", "true");
             $smarty->assign("MODULEUPDATE_NAME_MISMATCH", "true");
         } else {
             $moduleupdate_dep_vtversion = $package->getDependentVtigerVersion();
             $moduleupdate_license = $package->getLicense();
Пример #27
0
function initUpdateVtlibModule($module, $packagepath)
{
    global $log;
    require_once 'vtlib/Vtiger/Package.php';
    require_once 'vtlib/Vtiger/Module.php';
    $Vtiger_Utils_Log = true;
    $package = new Vtiger_Package();
    if ($module == null) {
        $log->fatal("Module name is invalid");
    } else {
        $moduleInstance = Vtiger_Module::getInstance($module);
        if ($moduleInstance) {
            $log->debug("{$module} - Module instance found - Init Update starts here");
            $package->initUpdate($moduleInstance, $packagepath, true);
        } else {
            $log->fatal("{$module} doesn't exists!");
        }
    }
}
Пример #28
0
function updateVtlibModule($module, $packagepath)
{
    global $log;
    require_once 'vtlib/Vtiger/Package.php';
    require_once 'vtlib/Vtiger/Module.php';
    $Vtiger_Utils_Log = defined('INSTALLATION_MODE_DEBUG') ? INSTALLATION_MODE_DEBUG : true;
    $package = new Vtiger_Package();
    if ($package->isLanguageType($packagepath)) {
        require_once 'vtlib/Vtiger/Language.php';
        $languagePack = new Vtiger_Language();
        $languagePack->update(null, $packagepath, true);
        return;
    }
    if ($module == null) {
        $log->fatal("Module name is invalid");
    } else {
        $moduleInstance = Vtiger_Module::getInstance($module);
        if ($moduleInstance || $package->isModuleBundle($packagepath)) {
            $log->debug("{$module} - Module instance found - Update starts here");
            $package->update($moduleInstance, $packagepath);
        } else {
            $log->fatal("{$module} doesn't exists!");
        }
    }
}
Пример #29
0
 function installManifestModule($module)
 {
     $package = new Vtiger_Package();
     ob_start();
     $rdo = $package->importManifest("modules/{$module}/manifest.xml");
     $out = ob_get_contents();
     ob_end_clean();
     $this->sendMsg($out);
     if ($rdo) {
         $this->sendMsg("{$module} installed!");
     } else {
         $this->sendMsgError("ERROR installing {$module}!");
     }
 }
Пример #30
0
ExecuteQuery('ALTER TABLE `vtiger_troubletickets` ADD `from_portal` VARCHAR(3) CHARACTER SET utf8 COLLATE utf8_general_ci NULL;');
ExecuteQuery('UPDATE `vtiger_troubletickets`
		INNER JOIN `vtiger_ticketcf` ON `vtiger_ticketcf`.ticketid=`vtiger_troubletickets`.ticketid
		SET `vtiger_troubletickets`.`from_portal`=`vtiger_ticketcf`.`from_portal`');
ExecuteQuery('ALTER TABLE `vtiger_ticketcf` DROP `from_portal`');
// Migrate FAQ Comments
ExecuteQuery("INSERT INTO `vtiger_faqcomments`(`commentid`, `faqid`, `comments`, `createdtime`) \n\t\tSELECT `modcommentsid`, `related_to`, `commentcontent`, CURDATE()\n\t\tFROM vtiger_modcomments\n\t\tINNER JOIN vtiger_crmentity ON crmid = related_to\n\t\tWHERE deleted = 0 and setype='FAQ'");
// Migrate Ticket Comments
ExecuteQuery("INSERT INTO `vtiger_ticketcomments`(`commentid`, `ticketid`, `comments`, `ownerid`, `ownertype`, `createdtime`)\n\t\tSELECT `modcommentsid`, `related_to`, `commentcontent`, \n\t\t\t\tCASE WHEN customer = '' THEN userid ELSE customer END, \n\t\t\t\tCASE WHEN customer = '' THEN 'user' ELSE 'customer' END, CURDATE()\n\t\tFROM vtiger_modcomments\n\t\tINNER JOIN vtiger_crmentity ON crmid = related_to\n\t\tWHERE deleted = 0 and setype='HelpDesk'");
// Recover chat functionality
ExecuteQuery("CREATE TABLE `vtiger_chat_users` (\n  `id` int(20) NOT NULL AUTO_INCREMENT,\n  `nick` varchar(50) NOT NULL,\n  `session` varchar(50) NOT NULL,\n  `ip` varchar(20) NOT NULL DEFAULT '000.000.000.000',\n  `ping` datetime DEFAULT NULL,\n  PRIMARY KEY (`id`),\n  KEY `chat_users_nick_idx` (`nick`),\n  KEY `chat_users_session_idx` (`session`),\n  KEY `chat_users_ping_idx` (`ping`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8");
ExecuteQuery("CREATE TABLE `vtiger_chat_msg` (\n`id` int(20) NOT NULL AUTO_INCREMENT,\n`chat_from` int(20) NOT NULL DEFAULT '0',\n`chat_to` int(20) NOT NULL DEFAULT '0',\n`born` datetime DEFAULT NULL,\n`msg` varchar(255) NOT NULL,\nPRIMARY KEY (`id`),\nKEY `chat_msg_chat_from_idx` (`chat_from`),\nKEY `chat_msg_chat_to_idx` (`chat_to`),\nKEY `chat_msg_born_idx` (`born`),\nCONSTRAINT `fk_1_vtiger_chat_msg` FOREIGN KEY (`chat_from`) REFERENCES `vtiger_chat_users` (`id`) ON DELETE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8");
ExecuteQuery("CREATE TABLE `vtiger_chat_pvchat` (\n  `id` int(20) NOT NULL AUTO_INCREMENT,\n  `msg` int(20) DEFAULT '0',\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `chat_pvchat_msg_idx` (`msg`),\n  CONSTRAINT `fk_1_vtiger_chat_pvchat` FOREIGN KEY (`msg`) REFERENCES `vtiger_chat_msg` (`id`) ON DELETE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8");
ExecuteQuery("CREATE TABLE `vtiger_chat_pchat` (\n  `id` int(20) NOT NULL AUTO_INCREMENT,\n  `msg` int(20) DEFAULT '0',\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `chat_pchat_msg_idx` (`msg`),\n  CONSTRAINT `fk_1_vtiger_chat_pchat` FOREIGN KEY (`msg`) REFERENCES `vtiger_chat_msg` (`id`) ON DELETE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8");
ExecuteQuery("CREATE TABLE `vtiger_ownernotify` (\n`crmid` int(19) DEFAULT NULL,\n`smownerid` int(19) DEFAULT NULL,\n`flag` int(3) DEFAULT NULL,\nKEY `ownernotify_crmid_flag_idx` (`crmid`,`flag`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8");
$package = new Vtiger_Package();
$rdo = $package->importManifest("modules/PBXManager/manifest.xml");
ExecuteQuery('ALTER TABLE vtiger_inventoryproductrel MODIFY comment text', array());
// Meta information cleanup
$inventoryModules = array('Invoice', 'SalesOrder', 'PurchaseOrder', 'Quotes');
$actions = array('Import', 'Export');
for ($i = 0; $i < count($inventoryModules); $i++) {
    $moduleName = $inventoryModules[$i];
    $moduleInstance = Vtiger_Module::getInstance($moduleName);
    foreach ($actions as $actionName) {
        Vtiger_Access::updateTool($moduleInstance, $actionName, false, '');
    }
}
$delws = array('LineItem', 'ProductTaxes', 'Tax');
foreach ($delws as $ws) {
    $wsrs = $adb->query("select id from vtiger_ws_entity where name='{$ws}'");