Exemplo n.º 1
0
 /**
  * @return stirng
  * @param string $templ_name - Шаблон оформления
  * @desc МАКРОС: Выводит форму подписки на рассылки
  */
 function form($templ_name = 'default')
 {
     $templ_file = '/subscription/' . $templ_name . '.tpl';
     $TEMPLATE = page::getTemplate($templ_file);
     if (!is_array($TEMPLATE)) {
         return page::errorNotFound('subscription.form', $templ_file);
     }
     $list = '';
     $sel = new ormSelect('subscription');
     $sel->where('lang', '=', languages::curId());
     $sel->where('domain', '=', domains::curId());
     $sel->where('active', '=', 1);
     $num = 0;
     while ($obj = $sel->getObject()) {
         page::assign('obj.id', $obj->id);
         page::assign('obj.name', $obj->name);
         $num++;
         page::assign('obj.num', $num);
         page::assign('class-first', $num == 1 ? 'first' : '');
         page::assign('class-last', $num == $sel->getObjectCount() ? 'last' : '');
         page::assign('class-odd', $num % 2 == 0 ? 'odd' : '');
         page::assign('class-even', $num % 2 != 0 ? 'even' : '');
         page::assign('class-third', $num % 3 == 0 ? 'third' : '');
         $list .= page::parse($TEMPLATE['list']);
     }
     // Парсим текст сообщения об ошибке
     page::parseError('subscription');
     if (empty($list)) {
         return page::parse($TEMPLATE['empty']);
     } else {
         page::assign('list', $list);
         return page::parse($TEMPLATE['frame']);
     }
 }
Exemplo n.º 2
0
 public function defAction()
 {
     function getSubscribersCount($id, $obj)
     {
         $sel = new ormSelect('subscribe_user');
         $sel->where('parents', '=', $id);
         return $sel->getCount();
     }
     ui::newButton(lang::get('SUBSCRIBE_BTN_ADD'), '/subscription/subscribe_add');
     $sel = new ormSelect('subscription');
     $sel->where('lang', '=', languages::curId());
     $sel->where('domain', '=', domains::curId());
     $table = new uiTable($sel);
     $table->formatValues(true);
     $table->addColumn('name', lang::get('SUBSCRIBE_TT1'), 200);
     $table->addColumn('last_subscribe', lang::get('SUBSCRIBE_TT2'), 200);
     $table->addColumn('id', lang::get('SUBSCRIBE_TT3'), 200, 0, 1, 'getSubscribersCount');
     $table->defaultRight('msg');
     $table->addRight('msg', 'list', single);
     $table->addRight('user', 'users', single);
     $table->addRight('subscribe_upd', 'edit', single);
     $table->addRight('subscribe_history', 'history', single);
     $table->addRight('subscribe_del', 'drop', multi);
     $table->addRight('subscribe_act', 'active', multi);
     $table->setDelMessage(lang::get('SUBSCRIBE_DEL_TITLE2'), lang::get('SUBSCRIBE_DEL_TEXT2'));
     $table->setMultiDelMessage(lang::get('SUBSCRIBE_DEL_TITLE_MULTI2'), lang::get('SUBSCRIBE_DEL_TEXT_MULTI2'));
     return $table->getHTML();
 }
Exemplo n.º 3
0
 public static function getInstance($lang = 'en')
 {
     if (self::$instance == null) {
         $c = __CLASS__;
         self::$instance = new $c($lang);
     }
     return self::$instance;
 }
Exemplo n.º 4
0
 public function execute()
 {
     if (!function_exists('memory_get_usage')) {
         $this->error("You must compile PHP with --enable-memory-limit", true);
     }
     $langtool = new languages();
     $memlast = $memstart = memory_get_usage();
     $this->output("Base memory usage: {$memstart}\n");
     foreach ($langtool->getLanguages() as $langcode) {
         Language::factory($langcode);
         $memstep = memory_get_usage();
         $this->output(sprintf("%12s: %d\n", $langcode, $memstep - $memlast));
         $memlast = $memstep;
     }
     $memend = memory_get_usage();
     $this->output(' Total Usage: ' . ($memend - $memstart) . "\n");
 }
Exemplo n.º 5
0
 function edit($id)
 {
     $languages = languages::find($id);
     $languages->languageTitle = Input::get('languageTitle');
     $languages->isRTL = Input::get('isRTL');
     $languages->languagePhrases = json_encode(Input::get('languagePhrases'));
     $languages->save();
     return $this->panelInit->apiOutput(true, $this->panelInit->language['editLanguage'], $this->panelInit->language['langModified'], $languages->toArray());
 }
Exemplo n.º 6
0
 public function langs()
 {
     $settingsArray = array();
     $languages = languages::get();
     foreach ($languages as $language) {
         $settingsArray['languages'][$language->id] = $language->languageTitle;
     }
     return $settingsArray;
 }
