Esempio n. 1
0
 function check()
 {
     $this->checkOpenOffice();
     $this->checkLucene();
     $this->checkDF();
     KTUtil::setSystemSetting('externalResourceIssues', serialize($this->resources));
 }
Esempio n. 2
0
 /**
  * Possibly we can optimise indexes. This method must be overriden.
  * The new function must call the parent!
  *
  */
 public function optimise()
 {
     KTUtil::setSystemSetting('luceneOptimisationDate', time());
 }
 function do_resetPassword()
 {
     $email = $_REQUEST['email'];
     $user = $_REQUEST['username'];
     $password = $_REQUEST['password'];
     $confirm = $_REQUEST['confirm'];
     if (!($password == $confirm)) {
         return _kt('The passwords do not match, please re-enter them.');
     }
     $password = md5($password);
     // Get user from db
     $sQuery = 'SELECT id FROM users WHERE username = ? AND email = ?';
     $aParams = array($user, $email);
     $id = DBUtil::getOneResultKey(array($sQuery, $aParams), 'id');
     if (!is_numeric($id) || $id < 1) {
         //PEAR::isError($res) || is_null($res)){
         return _kt('Please check that you have entered a valid username and email address.');
     }
     // Check expiry
     $expiry = KTUtil::getSystemSetting('password_reset_expire-' . $id);
     if ($expiry < time()) {
         return _kt('The password reset key has expired, please send a new request.');
     }
     // Update password
     $res = DBUtil::autoUpdate('users', array('password' => $password), $id);
     if (PEAR::isError($res) || is_null($res)) {
         return _kt('Your password could not be reset, please try again.');
     }
     // Unset expiry date and key
     KTUtil::setSystemSetting('password_reset_expire-' . $id, '');
     KTUtil::setSystemSetting('password_reset_key-' . $id, '');
     // Email confirmation
     $url = KTUtil::addQueryStringSelf('');
     $subject = APP_NAME . ': ' . _kt('password successfully reset');
     $body = '<dd><p>';
     $body .= _kt('Your password has been successfully reset, click the link below to login.');
     $body .= "</p><p><a href = '{$url}'>" . _kt('Login') . '</a></p></dd>';
     $oEmail = new Email();
     $res = $oEmail->send($email, $subject, $body);
     if ($res === true) {
         return _kt('Your password has been successfully reset.');
     }
     return _kt('An error occurred while sending the email, please try again or contact the System Administrator.');
 }
Esempio n. 4
0
 public static function getKTUsageStats($update = true)
 {
     $usage = array();
     $oRegistry =& KTPluginRegistry::getSingleton();
     $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin');
     $folders = self::getDirectories();
     foreach ($folders as $folder) {
         $directory = $folder['folder'];
         $pattern = $folder['pattern'];
         $canClean = $folder['canClean'];
         $name = $folder['name'];
         $temp = self::scanPath($directory, $pattern);
         $usage[] = array('description' => $name, 'folder' => $directory, 'files' => number_format($temp['files'], 0, '.', ','), 'filesize' => KTUtil::filesizeToString($temp['filesize']), 'action' => $i, 'canClean' => $canClean);
     }
     if ($update) {
         KTUtil::setSystemSetting('KTUsage', serialize($usage));
     }
     return $usage;
 }