*/ // swallow any accidential output generated by php notices and stuff to preserve a clean JSON reply structure OC_Shorty_Tools::ob_control ( TRUE ); //no apps or filesystem $RUNTIME_NOSETUPFS = true; // Sanity checks OCP\JSON::callCheck ( ); OCP\JSON::checkLoggedIn ( ); OCP\JSON::checkAppEnabled ( 'shorty' ); try { $p_id = OC_Shorty_Tools::shorty_id ( ); $p_status = OC_Shorty_Type::req_argument ( 'status', OC_Shorty_Type::STATUS, FALSE ); $p_title = OC_Shorty_Type::req_argument ( 'title', OC_Shorty_Type::STRING, FALSE ); $p_target = OC_Shorty_Type::req_argument ( 'target', OC_Shorty_Type::URL, TRUE ); $p_until = OC_Shorty_Type::req_argument ( 'until', OC_Shorty_Type::DATE, FALSE ); $p_notes = OC_Shorty_Type::req_argument ( 'notes', OC_Shorty_Type::STRING, FALSE ); $p_favicon = OC_Shorty_Type::req_argument ( 'favicon', OC_Shorty_Type::URL, FALSE ); // register shorty at backend $p_source = OC_Shorty_Backend::registerUrl ( $p_id ); // fallback title: choose hostname if no title is specified $p_title = $p_title ? trim($p_title) : parse_url($p_target,PHP_URL_HOST); // insert new shorty into our database $param = array ( ':user' => OCP\User::getUser(), ':id' => $p_id,