Ejemplo n.º 1
0
/**
 * show ads
 *
 * @param array $params parameters
 *
 * @return ads HTML
 */
function Ads_widget($params)
{
    if (!isset($params->{'ad-type'})) {
        return 'missing ad type';
    }
    $type_id = (int) $params->{'ad-type'};
    $howmany = (int) $params->{'how-many'};
    $type = dbRow('select * from ads_types where id=' . $type_id);
    $ads = array();
    $i = 0;
    if ($howmany > 1) {
        $sql = 'select id,image_url,target_type,poster from ads' . ' where type_id=' . $type_id . ' and is_active and cdate>date_add(now(), interval -2 day) order by rand()' . ' limit ' . $howmany;
        $adsNew = dbAll($sql);
        for (; $i < count($adsNew); ++$i) {
            $ads[] = $adsNew[$i];
        }
    }
    $adsOld = dbAll('select id,image_url,target_type,poster from ads' . ' where type_id=' . $type_id . ' and is_active order by rand()' . ' limit ' . $howmany);
    for ($j = 0; $j < $howmany - $i && $j < count($adsOld); ++$j) {
        $ads[] = $adsOld[$j];
    }
    $html = '<div class="ads-wrapper type-' . $type_id . '">';
    foreach ($ads as $ad) {
        $html .= Ads_adShow($ad, $type);
        dbQuery('insert into ads_track set ad_id=' . $ad['id'] . ', view=1, cdate=now()');
    }
    $html .= '</div>';
    WW_addScript('ads/j/js.js');
    WW_addCSS('/ww.plugins/ads/css.css');
    return $html;
}
Ejemplo n.º 2
0
/**
 * 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']);
}
Ejemplo n.º 3
0
/**
  * 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>&nbsp</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;
}
Ejemplo n.º 4
0
/**
 * returns a HTML string to show the Online-Store basket
 *
 * @param array $vars parameters passed via Smarty
 *
 * @return string
 */
function OnlineStore_showBasketWidget($vars = null)
{
    global $DBVARS;
    $slidedown = @$vars->slidedown;
    $slideup = (int) @$vars->slideup_delay;
    $html = '<div class="online-store-basket-widget' . ($slidedown ? ' slidedown' : '') . '">';
    if ($slidedown) {
        $html .= '<div class="slidedown-header">' . __('Your Items') . '</div>' . '<div class="slidedown-wrapper" slidedown="' . @$vars->slidedown_animation . '" slideup="' . $slideup . '">';
        WW_addCSS('/ww.plugins/online-store/basket.css');
    }
    // { basket body
    if (!isset($_SESSION['online-store'])) {
        $_SESSION['online-store'] = array('items' => array(), 'total' => 0);
    }
    $cpage = Page::getInstance($_SESSION['onlinestore_checkout_page']);
    $cpage = $cpage->getRelativeUrl();
    if (@$vars->template) {
        $t = $vars->template;
        $t = str_replace('{{ONLINESTORE_NUM_ITEMS}}', OnlineStore_getNumItems(), $t);
        if (!@$_SESSION['onlinestore_checkout_page']) {
            OnlineStore_setCheckoutPage();
        }
        $total = OnlineStore_getFinalTotal();
        if ($_SESSION['onlinestore_prices_shown_post_vat']) {
            $total *= (100 + $_SESSION['onlinestore_vat_percent']) / 100;
        }
        $t = str_replace('{{ONLINESTORE_FINAL_TOTAL}}', OnlineStore_numToPrice($total), $t);
        if (strpos($t, '{{ONLINESTORE_CHECKOUTURL}}') !== false) {
            $t = str_replace('{{ONLINESTORE_CHECKOUTURL}}', $cpage, $t);
        }
        $html .= $t;
    } else {
        if (isset($_SESSION['online-store']['items']) && count($_SESSION['online-store']['items'])) {
            $html .= '<table class="os_basket">';
            $html .= '<tr class="os_basket_titles"><th>' . __('Price') . '</th><th>' . __('Amt') . '</th>' . '<th>' . __('Total') . '</th></tr>';
            foreach ($_SESSION['online-store']['items'] as $md5 => $item) {
                // { name
                $html .= '<tr class="os_basket_itemTitle" product="' . $md5 . '">' . '<th colspan="3">';
                if (isset($item['id']) && $item['id']) {
                    $p = Product::getInstance($item['id']);
                    if ($p) {
                        $img = $p->getDefaultImage();
                        if ($img) {
                            $html .= '<a href="/f/' . $img . '" target="popup" ' . 'class="online-store-thumb-wrapper">' . '<img src="/a/f=getImg/w=16/h=16/' . $img . '"/>' . '</a>';
                        }
                    }
                }
                if ($item['url']) {
                    $html .= '<a href="' . $item['url'] . '">';
                }
                $html .= $item['short_desc'];
                if ($item['url']) {
                    $html .= '</a>';
                }
                $html .= '</th></tr>';
                // }
                $html .= '<tr class="os_basket_itemDetails ' . $md5 . '" product="' . $md5 . '">';
                // { cost
                $cost = $_SESSION['onlinestore_prices_shown_post_vat'] ? $item['cost'] * (100 + $_SESSION['onlinestore_vat_percent']) / 100 : $item['cost'];
                $html .= '<td>' . OnlineStore_numToPrice($cost) . '</td>';
                // }
                // { amount
                $html .= '<td class="amt"><span class="' . $md5 . '-amt">' . $item['amt'] . '</span>' . ' [<a title="remove" class="amt-del" href="javascript:;">x</a>]' . '</td>';
                // }
                // { price
                $price = $cost * $item['amt'];
                $html .= '<td class="' . $md5 . '-item-total total">' . OnlineStore_numToPrice($price) . '</td></tr>';
                // }
            }
            $total = $_SESSION['online-store']['total'];
            if ($_SESSION['onlinestore_prices_shown_post_vat']) {
                $total *= (100 + $_SESSION['onlinestore_vat_percent']) / 100;
            }
            $html .= '<tr class="os_basket_totals"><th colspan="2">' . __('Total') . '</th>' . '<td class="total">' . OnlineStore_numToPrice($total) . '</td></tr>' . '</table>' . '<a class="online-store-checkout-link" href="' . $cpage . '">' . __('Proceed to Checkout') . '</a>';
        } else {
            $html .= '<em class="os-basket empty">' . __('Empty') . '</em>';
        }
    }
    if (@$_SESSION['userdata']['id']) {
        $html .= '<div id="onlinestore-lists"><span>' . __('Lists:') . ' </span>' . '<a href="javascript:;" class="onlinestore-load-list">' . __('Load') . '</a>';
        if (count(@$_SESSION['online-store']['items'])) {
            $html .= ' | <a href="javascript:;" class="onlinestore-save-list">' . __('Save') . '</a>';
        }
        $html .= '</div>';
    }
    // }
    if ($slidedown) {
        $html .= '</div>';
    }
    $html .= '</div>';
    WW_addScript('online-store/j/basket.js');
    return $html;
}
Ejemplo n.º 5
0
<?php

