private function _renderTemplatesForm(&$form, $themeDir, $themeName, $index = 0)
 {
     $sourceTemplates = getTemplates();
     $path = $themeDir . '/templates/templates.php';
     if (file_exists($path)) {
         require_once $path;
         $input = array();
         foreach ($sourceTemplates as $type => $caption) {
             $options = array();
             if (isset($templates[$type])) {
                 $min = 0;
                 $minIndex = 0;
                 $i = 0;
                 $template = $templates[$type];
                 $name = getTemplateName($themeName, $type);
                 foreach ($template as $t) {
                     if (isset($t['name']) && $t['name'] == $type) {
                         $minIndex = $i;
                     }
                     $options[] = array('id_option' => $type . '_' . $t['id'], 'name' => $t['caption']);
                     $i++;
                 }
                 if (isset($options) && sizeof($options)) {
                     $input[] = array('type' => 'select', 'label' => $caption, 'name' => $name, 'options' => array('query' => $options, 'id' => 'id_option', 'name' => 'name'));
                     $value = Configuration::get($name);
                     $hasEmptyRecord = is_null($value);
                     // has database record with null value
                     $form['fields_value'][$name] = $hasEmptyRecord || !$value ? $options[$minIndex]['id_option'] : $value;
                 }
             }
         }
         $form['fields_form'][$index]['form'] = array('legend' => array('title' => 'Template settings', 'icon' => 'icon-edit'), 'input' => $input);
     }
 }
 public function postProcess()
 {
     if (Tools::isSubmit('submitAddconfiguration')) {
         $themeName = $this->_getThemeName();
         $modes = getSliderModes();
         $sliders = getSliders();
         foreach ($sliders as $sliderName => $sliderCaption) {
             foreach ($modes as $modeName => $modeCaption) {
                 $name = getSliderSettingsName($themeName, $sliderName, $modeName);
                 $value = Tools::getValue($name, '');
                 if (Validate::isInt($value) || empty($value)) {
                     $value = empty($value) ? '' : $value;
                     Configuration::updateValue($name, $value);
                 } else {
                     $this->errors[] = $this->l('Invalid value for slider "' . $sliderCaption . '" in "' . $modeCaption . '" mode');
                 }
             }
         }
         $sourceTemplates = getTemplates();
         foreach ($sourceTemplates as $type => $caption) {
             $name = getTemplateName($themeName, $type);
             $value = Tools::getValue($name, '');
             Configuration::updateValue($name, $value);
         }
         if (!count($this->errors)) {
             $this->confirmations[] = $this->l('The settings have been updated.');
         }
     }
     return parent::postProcess();
 }
 public function getThemeTemplates($themeName)
 {
     $path = FilesHelper::normalizePath(getThemeDir($themeName . _PREVIEW_SUFFIX_)) . '/templates/templates.php';
     if (file_exists($path)) {
         // TODO: Maybe we have to store all html and parse them after each update or export operation for backward
         require_once $path;
     } else {
         $templates = getTemplates();
         // backward with old themes which do not have templates.php file but plugin is already updated
     }
     $context = Context::getContext();
     $link = $context->link;
     $controllers = getTemplateControllers();
     $previewParam = 'theme_name=' . $themeName;
     $result = array();
     foreach ($templates as $type => $template) {
         $controller = $controllers[$type];
         $method = 'get' . $controller . 'Link';
         if (method_exists($link, $method)) {
             $lower = strtolower($controller);
             $item = Designer::getFirstItem($lower);
             if ($item > 0) {
                 $baseUrl = $link->{$method}($item);
                 $pos = strpos($baseUrl, '?');
                 if ($pos !== FALSE) {
                     // HACK: preview parameter must be first in URL in Debug mode
                     $mainPart = substr($baseUrl, 0, $pos);
                     $params = substr($baseUrl, $pos + 1);
                     $templateUrl = $mainPart . '?' . $previewParam . '&' . $params;
                 } else {
                     $templateUrl = $baseUrl . '?' . $previewParam;
                 }
             } else {
                 $templateUrl = $link->getPageLink('index') . '?' . $previewParam . '&missingContent=' . $lower;
             }
         } else {
             $templateUrl = $link->getPageLink($controller);
             if (strpos($templateUrl, $previewParam) === FALSE) {
                 // can be set in some case from Dispatcher.php
                 $templateUrl .= (strpos($templateUrl, '?') !== FALSE ? '&' : '?') . $previewParam;
             }
         }
         if (is_array($template)) {
             // updated theme with templates.php file
             foreach ($template as $t) {
                 $result[$t['name']] = $templateUrl . '&template=' . $type . '_' . $t['id'];
                 // format as {templateName_id.tpl}
             }
         } else {
             // backward with old themes which do not have templates.php file but plugin is already updated
             $result[$type] = $templateUrl;
         }
     }
     return $result;
 }
 function edit()
 {
     $jshopConfig = JSFactory::getConfig();
     $db = JFactory::getDBO();
     $cid = JRequest::getInt("category_id");
     $category = JTable::getInstance("category", "jshop");
     $category->load($cid);
     $_lang = $this->getModel("languages");
     $languages = $_lang->getAllLanguages(1);
     $multilang = count($languages) > 1;
     $nofilter = array();
     JFilterOutput::objectHTMLSafe($category, ENT_QUOTES, $nofilter);
     if ($cid) {
         $parentid = $category->category_parent_id;
         $rows = $this->_getAllCategoriesLevel($category->category_parent_id, $category->ordering);
     } else {
         $category->category_publish = 1;
         $parentid = JRequest::getInt("catid");
         $rows = $this->_getAllCategoriesLevel($parentid);
     }
     $lists['templates'] = getTemplates('category', $category->category_template);
     $lists['onelevel'] = $rows;
     $parentTop = new stdClass();
     $parentTop->category_id = 0;
     $parentTop->name = _JSHOP_TOP_LEVEL;
     $categories = buildTreeCategory(0, 1, 0);
     array_unshift($categories, $parentTop);
     $lists['treecategories'] = JHTML::_('select.genericlist', $categories, 'category_parent_id', 'class="inputbox" size="1" onchange = "changeCategory()"', 'category_id', 'name', $parentid);
     $lists['parentid'] = $parentid;
     $accessgroups = getAccessGroups();
     $lists['access'] = JHTML::_('select.genericlist', $accessgroups, 'access', 'class = "inputbox" size = "1"', 'id', 'title', $category->access);
     $view = $this->getView("category", 'html');
     $view->setLayout("edit");
     $view->assign('category', $category);
     $view->assign('lists', $lists);
     $view->assign('languages', $languages);
     $view->assign('multilang', $multilang);
     $view->assign('etemplatevar', '');
     JPluginHelper::importPlugin('jshoppingadmin');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeEditCategories', array(&$view));
     $view->displayEdit();
 }
