예제 #1
0
/**
 * Check if the current page use SSL connection on not
 *
 * @return bool uses SSL
 */
PHP_METHOD(Phady_Util_Tools, usingSecureMode) {

	zval *_SERVER, *_0, *_2 = NULL, *_3;
	zend_bool secureMode, _1;

	ZEPHIR_MM_GROW();
	zephir_get_global(&_SERVER, SS("_SERVER") TSRMLS_CC);

	if (zephir_array_isset_string(_SERVER, SS("HTTPS"))) {
		zephir_array_fetch_string(&_0, _SERVER, SL("HTTPS"), PH_NOISY | PH_READONLY, "phady/util/tools.zep", 113 TSRMLS_CC);
		_1 = ZEPHIR_IS_LONG(_0, 1);
		if (!(_1)) {
			ZEPHIR_INIT_VAR(_2);
			zephir_array_fetch_string(&_3, _SERVER, SL("HTTPS"), PH_NOISY | PH_READONLY, "phady/util/tools.zep", 113 TSRMLS_CC);
			zephir_fast_strtolower(_2, _3);
			_1 = ZEPHIR_IS_STRING(_2, "on");
		}
		secureMode = _1;
	} else if (zephir_array_isset_string(_SERVER, SS("SSL"))) {
		zephir_array_fetch_string(&_0, _SERVER, SL("SSL"), PH_NOISY | PH_READONLY, "phady/util/tools.zep", 117 TSRMLS_CC);
		_1 = ZEPHIR_IS_LONG(_0, 1);
		if (!(_1)) {
			ZEPHIR_INIT_NVAR(_2);
			zephir_array_fetch_string(&_3, _SERVER, SL("SSL"), PH_NOISY | PH_READONLY, "phady/util/tools.zep", 117 TSRMLS_CC);
			zephir_fast_strtolower(_2, _3);
			_1 = ZEPHIR_IS_STRING(_2, "on");
		}
		secureMode = _1;
	} else {
		secureMode = 0;
	}
	RETURN_MM_BOOL(secureMode);

}
예제 #2
0
PHP_METHOD(Test_Exceptions, testExceptionLiteral) {

	zval *type_param = NULL;
	zval *type = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 0, &type_param);

	zephir_get_strval(type, type_param);


	do {
		if (ZEPHIR_IS_STRING(type, "string")) {
			ZEPHIR_THROW_EXCEPTION_DEBUG_STR(zend_exception_get_default(TSRMLS_C), "Test", "test/exceptions.zep", 53);
			return;
		}
		if (ZEPHIR_IS_STRING(type, "char")) {
			ZEPHIR_THROW_EXCEPTION_DEBUG_STR(zend_exception_get_default(TSRMLS_C), "t", "test/exceptions.zep", 55);
			return;
		}
		if (ZEPHIR_IS_STRING(type, "int")) {
			ZEPHIR_THROW_EXCEPTION_DEBUG_STR(zend_exception_get_default(TSRMLS_C), "123", "test/exceptions.zep", 57);
			return;
		}
		if (ZEPHIR_IS_STRING(type, "double")) {
			ZEPHIR_THROW_EXCEPTION_DEBUG_STR(zend_exception_get_default(TSRMLS_C), "123.123", "test/exceptions.zep", 59);
			return;
		}
	} while(0);

	ZEPHIR_MM_RESTORE();

}
예제 #3
0
/**
 * Gets number of rows returned by a resultset
 *
 *<code>
 *	$result = $connection->query("SELECT * FROM robots ORDER BY name");
 *	echo 'There are ', $result->numRows(), ' rows in the resultset';
 *</code>
 */
PHP_METHOD(Phalcon_Db_Result_Pdo, numRows) {

	zend_bool _0$$3;
	zval *sqlStatement = NULL, *rowCount = NULL, *connection = NULL, *type = NULL, *pdoStatement = NULL, *matches = NULL, *result = NULL, *row = NULL, *_1$$6, _2$$6, *_3$$7, *_4$$7, *_5$$7, *_6$$7;
	int ZEPHIR_LAST_CALL_STATUS;

	ZEPHIR_MM_GROW();

	ZEPHIR_OBS_VAR(rowCount);
	zephir_read_property_this(&rowCount, this_ptr, SL("_rowCount"), PH_NOISY_CC);
	if (ZEPHIR_IS_FALSE_IDENTICAL(rowCount)) {
		ZEPHIR_OBS_VAR(connection);
		zephir_read_property_this(&connection, this_ptr, SL("_connection"), PH_NOISY_CC);
		ZEPHIR_CALL_METHOD(&type, connection, "gettype", NULL, 0);
		zephir_check_call_status();
		_0$$3 = ZEPHIR_IS_STRING(type, "mysql");
		if (!(_0$$3)) {
			_0$$3 = ZEPHIR_IS_STRING(type, "pgsql");
		}
		if (_0$$3) {
			ZEPHIR_OBS_VAR(pdoStatement);
			zephir_read_property_this(&pdoStatement, this_ptr, SL("_pdoStatement"), PH_NOISY_CC);
			ZEPHIR_CALL_METHOD(&rowCount, pdoStatement, "rowcount", NULL, 0);
			zephir_check_call_status();
		}
		if (ZEPHIR_IS_FALSE_IDENTICAL(rowCount)) {
			ZEPHIR_OBS_VAR(sqlStatement);
			zephir_read_property_this(&sqlStatement, this_ptr, SL("_sqlStatement"), PH_NOISY_CC);
			if (!(zephir_start_with_str(sqlStatement, SL("SELECT COUNT(*) ")))) {
				ZEPHIR_INIT_VAR(matches);
				ZVAL_NULL(matches);
				ZEPHIR_INIT_VAR(_1$$6);
				ZEPHIR_SINIT_VAR(_2$$6);
				ZVAL_STRING(&_2$$6, "/^SELECT\\s+(.*)/i", 0);
				zephir_preg_match(_1$$6, &_2$$6, sqlStatement, matches, 0, 0 , 0  TSRMLS_CC);
				if (zephir_is_true(_1$$6)) {
					zephir_array_fetch_long(&_3$$7, matches, 1, PH_NOISY | PH_READONLY, "phalcon/db/result/pdo.zep", 217 TSRMLS_CC);
					ZEPHIR_INIT_VAR(_4$$7);
					ZEPHIR_CONCAT_SVS(_4$$7, "SELECT COUNT(*) \"numrows\" FROM (SELECT ", _3$$7, ")");
					_5$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_bindParams"), PH_NOISY_CC);
					_6$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_bindTypes"), PH_NOISY_CC);
					ZEPHIR_CALL_METHOD(&result, connection, "query", NULL, 0, _4$$7, _5$$7, _6$$7);
					zephir_check_call_status();
					ZEPHIR_CALL_METHOD(&row, result, "fetch", NULL, 0);
					zephir_check_call_status();
					ZEPHIR_OBS_NVAR(rowCount);
					zephir_array_fetch_string(&rowCount, row, SL("numrows"), PH_NOISY, "phalcon/db/result/pdo.zep", 219 TSRMLS_CC);
				}
			} else {
				ZEPHIR_INIT_NVAR(rowCount);
				ZVAL_LONG(rowCount, 1);
			}
		}
		zephir_update_property_this(this_ptr, SL("_rowCount"), rowCount TSRMLS_CC);
	}
	RETURN_CCTOR(rowCount);

}
예제 #4
0
/**
 * Inserts jobs into the queue
 */
