Esempio n. 1
0
 public function getAdminOptions()
 {
     $arrIp = array();
     $arrIpTmp = frameCsp::_()->getTable('access')->orderBy('id DESC')->get('*', array('type_access' => 1));
     foreach ($arrIpTmp as $key => $value) {
         $arrIp[$value['id']] = $value['access'];
     }
     $arrUser = array();
     $arrUserTmp = frameCsp::_()->getTable('access')->orderBy('id DESC')->get('*', array('type_access' => 2));
     foreach ($arrUserTmp as $key => $value) {
         $user_meta = get_user_by('id', $value['access']);
         $arrUser[$value['id']] = $user_meta->user_login;
     }
     $selectUser = array('' => '');
     $arrSelUserTmp = get_users();
     foreach ($arrSelUserTmp as $data) {
         $selectUser[$data->ID] = $data->user_login;
     }
     $selectRole['10'] = 'Administrator';
     $selectRole['7'] = 'Editor';
     $selectRole['2'] = 'Author';
     $selectRole['1'] = 'Contributor';
     $selectRole['0'] = 'Subscriber';
     $this->assign('arrIp', $arrIp);
     $this->assign('arrUser', $arrUser);
     $this->assign('selectUser', $selectUser);
     $this->assign('selectRole', $selectRole);
     $blockList[0] = parent::getContent('ipBlock');
     $blockList[1] = parent::getContent('userBlock');
     $blockList[2] = parent::getContent('roleBlock');
     $this->assign('blockList', $blockList);
     return parent::getContent('accessPage');
 }
Esempio n. 2
0
 public function isAdmin()
 {
     if (!function_exists('wp_get_current_user')) {
         frameCsp::_()->loadPlugins();
     }
     return current_user_can('administrator');
 }
Esempio n. 3
0
 public function initMenu()
 {
     $mainSlug = dispatcherCsp::applyFilters('adminMenuMainSlug', $this->_mainSlug);
     $mainMenuPageOptions = array('page_title' => langCsp::_('Ready! Coming Soon'), 'menu_title' => langCsp::_('Ready! Coming Soon'), 'capability' => 'manage_options', 'menu_slug' => $mainSlug, 'function' => array(frameCsp::_()->getModule('options')->getView(), 'getAdminPage'));
     $mainMenuPageOptions = dispatcherCsp::applyFilters('adminMenuMainOption', $mainMenuPageOptions);
     add_menu_page($mainMenuPageOptions['page_title'], $mainMenuPageOptions['menu_title'], $mainMenuPageOptions['capability'], $mainMenuPageOptions['menu_slug'], $mainMenuPageOptions['function']);
 }
Esempio n. 4
0
 public function addMetaBox()
 {
     global $post;
     if ($post->post_status != 'publish' && frameCsp::_()->getModule('options')->get('sub_enable')) {
         add_meta_box('cspSubscribeMetaBox', langCsp::_('Coming Soon - Subscribe notifications'), array($this->getController()->getView(), 'getMetaBox'));
     }
 }
Esempio n. 5
0
 public function getSubscribeModAdminOptions($code)
 {
     frameCsp::_()->addScript('adminSubscribeModulesOptionsCsp', $this->getModule()->getModPath() . 'js/admin.subscribeModulesAdmin.options.js');
     $this->assign('optsModel', frameCsp::_()->getModule('options')->getModel());
     $this->assign('code', $code);
     $this->assign('subMod', frameCsp::_()->getModule($code));
     return parent::getContent('subscribeModAdminOptions');
 }
