/** * update. Overrides EasyContactFormsBase::update() * * updates an object with request data * * @param array $request * request data * @param int $id * object id */ function update($request, $id) { $request = EasyContactFormsUtils::parseRequest($request, 'TotalEntries', 'int'); $request = EasyContactFormsUtils::parseRequest($request, 'IncludeIntoReporting', 'boolean'); $request = EasyContactFormsUtils::parseRequest($request, 'CustomForms', 'int'); $request = EasyContactFormsUtils::parseRequest($request, 'Impressions', 'int'); parent::update($request, $id); }
/** * Displays a EasyContactFormsUsers manageMain view record * * @param object $view * the EasyContactFormsUsers manageMain view object * @param object $obj * a db object * @param int $i * record index * @param array $map * request data */ function getUsersManageMainViewRow($view, $obj, $i, $map) { $jsconf = json_decode(stripslashes($map['a'])); $args = $jsconf->ca[0]; $obj->addjsconfig = (object) array(); $obj->addjsconfig->viewTarget = $args->mt . 'Div'; $obj->addjsconfig->t = $args->mt; $obj->addjsconfig->m = 'mtmview'; $obj->addjsconfig->m2 = 'addRow'; $obj->addjsconfig->n = $args->t; $obj->addjsconfig->a = array(); $obj->addjsconfig->a[] = (object) array('fld' => $args->n, 'oid' => $obj->getId()); $obj->addjsconfig->a[] = (object) array('fld' => $args->fld, 'oid' => $args->oid); $obj->addjsconfig->a = json_encode($obj->addjsconfig->a); $obj->addjsconfig = EasyContactFormsUtils::toJs($obj->addjsconfig); $obj->Add = "onclick='ufo.link({$obj->addjsconfig}, {$view->jsconfig})'"; $obj->Description = array(); $obj->Description[] = $obj->get('Name'); $obj->Description[] = $obj->get('Description'); $obj->Description = EasyContactFormsUtils::vImplode(' ', $obj->Description); ?> <tr> <td class='firstcolumn'> <a id='<?php echo $obj->elId('Add', $obj->getId()); ?> ' title='<?php echo EasyContactFormsT::get('Add'); ?> ' href='javascript:;' class='icon_button_add ufo-mtmlink-button' <?php echo $obj->Add; ?> ></a> </td> <td> <?php echo $obj->get('id'); ?> </td> <td> <a id='<?php echo $obj->elId('Description', $obj->getId()); ?> ' class='ufo-id-link' onclick='ufo.redirect({m:"show", oid:"<?php echo $obj->get('id'); ?> ", t:"Users"})' onmouseover='ufo.showInfo({t:"Users", m2:"getUserASList", oid:<?php echo $obj->get('id'); ?> , m:"ajaxsuggest"}, this)'> <?php echo $obj->Description; ?> </a> </td> </tr> <?php }
/** * update. Overrides EasyContactFormsBase::update() * * updates an object with request data * * @param array $request * request data * @param int $id * object id */ function update($request, $id) { $request = EasyContactFormsUtils::parseRequest($request, 'UseTinyMCE', 'boolean'); $request = EasyContactFormsUtils::parseRequest($request, 'ApplicationWidth', 'int'); $request = EasyContactFormsUtils::parseRequest($request, 'ApplicationWidth2', 'int'); $request = EasyContactFormsUtils::parseRequest($request, 'FixJSLoading', 'boolean'); $request = EasyContactFormsUtils::parseRequest($request, 'FormCompletionMinTime', 'int'); $request = EasyContactFormsUtils::parseRequest($request, 'FormCompletionMaxTime', 'int'); $request = EasyContactFormsUtils::parseRequest($request, 'FixStatus0', 'boolean'); $request = EasyContactFormsUtils::parseRequest($request, 'InitTime', 'date'); $request = EasyContactFormsUtils::parseRequest($request, 'ShowPoweredBy', 'boolean'); parent::update($request, $id); }
/** * Displays a EasyContactFormsCustomForms manageMain view record * * @param object $view * the EasyContactFormsCustomForms manageMain view object * @param object $obj * a db object * @param int $i * record index * @param array $map * request data */ function getCustomFormsManageMainViewRow($view, $obj, $i, $map) { $jsconf = json_decode(stripslashes($map['a'])); $args = $jsconf->ca[0]; $obj->addjsconfig = (object) array(); $obj->addjsconfig->viewTarget = $args->mt . 'Div'; $obj->addjsconfig->t = $args->mt; $obj->addjsconfig->m = 'mtmview'; $obj->addjsconfig->m2 = 'addRow'; $obj->addjsconfig->n = $args->t; $obj->addjsconfig->a = array(); $obj->addjsconfig->a[] = (object) array('fld' => $args->n, 'oid' => $obj->getId()); $obj->addjsconfig->a[] = (object) array('fld' => $args->fld, 'oid' => $args->oid); $obj->addjsconfig->a = json_encode($obj->addjsconfig->a); $obj->addjsconfig = EasyContactFormsUtils::toJs($obj->addjsconfig); $obj->id = "onclick='ufo.link({$obj->addjsconfig}, {$view->jsconfig})'"; ?> <tr> <td class='firstcolumn'> <a id='<?php echo $obj->elId('id', $obj->getId()); ?> ' title='<?php echo EasyContactFormsT::get('Add'); ?> ' href='javascript:;' class='icon_button_add ufo-mtmlink-button' <?php echo $obj->id; ?> ></a> </td> <td> <?php echo $obj->get('id'); ?> </td> <td> <a onclick='ufo.redirect({m:"show", oid:"<?php echo $obj->get('id'); ?> ", t:"CustomForms"})'> <?php EasyContactFormsIHTML::echoStr($obj->get('Description')); ?> </a> </td> </tr> <?php }
/** * update. Overrides EasyContactFormsBase::update() * * updates an object with request data * * @param array $request * request data * @param int $id * object id */ function update($request, $id) { $request = EasyContactFormsUtils::parseRequest($request, 'UseTinyMCE', 'boolean'); $request = EasyContactFormsUtils::parseRequest($request, 'ApplicationWidth', 'int'); $request = EasyContactFormsUtils::parseRequest($request, 'ApplicationWidth2', 'int'); $request = EasyContactFormsUtils::parseRequest($request, 'FixJSLoading', 'boolean'); $request = EasyContactFormsUtils::parseRequest($request, 'FormCompletionMinTime', 'int'); $request = EasyContactFormsUtils::parseRequest($request, 'FormCompletionMaxTime', 'int'); $request = EasyContactFormsUtils::parseRequest($request, 'FixStatus0', 'boolean'); $request = EasyContactFormsUtils::parseRequest($request, 'InitTime', 'date'); $request = EasyContactFormsUtils::parseRequest($request, 'ShowPoweredBy', 'boolean'); $request = EasyContactFormsUtils::parseRequest($request, 'FixStatus02', 'boolean'); $request = EasyContactFormsUtils::parseRequest($request, 'w3cCompliant', 'boolean'); $request = EasyContactFormsUtils::parseRequest($request, 'FixJSLoading2', 'boolean'); $request = EasyContactFormsUtils::parseRequest($request, 'AllowMarkupInEntries', 'boolean'); $request = EasyContactFormsUtils::parseRequest($request, 'SkipWeeklyReport', 'boolean'); parent::update($request, $id); }
/** * @file * * EasyContactFormsUsers main form html template * * @see EasyContactFormsUsers::getMainForm() */ /* Copyright championforms.com, 2012-2013 | http://championforms.com * ----------------------------------------------------------- * Easy Contact Forms * * This product is distributed under terms of the GNU General Public License. http://www.gnu.org/licenses/gpl-2.0.txt. * */ EasyContactFormsLayout::getFormHeader('ufo-formpage ufo-mainform ufo-' . strtolower($obj->type)); echo EasyContactFormsUtils::getTypeFormDescription($obj->getId(), 'Users', 'Description,Name', '%s, %s'); EasyContactFormsLayout::getFormHeader2Body(); ?> <div> <?php EasyContactFormsLayout::getTabHeader(array('GeneralInfo', 'ContactInfo', 'History', 'More'), 'top'); ?> <div class='ufo-tab-wrapper ufo-tab-top'> <div id='GeneralInfo' class='ufo-tabs ufo-tab ufo-active'> <div> <div class='ufo-float-left ufo-width50'> <div> <label for='Description'> <?php echo EasyContactFormsT::get('LastName'); ?>
/** * getEmptyObject. Overrides EasyContactFormsBase::getEmptyObject() * * creates and initializes a new CustomFormEntryFile * * @param array $map * request data * @param array $fields * a field array * * @return object * the initialized instance */ function getEmptyObject($map, $fields = NULL) { $fields = (object) array(); $fields->Date = EasyContactFormsUtils::getDate(NULL, TRUE); $fields->CustomFormsEntries = EasyContactFormsDB::getFirst('CustomFormsEntries'); return parent::getEmptyObject($map, $fields); }
?> class='ufo-formvalue ufo-customform-fieldform-fieldset-cb' onchange='this.value=(this.checked)?"on":"off";'/></div><div><label for='AttachToNotification'><?php echo EasyContactFormsT::get('CF_AttachToNotification'); ?> <span id='AttachToNotificationHin' class='ufo-settingsform-label-hint ufo-label-hint ufo-id-link'>[<a>?</a>]</span></label><input type='hidden' id='AttachToNotificationHint' value='<?php echo EasyContactFormsT::get('CF_Hint_AttachToNotification'); ?> ' class='ufo-id-link'/><input type='checkbox' id='AttachToNotification' value='<?php echo isset($AttachToNotification) && $AttachToNotification == 'on' ? 'on' : 'off'; ?> ' <?php echo isset($AttachToNotification) && $AttachToNotification == 'on' ? 'checked' : ''; ?> class='ufo-formvalue ufo-customform-fieldform-fieldset-cb' onchange='this.value=(this.checked)?"on":"off";'/></div><?php if (!is_dir(EASYCONTACTFORMS__fileUploadDir)) { EasyContactFormsUtils::createFolder(EASYCONTACTFORMS__fileUploadDir); $as = EasyContactFormsApplicationSettings::getInstance(); $as->showMessages(); } ?> </div></div><div id='ufo-customform-settings-showlabel-fieldset' class='ufo-customform-fieldform-fieldset ufo-id-link'><div class='ufo-customform-fieldform-fieldset-legend'><span id='ufo-customform-settings-showlabel-expander' class='ufo-customform-fieldform-fieldset-expander ufo-id-link' onclick='ufoCf.expanderClick(this.id, "ufo-customform-settings-showlabel");'> </span><input type='hidden' id='ShowLabelHint' value='<?php echo EasyContactFormsT::get('CF_Hint_ShowLabel'); ?> ' class='ufo-id-link'/><div><input type='checkbox' id='ShowLabel' value='<?php echo isset($ShowLabel) && $ShowLabel == 'on' ? 'on' : 'off'; ?> ' <?php echo isset($ShowLabel) && $ShowLabel == 'on' ? 'checked' : ''; ?> class='ufo-formvalue ufo-customform-fieldform-fieldset-cb' onchange='this.value=(this.checked)?"on":"off";'/><label for='ShowLabel' style='width:auto;font-family:Arial;clear:none;display:inline;margin:0;float:none;font-size:12px;padding:0;line-height:16px'><?php echo EasyContactFormsT::get('CF_ShowLabel');
/** * @file * * EasyContactFormsCustomFormsEntries main view html template * * @see EasyContactFormsCustomFormsEntries ::getMainView() */ /* Copyright championforms.com, 2012-2013 | http://championforms.com * ----------------------------------------------------------- * Easy Contact Forms * * This product is distributed under terms of the GNU General Public License. http://www.gnu.org/licenses/gpl-2.0.txt. * */ EasyContactFormsLayout::getFormHeader('ufo-formpage ufo-mainview ufo-' . strtolower($obj->type)); echo EasyContactFormsUtils::getViewDescriptionLabel(EasyContactFormsT::get('CustomFormsEntries')); EasyContactFormsLayout::getFormHeader2Body(); ?> <div> <div class='buttons'> <div class='ufo-float-left'> <?php EasyContactFormsIHTML::getScroller($obj); ?> </div> <div class='ufo-float-left'> <?php echo EasyContactFormsIHTML::getButton(array('title' => EasyContactFormsT::get('Delete'), 'events' => " onclick='ufo.mdelete({$obj->jsconfig}, {$obj->mdeleteconfig})'", 'iclass' => " class='icon_button_delete' ", 'bclass' => "ufo-imagebutton")); ?> </div> <div class='ufo-float-left'>
/** * getSupportPage * * * @return * */ function getSupportPage() { if (!current_user_can('manage_options')) { return; } if (EasyContactFormsSupport::submitSupportForm()) { return; } wp_enqueue_script('easy-contact-forms-html', plugins_url('easy-contact-formshtml.1.4.9.js', __FILE__), array(), false, true); wp_enqueue_script('easy-contact-forms-env', plugins_url('easy-contact-forms.env.1.4.9.js', __FILE__), array(), false, true); $env = (object) array(); $env->System = (object) array(); $env->Wordpress = (object) array(); $env->Theme = (object) array(); global $current_user; $wp_url = rtrim(site_url(), '/'); $version = '1.4.9'; $env->System->PHPVersion = phpversion(); $env->System->UserAgent = $_SERVER['HTTP_USER_AGENT']; $env->System->Server = $_SERVER['SERVER_SOFTWARE']; $env->Wordpress->Version = get_bloginfo('version'); $env->Wordpress->Home = home_url(); $env->Wordpress->Site = $wp_url; $env->Wordpress->AdminEmail = $current_user->user_email; $env->Theme = (object) array(); if (function_exists('wp_get_theme')) { $theme = wp_get_theme(); } else { $theme_path = get_stylesheet_directory() . '/style.css'; $theme = get_theme_data($theme_path); $theme = (object) $theme; } $env->Theme->Name = $theme->Name; $env->Theme->ThemeURI = $theme->ThemeURI; $env->Theme->Version = $theme->Version; $env->Plugins = array(); $plugins = get_plugins(); $plugintable = array(); $plugintable[] = "<tr><th>" . __('Name') . "</th><th>" . __('Version') . "</th><th> URI</th></tr>"; foreach (array_keys($plugins) as $key) { if (!is_plugin_active($key)) { continue; } $plugindata =& $plugins[$key]; $plugin = (object) array(); $env->Plugins[] = $plugin; $plugin->Name = $plugindata['Name']; $plugin->Version = $plugindata['Version']; $plugin->PluginURI = $plugindata['PluginURI']; $plugintable[] = "<tr><td>{$plugin->Name}</td><td>{$plugin->Version}</td><td>{$plugin->PluginURI}</td></tr>"; } $plugintable = implode('', $plugintable); $plugintable = "<table class='ufo-object-table'>{$plugintable}</table>"; global $wpdb; $query = "SELECT CustomForms.id AS id, CustomForms.Description AS Name, CustomForms.NotificationSubject, CustomForms.NotificationText, CustomForms.SendNotificationAsText AS NotificationAsText, CustomForms.SendConfirmation AS SendConfirmations, CustomForms.SendFrom AS SendFromName, CustomForms.SendFromAddress, CustomForms.ConfirmationSubject, CustomForms.ConfirmationText, CustomForms.IncludeVisitorsAddressInReplyTo AS ReplyToVisitors, CustomForms.ReplyToNameTemplate, CustomForms.ConfirmationReplyToName, CustomForms.ConfirmationReplyToAddress, Users.email AS RecipientEmail, Users.Role AS RecipientRole, EngineUsers.user_login AS RecipientUserName FROM {$wpdb->prefix}easycontactforms_customforms AS CustomForms\tLEFT JOIN {$wpdb->prefix}easycontactforms_users AS Users LEFT JOIN {$wpdb->prefix}users AS EngineUsers ON Users.CMSId = EngineUsers.ID\tON CustomForms.ObjectOwner = Users.id"; $env->Forms = $wpdb->get_results($query); $formtable = EasyContactFormsUtils::getSimpleTable($env->Forms); $env->Settings->SupportInfo = "Objects could not be loaded"; if (@(include_once 'easy-contact-forms-root.php')) { require_once 'easy-contact-forms-applicationsettings.php'; unset($env->Settings->SupportInfo); $as = EasyContactFormsClassLoader::getObject('ApplicationSettings', true, 1); $env->Settings = $as->getData(); unset($env->Settings->SecretWord); unset($env->Settings->id); unset($env->Settings->Description); } $settinstable = EasyContactFormsUtils::getSimpleObjectTable($env->Settings); $data = "\n\t\t<h4>System Information:</h4>\n\t\t<table class='ufo-object-table'>\n\t\t<tr><th>Plugin Version:</th><td>{$version}</td></tr>\n\t\t<tr><th>WP Version:</th><td>{$env->Wordpress->Version}</td></tr>\n\t\t<tr><th>WP home URL</th><td>{$env->Wordpress->Home}</td></tr>\n\t\t<tr><th>WP site URL</th><td>{$env->Wordpress->Site}</td></tr>\n\t\t<tr><th>Admin email</th><td>{$env->Wordpress->AdminEmail}</td></tr>\n\t\t<tr><th>JS Errors</th><td id='support-data-table-js-errors'><span style='color:red'>Yes</span></td></tr>\n\t\t<tr><th>jQuery version</th><td id='support-data-table-query-version'></td></tr>\n\t\t<tr><th>PHP Version:</th><td>{$env->System->PHPVersion}</td></tr>\n\t\t<tr><th>User Agent:</th><td>{$env->System->UserAgent}</td></tr>\n\t\t<tr><th>Server Software:</th><td>{$env->System->Server}</td></tr>\n\t\t<tr><th>Theme Name:</th><td>{$env->Theme->Name}</td></tr>\n\t\t<tr><th>Theme URI:</th><td>{$env->Theme->ThemeURI}</td></tr>\n\t\t<tr><th>Theme Version:</th><td>{$env->Theme->Version}</td></tr>\n\t\t</table>\n\n\t\t<h4>Active Plugins:</h4>\n\t\t{$plugintable}\n\n\t\t<h4>Settings:</h4>\n\t\t{$settinstable}\n\n\t\t<h4>Form configuration:</h4>\n\t\t{$formtable}\n\n\t\t"; $supportform = $this->getForm(); if (!is_string($supportform)) { $supportform = $supportform->get_error_message(); } echo "<div class='wrap'>"; echo EasyContactFormsSupport::validateForm(); echo "<h2>" . __('Easy Contact Forms Support') . "</h2>"; echo "<div class='postbox-container-1' style='width:620px'>"; echo "<div class='metabox-holder'>"; echo "<div class='postbox'>"; echo "<h3>" . __('Support Request') . "</h3>"; echo "<div class='inside'>"; echo "<form method='POST'>"; echo "<input type='hidden' name='support-data-product-version' value='{$version}'>"; echo "<input type='hidden' name='support-form-data' value='1'>"; echo "<input type='hidden' name='support-data-query-version' id='support-data-query-version'>"; echo "<input type='hidden' name='support-data-js-errors' id='support-data-js-errors' value='Yes'>"; $env = base64_encode(serialize($env)); echo "<input type='hidden' name='support-data-env' id='support-data-env' value='{$env}'>"; echo $supportform; echo "<label><input type='checkbox' checked onchange='document.getElementById(\"support-data-env\").disabled = !this.checked'> " . __('Send Environment Info') . "</label><br />"; echo "<br /><input class='button-primary' type='submit' value='" . __('Submit') . "'>"; echo "</form>"; echo "</div>"; echo "</div>"; echo "</div>"; echo "</div>"; echo "<style>.ufo-object-table th {text-align:left;}.ufo-object-table{font-size:11px;}</style>"; echo "<div class='postbox-container-1' style='width:620px'>"; echo "<div class='metabox-holder'>"; echo "<div class='postbox'>"; echo "<h3>" . __('System information to be sent along with the support request:') . "</h3>"; echo "<div class='inside'>"; echo "<div>"; echo $data; echo "</div>"; echo "</div>"; echo "</div>"; echo "</div>"; echo "</div>"; echo "</div>"; }
/** * update. Overrides EasyContactFormsBase::update() * * updates an object with request data * * @param array $request * request data * @param int $id * object id */ function update($request, $id) { $request = EasyContactFormsUtils::parseRequest($request, 'CustomForms', 'int'); $request = EasyContactFormsUtils::parseRequest($request, 'Contacts', 'int'); parent::update($request, $id); }
/** * @file * * EasyContactFormsContactTypes main view html template * * @see EasyContactFormsContactTypes ::getMainView() */ /* Copyright championforms.com, 2012-2013 | http://championforms.com * ----------------------------------------------------------- * Easy Contact Forms * * This product is distributed under terms of the GNU General Public License. http://www.gnu.org/licenses/gpl-2.0.txt. * */ EasyContactFormsLayout::getFormHeader('ufo-formpage ufo-mainview ufo-' . strtolower($obj->type)); echo EasyContactFormsUtils::getViewDescriptionLabel(EasyContactFormsT::get('ContactTypes')); EasyContactFormsLayout::getFormHeader2Body(); ?> <div> <div class='buttons'> <div class='ufo-float-left'> <?php EasyContactFormsIHTML::getScroller($obj); ?> </div> <div class='ufo-float-left'> <?php echo EasyContactFormsIHTML::getButton(array('title' => EasyContactFormsT::get('Delete'), 'events' => " onclick='ufo.mdelete({$obj->jsconfig})'", 'iclass' => " class='icon_button_delete' ", 'bclass' => "ufo-imagebutton")); ?> </div> <div class='ufo-float-left'>
/** * Displays a EasyContactFormsUsers main view record * * @param object $view * the EasyContactFormsUsers main view object * @param object $obj * a db object * @param int $i * record index * @param array $map * request data */ function getUsersMainViewRow($view, $obj, $i, $map) { $obj->Description = array(); $obj->Description[] = $obj->get('Name'); $obj->Description[] = $obj->get('Description'); $obj->Description = EasyContactFormsUtils::vImplode(' ', $obj->Description); $usrname = EasyContactFormsDB::getValue("SELECT display_name FROM #wp__users WHERE ID = '" . $obj->get('CMSId') . "'"); if ($usrname) { $obj->CMSId = $usrname; } else { $obj->CMSId = ' '; } ?> <tr class='ufohighlight <?php EasyContactFormsIHTML::getTrSwapClassName($i); ?> '> <td class='firstcolumn'> <input type='checkbox' id='<?php echo $view->idJoin('cb', $obj->getId()); ?> ' value='off' class='ufo-deletecb' onchange='this.value=(this.checked)?"on":"off";'/> </td> <td> <?php echo $obj->get('id'); ?> </td> <td> <a id='<?php echo $obj->elId('Description', $obj->getId()); ?> ' class='ufo-id-link' onclick='ufo.redirect({m:"show", oid:"<?php echo $obj->get('id'); ?> ", t:"Users"})' onmouseover='ufo.showInfo({t:"Users", m2:"getUserASList", oid:<?php echo $obj->get('id'); ?> , m:"ajaxsuggest"}, this)'> <?php echo $obj->Description; ?> </a> </td> <td> <a onclick='ufo.redirect({m:"show", oid:"<?php echo $obj->get('ContactType'); ?> ", t:"ContactTypes"})'> <?php echo $obj->get('ContactTypeDescription'); ?> </a> </td> <td> <?php EasyContactFormsIHTML::echoDate($obj->get('Birthday'), EasyContactFormsApplicationSettings::getInstance()->getDateFormat('PHP'), 0); ?> </td> <td> <?php echo $obj->get('RoleDescription'); ?> </td> <td> <?php echo $obj->CMSId; ?> </td> <td> <?php $a = $obj->get('email'); if (!empty($a)) { ?> <a href='mailto:<?php echo $a; ?> '><?php echo $a; ?> </a> <?php } else { echo ' '; } ?> </td> </tr> <?php }
/** * process * * Applies the form entry data to db * * @param int $ownerid * User who owns the results */ function process($ownerid = NULL) { $form = EasyContactFormsClassLoader::getObject('CustomForms', true, $this->get('CustomForms')); if (!class_exists('EasyContactFormsT')) { $l_locale = get_locale(); $tag = strtolower(str_replace('_', '-', $l_locale)); require_once 'easy-contact-forms-strings.php'; if (!@(include_once 'easy-contact-forms-resources_' . $tag . '.php')) { require_once 'easy-contact-forms-resources_en-gb.php'; } } if (is_null($ownerid)) { $ownerid = $form->get('ObjectOwner'); } $content = $this->get('Content'); $xml = simplexml_load_string($content); $userid = (string) $xml->attributes()->userid; $userid = empty($userid) ? NULL : intval($userid); if (is_null($userid)) { $users = EasyContactFormsClassLoader::getObject('Users'); $user = $users->getEmptyObject(array()); $user->set('ObjectOwner', $ownerid); $siteuserid = $this->get('SiteUser'); $siteuserid = empty($siteuserid) ? NULL : $siteuserid; if (!is_null($siteuserid)) { $usrquery = "SELECT\n\t\t\t\t\t\t\tuser_login AS username,\n\t\t\t\t\t\t\tuser_email AS email,\n\t\t\t\t\t\t\tdisplay_name AS name\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t#wp__users\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tID='{$siteuserid}'"; $susr = EasyContactFormsDB::getObjects($usrquery); $susr = $susr[0]; $susrname = !empty($susr->name) ? $susr->name : $susr->username; if (!empty($susrname)) { $user->set('Description', $susrname); } if (!empty($susr->email)) { $user->set('email', $susr->email); } $user->set('CMSId', $siteuserid); } } else { $user = EasyContactFormsClassLoader::getObject('Users', true, $userid); $user->set('Role', NULL); } $fields = EasyContactFormsClassLoader::getObject('CustomFormFields'); foreach ($xml->children() as $xmlfld) { $value = (string) $xmlfld->h1; unset($xmlfld->h1); if (empty($value)) { continue; } $fldid = (string) $xmlfld->attributes()->id; $fldid = intval($fldid); $settings = $fields->getValue('Settings', $fldid); if (empty($settings)) { continue; } $settings = simplexml_load_string($settings); $link = (string) $settings->LinkToAppField; if (!empty($link)) { $link = explode('_', $link); if (count($link) > 1) { $user->set($link[1], $value); } } } $content = $xml->asXML(); $user->set('History', $content . '<br /><br />' . $user->get('History')); $user->save(); $this->set('Date', EasyContactFormsUtils::getDate($this->get('Date'), false, true, true)); $this->set('Users', $user->get('id')); $this->save(); $form->set('TotalProcessedEntries', $form->get('TotalProcessedEntries') + 1); $form->save(); }
/** * processEntry * * @param $map * * * @return * */ function processEntry($map) { $currentuser = isset($map['easycontactusr']) ? $map['easycontactusr'] : NULL; if (is_null($currentuser)) { return; } $newobjectmap = array(); $newobjectmap['easycontactusr'] = $currentuser; $id = intval($map['oid']); if ($id == 0) { return; } $entry = EasyContactFormsClassLoader::getObject('CustomFormsEntries', TRUE, $id); $content = $entry->get('Content'); $xml = simplexml_load_string($content); $userid = (string) $xml->attributes()->userid; $userid = empty($userid) ? NULL : intval($userid); if (empty($userid)) { $users = EasyContactFormsClassLoader::getObject('Users'); $user = $users->getEmptyObject($newobjectmap); $siteuserid = $entry->get('SiteUser'); $siteuserid = empty($siteuserid) ? NULL : $siteuserid; if (!is_null($siteuserid)) { $usrquery = "SELECT\n\t\t\t\t\t\t\tuser_login AS username,\n\t\t\t\t\t\t\tuser_email AS email,\n\t\t\t\t\t\t\tdisplay_name AS name\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t#wp__users\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tID='{$siteuserid}'"; $susr = EasyContactFormsDB::getObjects($usrquery); $susr = $susr[0]; $susrname = !empty($susr->name) ? $susr->name : $susr->username; if (empty($susrname)) { $user->set('Description', $susrname); } if (empty($susr->email)) { $user->set('email', $susr->email); } $user->set('CMSId', $siteuserid); } } else { $user = EasyContactFormsClassLoader::getObject('Users', true, $userid); $user->user = $currentuser; } $user->save(); $entry->set('Date', EasyContactFormsUtils::getDate($entry->get('Date'), false, true, true)); $entry->set('Users', $user->get('id')); $entry->save(); $form = EasyContactFormsClassLoader::getObject('CustomForms', true, $entry->get('CustomForms')); $form->set('TotalProcessedEntries', $form->get('TotalProcessedEntries') + 1); $form->save(); unset($map['oid']); unset($map['n']); $mn = isset($map['a']) ? 'viewDetailed' : 'view'; $map['m'] = $mn; EasyContactFormsRoot::processEvent($map); }
/** * webdirUpload * * takes a file from a temporary folder, registers it in the file * manager * places the file to a web directory for direct download and makes a * thumbnail * copy if it is necessary * * @param array $_uldmap * request data */ function webdirUpload($_uldmap) { $filerequestid = $_uldmap['t'] . '_' . $_uldmap['fld'] . '_' . $_uldmap['oid']; if ($_FILES[$filerequestid]['error'] != UPLOAD_ERR_OK) { return FALSE; } $oowner = $_uldmap['easycontactusr']->id; $filename = $_FILES[$filerequestid]['name']; $tmpname = $_FILES[$filerequestid]['tmp_name']; $filesize = $_FILES[$filerequestid]['size']; $filetype = mysql_real_escape_string($_FILES[$filerequestid]['type']); $id = intval($_uldmap['oid']); $Type = mysql_real_escape_string($_uldmap['t']); $fieldname = mysql_real_escape_string($_uldmap['fld']); $filename = mysql_real_escape_string($filename); $ds = DIRECTORY_SEPARATOR; $targdir = EASYCONTACTFORMS__fileUploadDir . $ds . $Type . $ds . $id . $ds . $fieldname; $query = "SELECT Name FROM #wp__easycontactforms_files WHERE Doctype='{$Type}' AND Docid='{$id}' AND Docfield='{$fieldname}'"; $name = EasyContactFormsDB::getValue($query); $filepath = $targdir . $ds . $name; if (is_file($filepath)) { unlink($filepath); } $filepath = $targdir . $ds . $filename; $query = "DELETE FROM #wp__easycontactforms_files WHERE Doctype='{$Type}' AND Docid='{$id}' AND Docfield='{$fieldname}'"; EasyContactFormsDB::query($query); $valuemap = array(); $valuemap['Count'] = '0'; $valuemap['Docfield'] = $fieldname; $valuemap['Doctype'] = $Type; $valuemap['Docid'] = $id; $valuemap['Name'] = $filename; $valuemap['Size'] = $filesize; $valuemap['Type'] = $filetype; $valuemap['Protected'] = 0; $valuemap['Webdir'] = 1; $valuemap['Storagename'] = $filename; $valuemap['ObjectOwner'] = $oowner; $isid = EasyContactFormsDB::insert($valuemap, 'Files'); if ($Type == 'Files') { $valuemap = array(); $valuemap['Docid'] = $isid; EasyContactFormsDB::update($valuemap, 'Files', $isid); } if (!is_dir($targdir)) { EasyContactFormsUtils::createFolder($targdir); } move_uploaded_file($tmpname, $filepath); if (isset($_uldmap['thumbnailx']) && intval($_uldmap['thumbnailx']) != 0) { $newfieldname = 'thumb' . $fieldname; $newfilename = 'thumb' . $filename; $newtargdir = EASYCONTACTFORMS__fileUploadDir . $ds . $Type . $ds . $id . $ds . $newfieldname; $query = "SELECT Name FROM #wp__easycontactforms_files WHERE Doctype='{$Type}' AND Docid='{$id}' AND Docfield='thumb{$fieldname}'"; $name = EasyContactFormsDB::getValue($query); if (is_file($newtargdir . $ds . $name)) { unlink($newtargdir . $ds . $name); } EasyContactFormsUtils::createFolder($newtargdir); EasyContactFormsFiles::imgResize($filepath, $newtargdir . $ds . $newfilename, $_uldmap['thumbnailx'], $_uldmap['thumbnaily'], 0xffffff, 80); $query = "DELETE FROM #wp__easycontactforms_files WHERE Doctype='{$Type}' AND Docid='{$id}' AND Docfield='{$newfieldname}'"; EasyContactFormsDB::query($query); $valuemap = array(); $valuemap['Count'] = '0'; $valuemap['Docfield'] = $newfieldname; $valuemap['Doctype'] = $Type; $valuemap['Docid'] = $id; $valuemap['Name'] = $newfilename; $valuemap['Size'] = filesize($newtargdir . $ds . $newfilename); $valuemap['Type'] = $filetype; $valuemap['Protected'] = 0; $valuemap['Webdir'] = 1; $valuemap['Storagename'] = $newfilename; $valuemap['ObjectOwner'] = $oowner; EasyContactFormsDB::insert($valuemap, 'Files'); } if (isset($_uldmap['resizex']) && intval($_uldmap['resizex']) != 0) { EasyContactFormsFiles::imgResize($filepath, $filepath, $_uldmap['resizex'], $_uldmap['resizey'], 0xffffff, 80); $valuemap = array(); $valuemap['Size'] = filesize($filepath); EasyContactFormsDB::update($valuemap, 'Files', $isid); } echo json_encode(array('success' => 'TRUE')); return TRUE; }
/** * getSimpleTable * * produces a simple html table based on object array * * @param array $objs * the object array to produce the table from * * @return string * html table */ function getSimpleTable($objs) { if (sizeof($objs) == 0) { return ''; } $html = ''; foreach ($objs as $obj) { $html .= "<p>"; $name = isset($obj->Description) ? $obj->Description : null; $name = isset($obj->Name) ? $obj->Name : $name; if (!is_null($name)) { $html .= "<h3>{$name}</h3>"; } $html .= EasyContactFormsUtils::getSimpleObjectTable($obj); $html .= "</p>"; } return $html; }
/** * getFileUpload * * An ajax upload object wrapper * * @param int $id * AjaxUpload button id * @param object $object * AjaxUpload configuration object * * @return string * html text */ function getFileUpload($id, $object) { $jsrequest = EasyContactFormsUtils::toJs($object->request); $jsoncomplete = isset($object->oncomplete) ? ', function(file, ext) {' . $object->oncomplete->func . '(' . $object->oncomplete->args . ')}' : ''; $label = isset($object->value) ? EasyContactFormsT::get('Update') : EasyContactFormsT::get('Upload'); ?> <input type = 'hidden' class = 'ufo-eval' value = 'AppMan.AjaxUpload.create("<?php echo $id; ?> ",<?php echo $jsrequest; echo $jsoncomplete; ?> );'> <span class = 'button internalimage ufo-upload' id = '<?php echo $id; ?> '> <span> <a class = 'icon_button_upload'> <?php echo $label; ?> </a> </span> </span> <?php if (isset($object->value)) { ?> <span class = 'button internalimage' onclick = 'ufo.deleteFile("<?php echo $id; ?> ",<?php echo $jsrequest; ?> , this<?php echo $jsoncomplete; ?> );'> <span> <a class = 'icon_button_delete'> <?php echo EasyContactFormsT::get('Delete'); ?> </a> </span> </span> <?php } }
/** * rrmdir * * removes a directory. (c) holger1 at zentralplan dot de * * @param string $dir * directory name */ function rrmdir($dir) { if (is_dir($dir)) { $objects = scandir($dir); foreach ($objects as $object) { if ($object != '.' && $object != '..') { if (filetype($dir . '/' . $object) == 'dir') { EasyContactFormsUtils::rrmdir($dir . '/' . $object); } else { unlink($dir . '/' . $object); } } } reset($objects); rmdir($dir); } }
* EasyContactFormsUsers AS form html template * * @see EasyContactFormsUsers::getASForm() */ /* Copyright championforms.com, 2012-2013 | http://championforms.com * ----------------------------------------------------------- * Easy Contact Forms * * This product is distributed under terms of the GNU General Public License. http://www.gnu.org/licenses/gpl-2.0.txt. * */ ?> <div class='ufo-as-form ufo-users'> <div class='ufo-as-list-hidden'> <?php echo EasyContactFormsUtils::getTypeFormDescription($obj->getId(), 'Users', 'Name,Description'); ?> </div> <?php if (!$obj->isEmpty('ContactTypeDescription')) { ?> <div> <label><?php echo EasyContactFormsT::get('ContactType'); ?> </label> <?php echo $obj->get('ContactTypeDescription'); ?> </div> <?php
/** * getMainForm * * prepares the view data and finally passes it to the html template * * @param array $formmap * request data */ function getMainForm($formmap) { $fields = array(); $fields[] = 'id'; $fields[] = 'Description'; $fields[] = 'ContactType'; $fields[] = 'Role'; $fields[] = 'Name'; $fields[] = 'CMSId'; $fields[] = 'Notes'; $fields[] = 'ContactField3'; $fields[] = 'ContactField4'; $fields[] = 'Birthday'; $fields[] = 'Country'; $fields[] = 'City'; $fields[] = 'State'; $fields[] = 'Zip'; $fields[] = 'Address'; $fields[] = 'email'; $fields[] = 'email2'; $fields[] = 'Cell'; $fields[] = 'Phone1'; $fields[] = 'Phone2'; $fields[] = 'Phone3'; $fields[] = 'SkypeId'; $fields[] = 'Website'; $fields[] = 'Comment'; $fields[] = 'History'; $obj = $this->formInit($formmap, $fields); $obj->set('Description', htmlspecialchars($obj->get('Description'), ENT_QUOTES)); $obj->set('Name', htmlspecialchars($obj->get('Name'), ENT_QUOTES)); $obj->CMSId = (object) array(); $obj->CMSId->view = $obj; $obj->CMSId->field = 'CMSId'; $obj->CMSId->config['t'] = 'Users'; $obj->CMSId->config['m2'] = 'getEUserASList'; $obj->CMSId->inpstyle = " style='width:100%'"; $obj->set('Notes', htmlspecialchars($obj->get('Notes'))); $obj->set('ContactField3', htmlspecialchars($obj->get('ContactField3'))); $obj->set('ContactField4', htmlspecialchars($obj->get('ContactField4'))); $obj->Birthday = EasyContactFormsUtils::getDate($obj->get('Birthday')); $obj->set('Country', htmlspecialchars($obj->get('Country'), ENT_QUOTES)); $obj->set('City', htmlspecialchars($obj->get('City'), ENT_QUOTES)); $obj->set('State', htmlspecialchars($obj->get('State'), ENT_QUOTES)); $obj->set('Zip', htmlspecialchars($obj->get('Zip'), ENT_QUOTES)); $obj->set('Address', htmlspecialchars($obj->get('Address'))); $obj->set('email', htmlspecialchars($obj->get('email'), ENT_QUOTES)); $obj->set('email2', htmlspecialchars($obj->get('email2'), ENT_QUOTES)); $obj->set('Cell', htmlspecialchars($obj->get('Cell'), ENT_QUOTES)); $obj->set('Phone1', htmlspecialchars($obj->get('Phone1'), ENT_QUOTES)); $obj->set('Phone2', htmlspecialchars($obj->get('Phone2'), ENT_QUOTES)); $obj->set('Phone3', htmlspecialchars($obj->get('Phone3'), ENT_QUOTES)); $obj->set('SkypeId', htmlspecialchars($obj->get('SkypeId'), ENT_QUOTES)); $obj->set('Website', htmlspecialchars($obj->get('Website'), ENT_QUOTES)); $obj->set('Comment', htmlspecialchars($obj->get('Comment'))); ?> <input type='hidden' class='ufostddata' id='t' value='<?php echo $obj->type; ?> '> <input type='hidden' class='ufostddata' id='oid' value='<?php echo $obj->getId(); ?> '> <?php require_once 'views/easy-contact-forms-usersmainform.php'; }
/** * @file * * EasyContactFormsDashBoard DashBoard form html template * * @see EasyContactFormsDashBoard::getDashBoardForm() */ /* Copyright championforms.com, 2012-2013 | http://championforms.com * ----------------------------------------------------------- * Easy Contact Forms * * This product is distributed under terms of the GNU General Public License. http://www.gnu.org/licenses/gpl-2.0.txt. * */ EasyContactFormsLayout::getFormHeader('ufo-formpage ufo-dashboardform ufo-' . strtolower($obj->type)); echo EasyContactFormsUtils::getViewDescriptionLabel(EasyContactFormsT::get('DashBoard')); EasyContactFormsLayout::getFormHeader2Body(); ?> <div> <div> <div style='width:300px;float:left'> <div class='ufo-dashboard-header'> <?php echo EasyContactFormsT::get('UserStatistics'); ?> </div> <div> <?php $obj->getUserStatistics(); ?> </div>
/** * @file * * EasyContactFormsApplicationSettings main form html template * * @see EasyContactFormsApplicationSettings::getMainForm() */ /* Copyright championforms.com, 2012-2013 | http://championforms.com * ----------------------------------------------------------- * Easy Contact Forms * * This product is distributed under terms of the GNU General Public License. http://www.gnu.org/licenses/gpl-2.0.txt. * */ EasyContactFormsLayout::getFormHeader('ufo-formpage ufo-mainform ufo-' . strtolower($obj->type)); echo EasyContactFormsUtils::getTypeFormDescription($obj->getId(), 'ApplicationSettings'); EasyContactFormsLayout::getFormHeader2Body(); ?> <div> <?php EasyContactFormsLayout::getTabHeader(array('GeneralSettings', 'AdditionalSettings', 'TinyMCESettings'), 'top'); ?> <div class='ufo-tab-wrapper ufo-tab-top'> <div id='GeneralSettings' class='ufo-tabs ufo-tab ufo-active'> <div class='ufo-float-left ufo-width50'> <label for='ShowPoweredBy'><?php echo EasyContactFormsT::get('ShowPoweredBy'); ?> </label> <input type='checkbox' id='ShowPoweredBy' value='<?php echo $obj->ShowPoweredBy;
/** * fillInTemplate * * fills the template with object data * * @param object $template * email template * @param string $object * object type * * @return object * the filled template */ function fillInTemplate($template, $object) { if (!is_object($object)) { $template->body = str_replace('{messagebody}', $object, $template->body); } else { $fields = get_object_vars($object); foreach ($fields as $fname => $fvalue) { $value = (EasyContactFormsUtils::endsWith($fname, 'date') || EasyContactFormsUtils::endsWith($fname, 'deadline')) && is_numeric($fvalue) ? EasyContactFormsUtils::getDate($fvalue) : $fvalue; if (isset($template->ishtml) && $template->ishtml) { $value = nl2br('' . $value); } if (isset($template->body)) { $fldcheck = EasyContactFormsBackOffice::fldTemplateReplace($template->body, $fname, $value); if (!$fldcheck) { $template->body = str_replace('{' . $fname . '}', $value, $template->body); } else { $template->body = $fldcheck; } } if (isset($template->subject)) { $fldcheck = EasyContactFormsBackOffice::fldTemplateReplace($template->subject, $fname, $value); if (!$fldcheck) { $template->subject = str_replace('{' . $fname . '}', $value, $template->body); } else { $template->subject = $fldcheck; } } } } return $template; }
/** * @file * * EasyContactFormsContactTypes main form html template * * @see EasyContactFormsContactTypes::getMainForm() */ /* Copyright championforms.com, 2012-2013 | http://championforms.com * ----------------------------------------------------------- * Easy Contact Forms * * This product is distributed under terms of the GNU General Public License. http://www.gnu.org/licenses/gpl-2.0.txt. * */ EasyContactFormsLayout::getFormHeader('ufo-formpage ufo-simple ufo-mainform ufo-' . strtolower($obj->type)); echo EasyContactFormsUtils::getTypeFormDescription($obj->getId(), 'ContactTypes'); EasyContactFormsLayout::getFormHeader2Body(); ?> <div> <div> <label for='Description'> <?php echo EasyContactFormsT::get('Description'); ?> <span class='mandatoryast'>*</span> </label> <input type='text' id='Description' value='<?php echo $obj->get('Description'); ?> ' class='textinput ufo-text ufo-formvalue' style='width:100%'/> <input type='hidden' value='var c = {};c.id = "Description";c.events = {};c.events.blur = [];c.minmax={};c.minmax.msg=AppMan.resources.ValueLengthShouldBeLessThan;c.minmax.args=[];c.minmax.args.push("200");c.max="200";c.events.blur.push("minmax");c.required={};c.required.msg=AppMan.resources.ThisFieldIsRequired;c.events.blur.push("required");c.InvalidCSSClass = "ufo-fields-invalid-field";AppMan.addValidation(c);' class='ufo-eval'/>
/** * mtmView * * handles many-to-many views * * @param array $_amap * request data */ function mtmView($_amap) { $viewname = $_amap['n']; $_amap['m'] = 'view'; $_amap = EasyContactFormsUtils::intercept($_amap); if ($_amap == NULL) { return EasyContactFormsIHTML::getNotLoggedInHTML(); } $newviewname = ucwords($_amap["n"]); $_amap['m'] = 'mtmview'; $_amap['n'] = $viewname; $atype = $_amap['t']; $aobj = EasyContactFormsClassLoader::getObject($atype); if (isset($_amap['m2']) && ($_amap['m2'] = 'addRow')) { $aobj->getEmptyObject($_amap); } $aobj->user = $_amap['easycontactusr']; $aobj->map = $_amap; $aobj->jsconfig = $aobj->getJSConfig($_amap); $aramethodname = 'get' . $viewname . $newviewname . 'View'; $aobj->{$aramethodname}($_amap); }
/** * getQueryText * * creates a parameter-value based sql query * * @param string $query * sql text * @param array $params * parameter key => values pairs * * @return string * sql text */ function getQueryText($query, $params) { if (isset($params)) { foreach ($params as $key => $value) { $query = str_replace('%' . $key, EasyContactFormsUtils::addMSlashes($value), $query); } } return $query; }
/** * val * * @param $map * * * @return * */ function val($map) { foreach ($map as $key => $value) { if (!EasyContactFormsUtils::beginsWith($key, 'id-')) { continue; } $names = explode('-', $key); $fldid = intval($names[1]); if ($fldid == 0) { continue; } $fld = EasyContactFormsClassLoader::getObject('CustomFormFields', true, $fldid); if (!$fld) { continue; } $phase = (object) array('index' => 4); include $fld->getTMPFileName('proc'); } }
/** * @file * * EasyContactFormsCustomFormsEntries main form html template * * @see EasyContactFormsCustomFormsEntries::getMainForm() */ /* Copyright championforms.com, 2012-2013 | http://championforms.com * ----------------------------------------------------------- * Easy Contact Forms * * This product is distributed under terms of the GNU General Public License. http://www.gnu.org/licenses/gpl-2.0.txt. * */ EasyContactFormsLayout::getFormHeader('ufo-formpage ufo-mainform ufo-' . strtolower($obj->type)); echo EasyContactFormsUtils::getTypeFormDescription($obj->getId(), 'CustomFormsEntries', 'id', 'Entry id:%d'); EasyContactFormsLayout::getFormHeader2Body(); ?> <div> <?php EasyContactFormsLayout::getTabHeader(array('GeneralInfo', 'CustomFormEntryFiles'), 'top'); ?> <div class='ufo-tab-wrapper ufo-tab-top'> <div id='GeneralInfo' class='ufo-tabs ufo-tab ufo-active'> <div> <div style='width:100%'> <label><?php echo EasyContactFormsT::get('CustomForm'); ?> </label> <span>
/** * update. Overrides EasyContactFormsBase::update() * * updates an object with request data * * @param array $request * request data * @param int $id * object id */ function update($request, $id) { $request = EasyContactFormsUtils::parseRequest($request, 'ListPosition', 'int'); $request = EasyContactFormsUtils::parseRequest($request, 'ValueField', 'boolean'); parent::update($request, $id); }