Exemplo n.º 1
0
 public function index()
 {
     \Ip\Internal\Content\Service::setManagementMode(1);
     return new \Ip\Response\Redirect(ipHomeUrl());
 }
Exemplo n.º 2
0
/**
 * Get management state
 *
 * Checks if the website is opened in management mode.
 * @return bool Returns true if the website is opened in management state.
 */
function ipIsManagementState()
{
    return \Ip\Internal\Content\Service::isManagementMode();
}
Exemplo n.º 3
0
 public function passwordReset()
 {
     if (\Ip\Internal\Admin\Backend::userId()) {
         //user has already been logged in
         \Ip\Internal\Content\Service::setManagementMode(1);
         return new \Ip\Response\Redirect(ipHomeUrl());
     }
     $content = ipView('view/passwordReset2.php', array('passwordResetForm' => FormHelper::getPasswordResetForm2()));
     ipAddJs('Ip/Internal/Admin/assets/passwordReset2.js');
     $response = ipResponse();
     $response->setLayout('Ip/Internal/Admin/view/loginLayout.php');
     $response->setLayoutVariable('content', $content);
     ipAddJs('assets/languageSelect.js');
     $response->setLayoutVariable('languageSelectForm', FormHelper::getLanguageSelectForm());
     return $response;
 }
Exemplo n.º 4
0
 /**
  *
  * Delete all not published revisions that are older than X days.
  * @param int $days
  */
 public static function removeOldRevisions($days)
 {
     //
     // 1) Dynamic Widgets (including revisions)
     // Dynamic widgets have an associated revision.
     // That revision's creation time and publication
     // state indicates if a widget should be removed
     // or not from corresponding db table 'ip_widget'.
     //
     $table = ipTable('revision');
     $sql = "\n            SELECT `revisionId` FROM {$table}\n            WHERE (" . ipDb()->sqlMinAge('createdAt', $days * 24, 'HOUR') . ") AND `isPublished` = 0\n        ";
     $revisionList = ipDb()->fetchColumn($sql);
     foreach ($revisionList as $revisionId) {
         \Ip\Internal\Content\Service::removeRevision($revisionId);
     }
     //
     // 2) Static Widgets (from static blocks only!)
     // Static widgets are presisted with revisionId=0.
     // Therefore, we've to make the time check on widget's
     // 'createdAt' column combined with 'isDeleted=1' flag
     // and 'revisionId=0' indicating widget's removal state.
     //
     $table = ipTable('widget');
     $sql = $sql = "\n            SELECT `id` FROM {$table}\n            WHERE (" . ipDb()->sqlMinAge('createdAt', $days * 24, 'HOUR') . ") \n            AND `revisionId` = 0 AND `isDeleted` = 1 AND `deletedAt` IS NOT NULL\n        ";
     $staticWidgetList = ipDb()->fetchColumn($sql);
     foreach ($staticWidgetList as $staticWidgetId) {
         \Ip\Internal\Content\Service::removeWidget($staticWidgetId);
     }
 }