Skip to main content
Code Review

Return to Question

replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

The client side version in JavaScript is here here

This is the server side version of my control module. How does the structure look.

PostScript

Because this is a small prototype/app I have preferences or things I will consider when I will have a working prototype, they are - testing, try/catch/throw handling of errors, advanced abstractions / design patterns, defensive coding against programmer error / malicious users. Auto-Loading, optimization Will add these later if the project matures.

<?php
function __autoload( $class_name ) { include 'class.' . $class_name . '.php'; }
$object_c = new CMachine(); 
$object_c->invoke();
class CMachine
{
 public function invoke()
 {
 $pipe = $this->getPipe();
 switch( $pipe['model'] )
 {
 case 'MUserNew': case 'MUserExist': 
 $model_object = new $pipe['model']( new SDB(), new SUniversals() , new SText( $pipe['page'] ), new SMessage() ); 
 $this->send( $model_object->invoke( $pipe['args'] ) );
 break;
 case 'MUserTry':
 $model_object = new $pipe['model']( new SDB(), new SText( $pipe['page'] ) );
 $test = $model_object->invoke( $pipe['args'] );
 $this->send( $test );
 break;
 case 'MUserAny': case 'MOrb': 
 $model_object = new $pipe['model']( new SDB() );
 $this->send( $model_object->invoke( $pipe['args'] ) );
 break;
 default:
 echo " -> Undefined Module Requested";
 }
 }
 private function send( $string_send )
 {
 echo "|A|" . $string_send; 
 }
 private function getPipe()
 {
 return json_decode( $_POST['pipe'], true );
 }
}

The client side version in JavaScript is here

This is the server side version of my control module. How does the structure look.

PostScript

Because this is a small prototype/app I have preferences or things I will consider when I will have a working prototype, they are - testing, try/catch/throw handling of errors, advanced abstractions / design patterns, defensive coding against programmer error / malicious users. Auto-Loading, optimization Will add these later if the project matures.

<?php
function __autoload( $class_name ) { include 'class.' . $class_name . '.php'; }
$object_c = new CMachine(); 
$object_c->invoke();
class CMachine
{
 public function invoke()
 {
 $pipe = $this->getPipe();
 switch( $pipe['model'] )
 {
 case 'MUserNew': case 'MUserExist': 
 $model_object = new $pipe['model']( new SDB(), new SUniversals() , new SText( $pipe['page'] ), new SMessage() ); 
 $this->send( $model_object->invoke( $pipe['args'] ) );
 break;
 case 'MUserTry':
 $model_object = new $pipe['model']( new SDB(), new SText( $pipe['page'] ) );
 $test = $model_object->invoke( $pipe['args'] );
 $this->send( $test );
 break;
 case 'MUserAny': case 'MOrb': 
 $model_object = new $pipe['model']( new SDB() );
 $this->send( $model_object->invoke( $pipe['args'] ) );
 break;
 default:
 echo " -> Undefined Module Requested";
 }
 }
 private function send( $string_send )
 {
 echo "|A|" . $string_send; 
 }
 private function getPipe()
 {
 return json_decode( $_POST['pipe'], true );
 }
}

The client side version in JavaScript is here

This is the server side version of my control module. How does the structure look.

PostScript

Because this is a small prototype/app I have preferences or things I will consider when I will have a working prototype, they are - testing, try/catch/throw handling of errors, advanced abstractions / design patterns, defensive coding against programmer error / malicious users. Auto-Loading, optimization Will add these later if the project matures.