/**
 * show the left menu for the pages admin
 *
 * PHP version 5.2
 *
 * @category None
 * @package  None
 * @author   Kae Verens <*****@*****.**>
 * @license  GPL 2.0
 * @link     http://kvsites.ie/
 */
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');
WW_addCSS('/ww.admin/pages/menu.css');
echo '<div id="pages-wrapper"></div>';
Ejemplo n.º 6
0
<?php

/**
 * User management - options
 *
 * PHP version 5.2
 *
 * @category None
 * @package  None
 * @author   Kae Verens <*****@*****.**>
 * @license  GPL 2.0
 * @link     http://kvsites.ie/
 */
if (@$_REQUEST['action'] == 'save') {
    Core_siteVar('useraccounts_registrationtokenemail_from', $_REQUEST['email']);
    Core_siteVar('useraccounts_registrationtokenemail_subject', $_REQUEST['subject']);
    Core_siteVar('useraccounts_registrationtokenemail_message', $_REQUEST['message']);
}
echo '<h3>User Options</h3>' . '<p>This list of options governs how users are created.</p>';
$rs = dbAll('select * from site_vars where name like "useraccounts_%"', 'name');
echo '<form action="./siteoptions.php?page=users&amp;tab=options" ' . 'method="post">';
echo '<div id="user-options-wrapper">';
// { token email
echo '<h2>User Token email</h2><div><table>' . '<tr><th>From email address</th><td><input name="email" value="' . htmlspecialchars(Core_siteVar('useraccounts_registrationtokenemail_from')) . '"/></td></tr>' . '<tr><th>Subject</th><td><input name="subject" value="' . htmlspecialchars(Core_siteVar('useraccounts_registrationtokenemail_subject')) . '"/></td></tr>' . '<tr><th>Message</th><td><textarea name="message">' . htmlspecialchars(Core_siteVar('useraccounts_registrationtokenemail_message')) . '</textarea></td><td><strong>codes</strong><br/>' . '<code>%token%</code>: the registration token</td></tr>' . '</table></div>';
// }
echo '</div><input type="hidden" name="action" value="save"/>' . '<input type="submit" value="Save"/></form>';
WW_addScript('/ww.admin/siteoptions/users-options.js');
WW_addCSS('/ww.admin/siteoptions/users-options.css');
Ejemplo n.º 7
0
// { css
WW_addCSS('/j/cluetip/jquery.cluetip.css');
WW_addCSS('/j/jquery.saorfm/jquery.saorfm.css');
WW_addCSS('/ww.admin/theme/admin.css');
WW_addCSS('//cdn.jsdelivr.net/codemirror/3.14.0/codemirror.css');
// }
// { datatables
WW_addScript('//cdn.datatables.net/1.10.2/js/jquery.dataTables.min.js');
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';
Ejemplo n.º 8
0
    echo '<script>window.parent.document.getElementById("page_' . $id . '")' . '.childNodes[1].innerHTML=\'<ins class="jstree-icon">&nbsp;</ins>' . htmlspecialchars(__FromJson($_REQUEST['name'], true)) . '\';</script>';
}
$is_an_update = $action == 'Insert Page Details' || $action == 'Update Page Details';
$edit = $is_an_update || $action == 'edit' || $id ? 1 : 0;
// }
// { display header and link in scripts
WW_addScript('/j/js.js');
WW_addScript('/j/jquery.json-2.2.min.js');
WW_addScript('//cdn.ckeditor.com/4.4.3/standard/ckeditor.js');
WW_addScript('//cdn.ckeditor.com/4.4.3/standard/adapters/jquery.js');
WW_addInlineScript('CKEDITOR_BASEPATH="//cdn.ckeditor.com/4.4.3/standard/";');
WW_addScript('/ww.admin/j/admin.js');
// { datatables
WW_addScript('//cdn.datatables.net/1.10.2/js/jquery.dataTables.min.js');
WW_addScript('/j/datatables-delay.js');
WW_addCSS('//cdn.datatables.net/1.10.2/css/jquery.dataTables.min.css');
// }
WW_addScript('/j/jquery.remoteselectoptions.js');
WW_addScript('/j/cluetip/jquery.cluetip.js');
WW_addScript('/j/jquery-ui-timepicker-addon.js');
WW_addScript('/ww.admin/pages/form2.js');
WW_addScript('/j/uploader.js');
WW_addScript('/j/lang.js');
WW_addScript('/j/jstree/jquery.jstree.js');
WW_addScript('/j/jstree/_lib/jquery.cookie.js');
WW_addInlineScript('$.jstree._themes="/j/jstree/themes/";');
echo '<html><head>' . Core_getJQueryScripts() . '<link rel="stylesheet" href="/j/cluetip/jquery.cluetip.' . 'css" />' . '<link rel="stylesheet" href="/ww.admin/theme/admin.css" />' . '<link rel="stylesheet" href="/ww.admin/pages/form.css" />' . '<title>page form</title>';
// { languages
$sql = 'select code,name from language_names order by is_default desc,code,name';
$langs = dbAll($sql, '', 'language_names');
WW_addInlineScript('var languages=' . json_encode($langs) . ';');
Ejemplo n.º 9
0
            $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>';
    }
}
Ejemplo n.º 10
0
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');
Ejemplo n.º 11
0
/**
 * check for new emails
 *
 * @param array  $data data
 * @param object $vars config object
 *
 * @return array array of results
 */
