コード例 #1
0
 public function on_success($time = '')
 {
     if (!$time) {
         $time = time();
     }
     set_site_preference(self::LASTEXECUTE_SITEPREF, $time);
 }
コード例 #2
0
 public function on_success($time = '')
 {
     if (!$time) {
         $time = time();
     }
     // clear any previous notifications
     set_site_preference(self::PREFNAME, '');
     // save the notifications
     if (count($this->_notifications)) {
         set_site_preference(self::PREFNAME, serialize($this->_notifications));
     }
 }
コード例 #3
0
 function preContent(&$db)
 {
     $test = new StdClass();
     $test->error = false;
     $test->messages = array();
     $db->SetFetchMode(ADODB_FETCH_ASSOC);
     $current_version = 1;
     $query = "SELECT version from " . cms_db_prefix() . "version";
     $dbresult = $db->Execute($query);
     if (!$dbresult) {
         $test->messages[] = ilang('invalid_query', $query);
         $test->error = true;
     } else {
         while ($row = $dbresult->FetchRow()) {
             $current_version = $row["version"];
         }
         if ($current_version == 1) {
             $test->messages[] = ilang('empty_query', $query);
             $test->error = true;
         }
     }
     if (!$test->error && $current_version < CMS_SCHEMA_VERSION) {
         $test->messages[] = ilang('need_upgrade_schema', $current_version, CMS_SCHEMA_VERSION);
         while ($current_version < CMS_SCHEMA_VERSION) {
             $filename = cms_join_path(CMS_INSTALL_BASE, 'upgrades', "upgrade.{$current_version}.to." . ($current_version + 1) . '.php');
             if (file_exists($filename)) {
                 if ($this->debug) {
                     include $filename;
                 } else {
                     @(include $filename);
                 }
             } else {
                 $test->messages[] = ilang('nofiles') . ": {$filename}";
             }
             $current_version++;
         }
         $test->messages[] = ilang('schema_ok', $current_version);
     } elseif (!$test->error) {
         $test->messages[] = ilang('noneed_upgrade_schema', CMS_SCHEMA_VERSION);
     }
     if (isset($_SESSION['disable_hierarchy'])) {
         // gotta move the hierarchy stuff
         $query = 'UPDATE ' . cms_db_prefix() . 'content SET page_url = content_alias';
         $db->Execute($query);
         set_site_preference('content_autocreate_urls', 1);
         set_site_preference('content_autocreate_flaturls', 1);
         $test->messages[] = ilang('setup_flat_urls');
         unset($_SESSION['disable_hierarchy']);
     }
     $this->smarty->assign('test', $test);
 }
コード例 #4
0
ファイル: listcontent.php プロジェクト: RTR-ITF/usse-cms
function content_move($contentid, $parentid, $direction)
{
    $objResponse = new xajaxResponse();
    $time = time();
    $tmp = get_site_preference('__listcontent_timelock__', 0);
    if (time() - $tmp < 3) {
        return $objResponse;
        // delay between requests
    }
    set_site_preference('__listcontent_timelock__', $time);
    movecontent($contentid, $parentid, $direction);
    $objResponse->assign("contentlist", "innerHTML", display_content_list());
    $objResponse->script("\$('#tr_{$contentid}').effect('highlight', [], 3000);");
    // reset lock
    return $objResponse;
}
コード例 #5
0
ファイル: pagedefaults.php プロジェクト: rasomu/chuza
    $page_extra2 = $_POST['page_extra2'];
    $page_extra3 = $_POST['page_extra3'];
    //
    // Store preferences
    //
    set_site_preference('page_secure', $page_secure);
    set_site_preference('page_active', $page_active);
    set_site_preference('page_showinmenu', $page_showinmenu);
    set_site_preference('page_cachable', $page_cachable);
    set_site_preference('page_metadata', $page_metadata);
    set_site_preference('defaultpagecontent', $page_defaultcontent);
    set_site_preference('additional_editors', $additional_editors);
    set_site_preference('page_searchable', $page_searchable);
    set_site_preference('page_extra1', $page_extra1);
    set_site_preference('page_extra2', $page_extra2);
    set_site_preference('page_extra3', $page_extra3);
    $message = lang('prefsupdated');
}
//
// Display Page Output
//
include_once "header.php";
if ($error != "") {
    echo "<div class=\"pageerrorcontainer\"><ul class=\"error\">" . $error . "</ul></div>";
}
if ($message != "") {
    echo $themeObject->ShowMessage($message);
}
?>