Beispiel #5
0
function install_aop()
{
    require_once 'modules/EmailTemplates/EmailTemplate.php';
    global $sugar_config;
    $sugar_config['aop']['enable_portal'] = false;
    $sugar_config['aop']['joomla_url'] = '';
    $sugar_config['aop']['distribution_user_id'] = '';
    $sugar_config['aop']['support_from_address'] = '';
    $sugar_config['aop']['support_from_name'] = '';
    $sugar_config['aop'] = array('distribution_method' => 'roundRobin');
    $templates = getTemplates();
    foreach ($templates as $configKey => $templateData) {
        $template = new EmailTemplate();
        foreach ($templateData as $field => $value) {
            $template->{$field} = $value;
        }
        $template->save();
        $sugar_config['aop'][$configKey . "_id"] = $template->id;
    }
    ksort($sugar_config);
    write_array_to_file('sugar_config', $sugar_config, 'config.php');
}
Beispiel #6
0
 /**
  * Возвращает темы
  *
  * @return array
  */
 public function getThemes()
 {
     return getTemplates();
 }
Beispiel #7
0
?>
</h4>

												<p class="message">
													<?php 
echo _t('새 글을 쓰거나 아래의 서식들 중 하나를 선택하여 글을 쓸 수 있습니다. 서식은 자유롭게 작성하여 저장할 수 있습니다.');
?>
												</p>

												<dl>
													<dt><?php 
