示例#1
0
 /**
  * 发送简历
  */
 function send()
 {
     if (input::getInput("post")) {
         $back = sf::getModel("backs");
         $back->setSubject(input::getInput("post.subject"));
         $back->setUserName(input::getInput("post.user_name"));
         $back->setUserSex(input::getInput("post.user_sex"));
         $back->setUserAge(input::getInput("post.user_age"));
         $back->setUserDegree(input::getInput("post.user_degree"));
         $back->setIdcard(input::getInput("post.idcard"));
         $back->setUserPhone(input::getInput("post.user_phone"));
         $back->setUserIm(input::getInput("post.user_im"));
         $back->setUserEmail(input::getInput("post.user_email"));
         $back->setUserAddress(input::getInput("post.user_address"));
         $back->setPostCode(input::getInput("post.post_code"));
         $back->setWorkAt(input::getInput("post.work_at"));
         $back->setStudyList(input::getInput("post.study_list"));
         $back->setWorkList(input::getInput("post.work_list"));
         $back->setUpdatedAt(date("Y-m-d H:i:s"));
         $back->save();
         $this->page_debug(lang::get("Has been saved!"), site_url("job/index"));
     }
     view::set("job", sf::getModel("jobs", input::getInput("get.id")));
     view::apply("inc_body", "template/job_send");
     view::display("template/page");
 }
示例#2
0
文件: need.php 项目: DINKIN/rokket
 public static function checkAddon($addons)
 {
     $return = '';
     foreach ($addons as $name => $version) {
         if (is_int($name)) {
             $name = $version;
             $version = false;
         }
         if (isset(rp::get('addons')[$name])) {
             $config = rp::get('addons')[$name];
         }
         if (!isset($config) || !is_array($config)) {
             $return .= sprintf(lang::get('addon_not_found'), $name);
             continue;
         }
         if (!addonConfig::isActive($name)) {
             $return .= sprintf(lang::get('addon_not_install_active'), $name);
             continue;
         }
         if (rp::checkVersion($config['version'], $version) === false) {
             $return .= sprintf(lang::get('addon_need_version'), $name, $version);
             continue;
         }
     }
     if ($return == '') {
         return true;
     } else {
         return $return;
     }
 }
示例#3
0
 public static function getSql($name)
 {
     if (!isset(self::$slots[$name])) {
         throw new Exception(sprintf(lang::get('slot_name_not_exist'), $name));
     }
     return self::$slots[$name];
 }
示例#4
0
 public static function formBlock($module)
 {
     $form = form::factory('module', 'id=' . $module->getModulId(), 'index.php');
     $form->setSave(false);
     $form->addFormAttribute('class', '');
     $form->setSuccessMessage(null);
     $input = $module->OutputFilter($form->get('input'), $module->getSql());
     $form->addRawField($input);
     $form->addHiddenField('structure_id', $module->getStructureId());
     if ($module->getId()) {
         $form->setMode('edit');
         $online = $module->get('online');
     } else {
         $form->setMode('add');
         $online = 1;
         $form->delButton('save-back');
     }
     $form->addHiddenField('modul', $module->getModulId());
     $form->addHiddenField('sort', $module->getSort());
     $field = $form->addRadioField('online', $online);
     $field->fieldName(lang::get('block_status'));
     $field->add(1, lang::get('online'));
     $field->add(0, lang::get('offline'));
     $form->addHiddenField('id', $module->getId());
     $form->addParam('structure_id', type::super('structure_id', 'int'));
     return $form;
 }
示例#5
0
文件: sftp.php 项目: DINKIN/rokket
 public function __construct($host, $user, $pass)
 {
     $this->sftp = new Net_SFTP($host);
     if (!$this->sftp->login($user, $pass)) {
         echo message::danger(lang::get('sftp_login_failed'), false);
     }
 }
示例#6
0
 public static function deleteFile($id)
 {
     $values = [];
     for ($i = 1; $i <= 10; $i++) {
         $values[] = '`media' . $i . '` = ' . $id;
     }
     for ($i = 1; $i <= 10; $i++) {
         $values[] = '`medialist' . $i . '` LIKE "%|' . $id . '|%"';
     }
     $sql = sql::factory();
     $sql->query('SELECT id FROM ' . sql::table('structure_area') . ' WHERE ' . implode(' OR ', $values))->result();
     if ($sql->num()) {
         echo message::warning(lang::get('file_in_use'));
     } else {
         $sql = sql::factory();
         $sql->setTable('media');
         $sql->setWhere('id=' . $id);
         $sql->select('filename');
         $sql->result();
         if (unlink(dir::media($sql->get('filename')))) {
             $sql->delete();
             return message::success(lang::get('file_deleted'), true);
         } else {
             return message::warning(sprintf(lang::get('file_not_deleted'), dyn::get('hp_url'), $sql->get('filename')), true);
         }
     }
 }
