Пример #1
0
 function generateLoginButton($scopes = ['publicData'])
 {
     $login = "";
     $login .= '<a href="';
     $login .= generateLink($scopes);
     $login .= '">';
     $login .= '<img alt="EVE SSO Login Buttons Small White" src="https://images.contentful.com/idjq7aai9ylm/18BxKSXCymyqY4QKo8KwKe/c2bdded6118472dd587c8107f24104d7/EVE_SSO_Login_Buttons_Small_White.png?w=195&amp;h=30"></a>';
     return $login;
 }
Пример #2
0
function generate_currency_cache($load = false)
{
    global $mysql, $config;
    $eshop_dir = get_plugcfg_dir('eshop');
    if (!file_exists($eshop_dir . '/cache_currency.php') or $load) {
        $currency_link = checkLinkAvailable('eshop', 'currency') ? generateLink('eshop', 'currency', array()) : generateLink('core', 'plugin', array('plugin' => 'eshop', 'handler' => 'currency'), array());
        $currency_tEntry = array();
        foreach ($mysql->select("SELECT * FROM " . prefix . "_eshop_currencies WHERE enabled = 1 ORDER BY position, id") as $row) {
            $row['currency_link'] = $currency_link . "?id=" . $row['id'];
            $currency_tEntry[] = $row;
        }
        file_put_contents($eshop_dir . '/cache_currency.php', serialize($currency_tEntry));
    }
}
Пример #3
0
function automation()
{
    global $tpl, $mysql, $twig;
    $tpath = locatePluginTemplates(array('config/main', 'config/automation'), 'eshop', 1);
    if (isset($_REQUEST['yml_url']) && !empty($_REQUEST['yml_url']) && isset($_REQUEST['import'])) {
        import_yml($_REQUEST['yml_url']);
        //$import_str = implode('<br/>',$_SESSION['import_yml']);
        //$info = "Импорт YML успешно завершен<br/><br/>".$import_str;
        $info = "Импорт YML успешно завершен";
        msg(array("type" => "info", "info" => $info));
    }
    if (isset($_REQUEST['currency'])) {
        $rates_str = update_currency();
        $info = "Валюты обновлены<br/><br/>" . $rates_str;
        msg(array("type" => "info", "info" => $info));
    }
    $xt = $twig->loadTemplate($tpath['config/automation'] . 'config/' . 'automation.tpl');
    $yml_export_link = checkLinkAvailable('eshop', 'yml_export') ? generateLink('eshop', 'yml_export', array()) : generateLink('core', 'plugin', array('plugin' => 'eshop', 'handler' => 'yml_export'), array());
    $tVars = array('yml_export_link' => $yml_export_link, 'info' => '');
    $xg = $twig->loadTemplate($tpath['config/main'] . 'config/' . 'main.tpl');
    $tVars = array('entries' => $xt->render($tVars), 'php_self' => $PHP_SELF, 'plugin_url' => admin_url . '/admin.php?mod=extra-config&plugin=eshop', 'skins_url' => skins_url, 'admin_url' => admin_url, 'home' => home, 'current_title' => 'Автоматизация');
    print $xg->render($tVars);
}
Пример #4
0
function ebasket_rpc_manage($params)
{
    global $userROW, $DSlist, $mysql, $twig;
    LoadPluginLibrary('xfields', 'common');
    if (!is_array($params) || !isset($params['action'])) {
        return array('status' => 0, 'errorCode' => 1, 'errorText' => 'Activity mode is not set');
    }
    $params = arrayCharsetConvert(1, $params);
    switch ($params['action']) {
        // **** ADD NEW ITEM INTO ebasket ****
        case 'add':
            $linked_ds = intval($params['ds']);
            $linked_id = intval($params['id']);
            $count = intval($params['count']);
            // Check available DataSources
            if (!in_array($linked_ds, array($DSlist['news']))) {
                return array('status' => 0, 'errorCode' => 2, 'errorText' => 'ebasket can be used only for NEWS');
            }
            // Check available DataSources
            if ($count < 1) {
                return array('status' => 0, 'errorCode' => 2, 'errorText' => 'Count should be positive');
            }
            // Check if linked item is available
            switch ($linked_ds) {
                case $DSlist['news']:
                    $conditions = array();
                    if ($linked_id) {
                        array_push($conditions, "p.id = " . db_squote($linked_id));
                    }
                    $fSort = " GROUP BY p.id ORDER BY p.id DESC";
                    $sqlQPart = "FROM " . prefix . "_eshop_products p LEFT JOIN " . prefix . "_eshop_products_categories pc ON p.id = pc.product_id LEFT JOIN " . prefix . "_eshop_categories c ON pc.category_id = c.id LEFT JOIN (SELECT * FROM " . prefix . "_eshop_images ORDER BY position, id) i ON i.product_id = p.id LEFT JOIN " . prefix . "_eshop_variants v ON p.id = v.product_id " . (count($conditions) ? "WHERE " . implode(" AND ", $conditions) : '') . $fSort;
                    $sqlQ = "SELECT p.id AS id, p.url as url, p.code AS code, p.name AS name, p.active AS active, p.featured AS featured, p.position AS position, c.url as curl, c.name AS category, i.filepath AS image_filepath, v.price AS price, v.compare_price AS compare_price, v.stock AS stock " . $sqlQPart;
                    // Retrieve news record
                    $rec = $mysql->record($sqlQ);
                    if (!is_array($rec)) {
                        return array('status' => 0, 'errorCode' => 3, 'errorText' => 'Item [news] with ID (' . $linked_id . ') is not found');
                    }
                    $btitle = $rec['name'];
                    $price = $rec['price'];
                    $view_link = checkLinkAvailable('eshop', 'show') ? generateLink('eshop', 'show', array('alt' => $rec['url'])) : generateLink('core', 'plugin', array('plugin' => 'eshop', 'handler' => 'show'), array('alt' => $rec['url']));
                    $rec['view_link'] = $view_link;
                    // Add data into basked
                    return ebasket_add_item($linked_ds, $linked_id, $btitle, $price, $count, array('item' => $rec));
                    break;
            }
            break;
        case 'update_count':
            $id = intval($params['id']);
            $linked_ds = intval($params['linked_ds']);
            $linked_id = intval($params['linked_id']);
            $count = intval($params['count']);
            return basket_update_item_count($id, $linked_ds, $linked_id, $count);
            break;
        case 'delete':
            $id = intval($params['id']);
            $linked_ds = intval($params['linked_ds']);
            $linked_id = intval($params['linked_id']);
            return basket_delete_item($id, $linked_ds, $linked_id);
            break;
        case 'add_fast':
            $linked_ds = intval($params['ds']);
            $linked_id = intval($params['id']);
            $count = intval($params['count']);
            $type = intval($params['type']);
            $order['name'] = filter_var($params['name'], FILTER_SANITIZE_STRING);
            if (empty($order['name'])) {
                return array('status' => 0, 'errorCode' => 3, 'errorText' => 'Item [news] with ID (' . $linked_id . ') is not found');
            }
            $order['email'] = "";
            $order['phone'] = filter_var($params['phone'], FILTER_SANITIZE_STRING);
            if (empty($order['phone'])) {
                return array('status' => 0, 'errorCode' => 3, 'errorText' => 'Item [news] with ID (' . $linked_id . ') is not found');
            }
            $order['address'] = filter_var($params['address'], FILTER_SANITIZE_STRING);
            if (empty($order['address'])) {
                return array('status' => 0, 'errorCode' => 3, 'errorText' => 'Item [news] with ID (' . $linked_id . ') is not found');
            }
            // Check available DataSources
            if (!in_array($linked_ds, array($DSlist['news']))) {
                return array('status' => 0, 'errorCode' => 2, 'errorText' => 'ebasket can be used only for NEWS');
            }
            // Check available DataSources
            if ($count < 1) {
                $count = 1;
            }
            $conditions = array();
            if ($linked_id) {
                array_push($conditions, "p.id = " . db_squote($linked_id));
            }
            $fSort = " GROUP BY p.id ORDER BY p.id DESC";
            $sqlQPart = "FROM " . prefix . "_eshop_products p LEFT JOIN " . prefix . "_eshop_products_categories pc ON p.id = pc.product_id LEFT JOIN " . prefix . "_eshop_categories c ON pc.category_id = c.id LEFT JOIN (SELECT * FROM " . prefix . "_eshop_images ORDER BY position, id) i ON i.product_id = p.id LEFT JOIN " . prefix . "_eshop_variants v ON p.id = v.product_id " . (count($conditions) ? "WHERE " . implode(" AND ", $conditions) : '') . $fSort;
            $sqlQ = "SELECT p.id AS id, p.url as url, p.code AS code, p.name AS name, p.active AS active, p.featured AS featured, p.position AS position, c.url as curl, c.name AS category, i.filepath AS image_filepath, v.price AS price, v.compare_price AS compare_price, v.stock AS stock " . $sqlQPart;
            // Retrieve news record
            $rec = $mysql->record($sqlQ);
            if (!is_array($rec)) {
                return array('status' => 0, 'errorCode' => 3, 'errorText' => 'Item [news] with ID (' . $linked_id . ') is not found');
            }
            $btitle = $rec['name'];
            $price = $rec['price'];
            $view_link = checkLinkAvailable('eshop', 'show') ? generateLink('eshop', 'show', array('alt' => $row['url'])) : generateLink('core', 'plugin', array('plugin' => 'eshop', 'handler' => 'show'), array('alt' => $row['url']));
            $rec['view_link'] = $view_link;
            // Add data into basked
            return ebasket_add_fast_order($linked_ds, $linked_id, $btitle, $price, $count, $type, $order, array('item' => $rec));
            break;
    }
    return array('status' => 1, 'errorCode' => 0, 'data' => 'OK, ' . var_export($params, true));
}
*/
define('XAJAX_HTML_CONTROL_DOCTYPE_FORMAT', 'HTML');
define('XAJAX_HTML_CONTROL_DOCTYPE_VERSION', '4.01');
define('XAJAX_HTML_CONTROL_DOCTYPE_VALIDATION', 'TRANSITIONAL');
$sBaseFolder = dirname(dirname(dirname(__FILE__)));
$sCoreFolder = '/xajax_core';
$sCtrlFolder = '/xajax_controls';
include $sBaseFolder . $sCoreFolder . '/xajax.inc.php';
$xajax = new xajax();
$xajax->configure('javascript URI', '../../');
include $sBaseFolder . $sCtrlFolder . '/validate_HTML401TRANSITIONAL.inc.php';
include $sBaseFolder . $sCoreFolder . '/xajaxControl.inc.php';
foreach (array('/document.inc.php', '/structure.inc.php', '/content.inc.php', '/form.inc.php', '/group.inc.php', '/misc.inc.php') as $sFile) {
    include $sBaseFolder . $sCtrlFolder . $sFile;
}
$objDocument = new clsDocument(array('children' => array(new clsDoctype(), new clsHtml(array('children' => array(new clsHead(array('xajax' => $xajax, 'children' => array(generateTitle(), generateStyle(), generateScript(), generateMeta(), generateLink(), generateBase()))), new clsBody(array('children' => array(generateOrderedList(), generateUnorderedList(), generateDefinitionList(), generateTable(), generateForm(), generateContent(), generateValidation(), generateIframe())))))))));
function generateTitle()
{
    return new clsTitle(array('child' => new clsLiteral('Title')));
}
function generateStyle()
{
    return new clsStyle(array('attributes' => array('type' => 'text/css'), 'child' => new clsLiteral('styleOne { background: #ffdddd; }')));
}
function generateScript()
{
    return new clsScript(array('attributes' => array('type' => 'text/javascript'), 'child' => new clsLiteral('javascriptFunction = function(a, b) { alert(a*b); };')));
}
function generateMeta()
{
    return new clsMeta(array('attributes' => array('name' => 'keywords', 'lang' => 'en-us', 'content' => 'xajax, javascript, php, ajax')));
Пример #6
0
		if (description.length < 15) {
			$("#wmd-input").addClass('textalert');
			$.fancyalert('Your description must be atleast 15 characters in length');
			$("#wmd-input").focus();
			return false;
		} else {
			$("#wmd-input").removeClass('textalert');
		}

		return true;
	}