function Aggregator_parse($data, $vars)
{
    if (!isset($vars->hide_story_title)) {
        $vars->hide_story_title = 0;
    }
    if (!isset($vars->characters_shown)) {
        $vars->characters_shown = 200;
    }
    if (!isset($vars->scrolling)) {
        $vars->scrolling = 0;
    }
    if (!isset($vars->load_in_other_tab)) {
        $vars->load_in_other_tab = 1;
    }
    if (!isset($vars->stories_to_show)) {
        $vars->stories_to_show = 10;
    }
    $altogether = array();
    foreach ($data as $r) {
        $md5 = md5($r->url);
        $f = Core_cacheLoad('messaging-notifier', $md5);
        if ($f === false || (int) @$f['last-check'] < time() - $r->refresh * 60) {
            switch ($r->type) {
                case 'WebME News Page':
                    // {
                    $f = Aggregator_getWebmeNews($r);
                    break;
                    // }
                // }
                case 'email':
                    // {
                    $f = Aggregator_getEmail($r);
                    break;
                    // }
                // }
                case 'phpBB3':
                    // {
                    $f = Aggregator_getPhpbb3($r);
                    break;
                    // }
                // }
                case 'RSS':
                    // {
                    $f = Aggregator_getRss($r);
                    break;
                    // }
                // }
                case 'Twitter':
                    // {
                    $f = Aggregator_getTwitter($r);
                    break;
                    // }
            }
            $f['last-check'] = time();
            Core_cacheSave('messaging-notifier', $md5, $f);
        }
        $altogether = array_merge($altogether, $f);
    }
    $html = '<div id="messaging-notifier-' . $vars->id . '">' . '<ul class="messaging-notifier">';
    $i = 0;
    $ordered = array();
    foreach ($altogether as $r) {
        $ordered[$r['unixtime']] = $r;
    }
    krsort($ordered);
    foreach ($ordered as $r) {
        if (++$i > 10 || !$vars->scrolling && $i > $vars->stories_to_show) {
            continue;
        }
        $description = '';
        if ($vars->characters_shown && isset($r['description'])) {
            $description = preg_replace('/<[^>]*>/', '', $r['description']);
            if (strlen($description) > (int) $vars->characters_shown) {
                $description = substr($description, 0, $vars->characters_shown) . '...';
            }
        }
        $target = $vars->load_in_other_tab ? ' target="_blank"' : '';
        $title = $vars->hide_story_title ? '' : '<strong>' . htmlspecialchars($r['title']) . '</strong><br />';
        $html .= '<li class="messaging-notifier-' . $r['type'] . '"><a' . $target . ' href="' . $r['link'] . '">' . $title . $description . '</a><br /><i>' . date('Y M jS H:i', $r['unixtime']) . '</i></li>';
    }
    $html .= '</ul></div>';
    WW_addCSS('/ww.plugins/messaging-notifier/c/styles.css');
    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/messaging-notifier/c/scroller.css');
            $html .= '<script defer="defer">$(function(){
					$("#messaging-notifier-' . $vars->id . '").vTicker({
						speed: 4000,
						pause: 5000,
						showItems: ' . $n_items . ',
						animation: "",
						mousePause: true
					});
				});</script>';
        }
    }
    $height = isset($vars->height_in_px) && $vars->height_in_px ? ' style="height:' . (int) $vars->height_in_px . 'px"' : '';
    return $html;
}
Ejemplo n.º 12
0
<?php

