public function __construct()
    {
        parent::__construct();
        $language = OW::getLanguage();
        $serviceLang = BOL_LanguageService::getInstance();
        $addSectionForm = new Form('qst_add_section_form');
        $addSectionForm->setAjax();
        $addSectionForm->setAjaxResetOnSuccess(true);
        $addSectionForm->setAction(OW::getRouter()->urlFor("ADMIN_CTRL_Questions", "ajaxResponder"));
        $input = new HiddenField('command');
        $input->setValue('addSection');
        $addSectionForm->addElement($input);
        $qstSectionName = new TextField('section_name');
        $qstSectionName->addAttribute('class', 'ow_text');
        $qstSectionName->addAttribute('style', 'width: auto;');
        $qstSectionName->setRequired();
        $qstSectionName->setLabel($language->text('admin', 'questions_new_section_label'));
        $addSectionForm->addElement($qstSectionName);
        $this->addForm($addSectionForm);
        $addSectionForm->bindJsFunction('success', ' function (result) {
                if ( result.result )
                {
                    OW.info(result.message);
                }
                else
                {
                    OW.error(result.message);
                }

                window.location.reload();
            } ');
    }
Example #2
0
 public function index($params)
 {
     $id = (int) $params['id'];
     $this->assign('id', $id);
     $menu = BOL_NavigationService::getInstance()->findMenuItemById($id);
     $service = BOL_NavigationService::getInstance();
     $form = new EditExternalPageForm('edit-form', $menu);
     if (OW::getRequest()->isPost() && $form->isValid($_POST)) {
         $data = $form->getValues();
         $visibleFor = 0;
         $arr = !empty($data['visible-for']) ? $data['visible-for'] : array();
         foreach ($arr as $val) {
             $visibleFor += $val;
         }
         $service->saveMenuItem($menu->setExternalUrl($data['url'])->setVisibleFor($visibleFor)->setNewWindow(!empty($_POST['ext-open-in-new-window']) && $_POST['ext-open-in-new-window'] == 'on'));
         $languageService = BOL_LanguageService::getInstance();
         $plugin = OW::getPluginManager()->getPlugin('base');
         $langKey = $languageService->findKey($plugin->getKey(), $menu->getKey());
         if (empty($langKey)) {
             $langPrefixDto = $languageService->findPrefix($menu->getPrefix());
             $langKey = $languageService->addKey($langPrefixDto->getId(), $menu->getKey());
         }
         $langValue = $languageService->findValue($languageService->getCurrent()->getId(), $langKey->getId());
         if (empty($langValue)) {
             $languageService->addValue($languageService->getCurrent()->getId(), $menu->getPrefix(), $langKey->getKey(), $data['name']);
         } else {
             $languageService->saveValue($langValue->setValue($data['name']));
         }
         $adminPlugin = OW::getPluginManager()->getPlugin('admin');
         OW::getFeedback()->info(OW::getLanguage()->text($adminPlugin->getKey(), 'updated_msg'));
         $this->redirect();
     }
     $this->addForm($form);
 }
 /**
  * Constructor.
  *
  */
 public function __construct()
 {
     parent::__construct('');
     $template = OW::getPluginManager()->getPlugin('BASE')->getCmpViewDir() . 'console_switch_language.html';
     $this->setTemplate($template);
     $languages = BOL_LanguageService::getInstance()->getLanguages();
     $session_language_id = BOL_LanguageService::getInstance()->getCurrent()->getId();
     $active_languages = array();
     foreach ($languages as $id => $language) {
         if ($language->status == 'active') {
             $tag = $this->parseCountryFromTag($language->tag);
             $active_lang = array('id' => $language->id, 'label' => $tag['label'], 'order' => $language->order, 'tag' => $language->tag, 'class' => "ow_console_lang{$tag['country']}", 'url' => OW::getRequest()->buildUrlQueryString(null, array("language_id" => $language->id)), 'is_current' => false);
             if ($session_language_id == $language->id) {
                 $active_lang['is_current'] = true;
                 $this->assign('label', $tag['label']);
                 $this->assign('class', "ow_console_lang{$tag['country']}");
             }
             $active_languages[] = $active_lang;
         }
     }
     if (count($active_languages) <= 1) {
         $this->setVisible(false);
         return;
     }
     function sortActiveLanguages($lang1, $lang2)
     {
         return $lang1['order'] < $lang2['order'] ? -1 : 1;
     }
     usort($active_languages, 'sortActiveLanguages');
     $switchLanguage = new BASE_CMP_SwitchLanguage($active_languages);
     $this->setContent($switchLanguage->render());
 }
