Skip to content

Commit

Permalink
Merge pull request #2246 from dreamsxin/updated_1.3.2
Browse files Browse the repository at this point in the history
Updated 1.3.2
  • Loading branch information
Phalcon committed Mar 28, 2014
2 parents 27facc2 + 355b002 commit 75276a4
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 4 deletions.
18 changes: 18 additions & 0 deletions ext/db/result/pdo.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ PHP_METHOD(Phalcon_Db_Result_Pdo, numRows);
PHP_METHOD(Phalcon_Db_Result_Pdo, dataSeek);
PHP_METHOD(Phalcon_Db_Result_Pdo, setFetchMode);
PHP_METHOD(Phalcon_Db_Result_Pdo, getInternalResult);
PHP_METHOD(Phalcon_Db_Result_Pdo, nextRowset);

ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_result___construct, 0, 0, 2)
ZEND_ARG_INFO(0, connection)
Expand All @@ -76,6 +77,7 @@ static const zend_function_entry phalcon_db_result_pdo_method_entry[] = {
PHP_ME(Phalcon_Db_Result_Pdo, dataSeek, arginfo_phalcon_db_resultinterface_dataseek, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Db_Result_Pdo, setFetchMode, arginfo_phalcon_db_resultinterface_setfetchmode, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Db_Result_Pdo, getInternalResult, arginfo_phalcon_db_resultinterface_getinternalresult, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Db_Result_Pdo, nextRowset, NULL, ZEND_ACC_PUBLIC)
PHP_FE_END
};

Expand Down Expand Up @@ -469,3 +471,19 @@ PHP_METHOD(Phalcon_Db_Result_Pdo, getInternalResult){
RETURN_MEMBER(this_ptr, "_pdoStatement");
}

