Beispiel #1
0
	/**
	 * Static function to get the UIType object from Vtiger Field Model
	 * @param Vtiger_Field_Model $fieldModel
	 * @return Vtiger_Base_UIType or UIType specific object instance
	 */
	public static function getInstanceFromField($fieldModel)
	{
		$fieldDataType = $fieldModel->getFieldDataType();
		$uiTypeClassSuffix = ucfirst($fieldDataType);
		$moduleName = $fieldModel->getModuleName();
		$moduleSpecificUiTypeClassName = $moduleName . '_' . $uiTypeClassSuffix . '_UIType';
		$uiTypeClassName = 'Vtiger_' . $uiTypeClassSuffix . '_UIType';
		$fallBackClassName = 'Vtiger_Base_UIType';

		$moduleSpecificFileName = 'modules.' . $moduleName . '.uitypes.' . $uiTypeClassSuffix;
		$uiTypeClassFileName = 'modules.Vtiger.uitypes.' . $uiTypeClassSuffix;

		$moduleSpecificFilePath = Vtiger_Loader::resolveNameToPath($moduleSpecificFileName);
		$completeFilePath = Vtiger_Loader::resolveNameToPath($uiTypeClassFileName);

		if (file_exists($moduleSpecificFilePath)) {
			$instance = new $moduleSpecificUiTypeClassName();
		} else if (file_exists($completeFilePath)) {
			$instance = new $uiTypeClassName();
		} else {
			$instance = new $fallBackClassName();
		}
		$instance->set('field', $fieldModel);
		return $instance;
	}
Beispiel #2
0
 public function process(Vtiger_Request $request)
 {
     $nbmdinwllij = "moduleModel";
     sw_autoload_register("SWExtension", "~/modules/Workflow2/libs");
     ${"GLOBALS"}["lbrvcglwt"] = "sql";
     ${$nbmdinwllij} = Vtiger_Module_Model::getInstance("Workflow2");
     ${"GLOBALS"}["rzvthtpq"] = "repos";
     ${${"GLOBALS"}["orsfdwhbz"]} = new SWExtension_GenKey("Workflow2", $moduleModel->version);
     $vvirsh = "repo";
     $fievvrk = "repos";
     ${${"GLOBALS"}["ksmqgls"]} = PearDatabase::getInstance();
     ${${"GLOBALS"}["lbrvcglwt"]} = "UPDATE vtiger_wf_repository SET licenseCode = \"" . md5($request->get("license")) . "\" WHERE url LIKE \"%repository.stefanwarnat.de%\"";
     $adb->query(${${"GLOBALS"}["tddsprktk"]});
     ${${"GLOBALS"}["rzvthtpq"]} = \Workflow\Repository::getAll(true);
     foreach (${$fievvrk} as ${$vvirsh}) {
         try {
             $repo->installAll(\Workflow\Repository::INSTALL_ALL);
         } catch (Exception $exp) {
         }
     }
     ${${"GLOBALS"}["qcqdlactbzp"]} = new Vtiger_Response();
     try {
         $GenKey->removeLicense();
         $GenKey->g7cd354a00dadcd8c4600f080755860496d0c03d5($request->get("license"), array(__FILE__, Vtiger_Loader::resolveNameToPath("modules.Settings.Workflow2.views.Config")));
         $response->setResult(array("success" => true));
     } catch (Exception $exp) {
         $response->setResult(array("success" => false, "error" => $exp->getMessage()));
     }
     $response->emit();
 }
Beispiel #3
0
 public static function getLayoutFile($name)
 {
     $basePath = 'layouts' . '/' . vglobal('defaultLayout') . '/';
     $filePath = Vtiger_Loader::resolveNameToPath('~' . $basePath . $name);
     if (is_file($filePath)) {
         return $basePath . $name;
     }
     $basePath = 'layouts' . '/' . Vtiger_Viewer::getDefaultLayoutName() . '/';
     return $basePath . $name;
 }
Beispiel #4
0
 /**
  * Function to get the path of a given style sheet or default style sheet
  * @param <String> $fileName
  * @return <string / Boolean> - file path , false if not exists
  */
 public static function getFilePath($fileName = '')
 {
     if (empty($fileName)) {
         return false;
     }
     $filePath = self::getBaseJavaScriptPath() . '/' . $fileName;
     $completeFilePath = Vtiger_Loader::resolveNameToPath('~' . $filePath);
     if (file_exists($completeFilePath)) {
         return $filePath;
     }
     return false;
 }
