Example #1
0
 /**
  * Catch all logger for miscellaneous security records
  * @param bool $success
  * @param string $requestor
  * @param string $auth
  * @param string $txt
  */
 static function security_misc($success, $requestor, $auth, $txt)
 {
     security_logger::Logger((int) ($success && true), NULL, NULL, $requestor, 'zp_admin_auth', $txt);
     return $success;
 }
Example #2
0
/**
 * control when and how setup scripts are turned back into PHP files
 * @param int reason
 * 						 1	No prior install signature
 * 						 2	restore setup files button
 * 						 4	Clone request
 * 						 5	Setup run with proper XSRF token
 * 						 6	checkSignature and no prior signature
 * 						11	No config file
 * 						12	No database specified
 * 						13	No DB connection
 * 						14	checkInstall Version has changed
 */
function restoreSetupScrpts($reason)
{
    //log setup file restore no matter what!
    require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/security-logger.php';
    switch ($reason) {
        default:
            $addl = sprintf(gettext('to run setup [%s]'), $reason);
            break;
        case 2:
            $addl = gettext('by Admin request');
            break;
        case 4:
            $addl = gettext('by cloning');
            break;
    }
    $allowed = defined('ADMIN_RIGHTS') && zp_loggedin(ADMIN_RIGHTS) && zpFunctions::hasPrimaryScripts();
    security_logger::log_setup($allowed, 'restore', $addl);
    if ($allowed) {
        if (!defined('FILE_MOD')) {
            define('FILE_MOD', 0666);
        }
        chdir(dirname(__FILE__) . '/setup/');
        $found = safe_glob('*.xxx');
        foreach ($found as $script) {
            chmod($script, 0777);
            if (@rename($script, stripSuffix($script) . '.php')) {
                chmod(stripSuffix($script) . '.php', FILE_MOD);
            } else {
                chmod($script, FILE_MOD);
            }
        }
    }
}
Example #3
0
 /**
  * Catch all logger for miscellaneous security records
  * @param bool $success
  * @param string $requestor
  * @param string $auth
  * @param string $txt
  */
 static function security_misc($success, $requestor, $auth, $txt)
 {
     list($user, $name) = security_logger::populate_user();
     security_logger::Logger((int) $success, $name, NULL, $requestor, $auth, $txt);
     return $success;
 }