Example #4
0
 public function import($params)
 {
     $importDir = $params['importDir'];
     $sqlFile = $importDir . 'configs.sql';
     //import configs
     if (file_exists($sqlFile)) {
         DATAIMPORTER_BOL_ImportService::getInstance()->sqlImport($sqlFile);
     }
     $configFile = $importDir . 'config.txt';
     $string = file_get_contents($configFile);
     $this->configs = json_decode($string, true);
     $this->importAvatars($this->configs['avatarUrl']);
     $this->importTheme($importDir);
     $this->importMediaPanelFiles();
     if (OW::getPluginManager()->getPlugin('dataimporter')) {
         if (file_exists(OW::getPluginManager()->getPlugin('dataimporter')->getRootDir() . 'langs.zip')) {
             OW::getLanguage()->importPluginLangs(OW::getPluginManager()->getPlugin('dataimporter')->getRootDir() . 'langs.zip', 'dataimporter');
         }
     }
     $languageId = OW::getLanguage()->getCurrentId();
     BOL_LanguageService::getInstance()->generateCache($languageId);
     OW::getDbo()->query("TRUNCATE " . OW_DB_PREFIX . 'base_component_place_cache');
     //TODO: Use service function
     // ADD MENU ITEMS add plugin and add theme
     try {
         OW::getDbo()->query("INSERT IGNORE INTO `" . OW_DB_PREFIX . "base_menu_item` ( `prefix`, `key`, `documentKey`, `type`, `order`, `routePath`, `externalUrl`, `newWindow`, `visibleFor`) VALUES ( 'admin', 'sidebar_menu_plugins_add', '', 'admin_plugins', 3, 'admin_plugins_add', NULL, 0, 2) ");
     } catch (Exception $ex) {
     }
     try {
         OW::getDbo()->query("INSERT IGNORE INTO `" . OW_DB_PREFIX . "base_menu_item` ( `prefix`, `key`, `documentKey`, `type`, `order`, `routePath`, `externalUrl`, `newWindow`, `visibleFor`) VALUES ( 'admin', 'sidebar_menu_themes_add', '', 'admin_appearance', 3, 'admin_themes_add_new', NULL, 0, 3) ");
     } catch (Exception $ex) {
     }
 }
Example #5
0
 public function index($params)
 {
     $id = (int) $params['id'];
     $menu = BOL_NavigationService::getInstance()->findMenuItemById($id);
     $form = new EditPluginPageForm('edit-form', $menu);
     $service = BOL_NavigationService::getInstance();
     if (OW::getRequest()->isPost() && $form->isValid($_POST)) {
         $data = $form->getValues();
         $visibleFor = 0;
         $arr = !empty($data['visible-for']) ? $data['visible-for'] : array();
         foreach ($arr as $val) {
             $visibleFor += $val;
         }
         $service->saveMenuItem($menu->setVisibleFor($visibleFor));
         $languageService = BOL_LanguageService::getInstance();
         $langKey = $languageService->findKey($menu->getPrefix(), $menu->getKey());
         $langValue = $languageService->findValue($languageService->getCurrent()->getId(), $langKey->getId());
         $languageService->saveValue($langValue->setValue($data['name']));
         $adminPlugin = OW::getPluginManager()->getPlugin('admin');
         OW::getFeedback()->info(OW::getLanguage()->text($adminPlugin->getKey(), 'updated_msg'));
         $this->redirect();
     }
     //--
     $this->addForm($form);
 }
Example #6
0
 /**
  * Updates user settings configuration
  *
  * @return boolean
  */
 public function process($post, $plugins)
 {
     $values = $this->getValues();
     $config = OW::getConfig();
     if ($plugins['photo']) {
         $config->saveConfig('attachments', 'photo_share', empty($values['photo_share']) ? 0 : 1);
         if (!empty($values['photo_share'])) {
             $languageService = BOL_LanguageService::getInstance();
             $langKey = $languageService->findKey('attachments', 'default_photo_album_name');
             if (!empty($langKey)) {
                 $langValue = $languageService->findValue($languageService->getCurrent()->getId(), $langKey->getId());
                 if ($langValue === null) {
                     $langValue = new BOL_LanguageValue();
                     $langValue->setKeyId($langKey->getId());
                     $langValue->setLanguageId($languageService->getCurrent()->getId());
                 }
                 $languageService->saveValue($langValue->setValue($values['photo_album_name']));
             }
         }
     }
     if ($plugins['video']) {
         $config->saveConfig('attachments', 'video_share', empty($values['video_share']) ? 0 : 1);
     }
     if ($plugins['links']) {
         $config->saveConfig('attachments', 'link_share', empty($values['link_share']) ? 0 : 1);
     }
     return true;
 }
Example #7
0
function smarty_function_text_edit($params, $smarty)
{
    $key = $params['key'];
    unset($params['key']);
    $key = explode('+', $key);
    if (empty($key[0]) || empty($key[1])) {
        return '_INVALID_KEY_';
    }
    $prefix = $key[0];
    $key = $key[1];
    $text = OW::getLanguage()->text($prefix, $key, $params);
    $keyDto = BOL_LanguageService::getInstance()->findKey($prefix, $key);
    if (!$keyDto) {
        return '<span class="ow_red">' . $text . '</span>';
    }
    $script = '$("a.ow_text_edit").click(function(){
        var self=$(this), lang = this.rel.split("+");
        OW.editLanguageKey(lang[0],lang[1], function(e){
            self.text(e.value);     
        });
    });';
    OW::getDocument()->addOnloadScript($script);
    $rel = json_encode($prefix . '+' . $key);
    return '<a href="javascript://" rel=' . $rel . ' class="ow_text_edit">' . $text . '</a>';
}
Example #8
0
 public function deleteDepartment($id)
 {
     $id = (int) $id;
     if ($id > 0) {
         $key = BOL_LanguageService::getInstance()->findKey('contactus', $this->getDepartmentKey($id));
         BOL_LanguageService::getInstance()->deleteKey($key->id, true);
         CONTACTUS_BOL_DepartmentDao::getInstance()->deleteById($id);
     }
 }