/**
 * Dynamic Search Plugin
 *
 * PHP version 5.2
 *
 * @category None
 * @package  None
 * @author   Conor Mac Aoidh <*****@*****.**>
 * @license  GPL 2.0
 * @link     http://kvsites.ie/
 */
WW_addScript('dynamic-search/files/general.js');
WW_addCSS('/ww.plugins/dynamic-search/files/style.css');
$html = '<h1>Search</h1><form method="get" id="dynamic_search">' . '<table id="dynamic_search_table"><tr><td>' . '<select name="dynamic_category" id="dynamic_search_select">' . '<option>Site Wide</option>';
if ($catags != '') {
    foreach ($catags as $catag) {
        $html .= '<option>' . $catag . '</option>';
    }
}
$html .= '</select></td><td><input type="text" name="dynamic_search"' . ' value="Enter Keywords..." id="dynamic_searchfield"/></td>' . '<td><input type="submit" value="Search" id="dynamic_search_submit"' . ' name="dynamic_search_submit"/></td></tr><tr><td>&nbsp;</td><td>' . '<ul id="dynamic_suggestions"></ul></td><td>&nbsp;</td></tr></table></form>';
Ejemplo n.º 13
0
/**
 * show the login widget
 *
 * @param array $vars      parameters
 * @param int   $widget_id id of the widget to show
 *
 * @return string html to return
 */
