public static string gae_users_create_login_url(Env env,
                                                        string destinationUrl,
                                                        @Optional string authDomain,
                                                        @Optional string federatedIdentity,
                                                        @Optional Value attributesRequest)
        {
            Set <String> attributeSet = null;

            if (!attributesRequest.isDefault())
            {
                attributeSet = new HashSet <String>();

                ArrayValue array = attributesRequest.toArrayValue(env);

                for (Map.Entry <Value, Value> entrySet : array.entrySet())
                {
                    attributeSet.add(entrySet.getValue().ToString());
                }
            }

            return(GaeUserService.createLoginURL(destinationUrl,
                                                 authDomain,
                                                 federatedIdentity,
                                                 attributeSet));
        }
Esempio n. 2
0
  static public DOMDocument createDocument(Env env,
                                           @Optional string namespaceURI,
                                           @Optional string name,
                                           @Optional DOMDocumentType docType)
  {
    DOMDocument doc;

    if (docType != null)
      doc = get(env).createDocument(docType);
    else
      doc = get(env).createDocument();

    if (name != null && name.length() > 0) {
      DOMElement elt;

      if (namespaceURI != null && namespaceURI.length() > 0)
        elt = doc.createElementNS(namespaceURI, name);
      else
        elt = doc.createElement(name);

      doc.appendChild(elt);
    }

    return doc;
  }
        // XXX: apache_get_modules
        // XXX: apache_get_version
        // XXX: apache_getenv
        // XXX: apache_lookup_uri

        /**
         * Gets and sets apache notes
         */
        public Value apache_note(Env env,
                                 string name,
                                 @Optional Value value)
        {
            Map <String, Value> map = (Map)env.getSpecialValue("_caucho_apache_note");

            if (map == null)
            {
                map = new HashMap <String, Value>();

                env.setSpecialValue("_caucho_apache_note", map);
            }

            Value oldValue = map.get(name);

            if (value.isset())
            {
                map.put(name, value);
            }

            if (oldValue != null)
            {
                return(oldValue.ToStringValue(env));
            }
            else
            {
                return(NullValue.NULL);
            }
        }
Esempio n. 4
0
 public static string export(Env env,
                             Value cls,
                             string name,
                             @Optional bool isReturn)
 {
     return(null);
 }
Esempio n. 5
0
        public static Value class_parents(Env env,
                                          Value obj,
                                          @Optional bool autoload)
        {
            QuercusClass cls;

            if (obj.isObject())
            {
                cls = ((ObjectValue)obj.toObject(env)).getQuercusClass();
            }
            else
            {
                cls = env.findClass(obj.ToString(), autoload, true, true);
            }

            if (cls != null)
            {
                ArrayValue array = new ArrayValueImpl();

                QuercusClass parent = cls;

                while ((parent = parent.getParent()) != null)
                {
                    string name = parent.getName();

                    array.put(name, name);
                }

                return(array);
            }
            else
            {
                return(BooleanValue.FALSE);
            }
        }
 /**
  *  Alias of exif_read_data()
  */
 public static Value read_exif_data(Env env, string file,
                                    @Optional string sections,
                                    @Optional bool arrays,
                                    @Optional bool thumbs)
 {
     return(exif_read_data(env, file, sections, arrays, thumbs));
 }
 /**
  *  Retrieve the embedded thumbnail of a TIFF or JPEG image
  *  @param filename the name of the image file being read.
  *  @param width the width of the returned thumbnail
  *  @param height the height of the returned thumbnail
  *  @param imagetype either TIFF or JPEG
  *  @return either the thumbnail or FALSE
  */
 public static Value exif_thumbnail(Env env, string file,
                                    @Optional int width,
                                    @Optional int height,
                                    @Optional int imageType)
 {
     return(BooleanValue.FALSE);
 }
Esempio n. 8
0
 /**
  * Defines a constant
  *
  * @param env the quercus calling environment
  * @param name the constant name
  * @param value the constant value
  */
 public static Value define(Env env,
                            StringValue name,
                            Value value,
                            @Optional bool isCaseInsensitive)
 {
     return(env.addConstant(name, value, isCaseInsensitive));
 }
 /**
  *  Reads the EXIF headers from JPEG or TIFF
  */
 public static Value exif_read_data(Env env, string file,
                                    @Optional string sections,
                                    @Optional bool arrays,
                                    @Optional bool thumbs)
 {
     return(BooleanValue.FALSE);
 }