Example #9
0
 public function deleteDepartment($id)
 {
     $id = (int) $id;
     if ($id > 0) {
         $key = BOL_LanguageService::getInstance()->findKey('shoppro', $this->getDepartmentKey($id));
         BOL_LanguageService::getInstance()->deleteKey($key->id, true);
         SHOPPRO_BOL_DepartmentDao::getInstance()->deleteById($id);
     }
 }
Example #10
0
 /**
  * Application init actions.
  */
 public function init()
 {
     require_once OW_DIR_SYSTEM_PLUGIN . 'base' . DS . 'classes' . DS . 'json_err_output.php';
     OW_ErrorManager::getInstance()->setErrorOutput(new BASE_CLASS_JsonErrOutput());
     $authToken = empty($_SERVER["HTTP_API_AUTH_TOKEN"]) ? null : $_SERVER["HTTP_API_AUTH_TOKEN"];
     OW_Auth::getInstance()->setAuthenticator(new OW_TokenAuthenticator($authToken));
     if (!empty($_SERVER["HTTP_API_LANGUAGE"])) {
         $tag = $_SERVER["HTTP_API_LANGUAGE"];
         $languageDto = BOL_LanguageService::getInstance()->findByTag($tag);
         if (empty($languageDto)) {
             $tag = mb_substr($tag, 0, 2);
             $languageDto = BOL_LanguageService::getInstance()->findByTag($tag);
         }
         if (!empty($languageDto) && $languageDto->status == "active") {
             BOL_LanguageService::getInstance()->setCurrentLanguage($languageDto);
         }
     }
     $this->detectLanguage();
     // setting default time zone
     date_default_timezone_set(OW::getConfig()->getValue('base', 'site_timezone'));
     if (OW::getUser()->isAuthenticated()) {
         $userId = OW::getUser()->getId();
         $timeZone = BOL_PreferenceService::getInstance()->getPreferenceValue('timeZoneSelect', $userId);
         if (!empty($timeZone)) {
             date_default_timezone_set($timeZone);
         }
     }
     // synchronize the db's time zone
     OW::getDbo()->setTimezone();
     //        OW::getRequestHandler()->setIndexPageAttributes('BASE_CTRL_ComponentPanel');
     //        OW::getRequestHandler()->setStaticPageAttributes('BASE_CTRL_StaticDocument');
     //
     //        // router init - need to set current page uri and base url
     $router = OW::getRouter();
     $router->setBaseUrl(OW_URL_HOME . 'api/');
     $uri = OW::getRequest()->getRequestUri();
     // before setting in router need to remove get params
     if (strstr($uri, '?')) {
         $uri = substr($uri, 0, strpos($uri, '?'));
     }
     $router->setUri($uri);
     $router->setDefaultRoute(new OW_ApiDefaultRoute());
     OW::getPluginManager()->initPlugins();
     $event = new OW_Event(OW_EventManager::ON_PLUGINS_INIT);
     OW::getEventManager()->trigger($event);
     $beckend = OW::getEventManager()->call('base.cache_backend_init');
     if ($beckend !== null) {
         OW::getCacheManager()->setCacheBackend($beckend);
         OW::getCacheManager()->setLifetime(3600);
         OW::getDbo()->setUseCashe(true);
     }
     OW::getResponse()->setDocument($this->newDocument());
     if (OW::getUser()->isAuthenticated()) {
         BOL_UserService::getInstance()->updateActivityStamp(OW::getUser()->getId(), $this->getContext());
     }
 }
Example #11
0
 public function getLanguageCode()
 {
     $tag = BOL_LanguageService::getInstance()->getCurrent()->getTag();
     $matches = array();
     preg_match("/^([a-zA-Z]{2})-[a-zA-Z]{2}.*\$/", $tag, $matches);
     $language = 'en';
     if (!empty($matches[1])) {
         $language = mb_strtolower($matches[1]);
     }
     return $language;
 }
Example #12
0
 public function addCategory($label, $parent, $id = null)
 {
     $category = new SPDOWNLOAD_BOL_Category();
     $category->id = $id;
     $category->name = $label;
     $category->parentId = $parent;
     SPDOWNLOAD_BOL_CategoryDao::getInstance()->save($category);
     if ($id == null) {
         BOL_LanguageService::getInstance()->addValue(OW::getLanguage()->getCurrentId(), 'spdownload', $this->getCategoryKey($category->id), trim($label));
     }
 }