PHP_METHOD(Phalcon_Queue_Beanstalk, put) {

	zend_bool _2;
	zephir_fcall_cache_entry *_1 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *options = NULL;
	zval *data, *options_param = NULL, *priority = NULL, *delay = NULL, *ttr = NULL, *serialized = NULL, *response = NULL, *status = NULL, *length = NULL, *_0, *_3;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 1, &data, &options_param);

	if (!options_param) {
		ZEPHIR_INIT_VAR(options);
		array_init(options);
	} else {
		zephir_get_arrval(options, options_param);
	}


	ZEPHIR_OBS_VAR(priority);
	if (!(zephir_array_isset_string_fetch(&priority, options, SS("priority"), 0 TSRMLS_CC))) {
		ZEPHIR_INIT_NVAR(priority);
		ZVAL_LONG(priority, 100);
	}
	ZEPHIR_OBS_VAR(delay);
	if (!(zephir_array_isset_string_fetch(&delay, options, SS("delay"), 0 TSRMLS_CC))) {
		ZEPHIR_INIT_NVAR(delay);
		ZVAL_LONG(delay, 0);
	}
	ZEPHIR_OBS_VAR(ttr);
	if (!(zephir_array_isset_string_fetch(&ttr, options, SS("ttr"), 0 TSRMLS_CC))) {
		ZEPHIR_INIT_NVAR(ttr);
		ZVAL_LONG(ttr, 86400);
	}
	ZEPHIR_CALL_FUNCTION(&serialized, "serialize", NULL, 75, data);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(length);
	ZVAL_LONG(length, zephir_fast_strlen_ev(serialized));
	ZEPHIR_INIT_VAR(_0);
	ZEPHIR_CONCAT_SVSVSVSV(_0, "put ", priority, " ", delay, " ", ttr, " ", length);
	ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", &_1, 0, _0);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", &_1, 0, serialized);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 382);
	zephir_check_call_status();
	zephir_array_fetch_long(&status, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 150 TSRMLS_CC);
	_2 = !ZEPHIR_IS_STRING(status, "INSERTED");
	if (_2) {
		_2 = !ZEPHIR_IS_STRING(status, "BURIED");
	}
	if (_2) {
		RETURN_MM_BOOL(0);
	}
	zephir_array_fetch_long(&_3, response, 1, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 156 TSRMLS_CC);
	RETURN_CTOR(_3);

}
예제 #5
0
/**
 * Inserts jobs into the queue
 *
 * @param string data
 * @param array options
 */
PHP_METHOD(Phalcon_Queue_Beanstalk, put) {

	zend_bool _4;
	zephir_fcall_cache_entry *_2 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;
	zephir_nts_static zephir_fcall_cache_entry *_0 = NULL, *_3 = NULL;
	zval *data, *options = NULL, *priority = NULL, *delay = NULL, *ttr = NULL, *serialized = NULL, *response = NULL, *status, *length, *_1, *_5;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 1, &data, &options);

	if (!options) {
		options = ZEPHIR_GLOBAL(global_null);
	}


	ZEPHIR_OBS_VAR(priority);
	if (!(zephir_array_isset_string_fetch(&priority, options, SS("priority"), 0 TSRMLS_CC))) {
		ZEPHIR_INIT_NVAR(priority);
		ZVAL_LONG(priority, 100);
	}
	ZEPHIR_OBS_VAR(delay);
	if (!(zephir_array_isset_string_fetch(&delay, options, SS("delay"), 0 TSRMLS_CC))) {
		ZEPHIR_INIT_NVAR(delay);
		ZVAL_LONG(delay, 0);
	}
	ZEPHIR_OBS_VAR(ttr);
	if (!(zephir_array_isset_string_fetch(&ttr, options, SS("ttr"), 0 TSRMLS_CC))) {
		ZEPHIR_INIT_NVAR(ttr);
		ZVAL_LONG(ttr, 86400);
	}
	ZEPHIR_CALL_FUNCTION(&serialized, "serialize", &_0, data);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(length);
	ZVAL_LONG(length, zephir_fast_strlen_ev(serialized));
	ZEPHIR_INIT_VAR(_1);
	ZEPHIR_CONCAT_SVSVSVSV(_1, "put ", priority, " ", delay, " ", ttr, " ", length);
	ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", &_2, _1);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", &_2, serialized);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", &_3);
	zephir_check_call_status();
	zephir_array_fetch_long(&status, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 128 TSRMLS_CC);
	_4 = !ZEPHIR_IS_STRING(status, "INSERTED");
	if (_4) {
		_4 = !ZEPHIR_IS_STRING(status, "BURIED");
	}
	if (_4) {
		RETURN_MM_BOOL(0);
	}
	zephir_array_fetch_long(&_5, response, 1, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 134 TSRMLS_CC);
	RETURN_CTOR(_5);

}
예제 #6
0
/**
 * Returns the active version (string)
 *
 * <code>
 * echo Phalcon\Version::get();
 * </code>
 */