<?php
function __autoload( $class_name ) { include 'class.' . $class_name . '.php'; }
$object_c = new CMachine(); 
$object_c->invoke();
class CMachine
{
 public function invoke()
 {
 $pipe = $this->getPipe();
 switch( $pipe['model'] )
 {
 case 'MUserNew': case 'MUserExist': 
 $model_object = new $pipe['model']( new SDB(), new SUniversals() , new SText( $pipe['page'] ), new SMessage() ); 
 $this->send( $model_object->invoke( $pipe['args'] ) );
 break;
 case 'MUserTry':
 $model_object = new $pipe['model']( new SDB(), new SText( $pipe['page'] ) );
 $test = $model_object->invoke( $pipe['args'] );
 $this->send( $test );
 break;
 case 'MUserAny': case 'MOrb': 
 $model_object = new $pipe['model']( new SDB() );
 $this->send( $model_object->invoke( $pipe['args'] ) );
 break;
 default:
 echo " -> Undefined Module Requested";
 }
 }
 private function send( $string_send )
 {
 echo "|A|" . $string_send; 
 }
 private function getPipe()
 {
 return json_decode( $_POST['pipe'], true );
 }
}
added 316 characters in body
Source Link
user7459
user7459
<?php
include 'class.DBOne.php';includefunction 'class.DB.php';
include__autoload( 'class.IUniversals.php';$class_name include) 'class.IText.php';{ include 'class.IMessage.php'; 
include' 'class.MUser.php';include 'class.MUserTry.php';include$class_name 'class.MUserNew.php';include 'class.MUserExist'.php'; }
$object_cin$object_c = new CIOCMachine(); 
$object_cin$object_c->invoke( $_POST[ 'model' ] );
class CIOCMachine
{
 public function invoke( $model )
 {
 $pipe = $this->getPipe();
 switch( $model$pipe['model'] )
 {
 case 'MUserTry''MUserNew': case 'MUserExist': 
 $model_object = new $model$pipe['model']( new SDB();, new SUniversals() , new SText( $pipe['page'] ), new SMessage() ); 
 $this->send( $model_object->invoke( 1$pipe['args'] ) );
 break;
 case 'MUserNew': case 'MUserExist': case 'MATweet''MUserTry':
 $model_object = new $model$pipe['model']( new IUniversalsSDB(), new ITextSText( $pipe['page'] ), new);
 IMessage $test = $model_object->invoke( $pipe['args'] );
  $this->send( $test );
 break;
 case 'MUserAny': case 'MOrb': 
  $model_object = new $pipe['model']( new SDB() );
 $this->send( $model_object->invoke( $pipe['args'] ) );
 break;
 default:
 echo "Incorrect" Ajax-> TypeUndefined provided";Module Requested";
 }
 }
 private function send( $string$string_send )
 {
 echo "|P|""|A|" . $string;$string_send; 
 }
 private function getPipe()
 {
 return json_decode( $_POST['pipe'], true );
 }
}
<?php
include 'class.DBOne.php';include 'class.DB.php';
include 'class.IUniversals.php'; include 'class.IText.php'; include 'class.IMessage.php'; 
include 'class.MUser.php';include 'class.MUserTry.php';include 'class.MUserNew.php';include 'class.MUserExist.php';
$object_cin = new CIO(); 
$object_cin->invoke( $_POST[ 'model' ] );
class CIO
{
 public function invoke( $model )
 {
 switch( $model )
 {
 case 'MUserTry':
 $model_object = new $model(); 
 $this->send( $model_object->invoke( 1 ) );
 break;
 case 'MUserNew': case 'MUserExist': case 'MATweet':
 $model_object = new $model( new IUniversals(), new IText(), new IMessage() ); 
 $this->send( $model_object->invoke() );
 break;
 default:
 echo "Incorrect Ajax Type provided";
 }
 }
 private function send( $string )
 {
 echo "|P|" . $string;
 }
}
<?php
function __autoload( $class_name ) { include 'class.' . $class_name . '.php'; }
$object_c = new CMachine(); 
$object_c->invoke();
class CMachine
{
 public function invoke()
 {
 $pipe = $this->getPipe();
 switch( $pipe['model'] )
 {
 case 'MUserNew': case 'MUserExist': 
 $model_object = new $pipe['model']( new SDB(), new SUniversals() , new SText( $pipe['page'] ), new SMessage() ); 
 $this->send( $model_object->invoke( $pipe['args'] ) );
 break;
 case 'MUserTry':
 $model_object = new $pipe['model']( new SDB(), new SText( $pipe['page'] ) );
  $test = $model_object->invoke( $pipe['args'] );
  $this->send( $test );
 break;
 case 'MUserAny': case 'MOrb': 
  $model_object = new $pipe['model']( new SDB() );
 $this->send( $model_object->invoke( $pipe['args'] ) );
 break;
 default:
 echo " -> Undefined Module Requested";
 }
 }
 private function send( $string_send )
 {
 echo "|A|" . $string_send; 
 }
 private function getPipe()
 {
 return json_decode( $_POST['pipe'], true );
 }
}
deleted 367 characters in body
Source Link
user7459
user7459
<?php
include 'class.DBOne.php';include 'class.DB.php';
include 'class.IUniversals.php'; include 'class.IText.php'; include 'class.IMessage.php'; 
include 'class.MUser.php';include 'class.MUserTry.php';include 'class.MUserNew.php';include 'class.MUserExist.php';
$object_cin = new CIO(); 
$object_cin->invoke( $_POST[ 'model' ] );
class CIO
{
 public function invoke( $model )
 {
 switch( $model ) 
 {
 case 'user_try''MUserTry':
 $model$model_object = new MUserTry$model(); 
 $this->send( $model$model_object->invoke( 1 ) );
 break;
 case 'user_new''MUserNew':
 $model = new MUserNew( new IUniversals() , new IText(), new IMessage() ); 
  $this->send( $model->invoke() );
 break;
 case 'user_exist''MUserExist': $model = new MUserExist( new IUniversals() , new IText(), new IMessage() ); 
 $this->send( $model->invoke() );
 break;
 case 'tweet''MATweet':
 $model$model_object = new MTweet$model( new IUniversals() , new IText(), new IMessage() );
 $this->send( $model$model_object->invoke() );
 break;
 default:
 echo "Incorrect Ajax Type provided";
 }
 }
 private function send( $string )
 {
 echo "|A|""|P|" . $string;
 }
}
<?php
include 'class.DBOne.php';include 'class.DB.php';
include 'class.IUniversals.php'; include 'class.IText.php'; include 'class.IMessage.php'; 
include 'class.MUser.php';include 'class.MUserTry.php';include 'class.MUserNew.php';include 'class.MUserExist.php';
$object_cin = new CIO(); 
$object_cin->invoke( $_POST[ 'model' ] );
class CIO
{
 public function invoke( $model )
 {
 switch( $model ) 
 {
 case 'user_try':
 $model = new MUserTry(); 
 $this->send( $model->invoke( 1 ) );
 break;
 case 'user_new':
 $model = new MUserNew( new IUniversals() , new IText(), new IMessage() ); 
  $this->send( $model->invoke() );
 break;
 case 'user_exist': $model = new MUserExist( new IUniversals() , new IText(), new IMessage() ); 
 $this->send( $model->invoke() );
 break;
 case 'tweet':
 $model = new MTweet( new IUniversals() , new IText(), new IMessage() );
 $this->send( $model->invoke() );
 break;
 default:
 echo "Incorrect Ajax Type provided";
 }
 }
 private function send( $string )
 {
 echo "|A|" . $string;
 }
}
<?php
include 'class.DBOne.php';include 'class.DB.php';
include 'class.IUniversals.php'; include 'class.IText.php'; include 'class.IMessage.php'; 
include 'class.MUser.php';include 'class.MUserTry.php';include 'class.MUserNew.php';include 'class.MUserExist.php';
$object_cin = new CIO(); 
$object_cin->invoke( $_POST[ 'model' ] );
class CIO
{
 public function invoke( $model )
 {
 switch( $model ) 
 {
 case 'MUserTry':
 $model_object = new $model(); 
 $this->send( $model_object->invoke( 1 ) );
 break;
 case 'MUserNew': case 'MUserExist': case 'MATweet':
 $model_object = new $model( new IUniversals() , new IText(), new IMessage() );
 $this->send( $model_object->invoke() );
 break;
 default:
 echo "Incorrect Ajax Type provided";
 }
 }
 private function send( $string )
 {
 echo "|P|" . $string;
 }
}
edited body
Source Link
user7459
user7459
Loading
added 1 characters in body
Source Link
user7459
user7459
Loading
Source Link
user7459
user7459
Loading
lang-php

AltStyle によって変換されたページ (->オリジナル) /