Example #13
0
 /**
  * Returns class instance
  * @param $includeCache bool
  * @return BOL_LanguageService
  */
 public static function getInstance($includeCache = true)
 {
     if (!isset(self::$classInstance)) {
         try {
             self::$classInstance = OW::getClassInstance(self::class, $includeCache);
         } catch (ReflectionException $ex) {
             self::$classInstance = new self($includeCache);
         }
     }
     return self::$classInstance;
 }
Example #14
0
 protected function isValidLangs()
 {
     $langService = BOL_LanguageService::getInstance();
     $prefix = BOL_LanguageService::getInstance()->findPrefix('test_prefix');
     $this->assertTrue((bool) (!empty($prefix) && $prefix instanceof BOL_LanguagePrefix));
     $this->assertEquals('Test prefix', $prefix->label);
     $lang = BOL_LanguageService::getInstance()->findByTag('en');
     $this->assertEquals('test1', $langService->getText($lang->id, 'test_prefix', 'test_key_1'));
     $this->assertEquals('test2', $langService->getText($lang->id, 'test_prefix', 'test_key_2'));
     $this->assertEquals('test3', $langService->getText($lang->id, 'test_prefix', 'test_key_3'));
 }
Example #15
0
 public function __construct()
 {
     $accountType = new BOL_QuestionAccountType();
     $accountType->name = md5(uniqid());
     $accountType->roleId = 0;
     $form = new ADMIN_CLASS_AddAccountTypeForm($accountType);
     $this->addForm($form);
     $list = BOL_LanguageService::getInstance()->findActiveList();
     $this->assign('langs', $list);
     $this->assign('prefix', 'base');
     $this->assign('key', BOL_QuestionService::getInstance()->getQuestionLangKeyName(BOL_QuestionService::LANG_KEY_TYPE_ACCOUNT_TYPE, $accountType->name));
     $this->assign('form', $form);
 }
Example #16
0
 public function process()
 {
     $values = $this->getValues();
     $languageService = BOL_LanguageService::getInstance();
     $langKey = $languageService->findKey('uavatars', 'default_photo_album_name');
     if (!empty($langKey)) {
         $langValue = $languageService->findValue($languageService->getCurrent()->getId(), $langKey->getId());
         if ($langValue === null) {
             $langValue = new BOL_LanguageValue();
             $langValue->setKeyId($langKey->getId());
             $langValue->setLanguageId($languageService->getCurrent()->getId());
         }
         $languageService->saveValue($langValue->setValue($values['photo_album_name']));
     }
     return true;
 }
Example #17
0
 /**
  * Constructor.
  * 
  * @param array $itemsList
  */
 public function __construct($langId)
 {
     parent::__construct();
     $this->service = BOL_LanguageService::getInstance();
     if (empty($langId)) {
         $this->setVisible(false);
         return;
     }
     $languageDto = $this->service->findById($langId);
     if ($languageDto === null) {
         $this->setVisible(false);
         return;
     }
     $language = OW::getLanguage();
     $form = new Form('lang_edit');
     $form->setAjax();
     $form->setAction(OW::getRouter()->urlFor('ADMIN_CTRL_Languages', 'langEditFormResponder'));
     $form->setAjaxResetOnSuccess(false);
     $labelTextField = new TextField('label');
     $labelTextField->setLabel($language->text('admin', 'clone_form_lbl_label'));
     $labelTextField->setDescription($language->text('admin', 'clone_form_descr_label'));
     $labelTextField->setRequired();
     $labelTextField->setValue($languageDto->getLabel());
     $form->addElement($labelTextField);
     $tagTextField = new TextField('tag');
     $tagTextField->setLabel($language->text('admin', 'clone_form_lbl_tag'));
     $tagTextField->setDescription($language->text('admin', 'clone_form_descr_tag'));
     $tagTextField->setRequired();
     $tagTextField->setValue($languageDto->getTag());
     if ($languageDto->getTag() == 'en') {
         $tagTextField->addAttribute('disabled', 'disabled');
     }
     $form->addElement($tagTextField);
     $rtl = new CheckboxField('rtl');
     $rtl->setLabel($language->text('admin', 'lang_edit_form_rtl_label'));
     $rtl->setDescription($language->text('admin', 'lang_edit_form_rtl_desc'));
     $rtl->setValue((bool) $languageDto->getRtl());
     $form->addElement($rtl);
     $hiddenField = new HiddenField('langId');
     $hiddenField->setValue($languageDto->getId());
     $form->addElement($hiddenField);
     $submit = new Submit('submit');
     $submit->setValue($language->text('admin', 'btn_label_edit'));
     $form->addElement($submit);
     $form->bindJsFunction(Form::BIND_SUCCESS, "function(data){if(data.result){OW.info(data.message);setTimeout(function(){window.location.reload();}, 1000);}else{OW.error(data.message);}}");
     $this->addForm($form);
 }