<div class="pagecontainer">
コード例 #6
0
 function preContent(&$db)
 {
     // check if db info is correct as it should at this point to prevent an undeleted installation dir
     // to be used for sending spam by messing up $_POST variables
     $db = ADONewConnection($_POST['dbms'], 'pear:date:extend:transaction');
     if (!empty($_POST['db_port'])) {
         $db->port = $_POST['db_port'];
     }
     if (!$db->Connect($_POST['host'], $_POST['username'], $_POST['password'], $_POST['database'])) {
         $this->errors[] = ilang('could_not_connect_db');
         return;
     }
     $newconfig = cmsms()->GetConfig();
     $newconfig['dbms'] = trim($_POST['dbms']);
     $newconfig['db_hostname'] = trim($_POST['host']);
     $newconfig['db_username'] = trim($_POST['username']);
     $newconfig['db_password'] = trim($_POST['password']);
     $newconfig['db_name'] = trim($_POST['database']);
     $newconfig['db_prefix'] = trim($_POST['prefix']);
     $newconfig['db_port'] = (int) $_POST['db_port'];
     $newconfig['root_url'] = rtrim(trim($_POST['docroot']), '/');
     $tmp = trim($_POST['querystr']);
     if ($tmp != 'page') {
         $newconfig['query_var'] = $_POST['querystr'];
     }
     $newconfig['timezone'] = $_POST['timezone'];
     $newconfig['default_encoding'] = $_POST['default_encoding'];
     $newconfig->save();
     if (file_exists(cms_join_path(TMP_CACHE_LOCATION, 'SITEDOWN'))) {
         if (!unlink(cms_join_path(TMP_CACHE_LOCATION, 'SITEDOWN'))) {
             echo ilang('install_admin_sitedown');
         }
     }
     #Make sure $gCms->db is set
     #Do module installation
     if (isset($_POST["createtables"]) && $_POST['createtables'] != 0) {
         $gCms = cmsms();
         global $DONT_LOAD_DB;
         $DONT_LOAD_DB = 'force';
         $db = $gCms->GetDb();
         $db->SetFetchMode(ADODB_FETCH_ASSOC);
         echo '<p>' . ilang('install_admin_update_hierarchy');
         $contentops = cmsms()->GetContentOperations();
         $contentops->SetAllHierarchyPositions();
         echo " [" . ilang('done') . "]</p>";
         echo '<p>' . ilang('install_admin_set_core_event');
         Events::SetupCoreEvents();
         echo " [" . ilang('done') . "]</p>";
         echo '<p>' . ilang('install_admin_install_modules');
         $modops = $gCms->GetModuleOperations();
         $modops->LoadModules(TRUE);
         $allmodules = $modops->GetAllModuleNames();
         if (is_array($allmodules) && count($allmodules)) {
             foreach ($allmodules as $module_name) {
                 $obj = $modops->get_module_instance($module_name, '', TRUE);
             }
         }
         echo " [" . ilang('done') . "]</p>";
         echo '<p>' . ilang('install_admin_clear_cache');
         $contentops->ClearCache();
         echo " [" . ilang('done') . "]</p>";
         // Insert new site preferences
         set_site_preference('global_umask', $_POST['umask']);
         set_site_preference('frontendlang', $_POST['frontendlang']);
         set_preference(1, 'default_cms_language', $_POST['default_cms_lang']);
     } else {
         $this->smarty->assign('tables_notinstalled', 1);
     }
     $link = str_replace(" ", "%20", $_POST['docroot']);
     if ($_POST['email_accountinfo'] == 1 && !empty($_POST['adminemail'])) {
         echo '<p>' . ilang('install_admin_emailing');
         $to = $_POST['adminemail'];
         $subject = ilang('email_accountinfo_subject');
         $message = ilang('email_accountinfo_message', $_POST['adminusername'], $_POST['adminpassword'], "{$link}/admin/");
         $message = html_entity_decode($message, ENT_QUOTES);
         // Encoded from TC
         echo @mail($to, $subject, $message) ? " [" . ilang('done') . "]" : "<strong>[" . ilang('failed') . "]</strong>";
         echo "</p>";
     }
 }