</script>

<form action="<?php 
echo generateLink("questions", "post");
?>
" method="post" onsubmit="javascript:return cform();">

	<h1>What would you like to ask or contribute?</h1>
	<input type="textbox" class="textbox" name="title" id="title" tabindex="1"/><br/>

	<div id="wmd-editor" class="wmd-panel" style="padding-top:10px">
		<div id="wmd-button-bar"></div>
		<textarea id="wmd-input" name="description" tabindex="2" ></textarea>
	</div>
	<div id="wmd-preview" class="markdown"></div>

	<h3 style="padding-top:20px">Share a Link</h3>
	<input type="textbox" class="textbox" name="link" id="link" tabindex="3"/><br/>
Пример #7
0
        printf("<a href=\"" . BASE_PATH . "/admin\">Admin Panel</a><br>");
    }
    ?>
				<a href="<?php 
    echo BASE_PATH;
    ?>
/users/logout">Logout</a>
			</div>
			<div style="clear:both"></div>
		</div>
		<?php 
} elseif (empty($loginpage)) {
    ?>
		<div class="userlogin">
			<form action="<?php 
    echo generateLink("users", "validate");
    ?>
" method="post">
				<h3>E-mail</h3>
				<input type="textbox" class="textbox" name="email" style="width:215px;"/>
				<h3>Password</h3>
				<input type="password" class="textbox" name="password" style="width:215px;"/>
				<input type="hidden" name="returnurl" value="<?php 
    echo getLink();
    ?>
">
				<div style="padding-top:10px">
					<input type="submit" value="Login" class="button"> or <i><a href="<?php 
    echo BASE_PATH;
    ?>
/users/register">click here to register</a></i>
Пример #8
0
	if (password.length < 1 || password.length > 100) {
		$("#namepassword").addClass('textalert');
		$.fancyalert('Please enter your password');
		$("#password").focus();
		return false;
	} else {
		$("#password").removeClass('textalert');
	}


	return true;
}
</script>

<form action="<?php 
echo generateLink("users", "create");
?>
" method="post" onsubmit="javascript:return cform();">

<h1>Register</h1>

<h3>Name</h3>
<input type="textbox" class="textbox" name="name" id="name"/><br/>

<h3>E-mail</h3>
<input type="textbox" class="textbox" name="email" id="email"/><br/>

<h3>Password</h3>
<input type="password" class="textbox" name="password" id="password"/></select>