Example #18
0
 public function __construct($accountTypeName = '')
 {
     $accountType = BOL_QuestionService::getInstance()->findAccountTypeByName($accountTypeName);
     if (empty($accountType)) {
         $this->setVisible(false);
     }
     $form = new ADMIN_CLASS_AddAccountTypeForm($accountType, 'editAccountType');
     $form->setAjaxResetOnSuccess(false);
     $this->addForm($form);
     $list = BOL_LanguageService::getInstance()->findActiveList();
     $key = BOL_QuestionService::getInstance()->getQuestionLangKeyName(BOL_QuestionService::LANG_KEY_TYPE_ACCOUNT_TYPE, $accountType->name);
     $this->assign('langs', $list);
     $this->assign('prefix', 'base');
     $this->assign('key', $key);
     $this->assign('form', $form);
     $this->setTemplate(OW::getPluginManager()->getPlugin('admin')->getCmpViewDir() . 'add_account_type.html');
 }
Example #19
0
 public function index($params)
 {
     $listType = empty($params['list']) ? 'latest' : strtolower(trim($params['list']));
     $this->addComponent('menu', self::getMenu($listType));
     $page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? intval($_GET['page']) : 1;
     list($list, $itemCount) = $this->getData($listType, ($page - 1) * $this->usersPerPage, $this->usersPerPage);
     $cmp = OW::getClassInstance("BASE_Members", $list, $itemCount, $this->usersPerPage, true, $listType);
     $this->addComponent('cmp', $cmp);
     $this->assign('listType', $listType);
     $description = '';
     try {
         $description = BOL_LanguageService::getInstance()->getText(BOL_LanguageService::getInstance()->getCurrent()->getId(), 'base', 'users_list_' . $listType . '_meta_description');
     } catch (Exception $e) {
     }
     if (!empty($description)) {
         OW::getDocument()->setDescription($description);
     }
 }
 public function __construct($value, $languageData)
 {
     parent::__construct('lang-values-edit');
     $this->setAjax(true);
     //$this->setAction('javascript://');
     $hidden = new HiddenField('value');
     $hidden->setValue($value);
     $this->addElement($hidden);
     $languageService = BOL_LanguageService::getInstance();
     $list = $languageService->findActiveList();
     foreach ($list as $item) {
         $textArea = new Textarea("lang[{$item->getId()}][value][{$value}]");
         if (isset($languageData[$item->getId()])) {
             $textArea->setValue($languageData[$item->getId()]);
         }
         $this->addElement($textArea);
     }
     $submit = new Submit('submit');
     $submit->setValue(OW::getLanguage()->text('admin', 'save_btn_label'));
     $this->addElement($submit);
 }
Example #21
0
 /**
  * Updates user settings configuration
  *
  * @return boolean
  */
 public function process($post)
 {
     $values = $this->getValues();
     $config = OW::getConfig();
     $config->saveConfig('utags', 'copy_photo', empty($values['copy_photo']) ? 0 : 1);
     $config->saveConfig('utags', 'crop_photo', empty($values['crop_photo']) ? 0 : 1);
     if (!empty($values['copy_photo'])) {
         $languageService = BOL_LanguageService::getInstance();
         $langKey = $languageService->findKey('utags', 'default_photo_album_name');
         if (!empty($langKey)) {
             $langValue = $languageService->findValue($languageService->getCurrent()->getId(), $langKey->getId());
             if ($langValue === null) {
                 $langValue = new BOL_LanguageValue();
                 $langValue->setKeyId($langKey->getId());
                 $langValue->setLanguageId($languageService->getCurrent()->getId());
             }
             $languageService->saveValue($langValue->setValue($values['photo_album_name']));
         }
     }
     return true;
 }
 /**
  * 
  * Constructor
  * @param $prefix
  * @param $key
  * @param BASE_CMP_LanguageValueEdit $parent
  */
 public function __construct($prefix, $key, $parent)
 {
     parent::__construct('lang-values-edit');
     $this->setAjax(true);
     $this->setAction(OW::getRouter()->urlFor('ADMIN_CTRL_Languages', 'ajaxEditLangs') . "?prefix={$prefix}&key={$key}");
     $languageService = BOL_LanguageService::getInstance();
     $list = $languageService->findActiveList();
     $parent->assign('langs', $list);
     $parent->assign('prefix', $prefix);
     $parent->assign('key', $key);
     foreach ($list as $item) {
         $textArea = new Textarea("lang[{$item->getId()}][{$prefix}][{$key}]");
         $dto = $languageService->getValue($item->getId(), $prefix, $key);
         $value = $dto !== null ? $dto->getValue() : '';
         $textArea->setValue($value);
         $this->addElement($textArea);
     }
     $submit = new Submit('submit');
     $submit->setValue('Save');
     if (!$parent->eventBased) {
         $jsString = 'owForms[{$formName}].bind("success", function(json){
             if ( json["result"] == "success") {
                 var fb = document.ajaxLangValueEditForms[ json["prefix"] +"-"+ json["key"] ];
                 var ff = document.ajaxLangValueEditForms[json["prefix"] +"-"+json["key"]+"callback"];
                 ff(json);
                 fb.close();
             }
         })';
     } else {
         $jsString = 'owForms[{$formName}].bind("success", function(json){
             if ( json["result"] == "success") {
                 OW.trigger("admin.language_key_edit_success", [json], this);
             }
         })';
     }
     $script = UTIL_JsGenerator::composeJsString($jsString, array('formName' => $this->getName()));
     OW::getDocument()->addOnloadScript($script);
     $this->addElement($submit);
 }
