public function Update() { $DB = new DBO(); $fields = get_object_vars($this); foreach ($fields as $k => $v) { if (is_null($v)) { unset($fields[$k]); } } if (is_numeric($this->id)) { return $DB->Update("client")->SetData($fields)->Where(["id", "=", $this->id])->Exec(); } else { return $DB->Insert("client")->SetData($fields)->Exec(); } }
/** * standard constructor * @param string Text that is to be shown as description or label with your object. * @param string Table, you want to connect with the object. * @param string $longitude,column, which stores the longitude * @param string $latitude, columnd, which stores the latitude * @param string $row_identifier Usually to be generated with form->setPK. Identifies the * row in db, you want to affect with operation. Keep empty for insert. (Example: stdEDForm) */ function CoordinatesInput($label, $table, $longitude, $latitude, $row_identifier = "1") { global $page, $page_state, $forceLoadFromDB, $page_action; DBO::DBO($label, $table, $longitude, $row_identifier, ""); $this->lng = $longitude; $this->lat = $latitude; $this->vlng = 0; $this->vlat = 0; if ($page_state == "processing" && value("changevariation") != "GO" && !($forceLoadFromDB == "yes")) { $this->vlng = value("coordY", "NUMERIC", "0"); $this->vlat = value("coordX", "NUMERIC", "0"); } else { if (($page_action == "UPDATE" || $page_action == "DELETE") && $this->row_identifier != "1") { $this->vlng = getDBCell($table, $longitude, $row_identifier); $this->vlat = getDBCell($table, $latitude, $row_identifier); } } include_once "nxgooglemapsapi.php"; $this->api = new NXGoogleMapsAPI(); $this->api->setWidth(590); $this->api->setHeight(350); $this->api->addControl(GLargeMapControl); $this->api->addControl(GOverviewMapControl); $this->api->addControl(GMapTypeControl); $this->api->setCenter(50, 10); $this->api->setZoomFactor(4); if ($this->vlng != 0 || $this->vlat != 0) { $this->api->addDragMarker($this->vlng, $this->vlat); } $page->headerPayload = $this->api->getHeadCode(); $page->onLoad .= $this->api->getOnLoadCode(); }
/** * standard constructor * @param string Text that is to be shown as description or label with your object. * @param string Table, you want to connect with the object. * @param string column, you want to connect with the object. * @param string $row_identifier Usually to be generated with form->setPK. Identifies the * row in db, you want to affect with operation. Keep empty for insert. (Example: stdEDForm) * @param string $params Allowed parameters are: * type:TEXT|TEXTAREA|COLOR|RICH|URL; * size:XX Size of Input in chars. * width:XX Size of Input in pixel. * @param string $check Does checks on user input. Allowed are MANDATORY (=not null)|UNIQUE. Separate with &. * @param string $db_datatype Datatype of the database, you want to use. Allowed are CHAR|NUMBER|PASSWORD */ function TextInput($label, $table, $column, $row_identifier = "1", $params = "type:text,size:10,width:100", $check = "", $db_datatype = "TEXT") { DBO::DBO($label, $table, $column, $row_identifier, $params, $db_datatype, $check); switch ($this->type): case "TEXT": $this->v_wuiobject = new Input($this->name, $this->value, $this->std_style, $this->size, $this->parameter, $this->width); break; case "TEXTAREA": $this->v_wuiobject = new Textarea($this->name, $this->value, $this->std_style, $this->size, $this->parameter, $this->width); break; case "COLOR": $this->v_wuiobject = new ColorInput($this->name, $this->value, $this->std_style, $this->parameter); break; case "RICH": $this->v_wuiobject = new Richedit($this->name, $this->value, $this->std_style, $this->size, $this->parameter, $this->width); break; case "URL": $this->v_wuiobject = new InputURL($this->name, $this->value, $this->std_style, $this->size, $this->parameter, $this->width); break; endswitch; }
public static function StartApp() { ob_start('ob_gzhandler'); session_start(); // Defines define('BASEURL', substr((empty($_SERVER['HTTPS']) ? 'http://' : 'https://' ) . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'],0,-10)); define('BASEPATH', substr($_SERVER['SCRIPT_FILENAME'],0,-10)); // Helper Boot Loader require(BASEPATH.'/core/bootloader.php'); // Initialize Helpers BootLoader::loadHelpers(); Registry::getInstance(); // Handle Errors Registry::setDebugMode(true); set_error_handler('Template::handleError'); set_exception_handler('Template::handleException'); // Initialize Database Model::$db = DBO::getInstance('sqlite:example.sqldb'); // Init Autoloads spl_autoload_register('Autoload::controllers'); spl_autoload_register('Autoload::models'); // Determine Controllers and Methods Routes::getRoute(); // Run Application Routes::run(); }
/** * standard constructor * @param string Text that is to be shown as description or label with your object. * @param string Table, you want to connect with the object. * @param string column, you want to connect with the object. * @param string $row_identifier Usually to be generated with form->setPK. Identifies the * row in db, you want to affect with operation. Keep empty for insert. (Example: stdEDForm) * @param string $params Allowed parameter is: * param:<Name of form> needed for js-reasons. * @param string $check Does checks on user input. Allowed are MANDATORY (=not null)|UNIQUE. Separate with &. * @param string $db_datatype Datatype of the database, you want to use. Allowed is DATE only. */ function DateTimeInput($label, $table, $column, $row_identifier = "1", $params = "param:form1", $check = "", $db_datatype = "DATE") { DBO::DBO($label, $table, $column, $row_identifier, $params, $db_datatype, $check); // load the data of the field. global $page_state, $page_action; if ($page_state == "processing") { $this->value = value($this->name, "NOSPACES", ""); if ($this->value != "") { $this->value.=" ".value($this->name."_time", "NOSPACES", "").":00"; $this->value = str_replace("/", "-", $this->value); /** added 21.1.2002 */ global $c_magic_quotes_gpc; if ($c_magic_quotes_gpc == 1) $this->value = str_replace("\\", "", $this->value); /** got rid of magic quotes! */ $this->oldvalue = getDBCell($table, $column, $row_identifier); } } else { if (($page_action == "UPDATE" || $page_action == "DELETE") && $this->row_identifier != "1") { $this->value = getDBCell($table, $column, $row_identifier); if ($this->value == "0000-00-00 00:00:00" || $this->value == "00:00:00" || $this->value=="") $this->value = ""; } } $this->v_wuiobject = new DateTimebox($this->name, $this->value, $this->std_style, $this->parameter); }
function process() { global $page_action, $specialID; if ($page_action == "INSERT") { $this->value = createClusterNode(value($this->table . "_" . $this->nameColumn, "", "Object") . $specialID, $this->value); DBO::process(); } }
/** * Standard constructor * * @param $table string Table, where the CLNID of the cluster shall be stored * @param $column string Column, wehere the CLNID of the cluster shall be stored * @param $cond string WhereStr to indentify the record * @param $cltid integer GUID of the cluster-template, for creating a new cluster only * @param $variation integer GUID of the language * @param $clustername string name of the cluster which shall be created. */ function ClusterEditor($table, $column, $cond, $cltid, $variation, $clustername) { global $page_action, $oid; DBO::DBO('', $table, $column, $cond, "", "NUMBER"); $this->cltid = $cltid; $this->variation = $variation; $this->clnid = -1; $this->clid = -1; $this->clustername = $clustername; $this->value = getDBCell($table, $column, $cond); if ($oid != "" && $oid != "0") { $this->checkIfCLNExists(); } }
/** * standard constructor * @param string Where Condition to filter */ function SelectChannelCategory($row_identifier = "1") { global $lang, $chcat, $page_state, $page_action; DBO::DBO($lang->get("sel_channel_cat", "Select Channel and Category"), "centerstage", "CHID", $row_identifier, '', 'NUMBER', 'MANDATORY'); if ($page_state != "processing") { $tmp = getDBCell("centerstage", "CH_CAT_ID", $row_identifier); if ($tmp != 0 && $tmp != "" && $tmp != "0") { $this->value = $tmp; } } $this->populateSelectbox(); $this->v_wuiobject = new Dropdown($this->name, $chcat, $this->std_style, $this->value, $this->width); }
/** * standard constructor * @param string Text that is to be shown as description or label with your object. * @param string Table, you want to connect with the object. * @param string column, you want to connect with the object. * @param string $row_identifier Usually to be generated with form->setPK. Identifies the * row in db, you want to affect with operation. Keep empty for insert. (Example: stdEDForm) * @param string $checkedValue Value that is to be used if field checkbox is submitted checked. * @param string $uncheckedValue Value that is to be used if field checkbox is submitted unchecked. * @param string Datatype of the database, you want to use. Allowed are CHAR|NUMBER|DATE|DATETIME|TIMESTAMP|PASSWORD */ function CheckboxInput($label, $table, $column, $row_identifier = "1", $checkedValue = "1", $uncheckedValue = "0", $datatype = "NUMBER") { DBO::DBO($label, $table, $column, $row_identifier, "param:$uncheckedValue", $datatype); $checked = false; if ($this->value == $checkedValue) { $checked = true; } else { $this->value = $uncheckedValue; } $this->v_wuiobject = new Checkbox($this->name, $checkedValue, $this->std_style, $checked); }
/** * draw the object. */ function draw() { /** Create the value array **/ global $db; $instances = null; $this->createCLT($instances); // set the values $this->v_wuiobject->value = $instances; // draw the object DBO::draw(); return 2; }
/** * draw the object. */ function draw() { /** Create the value array **/ global $db; $folders = null; $folders[0][0] = ">"; $folders[0][1] = 0; $this->createFolders($folders, ">", 0); // set the values $this->v_wuiobject->value = $folders; // draw the object DBO::draw(); return 2; }
/** * standard constructor * @param string Text that is to be shown as description or label with your object. * @param string Table, you want to connect with the object. * @param string column, you want to connect with the object. * @param string first $row_identifier Usually to be generated with form->setPK. Identifies the * row in db, you want to affect with operation. Keep empty for insert. (Example: stdEDForm) * @param string $params Allowed parameter is: * param:<Name of form> needed for js-reasons. * @param string $check Does checks on user input. Allowed are MANDATORY (=not null)|UNIQUE. Separate with &. * @param string $db_datatype Datatype of the database, you want to use. TIME is allowed only */ function TimeInput($label, $table, $column, $row_identifier = "1", $style = "", $params = "", $check = "", $db_datatype = "TIME") { DBO::DBO($label, $table, $column, $row_identifier, $params, $db_datatype, $check); global $page_state; if ($page_state == "processing") { $fieldname = $this->name; if (value($fieldname) != "0") $this->value = value($fieldname); } else { $this->value = getDBCell($table, $column, $row_identifier); } $this->v_wuiobject = new Timebox($this->name, $this->std_style, "", substr($this->value, 0, 5)); }
/** * standard constructor * @param string Text that is to be shown as description or label with your object. * @param string Table, you want to connect with the object. * @param string column, you want to connect with the object. * @param array name-value-array of entries to be shown in dropdown for selection. * @param string $row_identifier Usually to be generated with form->setPK. Identifies the * row in db, you want to affect with operation. Keep empty for insert. (Example: stdEDForm) * @param string allowed is type:DROPDOWN|SELECT as paramter for choosing a dropdown or selectbox. For select * you may also use size:XX for number of rows. * @param string $check Does checks on user input. Allowed are MANDATORY (=not null)|UNIQUE. Unique will not make sense in most cases! * @param string $datatype Datatype of the database, you want to use. Allowed are CHAR|NUMBER|DATE|DATETIME|TIMESTAMP|PASSWORD */ function ManualDropdownInput($label, $table, $column, $values, $row_identifier = "1", $param = "type:dropdown", $check = "MANDATORY", $datatype = "TEXT") { $chktmp = $check; DBO::DBO($label, $table, $column, $row_identifier, $param, $datatype, $chktmp); switch ($this->type): case "DROPDOWN": $this->v_wuiobject = new Dropdown($this->name, $values, $this->std_style, $this->value, $this->width); break; case "SELECT": $this->v_wuiobject = new Select($this->name, $values, "", $this->value, $this->size, $this->std_style, $this->width); break; endswitch; }
/** * draw the object. */ function draw() { /** Create the value array **/ global $db; $folders = null; $folders[0][0] = ">"; $folders[0][1] = 0; if ($this->livepages) { $this->createFolders($folders, ">", translateState(0, 10, false)); } else { $this->createFolders($folders, ">", 0); } // set the values $this->v_wuiobject->value = $folders; // draw the object DBO::draw(); return 2; }
public function __construct($query) { // Setup Database Connection $this->database = DBO::getInstance(); // Prepare and Bind Query $this->queryText = array_shift($query); $this->query = $this->database->prepare($this->queryText); preg_match_all('/(:[^,)\s]+)/', $this->queryText, $binds); if ($binds) foreach($binds[0] as $bind) { $value = array_shift($query); if (is_null($value)) $this->query->bindValue($bind, $value, PDO::PARAM_NULL); else $this->query->bindValue($bind, $value); } // Update Database $this->query->execute(); }
/** * standard constructor * @param string Text that is to be shown as description or label with your object. * @param string Table, you want to connect with the object. * @param string column, you want to connect with the object. * @param array values, the list of input-values. * @param string $row_identifier Usually to be generated with form->setPK. Identifies the * row in db, you want to affect with operation. Keep empty for insert. (Example: stdEDForm) * @param string allowed is type:DROPDOWN|SELECT as paramter for choosing a dropdown or selectbox. For select * you may also use size:XX for number of rows. * @param string $check Does checks on user input. Allowed are MANDATORY (=not null)|UNIQUE. Unique will not make sense in most cases! * @param string $datatype Datatype of the database, you want to use. Allowed are CHAR|NUMBER|DATE|DATETIME|TIMESTAMP|PASSWORD */ function SelectOneInputFixed($label, $table, $column, $values, $row_identifier = "1", $param = "type:dropdown", $check = "MANDATORY", $datatype = "NUMBER") { DBO::DBO($label, $table, $column, $row_identifier, $param, $datatype, $check); $dsvalues = array(); if (is_array($values[0])) { $dsvalues = $values; } else { foreach ($values as $key => $value) { $dsvalues[] = array($value, $key); } } switch ($this->type) { case "DROPDOWN": $this->v_wuiobject = new Dropdown($this->name, $dsvalues, $this->std_style, $this->value, $this->width); break; case "SELECT": $this->v_wuiobject = new Select($this->name, $dsvalues, "", $this->value, $this->size, $this->std_style, $this->width); break; default: echo "SelectOneInputFixed: ERROR! type {$this->type} is invalid<br>\n"; } }
/** * standard constructor * @param string Text that is to be shown as description or label with your object. * @param string Table, you want to connect with the object. * @param string column, you want to connect with the object. * @param string name of the table, you want to join to the input-value. * @param string name of the column, you want to use as diplay in dropdown for value. * @param string name of the column, you want to retrieve the values from for the table and column. * foreign key to table->column. * @param string $foreign_data_identifier where-condition in SQL-Clause for selections of input-values. * @param string $row_identifier Usually to be generated with form->setPK. Identifies the * row in db, you want to affect with operation. Keep empty for insert. (Example: stdEDForm) * @param string allowed is type:DROPDOWN|SELECT as paramter for choosing a dropdown or selectbox. For select * you may also use size:XX for number of rows. * @param string $check Does checks on user input. Allowed are MANDATORY (=not null)|UNIQUE. Unique will not make sense in most cases! * @param string $datatype Datatype of the database, you want to use. Allowed are CHAR|NUMBER|DATE|DATETIME|TIMESTAMP|PASSWORD */ function SelectOneInput($label, $table, $column, $foreign_table, $foreign_name, $foreign_value, $foreign_data_identifier = "1", $row_identifier = "1", $param = "type:dropdown", $check = "MANDATORY", $datatype = "NUMBER") { $chktmp = $check; DBO::DBO($label, $table, $column, $row_identifier, $param, $datatype, $chktmp); if (!$this->mandatory) { $values = createNameValueArray($foreign_table, $foreign_name, $foreign_value, $foreign_data_identifier); } else { $values = createNameValueArrayEx($foreign_table, $foreign_name, $foreign_value, $foreign_data_identifier); } switch ($this->type): case "DROPDOWN": $this->v_wuiobject = new Dropdown($this->name, $values, $this->std_style, $this->value, $this->width); break; case "SELECT": $this->v_wuiobject = new Select($this->name, $values, "", $this->value, $this->size, $this->std_style, $this->width); break; endswitch; }
$servidor = post('servidor'); $usuario = post('usuario'); $senha = post('senha'); $base = post('base'); $tabela = post('tabela'); $arquivo = strtolower($tabela); $classe = ucwords($tabela); if ($base != '') { $model = '<' . '?' . 'php' . NL . '$this->_dsn=\'' . $banco . '://' . $usuario . ':' . $senha . '@' . $servidor . '/' . $base . '\';'; try { $db = new Oraculum_Models(); $db->setDsn($banco . '://' . $usuario . ':' . $senha . '@' . $servidor . '/' . $base); $db->PDO(); $dbo = new DBO(); DBO::execSQL('USE ' . $base . ';'); $query = DBO::execSQL('SHOW KEYS FROM ' . $tabela . ' WHERE Key_name = \'PRIMARY\';')->fetchAll(); //$d=$query->fetchAll(); //var_dump($query); $keys = array(); foreach ($query as $r) { if (is_null($firstkey)) { $firstkey = $r['Column_name']; } $keys[] = $r['Column_name']; } $keys = 'array(\'' . implode('\',\'', $keys) . '\')'; $control = '<' . '?' . 'php' . NL . 'Oraculum::Load(\'Models\');' . NL . 'Oraculum::Load(\'Plugins\');' . NL . 'Oraculum::Load(\'HTTP\');' . NL . '// Carrega o arquivo de conexao com o banco' . NL . '$db=new Oraculum_Models(\'' . $banco . '\');' . NL . NL . '// Carrega dinamicamente uma classe para a tabela ' . $tabela . NL . '$db->LoadModelClass(\'' . $tabela . '\');' . NL . '$action=Oraculum_Request::getvar(\'' . $arquivo . '\');' . NL . NL . '// Verifica se a acao e\' permitida no sistema' . NL . 'if (!(in_array($action, array(\'cadastrar\', \'listar\', \'alterar\', \'excluir\'))))' . NL . ' $action=\'listar\';' . NL . NL . '// Verifica se existe uma funcao com o mesmo nome da acao' . NL . 'if (is_callable($action))' . NL . ' call_user_func($action); // Chama a funcao' . NL . 'else' . NL . '// Senao chama a funcao listar (esse e\' um tratamento de seguranca)' . NL . 'if (is_callable(\'listar\'))' . NL . ' call_user_func(\'listar\');' . NL . NL . 'function listar() {' . NL . ' // Carrega o plugin Oraculum_Datagrid' . NL . ' Oraculum_Plugins::Load(\'datagrid\');' . NL . ' // Cria uma instancia da classe' . NL . ' $tb=new ' . $classe . '();' . NL . ' $tb->setKey(' . $keys . ');' . NL . ' // Carrega todos os registros da tabela/entidade' . NL . ' $regs=$tb->getAll();' . NL . ' // Cria uma instancia de do plugin Oraculum_Datagrid' . NL . ' $grid=new Oraculum_Datagrid($regs);' . NL . NL . ' // Define a classe CSS da tabela' . NL . ' $grid->setTableClass(\'table table-bordered table-striped\');' . NL . ' // Define a classe CSS do botao de atualizacao' . NL . ' $grid->setUpdateClass(\'btn btn-primary\');' . NL . ' // Define a classe CSS do botao de exclusao' . NL . ' $grid->setDeleteClass(\'btn btn-danger\');' . NL . ' // Determina o padrao de URL para o link de atualizar' . NL . ' $grid->setUpdateURL(URL.\'' . $arquivo . '/alterar/%id%\');' . NL . ' // Determina o padrao de URL para o link de excluir' . NL . ' $grid->setDeleteURL(URL.\'' . $arquivo . '/excluir/%id%#confirm%id%" onclick="if(confirm(\\\'Tem certeza que deseja excluir?\\\')){return true;}else{return false;}\');' . NL . ' // Define o label do botao de atualizacao' . NL . ' $grid->setUpdateLabel(\'<i class="icon-pencil icon-white"></i> Alterar\');' . NL . ' // Define o label do botao de exclusao' . NL . ' $grid->setDeleteLabel(\'<i class="icon-remove icon-white"></i> Excluir\');' . NL . ' // Define o texto que deve ser exibido caso nao existem registros' . NL . ' $grid->setNoRecordsFound(\'Nenhum registro encontrado!\');' . NL . ' // Gera o HTML do grid' . NL . ' $grid=$grid->generate();' . NL . ' // Armazena o grid num registrador chamado grid que sera\' lido na view' . NL . ' Oraculum_Register::set(\'grid\', $grid);' . NL . ' // Armazena os registros num registrador chamado regs que sera\' lido na view' . NL . ' Oraculum_Register::set(\'regs\', $regs);' . NL . '}' . NL . NL . 'function excluir() {' . NL . ' // Cria uma instancia da classe' . NL . ' $tb=new ' . $classe . '();' . NL . ' $tb->setKey(' . $keys . ');' . NL . ' // Captura o que estiver apos /excluir/ na URL' . NL . ' $id=(int)Oraculum_Request::getvar(\'excluir\');' . NL . ' // Carrega todos os registros que tiverem o ID relacionado' . NL . ' $reg=$tb->getBy' . ucwords($firstkey) . '($id);' . NL . ' if (sizeof($reg)>0) {' . NL . ' // Se encontrar algum registro, o mesmo e\' apagado' . NL . ' $reg->delete();' . NL . ' }' . NL . ' // Redireciona para a pagina de listagem' . NL . ' Oraculum_HTTP::redirect(URL.\'' . $arquivo . '\');' . NL . '}' . NL . NL . 'function cadastrar() {' . NL . ' // No momento ainda e\' necessario criar manualmente o cadastro' . NL . '}' . NL . NL . 'function alterar() {' . NL . ' // No momento ainda e\' necessario criar manualmente a alteracao' . NL . '}' . NL . NL . 'if ($action==\'listar\'):' . NL . ' Oraculum_WebApp::LoadView()' . NL . ' ->AddTemplate(\'geral\')' . NL . ' ->LoadPage(\'' . $arquivo . '-listar\'); // Carrega a view de listagem' . NL . 'endif;'; $viewlistar = '<' . '?' . 'php $grid=Oraculum_Register::get(\'grid\'); ?' . '>' . "\n\r" . '<' . '?' . 'php echo $grid; ?' . '>'; Oraculum_Register::set('model', $model); Oraculum_Register::set('control', $control); Oraculum_Register::set('viewlistar', $viewlistar);
/** * standard constructor * @param string Text that is to be shown as description or label with your object. * @param string Table, you want to connect with the object. * @param string column, you want to connect with the object. * @param string $row_identifier Usually to be generated with form->setPK. Identifies the * row in db, you want to affect with operation. Keep empty for insert. (Example: stdEDForm) * @param string $posFilter Filter for determining the correct order * @param string $params Allowed parameters are: * size:XX Size of Input in chars. * width:XX Size of Input in pixel. */ function PositionInput($label, $table, $column, $row_identifier = "1", $posFilter, $params = "size:10,width:100") { $this->posFilter = $posFilter; DBO::DBO($label, $table, $column, $row_identifier, $params, "NUMBER", "NUMBER&MANDATORY"); $this->v_wuiobject = new Input($this->name, $this->value, $this->std_style, $this->size, $this->parameter, $this->width); }
protected static function _init($argDSN = NULL) { if (FALSE === self::$_initialized) { $DSN = NULL; if (class_exists('Configure') && NULL !== Configure::constant('DB_DSN')) { // 定義からセッションDBの接続情報を特定 $DSN = Configure::DB_DSN; } if (class_exists('Configure') && NULL !== Configure::constant('AUTH_DB_DSN')) { // 定義からセッションDBの接続情報を特定 $DSN = Configure::AUTH_DB_DSN; } if (class_exists('Configure') && NULL !== Configure::constant('AUTH_TBL_NAME')) { // 定義からuserTable名を特定 self::$authTable = Configure::AUTH_TBL_NAME; } if (class_exists('Configure') && NULL !== Configure::constant('AUTH_PKEY_FIELD_NAME')) { // 定義からuserTable名を特定 self::$authPKeyField = Configure::AUTH_PKEY_FIELD_NAME; } if (class_exists('Configure') && NULL !== Configure::constant('AUTH_ID_FIELD_NAME')) { // 定義からuserTable名を特定 self::$authIDField = Configure::AUTH_ID_FIELD_NAME; } if (class_exists('Configure') && NULL !== Configure::constant('AUTH_PASS_FIELD_NAME')) { // 定義からuserTable名を特定 self::$authPassField = Configure::AUTH_PASS_FIELD_NAME; } if (class_exists('Configure') && NULL !== Configure::constant('AUTH_CREATE_DATE_KEY_NAME')) { // 定義からuserTable名を特定 self::$authCreatedField = Configure::AUTH_CREATE_DATE_KEY_NAME; } if (class_exists('Configure') && NULL !== Configure::constant('AUTH_MODIFY_DATE_KEY_NAME')) { // 定義からuserTable名を特定 self::$authModifiedField = Configure::AUTH_MODIFY_DATE_KEY_NAME; } if (class_exists('Configure') && NULL !== Configure::constant('AUTH_ID_ENCRYPTED')) { // 定義からuserTable名を特定 self::$authIDEncrypted = Configure::AUTH_ID_ENCRYPTED; } if (class_exists('Configure') && NULL !== Configure::constant('AUTH_PASS_ENCRYPTED')) { // 定義からuserTable名を特定 self::$authPassEncrypted = Configure::AUTH_PASS_ENCRYPTED; } if (class_exists('Configure') && NULL !== Configure::constant('CRYPT_KEY')) { // 定義から暗号化キーを設定 self::$_sessionCryptKey = Configure::CRYPT_KEY; self::$_authCryptKey = Configure::CRYPT_KEY; } if (class_exists('Configure') && NULL !== Configure::constant('NETWORK_CRYPT_KEY')) { // 定義から暗号化キーを設定 self::$_sessionCryptKey = Configure::NETWORK_CRYPT_KEY; } if (class_exists('Configure') && NULL !== Configure::constant('SESSION_CRYPT_KEY')) { // 定義から暗号化キーを設定 self::$_sessionCryptKey = Configure::SESSION_CRYPT_KEY; } if (class_exists('Configure') && NULL !== Configure::constant('DB_CRYPT_KEY')) { // 定義から暗号化キーを設定 self::$_authCryptKey = Configure::DB_CRYPT_KEY; } if (class_exists('Configure') && NULL !== Configure::constant('AUTH_CRYPT_KEY')) { // 定義から暗号化キーを設定 self::$_authCryptKey = Configure::AUTH_CRYPT_KEY; } if (class_exists('Configure') && NULL !== Configure::constant('CRYPT_IV')) { // 定義から暗号化IVを設定 self::$_sessionCryptIV = Configure::CRYPT_IV; self::$_authCryptIV = Configure::CRYPT_KEY; } if (class_exists('Configure') && NULL !== Configure::constant('NETWORK_CRYPT_IV')) { // 定義から暗号化IVを設定 self::$_sessionCryptIV = Configure::NETWORK_CRYPT_IV; } if (class_exists('Configure') && NULL !== Configure::constant('SESSION_CRYPT_IV')) { // 定義から暗号化IVを設定 self::$_sessionCryptIV = Configure::SESSION_CRYPT_IV; } if (class_exists('Configure') && NULL !== Configure::constant('DB_CRYPT_IV')) { // 定義から暗号化キーを設定 self::$_authCryptKIV = Configure::DB_CRYPT_IV; } if (class_exists('Configure') && NULL !== Configure::constant('AUTH_CRYPT_IV')) { // 定義から暗号化キーを設定 self::$_authCryptIV = Configure::AUTH_CRYPT_IV; } if (defined('PROJECT_NAME') && strlen(PROJECT_NAME) > 0 && class_exists(PROJECT_NAME . 'Configure')) { $ProjectConfigure = PROJECT_NAME . 'Configure'; if (NULL !== $ProjectConfigure::constant('DB_DSN')) { // 定義からセッションDBの接続情報を特定 $DSN = $ProjectConfigure::DB_DSN; } if (NULL !== $ProjectConfigure::constant('AUTH_DB_DSN')) { // 定義からセッションDBの接続情報を特定 $DSN = $ProjectConfigure::AUTH_DB_DSN; } if (NULL !== $ProjectConfigure::constant('AUTH_TBL_NAME')) { // 定義からuserTable名を特定 self::$authTable = $ProjectConfigure::AUTH_TBL_NAME; } if (NULL !== $ProjectConfigure::constant('AUTH_PKEY_FIELD_NAME')) { // 定義からuserTable名を特定 self::$authPKeyField = $ProjectConfigure::AUTH_PKEY_FIELD_NAME; } if (NULL !== $ProjectConfigure::constant('AUTH_ID_FIELD_NAME')) { // 定義からuserTable名を特定 self::$authIDField = $ProjectConfigure::AUTH_ID_FIELD_NAME; } if (NULL !== $ProjectConfigure::constant('AUTH_PASS_FIELD_NAME')) { // 定義からuserTable名を特定 self::$authPassField = $ProjectConfigure::AUTH_PASS_FIELD_NAME; } if (NULL !== $ProjectConfigure::constant('AUTH_CREATE_DATE_KEY_NAME')) { // 定義からuserTable名を特定 self::$authCreatedField = $ProjectConfigure::AUTH_CREATE_DATE_KEY_NAME; } if (NULL !== $ProjectConfigure::constant('AUTH_MODIFY_DATE_KEY_NAME')) { // 定義からuserTable名を特定 self::$authModifiedField = $ProjectConfigure::AUTH_MODIFY_DATE_KEY_NAME; } if (NULL !== $ProjectConfigure::constant('AUTH_ID_ENCRYPTED')) { // 定義からuserTable名を特定 self::$authIDEncrypted = $ProjectConfigure::AUTH_ID_ENCRYPTED; } if (NULL !== $ProjectConfigure::constant('AUTH_PASS_ENCRYPTED')) { // 定義からuserTable名を特定 self::$authPassEncrypted = $ProjectConfigure::AUTH_PASS_ENCRYPTED; } if (NULL !== $ProjectConfigure::constant('CRYPT_KEY')) { // 定義から暗号化キーを設定 self::$_sessionCryptKey = $ProjectConfigure::CRYPT_KEY; } if (NULL !== $ProjectConfigure::constant('NETWORK_CRYPT_KEY')) { // 定義から暗号化キーを設定 self::$_sessionCryptKey = $ProjectConfigure::NETWORK_CRYPT_KEY; } if (NULL !== $ProjectConfigure::constant('SESSION_CRYPT_KEY')) { // 定義から暗号化キーを設定 self::$_sessionCryptKey = $ProjectConfigure::SESSION_CRYPT_KEY; } if (NULL !== $ProjectConfigure::constant('DB_CRYPT_KEY')) { // 定義から暗号化キーを設定 self::$_authCryptKey = $ProjectConfigure::DB_CRYPT_KEY; } if (NULL !== $ProjectConfigure::constant('AUTH_CRYPT_KEY')) { // 定義から暗号化キーを設定 self::$_authCryptKey = $ProjectConfigure::AUTH_CRYPT_KEY; } if (NULL !== $ProjectConfigure::constant('CRYPT_IV')) { // 定義から暗号化IVを設定 self::$_sessionCryptIV = $ProjectConfigure::CRYPT_IV; self::$_authCryptIV = $ProjectConfigure::CRYPT_KEY; } if (NULL !== $ProjectConfigure::constant('NETWORK_CRYPT_IV')) { // 定義から暗号化IVを設定 self::$_sessionCryptIV = $ProjectConfigure::NETWORK_CRYPT_IV; } if (NULL !== $ProjectConfigure::constant('SESSION_CRYPT_IV')) { // 定義から暗号化IVを設定 self::$_sessionCryptIV = $ProjectConfigure::SESSION_CRYPT_IV; } if (NULL !== $ProjectConfigure::constant('DB_CRYPT_IV')) { // 定義から暗号化キーを設定 self::$_authCryptKIV = $ProjectConfigure::DB_CRYPT_IV; } if (NULL !== $ProjectConfigure::constant('AUTH_CRYPT_IV')) { // 定義から暗号化キーを設定 self::$_authCryptIV = $ProjectConfigure::AUTH_CRYPT_IV; } } // DBOを初期化 if (NULL === self::$_DBO) { if (NULL !== $argDSN) { // セッションDBの接続情報を直指定 $DSN = $argDSN; } self::$_DBO = DBO::sharedInstance($DSN); } // 初期化済み self::$_initialized = TRUE; } }
function draw() { global $lang, $page_action; if ($this->value == "") $this->value = 999; $values = createNameValueArrayEx("sitemap", "NAME", "POSITION", "PARENT_ID = ".$this->parentId, " AND DELETED=0 ORDER BY POSITION"); for ($i=0; $i < count($values); $i++) { $values[$i][0] = $lang->get("after", "After:")." ".$values[$i][0]; if ($this->value > $values[$i][1] || $page_action == "INSERT") { $values[$i][1]++; } else if ($this->value == $values[$i][1] && $page_action != "INSERT") { $values[$i][0] = $lang->get("remain_pos", "Do not change position"); } } if (is_array($values)) { array_unshift($values, array($lang->get("begin", "At the beginnging"), "1")); } else { $values = array(array($lang->get("begin", "At the beginnging"), "1")); } if ($this->value == "999") { $this->v_wuiobject->selectedValue = $values[count($values)-1][1]; } $this->v_wuiobject->value = $values; return DBO::draw(); }
/** * DataSource::lastInsertedID() * * @return mixed */ public function lastInsertedID() { return $this->connection->lastInsertId(); }
/** * standard constructor * @param string Text that is to be shown as description or label with your object. * @param string Table, you want to connect with the object. * @param string column1, you want to connect with the object. * @param string column2, you want to connect with the object. * @param string first $row_identifier Usually to be generated with form->setPK. Identifies the * row in db, you want to affect with operation. Keep empty for insert. (Example: stdEDForm) * @param string $params Allowed parameter is: * param:<Name of form> needed for js-reasons. * @param string $check Does checks on user input. Allowed are MANDATORY (=not null)|UNIQUE. Separate with &. * @param string $db_datatype Datatype of the database, you want to use. */ function DurationInput($label, $table, $column1, $column2, $row_identifier = "1", $style = "standard", $params = "param:f1", $check = "", $db_datatype = "TIME") { DBO::DBO($label, $table, $column, $row_identifier, $params, $db_datatype, $check); $this->v_frombox = new TimeInput("", $table, $column1, $row_identifier, $style, $params, $check, $db_datatype); $this->v_untilbox = new TimeInput("to", $table, $column2, $row_identifier, $style, $params, $check, $db_datatype); }
/** * Sessionクラスの初期化 * @param string セッションの範囲となるドメイン * @param string セッションの有効期限 * @param string DBDSN情報 */ protected static function _init($argDomain = NULL, $argExpiredtime = NULL, $argDSN = NULL) { if (FALSE === self::$_initialized) { // セッションの有効ドメインを設定 self::$_domain = $argDomain; if (NULL === $argDomain) { self::$_domain = $_SERVER['SERVER_NAME']; } $DSN = NULL; $expiredtime = self::$_expiredtime; if (class_exists('Configure') && NULL !== Configure::constant('DB_DSN')) { // 定義からセッションDBの接続情報を特定 $DSN = Configure::DB_DSN; } if (class_exists('Configure') && NULL !== Configure::constant('SESSION_DB_DSN')) { // 定義からセッションDBの接続情報を特定 $DSN = Configure::SESSION_DB_DSN; } if (class_exists('Configure') && NULL !== Configure::constant('SESSION_EXPIRED_TIME')) { // 定義からセッションの有効期限を設定 $expiredtime = Configure::SESSION_EXPIRED_TIME; } if (class_exists('Configure') && NULL !== Configure::constant('SESSION_TBL_NAME')) { // 定義からセッションテーブル名を特定 self::$_sessionTblName = Configure::SESSION_TBL_NAME; } if (class_exists('Configure') && NULL !== Configure::constant('SESSION_TBL_PKEY_NAME')) { // 定義からセッションテーブルのPKey名を特定 self::$_sessionPKeyName = Configure::SESSION_TBL_PKEY_NAME; } if (class_exists('Configure') && NULL !== Configure::constant('SESSION_DATE_KEY_NAME')) { // 定義から日時フィールド名を特定 self::$_sessionDateKeyName = Configure::SESSION_DATE_KEY_NAME; } if (class_exists('Configure') && NULL !== Configure::constant('CRYPT_KEY')) { // 定義から暗号化キーを設定 self::$_cryptKey = Configure::CRYPT_KEY; } if (class_exists('Configure') && NULL !== Configure::constant('NETWORK_CRYPT_KEY')) { // 定義から暗号化キーを設定 self::$_cryptKey = Configure::NETWORK_CRYPT_KEY; } if (class_exists('Configure') && NULL !== Configure::constant('SESSION_CRYPT_KEY')) { // 定義から暗号化キーを設定 self::$_cryptKey = Configure::SESSION_CRYPT_KEY; } if (class_exists('Configure') && NULL !== Configure::constant('CRYPT_IV')) { // 定義から暗号化IVを設定 self::$_cryptIV = Configure::CRYPT_IV; } if (class_exists('Configure') && NULL !== Configure::constant('NETWORK_CRYPT_IV')) { // 定義から暗号化IVを設定 self::$_cryptIV = Configure::NETWORK_CRYPT_IV; } if (class_exists('Configure') && NULL !== Configure::constant('SESSION_CRYPT_IV')) { // 定義から暗号化IVを設定 self::$_cryptIV = Configure::SESSION_CRYPT_IV; } if (defined('PROJECT_NAME') && strlen(PROJECT_NAME) > 0 && class_exists(PROJECT_NAME . 'Configure')) { $ProjectConfigure = PROJECT_NAME . 'Configure'; if (NULL !== $ProjectConfigure::constant('DB_DSN')) { // 定義からセッションDBの接続情報を特定 $DSN = $ProjectConfigure::DB_DSN; } if (NULL !== $ProjectConfigure::constant('SESSION_DB_DSN')) { // 定義からセッションDBの接続情報を特定 $DSN = $ProjectConfigure::SESSION_DB_DSN; } if (NULL !== $ProjectConfigure::constant('SESSION_EXPIRED_TIME')) { // 定義からセッションの有効期限を設定 $expiredtime = $ProjectConfigure::SESSION_EXPIRED_TIME; } if (NULL !== $ProjectConfigure::constant('SESSION_TBL_NAME')) { // 定義からセッションテーブル名を特定 self::$_sessionTblName = $ProjectConfigure::SESSION_TBL_NAME; } if (NULL !== $ProjectConfigure::constant('SESSION_TBL_PKEY_NAME')) { // 定義からセッションテーブルのPKey名を特定 self::$_sessionPKeyName = $ProjectConfigure::SESSION_TBL_PKEY_NAME; } if (NULL !== $ProjectConfigure::constant('SESSION_DATE_KEY_NAME')) { // 定義から日時フィールド名を特定 self::$_sessionDateKeyName = $ProjectConfigure::SESSION_DATE_KEY_NAME; } if (NULL !== $ProjectConfigure::constant('CRYPT_KEY')) { // 定義から暗号化キーを設定 self::$_cryptKey = $ProjectConfigure::CRYPT_KEY; } if (NULL !== $ProjectConfigure::constant('NETWORK_CRYPT_KEY')) { // 定義から暗号化キーを設定 self::$_cryptKey = $ProjectConfigure::NETWORK_CRYPT_KEY; } if (NULL !== $ProjectConfigure::constant('SESSION_CRYPT_KEY')) { // 定義から暗号化キーを設定 self::$_cryptKey = $ProjectConfigure::SESSION_CRYPT_KEY; } if (NULL !== $ProjectConfigure::constant('CRYPT_IV')) { // 定義から暗号化IVを設定 self::$_cryptIV = $ProjectConfigure::CRYPT_IV; } if (NULL !== $ProjectConfigure::constant('NETWORK_CRYPT_IV')) { // 定義から暗号化IVを設定 self::$_cryptIV = $ProjectConfigure::NETWORK_CRYPT_IV; } if (NULL !== $ProjectConfigure::constant('SESSION_CRYPT_IV')) { // 定義から暗号化IVを設定 self::$_cryptIV = $ProjectConfigure::SESSION_CRYPT_IV; } } // DBOを初期化 if (NULL === self::$_DBO) { if (NULL !== $argDSN) { // セッションDBの接続情報を直指定 $DSN = $argDSN; } self::$_DBO = DBO::sharedInstance($DSN); } // セッションの有効期限を設定 if (NULL !== $argExpiredtime) { // セッションの有効期限を直指定 $expiredtime = $argExpiredtime; } self::$_expiredtime = $expiredtime; // セッションデータクラスの初期化 parent::_init($expiredtime, $DSN); // 初期化済み self::$_initialized = TRUE; } }
/** * Grab the original state of the table * @param string $table The table to select * @param string $condition The WHERE clause * @param array $keys Keys to select. Defaults to all * @return array */ public function fetchOriginal($table, $condition, array $keys = array('*')) { if (!in_array('*', $keys, true)) { // Include the primary key in the rows for original state $primaryKey = $this->getPrimaryKey($table); if (!in_array($primaryKey, $keys, true) && !in_array('*', $keys, true)) { $keys[] = $primaryKey; } } $sql = "SELECT " . implode(',', $keys) . "\n FROM " . DBO::cleanFieldName($table) . "\n WHERE {$condition};"; return $this->db->query($sql)->fetchAll(); }
protected static function _getDBO($argDSN = NULL) { // DBOを初期化 static $defaultDSN = NULL; static $DBO = array(); // DSNの自動判別 $DSN = $defaultDSN; if (NULL === $argDSN && NULL === $defaultDSN) { $DSN = NULL; if (class_exists('Configure') && NULL !== Configure::constant('DB_DSN')) { // 定義からセッションDBの接続情報を特定 $DSN = Configure::DB_DSN; } if (class_exists('Configure') && NULL !== Configure::constant('REST_DB_DSN')) { // 定義からセッションDBの接続情報を特定 $DSN = Configure::REST_DB_DSN; } if (defined('PROJECT_NAME') && strlen(PROJECT_NAME) > 0 && class_exists(PROJECT_NAME . 'Configure')) { $ProjectConfigure = PROJECT_NAME . 'Configure'; if (NULL !== $ProjectConfigure::constant('DB_DSN')) { // 定義からセッションDBの接続情報を特定 $DSN = $ProjectConfigure::DB_DSN; } if (NULL !== $ProjectConfigure::constant('REST_DB_DSN')) { // 定義からセッションDBの接続情報を特定 $DSN = $ProjectConfigure::REST_DB_DSN; } } $defaultDSN = $DSN; } elseif (NULL !== $argDSN) { $DSN = $argDSN; } if (!isset($DBO[$DSN])) { $DBO[$DSN] = DBO::sharedInstance($DSN); } return $DBO[$DSN]; }
public static function getInstance($dns = null, $username = '', $password = '', $driver_options = array()) { if (empty(self::$instance) && isset($dns)) self::$instance = new DBO($dns, $username, $password, $driver_options); return self::$instance; }
<?php require "config.php"; require "dbo_lib.php"; require "question.class.php"; require "myTinCanAPI.class.php"; $questions = array(); // We do not need the totals to show just one question // $corrects = 0; // $total = 0; $page = 0; if (!empty($_GET['page'])) { $page = $_GET['page']; } $dbo = new DBO($servername, $username, $password, $dbname); $sql = "SELECT * FROM questions"; $dbo->query($sql) or die($dbo->ShowError()); $num_questions = $dbo->emaitza_kopurua(); $sql = "SELECT * FROM questions LIMIT " . $page . ", 1"; $dbo->query($sql) or die($dbo->ShowError()); while ($questionDB = $dbo->emaitza()) { $question = new question($questionDB); $total++; $qid = 'q' . $question->getId(); $answer = $_POST[$qid]; $passed = $question->isCorrect($answer); // if ($passed) { // $corrects++; // } $myTC = new MyTinCanAPI(); $myTC->createObject($question->getBefore());
/** * standard constructor * @param string Text that is to be shown as description or label with your object. * @param string Table, you want to connect with the object. * @param string column, you want to connect with the object. * @param string $row_identifier Usually to be generated with form->setPK. Identifies the * row in db, you want to affect with operation. Keep empty for insert. (Example: stdEDForm) * @param string allowed is type:TEXT as paramter * @param string $datatype Datatype of the database, you want to use. Allowed are CHAR|NUMBER|DATE|DATETIME|TIMESTAMP|PASSWORD */ function DisplayedValue($label, $table, $column, $row_identifier = "1", $param = "type:text", $datatype = "TIMESTAMP") { DBO::DBO($label, $table, $column, $row_identifier, $param, $datatype, ""); $this->std_style = "standardlight"; $this->v_wuiobject = new Label($this->name, $this->value, $this->std_style, $this->width); }
function __construct($configInstance = null, $useReusableConnection = true) { parent::__construct($configInstance, $useReusableConnection); }