示例#1
0
function _tmpRegister($mode, $group, $username, $pass_and_salt, $massemail, $ip, $email)
{
    // vlozeni do tabulky uzivatelu
    if ($mode == 0) {
        DB::query("INSERT INTO `" . _mysql_prefix . "-users` (`group`,levelshift,username,password,salt,logincounter,registertime,activitytime,blocked,massemail,wysiwyg,language,ip,email,web,skype,msn,jabber,icq,note) VALUES (" . $group . ",0,'" . $username . "','" . $pass_and_salt[0] . "','" . $pass_and_salt[1] . "',0," . time() . "," . time() . ",0," . $massemail . ",0,'','" . _userip . "','" . $email . "','','','','',0,'')");
        $insert_id = DB::insertID();
        _extend('call', 'user.new', array('id' => $insert_id, 'username' => $username));
        _extend('call', 'mod.reg.success', array('user_id' => $insert_id));
        return;
    }
    // vlozeni do tabulky pro potvrzeni
    $code = str_replace('.', '-', uniqid('', true));
    DB::query("INSERT INTO `" . _mysql_prefix . "-user-activation` (`code`,`expire`,`group`,`username`,`password`,`salt`,`massemail`,`ip`,`email`) VALUES('" . $code . "'," . (time() + 3600) . "," . $group . ",'" . $username . "','" . $pass_and_salt[0] . "','" . $pass_and_salt[1] . "'," . $massemail . ",'" . $ip . "','" . $email . "')");
    return $code;
}
                // ulozeni korekci
                if ($newvotes != "") {
                    DB::query("UPDATE `" . _mysql_prefix . "-polls` SET votes='" . $newvotes . "' WHERE id=" . $id);
                }
            }
            // vynulovani
            if ($reset) {
                DB::query("UPDATE `" . _mysql_prefix . "-polls` SET votes='" . trim(str_repeat("0-", $answers_count), "-") . "' WHERE id=" . $id);
                DB::query("DELETE FROM `" . _mysql_prefix . "-iplog` WHERE type=4 AND var=" . $id);
            }
            // presmerovani
            define('_redirect_to', 'index.php?p=content-polls-edit&id=' . $id . '&saved');
            return;
        } else {
            DB::query("INSERT INTO `" . _mysql_prefix . "-polls` (author,question,answers,locked,votes) VALUES (" . $author . ",'" . $question . "','" . $answers . "'," . $locked . ",'" . trim(str_repeat("0-", $answers_count), "-") . "')");
            $newid = DB::insertID();
            define('_redirect_to', 'index.php?p=content-polls-edit&id=' . $newid . '&created');
            return;
        }
    } else {
        $message = _formMessage(2, _eventList($errors, 'errors'));
    }
}
/* ---  vystup  --- */
if ($continue) {
    // vyber autora
    if (_loginright_adminpollall) {
        $author_select = "\n    <tr>\n    <td class='rpad'><strong>" . $_lang['article.author'] . "</strong></td>\n    <td>" . _admin_authorSelect("author", $query['author'], "adminpoll=1", "selectmedium") . "</td></tr>\n    ";
    } else {
        $author_select = "";
    }
示例#3
0
文件: model.php 项目: Tapac/hotscot
 /**
  * saves the fields to the database and updates the caches
  *
  * @return void
  * @author Craig Ulliott
  */
 public final function save()
 {
     $this->requiresState();
     //is there a pre save method
     if (method_exists($this, 'preSave')) {
         $this->preSave();
     }
     //an array of the fields
     $insert_r = array();
     // a keyed array of rows and values
     foreach ($this->fields as $field) {
         if (isset($this->values[$field])) {
             $insert_r['`' . $field . '`'] = DB::s($this->values[$field]);
         } else {
             $insert_r['`' . $field . '`'] = 'NULL';
         }
     }
     // are we creating a new object or updating an existing one
     if ($this->ID) {
         // the primary key will cause a duplicate key, and thus an update
         $sql = 'INSERT INTO `' . $this->database . '`.`' . $this->table . '` (' . $this->primary_key . ',' . implode(',', array_keys($insert_r)) . ') VALUES (' . $this->ID . ',' . implode(',', $insert_r) . ') on duplicate key update ';
     } else {
         // no primary key, we will get an ID after row creation
         $sql = 'INSERT INTO `' . $this->database . '`.`' . $this->table . '` (' . implode(',', array_keys($insert_r)) . ') VALUES (' . implode(',', $insert_r) . ') on duplicate key update ';
     }
     // the update part of the query
     $sqls = array();
     $first = true;
     foreach ($insert_r as $field => $value) {
         /*
          * this piece of sql added to the first field allows us to pass back the primary key as a 
          * negative number if the on duplicate key portion of the query was used 
          * we use this to tell if it was a new object being inserted or not
          */
         if ($first) {
             $first = false;
             $sqls[] = $field . ' = concat(' . $value . ',left(last_insert_id(-' . $this->primary_key . '),0)) ';
         } else {
             $sqls[] = $field . ' = ' . $value;
         }
     }
     $sql = $sql . implode(', ', $sqls);
     //run the query
     DB::q($sql);
     // was this a new object?
     $newObject = false;
     if (!$this->ID) {
         $id = DB::insertID();
         //we can tell by the primary key field returned being negative
         if ($id < 0) {
             $id = abs($id);
         } else {
             $newObject = true;
             // we fake the added field here so the object has it avaliable right away
             $this->values['added'] = time();
         }
         //add the ID to make this object real
         $this->ID = $id;
     }
     //save this into the cache for faster retrieval next time
     $this->saveCache();
     //is there a post save method
     if (method_exists($this, 'postSave')) {
         $this->postSave($newObject);
     }
     //pass back this object for chaining
     return $this;
 }
示例#4
0
include 'inc/db_connect.php';
if (isset($_POST['userName'])) {
    $name = $_POST['name'];
    $email = $_POST['email'];
    $username = $_POST['userName'];
    $password = $_POST['password'];
    $hashed_password = password_hash($password, PASSWORD_DEFAULT);
    try {
        DB::insert('users', array('name' => $name, 'email' => $email, 'username' => $username, 'password' => $hashed_password, 'status' => 1));
    } catch (MeekroDBException $e) {
        header('Location: /signup.php?error=yes');
        exit;
    }
    $_SESSION['username'] = $username;
    $_SESSION['uid'] = DB::insertID();
    header('Location: /?callback=registration');
    // print $_POST['email'];
    // print $_POST['password'];
    // print $hashed_password;
    // exit;
    //USER SUBMITTED SOMETHING.
    //NOW WHAT?
    //Check to see if this user is in the DB!!
    $result = DB::query("SELECT * FROM users \n\t\t\tWHERE username = '******'userName'] . "' \n\t\t\t\tAND password = '******'");
    // print '<pre>';
    // print_r($result);
    // exit;
    if (mysql_num_rows($result) == 1) {
        //We have a match!!
        $_SESSION['username'] = $_POST['userName'];
示例#5
0
 public function setName($handle)
 {
     $authorID = !empty($GLOBALS['Session']) && $GLOBALS['Session']->PersonID ? $GLOBALS['Session']->PersonID : null;
     $oldHandle = $this->_handle;
     if ($this->Size == 0 && $authorID && $this->AuthorID == $authorID && !$this->AncestorID) {
         // updating existing record only if file is empty, by the same author, and has no ancestor
         DB::nonQuery('UPDATE `%s` SET Handle = "%s" WHERE ID = %u', array(static::$tableName, DB::escape($handle), $this->ID));
     } else {
         // clone existing record
         DB::nonQuery('INSERT INTO `%s` SET CollectionID = %u, Handle = "%s", Status = "%s", SHA1 = "%s", Size = %u, Type = "%s", AuthorID = %s, AncestorID = %u', array(static::$tableName, $this->CollectionID, DB::escape($handle), $this->Status, $this->SHA1, $this->Size, $this->Type, $this->AuthorID ? $this->AuthorID : 'NULL', $this->ID));
         $newID = DB::insertID();
         // delete current record
         $this->delete();
         // symlink to old data point
         symlink($this->ID, static::getRealPathByID($newID));
         // update instance
         $this->_record['ID'] = $newID;
         if ($authorID != $this->AuthorID) {
             $this->_author = null;
         }
         $this->_record['AuthorID'] = $authorID;
     }
     $this->_handle = $handle;
     // invalidate cache of new and old handle
     Cache::delete(static::getCacheKey($this->CollectionID, $oldHandle));
     Cache::delete(static::getCacheKey($this->CollectionID, $handle));
     // fire event
     static::fireFileEvent($this->getFullPath(null, false), 'fileRename', array('record' => $this->_record, 'oldHandle' => $oldHandle, 'newHandle' => $handle));
 }
 public function setName($handle)
 {
     if ($this->Size == 0 && $this->AuthorID == $GLOBALS['Session']->PersonID && !$this->AncestorID) {
         // updating existing record only if file is empty, by the same author, and has no ancestor
         DB::nonQuery('UPDATE `%s` SET Handle = "%s" WHERE ID = %u', array(static::$tableName, DB::escape($handle), $this->ID));
     } else {
         // clone existing record
         DB::nonQuery('INSERT INTO `%s` SET CollectionID = %u, Handle = "%s", Status = "%s", SHA1 = "%s", Size = %u, Type = "%s", AuthorID = %u, AncestorID = %u', array(static::$tableName, $this->CollectionID, DB::escape($handle), $this->Status, $this->SHA1, $this->Size, $this->Type, $GLOBALS['Session']->PersonID, $this->ID));
         $newID = DB::insertID();
         // delete current record
         $this->delete();
         // symlink to old data point
         symlink($this->ID, static::getRealPathByID($newID));
     }
 }
 public static function createRecord($handle, $parentCollection = null, $remote = false)
 {
     // clear cache of not-found or deleted record
     Cache::delete(static::getCacheKey($handle, $parentCollection ? $parentCollection->ID : null, $remote));
     // check for existing deleted node
     $existingRecord = DB::oneRecord('SELECT * FROM `%s` WHERE Site = "%s" AND ParentID = %s AND Handle = "%s"', array(static::$tableName, $parentCollection ? $parentCollection->Site : ($remote ? 'Remote' : 'Local'), $parentCollection ? $parentCollection->ID : 'NULL', DB::escape($handle)));
     if ($existingRecord) {
         DB::nonQuery('UPDATE `%s` SET Status = "Normal" WHERE ID = %u', array(static::$tableName, $existingRecord['ID']));
         return $existingRecord['ID'];
     }
     DB::nonQuery('LOCK TABLES ' . static::$tableName . ' WRITE, ' . SiteFile::$tableName . ' READ');
     // The table lock will interfere with normal error handling, so any exceptions until the table is unlocked must be intercepted
     try {
         // determine new node's position
         if ($parentCollection) {
             $left = DB::oneValue('SELECT PosRight FROM `%s` WHERE ID = %u', array(static::$tableName, $parentCollection->ID));
         } else {
             $left = DB::oneValue('SELECT IFNULL(MAX(PosRight)+1, 1) FROM `%s`', static::$tableName);
         }
         $right = $left + 1;
         if ($parentCollection) {
             // push rest of set right by 2 to make room
             DB::nonQuery('UPDATE `%s` SET PosRight = PosRight + 2 WHERE PosRight >= %u ORDER BY PosRight DESC', array(static::$tableName, $left));
             DB::nonQuery('UPDATE `%s` SET PosLeft = PosLeft + 2 WHERE PosLeft > %u ORDER BY PosLeft DESC', array(static::$tableName, $left));
         }
         // create record
         DB::nonQuery('INSERT INTO `%s` SET Site = "%s", Handle = "%s", CreatorID = %u, ParentID = %s, PosLeft = %u, PosRight = %u', array(static::$tableName, $parentCollection ? $parentCollection->Site : ($remote ? 'Remote' : 'Local'), DB::escape($handle), !empty($GLOBALS['Session']) ? $GLOBALS['Session']->PersonID : null, $parentCollection ? $parentCollection->ID : 'NULL', $left, $right));
         $newID = DB::insertID();
     } catch (Exception $e) {
         // TODO: use `finally` structure in PHP 5.5
         DB::nonQuery('UNLOCK TABLES');
         throw $e;
     }
     DB::nonQuery('UNLOCK TABLES');
     return $newID;
 }
 public function save($deep = true)
 {
     // fire event
     Emergence\EventBus::fireEvent('beforeRecordSave', $this->getRootClass(), array('Record' => $this, 'deep' => $deep));
     // set creator
     if (static::_fieldExists('CreatorID') && !$this->CreatorID) {
         $Creator = $this->getUserFromEnvironment();
         $this->CreatorID = $Creator ? $Creator->ID : null;
     }
     // set created
     if (static::_fieldExists('Created') && (!$this->Created || $this->Created == 'CURRENT_TIMESTAMP')) {
         $this->Created = time();
     }
     // validate
     if (!$this->validate($deep)) {
         throw new RecordValidationException($this, 'Cannot save invalid record');
     }
     // clear caches
     foreach ($this->getClassFields() as $field => $options) {
         if (!empty($options['unique']) || !empty($options['primary'])) {
             $key = sprintf('%s/%s:%s', static::$tableName, $field, $this->getValue($field));
             DB::clearCachedRecord($key);
         }
     }
     // traverse relationships
     if ($deep) {
         $this->_saveRelationships();
     }
     if ($this->isDirty) {
         if (!$this->_isPhantom && static::$trackModified) {
             $this->Modified = time();
             $Modifier = $this->getUserFromEnvironment();
             $this->ModifierID = $Modifier ? $Modifier->ID : null;
         }
         // prepare record values
         $recordValues = $this->_prepareRecordValues();
         // transform record to set array
         $set = static::_mapValuesToSet($recordValues);
         // create new or update existing
         if ($this->_isPhantom) {
             $insertQuery = DB::prepareQuery('INSERT INTO `%s` SET %s', array(static::$tableName, join(',', $set)));
             try {
                 try {
                     DB::nonQuery($insertQuery);
                 } catch (TableNotFoundException $e) {
                     // auto-create table and try insert again
                     DB::multiQuery(SQL::getCreateTable(get_called_class()));
                     DB::nonQuery($insertQuery);
                 }
                 $this->_record['ID'] = DB::insertID();
                 $this->_isPhantom = false;
                 $this->_isNew = true;
             } catch (DuplicateKeyException $e) {
                 if (static::$updateOnDuplicateKey && preg_match('/Duplicate entry \'.*?\' for key \'([^\']+)\'/', $e->getMessage(), $errorMatches) && ($duplicateKeyName = $errorMatches[1]) && ($duplicateKeyName == 'PRIMARY' || ($duplicateKeyConfig = static::getStackedConfig('indexes', $duplicateKeyName)))) {
                     if (!empty($duplicateKeyConfig)) {
                         $keyFields = $duplicateKeyConfig['fields'];
                     } else {
                         $keyFields = array();
                         foreach (static::getClassFields() as $fieldName => $fieldConfig) {
                             if (!empty($fieldConfig['primary'])) {
                                 $keyFields[] = $fieldName;
                             }
                         }
                     }
                     $keyValues = array_intersect_key($recordValues, array_flip($keyFields));
                     $deltaValues = array_diff_key($recordValues, array_flip(array('Created', 'CreatorID')));
                     DB::nonQuery('UPDATE `%s` SET %s WHERE %s', array(static::$tableName, join(',', static::_mapValuesToSet($deltaValues)), join(' AND ', static::_mapConditions($keyValues))));
                     $this->_record = static::getRecordByWhere($keyValues);
                     $this->_isPhantom = false;
                     $this->_isUpdated = true;
                 } else {
                     throw $e;
                 }
             }
         } elseif (count($set)) {
             DB::nonQuery('UPDATE `%s` SET %s WHERE `%s` = %u', array(static::$tableName, join(',', $set), static::_cn('ID'), $this->ID));
             $this->_isUpdated = true;
         }
         // clear cache
         static::_invalidateRecordCaches($this->ID);
         // update state
         $this->_isDirty = false;
     }
     // traverse relationships again
     if ($deep) {
         $this->_postSaveRelationships();
     }
     // fire event
     Emergence\EventBus::fireEvent('afterRecordSave', $this->getRootClass(), array('Record' => $this, 'deep' => $deep));
 }
示例#9
0
             }
             // anti spam limit
             if (!_iplogCheck(5)) {
                 $message = _formMessage(2, str_replace('*postsendexpire*', _postsendexpire, $_lang['misc.requestlimit']));
                 break;
             }
             /* ---  vse ok, odeslani  --- */
             // zaznam v logu
             if (!_loginright_unlimitedpostaccess) {
                 _iplogUpdate(5);
             }
             // extend
             _extend('call', 'mod.messages.new', array('receiver' => $rq['usr_id'], 'subject' => &$subject, 'text' => &$text));
             // vlozeni do pm tabulky
             DB::query('INSERT INTO `' . _mysql_prefix . '-pm` (sender,sender_readtime,sender_deleted,receiver,receiver_readtime,receiver_deleted,update_time) VALUES(' . _loginid . ',UNIX_TIMESTAMP(),0,' . $rq['usr_id'] . ',0,0,UNIX_TIMESTAMP())');
             $pm_id = DB::insertID();
             // vlozeni do posts tabulky
             DB::query("INSERT INTO `" . _mysql_prefix . "-posts` (type,home,xhome,subject,text,author,guest,time,ip,bumptime) VALUES (6," . $pm_id . ",-1,'" . DB::esc($subject) . "','" . DB::esc($text) . "'," . _loginid . ",''," . time() . ",'" . _userip . "',0)");
             // presmerovani a konec
             define('_redirect_to', _url . '/' . _indexOutput_url . '&a=list&read=' . $pm_id);
             return;
         } while (false);
     }
     // formular
     if (isset($message)) {
         $module .= $message . "\n";
     }
     $module .= "<form action='' method='post' name='newmsg'" . _jsCheckForm('newmsg', array('receiver')) . ">\n<table>\n\n<tr>\n    <td><strong>" . $_lang['mod.messages.receiver'] . "</strong></td>\n    <td><input type='text' name='receiver' class='inputsmall' maxlength='24'" . _restorePostValue("receiver", _get('receiver')) . " /></td>\n</tr>\n\n<tr>\n    <td><strong>" . $_lang['posts.subject'] . "</strong></td>\n    <td><input type='text' name='subject' class='inputsmall' maxlength='22'" . _restorePostValue("subject", _get('subject')) . " /></td>\n</tr>\n\n<tr class='valign-top'>\n    <td><strong>" . $_lang['mod.messages.message'] . "</strong></td>\n    <td><textarea name='text' class='areamedium' rows='5' cols='33'>" . _restorePostValue("text", null, true) . "</textarea></td>\n</tr>\n\n<tr>\n    <td></td>\n    <td><input type='submit' value='" . $_lang['global.send'] . "' />" . _getPostFormControls('newmsg', 'text') . "</td>\n</tr>\n\n</table>\n\n" . _jsLimitLength(16384, 'newmsg', 'text') . "\n\n" . _xsrfProtect() . "</form>\n";
     break;
     /* ---  vypis  --- */
 /* ---  vypis  --- */
 public static function createRecord($handle, $parentCollection = null, $siteID = null)
 {
     // check for existing deleted node
     $existingRecord = DB::oneRecord('SELECT * FROM `%s` WHERE SiteID = %u AND ParentID = %s AND Handle = "%s"', array(static::$tableName, $parentCollection ? $parentCollection->SiteID : ($siteID ? $siteID : Site::getSiteID()), $parentCollection ? $parentCollection->ID : 'NULL', DB::escape($handle)));
     if ($existingRecord) {
         DB::nonQuery('UPDATE `%s` SET Status = "Normal" WHERE ID = %u', array(static::$tableName, $existingRecord['ID']));
         return $existingRecord['ID'];
     }
     DB::nonQuery('LOCK TABLES ' . static::$tableName . ' WRITE');
     // determine new node's position
     $left = $parentCollection ? $parentCollection->PosRight : DB::oneValue('SELECT IFNULL(MAX(`PosRight`)+1,1) FROM `%s`', static::$tableName);
     $right = $left + 1;
     if ($parentCollection) {
         // push rest of set right by 2 to make room
         DB::nonQuery('UPDATE `%s` SET PosRight = PosRight + 2 WHERE PosRight >= %u ORDER BY PosRight DESC', array(static::$tableName, $left));
         DB::nonQuery('UPDATE `%s` SET PosLeft = PosLeft + 2 WHERE PosLeft > %u ORDER BY PosLeft DESC', array(static::$tableName, $left));
     }
     // create record
     DB::nonQuery('INSERT INTO `%s` SET SiteID = %u, Handle = "%s", CreatorID = %u, ParentID = %s, PosLeft = %u, PosRight = %u', array(static::$tableName, $parentCollection ? $parentCollection->SiteID : ($siteID ? $siteID : Site::getSiteID()), DB::escape($handle), $GLOBALS['Session']->PersonID, $parentCollection ? $parentCollection->ID : 'NULL', $left, $right));
     //DB::nonQuery('COMMIT');
     DB::nonQuery('UNLOCK TABLES');
     return DB::insertID();
 }
示例#11
0
    }
} else {
    $continue2 = true;
}
/* --  ulozeni prispevku  -- */
if ($continue and $continue2 and $text != "" and $posttype == 4 || _captchaCheck()) {
    if (_xsrfCheck()) {
        if ($posttype == 4 or _loginright_unlimitedpostaccess or _iplogCheck(5)) {
            if ($guest === '' || DB::result(DB::query('SELECT COUNT(*) FROM `' . _mysql_prefix . '-users` WHERE username=\'' . DB::esc($guest) . '\' OR publicname=\'' . DB::esc($guest) . '\''), 0) == 0) {
                // zpracovani pluginem
                $allow = true;
                _extend('call', 'posts.submit', array('allow' => &$allow, 'posttype' => $posttype, 'posttarget' => $posttarget, 'xhome' => $xhome, 'subject' => &$subject, 'text' => &$text, 'author' => $author, 'guest' => $guest));
                if ($allow) {
                    // ulozeni
                    DB::query("INSERT INTO `" . _mysql_prefix . "-posts` (type,home,xhome,subject,text,author,guest,time,ip,bumptime,flag) VALUES (" . $posttype . "," . $posttarget . "," . $xhome . ",'" . $subject . "','" . $text . "'," . $author . ",'" . $guest . "'," . time() . ",'" . _userip . "'," . ($posttype == 5 && $xhome == -1 ? 'UNIX_TIMESTAMP()' : '0') . "," . $pluginflag . ")");
                    $insert_id = DB::insertID();
                    if (!_loginright_unlimitedpostaccess and $posttype != 4) {
                        _iplogUpdate(5);
                    }
                    $return = 1;
                    _extend('call', 'posts.new', array('id' => $insert_id, 'posttype' => $posttype));
                    // topicy - aktualizace bumptime
                    if ($posttype == 5 && $xhome != -1) {
                        DB::query("UPDATE `" . _mysql_prefix . "-posts` SET bumptime=UNIX_TIMESTAMP() WHERE id=" . $xhome);
                    }
                    // zpravy - aktualizace casu zmeny a precteni
                    if ($posttype == 6) {
                        $role = $tdata['sender'] == _loginid ? 'sender' : 'receiver';
                        DB::query('UPDATE `' . _mysql_prefix . '-pm` SET update_time=UNIX_TIMESTAMP(),' . $role . '_readtime=UNIX_TIMESTAMP() WHERE id=' . $posttarget);
                    }
                    // shoutboxy - odstraneni prispevku za hranici limitu
示例#12
0
 /**
  * get the primary key value for the row we just inserted, as its the first row it should be the number 1
  * 
  * @depends testInsert
  */
 public function testInsertID()
 {
     // a query that should probably always work
     $this->assertEquals(DB::insertID(), 1);
 }
                $new_column_list .= $item[0] . ",";
                $sql .= $quotes . DB::esc($val) . $quotes . ",";
            }
        }
    }
    // vlozeni / ulozeni
    $sql = rtrim($sql, ",");
    if (!$new) {
        // ulozeni
        DB::query("UPDATE `" . _mysql_prefix . "-root` SET " . $sql . "  WHERE id=" . $id);
        _extend('call', 'admin.root.edit', array('id' => $id, 'query' => $query));
    } else {
        // vytvoreni
        $new_column_list = rtrim($new_column_list, ",");
        DB::query("INSERT INTO `" . _mysql_prefix . "-root` (type," . $new_column_list . ") VALUES (" . $type . "," . $sql . ")");
        $id = $query['id'] = DB::insertID();
        _extend('call', 'admin.root.new', array('id' => $id, 'query' => $query));
    }
    define('_redirect_to', 'index.php?p=content-edit' . $type_array[$type] . '&id=' . $id . '&saved');
    return;
}
/* ---  vystup  --- */
if ($continue != true) {
    $output .= _formMessage(3, $_lang['global.badinput']);
} else {
    // vyber rozcestniku
    if ($type != 7) {
        $intersection_select = "<select name='intersection' class='selectmedium'><option value='-1' class='special'>" . $_lang['admin.content.form.intersection.none'] . "</option>";
        $isquery = DB::query("SELECT id,title FROM `" . _mysql_prefix . "-root` WHERE type=7 ORDER BY ord");
        while ($item = DB::row($isquery)) {
            if ($item['id'] == $query['intersection']) {
示例#14
0
         if ($id != null) {
             // ulozeni
             DB::query("UPDATE `" . _mysql_prefix . "-users` SET email='" . $email . "',avatar=" . (isset($avatar) ? '\'' . $avatar . '\'' : 'NULL') . ",web='" . $web . "',skype='" . $skype . "',msn='" . $msn . "',jabber='" . $jabber . "',icq=" . $icq . ",note='" . $note . "',publicname='" . $publicname . "',`group`=" . $group . ",blocked=" . $blocked . ",levelshift=" . $levelshift . " WHERE id=" . $query['id']);
             if ($passwordchange == true) {
                 DB::query("UPDATE `" . _mysql_prefix . "-users` SET password='******', salt='" . $password[1] . "' WHERE id=" . $query['id']);
             }
             if ($usernamechange == true) {
                 DB::query("UPDATE `" . _mysql_prefix . "-users` SET username='******' WHERE id=" . $query['id']);
             }
             _extend('call', 'user.edit', array('id' => $query['id'], 'username' => $username));
             define('_redirect_to', 'index.php?p=users-edit&r=1&id=' . $username);
             return;
         } else {
             // vytvoreni
             DB::query("INSERT INTO `" . _mysql_prefix . "-users` (`group`,levelshift,username,publicname,password,salt,logincounter,registertime,activitytime,blocked,massemail,wysiwyg,ip,email,web,skype,msn,jabber,icq,note) VALUES (" . $group . "," . $levelshift . ",'" . $username . "','" . $publicname . "','" . $password[0] . "','" . $password[1] . "',0," . time() . ",0," . $blocked . ",1,0,'','" . $email . "','" . $web . "','" . $skype . "','" . $msn . "','" . $jabber . "'," . $icq . ",'" . $note . "')");
             _extend('call', 'user.new', array('id' => DB::insertID(), 'username' => $username));
             define('_redirect_to', 'index.php?p=users-edit&r=2&id=' . $username);
             return;
         }
     } else {
         $message = _eventList($errors, 'errors');
     }
 }
 /* ---  vystup  --- */
 // zpravy
 $messages_code = "";
 if (isset($_GET['r'])) {
     switch ($_GET['r']) {
         case 1:
             $messages_code .= _formMessage(1, $_lang['global.saved']);
             break;