示例#7
0
 function getIsHotStr()
 {
     if (parent::getIsHot() > 0) {
         return lang::get('Is hot');
     }
     //else return lang::get('Is normal');
 }
示例#8
0
文件: Log.php 项目: meetcd/sofast
 /** 
  * 写日志 
  * 
  * @param string $s_message 日志信息 
  * @param string $s_type    日志类型 
  */
 public static function write($s_message, $s_type = 'log')
 {
     // 检查日志目录是否可写
     if (!is_dir(config::get("log_dir"))) {
         @mkdir(config::get("log_dir"));
         chmod(config::get("log_dir"), 0777);
     }
     if (!is_writable(config::get("log_dir"))) {
         throw new sfException(lang::get('LOG_PATH is not writeable !'));
     }
     $s_now_time = date('[Y-m-d H:i:s]');
     $s_now_day = date('Y_m_d');
     // 根据类型设置日志目标位置
     $s_target = config::get("log_dir");
     switch ($s_type) {
         case 'debug':
             $s_target .= '/Out_' . $s_now_day . '.log';
             break;
         case 'error':
             $s_target .= '/Err_' . $s_now_day . '.log';
             break;
         default:
             $s_target .= '/Log_' . $s_now_day . '.log';
             break;
     }
     //检测日志文件大小, 超过配置大小则重命名
     if (file_exists($s_target) && self::$max_size <= filesize($s_target)) {
         $s_file_name = substr(basename($s_target), 0, strrpos(basename($s_target), '.log')) . '_' . time() . '.log';
         rename($s_target, dirname($s_target) . '/' . $s_file_name);
     }
     clearstatcache();
     // 写日志, 返回成功与否
     return error_log("{$s_now_time} {$s_message}\n", 3, $s_target);
 }
示例#9
0
 public function run()
 {
     include main::getPluginDir() . '/libs/classes/aws-autoloader.php';
     $ad = $this->params['access_details'];
     main::log(lang::get('Start copy files to Amazon S3', false));
     $files = $this->params['files'];
     $dir = isset($ad['dir']) ? $ad['dir'] : '/';
     $credentials = new Aws\Common\Credentials\Credentials($ad['AccessKeyId'], $ad['SecretAccessKey']);
     $client = Aws\S3\S3Client::factory(array('credentials' => $credentials));
     try {
         $n = count($files);
         for ($i = 0; $i < $n; $i++) {
             $filePath = preg_replace('#[/\\\\]+#', '/', BACKUP_DIR . '/' . $dir . '/' . $files[$i]);
             $key = $dir ? $dir . '/' . basename($filePath) : basename($filePath);
             $key = ltrim(preg_replace('#[/\\\\]+#', '/', $key), '/');
             //if first will be '/', file not will be uploaded, but result will be ok
             $putRes = $client->putObject(array("Bucket" => $ad['bucket'], 'Key' => $key, 'Body' => fopen($filePath, 'r+')));
             if (isset($putRes['RequestId']) && !empty($putRes['RequestId'])) {
                 main::log(str_replace('%s', basename($filePath), lang::get("File(%s) Upload successfully to Amazon S3", false)));
             }
         }
         main::log(lang::get('End copy files to Amazon S3', false));
     } catch (Exception $e) {
         main::log('Error send to Amazon s3: ' . $e->getMessage());
         $this->setError($e->getMessage());
         return false;
     } catch (S3Exception $e) {
         main::log('Error send to Amazon s3: ' . $e->getMessage());
         $this->setError($e->getMessage());
         return false;
     }
     return true;
 }