Esempio n. 6
0
 public function init()
 {
     $isAdminPlugPage = frameCsp::_()->isAdminPlugPage();
     $isPluginsPage = utilsCsp::isPluginsPage();
     if (is_admin()) {
         if ($isAdminPlugPage || $isPluginsPage) {
             frameCsp::_()->addScript('jquery');
             frameCsp::_()->addScript('jquery-ui-tabs', '', array('jquery'));
             frameCsp::_()->addScript('jquery-ui-dialog', '', array('jquery'));
             frameCsp::_()->addScript('jquery-ui-button', '', array('jquery'));
             frameCsp::_()->addScript('farbtastic');
             frameCsp::_()->addScript('commonCsp', CSP_JS_PATH . 'common.js');
             frameCsp::_()->addScript('coreCsp', CSP_JS_PATH . 'core.js');
             frameCsp::_()->addScript('adminOptionsCsp', CSP_JS_PATH . 'admin.options.js');
             frameCsp::_()->addScript('ajaxupload', CSP_JS_PATH . 'ajaxupload.js');
             frameCsp::_()->addScript('postbox', get_bloginfo('wpurl') . '/wp-admin/js/postbox.js');
             add_thickbox();
             $ajaxurl = admin_url('admin-ajax.php');
             if (frameCsp::_()->getModule('options')->get('ssl_on_ajax')) {
                 $ajaxurl = uriCsp::makeHttps($ajaxurl);
             }
             $jsData = array('siteUrl' => CSP_SITE_URL, 'imgPath' => CSP_IMG_PATH, 'cssPath' => CSP_CSS_PATH, 'loader' => CSP_LOADER_IMG, 'close' => CSP_IMG_PATH . 'cross.gif', 'ajaxurl' => $ajaxurl, 'animationSpeed' => frameCsp::_()->getModule('options')->get('js_animation_speed'), 'siteLang' => langCsp::getData(), 'options' => frameCsp::_()->getModule('options')->getAllowedPublicOptions(), 'CSP_CODE' => CSP_CODE, 'ball_loader' => CSP_IMG_PATH . 'ajax-loader-ball.gif', 'ok_icon' => CSP_IMG_PATH . 'ok-icon.png');
             $jsData['allCheckRegPlugs'] = modInstallerCsp::getCheckRegPlugs();
             $jsData = dispatcherCsp::applyFilters('jsInitVariables', $jsData);
             frameCsp::_()->addJSVar('coreCsp', 'CSP_DATA', $jsData);
             $this->_styles = array('styleCsp' => array('path' => CSP_CSS_PATH . 'style.css'), 'adminStylesCsp' => array('path' => CSP_CSS_PATH . 'adminStyles.css'), 'jquery-tabs' => array('path' => CSP_CSS_PATH . 'jquery-tabs.css'), 'jquery-buttons' => array('path' => CSP_CSS_PATH . 'jquery-buttons.css'), 'wp-jquery-ui-dialog' => array(), 'farbtastic' => array(), 'jquery-dialog' => array('path' => CSP_CSS_PATH . 'jquery-dialog.css'));
             $defaultPlugTheme = frameCsp::_()->getModule('options')->get('default_theme');
             foreach ($this->_styles as $s => $sInfo) {
                 if (isset($sInfo['for'])) {
                     if ($sInfo['for'] == 'frontend' && is_admin() || $sInfo['for'] == 'admin' && !is_admin()) {
                         continue;
                     }
                 }
                 $canBeSubstituted = true;
                 if (isset($sInfo['substituteFor'])) {
                     switch ($sInfo['substituteFor']) {
                         case 'frontend':
                             $canBeSubstituted = !is_admin();
                             break;
                         case 'admin':
                             $canBeSubstituted = is_admin();
                             break;
                     }
                 }
                 if ($canBeSubstituted && file_exists(CSP_TEMPLATES_DIR . $defaultPlugTheme . DS . $s . '.css')) {
                     frameCsp::_()->addStyle($s, CSP_TEMPLATES_PATH . $defaultPlugTheme . '/' . $s . '.css');
                 } elseif ($canBeSubstituted && file_exists(utilsCsp::getCurrentWPThemeDir() . 'csp' . DS . $s . '.css')) {
                     frameCsp::_()->addStyle($s, utilsCsp::getCurrentWPThemePath() . '/toe/' . $s . '.css');
                 } elseif (!empty($sInfo['path'])) {
                     frameCsp::_()->addStyle($s, $sInfo['path']);
                 } else {
                     frameCsp::_()->addStyle($s);
                 }
             }
         }
     }
     parent::init();
 }
Esempio n. 7
0
 public function getPresetTemplates()
 {
     $this->assign('tplModules', frameCsp::_()->getModules(array('type' => 'template')));
     $tplModulesPromo = array();
     if (!frameCsp::_()->getModule('license')) {
         $tplModulesPromo = frameCsp::_()->getModule('promo_ready')->getPromoTemplates();
     }
     $this->assign('tplModulesPromo', $tplModulesPromo);
     return parent::getContent('templatePresetTemplates');
 }
