/** * getRights * * inits a 'easycontactusr' variable with the current user role * * @param array $_ssmap * request data */ function getRights($_ssmap) { $_ssmap['easycontactusr'] = EasyContactFormsSecurityManager::getGuest(); $foreignid = intval($_ssmap['frid']); if ($foreignid == 0) { return $_ssmap; } if (isset($_ssmap['m'])) { $m = $_ssmap['m']; $sm = addcslashes($m, chr(34) . chr(39) . chr(92) . "&;%<>"); $sm = str_replace(' ', '', $sm); if ($sm != $m) { unset($_ssmap['m']); $_ssmap['m'] = '&'; return $_ssmap; } } $query = "SELECT\n\t\t\t\tUsers.Role AS roleid,\n\t\t\t\tUsers.id\n\t\t\tFROM\n\t\t\t\t#wp__easycontactforms_users AS Users\n\t\t\tWHERE\n\t\t\t\tUsers.CMSId='{$foreignid}'"; $usr = EasyContactFormsDB::getObjects($query); if (EasyContactFormsDB::err()) { return $_ssmap; } if (count($usr) == 0) { return $_ssmap; } $usr = $usr[0]; $query = "SELECT * FROM #wp__easycontactforms_roles AS Roles WHERE Roles.id = '" . $usr->roleid . "'"; $role = EasyContactFormsDB::getObjects($query); if (EasyContactFormsDB::err()) { return $_ssmap; } if (count($role) == 0) { return $_ssmap; } $usr->role = (object) array(); $usr->role->Description = $role[0]->Description; $usr->role->id = $role[0]->id; unset($usr->roleid); $_ssmap['easycontactusr'] = $usr; return $_ssmap; }
/** * refreshForm * * @param $map * * * @return * */ function refreshForm($map) { $fid = intval($map['oid']); $form = new EasyContactFormsCustomForms(true, $fid); $form->user = EasyContactFormsSecurityManager::getGuest(); $form->preview = true; $html = $form->preprocess(); $text = array(); $text[] = "<script type='text/javascript' src='" . EASYCONTACTFORMS__engineWebAppDirectory . "/easy-contact-forms-forms.1.4.2.js'></script>"; $text[] = "<table align=center style='height:100%'><tr>"; $text[] = "<td style='padding-top:50px;vertical-align:top'>"; $text[] = $html; $text[] = "</td>"; $text[] = "</tr></table>"; $text = implode('', $text); if (!isset($map['ufo-skipoutput'])) { echo $text; exit; } }