<br/><br/>
Пример #9
0
function plugin_gsmg_screen()
{
    global $config, $mysql, $catz, $catmap, $SUPRESS_TEMPLATE_SHOW, $SYSTEM_FLAGS, $PFILTERS;
    $SUPRESS_TEMPLATE_SHOW = 1;
    $SUPRESS_MAINBLOCK_SHOW = 1;
    @header('Content-type: text/xml; charset=utf-8');
    $SYSTEM_FLAGS['http.headers'] = array('content-type' => 'application/xml; charset=charset=utf-8', 'cache-control' => 'private');
    if (extra_get_param('gsmg', 'cache')) {
        $cacheData = cacheRetrieveFile('gsmg.txt', extra_get_param('gsmg', 'cacheExpire'), 'gsmg');
        if ($cacheData != false) {
            // We got data from cache. Return it and stop
            print $cacheData;
            return;
        }
    }
    $output = '<?xml version="1.0" encoding="UTF-8"?>';
    $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
    // Настройки постранички
    if ($config['number'] < 1) {
        $config['number'] = 5;
    }
    // Надо ли выводить данные с головной страницы
    if (extra_get_param('gsmg', 'main')) {
        $output .= "<url>";
        $output .= "<loc>" . generateLink('news', 'main', array(), array(), false, true) . "</loc>";
        $output .= "<priority>" . floatval(extra_get_param('gsmg', 'main_pr')) . "</priority>";
        $lm = $mysql->record("select date(from_unixtime(max(postdate))) as pd from " . prefix . "_news");
        $output .= "<lastmod>" . $lm['pd'] . "</lastmod>";
        $output .= "<changefreq>daily</changefreq>";
        $output .= "</url>";
        if (extra_get_param('gsmg', 'mainp')) {
            $cnt = $mysql->record("select count(*) as cnt from " . prefix . "_news");
            $pages = ceil($cnt['cnt'] / $config['number']);
            for ($i = 2; $i <= $pages; $i++) {
                $output .= "<url>";
                $output .= "<loc>" . generateLink('news', 'main', array('page' => $i), array(), false, true) . "</loc>";
                $output .= "<priority>" . floatval(extra_get_param('gsmg', 'mainp_pr')) . "</priority>";
                $output .= "<lastmod>" . $lm['pd'] . "</lastmod>";
                $output .= "<changefreq>daily</changefreq>";
                $output .= "</url>";
            }
        }
    }
    // Надо ли выводить данные по категориям
    if (extra_get_param('gsmg', 'cat')) {
        foreach ($catmap as $id => $altname) {
            $output .= "<url>";
            $output .= "<loc>" . generateLink('news', 'by.category', array('category' => $altname, 'catid' => $id), array(), false, true) . "</loc>";
            $output .= "<priority>" . floatval(extra_get_param('gsmg', 'cat_pr')) . "</priority>";
            $output .= "<lastmod>" . $lm['pd'] . "</lastmod>";
            $output .= "<changefreq>daily</changefreq>";
            $output .= "</url>";
            if (extra_get_param('gsmg', 'catp')) {
                $cn = $catz[$altname]['number'] > 0 ? $catz[$altname]['number'] : $config['number'];
                $pages = ceil($catz[$altname]['posts'] / $cn);
                for ($i = 2; $i <= $pages; $i++) {
                    $output .= "<url>";
                    $output .= "<loc>" . generateLink('news', 'by.category', array('category' => $altname, 'catid' => $id, 'page' => $i), array(), false, true) . "</loc>";
                    $output .= "<priority>" . floatval(extra_get_param('gsmg', 'catp_pr')) . "</priority>";
                    $output .= "<lastmod>" . $lm['pd'] . "</lastmod>";
                    $output .= "<changefreq>daily</changefreq>";
                    $output .= "</url>";
                }
            }
        }
    }
    // Надо ли выводить данные по новостям
    if (extra_get_param('gsmg', 'news')) {
        $query = "select id, postdate, author, author_id, alt_name, editdate, catid from " . prefix . "_news where approve = 1 order by id desc";
        foreach ($mysql->select($query, 1) as $rec) {
            $link = newsGenerateLink($rec, false, 0, true);
            $output .= "<url>";
            $output .= "<loc>" . $link . "</loc>";
            $output .= "<priority>" . floatval(extra_get_param('gsmg', 'news_pr')) . "</priority>";
            $output .= "<lastmod>" . strftime("%Y-%m-%d", max($rec['editdate'], $rec['postdate'])) . "</lastmod>";
            $output .= "<changefreq>daily</changefreq>";
            $output .= "</url>";
        }
    }
    // Надо ли выводить данные по статическим страницам
    if (extra_get_param('gsmg', 'static')) {
        $query = "select id, alt_name from " . prefix . "_static where approve = 1";
        foreach ($mysql->select($query, 1) as $rec) {
            $link = generatePluginLink('static', '', array('altname' => $rec['alt_name'], 'id' => $rec['id']), array(), false, true);
            $output .= "<url>";
            $output .= "<loc>" . $link . "</loc>";
            $output .= "<priority>" . floatval(extra_get_param('gsmg', 'static_pr')) . "</priority>";
            $output .= "<lastmod>" . $lm['pd'] . "</lastmod>";
            $output .= "<changefreq>weekly</changefreq>";
            $output .= "</url>";
        }
    }
    if (is_array($PFILTERS['gsmg'])) {
        foreach ($PFILTERS['gsmg'] as $k => $v) {
            $v->onShow($output);
        }
    }
    $output .= "</urlset>";
    print $output;
    cacheStoreFile('gsmg.txt', $output, 'gsmg');
}
Пример #10
0
function automation()
{
    global $tpl, $mysql, $twig;
    $tpath = locatePluginTemplates(array('config/main', 'config/automation'), 'eshop', 1);
    if (isset($_REQUEST['yml_url']) && !empty($_REQUEST['yml_url']) && isset($_REQUEST['import'])) {
        import_yml($_REQUEST['yml_url']);
        //$import_str = implode('<br/>',$_SESSION['import_yml']);
        //$info = "Импорт YML успешно завершен<br/><br/>".$import_str;
        $info = "Импорт YML успешно завершен";
        msg(array("type" => "info", "info" => $info));
    }
    if (isset($_REQUEST['currency'])) {
        $rates_str = update_currency();
        $info = "Валюты обновлены<br/><br/>" . $rates_str;
        msg(array("type" => "info", "info" => $info));
    }
    if (isset($_REQUEST['change_price'])) {
        $change_price_type = intval($_REQUEST['change_price_type']);
        $change_price_qnt = intval($_REQUEST['change_price_qnt']);
        update_prices($change_price_type, $change_price_qnt);
        $info = "Цены обновлены<br/>";
        msg(array("type" => "info", "info" => $info));
    }
    if (isset($_REQUEST['export_csv'])) {
        $SUPRESS_TEMPLATE_SHOW = 1;
        $SUPRESS_MAINBLOCK_SHOW = 1;
        require_once dirname(__FILE__) . '/csv_lib/CsvImportInterface.php';
        require_once dirname(__FILE__) . '/csv_lib/CsvImport.php';
        require_once dirname(__FILE__) . '/csv_lib/CsvExportInterface.php';
        require_once dirname(__FILE__) . '/csv_lib/CsvExport.php';
        $export = new CsvExport();
        $cat_array = array();
        foreach ($mysql->select('SELECT * FROM ' . prefix . '_eshop_categories ORDER BY position ASC') as $cat_row) {
            $catlink = checkLinkAvailable('eshop', '') ? generateLink('eshop', '', array('cat' => $cat_row['id'])) : generateLink('core', 'plugin', array('plugin' => 'eshop'), array('cat' => $cat_row['id']));
            $cat_array[] = array('id' => $cat_row['id'], 'url' => $cat_row['url'], 'image' => $cat_row['image'], 'name' => $cat_row['name'], 'description' => $cat_row['description'], 'parent_id' => $cat_row['parent_id'], 'position' => $cat_row['position'], 'meta_title' => $cat_row['meta_title'], 'meta_keywords' => $cat_row['meta_keywords'], 'meta_description' => $cat_row['meta_description'], 'link' => $catlink);
        }
        $conditions = array();
        array_push($conditions, "p.active = 1");
        //$limitCount = "10000";
        $fSort = " GROUP BY p.id ORDER BY p.id DESC ";
        $sqlQPart = "FROM " . prefix . "_eshop_products p LEFT JOIN " . prefix . "_eshop_products_categories pc ON p.id = pc.product_id LEFT JOIN " . prefix . "_eshop_categories c ON pc.category_id = c.id " . (count($conditions) ? "WHERE " . implode(" AND ", $conditions) : '') . $fSort;
        $sqlQ = "SELECT p.id AS id, p.url AS url, p.code AS code, p.name AS name, p.annotation AS annotation, p.body AS body, p.active AS active, p.featured AS featured, p.stocked AS stocked, p.position AS position, p.meta_title AS meta_title, p.meta_keywords AS meta_keywords, p.meta_description AS meta_description, p.date AS date, p.editdate AS editdate, p.views AS views, c.id AS cid, c.name AS category " . $sqlQPart;
        $entries = array();
        foreach ($mysql->select($sqlQ) as $row) {
            $entriesImg = array();
            foreach ($mysql->select('SELECT * FROM ' . prefix . '_eshop_images i WHERE i.product_id = ' . $row['id'] . ' ') as $row2) {
                $entriesImg[] = $row2['filepath'];
            }
            $entriesVariants = array();
            foreach ($mysql->select('SELECT * FROM ' . prefix . '_eshop_variants v WHERE v.product_id = ' . $row['id'] . ' ') as $vrow) {
                $entriesVariants[] = $vrow;
            }
            $options_array = array();
            foreach ($mysql->select("SELECT * FROM " . prefix . "_eshop_options LEFT JOIN " . prefix . "_eshop_features ON " . prefix . "_eshop_features.id=" . prefix . "_eshop_options.feature_id WHERE " . prefix . "_eshop_options.product_id = " . $row['id'] . " ORDER BY position, id") as $orow) {
                $options_array[$orow['id']] = $orow['value'];
            }
            $xf_name_id = array();
            $features_array = array();
            foreach ($mysql->select("SELECT * FROM " . prefix . "_eshop_features ORDER BY position, id") as $frow) {
                $frow['value'] = $options_array[$frow['id']];
                $frow['foptions'] = json_decode($frow['foptions'], true);
                foreach ($frow['foptions'] as $key => $value) {
                    $frow['foptions'][$key] = iconv("utf-8", "windows-1251", $value);
                }
                $features_array["xfields_" . $frow['name']] = $frow['value'];
                $xf_name_id[$frow['name']] = $frow['id'];
            }
            $images_comma_separated = implode(",", $entriesImg);
            $entry = array();
            $entry = array('id' => $row['id'], 'code' => $row['code'], 'url' => $row['url'], 'name' => $row['name'], 'variants' => $entriesVariants, 'annotation' => $row['annotation'], 'body' => $row['body'], 'active' => $row['active'], 'featured' => $row['featured'], 'stocked' => $row['stocked'], 'meta_title' => $row['meta_title'], 'meta_keywords' => $row['meta_keywords'], 'meta_description' => $row['meta_description'], 'date' => empty($row['date']) ? '' : $row['date'], 'editdate' => empty($row['editdate']) ? '' : $row['editdate'], 'cat_name' => $row['category'], 'cid' => $row['cid'], 'images' => $images_comma_separated);
            foreach ($features_array as $fk => $fv) {
                $entry[$fk] = $fv;
            }
            $entries[] = $entry;
        }
        $count = 0;
        foreach ($entries as $entry) {
            foreach ($entry['variants'] as $variant) {
                $entry_row = array();
                $entry_row = $entry;
                unset($entry_row['variants']);
                $entry_row['v_id'] = $variant['id'];
                $entry_row['v_sku'] = $variant['sku'];
                $entry_row['v_name'] = $variant['name'];
                $entry_row['v_price'] = $variant['price'];
                $entry_row['v_compare_price'] = $variant['compare_price'];
                $entry_row['v_stock'] = $variant['stock'];
                $entry_row['v_amount'] = $variant['amount'];
                if ($count == 0) {
                    $export->setHeader(array_keys($entry_row));
                }
                $count += 1;
                $export->append(array($entry_row));
                unset($entry_row);
            }
        }
        $export->export('products.csv', ';');
        die;
    }
    if (isset($_REQUEST['import_csv'])) {
        $SUPRESS_TEMPLATE_SHOW = 1;
        $SUPRESS_MAINBLOCK_SHOW = 1;
        if (is_uploaded_file($_FILES["filename"]["tmp_name"])) {
            require_once dirname(__FILE__) . '/csv_lib/CsvImportInterface.php';
            require_once dirname(__FILE__) . '/csv_lib/CsvImport.php';
            require_once dirname(__FILE__) . '/csv_lib/CsvExportInterface.php';
            require_once dirname(__FILE__) . '/csv_lib/CsvExport.php';
            $import = new CsvImport();
            $filepath = dirname(__FILE__) . "/import/" . $_FILES["filename"]["name"];
            move_uploaded_file($_FILES["filename"]["tmp_name"], $filepath);
            $import->setFile($filepath, 10000, ";");
            $items = $import->getRows();
            $xf_name_id = array();
            foreach ($mysql->select("SELECT * FROM " . prefix . "_eshop_features ORDER BY position, id") as $frow) {
                $xf_name_id[$frow['name']] = $frow['id'];
            }
            foreach ($items as $iv) {
                $current_time = time();
                $id = $iv['id'];
                $code = empty($iv['code']) ? "" : $iv['code'];
                $url = empty($iv['url']) ? "" : $iv['url'];
                $name = empty($iv['name']) ? "" : $iv['name'];
                $v_id = empty($iv['v_id']) ? "" : $iv['v_id'];
                $v_sku = empty($iv['v_sku']) ? "" : $iv['v_sku'];
                $v_name = empty($iv['v_name']) ? "" : $iv['v_name'];
                $v_price = empty($iv['v_price']) ? "" : $iv['v_price'];
                $v_compare_price = empty($iv['v_compare_price']) ? "" : $iv['v_compare_price'];
                $v_stock = empty($iv['v_stock']) ? "" : $iv['v_stock'];
                $v_amount = empty($iv['v_amount']) ? "" : $iv['v_amount'];
                if ($v_amount == '') {
                    $v_amount = 'NULL';
                }
                $annotation = empty($iv['annotation']) ? "" : $iv['annotation'];
                $body = empty($iv['body']) ? "" : $iv['body'];
                $active = empty($iv['active']) ? "1" : $iv['active'];
                $featured = empty($iv['featured']) ? "0" : $iv['featured'];
                $stocked = empty($iv['stocked']) ? "0" : $iv['stocked'];
                $meta_title = empty($iv['meta_title']) ? "" : $iv['meta_title'];
                $meta_keywords = empty($iv['meta_keywords']) ? "" : $iv['meta_keywords'];
                $meta_description = empty($iv['meta_description']) ? "" : $iv['meta_description'];
                $date = empty($iv['date']) ? $current_time : $iv['date'];
                $editdate = empty($iv['editdate']) ? $current_time : $iv['editdate'];
                $cat_name = empty($iv['cat_name']) ? "" : $iv['cat_name'];
                $cid = empty($iv['cid']) ? "0" : $iv['cid'];
                //$images = explode(',',$iv['images']);
                $xfields_items = array();
                foreach ($iv as $xfk => $xfv) {
                    preg_match("/xfields_/", $xfk, $find_xf);
                    if (isset($find_xf[0])) {
                        $xf_name = str_replace('xfields_', '', $xfk);
                        $xf_id = $xf_name_id[$xf_name];
                        $xfields_items[$xf_id] = $xfv;
                    }
                }
                if ($iv['id'] != "") {
                    $product_row = $mysql->record("SELECT * FROM " . prefix . "_eshop_products WHERE id=" . db_squote($iv['id']) . " ");
                    if (empty($product_row)) {
                        if ($url != "") {
                            if (!is_array($mysql->record("select id from " . prefix . "_eshop_products where url = " . db_squote($product_row["url"]) . " limit 1"))) {
                                $mysql->query("INSERT INTO " . prefix . "_eshop_products (`id`, `code`, `url`, `name`, `annotation`, `body`, `active`, `featured`, `stocked`, `meta_title`, `meta_keywords`, `meta_description`, `date`, `editdate`) VALUES ('{$id}','{$code}','{$url}','{$name}','{$annotation}','{$body}','{$active}','{$featured}','{$stocked}','{$meta_title}','{$meta_keywords}','{$meta_description}','{$date}','{$editdate}')");
                                $qid = $mysql->lastid('eshop_products');
                                import_upload_images($qid);
                                if (!empty($xfields_items)) {
                                    foreach ($xfields_items as $f_key => $f_value) {
                                        if ($f_value != '') {
                                            $mysql->query("INSERT INTO " . prefix . "_eshop_options (`product_id`, `feature_id`, `value`) VALUES ('{$qid}','{$f_key}','{$f_value}')");
                                        }
                                    }
                                }
                                $category_id = intval($cid);
                                if ($category_id != 0) {
                                    $mysql->query("INSERT INTO " . prefix . "_eshop_products_categories (`product_id`, `category_id`) VALUES ('{$qid}','{$category_id}')");
                                }
                                $mysql->query("INSERT INTO " . prefix . "_eshop_variants (`product_id`, `sku`, `name`, `price`, `compare_price`, `stock`, `amount`) VALUES ('{$qid}', '{$v_sku}', '{$v_name}', '{$v_price}', '{$v_compare_price}', '{$v_stock}', '{$v_amount}')");
                            }
                        }
                    } else {
                        if ($product_row["url"]) {
                            if (is_array($mysql->record("select id from " . prefix . "_eshop_products where url = " . db_squote($url) . " limit 1"))) {
                                $mysql->query("REPLACE INTO " . prefix . "_eshop_products (`id`, `code`, `url`, `name`, `annotation`, `body`, `active`, `featured`, `stocked`, `meta_title`, `meta_keywords`, `meta_description`, `date`, `editdate`) VALUES ('{$id}','{$code}','{$url}','{$name}','{$annotation}','{$body}','{$active}','{$featured}','{$stocked}','{$meta_title}','{$meta_keywords}','{$meta_description}','{$date}','{$editdate}')");
                                $qid = $product_row["id"];
                                import_upload_images($qid);
                                if (!empty($xfields_items)) {
                                    //$mysql->query("DELETE FROM ".prefix."_eshop_options WHERE product_id='$qid'");
                                    foreach ($xfields_items as $f_key => $f_value) {
                                        if ($f_value != '') {
                                            $mysql->query("REPLACE INTO " . prefix . "_eshop_options (`product_id`, `feature_id`, `value`) VALUES ('{$qid}','{$f_key}','{$f_value}')");
                                        }
                                    }
                                }
                                $category_id = intval($cid);
                                if ($category_id != 0) {
                                    //$mysql->query("DELETE FROM ".prefix."_eshop_products_categories WHERE product_id='$qid'");
                                    $mysql->query("REPLACE INTO " . prefix . "_eshop_products_categories (`product_id`, `category_id`) VALUES ('{$qid}','{$category_id}')");
                                } else {
                                    $mysql->query("DELETE FROM " . prefix . "_eshop_products_categories WHERE product_id='{$qid}'");
                                }
                                $SQLv = array();
                                $SQLv['product_id'] = $qid;
                                $SQLv['sku'] = $v_sku;
                                $SQLv['name'] = $v_name;
                                $SQLv['price'] = $v_price;
                                $SQLv['compare_price'] = $v_compare_price;
                                $SQLv['stock'] = $v_stock;
                                $SQLv['amount'] = $v_amount;
                                foreach ($SQLv as $k => $v) {
                                    $vnames[] = $k . ' = ' . db_squote($v);
                                }
                                if ($v_id != "") {
                                    $mysql->query('UPDATE ' . prefix . '_eshop_variants SET ' . implode(', ', $vnames) . ' WHERE id = \'' . intval($v_id) . '\'  ');
                                } else {
                                    $mysql->query("INSERT INTO " . prefix . "_eshop_variants (`product_id`, `sku`, `name`, `price`, `compare_price`, `stock`, `amount`) VALUES ('{$qid}', '{$v_sku}', '{$v_name}', '{$v_price}', '{$v_compare_price}', '{$v_stock}', '{$v_amount}')");
                                }
                                //$mysql->query("DELETE FROM ".prefix."_eshop_variants WHERE product_id='$qid'");
                                //$mysql->query("INSERT INTO ".prefix."_eshop_variants (`product_id`, `price`, `compare_price`, `stock`) VALUES ('$qid', '$price', '$compare_price', '$stock')");
                            }
                        }
                    }
                } else {
                    $mysql->query("INSERT INTO " . prefix . "_eshop_products (`code`, `url`, `name`, `annotation`, `body`, `active`, `featured`, `stocked`, `meta_title`, `meta_keywords`, `meta_description`, `date`, `editdate`) VALUES ('{$code}','{$url}','{$name}','{$annotation}','{$body}','{$active}','{$featured}','{$stocked}','{$meta_title}','{$meta_keywords}','{$meta_description}','{$date}','{$editdate}')");
                    $qid = $mysql->lastid('eshop_products');
                    import_upload_images($qid);
                    if (!empty($xfields_items)) {
                        foreach ($xfields_items as $f_key => $f_value) {
                            if ($f_value != '') {
                                $mysql->query("INSERT INTO " . prefix . "_eshop_options (`product_id`, `feature_id`, `value`) VALUES ('{$qid}','{$f_key}','{$f_value}')");
                            }
                        }
                    }
                    $category_id = intval($cid);
                    if ($category_id != 0) {
                        $mysql->query("INSERT INTO " . prefix . "_eshop_products_categories (`product_id`, `category_id`) VALUES ('{$qid}','{$category_id}')");
                    }
                    $mysql->query("INSERT INTO " . prefix . "_eshop_variants (`product_id`, `sku`, `name`, `price`, `compare_price`, `stock`, `amount`) VALUES ('{$qid}', '{$v_sku}', '{$v_name}', '{$v_price}', '{$v_compare_price}', '{$v_stock}', '{$v_amount}')");
                }
            }
            unlink($filepath);
            $info = "Импорт CSV завершен<br/>";
            msg(array("type" => "info", "info" => $info));
            die;
        } else {
            $info = "Ошибка загрузки файла<br/>";
            msg(array("type" => "info", "info" => $info));
            die;
        }
    }
    if (isset($_REQUEST['multiple_upload_images'])) {
        $images = $_REQUEST['data']['images'];
        if ($images != NULL) {
            foreach ($images as $inx_img => $img) {
                $img_parts = explode(".", $img);
                $img_s = explode("_", $img_parts[0]);
                $qid = $img_s[0];
                if ($qid != "") {
                    $prd_row = $mysql->record("select * from " . prefix . "_eshop_products where id = " . db_squote($qid) . " limit 1");
                    if (!is_array($prd_row)) {
                        break;
                    }
                    $positions_img = array();
                    foreach ($mysql->select("SELECT * FROM " . prefix . "_eshop_images WHERE product_id = '{$qid}' ORDER BY position, id") as $irow) {
                        $positions_img[] = $irow['position'];
                    }
                    if (!empty($positions_img)) {
                        $max_img_pos = max($positions_img) + 1;
                    } else {
                        $max_img_pos = 0;
                    }
                    $inx_img = $max_img_pos;
                    @mkdir($_SERVER['DOCUMENT_ROOT'] . '/uploads/eshop/products/' . $qid . '/', 0777);
                    @mkdir($_SERVER['DOCUMENT_ROOT'] . '/uploads/eshop/products/' . $qid . '/thumb', 0777);
                    $timestamp = time();
                    $iname = $timestamp . "-" . $img;
                    $temp_name = $_SERVER['DOCUMENT_ROOT'] . '/uploads/eshop/products/temp/' . $img;
                    $current_name = $_SERVER['DOCUMENT_ROOT'] . '/uploads/eshop/products/' . $qid . '/' . $iname;
                    rename($temp_name, $current_name);
                    $temp_name = $_SERVER['DOCUMENT_ROOT'] . '/uploads/eshop/products/temp/thumb/' . $img;
                    $current_name = $_SERVER['DOCUMENT_ROOT'] . '/uploads/eshop/products/' . $qid . '/thumb/' . $iname;
                    rename($temp_name, $current_name);
                    $mysql->query("INSERT INTO " . prefix . "_eshop_images (`filepath`, `product_id`, `position`) VALUES ('{$iname}','{$qid}','{$inx_img}')");
                }
            }
        }
        $info = "Изображения загружены<br/>";
        msg(array("type" => "info", "info" => $info));
    }
    $xt = $twig->loadTemplate($tpath['config/automation'] . 'config/' . 'automation.tpl');
    $yml_export_link = checkLinkAvailable('eshop', 'yml_export') ? generateLink('eshop', 'yml_export', array()) : generateLink('core', 'plugin', array('plugin' => 'eshop', 'handler' => 'yml_export'), array());
    $tVars = array('yml_export_link' => $yml_export_link, 'info' => '');
    $xg = $twig->loadTemplate($tpath['config/main'] . 'config/' . 'main.tpl');
    $tVars = array('entries' => $xt->render($tVars), 'php_self' => $PHP_SELF, 'plugin_url' => admin_url . '/admin.php?mod=extra-config&plugin=eshop', 'skins_url' => skins_url, 'admin_url' => admin_url, 'home' => home, 'current_title' => 'Автоматизация');
    print $xg->render($tVars);
}
    $remove = generateLink("Remove", buildTextbookLink($bookRef, "core/remove.php"));
    $action = '';
    //Chooses what action to display and links them correctly
    if ($result[$i]['CategoryId'] == "2") {
        if ($result[$i]['State'] == "Active") {
            $action = generateLink("Borrowed", buildTextbookLink($bookRef, "core/updateState.php") . "&action=borrowed");
        } elseif ($result[$i]['State'] != 'Hidden') {
            $action = generateLink("UnBorrow", buildTextbookLink($bookRef, "core/updateState.php") . "&action=unborrow");
        }
    } elseif ($result[$i]['CategoryId'] == "1") {
        if ($result[$i]['State'] == "Active") {
            $action = generateLink("Swaped", buildTextbookLink($bookRef, "core/updateState.php") . "&action=swapped");
        } elseif ($result[$i]['State'] != 'Hidden') {
            $action = generateLink("UnSwap", buildTextbookLink($bookRef, "core/updateState.php") . "&action=unswap");
        }
    } elseif ($result[$i]['CategoryId'] == "0") {
        if ($result[$i]['State'] == "Active") {
            $action = generateLink("Sold", buildTextbookLink($bookRef, "core/updateState.php") . "&action=sold");
        } elseif ($result[$i]['State'] != 'Hidden') {
            $action = generateLink("UnSell", buildTextbookLink($bookRef, "core/updateState.php") . "&action=unsell");
        }
    }
    if ($result[$i]['State'] == "Active") {
        $hide = generateLink("Hide", buildTextbookLink($bookRef, "core/updateState.php") . "&action=hide");
    } elseif ($result[$i]['State'] == "Hidden") {
        $hide = generateLink("Activate", buildTextbookLink($bookRef, "core/updateState.php") . "&action=active");
    } else {
        $hide = "";
    }
    echo '<tr><td>' . $bookRef . '</td><td>' . $result[$i]['Title'] . '</td><td>' . $result[$i]['ISBN'] . '</td><td>' . $result[$i]['Subject'] . '</td><td>' . $result[$i]['Edition'] . '</td><td>' . $conditions[$result[$i]['CondId']]['Condname'] . '</td><td>' . $categories[$result[$i]['CategoryId']]['CategoryName'] . '</td><td>' . $result[$i]['State'] . '</td><td>' . $view . '  ' . $remove . '  ' . $action . '  ' . $hide . '</td></tr>';
}
Пример #12
0
function breadcrumbs()
{
    global $lang, $catz, $catmap, $template, $CurrentHandler, $config, $SYSTEM_FLAGS, $tpl, $systemAccessURL, $twig;
    $tpath = locatePluginTemplates(array('breadcrumbs'), 'breadcrumbs', pluginGetVariable('breadcrumbs', 'template_source'));
    $location = array();
    $location_last = '';
    # processing 404 page
    if ($SYSTEM_FLAGS['info']['title']['group'] == $lang['404.title']) {
        $link = str_replace(array('{home_url}', '{home_title}'), array($config['home_url'], $lang['bc:mainpage']), $lang['bc:page_404']);
        $location[] = array('url' => $config['home_url'], 'title' => $lang['bc:mainpage'], 'link' => $link);
        $location_last = $lang['404.title'];
    } else {
        if ($CurrentHandler) {
            $params = $CurrentHandler['params'];
            $pluginName = $CurrentHandler['pluginName'];
        }
        # generate main page with or without link
        $main_page = $systemAccessURL != '/' ? str_replace(array('{home_url}', '{home_title}'), array($config['home_url'], $lang['bc:mainpage']), $lang['bc:page_404']) : $lang['bc:mainpage'];
        $location[] = array('url' => $systemAccessURL != '/' ? $config['home_url'] : '', 'title' => $systemAccessURL != '/' ? $lang['bc:mainpage'] : $lang['bc:mainpage'], 'link' => $main_page);
        $location_last = $main_page;
        # if category
        if ($CurrentHandler['handlerName'] == 'by.category') {
            $location_last = GetCategories($catz[$params['category']]['id'], true);
            # show full path [if requested]
            if ($catz[$params['category']]['parent'] != 0 && !pluginGetVariable('breadcrumbs', 'block_full_path')) {
                $id = $catz[$params['category']]['parent'];
                do {
                    $location_tmp[] = array('url' => generateLink('news', 'by.category', array('category' => $catz[$params['category']]['alt'], 'catid' => $catz[$params['category']]['id'])), 'title' => $catz[$params['category']]['name'], 'link' => GetCategories($id, false));
                    $id = $catz[$catmap[$id]]['parent'];
                } while ($id != 0);
                $location = array_merge($location, array_reverse($location_tmp));
            }
        } elseif ($params['year']) {
            # if we have only year then $year = plain text, if we have month then $year = link
            $year = !$params['month'] ? $params['year'] : str_replace(array('{year_url}', '{year}'), array(generateLink('news', 'by.year', array('year' => $params['year'])), $params['year']), $lang['bc:by.year']);
            $month_p = LangDate("F", mktime(0, 0, 0, $params['month'], 7, 0));
            # if we have only year and month then $month = plain text, if we have day then $month = link
            $month = !$params['day'] ? $month_p : str_replace(array('{month_url}', '{month_p}'), array(generateLink('news', 'by.month', array('year' => $params['year'], 'month' => $params['month'])), $month_p), $lang['bc:by.month']);
            $day = $params['day'];
            $location_last = $year;
            if ($params['month']) {
                $location[] = array('url' => !$params['month'] ? '' : generateLink('news', 'by.year', array('year' => $params['year'])), 'title' => !$params['month'] ? $params['year'] : $params['year'], 'link' => $year);
                $location_last = $month;
            }
            if ($params['day']) {
                $location[] = array('url' => !$params['day'] ? '' : generateLink('news', 'by.month', array('year' => $params['year'], 'month' => $params['month'])), 'title' => !$params['day'] ? $month_p : $month_p, 'link' => $month);
                $location_last = $day;
            }
            # plugin, static, etc.
        } elseif ($pluginName != 'news') {
            if ($pluginName == "static") {
                $location_last = $SYSTEM_FLAGS['info']['title']['item'];
            } elseif ($pluginName == 'uprofile' && $CurrentHandler['handlerName'] == 'edit' || $pluginName == 'search') {
                $location_last = $SYSTEM_FLAGS['info']['title']['group'];
            } elseif ($pluginName == 'uprofile' && $CurrentHandler['handlerName'] == 'show') {
                $location_last = $SYSTEM_FLAGS['info']['title']['group'] . ' ' . $SYSTEM_FLAGS['info']['title']['item'];
            } elseif ($pluginName == 'core' && in_array($CurrentHandler['handlerName'], array('registration', 'lostpassword', 'login'))) {
                $location_last = $SYSTEM_FLAGS['info']['title']['group'];
            } elseif ($params['plugin'] || $pluginName) {
                # if plugin provide put some info
                if ($SYSTEM_FLAGS['info']['breadcrumbs']) {
                    # plugin name becomes link
                    $count = count($SYSTEM_FLAGS['info']['breadcrumbs']) - 1;
                    # all items except last become links
                    for ($i = 0; $i < $count; $i++) {
                        $link = str_replace(array('{plugin_url}', '{plugin}'), array($SYSTEM_FLAGS['info']['breadcrumbs'][$i]['link'], $SYSTEM_FLAGS['info']['breadcrumbs'][$i]['text']), $lang['bc:plugin']);
                        $location[] = array('url' => $SYSTEM_FLAGS['info']['breadcrumbs'][$i]['link'], 'title' => $SYSTEM_FLAGS['info']['breadcrumbs'][$i]['text'], 'link' => $link);
                    }
                    # last item becomes plain text
                    $location_last = $SYSTEM_FLAGS['info']['breadcrumbs'][$i]['text'];
                } else {
                    $link = str_replace(array('{plugin_url}', '{plugin}'), array(generatePluginLink($params['plugin'], '', array(), array(), false, true), $SYSTEM_FLAGS['info']['title']['group'] != $lang['loc_plugin'] ? $SYSTEM_FLAGS['info']['title']['group'] : $params['plugin']), $lang['bc:plugin']);
                    $location[] = array('url' => generatePluginLink($params['plugin'], '', array(), array(), false, true), 'title' => $SYSTEM_FLAGS['info']['title']['group'] != $lang['loc_plugin'] ? $SYSTEM_FLAGS['info']['title']['group'] : $params['plugin'], 'link' => $link);
                    if ($SYSTEM_FLAGS['info']['title']['group'] != $lang['loc_plugin']) {
                        $location_last = $SYSTEM_FLAGS['info']['title']['group'];
                    } else {
                        $location_last = $params['plugin'];
                    }
                }
            }
            # full news
        } elseif ($CurrentHandler['pluginName'] == 'news' && $CurrentHandler['handlerName'] == 'news') {
            $catids = $SYSTEM_FLAGS['news']['db.categories'];
            $location_last = $SYSTEM_FLAGS['info']['title']['item'];
            if (count($catids) != 1 || pluginGetVariable('breadcrumbs', 'block_full_path')) {
                if ($CurrentHandler['params']['category'] != 'none') {
                    foreach ($catids as $cid) {
                        foreach ($catz as $cc) {
                            if ($cc['id'] == $cid) {
                                $location[] = array('url' => generateLink('news', 'by.category', array('category' => $cc['alt'], 'catid' => $cc['id'])), 'title' => $cc['name'], 'link' => GetCategories($cc['id'], false));
                            }
                        }
                    }
                }
            } else {
                $id = $catz[$params['category']]['parent'];
                $location_tmp[] = array('url' => generateLink('news', 'by.category', array('category' => $catz[$params['category']]['alt'], 'catid' => $catz[$params['category']]['id'])), 'title' => $catz[$params['category']]['name'], 'link' => GetCategories($catz[$params['category']]['id'], false));
                while ($id != 0) {
                    foreach ($catz as $cc) {
                        if ($cc['id'] == $id) {
                            $location_tmp[] = array('url' => generateLink('news', 'by.category', array('category' => $cc['alt'], 'catid' => $cc['id'])), 'title' => $cc['name'], 'link' => GetCategories($cc['id'], false));
                            $id = $catz[$cc['alt']]['parent'];
                        }
                    }
                }
                $location = array_merge($location, array_reverse($location_tmp));
            }
        }
    }
    $tVars = array('location' => $location, 'location_last' => $location_last, 'separator' => $separator);
    $xt = $twig->loadTemplate($tpath['breadcrumbs'] . 'breadcrumbs.tpl');
    $template['vars']['breadcrumbs'] = $xt->render($tVars);
}
Пример #13
0
function main_prd($params)
{
    global $tpl, $template, $twig, $SYSTEM_FLAGS, $config, $userROW, $mysql, $twigLoader;
    $results = array();
    $params = arrayCharsetConvert(1, $params);
    $number = $params['number'];
    $mode = $params['mode'];
    $cat = $params['cat'];
    $overrideTemplateName = $params['template'];
    $prd_per_page = $number;
    $page = $params['page'];
    switch ($params['action']) {
        // **** ADD NEW ITEM INTO compare ****
        case 'show':
            $conditions = array();
            if (isset($cat) && !empty($cat)) {
                array_push($conditions, "c.id IN (" . $cat . ") ");
            }
            array_push($conditions, "p.active = 1");
            if ($number < 1 || $number > 100) {
                $number = 5;
            }
            switch ($mode) {
                case 'view':
                    $orderby = " ORDER BY p.view DESC ";
                    break;
                case 'last':
                    $orderby = " ORDER BY p.editdate DESC ";
                    break;
                case 'stocked':
                    array_push($conditions, "p.stocked = 1");
                    $orderby = " ORDER BY p.editdate DESC ";
                    break;
                case 'featured':
                    array_push($conditions, "p.featured = 1");
                    $orderby = " ORDER BY p.editdate DESC ";
                    break;
                case 'rnd':
                    $cacheDisabled = true;
                    $orderby = " ORDER BY RAND() DESC ";
                    break;
                default:
                    $mode = 'last';
                    $orderby = " ORDER BY p.editdate DESC ";
                    break;
            }
            $fSort = " " . $orderby;
            $sqlQPart = "FROM " . prefix . "_eshop_products p LEFT JOIN " . prefix . "_eshop_products_categories pc ON p.id = pc.product_id LEFT JOIN " . prefix . "_eshop_categories c ON pc.category_id = c.id " . (count($conditions) ? "WHERE " . implode(" AND ", $conditions) : '') . $fSort;
            $sqlQCount = "SELECT COUNT(p.id) " . $sqlQPart;
            $sqlQ = "SELECT p.id AS id, p.url as url, p.code AS code, p.name AS name, p.annotation AS annotation, p.body AS body, p.active AS active, p.featured AS featured, p.stocked AS stocked, p.position AS position, p.meta_title AS meta_title, p.meta_keywords AS meta_keywords, p.meta_description AS meta_description, p.date AS date, p.editdate AS editdate, p.views AS views, c.id AS cid, c.url as curl, c.name AS category " . $sqlQPart;
            $entries = array();
            $pageNo = intval($page) ? $page : 0;
            if ($pageNo < 1) {
                $pageNo = 1;
            }
            if (!$start_from) {
                $start_from = ($pageNo - 1) * $prd_per_page;
            }
            $count = $mysql->result($sqlQCount);
            $countPages = ceil($count / $prd_per_page);
            $cmp_array = array();
            foreach ($SYSTEM_FLAGS["eshop"]["compare"]["entries"] as $cmp_row) {
                $cmp_array[] = $cmp_row['linked_fld'];
            }
            foreach ($mysql->select($sqlQ . ' LIMIT ' . $start_from . ', ' . $prd_per_page) as $row) {
                $fulllink = checkLinkAvailable('eshop', 'show') ? generateLink('eshop', 'show', array('alt' => $row['url'])) : generateLink('core', 'plugin', array('plugin' => 'eshop', 'handler' => 'show'), array('alt' => $row['url']));
                $catlink = checkLinkAvailable('eshop', '') ? generateLink('eshop', '', array('alt' => $row['curl'])) : generateLink('core', 'plugin', array('plugin' => 'eshop'), array('alt' => $row['curl']));
                $cmp_flag = in_array($row['id'], $cmp_array);
                $entries[$row['id']] = array('id' => $row['id'], 'code' => $row['code'], 'name' => $row['name'], 'annotation' => $row['annotation'], 'body' => $row['body'], 'active' => $row['active'], 'featured' => $row['featured'], 'meta_title' => $row['meta_title'], 'meta_keywords' => $row['meta_keywords'], 'meta_description' => $row['meta_description'], 'fulllink' => $fulllink, 'date' => empty($row['date']) ? '' : $row['date'], 'editdate' => empty($row['editdate']) ? '' : $row['editdate'], 'views' => $row['views'], 'cat_name' => $row['category'], 'cid' => $row['cid'], 'catlink' => $catlink, 'compare' => $cmp_flag, 'home' => home, 'tpl_url' => home . '/templates/' . $config['theme']);
            }
            $entries_array_ids = array_keys($entries);
            if (isset($entries_array_ids) && !empty($entries_array_ids)) {
                $entries_string_ids = implode(',', $entries_array_ids);
                foreach ($mysql->select('SELECT * FROM ' . prefix . '_eshop_images i WHERE i.product_id IN (' . $entries_string_ids . ') ORDER BY i.position, i.id') as $irow) {
                    $entries[$irow['product_id']]['images'][] = $irow;
                }
                foreach ($mysql->select('SELECT * FROM ' . prefix . '_eshop_variants v WHERE v.product_id IN (' . $entries_string_ids . ') ORDER BY v.position, v.id') as $vrow) {
                    $entries[$vrow['product_id']]['variants'][] = $vrow;
                }
            }
            $tVars = array('info' => isset($info) ? $info : '', 'entries' => isset($entries) ? $entries : '', 'tpl_url' => home . '/templates/' . $config['theme'], 'tpl_home' => admin_url);
            if ($overrideTemplateName) {
                $templateName = 'block/' . $overrideTemplateName;
            } else {
                $templateName = 'block/main_block_eshop';
            }
            // Determine paths for all template files
            $tpath = locatePluginTemplates(array($templateName), 'eshop', pluginGetVariable('eshop', 'localsource'));
            // Preload template configuration variables
            @templateLoadVariables();
            $tVars['mode'] = $mode;
            $tVars['number'] = $number;
            $tVars['tpl_url'] = tpl_url;
            $tVars['home'] = home;
            $tVars['pagesss'] = generateLP(array('current' => $pageNo, 'count' => $countPages, 'url' => '#', 'tpl' => $templateName . '_pages'));
            $xt = $twig->loadTemplate($tpath[$templateName] . $templateName . '.tpl');
            if (empty($row)) {
                $results = array('prd_main' => 2, 'prd_main_text' => iconv('Windows-1251', 'UTF-8', 'Нет продукции!'), 'prd_main_pages_text' => iconv('Windows-1251', 'UTF-8', ''));
            } else {
                $results = array('prd_main' => 100, 'prd_main_text' => iconv('Windows-1251', 'UTF-8', $xt->render($tVars)), 'prd_main_pages_text' => iconv('Windows-1251', 'UTF-8', $tVars['pagesss']));
            }
            break;
    }
    return array('status' => 1, 'errorCode' => 0, 'data' => $results);
}
Пример #14
0
        if (isset($_SESSION['step_pp_16']['links_game_pom5'])) {
            generateLink($file, $dirname, "http://www.darkelf.cz/", $webgen_links_game_darkelf[$language], "darkelf.jpg", "game");
        }
        if (isset($_SESSION['step_pp_16']['links_game_pom6'])) {
            generateLink($file, $dirname, "http://www.stargatewars.com", $webgen_links_game_stargate[$language], "stargate.jpg", "game");
        }
        if (isset($_SESSION['step_pp_16']['links_other_pom1'])) {
            generateLink($file, $dirname, "http://wikipedia.org/", $webgen_links_other_wikipedia[$language], "wikipedia.jpg", "other");
        }
        if (isset($_SESSION['step_pp_16']['links_other_pom2'])) {
            generateLink($file, $dirname, "http://www.youtube.com/", $webgen_links_other_youtube[$language], "youtube.jpg", "other");
        }
        $pom = 0;
        while (!empty($_SESSION['step_pp_16']['link_description_data'][$pom]) && !empty($_SESSION['step_pp_16']['link_url_data'][$pom]) || !empty($_SESSION['step_pp_16']['link_description_data'][$pom + 1]) && !empty($_SESSION['step_pp_16']['link_url_data'][$pom + 1])) {
            if (!empty($_SESSION['step_pp_16']['link_description_data'][$pom]) && !empty($_SESSION['step_pp_16']['link_url_data'][$pom])) {
                generateLink($file, $dirname, addHttp(correctOutput($_SESSION['step_pp_16']['link_url_data'][$pom])), correctOutput($_SESSION['step_pp_16']['link_description_data'][$pom]), "icon.jpg", "user defined");
            }
            $pom = $pom + 1;
        }
        fwrite($file, "\t\t</links>\n");
    }
}
// *********************** CV ***********************************************
if (isset($_SESSION['step_pp_5']['cv'])) {
    fwrite($file, "\t\t<cv>\n");
    if (!empty($_SESSION['step_pp_14']['email_cv_que']) && $_SESSION['step_pp_14']['email_cv_que'] != 'c') {
        switch ($_SESSION['step_pp_14']['email_cv_que']) {
            case 'a':
                fwrite($file, "\t\t\t<cvEmail>" . correctOutput($_SESSION['step_pp_8']['email_data']) . "</cvEmail>\n");
                break;
            case 'b':
Пример #15
0
	</head>
	<body>
	
	<h3>The standard Lorem Ipsum passage, used since the 1500s</h3>
	<p>"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p>
	<h3>Section 1.10.32 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC</h3>
	<p>"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"</p>
	<h3>1914 translation by H. Rackham</h3>
	<p>"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?"</p>
	<h3>Section 1.10.33 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC</h3>
	<p>"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat."</p>
	<h3>1914 translation by H. Rackham</h3>
	<p>"On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains."</p>

<?php 
echo generateLink($max_links_per_page, $max_pages, $include_https_each);
if ($id == "") {
    if (empty($id)) {
        $d = opendir("doc");
        while ($f = readdir($d)) {
            if ($f != '.' && $f != '..') {
                echo "<br /><a href='doc/" . $f . "'>" . $f . "</a>";
            }
        }
        closedir($d);
    }
    // 404
    echo "<br/><a href='404.html'>404</a>";
}
?>
Пример #16
0
 function onShow(&$output)
 {
     global $userROW, $mysql, $twig;
     if (pluginGetVariable('eshop', 'integrate_gsmg') == "1") {
         $lm = $mysql->record("select date(from_unixtime(max(date))) as pd from " . prefix . "_eshop_products");
         foreach ($mysql->select("SELECT * FROM " . prefix . "_eshop_categories ORDER BY position, id") as $rows) {
             $cat_link = checkLinkAvailable('eshop', '') ? generateLink('eshop', '', array('alt' => $rows['url'])) : generateLink('core', 'plugin', array('plugin' => 'eshop'), array('alt' => $rows['url']));
             $new_output .= "<url>";
             $new_output .= "<loc>" . home . $cat_link . "</loc>";
             $new_output .= "<priority>" . floatval(pluginGetVariable('gsmg', 'catp_pr')) . "</priority>";
             $new_output .= "<lastmod>" . $lm['pd'] . "</lastmod>";
             $new_output .= "<changefreq>daily</changefreq>";
             $new_output .= "</url>";
         }
         $query = "select * from " . prefix . "_eshop_products where active = 1 order by id desc";
         foreach ($mysql->select($query) as $rec) {
             $link = checkLinkAvailable('eshop', 'show') ? generateLink('eshop', 'show', array('alt' => $rec['url'])) : generateLink('core', 'plugin', array('plugin' => 'eshop', 'handler' => 'show'), array('alt' => $rec['url']));
             $new_output .= "<url>";
             $new_output .= "<loc>" . home . $link . "</loc>";
             $new_output .= "<priority>" . floatval(pluginGetVariable('gsmg', 'news_pr')) . "</priority>";
             $new_output .= "<lastmod>" . strftime("%Y-%m-%d", max($rec['editdate'], $rec['date'])) . "</lastmod>";
             $new_output .= "<changefreq>daily</changefreq>";
             $new_output .= "</url>";
         }
         $output = $output . $new_output;
     }
 }
Пример #17
0
echo _("Please enter your e-mail");
?>
');
		$("#email").focus();
		return false;
	} else {
		$("#email").removeClass('textalert');
	}

	
	return true;
}
</script>

<form action="<?php 
echo generateLink("users", "update");
?>
" method="post" onsubmit="javascript:return cform();">

<h1><?php 
echo _("Edit Profile");
?>
</h1>

<h3><?php 
echo _("Name");
?>
</h3>
<input type="textbox" class="textbox" name="name" id="name" value="<?php 
echo $user['name'];
?>
*/
define('XAJAX_HTML_CONTROL_DOCTYPE_FORMAT', 'XHTML');
define('XAJAX_HMTL_CONTROL_DOCTYPE_VERSION', '1.0');
define('XAJAX_HTML_CONTROL_DOCTYPE_VALIDATION', 'TRANSITIONAL');
$sBaseFolder = dirname(dirname(dirname(__FILE__)));
$sCoreFolder = '/xajax_core';
$sCtrlFolder = '/xajax_controls';
include $sBaseFolder . $sCoreFolder . '/xajax.inc.php';
$xajax = new xajax();
$xajax->configure('javascript URI', '../../');
include $sBaseFolder . $sCtrlFolder . '/validate_XHTML10TRANSITIONAL.inc.php';
include $sBaseFolder . $sCoreFolder . '/xajaxControl.inc.php';
foreach (array('/document.inc.php', '/structure.inc.php', '/content.inc.php', '/form.inc.php', '/group.inc.php', '/misc.inc.php') as $sFile) {
    include $sBaseFolder . $sCtrlFolder . $sFile;
}
$objDocument = new clsDocument(array('children' => array(new clsDoctype(), new clsHtml(array('attributes' => array('xmlns' => 'http://www.w3.org/1999/xhtml', 'xml:lang' => 'en', 'lang' => 'en'), 'children' => array(new clsHead(array('xajax' => $xajax, 'children' => array(generateTitle(), generateStyle(), generateScript(), generateMeta(), generateLink(), generateBase()))), new clsBody(array('children' => array(generateOrderedList(), generateUnorderedList(), generateDefinitionList(), generateTable(), generateForm(), generateContent(), generateValidation(), generateIframe())))))))));
function generateTitle()
{
    return new clsTitle(array('child' => new clsLiteral('Title')));
}
function generateStyle()
{
    return new clsStyle(array('attributes' => array('type' => 'text/css'), 'child' => new clsLiteral('styleOne { background: #ffdddd; }')));
}
function generateScript()
{
    return new clsScript(array('attributes' => array('type' => 'text/javascript'), 'child' => new clsLiteral('javascriptFunction = function(a, b) { alert(a*b); };')));
}
function generateMeta()
{
    return new clsMeta(array('attributes' => array('name' => 'keywords', 'lang' => 'en-us', 'content' => 'xajax, javascript, php, ajax')));
Пример #19
0
function link_eshop()
{
    $eshopURL = checkLinkAvailable('eshop', '') ? generateLink('eshop', '') : generateLink('core', 'plugin', array('plugin' => 'eshop'));
    return $eshopURL;
}
Пример #20
0
function plugin_block_eshop($number, $mode, $cat, $overrideTemplateName, $cacheExpire)
{
    global $config, $mysql, $tpl, $template, $twig, $twigLoader, $langMonths, $lang, $TemplateCache;
    // Prepare keys for cacheing
    $cacheKeys = array();
    $cacheDisabled = false;
    $conditions = array();
    if (isset($cat) && !empty($cat)) {
        array_push($conditions, "c.id IN (" . $cat . ") ");
    }
    array_push($conditions, "p.active = 1");
    if ($number < 1 || $number > 100) {
        $number = 5;
    }
    switch ($mode) {
        case 'view':
            $orderby = " ORDER BY p.view DESC ";
            break;
        case 'last':
            $orderby = " ORDER BY p.editdate DESC ";
            break;
        case 'stocked':
            array_push($conditions, "p.stocked = 1");
            $orderby = " ORDER BY p.editdate DESC ";
            break;
        case 'featured':
            array_push($conditions, "p.featured = 1");
            $orderby = " ORDER BY p.editdate DESC ";
            break;
        case 'rnd':
            $cacheDisabled = true;
            $orderby = " ORDER BY RAND() DESC ";
            break;
        default:
            $mode = 'last';
            $orderby = " ORDER BY p.editdate DESC ";
            break;
    }
    $fSort = " GROUP BY p.id " . $orderby . " LIMIT " . $number;
    $sqlQPart = "FROM " . prefix . "_eshop_products p LEFT JOIN " . prefix . "_eshop_products_categories pc ON p.id = pc.product_id LEFT JOIN " . prefix . "_eshop_categories c ON pc.category_id = c.id " . (count($conditions) ? "WHERE " . implode(" AND ", $conditions) : '') . $fSort;
    $sqlQ = "SELECT p.id AS id, p.url as url, p.code AS code, p.name AS name, p.annotation AS annotation, p.body AS body, p.active AS active, p.featured AS featured, p.stocked AS stocked, p.position AS position, p.meta_title AS meta_title, p.meta_keywords AS meta_keywords, p.meta_description AS meta_description, p.date AS date, p.editdate AS editdate, p.views AS views, c.id AS cid, c.url as curl, c.name AS category " . $sqlQPart;
    $tEntries = array();
    foreach ($mysql->select($sqlQ) as $row) {
        $view_link = checkLinkAvailable('eshop', 'show') ? generateLink('eshop', 'show', array('alt' => $row['url'])) : generateLink('core', 'plugin', array('plugin' => 'eshop', 'handler' => 'show'), array('alt' => $row['url']));
        $tEntries[$row['id']] = array('id' => $row['id'], 'code' => $row['code'], 'name' => $row['name'], 'category' => $row['category'], 'active' => $row['active'], 'featured' => $row['featured'], 'stocked' => $row['stocked'], 'position' => $row['position'], 'date' => $row['date'], 'editdate' => $row['editdate'], 'edit_link' => "?mod=extra-config&plugin=eshop&action=edit_product&id=" . $row['id'] . "", 'view_link' => $view_link);
    }
    $entries_array_ids = array_keys($tEntries);
    if (isset($entries_array_ids) && !empty($entries_array_ids)) {
        $entries_string_ids = implode(',', $entries_array_ids);
        foreach ($mysql->select('SELECT * FROM ' . prefix . '_eshop_images i WHERE i.product_id IN (' . $entries_string_ids . ') ORDER BY i.position, i.id') as $irow) {
            $tEntries[$irow['product_id']]['images'][] = $irow;
        }
        foreach ($mysql->select('SELECT * FROM ' . prefix . '_eshop_variants v WHERE v.product_id IN (' . $entries_string_ids . ') ORDER BY v.position, v.id') as $vrow) {
            $tEntries[$vrow['product_id']]['variants'][] = $vrow;
        }
    }
    if ($overrideTemplateName) {
        $templateName = 'block/' . $overrideTemplateName;
    } else {
        $templateName = 'block/block_eshop';
    }
    // Determine paths for all template files
    $tpath = locatePluginTemplates(array($templateName), 'eshop', pluginGetVariable('eshop', 'localsource'));
    // Preload template configuration variables
    @templateLoadVariables();
    $cacheKeys[] = '|number=' . $number;
    $cacheKeys[] = '|mode=' . $mode;
    $cacheKeys[] = '|cat=' . $cat;
    $cacheKeys[] = '|templateName=' . $templateName;
    // Generate cache file name [ we should take into account SWITCHER plugin ]
    $cacheFileName = md5('eshop' . $config['theme'] . $templateName . $config['default_lang'] . join('', $cacheKeys)) . '.txt';
    if (!$cacheDisabled && $cacheExpire > 0) {
        $cacheData = cacheRetrieveFile($cacheFileName, $cacheExpire, 'eshop');
        if ($cacheData != false) {
            // We got data from cache. Return it and stop
            return $cacheData;
        }
    }
    $tVars['mode'] = $mode;
    $tVars['number'] = $number;
    $tVars['entries'] = $tEntries;
    $tVars['tpl_url'] = tpl_url;
    $tVars['home'] = home;
    $xt = $twig->loadTemplate($tpath[$templateName] . $templateName . '.tpl');
    $output = $xt->render($tVars);
    if (!$cacheDisabled && $cacheExpire > 0) {
        cacheStoreFile($cacheFileName, $output, 'eshop');
    }
    return $output;
}
Пример #21
0
	<?php 
    }
    ?>

	<h2>• Lowest voted questions</h2>
	<?php 
    foreach ($worstquestions as $worstquestion) {
        ?>
	Vote: <?php 
        echo $worstquestion['votes'];
        ?>
	Title: <?php 
        echo $worstquestion['title'];
        ?>
 <a href="<?php 
        echo generateLink("users", "view") . "/" . $worstquestion['userid'];
        ?>
"> <b>Author</b></a>
	<br />
	<?php 
    }
    ?>

<?php 
} else {
    ?>
	<meta http-equiv="refresh" content="0; url=<?php 
    echo BASE_PATH;
    ?>
">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';
Пример #22
0
No comments on this article as yet.<?php 
    } else {
        ?>
No answers as yet. Be the first to write an answer.<?php 
    }
    ?>