PHP_METHOD(Phalcon_Version, get) {

	zval *version = NULL, *major = NULL, *medium = NULL, *minor = NULL, *special = NULL, *specialNumber = NULL, *result = NULL, *suffix = NULL, *_1$$3;
	zephir_fcall_cache_entry *_0 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;

	ZEPHIR_MM_GROW();

	ZEPHIR_CALL_STATIC(&version, "_getversion", NULL, 0);
	zephir_check_call_status();
	ZEPHIR_OBS_VAR(major);
	zephir_array_fetch_long(&major, version, 0, PH_NOISY, "phalcon/version.zep", 139 TSRMLS_CC);
	ZEPHIR_OBS_VAR(medium);
	zephir_array_fetch_long(&medium, version, 1, PH_NOISY, "phalcon/version.zep", 140 TSRMLS_CC);
	ZEPHIR_OBS_VAR(minor);
	zephir_array_fetch_long(&minor, version, 2, PH_NOISY, "phalcon/version.zep", 141 TSRMLS_CC);
	ZEPHIR_OBS_VAR(special);
	zephir_array_fetch_long(&special, version, 3, PH_NOISY, "phalcon/version.zep", 142 TSRMLS_CC);
	ZEPHIR_OBS_VAR(specialNumber);
	zephir_array_fetch_long(&specialNumber, version, 4, PH_NOISY, "phalcon/version.zep", 143 TSRMLS_CC);
	ZEPHIR_INIT_VAR(result);
	ZEPHIR_CONCAT_VSVSVS(result, major, ".", medium, ".", minor, " ");
	ZEPHIR_CALL_STATIC(&suffix, "_getspecial", &_0, 472, special);
	zephir_check_call_status();
	if (!ZEPHIR_IS_STRING(suffix, "")) {
		ZEPHIR_INIT_VAR(_1$$3);
		ZEPHIR_CONCAT_VSV(_1$$3, suffix, " ", specialNumber);
		zephir_concat_self(&result, _1$$3 TSRMLS_CC);
	}
	zephir_fast_trim(return_value, result, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC);
	RETURN_MM();

}
예제 #7
0
/**
 * Get stats of a tube.
 */
PHP_METHOD(Phalcon_Queue_Beanstalk, statsTube) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *tube_param = NULL, *response = NULL, *_1, *_2;
	zval *tube = NULL, *_0;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 0, &tube_param);

	if (unlikely(Z_TYPE_P(tube_param) != IS_STRING && Z_TYPE_P(tube_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tube' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	if (likely(Z_TYPE_P(tube_param) == IS_STRING)) {
		zephir_get_strval(tube, tube_param);
	} else {
		ZEPHIR_INIT_VAR(tube);
		ZVAL_EMPTY_STRING(tube);
	}


	ZEPHIR_INIT_VAR(_0);
	ZEPHIR_CONCAT_SV(_0, "stats-tube ", tube);
	ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(&response, this_ptr, "readyaml", NULL, 384);
	zephir_check_call_status();
	zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 249 TSRMLS_CC);
	if (!ZEPHIR_IS_STRING(_1, "OK")) {
		RETURN_MM_BOOL(0);
	}
	zephir_array_fetch_long(&_2, response, 2, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 253 TSRMLS_CC);
	RETURN_CTOR(_2);

}
예제 #8
0
PHP_METHOD(Litesploit_Litepreter, engine) {

	int ZEPHIR_LAST_CALL_STATUS;
	zephir_fcall_cache_entry *_2 = NULL;
	zval *_SERVER, *location = NULL, *_0, _1, *_3;

	ZEPHIR_MM_GROW();
	zephir_get_global(&_SERVER, SS("_SERVER") TSRMLS_CC);

	zephir_array_fetch_string(&_0, _SERVER, SL("SCRIPT_NAME"), PH_NOISY | PH_READONLY, "litesploit/litepreter.zep", 8 TSRMLS_CC);
	ZEPHIR_SINIT_VAR(_1);
	ZVAL_STRING(&_1, "/", 0);
	ZEPHIR_INIT_VAR(location);
	zephir_fast_trim(location, _0, &_1, ZEPHIR_TRIM_BOTH TSRMLS_CC);
	if (ZEPHIR_IS_STRING(location, "")) {
		ZEPHIR_INIT_NVAR(location);
		ZVAL_STRING(location, "exploit.lite", 1);
	}
	ZEPHIR_INIT_VAR(_3);
	ZVAL_STRING(_3, "text/html", ZEPHIR_TEMP_PARAM_COPY);
	ZEPHIR_CALL_SELF(NULL, "content", &_2, 20, location, _3);
	zephir_check_temp_parameter(_3);
	zephir_check_call_status();
	ZEPHIR_MM_RESTORE();

}
예제 #9
0
/**
 * The kick command applies only to the currently used tube.
 */
PHP_METHOD(Phalcon_Queue_Beanstalk, kick) {

	zval *_1;
	zval *bound_param = NULL, *response = NULL, _0, *_2, *_3;
	int bound, ZEPHIR_LAST_CALL_STATUS;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 0, &bound_param);

	bound = zephir_get_intval(bound_param);


	ZEPHIR_SINIT_VAR(_0);
	ZVAL_LONG(&_0, bound);
	ZEPHIR_INIT_VAR(_1);
	ZEPHIR_CONCAT_SV(_1, "kick ", &_0);
	ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _1);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 409);
	zephir_check_call_status();
	zephir_array_fetch_long(&_2, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 306 TSRMLS_CC);
	if (!ZEPHIR_IS_STRING(_2, "KICKED")) {
		RETURN_MM_BOOL(0);
	}
	ZEPHIR_OBS_VAR(_3);
	zephir_array_fetch_long(&_3, response, 1, PH_NOISY, "phalcon/queue/beanstalk.zep", 310 TSRMLS_CC);
	RETURN_MM_LONG(zephir_get_intval(_3));

}
예제 #10
0
/**
 * Return the next job in the list of buried jobs.
 */
PHP_METHOD(Phalcon_Queue_Beanstalk, peekDelayed) {

	zval *response = NULL, *_0 = NULL, *_1, *_2, *_3, *_4 = NULL, *_5, *_6 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;

	ZEPHIR_MM_GROW();

	ZEPHIR_INIT_VAR(_1);
	ZVAL_STRING(_1, "peek-delayed", ZEPHIR_TEMP_PARAM_COPY);
	ZEPHIR_CALL_METHOD(&_0, this_ptr, "write", NULL, 0, _1);
	zephir_check_temp_parameter(_1);
	zephir_check_call_status();
	if (!(zephir_is_true(_0))) {
		RETURN_MM_BOOL(0);
	}
	ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 409);
	zephir_check_call_status();
	zephir_array_fetch_long(&_2, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 444 TSRMLS_CC);
	if (!ZEPHIR_IS_STRING(_2, "FOUND")) {
		RETURN_MM_BOOL(0);
	}
	object_init_ex(return_value, phalcon_queue_beanstalk_job_ce);
	zephir_array_fetch_long(&_3, response, 1, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 448 TSRMLS_CC);
	zephir_array_fetch_long(&_5, response, 2, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 448 TSRMLS_CC);
	ZEPHIR_CALL_METHOD(&_4, this_ptr, "read", NULL, 0, _5);
	zephir_check_call_status();
	ZEPHIR_CALL_FUNCTION(&_6, "unserialize", NULL, 66, _4);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 410, this_ptr, _3, _6);
	zephir_check_call_status();
	RETURN_MM();

}
예제 #11
0
/**
 * Return the next job in the list of buried jobs
 */