function UserAuthentication_showWidget($vars = null, $widget_id = 0)
{
    WW_addCSS('/ww.plugins/privacy/widget.css');
    if (!isset($_SESSION['userdata']) || !$_SESSION['userdata']['id']) {
        require_once SCRIPTBASE . 'ww.plugins/privacy/frontend/widget-login.php';
        WW_addScript('privacy/frontend/widget-login.js');
        return $c;
    }
    return '<div id="userauthentication-widget"><ul>' . '<li>Hi, <strong>' . $_SESSION['userdata']['name'] . '</strong></li>' . '<li class="userauthentication-logout">' . '<a href="/?logout">' . __('log out', 'core') . '</a></li>' . '<li class="userauthentication-edit-profile">' . '<a href="/_r?type=loginpage">' . __('my account', 'core') . '</a></li></ul><br class="clear"/></div>';
}
Ejemplo n.º 14
0
$opts = json_decode($page_vars['issue_tracker_edit_all']);
foreach ($rs as $r) {
    $html .= '<option value="' . $r['id'] . '"';
    if (in_array($r['id'], $opts)) {
        $html .= ' selected="selected"';
    }
    $html .= '>' . htmlspecialchars($r['name']) . '</option>';
}
$html .= '</select></td></tr>';
// }
$html .= '</table>';
$html .= '</div>';
// }
// { header
$html .= '<div id="issuetracker-header">';
$html .= '<p>Text to be shown above the product/product list</p>';
$html .= ckeditor('body', $page['body'], null, 1);
$html .= '</div>';
// }
// { footer
$html .= '<div id="issuetracker-footer">';
$html .= '<p>Text to be shown below the product/product list</p>';
$html .= ckeditor('page_vars[footer]', isset($vars['footer']) ? $vars['footer'] : '', null, 1);
$html .= '</div>';
// }
$html .= '</div>';
WW_addScript('issue-tracker/str.js');
WW_addScript('issue-tracker/admin.js');
WW_addScript('/j/jquery.multiselect/jquery.multiselect.min.js');
WW_addCSS('/j/jquery.multiselect/jquery.multiselect.css');
Ejemplo n.º 15
0
}
$c .= '<div id="blog-featured-excerpts"><div class="main">';
$shown = 0;
foreach ($rs as $r) {
    $c .= '<div class="featured-excerpt"';
    if ($shown++) {
        $c .= ' style="display:none"';
    }
    $c .= '>';
    // { image
    if (!$r['excerpt_image']) {
        $img = preg_replace('/.*<img.*?src="([^"]*)".*/m', '\\1', str_replace(array("\n", "\r"), ' ', $r['body']));
        if (strpos($img, '/f') === 0) {
            $r['excerpt_image'] = preg_replace('#^/f/#', '', $img);
        }
    }
    $img = '';
    if ($r['excerpt_image']) {
        $img = '<img class="blog-excerpt-image" src="/a/f=getImg/w=320/h=200/' . $r['excerpt_image'] . '"/>';
    }
    // }
    $c .= $img;
    $excerpt = preg_replace('/<[^>]*>/', ' ', $r['body']);
    $date = preg_replace('/ .*/', '', $r['cdate']);
    $c .= '<div class="text"><div class="overlay"></div>' . '<h2 class="blog-header">' . htmlspecialchars($r['title']) . '</h2>' . '<div class="blog-excerpt">' . $excerpt . '</div>' . '<a class="blog-link-to-article" href="' . $links_prefix . '/' . $r['user_id'] . '/' . $date . '/' . preg_replace('/[^a-zA-Z0-9]/', '-', transcribe($r['title'])) . '">' . __('Read more', 'core') . '</a>' . '</div>';
    $c .= '</div>';
}
$c .= '</div>' . '<div class="carousel"></div>' . '</div>';
WW_addScript('blog/j/featured.js');
WW_addCSS('/ww.plugins/blog/c/featured.css');
Ejemplo n.º 16
0
 * PHP version 5.2
 *
 * @category None
 * @package  None
 * @author   Conor Mac Aoidh <*****@*****.**>
 * @author   Kae Verens <*****@*****.**>
 * @license  GPL 2.0
 * @link     http://kvsites.ie/
 */