コード例 #7
0
ファイル: siteprefs.php プロジェクト: rasomu/chuza
                        set_site_preference('urlcheckversion', $urlcheckversion);
                        if (isset($_POST["clear_vc_cache"])) {
                            set_site_preference('lastcmsversioncheck', 0);
                        }
                        set_site_preference('clear_vc_cache', $clear_vc_cache);
                        set_site_preference('disablesafemodewarning', $disablesafemodewarning);
                        set_site_preference('allowparamcheckwarnings', $allowparamcheckwarnings);
                        set_site_preference('enablenotifications', $enablenotifications);
                        set_site_preference('basic_attributes', $basic_attributes);
                        if (isset($_POST['auto_clear_cache_age'])) {
                            $auto_clear_cache_age = (int) $_POST['auto_clear_cache_age'];
                            set_site_preference('auto_clear_cache_age', $auto_clear_cache_age);
                        }
                        if (isset($_POST['pseudocron_granularity'])) {
                            $pseudocron_granularity = (int) $_POST['pseudocron_granularity'];
                            set_site_preference('pseudocron_granularity', $pseudocron_granularity);
                        }
                        break;
                }
                audit(-1, '', 'Edited Site Preferences');
                $message .= lang('prefsupdated');
            } else {
                $error .= "<li>" . lang('noaccessto', array('Modify Site Permissions')) . "</li>";
            }
        }
    }
}
//
// build the form
//
$templates = array();
コード例 #8
0
 /**
  * The primary interface to the pseudo-cron methodoligy.
  *
  * This method checks to see if the last time that tasks were handled was
  * outside of its granularity window.  If it is, then the tasks are queried
  * and executed.
  *
  */
 public static function handle_tasks()
 {
     global $CMS_STYLESHEET;
     global $CMS_INSTALL_PAGE;
     global $CMS_LOGIN_PAGE;
     if (isset($CMS_STYLESHEET) && $CMS_STYLESHEET == 1 || isset($CMS_INSTALL_PAGE) || isset($CMS_LOGIN_PAGE)) {
         return;
     }
     $granularity = (int) get_site_preference('pseudocron_granularity', 60);
     $last_check = get_site_preference('pseudocron_lastrun', 0);
     if (time() - $granularity * 60 >= $last_check) {
         // 1.  Get Task objects.
         self::get_tasks();
         // 2.  Evaluate Tasks
         self::execute();
         // 3.  Cleanup to minimize memory usage
         self::cleanup();
         // 4.  Say we've done a check
         set_site_preference('pseudocron_lastrun', time());
     }
 }