PHP_METHOD(Phalcon_Queue_Beanstalk, peekBuried) {

	zephir_nts_static zephir_fcall_cache_entry *_1 = NULL, *_7 = NULL, *_8 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *response = NULL, *_0, *_2, *_3, *_4 = NULL, *_5, *_6 = NULL;

	ZEPHIR_MM_GROW();

	ZEPHIR_INIT_VAR(_0);
	ZVAL_STRING(_0, "peek-buried", ZEPHIR_TEMP_PARAM_COPY);
	ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, _0);
	zephir_check_temp_parameter(_0);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", &_1);
	zephir_check_call_status();
	zephir_array_fetch_long(&_2, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 227 TSRMLS_CC);
	if (!ZEPHIR_IS_STRING(_2, "FOUND")) {
		RETURN_MM_BOOL(0);
	}
	object_init_ex(return_value, phalcon_queue_beanstalk_job_ce);
	zephir_array_fetch_long(&_3, response, 1, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 231 TSRMLS_CC);
	zephir_array_fetch_long(&_5, response, 2, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 231 TSRMLS_CC);
	ZEPHIR_CALL_METHOD(&_4, this_ptr, "read", NULL, _5);
	zephir_check_call_status();
	ZEPHIR_CALL_FUNCTION(&_6, "unserialize", &_7, _4);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_8, this_ptr, _3, _6);
	zephir_check_call_status();
	RETURN_MM();

}
예제 #12
0
/**
 * Return the next job in the list of buried jobs
 */
PHP_METHOD(Phalcon_Queue_Beanstalk, peekBuried) {

	zval *response = NULL, *_0, *_1, *_2, *_3 = NULL, *_4, *_5 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;

	ZEPHIR_MM_GROW();

	ZEPHIR_INIT_VAR(_0);
	ZVAL_STRING(_0, "peek-buried", ZEPHIR_TEMP_PARAM_COPY);
	ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, _0);
	zephir_check_temp_parameter(_0);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 382);
	zephir_check_call_status();
	zephir_array_fetch_long(&_1, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 300 TSRMLS_CC);
	if (!ZEPHIR_IS_STRING(_1, "FOUND")) {
		RETURN_MM_BOOL(0);
	}
	object_init_ex(return_value, phalcon_queue_beanstalk_job_ce);
	zephir_array_fetch_long(&_2, response, 1, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 304 TSRMLS_CC);
	zephir_array_fetch_long(&_4, response, 2, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 304 TSRMLS_CC);
	ZEPHIR_CALL_METHOD(&_3, this_ptr, "read", NULL, 0, _4);
	zephir_check_call_status();
	ZEPHIR_CALL_FUNCTION(&_5, "unserialize", NULL, 76, _3);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 383, this_ptr, _2, _5);
	zephir_check_call_status();
	RETURN_MM();

}
예제 #13
0
/**
 * List all tables in database
 *
 * <code>
 *    print_r($dialect->listTables("blog"))
 * </code>
 */
PHP_METHOD(Phalcon_Db_Dialect_Oracle, listTables) {

	int ZEPHIR_LAST_CALL_STATUS;
	zephir_fcall_cache_entry *_1 = NULL;
	zval *schemaName_param = NULL, *_0 = NULL;
	zval *schemaName = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 0, 1, &schemaName_param);

	if (!schemaName_param) {
		ZEPHIR_INIT_VAR(schemaName);
		ZVAL_EMPTY_STRING(schemaName);
	} else {
		zephir_get_strval(schemaName, schemaName_param);
	}


	if (!ZEPHIR_IS_STRING(schemaName, "")) {
		ZEPHIR_CALL_CE_STATIC(&_0, phalcon_text_ce, "upper", &_1, 144, schemaName);
		zephir_check_call_status();
		ZEPHIR_CONCAT_SVS(return_value, "SELECT TABLE_NAME, OWNER FROM ALL_TABLES WHERE OWNER='", _0, "' ORDER BY OWNER, TABLE_NAME");
		RETURN_MM();
	}
	RETURN_MM_STRING("SELECT TABLE_NAME, OWNER FROM ALL_TABLES ORDER BY OWNER, TABLE_NAME", 1);

}
예제 #14
0
/**
 * Checks for annotations in the controller docblock
 */