示例#10
0
 /**
  * Return the generated form output.
  * @param array $args List of parameter values passed through to the form depending on how the form has been configured.
  * This array always contains a value for language.
  * @param object $node The Drupal node object.
  * @param array $response When this form is reloading after saving a submission, contains the response from the service call.
  * Note this does not apply when redirecting (in this case the details of the saved object are in the $_GET data).
  * @return Form HTML.
  */
 public static function get_form($args, $node, $response = null)
 {
     $reloadPath = self::get_reload_path();
     $auth = data_entry_helper::get_read_write_auth($args['website_id'], $args['password']);
     $r = "<form method=\"post\" id=\"entry_form\" action=\"{$reloadPath}\">\n";
     $r .= $auth['write'];
     data_entry_helper::$entity_to_load = array();
     if (!empty($_GET['termlists_term_id'])) {
         data_entry_helper::load_existing_record($auth['read'], 'termlists_term', $_GET['termlists_term_id']);
         // map fields to their appropriate supermodels
         data_entry_helper::$entity_to_load['term:term'] = data_entry_helper::$entity_to_load['termlists_term:term'];
         data_entry_helper::$entity_to_load['term:id'] = data_entry_helper::$entity_to_load['termlists_term:term_id'];
         data_entry_helper::$entity_to_load['meaning:id'] = data_entry_helper::$entity_to_load['termlists_term:meaning_id'];
         if (function_exists('hostsite_set_page_title')) {
             hostsite_set_page_title(lang::get('Edit {1}', data_entry_helper::$entity_to_load['term:term']));
         }
     }
     $r .= data_entry_helper::hidden_text(array('fieldname' => 'website_id', 'default' => $args['website_id']));
     $r .= data_entry_helper::hidden_text(array('fieldname' => 'termlists_term:id'));
     $r .= data_entry_helper::hidden_text(array('fieldname' => 'termlists_term:termlist_id', 'default' => $args['termlist_id']));
     $r .= data_entry_helper::hidden_text(array('fieldname' => 'termlists_term:preferred', 'default' => 't'));
     $r .= data_entry_helper::hidden_text(array('fieldname' => 'term:id'));
     $r .= data_entry_helper::hidden_text(array('fieldname' => 'term:language_id', 'default' => $args['language_id']));
     $r .= data_entry_helper::hidden_text(array('fieldname' => 'meaning:id'));
     // request automatic JS validation
     data_entry_helper::enable_validation('entry_form');
     $r .= data_entry_helper::text_input(array('label' => lang::get('Term'), 'fieldname' => 'term:term', 'helpText' => lang::get('Please provide the term'), 'validation' => array('required'), 'class' => 'control-width-5'));
     $r .= "<input type=\"submit\" name=\"form-submit\" id=\"delete\" value=\"Delete\" />\n";
     $r .= "<input type=\"submit\" name=\"form-submit\" value=\"Save\" />\n";
     $r .= '<form>';
     self::set_breadcrumb($args);
     return $r;
 }
示例#11
0
 public function proc()
 {
     //reg::setKey('/users/errorCountCapcha', system::POST('errorCountCapcha'));
     reg::setKey('/users/errorCountBlock', system::POST('errorCountBlock'));
     reg::setKey('/users/reg', system::POST('reg', isBool));
     reg::setKey('/users/activation', system::POST('activation', isBool));
     reg::setKey('/users/confirm', system::POST('confirm', isBool));
     reg::setKey('/users/ask_email', system::POST('ask_email', isBool));
     //авторизация чере соц. сети
     reg::setKey('/users/twitter_bool', system::POST('twitter_bool'), isBool);
     reg::setKey('/users/twitter_id', system::POST('twitter_id'), isString);
     reg::setKey('/users/twitter_secret', system::POST('twitter_secret'), isString);
     reg::setKey('/users/vk_bool', system::POST('vk_bool'), isBool);
     reg::setKey('/users/vk_id', system::POST('vk_id'), isString);
     reg::setKey('/users/vk_secret', system::POST('vk_secret'), isString);
     reg::setKey('/users/ok_bool', system::POST('ok_bool'), isBool);
     reg::setKey('/users/ok_id', system::POST('ok_id'), isString);
     reg::setKey('/users/ok_public', system::POST('ok_public'), isString);
     reg::setKey('/users/ok_secret', system::POST('ok_secret'), isString);
     reg::setKey('/users/facebook_bool', system::POST('facebook_bool'), isBool);
     reg::setKey('/users/facebook_id', system::POST('facebook_id'), isString);
     reg::setKey('/users/facebook_secret', system::POST('facebook_secret'), isString);
     reg::setKey('/users/yandex_bool', system::POST('yandex_bool'), isBool);
     reg::setKey('/users/google_bool', system::POST('google_bool'), isBool);
     ui::MessageBox(lang::get('CONFIG_SAVE_OK'), lang::get('CONFIG_SAVE_OK_MSG'));
     reg::clearCache();
     system::log(lang::get('CONFIG_LOG_SAVE'), warning);
     system::redirect('/users/settings');
 }
