GithubHelp home page GithubHelp logo

trongate / trongate-framework Goto Github PK

View Code? Open in Web Editor NEW
1.1K 68.0 95.0 1.11 MB

The Trongate PHP framework

Home Page: https://trongate.io

License: Other

PHP 60.49% Hack 1.21% CSS 7.51% JavaScript 30.80%

trongate-framework's Introduction

Trongate PHP Framework

logo

Break the rules use Trongate

GitHub stars are the metric by which the success of frameworks gets measured. We need 1,200 GitHub stars to make Trongate a top ten PHP framework. If Trongate becomes a top ten PHP framework it will be one of the most electrifying events in the history of PHP!

PHP8+ required contributors last update forks stars open issues


📔 Table of Contents

🌟 About the Project

Trongate was built with a love of pure PHP and a belief that PHP is best when it's easy, stable and fast. Trongate uses PHP the way that PHP was originally intended to be used, i.e., as a templating engine. Trongate is the only PHP framework that actively rejects; PSR-4 auto-loading, Composer, Packagist, rewrite culture, certification and all forms of bureaucracy.

Trongate is also the first PHP framework that has been built with a determination to remain v1 forever. Finally, PHP developers have framework that has been built with stability as a priority.

The Trongate framework will never contain features that developers don't need. Trongate will never offer certification - paid or unpaid. Instead, Trongate will continue to boldly tackle real problems that face real developers every day.

The Trongate framework is free. The Trongate desktop app is also free. These things will always be free. That's a promise!

Is this fast enough for you?

Trongate favours pure PHP over things like PSR-4 autoloading. The result? A brave new PHP framework that demolishes the competition based on every metric that counts. Pure PHP is back!

🎯 Features

Automatic Installer

No command line. No Git. No 'Composer dot phar'. No Yaml. No Packagist. Trongate installs itself. Simply download the free Trongate desktop app and set up entire database driven apps in seconds!

API Manager

Trongate's best in class API Manager sets a new standard for rapid API development. Mobile developers and JavaScript developers - you're in for a treat!

Advanced File Uploaders

Trongate sets a new standard for PHP by letting developers build highly performant features in record time. This includes some of the fastest file uploaders in the industry.

Graphical Query Builder

Trongate is the only framework that comes with a free graphical SQL query builder. So, now you can build complex table joins easily and liberate yourself from costly db management software.

Updates Itself

Whenever new features come out you get an alert, asking if you want it. If you want it, you click 'yes'. Then it self-updates. Another industry first! By the way, Trongate is also the first PHP framework that aims to be v1 forever!

Automatic Code Generator

With Trongate, you get a revolutionary code generator to help take care of boring boilerplate code. Your productivity levels are about to go through the roof!

JavaScript Components

With Trongate you can build beautiful pop up calendars, time pickers, date-range pickers and even drag and drop file uploaders in seconds!

Custom Themes

Unlike some frameworks that tether users to a particular design, Trongate lets you choose from a potentially unlimited number of design themes for your admin panels.

Custom CSS Library

Frameworks should NOT depend upon third party libraries. That's why Trongate has its own CSS library. Yet another industry first!

Modular HAVC

Trongate uses Hierarchical Asset View Controller architecture. It's like HMVC on steroids! Finally, the PHP community have a "truly modular" PHP framework.

Module Import Wizard

Easily import entire modules, including SQL data. Drag 'n' drop web development, at last.

An App Store!

Trongate's Module Market is the PHP community's first legitimate challenge to the Composer / Packagist combo. Goodbye henhouse. Hello sunshine!

🧰 Getting Started

‼️ Prerequisites

  • PHP 8+
    • gd module loaded in php.ini (for image uploader)
    • intl module loaded in php.ini (for url_title() method)
  • MariaDB or MySQL

⚙️ Installation

The Trongate PHP framework is available from GitHub at the following URL:

https://github.com/trongate/trongate-framework.

However, the fastest and easiest way to get the Trongate PHP framework is by using the Trongate Desktop App. The Trongate Desktop App is 100% free of charge (it always will be!) and is available for Mac, Windows and Linux. The Trongate Desktop App can be downloaded from:

https://trongate.io/download