PHP_METHOD(Phalcon_Mvc_Router_Annotations, processControllerAnnotation) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *handler_param = NULL, *annotation, *_0 = NULL, *_1 = NULL, *_2;
	zval *handler = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 2, 0, &handler_param, &annotation);

	if (unlikely(Z_TYPE_P(handler_param) != IS_STRING && Z_TYPE_P(handler_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'handler' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	if (likely(Z_TYPE_P(handler_param) == IS_STRING)) {
		zephir_get_strval(handler, handler_param);
	} else {
		ZEPHIR_INIT_VAR(handler);
		ZVAL_EMPTY_STRING(handler);
	}


	ZEPHIR_CALL_METHOD(&_0, annotation, "getname", NULL, 0);
	zephir_check_call_status();
	if (ZEPHIR_IS_STRING(_0, "RoutePrefix")) {
		ZEPHIR_INIT_VAR(_2);
		ZVAL_LONG(_2, 0);
		ZEPHIR_CALL_METHOD(&_1, annotation, "getargument", NULL, 0, _2);
		zephir_check_call_status();
		zephir_update_property_this(this_ptr, SL("_routePrefix"), _1 TSRMLS_CC);
	}
	ZEPHIR_MM_RESTORE();

}
예제 #15
0
/**
 * Magic function so that $obj->value will work.
 *
 * @param string $name
 * @return mixed
 */
PHP_METHOD(Yaf_Session, __get) {

    zval *name_param = NULL, *result = NULL, *_0, *_1, *_SESSION;
    zval *name = NULL;

    ZEPHIR_MM_GROW();
    zephir_fetch_params(1, 1, 0, &name_param);

    zephir_get_strval(name, name_param);


    ZEPHIR_INIT_VAR(result);
    ZVAL_NULL(result);
    if (ZEPHIR_IS_STRING(name, "")) {
        RETURN_MM_NULL();
    }
    _0 = zephir_fetch_nproperty_this(this_ptr, SL("session"), PH_NOISY_CC);
    if (zephir_array_key_exists(_0, name TSRMLS_CC)) {
        _1 = zephir_fetch_nproperty_this(this_ptr, SL("session"), PH_NOISY_CC);
        ZEPHIR_OBS_NVAR(result);
        zephir_array_fetch(&result, _1, name, PH_NOISY, "yaf/session.zep", 81 TSRMLS_CC);
    } else {
        zephir_get_global(&_SESSION, SS("_SESSION") TSRMLS_CC);
        if (zephir_array_key_exists(_SESSION, name TSRMLS_CC)) {
            zephir_get_global(&_SESSION, SS("_SESSION") TSRMLS_CC);
            ZEPHIR_OBS_NVAR(result);
            zephir_array_fetch(&result, _SESSION, name, PH_NOISY, "yaf/session.zep", 85 TSRMLS_CC);
        }
    }
    RETURN_CCTOR(result);

}
예제 #16
0
PHP_METHOD(PhalconPlus_Enum_AbstractEnum, __construct) {

	zephir_fcall_cache_entry *_9 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *val = NULL, *reflection = NULL, *defaultVal = NULL, *_0, *_1 = NULL, *_2, *_3$$3, *_4$$3 = NULL, *_5$$4, *_6$$4, _7$$4, *_8$$4 = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 0, 1, &val);

	if (!val) {
		ZEPHIR_INIT_VAR(val);
		ZVAL_STRING(val, "__PhalconPlus_AbstractEnum_DefaultValue__", 1);
	}


	ZEPHIR_INIT_VAR(reflection);
	object_init_ex(reflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC));
	ZEPHIR_INIT_VAR(_0);
	zephir_get_called_class(_0 TSRMLS_CC);
	ZEPHIR_CALL_METHOD(NULL, reflection, "__construct", NULL, 4, _0);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(_2);
	ZVAL_STRING(_2, "__default", ZEPHIR_TEMP_PARAM_COPY);
	ZEPHIR_CALL_METHOD(&_1, reflection, "hasconstant", NULL, 11, _2);
	zephir_check_temp_parameter(_2);
	zephir_check_call_status();
	if (zephir_is_true(_1)) {
		ZEPHIR_INIT_VAR(_3$$3);
		ZVAL_STRING(_3$$3, "__default", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&defaultVal, reflection, "getconstant", NULL, 12, _3$$3);
		zephir_check_temp_parameter(_3$$3);
		zephir_check_call_status();
		ZEPHIR_CALL_STATIC(&_4$$3, "isvalid", NULL, 0, defaultVal);
		zephir_check_call_status();
		if (!(zephir_is_true(_4$$3))) {
			ZEPHIR_INIT_VAR(_5$$4);
			object_init_ex(_5$$4, spl_ce_OutOfRangeException);
			ZEPHIR_INIT_VAR(_6$$4);
			zephir_get_class(_6$$4, this_ptr, 0 TSRMLS_CC);
			ZEPHIR_SINIT_VAR(_7$$4);
			ZVAL_STRING(&_7$$4, "Invalid __default enumeration %s for Enum %s", 0);
			ZEPHIR_CALL_FUNCTION(&_8$$4, "sprintf", NULL, 13, &_7$$4, defaultVal, _6$$4);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(NULL, _5$$4, "__construct", NULL, 14, _8$$4);
			zephir_check_call_status();
			zephir_throw_exception_debug(_5$$4, "phalconplus/Enum/AbstractEnum.zep", 15 TSRMLS_CC);
			ZEPHIR_MM_RESTORE();
			return;
		}
	}
	if (ZEPHIR_IS_STRING(val, "__PhalconPlus_AbstractEnum_DefaultValue__")) {
		ZEPHIR_CALL_METHOD(NULL, this_ptr, "setvalue", &_9, 0, defaultVal);
		zephir_check_call_status();
	} else {
		ZEPHIR_CALL_METHOD(NULL, this_ptr, "setvalue", &_9, 0, val);
		zephir_check_call_status();
	}
	ZEPHIR_MM_RESTORE();

}
예제 #17
0
PHP_METHOD(Test_ExitDie, testDie) {

	zend_bool _0;
	zval *param = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 0, 1, &param);

	if (!param) {
		ZEPHIR_INIT_VAR(param);
		ZVAL_STRING(param, "", 1);
	}


	_0 = Z_TYPE_P(param) == IS_STRING;
	if (_0) {
		_0 = ZEPHIR_IS_STRING(param, "");
	}
	if (_0) {
		zephir_exit_empty();
		ZEPHIR_MM_RESTORE();
	} else {
		zephir_exit(param);
		ZEPHIR_MM_RESTORE();
	}
	ZEPHIR_MM_RESTORE();

}
예제 #18
0
/**
 * Retrieve the method
 * @return string
 */
PHP_METHOD(Yaf_Request_Abstract, getMethod) {

	zend_bool _3;
	zephir_nts_static zephir_fcall_cache_entry *_2 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *method = NULL, *sapiType = NULL, *_0, *_1 = NULL, _4, _5, *_6, *_7;

	ZEPHIR_MM_GROW();

	_0 = zephir_fetch_nproperty_this(this_ptr, SL("method"), PH_NOISY_CC);
	if (Z_TYPE_P(_0) == IS_NULL) {
		ZEPHIR_INIT_VAR(_1);
		ZVAL_STRING(_1, "REQUEST_METHOD", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&method, this_ptr, "getserver", NULL, _1);
		zephir_check_temp_parameter(_1);
		zephir_check_call_status();
		if (zephir_is_true(method)) {
			zephir_update_property_this(this_ptr, SL("method"), method TSRMLS_CC);
		} else {
			ZEPHIR_CALL_FUNCTION(&sapiType, "php_sapi_name", &_2);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(_1);
			zephir_fast_strtolower(_1, sapiType);
			_3 = ZEPHIR_IS_STRING(_1, "cli");
			if (!(_3)) {
				ZEPHIR_SINIT_VAR(_4);
				ZVAL_LONG(&_4, 0);
				ZEPHIR_SINIT_VAR(_5);
				ZVAL_LONG(&_5, 3);
				ZEPHIR_INIT_VAR(_6);
				zephir_substr(_6, sapiType, 0 , 3 , 0);
				_3 = ZEPHIR_IS_STRING(_6, "cgi");
			}
			if (_3) {
				ZEPHIR_INIT_ZVAL_NREF(_7);
				ZVAL_STRING(_7, "CLI", 1);
				zephir_update_property_this(this_ptr, SL("method"), _7 TSRMLS_CC);
			} else {
				ZEPHIR_INIT_ZVAL_NREF(_7);
				ZVAL_STRING(_7, "Unknown", 1);
				zephir_update_property_this(this_ptr, SL("method"), _7 TSRMLS_CC);
			}
		}
	}
	RETURN_MM_MEMBER(this_ptr, "method");

}
예제 #19
0
파일: enum.zep.c 프로젝트: wells5609/xpl
/**
 * Allows read-only access to the "value" property, "constant" name, and "default" value.
 *
 * @param string var One of "value", "constant" or "default".
 * @return mixed
 *
 * @throws \OverflowException if var is not "value", "constant" or "default".
 */
