function update_tag() { global $xoopsModule, $xoopsSecurity; $page = rmc_server_var($_POST, 'page', 1); $tags = rmc_server_var($_POST, 'tags', array()); if (!$xoopsSecurity->check()) { redirectMsg('tags.php?page=' . $page, __('Sorry, operation not allowed!', 'mywords'), 1); die; } if (!is_array($tags) || empty($tags)) { redirectMsg('tags.php?page=' . $page, __('Please, specify a valid tag id!', 'mywords'), 1); die; } foreach ($tags as $id) { $tag = new MWTag($id); if ($tag->isNew()) { continue; } $tag->update_posts(); } redirectMsg('tags.php?page=' . $page, __('Tags updated!', 'mywords'), 0); }
/** * @desc Elimina los temas especificados **/ function deleteTopics() { global $xoopsSecurity; foreach ($_POST as $k => $v) { ${$k} = $v; } if (!$xoopsSecurity->check()) { redirectMsg('prune.php', __('Session token expired!', 'bxpress'), 0); die; } $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = "SELECT id_topic FROM " . $db->prefix('bxpress_topics') . " WHERE "; $sql .= $forums == 0 ? '' : "id_forum='{$forums}' "; //Determinamos de que foro se va a limpiar temas $sql .= $forums ? " AND date<" . (time() - $days * 86400) : " date<" . (time() - $days * 86400); //Determinamos los temas con los dias de antigüedad especificados $sql .= $option == 2 ? " AND replies=0" : ''; //Determinamos los temas a eliminar $sql .= $fixed ? " AND sticky=1 " : ' AND sticky=0'; //Temas fijos $result = $db->queryF($sql); $num = $db->getRowsNum($result); while ($rows = $db->fetchArray($result)) { $topic = new BBTopic(); $topic->assignVars($rows); $topic->delete(); } redirectMsg('prune.php', sprintf(__('Prune done! %u topics deleted', 'bxpress'), $num), 0); }
function rd_save_page() { $page = rmc_server_var($_POST, 'homepage', ''); if (file_put_contents(XOOPS_CACHE_PATH . '/rd_homepage.html', $page)) { redirectMsg('hpage.php', __('Page saved successfully!', 'docs'), 0); } else { redirectMsg('hpage.php', __('Page could not be saved!', 'docs'), 1); } }
public function eventCoreIncludeFunctionsRedirectheader($params) { // 0 = URL // 1 = Time // 2 = Message // 3 = Add redirect // 4 = Allow external link RMEvents::get()->run_event('rmcommon.redirect.header', $params[0], $params[1], $params[2], $params[3], $params[4]); if (!defined('XOOPS_CPFUNC_LOADED')) { return; } redirectMsg($params[0], $params[2]); die; }
function xt_show_menus() { global $xtAssembler, $xtFunctions; $tc = TextCleaner::getInstance(); $menus = $xtAssembler->rootMenus(); if (!$menus) { redirectMsg('themes.php', __('This theme does not support xThemes menus!', 'xthemes'), RMMSG_WARN); } $theme_menu = $xtAssembler->menu(); $tpl = RMTemplate::get(); $tpl->add_local_script('jquery.nestedSortable.js', 'xthemes'); $tpl->add_local_script('json_encode.js', 'xthemes'); $tpl->add_head_script("var lang_delete = '" . __('Do you really want to delete selected menu?', 'xthemes') . "';"); $tpl->add_local_script('xthemes.js', 'xthemes'); $tpl->assign('xoops_pagetitle', __('Theme menus', 'xthemes')); xoops_cp_header(); include $tpl->get_template('xt_navigation.php', 'module', 'xthemes'); xoops_cp_footer(); }
function delete_mw_trackbacks() { global $xoopsSecurity; $tbs = rmc_server_var($_POST, 'tbs', array()); if (empty($tbs) || !is_array($tbs)) { redirectMsg('trackbacks.php', __('Select one trackback at least!', 'mw_categories'), 1); die; } if (!$xoopsSecurity->check()) { redirectMsg('trackbacks.php', __('Session token expired!', 'mywords'), 1); die; } // Event RMEvents::get()->run_event('mywords.before.delete.trackback', $tbs); foreach ($tbs as $id) { $trac = new MWTrackbackObject($id); if ($trac->isNew()) { continue; } $trac->delete(); } redirectMsg('trackbacks.php', __('Trackbacks deleted successfully', 'mywords'), 0); }
/** * Deleting a category */ function m_delete_category() { global $xoopsModule, $xoopsSecurity; $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0; $ok = isset($_POST['ok']) ? intval($_POST['ok']) : 0; //Verificamos que nos hayan proporcionado una categoría para eliminar if (!is_array($ids) && $ids <= 0) { redirectMsg('./categories.php', __('No categories selected!', 'match'), 1); die; } if (!is_array($ids)) { $catego = new MCHCategory($ids); $ids = array($ids); } if (!$xoopsSecurity->check()) { redirectMsg('./categories.php', __('Session token expired!', 'match'), 1); die; } $db = XoopsDatabaseFactory::getDatabaseConnection(); $errors = ''; foreach ($ids as $k) { //Verificamos si la categoría es válida if ($k <= 0) { $errors .= sprintf(__('Category id "%s" is not valid!', 'match'), $k); continue; } //Verificamos si la categoría existe $cat = new MCHCategory($k); if ($cat->isNew()) { $errors .= sprintf(__('Category "%s" does not exists!', 'match'), $k); continue; } RMEvents::get()->run_event('match.delete.category', $cat); if (!$cat->delete()) { $errors .= sprintf(__('Category "%s" could not be deleted!', 'match'), $k); } else { $sql = "UPDATE " . $db->prefix('mch_categories') . " SET parent='" . $cat->getVar('parent') . "' WHERE parent='" . $cat->id() . "'"; $result = $db->queryF($sql); } } if ($errors != '') { redirectMsg('./categories.php', __('Errors ocurred while trying to delete categories', 'match') . '<br />' . $errors, 1); die; } else { redirectMsg('./categories.php', __('Database updated successfully!', 'match'), 0); die; } }
/** * @desc Activa/desactiva las categorías especificadas **/ function activeCategory($act = 0) { global $xoopsSecurity; $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : null; if (!$xoopsSecurity->check()) { redirectMsg('./categos.php', __('Session token expired!', 'works'), 1); die; } //Verificamos que nos hayan proporcionado una categoría if (!is_array($ids)) { redirectMsg('./categos.php', __('You must select a category to enable/disable', 'works'), 1); die; } $errors = ''; foreach ($ids as $k) { //Verificamos si la categoría es válida if ($k <= 0) { $errors .= sprintf(__('Category id "%s" is not valid!', 'works'), $k); continue; } //Verificamos si la categoría existe $cat = new PWCategory($k); if ($cat->isNew()) { $errors .= sprintf(__('Specified category "%s" does not exists!', 'works'), $k); continue; } $cat->setActive($act); RMEvents::get()->run_event('works.activate.category', $cat); if (!$cat->save()) { $errors .= sprintf(__('Category "%s" could not be saved!', 'works'), $k); } } if ($errors != '') { redirectMsg('./categos.php', __('Errors ocurred while trying to save category', 'works') . $errors, 1); die; } else { redirectMsg('./categos.php', __('Database updated successfully!', 'works'), 0); die; } }
function xt_save_settings() { global $xoopsConfig, $xtAssembler, $xtFunctions; if (!$xtAssembler->isSupported()) { redirectMsg('index.php', __('This is a not valid theme', 'xthemes'), 1); } $xt_to_save = array(); $theme = $xtAssembler->theme(); foreach ($_POST as $id => $v) { if (substr($id, 0, 5) != 'conf_') { continue; } $xt_to_save[substr($id, 5)] = $theme->checkSettingValue($v); } if (!$xtFunctions->insertOptions($theme, $xt_to_save)) { redirectMsg('settings.php', __('Settings could not be saved! Please try again', 'xthemes'), RMMSG_ERROR); } RMEvents::get()->run_event('xtheme.save.settings', $xt_to_save); redirectMsg('settings.php', __('Settings updated successfully!', 'xthemes'), RMMSG_SAVED); }
function module_disable_now($enable = 0) { global $xoopsSecurity, $xoopsConfig; $mod = rmc_server_var($_POST, 'module', ''); if (!$xoopsSecurity->check()) { redirectMsg('modules.php', __('Sorry, this operation could not be completed!', 'rmcommon'), 1); die; } $module_handler = xoops_gethandler('module'); if (!($module = $module_handler->getByDirname($mod))) { redirectMsg('modules.php', sprintf(__('Module %s is not installed yet!', 'rmcommon'), $mod), 1); die; } RMEvents::get()->run_event('rmcommon.disabling.module', $module); $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = "UPDATE " . $db->prefix("modules") . " SET isactive='{$enable}' WHERE dirname='{$mod}'"; if (!$db->queryF($sql)) { redirectMsg('modules.php', sprintf(__('Module %s could not be disabled!', 'rmcommon'), $mod), 1); die; } RMEvents::get()->run_event('rmcommon.module.disabled', $module); redirectMsg("modules.php", sprintf(__('Module %s successfully disabled!', 'rmcommon'), $module->name()), 0); }
function deleteCoachs() { global $db; $coachs = TCFunctions::request('coachs'); if (empty($coachs)) { redirectMsg('coachs.php', __('Selecciona al menos un entrenador', 'admin_template'), 1); die; } foreach ($coachs as $k) { $coach = new TCCoach($k); $coach->delete(); } redirectMsg('coachs.php', __('Base de datos actulizada correctamente', 'admin_template'), 0); }
// $Id$ // -------------------------------------------------------------- // Designia v1.0 // Theme for Common Utilities 2 // Author: Eduardo Cortés <*****@*****.**> // Email: i.bitcero@gmail.com // License: GPL 2.0 // -------------------------------------------------------------- global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $rmc_config; include XOOPS_ROOT_PATH . '/include/cp_header.php'; require_once XOOPS_ROOT_PATH . '/modules/rmcommon/admin_loader.php'; if (rmc_server_var($_POST, 'action', '') != '') { $settings = "<?php\n\nreturn array(\n'logo' => '" . rmc_server_var($_POST, 'logo_url', RMCURL . '/themes/designia/images/logo.png') . "',\n'scheme' => '" . rmc_server_var($_POST, 'scheme', 'colors') . "'\n);"; file_put_contents(XOOPS_CACHE_PATH . '/designia.php', $settings); redirectMsg(RMCURL, __('Settings saved successfully!', 'designia'), RMMSG_SUCCESS); die; } RMTemplate::get()->add_theme_style('settings.css', 'designia'); RMTemplate::get()->add_local_script('colorpicker.js', 'rmcommon', 'include'); RMTemplate::get()->add_style('colorpicker.css', 'rmcommon'); RMTemplate::get()->add_theme_script('settings.js', 'designia'); RMTemplate::get()->assign('xoops_pagetitle', __('Designia Options', 'designia')); $dConfig = (include XOOPS_CACHE_PATH . '/designia.php'); xoops_cp_header(); ?> <h1 class=rmc_titles><?php _e('Designia Theme Settings', 'designia'); ?> </h1>
/** * Sends a reply made from reply form */ function cm_send_reply() { global $xoopsSecurity, $xoopsModuleConfig, $xoopsConfig; $id = rmc_server_var($_POST, 'id', 0); $page = rmc_server_var($_POST, 'page', 1); if ($id <= 0) { redirectMsg('index.php?page=' . $page, __('You must specify a message ID', 'contact'), 1); die; } if (!$xoopsSecurity->check()) { redirectMsg('index.php?page=' . $page, __('Session token expired!', 'contact'), 1); die; } $msg = new CTMessage($id); if ($msg->isNew()) { redirectMsg('index.php?page=' . $page, __('Sorry, specified message does not exists!', 'contact'), 1); die; } $subject = rmc_server_var($_POST, 'subject', ''); $message = rmc_server_var($_POST, 'message', 1); if ($subject == '' || $message == '') { redirectMsg('index.php?action=reply&id=' . $id . '&page=' . $page, __('Please fill al required fields!', 'contact'), 1); die; } $xoopsMailer =& getMailer(); $xoopsMailer->useMail(); $xoopsMailer->setBody($message . '\\n--------------\\n' . __('Message sent with ContactMe!', 'contact') . '\\nFrom ' . $xoopsModuleConfig['url']); $xoopsMailer->setToEmails($msg->getVar('email')); $xoopsMailer->setFromEmail($xoopsConfig['from']); $xoopsMailer->setFromName($xoopsConfig['fromname']); $xoopsMailer->setSubject($subject); if (!$xoopsMailer->send(true)) { redirectMsg('index.php?action=reply&id=' . $id . '&page=' . $page, __('Message could not be delivered. Please try again.', 'contact') . '<br />' . $xoopsMailer->getErrors(), 1); die; } redirectMsg('index.php?page=' . $page, __('Message sent successfully!', 'contact'), 0); }
<?php require_once 'common/functions.php'; $id = (int) $_GET['id']; $tag = $_GET['tag']; $p = (int) $_GET['p']; $fav = (int) $_GET['fav']; if (!empty($fav) && !loggedIn()) { //only allow favorite search if user is logged in redirectMsg("./", 'Operação não permitida'); } $offset = $p * 12; if (!empty($id) && !empty($tag) || !empty($id) && !empty($fav) || !empty($tag) && !empty($fav)) { //tag AND id AND favorite? no sir redirect('./'); } if (isset($_SESSION['json_news'])) { unset($_SESSION['json_news']); } //unset array of news from obter_noticias.php (if no news have been added) require_once 'db/news_query.php'; ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Social News</title> <link rel="stylesheet" href="common/style.css"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script src="common/favorites.js"></script> <script src="common/search.js"></script>
function clonePage() { $id = rmc_server_var($_GET, 'id', 0); $page = new QPPage($id); if ($page->isNew()) { redirectMsg('pages.php', __('Specified page does not exists!', 'qpages'), 1); die; } $page->setNew(); $page->setTitle($page->getTitle() . ' [cloned]'); $page->setFriendTitle(TextCleaner::sweetstring($page->getTitle())); if (!$page->save()) { redirectMsg('pages.php', __('Page could not be cloned!', 'qpages'), 1); die; } redirectMsg('pages.php?op=edit&id=' . $page->getID(), __('Page cloned successfully!', 'qpages'), 0); }
/** * @desc Elimina pantallas de la base de datos **/ function deleteScreens() { global $xoopsModule, $util; $ids = isset($_REQUEST['id']) ? $_REQUEST['id'] : 0; $item = isset($_REQUEST['item']) ? intval($_REQUEST['item']) : 0; $ok = isset($_POST['ok']) ? intval($_POST['ok']) : 0; //Verificamos que el software sea válido if ($item <= 0) { redirectMsg('./screens.php', _AS_DT_ERR_ITEMVALID, 1); die; } //Verificamos que el software exista $sw = new DTSoftware($item); if ($sw->isNew()) { redirectMsg('./screens.php', _AS_DT_ERR_ITEMEXIST, 1); die; } //Verificamos si nos proporcionaron alguna pantalla if (!is_array($ids) && $ids <= 0) { redirectMsg('./screens.php?item=' . $item, _AS_DT_NOTSCREEN, 1); die; } $num = 0; if (!is_array($ids)) { $scr = new DTScreenshot($ids); $ids = array($ids); $num = 1; } if ($ok) { if (!$util->validateToken()) { redirectMsg('./screens.php?item=' . $item, _AS_DT_SESSINVALID, 1); die; } $errors = ''; foreach ($ids as $k) { //Verificamos si pantalla es válida if ($k <= 0) { $errors .= sprintf(_AS_DT_ERRSCVAL, $k); continue; } //Verificamos que la pantalla exista $sc = new DTScreenshot($k); if ($sc->isNew()) { $errors .= sprintf(_AS_DT_ERRSCEX, $k); continue; } if (!$sc->delete()) { $errors .= sprintf(_AS_DT_ERRSCDEL, $k); } } if ($errors != '') { redirectMsg('./screens.php?item=' . $item, _AS_DT_ERRORS . $errors, 1); die; } else { redirectMsg('./screens.php?item=' . $item, _AS_DT_DBOK, 0); die; } } else { optionsBar($sw); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » <a href='./items.php'>" . _AS_DT_SW . "</a> » " . _AS_DT_DELETESCREEN); xoops_cp_header(); $hiddens['ok'] = 1; $hiddens['id[]'] = $ids; $hiddens['item'] = $item; $hiddens['op'] = 'delete'; $buttons['sbt']['type'] = 'submit'; $buttons['sbt']['value'] = _DELETE; $buttons['cancel']['type'] = 'button'; $buttons['cancel']['value'] = _CANCEL; $buttons['cancel']['extra'] = 'onclick="window.location=\'screens.php?item=' . $item . '\';"'; $util->msgBox($hiddens, 'screens.php', ($num ? sprintf(_AS_DT_DELETECONF, $scr->title()) : _AS_DT_DELCONF) . '<br /><br />' . _AS_DT_ALLPERM, XOOPS_ALERT_ICON, $buttons, true, '400px'); xoops_cp_footer(); } }
/** * Deleting a category */ function m_delete_teams() { global $xoopsModule, $xoopsSecurity; $ids = rmc_server_var($_POST, 'ids', array()); //Verificamos que nos hayan proporcionado una categoría para eliminar if (empty($ids)) { redirectMsg('./teams.php', __('No teams selected!', 'match'), 1); die; } if (!$xoopsSecurity->check()) { redirectMsg('./teams.php', __('Session token expired!', 'match'), 1); die; } $db = XoopsDatabaseFactory::getDatabaseConnection(); $errors = ''; foreach ($ids as $k) { //Verificamos si la categoría es válida if ($k <= 0) { $errors .= sprintf(__('Team id "%s" is not valid!', 'match'), $k); continue; } //Verificamos si la categoría existe $team = new MCHTeam($k); if ($team->isNew()) { $errors .= sprintf(__('Team "%s" does not exists!', 'match'), $k); continue; } RMEvents::get()->run_event('match.delete.team', $cat); $file = MCH_UP_PATH . '/' . $team->getVar('logo'); if (!$team->delete()) { $errors .= sprintf(__('Team "%s" could not be deleted!', 'match'), $k); } else { if (is_file($file)) { unlink($file); } } } if ($errors != '') { redirectMsg('./teams.php', __('Errors ocurred while trying to delete teams', 'match') . '<br />' . $errors, 1); die; } else { redirectMsg('./teams.php', __('Database updated successfully!', 'match'), 0); die; } }
/** * @desc Elimina la información de una sección **/ function rd_delete_sections() { global $xoopsModule; $id = rmc_server_var($_GET, 'id', 0); $id_sec = rmc_server_var($_GET, 'sec', 0); // Check if a Document id has been provided if ($id <= 0) { redirectMsg('resources.php', __('You have not specify a Document id', 'docs'), 1); die; } $res = new RDResource($id); if ($res->isNew()) { redirectMsg('The specified Document does not exists!', 'docs'); die; } // Check if a section id has been provided if ($id_sec <= 0) { redirectMsg('./sections.php?id=' . $id, __('You have not specified a section ID to delete!', 'docs'), 1); die; } $sec = new RDSection($id_sec); if ($sec->isNew()) { redirectMsg('./sections.php?id=' . $id, __('Specified section does not exists!', 'docs'), 1); die; } if (!$sec->delete()) { redirectMsg('./sections.php?id=' . $id, __('Errors ocurred while trying to delete sections!', 'docs') . '<br />' . $sec->errors(), 1); die; } else { redirectMsg('./sections.php?id=' . $id, __('Sections deleted successfully!', 'docs'), 0); } }
function save_settings_rm_plugin() { global $xoopsSecurity; $name = rmc_server_var($_POST, 'plugin', ''); if ($name == '') { redirectMsg('plugins.php', __('You must specify a existing plugin', 'rmcommon'), 1); die; } $plugin = new RMPlugin($name); if ($plugin->isNew()) { redirectMsg('plugins.php', __('Specified plugin is not installed yet!', 'rmcommon'), 1); die; } if (!$plugin->getVar('status')) { redirectMsg('plugins.php', __('Specified plugin is not active!', 'rmcommon'), 1); die; } if (!$xoopsSecurity->check()) { redirectMsg('plugins.php?action=configure&plugin=' . $name, __('Session token expired!', 'rmcommon'), 1); die; } $options = $plugin->options(); $db = Database::getInstance(); $confs = array(); foreach ($options as $k => $option) { if (!isset($_POST['conf_' . $k])) { continue; } $value = $_POST['conf_' . $k]; $option['value'] = is_array($value) ? serialize($value) : $value; $db->queryF("UPDATE " . $db->prefix("rmc_settings") . " SET value='{$option['value']}' WHERE element='{$name}' AND type='plugin' AND name='{$k}'"); } redirectMsg('plugins.php', __('Settings updated!', 'rmcommon'), 0); }
/** * Delete a set of selected widgets */ function delete_widgets() { global $exmSecurity; if (!$exmSecurity->check() || !$exmSecurity->checkReferer()) { redirectMsg('widgets.php', __('You are not allowed to do this action!', 'system'), 1); die; } $ids = exm_server_var($_POST, 'widget', array()); if (empty($ids) || !is_array($ids)) { redirectMsg('widgets.php', __('You must select at least one widget!', 'system'), 1); die; } $error = ''; foreach ($ids as $id) { $widget = new EXMWidget($id); // API: Before delete a widget $widget = EXMEventsApi::get()->run_event('exm_event_deleting_widget', $widget); if (!$widget->delete()) { $error .= $widget->errors(); } } if ($errors != '') { redirectMsg('widgets.php', __('There was some errors:', 'system') . $error, 1); } else { redirectMsg('widgets.php', __('Database updated successfully', 'global'), 0); } }
/** * @desc Bloquea/Desbloquea un usuario **/ function blockUsers() { global $util, $xoopsModule; $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0; $page = isset($_REQUEST['pag']) ? $_REQUEST['pag'] : ''; $search = isset($_REQUEST['search']) ? $_REQUEST['search'] : ''; $ruta = "pag={$page}&search={$search}"; //Verificamos si nos proporcionaron al menos un usuario para bloquear/desbloquear if (!is_array($ids)) { redirectMsg('./users.php?' . $ruta, __('Select at least one user to update', 'galleries'), 1); die; } $errors = ''; foreach ($ids as $k) { //Verificamos si el usuario es válido if ($k <= 0) { $errors .= sprintf(__('ID "%s" is not valid', 'galleries'), $k); continue; } //Verificamos si el usuario existe $user = new GSUser($k); if ($user->isNew()) { $errors .= sprintf(__('User with id "%s" does not exists!', 'galleries'), $k); continue; } $user->setBlocked(!$user->blocked()); if (!$user->save()) { $errors .= sprintf(__('User with id "%s" could not be updated!'), $k); } } if ($erros != '') { redirectMsg('./users.php?' . $ruta, __('Errors ocurred while trying to update users', 'galleries') . '<br />' . $errors, 1); die; } else { redirectMsg('./users.php?' . $ruta, __('Users updated successfully!', 'galleries'), 0); die; } }
function rm_change_theme() { global $xoopsModule; $theme = rmc_server_var($_GET, 'theme', ''); if (is_file(RMCPATH . '/themes/' . $theme . '/admin-gui.php')) { $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = "UPDATE " . $db->prefix("config") . " SET conf_value='{$theme}' WHERE conf_name='theme' AND conf_modid='" . $xoopsModule->mid() . "'"; if ($db->queryF($sql)) { redirectMsg('index.php', __('Theme changed successfully!', 'rmcommon'), 0); die; } else { redirectMsg('index.php', __('Theme could not be changed!', 'rmcommon') . '<br />' . $db->error(), 0); die; } } redirectMsg('index.php', __('Specified theme does not exist!', 'rmcommon'), 1); die; }
function delete_editors() { global $xoopsSecurity; $page = rmc_server_var($_POST, 'page', 1); $editors = rmc_server_var($_POST, 'editors', array()); if (!$xoopsSecurity->check()) { redirectMsg('editors.php?page=' . $page, __('Sorry, operation not allowed!', 'mywords'), 1); die; } if (!is_array($editors) || empty($editors)) { redirectMsg('editors.php?page=' . $page, __('Please, specify a valid editor ID!', 'mywords'), 1); die; } // Delete all relations $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = "UPDATE " . $db->prefix("mw_posts") . " SET author='0' WHERE author IN(" . implode(',', $editors) . ")"; if (!$db->queryF($sql)) { redirectMsg('editors.php?page=' . $page, __('Errors ocurred while trying to delete editors!', 'mywords') . '<br />' . $db->error(), 1); die; } $sql = "DELETE FROM " . $db->prefix("mw_editors") . " WHERE id_editor IN(" . implode(",", $editors) . ")"; if (!$db->queryF($sql)) { redirectMsg('editors.php?page=' . $page, __('Errors ocurred while trying to delete editors!', 'mywords') . '<br />' . $db->error(), 1); die; } redirectMsg('editors.php?page=' . $page, __('Database updated succesfully!', 'mywords'), 0); }
$stmt = $db->prepare('INSERT INTO news values(null, ?, ?, ?, ?, ?, ?)'); if ($stmt->execute(array(strip_tags($json_news[$serveri][$i]->{'title'}), strtotime($json_news[$serveri][$i]->{'date'}), strip_tags($json_news[$serveri][$i]->{'text'}), strip_tags($json_news[$serveri][$i]->{'posted_by'}), strip_tags($json_news[$serveri][$i]->{'url'}), strip_tags($_SESSION['username'])))) { $news_id = $db->lastInsertID(); if (!empty($json_news[$serveri][$i]->{'tags'})) { $sql = "INSERT INTO 'tag'\n\t\t\t\t\t\t\t\t\tSELECT '" . $news_id . "' as 'news_id', '" . strip_tags($json_news[$serveri][$i]->{'tags'}[0]) . "' as 'tag' "; foreach ($json_news[$serveri][$i]->{'tags'} as $j => $tag) { if ($j < 1) { continue; } //skip first tag $sql .= sprintf("UNION SELECT '%d', '%s' ", $news_id, strip_tags($json_news[$serveri][$i]->{'tags'}[$j])); } if (!$db->query($sql)) { $error = $db->errorInfo(); if ($error[1] != 19) { echo "Erro: " . $error[2]; exit; } } } } else { $error = $db->errorInfo(); echo "Erro: " . $error[2]; } } } redirectMsg("./", 'Operação efectuada'); } else { redirectMsg("./", 'Erro a obter o JSON'); } }
/** * @desc Elimina Reportes **/ function deleteReports() { global $xoopsModule, $xoopsUser, $xoopsSecurity; $ids = rmc_server_var($_POST, 'ids', array()); $show = rmc_server_var($_POST, 'show', array()); //Verificamos si los reportes son válidos if (empty($ids)) { redirectMsg('reports.php?show=' . $show, __('Select at least one report!', 'bxpress'), 1); die; } if (!$xoopsSecurity->check()) { redirectMsg('reports.php?show=' . $show, __('Session token expired!', 'bxpress'), 1); die; } $errors = ''; foreach ($ids as $id) { //Verificamos si el reporte es válido if ($id <= 0) { $errors .= sprintf(__('ID %s is not valid!', 'bxpress'), $id); continue; } $report = new bXReport($id); //Comprobamos si el reporte existe if ($report->isNew()) { $errors .= sprintf(__('Report with ID %s does not exists!', 'bxpress'), $id); continue; } if (!$report->delete()) { $errors .= sprintf(__('Report %s could dot be deleted!', 'bxpress'), $id); } } if ($errors != '') { redirectMsg('reports.php?show=' . $show, __('Errors ocurred while trying to delete selected reports.', 'bxpress') . "<br />" . $errors, 1); } else { redirectMsg('./reports.php?show=' . $show, __('Reports deleted successfully!', 'bxpress'), 0); } }
/** * @desc Elimina un sitio de la base de datos */ function delete_bookmark() { global $xoopsSecurity; $books = rmc_server_var($_POST, 'books', array()); if (!$xoopsSecurity->check()) { redirectMsg('bookmarks.php', __('Sorry, operation not allowed!', 'mywords'), 1); die; } if (!is_array($books) || empty($books)) { redirectMsg('bookmarks.php', __('Please, specify a valid site ID!', 'mywords'), 1); die; } $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = "DELETE FROM " . $db->prefix("mod_mywords_bookmarks") . " WHERE id_book IN (" . implode(',', $books) . ")"; if ($db->queryF($sql)) { redirectMsg('bookmarks.php', __('Database updated successfully!', 'mywords'), 0); } else { redirectMsg('bookmarks.php', __('Errors ocurred while trying to update database!', 'mywords') . '<br />' . $db->error(), 0); } }
/** * This function deletes all image formats, except thumbnails, for specified albums. * This is useful when you need to regenerate images */ function delete_formats() { global $xoopsModuleConfig; $id = rmc_server_var($_GET, 'id', 0); $page = rmc_server_var($_GET, 'page', 1); if ($id <= 0) { redirectMsg("sets.php?page={$page}", __('Sorry, this is not a valid album!', 'galleries'), 1); die; } $set = new GSSet($id); if ($set->isNew()) { redirectMsg("sets.php?page={$page}", __('Specified Album does not exists!', 'galleries'), 1); die; } $db = Database::getInstance(); $t1 = $db->prefix("gs_images"); $t2 = $db->prefix("gs_setsimages"); $sql = "SELECT a.image FROM {$t1} a, {$t2} b WHERE b.id_set={$id} AND a.id_image=b.id_image"; $result = $db->query($sql); $dir = rtrim($xoopsModuleConfig['storedir'], '/'); if ($set->uname() == '') { $user = new XoopsUser($set->owner()); $uname = $user->uname(); } else { $uname = $set->uname(); } if ($uname == '') { redirectMsg('sets.php?page=' . $page, __('Sorry, we were unable to find the album owner!', 'galleries'), 1); break; } $dir .= '/' . $uname . '/formats'; if (!is_dir($dir)) { redirectMsg('sets.php?page=' . $page, __('There are not image formats for this album.', 'galleries'), 0); die; } while (list($image) = $db->fetchRow($result)) { @unlink($dir . '/bigset_' . $image); @unlink($dir . '/set_' . $image); @unlink($dir . '/user_' . $image); @unlink($dir . '/srh_' . $image); } $pics = $set->getPics(); $sql = "UPDATE {$t1} SET user_format=0, set_format=0, bigset_format=0, search_format=0 WHERE id_image IN (" . implode(",", $pics) . ")"; $db->queryF($sql); redirectMsg('sets.php?page=' . $page, __('Image formats deleted!', 'galleries'), 0); }
if ($stmt) { // Register session data $_SESSION['username'] = $username; $_SESSION['user_type'] = 0; $_SESSION['user_id'] = $db->lastInsertID(); redirectMsg('./', 'Utilizador registado e login efectuado'); } } else { $stmt = $db->query('SELECT id, count(*) as count, username, user_type FROM user where username="******" and password="******"'); if ($stmt) { $result = $stmt->fetch(); if ($result['count'] > 0) { // Register session data $_SESSION['username'] = $result['username']; $_SESSION['user_type'] = $result['user_type']; $_SESSION['user_id'] = $result['id']; //redirectmsg("./", 1); annoying redirect("./"); } else { redirectMsg($_SERVER['PHP_SELF'], 'Dados de login errados'); } } } if (!$stmt) { $error = $db->errorInfo(); if ($error[1] == 19) { redirectMsg($_SERVER['PHP_SELF'], 'Utilizador já registado'); } echo "Erro: " . $error[2]; } }
function set_posts_status($status) { global $xoopsSecurity; $posts = rmc_server_var($_POST, 'posts', array()); $limit = rmc_server_var($_POST, 'limit', 15); $keyw = rmc_server_var($_POST, 'keyw', ''); $page = rmc_server_var($_POST, 'page', 1); $q = "limit={$limit}&keyw={$keyw}&page={$page}"; if (empty($posts)) { redirectMsg('posts.php?' . $q, __('Select one post at least!', 'mywords'), 1); die; } if (!$xoopsSecurity->check()) { redirectMsg('posts.php?' . $q, __('Session token expired!', 'mywords'), 1); die; } $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = "UPDATE " . $db->prefix("mod_mywords_posts") . " SET status='{$status}' WHERE id_post IN (" . implode(",", $posts) . ")"; if (!$db->queryF($sql)) { redirectMsg('posts.php?' . $q, __('Posts could not be updated!', 'mw_categories'), 1); die; } redirectMsg('posts.php?' . $q, __('Posts updated successfully!', 'mywords'), 0); }
function delete_positions() { global $xoopsSecurity; if (!$xoopsSecurity->check()) { redirectMsg('blocks.php?from=positions', __('You are not allowed to do this action!', 'rmcommon'), 1); die; } $ids = rmc_server_var($_POST, 'ids', array()); if (empty($ids) || !is_array($ids)) { redirectMsg('blocks.php?from=positions', __('You must select at least one position!', 'rmcommon'), 1); die; } $errors = ''; foreach ($ids as $id) { $pos = new RMBlockPosition($id); $pos = RMEvents::get()->run_event('rmcommon.deleting.block.position', $pos); if (!$pos->delete()) { $errors .= $pos->errors(); } } if ($errors != '') { redirectMsg('blocks.php?from=positions', __('There was some errors:', 'rmcommon') . '<br />' . $error, 1); } else { redirectMsg('blocks.php?from=positions', __('Database updated successfully', 'rmcommon'), 0); } }