There are a wide variety of benefits from using the Trongate Desktop App. These include:

  • Automatic framework downloads and setups
  • Automatic updates whenever new features are added to Trongate
  • Automatic code generation
  • Automatic database management
  • A graphical query builder

and much more... !

👀 Usage

Watch the video

👋 Contributing

Contributions are always welcome!

⚠️ License

See LICENSE.txt for more information.

🤝 Contact

David Connelly - @davidjconnelly - Get In Touch

trongate-framework's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

trongate-framework's Issues

Setting database DEBUG mode

In order to set debug mode on the database, engine/model.php needs to be edited. It would be safer and consistent with the advice not to modify engine files if this were to be moved to the config/database.php file.

delete button on admin item show page

EDIT: THIS IS RELATED TO THE TRONGATE APP

i thought i might share this suggestion of improving the delete button that you see on every items show page on the admin panel.

Right now when modules have picture uploaders you can only delete the pictures by clicking on the delete button of the picture uploader card, which is totally fine. But when you want to delete the whole item, then it leaves the directory together with the picture inside your project.

This will obviously fill up your project with unused pictures which will have an impact on host/storage costs.
It can get very unmanageable on a big website really quick, so i thought this would be something that we need to fix.

With the help of Jason aka "codefire" i improved the delete function to delete the directories together with the pictures inside them if there are any.

I don't consider the code perfect, but it does the job perfectly.

Please tell me what you think of it.

http://ums.myds.me/phpbb/viewtopic.php?p=2310&sid=2174017500ed57f6bebee8489c7065ac#p2310

Cheers,
Andy

function delete_images($module_name, $record_id) {
        $picture_directory_paths[] = [];
        $picture_directory_paths[] = APPPATH . 'public/'. $module_name .'_pics/'. $record_id . '/';
        $picture_directory_paths[] = APPPATH . 'public/'. $module_name .'_pics_thumbnails/'. $record_id . '/';
        $picture_directory_paths[] = APPPATH . 'public/'. $module_name .'_pictures/'. $record_id . '/';

        foreach ($picture_directory_paths as $picture_directory_path) {
            if (is_dir($picture_directory_path)) {

                $pictures = scandir($picture_directory_path);

                foreach ($pictures as  $pic) {

                   $full_path = $picture_directory_path . $pic;
                   unlink($full_path);

                }

            rmdir( $picture_directory_path);
            }
        }
        
    }

    function submit_delete() {
        $this->module('security');
        $this->security->_make_sure_allowed();

        $submit = $this->input('submit', true);

        if ($submit == 'Submit') {
            $update_id = $this->url->segment(3);
            $module = $this->url->segment(1);

            if (!is_numeric($update_id)) {
                die();
            } else {
                $this->delete_images($module, $update_id);
                $data['update_id'] = $update_id;

                //delete all of the comments associated with this record
                $sql = 'delete from comments where target_table = :module and update_id = :update_id';
                $data['module'] = $this->module;
                $this->model->query_bind($sql, $data);

                //delete the record
                $this->model->delete($update_id, $this->module);

                //set the flashdata
                $flash_msg = 'The record was successfully deleted';
                set_flashdata($flash_msg);

                //redirect to the manage page
                redirect($module.'/manage');
            }
        }
    }

Admin id hard coded into tg_admin_template.php

Line 25 of tg_admin_template.php is currently hard coding the admin id into the url for the link to Update Your Account:
<a href="<?= BASE_URL ?>trongate_administrators/create/1">

So when you have more than 1 admin user it always tries to update admin user 1.

Change line 25 to:
<a href="<?= BASE_URL ?>trongate_administrators/create/<?= $data['my_admin_id']?>">

Undefined constants

engine > Model.php
line 19: DEBUG = Undefined constant

engine > tg_helpers > form_helper.php
line 77: AUTOCOMPLETE = Undefined constant

Not forget in todo list: change MODULE DETAILS

I looked writing your todo list and missed one item belonging at the end of the list.

This is an item you already mentioned (and I appreciate very in the previous version).
Soon you'll be able to edit the different values from here. However, we're not quite there yet. Changes are happening daily and I appreciate your patience at this time. Cheers! - DC

image

TYPEERROR: CONN.QUERY IS NOT A FUNCTION