PHP_METHOD(Xpl_Enum, __get) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *property_param = NULL, *_0, *_1$$6;
	zval *property = NULL, *_2$$6;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 0, &property_param);

	zephir_get_strval(property, property_param);


	ZEPHIR_INIT_VAR(_0);
	zephir_fast_strtolower(_0, property);
	do {
		if (ZEPHIR_IS_STRING(_0, "value")) {
			ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getvalue", NULL, 0);
			zephir_check_call_status();
			RETURN_MM();
		}
		if (ZEPHIR_IS_STRING(_0, "constant")) {
			ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getconstantname", NULL, 0);
			zephir_check_call_status();
			RETURN_MM();
		}
		if (ZEPHIR_IS_STRING(_0, "default")) {
			ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getdefaultvalue", NULL, 0);
			zephir_check_call_status();
			RETURN_MM();
		}
		ZEPHIR_INIT_VAR(_1$$6);
		object_init_ex(_1$$6, spl_ce_OverflowException);
		ZEPHIR_INIT_VAR(_2$$6);
		ZEPHIR_CONCAT_SV(_2$$6, "Invalid property: ", property);
		ZEPHIR_CALL_METHOD(NULL, _1$$6, "__construct", NULL, 99, _2$$6);
		zephir_check_call_status();
		zephir_throw_exception_debug(_1$$6, "xpl/enum.zep", 118 TSRMLS_CC);
		ZEPHIR_MM_RESTORE();
		return;
	} while(0);

	ZEPHIR_MM_RESTORE();

}
예제 #20
0
/**
 * Sends the headers to the client
 */
PHP_METHOD(Phalcon_Http_Response_Headers, send) {

	zend_bool _7$$6;
	HashTable *_3$$3;
	HashPosition _2$$3;
	zval *header = NULL, *value = NULL, *_0 = NULL, *_1$$3, **_4$$3, *_5$$5 = NULL, _8$$6 = zval_used_for_init, _9$$6 = zval_used_for_init, *_10$$6 = NULL, *_11$$8 = NULL;
	zephir_fcall_cache_entry *_6 = NULL;
	zend_long ZEPHIR_LAST_CALL_STATUS;

	ZEPHIR_MM_GROW();

	ZEPHIR_CALL_FUNCTION(&_0, "headers_sent", NULL, 28);
	zephir_check_call_status();
	if (!(zephir_is_true(_0))) {
		_1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_headers"), PH_NOISY_CC);
		zephir_is_iterable(_1$$3, &_3$$3, &_2$$3, 0, 0, "phalcon/http/response/headers.zep", 94);
		for (
		  ; zend_hash_get_current_data_ex(_3$$3, (void**) &_4$$3, &_2$$3) == SUCCESS
		  ; zend_hash_move_forward_ex(_3$$3, &_2$$3)
		) {
			ZEPHIR_GET_HMKEY(header, _3$$3, _2$$3);
			ZEPHIR_GET_HVALUE(value, _4$$3);
			if (Z_TYPE_P(value) != IS_NULL) {
				ZEPHIR_INIT_LNVAR(_5$$5);
				ZEPHIR_CONCAT_VSV(_5$$5, header, ": ", value);
				ZEPHIR_CALL_FUNCTION(NULL, "header", &_6, 257, _5$$5, ZEPHIR_GLOBAL(global_true));
				zephir_check_call_status();
			} else {
				_7$$6 = zephir_memnstr_str(header, SL(":"), "phalcon/http/response/headers.zep", 87);
				if (!(_7$$6)) {
					ZEPHIR_SINIT_NVAR(_8$$6);
					ZVAL_LONG(&_8$$6, 0);
					ZEPHIR_SINIT_NVAR(_9$$6);
					ZVAL_LONG(&_9$$6, 5);
					ZEPHIR_INIT_NVAR(_10$$6);
					zephir_substr(_10$$6, header, 0 , 5 , 0);
					_7$$6 = ZEPHIR_IS_STRING(_10$$6, "HTTP/");
				}
				if (_7$$6) {
					ZEPHIR_CALL_FUNCTION(NULL, "header", &_6, 257, header, ZEPHIR_GLOBAL(global_true));
					zephir_check_call_status();
				} else {
					ZEPHIR_INIT_LNVAR(_11$$8);
					ZEPHIR_CONCAT_VS(_11$$8, header, ": ");
					ZEPHIR_CALL_FUNCTION(NULL, "header", &_6, 257, _11$$8, ZEPHIR_GLOBAL(global_true));
					zephir_check_call_status();
				}
			}
		}
		RETURN_MM_BOOL(1);
	}
	RETURN_MM_BOOL(0);

}
예제 #21
0
PHP_METHOD(ADOdb_Connection, __set) {

    zval *name_param = NULL, *value, *_0;
    zval *name = NULL;

    ZEPHIR_MM_GROW();
    zephir_fetch_params(1, 2, 0, &name_param, &value);

    zephir_get_strval(name, name_param);


    do {
        if (ZEPHIR_IS_STRING(name, "host")) {
            _0 = zephir_fetch_nproperty_this(this_ptr, SL("dso"), PH_NOISY_CC);
            zephir_call_method_p1_noret(_0, "sethostname", value);
            break;
        }
        if (ZEPHIR_IS_STRING(name, "database")) {
            _0 = zephir_fetch_nproperty_this(this_ptr, SL("dso"), PH_NOISY_CC);
            zephir_call_method_p1_noret(_0, "setdatabase", value);
            break;
        }
        if (ZEPHIR_IS_STRING(name, "user")) {
            _0 = zephir_fetch_nproperty_this(this_ptr, SL("dso"), PH_NOISY_CC);
            zephir_call_method_p1_noret(_0, "setusername", value);
            break;
        }
        if (ZEPHIR_IS_STRING(name, "password")) {
            _0 = zephir_fetch_nproperty_this(this_ptr, SL("dso"), PH_NOISY_CC);
            zephir_call_method_p1_noret(_0, "setpassword", value);
            break;
        }
        if (ZEPHIR_IS_STRING(name, "debug")) {
            zephir_call_method_p1_noret(this_ptr, "setdebug", value);
            break;
        }
    } while(0);

    ZEPHIR_MM_RESTORE();

}
예제 #22
0
PHP_METHOD(ADOdb_Connection, __get) {

    zval *name_param = NULL, *_0;
    zval *name = NULL;

    ZEPHIR_MM_GROW();
    zephir_fetch_params(1, 1, 0, &name_param);

    zephir_get_strval(name, name_param);


    do {
        if (ZEPHIR_IS_STRING(name, "host")) {
            _0 = zephir_fetch_nproperty_this(this_ptr, SL("dso"), PH_NOISY_CC);
            zephir_call_method(return_value, _0, "gethostname");
            RETURN_MM();
        }
        if (ZEPHIR_IS_STRING(name, "database")) {
            _0 = zephir_fetch_nproperty_this(this_ptr, SL("dso"), PH_NOISY_CC);
            zephir_call_method(return_value, _0, "getdatabase");
            RETURN_MM();
        }
        if (ZEPHIR_IS_STRING(name, "user")) {
            _0 = zephir_fetch_nproperty_this(this_ptr, SL("dso"), PH_NOISY_CC);
            zephir_call_method(return_value, _0, "getusername");
            RETURN_MM();
        }
        if (ZEPHIR_IS_STRING(name, "password")) {
            _0 = zephir_fetch_nproperty_this(this_ptr, SL("dso"), PH_NOISY_CC);
            zephir_call_method(return_value, _0, "getpassword");
            RETURN_MM();
        }
        if (ZEPHIR_IS_STRING(name, "debug")) {
            RETURN_MM_MEMBER(this_ptr, "debug");
        }
    } while(0);

    ZEPHIR_MM_RESTORE();

}
예제 #23
0
PHP_METHOD(Test_Typeoff, testNativeBoolFalse) {

    zval *_0;
    zend_bool testVar;

    ZEPHIR_MM_GROW();

    testVar = 0;
    ZEPHIR_INIT_VAR(_0);
    zephir_gettype(_0, (testVar ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false)) TSRMLS_CC);
    RETURN_MM_BOOL(ZEPHIR_IS_STRING(_0, "double"));

}
예제 #24
0
/**
 *
 * @param \Phal\Entity $resource
 * @param array linksByRel
 * @return void
 */
