Exemplo n.º 1
0
 public static function get_lang_options()
 {
     $Lang = PerchLang::fetch();
     $out = array();
     // Addons folder
     if (is_dir(PerchUtil::file_path(PERCH_PATH . '/addons/lang'))) {
         $lang_dir = PerchUtil::file_path(PERCH_PATH . '/addons/lang');
         $files = PerchUtil::get_dir_contents($lang_dir, false);
         if (is_array($files)) {
             foreach ($files as $file) {
                 $out[] = PerchUtil::strip_file_extension($file);
             }
         }
     }
     // Core folder
     $lang_dir = PerchUtil::file_path(PERCH_CORE . '/lang');
     if (is_dir($lang_dir)) {
         $files = PerchUtil::get_dir_contents($lang_dir, false);
         if (is_array($files)) {
             foreach ($files as $file) {
                 $f = PerchUtil::strip_file_extension($file);
                 if (!in_array($f, $out)) {
                     $out[] = $f;
                 }
             }
         }
     }
     if (PerchUtil::count($out)) {
         sort($out);
         return $out;
     }
     return false;
 }
Exemplo n.º 2
0
 function __construct($version = 1.0, $app_id)
 {
     $this->app_id = $app_id;
     $this->version = $version;
     if (!defined('PERCH_APPS_EDITOR_PLUGIN')) {
         define('PERCH_APPS_EDITOR_PLUGIN', 'markitup');
     }
     if (!defined('PERCH_APPS_EDITOR_MARKUP_LANGUAGE')) {
         define('PERCH_APPS_EDITOR_MARKUP_LANGUAGE', 'textile');
     }
     if (strpos($app_id, '_') === false) {
         $this->Lang = PerchLang::fetch();
     }
 }
 $postvars = array('headerColour', 'headerScheme', 'lang', 'hideBranding', 'helpURL', 'siteURL', 'dashboard', 'hide_pwd_reset');
 $checkboxes = array('hideBranding', 'dashboard', 'hide_pwd_reset');
 include '_app_settings.pre.php';
 $data = $Form->receive($postvars);
 foreach ($checkboxes as $checkbox) {
     if (!isset($data[$checkbox])) {
         $data[$checkbox] = '0';
     }
 }
 if (isset($_POST['logo_remove']) && $_POST['logo_remove'] == '1') {
     $data['logoPath'] = '';
 }
 foreach ($data as $key => $value) {
     $Settings->set($key, $value);
 }
 $Lang = PerchLang::fetch();
 $Lang->reload();
 $Alert->set('success', PerchLang::get("Your settings have been updated."));
 // image upload
 if (isset($_FILES['customlogo']) && (int) $_FILES['customlogo']['size'] > 0) {
     if (is_array(getimagesize($_FILES['customlogo']['tmp_name']))) {
         $filename = $_FILES['customlogo']['name'];
         if (strpos($filename, '.php') !== false) {
             $filename .= '.txt';
         }
         // diffuse PHP files
         $target = PERCH_RESFILEPATH . '/' . $filename;
         if (file_exists($target)) {
             $filename = time() . '_' . $_FILES['customlogo']['name'];
             $target = PERCH_RESFILEPATH . '/' . $filename;
         }