echo _t('서식 목록');
?>
</dt>
<?php 
$templateLists = getTemplates(getBlogId(), 'id,title');
if (count($templateLists) == 0) {
    echo '												<dd class="noItem">' . _t('등록된 서식이 없습니다.') . '</dd>' . CRLF;
} else {
    foreach ($templateLists as $templateList) {
        echo '												<dd><a href="#void" onclick="entryManager.loadTemplate(' . $templateList['id'] . ',\'' . htmlspecialchars($templateList['title']) . '\');return false;">' . htmlspecialchars($templateList['title']) . '</a></dd>' . CRLF;
    }
}
?>
												</dl>
												
												<div class="button-box">
													<button class="close-button input-button" onclick="toggleTemplateDialog();return false;" title="<?php 
echo _t('이 대화상자를 닫습니다.');
?>
"><span class="text"><?php 
 function editlist()
 {
     $cid = JRequest::getVar('cid');
     if (count($cid) == 1) {
         $this->setRedirect("index.php?option=com_jshopping&controller=products&task=edit&product_id=" . $cid[0]);
         return 0;
     }
     $id_vendor_cuser = getIdVendorForCUser();
     $jshopConfig = JSFactory::getConfig();
     $db = JFactory::getDBO();
     JPluginHelper::importPlugin('jshoppingadmin');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onLoadEditListProduct', array());
     $products = $this->getModel("products");
     $product = JTable::getInstance('product', 'jshop');
     $_lang = $this->getModel("languages");
     $_tax = $this->getModel("taxes");
     $all_taxes = $_tax->getAllTaxes();
     $list_tax = array();
     $list_tax[] = JHTML::_('select.option', -1, "- - -", 'tax_id', 'tax_name');
     foreach ($all_taxes as $tax) {
         $list_tax[] = JHTML::_('select.option', $tax->tax_id, $tax->tax_name . ' (' . $tax->tax_value . '%)', 'tax_id', 'tax_name');
     }
     if (count($all_taxes) == 0) {
         $withouttax = 1;
     } else {
         $withouttax = 0;
     }
     $categories = buildTreeCategory(0, 1, 0);
     $manuf1 = array();
     $manuf1[-1] = new stdClass();
     $manuf1[-1]->manufacturer_id = '-1';
     $manuf1[-1]->name = "- - -";
     $manuf1[0] = new stdClass();
     $manuf1[0]->manufacturer_id = '0';
     $manuf1[0]->name = _JSHOP_NONE;
     $_manufacturer = $this->getModel('manufacturers');
     $manufs = $_manufacturer->getList();
     $manufs = array_merge($manuf1, $manufs);
     $price_modification = array();
     $price_modification[] = JHTML::_('select.option', '+', '+', 'id', 'name');
     $price_modification[] = JHTML::_('select.option', '-', '-', 'id', 'name');
     $price_modification[] = JHTML::_('select.option', '*', '*', 'id', 'name');
     $price_modification[] = JHTML::_('select.option', '/', '/', 'id', 'name');
     $price_modification[] = JHTML::_('select.option', '=', '=', 'id', 'name');
     $price_modification[] = JHTML::_('select.option', '%', '%', 'id', 'name');
     $lists['price_mod_price'] = JHTML::_('select.genericlist', $price_modification, 'mod_price', '', 'id', 'name');
     $lists['price_mod_old_price'] = JHTML::_('select.genericlist', $price_modification, 'mod_old_price', '', 'id', 'name');
     if ($jshopConfig->admin_show_delivery_time) {
         $_deliveryTimes = $this->getModel("deliveryTimes");
         $all_delivery_times = $_deliveryTimes->getDeliveryTimes();
         $all_delivery_times0 = array();
         $all_delivery_times0[-1] = new stdClass();
         $all_delivery_times0[-1]->id = '-1';
         $all_delivery_times0[-1]->name = "- - -";
         $all_delivery_times0[0] = new stdClass();
         $all_delivery_times0[0]->id = '0';
         $all_delivery_times0[0]->name = _JSHOP_NONE;
         $lists['deliverytimes'] = JHTML::_('select.genericlist', array_merge($all_delivery_times0, $all_delivery_times), 'delivery_times_id', 'class = "inputbox" size = "1"', 'id', 'name');
     }
     //
     // units
     $_units = $this->getModel("units");
     $allunits = $_units->getUnits();
     if ($jshopConfig->admin_show_product_basic_price) {
         $lists['basic_price_units'] = JHTML::_('select.genericlist', $allunits, 'basic_price_unit_id', 'class = "inputbox"', 'id', 'name');
     }
     //
     // product labels
     if ($jshopConfig->admin_show_product_labels) {
         $_labels = $this->getModel("productLabels");
         $alllabels = $_labels->getList();
         $first = array();
         $first[] = JHTML::_('select.option', '-1', "- - -", 'id', 'name');
         $first[] = JHTML::_('select.option', '0', _JSHOP_SELECT, 'id', 'name');
         $lists['labels'] = JHTML::_('select.genericlist', array_merge($first, $alllabels), 'label_id', 'class = "inputbox"', 'id', 'name');
     }
     //
     // access rights
     $accessgroups = getAccessGroups();
     $first = array();
     $first[] = JHTML::_('select.option', '-1', "- - -", 'id', 'title');
     $lists['access'] = JHTML::_('select.genericlist', array_merge($first, $accessgroups), 'access', 'class = "inputbox"', 'id', 'title');
     //currency
     $current_currency = $product->currency_id;
     if (!$current_currency) {
         $current_currency = $jshopConfig->mainCurrency;
     }
     $_currency = $this->getModel("currencies");
     $currency_list = $_currency->getAllCurrencies();
     $lists['currency'] = JHTML::_('select.genericlist', $currency_list, 'currency_id', 'class = "inputbox"', 'currency_id', 'currency_code', $current_currency);
     // vendors
     $display_vendor_select = 0;
     if ($jshopConfig->admin_show_vendors) {
         $_vendors = $this->getModel("vendors");
         $listvebdorsnames = $_vendors->getAllVendorsNames(1);
         $first = array();
         $first[] = JHTML::_('select.option', '-1', "- - -", 'id', 'name');
         $lists['vendors'] = JHTML::_('select.genericlist', array_merge($first, $listvebdorsnames), 'vendor_id', 'class = "inputbox" size = "1"', 'id', 'name');
         $display_vendor_select = 1;
         if ($id_vendor_cuser > 0) {
             $display_vendor_select = 0;
         }
     }
     //
     $published = array();
     $published[] = JHTML::_('select.option', '-1', "- - -", 'value', 'name');
     $published[] = JHTML::_('select.option', 0, _JSHOP_UNPUBLISH, 'value', 'name');
     $published[] = JHTML::_('select.option', 1, _JSHOP_PUBLISH, 'value', 'name');
     $lists['product_publish'] = JHTML::_('select.genericlist', $published, 'product_publish', '', 'value', 'name');
     $lists['manufacturers'] = JHTML::_('select.genericlist', $manufs, 'product_manufacturer_id', 'class = "inputbox" size = "1"', 'manufacturer_id', 'name');
     $lists['tax'] = JHTML::_('select.genericlist', $list_tax, 'product_tax_id', 'class = "inputbox" size = "1"', 'tax_id', 'tax_name');
     $lists['categories'] = JHTML::_('select.genericlist', $categories, 'category_id[]', 'class="inputbox" size="10" multiple = "multiple" ', 'category_id', 'name');
     $lists['templates'] = getTemplates('product', "", 1);
     $view = $this->getView("product_edit", 'html');
     $view->setLayout("editlist");
     $view->assign('lists', $lists);
     $view->assign('cid', $cid);
     $view->assign('config', $jshopConfig);
     $view->assign('withouttax', $withouttax);
     $view->assign('display_vendor_select', $display_vendor_select);
     $view->assign('etemplatevar', '');
     $dispatcher->trigger('onBeforeDisplayEditListProductView', array(&$view));
     $view->editGroup();
 }
