public function _delete() { $id = abs((int) $_GET['id']); if (!$id) { return; } $subscriber = new EmailSubscriberEntity($id); $subscriber->deleteObject(); App::add('Email Subscriber with email "' . $subscriber->getEmail() . '" deleted'); Messages::sendMessage('Subscriber deleted'); back(); }
public function __construct() { // Check background services if (isset($_GET['cms_is_running_background']) && $_GET['cms_is_running_background'] == 1) { ServiceManager::checkNeeded(); exit; } // Try updating CMS if (isset($_GET['key']) && $_GET['key'] == Configuration::getInstance()->get('cms')['unique_key'] && count($_GET) === 2) { $updater = Updater::getInstance(); // Update files from repo $updater->updateSourceCode(isset($_GET['branch']) ? $_GET['branch'] : NULL); // Update composer only if required if (isset($_GET['composer'])) { $updater->updateComposerVendors(); } // Update database $updater->runMigrations(); // Run PHPUnit tests $updater->runTests(); // Output $out = $updater->getResult(); $text = json_encode($out, JSON_FORCE_OBJECT); echo $text; if (stripos($text, 'Code Coverage Report') === false) { Mailer::getInstance()->setMessage('Did not find "Code Coverage Report" in updater response:<br><br>' . $text)->setRecipient(CMS_SUPPORT_EMAIL)->setSender(Settings::getCommonEmail(), Configuration::getInstance()->get('site')['name'] . ' - AutoUpdater')->setSubject('Error found during update')->send(); } exit; } // Else - running usual Admin panel // Proceed with request $this->parseUrl(); // Save log if (Users::getInstance()->isLogged() && Settings::get('save_back_access_log') && !IS_AJAX_REQUEST) { $users_log = new UserLog(); $users_log->save(); } // Init page data if (Users::getInstance()->isLogged()) { define('LNG', Users::getInstance()->getUserLng()); } $this->sendHeaders(); $this->prepareHead(); $this->parseMenu(); // Post-scripts Page::setTail(PageTail::getInstance()); // Flush application log App::flushLog(); $this->generateContent(); }
public function _tags_delete() { $tag = new ArticleTagEntity($_GET['id']); $tag->deleteObject(); Messages::sendGreenAlert('Tag deleted'); App::add('Tag ' . $tag->getTitle() . ' deleted'); if (IS_AJAX_REQUEST) { die('1'); } go('?p=' . P . '&do=tags'); }
/** * Action for Edit contents */ public function _edit_content() { $dir =& $_GET['path']; if (isset($dir[0]) && $dir[0] == '/') { $dir = substr($dir, 1); } if (!is_file(DIR_BASE . $dir)) { error('Not a file'); } file_put_contents(DIR_BASE . $dir, $_POST['content']); App::add('Content of file "' . $_POST['name'] . '" edited'); Messages::sendGreenAlert('Content of file "' . $_POST['name'] . '" edited'); $path_to_dir = explode('/', $dir); array_pop($path_to_dir); go('?p=' . P . '&do=show_files&nomenu&path=' . implode('/', $path_to_dir) . '/'); }
<?php defined('INC') or exit; use TMCms\Admin\Users; use TMCms\Log\App; Users::getInstance()->deleteSession($_SESSION['admin_id']); App::add('User "' . $_SESSION['admin_login'] . '" logged out'); $_SESSION['admin_logged'] = false; $_SESSION['admin_id'] = false; $_SESSION['admin_login'] = false; $_SESSION['admin_super'] = false; $_SESSION['admin_sid'] = false; go(DIR_CMS_URL);
public static function _categories_delete() { if (!isset($_GET['id']) || !ctype_digit((string) $_GET['id'])) { return; } $id = $_GET['id']; $category = new FaqCategoryEntity($id); $category->deleteObject(); App::add('Category ' . $category->getTitle() . ' deleted'); Messages::sendMessage('Category deleted'); back(); }
/** * After that user is logged-in * @param AdminUser $user * @return string session id */ public function setUserLoggedIn($user) { $_SESSION['admin_logged'] = true; $_SESSION['admin_id'] = $user->getId(); $_SESSION['admin_login'] = $user->getLogin(); $_SESSION['admin_sid'] = Users::getInstance()->startSession($user->getId()); if (!defined('USER_ID')) { define('USER_ID', $user->getId()); } App::add('User "' . $user->getLogin() . '" logged in.'); }
<?php defined('INC') or exit; use TMCms\Admin\Messages; use TMCms\Cache\Cacher; use TMCms\Config\Configuration; use TMCms\Log\App; use TMCms\Network\Mailer; Mailer::getInstance()->setSubject('Message from ' . Configuration::getInstance()->get('site')['name'] . ' (' . CFG_DOMAIN . ')')->setSender(Configuration::getInstance()->get('site')['email'], Configuration::getInstance()->get('site')['name'])->setRecipient(CMS_SUPPORT_EMAIL, CMS_NAME)->setMessage($_POST['message'])->send(); Cacher::getInstance()->getDefaultCacher()->set('cms_home_support_email', NOW); App::add('Message sent to developers'); Messages::sendGreenAlert('Message sent to developers'); back();
public function _delete() { $id = abs((int) $_GET['id']); if (!$id) { return; } $entity = $this->getRealEntityInUse($id); $name = $this->getRealEntityName($entity); $entity->deleteObject(); App::add($name . ' deleted'); Messages::sendGreenAlert($name . ' deleted'); back(); }
public function _delete() { $id = abs((int) $_GET['id']); if (!$id) { return; } $review = new ReviewEntity($id); $review->deleteObject(); App::add('Review "' . $review->getTitle() . '" deleted'); Messages::sendMessage('Review deleted'); back(); }
<?php defined('INC') or exit; use TMCms\Admin\Messages; use TMCms\Admin\Users\Entity\AdminUser; use TMCms\Log\App; $user = new AdminUser(USER_ID); $user->loadDataFromArray($_POST); $user->save(); App::add('Notes updated'); Messages::sendGreenAlert('Notes updated'); back();
public function _setting_options_delete() { $id = abs((int) $_GET['id']); if (!$id) { return; } $option = new CustomSettingOption($id); $option->deleteObject(); App::add('Custom Setting Option "' . $option->getOptionName() . '" deleted'); Messages::sendMessage('Setting Option deleted'); back(); }