예제 #1
0
/**
 * function to load minify chached uris from file and set them in memory
 * @return void
 */
function loadMinifyUris()
{
    /*init Minify urls cache*/
    $cacheFile = MINIFY_CACHE_DIR . 'urls_cache';
    if (file_exists($cacheFile)) {
        $uris = Util\jsonDecode(file_get_contents($cacheFile));
        Cache::set('MinifyUris', $uris);
    }
}
예제 #2
0
파일: index.php 프로젝트: sebbie42/casebox
         }
     } else {
         if (!User::isLoged()) {
             exit(0);
         }
         $userId = $_SESSION['user']['id'];
     }
     /* end of check if public user is given */
     Files::download($id, $versionId, !isset($_GET['pw']), $userId);
     break;
 case 'upload':
     require_once 'init.php';
     $result = array('success' => false);
     if (isset($_SERVER['HTTP_X_FILE_OPTIONS'])) {
         // AJAX call
         $file = Util\jsonDecode($_SERVER['HTTP_X_FILE_OPTIONS']);
         $file['error'] = UPLOAD_ERR_OK;
         $file['tmp_name'] = tempnam(Config::get('incomming_files_dir'), 'cbup');
         $file['name'] = urldecode($file['name']);
         if (empty($file['content_id'])) {
             Util\bufferedSaveFile('php://input', $file['tmp_name']);
         }
         $_FILES = array('file' => $file);
         $browser = new Browser();
         $result = $browser->saveFile(array('pid' => @$file['pid'], 'draftPid' => @$file['draftPid'], 'response' => @$file['response']));
     }
     header('Content-Type: application/json; charset=UTF-8');
     echo Util\jsonEncode($result);
     break;
 case 'logo.png':
     require_once 'config.php';
예제 #3
0
 /**
  * get core config stored in casebox.cores table
  *
  * @return array
  */
 public static function getPlatformConfigForCore($coreName)
 {
     $rez = array();
     $res = DB\dbQuery('SELECT id, cfg, active
         FROM ' . PREFIX . '_casebox.cores
         WHERE name = $1', $coreName) or die(DB\dbQueryError());
     if ($r = $res->fetch_assoc()) {
         $rez = Util\jsonDecode($r['cfg']);
     } else {
         throw new \Exception('Core not defined in cores table: ' . $coreName, 1);
     }
     $res->close();
     if ($rez === false) {
         throw new \Exception('Error decoding core config', 1);
     }
     $rez['core_id'] = $r['id'];
     $rez['core_status'] = $r['active'];
     return $rez;
 }
while ($r = $res->fetch_assoc()) {
    reset($r);
    $name = current($r);
    while (($v = next($r)) !== false) {
        $T[key($r)][] = "'" . $name . "':'" . addcslashes($v, "'") . "'";
    }
}
$res->close();
//save each translations as main language file
saveFiles($T);
echo "main language files saved\n";
//iterate cores and collect those that have custom translations
$cores = array();
$res = DB\dbQuery('SELECT name, cfg FROM ' . \CB\PREFIX . '_casebox.cores') or die(DB\dbQueryError());
while ($r = $res->fetch_assoc()) {
    $cfg = Util\jsonDecode($r['cfg']);
    $db = empty($cfg['db_name']) ? \CB\PREFIX . $r['name'] : $cfg['db_name'];
    $res2 = DB\dbQuery('SELECT count(*) `count`
        FROM ' . $db . '.translations');
    // dont exit if db doesnt have translations
    if ($res2) {
        if ($r2 = $res2->fetch_assoc()) {
            if ($r2['count'] > 0) {
                $cores[$r['name']] = $db;
            }
        }
        $res2->close();
    }
}
$res->close();
if (empty($cores)) {