示例#12
0
 public function defAction()
 {
     // Формируем список классов для быстрого добавления
     $types = ormClasses::get('user')->getAllInheritors();
     if (count($types) > 1) {
         $class_list = '';
         while (list($id, $name) = each($types)) {
             $bclass = ormClasses::get($id);
             $class_list .= '<li><a href="' . system::au() . '/users/user_add/0/' . $bclass->getSName() . '" >' . $bclass->getName() . '</a></li>';
         }
         $java = '<script> $("#usel").parent().css("width", "150px"); </script>';
         ui::newButton(lang::get('BTN_NEW_USER'), "/users/user_add", 'class_list', '<ul id="usel">' . $class_list . '</ul>' . $java);
     } else {
         ui::newButton(lang::get('BTN_NEW_USER'), "/users/user_add");
     }
     ui::newButton(lang::get('BTN_NEW_UGROUP'), "/users/group_add");
     $sel = new ormSelect('user_group');
     $sel->orderBy('name', asc);
     $table = new uiTable($sel);
     $table->showSearch(true);
     $table->addColumn('name', lang::get('USERS_TABLE_FIELD_5'), 0, true);
     $table->addColumn('children', lang::get('USERS_TABLE_FIELD_6'), 0, true, true, 'count');
     $table->defaultRight('userlist');
     $table->addRight('userlist', 'users', single);
     $table->addRight('group_upd', 'edit', single);
     $table->addRight('group_act', 'active', multi);
     $table->addRight('group_del', 'drop', multi);
     $table->setDelMessage(lang::get('USERS_DEL_TITLE2'), lang::get('USERS_DEL_TEXT2'));
     $table->setMultiDelMessage(lang::get('USERS_DEL_TITLE_MULTI2'), lang::get('USERS_DEL_TEXT_MULTI2'));
     return $table->getHTML();
 }
示例#13
0
 public static function checkAddon($addons)
 {
     $return = '';
     foreach ($addons as $name => $version) {
         if (is_int($name)) {
             $name = $version;
             $version = false;
         }
         $config = addonConfig::getConfig($name);
         // Nicht installiert
         if (!is_array($config)) {
             $return .= sprintf(lang::get('addon_not_found'), $name);
             continue;
         }
         if (!addonConfig::isActive($name)) {
             $return .= sprintf(lang::get('addon_not_install_active'), $name);
             continue;
         }
         if ($version && $config['version'] < $version) {
             $return .= sprintf(lang::get('addon_need_version'), $name, $version);
             continue;
         }
     }
     if ($return == '') {
         return true;
     } else {
         return $return;
     }
 }
示例#14
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();
 }
示例#15
0
 public function defAction()
 {
     $count = ormObjects::getCountTrashObjects();
     $max_count = uiTable::getMaxCount();
     if (uiTable::getCurPage() != 1) {
         $niz = empty($start_pos) ? uiTable::getCurPage() * $max_count - $max_count : 0;
         $objects = ormObjects::getTrashObjects($niz, $max_count);
     } else {
         $objects = ormObjects::getTrashObjects($max_count);
     }
     if (user::issetRight('object_del') && !empty($objects)) {
         ui::newButton(lang::get('BTN_NEW_CLEAК_TRASH'), 'javascript:clearTrash();');
     }
     $table = new uiTable($objects, $count);
     $table->addColumn('name', lang::get('TRASH_TABLE_1'), 400);
     $table->addColumn('class', lang::get('TRASH_TABLE_2'));
     $table->addColumn('date', lang::get('TRASH_TABLE_3'), 0, false, false, 'viewDateTime');
     $table->addColumn('user', lang::get('TRASH_TABLE_4'), 200);
     $table->addRight('object_restore', 'restore', multi, 'restoreObj(this)', lang::get('TRASH_TABLE_RESTORE'));
     $table->addRight('object_del', 'drop', multi);
     $table->setDelMessage(lang::get('TRASH_DEL_TITLE'), lang::get('TRASH_DEL_MSG'));
     $table->setMultiDelMessage(lang::get('TRASH_DEL_TITLE2'), lang::get('TRASH_DEL_MSG2'));
     $table->emptyText(lang::get('TRASH_EMPTY_MSG'));
     $html = '
     <script type="text/javascript" src="/css_mpanel/restore_objects.js"></script>
     <input id="clearTrashTitle" type="hidden" value="' . lang::get('TRASH_DEL_TITLE3') . '">
     <input id="clearTrashText" type="hidden" value="' . lang::get('TRASH_DEL_MSG3') . '">
     ';
     return $html . $table->getHTML();
 }