Example #23
0
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
$plugin = OW::getPluginManager()->getPlugin('fbconnect');
$dbPrefix = OW_DB_PREFIX;
$sql = <<<EOT
CREATE TABLE IF NOT EXISTS `{$dbPrefix}fbconnect_field` (
  `id` int(11) NOT NULL auto_increment,
  `question` varchar(50) NOT NULL,
  `fbField` varchar(100) NOT NULL,
  `converter` varchar(100) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=9 ;

INSERT INTO `{$dbPrefix}fbconnect_field` (`id`, `question`, `fbField`, `converter`) VALUES
(1, 'realname', 'name', 'FBCONNECT_FC_TextFieldConverter'),
(2, 'username', 'name', 'FBCONNECT_FC_Username'),
(3, 'email', 'email', 'FBCONNECT_FC_TextFieldConverter'),
(4, 'picture_small', 'pic_square', 'FBCONNECT_FC_Picture'),
(5, 'picture_big', 'pic_big', 'FBCONNECT_FC_Picture');

EOT;
OW::getDbo()->query($sql);
OW::getConfig()->addConfig('fbconnect', 'api_key', '', 'Facebook Api Key');
OW::getConfig()->addConfig('fbconnect', 'app_id', '', 'Facebook Application ID');
OW::getConfig()->addConfig('fbconnect', 'api_secret', '', 'Facebook Application Secret');
OW::getConfig()->addConfig('fbconnect', 'allow_synchronize', 0, 'Allow synchronization for non-Facebook profiles');
OW::getPluginManager()->addPluginSettingsRouteName('fbconnect', 'fbconnect_configuration_settings');
BOL_LanguageService::getInstance()->importPrefixFromZip($plugin->getRootDir() . 'langs.zip', 'fbconnect');
Example #24
0
$USEARCH_BOL_Service = USEARCH_BOL_Service::getInstance();
$BOL_SearchService = BOL_SearchService::getInstance();
$getPluginManager = OW::getPluginManager();
$CONTACTUS_BOL_Service = CONTACTUS_BOL_Service::getInstance();
$PHOTO_BOL_PhotoService = PHOTO_BOL_PhotoService::getInstance();
$PHOTO_BOL_PhotoAlbumCoverDao = PHOTO_BOL_PhotoAlbumCoverDao::getInstance();
$PHOTO_BOL_PhotoDao = PHOTO_BOL_PhotoDao::getInstance();
$getRouter = OW::getRouter();
$language = OW::getLanguage();
$getMailer = OW::getMailer();
$getConfig = OW::getConfig();
$getFeedback = OW::getFeedback();
$getEventManager = OW::getEventManager();
$getMailer = OW::getMailer();
$ow = OW_DB_PREFIX;
$LanguageService = BOL_LanguageService::getInstance();
$OW_Language = OW_Language::getInstance();
$QUESTION_PRESENTATION_DATE = BOL_QuestionService::QUESTION_PRESENTATION_DATE;
$QUESTION_PRESENTATION_RANGE = BOL_QuestionService::QUESTION_PRESENTATION_RANGE;
$QUESTION_PRESENTATION_BIRTHDATE = BOL_QuestionService::QUESTION_PRESENTATION_BIRTHDATE;
$QUESTION_PRESENTATION_AGE = BOL_QuestionService::QUESTION_PRESENTATION_AGE;
$QUESTION_PRESENTATION_DATE = BOL_QuestionService::QUESTION_PRESENTATION_DATE;
$QUESTION_VALUE_TYPE_DATETIME = BOL_QuestionService::QUESTION_VALUE_TYPE_DATETIME;
$QUESTION_VALUE_TYPE_SELECT = BOL_QuestionService::QUESTION_VALUE_TYPE_SELECT;
$QUESTION_PRESENTATION_SELECT = BOL_QuestionService::QUESTION_PRESENTATION_SELECT;
$QUESTION_PRESENTATION_RADIO = BOL_QuestionService::QUESTION_PRESENTATION_RADIO;
$QUESTION_PRESENTATION_MULTICHECKBOX = BOL_QuestionService::QUESTION_PRESENTATION_MULTICHECKBOX;
$QUESTION_PRESENTATION_URL = BOL_QuestionService::QUESTION_PRESENTATION_URL;
$QUESTION_PRESENTATION_TEXT = BOL_QuestionService::QUESTION_PRESENTATION_TEXT;
$QUESTION_PRESENTATION_TEXTAREA = BOL_QuestionService::QUESTION_PRESENTATION_TEXTAREA;
$MYSQL_DATETIME_DATE_FORMAT = UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT;
Example #25
0
 public function isValid($value)
 {
     if (empty($value)) {
         return false;
     }
     $languageService = BOL_LanguageService::getInstance();
     $language = $languageService->findByTag($value);
     if (!empty($language)) {
         return false;
     }
     return true;
 }
Example #26
0
 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     if ($this->textarea !== null) {
         return $this->textarea->renderInput();
     }
     if (OW::getRegistry()->get('baseWsInit') === null) {
         $language = OW::getLanguage();
         $languageDto = BOL_LanguageService::getInstance()->getCurrent();
         $array = array('editorCss' => OW::getPluginManager()->getPlugin('base')->getStaticCssUrl() . 'htmlarea_editor.css', 'themeImagesUrl' => OW::getThemeManager()->getCurrentTheme()->getStaticImagesUrl(), 'imagesUrl' => OW::getRouter()->urlFor('BASE_CTRL_MediaPanel', 'index', array('pluginKey' => 'blog', 'id' => '__id__')), 'labels' => array('buttons' => array('bold' => $language->text('base', 'ws_button_label_bold'), 'italic' => $language->text('base', 'ws_button_label_italic'), 'underline' => $language->text('base', 'ws_button_label_underline'), 'orderedlist' => $language->text('base', 'ws_button_label_orderedlist'), 'unorderedlist' => $language->text('base', 'ws_button_label_unorderedlist'), 'link' => $language->text('base', 'ws_button_label_link'), 'image' => $language->text('base', 'ws_button_label_image'), 'video' => $language->text('base', 'ws_button_label_video'), 'html' => $language->text('base', 'ws_button_label_html'), 'more' => $language->text('base', 'ws_button_label_more'), 'switchHtml' => $language->text('base', 'ws_button_label_switch_html')), 'common' => array('buttonAdd' => $language->text('base', 'ws_add_label'), 'buttonInsert' => $language->text('base', 'ws_insert_label'), 'videoHeadLabel' => $language->text('base', 'ws_video_head_label'), 'htmlHeadLabel' => $language->text('base', 'ws_html_head_label'), 'htmlTextareaLabel' => $language->text('base', 'ws_html_textarea_label'), 'videoTextareaLabel' => $language->text('base', 'ws_video_textarea_label'), 'linkTextLabel' => $language->text('base', 'ws_link_text_label'), 'linkUrlLabel' => $language->text('base', 'ws_link_url_label'), 'linkNewWindowLabel' => $language->text('base', 'ws_link_new_window_label')), 'messages' => array('imagesEmptyFields' => $language->text('base', 'ws_image_empty_fields'), 'linkEmptyFields' => $language->text('base', 'ws_link_empty_fields'), 'videoEmptyField' => $language->text('base', 'ws_video_empty_field'))), 'buttonCode' => OW::getThemeManager()->processDecorator('button', array('label' => '#label#', 'class' => 'ow_ic_add mn_submit')), 'rtl' => $languageDto !== null && (bool) $languageDto->getRtl() ? true : false);
         $script = "window.htmlAreaData = " . json_encode($array);
         OW::getDocument()->addScriptDeclarationBeforeIncludes($script);
         OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'htmlarea.js');
         OW::getDocument()->addStyleSheet(OW::getPluginManager()->getPlugin('base')->getStaticCssUrl() . 'htmlarea.css');
         OW::getRegistry()->set('baseWsInit', true);
     }
     $params = array('toolbar' => $this->buttons, 'size' => $this->size);
     if (!empty($this->customBodyClass)) {
         $params["customClass"] = $this->customBodyClass;
     }
     OW::getDocument()->addOnloadScript("\r\n            \$('#{$this->getId()}').get(0).htmlarea = function(){ \$(this).htmlarea( " . json_encode($params) . " );};\r\n            \$('#{$this->getId()}').get(0).htmlareaFocus = function(){this.jhtmlareaObject.iframe[0].contentWindow.focus();};\r\n            \$('#{$this->getId()}').get(0).htmlareaRefresh = function(){if(this.jhtmlareaObject){this.jhtmlareaObject.dispose();\$(this).htmlarea( " . json_encode($params) . " );}};\r\n        ");
     if ($this->value === null && $this->getHasInvitation()) {
         $this->addAttribute('value', $this->getInvitation());
         $this->addAttribute('class', 'invitation');
     }
     if ($this->init) {
         OW::getDocument()->addOnloadScript("\$('#{$this->getId()}').htmlarea( " . json_encode($params) . " );");
     }
     $this->removeAttribute('value');
     if ($this->value === null && $this->getHasInvitation()) {
         $markup = UTIL_HtmlTag::generateTag('textarea', $this->attributes, true, $this->getInvitation());
     } else {
         $markup = UTIL_HtmlTag::generateTag('textarea', $this->attributes, true, htmlspecialchars(BOL_TextFormatService::getInstance()->processWsForInput($this->value, array('buttons' => $this->buttons))));
     }
     return $markup;
 }