コード例 #9
0
}
$db =& $this->GetDb();
$dict = NewDataDictionary($db);
$sqlarray = $dict->DropTableSQL(cms_db_prefix() . "module_AdvancedContent_blockdisplay");
$dict->ExecuteSQLArray($sqlarray);
$sqlarray = $dict->DropTableSQL(cms_db_prefix() . "module_AdvancedContent_messagedisplay");
$dict->ExecuteSQLArray($sqlarray);
$sqlarray = $dict->DropTableSQL(cms_db_prefix() . "module_AdvancedContent_groupdisplay");
$dict->ExecuteSQLArray($sqlarray);
$sqlarray = $dict->DropTableSQL(cms_db_prefix() . "module_AdvancedContent_multi_inputs");
$dict->ExecuteSQLArray($sqlarray);
$sqlarray = $dict->DropTableSQL(cms_db_prefix() . "module_AdvancedContent_multi_input_tpl_assocs");
$dict->ExecuteSQLArray($sqlarray);
# remove permissions
$this->RemovePermission('Manage AdvancedContent');
$this->RemovePermission('Manage AdvancedContent Preferences');
$this->RemovePermission('Manage All AdvancedContent Blocks');
$this->RemovePermission('Manage AdvancedContent Options');
$this->RemovePermission('Manage AdvancedContent MultiInputs');
$this->RemovePermission('Manage AdvancedContent MultiInput Templates');
$this->RemoveEventHandler('Core', 'ContentPostRender');
$this->RemoveEventHandler('Core', 'ContentEditPost');
$this->DeleteTemplate();
# remove preferences
$this->RemovePreference();
# restore default content type
$default_contenttype = get_site_preference('default_contenttype', 'content');
if ($default_contenttype == 'content2' || $default_contenttype == 'advanced_content') {
    set_site_preference('default_contenttype', 'content');
}
$this->Audit(0, $this->Lang('AdvancedContent'), $this->Lang('uninstalled', $this->GetVersion()));
コード例 #10
0
ファイル: header.php プロジェクト: rasomu/chuza
                         } else {
                             // the version is valid.
                             set_site_preference('cms_is_uptodate', 1);
                         }
                     }
                     // if
                 }
                 // if
             }
         }
         // if
         // update the last check time
         // to midnight of the current day
         // if( $goodtest )
         if (true) {
             set_site_preference('lastcmsversioncheck', strtotime("23:59:55"));
         }
     }
     if ($cms_is_uptodate == 0 || $do_getpref == 1 && get_site_preference('cms_is_uptodate', 1) == 0) {
         // it wasn't up-to-date last time either
         $themeObject->AddNotification(1, 'Core', lang('new_version_available'));
     }
     // Display a warning about mail settings.
     if (isset($gCms->modules['CMSMailer']) && isset($gCms->modules['CMSMailer']['object']) && isset($gCms->modules['CMSMailer']['installed']) && get_site_preference('mail_is_set', 0) == 0) {
         $urlCMSMailer = 'moduleinterface.php?' . CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY] . '&amp;module=CMSMailer';
         $themeObject->AddNotification(1, 'Core', lang('warning_mail_settings', $urlCMSMailer));
     }
 }
 // and display the dashboard.
 $themeObject->DisplayNotifications(3);
 // todo, a preference.
コード例 #11
0
 /**
  * Sets a module preference.
  *
  * @final
  * @param string The name of the preference to set
  * @param string The value to set it to
  * @return void
  */
 public final function SetPreference($preference_name, $value)
 {
     return set_site_preference($this->GetName() . "_mapi_pref_" . $preference_name, $value);
 }
コード例 #12
0
    //
    // Store preferences
    //
    set_site_preference('page_secure', $page_secure);
    set_site_preference('page_active', $page_active);
    set_site_preference('page_showinmenu', $page_showinmenu);
    set_site_preference('page_parent_use_name', $page_parent_use_name);
    set_site_preference('page_cachable', $page_cachable);
    set_site_preference('page_metadata', $page_metadata);
    set_site_preference('defaultpagecontent', $page_defaultcontent);
    set_site_preference('additional_editors', $additional_editors);
    set_site_preference('page_searchable', $page_searchable);
    set_site_preference('page_extra1', $page_extra1);
    set_site_preference('page_extra2', $page_extra2);
    set_site_preference('page_extra3', $page_extra3);
    set_site_preference('default_contenttype', $default_contenttype);
    $message = lang('prefsupdated');
}
//
// Display Page Output
//
include_once "header.php";
if ($error != "") {
    echo "<div class=\"pageerrorcontainer\"><ul class=\"error\">" . $error . "</ul></div>";
}
if ($message != "") {
    echo $themeObject->ShowMessage($message);
    // put mention into the admin log
    audit('', 'Page Defaults', 'Edited');
}
// give everything to smarty.
コード例 #13
0
                        }
                        if (isset($_POST['browser_cache_expiry'])) {
                            $browser_cache_expiry = (int) $_POST['browser_cache_expiry'];
                            set_site_preference('browser_cache_expiry', $browser_cache_expiry);
                        }
                        if (isset($_POST['auto_clear_cache_age'])) {
                            $auto_clear_cache_age = (int) $_POST['auto_clear_cache_age'];
                            set_site_preference('auto_clear_cache_age', $auto_clear_cache_age);
                        }
                        if (isset($_POST['pseudocron_granularity'])) {
                            $pseudocron_granularity = (int) $_POST['pseudocron_granularity'];
                            set_site_preference('pseudocron_granularity', $pseudocron_granularity);
                        }
                        if (isset($_POST["adminlog_lifetime"])) {
                            $adminlog_lifetime = $_POST["adminlog_lifetime"];
                            set_site_preference('adminlog_lifetime', $adminlog_lifetime);
                        }
                        break;
                }
                // put mention into the admin log
                audit(-1, 'Global Settings', 'Edited');
                $message .= lang('siteprefsupdated');
            } else {
                $error .= "<li>" . lang('noaccessto', array('Modify Site Permissions')) . "</li>";
            }
        }
    }
}
//
// build the form
//
コード例 #14
0
 /**
  * The primary interface to the pseudo-cron methodoligy.
  *
  * This method checks to see if the last time that tasks were handled was
  * outside of its granularity window.  If it is, then the tasks are queried
  * and executed.
  *
  */
 public static function handle_tasks()
 {
     $granularity = (int) get_site_preference('pseudocron_granularity', 60);
     $last_check = get_site_preference('pseudocron_lastrun', 0);
     if (time() - $granularity * 60 >= $last_check) {
         // 1.  Get Task objects.
         self::get_tasks();
         // 2.  Evaluate Tasks
         self::execute();
         // 3.  Cleanup to minimize memory usage
         self::cleanup();
         // 4.  Say we've done a check
         set_site_preference('pseudocron_lastrun', time());
     }
 }