示例#16
0
/**
 * List of methods that assist with handling recording groups.
 * @package Client
 * @subpackage PrebuiltForms.
 */
function group_authorise_form($args, $readAuth)
{
    if (!empty($args['limit_to_group_id']) && $args['limit_to_group_id'] !== (empty($_GET['group_id']) ? '' : $_GET['group_id'])) {
        // page owned by a different group, so throw them out
        hostsite_show_message(lang::get('This page is a private recording group page which you cannot access.'), 'alert');
        hostsite_goto_page('<front>');
    }
    if (!empty($_GET['group_id'])) {
        // loading data into a recording group. Are they a member or is the page public?
        // @todo: consider performance - 2 web services hits required to check permissions.
        if (hostsite_get_user_field('indicia_user_id')) {
            $gu = data_entry_helper::get_population_data(array('table' => 'groups_user', 'extraParams' => $readAuth + array('group_id' => $_GET['group_id'], 'user_id' => hostsite_get_user_field('indicia_user_id')), 'nocache' => true));
        } else {
            $gu = array();
        }
        $gp = data_entry_helper::get_population_data(array('table' => 'group_page', 'extraParams' => $readAuth + array('group_id' => $_GET['group_id'], 'path' => drupal_get_path_alias($_GET['q']))));
        if (count($gp) === 0) {
            hostsite_show_message(lang::get('You are trying to access a page which is not available for this group.'), 'alert');
            hostsite_goto_page('<front>');
        } elseif (count($gu) === 0 && $gp[0]['administrator'] !== NULL) {
            // not a group member, so throw them out
            hostsite_show_message(lang::get('You are trying to access a page for a group you do not belong to.'), 'alert');
            hostsite_goto_page('<front>');
        }
    }
}
示例#17
0
 public function proc_upd()
 {
     $obj = ormPages::get(system::POST('obj_id'));
     $obj->tabuList('pseudo_url', 'h1', 'keywords', 'title', 'description', 'active', 'is_home_page', 'view_in_menu', 'view_submenu', 'in_search', 'in_index', 'in_new_window', 'other_link', 'img_act', 'img_no_act', 'img_h1');
     $obj->loadFromPost();
     // Публикация на сайте
     if (system::POST('publ', isBool)) {
         if ($obj->isInheritor('faq') && $obj->newVal('answer') == '') {
             ui::MessageBox(lang::get('TEXT_MESSAGE_ERROR'), lang::get('FEEDBACK_MSG_3'));
             ui::selectErrorFields(array('select' => '', 'focus' => 'answer'));
         } else {
             $obj->active = 1;
         }
     }
     $obj_id = $obj->save();
     // Если объект не сохранился, выводим пользователю текст ошибки.
     if ($obj_id === false) {
         system::savePostToSession();
         ui::MessageBox(lang::get('TEXT_MESSAGE_ERROR'), $obj->getErrorListText());
         ui::selectErrorFields($obj->getErrorFields());
         system::redirect('/feedback/message_upd/' . $_POST['obj_id']);
     }
     if (system::POST('send_to_email', isBool) && !$obj->send_answer_to_user && ($form_obj = ormObjects::get($obj->form_id))) {
         if ($form_obj->send_answer) {
             if ($obj->answer != '') {
                 $fields = $obj->getClass()->loadFields();
                 while (list($num, $field) = each($fields)) {
                     if (!empty($field['f_sname'])) {
                         page::assign($field['f_sname'], $obj->__get($field['f_sname']));
                     }
                 }
                 page::assign('site_name', domains::curDomain()->getSiteName());
                 page::assign('base_email', domains::curDomain()->getEmail());
                 $mail = new phpmailer();
                 $mail->From = $this->parse($form_obj->answer_sender_address);
                 $mail->FromName = $this->parse($form_obj->answer_sender_name);
                 $mail->AddAddress($obj->email);
                 $mail->WordWrap = 50;
                 $mail->IsHTML(true);
                 $mail->Subject = $this->parse($form_obj->answer_subject);
                 $mail->Body = $this->parse($form_obj->answer_template);
                 $mail->Send();
                 // Помечаем, что ответ отправлен
                 $obj->send_answer_to_user = 1;
                 $obj->save();
                 ui::MessageBox(lang::get('FEEDBACK_MSG_1'), '');
             } else {
                 ui::MessageBox(lang::get('TEXT_MESSAGE_ERROR'), lang::get('FEEDBACK_MSG_2'));
                 ui::selectErrorFields(array('select' => '', 'focus' => 'answer'));
             }
         }
     }
     // Если данные изменились корректно перенаправляем на соответствующию страницу
     if ($_POST['parram'] == 'apply') {
         system::redirect('/feedback/message_upd/' . $obj_id);
     } else {
         system::redirect('/feedback');
     }
 }
