/** * Ratings_templateFunction * * replaces {{RATINGS}} with a rating interface * * @param array $vars settings * * @return string html */ function Ratings_templateFunction($vars) { $name = @$vars['name']; $type = @$vars['type']; if ($name == '') { return ''; } $script = '$(function(){$(".ratings").ratings();});'; WW_addScript('ratings/ratings.js'); WW_addInlineScript($script); return '<div class="ratings" id="' . $name . '" type="' . $type . '">' . __('ratings', 'core') . '</div>'; }
/** * show the form to be submitted * * @param array $page page db row * @param array $vars page meta data * @param array $errors any errors that need to be shown * @param array form_fields list of fields in the form * * @return HTML of the form */ function Form_showForm($page, $vars, $errors, $form_fields) { if (!isset($_SESSION['forms'])) { $_SESSION['forms'] = array(); } $c = '<form action="' . $_SERVER['REQUEST_URI'] . '" method="post" ' . 'class="ww_form" enctype="multipart/form-data">'; if (count($errors)) { $c .= '<div class="errorbox">' . join('<br />', $errors) . '</div>'; } switch (@$vars['forms_htmltype']) { case 'div': // { $vals_wrapper_start = ''; $vals_field_start = '<div><span class="__" lang-context="core">'; $vals_field_middle = '</span>'; $vals_field_end = '</div>'; $vals_2col_start = '<div>'; $vals_2col_end = '</div>'; $vals_wrapper_end = ''; break; // } // } default: // { $vals_wrapper_start = '<table class="forms-table">'; $vals_field_start = '<tr><th class="__" lang-context="core">'; $vals_field_middle = '</th><td>'; $vals_field_end = '</td></tr>'; $vals_2col_start = '<tr><td colspan="2">'; $vals_2col_end = '</td></tr>'; $vals_wrapper_end = '</table>'; // } } if (@$vars['forms_template'] && strpos($vars['forms_template'], '{{') === false) { $vars['forms_template'] = ''; } // }} if (!@$vars['forms_template'] || $vars['forms_template'] == ' ') { $c .= '<div>' . $vals_wrapper_start; } $required = array(); $cnt = 0; $has_date = false; $has_ccdate = false; foreach ($form_fields as $r2) { if ($r2['type'] == 'hidden') { continue; } $name = preg_replace('/[^a-zA-Z0-9_]/', '', $r2['name']); $help = @$r2['help']; if ($help != '') { $help = ' title="' . htmlspecialchars($help, ENT_QUOTES) . '"'; } $class = ''; if ($r2['isrequired']) { $required[] = $name . ',' . $r2['type']; $class = ' required'; } if (isset($_REQUEST[$name])) { $_SESSION['forms'][$name] = $_REQUEST[$name]; } $val = Form_valueDefault($name); if (!isset($_REQUEST[$name])) { $_REQUEST[$name] = ''; } $table_break = 0; switch ($r2['type']) { case 'checkbox': // { $d = '<input type="checkbox" id="' . $name . '" name="' . $name . '"' . $help; if ($_REQUEST[$name]) { $d .= ' checked="' . $_REQUEST[$name] . '"'; } $d .= ' class="' . $class . ' checkbox" />'; break; // } // } case 'ccdate': // { if ($_REQUEST[$name] == '') { $_REQUEST[$name] = date('Y-m'); } $d = '<input name="' . $name . '" value="' . $_REQUEST[$name] . '" class="ccdate"' . $help . '/>'; $has_ccdate = true; break; // } // } case 'date': // { if ($_REQUEST[$name] == '') { $_REQUEST[$name] = date('Y-m-d'); } $d = '<input name="' . $name . '" value="' . $_REQUEST[$name] . '"' . $help . ' class="date" placeholder="yyyy-mm-dd" ' . 'metadata="' . addslashes($r2['extra']) . '"/>'; $has_date = true; break; // } // } case 'email': // { if ($r2['extra']) { $class .= ' verify'; $verify = '<input style="display:none" class="email-verification" ' . 'name="' . $name . '_verify" value="" placeholder="verification code"' . $help . '/>'; $_SESSION['form_input_email_verify_' . $name] = rand(10000, 99999); } else { $verify = ''; } $d = '<input type="email" id="' . $name . '" name="' . $name . '" value="' . $val . '" class="email' . $class . ' text"' . $help . '/>' . $verify; break; // } // } case 'file': // { WW_addScript('/j/swfobject.js'); WW_addScript('/j/jquery.uploadify/jquery.uploadify.min.js'); $opts = isset($r2['extra']) ? explode(':', $r2['extra']) : array(); if (!isset($opts[0]) || !isset($opts[1])) { $opts = array('off', '*;'); } $multi = $opts[0] == 'on' ? 'true' : 'false'; $script = ' $(function(){ $("#' . $name . '").uploadify({ "uploader":"/j/jquery.uploadify/uploadify.swf", "script":"/ww.plugins/forms/frontend/file-upload.php", "cancelImg":"/ww.plugins/forms/j/cancel.png", "multi":' . $multi . ', "removeCompleted":false, "fileDataName":"file-upload", "scriptData":{ "PHPSESSID":"' . session_id() . '" }, "onComplete":function(event,ID,fileObj,response,data){ if(response=="deleted"){ alert("You have uploaded too many large files. These files' . ' have been deleted to conserve space. Please reload the ' . 'page and try again with less or smaller files."); } }, "onAllComplete":function(){ $("input[type=submit]").attr("disabled",false); }, "onSelect":function(){ $("input[type=submit]").attr("disabled","disabled"); }, "fileExt":"' . $opts[1] . '", "fileDesc":" ", "auto":true }); });'; WW_addInlineScript($script); $d = '<div id="upload">'; $d .= '<input type="file" id="' . $name . '" name="file-upload"' . $help . '/>'; $d .= '</div>'; // { add existing files $dir = USERBASE . '/f/.files/forms/' . session_id(); if (is_dir($dir)) { $files = array(); $uploads = new DirectoryIterator($dir); foreach ($uploads as $upload) { if ($upload->isDot() || $upload->isDir()) { continue; } $bytes = $upload->getSize(); $kb = round($bytes / 1024, 2); $d .= '<div class="uploadifyQueueItem completed">' . '<div class="cancel"><a class="download-delete-item" ' . 'href="javascript:;" id="' . $upload->getFileName() . '">' . '<img border="0" src="/ww.plugins/forms/j/cancel.png"></a>' . '</div>' . '<span class="fileName">' . $upload->getFileName() . ' (' . $kb . ' KB)</span>' . '<span class="percentage"> - Completed</span>' . '</div>'; } } // } break; // } // } case 'hidden': // { $d = '<textarea id="' . $name . '" name="' . $name . '" class="' . $class . ' hidden"' . $help . '>' . htmlspecialchars($r2['extra']) . '</textarea>'; break; // } // } case 'html-block': // { $d = $r2['extra']; $table_break = true; break; // } // } case 'page-next': // { $d = '<a href="javascript:;" class="form-page-next">Next</a>'; $table_break = true; break; // } // } case 'page-previous': // { $d = '<a href="javascript:;" class="form-page-previous">Previous</a>'; $table_break = true; break; // } // } case 'page-break': // { $d = '</div><div style="display:none">'; $table_break = true; break; // } // } case 'selectbox': // { $d = '<select id="' . $name . '" name="' . $name . '"' . $help . '>'; $arr = explode("\n", htmlspecialchars($r2['extra'])); foreach ($arr as $li) { if ($_REQUEST[$name] == $li) { $d .= '<option selected="selected">' . rtrim($li) . '</option>'; } else { $d .= '<option>' . rtrim($li) . '</option>'; } } $d .= '</select>'; break; // } // } case 'signature': // { $d = '<div class="signature-wrapper">' . '<canvas class="signature-pad" width="300" height="150">' . '</canvas>' . '<a href="#" class="signature-clear">clear</a>' . '<input type="hidden" name="' . $name . '"/>' . '</div>'; WW_addScript('forms/j/jquery.signaturepad.js'); WW_addScript('forms/j/field-type-signature.js'); break; // } // } case 'textarea': // { if (!$r2['extra']) { $r2['extra'] = '0,0'; } list($max, $softmax) = explode(',', $r2['extra']); $maxlength = $max ? 'maxlength="' . $max . '" ' : ''; $d = '<textarea ' . $maxlength . ' softmaxlength="' . $softmax . '"' . $help . ' id="' . $name . '" name="' . $name . '" class="' . $class . '">' . $_REQUEST[$name] . '</textarea>'; break; // } // } default: // { # input boxes, and anything which was not handled already $d = '<input id="' . $name . '" name="' . $name . '" value="' . $val . '" class="' . $class . ' text"' . $help . '/>'; // } } if (@$vars['forms_template'] && $vars['forms_template'] != ' ') { $vars['forms_template'] = str_replace('{{$' . $cnt . '}}', $d, $vars['forms_template']); $vars['forms_template'] = str_replace('{{$' . htmlspecialchars($r2['name']) . '}}', $d, $vars['forms_template']); } else { if ($table_break) { $c .= $vals_wrapper_end . $d . $vals_wrapper_start; } else { $c .= $vals_field_start . $r2['name']; if ($r2['isrequired']) { $c .= '<sup>*</sup>'; } $c .= $vals_field_middle . $d . $vals_field_end; } } $cnt++; } if (@$vars['forms_captcha_required']) { require_once SCRIPTBASE . 'ww.incs/recaptcha.php'; $row = $vals_2col_start . Recaptcha_getHTML() . $vals_2col_end; if (isset($vars['forms_template']) && $vars['forms_template']) { $vars['forms_template'] .= $vals_wrapper_start . $row . $vals_wrapper_end; } else { $c .= $row; } } if (@$vars['forms_template'] && $vars['forms_template'] != ' ') { $c .= $vars['forms_template']; } else { $c .= $vals_2col_start; } $c .= '<button class="submit __" lang-context="core">Submit Form</button>' . '<input type="hidden" name="funcFormInput" value="submit" />' . '<input type="hidden" name="requiredFields" value="' . join(',', $required) . '" />'; if (count($required)) { $c .= '<br /><span>' . __('* indicates required fields', 'core') . '</span>'; } if (!@$vars['forms_template'] || @$vars['forms_template'] == ' ') { $c .= $vals_2col_end . $vals_wrapper_end . '</div>'; $c = str_replace('<table></table>', '', $c); WW_addInlineScript('var form_rules=' . json_encode(Form_getValidationRules($vars, $form_fields)) . ';'); WW_addScript('forms/frontend/show.js'); $c .= '<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/' . 'jquery.validate.min.js"></script>'; } $helpType = (int) @$vars['forms_helpType']; $helpSelector = @$vars['forms_helpSelector']; $verifiedEmails = isset($_SESSION['forms_verified_emails']) ? json_encode($_SESSION['forms_verified_emails']) : '[]'; $c .= '<script defer="defer">var forms_helpType=' . $helpType . ',forms_helpSelector="' . $helpSelector . '",forms_verifiedEmails=' . $verifiedEmails . ';</script></form>'; if ($has_ccdate) { WW_addInlineScript('$("input.ccdate").datepicker({"dateFormat":"yy-mm"});'); } WW_addCSS('/ww.plugins/forms/forms.css'); return $c; }
/** * produce a HTML version of the product * * @param string $product the product to render * @param string $template multi-view product or single-view? * @param boolean $add_wrapper wrap in div.products-product before return * * @return string html of the product */ function render($product, $template = 'singleview', $add_wrapper = true) { global $DBVARS, $PAGEDATA; $GLOBALS['products_template_used'] = $template; if (isset($DBVARS['online_store_currency'])) { $csym = $DBVARS['online_store_currency']; } $smarty = Products_setupSmarty(); $smarty->assign('product', $product); $smarty->assign('product_id', $product->get('id')); $smarty->assign('_name', __FromJson($product->name)); $smarty->assign('_stock_number', $product->stock_number); if (!is_array(@$this->data_fields)) { $this->data_fields = array(); } $productVals = array(); foreach ($this->data_fields as $f) { $f->n = preg_replace('/[^a-zA-Z0-9\\-_]/', '_', $f->n); $val = $product->get($f->n); $required = @$f->r ? ' required' : ''; switch ($f->t) { case 'checkbox': // { $val = $val ? __('Yes') : __('No'); $smarty->assign($f->n, $val); break; // } // } case 'colour': // { if (@$f->u) { // user-definable WW_addScript('/j/mColorPicker/mColorPicker.js'); $h = '<input class="color-picker" ' . 'name="products_values_' . $f->n . '" ' . 'style="height:20px;width:20px;" ' . 'value="' . htmlspecialchars($val) . '" ' . 'data-text="hidden"/>' . '<style>#mColorPickerFooter,#mColorPickerImg{display:none}</style>'; WW_addInlineScript('$(".color-picker")' . '.mColorPicker({"imageFolder":"/j/mColorPicker/images/"});'); } else { $h = 'TODO'; } $smarty->assign($f->n, $h); break; // } // } case 'date': // { if (@$f->u) { // user-definable $smarty->assign($f->n, '<input class="product-field date ' . $f->n . $required . '" name="' . 'products_values_' . $f->n . '"/>'); $format = @$f->e ? $f->e : 'yy-mm-dd'; $y = date('Y'); WW_addInlineScript('$("input[name=products_values_' . $f->n . ']").datepicker({' . '"dateFormat":"' . $format . '",' . 'changeYear:true,changeMonth:true,yearRange:"1900:' . $y . '"' . '});'); WW_addInlineScript('$("input.hasDatepicker").each(function() {' . 'if (this.value!="") return;' . '$(this).datepicker("setDate", "+0");' . '});'); } else { $val = Core_dateM2H($val); $smarty->assign($f->n, $val); } break; // } // } case 'hidden': // { $smarty->assign($f->n, '<input type="hidden" name="products_values_' . $f->n . '" value="' . htmlspecialchars($val) . '"/>'); break; // } // } case 'selectbox': // { if (@$f->u) { $valid_entries = explode("\n", $val); foreach ($valid_entries as $k => $v) { $v = trim($v); if ($v == '') { unset($valid_entries[$k]); } else { $valid_entries[$k] = $v; } } if (!count($valid_entries)) { $valid_entries = explode("\n", $f->e); } $h = '<select name="products_values_' . $f->n . '" class="' . $required . '">'; $translateable = @$f->tr && 1; foreach ($valid_entries as $e) { $e = trim($e); if ($e == '' || !in_array($e, $valid_entries)) { continue; } $o = $e; $p = ''; if (strpos($e, '|') !== false) { $bits = explode('|', $e); $e = $bits[0]; $p = 'price="' . (int) $bits[1] . '"'; } $h .= '<option ' . $p . ' value="' . htmlspecialchars($o) . '"'; if ($translateable) { $h .= ' class="__"'; } $h .= '>' . htmlspecialchars($e) . '</option>'; } $h .= '</select>'; } else { $val = preg_replace('/\\|.*/', '', $val); $h = $val; } $smarty->assign($f->n, $h); break; // } // } case 'selected-image': // { $smarty->assign($f->n, '<input type="hidden" name="products_values_' . $f->n . '" ' . 'class="product-field ' . $f->n . $required . '"/>'); break; // } // } case 'textarea': // { textarea if (@$f->u) { $val = trim(preg_replace('/<[^>]*>/', '', $val)); $smarty->assign($f->n, '<textarea class="product-field ' . $f->n . $required . '" name="products_values_' . $f->n . '">' . htmlspecialchars($val) . '</textarea>'); } else { $smarty->assign($f->n, $val); } break; // } // } case 'user': // { $u = User::getInstance($val, false, false); $val = $u ? $u->get('name') : 'no name'; $smarty->assign($f->n, $val); break; // } // } default: // { everything else if (@$f->u) { $smarty->assign($f->n, '<input class="product-field ' . $f->n . $required . '" value="' . htmlspecialchars($val) . '" name="products_values_' . $f->n . '"/>'); } else { $smarty->assign($f->n, $val); } // } } $productVals[$f->n] = $val; $PAGEDATA->title = str_replace('{{$' . $f->n . '}}', $val, $PAGEDATA->title); } if (isset($PAGEDATA->vars['products_pagedescriptionoverride']) && $PAGEDATA->vars['products_pagedescriptionoverride']) { $desc = preg_replace('/<[^>]*>/', '', $productVals['description']); $desc = trim(preg_replace('/\\s+/m', ' ', $desc)); $PAGEDATA->description = substr($desc, 0, 153) . '...'; } if (isset($product->ean)) { $smarty->assign('_ean', $product->ean); } // { $_name, $_stock_number, $_ean $PAGEDATA->title = str_replace(array('{{$_name}}', '{{$_stock_number}}', '{{$_ean}}'), array($product->get('_name'), $product->get('_stock_number'), $product->vals['ean']), $PAGEDATA->title); // } $html = ''; if ($add_wrapper) { $classes = array('products-product'); if ($this->stock_control) { $classes[] = 'stock-control'; } $html .= '<div class="' . join(' ', $classes) . '" id="products-' . $product->get('id') . '">'; } $html .= $smarty->fetch(USERBASE . '/ww.cache/products/templates/types_' . $template . '_' . $this->id); if ($template == 'singleview') { $PAGEDATA->vars['header_html'] = (isset($PAGEDATA->vars['header_html']) ? $PAGEDATA->vars['header_html'] : '') . '<link rel="canonical" href="' . htmlspecialchars($product->getRelativeUrl()) . '" />'; if ($this->allow_comments) { $html .= Core_commentsShow('http://' . $_SERVER['HTTP_HOST'] . $product->getRelativeURL()); } } if ($add_wrapper) { $html .= '</div>'; } return $html; }
/** * show a registration form for creating a user * * @param string $error any error messages that need to be displayed * @param string $alert any messages that need to be displayed in popups * * @return string HTML of the form */ function Privacy_registrationShowForm($error = '', $alert = '') { global $PAGEDATA; /** * form validation array */ $validation = array(); $c = '<div id="userregistration"><em style="color:red" id="error"></em>'; if (isset($PAGEDATA->vars['userlogin_message_registration'])) { $c .= $PAGEDATA->vars['userlogin_message_registration']; } require_once SCRIPTBASE . 'ww.incs/recaptcha.php'; $c .= $error . '<form id="reg-form" class="userRegistrationBox" action="' . $GLOBALS['PAGEDATA']->getRelativeUrl() . '#userregistration" method="post"><table>' . '<tr><th>' . __('Name', 'core') . '</th>' . '<td><input type="text" name="name" value="' . htmlspecialchars(@$_REQUEST['name']) . '" /></td>' . '<th>' . __('Email', 'core') . '</th>' . '<td><input type="text" name="email" value="' . htmlspecialchars(@$_REQUEST['email']) . '" /></td></tr>' . '<tr><th>' . __('Preferred Password', 'core') . '</th>' . '<td><input name="pass1" type="password"/></td>' . '<th>' . __('Repeat Password', 'core') . '</th>' . '<td><input name="pass2" type="password"/></td' . '></tr><tr><td colspan="2">' . Recaptcha_getHTML() . '</td></tr></table>'; if (strlen(@$PAGEDATA->vars['privacy_extra_fields']) > 2) { $c .= '<table>'; $required = array(); $rs = json_decode($PAGEDATA->vars['privacy_extra_fields']); $cnt = 0; foreach ($rs as $r) { if (!$r->name || $r->type == 'hidden') { continue; } $name = preg_replace('/[^a-zA-Z0-9_]/', '', $r->name); $class = ''; if (isset($r->is_required) && $r->is_required) { $required[] = $name . ',' . $r->type; $class = ' required'; $validation['privacy_extras_' . $name] = array('required' => true); } if (isset($_REQUEST[$name])) { $_SESSION['privacys'][$name] = $_REQUEST[$name]; } $val = @$_REQUEST[$name]; if (!$val && isset($_SESSION['userdata']) && $_SESSION['userdata']) { switch ($name) { case 'Email': case '__ezine_subscribe': // { $val = $_SESSION['userdata']['email']; break; // } // } case 'FirstName': // { $val = preg_replace('/ .*/', '', $_SESSION['userdata']['name']); break; // } // } case 'Street': // { $val = $_SESSION['userdata']['address1']; break; // } // } case 'Street2': // { $val = $_SESSION['userdata']['address2']; break; // } // } case 'Surname': // { $val = preg_replace('/.* /', '', $_SESSION['userdata']['name']); break; // } // } case 'Town': // { $val = $_SESSION['userdata']['address3']; break; // } } } if (!isset($_REQUEST[$name])) { $_REQUEST[$name] = ''; } switch ($r->type) { case 'checkbox': // { $d = '<input type="checkbox" id="privacy_extras_' . $name . '" name="privacy_extras_' . $name . '"'; if ($_REQUEST[$name]) { $d .= ' checked="' . $_REQUEST[$name] . '"'; } $d .= ' class="' . $class . ' checkbox" />'; break; // } // } case 'ccdate': // { if ($_REQUEST[$name] == '') { $_REQUEST[$name] = date('Y-m'); } $d = '<input name="privacy_extras_' . $name . '" value="' . $_REQUEST[$name] . '" class="ccdate" />'; break; // } // } case 'date': // { if ($_REQUEST[$name] == '') { $_REQUEST[$name] = date('Y-m-d'); } $d = '<input name="privacy_extras_' . $name . '" value="' . $_REQUEST[$name] . '" class="date" />'; break; // } // } case 'email': // { $d = '<input id="privacy_extras_' . $name . '" name="privacy_extras_' . $name . '" value="' . $val . '" class="email' . $class . ' text" />'; if (isset($validation['privacy_extras_' . $name])) { $validation['privacy_extras_' . $name]['email'] = true; } else { $validation['privacy_extras_' . $name] = array('email' => true); } break; // } // } case 'url': // { $d = '<input id="privacy_extras_' . $name . '" name="privacy_extras_' . $name . '" value="" class="url' . $class . ' text" />'; if (isset($validation['privacy_extras_' . $name])) { $validation['privacy_extras_' . $name]['url'] = true; } else { $validation['privacy_extras_' . $name] = array('url' => true); } break; // } // } case 'file': // { $d = '<input id="privacy_extras_' . $name . '" name="privacy_extras_' . $name . '" type="file" />'; break; // } // } case 'hidden': // { $d = '<textarea id="privacy_extras_' . $name . '" name="privacy_extras_' . $name . '" class="' . $class . ' hidden">' . htmlspecialchars($r->extra) . '</textarea>'; break; // } // } case 'selectbox': // { $d = '<select id="privacy_extras_' . $name . '" name="privacy_extras_' . $name . '">'; $arr = explode("\n", htmlspecialchars($r->extra)); foreach ($arr as $li) { if ($_REQUEST[$name] == $li) { $d .= '<option selected="selected">' . rtrim($li) . '</option>'; } else { $d .= '<option>' . rtrim($li) . '</option>'; } } $d .= '</select>'; break; // } // } case 'textarea': // { $d = '<textarea id="privacy_extras_' . $name . '" name="privacy_extras_' . $name . '" class="' . $class . '">' . $_REQUEST[$name] . '</textarea>'; break; // } // } default: // { input boxes, and anything which was not handled already $d = '<input id="privacy_extras_' . $name . '" name="privacy_extras_' . $name . '" value="' . $val . '" class="' . $class . ' text" />'; // } } $c .= '<tr><th>' . htmlspecialchars($r->name); if (isset($r->is_required) && $r->is_required) { $c .= '<sup>*</sup>'; } $c .= "</th>\n\t<td>" . $d . "</td></tr>\n\n"; $cnt++; } $c .= '</table>'; if (count($required)) { $c .= '<br /><span>' . __('* indicates required fields', 'core') . '</span>'; } } if (@$PAGEDATA->vars['userlogin_terms_and_conditions']) { $c .= '<input type="checkbox" name="terms_and_conditions" /> <span>' . __('I agree to the <a href="javascript:userlogin_t_and_c()">' . 'terms and conditions</a>.', 'core') . '</span><br />'; $c .= '<script defer="defer">function userlogin_t_and_c(){$("<div>' . addslashes(str_replace(array("\n", "\r"), ' ', $PAGEDATA->vars['userlogin_terms_and_conditions'])) . '</div>").dialog({modal:true,width:"90%"});}</script>'; } if ($alert) { WW_addInlineScript('$(function(){$(\'<div>' . addslashes($alert) . '</div>\').dialog({modal:true});});'); } $c .= '<button id="registration-submit">' . __('Register', 'core') . '</button>' . '<input type="hidden" name="a" value="Register" /></form></div>'; /** * add jquery form validation */ WW_addScript('/j/validate.jquery.min.js'); $script = ' var options = ' . json_encode($validation) . '; $( "#reg-form" ).validate( options, function( message ){ $( "#userregistration em#error" ).html( message ); } ); '; WW_addInlineScript($script); $c .= '<style type="text/css">.error{ border:1px solid #600;' . 'background:#f99 }</style>'; return $c; }
} echo '>' . __('Yes') . '</option>'; echo '</select></td></tr>'; // } // { maintenance mode $script = '$(function(){ $("select[name=\'maintenance-mode\']").change(function(){ $(".maintenance-message").toggle(); }); $( "#add-ip" ).click( function( ){ var test=prompt("' . __('Please enter the IP Address') . '"); alert(test); }); });'; WW_addInlineScript($script); $display = ' style="display:none"'; echo '<tr><th>Enable maintenance mode</th><td> <select name="maintenance-mode"> <option value="No">' . __('No') . '</option> <option value="yes"'; if (@$DBVARS['maintenance-mode'] == 'yes') { echo ' selected="selected"'; $display = ''; } if (!isset($DBVARS['maintenance-mode-ips']) || $DBVARS['maintenance-mode-ips'] == '') { $DBVARS['maintenance-mode-ips'] = $_SERVER['REMOTE_ADDR']; } echo '>' . __('Yes') . '</option> </select></td></tr> <tr class="maintenance-message" ' . $display . '>
/** * show a content snippet * * @param array $vars array of parameters * * @return string contentsnippet */ function ContentSnippet_show($vars = null) { if (!is_array($vars) && @$vars->id) { $data = Core_cacheLoad('content_snippets', $vars->id . '-data'); if ($data === false) { $data = dbRow('select * from content_snippets where id=' . $vars->id, 'content'); $data['content'] = json_decode($data['content'], true); Core_cacheSave('content_snippets', $vars->id . '-data', $data); } if (!is_array($data['content']) || !count($data['content'])) { return '<p>' . __('This Content Snippet is not yet defined.') . '</p>'; } // { no sub-pages if (!$data['accordion']) { return '<div class="content-snippet">' . $data['content'][0]['html'] . '</div>'; } // } // { vertical accordion $id = 'cs-' . rand(); if ($data['accordion_direction'] == '0') { $script = ' function change_slide( ){ var active = $( "#' . $id . '" ).accordion( "option", "active" ); var total = $( ".accordion-h3" ).length; active = ( active + 1 ) % total; $( "#' . $id . '" ).accordion( "activate", active ); setTimeout( change_slide, 8000 ); } $( "#' . $id . '" ).accordion( { \'heightStyle\':\'content\', \'beforeActivate\': function( ){ clearTimeout( change_slide ); } } ); setTimeout( change_slide, 8000 ); '; WW_addInlineScript($script); $html = '<div id="' . $id . '">'; foreach ($data['content'] as $content) { $html .= '<h3 class="accordion-h3"><a href="#">' . htmlspecialchars($content['title']) . '</a></h3>'; $html .= '<div>' . $content['html'] . '</div>'; } $html .= '</div>'; return $html; } // } // { horizontal accordion WW_addScript('content-snippet/frontend/jquery.hrzAccordion.js'); WW_addCss('/ww.plugins/content-snippet/frontend/jquery.hrzAccordion.defaults.css'); $html = '<ul class="hrzAccordion" id="' . $id . '">'; $imgs = array(); if ($data['images_directory'] && file_exists(USERBASE . '/f' . $data['images_directory'])) { $dir = new DirectoryIterator(USERBASE . '/f' . $data['images_directory']); foreach ($dir as $file) { if ($file->isDot()) { continue; } $imgs[] = '/f' . $data['images_directory'] . '/' . $file->getFilename(); } } sort($imgs); $i = 0; foreach ($data['content'] as $content) { $html .= '<li><div class="handle">'; if (count($imgs) && isset($imgs[$i])) { $size = getimagesize(USERBASE . '/' . $imgs[$i]); $html .= '<img src="' . htmlspecialchars($imgs[$i]) . '" style="width:' . $size[0] . 'px;height:' . $size[1] . 'px" />'; } else { $html .= htmlspecialchars($content['title']); } $html .= '</div>'; $html .= $content['html'] . '</li>'; ++$i; } $html .= '</ul><script defer="defer">$(function(){$("#' . $id . '").hrzAccordion({handlePos' . 'ition:"left",cycle:true,cycleInterval:4000});});</script>'; return $html; return $data['accordion_direction']; // } } return '<p>' . __('This Content Snippet is not yet defined.') . '</p>'; }
/** * show the frontend of the blog * * @param object $PAGEDATA the page object * * @return string */ function Blog_frontend($PAGEDATA) { global $unused_uri; if (isset($_SESSION['userdata']['id'])) { // load SaorFM WW_addCSS('/j/jquery.saorfm/jquery.saorfm.css'); WW_addScript('/j/jquery.saorfm/jquery.saorfm.js'); } // { parameters $excerpts_per_page = (int) $PAGEDATA->vars['blog_excerpts_per_page']; if (!$excerpts_per_page) { $excerpts_per_page = 10; } // } $excerpts_offset = 0; $blog_author = 0; $links_prefix = $PAGEDATA->getRelativeURL(); $authors_per_page = 10; WW_addScript('blog'); if (isset($PAGEDATA->vars['blog_groupsAllowedToPost']) && $PAGEDATA->vars['blog_groupsAllowedToPost']) { WW_addInlineScript('var blog_groups=' . $PAGEDATA->vars['blog_groupsAllowedToPost'] . ';'); } if ($unused_uri) { if (preg_match('#page[0-9]+#', $unused_uri)) { $excerpts_offset = $excerpts_per_page * (int) preg_replace('#.*page([0-9]+).*#', '\\1', $unused_uri); } // { show specific article if (preg_match('#^[0-9]+/[0-9]+-[0-9]+-[0-9]+/[^/]+#', $unused_uri)) { require_once SCRIPTBASE . 'ww.plugins/blog/frontend/show-article.php'; return $PAGEDATA->render() . $c . @$PAGEDATA->vars['footer']; } // } if (preg_match('#^tags/#', $unused_uri)) { // { show list of tags if ($unused_uri == 'tags/') { require_once SCRIPTBASE . 'ww.plugins/blog/frontend/tags.php'; return $PAGEDATA->render() . $c . @$PAGEDATA->vars['footer']; } // } // { show list of excerpts specific to a tag $tagname = preg_replace('#^tags/([^/]*).*#', '\\1', $unused_uri); $links_prefix .= '/tags/' . $tagname; $tagsql = preg_replace('/[^a-zA-Z0-9]/', '_', $tagname); $entry_ids = array(); $rs = dbAll('select entry_id from blog_tags where tag like "' . $tagsql . '"'); foreach ($rs as $r) { $entry_ids[] = $r['entry_id']; } require_once SCRIPTBASE . 'ww.plugins/blog/frontend/excerpts.php'; return $PAGEDATA->render() . $c . @$PAGEDATA->vars['footer']; // } } // { show a page of excerpts if (preg_match('#page[0-9]+#', $unused_uri)) { $excerpts_offset = $excerpts_per_page * (int) preg_replace('#page([0-9]+).*#', '\\1', $unused_uri); require_once SCRIPTBASE . 'ww.plugins/blog/frontend/excerpts.php'; return $PAGEDATA->render() . $c . @$PAGEDATA->vars['footer']; } // } // { show list of a specific user's excerpts if (preg_match('#^[0-9]+#', $unused_uri)) { $blog_author = preg_replace('/^([0-9]+).*/', '\\1', $unused_uri); require_once SCRIPTBASE . 'ww.plugins/blog/frontend/excerpts.php'; return $PAGEDATA->render() . $c . @$PAGEDATA->vars['footer']; } // } if ($unused_uri == 'authors/') { require_once SCRIPTBASE . 'ww.plugins/blog/frontend/authors.php'; return $PAGEDATA->render() . $c . @$PAGEDATA->vars['footer']; } return $PAGEDATA->render() . $unused_uri . @$PAGEDATA->vars['footer']; } require_once SCRIPTBASE . 'ww.plugins/blog/frontend/excerpts.php'; return $PAGEDATA->render() . $c . @$PAGEDATA->vars['footer']; }
* * PHP version 5.2 * * @category None * @package None * @author Kae Verens <*****@*****.**> * @license GPL 2.0 * @link http://kvsites.ie/ */ if (!Core_isAdmin()) { Core_quit(); } // { links: add product, import products echo '<a href="plugin.php?_plugin=products&_page=products">' . __('List all products') . '</a> | <a href="plugin.php?_plugin=products&_page=products-edit">' . __('Add a Product') . '</a> | ' . '<a href="javascript:Core_screen(\'products\', \'js:Import\');">' . __('Import Products', 'core') . '</a>'; // } if (!dbOne('select id from products_types limit 1', 'id')) { echo '<em>' . __('You can\'t create a product until you have created a type.') . ' <a href="javascript:Core_screen(\'products\',\'js:Types\');">' . __('Click here to create a Product Type.') . '</a></em>'; return; } $rs = dbAll('select id from products limit 1'); if (!count($rs)) { echo '<em>' . __('No existing products.', 'core') . ' <a href="/ww.admin/plugin.php?_plugin=products&_page=products-edit">' . __('Add a Product') . '</a> ' . __('or', 'core') . ' <a href="javascript:Core_screen(\'products\', \'js:Import\');">' . __('Import Products', 'core') . '</a>'; return; } echo '<div id="products-wrapper"></div>' . '<select id="products-action"><option value="0"> -- </option>' . '<option value="1">' . __('Delete Selected') . '</option>' . '<option value="2">' . __('Set Disabled') . '</option>' . '<option value="3">' . __('Set Enabled') . '</option>' . '</select>'; $product_columns = array(); Core_trigger('extra-products-columns'); WW_addInlineScript('var extraProductColumns=' . json_encode($product_columns)); WW_addScript('/j/datatables-colvis-1.0.8/ColVis.min.js'); WW_addScript('products/admin/products.js'); WW_addCSS('/ww.plugins/products/admin/products.css');
* * @category None * @package None * @subpackage None * @author Kae Verens <*****@*****.**> * @license GPL Version 2 * @link www.kvweb.me */ $bits = explode('/', $unused_uri); $user_id = (int) $bits[0]; $date = $bits[1]; $titlelike = str_replace('-', '_', $bits[2]); $sql = 'select * from blog_entry where user_id=' . $user_id . ' and cast(cdate as date)' . '="' . addslashes($date) . '" and title like "' . addslashes($titlelike) . '"'; $r = dbRow($sql, 'blog_entry'); if (!$r) { $c = '<div class="blog-article-error">Error: article not found.</div>'; return; } $c = '<div class="blog-article-wrapper" id="blog-entry-' . $r['id'] . '">'; $c .= '<h1 class="blog-header">' . htmlspecialchars($r['title']) . '</h1>'; $user = User::getInstance($r['user_id']); $name = $user ? $user->name : 'unknown'; $c .= '<div class="blog-meta">' . '<span class="blog-author" data-uid="' . $r['user_id'] . '">' . $name . '</span>' . '<span class="blog-spacing"> ~ </span>' . '<span class="blog-date-published">' . Core_dateM2H($r['cdate']) . '</span>' . '</div>'; $c .= '<div class="blog-body">' . $r['body'] . '</div>'; $date = preg_replace('/ .*/', '', $r['cdate']); $c .= '</div>'; WW_addScript('blog'); WW_addInlineScript('window.blog_comments=0;'); if ($r['allow_comments']) { $c .= Core_commentsShow($PAGEDATA->getAbsoluteUrl() . '/' . $r['user_id'] . '/' . $date . '/' . preg_replace('/[^a-zA-Z0-9]/', '-', transcribe($r['title']))); }
// { Orders Directory echo '<tr><th>' . __('Orders Directory') . '</th>' . '<td><input name="online_store_vars[export_dir]" value="' . htmlspecialchars(dbOne('select val from online_store_vars where name="export_dir"', 'val')) . '" placeholder="' . '/f/orders"/></td></tr>'; // } // { Customers Directory echo '<tr><th>' . __('Customers Directory') . '</th><td>' . '<input name="online_store_vars[export_customers]" value="' . htmlspecialchars(dbOne('select val from online_store_vars where name="export_customers"', 'val')) . '" placeholder="' . '/f/customers"/></td></td></tr>'; // } // { Customers Filename echo '<tr><th>' . __('Customers Filename') . '</th>' . '<td><input name="online_store_vars[export_customer_filename]" value="' . htmlspecialchars(dbOne('select val from online_store_vars' . ' where name="export_customer_filename"', 'val')) . '"' . ' placeholder="customer-{{$Email}}.csv"/></td></tr>'; // } echo '</table></div>'; // } // { currencies echo '<h2>' . __('Currencies') . '</h2>' . '<div id="currencies">' . '<p>' . __('The top row is the default currency of the website.' . ' To change the default, please drag a different row to the top.') . '</p>' . '</div>'; // } // { discounts echo '<h2>' . __('Group discounts') . '</h2><div><table>'; $groups = dbAll('select * from groups order by name'); foreach ($groups as $group) { if ($group['meta'] == '') { $group['meta'] = '{}'; } $meta = json_decode($group['meta'], true); echo '<tr><th>' . htmlspecialchars($group['name']) . '</th><td>%' . '<input type="number" name="discounts[' . $group['id'] . ']" min="0" max="100" value="' . (double) @$meta['discount'] . '"/></td></tr>'; } echo '</table></div>'; // } echo '</div>'; echo '<input type="submit" name="action" value="Save" /></form>'; WW_addScript('online-store/admin/site-options.js'); WW_addInlineScript('window.os_currencies=' . $os_currencies . ';'); WW_addCSS('/ww.plugins/online-store/admin/site-options.css');
$h = $size[1]; if ($w > 240) { $w = $w * (240 / $w); $h = $h * (240 / $w); } if ($h > 172) { $w = $w * (172 / $h); $h = $h * (172 / $h); } echo '<img src="/ww.skins/' . htmlspecialchars($file) . '/screenshot.png" width="' . floor($w) . '" height="' . floor($h) . '" /><br />' . '<strong>', htmlspecialchars($file), '</strong><br />'; if (is_dir($DBVARS['theme_dir'] . '/' . $file . '/cs')) { $dir2 = new DirectoryIterator($DBVARS['theme_dir'] . '/' . $file . '/cs'); echo 'variant: <select name="theme_variant">'; foreach ($dir2 as $file2) { if ($file2->isDot()) { continue; } $file2 = preg_replace('/\\.css$/', '', $file2); $sel = isset($DBVARS['theme_variant']) && $file2 == $DBVARS['theme_variant'] ? ' selected="selected"' : ''; echo '<option', $sel, '>', htmlspecialchars($file2), '</option>'; } echo '</select>'; } echo '<br /><input type="submit" value="set theme" /></form></div>'; } if ($themes_found == 0) { echo '<em>No themes found. Download a theme and unzip it into the ' . '/ww.skins/ directory.</em>'; } echo '<br style="clear:both" /></div>'; WW_addInlineScript('$(function(){$(".tabs").tabs()})'); // }
/** * frontend of the classified ads thing * * @param object $PAGEDATA the page object * * @return html */ function ClassifiedAds_frontend($PAGEDATA) { global $unused_uri; $html = $PAGEDATA->render(); $bits = false; if ($unused_uri == '') { $cid = 0; } else { $bits = explode('/', preg_replace('/\\/$/', '', $unused_uri)); $cid = ClassifiedAds_getCategoryId($bits); } $sql = 'select name from classifiedads_categories where id=' . $cid; WW_addInlineScript('var classifiedads_categoryId=' . $cid . ', classifiedads_categoryName="' . addslashes(dbOne($sql, 'name')) . '"' . ', classifiedads_paypal="' . $PAGEDATA->vars['classified-ads-paypal'] . '";'); $html = '<div id="classifiedads-wrapper">'; // { breadcrumbs if ($bits) { $html .= '<div class="breadcrumbs">' . ClassifiedAds_getBreadcrumbs($PAGEDATA, $bits); if ($cid) { $html .= ' <span class="divider">»</span>' . ' <button class="classifiedads-advertise-button">' . 'Advertise Here</button>'; WW_addScript('classified-ads/frontend/advertise.js'); } $html .= '</div>'; } // } if ($bits && preg_match('/^[0-9]+-.*/', $bits[count($bits) - 1])) { $ad_id = (int) preg_replace('/[^0-9].*/', '', $bits[count($bits) - 1]); $ad = ClassifiedAds::get($ad_id); $html .= '<div id="classifiedads-single">' . '<h2>' . htmlspecialchars($ad['title']) . '</h2>' . '<table id="classifiedads-ad-details"><tr>' . '<td class="classifiedads-creation-date">Posted: ' . Core_dateM2H($ad['creation_date']) . '</td>' . '<td class="classifiedads-location">Location: ' . htmlspecialchars($ad['location']) . '</td>' . '<td class="classifiedads-cost">Cost: €' . htmlspecialchars($ad['cost']) . '</td></tr></table>'; $images = array(); $dir = '/userfiles/' . $ad['user_id'] . '/classified-ads/' . $ad['id']; if (file_exists(USERBASE . '/f' . $dir)) { $files = new DirectoryIterator(USERBASE . '/f' . $dir); foreach ($files as $f) { if ($f->isDot() || $f->isDir()) { continue; } $images[] = '<a href="/f' . $dir . '/' . $f->getFilename() . '" target="popup">' . '<img src="/a/f=getImg/w=128/h=128' . $dir . '/' . $f->getFilename() . '"' . ' style="max-width:128px;max-height:128px"/></a>'; } } $html .= '<p class="classified-ads-body">' . nl2br(htmlspecialchars($ad['body'])) . '</p>' . join('', $images); $html .= '<table class="classifiedads-contact"><tr>'; if ($ad['phone']) { $html .= '<td>Phone: ' . htmlspecialchars($ad['phone']) . '</td>'; } /* if ($ad['email']) { $html.='<td>Email: <a href="#" class="classified-ads-email"' .' data-ad-id="'.$ad['id'].'">click to send</a></td>'; } */ $html .= '</tr></table>'; $html .= '</div>'; } else { // show sub-categories and ads // { sub-categories $subcats = dbAll('select id, icon, name from classifiedads_categories where parent=' . $cid . ' order by name'); if (count($subcats)) { $html .= '<div id="classifiedads-subcats">' . '<h2>Categories</h2><ul>'; foreach ($subcats as $cat) { $url = ClassifiedAds_getCategoryUrl($cat['id']); $html .= '<li>' . '<a href="' . $url . '">'; if ($cat['icon']) { $html .= '<img src="/a/f=getImg/' . $cat['icon'] . '/w=32/h=32"/>'; } $html .= htmlspecialchars($cat['name']); $html .= '</a></li>'; } $html .= '</div>'; } // } // { ads $subcatsRecursive = ClassifiedAds_getCategoryIdsRecursive($cid); $ads = ClassifiedAds::getByCategories($subcatsRecursive); $html .= '<table id="classifiedads-ads">' . '<thead><tr><th colspan="2">Title</th><th>Location</th><th>Posted</th>' . '<th>Price</th></tr></thead><tbody>'; $today = date('Y-m-d'); foreach ($ads as $ad) { if ($ad['expiry_date'] < $today) { dbQuery('delete from classifiedads_ad where id=' . $ad['id']); Core_cacheClear('classifiedads_ad'); continue; } $url = ClassifiedAds_getCategoryUrl($ad['category_id']) . '/' . $ad['id'] . '-' . preg_replace('/[^a-z0-9A-Z]/', '-', $ad['title']); $img = ''; $adDir = '/userfiles/' . $ad['user_id'] . '/classified-ads/' . $ad['id']; $dir = USERBASE . '/f' . $adDir; if (file_exists($dir)) { $files = new DirectoryIterator($dir); foreach ($files as $f) { if (!$f->isDot()) { $img = '<img style="max-width:64px;max-height:64px;" src="/a/f=getImg/w=64/h=64' . $adDir . '/' . $f->getFilename() . '"/>'; break; } } } $html .= '<tr class="ad-top-details"><td rowspan="2">' . $img . '</td><td><a href="' . $url . '">' . htmlspecialchars($ad['title']) . '</a></td>' . '<td class="location">' . htmlspecialchars($ad['location']) . '</td>' . '<td class="posted">' . Core_dateM2H($ad['creation_date']) . '</td>' . '<td class="price">€' . htmlspecialchars($ad['cost']) . '</td>' . '</tr><tr class="ad-bottom-details">' . '<td colspan="4">' . $ad['excerpt'] . '</td></tr>'; } $html .= '</tbody></table>'; // } } $html .= '</div>'; $html .= @$PAGEDATA->vars['footer']; WW_addCSS('/ww.plugins/classified-ads/frontend/style.css'); WW_addScript('/j/uploader.js'); return $html; }
$options = '<option value=""> -- ' . __('Choose') . ' -- </option>'; foreach ($relations as $r) { $options .= '<option value="' . $r['id'] . '"'; if ($r['id'] == $relation['id']) { $options .= ' selected="selected"'; } $options .= '>' . htmlspecialchars($r['name']) . '</option>'; } foreach ($ps as $p) { echo '<tr><td><select name="product-relations-type[]">' . $options . '</select></td><td><select class="products-relations-product"' . ' name="products-relations-product[]">' . '<option value="' . $p['to_id'] . '">'; echo htmlspecialchars(__FromJson(dbOne('select name from products where id=' . $p['to_id'], 'name'))) . '</option></select></td></tr>'; } } echo '<tr><td><select name="product-relations-type[]">' . '<option value=""> -- ' . __('Choose') . ' -- </option>'; foreach ($relations as $relation) { echo '<option value="' . $relation['id'] . '">' . htmlspecialchars($relation['name']) . '</option>'; } echo '</select></td>' . '<td><select class="products-relations-product"' . ' name="products-relations-product[]">' . '<option value=""> -- ' . __('Choose') . ' -- </option></select>'; WW_addScript('products/admin/products-edit-related.js'); echo '</td></tr></table></div>'; } // } // { end form and tabs echo '</div><input type="submit" value="' . __('Save') . '" /></form>'; // } WW_addScript('products/admin/products-edit.js'); WW_addScript('products/admin/create-page.js'); WW_addScript('products/admin/add-category.js'); WW_addCss('/ww.plugins/products/admin.css'); WW_addInlineScript('$(function(){' . '$("#onTheFlyParent").remoteselectoptions({' . 'url:"/a/p=products/f=adminCategoriesGetRecursiveList"' . '})' . '})');
/** * show the purchase page for Ads * * @param object $PAGEDATA the page object * * @return string */ function Ads_frontend($PAGEDATA) { if (preg_match('/show-all-ads$/', $_SERVER['REQUEST_URI'])) { require_once SCRIPTBASE . 'ww.plugins/ads/frontend/show-all-ads.php'; return $html; } else { $html = '<div id="ads-purchase-wrapper"></div>'; WW_addInlineScript('var ads_paypal="' . addslashes($PAGEDATA->vars['ads-paypal']) . '";'); WW_addScript('ads/j/purchase2.js'); WW_addScript('/j/uploader.js'); WW_addCss('/ww.plugins/ads/css.css'); return $PAGEDATA->render() . $html . @$PAGEDATA->vars['footer']; } }
$txt = isset($PAGEDATA->vars['online_stores_proceedToPayment']) ? $PAGEDATA->vars['online_stores_proceedToPayment'] : 'Proceed to Payment'; if ($pviewtype == 1 && $viewtype == 1 || !$pviewtype) { $c .= '<form method="post">' . $PAGEDATA->render() . '<input type="hidden" name="viewtype" value="1"/>' . '<input type="hidden" name="action" value="Proceed to Payment" />' . '<button>' . __($txt, 'core') . '</button>' . '</form>'; } else { if ($pviewtype == 2 || $pviewtype == 3) { $c .= '<div id="online-store-wrapper" class="online-store"></div>'; } else { $c .= '<form method="post" action="' . $PAGEDATA->getRelativeUrl() . '">' . '<input type="hidden" name="viewtype" value="1"/>' . '<button class="onlinestore-view-checkout __" lang-context="core">' . __('Checkout', 'core') . '</button></form>'; } } // } // { add scripts // { set up variables $post = $_POST; unset($post['action']); $postage = dbOne('select value from page_vars where page_id=' . $PAGEDATA->id . ' and ' . 'name="online_stores_postage"', 'value'); if (!$postage) { $post['_pandp'] = 0; } else { $post['_pandp'] = count(json_decode($postage)); } $post['os_pandp'] = isset($_SESSION['os_pandp']) ? (int) $_SESSION['os_pandp'] : 0; // } WW_addInlineScript('var os_post_vars=' . json_encode($post) . ', os_userRegWithoutVerification=' . (int) (@$PAGEDATA->vars['online_stores_user_reg_no_verify'] == 'on') . ';'); WW_addScript('online-store'); // } } else { $c .= '<em>' . __('No items in your basket', 'core') . '</em>'; } } // }
foreach ($rs as $r) { echo '<input type="checkbox" ' . 'name="page_vars[restrict_to_groups][' . $r['id'] . ']"'; if (isset($restrict_to->{$r}['id'])) { echo ' checked="checked"'; } echo ' />' . htmlspecialchars($r['name']) . '<br />'; } echo '</td></tr>'; // } // { allow non-logged-in readers to view the page if they know a password if (!isset($page_vars['privacy_password'])) { $page_vars['privacy_password'] = ''; } echo '<tr><th>Allow non-logged-in readers to view the page if they enter ' . 'this password:</th>' . '<td><input name="page_vars[privacy_password]" value="' . htmlspecialchars($page_vars['privacy_password']) . '" /></td></tr>'; // } // { redirect to echo '<tr><th>If a visitor is not logged in, redirect them to:</th>' . '<td><select id="page_vars_non_logged_in_redirect"' . ' name="page_vars[non_logged_in_redirect_to]">'; if (@$page_vars['non_logged_in_redirect_to']) { $redirect = Page::getInstance($page_vars['non_logged_in_redirect_to']); if ($redirect->id) { echo '<option value="' . $redirect->id . '">' . htmlspecialchars($redirect->name) . '</option>'; } } else { echo '<option value="0"> -- none -- </option>'; } echo '</td></tr>'; WW_addInlineScript('$(function(){' . '$("#page_vars_non_logged_in_redirect").remoteselectoptions({' . 'url:"/a/f=adminPageParentsList"' . '})' . '})'); // } echo '</table>'; // } WW_addScript('privacy/admin/privacy_show_page_panel.js');
/** * get HTML for building a hierarchical menu * * @param array $opts options * * @return string the html */ function Core_menuShowFg($opts = array()) { if (!function_exists('menuBuildFg')) { // menuBuildFg /** * get recursive details of pages to build a menu * * @param int $parentid the parent's ID * @param int $depth current menu depth * @param array $options any further options * * @return string HTML of the sub-menu */ function menuBuildFg($parentid, $depth, $options) { $PARENTDATA = Page::getInstance($parentid)->initValues(); // { menu order $order = 'ord,name'; if (isset($PARENTDATA->vars['order_of_sub_pages'])) { switch ($PARENTDATA->vars['order_of_sub_pages']) { case 1: // { alphabetical $order = 'name'; if ($PARENTDATA->vars['order_of_sub_pages_dir']) { $order .= ' desc'; } break; // } // } case 2: // { associated_date $order = 'associated_date'; if ($PARENTDATA->vars['order_of_sub_pages_dir']) { $order .= ' desc'; } $order .= ',name'; break; // } // } default: // { by admin order $order = 'ord'; if ($PARENTDATA->vars['order_of_sub_pages_dir']) { $order .= ' desc'; } $order .= ',name'; break; // } } } // } $sql = "select id,name,type from pages where parent='" . $parentid . "' and !(special&2) order by {$order}"; $md5 = md5($sql); $rs = Core_cacheLoad('pages', $md5, -1); if ($rs === -1) { $rs = dbAll($sql); Core_cacheSave('pages', $md5, $rs); } if ($rs === false || !count($rs)) { return ''; } $items = array(); foreach ($rs as $r) { $item = '<li>'; $page = Page::getInstance($r['id'])->initValues(); $item .= '<a class="menu-fg menu-pid-' . $r['id'] . '" href="' . $page->getRelativeUrl() . '">' . htmlspecialchars(__FromJson($page->name)) . '</a>'; // { override menu if a trigger causes the override $submenus = Core_trigger('menu-subpages-html', array($page, $depth + 1, $options)); if ($submenus) { $item .= $submenus; } else { $item .= menuBuildFg($r['id'], $depth + 1, $options); } // } $item .= '</li>'; $items[] = $item; } $options['columns'] = (int) $options['columns']; // { return top-level menu if (!$depth) { return '<ul>' . join('', $items) . '</ul>'; } // } $s = ''; if ($options['style_from'] == '1') { if ($options['background']) { $s .= 'background:' . $options['background'] . ';'; } if ($options['opacity']) { $s .= 'opacity:' . $options['opacity'] . ';'; } if ($s) { $s = ' style="' . $s . '"'; } } // { return 1-column sub-menu if ($options['columns'] < 2) { return '<ul' . $s . '>' . join('', $items) . '</ul>'; } // } // { return multi-column submenu $items_count = count($items); $items_per_column = ceil($items_count / $options['columns']); $c = '<table' . $s . '><tr><td><ul>'; for ($i = 1; $i < $items_count + 1; ++$i) { $c .= $items[$i - 1]; if ($i != $items_count && !($i % $items_per_column)) { $c .= '</ul></td><td><ul>'; } } $c .= '</ul></td></tr></table>'; return $c; // } } } global $_languages; $c = ''; $options = array('direction' => 0, 'parent' => 0, 'background' => '', 'columns' => 1, 'opacity' => 0, 'type' => 0, 'style_from' => 1, 'state' => 0); foreach ($opts as $k => $v) { if (isset($options[$k])) { $options[$k] = $v; } } if (!is_numeric($options['parent'])) { $r = Page::getInstanceByName($options['parent']); if ($r) { $options['parent'] = $r->id; } } if (is_numeric($options['direction'])) { if ($options['direction'] == '0') { $options['direction'] = 'horizontal'; } else { $options['direction'] = 'vertical'; } } $options['type'] = (int) $options['type']; $items = array(); if (!isset($GLOBALS['fg_menus'])) { $GLOBALS['fg_menus'] = 0; } $menuid = $GLOBALS['fg_menus']++; $md5 = md5($options['parent'] . '|0|' . json_encode($options) . '|' . join(', ', $_languages)); $html = menuBuildFg($options['parent'], 0, $options); switch ($options['type']) { case 2: // { tree $c .= '<div class="menu-tree">' . $html . '</div>'; break; // } // } case 1: // { accordion WW_addScript('/j/menu-accordion/menu.js'); WW_addCSS('/j/menu-accordion/menu.css'); $class = $options['state'] == 0 ? ' contracted' : ($options['state'] == 1 ? ' expanded' : ' expand-selected'); $c .= '<div class="menu-accordion' . $class . '">' . $html . '</div>'; break; // } // } default: // { fly-out WW_addScript('/j/fg.menu/fg.menu.js'); WW_addCSS('/j/fg.menu/fg.menu.css'); $c .= '<div class="menu-fg menu-fg-' . $options['direction'] . '" id="menu-fg-' . $menuid . '">' . $html . '</div>'; if ($options['direction'] == 'vertical') { $posopts = "positionOpts: { posX: 'left', posY: 'top'," . "offsetX: 40, offsetY: 10, directionH: 'right', directionV: 'down'," . "detectH: true, detectV: true, linkToFront: false },"; } else { $posopts = ''; } WW_addInlineScript("\$(function(){ \$('#menu-fg-{$menuid}>ul>li>a').each(function(){ \$(this)" . ".fgmenu({ content:\$(this).next().outerHTML(), choose:function(ev,ui" . "){ document.location=ui.item[0].childNodes(0).href; }, {$posopts} fly" . "Out:true }); }); \$('.menu-fg>ul>li').addClass('fg-menu-top-level');" . "});"); break; // } } return $c; }
function forum_user_profile($PAGEDATA, $user) { $script = '$(function(){$(".rating").ratings();}); '; WW_addScript('ratings/ratings.js'); WW_addInlineScript($script); $threads = dbOne('select count(id) from forums_threads where creator_id=' . $user['id'], 'count(id)'); $posts = dbOne('select count(id) from forums_posts where author_id=' . $user['id'], 'count(id)'); $emailHash = md5(trim(strtolower($user['email']))); $html = '<h1>Forum</h1> <table style="border:1px solid #ccc;margin:10px"> <tr> <td rowspan="3"> <img class="avatar" data-uid="' . $user['id'] . '"/> </td> <th>Threads Created:</th> <td>' . $threads . '</tr> </tr> <tr> <th>Posts:</th> <td>' . $posts . '</td> </tr> <tr> <th>Helpfulness Rating:</th> <td><p id="forum_user_' . $user['id'] . '" class="rating" type="forum_user">rating</p></td> </tr> </table>'; $recent = dbAll('select * from forums_posts where author_id=' . $user['id'] . ' order by created_date desc limit 4'); $ids = array(); foreach ($recent as $post) { if (!in_array($post['thread_id'], $ids)) { array_push($ids, $post['thread_id']); } } $threads = dbAll('select * from forums_threads where id=' . implode(' or id=', $ids)); $html .= '<h1>Forum - Your Recent Posts</h1> <table style="border:1px solid #ccc;margin:10px"> <tr> <th>Thread</th> <th>Date</th> <th>Post</th> </tr>'; foreach ($recent as $post) { foreach ($threads as $thread) { if ($thread['id'] == $post['thread_id']) { $thread_id = $thread['id']; $name = $thread['name']; $forum = $thread['forum_id']; break; } } $pagename = dbOne('select name from pages where id=(select page_id from forums where id=1)', 'name'); $link = '/_r?type=forum&forum-f=' . $forum . '&forum-t=' . $thread_id; $html .= '<tr> <td><a href="' . $link . '">' . $name . '</a></td> <td>' . Core_dateM2H($post['created_date']) . '</td> <td>' . substr($post['body'], 0, 40) . ' [...]</td> </tr>'; } $html .= '</table>'; return $html; }
echo '<input type="checkbox" name="special[' . $i . ']"'; if ($page['special'] & pow(2, $i)) { echo ' checked="checked"'; } echo '/>' . __($specials[$i]) . '<br />'; } } // } echo '</td></tr></table></div>'; // } // { tabs added by plugins foreach ($PLUGINS as $n => $p) { if (isset($p['admin']['page_panel'])) { echo '<div id="' . $p['admin']['page_panel']['name'] . '">'; $p['admin']['page_panel']['function']($page, $page_vars); echo '</div>'; } } // } // { form footer echo '</div>'; echo '<input type="hidden" name="action" value="Update Page Details"/>'; echo '<div id="submit-row"><input id="pages-submit" type="submit" value="' . __('Update Page Details') . '"/></div>'; echo '</form>'; // } // { page footer WW_addInlineScript('this.page_menu_currentpage=' . $id . ';this.sessid="' . session_id() . '";' . 'this.user_id=' . $_SESSION['userdata']['id'] . ';' . 'this.userdata={wasAdmin:1}'); echo WW_getScripts(); echo WW_getCss(); // } echo '<div style="float:right">pageid: ' . $id . '</div></body></html>';
/** * display a specific thread * * @param object &$PAGEDATA the page object * @param int &$id the thread's ID * * @return string HTML of the forum creation tool */ function Forum_showThread(&$PAGEDATA, &$id) { require_once SCRIPTBASE . 'ww.incs/bb2html.php'; WW_addCSS('/ww.plugins/forum/frontend/forum.css'); $script = '$(function(){$(".ratings").ratings();});'; WW_addScript('ratings/ratings.js'); WW_addInlineScript($script); $thread = dbRow('select * from forums_threads where id=' . $id); $forum_id = $thread['forum_id']; if (!$thread || !count($thread)) { return '<em class="error">Error: this thread does not exist!</em>'; } $c = Forum_getForumBreadcrumbs($PAGEDATA, $thread['forum_id']) . ' » <a href="' . $PAGEDATA->getRelativeUrl() . '?forum-f=' . $forum_id . '&forum-t=' . $id . '">' . htmlspecialchars($thread['name']) . '</a>'; $c .= '<table id="forum-posts"><tr><th>Author</th><th>Post</th></tr>'; $posts = dbAll('select * from forums_posts where thread_id=' . $id . ' and moderated = 1 order by created_date'); foreach ($posts as $post) { $user = User::getInstance($post['author_id']); if ($user) { $user_name = $user->get('name'); $user_id = $post['author_id']; $user_email = $user->get('email'); } else { $user_name = 'unknown'; $user_id = 0; $user_email = ''; } $c .= '<tr p-data=\'({"id":' . $post['id'] . ',"cdate":"' . $post['created_date'] . '"' . ',"uid":' . $post['author_id'] . '})\'>' . '<td class="user-details"><a name="forum-c-' . $post['id'] . '"></a>' . htmlspecialchars($user_name) . '</td>' . '<td><div class="post-header">Posted: ' . Core_dateM2H($post['created_date'], 'datetime') . '</div></td></tr>'; $count_posts = $user_id ? dbOne('select count(id) from forums_posts where author_id=' . $user->get('id'), 'count(id)') : 0; $emailHash = md5(trim(strtolower($user_email))); $c .= '<tr><td><img class="avatar" data-uid="' . $user_id . '" />' . '<span>Posts: ' . $count_posts . '</span>' . '<p>Helpfulness:' . '<span class="ratings" id="forum_user_' . $user_email . '"' . ' type="forum_user">rating</span></p>'; $c .= '</td><td class="post">' . bb2html($post['body']) . '</td></tr>'; } $c .= '</table>'; // { post form if (isset($_SESSION['userdata']) && $_SESSION['userdata']['id']) { $c .= '<div id="forum-post-submission-form"><script defer="defer">var forum_id=' . $forum_id . ',forum_thread_id=' . $id . ';</script></div>'; WW_addScript('//cdn.ckeditor.com/4.4.3/standard/ckeditor.js'); WW_addScript('//cdn.ckeditor.com/4.4.3/standard/adapters/jquery.js'); WW_addScript('forum/frontend/forum.js'); } else { $c .= '<div class="forum-not-logged-in">In order to post to this thread,' . ' you must <a href="/_r?type=loginpage">login' . '</a> first.</div>'; } // } return $c; }
WW_addScript('/j/datatables-delay.js'); WW_addCSS('//cdn.datatables.net/1.10.2/css/jquery.dataTables.min.css'); // } echo '<!doctype html> <html><head><title>' . __('WebME admin area') . '</title>'; foreach ($PLUGINS as $pname => $p) { if (file_exists(SCRIPTBASE . '/ww.plugins/' . $pname . '/admin/admin.css')) { WW_addCSS('/ww.plugins/' . $pname . '/admin/admin.css'); } } echo WW_getCSS(); echo Core_getJQueryScripts() . '<script src="/js/' . filemtime(SCRIPTBASE . 'j/js.js') . '"></script>'; WW_addInlineScript('var sessid="' . session_id() . '";'); WW_addScript('/j/fg.menu/fg.menu.js'); // { languages $sql = 'select code,name from language_names order by is_default desc,code,name'; $langs = dbAll($sql, '', 'language_names'); echo '<script>var languages=' . json_encode($langs) . ';</script>'; // } WW_addScript('/j/jstree/jquery.jstree.js'); WW_addScript('/j/jstree/_lib/jquery.cookie.js'); WW_addInlineScript('$.jstree._themes="/j/jstree/themes/";'); echo '</head><body'; echo '><div id="header"></div>'; echo Core_languagesGetUi(array('type' => 'selectbox')); // { if maintenance mode is enabled show warning if (@$DBVARS['maintenance-mode'] == 'yes') { echo '<div id="maintenance"><em>' . __('Maintenance Mode is currently enabled which means that only' . ' administrators can view the frontend of this website.' . ' Click <a href="siteoptions.php">here</a> to disable it.') . '</em></div><style type="text/css">.pages_iframe{ top:130px!important;}' . '</style>'; } // } echo '<div id="wrapper"><div id="main">';
<?php $html = '<div id="issuetracker-wrapper"></div>'; if (isset($PAGEDATA->vars['issue_tracker_see_all'])) { WW_addInlineScript('var it_see_all=' . $PAGEDATA->vars['issue_tracker_see_all'] . ';'); } if (isset($PAGEDATA->vars['issue_tracker_edit_all'])) { WW_addInlineScript('var it_edit_all=' . $PAGEDATA->vars['issue_tracker_edit_all'] . ';'); } WW_addScript('issue-tracker/str.js'); WW_addScript('issue-tracker/js.js'); WW_addScript('/j/uploader.js'); // { datatables WW_addScript('http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/' . 'jquery.dataTables.min.js'); WW_addCSS('http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/' . 'jquery.dataTables.css'); WW_addCSS('http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/' . 'jquery.dataTables_themeroller.css'); // }
/** * show the ImageGallery widget * * @param array $vars parameters * * @return html */ function GalleryWidget_show($vars) { if (!isset($vars->id) || !$vars->id) { return ''; } $id = $vars->id; // { get data from widget db $vars = dbRow('select * from image_gallery_widget where id="' . $id . '"'); // } // { check to see if there are files in the directory $hasImages = false; $dirname = USERBASE . '/f/' . $vars['directory']; if (file_exists($dirname)) { $dir = new DirectoryIterator($dirname); foreach ($dir as $file) { if ($file->isDot()) { continue; } $hasImages = true; break; } } // } if ($hasImages) { // { if template doesn't exist, create it $template = USERBASE . '/ww.cache/image-gallery-widget/'; @mkdir($template, 0777, true); $template .= $id; if (!file_exists($template)) { if (!$vars['gallery_type']) { $vars['gallery_type'] = 'grid'; } $thtml = file_get_contents(SCRIPTBASE . 'ww.plugins/image-gallery/admin/types/' . strtolower($vars['gallery_type']) . '.tpl'); if (!$thtml) { $thtml = file_get_contents(dirname(__FILE__) . '/../admin/types/list.tpl'); } file_put_contents($template, $thtml); } // } // { display the template require_once SCRIPTBASE . 'ww.incs/vendor/Smarty-3.1.19/libs/Smarty.class.php'; require_once SCRIPTBASE . 'ww.plugins/image-gallery/frontend/template-functions.php'; $smarty = new Smarty(); $smarty->compile_dir = USERBASE . '/ww.cache/templates_c'; @mkdir(USERBASE . '/ww.cache/templates_c'); @mkdir(USERBASE . '/ww.cache/templates_c/image-gallery-widget'); $smarty->registerPlugin('function', 'GALLERY_IMAGE', 'ImageGallery_templateImage'); $smarty->registerPlugin('function', 'GALLERY_IMAGES', 'ImageGallery_templateImages'); $smarty->left_delimiter = '{{'; $smarty->right_delimiter = '}}'; $c .= $smarty->fetch($template); // { quick hack to add the options rather than // writing a whole new function in php $script = ' Gallery.options.directory="' . (int) $vars['directory'] . '"; Gallery.options.thumbsize=' . (int) $vars['thumbsize'] . '; Gallery.options.imageWidth=' . (int) $vars['image_size'] . '; Gallery.options.imageHeight=' . (int) $vars['image_size'] . '; Gallery.gallery() .attr("cols","' . $vars['columns'] . '") .attr("rows","' . $vars['rows'] . '"); '; // } WW_addScript('image-gallery/frontend/gallery.js'); WW_addInlineScript($script); WW_addCSS('/ww.plugins/image-gallery/frontend/gallery.css'); // } return $c; } else { $dir = $vars['directory']; return '<em>' . __('gallery "%1" not found or empty.', array($dir), 'core') . '</em>'; } }
/** * show the image transition * * @param array $vars array of variables * * @return HTML of the widget */ function ImageTransition_show($vars) { global $cdnprefix; if (!is_array($vars) && isset($vars->id) && $vars->id) { $r = Core_cacheLoad('image-transitions', 'id' . $vars->id); if ($r === false) { $r = dbRow('select * from image_transitions where id=' . $vars->id); Core_cacheSave('image-transitions', 'id' . $vars->id, $r); } if ($r && is_array($r)) { $width = (int) $r['width']; $height = (int) $r['height']; $imgs = array(); $dir = USERBASE . '/f' . $r['directory']; if (!file_exists($dir) || !is_dir($dir)) { return '<!-- ' . $dir . ' -->'; } $fs = new DirectoryIterator($dir); $max = array($width, $height); foreach ($fs as $f) { if ($f->isDot() || !preg_match('/\\.(jpg|.jpeg|png|gif)$/i', $f->getFilename())) { continue; } list($iw, $ih) = getimagesize(USERBASE . '/f' . $r['directory'] . '/' . $f->getFilename()); if (!$iw || !$ih) { // not an image continue; } if (!$width) { // no size predefined if ($iw > $max[0]) { $max[0] = $iw; } if ($ih > $max[1]) { $max[1] = $ih; } } $imgs[] = $f->getFilename(); } $width = $max[0]; $height = $max[1]; asort($imgs); if (!count($imgs)) { return '<em>' . __('No images in selected directory.') . '</em>'; } $html = ''; if ($r['trans_type'] == '3dCarousel') { $html .= '<div id="k3dCarousel' . $vars->id . '" style="height:' . ($height + 30) . 'px"><img style="display:none" src="' . $cdnprefix . '/a/f=getImg/w=' . $width . '/h=' . $height . $r['directory'] . '/' . join('" /><img style="display:none" src="' . $cdnprefix . '/a/f=getImg/w=' . $width . '/h=' . $height . $r['directory'] . '/', $imgs) . '" />'; $html .= '</div>'; WW_addScript('/ww.plugins/image-transition/frontend/k3dCarousel/' . 'jquery.k3dCarousel.js'); WW_addInlineScript('$(window).load(function(){' . '$("#k3dCarousel' . $vars->id . '").k3dCarousel();' . '});'); } else { if ($r['url']) { $url = PAGE::getInstance($r['url'])->getRelativeUrl(); $html .= '<a href="' . $url . '"'; } else { $html .= '<div'; } $html .= ' style="display:block;width:' . $width . 'px;height:' . $height . 'px;" id="image_transitions_' . $vars->id . '">' . '<div style="width:' . $width . 'px;height:' . $height . 'px;background:' . 'url(\'' . $cdnprefix . '/a/f=getImg/w=' . $width . '/h=' . $height . $r['directory'] . '/' . join('\') no-repeat center center"> </div><div style="width:' . $width . 'px;height:' . $height . 'px;display:none;background:' . 'url(\'' . $cdnprefix . '/a/f=getImg/w=' . $width . '/h=' . $height . $r['directory'] . '/', $imgs) . '\') no-repeat center center"> </div>'; if ($r['url']) { $html .= '</a>'; } else { $html .= '</div>'; } WW_addScript('/j/jquery.cycle.all.js'); WW_addInlineScript('$(window).load(function(){$("#image_transitions_' . $vars->id . '").cycle({fx:"' . $r['trans_type'] . '",speed:' . $r['pause'] . '})});'); } return $html; } } return '<p>' . __('This Image Transition is not yet defined.') . '</p>'; }
* @package None * @author Kae Verens <*****@*****.**> * @license GPL Version 2 * @link http://www.kvweb.me/ */ require_once 'header.php'; echo '<h1>' . __('Pages') . '</h1>'; // { left side echo '<div class="sub-nav">' . '<div id="pages-wrapper"></div>' . '</div>'; // } // { right side echo '<div class="pages_iframe"><div id="reports-wrapper"></div></div>'; // } // { scripts, etc WW_addScript('/j/jstree/_lib/jquery.cookie.js'); WW_addScript('/j/jstree/jquery.jstree.js'); WW_addScript('/j/jquery.remoteselectoptions.js'); WW_addScript('/ww.admin/pages/menu2.js'); $reports = array(array('visitorStats', 'Visitor Stats', false), array('popularPages', 'Popular Pages', false)); foreach ($PLUGINS as $n => $p) { if (isset($p['reports'])) { foreach ($p['reports'] as $k => $v) { $reports[] = array($k, $v, $n); } } } WW_addInlineScript('window.page_menu_currentpage=' . $id . ';' . 'window.reports=' . json_encode($reports) . ';'); WW_addCSS('/ww.admin/pages/menu.css'); WW_addCSS('/ww.admin/pages/css.css'); // } require_once 'footer.php';
function menu_show_fg($opts) { $md5 = md5('menu_fg|' . print_r($opts, true)); $cache = cache_load('menus', $md5); if ($cache) { return $cache; } $options = array('direction' => 0, 'parent' => 0, 'background' => '', 'columns' => 1, 'opacity' => 0, 'type' => 0, 'style_from' => 1); foreach ($opts as $k => $v) { if (isset($options[$k])) { $options[$k] = $v; } } if (!is_numeric($options['parent'])) { $r = Page::getInstanceByName($options['parent']); if ($r) { $options['parent'] = $r->id; } } if (is_numeric($options['direction'])) { if ($options['direction'] == '0') { $options['direction'] = 'horizontal'; } else { $options['direction'] = 'vertical'; } } $options['type'] = (int) $options['type']; $items = array(); $menuid = $GLOBALS['fg_menus']++; $md5 = md5($options['parent'] . '|0|' . json_encode($options)); $html = cache_load('pages', 'fgmenu-' . $md5); if ($html === false) { $html = menu_build_fg($options['parent'], 0, $options); cache_save('pages', 'fgmenu-' . $md5, $html); } if ($options['type']) { WW_addScript('/j/menu-accordion/menu.js'); WW_addCSS('/j/menu-accordion/menu.css'); $c .= '<div class="menu-accordion">' . $html . '</div>'; } else { WW_addScript('/j/fg.menu/fg.menu.js'); WW_addCSS('/j/fg.menu/fg.menu.css'); $c .= '<div class="menu-fg menu-fg-' . $options['direction'] . '" id="menu-fg-' . $menuid . '">' . $html . '</div>'; if ($options['direction'] == 'vertical') { $posopts = "positionOpts: { posX: 'left', posY: 'top',\n\t\t\t\toffsetX: 40, offsetY: 10, directionH: 'right', directionV: 'down',\n\t\t\t\tdetectH: true, detectV: true, linkToFront: false },"; } else { $posopts = ''; } WW_addInlineScript("\$(function(){ \$('#menu-fg-{$menuid}>ul>li>a').each(function(){ \$(this).fgmenu({ content:\$(this).next().outerHTML(), choose:function(ev,ui){ document.location=ui.item[0].childNodes(0).href; }, {$posopts} flyOut:true }); }); \$('.menu-fg>ul>li').addClass('fg-menu-top-level'); });"); } return $c; }