if (!defined('SCRIPTBASE')) {
    // don't access directly
    Core_quit();
}
require_once SCRIPTBASE . '/ww.plugins/themes-api/api/funcs.php';
WW_addScript('themes-api/carousel.js');
WW_addCSS('/ww.plugins/themes-api/api.css');
$script = '
$( "#carousel" ).themesCarousel({loop:true});
$( "#next" ).click( function( ){
	$( "#carousel" ).themesCarousel( "next" );
} );
$( "#prev" ).click( function( ){
	$( "#carousel" ).themesCarousel( "previous" );
} );
$( "#themes_search" ).click( function( ){
	var value = $( this ).val( );
	$( "#carousel" ).themesCarousel( "search", value );
});
';
WW_addInlineScript($script);
$html = '<input type="text" name="themes_search" /><input type="submit" ' . 'name="Search" id="themes_search"/>' . '<h1>' . __('Themes Repository') . '</h1>' . '<div id="carousel"></div>' . '<div id="previous">&lt;</div>' . '<div id="next" style="position:relative;top:0;background:#000;color:#ff' . 'f;padding:30px">&gt;</div> <br style="clear:both"/>';
Ejemplo n.º 17
0
/**
 * 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'] == '&nbsp;') {
        $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'] != '&nbsp;') {
            $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'] != '&nbsp;') {
        $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'] == '&nbsp;') {
        $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;
}
Ejemplo n.º 18
0
}
$c .= '</select></td>';
// }
// { show captions in slider
$c .= '<th>Show Captions in Slider</th><td>' . '<select name="page_vars[image_gallery_captions_in_slider]">' . '<option>No</option><option value="1"';
if ('1' == @$vars['image_gallery_captions_in_slider']) {
    $c .= ' selected="selected"';
}
$c .= '">Yes</option></select></td></tr>';
// }
$c .= '<tr><th>Gallery Container Width:</th>';
$c .= '<td><input type="text" name="page_vars[image_gallery_width]" ';
$c .= ' value="' . @$vars['image_gallery_width'] . '"/></td>';
$c .= '<td colspan="2"><i>If left blank this value will be calculated manually, this is ' . 'the recommended method.</i></td>';
$c .= '</tr>';
// }
// }
// { form footer
$c .= '</table>';
$c .= '</div>';
$c .= '</div>';
if (!is_dir(USERBASE . '/ww.cache/image-gallery')) {
    mkdir(USERBASE . '/ww.cache/image-gallery');
}
if (file_exists(USERBASE . '/ww.cache/image-gallery/' . $page['id'])) {
    unlink(USERBASE . '/ww.cache/image-gallery/' . $page['id']);
}
file_put_contents(USERBASE . '/ww.cache/image-gallery/' . $page['id'], @$vars['gallery-template']);
ww_addScript('/ww.plugins/image-gallery/admin/admin.js');
WW_addCSS('/ww.plugins/image-gallery/admin/admin.css');
// }
Ejemplo n.º 19
0
/**
 * 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;
}
Ejemplo n.º 20
0
/**
 * 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']) . ' &raquo; <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;
}
Ejemplo n.º 21
0
/**
 * 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;
}
Ejemplo n.º 22
0
<?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');
// }
Ejemplo n.º 23
0
 * 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&amp;_page=products">' . __('List all products') . '</a> | <a href="plugin.php?_plugin=products&amp;_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&amp;_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');
Ejemplo n.º 24
0
    if (isset($_SESSION['userdata']['discount'])) {
        $tmp .= ',discount:' . (int) $_SESSION['userdata']['discount'];
    }
    $tmp .= ',groups:' . json_encode($_SESSION['userdata']['groups']);
    $tmp .= '}';
} else {
    $tmp .= 'userdata={isAdmin:0}';
}
$tmp .= ';document.write("<"+"style>' . 'a.nojs{display:none !important}<"+"/style>");';
array_unshift($scripts_inline, $tmp);
// }
if (is_admin()) {
    WW_addScript('/ww.admin/j/admin-frontend.js');
    WW_addScript('/j/ckeditor-3.5/ckeditor.js');
    WW_addScript('/j/ckeditor-3.5/adapters/jquery.js');
    WW_addCSS('/ww.admin/theme/admin-frontend.css');
    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) . '"/>';
}
Ejemplo n.º 25
0
/**
 * 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'];
}
Ejemplo n.º 26
0
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');
Ejemplo n.º 27
0
/**
 * 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>';
    }
}
Ejemplo n.º 28
0
 /**
  * render a list of products to HTML
  *
  * @param object $PAGEDATA      the page object
  * @param int    $start         offset
  * @param int    $limit         how many products to show
  * @param string $order_by      what field to order the search by
  * @param int    $order_dir     order ascending or descending
  * @param int    $limit_start   lowest $start offset allowed
  * @param int    $enabledFilter whether to allow enabled/disabled products
  *
  * @return string the HTML of the products list
  */
 function render($PAGEDATA, $start = 0, $limit = 0, $order_by = '', $order_dir = 0, $limit_start = 0, $enabledFilter = 0)
 {
     global $cdnprefix;
     $c = '';
     // { sort based on $order_by
     $md5 = md5('ps-sorted-' . join(',', $this->product_ids) . '|' . $order_by . '|' . $order_dir . '|' . $enabledFilter);
     $tmpprods = -1;
     if ($order_dir != 2) {
         $tmpprods = Core_cacheLoad('products', $md5, -1);
     }
     if ($tmpprods == -1) {
         if ($order_by != '') {
             $native = substr($order_by, 0, 1) === '_';
             $tmpprods1 = array();
             $prods = $this->product_ids;
             $sql = 'select id';
             if (!$native) {
                 $sql .= ',data_fields';
             }
             $sql .= ' from products where id in (' . join(', ', $this->product_ids) . ')';
             if ($enabledFilter == 0) {
                 $sql .= ' and enabled';
             }
             if ($enabledFilter == 1) {
             }
             if ($enabledFilter == 2) {
                 $sql .= ' and !enabled';
             }
             if ($native) {
                 $sql .= ' order by ' . substr($order_by, 1, strlen($order_by) - 1);
                 if ($order_dir == 1) {
                     $sql .= ' desc';
                 }
             }
             $values = dbAll($sql, '', 'products');
             if ($native) {
                 $tmpprods = array();
                 if (is_array($values)) {
                     foreach ($values as $v) {
                         $tmpprods[] = $v['id'];
                     }
                     if ($order_dir == 2) {
                         shuffle($tmpprods);
                     }
                 }
             } else {
                 if (is_array($values)) {
                     foreach ($values as $v) {
                         $vals = json_decode($v['data_fields'], true);
                         $key2 = '';
                         foreach ($vals as $v2) {
                             if ($v2['n'] == $order_by) {
                                 $key2 = __FromJSON($v2['v']);
                             }
                         }
                         if (!isset($tmpprods1[$key2])) {
                             $tmpprods1[$key2] = array();
                         }
                         $tmpprods1[$key2][] = $v['id'];
                     }
                 }
                 if ($order_dir == 1) {
                     krsort($tmpprods1);
                 } else {
                     if ($order_dir == 0) {
                         ksort($tmpprods1);
                     } else {
                         if ($order_dir == 2) {
                             shuffle($tmpprods1);
                         }
                     }
                 }
                 $tmpprods = array();
                 foreach ($tmpprods1 as $pids) {
                     foreach ($pids as $pid) {
                         $tmpprods[] = $pid;
                     }
                 }
                 foreach ($prods as $key => $pid) {
                     $tmpprods[] = $pid;
                 }
             }
         } else {
             $tmpprods = $this->product_ids;
         }
         Core_cacheSave('products', $md5, $tmpprods);
     }
     // }
     // { sanitise the limits
     $cnt = count($tmpprods);
     if (!$limit) {
         $limit = $cnt;
         $start = 0;
     } else {
         if ($start && $start >= count($this->product_ids)) {
             $start = $cnt - $limit;
         }
     }
     // }
     // { build array of items
     $prevnext = '';
     $total_found = count($tmpprods);
     if ($cnt == $limit) {
         $prods =& $tmpprods;
     } else {
         $prods = array();
         for ($i = $start; $i < $limit + $start; ++$i) {
             if (isset($tmpprods[$i])) {
                 $prods[] = $tmpprods[$i];
             }
         }
         $prefix = '';
         if ($PAGEDATA->vars['products_what_to_show'] == 2) {
             $cat = ProductCategory::getInstance($PAGEDATA->vars['products_category_to_show']);
             if ($cat) {
                 $prefix = $cat->getRelativeUrl();
             }
         }
         if (!$prefix) {
             $prefix = $PAGEDATA->getRelativeUrl();
         }
         if ($start > $limit_start) {
             $prevnext .= '<a class="products-prev" href="' . $prefix . '?start=' . ($start - $limit) . '">' . __('Previous') . '</a>';
         }
         if ($limit && $start + $limit < $cnt) {
             if ($start) {
                 $prevnext .= ' | ';
             }
             $prevnext .= '<a class="products-next" href="' . $prefix . '?start=' . ($start + $limit) . '">' . __('Next') . '</a>';
         }
     }
     $prevnext = '<div class="products-pagination">' . $prevnext . '</div>';
     // }
     // { see if there are search results
     if (isset($PAGEDATA->vars['products_add_a_search_box']) && $PAGEDATA->vars['products_add_a_search_box']) {
         $c .= '<div class="products-num-results">' . __('<strong>%1</strong> results found.', array($total_found), 'core') . '</div>';
     }
     // }
     if (!isset($PAGEDATA->vars['products_show_multiple_with'])) {
         $PAGEDATA->vars['products_show_multiple_with'] = 0;
     }
     $prods = array_unique($prods);
     switch ($PAGEDATA->vars['products_show_multiple_with']) {
         case 1:
             // { horizontal table, headers on top
             $c .= Product_datatableMultiple($prods, 'horizontal');
             break;
             // }
         // }
         case 2:
             // { vertical table, headers on left
             $c .= Product_datatableMultiple($prods, 'vertical');
             break;
             // }
         // }
         case 3:
             // { map view
             WW_addScript('products');
             WW_addCSS('/ww.plugins/products/products.css');
             return '<div id="products-mapview"></div>';
             // }
         // }
         case 4:
             // { carousel
             WW_addScript('products');
             $c = '<div id="products-carousel"><ul id="products-carousel-slider">';
             foreach ($prods as $pid) {
                 $product = Product::getInstance($pid, false, $enabledFilter);
                 if ($product && isset($product->id) && $product->id) {
                     $typeID = $product->get('product_type_id');
                     $type = ProductType::getInstance($typeID);
                     if (!$type) {
                         $c .= '<li>' . __('Missing Product Type: %1', array($typeID), 'core') . '</li>';
                     } else {
                         $c .= '<li id="products-' . $product->id . '" class="products-product">' . $type->render($product, 'multiview', 0) . '</li>';
                     }
                 }
             }
             $c .= '</ul></div>';
             WW_addScript('/j/jsor-jcarousel-7bb2e0a/jquery.jcarousel.min.js');
             WW_addCSS('/ww.plugins/products/products.css');
             return $c;
             // }
         // }
         default:
             // { use template
             if (count($prods)) {
                 // display the first item's header
                 $product = Product::getInstance($prods[0], false, $enabledFilter);
                 $type = ProductType::getInstance($product->get('product_type_id'));
                 if ($type) {
                     $smarty = Products_setupSmarty();
                     $c .= $smarty->fetch(USERBASE . '/ww.cache/products/templates/types_multiview_' . $type->id . '_header');
                 }
             }
             foreach ($prods as $pid) {
                 $product = Product::getInstance($pid, false, $enabledFilter);
                 if ($product && isset($product->id) && $product->id) {
                     $typeID = $product->get('product_type_id');
                     $type = ProductType::getInstance($typeID);
                     if (!$type) {
                         $c .= __('Missing Product Type: %1', array($typeID), 'core');
                     } else {
                         if (isset($_REQUEST['product_id'])) {
                             $c .= $type->render($product, 'singleview');
                         } else {
                             $c .= $type->render($product, 'multiview');
                         }
                     }
                 }
             }
             if (isset($type) && $type && count($prods)) {
                 // display first item's header
                 $smarty = Products_setupSmarty();
                 $c .= $smarty->fetch(USERBASE . '/ww.cache/products/templates/types_multiview_' . $type->id . '_footer');
             }
             // }
     }
     $categories = '';
     if (!isset($_REQUEST['products-search']) && isset($this->subCategories) && count($this->subCategories) && !@$PAGEDATA->vars['products_dont_show_sub_categories']) {
         $categories = '<ul class="products-categories categories">';
         foreach ($this->subCategories as $cr) {
             $cat = ProductCategory::getInstance($cr['id']);
             $categories .= '<li><a href="' . $cat->getRelativeUrl() . '">';
             $icon = '/products/categories/' . $cr['id'] . '/icon.png';
             if (file_exists(USERBASE . 'f' . $icon)) {
                 $subcatW = (int) $cat->vals['thumbsize_w'];
                 $subcatH = (int) $cat->vals['thumbsize_h'];
                 $categories .= '<img src="' . $cdnprefix . '/a/f=getImg/w=' . $subcatW . '/h=' . $subcatH . '/fmt=' . filemtime(USERBASE . 'f' . $icon) . $icon . '"/>';
             }
             $categories .= '<span>' . htmlspecialchars($cr['name']) . '</span>' . '</a></li>';
         }
         $categories .= '</ul>';
     }
     return $categories . $prevnext . '<div class="products">' . $c . '</div>' . $prevnext;
 }
Ejemplo n.º 29
0
 * @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';
Ejemplo n.º 30
0
    exit;
}
// }
require $dir . '/admin_libs.php';
$admin_vars = array();
// { common variables
foreach (array('action', 'resize') as $v) {
    ${$v} = getVar($v);
}
foreach (array('show_items', 'start') as $v) {
    ${$v} = getVar($v, 0);
}
$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
// }
WW_addScript('/j/jquery.dataTables-1.7.5/jquery.dataTables.min.js');
WW_addCSS('/j/jquery.dataTables-1.7.5/jquery.dataTables.css');
WW_addScript('/j/jquery.remoteselectoptions.js');
WW_addScript('/j/fg.menu/fg.menu.js');
WW_addScript('/j/ckeditor-3.5/ckeditor.js');
WW_addScript('/j/cluetip/jquery.cluetip.js');
WW_addScript('/ww.admin/j/admin.js');
?>
<!doctype html>
<html>
	<head>
		<title>WebME admin area</title>
<?php 
echo Core_getJQueryScripts();
?>
		<?php 
echo '<script src="/js/' . filemtime(SCRIPTBASE . 'j/js.js') . '"></script>';