示例#18
0
    public function view()
    {
        if (user::issetRight('delete')) {
            ui::newButton(lang::get('BTN_CLEAR_JORNAL'), 'javascript:clearJornal();');
        }
        ui::addLeftButton('Системный журнал', 'system_view');
        ui::addLeftButton('Журнал БД', 'db_view');
        function getState($val)
        {
            if ($val == info) {
                return 'info';
            } else {
                if ($val == error) {
                    return 'error';
                } else {
                    if ($val == warning) {
                        return 'warning';
                    }
                }
            }
        }
        function getEditUser($val, $obj)
        {
            if (user::issetRight('user_upd', 'users')) {
                return '<a href="' . system::au() . '/users/user_upd/' . $obj['rev_user_id'] . '" target="_blank">' . $val . '</a>';
            } else {
                return $val;
            }
        }
        $count = db::q('SELECT count(rev_id) count FROM <<revue>>, <<objects>> WHERE rev_obj_id = o_id;', value);
        $max_count = uiTable::getMaxCount();
        if (uiTable::getCurPage() != 1) {
            $niz = empty($start_pos) ? uiTable::getCurPage() * $max_count - $max_count : 0;
            $limit = ' LIMIT ' . $niz . ', ' . $max_count;
        } else {
            $limit = ' LIMIT ' . $max_count;
        }
        $mas = db::q('SELECT rev_state, rev_user, rev_user_id, rev_datetime,
        			concat(rev_message, " <b>", o_name, "</b>") rev_msg, rev_ip
		        	FROM <<revue>>, <<objects>>
		        	WHERE rev_obj_id = o_id
		        	ORDER BY rev_datetime DESC ' . $limit, records);
        /*
          Сделать фильтры:
          	- важность
          	- пользователь
          	- тип данных
          	- периуд времени
          	- IP
        */
        $table = new uiTable($mas, $count);
        $table->addColumn('rev_state', 'Важность', 0, false, false, 'getState');
        $table->addColumn('rev_user', 'Пользователь', 0, false, false, 'getEditUser');
        $table->addColumn('rev_msg', 'Действие', 400);
        $table->addColumn('rev_datetime', 'Дата / Время', 0, false, false, 'viewDateTime2');
        $table->addColumn('rev_ip', 'IP');
        $table->emptyText('В журнале нет записей!');
        return $table->getHTML();
    }
/**
 * Retrieve the html for a block of attributes.
 * @param array $attributes Array of attributes as returned from a call to data_entry_helper::getAttributes.
 * @param array $args Form argument array.
 * @param array $ctrlOptions Array of default options to apply to every attribute control.
 * @param array $outerFilter Name of the outer block to get controls for. Leave null for all outer blocks.
 * @param array $attrSpecificOptions Associative array of control names that have non-default options. Each entry
 * is keyed by the control name and has an array of the options and values to override.
 * @param array $idPrefix Optional prefix to give to IDs (e.g. for fieldsets) to allow you to ensure they remain unique.
 */
function get_attribute_html(&$attributes, $args, $ctrlOptions, $outerFilter = null, $attrSpecificOptions = null, $idPrefix = '', $helperClass = 'data_entry_helper')
{
    $lastOuterBlock = '';
    $lastInnerBlock = '';
    $r = '';
    foreach ($attributes as &$attribute) {
        if (in_array($attribute['id'], data_entry_helper::$handled_attributes)) {
            $attribute['handled'] = 1;
        }
        // Apply filter to only output 1 block at a time. Also hide controls that have already been handled.
        if (($outerFilter === null || strcasecmp($outerFilter, $attribute['outer_structure_block']) == 0) && !isset($attribute['handled'])) {
            if (empty($outerFilter) && $lastOuterBlock != $attribute['outer_structure_block']) {
                if (!empty($lastInnerBlock)) {
                    $r .= '</fieldset>';
                }
                if (!empty($lastOuterBlock)) {
                    $r .= '</fieldset>';
                }
                if (!empty($attribute['outer_structure_block'])) {
                    $r .= '<fieldset id="' . get_fieldset_id($attribute['outer_structure_block'], $idPrefix) . '"><legend>' . lang::get($attribute['outer_structure_block']) . '</legend>';
                }
                if (!empty($attribute['inner_structure_block'])) {
                    $r .= '<fieldset id="' . get_fieldset_id($attribute['outer_structure_block'], $attribute['inner_structure_block'], $idPrefix) . '"><legend>' . lang::get($attribute['inner_structure_block']) . '</legend>';
                }
            } elseif ($lastInnerBlock != $attribute['inner_structure_block']) {
                if (!empty($lastInnerBlock)) {
                    $r .= '</fieldset>';
                }
                if (!empty($attribute['inner_structure_block'])) {
                    $r .= '<fieldset id="' . get_fieldset_id($lastOuterBlock, $attribute['inner_structure_block'], $idPrefix) . '"><legend>' . lang::get($attribute['inner_structure_block']) . '</legend>';
                }
            }
            $lastInnerBlock = $attribute['inner_structure_block'];
            $lastOuterBlock = $attribute['outer_structure_block'];
            $options = $ctrlOptions + get_attr_validation($attribute, $args);
            // when getting the options, only use the first 2 parts of the fieldname as any further imply an existing record ID so would differ.
            $fieldNameParts = explode(':', $attribute['fieldname']);
            if (preg_match('/[a-z][a-z][a-z]Attr/', $fieldNameParts[count($fieldNameParts) - 2])) {
                $optionFieldName = $fieldNameParts[count($fieldNameParts) - 2] . ':' . $fieldNameParts[count($fieldNameParts) - 1];
            } elseif (preg_match('/[a-za-za-z]Attr/', $fieldNameParts[count($fieldNameParts) - 3])) {
                $optionFieldName = $fieldNameParts[count($fieldNameParts) - 3] . ':' . $fieldNameParts[count($fieldNameParts) - 2];
            } else {
                throw new exception('Option fieldname not found');
            }
            if (isset($attrSpecificOptions[$optionFieldName])) {
                $options = array_merge($options, $attrSpecificOptions[$optionFieldName]);
            }
            $r .= call_user_func($helperClass . '::outputAttribute', $attribute, $options);
            $attribute['handled'] = true;
        }
    }
    if (!empty($lastInnerBlock)) {
        $r .= '</fieldset>';
    }
    if (!empty($lastOuterBlock) && strcasecmp($outerFilter, $lastOuterBlock) !== 0) {
        $r .= '</fieldset>';
    }
    return $r;
}
示例#20
0
 public function proc()
 {
     reg::setKey('/comments/only_reg', system::POST('only_reg', isBool));
     reg::setKey('/comments/com_moderation', system::POST('com_moderation', isBool));
     reg::setKey('/comments/text_length', system::POST('text_length', isInt));
     ui::MessageBox(lang::get('CONFIG_SAVE_OK'), lang::get('CONFIG_SAVE_OK_MSG'));
     system::redirect('/comments/settings');
 }
 /**
  * An extension control for dynamic forms that adds a box to output hints on any
  * species selected for addition to the species checklist grid. To use this control
  * provide a file called speciesHints.json in the Drupal file path, within the indicia
  * subfolder. This should contain a JSON object with the property names matching the
  * external keys of the taxa_taxon_list table, and the property values being the hint
  * string to show.
  */
 public static function add_species_hints($auth, $args, $tabalias, $options, $path)
 {
     // enable nice tooltips
     //drupal_add_library('system', 'ui.tooltip', true);
     $filePath = variable_get('file_public_path', conf_path() . '/files');
     data_entry_helper::$javascript .= "initSpeciesHints('{$filePath}/indicia/speciesHints.json');\n";
     return '<h3>' . lang::get('Hints relating to species names entered') . '</h3> ' . '<div id="species-hints"></div>';
 }
示例#22
0
 function getIsPublicStr()
 {
     if (parent::getIsPublic() > 0) {
         return lang::get('Is public');
     } else {
         return lang::get('Is wait');
     }
 }
示例#23
0
 function getState()
 {
     if (parent::getIsLock() == 1) {
         return lang::get("Is normal!");
     } else {
         return lang::get("Is lock!");
     }
 }
示例#24
0
 public function proc()
 {
     reg::setKey('/subscription/count_mails', system::POST('count_mails', isInt));
     reg::setKey('/subscription/count_mails_day', system::POST('count_mails_day', isInt));
     reg::clearCache();
     ui::MessageBox(lang::get('CONFIG_SAVE_OK'), lang::get('CONFIG_SAVE_OK_MSG'));
     system::redirect('/subscription/settings');
 }
示例#25
0
 public function view()
 {
     if (user::issetRight('delete')) {
         ui::newButton(lang::get('BTN_CLEAR_JORNAL'), 'javascript:clearJornal();');
     }
     ui::addLeftButton('Системный журнал', 'system_view');
     ui::addLeftButton('Журнал БД', 'db_view');
     function removeQuotes($val, $obj)
     {
         return substr($val, 1, strlen($val) - 2);
     }
     function rqDateTime($val, $obj)
     {
         return date('d.m.Y H:i:s', $val);
     }
     function sortByTime($a, $b)
     {
         if ($a[1] == $b[1]) {
             return 0;
         }
         return $a[1] > $b[1] ? -1 : 1;
     }
     $mas = array();
     $system_file = ROOT_DIR . '/revue.log';
     if (file_exists($system_file)) {
         // Читаем файл, формируем массив
         $tmp_mas = array();
         $file = file($system_file);
         while (list($key, $val) = each($file)) {
             $tmp = explode(Chr(9), $val);
             if (!empty($tmp[1])) {
                 $tmp[1] = strtotime(removeQuotes($tmp[1], $tmp[1]));
                 $tmp_mas[] = $tmp;
             }
         }
         // Сортиуем массив по времени
         usort($tmp_mas, 'sortByTime');
         // Выбераем часть массива в соотвествии с постраничной навигацией
         $count = count($tmp_mas);
         $max_count = uiTable::getMaxCount();
         if (uiTable::getCurPage() != 1) {
             $niz = empty($start_pos) ? uiTable::getCurPage() * $max_count - $max_count : 0;
             $mas = array_slice($tmp_mas, $niz, $max_count);
         } else {
             $mas = array_slice($tmp_mas, 0, $max_count);
         }
     } else {
         $count = 0;
     }
     $table = new uiTable($mas, $count);
     $table->emptyText('В системном журнале нет записей!');
     $table->addColumn('2', 'Важность', 0, false, false, 'removeQuotes');
     $table->addColumn('3', 'Пользователь', 0, false, false, 'removeQuotes');
     $table->addColumn('4', 'Действие', 400);
     $table->addColumn('1', 'Дата / Время', 0, false, false, 'rqDateTime');
     $table->addColumn('0', 'IP');
     return $table->getHTML();
 }
示例#26
0
 public function defAction()
 {
     ui::newButton(lang::get('BTN_NEW_CLASS'), '/constructor/class_add');
     if (file_exists(MODUL_DIR . '/constructor/template/classesTree.tpl')) {
         include MODUL_DIR . '/constructor/template/classesTree.tpl';
         page::assign('items', $this->createTree(0, $TEMPLATE));
         return page::parse($TEMPLATE['frame']);
     }
 }
示例#27
0
 public function unsubscribeAction()
 {
     if ($page = ormPages::get(system::url(3))) {
         comments::unsubscribe(system::url(2), system::url(3));
         page::globalVar('title', lang::get('COM_TITLE'));
         page::globalVar('h1', lang::get('COM_TITLE'));
         return lang::get('COM_UNSUBSCRIBE') . '"' . $page->name . '".';
     }
 }
示例#28
0
 function index()
 {
     if (input::getInput("post.site")) {
         $htmlStr = $this->getHtmlStr(input::getInput("post.site"));
         file_put_contents(APPPATH . "config/Config.config.php", "<?php\r\n" . 'config::set(' . $htmlStr . ");\r\n?>");
         $this->page_debug(lang::get('Has been save!'), getFromUrl());
     }
     view::apply("inc_body", "admin/configure/index");
     view::display("admin/page");
 }
示例#29
0
 /**
  * 删除数据
  */
 function delete()
 {
     if (input::getInput("post.select_id")) {
         $ids = implode("','", input::getInput("post.select_id"));
     } else {
         $ids = input::getInput("get.id");
     }
     sf::getModel("Authorizations")->remove("`id` IN('" . $ids . "')");
     $this->page_debug(lang::get("Has been deleted!"), getFromUrl());
 }
示例#30
0
 public function __call($name, array $args)
 {
     if (!isset($this->classMethods[$name])) {
         $this->setClassMethod($name);
     }
     if (isset($this->classMethods[$name])) {
         return call_user_func_array($this->classMethods[$name], $args);
     }
     throw new Exception(sprintf(lang::get('traitmeta_not_exists'), __CLASS__, $name));
 }