Screenshot from 2021-07-05 22-21-08

I don't know if this is the place to report the issue but I did not find a repo for the desktop app.

Same issue happened on both Ubuntu 20.04 and MacOS big sur.

Steps to reproduce (on ubuntu 20.04):

  • In the mysql prompt:
create user trongate_user@localhost idenified by 'qwertyuiop';
create database trongate;
grant all privileges on trongate.* to 'trongate_user'@'localhost';
flush privileges;
exit

In the Trongate App:

{
    "host" : "127.0.0.1",
    "user" : "trongate_user",
    "password" : "qwertyuiop",
    "database" : "trongate"
}
  • TYPEERROR: CONN.QUERY IS NOT A FUNCTION
    My Environment:
  • Ubuntu 20.04
  • I have php 7.4 installed
  • I have mysql 8.0.25
  • I have apache 2.4.41 (with php-mod enabled)

Misleading / incorrect error messages in engine/tg-helpers/validation_helper.php

The error messages returned from min_length() and max_length() functions in engine/tg-helpers/validation_helper.php are misleading / incorrect. Suggest they are replaced with following code:

private function min_length($key, $label, $posted_value, $inner_value) {

        if((strlen($_POST[$key])<$inner_value) && ($posted_value !== '')) {
            $this->form_submission_errors[] = 'The '.$label.' field must be at least '.$inner_value.' characters in length.';
        }

    }
    private function max_length($key, $label, $posted_value, $inner_value) {

        if((strlen($_POST[$key])>$inner_value) && ($posted_value !== '')) {
            $this->form_submission_errors[] = 'The '.$label.' field must be no more than  '.$inner_value.' characters in length.';
        }

    }

TRONGATE REQUIRES THE GD EXTENSION FOR PHP

Hello,

I've started going through some video tutorials on youtube for Trongate and am trying to get the image uploader to work however I am getting the Warning message that Trongate requires the GD extension for PHP. I have already configured my php.ini file to remove the leading semi-colon from "extension=gd". I did this for both php.ini production and php.ini development files and saved it last night and still this morning I am getting this warning message. I also made the following changes to the module for the following functions that I don't think should matter but just for the sake of completeness I'll include my changes.
Any advice?
Thanks,
Kevin

function _init_picture_settings() {

    $picture_settings['max_file_size'] = 500;

    $picture_settings['max_width'] = 2000;

    $picture_settings['max_height'] = 2000;

    $picture_settings['resized_max_width'] = 450;

    $picture_settings['resized_max_height'] = 450;

    $picture_settings['destination'] = 'itemss_pics';

    $picture_settings['target_column_name'] = 'picture';

    $picture_settings['thumbnail_dir'] = 'itemss_pics_thumbnails';

    $picture_settings['thumbnail_max_width'] = 120;

    $picture_settings['thumbnail_max_height'] = 120;

    $picture_settings['upload_to_module'] = true;

    return $picture_settings;

}

...