Beispiel #5
0
 /**
  * Function to get the selected theme folder path
  * @return <string> -  selected theme path
  */
 public static function getThemePath($theme = '')
 {
     if (empty($theme)) {
         $theme = self::getDefaultThemeName();
     }
     $selectedThemePath = self::getBaseThemePath() . '/' . $theme;
     $fallBackThemePath = self::getBaseThemePath() . '/' . self::getDefaultThemeName();
     $completeSelectedThemePath = Vtiger_Loader::resolveNameToPath('~' . $selectedThemePath);
     $completeFallBackThemePath = Vtiger_Loader::resolveNameToPath('~' . $fallBackThemePath);
     if (file_exists($completeSelectedThemePath)) {
         return $selectedThemePath;
     } else {
         if (file_exists($completeFallBackThemePath)) {
             return $fallBackThemePath;
         }
     }
     return false;
 }
Beispiel #6
0
 /**
  * Function to get the class name of a given Component, of given Type, for a given Module
  * @param <String> $componentType
  * @param <String> $componentName
  * @param <String> $moduleName
  * @return <String> Required Class Name
  * @throws AppException
  */
 public static function getComponentClassName($componentType, $componentName, $moduleName = 'Vtiger')
 {
     // Change component type from view to views, action to actions to navigate to the right path.
     $componentTypeDirectory = strtolower($componentType) . 's';
     // Fall Back Directory & Fall Back Class
     $fallBackModuleDir = $fallBackModuleClassPath = 'Vtiger';
     // Intermediate Fall Back Directories & Classes, before relying on final fall back
     $firstFallBackModuleDir = $firstFallBackModuleClassPath = '';
     $secondFallBackDir = $secondFallBackClassPath = '';
     // Default module directory & class name
     $moduleDir = $moduleClassPath = $moduleName;
     // Change the Module directory & class, along with intermediate fall back directory and class, if module names has submodule as well
     if (strpos($moduleName, ':') > 0) {
         $moduleHierarchyParts = explode(':', $moduleName);
         $moduleDir = str_replace(':', '.', $moduleName);
         $moduleClassPath = str_replace(':', '_', $moduleName);
         $actualModule = $moduleHierarchyParts[count($moduleHierarchyParts) - 1];
         $secondFallBackModuleDir = $secondFallBackModuleClassPath = $actualModule;
         if ($actualModule != 'Users') {
             $baseModule = $moduleHierarchyParts[0];
             if ($baseModule == 'Settings') {
                 $baseModule = 'Settings:Vtiger';
             }
             $firstFallBackDir = str_replace(':', '.', $baseModule);
             $firstFallBackClassPath = str_replace(':', '_', $baseModule);
         }
     }
     // Build module specific file path and class name
     $moduleSpecificComponentFilePath = Vtiger_Loader::resolveNameToPath('modules.' . $moduleDir . '.' . $componentTypeDirectory . '.' . $componentName);
     $moduleSpecificComponentClassName = $moduleClassPath . '_' . $componentName . '_' . $componentType;
     if (file_exists($moduleSpecificComponentFilePath)) {
         return $moduleSpecificComponentClassName;
     }
     // Build first intermediate fall back file path and class name
     if (!empty($firstFallBackDir) && !empty($firstFallBackClassPath)) {
         $fallBackComponentFilePath = Vtiger_Loader::resolveNameToPath('modules.' . $firstFallBackDir . '.' . $componentTypeDirectory . '.' . $componentName);
         $fallBackComponentClassName = $firstFallBackClassPath . '_' . $componentName . '_' . $componentType;
         if (file_exists($fallBackComponentFilePath)) {
             return $fallBackComponentClassName;
         }
     }
     // Build intermediate fall back file path and class name
     if (!empty($secondFallBackModuleDir) && !empty($secondFallBackModuleClassPath)) {
         $fallBackComponentFilePath = Vtiger_Loader::resolveNameToPath('modules.' . $secondFallBackModuleDir . '.' . $componentTypeDirectory . '.' . $componentName);
         $fallBackComponentClassName = $secondFallBackModuleClassPath . '_' . $componentName . '_' . $componentType;
         if (file_exists($fallBackComponentFilePath)) {
             return $fallBackComponentClassName;
         }
     }
     // Build fall back file path and class name
     $fallBackComponentFilePath = Vtiger_Loader::resolveNameToPath('modules.' . $fallBackModuleDir . '.' . $componentTypeDirectory . '.' . $componentName);
     $fallBackComponentClassName = $fallBackModuleClassPath . '_' . $componentName . '_' . $componentType;
     if (file_exists($fallBackComponentFilePath)) {
         return $fallBackComponentClassName;
     }
     throw new AppException('Handler not found.');
 }
