Exemplo n.º 1
0
        public static bool ResetRewriteVariables()
        {
            /*PhpException.FunctionNotSupported();
             * return false;*/


            ScriptContext  context  = ScriptContext.CurrentContext;
            UrlRewriter    rewriter = UrlRewriter.Current;
            BufferedOutput output   = context.BufferedOutput;

            if (rewriter == null ||
                output.Level == 0 ||
                output.GetFilter() != rewriter.filterCallback)
            {
                return(false);
            }

            // some output flush
            output.Flush();

            rewriter.Variables.Clear();
            output.DecreaseLevel(false);

            if (output.Level == 0)
            {
                context.IsOutputBuffered = false;
            }

            return(true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Decreases the level of buffering and discards or flushes data on the current level of buffering.
        /// </summary>
        /// <param name="context">Current script context.</param>
        /// <param name="flush">Whether to flush data.</param>
        /// <returns>Whether the content was discarded and the level was decreased.</returns>
        private static bool EndInternal(ScriptContext /*!*/ context, bool flush)
        {
            BufferedOutput buf = context.BufferedOutput;

            if (buf.Level == 0)
            {
                PhpException.Throw(PhpError.Notice, CoreResources.GetString("output_buffering_disabled"));
                return(false);
            }

            if (buf.DecreaseLevel(flush) < 0)
            {
                context.IsOutputBuffered = false;
            }

            return(true);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Decreases the level of buffering and discards or flushes data on the current level of buffering.
        /// </summary>
        /// <param name="ctx">Current runtime context.</param>
        /// <param name="flush">Whether to flush data.</param>
        /// <returns>Whether the content was discarded and the level was decreased.</returns>
        private static bool EndInternal(Context /*!*/ ctx, bool flush)
        {
            BufferedOutput buf = ctx.BufferedOutput;

            if (buf.Level == 0)
            {
                //PhpException.Throw(PhpError.Notice, CoreResources.GetString("output_buffering_disabled"));
                //return false;
                throw new NotImplementedException();
            }

            if (buf.DecreaseLevel(flush) < 0)
            {
                ctx.IsOutputBuffered = false;
            }

            return(true);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Decreases the level of buffering and discards or flushes data on the current level of buffering.
        /// </summary>
        /// <param name="ctx">Current runtime context.</param>
        /// <param name="flush">Whether to flush data.</param>
        /// <returns>Whether the content was discarded and the level was decreased.</returns>
        private static bool EndInternal(Context /*!*/ ctx, bool flush)
        {
            BufferedOutput buf = ctx.BufferedOutput;

            if (buf.Level == 0)
            {
                // "failed to delete buffer. No buffer to delete"
                PhpException.Throw(PhpError.Notice, Core.Resources.ErrResources.output_buffering_disabled);
                return(false);
            }

            if (buf.DecreaseLevel(flush) < 0)
            {
                ctx.IsOutputBuffered = false;
            }

            return(true);
        }