if ($submit == 'Upload') {

        $picture_settings = $this->_init_picture_settings();

        extract($picture_settings);



        $validation_str = 'allowed_types[gif,jpg,jpeg,png,GIF,JPG,JPEG,PNG]|max_size['.$max_file_size.']|max_width['.$max_width.']|max_height['.$max_height.']';

Administrators Login 'Remember Me' feature missing code

There is a line of code missing from Trongate_administrators.php in function "_log_user_in()" at line 247

Warning: Undefined property: Trongate_administrators::$trongate_tokens in D:\xampp\htdocs\xxxxx\modules\trongate_administrators\controllers\Trongate_administrators.php on line 247

insert the following line at line 247

$this->module('trongate_tokens');

Model.php insert() method fails on column names matching database reserved words

A help Bar post identified an issue when using specific column names (database reserved words) causing a fatal error.
The solution surrounds each column name with backticks to identify each item as a column name in the final query.

Suggested fix is as follows:

engine/Model.php ~ line 403:

$sql.= implode(", ", array_keys($data)).')';

can be replaced with:

$sql.= '`'.implode("`, `", array_keys($data)).'`)';

Undefined variable

modules > trongate_tokens > controllers > Trongate_tokens.php
line 23: $valid = undefined variable

Model.php, function get_where_custom always showing query, ignoring value of $debug

Hi David,
I saw you "fix" this on live stream, however you actually broke it. I'm not sure which issue this addressed so creating a new one.
In Model.php from 1.3.3025, at line 163 you need to put back the condition if ($this->debug == true) {
closing the curly bracket after $this->query_caveat);
Otherwise using get_where_custom will always print the queries out.

Can we add form_number to Trongate helpers.

Form_numbers would be useful I think for form_helpers.php
Looks like we only need to copy form_input and change the function name and
the return input to type="number"

and maybe adding input[type="number"] to the trongate.css

Module relation (comma seperated identifier_column does not work in the same way as prev version)

The new desktop app works great. I have my first question that has to do with the module relation. I like to use more columns in my dropdown.

Working with the old desktop app I used the posibility to use more than one "identifier_column" comma separated and worked very well.

I am not sure if with the new desktop app we have an other method to do it, or that it also can added to the new desktop app or that it cannot added.

image

Greatings Jerry

Pre-Launch Desktop App Glitch when attempting to Delete a Module

With the Pre Launch version of the Trongate Desktop App, two minor observations - neither of which seriously gets in the way of progress but are nevertheless annoying and I thought you might like to fix them before launch:

  1. Using the App to delete a Trongate Module. Click on Delete Module then Select Option to choose the module be deleted. The Text on the screen says:
    "TO DELETE THE BOOKINGS MODULE ..." presumably a leftover from an earlier project.

  2. Having then selected the module for deletion, if you then happen to mis-type the word DELETE for example DELETR a window pops up and tells you to type the word 'delete'. Then dismiss the pop up by clicking OK but the app does not allow focus back to the text field so you have to RESET the app and start again.

Unable to edit the associated bridge tables on gui

The paragraph element is display:none is set on all associated module views. Quick fix go into web inspector un-click display: none. While this does make the modal appear it still has no functionality

Update engine

For the early users of trongate some updates are easier to update when familiar with the new engine.
When by acident the engine is updated it's not easy to go back to the previous engine.

Define standard css rules

engine > tg_transferer > index.php
line 123: define standard rule @Keyframes
line 134: define standard rule: animation-name, animation-duration, animation-iteration-count, animation-timing-function, animation-direction

No way to add CORS headers

I couldn't find a way of adding CORS headers to the API to allow access from other domains - apart from manually adding it to the API in Engine. Is there another way to do this?

image

Trongate desktop app 1.0.9005 - Background image glitch upon Image Upload button

On the multi image uploader, png files with transparency are turned to black. I'm able to manually move files into the
folders and retain transparency or if I save png in gimp with index mode. I believe the function prepTransparentPng($resource) which is in the Image.php is not being called.

Linux mx 4.19.0-11-amd64 #1 SMP Debian 4.19.146-1 (2020-09-17) x86_64 GNU/Linux

Undefined $template on line 130

When records are more than 10, then it will throw an error.

To quickly recreate the issue:

Use tg-desktop app:

  1. create a new app
  2. create a new module
  3. create more than 10 records in your new module manage page

error:
undefined $template on line 130 in engine/Pagination.php

$this->_not_allowed_msg(); Undefined Method.

In the trongate_tokens module. In the _validate_token() function $this->_not_allowed_msg(); is an
undefined method. Looks like its called from the Api.php inside the engine.

Updating admin password

Validation rule for updating admin password fails. Rule calls for min 6 character and admin has 5.
Admin password can't be updated.

Problem with modals using bootstrap

Hello, im using the admin template but if i try to style the create form with bootstrap the delete record modal doesnt work anymore.
Looks like admin.css and bootstrap.css are using the same name for the modal class and maybe thats the problem.
Is there a way to have them both?
I tried to use the !important rule but with no success.

Problem with Image Upload

Maybe this has already been addressed but here goes
OS windows, Server Xampp and directory permissions looks fine, Trongate Pre-launch version while trying the image uploader

Uncaught Error: Call to undefined function imagecreatefrompng() in C:\xampp\htdocs\image_test\engine\Image.php:53
Same for imagecreatefromjpeg

Semicolons in css files

public > css > trongate-datetime.css
line 182: remove semicolon

public > css > admin.css
line 453: remove semicolon

modal can't scroll -- trongate.css

Modal can't scroll when modal height is more than
screen height. Solution I use.

@media screen and (max-width: 550px) {
  .modal {
    max-height: 85vh;
    overflow-y: auto;
  }
  button, .button {
    width: 100%;
    display: block;
  }
}

Critical security issue: Path traversal vulnerability in Core.php

In engine/Core.php, you read and display a file to the user agent without any form of authentication or validation: https://github.com/davidjconnelly/trongate-framework/blob/master/engine/Core.php#L13-L28

This file can be any file that the executing user (i.e. the apache2 or php-fpm user) has read access to. This includes sensitive configuration files such as config/db.php or your encryption class and accompanying key. Depending on the operating system's setup, this may also put the underlying system at risk of compromise.

The ideal behaviour here would be to remove the relevant branch entirely and simply place assets in the web root such that the web server can serve them without invoking PHP.

Failing that, you should pass all given URLs through realpath and check them against an allowlist.

Trying to use the Desktop App

I had the desktop app working fine on my PC for a while. Now every time I try to make a new app, I get just past the enter database connection details and I get the following error.

"typeerror: conn.query is not a function"

I have no idea what has happened. I have even re-downloaded the desktop app and it still does it.

Update:

Even deleting the trongate folder in the appdata folder has not fixed this issue.

trying to upload image using filezone

trying to upload images using trongate_filezone api


  goog.events.listen(handler, goog.events.FileDropHandler.EventType.DROP,
        function(e) {
          goog.log.log(logger, goog.log.Level.SHOUT, 'DROP event detected!');
          goog.log.info(logger, 'dataTransfer:\n' +
              goog.debug.deepExpose(e.getBrowserEvent().dataTransfer));
          var files = e.getBrowserEvent().dataTransfer.files;

          for (var i = 0; i < files.length; i++) {
            // If you want to access the filename you should try both
            // alternatives.
            var file = files[i];
            var fileName = file.name || file.fileName;
            goog.log.info(logger, 'File name: ' + fileName);
            // Sample code to upload the dropped files (commented out).
            var xhr = goog.net.XmlHttp();


            xhr.open('POST', "<?= BASE_URL ?>trongate_filezone/upload/records/33");

            var formData = new FormData();
            formData.append("upload", file, true);
            xhr.setRequestHeader('Content-type', 'application/json');
            xhr.setRequestHeader('trongateToken', "<?= $token ?>");
            xhr.setRequestHeader("Content-Type", "multipart/form-data");
           var hello = xhr.send(formData);
            xhr.onreadystatechange = function() {
            };
          }
        });

getting this issue in console

Notice: Undefined offset: 0 in /Applications/XAMPP/xamppfiles/htdocs/standardway/engine/Trongate.php on line 183



Notice: Undefined index: in /Applications/XAMPP/xamppfiles/htdocs/standardway/engine/Trongate.php on line 184



Warning: getimagesize(): Filename cannot be empty in /Applications/XAMPP/xamppfiles/htdocs/standardway/engine/Trongate.php on line 186

ERROR: non numeric image width

config/themes.php missing when upgrading from 1.3.3021 to 1.3.3031

I upgraded the TG frameswork from 1.3.3021 to 1.3.3031 using Trongate desktop app (Windows) 1.0.003

I then received Server error 500 from Apache running on Ubuntu:
The error log from apache showed this:
[Tue Jan 18 17:05:10.587411 2022] [php7:warn] [pid 76662] [client 192.168.xxx.xxx:1300] PHP Warning: require_once(../config/themes.php): failed to open stream: No such file or directory in /home/tg/app/engine/bootstrap.php on line 7
[Tue Jan 18 17:05:10.587875 2022] [php7:error] [pid 76662] [client 192.168.xxx.xxx:1300] PHP Fatal error: require_once(): Failed opening required '../config/themes.php' (include_path='.:/usr/share/php') in /home/tg/app/engine/bootstrap.php on line 7

Created themes.php in /config, populated it from config/themes.php from GitHub https://github.com/davidjconnelly/trongate-framework and then it was ok again

I don't think this was a write permission thing when the TG desktop app updated the files as license.txt and the other files updated ok.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.