/** * Phalcon_Logger constructor * * @param string $adapter * @param string $name * @param array $options */ PHP_METHOD(Phalcon_Logger, __construct){ zval *adapter = NULL, *name = NULL, *options = NULL, *class_name = NULL; zval *a0 = NULL; zval *r0 = NULL, *r1 = NULL, *r2 = NULL; zval *i0 = NULL, *i1 = NULL; zend_class_entry *ce0; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|zzz", &adapter, &name, &options) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } if (!adapter) { PHALCON_INIT_VAR(adapter); ZVAL_STRING(adapter, "File", 1); } if (!name) { PHALCON_INIT_VAR(name); ZVAL_NULL(name); } if (!options) { PHALCON_INIT_VAR(a0); array_init(a0); PHALCON_CPY_WRT(options, a0); } PHALCON_ALLOC_ZVAL_MM(r0); PHALCON_CONCAT_LEFT(r0, "Phalcon_Logger_Adapter_", adapter); PHALCON_CPY_WRT(class_name, r0); PHALCON_ALLOC_ZVAL_MM(r1); PHALCON_CALL_FUNC_PARAMS_1(r1, "class_exists", class_name, 0x012); if (!zend_is_true(r1)) { PHALCON_ALLOC_ZVAL_MM(i0); object_init_ex(i0, phalcon_logger_exception_ce); PHALCON_ALLOC_ZVAL_MM(r2); PHALCON_CONCAT_BOTH(r2, "Logger adapter '", class_name, "' cannot be found"); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(i0, "__construct", r2, PHALCON_CHECK); phalcon_throw_exception(i0 TSRMLS_CC); return; } ce0 = phalcon_fetch_class(class_name TSRMLS_CC); PHALCON_ALLOC_ZVAL_MM(i1); object_init_ex(i1, ce0); PHALCON_CALL_METHOD_PARAMS_2_NORETURN(i1, "__construct", name, options, PHALCON_CHECK); phalcon_update_property_zval(this_ptr, "_adapter", strlen("_adapter"), i1 TSRMLS_CC); PHALCON_MM_RESTORE(); }
/** * Gets HTTP header from request data * * @param string $header * @return string */ PHP_METHOD(Phalcon_Request, getHeader){ zval *header = NULL; zval *g0 = NULL; zval *r0 = NULL, *r1 = NULL, *r2 = NULL, *r3 = NULL; int eval_int; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &header) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } phalcon_get_global(&g0, "_SERVER", sizeof("_SERVER") TSRMLS_CC); eval_int = phalcon_array_isset(g0, header); if (eval_int) { PHALCON_ALLOC_ZVAL_MM(r0); phalcon_array_fetch(&r0, g0, header, PHALCON_NOISY TSRMLS_CC); PHALCON_RETURN_CHECK_CTOR(r0); } else { PHALCON_ALLOC_ZVAL_MM(r1); PHALCON_CONCAT_LEFT(r1, "HTTP_", header); eval_int = phalcon_array_isset(g0, r1); if (eval_int) { PHALCON_ALLOC_ZVAL_MM(r2); PHALCON_CONCAT_LEFT(r2, "HTTP_", header); PHALCON_ALLOC_ZVAL_MM(r3); phalcon_array_fetch(&r3, g0, r2, PHALCON_NOISY TSRMLS_CC); PHALCON_RETURN_CHECK_CTOR(r3); } } PHALCON_MM_RESTORE(); RETURN_STRING("", 1); }
/** * Magic method __get * * @param string $propertyName */ PHP_METHOD(Phalcon_Controller, __get){ zval *property_name = NULL, *model = NULL; zval *r0 = NULL, *r1 = NULL, *r2 = NULL, *r3 = NULL, *r4 = NULL; zval *t0 = NULL, *t1 = NULL, *t2 = NULL, *t3 = NULL, *t4 = NULL; zval *i0 = NULL, *i1 = NULL; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &property_name) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } if (PHALCON_COMPARE_STRING(property_name, "view")) { PHALCON_ALLOC_ZVAL_MM(r0); PHALCON_CALL_METHOD(r0, this_ptr, "_getviewcomponent", PHALCON_NO_CHECK); phalcon_update_property_zval(this_ptr, "view", strlen("view"), r0 TSRMLS_CC); PHALCON_ALLOC_ZVAL_MM(t0); phalcon_read_property(&t0, this_ptr, "view", sizeof("view")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_RETURN_CHECK_CTOR(t0); } if (PHALCON_COMPARE_STRING(property_name, "filter")) { PHALCON_ALLOC_ZVAL_MM(i0); object_init_ex(i0, phalcon_filter_ce); PHALCON_CALL_METHOD_NORETURN(i0, "__construct", PHALCON_CHECK); phalcon_update_property_zval(this_ptr, "filter", strlen("filter"), i0 TSRMLS_CC); PHALCON_ALLOC_ZVAL_MM(t1); phalcon_read_property(&t1, this_ptr, "filter", sizeof("filter")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_RETURN_CHECK_CTOR(t1); } if (PHALCON_COMPARE_STRING(property_name, "session")) { PHALCON_ALLOC_ZVAL_MM(i1); object_init_ex(i1, phalcon_session_namespace_ce); PHALCON_ALLOC_ZVAL_MM(r1); phalcon_get_class(r1, this_ptr TSRMLS_CC); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(i1, "__construct", r1, PHALCON_CHECK); phalcon_update_property_zval(this_ptr, "session", strlen("session"), i1 TSRMLS_CC); PHALCON_ALLOC_ZVAL_MM(t2); phalcon_read_property(&t2, this_ptr, "session", sizeof("session")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_RETURN_CHECK_CTOR(t2); } PHALCON_ALLOC_ZVAL_MM(t3); phalcon_read_property(&t3, this_ptr, "model", sizeof("model")-1, PHALCON_NOISY TSRMLS_CC); if (zend_is_true(t3)) { PHALCON_ALLOC_ZVAL_MM(t4); phalcon_read_property(&t4, this_ptr, "model", sizeof("model")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_CPY_WRT(model, t4); PHALCON_ALLOC_ZVAL_MM(r2); PHALCON_CALL_METHOD_PARAMS_1(r2, model, "ismodel", property_name, PHALCON_NO_CHECK); if (zend_is_true(r2)) { PHALCON_ALLOC_ZVAL_MM(r3); PHALCON_CALL_METHOD_PARAMS_1(r3, model, "getmodel", property_name, PHALCON_NO_CHECK); PHALCON_RETURN_DZVAL(r3); } } PHALCON_ALLOC_ZVAL_MM(r4); PHALCON_CONCAT_LEFT(r4, "Access to undefined property ", property_name); PHALCON_CALL_FUNC_PARAMS_1_NORETURN("trigger_error", r4, 0x033); PHALCON_MM_RESTORE(); RETURN_NULL(); }
/** * Get the conditions of query * * @return string $query */ PHP_METHOD(Phalcon_Model_Query, getConditions){ zval *controller_front = NULL, *model_manager = NULL, *model_name = NULL; zval *entity = NULL, *meta_data = NULL, *attributes = NULL, *numeric_types = NULL; zval *i = NULL, *parameters = NULL, *conditions = NULL, *value = NULL, *param = NULL; zval *condition = NULL, *index = NULL; zval *t0 = NULL, *t1 = NULL, *t2 = NULL, *t3 = NULL, *t4 = NULL, *t5 = NULL, *t6 = NULL; zval *t7 = NULL; zval *r0 = NULL, *r1 = NULL, *r2 = NULL, *r3 = NULL, *r4 = NULL, *r5 = NULL, *r6 = NULL; zval *r7 = NULL, *r8 = NULL, *r9 = NULL, *r10 = NULL, *r11 = NULL, *r12 = NULL, *r13 = NULL; zval *r14 = NULL, *r15 = NULL, *r16 = NULL, *r17 = NULL, *r18 = NULL; zval *i0 = NULL; zval *a0 = NULL, *a1 = NULL; zval *c0 = NULL; HashTable *ah0, *ah1, *ah2; HashPosition hp0, hp1, hp2; zval **hd; char *hash_index; uint hash_index_len; ulong hash_num; int hash_type; int eval_int; PHALCON_MM_GROW(); PHALCON_ALLOC_ZVAL_MM(t0); phalcon_read_property(&t0, this_ptr, "_manager", sizeof("_manager")-1, PHALCON_NOISY TSRMLS_CC); if (!zend_is_true(t0)) { PHALCON_ALLOC_ZVAL_MM(r0); PHALCON_CALL_STATIC(r0, "phalcon_controller_front", "getinstance"); PHALCON_CPY_WRT(controller_front, r0); PHALCON_ALLOC_ZVAL_MM(r1); PHALCON_CALL_METHOD(r1, controller_front, "getmodelcomponent", PHALCON_NO_CHECK); PHALCON_CPY_WRT(model_manager, r1); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(this_ptr, "setmanager", model_manager, PHALCON_NO_CHECK); } else { PHALCON_ALLOC_ZVAL_MM(t1); phalcon_read_property(&t1, this_ptr, "_manager", sizeof("_manager")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_CPY_WRT(model_manager, t1); } PHALCON_ALLOC_ZVAL_MM(t2); phalcon_read_property(&t2, this_ptr, "_models", sizeof("_models")-1, PHALCON_NOISY TSRMLS_CC); if (phalcon_valid_foreach(t2 TSRMLS_CC)) { ah0 = Z_ARRVAL_P(t2); zend_hash_internal_pointer_reset_ex(ah0, &hp0); fes_a355_0: if(zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) != SUCCESS){ goto fee_a355_0; } PHALCON_INIT_VAR(model_name); ZVAL_ZVAL(model_name, *hd, 1, 0); PHALCON_INIT_VAR(r2); PHALCON_CALL_METHOD_PARAMS_1(r2, model_manager, "getmodel", model_name, PHALCON_NO_CHECK); PHALCON_CPY_WRT(entity, r2); if (!zend_is_true(entity)) { PHALCON_INIT_VAR(i0); object_init_ex(i0, phalcon_model_exception_ce); PHALCON_INIT_VAR(r3); PHALCON_CONCAT_BOTH(r3, "The model ", model_name, " does not exist"); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(i0, "__construct", r3, PHALCON_CHECK); phalcon_throw_exception(i0 TSRMLS_CC); return; } PHALCON_INIT_VAR(r4); PHALCON_CALL_METHOD(r4, model_manager, "getmetadata", PHALCON_NO_CHECK); PHALCON_CPY_WRT(meta_data, r4); PHALCON_INIT_VAR(r5); PHALCON_CALL_METHOD_PARAMS_1(r5, meta_data, "getattributes", entity, PHALCON_NO_CHECK); PHALCON_CPY_WRT(attributes, r5); PHALCON_INIT_VAR(r6); PHALCON_CALL_METHOD_PARAMS_1(r6, meta_data, "getdatatypesnumeric", entity, PHALCON_NO_CHECK); PHALCON_CPY_WRT(numeric_types, r6); PHALCON_INIT_VAR(t3); phalcon_read_property(&t3, this_ptr, "_data", sizeof("_data")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_INIT_VAR(r7); phalcon_fast_count(r7, t3 TSRMLS_CC); if (zend_is_true(r7)) { PHALCON_INIT_VAR(i); ZVAL_LONG(i, 0); PHALCON_INIT_VAR(a0); array_init(a0); PHALCON_CPY_WRT(parameters, a0); PHALCON_INIT_VAR(a1); array_init(a1); PHALCON_CPY_WRT(conditions, a1); PHALCON_INIT_VAR(t4); phalcon_read_property(&t4, this_ptr, "_data", sizeof("_data")-1, PHALCON_NOISY TSRMLS_CC); if (phalcon_valid_foreach(t4 TSRMLS_CC)) { ah1 = Z_ARRVAL_P(t4); zend_hash_internal_pointer_reset_ex(ah1, &hp1); fes_a355_1: if(zend_hash_get_current_data_ex(ah1, (void**) &hd, &hp1) != SUCCESS){ goto fee_a355_1; } else { PHALCON_INIT_VAR(param); PHALCON_GET_FOREACH_KEY(param, ah1, hp1); } PHALCON_INIT_VAR(value); ZVAL_ZVAL(value, *hd, 1, 0); PHALCON_INIT_VAR(r8); PHALCON_CALL_FUNC_PARAMS_2(r8, "in_array", param, attributes, 0x03E); if (zend_is_true(r8)) { PHALCON_INIT_VAR(t5); ZVAL_STRING(t5, "", 1); PHALCON_INIT_VAR(r9); is_not_identical_function(r9, t5, value TSRMLS_CC); PHALCON_INIT_VAR(r11); PHALCON_CALL_FUNC_PARAMS_1(r11, "is_null", value, 0x041); PHALCON_INIT_VAR(r10); boolean_not_function(r10, r11 TSRMLS_CC); PHALCON_INIT_VAR(r12); phalcon_and_function(r12, r9, r10); if (zend_is_true(r12)) { if (!PHALCON_COMPARE_STRING(value, "@")) { eval_int = phalcon_array_isset(numeric_types, param); if (eval_int) { PHALCON_INIT_VAR(r13); PHALCON_CONCAT_VBOTH(r13, param, " = ?", i); PHALCON_CPY_WRT(condition, r13); phalcon_array_update(¶meters, i, &value, PHALCON_SEPARATE_PLZ, PHALCON_COPY, PHALCON_NO_CTOR TSRMLS_CC); } else { PHALCON_INIT_VAR(r14); PHALCON_CONCAT_VBOTH(r14, param, " LIKE ?", i); PHALCON_CPY_WRT(condition, r14); PHALCON_INIT_VAR(r15); PHALCON_CONCAT_BOTH(r15, "%", value, "%"); phalcon_array_update(¶meters, i, &r15, PHALCON_SEPARATE_PLZ, PHALCON_COPY, PHALCON_NO_CTOR TSRMLS_CC); } phalcon_array_append(&conditions, condition, PHALCON_SEPARATE_PLZ TSRMLS_CC); } } } PHALCON_SEPARATE(i); increment_function(i); zend_hash_move_forward_ex(ah1, &hp1); goto fes_a355_1; fee_a355_1: if(0){} } else { return; } } else { PHALCON_INIT_VAR(t6); phalcon_read_property(&t6, this_ptr, "_parameters", sizeof("_parameters")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_CPY_WRT(parameters, t6); PHALCON_INIT_VAR(t7); phalcon_read_property(&t7, this_ptr, "_conditions", sizeof("_conditions")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_CPY_WRT(conditions, t7); } PHALCON_INIT_VAR(c0); ZVAL_STRING(c0, " AND ", 1); PHALCON_INIT_VAR(r16); phalcon_fast_join(r16, c0, conditions TSRMLS_CC); PHALCON_CPY_WRT(conditions, r16); if (phalcon_valid_foreach(parameters TSRMLS_CC)) { ah2 = Z_ARRVAL_P(parameters); zend_hash_internal_pointer_reset_ex(ah2, &hp2); fes_a355_2: if(zend_hash_get_current_data_ex(ah2, (void**) &hd, &hp2) != SUCCESS){ goto fee_a355_2; } else { PHALCON_INIT_VAR(index); PHALCON_GET_FOREACH_KEY(index, ah2, hp2); } PHALCON_INIT_VAR(value); ZVAL_ZVAL(value, *hd, 1, 0); PHALCON_INIT_VAR(r17); PHALCON_INIT_VAR(r18); PHALCON_CONCAT_LEFT(r18, "?", index); PHALCON_CALL_FUNC_PARAMS_3(r17, "str_replace", r18, value, conditions, 0x003); PHALCON_CPY_WRT(conditions, r17); zend_hash_move_forward_ex(ah2, &hp2); goto fes_a355_2; fee_a355_2: if(0){} } else { return; } if (PHALCON_COMPARE_STRING(conditions, "")) { PHALCON_INIT_VAR(conditions); ZVAL_STRING(conditions, "1=1", 1); } PHALCON_RETURN_CHECK_CTOR(conditions); zend_hash_move_forward_ex(ah0, &hp0); goto fes_a355_0; fee_a355_0: if(0){} } else { return; } PHALCON_MM_RESTORE(); }
PHP_METHOD(Phalcon_Flash, _showMessage){ zval *v0 = NULL, *v1 = NULL, *v2 = NULL, *v3 = NULL; zval *r0 = NULL, *r1 = NULL, *r2 = NULL, *r3 = NULL, *r4 = NULL, *r5 = NULL, *r6 = NULL; zval *c0 = NULL; zval *t0 = NULL, *t1 = NULL; HashTable *ah0; HashPosition hp0; zval **hd; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &v0, &v1) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } if (Z_TYPE_P(v1) == IS_ARRAY) { PHALCON_ALLOC_ZVAL_MM(r0); PHALCON_INIT_VAR(c0); ZVAL_STRING(c0, " ", 1); PHALCON_CALL_FUNC_PARAMS_2(r0, "join", c0, v1, 0x00F); PHALCON_CPY_WRT(v2, r0); } else { PHALCON_CPY_WRT(v2, v1); } if (Z_TYPE_P(v0) == IS_ARRAY) { if (Z_TYPE_P(v0) != IS_ARRAY) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid argument supplied for foreach()"); } else { ah0 = Z_ARRVAL_P(v0); zend_hash_internal_pointer_reset_ex(ah0, &hp0); fes_3b3c_0: if(zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) != SUCCESS){ goto fee_3b3c_0; } PHALCON_INIT_VAR(v3); ZVAL_ZVAL(v3, *hd, 1, 0); PHALCON_INIT_VAR(r3); PHALCON_CONCAT_LEFT(r3, "<div class=\"", v2); PHALCON_INIT_VAR(r2); PHALCON_CONCAT_VBOTH(r2, r3, "\">", v3); PHALCON_INIT_VAR(t0); zend_get_constant("PHP_EOL", strlen("PHP_EOL"), t0 TSRMLS_CC); PHALCON_INIT_VAR(r1); PHALCON_CONCAT_VBOTH(r1, r2, "</div>", t0); zend_print_zval(r1, 0); zend_hash_move_forward_ex(ah0, &hp0); goto fes_3b3c_0; fee_3b3c_0: if(0){ }; } } else { PHALCON_ALLOC_ZVAL_MM(r6); PHALCON_CONCAT_LEFT(r6, "<div class=\"", v2); PHALCON_ALLOC_ZVAL_MM(r5); PHALCON_CONCAT_VBOTH(r5, r6, "\">", v0); PHALCON_ALLOC_ZVAL_MM(t1); zend_get_constant("PHP_EOL", strlen("PHP_EOL"), t1 TSRMLS_CC); PHALCON_ALLOC_ZVAL_MM(r4); PHALCON_CONCAT_VBOTH(r4, r5, "</div>", t1); zend_print_zval(r4, 0); } PHALCON_MM_RESTORE(); RETURN_NULL(); }