Exemple #1
0
function parsePhp($json)
{
    $json = str_replace("'", "", $json);
    //  return;
    //$json = removeslashes($json);
    //var_dump( $json  );
    $v = json_decode($json);
    //echo 'Last error: ', $json_errors[json_last_error()], PHP_EOL, PHP_EOL;
    //print_r($v->file_path);
    $parser = new \KiWi\KiwiParser(TRUE);
    /*$parser->processDir('/home/yash/Projects/php/laravel/',["php"])*/
    //$connection = \Tivoka\Client::connect(array('host' => '127.0.0.1', 'port' => 9040));
    //"/var/www/html/kiwi/app/controllers/HomeController.php"
    $j = $parser->processFile($v->file_path)->call()->result();
    //echo $j."kkk";
    echo return_result('updateAutocompleteModel', $j);
}
                $dbo->exeUpdate($sql);
            } else {
                $mod_count = $session_data['mod_count'] + 1;
                $affair_ser = $session_data['affair_array'];
                $data_ser = $session_data['data_array'];
                //完成时的数据交换
                $data_array = unserialize($data_ser);
                $fs['photo_id'] = $photo_id;
                $data_array[] = $fs;
                //新鲜事的数据交换
                $affair_array = unserialize($affair_ser);
                $affair_array[$mod_count]['id'] = $photo_id;
                $affair_array[$mod_count]['file'] = $thumb_src;
                //序列化
                $data_ser = serialize($data_array);
                $affair_ser = serialize($affair_array);
                //更新库表
                $sql = "update {$t_tmp_file} set mod_count={$mod_count},affair_array='{$affair_ser}',data_array='{$data_ser}' where mod_id={$album_id}";
                $dbo->exeUpdate($sql);
            }
            increase_integral($dbo, $int_photo, $user_id);
            $success = "true";
        } else {
            $success = "false";
        }
    } else {
        $success = "false";
    }
}
return_result($success, $errors, $data);
Exemple #3
0
    $mas['result'] = "Коэффициент a равен 0";
    $mas['errno'] = -2;
    $mas['count_korn'] = 0;
    return_result($mas);
}
// вычисляем Дискриминант
$d = pow($b, 2) - 4 * $a * $c;
// Определяем количество корней в зависимости от дискриминанта и формируем массив ответов
if ($d < 0) {
    $mas['result'] = "Уравнение не имеет корней";
    $mas['count_korn'] = 0;
    $mas['errno'] = -3;
    $mas['D'] = $d;
}
if ($d == 0) {
    $mas['result'] = "Уравнение имеет один корень";
    $mas['count_korn'] = 1;
    $mas['D'] = 0;
    $mas['x1'] = -$b / (2 * $a);
    $mas['errno'] = 0;
}
if ($d > 0) {
    $mas['result'] = "Уравнение имеет два корня";
    $mas['D'] = $d;
    $mas['count_korn'] = 2;
    $mas['x1'] = (-$b + sqrt($d)) / (2 * $a);
    $mas['x2'] = (-$b - sqrt($d)) / (2 * $a);
    $mas['errno'] = 0;
}
return_result($mas);
Exemple #4
0
    if ($_SESSION['store_id'] == 0 && $_SESSION['selected_store_id'] > 0) {
        $use_store_id = $_SESSION['selected_store_id'];
    } elseif ($_SESSION['store_id'] > 0) {
        $use_store_id = $_SESSION['store_id'];
    }
    if (move_uploaded_file($_FILES['upl_' . $upcounter]['tmp_name'], $move_destination)) {
        if ((substr_count($finfo['extension'], "pdf") > 0 || substr_count($finfo['extension'], "PDF") > 0) && $public == 1) {
            $move_destination_png = $move_destination;
            $move_destination_png = str_replace(".pdf", ".png", $move_destination_png);
            $move_destination_png = str_replace(".PDF", ".png", $move_destination_png);
            $imagick = new Imagick();
            $imagick->setResolution(300, 300);
            $imagick->readImage($move_destination);
            $imagick->setImageFormat("png");
            $imagick->writeImage($move_destination_png);
            $new_filename = $move_destination_png;
        }
        $sql = "\n\t\t\tinsert into attached_files\n\t\t\t\t(xref_id,\n\t\t\t\tfilename,\n\t\t\t\tfilesize,\n\t\t\t\tlinedate_added,\n\t\t\t\tsection_id,\n\t\t\t\taccess_level,\n\t\t\t\tdeleted,\n\t\t\t\tuser_id,\n\t\t\t\tmerchant_id,\n\t\t\t\tstore_id,\n\t\t\t\tpublic_name,\n\t\t\t\tpublic_flag)\n\t\t\t\t\n\t\t\tvalues ('" . sql_friendly($_SESSION['upload_params'][$upcounter]['xref_id']) . "',\n\t\t\t\t'" . sql_friendly($new_filename) . "',\n\t\t\t\t0,\n\t\t\t\tnow(),\n\t\t\t\t'" . sql_friendly($_SESSION['upload_params'][$upcounter]['section_id']) . "',\n\t\t\t\t'" . sql_friendly($_SESSION['access_level']) . "',\n\t\t\t\t0,\n\t\t\t\t'" . sql_friendly($_SESSION['user_id']) . "',\n\t\t\t\t'" . sql_friendly($use_merchant_id) . "',\n\t\t\t\t'" . sql_friendly($use_store_id) . "',\n\t\t\t\t'" . sql_friendly(get_filename_without_unique($new_filename)) . "',\n\t\t\t\t'" . sql_friendly($public) . "')\n\t\t";
        simple_query($sql);
        $rslt['status_code'] = 1;
        $rslt['msg'] = 'success!';
        $rslt['filename_new'] = $new_filename;
        $rslt['filename_original'] = $_FILES['upl_' . $upcounter]['name'];
        $rslt['extra_params'] = $_SESSION['upload_params'][$upcounter]['extra_params'];
        return_result($rslt);
    }
}
$rslt['status_code'] = 0;
$rslt['msg'] = 'No files found.';
return_result($rslt);
                $fav = "http:" . $fav;
            } else {
                $data = parse_url($storage["links"][$id]["link"]);
                if ($fav[0] == '/') {
                    // absolute path
                    $fav = $data["scheme"] . "://" . $data["host"] . $fav;
                } else {
                    // relative path
                    $fav = $data["scheme"] . "://" . $data["host"] . "?" . $data["argument"] . $fav;
                }
            }
        }
    }
    $storage["links"][$id]["favicon"] = $fav;
    $storage["links"][$id]["title"] = (string) $xml->xpath('//title')[0];
    // title
}
///
/// Execute action and return result
///
if (!array_key_exists('action', $_GET)) {
    return_result("1", "No action specified");
} elseif (!array_key_exists($_GET['action'], $actions)) {
    return_result("2", "No such action");
} else {
    $actions[$_GET['action']]();
}
///
/// Save bookmark storage
///
file_put_contents("./data/bookmarks.dat", serialize($storage));