/** * show the onetouchcontact widget * * @param array $vars config * * @return string form */ function Onetouchcontact_widgetShow($vars) { $form = '<form class="onetouchcontact">Name<br/>' . '<input id="onetouchcontact-name"/><br/>Email<br/>' . '<input id="onetouchcontact-email"/><br/>'; if ($vars->phone) { $form .= 'Phone<br/><input id="onetouchcontact-phone" /><br/>'; } $form .= '<input type="hidden" name="cid" value="' . $vars->cid . '"/>' . '<input type="hidden" name="mid" value="' . $vars->mid . '"/>' . '<div class="onetouchcontact-msg"></div>' . '<input class="submit" type="submit" value="subscribe"/></form>'; WW_addScript('onetouchcontact/frontend/js.js'); return $form; }
/** * 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 registration or login page * * @param object $PAGEDATA the page object * * @return HTML of the page */ function IssueTracker_front($PAGEDATA) { require SCRIPTBASE . 'ww.plugins/issue-tracker/frontend/page_type.php'; global $unused_uri; if (isset($unused_uri) && $unused_uri) { redirect($PAGEDATA->getRelativeURL() . '#' . preg_replace('/\\/$/', '', $unused_uri)); } if (isset($_SESSION['userdata'])) { WW_addCSS('/j/jquery.multiselect/jquery.multiselect.css'); WW_addScript('/j/jquery.multiselect/jquery.multiselect.min.js'); } return $PAGEDATA->render() . $html . __FromJson(@$PAGEDATA->vars['footer']); }
/** * SendAsEmail_showWidget * * @param array $vars variables * * @return null */ function SendAsEmail_showWidget($vars) { $template = $vars->template; $url = $_SERVER['REQUEST_URI']; if (strpos($url, '&__t=') !== false || strpos($url, '?__t=') !== false) { $url = preg_replace('/[\\?\\&]__t=[^\\&]*/', '', $url); } $url .= '&__t=' . $template; if (strpos($url, '&') !== false && strpos($url, '?') === false) { $url = preg_replace('/&/', '?', $url, 1); } echo '<div class="sendasemail-print"><a href="' . $url . '">Print Version</a>' . '</div>' . '<div class="sendasemail-sendasemail">' . '<a href="javascript:;" onclick="sendasemail_send(\'' . $template . '\')">' . 'Send as Email</a></div>'; WW_addScript('send-as-email/frontend/widget.js'); }
/** * This is the main function. * It figures out if a list of quizzes, questions * or results should be displayed and displays the correct thing * * @see displayQuizInfo * @see [QuizSession::]getScore() * * @return string $displayString The correct page HTML */ function getPageHtml() { // { datatables WW_addScript('http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/' . 'jquery.dataTables.min.js'); WW_addScript('/j/datatables-delay.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'); // } // { The Script $displayString = '<script defer="defer">' . '$(function(){' . '$(\'#quizzesFrontend\').dataTable().fnSetFilteringDelay();' . '});' . '</script>'; // } $quizzes = dbAll("SELECT DISTINCT \n\t\t\tquiz_quizzes.id, \n\t\t\tname, \n\t\t\tquiz_quizzes.description \n\t\t\tFROM quiz_quizzes, quiz_questions \n\t\t\tWHERE quiz_quizzes.id=quiz_questions.quiz_id \n\t\t\tand quiz_quizzes.enabled=1"); $displayString = $displayString . '<form method="post">'; $displayString = $displayString . '<table id="quizzesFrontend" style="{width:100% postion:top}">'; $displayString = $displayString . '<thead><tr>'; $displayString = $displayString . '<th>Name</th>'; $displayString = $displayString . '<th>Description</th>'; $displayString = $displayString . '<th> </th>'; $displayString = $displayString . '</tr></thead>'; $displayString = $displayString . '<tbody>'; foreach ($quizzes as $quiz) { $quizId = $quiz['id']; $name = $quiz['name']; $topic = $quiz['description']; $id = $quiz['id']; $displayString = $displayString . '<tr>'; $displayString = $displayString . displayQuizInfo($name, $topic, $id); $displayString = $displayString . '</tr>'; } $displayString = $displayString . '</tbody></table>'; $displayString = $displayString . '</form>'; if (isset($_POST['take'])) { $id = $_POST['take']; $id = addSlashes($id); $quiz = new QuizSession($id); $_SESSION['id'] = $id; $quiz->chooseQuestions(); $displayString = $quiz->getQuestionPageHtml(); } if (isset($_POST['check'])) { $quiz = new QuizSession($_SESSION['id']); $displayString = $quiz->checkAnswers($_SESSION['questions'], $_POST); } return $displayString; }
/** * get a map centered on the product * * @param array $params parameters * @param object $smarty Smarty object * * @return html of the map */ function Products_map2($params, $smarty) { $params = array_merge(array('width' => 160, 'height' => '120'), $params); $pid = $smarty->smarty->tpl_vars['product']->value->id; $product = Product::getInstance($pid); $uid = (int) $product->vals['user_id']; if (!$uid) { return 'unknown location'; } $user = User::getInstance($uid, false, false); if (!$user) { return 'unknown user'; } $lat = (double) $user->get('location_lat'); $lng = (double) $user->get('location_lng'); WW_addScript('products/j/maps.js'); return '<div class="products-map"' . ' data-lat="' . $lat . '"' . ' data-lng="' . $lng . '"' . ' data-pid="' . $pid . '"' . ' style="width:' . (int) $params['width'] . 'px;' . 'height:' . (int) $params['height'] . 'px"></div>'; }
function poll_display() { WW_addScript('polls'); $poll = dbRow('select * from poll where enabled limit 1'); if (!count($poll)) { return '<div class="polls-wrapper"><em>No polls available.</em></div>'; } $id = $poll['id']; $html = '<div class="polls-wrapper" poll-id="' . $id . '">'; $html .= '<div class="question">' . $poll['body'] . '</div><ul class="answers">'; $answers = dbAll("select * from poll_answer where poll_id={$id} order by num"); foreach ($answers as $answer) { $html .= '<li><input type="radio" name="poll_answer" value=' . '"' . $answer['num'] . '" />' . htmlspecialchars($answer['answer']) . '</li>'; } $html .= '</ul><input type="button" class="polls-vote" value="Vote" /><inpu' . 't type="button" class="polls-results" value="View Results" />'; $html .= '</div>'; return $html; }
/** * widget for mailing lists * * @param array $vars parameters * * @return html */ function MailingLists_widget($vars) { $html = '<div id="mailinglists-subscribe">' . '<input type="email" placeholder="' . __('enter email address') . '"/>'; $sql = 'select * from mailinglists_lists'; $md5 = md5($sql); $lists = Core_cacheLoad('mailinglists', $md5, -1); if ($lists === -1) { $lists = dbAll($sql); Core_cacheSave('mailinglists', $md5, $lists); } if (count($lists) > 1) { $html .= '<select><option value="">' . __('Mailing List') . '</option>'; foreach ($lists as $list) { $html .= '<option value="' . $list['id'] . '">' . htmlspecialchars($list['name']) . '</option>'; } $html .= '</select>'; } $html .= '<button>' . __('Subscribe') . '</button></div>'; WW_addScript('mailinglists/js.js'); return $html; }
/** * show frontend widget * * @param array $vars settings * * @return string html */ function MP3_frontendWidget($vars = null) { $db = dbRow('select fields,template from mp3_plugin where id=' . $vars->id); $files = json_decode($db['fields'], true); if (count($files) == 0) { return 'No files yet'; } // { if template doesnt exist, create it $template = USERBASE . '/ww.cache/mp3/'; if (!is_dir($template)) { mkdir($template); } $template .= $vars->id; if (!file_exists($template)) { file_put_contents($template, $db['template']); } // } // { display the template require_once SCRIPTBASE . 'ww.incs/vendor/Smarty-3.1.19/libs/Smarty.class.php'; $smarty = new Smarty(); $smarty->compile_dir = USERBASE . '/ww.cache/templates_c'; if (!file_exists(USERBASE . '/ww.cache/templates_c')) { mkdir(USERBASE . '/ww.cache/templates_c'); } if (!file_exists(USERBASE . '/ww.cache/templates_c/image-gallery')) { mkdir(USERBASE . '/ww.cache/templates_c/image-gallery'); } $smarty->registerPlugin('function', 'LIST', 'MP3_list'); $smarty->registerPlugin('function', 'PLAY', 'mp3_play'); $smarty->registerPlugin('function', 'PROGRESS', 'MP3_progress'); $smarty->left_delimiter = '{{'; $smarty->right_delimiter = '}}'; $smarty->smarty->tpl_vars['mp3_files']->value = $files; $html = $smarty->fetch(USERBASE . '/ww.cache/mp3/' . $vars->id); WW_addScript('mp3/frontend/jwplayer.js'); WW_addScript('mp3/frontend/widget.js'); // } return $html; }
echo '</tr>' . '<tr style="display:none" id="users-email-to-send"><th colspan="3">Email to send to user</th><th><a href="#" id="new-user-email-template">template</a></th></tr>' . '<tr><td colspan="4" id="users-email-to-send-holder"></td></tr>' . '</table></div>'; // } // { locations echo '<div id="locations">'; // { physical location echo '<h2>Currently located</h2>' . '<p id="user-location">The user is recorded as being located at ' . 'Lat:<input name="location_lat" value="' . (double) @$r['location_lat'] . '"/>, ' . 'Long:<input name="location_lng" value="' . (double) @$r['location_lng'] . '"/> <a href="#">edit</a></p>'; // } // { addresses echo '<h2>Addresses</h2> <a id="new-address" href="javascript:;" style="flo' . 'at:right">[+] Add Address</a> <div id="add-content">'; if (!is_array($r['address'])) { if ($r['address'] == '') { $r['address'] = '[]'; } $r['address'] = json_decode($r['address'], true); } foreach ($r['address'] as $name => $address) { $select = @$address['default'] == 'yes' ? ' checked="checked"' : ''; $address = array_merge(array('street' => '', 'street2' => '', 'town' => '', 'postcode' => '', 'county' => '', 'country' => '', 'phone' => ''), $address); echo '<table class="address-table">' . '<tr><th colspan="2"><input type="radio"' . $select . ' name="default-address"' . ' value="' . $name . '"/>default ' . '<a href="javascript:;" class="delete-add" title="delete">[x]</a>' . '<input type="hidden" name="address[' . $name . ']"/></th></tr>' . '<tr><th>Street</th><td><input type="text" name="street-' . $name . '"' . ' value="' . $address['street'] . '"/></td></tr>' . '<tr><th>Street 2</th><td><input type="text" name="street2-' . $name . '"' . ' value="' . $address['street2'] . '"/></td></tr>' . '<tr> <th>Town</th> <td><input type="text" name="town-' . $name . '"' . ' value="' . $address['town'] . '"/></td></tr>' . '<tr> <th>Postcode</th> <td><input type="text" name="postcode-' . $name . '"' . ' value="' . $address['postcode'] . '"/></td> </tr>' . '<tr> <th>County</th> <td><input type="text" name="county-' . $name . '"' . ' value="' . $address['county'] . '"/></td> </tr>' . '<tr> <th>Country</th> <td><input type="text" name="country-' . $name . '"' . ' value="' . $address['country'] . '"/></td> </tr>' . '<tr> <th>Phone</th> <td><input type="text" name="phone-' . $name . '"' . ' value="' . $address['phone'] . '"/></td> </tr>' . '</table>'; } echo '</div><br style="clear:both"/>'; // } echo '</div>'; // } // { custom data echo '<div id="custom"><input type="hidden" value="' . htmlspecialchars($r['extras'], ENT_QUOTES) . '" /></div>'; // } echo '<input type="submit" name="action" value="Save" />'; echo '</form></div>'; WW_addScript('/ww.admin/siteoptions/users.js'); // }
<?php $ads = dbAll('select id,name,customer_id,views,clicks,is_active,image_url,date_expire' . ',type_id' . ' from ads'); $ad_types = array(); $rs = dbAll('select id,name from ads_types'); foreach ($rs as $r) { $ad_types[$r['id']] = $r['name']; } echo '<table id="ads-table"><thead><tr><th>ID</th><th>Name</th><th>Type</th>' . '<th>Owner</th><th>Views</th><th>Clicks</th><th>Active</th>' . '<th>Expires</th><th></th></tr></thead><tbody>'; foreach ($ads as $ad) { $username = ''; if ($ad['customer_id']) { $user = User::getInstance($ad['customer_id']); $username = $user ? $user->get('name') : 'UNKNOWN'; } echo '<tr id="ad-' . $ad['id'] . '">' . '<td>' . str_pad($ad['id'], 4, '0', STR_PAD_LEFT) . '</td>' . '<td>' . htmlspecialchars($ad['name']) . '</td>' . '<td>' . htmlspecialchars($ad_types[$ad['type_id']]) . '</td>' . '<td>' . htmlspecialchars($username) . '</td>' . '<td>' . $ad['views'] . '</td>' . '<td>' . $ad['clicks'] . '</td>' . '<td>' . ($ad['is_active'] ? 'Yes' : 'No') . '</td>' . '<td>' . $ad['date_expire'] . '</td>' . '<td><a href="#" class="edit">edit</a>' . ' | <a href="#" class="delete">[x]</a></td></tr>'; } echo '</tbody></table><button class="new-ad">' . __('New Ad') . '</button>'; WW_addScript('/ww.plugins/ads/admin.js');
/** * 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>'; } }
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">';
/** * 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; }
<?php require_once 'header.php'; $pname = isset($_REQUEST['_plugin']) ? $_REQUEST['_plugin'] : ''; $pagename = isset($_REQUEST['_page']) ? $_REQUEST['_page'] : ''; if (preg_match('/[^\\-a-zA-Z0-9]/', $pagename) || $pagename == '') { die('illegal character in page name'); } if (!isset($PLUGINS[$pname])) { die('no plugin of that name (' . htmlspecialchars($pname) . ') exists'); } $plugin = $PLUGINS[$pname]; $_url = '/ww.admin/plugin.php?_plugin=' . urlencode($pname) . '&_page=' . $pagename; WW_addScript('/ww.admin/j/plugins.js'); // { help pages $help = array(); if (file_exists(SCRIPTBASE . '/ww.plugins/' . $pname . '/docs/admin.html')) { $help[] = array('admin', 'documentation'); } if (file_exists(SCRIPTBASE . '/ww.plugins/' . $pname . '/docs/design.html')) { $help[] = array('design', 'design docs'); } if (count($help)) { echo '<div id="nav-help" style="width:150px;">'; foreach ($help as $h) { echo '<a href="javascript:show_help(\'' . $pname . '\',\'' . $h[0] . '\')">' . $h[1] . '</a>'; } echo '</div>'; } // } // { display the plugin
* * 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');
$row = 0; do { $c .= '<tr>'; for ($j = 0; $j < 3; ++$j) { $k = $row * 3 + $j; if (isset($countries[$k])) { $country = $countries[$k]; $checked = in_array($country, $keys) ? ' checked="checked"' : ''; $c .= '<td><input name="page_vars[online-store-countries][' . $country . ']" type="checkbox"' . $checked . '/> ' . $country . '</td>'; } else { $c .= '<td> </td>'; } } $c .= '</tr>'; ++$row; } while ($row * 3 <= $num_countries); $c .= '</table></div>'; } $c .= '</div></div>'; // } $c .= '</div>'; WW_addScript('online-store/admin/index.js'); WW_addScript('/j/jquery.inlinemultiselect.js'); if (!file_exists(USERBASE . '/ww.cache/online-store')) { mkdir(USERBASE . '/ww.cache/online-store'); } if (file_exists(USERBASE . '/ww.cache/online-store/' . $page['id'])) { unlink(USERBASE . '/ww.cache/online-store/' . $page['id']); } file_put_contents(USERBASE . '/ww.cache/online-store/' . $page['id'], dbOne('select val from online_store_vars where name="email_invoice"', 'val')); $c .= '<style>@import "/ww.plugins/online-store/admin/styles.css";</style>';
/** * function for showing the form for the mailinglist * * @return null */ function Mailinglist_showForm2() { WW_addScript('mailing-list/files/impromptu.jquery.min.js'); WW_addScript('mailing-list/files/general.js'); WW_addCSS('/ww.plugins/mailing-list/files/mailing-list.css'); $html = Mailinglist_createForm(); if (isset($_GET['mailing_list_hash'])) { $hash = $_GET['mailing_list_hash']; $email = dbQuery('select email from mailing_list where hash="' . $hash . '"'); if (count($email) != 1) { $html .= Mailinglist_showAlert('Error. Invalid link provided'); } else { dbQuery('update mailing_list set status="Activated" where hash="' . $hash . '"'); $html .= Mailinglist_showAlert('Thank You, Email added to the list.'); } } elseif (isset($_POST['submit'])) { $email .= $_POST['mailing_email']; if (isset($_POST['name'])) { $name = $_POST['name']; } else { $name = '__empty__'; } if (isset($_POST['mobile'])) { $mobile = $_POST['mobile']; } else { $mobile = '__empty__'; } $valid = Mailinglist_checkNameAndEmail($email, $name); if ($valid == true) { $hash = Mailinglist_addPersonToDatabase($email, $name, $mobile); Mailinglist_sendConfirmation($email, $hash); $html .= Mailinglist_showAlert('Thank You! A confirmation email has been sent to ' . $email); } else { $html .= Mailinglist_showAlert('Error. Invalid details.'); } } return $html; }
/** * 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']; }
*/ if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'Save') { // { online_store_vars foreach ($_REQUEST['ebayVals'] as $k => $v) { dbQuery('delete from online_store_vars where name="ebay_' . addslashes($k) . '"'); dbQuery('insert into online_store_vars set name="ebay_' . addslashes($k) . '"' . ', val="' . addslashes($v) . '"'); } // } Core_cacheClear('online-store'); echo '<em>Saved</em>'; } echo '<form method="post" action="' . $_url . '" />' . '<div class="accordion">'; // { main echo '<h2>' . __('Main Details') . '</h2><div><table>' . '<tr><th>What paypal address to use</th>' . '<td><input name="ebayVals[paypal_address]" value="' . htmlspecialchars(dbOne('select val from online_store_vars where name="ebay_paypal_address"', 'val')) . '"/></td></tr>' . '<tr><th>Status</th><td><select name="ebayVals[status]">' . '<option value="0">Sandbox</option>' . '<option value="1"' . (dbOne('select val from online_store_vars where name="ebay_status"', 'val') ? ' selected="selected"' : '') . '>Production</option>' . '</select></td></tr>' . '<tr><th>What country your products come from (2-letter code)</th>' . '<td><input name="ebayVals[country_from]" value="' . htmlspecialchars(dbOne('select val from online_store_vars where name="ebay_country_from"', 'val')) . '"/></td></tr>' . '<tr><th>What location in the country?</th>' . '<td><input name="ebayVals[location]" value="' . htmlspecialchars(dbOne('select val from online_store_vars where name="ebay_location"', 'val')) . '"/></td></tr>' . '<tr><th>How many days to dispatch</th>' . '<td><input name="ebayVals[dispatch_days]" value="' . htmlspecialchars(dbOne('select val from online_store_vars where name="ebay_dispatch_days"', 'val')) . '"/></td></tr>' . '</table></div>'; // } // { sandbox authentication echo '<h2>' . __('Sandbox Authentication') . '</h2><div>' . '<p>You must get a developer account from' . ' <a href="https://developer.ebay.com/">eBay</a>.</p>' . '<table>' . '<tr><th>Dev ID</th><td><input name="ebayVals[sandbox_devid]" value="' . htmlspecialchars(dbOne('select val from online_store_vars where name="ebay_sandbox_devid"', 'val')) . '"/></td>' . '<th rowspan="3">User Token</th><td rowspan="3">' . '<textarea name="ebayVals[sandbox_usertoken]">' . htmlspecialchars(dbOne('select val from online_store_vars where name="ebay_sandbox_usertoken"', 'val')) . '</textarea></td></tr>' . '<tr><th>App ID</th><td><input name="ebayVals[sandbox_appid]" value="' . htmlspecialchars(dbOne('select val from online_store_vars where name="ebay_sandbox_appid"', 'val')) . '"/></td>' . '<tr><th>Cert ID</th><td><input name="ebayVals[sandbox_certid]" value="' . htmlspecialchars(dbOne('select val from online_store_vars where name="ebay_sandbox_certid"', 'val')) . '"/></td></tr>' . '</table></div>'; // } // { production authentication echo '<h2>' . __('Production Authentication') . '</h2><div>' . '<p>You must get a developer account from' . ' <a href="https://developer.ebay.com/">eBay</a>.</p><table>' . '<tr><th>Dev ID</th><td><input name="ebayVals[devid]" value="' . htmlspecialchars(dbOne('select val from online_store_vars where name="ebay_devid"', 'val')) . '"/></td>' . '<th rowspan="3">User Token</th><td rowspan="3">' . '<textarea name="ebayVals[usertoken]">' . htmlspecialchars(dbOne('select val from online_store_vars where name="ebay_usertoken"', 'val')) . '</textarea></td></tr>' . '<tr><th>App ID</th><td><input name="ebayVals[appid]" value="' . htmlspecialchars(dbOne('select val from online_store_vars where name="ebay_appid"', 'val')) . '"/></td></tr>' . '<tr><th>Cert ID</th><td><input name="ebayVals[certid]" value="' . htmlspecialchars(dbOne('select val from online_store_vars where name="ebay_certid"', 'val')) . '"/></td></tr>' . '</table></div>'; // } // { description afterword echo '<h2>' . __('Description Afterword') . '</h2><div><table>' . '<tr><textarea name="ebayVals[description_afterword]">' . htmlspecialchars(dbOne('select val from online_store_vars where name="ebay_description_afterword"', 'val')) . '</textarea></td></tr>' . '</table></div>'; // } // { returns policy echo '<h2>' . __('Returns Policy') . '</h2><div><table>' . '<tr><textarea name="ebayVals[returns_policy]">' . htmlspecialchars(dbOne('select val from online_store_vars where name="ebay_returns_policy"', 'val')) . '</textarea></td></tr>' . '</table></div>'; // } echo '</div>'; echo '<input type="submit" name="action" value="Save" /></form>'; WW_addScript('online-store-ebay/admin/options.js'); WW_addCSS('/ww.plugins/online-store-ebay/admin/options.css');
/** * 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>'; }
$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>'; } } // }
<?php /** * widget for search plugin * * PHP version 5.2 * * @category None * @package None * @author Kae Verens <*****@*****.**> * @license GPL 2.0 * @link http://kvsites.ie/ */ $html = '<form action="#"><input name="search" class="search'; if (isset($_REQUEST['search'])) { $html .= '" value="' . htmlspecialchars($_REQUEST['search']); } else { $html .= ' empty" value="search'; } $html .= '" /></form>'; $html .= '<style type="text/css">' . 'input.search{background:url(/i/search.png) white no-repeat right;}' . 'input.search.empty{color:#999;font-style:italic}</style>'; WW_addScript('search/j/js.js');
$smarty->assign('THEMEDIR', '/ww.skins/' . THEME); // } // { build metadata // { page title $c = '<title>' . htmlspecialchars($PAGEDATA->title ? $PAGEDATA->title : str_replace('www.', '', $_SERVER['HTTP_HOST']) . ' > ' . __FromJson($PAGEDATA->name)) . '</title>'; // } // { show stylesheet and javascript links $c .= 'WW_CSS_GOES_HERE' . Core_getJQueryScripts() . '<script src="WW_SCRIPTS_GO_HERE"></script>'; // { generate inline javascript $tmp = 'var pagedata={id:' . $PAGEDATA->id . Core_trigger('displaying-pagedata') . ',ptop:' . $PAGEDATA->getTopParentId() . (isset($DBVARS['cdn']) && $DBVARS['cdn'] ? ', cdn:"' . $DBVARS['cdn'] . '"' : '') . ',sessid:"' . session_id() . '"' . ',lang:"' . @$_SESSION['language'] . '"' . '},' . 'CKEDITOR_BASEPATH="//cdn.ckeditor.com/4.4.3/standard/", ' . (isset($_SESSION['userdata']['id']) ? User::getAsScript() : 'userdata={isAdmin:0' . (isset($_SESSION['wasAdmin']) ? ',wasAdmin:1' : '') . '};'); array_unshift($scripts_inline, $tmp); // } if (Core_isAdmin()) { foreach ($GLOBALS['PLUGINS'] as $p) { if (isset($p['frontend']['admin-script'])) { WW_addScript($p['frontend']['admin-script']); } } } // } // { meta tags $c .= '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'; if ($PAGEDATA->keywords) { $c .= '<meta http-equiv="keywords" content="' . htmlspecialchars($PAGEDATA->keywords) . '" />'; } if ($PAGEDATA->description) { $c .= '<meta http-equiv="description" content="' . htmlspecialchars($PAGEDATA->description) . '"/>'; } if (isset($PAGEDATA->vars['google-site-verification'])) { $c .= '<meta name="google-site-verification" content="' . htmlspecialchars($PAGEDATA->vars['google-site-verification']) . '" />'; }
* @author Kae Verens <*****@*****.**> * @license GPL 2.0 * @link None */ $html = '<h2>' . __('Online Store - Order History', 'core') . '</h2>'; $history = array(); $orders = dbAll('select meta,id,status,total,user_id,date_created from online_store_orders' . ' order by date_created desc'); foreach ($orders as $order) { if ($order['user_id'] != 0 && $order['user_id'] == $user['id']) { array_push($history, $order); } } if (count($history) == 0) { return $html .= '<p><i>No recent orders</i></p>'; } WW_addScript('online-store/frontend/user-profile.js'); $html .= '<table id="online_store_orders"> <tr> <th>' . __('Date', 'core') . '</th> <th>' . __('Amount', 'core') . '</th> <th>' . __('Status', 'core') . '</th> <th>' . __('Invoice', 'core') . '</th> </tr>'; foreach ($history as $order) { $status = $order['status'] == 1 ? 'Paid' : 'Unpaid'; $meta = json_decode($order['meta'], true); $oid = $order['id']; $html .= '<tr>' . '<td>' . Core_dateM2H($order['date_created']) . '</td>' . '<td>' . $order['total'] . '</td>' . '<td>' . $status . '</td>' . '<td>' . '<a href="' . $PAGEDATA->getRelativeUrl() . '?onlinestore_iid=' . $oid . '">' . __('Details') . '</a> | '; if (isset($meta['invoice-type']) && $meta['invoice-type'] == 'pdf') { $html .= '<a href="javascript:os_invoice(' . $oid . ', \'pdf\', true)">PDF</a>'; } else {
/** * 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; }
* @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';
$img = preg_replace('#^/f/#', '', $img); $thumb = '<img src="/a/f=getImg/w=' . $vars->thumbnailw . '/h=' . $vars->thumbnailh . '/' . $img . '" style="float:left;"/>'; } } $body = ''; if ($vars->characters_shown) { $body = preg_replace('#<h1[^<]*</h1>#', '', $pagerendered); $body = str_replace(array("\n", "\r"), ' ', $body); $body = preg_replace('/<script defer="defer"[^>]*>.*?<\\/script>/', '', $body); $body = preg_replace('/<[^>]*>/', '', $body); $body = '<br /><i>' . substr($body, 0, $vars->characters_shown) . '...</i>'; } $links[] = '<a href="' . $page->getRelativeURL() . '"><strong>' . htmlspecialchars(__FromJson($page->name)) . '</strong><div class="date">' . Core_dateM2H($page->associated_date) . '</div><span class="news-body">' . $thumb . $body . '</span></a>'; } $html .= '<div id="news-wrapper-' . $vars->id . '" class="news_excerpts_wrapper"><ul class="news_excerpts"><li>' . join('</li><li>', $links) . '</li></ul></div>'; if (isset($vars->scrolling) && $vars->scrolling) { $n_items = isset($vars->stories_to_show) && is_numeric($vars->stories_to_show) ? $vars->stories_to_show : 2; if (isset($vars->scrolling) && $vars->scrolling) { WW_addScript('/j/jquery.vticker.js'); WW_addCSS('/ww.plugins/news/c/scroller.css'); $html .= '<script defer="defer">$(function(){ $("#news-wrapper-' . $vars->id . '").vTicker({ speed: 15000, pause: 5000, showItems: ' . $n_items . ', animation: "", mousePause: true }); });</script>'; } }
function SiteCredits_adminShowStatus() { WW_addScript('/ww.plugins/site-credits/admin-status.js'); }
foreach ($files as $file) { echo '<li><a href="/ww.admin/plugin.php?_plugin=theme-editor&_page=in' . 'dex&name=' . urlencode($file) . '&type=c">' . htmlspecialchars($file) . '</a></li>'; } echo '</ul>'; // } echo '</div>'; // } // { content echo '<div class="pages_iframe">'; if (!$name || !$type || !in_array($type, array('h', 'c')) || !preg_match('/^[a-z0-9_][^\\/]*$/', $name)) { echo '<p>Please choose a file from the left menu.</p>'; } else { $name = $_REQUEST['name']; switch ($_REQUEST['type']) { case 'h': // { require 'templates.php'; break; // } // } case 'c': // { require 'css.php'; break; // } } } echo '</div>'; // } WW_addScript('theme-editor/admin/menu.js'); ww_addCSS('/ww.plugins/theme-editor/admin/menu.css');