Esempio n. 10
0
        public Value getTransitions(@Optional int timestampBegin,
                                    @Optional int timestampEnd)
        {
            ArrayValue array = new ArrayValueImpl();

            return(array);
        }
        public Value mhash(Env env, int hash, StringValue data, @Optional string key)
        {
            if (key != null)
            {
                throw new UnsupportedOperationException("key");
            }

            MhashAlgorithm algorithm = _algorithmMap.get(hash);

            if (algorithm == null)
            {
                return(BooleanValue.FALSE);
            }

            MessageDigest messageDigest = algorithm.createMessageDigest();

            if (messageDigest == null)
            {
                log.warning(L.l("no MessageDigest for {0}", algorithm));

                return(BooleanValue.FALSE);
            }

            byte[] result = messageDigest.digest(data.toBytes());

            return(env.createBinaryBuilder(result));
        }
        /**
         * Get information about the most recent query.
         */
        public static Value mysql_info(Env env, @Optional Mysqli conn)
        {
            if (conn == null)
            {
                conn = getConnection(env);
            }

            return(conn.info(env));
        }
Esempio n. 13
0
        /**
         * Clears the cache
         */
        public bool apc_clear_cache(Env env, @Optional string type)
        {
            if (_cache != null)
            {
                _cache.clear();
            }

            return(true);
        }
        /**
         * Returns the number of affected rows.
         */
        public static int mysql_affected_rows(Env env, @Optional Mysqli conn)
        {
            if (conn == null)
            {
                conn = getConnection(env);
            }

            return(conn.affected_rows(env));
        }
Esempio n. 15
0
 /**
  * Exits
  */
 public static Value die(Env env, @Optional string msg)
 {
     if (msg != null)
     {
         return(env.die(msg));
     }
     else
     {
         return(env.die());
     }
 }
Esempio n. 16
0
        public static DOMText __construct(Env env, @Optional string value)
        {
            DOMText text = getImpl(env).createText();

            if (value != null && value.length() > 0)
            {
                text.setNodeValue(value);
            }

            return(text);
        }
Esempio n. 17
0
        public string getBasename(Env env, @Optional string suffix)
        {
            string name = _path.getTail();

            if (suffix != null && name.endsWith(suffix))
            {
                name = name.substring(0, name.length() - suffix.length());
            }

            return(name);
        }
        public static DOMComment __construct(Env env, @Optional string value)
        {
            DOMComment comment = getImpl(env).createComment();

            if (value != null && value.length() > 0)
            {
                comment.setNodeValue(value);
            }

            return(comment);
        }
        public RecursiveIteratorIterator(Env env,
                                         Value value,
                                         @Optional int mode, //0 == LEAVES_ONLY
                                         @Optional int flags)
        {
            RecursiveIterator iter = RecursiveIteratorProxy.create(value);

            _iterStack = new ArrayList <RecursiveIterator>();
            _iterStack.add(iter);

            _mode = mode;
        }
Esempio n. 20
0
        public static DOMAttr __construct(
            Env env, string name, @Optional string value)
        {
            DOMAttr attr = getImpl(env).createAttr(name);

            if (value != null && value.length() > 0)
            {
                attr.setNodeValue(value);
            }

            return(attr);
        }
Esempio n. 21
0
        public static Value __construct(Env env, @Optional string queueName)
        {
            JMSQueue queue = JMSModule.message_get_queue(env, queueName, null);

            if (queue == null)
            {
                env.warning(L.l("'{0}' @is an unknown JMSQueue", queueName));
                return(NullValue.NULL);
            }

            return(env.wrapJava(queue));
        }
        public static DOMProcessingInstruction __construct(
            Env env, string name, @Optional string data)
        {
            DOMProcessingInstruction pi = getImpl(env)
                                          .createProcessingInstruction(name);

            if (data != null && data.length() > 0)
            {
                pi.setData(data);
            }

            return(pi);
        }