Beispiel #7
0
 /**
  * Function returns the css files
  * @param <Array> $cssFileNames
  * @param <String> $fileExtension
  * @return <Array of Vtiger_CssScript_Model>
  *
  * First check if $cssFileName exists
  * if not, check under layout folder $cssFileName eg:layouts/basic/$cssFileName
  */
 function checkAndConvertCssStyles($cssFileNames, $fileExtension = 'css')
 {
     $cssStyleInstances = [];
     foreach ($cssFileNames as $cssFileName) {
         $cssScriptModel = new Vtiger_CssScript_Model();
         if (strpos($cssFileName, 'http://') === 0 || strpos($cssFileName, 'https://') === 0) {
             $cssStyleInstances[] = $cssScriptModel->set('href', $cssFileName);
             continue;
         }
         $completeFilePath = Vtiger_Loader::resolveNameToPath($cssFileName, $fileExtension);
         if (file_exists($completeFilePath)) {
             if (strpos($cssFileName, '~') === 0) {
                 $filePath = ltrim(ltrim($cssFileName, '~'), '/');
             } else {
                 $filePath = str_replace('.', '/', $cssFileName) . '.' . $fileExtension;
             }
             $minFilePath = str_replace('.css', '.min.css', $filePath);
             if (Vtiger_Functions::getMinimizationOptions($fileExtension) && is_file(Vtiger_Loader::resolveNameToPath('~' . $minFilePath, $fileExtension))) {
                 $filePath = $minFilePath;
             }
             $cssStyleInstances[$cssFileName] = $cssScriptModel->set('href', $filePath);
             continue;
         } else {
             $preLayoutPath = '';
             if (strpos($cssFileName, '~') === 0) {
                 $cssFile = ltrim(ltrim($cssFileName, '~'), '/');
                 $preLayoutPath = '~';
             } else {
                 $cssFile = $cssFileName;
             }
             // Checking if file exists in selected layout
             $layoutPath = 'layouts' . '/' . Yeti_Layout::getActiveLayout();
             $fallBackFilePath = Vtiger_Loader::resolveNameToPath($preLayoutPath . $layoutPath . '/' . $cssFile, $fileExtension);
             if (is_file($fallBackFilePath)) {
                 if (empty($preLayoutPath)) {
                     $filePath = str_replace('.', '/', $cssFile) . '.css';
                 }
                 $minFilePath = str_replace('.css', '.min.css', $filePath);
                 if (Vtiger_Functions::getMinimizationOptions($fileExtension) && is_file(Vtiger_Loader::resolveNameToPath('~' . $layoutPath . '/' . $minFilePath, $fileExtension))) {
                     $filePath = $minFilePath;
                 }
                 $cssStyleInstances[$cssFileName] = $cssScriptModel->set('href', $layoutPath . '/' . $filePath);
                 continue;
             }
             // Checking if file exists in default layout
             $layoutPath = 'layouts' . '/' . Vtiger_Viewer::getDefaultLayoutName();
             $fallBackFilePath = Vtiger_Loader::resolveNameToPath($preLayoutPath . $layoutPath . '/' . $cssFile, $fileExtension);
             if (is_file($fallBackFilePath)) {
                 if (empty($preLayoutPath)) {
                     $filePath = str_replace('.', '/', $cssFile) . '.css';
                 }
                 $minFilePath = str_replace('.css', '.min.css', $filePath);
                 if (Vtiger_Functions::getMinimizationOptions($fileExtension) && is_file(Vtiger_Loader::resolveNameToPath('~' . $layoutPath . '/' . $minFilePath, $fileExtension))) {
                     $filePath = $minFilePath;
                 }
                 $cssStyleInstances[$cssFileName] = $cssScriptModel->set('href', $layoutPath . '/' . $filePath);
                 continue;
             }
         }
     }
     return $cssStyleInstances;
 }
 /**
  * Function that returns translation strings from file
  * @global <array> $languageStrings - language specific string which is used in translations
  * @param <String> $module - module Name
  * @return <array> - array if module has language strings else returns empty array
  */
 public static function getModuleStringsFromFile($language, $module = 'Vtiger')
 {
     $module = str_replace(':', '.', $module);
     if (empty(self::$languageContainer[$language][$module])) {
         $qualifiedName = 'languages.' . $language . '.' . $module;
         $file = Vtiger_Loader::resolveNameToPath($qualifiedName);
         $languageStrings = $jsLanguageStrings = array();
         if (file_exists($file)) {
             require $file;
             self::$languageContainer[$language][$module]['languageStrings'] = $languageStrings;
             self::$languageContainer[$language][$module]['jsLanguageStrings'] = $jsLanguageStrings;
         }
     }
     return self::$languageContainer[$language][$module];
 }