コード例 #15
0
ファイル: adminlog.php プロジェクト: RTR-ITF/usse-cms
     $page = $_GET['page'];
 }
 $limit = 20;
 $page_string = "";
 $from = $page * $limit - $limit;
 if (isset($_POST["filterreset"])) {
     set_site_preference('adminlog_filteruser', '');
     //set_site_preference('adminlog_filtername','');
     set_site_preference('adminlog_filteraction', '');
 }
 if (isset($_POST["filterapply"])) {
     if (isset($_POST['filteruser'])) {
         set_site_preference('adminlog_filteruser', trim($_POST["filteruser"]));
     }
     if (isset($_POST['filteraction'])) {
         set_site_preference('adminlog_filteraction', trim($_POST["filteraction"]));
     }
 }
 $params = array();
 $criteria = "";
 $filterdisplay = "none";
 if (get_site_preference('adminlog_filteruser') != '') {
     $criteria .= "WHERE username=?";
     $params = array_merge($params, array(get_site_preference('adminlog_filteruser')));
     $filterdisplay = "block";
 }
 if (get_site_preference('adminlog_filteraction') != '') {
     if ($criteria != "") {
         $criteria .= " AND ";
     }
     $criteria .= "WHERE action LIKE ?";
コード例 #16
0
ファイル: siteprefs.php プロジェクト: RTR-ITF/usse-cms
                case 'smarty':
                    if (isset($_POST['use_smartycache'])) {
                        $use_smartycache = $_POST['use_smartycache'];
                        set_site_preference('use_smartycache', $use_smartycache);
                    }
                    if (isset($_POST['use_smartycompilecheck'])) {
                        $use_smartycompilecheck = $_POST['use_smartycompilecheck'];
                        set_site_preference('use_smartycompilecheck', $use_smartycompilecheck);
                    }
                    if (isset($_POST['smarty_cachemodules'])) {
                        $smarty_cachemodules = $_POST['smarty_cachemodules'];
                        set_site_preference('smarty_cachemodules', $smarty_cachemodules);
                    }
                    if (isset($_POST['smarty_cacheudt'])) {
                        $smarty_cacheudt = $_POST['smarty_cacheudt'];
                        set_site_preference('smarty_cacheudt', $smarty_cacheudt);
                    }
                    $gCms->clear_cached_files();
            }
            // put mention into the admin log
            audit(-1, 'Global Settings', 'Edited');
            $message .= lang('siteprefsupdated');
        } else {
            $error .= "<li>" . lang('noaccessto', array('Modify Site Permissions')) . "</li>";
        }
    }
}
/**
 * Build page
 */