PHP_METHOD(Phal_Format_Reader_Hal_JsonReader, transformLinks) {

	zephir_fcall_cache_entry *_4 = NULL, *_5 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;
	HashTable *_1;
	HashPosition _0;
	zval *resource, *linksByRel, *rel = NULL, *data = NULL, *link = NULL, *links = NULL, **_2, *_3 = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 2, 0, &resource, &linksByRel);



	if (!(zephir_instance_of_ev(resource, phal_entity_ce TSRMLS_CC))) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_InvalidArgumentException, "Parameter 'resource' must be an instance of 'Phal\\Entity'", "", 0);
		return;
	}
	if (Z_TYPE_P(linksByRel) != IS_ARRAY) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_InvalidArgumentException, "linksByRel must be array", "phal/format/reader/hal/jsonreader.zep", 66);
		return;
	}
	zephir_is_iterable(linksByRel, &_1, &_0, 0, 0);
	for (
	  ; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS
	  ; zephir_hash_move_forward_ex(_1, &_0)
	) {
		ZEPHIR_GET_HMKEY(rel, _1, _0);
		ZEPHIR_GET_HVALUE(data, _2);
		if (ZEPHIR_IS_STRING(rel, "self")) {
			ZEPHIR_CALL_METHOD(NULL, this_ptr, "transformselflink", NULL, resource, data);
			zephir_check_call_status();
			continue;
		}
		ZEPHIR_CALL_METHOD(&_3, this_ptr, "isassocarray", NULL, data);
		zephir_check_call_status();
		if (zephir_is_true(_3)) {
			ZEPHIR_CALL_METHOD(&link, this_ptr, "dotransformlink", NULL, data);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(NULL, resource, "setlink", &_4, rel, link);
			zephir_check_call_status();
		} else {
			ZEPHIR_CALL_METHOD(&links, this_ptr, "dotransformlinks", NULL, data);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(NULL, resource, "setlinks", &_5, rel, links);
			zephir_check_call_status();
		}
	}
	ZEPHIR_MM_RESTORE();

}
예제 #25
0
PHP_METHOD(Test_Typeoff, testNativeStringTrue) {

    zval *_0;
    zval *testVar;

    ZEPHIR_MM_GROW();

    ZEPHIR_INIT_VAR(testVar);
    ZVAL_STRING(testVar, "sdfsdf", 1);
    ZEPHIR_INIT_VAR(_0);
    zephir_gettype(_0, testVar TSRMLS_CC);
    RETURN_MM_BOOL(ZEPHIR_IS_STRING(_0, "string"));

}
예제 #26
0
/**
 * Returns the active version (string)
 *
 * <code>
 * echo Phalcon\Version::get();
 * </code>
 */