/**
* Advances to the next rowset in a multi-rowset statement handle
*
* @return boolean
*/
PHP_METHOD(Phalcon_Db_Result_Pdo, nextRowset){

zval *pdo_statement;

PHALCON_MM_GROW();

pdo_statement = phalcon_fetch_nproperty_this(this_ptr, SL("_pdoStatement"), PH_NOISY TSRMLS_CC);
PHALCON_RETURN_CALL_METHOD(pdo_statement, "nextrowset");

RETURN_MM();
}
10 changes: 8 additions & 2 deletions ext/dispatcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ PHP_METHOD(Phalcon_Dispatcher, dispatch){
zval *exception = NULL;
zval *dependency_injector, *events_manager, *tmp;
zval *handler_suffix, *action_suffix, *namespace_name, *handler_name, *action_name;
zval *camelized_namespace = NULL;
int number_dispatches = 0;

PHALCON_MM_GROW();
Expand Down Expand Up @@ -710,7 +711,9 @@ PHP_METHOD(Phalcon_Dispatcher, dispatch){
if (phalcon_end_with_str(namespace_name, SL("\\"))) {
PHALCON_CONCAT_VVV(handler_class, namespace_name, camelized_class, handler_suffix);
} else {
PHALCON_CONCAT_VSVV(handler_class, namespace_name, "\\", camelized_class, handler_suffix);
PHALCON_INIT_VAR(camelized_namespace);
phalcon_camelize(camelized_namespace, namespace_name);
PHALCON_CONCAT_VSVV(handler_class, camelized_namespace, "\\", camelized_class, handler_suffix);
}
} else {
PHALCON_CONCAT_VV(handler_class, camelized_class, handler_suffix);
Expand Down Expand Up @@ -1097,6 +1100,7 @@ PHP_METHOD(Phalcon_Dispatcher, getHandlerClass){

zval *camelized_class = NULL;
zval *handler_suffix, *namespace_name, *handler_name;
zval *camelized_namespace;

PHALCON_MM_GROW();

Expand Down Expand Up @@ -1143,7 +1147,9 @@ PHP_METHOD(Phalcon_Dispatcher, getHandlerClass){
if (phalcon_end_with_str(namespace_name, SL("\\"))) {
PHALCON_CONCAT_VVV(return_value, namespace_name, camelized_class, handler_suffix);
} else {
PHALCON_CONCAT_VSVV(return_value, namespace_name, "\\", camelized_class, handler_suffix);
PHALCON_INIT_VAR(camelized_namespace);
phalcon_camelize(camelized_namespace, namespace_name);
PHALCON_CONCAT_VSVV(return_value, camelized_namespace, "\\", camelized_class, handler_suffix);
}
} else {
PHALCON_CONCAT_VV(return_value, camelized_class, handler_suffix);
Expand Down
31 changes: 29 additions & 2 deletions ext/http/request/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "http/request/exception.h"

#include <main/SAPI.h>
#include <ext/spl/spl_directory.h>

#include "kernel/main.h"
#include "kernel/memory.h"
Expand Down Expand Up @@ -66,6 +67,7 @@ PHP_METHOD(Phalcon_Http_Request_File, getKey);
PHP_METHOD(Phalcon_Http_Request_File, isUploadedFile);
PHP_METHOD(Phalcon_Http_Request_File, moveTo);
PHP_METHOD(Phalcon_Http_Request_File, __set_state);
PHP_METHOD(Phalcon_Http_Request_File, getExtension);

ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_http_request_file___construct, 0, 0, 1)
ZEND_ARG_INFO(0, file)
Expand All @@ -87,6 +89,7 @@ static const zend_function_entry phalcon_http_request_file_method_entry[] = {
PHP_ME(Phalcon_Http_Request_File, isUploadedFile, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Http_Request_File, moveTo, arginfo_phalcon_http_request_fileinterface_moveto, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Http_Request_File, __set_state, arginfo_phalcon_http_request_file___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME(Phalcon_Http_Request_File, getExtension, NULL, ZEND_ACC_PUBLIC)
PHP_FE_END
};

Expand All @@ -95,7 +98,7 @@ static const zend_function_entry phalcon_http_request_file_method_entry[] = {
*/
PHALCON_INIT_CLASS(Phalcon_Http_Request_File){

PHALCON_REGISTER_CLASS(Phalcon\\Http\\Request, File, http_request_file, phalcon_http_request_file_method_entry, 0);
PHALCON_REGISTER_CLASS_EX(Phalcon\\Http\\Request, File, http_request_file, spl_ce_SplFileInfo, phalcon_http_request_file_method_entry, 0);

zend_declare_property_null(phalcon_http_request_file_ce, SL("_name"), ZEND_ACC_PROTECTED TSRMLS_CC);
zend_declare_property_null(phalcon_http_request_file_ce, SL("_tmp"), ZEND_ACC_PROTECTED TSRMLS_CC);
Expand All @@ -104,6 +107,7 @@ PHALCON_INIT_CLASS(Phalcon_Http_Request_File){
zend_declare_property_null(phalcon_http_request_file_ce, SL("_real_type"), ZEND_ACC_PROTECTED TSRMLS_CC);
zend_declare_property_null(phalcon_http_request_file_ce, SL("_error"), ZEND_ACC_PROTECTED TSRMLS_CC);
zend_declare_property_null(phalcon_http_request_file_ce, SL("_key"), ZEND_ACC_PROTECTED TSRMLS_CC);
zend_declare_property_null(phalcon_http_request_file_ce, SL("_extension"), ZEND_ACC_PROTECTED TSRMLS_CC);

zend_class_implements(phalcon_http_request_file_ce TSRMLS_CC, 1, phalcon_http_request_fileinterface_ce);

Expand All @@ -118,6 +122,7 @@ PHALCON_INIT_CLASS(Phalcon_Http_Request_File){
PHP_METHOD(Phalcon_Http_Request_File, __construct){

zval *file, *name, *temp_name, *size, *type, *error, *key = NULL;
zval *constant, *extension = NULL;

PHALCON_MM_GROW();

Expand All @@ -131,13 +136,22 @@ PHP_METHOD(Phalcon_Http_Request_File, __construct){
PHALCON_OBS_VAR(name);
phalcon_array_fetch_string(&name, file, SL("name"), PH_NOISY);
phalcon_update_property_this(this_ptr, SL("_name"), name TSRMLS_CC);

PHALCON_INIT_VAR(constant);
if (zend_get_constant(SL("PATHINFO_EXTENSION"), constant TSRMLS_CC)) {
PHALCON_CALL_FUNCTION(&extension, "pathinfo", name, constant);
phalcon_update_property_this(this_ptr, SL("_extension"), extension TSRMLS_CC);
}
}

if (phalcon_array_isset_string(file, SS("tmp_name"))) {
PHALCON_OBS_VAR(temp_name);
phalcon_array_fetch_string(&temp_name, file, SL("tmp_name"), PH_NOISY);
phalcon_update_property_this(this_ptr, SL("_tmp"), temp_name TSRMLS_CC);
}
} else {
PHALCON_INIT_VAR(temp_name);
ZVAL_NULL(temp_name);
}

if (phalcon_array_isset_string(file, SS("size"))) {
PHALCON_OBS_VAR(size);
Expand All @@ -161,6 +175,8 @@ PHP_METHOD(Phalcon_Http_Request_File, __construct){
phalcon_update_property_this(this_ptr, SL("_key"), key TSRMLS_CC);
}

PHALCON_CALL_PARENT(NULL, phalcon_http_request_file_ce, this_ptr, "__construct", temp_name);

PHALCON_MM_RESTORE();
}

Expand Down Expand Up @@ -319,3 +335,14 @@ PHP_METHOD(Phalcon_Http_Request_File, __set_state) {
PHALCON_CALL_METHOD(NULL, return_value, "__construct", data);
PHALCON_MM_RESTORE();
}

/**
* Returns the file extension
*
* @return string
*/
PHP_METHOD(Phalcon_Http_Request_File, getExtension){


RETURN_MEMBER(this_ptr, "_extension ");
}
22 changes: 22 additions & 0 deletions ext/session/adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,16 @@ PHP_METHOD(Phalcon_Session_Adapter, destroy);
PHP_METHOD(Phalcon_Session_Adapter, __get);
PHP_METHOD(Phalcon_Session_Adapter, count);
PHP_METHOD(Phalcon_Session_Adapter, getIterator);
PHP_METHOD(Phalcon_Session_Adapter, setId);

ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_session_adapter___construct, 0, 0, 0)
ZEND_ARG_INFO(0, options)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_session_adapter_setid, 0, 0, 1)
ZEND_ARG_INFO(0, sid)
ZEND_END_ARG_INFO()

static const zend_function_entry phalcon_session_adapter_method_entry[] = {
PHP_ME(Phalcon_Session_Adapter, __construct, arginfo_phalcon_session_adapter___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
PHP_ME(Phalcon_Session_Adapter, __destruct, arginfo___destruct, ZEND_ACC_PUBLIC | ZEND_ACC_DTOR)
Expand All @@ -87,6 +92,7 @@ static const zend_function_entry phalcon_session_adapter_method_entry[] = {
PHP_MALIAS(Phalcon_Session_Adapter, offsetUnset, remove, arginfo_arrayaccess_offsetunset, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Session_Adapter, count, arginfo_countable_count, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Session_Adapter, getIterator, arginfo_iteratoraggregate_getiterator, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Session_Adapter, setId, arginfo_phalcon_session_adapter_setid, ZEND_ACC_PUBLIC)
PHP_FE_END
};

Expand Down Expand Up @@ -679,3 +685,19 @@ PHP_METHOD(Phalcon_Session_Adapter, getIterator)
object_init_ex(return_value, spl_ce_ArrayIterator);
PHALCON_CALL_METHODW(NULL, return_value, "__construct", data);
}

/**
* Set the current session id
*
*<code>
* $session->setId($id);
*</code>
*/
PHP_METHOD(Phalcon_Session_Adapter, setId){

zval *sid;

phalcon_fetch_params(0, 1, 0, &sid);

RETURN_ON_FAILURE(phalcon_set_session_id(sid TSRMLS_CC));
}

0 comments on commit 75276a4

Please sign in to comment.