include_once "header.php";
コード例 #17
0
ファイル: header.php プロジェクト: rainbow-studio/cmsms
        // Display a warning sitedownwarning
        $sitedown_message = lang('sitedownwarning', TMP_CACHE_LOCATION . '/SITEDOWN');
        $sitedown_file = TMP_CACHE_LOCATION . '/SITEDOWN';
        if (file_exists($sitedown_file)) {
            $themeObject->AddNotification(1, 'Core', $sitedown_message);
        }
        $timelastchecked = get_site_preference('lastcmsversioncheck', 0);
        if (get_site_preference('checkversion', 1) && time() - $timelastchecked > 24 * 60 * 60 || isset($_GET['forceversioncheck'])) {
            $req = new cms_http_request();
            $req->setTimeout(10);
            $req->execute(CMS_DEFAULT_VERSIONCHECK_URL);
            if ($req->getStatus() == 200) {
                $remote_ver = trim($req->getResult());
                if (strpos($remote_ver, ':') !== FALSE) {
                    list($tmp, $remote_ver) = explode(':', $remote_ver, 2);
                    $remote_ver = trim($remote_ver);
                }
                if (version_compare(CMS_VERSION, $remote_ver) < 0) {
                    set_site_preference('cms_is_uptodate', 0);
                    $themeObject->AddNotification(1, 'Core', lang('new_version_available'));
                    audit('', 'Core', 'CMSMS version ' . $remote_ver . ' is available');
                } else {
                    set_site_preference('cms_is_uptodate', 1);
                    audit('', 'Core', 'Tested for newer CMSMS Version. None Available.');
                }
            }
            set_site_preference('lastcmsversioncheck', mktime(23, 59, 55));
        }
    }
    $themeObject->do_header();
}
コード例 #18
0
ファイル: CMSMailer.module.php プロジェクト: rasomu/chuza
 function _SetAdminPrefs($id, &$params, $returnid)
 {
     if (!$this->CheckPermission('Modify Site Preferences')) {
         return;
     }
     set_site_preference('mail_is_set', 1);
     if (isset($params['input_mailer'])) {
         $this->SetPreference('mailer', $params['input_mailer']);
     }
     if (isset($params['input_host'])) {
         $this->SetPreference('host', $params['input_host']);
     }
     if (isset($params['input_secure'])) {
         $this->SetPreference('secure', $params['input_secure']);
     }
     if (isset($params['input_port'])) {
         $this->SetPreference('port', $params['input_port']);
     }
     if (isset($params['input_from'])) {
         $this->SetPreference('from', $params['input_from']);
     }
     if (isset($params['input_fromuser'])) {
         $this->SetPreference('fromuser', $params['input_fromuser']);
     }
     if (isset($params['input_sendmail'])) {
         $this->SetPreference('sendmail', $params['input_sendmail']);
     }
     if (isset($params['input_timeout'])) {
         $this->SetPreference('timeout', $params['input_timeout']);
     }
     if (isset($params['input_smtpauth'])) {
         $this->SetPreference('smtpauth', $params['input_smtpauth']);
     } else {
         $this->SetPreference('smtpauth', 0);
     }
     if (isset($params['input_username'])) {
         $this->SetPreference('username', $params['input_username']);
     }
     if (isset($params['input_password'])) {
         $this->SetPreference('password', $params['input_password']);
     }
     if (isset($params['input_charset'])) {
         $this->SetPreference('charset', trim($params['input_charset']));
     }
     $this->reset();
     if (isset($params['sendtest'])) {
         // here we're gonna send a nice, hard coded test message
         if (!isset($params['input_testaddress']) || trim($params['input_testaddress']) == '') {
             $this->_DisplayErrorPage($id, $params, $returnid, $this->Lang('error_notestaddress'));
             return;
         } else {
             $this->AddAddress($params['input_testaddress']);
             $this->SetBody($this->Lang('testbody'));
             $this->SetSubject($this->Lang('testsubject'));
             $this->Send();
             $this->reset();
             // yes, another reset
         }
     }
     $this->Redirect($id, 'defaultadmin', $returnid, $params);
 }