if(mlang_getcurrentlang()=="English") { } if(mlang_getcurrentlang()=="") { } set_error_handler("connect_error_handler"); $conn = db_connect(); restore_error_handler(); if(!isLogged()) { $allowGuest = true; $scriptname = getFileNameFromURL(); if($allowGuest && $scriptname!="login.php" && $scriptname!="remind.php" && $scriptname!="register.php") { DoLogin(true); } } $isGroupSecurity = true; $isUseRTEBasic = true; $isUseRTECK = false; $isUseRTEInnova = false; $caseInsensitiveUsername = 0;
$data_file = $assetsFolder . '/data.json'; if (!file_exists($data_file)) { exit("Data file {$data_file} not found\n"); } $data = json_decode(file_get_contents($data_file)); if (json_last_error()) { exit("Data file {$data_file} parsing failed\n"); } $RCX = new RollingCurlX(10); $RCX->setCallback('cb'); foreach ($data as $id => $post) { if (!isset($post->full_picture)) { $photos[$post->id] = 'post has no image'; continue; } $file_name = getFileNameFromURL($post->full_picture); $file_path = $assetsFolder . "/photos/{$file_name}"; if (!file_exists($file_path)) { $RCX->addRequest($post->full_picture, NULL, NULL, array('id' => $id, 'path' => $file_path)); $photos[$post->id] = 'image download intitiated'; } else { $photos[$post->id] = 'image exists on disk'; } } $RCX->execute(); print_r($photos); function cb($response, $url, $request_info, $user_data, $time) { global $photos; if ($request_info['http_code'] == 200) { if (file_put_contents($user_data['path'], $response) !== FALSE) {