Beispiel #9
0
     $query = DB::query("SELECT email FROM member");
     while ($result = DB::fetch($query)) {
         DB::insert('mail_queue', array('to' => $result['email'], 'subject' => $title, 'content' => $content));
     }
     saveSetting('mail_queue', 1);
     showmessage('已经添加至邮件队列,稍后将由系统自动发送', 'admin.php#mail');
     break;
 case 'cloud_sync':
     $ret = cloud::sync();
     showmessage($ret ? '站点信息同步成功!' : '同步信息失败,请稍后再试', 'admin.php#setting');
     break;
 case 'load_plugin':
     exit(json_encode(getPlugins()));
     break;
 case 'load_template':
     exit(json_encode(getTemplates()));
     break;
 case 'load_cron':
     exit(json_encode(getCron()));
     break;
 case 'skip_cron':
     if (!defined('AFENABLED')) {
         exit;
     }
     if ($formhash != $_GET['formhash']) {
         showmessage('来源不可信,请重试', 'admin.php#cron');
     }
     $cron_id = daddslashes($_GET['cid']);
     DB::query("UPDATE cron SET nextrun=nextrun+86400 WHERE id='{$cron_id}'");
     $time = TIMESTAMP;
     DB::query("UPDATE cron SET nextrun='{$time}'+3600 WHERE id='{$cron_id}' AND nextrun < '{$time}'");
}
function notifyUsers($userids, $prizeid, $winEmail, $winNot)
{
    foreach ($userids as $userid) {
        notifyUser($userid, $prizeid, $winEmail, $winNot);
        //echo $message;
        //sendContactEmail() // would go here if we were doing it that way
    }
}
if (!isset($_GET['mail'])) {
    // userids and prizeid passed in from console
    $userids = explode(',', $userids);
    showUsersToBeNotified($userids);
    $winEmail = new stdClass();
    $winNot = new stdClass();
    getTemplates(&$winEmail, &$winNot);
    showNotificationForm($userids, $prizeid, $winEmail, $winNot);
} else {
    $userids = explode(',', $_POST['userids']);
    $prizeid = $_POST['prizeid'];
    $mailObj->email = $_POST['to'];
    $mailObj->from = $_POST['from'];
    $mailObj->subject = $_POST['subject'];
    $mailObj->body = $_POST['body'];
    $mailObj->bcc = $_POST['bcc'];
    $notObj->fbId = $_POST['fbId'];
    $notObj->body = $_POST['notificationBody'];
    echo "Awarding " . implode(',', $userids) . "...<br/>";
    awardUsers($userids, $prizeid);
    echo "Notifying " . implode(',', $userids) . "...<br/>";
    notifyUsers($userids, $prizeid, $mailObj, $notObj);
Beispiel #11
0
     break;
     // edit templates group list
 // edit templates group list
 case 'vizitka_edit_group_list':
     $bigButtonsMenu = getMenu('big_buttons');
     $group_templates = getGroupTemplates();
     $page = getPageContent($view);
     if (!$page) {
         $page = '';
     }
     break;
     // edit template list
 // edit template list
 case 'vizitka_edit_template_list':
     $bigButtonsMenu = getMenu('big_buttons');
     $templates = getTemplates($alias);
     $page = getPageContent($view);
     if (!$page) {
         $page = '';
     }
     break;
     // edit template step 1
 // edit template step 1
 case 'vizitka_edit_template':
     $editor = true;
     $bigButtonsMenu = getMenu('big_buttons');
     $tiraj = getTiraj('vizitki');
     $template = getTemplate($id);
     $paper_types = getPaperTypes();
     $page = getPageContent($view);
     if (!$page) {
function updateCssFromTemplateColor($template)
{
    $template_info = getTemplates($template);
    // css読み込み
    $file = DIR_FS_CATALOG_TEMPLATES . $template . '/css/' . FILENAME_EASY_DESIGN_CSS_TEMPLATE;
    if (file_exists($file)) {
        $css = file_get_contents($file);
        // カラー置換
        for ($i = 0; $i < count($template_info[0]['color']); $i++) {
            $css = str_replace('#{' . $template_info[0]['color'][$i]['key'] . '}', $template_info[0]['color'][$i]['value'], $css);
        }
        // css保存
        $file = DIR_FS_CATALOG_TEMPLATES . $template . '/css/' . FILENAME_EASY_DESIGN_CSS;
        clearstatcache();
        if (!is_writable($file)) {
            return false;
        }
        umask(0);
        if (file_put_contents($file, $css) !== false) {
            return true;
        } else {
            return false;
        }
    }
    return true;
}
Beispiel #13
0
	/*	Author: darkdragon
	/*	Licensed: GPLv2, see license.txt on top level directory
	/* 
	/*      File: admin/pages/SiteNew.php
	/*	Description: 
	/*************************************/
//TODO: Add support for existing block content
$Step = "1";
// VerifyParam()
if (!empty($_GET['step'])) {
    $Step = $_GET['step'];
}
//Step 1: Choose Template
if ($Step == "1") {
    //create Template List
    $Block['Templates'] = getTemplates();
}
//Step 2: Configure
if ($Step == "2") {
    // allgemeine settings
    //include blocks from template config
    include_once GC_IPATH . 'templates/' . $_POST['Template'] . '/config.php';
    $TPLBlocks = explode(';', $TemplateSettings);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
//Step 3: Save new Site
if ($Step == "3") {
    //get Template Settings
    include_once GC_IPATH . 'templates/' . $_POST['Template'] . '/config.php';
    $TPLBlocks = explode(';', $TemplateSettings);
    include_once GC_IPATH . 'functions.php';
 } else {
     if ($_POST['type'] == 'getfiles') {
         session_start();
         echo getFiles($_SESSION['username'], $_POST['grantname']);
     } else {
         if ($_POST['type'] == 'deletefile') {
             session_start();
             echo deleteFile($_SESSION['username'], $_POST['grantname'], $_POST['filename']);
         } else {
             if ($_POST['type'] == 'deletefile') {
                 session_start();
                 echo downloadFile($_SESSION['username'], $_POST['grantname'], $_POST['filename']);
             } else {
                 if ($_POST['type'] == 'gettemplates') {
                     session_start();
                     echo getTemplates($_SESSION['username']);
                 } else {
                     if ($_POST['type'] == 'edituser') {
                         session_start();
                         $phpdata = (array) json_decode($_POST['data']);
                         echo var_dump($phpdata);
                         if ($phpdata['password'] == '') {
                             $passhash = '';
                         } else {
                             $passhash = password_hash($phpdata['password'], PASSWORD_DEFAULT);
                         }
                         $_SESSION['firstname'] = $phpdata['firstname'];
                         $_SESSION['middlename'] = $phpdata['middlename'];
                         $_SESSION['lastname'] = $phpdata['lastname'];
                         $_SESSION['email'] = $phpdata['email'];
                         echo editUser($_SESSION['username'], $phpdata['firstname'], $phpdata['middlename'], $phpdata['lastname'], $phpdata['email'], $passhash);
Beispiel #15
0
<?php 
echo $_SESSION['permissions']['access_permissions'] != 1 ? "\ttmp.disabled=true;" : "";
?>

mb.add( tmp = new MenuButton( "<?php 
echo $_lang['users'];
?>
", usersMenu ) );

///////////////////////////////////////////////////////////////////////////////
// Resources Menus
//
  // first generate the submenus
  var editTemplatesMenu = new Menu();
<?php 
getTemplates();
?>

  var editSnippetsMenu = new Menu();
<?php 
getSnippets();
?>

  var editHTMLSnippetsMenu = new Menu();
<?php 
getHTMLSnippets();
?>

var resourcesMenu = new Menu();

resourcesMenu.add( tmp = new MenuItem( "<?php 
Beispiel #16
0
                 $message .= "<br/>" . TEXT_UPDATE_SUCCESS_COLOR;
             } else {
                 $error .= "<br/>" . TEXT_UPDATE_FAILURE_COLOR;
             }
         }
     }
 } else {
     if ($action == "recovery_color") {
         // 色の初期化
         // テンプレート名が設定されている事
         $template = $_REQUEST['template'];
         if ($template != "") {
             // テンプレートのカラー設定を削除し
             // 再度読み込みを行う
             deleteTemplateColor($template);
             $template_info = getTemplates();
             // css更新
             if (updateCssFromTemplateColor($template)) {
                 $message .= "<br/>" . TEXT_UPDATE_SUCCESS_COLOR;
             } else {
                 $error .= "<br/>" . TEXT_UPDATE_FAILURE_COLOR;
             }
         }
     } else {
         if ($action == "change_objection") {
             // POSTされた全データを対象とする
             // (keyが追加されても大丈夫なように)
             $objection = array();
             $i = 0;
             for (;;) {
                 if (!isset($_REQUEST['objection_id'][$i]) || !isset($_REQUEST['objection_value'][$i])) {