Esempio n. 8
0
 protected function _loadUserData()
 {
     if (!$this->_dataLoaded) {
         if (!function_exists('wp_get_current_user')) {
             frameCsp::_()->loadPlugins();
         }
         $user = wp_get_current_user();
         $this->_data = $user->data;
         $this->_curentID = $this->_data->ID;
         $this->_dataLoaded = true;
     }
 }
Esempio n. 9
0
 /**
  * Get the content for templates module tab
  * 
  * @return type 
  */
 public function getTabContent()
 {
     $templates = frameCsp::_()->getModule('templatesCsp')->getModel()->get();
     if (empty($templates)) {
         $tpl = 'noTemplates';
     } else {
         $this->assign('templatesCsp', $templates);
         $this->assign('default_theme', frameCsp::_()->getModule('optionsCsp')->getModel()->get('default_theme'));
         $tpl = 'templatesTab';
     }
     return parent::getContent($tpl);
 }
Esempio n. 10
0
    public function initJsVars()
    {
        $ajaxurl = admin_url('admin-ajax.php');
        if (frameCsp::_()->getModule('options')->get('ssl_on_ajax')) {
            $ajaxurl = uriCsp::makeHttps($ajaxurl);
        }
        $jsData = array('siteUrl' => CSP_SITE_URL, 'imgPath' => CSP_IMG_PATH, 'loader' => CSP_LOADER_IMG, 'close' => CSP_IMG_PATH . 'cross.gif', 'ajaxurl' => $ajaxurl, 'animationSpeed' => frameCsp::_()->getModule('options')->get('js_animation_speed'), 'CSP_CODE' => CSP_CODE);
        return '<script type="text/javascript">
		// <!--
			var CSP_DATA = ' . utilsCsp::jsonEncode($jsData) . ';
		// -->
		</script>';
    }
Esempio n. 11
0
 public function getOrdersList($uid = 0)
 {
     $user = frameCsp::_()->getModule('user')->getCurrent();
     $searchCriteria = array();
     if (!$user->isAdmin) {
         if (!$uid || !is_numeric($uid)) {
             //!is_numeric($uid) is becouse WP add some first parametr when adding the_content hook
             $uid = $user->ID;
         }
         $searchCriteria['user_id'] = $uid;
     }
     frameCsp::_()->getModule('order')->getView()->getAllOrders($searchCriteria);
 }
 public function install()
 {
     parent::install();
     frameCsp::_()->getTable('options')->insert(array('code' => $this->getCode() . '_enabled', 'value' => '', 'label' => langCsp::_($this->getLabel() . ' Enabled'), 'cat_id' => 2));
     // unused for now
     /*frameCsp::_()->getTable('options')->insert(array(
     			'code' => $this->getCode(). '_auto_subscriber_create',
     			'value' => '1',
     			'label' => langCsp::_($this->getLabel(). ' Auto subscribers create'),
     			'cat_id' => 2,
     		));*/
     frameCsp::_()->getTable('options')->insert(array('code' => $this->getCode() . '_is_main', 'value' => '', 'label' => langCsp::_($this->getLabel() . ' is Main'), 'cat_id' => 2));
 }
Esempio n. 13
0
 public function create()
 {
     $res = new responseCsp();
     $data = reqCsp::get('post');
     if (isset($data['withoutConfirm'])) {
         $data['withoutConfirm'] = false;
     }
     if ($this->getModel()->create($data)) {
         $res->addMessage(langCsp::_(frameCsp::_()->getModule('options')->get('sub_success_msg')));
     } else {
         $res->pushError($this->getModel()->getErrors());
     }
     return $res->ajaxExec();
 }
Esempio n. 14
0
 public function adminTextEditorPopup()
 {
     $shortcodes = frameCsp::_()->getModule('shortcodesCsp')->getCodes();
     $shortcodesSelectOptions = array('' => langCsp::_('Select'));
     foreach ($shortcodes as $code => $cinfo) {
         if (in_array($code, array('product', 'category'))) {
             continue;
         }
         $shortcodesSelectOptions[$code] = $code;
     }
     $this->assign('shortcodesCsp', $shortcodes);
     $this->assign('shortcodesSelectOptions', $shortcodesSelectOptions);
     return parent::getContent('adminTextEditorPopup');
 }
