} else { include View::Get('server_add.html', $st_subdir . 'server/'); } break; case 'constants': $site_name = Filter::input('site_name'); if ($site_name) { $site_offline = Filter::input('site_offline', 'post', 'bool'); $smtp = Filter::input('smtp', 'post', 'bool'); $site_about = Filter::input('site_about'); $keywords = Filter::input('site_keyword'); if (TextBase::StringLen($keywords) > 200) { $info .= lng('INCORRECT_LEN') . ' (' . lng('ADMIN_KEY_WORDS') . ') ' . lng('TO') . ' 200 ' . lng('CHARACTERS'); break; } if (!TextBase::StringLen($site_name)) { $info .= lng('INCORRECT') . ' (' . lng('ADMIN_SITE_NAME') . ') '; break; } $sbuffer = Filter::input('sbuffer', 'post', 'bool'); $rewrite = Filter::input('rewrite', 'post', 'bool'); $log = Filter::input('log', 'post', 'bool'); $comm_revers = Filter::input('comm_revers', 'post', 'bool'); $theme_id = Filter::input('theme_name', 'post'); $theme_delete = Filter::input('theme_delete', 'post'); $theme_old = $config['s_theme']; $email_name = Filter::input('email_name', 'post'); $email_mail = Filter::input('email_mail', 'post'); $email_test = Filter::input('email_test', 'post'); if (ThemeManager::GetThemeInfo($theme_id) === false) { $theme_id = false;
public function Create($message, $user_id, $item_id, $item_type) { if ($this->id) { return 0; } $this->parent_id = (int) $item_id; $this->parent_type = (int) $item_type; if (!$this->initParent()) { return 1703; } $this->user_id = $user_id; $message = Message::Comment($message); if (TextBase::StringLen($message) < 2) { return 1701; } // lock read \ write cause comments may asked to be shown \ delete while creation $sql = "INSERT INTO `{$this->db}` ( `message`, `time` , `item_id`, `item_type`, `user_id`) " . "VALUES (:message, NOW(), '" . $this->parent_obj->id() . "', '" . $this->parent_obj->type() . "', '" . $this->user_id . "')"; $result = getDB()->ask($sql, array('message' => $message)); if ($result) { $this->id = getDB()->lastInsertId(); $this->parent_obj->OnComment(); return 1; } return 0; }
public function SetText($var, $field = 'name') { if (!$this->Exist()) { return false; } else { if ($field !== 'name' and $field !== 'info') { return false; } } if (!$var or !TextBase::StringLen($var)) { return false; } getDB()->ask("UPDATE `" . $this->db . "` SET `{$field}`=:var WHERE `id`='" . $this->id . "'", array('var' => $var)); if ($field == 'name') { $this->name = $var; } else { $this->info = $var; } }
public function Edit($cat_id, $title, $message, $message_full = false, $vote = true, $discus = true) { global $user; if (!$this->Exist() or empty($user) or !$user->getPermission('add_news')) { return false; } $cat_id = (int) $cat_id; if (!CategoryManager::ExistByID($cat_id)) { return false; } $sql = "UPDATE `{$this->db}` SET " . "`message`=:message," . "`title`=:title," . "`message_full`=:message_full," . "`category_id`=:category_id, " . "`discus`=:discus," . "`vote`=:vote WHERE `id`='" . $this->id . "'"; $result = getDB()->ask($sql, array('title' => $title, 'message' => TextBase::StringLen($message) ? (string) $message : '', 'message_full' => TextBase::StringLen($message_full) ? (string) $message_full : '', 'category_id' => $cat_id, 'discus' => $discus ? '1' : '0', 'vote' => $vote ? '1' : '0')); $this->category_id = (int) $cat_id; $this->title = $title; $this->discus = $discus ? true : false; $this->vote = $vote ? true : false; return true; }
public function Edit($name, &$permissions) { if (!$this->id) { return false; } if (!$name or !TextBase::StringLen($name)) { return false; } $line = getDB()->fetchRow("SELECT COUNT(*) FROM `{$this->db}` " . "WHERE `name`=:name and `id`!='{$this->id}'", array('name' => $name), 'num'); if ((int) $line[0]) { return false; } $sql = '`name`=?'; $sqlData = array($name); foreach (self::$permissions as $key => $value) { if ($value == 'bool') { $sqlData[] = (isset($permissions[$key]) and $permissions[$key]) ? 1 : 0; } elseif (isset($permissions[$key])) { $sqlData[] = (int) $permissions[$key]; } else { continue; } $sql .= ",`{$key}`=?"; } $result = getDB()->ask("UPDATE `{$this->db}` SET {$sql} WHERE `id`='{$this->id}'", $sqlData); if ($result and $result->rowCount()) { return true; } return false; }