* Copyright (c) 2001-2008 Platon Group, http://platon.sk/ * All rights reserved. * * See README file for more information about this software. * See COPYING file for license information. * * Download the latest version from * http://platon.sk/projects/Metafox/ */ /* $Platon: Metafox/admin/inc/functions.inc.php,v 1.12 2017/06/09 15:12:58 igor Exp $ */ /* MAINTAINANCE: This file is maintained in Metafox project and distributed across the particular projects accordingly. */ function ezin_admin_check_list_privileges($priv) /* {{{ */ { return stristr($priv, 'L') !== false; } /* }}} */ function ezin_admin_check_full_list_privileges($priv) /* {{{ */ { return strstr($priv, 'L') !== false; } /* }}} */ function ezin_admin_check_restricted_list_privileges($priv) /* {{{ */ { return strstr($priv, 'l') !== false; } /* }}} */ function ezin_admin_word_clean($content) /* {{{ */ { global $ezin_sys, $ezin_cfg; $content = preg_replace('|\ |mi', ' ', $content); $content = preg_replace('||mi', '', $content); $content = preg_replace('|]*>|mi', '', $content); $content = preg_replace('|<\?xml[^>]*>|mi', '', $content); $content = preg_replace('|]*>|mi', '', $content); $content = preg_replace('|]*>|mi', '', $content); $content = preg_replace('|]*>|mi', '', $content); $content = preg_replace('|]*>|mi', '', $content); $content = preg_replace('|]*>|mi', '', $content); $content = preg_replace('|]*>|mi', '', $content); $content = preg_replace('|]*>|mi', '', $content); $content = preg_replace('|]*>|mi', '', $content); $content = preg_replace('|]*>|mi', '', $content); $content = preg_replace('|]*>|mi', '', $content); $content = preg_replace('|]*>|mi', '', $content); $content = preg_replace('|]*>|mi', '', $content); $content = preg_replace('|]*>|mi', '', $content); $content = preg_replace('|]*>|mi', '', $content); $content = preg_replace('|]*>|mi', '

', $content); $content = preg_replace('|]*>|mi', '', $content); $content = preg_replace('|]*>|mi', '', $content); $content = preg_replace('|]*>|mi', '', $content); $content = preg_replace('|]*>|mi', '', $content); $content = preg_replace('{]*|)>}mi', '', $content); $content = preg_replace('{]*|)>}mi', '', $content); $content = preg_replace('{]*|)>}mi', '', $content); $content = preg_replace('{]*|)>}mi', '', $content); $content = preg_replace('{]*|)>}mi', '', $content); $content = preg_replace('{]*|)>}mi', '', $content); //$content = preg_replace('|[\x0a]|mi', '~', $content); // TODO: fix this, not working $content = preg_replace('|\s*]*>\s*|mi', "\n", $content); $content = preg_replace('|\s*]*>\s*|mi', "\n", $content); $content = preg_replace('|\s*]*>\s*|mi', "\n", $content); $content = preg_replace('|\s*]*>\s*|mi', "\n", $content); $content = preg_replace('|\s*]*>\s*|mi', "\n", $content); $content = preg_replace('|\s*]*>\s*|mi', "\n", $content); $content = preg_replace('|\s*]*>\s*|mi', "\n
", $content); $content = preg_replace('|\s*]*>\s*|mi', "\n", $content); $content = preg_replace('|\s*]*)>\s*<\1>\s*|mi', '', $content); // ex: $content = preg_replace('|\s*<([^>]*)>\s*\s*|mi', '', $content); // ex: $content = preg_replace('|\s*]*)>\s*<\1>\s*|mi', '', $content); // ex: $content = preg_replace('|\s*<([^>]*)>\s*\s*|mi', '', $content); // ex: $content = preg_replace('|[ \t]+|mi', ' ', $content); $content = preg_replace('|\s*]*>\s*|mi', "\n\r\n\r", $content); $content = trim($content); $tag = sprintf("\n", $ezin_sys['software']['name'], $ezin_sys['software']['version'], date($ezin_cfg['format_datetime'])); return $tag.$content; } /* }}} */ function ezin_admin_get_template_keys($template_name) /* {{{ */ { global $ezin_sys, $ezin_cfg; $output_ar = array(); $directory = dir($ezin_sys['dir']['root'].'/'.$ezin_sys['dir']['themes'].'/'.$ezin_cfg['theme']['name'].'/'); $template_name .= $ezin_sys['tmpl']['delim']; $template_name_len = strlen($template_name); $delimext = $ezin_sys['tmpl']['delimext']; $delimext_len = strlen($delimext); while ($entry = $directory->read()) { if (strncmp($entry, $template_name, $template_name_len)) { continue; } $entry = Platon::str_replace_prefix($template_name, '', $entry); if (strncmp(strrev($entry), strrev($delimext), $delimext_len)) { continue; } $entry = Platon::str_replace_postfix($delimext, '', $entry); array_push($output_ar, $entry); } sort($output_ar); return $output_ar; } /* }}} */ function ezin_admin_is_blog() /* {{{ */ { global $ezin_user; if (strpos($ezin_user['role_authors'], 'X') !== false) { return true; } return false; } /* }}} */ function ezin_reset_session_records() /* {{{ */ { global $ezin_sys; global $ezin_db_handle; $query = sprintf('UPDATE %s' .' SET password = REPEAT("*", LENGTH(password))' .' WHERE password IS NOT NULL AND LENGTH(password) > 0' .' AND login < SUBDATE(NOW(), INTERVAL 7 DAY)', $ezin_sys['db']['tables']['sessions']); $result = mysqli_query($ezin_db_handle, $query); if ($result == false) { ezin_db_error('ezin_reset_session_records()'); } // NOTE: no mysqli_free_result() neccessary here return true; } /* }}} */ /* Modeline for ViM {{{ * vim: set ts=4: * vim600: fdm=marker fdl=0 fdc=0: * }}} */ ?>