Esempio n. 1
0
 function can_edit_file($module_name, $entity_type)
 {
     if (!MAINSITE) {
         return TRUE;
     }
     if (!is_client_module($module_name) && $entity_type == 'modules' || MAINSITE && $entity_type == 'main') {
         $can_edit_file = FALSE;
     } else {
         $can_edit_file = TRUE;
     }
     return $can_edit_file;
 }
Esempio n. 2
0
 /**
  * Update javascript langs file(jsLangs.js)
  * @param type $langs
  * @param type $domain
  */
 private function updateJsLangsFile($langs, $domain, $type)
 {
     if ($type == 'modules') {
         if (MAINSITE && !is_client_module($domain)) {
             return FALSE;
         }
     }
     $base_dir = ".";
     if (!empty($langs)) {
         $js_content = '<script>' . PHP_EOL;
         foreach ($langs as $langArray) {
             foreach ($langArray as $origin) {
                 $js_content .= 'langs["' . mb_ereg_replace('([\\s]+{.*?})', "<?php echo '\\0'?>", $origin) . '"] = \'<?php echo lang("' . $origin . '", "' . $domain . '", FALSE)?>\';' . PHP_EOL;
             }
         }
         $js_content .= '</script>';
         if ($domain == "admin") {
             file_put_contents($base_dir . '/templates/administrator/inc/jsLangs.tpl', $js_content);
         } else {
             file_put_contents($base_dir . '/application/modules/' . $domain . '/assets/jsLangs.tpl', $js_content);
         }
     } else {
         if ($domain == "admin") {
             if (file_exists($base_dir . '/templates/administrator/inc/jsLangs.tpl')) {
                 unlink($base_dir . '/templates/administrator/inc/jsLangs.tpl');
             }
         } else {
             if (file_exists($base_dir . '/application/modules/' . $domain . '/assets/jsLangs.tpl')) {
                 unlink($base_dir . '/application/modules/' . $domain . '/assets/jsLangs.tpl');
             }
         }
     }
 }