</h3><?php 
}
?>

<?php 
if ($_SESSION['userid'] != '') {
    ?>
<div class="questionsview_form">
<form action="<?php 
    echo generateLink("answers", "post");
    ?>
" method="post"  onsubmit="javascript:return cform();">

<h2 style="padding-top:0px;padding-bottom:16px;"><?php 
    if ($kb) {
        ?>
Add a comment<?php 
    } else {
        ?>
Answer Question<?php 
    }
    ?>
</h2>

<div id="wmd-editor" class="wmd-panel">
Пример #23
0
        } elseif ($result[$i]['State'] != 'Hidden') {
            $action = generateLink("UnBorrow", buildTextbookLink($result[$i]['Id'], "core/updateState.php") . "&action=unborrow");
        }
    } elseif ($result[$i]['Category'] == "Swap") {
        if ($result[$i]['State'] == "Active") {
            $action = generateLink("Swaped", buildTextbookLink($result[$i]['Id'], "core/updateState.php") . "&action=swapped");
        } elseif ($result[$i]['State'] != 'Hidden') {
            $action = generateLink("UnSwap", buildTextbookLink($result[$i]['Id'], "core/updateState.php") . "&action=unswap");
        }
    } elseif ($result[$i]['Category'] == "Sale") {
        if ($result[$i]['State'] == "Active") {
            $action = generateLink("Sold", buildTextbookLink($result[$i]['Id'], "core/updateState.php") . "&action=sold");
        } elseif ($result[$i]['State'] != 'Hidden') {
            $action = generateLink("UnSell", buildTextbookLink($result[$i]['Id'], "core/updateState.php") . "&action=unsell");
        }
    }
    if ($result[$i]['State'] == "Active") {
        $hide = generateLink("Hide", buildTextbookLink($result[$i]['Id'], "core/updateState.php") . "&action=hide");
    } elseif ($result[$i]['State'] == "Hidden") {
        $hide = generateLink("Activate", buildTextbookLink($result[$i]['Id'], "core/updateState.php") . "&action=active");
    } else {
        $hide = "";
    }
    echo '<tr><td>' . $result[$i]['Id'] . '</td><td>' . $result[$i]['Title'] . '</td><td>' . $result[$i]['ISBN'] . '</td><td>' . $result[$i]['Subject'] . '</td><td>' . $result[$i]['Edition'] . '</td><td>' . $result[$i]['Cond'] . '</td><td>' . $result[$i]['Category'] . '</td><td>' . $result[$i]['State'] . '</td>
				<td>' . $view . ' ' . $remove . ' <br></br> ' . $action . ' ' . $hide . '</td></tr>';
}
?>
	</tr>
