function options() { global $tpl, $mysql, $cron, $twig; $tpath = locatePluginTemplates(array('config/main', 'config/general.from'), 'eshop', 1); $tVars = array(); if (isset($_REQUEST['submit'])) { pluginSetVariable('eshop', 'count', intval($_REQUEST['count'])); pluginSetVariable('eshop', 'count_search', secure_html($_REQUEST['count_search'])); pluginSetVariable('eshop', 'count_stocks', secure_html($_REQUEST['count_stocks'])); pluginSetVariable('eshop', 'views_count', $_REQUEST['views_count']); pluginSetVariable('eshop', 'bidirect_linked_products', $_REQUEST['bidirect_linked_products']); pluginSetVariable('eshop', 'approve_comments', $_REQUEST['approve_comments']); pluginSetVariable('eshop', 'sort_comments', $_REQUEST['sort_comments']); pluginSetVariable('eshop', 'integrate_gsmg', $_REQUEST['integrate_gsmg']); pluginSetVariable('eshop', 'max_image_size', intval($_REQUEST['max_image_size'])); pluginSetVariable('eshop', 'width_thumb', intval($_REQUEST['width_thumb'])); pluginSetVariable('eshop', 'width', intval($_REQUEST['width'])); pluginSetVariable('eshop', 'height', intval($_REQUEST['height'])); pluginSetVariable('eshop', 'ext_image', check_php_str($_REQUEST['ext_image'])); pluginSetVariable('eshop', 'pre_width', intval($_REQUEST['pre_width'])); pluginSetVariable('eshop', 'catz_max_image_size', intval($_REQUEST['catz_max_image_size'])); pluginSetVariable('eshop', 'catz_width_thumb', intval($_REQUEST['catz_width_thumb'])); pluginSetVariable('eshop', 'catz_width', intval($_REQUEST['catz_width'])); pluginSetVariable('eshop', 'catz_height', intval($_REQUEST['catz_height'])); pluginSetVariable('eshop', 'catz_ext_image', check_php_str($_REQUEST['catz_ext_image'])); pluginSetVariable('eshop', 'email_notify_orders', $_REQUEST['email_notify_orders']); pluginSetVariable('eshop', 'email_notify_comments', $_REQUEST['email_notify_comments']); pluginSetVariable('eshop', 'email_notify_back', $_REQUEST['email_notify_back']); pluginSetVariable('eshop', 'description_delivery', $_REQUEST['description_delivery']); pluginSetVariable('eshop', 'description_order', $_REQUEST['description_order']); pluginSetVariable('eshop', 'description_phones', $_REQUEST['description_phones']); pluginsSaveConfig(); redirect_eshop('?mod=extra-config&plugin=eshop&action=options'); } $views_cnt = intval(pluginGetVariable('eshop', 'views_count')); if ($views_cnt == 2) { $cron_row = $cron->getConfig(); foreach ($cron_row as $key => $value) { if ($value['plugin'] == 'eshop' && $value['handler'] == 'eshop_views') { $cron_min = $value['min']; $cron_hour = $value['hour']; $cron_day = $value['day']; $cron_month = $value['month']; } } if (!isset($cron_min)) { $cron_min = '0,15,30,45'; } if (!isset($cron_hour)) { $cron_hour = '*'; } if (!isset($cron_day)) { $cron_day = '*'; } if (!isset($cron_month)) { $cron_month = '*'; } $cron->unregisterTask('eshop', 'eshop_views'); $cron->registerTask('eshop', 'eshop_views', $cron_min, $cron_hour, $cron_day, $cron_month, '*'); } else { $cron->unregisterTask('eshop', 'eshop_views'); } $count = pluginGetVariable('eshop', 'count'); $count_search = pluginGetVariable('eshop', 'count_search'); $count_stocks = pluginGetVariable('eshop', 'count_stocks'); $views_count = pluginGetVariable('eshop', 'views_count'); $views_count = '<option value="0" ' . ($views_count == 0 ? 'selected' : '') . '>Нет</option><option value="1" ' . ($views_count == 1 ? 'selected' : '') . '>Да</option><option value="2" ' . ($views_count == 2 ? 'selected' : '') . '>Отложенное</option>'; $bidirect_linked_products = pluginGetVariable('eshop', 'bidirect_linked_products'); $bidirect_linked_products = '<option value="0" ' . ($bidirect_linked_products == 0 ? 'selected' : '') . '>Нет</option><option value="1" ' . ($bidirect_linked_products == 1 ? 'selected' : '') . '>Да</option>'; $approve_comments = pluginGetVariable('eshop', 'approve_comments'); $approve_comments = '<option value="0" ' . ($approve_comments == 0 ? 'selected' : '') . '>Нет</option><option value="1" ' . ($approve_comments == 1 ? 'selected' : '') . '>Да</option>'; $sort_comments = pluginGetVariable('eshop', 'sort_comments'); $sort_comments = '<option value="0" ' . ($sort_comments == 0 ? 'selected' : '') . '>Новые снизу</option><option value="1" ' . ($sort_comments == 1 ? 'selected' : '') . '>Новые сверху</option>'; $integrate_gsmg = pluginGetVariable('eshop', 'integrate_gsmg'); $integrate_gsmg = '<option value="0" ' . ($integrate_gsmg == 0 ? 'selected' : '') . '>Нет</option><option value="1" ' . ($integrate_gsmg == 1 ? 'selected' : '') . '>Да</option>'; $max_image_size = pluginGetVariable('eshop', 'max_image_size'); $width_thumb = pluginGetVariable('eshop', 'width_thumb'); $width = pluginGetVariable('eshop', 'width'); $height = pluginGetVariable('eshop', 'height'); $ext_image = pluginGetVariable('eshop', 'ext_image'); $pre_width = pluginGetVariable('eshop', 'pre_width'); $catz_max_image_size = pluginGetVariable('eshop', 'catz_max_image_size'); $catz_width_thumb = pluginGetVariable('eshop', 'catz_width_thumb'); $catz_width = pluginGetVariable('eshop', 'catz_width'); $catz_height = pluginGetVariable('eshop', 'catz_height'); $catz_ext_image = pluginGetVariable('eshop', 'catz_ext_image'); $email_notify_orders = pluginGetVariable('eshop', 'email_notify_orders'); $email_notify_comments = pluginGetVariable('eshop', 'email_notify_comments'); $email_notify_back = pluginGetVariable('eshop', 'email_notify_back'); $description_delivery = pluginGetVariable('eshop', 'description_delivery'); $description_order = pluginGetVariable('eshop', 'description_order'); $description_phones = pluginGetVariable('eshop', 'description_phones'); $tEntry = array('count' => $count, 'count_search' => $count_search, 'count_stocks' => $count_stocks, 'views_count' => $views_count, 'bidirect_linked_products' => $bidirect_linked_products, 'approve_comments' => $approve_comments, 'sort_comments' => $sort_comments, 'integrate_gsmg' => $integrate_gsmg, 'max_image_size' => $max_image_size, 'width_thumb' => $width_thumb, 'width' => $width, 'height' => $height, 'ext_image' => $ext_image, 'pre_width' => $pre_width, 'catz_max_image_size' => $catz_max_image_size, 'catz_width_thumb' => $catz_width_thumb, 'catz_width' => $catz_width, 'catz_height' => $catz_height, 'catz_ext_image' => $catz_ext_image, 'email_notify_orders' => $email_notify_orders, 'email_notify_comments' => $email_notify_comments, 'email_notify_back' => $email_notify_back, 'description_delivery' => $description_delivery, 'description_order' => $description_order, 'description_phones' => $description_phones); $xt = $twig->loadTemplate($tpath['config/general.from'] . 'config/' . 'general.from.tpl'); $tVars = array('entries' => isset($tEntry) ? $tEntry : ''); $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); }
function social_config() { global $tpl, $mysql, $lang, $twig; $tpath = locatePluginTemplates(array('config/main', 'config/social'), 'guestbook', 1); if (isset($_REQUEST['submit'])) { pluginSetVariable('guestbook', 'vk_client_id', secure_html($_REQUEST['vk_client_id'])); pluginSetVariable('guestbook', 'vk_client_secret', secure_html($_REQUEST['vk_client_secret'])); pluginSetVariable('guestbook', 'facebook_client_id', secure_html($_REQUEST['facebook_client_id'])); pluginSetVariable('guestbook', 'facebook_client_secret', secure_html($_REQUEST['facebook_client_secret'])); pluginSetVariable('guestbook', 'google_client_id', secure_html($_REQUEST['google_client_id'])); pluginSetVariable('guestbook', 'google_client_secret', secure_html($_REQUEST['google_client_secret'])); pluginSetVariable('guestbook', 'instagram_client_id', secure_html($_REQUEST['instagram_client_id'])); pluginSetVariable('guestbook', 'instagram_client_secret', secure_html($_REQUEST['instagram_client_secret'])); pluginsSaveConfig(); msg(array("text" => $lang['gbconfig']['msgo_settings_saved'])); } $vk_client_id = pluginGetVariable('guestbook', 'vk_client_id'); $vk_client_secret = pluginGetVariable('guestbook', 'vk_client_secret'); $facebook_client_id = pluginGetVariable('guestbook', 'facebook_client_id'); $facebook_client_secret = pluginGetVariable('guestbook', 'facebook_client_secret'); $google_client_id = pluginGetVariable('guestbook', 'google_client_id'); $google_client_secret = pluginGetVariable('guestbook', 'google_client_secret'); $instagram_client_id = pluginGetVariable('guestbook', 'instagram_client_id'); $instagram_client_secret = pluginGetVariable('guestbook', 'instagram_client_secret'); $xt = $twig->loadTemplate($tpath['config/social'] . 'config/social.tpl'); $tVars = array('skins_url' => skins_url, 'home' => home, 'tpl_home' => admin_url, 'vk_client_id' => $vk_client_id, 'vk_client_secret' => $vk_client_secret, 'facebook_client_id' => $facebook_client_id, 'facebook_client_secret' => $facebook_client_secret, 'google_client_id' => $google_client_id, 'google_client_secret' => $google_client_secret, 'instagram_client_id' => $instagram_client_id, 'instagram_client_secret' => $instagram_client_secret); $xg = $twig->loadTemplate($tpath['config/main'] . 'config/main.tpl'); $tVars = array('entries' => $xt->render($tVars)); print $xg->render($tVars); }