public static function encode_mime_fileurl($y_msg_file, $y_ctrl_key) { //-- $y_msg_file = (string) trim((string) $y_msg_file); if ((string) $y_msg_file == '') { Smart::log_warning('Mail-Utils / Encode Mime File URL: Empty Message File Path has been provided. This means the URL link will be unavaliable (empty) to assure security protection.'); return ''; } //end if if (!SmartFileSysUtils::check_file_or_dir_name($y_msg_file)) { Smart::log_warning('Mail-Utils / Encode Mime File URL: Invalid Message File Path has been provided. This means the URL link will be unavaliable (empty) to assure security protection. Message File: ' . $y_msg_file); return ''; } //end if //-- $y_ctrl_key = (string) trim((string) $y_ctrl_key); if ((string) $y_ctrl_key == '') { Smart::log_warning('Mail-Utils / Encode Mime File URL: Empty Controller Key has been provided. This means the URL link will be unavaliable (empty) to assure security protection.'); return ''; } //end if if (SMART_FRAMEWORK_ADMIN_AREA === true) { // {{{SYNC-ENCMIMEURL-CTRL-PREFIX}}} $y_ctrl_key = (string) 'AdminMailUtilArea/' . $y_ctrl_key; } else { $y_ctrl_key = (string) 'IndexMailUtilArea/' . $y_ctrl_key; } //end if //-- $crrtime = (int) time(); $access_key = sha1('MimeLink:' . SMART_SOFTWARE_NAMESPACE . '-' . SMART_FRAMEWORK_SECURITY_KEY . '-' . SMART_APP_VISITOR_COOKIE . ':' . $y_msg_file . '>' . $y_ctrl_key); $unique_key = sha1('Time=' . $crrtime . '#' . SMART_SOFTWARE_NAMESPACE . '-' . SMART_FRAMEWORK_SECURITY_KEY . '-' . $access_key . '-' . SmartUtils::unique_auth_client_private_key() . ':' . $y_msg_file . '>' . $y_ctrl_key); $self_robot_key = sha1('Time=' . $crrtime . '#' . SmartAuth::get_login_id() . '*' . SMART_SOFTWARE_NAMESPACE . '-' . SMART_FRAMEWORK_SECURITY_KEY . '-' . SmartUtils::get_selfrobot_useragent_name() . '$' . $access_key . ':' . $y_msg_file . '>' . $y_ctrl_key); //-- {{{SYNC-MIME-ENCRYPT-ARR}}} $safe_link = SmartUtils::crypto_encrypt(trim((string) $crrtime) . "\n" . trim((string) $y_msg_file) . "\n" . trim((string) $access_key) . "\n" . trim((string) $unique_key) . "\n" . trim((string) $self_robot_key) . "\n", 'SmartFramework//MimeLink' . SMART_FRAMEWORK_SECURITY_KEY); //-- return (string) $safe_link; //-- }