Esempio n. 15
0
 public function get($d = array())
 {
     global $wpdb;
     $logAl = frameCsp::_()->getTable('log')->alias();
     frameCsp::_()->getTable('log')->orderBy('id DESC');
     frameCsp::_()->getTable('log')->arbitraryJoin('LEFT JOIN ' . $wpdb->users . ' ON ' . $wpdb->users . '.ID = ' . $logAl . '.uid');
     $dataFromDb = frameCsp::_()->getTable('log')->get($logAl . '.*, ' . $wpdb->users . '.user_nicename', $d);
     if (!empty($dataFromDb)) {
         foreach ($dataFromDb as $i => $d) {
             $dataFromDb[$i] = $this->_adaptFromDb($dataFromDb[$i]);
         }
     }
     return $dataFromDb;
 }
Esempio n. 16
0
 protected function _createView($name = '')
 {
     if (empty($name)) {
         $name = $this->getCode();
     }
     $parentModule = frameCsp::_()->getModule($this->getCode());
     $className = '';
     if (importCsp($parentModule->getModDir() . 'views' . DS . $name . '.php')) {
         $className = toeGetClassNameCsp($name . 'View');
     }
     if ($className) {
         $view = new $className();
         $view->setCode($this->getCode());
         return $view;
     }
     return NULL;
 }
Esempio n. 17
0
 public function sendMailToDevelopers()
 {
     $res = new responseCsp();
     $data = reqCsp::get('post');
     $fields = array('name' => new fieldCspCsp('name', langCsp::_('Your name field is required.'), '', '', 'Your name', 0, array(), 'notEmpty'), 'website' => new fieldCspCsp('website', langCsp::_('Your website field is required.'), '', '', 'Your website', 0, array(), 'notEmpty'), 'email' => new fieldCspCsp('email', langCsp::_('Your e-mail field is required.'), '', '', 'Your e-mail', 0, array(), 'notEmpty, email'), 'subject' => new fieldCspCsp('subject', langCsp::_('Subject field is required.'), '', '', 'Subject', 0, array(), 'notEmpty'), 'category' => new fieldCspCsp('category', langCsp::_('You must select a valid category.'), '', '', 'Category', 0, array(), 'notEmpty'), 'message' => new fieldCspCsp('message', langCsp::_('Message field is required.'), '', '', 'Message', 0, array(), 'notEmpty'));
     foreach ($fields as $f) {
         $f->setValue($data[$f->name]);
         $errors = validatorCsp::validate($f);
         if (!empty($errors)) {
             $res->addError($errors);
         }
     }
     if (!$res->error) {
         $msg = 'Message from: ' . get_bloginfo('name') . ', Host: ' . $_SERVER['HTTP_HOST'] . '<br />';
         foreach ($fields as $f) {
             $msg .= '<b>' . $f->label . '</b>: ' . nl2br($f->value) . '<br />';
         }
         $headers[] = 'From: ' . $fields['name']->value . ' <' . $fields['email']->value . '>';
         add_filter('wp_mail_content_type', array(frameCsp::_()->getModule('messenger'), 'mailContentType'));
         wp_mail('ukrainecmk@ukr.net, simon@readyshoppingcart.com, support@readyecommerce.zendesk.com', 'Ready Ecommerce Contact Dev', $msg, $headers);
         $res->addMessage(langCsp::_('Done'));
     }
     $res->ajaxExec();
 }
Esempio n. 18
0
 public function overwriteProtocol($link, $id, $sample)
 {
     static $pagesCache;
     $makeHttpsReplace = false;
     if (frameCsp::_()->getModule('options')->get('ssl_on_checkout') || frameCsp::_()->getModule('options')->get('ssl_on_account')) {
         if (!isset($pagesCache[$id])) {
             $pageParams = $this->getByID($id);
             if ($pageParams == NULL) {
                 $pagesCache[$id] = false;
             } else {
                 $pagesCache[$id] = $pageParams;
             }
         }
         if ($pagesCache[$id] && is_object($pagesCache[$id])) {
             if (frameCsp::_()->getModule('options')->get('ssl_on_checkout') && ($pagesCache[$id]->mod == 'checkout' || $pagesCache[$id]->mod == 'user' && in_array($pagesCache[$id]->action, array('getShoppingCart'))) || frameCsp::_()->getModule('options')->get('ssl_on_account') && ($pagesCache[$id]->mod == 'user' && in_array($pagesCache[$id]->action, array('getLoginForm', 'getRegisterForm', 'getAccountSummaryHtml', 'getProfileHtml', 'getOrdersList')) || $pagesCache[$id]->mod == 'digital_product' && in_array($pagesCache[$id]->action, array('getDownloadsList')))) {
                 $makeHttpsReplace = true;
             }
         }
     }
     if ($makeHttpsReplace) {
         $link = uriCsp::makeHttps($link);
     }
     return $link;
 }
