public static function InitDB($strDataBaseConnection) { if (!self::$blnDBConnected) { self::$blnDBConnected = true; $arrDBInfo = unserialize($strDataBaseConnection); $objDataConnection = new MySqlDataConnection($arrDBInfo['host'], $arrDBInfo['db_name'], $arrDBInfo['user'], $arrDBInfo['password']); $objDataConnection->Connect(); LoadDriver::AddDataConnection($objDataConnection); } }
<?php /* * User defined configuration settings will go in here */ define('__CONTEST_DEBUG_MODE__', 'true'); //Comment this out before going live //define('__ADMIN_FBUIDS__', '8601266,100001842107744'); //defined('__SHOW_UNLIKED_PAGE__', 'true'); //It is strongly recomended you set the template version //define('APP_TEMPLATE_LOC', 'x.x');//only put the core in here //here so the users can upgrade if they want SApplication::LoadPackage('framework', '0.02'); SApplication::LoadPackage('contest', '0.02');
function __construct() { $this->home = dirname(__FILE__); parent::__construct(); }
<?php SApplication::ExicuteOnDB("CREATE TABLE IF NOT EXISTS `ContestEntry` (" . "`idContestEntry` int(11) NOT NULL AUTO_INCREMENT," . "`idApp` int(11) DEFAULT NULL," . "`Fbuid` varchar(32) DEFAULT NULL," . "`creDate` datetime DEFAULT NULL," . "`delDate` datetime DEFAULT NULL," . "PRIMARY KEY (`idContestEntry`)," . "KEY `idApp` (`idApp`)" . ") ENGINE=InnoDB AUTO_INCREMENT=89 DEFAULT CHARSET=latin1;"); SApplication::ExicuteOnDB("CREATE TABLE IF NOT EXISTS `ContestFormFieldType` (" . "`idContestFormFieldType` int(11) NOT NULL AUTO_INCREMENT," . "`shortDesc` varchar(32) DEFAULT NULL," . "PRIMARY KEY (`idContestFormFieldType`)" . ") ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;"); $intRowCount = mysql_num_rows(SApplication::ExicuteOnDB("SELECT * FROM `ContestFormFieldType`;")); if ($intRowCount == 0) { SApplication::ExicuteOnDB("INSERT INTO `ContestFormFieldType` VALUES ('1', 'text');"); SApplication::ExicuteOnDB("INSERT INTO `ContestFormFieldType` VALUES ('2', 'longText');"); SApplication::ExicuteOnDB("INSERT INTO `ContestFormFieldType` VALUES ('3', 'upload');"); SApplication::ExicuteOnDB("INSERT INTO `ContestFormFieldType` VALUES ('4', 'youtube');"); SApplication::ExicuteOnDB("INSERT INTO `ContestFormFieldType` VALUES ('5', 'select');"); } SApplication::ExicuteOnDB("CREATE TABLE IF NOT EXISTS `ContestFormAnswer` (" . "`idFormAnswer` int(11) NOT NULL AUTO_INCREMENT," . "`idContestEntry` int(11) DEFAULT NULL," . "`idContestFormFieldType` int(11) DEFAULT NULL," . "`name` varchar(32) DEFAULT NULL," . "`value` longtext," . "PRIMARY KEY (`idFormAnswer`)," . "KEY `fk_ContestFormAnswer_idContestEntry` (`idContestEntry`)," . "KEY `fk_ContestFormAnswer_idContestFormFieldType` (`idContestFormFieldType`)," . "CONSTRAINT `fk_ContestFormAnswer_idContestEntry` FOREIGN KEY (`idContestEntry`) REFERENCES `ContestEntry` (`idContestEntry`) ON DELETE NO ACTION ON UPDATE NO ACTION," . "CONSTRAINT `fk_ContestFormAnswer_idContestFormFieldType` FOREIGN KEY (`idContestFormFieldType`) REFERENCES `ContestFormFieldType` (`idContestFormFieldType`) ON DELETE NO ACTION ON UPDATE NO ACTION" . ") ENGINE=InnoDB AUTO_INCREMENT=856 DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 6144 kB; (`idContestFormField`) REFER `MFB/Cont';");
<?php define('__SDATALAYER_PACKAGE_VERSION__', '0.01'); define('__SDATALAYER_DIR__', __PACKAGE_DIR__ . '/sdatalayer/' . __SDATALAYER_PACKAGE_VERSION__); //require(__SDATALAYER_DIR__ . '/inc/FBPollApplicationBase.class.php'); define('__SDATALAYER_PHP_ASSETS__', __SDATALAYER_DIR__ . '/inc/php'); SApplication::AddClass('BaseEntity', __SDATALAYER_PHP_ASSETS__ . '/BaseEntity.class.php'); SApplication::AddClass('BaseEntityCollection', __SDATALAYER_PHP_ASSETS__ . '/BaseEntityCollection.class.php'); SApplication::AddClass('DataConnectionBase', __SDATALAYER_PHP_ASSETS__ . '/DataConnectionBase.class.php'); SApplication::AddClass('MFBDateTime', __SDATALAYER_PHP_ASSETS__ . '/MFBDateTime.class.php'); SApplication::AddClass('LoadDriver', __SDATALAYER_PHP_ASSETS__ . '/LoadDriver.class.php'); SApplication::AddClass('MySqlDataConnection', __SDATALAYER_PHP_ASSETS__ . '/MySqlDataConnection.class.php');
<?php SApplication::ExicuteOnDB("CREATE TABLE IF NOT EXISTS `FeedPost` (" . "`idFeedPost` int(11) NOT NULL AUTO_INCREMENT," . "`idApp` int(11) DEFAULT NULL," . "`senderFbuid` varchar(32) DEFAULT NULL," . "`reciverFbuid` varchar(32) DEFAULT NULL," . "`data` longtext," . "`creDate` datetime DEFAULT NULL," . "`tag` varchar(32) DEFAULT NULL," . "PRIMARY KEY (`idFeedPost`)," . "KEY `fk_FeedPost_idApp` (`idApp`)" . ") ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;"); SApplication::ExicuteOnDB("CREATE TABLE IF NOT EXISTS `App` (" . "`idApp` int(11) NOT NULL auto_increment," . "`name` varchar(128) default NULL," . "`creDate` datetime default NULL," . "PRIMARY KEY (`idApp`)" . ") ENGINE=MyISAM DEFAULT CHARSET=latin1;"); SApplication::ExicuteOnDB("CREATE TABLE IF NOT EXISTS `Attachment` (" . "`idAttachment` int(11) NOT NULL auto_increment," . "`shortDesc` varchar(128) default NULL," . "`fileLoc` varchar(256) default NULL," . "`creDate` datetime default NULL," . "`fbuid` varchar(128) default NULL," . "PRIMARY KEY (`idAttachment`)" . ") ENGINE=MyISAM DEFAULT CHARSET=latin1;");
public static function FBPostToFeed($intUserId, $arrParams, $strTag = null) { $objFeedPost = new FeedPost(); $objFeedPost->IdApp = SApplication::AppName(); $objFeedPost->SenderFbuid = self::FBUid(); $objFeedPost->ReciverFbuid = $intUserId; $objFeedPost->Data = json_encode($arrParams); $objFeedPost->CreDate = QDateTime::Now(); $objFeedPost->Tag = $strTag; $objFeedPost->Save(); $strCall = sprintf('/%s/feed', $intUserId); return self::FB($strCall, $arrParams); }
<?php /* * User defined configuration settings will go in here */ //The Facebook App Id for this specific app define('__CUST_FB_APP_ID__', 'your_facebook_app_id'); //The Facebook App Secret Key for this specific app define('__CUST_FB_APP_SECRET__', 'your_facebook_app_secret'); define('__CONTEST_DEBUG_MODE__', 'true'); //Comment this out before going live //A comma delimited list of admin facebook user ids define('__ADMIN_FBUIDS__', '8601266,100001842107744'); //DO NOT CHANGE THIS define('APP_TEMPLATE_LOC', '29/15'); //A list of packages that are required to run this app SApplication::LoadPackage('framework', '0.03'); SApplication::LoadPackage('contest', '0.04'); //The data base this app needs to run SApplication::InitDB(DATABASE_1);
function DemoApplication() { parent::SApplication(); }
<?php require dirname(__FILE__) . '/inc/prepend.inc.php'; SApplication::Run('contest');
define('__APP_TEMPLATE_CSS_ASSETS__', __APP_TEMPLATE_ASSETS__ . '/css'); define('__APP_TEMPLATE_JS_ASSETS__', __APP_TEMPLATE_ASSETS__ . '/js'); define('__APP_TEMPLATE_IMAGE_ASSETS__', __APP_TEMPLATE_ASSETS__ . '/images'); //Normal define('__APP_ASSETS__', APP_FRONTEND_DIR . '/assets'); define('__APP_PUB_ASSETS__', __APP_URL__ . '/assets'); define('__APP_PHP_ASSETS__', __APP_ASSETS__ . '/php'); define('__APP_TPL_ASSETS__', __APP_ASSETS__ . '/templates'); define('__APP_CSS_ASSETS__', __APP_PUB_ASSETS__ . '/css'); define('__APP_JS_ASSETS__', __APP_PUB_ASSETS__ . '/js'); define('__APP_IMAGE_ASSETS__', __APP_PUB_ASSETS__ . '/images'); if (!defined('FORM_VAR_ENC_KEY')) { define('FORM_VAR_ENC_KEY', md5('aeckiIE99381923')); } if (defined('APP_CONTROL_LOC')) { if (file_exists(APP_CONTROL_LOC)) { $strOldPrependLoc = sprintf('%s/_core/inc/php/prepend.inc.php', APP_BACKEND_DIR); if (file_exists($strOldPrependLoc)) { require_once $strOldPrependLoc; } else { require_once sprintf('%s/prepend.inc.php', APP_BACKEND_DIR); } require_once APP_CONTROL_LOC; } else { throw new Exception("Control file not found in Account App FTP Dir(" . APP_CONTROL_LOC . ")"); } } } SApplication::AddRunFunction('FRAMEWK_RUN'); SApplication::LoadPackage('facebook', '0.01');
<?php require_once dirname(__FILE__) . '/../inc/prepend.inc.php'; //Require Config $strAppName = $_GET['app']; //Require the install SApplication::InstallApp($strAppName); header('location: ' . __BASE_URL__ . '/gettingStarted.php?success=1');
<?php require dirname(__FILE__) . '/inc/prepend.inc.php'; SApplication::Run('example');
<?php require dirname(__FILE__) . '/inc/prepend.inc.php'; SApplication::BootPhpAsset($_GET[MFBQS::PACKAGE], $_GET[MFBQS::VERSION], $_GET[MFBQS::CTL_FILE]);