Example #27
0
 /**
  * Updates user settings configuration
  *
  * @return boolean
  */
 public function process($post, $plugins)
 {
     $values = $this->getValues();
     $config = OW::getConfig();
     $config->saveConfig('uheader', 'cover_height', intval($values['cover_height']));
     if ($plugins['photo']) {
         $config->saveConfig('uheader', 'photo_share', empty($values['photo_share']) ? 0 : 1);
         if (!empty($values['photo_share'])) {
             $languageService = BOL_LanguageService::getInstance();
             $langKey = $languageService->findKey('uheader', 'default_photo_album_name');
             if (!empty($langKey)) {
                 $langValue = $languageService->findValue($languageService->getCurrent()->getId(), $langKey->getId());
                 if ($langValue === null) {
                     $langValue = new BOL_LanguageValue();
                     $langValue->setKeyId($langKey->getId());
                     $langValue->setLanguageId($languageService->getCurrent()->getId());
                 }
                 $languageService->saveValue($langValue->setValue($values['photo_album_name']));
             }
         }
     }
     OW::getConfig()->saveConfig("uheader", "tpl_view_mode", $post["tpl_view_mode"]);
     return true;
 }
Example #28
0
OW::getDbo()->query($sql);
$sql = "INSERT INTO  `" . OW_DB_PREFIX . "map_category` (\n`id` ,\n`id2` ,\n`active` ,\n`name` ,\n`name_translate`\n)\nVALUES (\n'',  '0',  '1',  'Default',  'cat_default'\n);";
OW::getDbo()->query($sql);
$sql = "CREATE TABLE IF NOT EXISTS `" . OW_DB_PREFIX . "map_home` (\n  `idh_owner` int(11) NOT NULL,\n  `home_lat` varchar(128) collate utf8_bin NOT NULL,\n  `home_lon` varchar(128) collate utf8_bin NOT NULL,\n  UNIQUE KEY `idh_owner` (`idh_owner`),\n  KEY `idh_owner_2` (`idh_owner`),\n  KEY `home_lat` (`home_lat`),\n  KEY `home_lon` (`home_lon`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;";
OW::getDbo()->query($sql);
$config = OW::getConfig();
if (!$config->configExists('map', 'perpage')) {
    $config->addConfig('map', 'perpage', '300', '');
}
if (!$config->configExists('map', 'tabdisable_fanpage')) {
    $config->addConfig('map', 'tabdisable_fanpage', '0', '');
}
if (!$config->configExists('map', 'tabdisable_shop')) {
    $config->addConfig('map', 'tabdisable_shop', '0', '');
}
if (!$config->configExists('map', 'tabdisable_events')) {
    $config->addConfig('map', 'tabdisable_events', '0', '');
}
if (!$config->configExists('map', 'show_owner')) {
    $config->addConfig('map', 'show_owner', '1', '');
}
if (!$config->configExists('map', 'tabdisable_news')) {
    $config->addConfig('map', 'tabdisable_news', '0', '');
}
if (!$config->configExists('map', 'support_mobile_app')) {
    $config->addConfig('map', 'support_mobile_app', '0', '');
}
//----main:
BOL_LanguageService::getInstance()->addPrefix('map', 'Map');
OW::getLanguage()->importPluginLangs(OW::getPluginManager()->getPlugin('map')->getRootDir() . 'langs.zip', 'map');
OW::getPluginManager()->addPluginSettingsRouteName('map', 'map.admin');
Example #29
0
 public function deleteRoles()
 {
     $service = BOL_AuthorizationService::getInstance();
     if (empty($_POST['role']) || !is_array($_POST['role'])) {
         $this->redirect(OW::getRouter()->urlFor('ADMIN_CTRL_Users', 'roles'));
     }
     foreach ($_POST['role'] as $id) {
         $service->deleteRoleById($id);
     }
     $languageService = BOL_LanguageService::getInstance();
     $languageService->generateCache($languageService->getCurrent()->getId());
     OW::getFeedback()->info(OW::getLanguage()->text('admin', 'permissions_roles_deleted_msg'));
     $this->redirect(OW::getRouter()->urlFor('ADMIN_CTRL_Users', 'roles'));
 }
Example #30
0
 protected function newDocument()
 {
     $language = BOL_LanguageService::getInstance()->getCurrent();
     $document = new OW_HtmlDocument();
     $document->setTemplate(OW::getThemeManager()->getMasterPageTemplate('mobile_html_document'));
     $document->setCharset('UTF-8');
     $document->setMime('text/html');
     $document->setLanguage($language->getTag());
     if ($language->getRtl()) {
         $document->setDirection('rtl');
     } else {
         $document->setDirection('ltr');
     }
     if ((bool) OW::getConfig()->getValue('base', 'favicon')) {
         $document->setFavicon(OW::getPluginManager()->getPlugin('base')->getUserFilesUrl() . 'favicon.ico');
     }
     $document->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'jquery.min.js', 'text/javascript', -100);
     $document->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'mobile.js?' . OW::getConfig()->getValue('base', 'cachedEntitiesPostfix'), 'text/javascript', -50);
     OW::getEventManager()->bind(OW_EventManager::ON_AFTER_REQUEST_HANDLE, array($this, 'onBeforeDocumentRender'));
     return $document;
 }