Esempio n. 19
0
 public static function delete()
 {
     global $wpdb;
     $wpPrefix = $wpdb->prefix;
     /* add to 0.0.3 Versiom */
     $deleteOptions = reqCsp::getVar('deleteOptions');
     if (frameCsp::_()->getModule('pages')) {
         if (is_null($deleteOptions)) {
             frameCsp::_()->getModule('pages')->getView()->displayDeactivatePage();
             exit;
         }
         //Delete All pages, that was installed with plugin
         $pages = frameCsp::_()->getModule('pages');
         if (is_object($pages)) {
             $pages = $pages->getAll();
             if ($pages) {
                 foreach ($pages as $p) {
                     wp_delete_post($p->page_id, true);
                 }
             }
         }
     }
     if ((bool) $deleteOptions) {
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . CSP_DB_PREF . "modules`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . CSP_DB_PREF . "modules_type`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . CSP_DB_PREF . "options`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . CSP_DB_PREF . "htmltype`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . CSP_DB_PREF . "templates`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . CSP_DB_PREF . "email_templates`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . CSP_DB_PREF . "subscribers`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . CSP_DB_PREF . "files`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . CSP_DB_PREF . "log`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . CSP_DB_PREF . "options_categories`");
         $wpdb->query("DROP TABLE IF EXISTS `" . $wpPrefix . CSP_DB_PREF . "access`");
     }
     delete_option($wpPrefix . 'db_version');
     delete_option($wpPrefix . 'db_installed');
 }
Esempio n. 20
0
 /**
  * Get the template from database
  * @param string $module
  * @param string $template
  * @return object Email Template 
  */
 public function getTemplate($module, $template)
 {
     $conditions = array('module' => $module, 'name' => $template);
     $template = frameCsp::_()->getTable('email_templates')->get('*', $conditions);
     $this->template = $template[0];
     return $this;
 }
<div class="cspLeftCol">
<?php 
echo htmlCsp::ajaxfile('logo_image', array('url' => uriCsp::_(array('baseUrl' => admin_url('admin-ajax.php'), 'page' => 'options', 'action' => 'saveLogoImg', 'reqType' => 'ajax')), 'buttonName' => 'Select Logo image', 'responseType' => 'json', 'onSubmit' => 'toeOptLogoImgOnSubmitNewFile', 'onComplete' => 'toeOptLogoImgCompleteSubmitNewFile'));
?>
<div id="cspOptLogoImgkMsg"></div>
<br />
<img id="cspOptLogoImgPrev" 
		src="<?php 
echo $this->optModel->isEmpty('logo_image') ? '' : frameCsp::_()->getModule('options')->getLogoImgFullPath();
?>
" 
style="max-width: 200px;" />
</div>
<div class="cspRightCol">
    <div class="cspTip cspTipArrowLeft nomargin">
        <?php 
langCsp::_e('Choose your logo, you can use png, jpg or gif image file.');
?>
        <span class="cspTipCorner"></span>
    </div>
    <br />
    <div class="cspTip cspTipArrowDown nomargin">
        <?php 
langCsp::_e('You can use default logo, your own or disable it. To disable logo on Coming Soon page click "Remove image" button bellow.');
?>
        <span class="cspTipCorner"></span>
    </div> <br /> 
    
    <?php 
echo htmlCsp::button(array('value' => langCsp::_('Remove image'), 'attrs' => 'id="cspLogoRemove" class="button button-large" style="width:100%;"'));
?>
            case 'stretch':
                echo '<img src="' . frameCsp::_()->getModule('options')->getBgImgFullPath() . '" id="fullScreenBg" alt="" />';
                break;
            case 'center':
                echo '<style type="text/css">body {
								background:url(' . frameCsp::_()->getModule('options')->getBgImgFullPath() . ') center center no-repeat;
								background-size: cover;
							}</style>';
                break;
            case 'tile':
                echo '<style type="text/css">body {background:url(' . frameCsp::_()->getModule('options')->getBgImgFullPath() . ');}</style>';
                break;
        }
        break;
    case 'color':
        echo '<style type="text/css">body {background:' . frameCsp::_()->getModule('options')->get('bg_color') . '}</style>';
        break;
    case 'standart':
        echo '<img src="' . $this->getModule()->getModPath() . 'css/img/standart_bg.jpg" id="fullScreenBg" alt="" />';
        break;
}
?>
    
        <div class="cspHtmlContainerWrapper">
            <?php 
