Mgigs Sandbox

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Mgigs Sandbox

    So i am creating the whole mgigs script again and im at my very conceptual stage but i decided to go open source on this one. Reasons being that contributed code will not only help the codes grow faster but it will help keep a lid on the security from inception.

    What now?
    Im going to be attaching the script to this thread a bit later but before then i want to know those that may be interested in contributing. If the users interested in this are huge enough i will post the script.

    What stage am i now?
    I finished the structuring and i have started working through the pages one after another. So far i have just the index and login page coded, the register page is undergoing coding.

    The architecture
    I used a single front controller method, meaning that all requests pass through the index file. The index file includes a bootstrap file that fetches the correct page nased on the _GET request, and serves the function associated with the said page. All pages are actually functions. Its something like the MVC pattern only that its a really scaled down version that has no models, and the controllers are functions instead.

    What you should do?
    The first step is tp look at the coding and try to understand how it handles requests and serve pages. Also look at each function and understand how it works. This way everyone can understand whats going on and can contribute.

    So for now, i'd like to know those interested. Please note that though everyone can contribute, all codes will be well thought out before being added.
    Attached Files
    Last edited by CreativityKills; 30.05.12, 15:23.

    #2
    sounds good

    ill take a look and help where ever i can but im working on 3 different scripts of my own atm so i dont know if ill be a MAJOR contributor
    Creator of
    Epix.Mobi

    Keep an Eye on us Big things coming soon!!!!
    Need something for your site hit me up here

    http://coding-talk.com/forum/main-fo...r-your-wapsite

    Comment


      #3
      I can help if you need


      i suggest that you are doing somethings similar to this
      PHP Code:
      <?php

      $page 
      = isset($_GET['page']) ? trim($_GET['page']) : '';

      swicth($page)
      {
        default: 
        case 
      'index':
         
      $pageCatcher->fetch('index'); //where index is a function 
         
      break;

        case 
      'login':
        
      pageCatcher->fetch('login');  //where login is a function
         
      break;
         


      }



      ?>

      Comment


        #4
        though im not firmiliar with this mgigs sandbox you talk about. this project still sounds pretty interesting.
        <?php
        include ('Ghost');
        if ($Post == true) {
        echo '

        sigpic
        alt='coding-talk.com!!' />';
        echo 'Sharing Is Caring!';
        } else {
        echo '

        alt='the username GHOST has been comprimised!' />';
        echo 'OMG SOMEBODY HELP ME!!';
        }
        ?>

        Comment


          #5
          Count me in

          I already own a mobile social portal, but its been putting too much load on my server. I would like to be part of this venture, learn, contribute and share. The function page idea is an interesting one.
          tinyurl.com/earnbymobile
          Easy earning for Indians
          ---------------------
          Alternative mobile advertising network .. Minimum 100 USD pay / NET15 pay cycle, Good Brand, Best targeting for Android
          goo.gl/6vub3

          Comment


            #6
            Originally posted by antony2kx View Post
            I can help if you need


            i suggest that you are doing somethings similar to this
            PHP Code:
            <?php

            $page 
            = isset($_GET['page']) ? trim($_GET['page']) : '';

            swicth($page)
            {
              default: 
              case 
            'index':
               
            $pageCatcher->fetch('index'); //where index is a function 
               
            break;

              case 
            'login':
              
            pageCatcher->fetch('login');  //where login is a function
               
            break;
               


            }



            ?>

            Yeah but more like...
            PHP Code:
            <?php define('MGIGS_START'microtime(TRUE));
            /**
             * MobileGigs Mobile Community.
             *
             * Simple mobile community script.
             *
             * @author    Neo Ighodaro
             * @copyright    CreativityKills Web Development
             * @license    LICENSE.txt
             */

            // Start session
            session_start();

            // Directory separator
            define('DS'DIRECTORY_SEPARATOR);

            // Document root
            define('DOCROOT'realpath(dirname(__FILE__)).DS);

            // System and Application directory
            define('SYSPATH'DOCROOT.'system'.DS);
            define('APPPATH'DOCROOT.'application'.DS);

            // Include the bootstrap file
            include DOCROOT.'bootstrap.php';

            // Set default language
            I18n::set_lang('en-us');

            // Requested action/page
            $action arrGet($_GET'ac''index');

            if ( ! 
            Mgigs::valid_page($action))
            {
                
            // The page was not found :P
                
            call_user_func('mg_action_error''404');
                exit();
            }

            if (
            mg_db_connect() === FALSE)
            {
                
            // Could not connect to database O_o
                
            call_user_func('mg_action_error''3000');
                exit();
            }

            // Launch the page
            call_user_func('mg_action_'.$action);
            Thats the index that handles the requests. Though im thinking of actually making it totally OOP, but just for the sake of simplicity, im leaving it this way. Though categorizing the functions into classes sounds like another good plan.

            I think there are enough users interested in contributing to post the source codes. So i will be attaching it now.

            Added after 27 minutes:

            The title text has been updated and the source attached. Before we start suggesting codes, we will just take some time to study the script shall we?

            Architechture. . .File: index.php
            I commented on the codes as much as i can so it should not be too hard to follow it. But then lets just explain how requests are handled. Pages are loaded from the $_GET['ac']. All pages are stored in the pages.php under system and applications folders.

            Why application and system folders? I decided to separate the core libraries and the custom made application libraries and files. The system has classes that are extensible by creating a duplicate and extending it. For example, to extend the View class, create a file in the classes directory of the application folder named view.php and extend the original core class...
            PHP Code:
            <?php
            class View extends Core_View {
                
            // Extension code goes here...
            }
            There are many other things to consider before suggesting codes. I place alot of imoportance to coding styles. Let me share a few...

            //------------------------------------

            <?php echo $var ?> [okay]
            <?=$var?> [not okay] ...some servers disable the short start tags for PHP by default.

            //------------------------------------

            This also applies to pretty much any codes with { curly braces } ...foreach, for, if, while etc.

            if (1===1)
            {
            echo 'hi'; [okay] ...its really readable
            }

            if (1===1)
            echo 'hi'; [not ok]

            if (1===1){
            echo 'hi'; [not okay]
            }

            //------------------------------------


            I cant really cover everything im currently tired. if you have any questions about how it works feel free to ask. Next we will start reviewing the existing codes for security.
            Last edited by CreativityKills; 30.05.12, 15:36.

            Comment


              #7
              sounds interesting.. i hope i can also contribute to this great project.. but i have only limited knowledge about php coding..:D
              Last edited by ven0m_; 31.05.12, 00:05.

              Comment


                #8
                No questions?

                Comment

                Working...
                X