</table>
</body>
</html>
Пример #24
0
		if (description.length < 15) {
			$("#wmd-input").addClass('textalert');
			$.fancyalert('Your description must be atleast 15 characters in length');
			$("#wmd-input").focus();
			return false;
		} else {
			$("#wmd-input").removeClass('textalert');
		}

		return true;
	}
</script>

<form action="<?php 
echo generateLink("questions", "update");
?>
" method="post" onsubmit="javascript:return cform();">

	<h1>Edit Your Question</h1>
	<input type="textbox" class="textbox" name="title" id="title" value="<?php 
echo $title;
?>
"/><br/>

	<div id="wmd-editor" class="wmd-panel" style="padding-top:20px">
		<div id="wmd-button-bar"></div>
		<textarea id="wmd-input" name="description" ><?php 
echo $description;
?>
</textarea>
Пример #25
0
<form action="<?php 
echo generateLink("answers", "update");
?>
" method="post">

<h1><?php 
echo _("Edit Your Answer");
?>
</h1>

<div id="wmd-editor" class="wmd-panel">
<div id="wmd-button-bar"></div>
<textarea id="wmd-input" name="description" ><?php 
echo $description;
?>
</textarea>
</div>
<div id="wmd-preview" class="wmd-panel"></div>
 
<br/><br/>
<input type="hidden" name="id" value="<?php 
echo $answerid;
?>
">
<input type="submit" value="<?php 
echo _("Update Answer");
?>
" class="button">
</form>
Пример #26
0
function _guestbook_records($order, $start, $perpage)
{
    global $mysql, $tpl, $userROW, $config, $parse;
    foreach ($mysql->select("SELECT * FROM " . prefix . "_guestbook WHERE status = 1 ORDER BY id {$order} LIMIT {$start}, {$perpage}") as $row) {
        if (pluginGetVariable('guestbook', 'usmilies')) {
            $row['message'] = $parse->smilies($row['message']);
        }
        if (pluginGetVariable('guestbook', 'ubbcodes')) {
            $row['message'] = $parse->bbcodes($row['message']);
        }
        $editlink = checkLinkAvailable('guestbook', 'edit') ? generatePluginLink('guestbook', 'edit', array('id' => $row['id']), array()) : generateLink('core', 'plugin', array('plugin' => 'guestbook', 'handler' => 'edit'), array('id' => $row['id']));
        $dellink = generateLink('core', 'plugin', array('plugin' => 'guestbook'), array('action' => 'delete', 'id' => $row['id']));
        $comnum++;
        // get fields
        $data = $mysql->select("select * from " . prefix . "_guestbook_fields");
        $fields = array();
        foreach ($data as $num => $value) {
            $fields[$value['id']] = $value['name'];
        }
        $comment_fields = array();
        foreach ($fields as $fid => $fname) {
            $comment_fields[$fid] = array('id' => $fid, 'name' => $fname, 'value' => $row[$fid]);
        }
        // set date format
        $date_format = pluginGetVariable('guestbook', 'date');
        if (empty($date_format)) {
            $date_format = 'j Q Y';
        }
        // get social data
        $social = unserialize($row['social']);
        $profiles = array();
        foreach ($social as $name => $id) {
            $img = $mysql->record("SELECT name, description FROM " . prefix . "_images WHERE id = {$id}");
            $profiles[$name] = array('photo' => $config['images_url'] . '/' . $img['name'], 'link' => $img['description']);
        }
        $comments[] = array('id' => $row['id'], 'date' => LangDate($date_format, $row['postdate']), 'message' => $row['message'], 'answer' => $row['answer'], 'author' => $row['author'], 'ip' => $row['ip'], 'comnum' => $comnum, 'edit' => $editlink, 'del' => $dellink, 'fields' => $comment_fields, 'social' => $profiles);
    }
    return $comments;
}