if (!empty($this->messages)) {
    ?>
                <?php 
    foreach ($this->messages as $m) {
        ?>
                    <div class="toeSuccessMsg"><?php 
 public function postWidget($args, $instance)
 {
     if (frameCsp::_()->isTplEditor()) {
         echo $args['after_widget'];
     }
 }
Esempio n. 24
0
 /**
  * This will display form for our widgets
  */
 public function displayWidgetForm($data = array(), $widget = array(), $formTpl = 'form')
 {
     $this->assign('data', $data);
     $this->assign('widget', $widget);
     if (frameCsp::_()->isTplEditor()) {
         if ($this->getPath($formTpl . '_ext')) {
             $formTpl .= '_ext';
         }
     }
     self::display($formTpl);
 }
Esempio n. 25
0
 public static function _installTables($module, $action = 'install')
 {
     $modDir = empty($module['ex_plug_dir']) ? CSP_MODULES_DIR . $module['code'] . DS : utilsCsp::getPluginDir($module['ex_plug_dir']) . $module['code'] . DS;
     if (is_dir($modDir . 'tables')) {
         $tableFiles = utilsCsp::getFilesList($modDir . 'tables');
         if (!empty($tableFiles)) {
             frameCsp::_()->extractTables($modDir . 'tables' . DS);
             foreach ($tableFiles as $file) {
                 $tableName = str_replace('.php', '', $file);
                 if (frameCsp::_()->getTable($tableName)) {
                     frameCsp::_()->getTable($tableName)->{$action}();
                 }
             }
         }
     }
 }
Esempio n. 26
0
 /**
  * Displays the config options for given module
  * 
  * @param string $module 
  * @param array $addDefaultOptions - if you want to add some additionsl options - specify it here
  */
 public function drawConfig($module, $additionalOptions = array())
 {
     if (!frameCsp::_()->getModule($module)) {
         return false;
     }
     // check for xml file with params structure
     if (frameCsp::_()->getModule($module)->isExternal()) {
         $config_xml = frameCsp::_()->getModule($module)->getModDir() . 'mod.xml';
     } else {
         $config_xml = CSP_MODULES_DIR . $module . DS . 'mod.xml';
     }
     if (!file_exists($config_xml)) {
         // if there is no configuration file for this $module
         return langCsp::_('There are no configuration options for this module');
     }
     $output = '';
     // reading params structure
     $configOptions = $this->prepareConfigOptions($config_xml);
     // reading params from database
     //bugodel2nia..............
     if (is_string($this->value)) {
         $params = Utils::jsonDecode($this->value);
     } elseif (is_object($this->value) || is_array($this->value)) {
         $params = toeObjectToArray($this->value);
     }
     //if (!empty($params)) {
     if (!empty($configOptions)) {
         $i = 0;
         if (empty($params)) {
             $params = array('0' => array());
         }
         if (is_array($additionalOptions) && !empty($additionalOptions)) {
             $configOptions = array_merge($configOptions, $additionalOptions);
         }
         foreach ($params as $param) {
             $output .= '<div class="module_options">';
             foreach ($configOptions as $key => $value) {
                 $fieldValue = '';
                 $output .= '<div class="module_option">';
                 $method = $configOptions[$key]['type'];
                 $name = 'params[' . $i . '][' . $key . ']';
                 $options = array();
                 // if the values attribute is set
                 if ($configOptions[$key]['values'] != '') {
                     $extract_options = explode(',', $configOptions[$key]['values']);
                     if (count($extract_options) > 1) {
                         foreach ($extract_options as $item => $string) {
                             if (strpos($string, '=>')) {
                                 $keyVal = array_map('trim', explode('=>', $string));
                                 $options[$keyVal[0]] = $keyVal[1];
                             } else {
                                 $options[$string] = $string;
                             }
                         }
                     } else {
                         $fieldValue = $configOptions[$key]['default'];
                     }
                     // if helper is needed to render the object
                 } elseif ($configOptions[$key]['helper'] != '') {
                     $helper_name = $configOptions[$key]['helper'];
                     // is helper from current module or other?
                     if ($configOptions[$key]['module'] != '') {
                         $hmodule = $configOptions[$key]['module'];
                     } else {
                         $hmodule = $module;
                     }
                     // calling the helper class
                     $helper = frameCsp::_()->getModule($hmodule)->getHelper();
                     if ($helper) {
                         // calling the helper method for current option
                         if (method_exists($helper, $helper_name)) {
                             $options = $helper->{$helper_name}();
                         }
                     }
                 }
                 if (isset($param[$key])) {
                     $fieldValue = $param[$key];
                 } else {
                     if ($fieldValue == '') {
                         $fieldValue = $configOptions[$key]['default'];
                     }
                 }
                 // filling the parameters to build html element
                 $htmlParams = array('value' => $fieldValue, 'optionsCsp' => $options);
                 if ($method == 'checkbox') {
                     $htmlParams['value'] = 1;
                     $htmlParams['checked'] = (bool) $fieldValue;
                 }
                 if (!empty($configOptions[$key]['htmlParams']) && is_array($configOptions[$key]['htmlParams'])) {
                     $htmlParams = array_merge($htmlParams, $configOptions[$key]['htmlParams']);
                 }
                 // output label and html element
                 $output .= '<label>' . langCsp::_($configOptions[$key]['label']);
                 if ($configOptions[$key]['description'] != '') {
                     $output .= '<a class="toeOptTip" tip="' . langCsp::_($configOptions[$key]['description']) . '"></a>';
                 }
                 $output .= '</label><br />';
                 $output .= htmlCsp::$method($name, $htmlParams) . '<br />';
                 $output .= '</div>';
             }
             $i++;
             $output .= '</div>';
         }
     }
     return $output;
 }
Esempio n. 27
0
<form id="cspAdminAccessFormRole">
<table>
  <tr>
    <td>Only users at or above this level will be able to log in:</td>
    <td>
    	<?php 
$selected = frameCsp::_()->getTable('access')->get('access', array('type_access' => 3));
?>
		<?php 
echo htmlCsp::selectbox('roleCsp', array('attrs' => 'style="float:left; width:120px; margin-right:8px;"', 'options' => $this->selectRole, 'value' => $selected[0]['access']));
?>
        <?php 
echo htmlCsp::hidden('reqType', array('value' => 'ajax'));
?>
		<?php 
echo htmlCsp::hidden('page', array('value' => 'access'));
?>
		<?php 
echo htmlCsp::hidden('action', array('value' => 'saveRole'));
?>
        <?php 
echo htmlCsp::submit('submitRole', array('value' => langCsp::_('Save'), 'attrs' => 'class="button button-primary button-large" style="float:right;"'));
?>
        
    </td>
  </tr>
</table>
</form>
Esempio n. 28
0
 public static function isThisCommercialEdition()
 {
     /*$commercialModules = array('rating');
       foreach($commercialModules as $m) {
           if(!frameCsp::_()->getModule($m)) 
               return false;
           if(!is_dir(frameCsp::_()->getModule($m)->getModDir())) 
               return false;
       }
       return true;*/
     foreach (frameCsp::_()->getModules() as $m) {
         if (is_object($m) && $m->isExternal()) {
             // Should be at least one external module
             return true;
         }
     }
     return false;
 }
Esempio n. 29
0
 /**
  * Will save subscriptions options as usual options + try to re-saive email templates from this part
  */
 public function saveSubscriptionGroup()
 {
     $res = new responseCsp();
     if ($this->getModel()->saveGroup(reqCsp::get('post'))) {
         $res->addMessage(langCsp::_('Done'));
         $emailTplData = reqCsp::getVar('email_tpl');
         if (!empty($emailTplData) && is_array($emailTplData)) {
             foreach ($emailTplData as $id => $tData) {
                 frameCsp::_()->getModule('messenger')->getController()->getModel('email_templates')->save(array('id' => $id, 'subject' => $tData['subject'], 'body' => $tData['body']));
             }
         }
     } else {
         $res->pushError($this->getModel('options')->getErrors());
     }
     return $res->ajaxExec();
 }
 public function getAdminView()
 {
     return frameCsp::_()->getModule('subscribe')->getView()->getSubscribeModAdminOptions($this->getCode());
 }