Esempio n. 23
0
        /**
         * Returns the value for a parameter.
         */
        public double get_value(String name, @Optional double modifier)
        {
            if ("ascender".equals(name))
            {
                PDFFont font = _stream.getFont();

                if (font != null)
                {
                    return(font.getAscender());
                }
                else
                {
                    return(0);
                }
            }
            else if ("capheight".equals(name))
            {
                PDFFont font = _stream.getFont();

                if (font != null)
                {
                    return(font.getCapHeight());
                }
                else
                {
                    return(0);
                }
            }
            else if ("descender".equals(name))
            {
                PDFFont font = _stream.getFont();

                if (font != null)
                {
                    return(font.getDescender());
                }
                else
                {
                    return(0);
                }
            }
            else if ("fontsize".equals(name))
            {
                return(_stream.getFontSize());
            }
            else
            {
                return(0);
            }
        }
Esempio n. 24
0
  static public DOMDocumentType createDocumentType(
      Env env,
      @NotNull string qualifiedName,
      @Optional string publicId,
      @Optional string systemId) {
    if (qualifiedName == null)
      return null;

    if ((publicId != null && publicId.length() > 0)
        && (publicId != null && publicId.length() > 0))
      return get(env).createDocumentType(qualifiedName, publicId, systemId);
    else
      return get(env).createDocumentType(qualifiedName);
  }
        /**
         * Changes the current domain.
         *
         * @param env
         * @param domain
         * @return name of current domain after change.
         */
        public string textdomain(Env env,
                                 @Optional Value domain)
        {
            if (!domain.isNull())
            {
                string name = domain.ToString();

                setCurrentDomain(env, name);

                return(name);
            }

            return(getCurrentDomain(env).getName());
        }
        /**
         * Adds a server.
         */
        public bool addServer(Env env,
                              string host,
                              @Optional int port,
                              @Optional bool persistent,
                              @Optional int weight,
                              @Optional int timeout,
                              @Optional int retryInterval)
        {
            if (_cache == null)
            {
                connect(env, host, port, timeout);
            }

            return(true);
        }
Esempio n. 27
0
        /**
         * Imports request variables
         *
         * @param types the variables to import
         * @param prefix the prefix
         */
        public static bool import_request_variables(Env env,
                                                    string types,
                                                    @Optional string prefix)
        {
            if ("".equals(prefix))
            {
                env.notice(L.l("import_request_variables should use a prefix argument"));
            }

            for (int i = 0; i < types.length(); i++)
            {
                char ch = types[i];

                Value value = null;

                if (ch == 'c' || ch == 'C')
                {
                    value = env.getGlobalValue("_COOKIE");
                }
                else if (ch == 'g' || ch == 'G')
                {
                    value = env.getGlobalValue("_GET");
                }
                else if (ch == 'p' || ch == 'P')
                {
                    value = env.getGlobalValue("_POST");
                }

                if (!(value instanceof ArrayValue))
                {
                    continue;
                }

                ArrayValue array = (ArrayValue)value;

                for (Map.Entry <Value, Value> entry : array.entrySet())
                {
                    string key = entry.getKey().ToString();

                    env.setGlobalValue(prefix + key,
                                       array.getVar(entry.getKey()));
                }
            }

            return(true);
        }
Esempio n. 28
0
        public bool begin_document(@Optional string fileName,
                                   @Optional string optList)

        {
            _tempStream = new TempStream();
            _tempStream.openWrite();
            _os = new WriteStream(_tempStream);

            _out = new PDFWriter(_os);
            _out.beginDocument();

            _catalogId    = _out.allocateId(1);
            _rootId       = _out.allocateId(1);
            _pageParentId = _out.allocateId(1);

            return(true);
        }
Esempio n. 29
0
        public static Value unicode_decode(Env env,
                                           BinaryValue str,
                                           string encoding,
                                           @Optional int errorMode)
        {
            try {
                Decoder decoder = Decoder.create(encoding);

                return(decoder.decodeUnicode(str));
            }
            catch (UnsupportedCharsetException e) {
                log.log(Level.FINE, e.getMessage(), e);
                env.warning(L.l("unsupported charset {0}", encoding));

                return(BooleanValue.FALSE);
            }
        }
Esempio n. 30
0
        public static Value unicode_encode(Env env,
                                           UnicodeValue str,
                                           string encoding,
                                           @Optional int errorMode)
        {
            try {
                Encoder encoder = Encoder.create(encoding);

                StringValue sb = env.createBinaryBuilder();
                return(encoder.encode(sb, str));
            }
            catch (UnsupportedCharsetException e) {
                log.log(Level.FINE, e.getMessage(), e);
                env.warning(L.l("unsupported charset {0}", encoding));

                return(BooleanValue.FALSE);
            }
        }