function save_keyword($kword_type, $device, $summary, $detail_item) { global $CONFIGS, $DEVSAV; $db_name = 'grep-datas'; $table_name = null; switch ($kword_type) { case 'kword_title': $table_name = 'historys'; break; case 'kword_interest': $table_name = 'interests'; break; case 'kword_cart': $table_name = 'carts'; break; case 'kword_favorite': $table_name = 'favorites'; break; case 'kword_submit': $table_name = 'searchs'; break; case 'kword_account': $table_name = 'accounts'; break; default: return false; } if (!array_key_exists('ID', $DEVSAV)) { $ori_data = new_data($db_name, $table_name, $device); $DEVSAV['ID'] = $ori_data['general']['ID']; } else { $ID = $DEVSAV['ID']; $ori_data = data_object($db_name, $table_name, $ID . '.json'); if (empty($ori_data)) { $ori_data = new_data($db_name, $table_name, $device, $ID); } $ori_data['general']['TIME'] = jsondb_date(); } $ori_data['data']['summary'] = $summary; $detail_url = $ori_data['data']['details']; $detail_file = jsondb_file($db_name, $table_name, basename($detail_url)); file_put_contents($detail_file, json_encode($detail_item) . "\r\n", FILE_APPEND | LOCK_EX); jsondb_data($db_name, $table_name, $device, $ori_data); }
die('No Args'); } /* -------------------------------------------------------------------------- */ $_URL = urldecode($argv[1]); $_OWNER = urldecode($argv[2]); $_NAME = strrchr($_URL, '/'); $fp = fopen($cfg["torrent_file_path"] . getAliasName($_NAME) . ".url", 'w'); fwrite($fp, $_URL); fclose($fp); // // write out stat-file now write_stat_file(); $nice = ""; if ($cfg["nice_adjust"] != 0) { $nice = "nice -n " . $cfg["nice_adjust"] . " "; } $command = "cd " . $cfg["path"] . $_OWNER . "/; HOME=" . $cfg["path"] . $_OWNER . "/; export HOME; " . $nice . $cfg['bin_wget'] . " -i " . escapeshellarg($cfg["torrent_file_path"] . getAliasName($_NAME) . ".url") . " 2>&1"; //2>&1 will direct STDERR to STDOUT $wget = popen($command, 'r'); do { $read = @fread($wget, 2096); new_data($read); write_stat_file(); sleep(2); } while (!feof($wget)); pclose($wget); $_PERCENTAGE = 100; $_COMPLETED = $_SIZE; $_STATUS = '0'; write_stat_file(); //Run again afterwards just to make sure it finished writing the file.
/** * XHTML functions */ include "../functions/functions.xhtml.php"; /** * Import functions */ include "../functions/functions.import.php"; xhtml_head(T_("Import data file")); if (isset($_POST['import_file'])) { //file has been submitted $ddifname = tempnam("/tmp", "FOO"); $datafname = tempnam("/tmp", "FOO"); move_uploaded_file($_FILES['ddifile']['tmp_name'], $ddifname); move_uploaded_file($_FILES['datafile']['tmp_name'], $datafname); $data_id = new_data($_POST['description']); if ($data_id) { print "<p>" . T_("Created new data entry: ") . "{$data_id}</p>"; $ds = import_ddi($ddifname, $data_id); if ($ds) { print "<p>" . T_("Created column strucure") . "</p>"; $is = import_fixed_width($datafname, $data_id); if ($is != false) { print "<p>" . T_("Data imported successfully") . "</p>"; } } } } else { ?> <form enctype="multipart/form-data" action="" method="post"> <p><input type="hidden" name="MAX_FILE_SIZE" value="1000000000" /></p>