PHP_METHOD(Phalcon_Version, get) {

	zval version, major, medium, minor, special, specialNumber, result, suffix, _1$$3, _2$$4;
	zephir_fcall_cache_entry *_0 = NULL;
	zend_long ZEPHIR_LAST_CALL_STATUS;
	zval *this_ptr = getThis();

	ZVAL_UNDEF(&version);
	ZVAL_UNDEF(&major);
	ZVAL_UNDEF(&medium);
	ZVAL_UNDEF(&minor);
	ZVAL_UNDEF(&special);
	ZVAL_UNDEF(&specialNumber);
	ZVAL_UNDEF(&result);
	ZVAL_UNDEF(&suffix);
	ZVAL_UNDEF(&_1$$3);
	ZVAL_UNDEF(&_2$$4);

	ZEPHIR_MM_GROW();

	ZEPHIR_CALL_STATIC(&version, "_getversion", NULL, 0);
	zephir_check_call_status();
	ZEPHIR_OBS_VAR(&major);
	zephir_array_fetch_long(&major, &version, 0, PH_NOISY, "phalcon/version.zep", 127 TSRMLS_CC);
	ZEPHIR_OBS_VAR(&medium);
	zephir_array_fetch_long(&medium, &version, 1, PH_NOISY, "phalcon/version.zep", 128 TSRMLS_CC);
	ZEPHIR_OBS_VAR(&minor);
	zephir_array_fetch_long(&minor, &version, 2, PH_NOISY, "phalcon/version.zep", 129 TSRMLS_CC);
	ZEPHIR_OBS_VAR(&special);
	zephir_array_fetch_long(&special, &version, 3, PH_NOISY, "phalcon/version.zep", 130 TSRMLS_CC);
	ZEPHIR_OBS_VAR(&specialNumber);
	zephir_array_fetch_long(&specialNumber, &version, 4, PH_NOISY, "phalcon/version.zep", 131 TSRMLS_CC);
	ZEPHIR_INIT_VAR(&result);
	ZEPHIR_CONCAT_VSVSV(&result, &major, ".", &medium, ".", &minor);
	ZEPHIR_CALL_STATIC(&suffix, "_getspecial", &_0, 460, &special);
	zephir_check_call_status();
	if (!ZEPHIR_IS_STRING(&suffix, "")) {
		ZEPHIR_INIT_VAR(&_1$$3);
		ZEPHIR_CONCAT_SV(&_1$$3, "-", &suffix);
		zephir_concat_self(&result, &_1$$3 TSRMLS_CC);
		if (!ZEPHIR_IS_LONG(&specialNumber, 0)) {
			ZEPHIR_INIT_VAR(&_2$$4);
			ZEPHIR_CONCAT_SV(&_2$$4, ".", &specialNumber);
			zephir_concat_self(&result, &_2$$4 TSRMLS_CC);
		}
	}
	RETURN_CCTOR(&result);

}
예제 #27
0
PHP_METHOD(Test_Typeoff, testNativeDoubleTrue) {

    zval *_0, _1;
    double testVar;

    ZEPHIR_MM_GROW();

    testVar = (double) (12345);
    ZEPHIR_INIT_VAR(_0);
    ZEPHIR_SINIT_VAR(_1);
    ZVAL_DOUBLE(&_1, testVar);
    zephir_gettype(_0, &_1 TSRMLS_CC);
    RETURN_MM_BOOL(ZEPHIR_IS_STRING(_0, "double"));

}
예제 #28
0
PHP_METHOD(Test_Typeoff, testNativeIntTrue) {

    zval *_0, _1;
    int testVar;

    ZEPHIR_MM_GROW();

    testVar = 12345;
    ZEPHIR_INIT_VAR(_0);
    ZEPHIR_SINIT_VAR(_1);
    ZVAL_LONG(&_1, testVar);
    zephir_gettype(_0, &_1 TSRMLS_CC);
    RETURN_MM_BOOL(ZEPHIR_IS_STRING(_0, "integer"));

}
예제 #29
0
/**
 * Was the request made by DELETE?
 *
 * @return boolean
 */
PHP_METHOD(Yaf_Request_Abstract, isDelete) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *_0 = NULL;

	ZEPHIR_MM_GROW();

	ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmethod", NULL);
	zephir_check_call_status();
	if (ZEPHIR_IS_STRING(_0, "DELETE")) {
		RETURN_MM_BOOL(1);
	}
	RETURN_MM_BOOL(0);

}
예제 #30
0
/**
 * Generates SQL to query foreign keys on a table
 */
PHP_METHOD(Phalcon_Db_Dialect_Oracle, describeReferences) {

	int ZEPHIR_LAST_CALL_STATUS;
	zephir_fcall_cache_entry *_1 = NULL;
	zval *table_param = NULL, *schema_param = NULL, *sql, *_0 = NULL, *_2 = NULL, *_3 = NULL;
	zval *table = NULL, *schema = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 1, &table_param, &schema_param);

	if (unlikely(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	if (likely(Z_TYPE_P(table_param) == IS_STRING)) {
		zephir_get_strval(table, table_param);
	} else {
		ZEPHIR_INIT_VAR(table);
		ZVAL_EMPTY_STRING(table);
	}
	if (!schema_param) {
		ZEPHIR_INIT_VAR(schema);
		ZVAL_EMPTY_STRING(schema);
	} else {
		zephir_get_strval(schema, schema_param);
	}


	ZEPHIR_INIT_VAR(sql);
	ZVAL_STRING(sql, "SELECT AC.TABLE_NAME, CC.COLUMN_NAME, AC.CONSTRAINT_NAME, AC.R_OWNER, RCC.TABLE_NAME R_TABLE_NAME, RCC.COLUMN_NAME R_COLUMN_NAME FROM ALL_CONSTRAINTS AC JOIN ALL_CONS_COLUMNS CC ON AC.CONSTRAINT_NAME = CC.CONSTRAINT_NAME JOIN ALL_CONS_COLUMNS RCC ON AC.R_OWNER = RCC.OWNER AND AC.R_CONSTRAINT_NAME = RCC.CONSTRAINT_NAME WHERE AC.CONSTRAINT_TYPE='R' ", 1);
	if (!ZEPHIR_IS_STRING(schema, "")) {
		ZEPHIR_CALL_CE_STATIC(&_0, phalcon_text_ce, "upper", &_1, 144, schema);
		zephir_check_call_status();
		ZEPHIR_CALL_CE_STATIC(&_2, phalcon_text_ce, "upper", &_1, 144, table);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(_3);
		ZEPHIR_CONCAT_SVSVS(_3, "AND AC.OWNER='", _0, "' AND AC.TABLE_NAME = '", _2, "'");
		zephir_concat_self(&sql, _3 TSRMLS_CC);
	} else {
		ZEPHIR_CALL_CE_STATIC(&_0, phalcon_text_ce, "upper", &_1, 144, table);
		zephir_check_call_status();
		ZEPHIR_INIT_LNVAR(_3);
		ZEPHIR_CONCAT_SVS(_3, "AND AC.TABLE_NAME = '", _0, "'");
		zephir_concat_self(&sql, _3 TSRMLS_CC);
	}
	RETURN_CCTOR(sql);

}