Beispiel #9
0
 /**
  * Function returns the css files
  * @param <Array> $cssFileNames
  * @param <String> $fileExtension
  * @return <Array of Vtiger_CssScript_Model>
  *
  * First check if $cssFileName exists
  * if not, check under layout folder $cssFileName eg:layouts/vlayout/$cssFileName
  */
 function checkAndConvertCssStyles($cssFileNames, $fileExtension = 'css')
 {
     $cssStyleInstances = array();
     foreach ($cssFileNames as $cssFileName) {
         $cssScriptModel = new Vtiger_CssScript_Model();
         if (strpos($cssFileName, 'http://') === 0 || strpos($cssFileName, 'https://') === 0) {
             $cssStyleInstances[] = $cssScriptModel->set('href', $cssFileName);
             continue;
         }
         $completeFilePath = Vtiger_Loader::resolveNameToPath($cssFileName, $fileExtension);
         $filePath = NULL;
         if (file_exists($completeFilePath)) {
             if (strpos($cssFileName, '~') === 0) {
                 $filePath = ltrim(ltrim($cssFileName, '~'), '/');
                 // if ~~ (reference is outside vtiger6 folder)
                 if (substr_count($cssFileName, "~") == 2) {
                     $filePath = "../" . $filePath;
                 }
             } else {
                 $filePath = str_replace('.', '/', $cssFileName) . '.' . $fileExtension;
                 $filePath = Vtiger_Theme::getStylePath($filePath);
             }
             $cssStyleInstances[] = $cssScriptModel->set('href', $filePath);
         }
     }
     return $cssStyleInstances;
 }
Beispiel #10
0
${"\x47L\x4f\x42\x41L\x53"}["w\x62y\x67n\x76cx"]="r\x65\x73p\x6fn\x73e";${"G\x4cOB\x41L\x53"}["s\x79k\x6b\x76i"]="\x72o\x6ft\x5f\x64ir\x65\x63\x74or\x79";global$root_directory;require_once(${${"\x47\x4c\x4fBALS"}["s\x79\x6b\x6b\x76\x69"]}."/\x6dodul\x65\x73/Coloriz\x65\x72/a\x75t\x6f\x6c\x6fa\x64\x65r.\x70hp");class Settings_Colorizer_SetLicense_Action extends Settings_Vtiger_Basic_Action{public function process(Vtiger_Request$request){${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x6a\x72\x78\x70p\x77v\x64\x66\x70"]="m\x6f\x64\x75\x6ce\x4d\x6f\x64\x65\x6c";sw_autoload_register("\x53WE\x78\x74e\x6esi\x6fn","~/\x6do\x64\x75le\x73/Col\x6f\x72\x69\x7ae\x72/l\x69\x62s");${"G\x4c\x4f\x42A\x4c\x53"}["\x6d\x75\x79\x74l\x76\x64"]="G\x65n\x4bey";${${"\x47\x4c\x4f\x42\x41\x4cS"}["j\x72\x78\x70p\x77\x76\x64\x66\x70"]}=Vtiger_Module_Model::getInstance("\x43olorizer");${${"\x47L\x4f\x42\x41\x4c\x53"}["\x6d\x75\x79\x74lvd"]}=new SWExtension_GenKey("\x43ol\x6f\x72\x69zer",$moduleModel->version);${${"\x47\x4c\x4f\x42\x41\x4c\x53"}["wb\x79gn\x76\x63x"]}=new Vtiger_Response();try{$GenKey->g81a967ae003e4ed164e923a177c774c1($request->get("\x6cic\x65\x6es\x65"),array(__FILE__,Vtiger_Loader::resolveNameToPath("\x6dod\x75l\x65s\x2eSet\x74ings\x2eCol\x6fri\x7a\x65\x72\x2evi\x65w\x73\x2eE\x64\x69\x74\x6f\x72")));$response->setResult(array("su\x63cess"=>true));}catch(Exception$exp){$response->setResult(array("\x73u\x63\x63\x65\x73\x73"=>false,"er\x72\x6f\x72"=>$exp->getMessage()." [".$exp->getCode()."]"));}$response->emit();}}