public static function get_instance() { if (self::$instance == null) { self::$instance = new self(); } return self::$instance; }
public function _log($typeID, $id = array(), $text = "", $data = array()) { //save($id=array("contentID"=>"","commentID"=>"","meetingID"=>"","companyID"=>"","answerID"=>""),$text="",$userID="") { $timer = new timer(); $f3 = \base::instance(); $user = $f3->get("user"); $userID = $user['ID']; //test_array($id); $values = array('typeID' => $typeID, 'userID' => $userID, 'contentID' => isset($id["contentID"]) ? $id["contentID"] : null, 'commentID' => isset($id["commentID"]) ? $id["commentID"] : null, 'meetingID' => isset($id["meetingID"]) ? $id["meetingID"] : null, 'companyID' => isset($id["companyID"]) ? $id["companyID"] : null, 'optionID' => isset($id["optionID"]) ? $id["optionID"] : null, 'fileID' => isset($id["fileID"]) ? $id["fileID"] : null, 'text' => $text, 'data' => json_encode($data), 'sessionID' => session_id()); //test_array($values); if ($values['fileID'] != null && $values['contentID'] == null) { $values['contentID'] = $this->lookup($values['fileID'], 'mp_content_files')->contentID; } if ($values['optionID'] != null && $values['contentID'] == null) { $values['contentID'] = $this->lookup($values['optionID'], 'mp_content_poll_answers')->contentID; } if ($values['commentID'] != null && $values['contentID'] == null) { $values['contentID'] = $this->lookup($values['commentID'], 'mp_content_comments')->contentID; } if ($values['contentID'] != null && $values['meetingID'] == null) { $values['meetingID'] = $this->lookup($values['contentID'], 'mp_content')->meetingID; } if ($values['meetingID'] != null && $values['companyID'] == null) { $values['companyID'] = $this->lookup($values['meetingID'], 'mp_meetings')->companyID; } $art = new \DB\SQL\Mapper($this->f3->get("DB"), 'mp_logs'); foreach ($values as $key => $value) { if (isset($art->{$key}) && $key != "ID") { $art->{$key} = $value; } } $art->save(); $timer->_stop(__NAMESPACE__, __CLASS__, __FUNCTION__, func_get_args()); return $values; }
function __construct() { $this->f3 = \base::instance(); $this->user = $this->f3->get("user"); if ($this->user['ID'] == "") { $this->f3->reroute("/login?msg=Login+Failed"); } }
$errorPath = dirname(ini_get('error_log')); $errorFile = $errorPath . DIRECTORY_SEPARATOR . basename(__DIR__) . "-errors.log"; ini_set("error_log", $errorFile); if (session_id() == "") { $SID = @session_start(); } else { $SID = session_id(); } if (!$SID) { session_start(); $SID = session_id(); } $GLOBALS["output"] = array(); $GLOBALS["models"] = array(); require_once 'vendor/autoload.php'; $f3 = \base::instance(); require 'inc/timer.php'; require 'inc/template.php'; require 'inc/functions.php'; require 'inc/pagination.php'; $GLOBALS['page_execute_timer'] = new timer(true); $cfg = array(); require_once 'config.default.inc.php'; if (file_exists("config.inc.php")) { require_once 'config.inc.php'; } $f3->set('AUTOLOAD', './|lib/|controllers/|inc/|/modules/'); $f3->set('PLUGINS', 'vendor/bcosca/fatfree/lib/'); $f3->set('CACHE', true); $f3->set('DB', new DB\SQL('mysql:host=' . $cfg['DB']['host'] . ';dbname=' . $cfg['DB']['database'] . '', $cfg['DB']['username'], $cfg['DB']['password'])); $f3->set('cfg', $cfg);
static function format($data) { $timer = new timer(); $f3 = \base::instance(); $single = false; if (isset($data['ID'])) { $single = true; $data = array($data); } $i = 1; $n = array(); //test_array($items); foreach ($data as $item) { unset($item['password']); $n[] = $item; } if ($single) { $n = $n[0]; } $timer->_stop(__NAMESPACE__, __CLASS__, __FUNCTION__, func_get_args()); return $n; }
static function remove($ID) { $timer = new timer(); $f3 = \base::instance(); // test_array($values); $art = new \DB\SQL\Mapper($f3->get("DB"), "dir_items"); $art->load("ID='{$ID}'"); $art->erase(); $timer->_stop(__NAMESPACE__, __CLASS__, __FUNCTION__, func_get_args()); return "done"; }
function __construct() { $this->f3 = \base::instance(); $this->user = $this->f3->get("user"); $this->cfg = $this->f3->get("cfg"); }