Exemplo n.º 7
0
 /**
 * @return array
 * @param boolean $type - Назначение шаблонов:
 		0	-	шаблон для страниц
 		1	-	шаблон для объектов
 * @desc Вернет все шаблоны для текущей языковой версии и текущего домена. Метод без кеширования результатов.
 */
 static function getByDestination($type = 0, $spec_name = false)
 {
     $type = $type ? 1 : 0;
     $select = $spec_name ? 't_id id, concat(t_name, " (", t_file, ")") name' : '*, t_id id';
     return db::q('SELECT ' . $select . ' FROM <<template>>
     			  WHERE t_type = "' . $type . '" and
     			  		t_lang_id = "' . languages::curId() . '" and
     					t_domain_id = "' . domains::curId() . '"
     			  ORDER BY t_name;', records);
 }
Exemplo n.º 8
0
 public function index($method = "main")
 {
     $languages = languages::where('id', 1)->first()->toArray();
     $languages['languagePhrases'] = json_decode($languages['languagePhrases'], true);
     if ($this->data['users']->role == "admin" and $this->panelInit->version != $this->panelInit->settingsArray['latestVersion']) {
         $this->data['latestVersion'] = $this->panelInit->settingsArray['latestVersion'];
     }
     $this->data['role'] = $this->data['users']->role;
     $this->panelInit->viewop($this->layout, 'welcome', $this->data);
 }
 public function langs()
 {
     $settingsArray = array();
     $languages = languages::get();
     foreach ($languages as $language) {
         $settingsArray['languages'][$language->id] = $language->languageTitle;
     }
     $settingsArray['languageAllow'] = $this->panelInit->settingsArray['languageAllow'];
     $settingsArray['layoutColorUserChange'] = $this->panelInit->settingsArray['layoutColorUserChange'];
     return $settingsArray;
 }
Exemplo n.º 10
0
 /**
  * @return array
  * @param boolean $prinud - Если true, принудительно читает данные из БД.
  * @desc Вернет все языковые версии системы
  */
 static function getAll($prinud = false)
 {
     if (empty(self::$langs) || $prinud) {
         $mas = db::q('SELECT *, l_id id FROM <<langs>>;', records);
         self::$langs = array();
         while (list($key, $lang) = each($mas)) {
             self::$langs[$lang['l_id']] = $lang;
             self::$langs_rel[$lang['l_prefix']] = $lang['l_id'];
         }
     }
     return self::$langs;
 }
Exemplo n.º 11
0
 public function execute()
 {
     // Generate a template .pot based on source tree
     $this->output("Getting 'gettext' default messages from sources:");
     $this->generatePot();
     $this->output("done.\n");
     $langTool = new languages();
     if ($this->getOption('lang', ALL_LANGUAGES) === ALL_LANGUAGES) {
         $codes = $langTool->getLanguages();
     } else {
         $codes = array($this->getOption('lang'));
     }
     // Do all languages
     foreach ($codes as $langcode) {
         $this->output("Loading messages for {$langcode}:\n");
         if (!$this->generatePo($langcode, $langTool->getMessages($langcode))) {
             $this->error("ERROR: Failed to write file.");
         } else {
             $this->output("Applying template:");
             $this->applyPot($langcode);
         }
     }
 }
Exemplo n.º 12
0
 /**
  * @return HTML
  * @param int $form_id - ID формы обратной связи. Форма предварительно должна быть создана в настройках модуля "Обратная связь".
  * @param string $templ_name - Шаблон оформления
  * @desc МАКРОС: Автоватически генерирует форму обратной связи (добавления отзыва, вопрос-ответа и пр.)
  */
 public function autoForm($form_id, $templ_name = 'default')
 {
     if ($form_obj = ormObjects::get($form_id, 'feedback_form')) {
         $obj = new ormPage();
         $obj->setClass($form_obj->form_class);
         $form = new ormEditForm($obj, languages::pre() . '/feedback/send_message');
         $form->tabuList('pseudo_url', 'h1', 'keywords', 'title', 'description', 'active', 'is_home_page', 'view_in_menu', 'view_submenu', 'in_search', 'answer', 'in_index', 'in_new_window', 'other_link', 'img_act', 'img_no_act', 'img_h1');
         page::assign('form_id', $form_obj->id);
         if ($form_obj->captcha) {
             $form->showCaptcha();
         }
         // Парсим текст сообщения
         page::parseError('feedback');
         return $form->getHTML('feedback/' . $templ_name);
     }
 }
 public function getLanguages($language_spec)
 {
     $languages = array();
     $lang_handler = languages::getInstance("en");
     if (strcmp($language_spec, "") == 0) {
         $language_spec = "zh-CN,cs-CZ,da-DK,nl-NL,en-GB,fr-FR,fi-FI,de-DE,el-GR,he-IL,ja-JA,ko-KR,it-IT,no-NO,pl-PL,pt-PT,ru-RU,es-ES,sv-SE";
     }
     $list = explode(",", $language_spec);
     if (count($list) > 1) {
         $languages[] = array("name" => "Autodetect", "code" => "", "default" => 1);
     }
     foreach ($list as $language) {
         $name = $lang_handler->iso2Language($language);
         if (strlen($language) == 2) {
             $name = ereg_replace(" *\\(.+\\)", "", $name);
             # remove country name if not specified
         }
         $languages[] = array("name" => $name, "code" => $language, "default" => 0);
     }
     return $languages;
 }
Exemplo n.º 14
0
        $wgOut = new wikiStatsOutput();
        break;
    case 'metawiki':
        $wgOut = new metawikiStatsOutput();
        break;
    case 'text':
        $wgOut = new textStatsOutput();
        break;
    case 'csv':
        $wgOut = new csvStatsOutput();
        break;
    default:
        showUsage();
}
# Languages
$wgLanguages = new languages();
# Header
$wgOut->heading();
$wgOut->blockstart();
$wgOut->element('Language', true);
$wgOut->element('Code', true);
$wgOut->element('Translated', true);
$wgOut->element('%', true);
$wgOut->element('Obsolete', true);
$wgOut->element('%', true);
$wgOut->element('Problematic', true);
$wgOut->element('%', true);
$wgOut->blockend();
$wgGeneralMessages = $wgLanguages->getGeneralMessages();
$wgRequiredMessagesNumber = count($wgGeneralMessages['required']);
foreach ($wgLanguages->getLanguages() as $code) {
Exemplo n.º 15
0
 private function getLangsAndDomains($TEMPLATE)
 {
     $sub_menu = '';
     $langs = languages::getAll();
     $domains = domains::getAll();
     page::assign('ldObjectLinks', '');
     if (count($langs) > 1 || count($domains) > 1) {
         $isMultiDom = count($domains) > 1 ? true : false;
         $sub_items = $curLD = '';
         $mas = array();
         $num = 0;
         while (list($num2, $domain) = each($domains)) {
             reset($langs);
             while (list($num1, $lang) = each($langs)) {
                 if (user::issetRight($lang['l_id'] . ' ' . $domain['d_id'], 'structure')) {
                     if ($isMultiDom) {
                         $lanver = $domain['d_name'];
                         if ($lang['l_id'] != $domain['d_def_lang']) {
                             $lanver .= '/' . $lang['l_prefix'];
                         }
                     } else {
                         $lanver = $lang['l_name'];
                     }
                     $link = ADMIN_URL;
                     if ($domain['d_id'] != domains::curSiteDomain()->id()) {
                         $link .= '/' . str_replace('.', '_', $domain['d_name']);
                     }
                     if ($lang['l_id'] != $domain['d_def_lang']) {
                         $link = '/' . $lang['l_prefix'] . $link;
                     }
                     if (domains::curId() == $domain['d_id'] && languages::curId() == $lang['l_id']) {
                         $curLD = $link;
                     }
                     page::assign('name', $lanver);
                     page::assign('url', $link);
                     $sub_items .= page::parse($TEMPLATE['langver']);
                     $mas[] = array('id' => $link, 'name' => $lanver);
                     $num++;
                 }
             }
         }
         if (!empty($sub_items) && $num > 1) {
             if ($isMultiDom) {
                 $lanver = domains::curDomain()->getName() . languages::pre();
             } else {
                 $lanver = languages::curLang()->getName();
             }
             page::assign('eshe', $lanver);
             page::assign('sub_items', $sub_items);
             $sub_menu = page::parse($TEMPLATE['sub_menu']);
             ui::SelectBox('ldObjectLinks', $mas, $curLD, 474, '', 'onSelectldObjectLinks()');
         }
     }
     return $sub_menu;
 }
 public function doAction()
 {
     $lang_handler = languages::getInstance("en");
     //		log::doLog('REF SEGMENT: '.$this->ref_segment);
     if ($this->ref_segment == '') {
         $this->ref_segment = 0;
     }
     // CASMACAT extension start
     if ($this->casIsReplaying) {
         $data = getMoreSegmentsWithoutTranslation($this->jid, $this->password, $this->step, $this->ref_segment, $this->where);
     } else {
         $data = getMoreSegments($this->jid, $this->password, $this->step, $this->ref_segment, $this->where);
     }
     // CASMACAT extension end
     $first_not_translated_found = false;
     //log::doLog('REF SEGMENT: '.$this->ref_segment);
     //		print_r($data); exit;
     foreach ($data as $i => $seg) {
         if ($this->where == 'before') {
             if ((double) $seg['sid'] >= (double) $this->ref_segment) {
                 break;
             }
         }
         // remove this when tag management enabled
         //        	$seg['segment'] = $this->stripTagsFromSource($seg['segment']);
         if (empty($this->pname)) {
             $this->pname = $seg['pname'];
         }
         if (empty($this->last_opened_segment)) {
             $this->last_opened_segment = $seg['last_opened_segment'];
         }
         if (empty($this->cid)) {
             $this->cid = $seg['cid'];
         }
         if (empty($this->pid)) {
             $this->pid = $seg['pid'];
         }
         if (empty($this->tid)) {
             $this->tid = $seg['tid'];
         }
         if (empty($this->create_date)) {
             $this->create_date = $seg['create_date'];
         }
         if (empty($this->source_code)) {
             $this->source_code = $seg['source'];
         }
         if (empty($this->target_code)) {
             $this->target_code = $seg['target'];
         }
         if (empty($this->source)) {
             $s = explode("-", $seg['source']);
             $source = strtoupper($s[0]);
             $this->source = $source;
         }
         if (empty($this->target)) {
             $t = explode("-", $seg['target']);
             $target = strtoupper($t[0]);
             $this->target = $target;
         }
         $id_file = $seg['id_file'];
         $file_stats = CatUtils::getStatsForFile($id_file);
         if (!isset($this->data["{$id_file}"])) {
             $this->data["{$id_file}"]['jid'] = $seg['jid'];
             $this->data["{$id_file}"]["filename"] = $seg['filename'];
             $this->data["{$id_file}"]["mime_type"] = $seg['mime_type'];
             $this->data["{$id_file}"]['id_segment_start'] = $seg['id_segment_start'];
             $this->data["{$id_file}"]['id_segment_end'] = $seg['id_segment_end'];
             $this->data["{$id_file}"]['source'] = $lang_handler->iso2Language($seg['source']);
             $this->data["{$id_file}"]['target'] = $lang_handler->iso2Language($seg['target']);
             $this->data["{$id_file}"]['source_code'] = $seg['source'];
             $this->data["{$id_file}"]['target_code'] = $seg['target'];
             $this->data["{$id_file}"]['file_stats'] = $file_stats;
             $this->data["{$id_file}"]['segments'] = array();
         }
         //if (count($this->data["$id_file"]['segments'])>100){continue;}
         $this->filetype_handler = new filetype($seg['mime_type']);
         unset($seg['id_file']);
         unset($seg['source']);
         unset($seg['target']);
         unset($seg['source_code']);
         unset($seg['target_code']);
         unset($seg['mime_type']);
         unset($seg['filename']);
         unset($seg['jid']);
         unset($seg['pid']);
         unset($seg['cid']);
         unset($seg['tid']);
         unset($seg['pname']);
         unset($seg['create_date']);
         unset($seg['id_segment_end']);
         unset($seg['id_segment_start']);
         //		log::doLog('A');
         $seg['segment'] = $this->filetype_handler->parse($seg['segment']);
         // ASKED. MARCO CONFIRMED: in the web interface do not show xliff_ext_prec_tags and xliff_ext_succ_tags
         // $seg['segment'] = $seg['xliff_ext_prec_tags'] . $seg['segment'].$seg['xliff_ext_succ_tags'] ;
         $seg['segment'] = CatUtils::rawxliff2view($seg['segment']);
         $seg['translation'] = CatUtils::rawxliff2view($seg['translation']);
         $seg['parsed_time_to_edit'] = $this->parse_time_to_edit($seg['time_to_edit']);
         $this->data["{$id_file}"]['segments'][] = $seg;
     }
     //log::doLog ($this->data);
     $this->result['data']['files'] = $this->data;
     $this->result['data']['where'] = $this->where;
 }
Exemplo n.º 17
0
 public function __construct()
 {
     $this->panelItems = array("dashboard" => array("title" => "dashboard", "icon" => "fa fa-dashboard", "url" => URL::to('#'), "permissions" => array('admin', 'teacher', 'student', 'parent')), "staticContent" => array("title" => "staticPages", "icon" => "fa fa-file-text", "activated" => "staticpagesAct", "url" => "", "permissions" => array('admin', 'teacher', 'student', 'parent'), "children" => array("controlStatic" => array("title" => "controlPages", "url" => URL::to('#static'), "icon" => "fa fa-cog", "permissions" => array('admin')))), "messages" => array("title" => "Messages", "url" => URL::to('#messages'), "icon" => "fa fa-envelope", "permissions" => array('admin', 'teacher', 'student', 'parent')), "calender" => array("title" => "Calender", "url" => URL::to('#calender'), "icon" => "fa fa-calendar", "permissions" => array('admin', 'teacher', 'student', 'parent')), "classSchedule" => array("title" => "classSch", "url" => URL::to('#classschedule'), "icon" => "fa fa-list", "permissions" => array('admin', 'teacher', 'student', 'parent')), "attendance" => array("title" => "Attendance", "url" => "", "icon" => "fa fa-bar-chart", "activated" => "attendanceAct", "permissions" => array('admin', 'teacher'), "children" => array("controlAttendance" => array("title" => "Attendance", "url" => URL::to('#attendance'), "icon" => "fa fa-check", "permissions" => array('admin', 'teacher')), "statsAttendance" => array("title" => "attendanceStats", "url" => URL::to('#attendanceStats'), "icon" => "fa fa-bar-chart", "permissions" => array('admin', 'teacher')))), "vacation" => array("title" => "Vacation", "url" => URL::to('#vacation'), "icon" => "fa fa-coffee", "activated" => "vacationAct", "permissions" => array('teacher', 'student')), "myAttendance" => array("title" => "Attendance", "url" => URL::to('#attendanceStats'), "icon" => "fa fa-bar-chart", "activated" => "attendanceAct", "permissions" => array('student', 'parent')), "staffAttendance" => array("title" => "staffAttendance", "url" => URL::to('#staffAttendance'), "icon" => "fa fa-check", "activated" => "staffAttendanceAct", "permissions" => array('admin')), "library" => array("title" => "Library", "url" => URL::to('#library'), "icon" => "fa fa-folder-open", "activated" => "bookslibraryAct", "permissions" => array('admin', 'teacher', 'student', 'parent')), "media" => array("title" => "mediaCenter", "url" => URL::to('#media'), "icon" => "fa fa-video-camera", "activated" => "mediaAct", "permissions" => array('admin', 'teacher', 'student', 'parent')), "teachers" => array("title" => "teachers", "url" => URL::to('#teachers'), "icon" => "fa fa-suitcase", "permissions" => array('admin')), "students" => array("title" => "students", "url" => URL::to('#students'), "icon" => "fa fa-users", "permissions" => array('admin', 'teacher', 'parent')), "parents" => array("title" => "parents", "url" => URL::to('#parents'), "icon" => "fa fa-user", "permissions" => array('admin')), "gradelevels" => array("title" => "gradeLevels", "url" => URL::to('#gradeLevels'), "icon" => "fa fa-check-square-o", "permissions" => array('admin')), "materials" => array("title" => "studyMaterial", "url" => URL::to('#materials'), "icon" => "fa fa-book", "activated" => "materialsAct", "permissions" => array('admin', 'teacher', 'student')), "assignments" => array("title" => "Assignments", "url" => URL::to('#assignments'), "icon" => "fa fa-file-pdf-o", "activated" => "assignmentsAct", "permissions" => array('admin', 'teacher', 'student')), "examslist" => array("title" => "examsList", "url" => URL::to('#examsList'), "icon" => "fa fa-graduation-cap", "permissions" => array('admin', 'teacher', 'student', 'parent')), "onlineexams" => array("title" => "onlineExams", "url" => URL::to('#onlineExams'), "icon" => "fa fa-graduation-cap", "activated" => "onlineexamsAct", "permissions" => array('admin', 'teacher', 'student')), "newsboard" => array("title" => "newsboard", "url" => URL::to('#newsboard'), "icon" => "fa fa-bullhorn", "activated" => "newsboardAct", "permissions" => array('admin', 'teacher', 'student', 'parent')), "events" => array("title" => "events", "url" => URL::to('#events'), "icon" => "fa fa-clock-o", "activated" => "eventsAct", "permissions" => array('admin', 'teacher', 'student', 'parent')), "controlPayments" => array("title" => "Payments", "url" => URL::to('#payments'), "icon" => "fa fa-money", "activated" => "paymentsAct", "permissions" => array('admin', 'student', 'parent')), "transportations" => array("title" => "Transportation", "url" => URL::to('#transports'), "icon" => "fa fa-bus", "activated" => "transportAct", "permissions" => array('admin', 'teacher', 'student', 'parent')), "classes" => array("title" => "classes", "url" => URL::to('#classes'), "icon" => "fa fa-sitemap", "permissions" => array('admin')), "subjects" => array("title" => "Subjects", "url" => URL::to('#subjects'), "icon" => "fa fa-book", "permissions" => array('admin')), "reports" => array("title" => "Reports", "url" => URL::to('#reports'), "icon" => "fa fa-pie-chart", "activated" => "reportsAct", "permissions" => array('admin')), "adminTasks" => array("title" => "adminTasks", "url" => "", "icon" => "fa fa-cog", "permissions" => array('admin'), "children" => array("permissions" => array("title" => "permissions", "url" => URL::to('#permissions'), "icon" => "fa fa-male", "permissions" => array('admin')), "academicyear" => array("title" => "academicyears", "url" => URL::to('#academicYear'), "icon" => "fa fa-calendar-check-o", "permissions" => array('admin')), "promotion" => array("title" => "Promotion", "url" => URL::to('#promotion'), "icon" => "fa fa-arrow-up", "permissions" => array('admin')), "mailsms" => array("title" => "mailsms", "url" => URL::to('#mailsms'), "icon" => "fa fa-send", "permissions" => array('admin')), "mailsmsTemplates" => array("title" => "mailsmsTemplates", "url" => URL::to('#mailsmsTemplates'), "icon" => "fa fa-envelope-o", "permissions" => array('admin')), "polls" => array("title" => "Polls", "url" => URL::to('#polls'), "icon" => "fa fa-tasks", "activated" => "pollsAct", "permissions" => array('admin')), "dormitories" => array("title" => "Dormitories", "url" => URL::to('#dormitories'), "icon" => "fa fa-building-o", "permissions" => array('admin')), "siteSettings" => array("title" => "generalSettings", "url" => URL::to('#settings'), "icon" => "fa fa-cog", "permissions" => array('admin')), "languages" => array("title" => "Languages", "url" => URL::to('#languages'), "icon" => "fa fa-font", "permissions" => array('admin')), "admins" => array("title" => "Administrators", "url" => URL::to('#admins'), "icon" => "fa fa-gears", "permissions" => array('admin')), "terms" => array("title" => "schoolTerms", "url" => URL::to('#terms'), "icon" => "fa fa-file-text-o", "permissions" => array('admin')))));
     $settings = settings::get();
     foreach ($settings as $setting) {
         $this->settingsArray[$setting->fieldName] = $setting->fieldValue;
     }
     if ($this->settingsArray['lastUpdateCheck'] + 86400 < time()) {
         $sb = $this->sbApi();
         if ($sb == "err") {
             exit;
         }
         $latestUpdate = @file_get_contents("http://cr-house.com/apps/schoex/latest");
         $latestUpdate = @json_decode($latestUpdate, true);
         $settings = settings::where('fieldName', 'lastUpdateCheck')->first();
         $settings->fieldValue = time();
         $settings->save();
         if (is_array($latestUpdate)) {
             $settings = settings::where('fieldName', 'latestVersion')->first();
             $settings->fieldValue = $latestUpdate['v'];
             $settings->save();
         }
     }
     $staticPages = staticPages::where('pageActive', '1')->get();
     foreach ($staticPages as $pages) {
         $this->panelItems['staticContent']['children'][md5(uniqid())] = array("title" => $pages->pageTitle, "url" => URL::to('#static') . "/" . $pages->id, "icon" => "fa fa-file-text", "permissions" => array('admin', 'teacher', 'student', 'parent'));
     }
     //Languages
     $defLang = $defLang_ = $this->settingsArray['languageDef'];
     if (isset($this->settingsArray['languageAllow']) and $this->settingsArray['languageAllow'] == "1" and !Auth::guest() and \Auth::user()->defLang != 0) {
         $defLang = \Auth::user()->defLang;
     }
     //Theme
     $this->defTheme = $this->settingsArray['layoutColor'];
     if (isset($this->settingsArray['layoutColorUserChange']) and $this->settingsArray['layoutColorUserChange'] == "1" and !Auth::guest() and \Auth::user()->defTheme != "") {
         $this->defTheme = \Auth::user()->defTheme;
     }
     $language = languages::whereIn('id', array($defLang, 1))->get();
     if (count($language) == 0) {
         $language = languages::whereIn('id', array($defLang_, 1))->get();
     }
     foreach ($language as $value) {
         if ($value->id == 1) {
             $this->language = json_decode($value->languagePhrases, true);
         } else {
             $this->isRTL = $value->isRTL;
             $phrases = json_decode($value->languagePhrases, true);
             while (list($key, $value) = each($phrases)) {
                 $this->language[$key] = $value;
             }
         }
     }
     //Selected academicYear
     if (Session::has('selectAcYear')) {
         $this->selectAcYear = Session::get('selectAcYear');
     } else {
         $currentAcademicYear = academicYear::where('isDefault', '1')->first();
         $this->selectAcYear = $currentAcademicYear->id;
         Session::put('selectAcYear', $this->selectAcYear);
     }
     $this->baseURL = Request::url('index.php');
     if (strpos($this->baseURL, 'index.php') == false) {
         $this->baseURL = URL::to('index.php');
     }
 }
Exemplo n.º 18
0
// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
// | General Public License for more details.                              |
// |                                                                       |
// | You should have received a copy of the GNU General Public License     |
// | along with this program; if not, write to the Free Software           |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA.                                                                  |
// +-----------------------------------------------------------------------+
if (!defined("PHPWG_ROOT_PATH")) {
    die("Hacking attempt!");
}
include_once PHPWG_ROOT_PATH . 'admin/include/languages.class.php';
$template->set_filenames(array('languages' => 'languages_installed.tpl'));
$base_url = get_root_url() . 'admin.php?page=' . $page['page'];
$languages = new languages();
$languages->get_db_languages();
//--------------------------------------------------perform requested actions
if (isset($_GET['action']) and isset($_GET['language'])) {
    $page['errors'] = $languages->perform_action($_GET['action'], $_GET['language']);
    if (empty($page['errors'])) {
        redirect($base_url);
    }
}
// +-----------------------------------------------------------------------+
// |                     start template output                             |
// +-----------------------------------------------------------------------+
$default_language = get_default_language();
$tpl_languages = array();
foreach ($languages->fs_languages as $language_id => $language) {
    $language['u_action'] = add_url_params($base_url, array('language' => $language_id));
Exemplo n.º 19
0
    /**
     * @return int ID шаблона
     * @param int $type - Тип шаблона. 0 - шаблон страницы, 1 - шаблон содержимого
     * @desc Возвращает id стандартного шаблона для класса с учетом текущего домена и языка, 0 - шаблон не выбран
     */
    public function getDefTemplate($type = 0)
    {
        $id = db::q('SELECT t_id
			   FROM <<template>>, <<template_def>> 
			   WHERE t_id = td_template_id AND td_class_id = ' . $this->id . ' AND t_type = ' . $type . ' AND t_lang_id = ' . languages::curId() . ' AND t_domain_id = ' . domains::curId() . ' 
			   LIMIT 1', value);
        return $id != '' ? $id : 0;
    }
Exemplo n.º 20
0
<?php

/**
 * Dumb program that tries to get the memory usage
 * for each language file.
 */
/** This is a command line script */
require_once dirname(__FILE__) . '/../commandLine.inc';
require_once dirname(__FILE__) . '/languages.inc';
$langtool = new languages();
if (!function_exists('memory_get_usage')) {
    wfDie("You must compile PHP with --enable-memory-limit\n");
}
$memlast = $memstart = memory_get_usage();
print 'Base memory usage: ' . $memstart . "\n";
foreach ($langtool->getLanguages() as $langcode) {
    Language::factory($langcode);
    $memstep = memory_get_usage();
    printf("%12s: %d\n", $langcode, $memstep - $memlast);
    $memlast = $memstep;
}
$memend = memory_get_usage();
echo ' Total Usage: ' . ($memend - $memstart) . "\n";
Exemplo n.º 21
0
function applyPot($langcode)
{
    $langdir = LOCALE_OUTPUT_DIR . '/' . $langcode;
    $from = $langdir . '/fromlanguagefile.po';
    $pot = LOCALE_OUTPUT_DIR . '/wfMsg.pot';
    $dest = $langdir . '/messages.po';
    // Merge template and generate file to get final .po
    exec(MSGMERGE_BIN . MSGMERGE_OPTIONS . " {$from} {$pot} -o {$dest} ");
    // delete no more needed file
    //	unlink($from);
}
// Generate a template .pot based on source tree
echo "Getting 'gettext' default messages from sources:";
generatePot();
echo "done.\n";
$langTool = new languages();
// Do all languages
foreach ($langTool->getMessages() as $langcode) {
    echo "Loading messages for {$langcode}:\t";
    require_once Language::getClassFileName($langcode);
    $arr = 'wgAllMessages' . $langcode;
    if (!@is_array(${$arr})) {
        echo "NONE FOUND\n";
    } else {
        echo "ok\n";
        if (!generatePo($langcode, ${$arr})) {
            echo "ERROR: Failed to wrote file.\n";
        } else {
            echo "Applying template:";
            applyPot($langcode);
        }
Exemplo n.º 22
0
    static function indexPage($page)
    {
        if ($page instanceof ormPage) {
            if ($page->in_search) {
                /*
                	Пробегаем по всем полям, данные которых участвуют в поиске. Разбиваем их содержимое
                	на отдельные словоформы и ранжируем в соотвествии с настройками.
                */
                self::parseContent($page->name, 'name');
                $fields = $page->getClass()->loadFields();
                while (list($fname, $field) = each($fields)) {
                    if ($field['f_search']) {
                        self::parseContent($page->__get($fname), $fname);
                    }
                }
                // Сохраняем все найденные слова в БД
                while (list($word, $rank) = each(self::$words)) {
                    $word_id = self::getWordId(self::morphGetRoot($word));
                    db::q('INSERT INTO <<search_rankings>>
			        		SET sr_word_id = "' . $word_id . '",
			        			sr_rank = "' . $rank . '",
			        			sr_obj_id = "' . $page->id . '",
			        			sr_lang_id = "' . languages::curId() . '",
			        			sr_domain_id = "' . domains::curId() . '";');
                }
            }
        }
    }
Exemplo n.º 23
0
            } elseif (!isset($_POST[$photoalbums[$i]['name']])) {
                // first check whether combination already exists
                $checkforcombination = $database->executeQuery("SELECT COUNT(*) AS count FROM photoalbumsforarticle WHERE articleid = " . $_GET['s'] . " AND photoalbumid = " . $photoalbums[$i]['id'], 1);
                if ($checkforcombination[0]['count'] == 1) {
                    $database->executeQuery("DELETE FROM photoalbumsforarticle WHERE articleid = " . $_GET['s'] . " AND photoalbumid = " . $photoalbums[$i]['id'], 0);
                }
            }
        }
    }
    $database->closeConnection();
    header('Location: ?p=' . $_GET['p'] . '&a=es&s=' . $_GET['s']);
}
?>
<div id="language_bar">
	<?php 
$language = new languages($currentLanguage, isset($_GET['langType']) ? $_GET['langType'] : 0);
$language->makeLanguageBar($arr);
?>
</div>

<div id="menuitems">
	<?php 
//$menu = new menu( $arr, $currentLanguage );
//$menuitems = $menu->getMenuItems();
$database1 = new database($arr);
$menuitems = $database1->executeQuery("SELECT * FROM menuitems WHERE languageid = " . $currentLanguage . " ORDER BY sortorder");
for ($i = 0; $i < count($menuitems); $i++) {
    echo "<div class=\"item\">";
    echo "<div class=\"hoofditem\">";
    if (isset($_GET['a']) && $_GET['a'] == 'ai' && $_GET['m'] == $menuitems[$i]['id']) {
        ?>
Exemplo n.º 24
0
TEXT;
    exit(1);
}
# Get the language code
if (isset($options['lang'])) {
    $wgCode = $options['lang'];
} else {
    $wgCode = $wgContLang->getCode();
}
# Get the duplicate message source
if (isset($options['remove-duplicates']) && strcmp($options['remove-duplicates'], '')) {
    $wgDupeMessageSource = $options['remove-duplicates'];
} else {
    $wgDupeMessageSource = '';
}
# Get the options
$wgWriteToFile = !isset($options['dry-run']);
$wgListUnknownMessages = !isset($options['no-unknown']);
$wgRemoveUnknownMessages = isset($options['remove-unknown']);
$wgRemoveDuplicateMessages = isset($options['remove-duplicates']);
# Get language objects
$wgLanguages = new languages();
# Write all the language
if ($wgCode == 'all') {
    foreach ($wgLanguages->getLanguages() as $language) {
        rebuildLanguage($language, $wgWriteToFile, $wgListUnknownMessages, $wgRemoveUnknownMessages, $wgRemoveDuplicateMessages, $wgDupeMessageSource);
    }
} else {
    rebuildLanguage($wgCode, $wgWriteToFile, $wgListUnknownMessages, $wgRemoveUnknownMessages, $wgRemoveDuplicateMessages, $wgDupeMessageSource);
}
Exemplo n.º 25
0
    $is_newsletter_subscribe = isset($_POST['newsletter_subscribe']);
}
$infos = array();
$errors = array();
$config_file = PHPWG_ROOT_PATH . PWG_LOCAL_DIR . 'config/database.inc.php';
if (@file_exists($config_file)) {
    include $config_file;
    // Is Piwigo already installed ?
    if (defined("PHPWG_INSTALLED")) {
        die('Piwigo is already installed');
    }
}
include PHPWG_ROOT_PATH . 'include/constants.php';
include PHPWG_ROOT_PATH . 'admin/include/functions.php';
include PHPWG_ROOT_PATH . 'admin/include/languages.class.php';
$languages = new languages('utf-8');
if (isset($_GET['language'])) {
    $language = strip_tags($_GET['language']);
    if (!in_array($language, array_keys($languages->fs_languages))) {
        $language = PHPWG_DEFAULT_LANGUAGE;
    }
} else {
    $language = 'en_UK';
    // Try to get browser language
    foreach ($languages->fs_languages as $language_code => $fs_language) {
        if (substr($language_code, 0, 2) == @substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, 2)) {
            $language = $language_code;
            break;
        }
    }
}
Exemplo n.º 26
0
function applyPot($langcode)
{
    $langdir = LOCALE_OUTPUT_DIR . '/' . $langcode;
    $from = $langdir . '/fromlanguagefile.po';
    $pot = LOCALE_OUTPUT_DIR . '/wfMsg.pot';
    $dest = $langdir . '/messages.po';
    // Merge template and generate file to get final .po
    exec(MSGMERGE_BIN . MSGMERGE_OPTIONS . " {$from} {$pot} -o {$dest} ");
    // delete no more needed file
    //	unlink($from);
}
// Generate a template .pot based on source tree
echo "Getting 'gettext' default messages from sources:";
generatePot();
echo "done.\n";
$langTool = new languages();
// Do all languages
foreach ($langTool->getList() as $langcode) {
    echo "Loading messages for {$langcode}:\t";
    require_once 'languages/Language' . $langcode . '.php';
    $arr = 'wgAllMessages' . $langcode;
    if (!@is_array(${$arr})) {
        echo "NONE FOUND\n";
    } else {
        echo "ok\n";
        if (!generatePo($langcode, ${$arr})) {
            echo "ERROR: Failed to wrote file.\n";
        } else {
            echo "Applying template:";
            applyPot($langcode);
        }
Exemplo n.º 27
0
TEXT;
    exit(1);
}
# Get the language code
if (isset($options['lang'])) {
    $wgCode = $options['lang'];
} else {
    $wgCode = $wgContLang->getCode();
}
# Get the duplicate message source
if (isset($options['remove-duplicates']) && strcmp($options['remove-duplicates'], '')) {
    $wgDupeMessageSource = $options['remove-duplicates'];
} else {
    $wgDupeMessageSource = '';
}
# Get the options
$wgWriteToFile = !isset($options['dry-run']);
$wgListUnknownMessages = !isset($options['no-unknown']);
$wgRemoveUnknownMessages = isset($options['remove-unknown']);
$wgRemoveDuplicateMessages = isset($options['remove-duplicates']);
$messagesFolder = isset($options['messages-folder']) ? $options['messages-folder'] : false;
# Get language objects
$languages = new languages();
# Write all the language
if ($wgCode == 'all') {
    foreach ($languages->getLanguages() as $languageCode) {
        rebuildLanguage($languages, $languageCode, $wgWriteToFile, $wgListUnknownMessages, $wgRemoveUnknownMessages, $wgRemoveDuplicateMessages, $wgDupeMessageSource, $messagesFolder);
    }
} else {
    rebuildLanguage($languages, $wgCode, $wgWriteToFile, $wgListUnknownMessages, $wgRemoveUnknownMessages, $wgRemoveDuplicateMessages, $wgDupeMessageSource, $messagesFolder);
}
Exemplo n.º 28
0
{
    global $SAVES;
    if (array_key_exists($key, $SAVES)) {
        return $SAVES[$key];
    } else {
        return NULL;
    }
}
if (array_key_exists('phase', $_GET) == false) {
    $phaseProvided = PHASE_START;
} else {
    $phaseProvided = $_GET['phase'];
}
$doPhase = $phaseProvided;
set_error_handler('errorHandlerForInstaller');
$i10nMan = new languages('install/languages/', 'english');
if (array_key_exists('language', $_COOKIE)) {
    $language = $_COOKIE['language'];
} elseif (array_key_exists('language', $_GET)) {
    $language = $_GET['language'];
    setcookie('language', addslashes($language));
} else {
    $language = 'english';
}
$language = addslashes($language);
$result = @$i10nMan->loadLanguage($language);
// if it couldn\'t load don\'t throw an error
$canrun = false;
while ($canrun == false) {
    switch ($doPhase) {
        case PHASE_START:
Exemplo n.º 29
0
    public function delete()
    {
        if (!empty($this->id) && $this->id != 1) {
            $is_ok = true;
            $list = languages::getAll();
            while (list($key, $val) = each($list)) {
                // Удаление страниц
                $tmp = ormPages::delAllFor($this->id, $val['id']);
                if (!$tmp) {
                    $is_ok = $tmp;
                } else {
                    // Удаление прав на домен
                    db::q('DELETE FROM <<modules_rights>>
	    				   WHERE mr_name = "' . $val['id'] . ' ' . $this->id . '"
	    				   		 and mr_mod_id = "3";');
                }
            }
            // Удаление домена
            if ($is_ok) {
                $is_ok = db::q('DELETE FROM <<domains>> WHERE d_id = "' . $this->id . '";');
                if ($is_ok !== false) {
                    // Удаление настроек
                    reg::delKey('/structure/' . $this->id);
                    system::log('Удален домен "' . $this->values['d_name'] . '" (id:' . $this->id . ')', warning);
                    return true;
                } else {
                    system::log('Произошла ошибка при удалении домена "' . $this->values['d_name'] . '" (id:' . $this->id . ')', error);
                    $this->newError(12, 'Произошла ошибка при удалении домена "' . $this->values['d_name'] . '"!');
                }
            } else {
                system::log('Пользователь пытался удалить домен "' . $this->values['d_name'] . '" (id:' . $this->id . '), но ему не хватило прав на удаление всех страниц!', error);
                $this->newError(63, 'Вы не можете удалить домен "' . $this->values['d_name'] . '", т.к. не имеете прав на удаление некоторых страниц!');
            }
        }
        return false;
    }
Exemplo n.º 30
0
 /**
  * @return NULL
  * @param integer $lang_id - ID языковой версии, если не указан используется текущая.
  * @param integer $domain_id - ID домена, если не указан используется текущий.
  * @desc Указывает что выборка будет производиться только по страницам.
  */
 public function findInPages($lang_id = 0, $domain_id = 0)
 {
     if (empty($lang_id)) {
         $this->cur_lang_id = languages::curId();
     }
     if (empty($domain_id)) {
         $this->cur_domain_id = domains::curId();
     }
     $this->find_page = 1;
 }