protected function _cat_remove() { gfatal(); $v = $this->__(array('el' => 0)); $sql = 'SELECT * FROM _tickets_cat WHERE cat_id = ?'; if (!($cat = _fieldrow(sql_filter($sql, $v['el'])))) { $this->_error('#TICKET_CAT_NO'); } $sql = 'SELECT ticket_id FROM _tickets WHERE ticket_cat = ?'; if ($aaa = _fieldrow(sql_filter($sql, $v['el']))) { $this->_error('#TICKET_CAT_CANT_REMOVE'); } $sql = 'DELETE FROM _tickets_cat WHERE cat_id = ?'; _sql(sql_filter($sql, $v['el'])); return $this->e('~OK'); }
protected function _permission_create() { gfatal(); global $bio; $v = $this->__(array('alias')); $sql = 'SELECT bio_id FROM _bio WHERE bio_alias = ? AND bio_active = ? AND bio_id NOT IN ( SELECT ban_bio FROM _bio_ban )'; if (!($_bio = sql_fieldrow(sql_filter($sql, $v->alias, 1)))) { _fatal(); } $sql = 'SELECT auth_bio FROM _bio_auth WHERE auth_assoc = ? AND auth_bio = ?'; if (sql_field(sql_filter($sql, $this->a('bio_id'), $_bio->bio_id), 'auth_bio', 0)) { $this->warning->ok(); } $sql_insert = array('auth_assoc' => $this->a('bio_id'), 'auth_bio' => $_bio->bio_id, 'auth_time' => time()); sql_put('_bio_auth', $sql_insert); redirect(_link('alias', array('alias' => $this->a('bio_alias'), 'x1' => $this->x(1), 'x2' => $this->x(2)))); }
protected function _status_home() { gfatal(); global $bio; if (!$bio->v('auth_logged')) { _fatal(); } $v = $this->__(array('status', 'bio' => 0)); if (!$v['bio']) { $v['bio'] = $bio->v('bio_id'); } if ($v['bio'] !== $bio->v('bio_id')) { if (!$this->bio_exists($v['bio'])) { _fatal(); } if (!$bio->v('auth_status_update_others', false, $v['bio'])) { _fatal(); } } $sql_insert = array('bio' => $v['bio'], 'time' => time(), 'text' => _prepare($v['status']), 'ip' => $bio->v('session_ip')); sql_put('_bio_status', prefix('status', $sql_insert)); $response = array('time' => $sql_insert['time'], 'text' => $sql_insert['text']); return $this->e(json_encode($response)); }
protected function _groups_remove() { gfatal(); global $core; $v = $this->__(array('el' => 0)); $sql = 'SELECT group_id FROM _groups WHERE group_id = ?'; if (!($group = _fieldrow(sql_filter($sql, $v['el'])))) { $this->_error('#GROUPS_NO_EXISTS'); } $sql = 'SELECT ticket_id FROM _tickets WHERE ticket_group = ?'; if (_fieldrow(sql_filter($sql, $v['el']))) { $this->_error('#GROUP_CANT_REMOVE_TICKETS'); } $sql = 'DELETE FROM _groups WHERE group_id = ?'; _sql(sql_filter($sql, $v['el'])); $sql = 'DELETE FROM _groups_members WHERE member_group = ?'; _sql(sql_filter($sql, $v['el'])); $core->cache_unload(); return $this->e('~OK'); }