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); } }
/** * 发送简历 */ 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"); }
/** * Вывод списка online-пользователей * @return null */ public function show_online() { $i = (int) config::o()->v('online_interval'); if (!$i) { $i = 15; } $time = time() - $i; $res = db::o()->p($time)->query('SELECT userdata FROM sessions WHERE time > ? GROUP BY IF(uid>0,uid,ip)'); $res = db::o()->fetch2array($res); tpl::o()->assign("res", $res); $c = count($res); $mo = stats::o()->read("max_online"); if (!intval($mo) || $mo < $c) { $mo = $c; stats::o()->write("max_online", $c); stats::o()->write("max_online_time", time()); } $mot = stats::o()->read("max_online_time"); tpl::o()->assign("record_total", $mo); tpl::o()->assign("record_time", $mot); /* @var $user user */ $user = plugins::o()->get_module("user"); lang::o()->get("profile"); tpl::o()->register_modifier("gau", array($user, "get_age")); tpl::o()->assign("bdl", $this->bd_list()); tpl::o()->display("blocks/contents/online.tpl"); }
public function __construct($requestArray) { // make an array with posible privileges if (!isset($_SESSION['POSIBLEPRIVS'])) { $_SESSION['POSIBLEPRIVS'] = array('insert' => lang::translate('act_insert'), 'update' => lang::translate('act_update'), 'delete' => lang::translate('act_delete'), 'list' => lang::translate('act_view'), 'uploadfile' => lang::translate('act_uploadfile'), 'deletefile' => lang::translate('act_deletefile')); } // get database connection $this->DB = new db(); // set user and pass to be checked $this->POST = $requestArray; // make login if not logged in if (!isset($_SESSION['USERAUTH']) || empty($_SESSION['USERAUTH'])) { $_SESSION['USERAUTH'] = $this->login(); } // if cannot make login if (empty($_SESSION['USERAUTH'])) { return $this->createLoginForm(); } // check login again, for valid info if (!$this->check()) { return $this->createLoginForm(); } // get user data from $this->login() // after we know everything it's OK $this->userData = $_SESSION['USERAUTH']; // populate privileges array $this->getPriv(); }
/** * Получение сообщения * @return string сообщение */ public function getEMessage() { // Ибо getMessage - final $m = lang::o()->if_exists($this->message); $v = $this->vars; return $v ? vsprintf($m, $v) : $m; }
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'); }
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]; }
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(); }
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; }
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; }
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; } }
public static function getDB($key = 'default') { self::clearErr(); if (empty($key)) { $this->code = 1023; $this->msg = lang::getLang('learn', 'param_error'); } $config = cfg_db::$default; if (isset($dbResMap[$key])) { if (self::$dbResMap[$key]->selectDB($config['db'])) { return self::$dbResMap[$key]; } if (self::$dbResMap[$key]->selectDB($config['db'])) { return self::$dbResMap[$key]; } $dbResMap[$key]->closeDB(); unset($dbResMap[$key]); return false; } $db = new db($config['host'], $config['port'], $config['db'], $config['user'], $config['password']); if ($db->errCode > 0) { self::$code = 1024; self::$msg = "todo"; return false; } self::$dbResMap[$key] = $db; return self::$dbResMap[$key]; }
private static function defineLang() { $cookieLang = in::getCookie('lang'); $getLang = in::getGet('lang'); if (!empty($getLang)) { self::$lang = in::getGet('lang'); out::setCookie('lang', self::$lang, time() + 60 * 60); } elseif (!empty($cookieLang)) { self::$lang = in::getCookie('lang'); } else { self::$lang = self::defaultLang; } if (!@(include_once 'includes/langs/' . self::$lang . '.php')) { //throw new Exception('includes/langs/'.self::$lang.'.php doesnt exist.'); @(include_once 'includes/langs/' . self::defaultLang . '.php'); } if (LANGC_DEBUGCHARSET) { if (LANGC_LANGCHARSET == 'iso-8859-1' && LANGC_CHARSET == 'utf-8') { $sort = null; foreach ($STRING as $key => $value) { $sort[$key] = utf8_encode($STRING[$key]); } $STRING = $sort; } elseif (LANGC_LANGCHARSET == 'utf-8' && LANGC_CHARSET == 'iso-8859-1') { $sort = null; foreach ($STRING as $key => $value) { $sort[$key] = utf8_decode($STRING[$key]); } $STRING = $sort; } } self::$strings = $STRING; }
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(); }
/** * Initialize language manager and set up current page language * @param String $pays language code - must be a subdirectory of /lang */ public function __construct($pays) { self::$pays = $pays; self::$type[] = "text"; self::$type[] = "success"; self::$type[] = "error"; self::$type[] = "title"; // Automatic creation of language folder if (!is_dir(LANG . '/' . $pays)) { mkdir(LANG . '/' . $pays); mkdir(LANG . '/' . $pays . '/mail'); } foreach (self::$type as $t) { if (!file_exists(LANG . '/' . $pays . '/lang.' . $t . '.xml')) { // Automatic creation of language files $template = new template(SYSTEM . '/template/lang.tpl'); $template->assign('lang', $pays); $file = fopen(LANG . '/' . $pays . '/lang.' . $t . '.xml', "w+"); fputs($file, $template->display()); fclose($file); } if (file_exists(LANG . '/' . $pays . '/lang.' . $t . '.xml')) { $xml = simplexml_load_file(LANG . '/' . $pays . '/lang.' . $t . '.xml', 'SimpleXMLElement', LIBXML_NOCDATA); foreach ($xml->lang as $line) { $id = (string) $line['id']; self::$lang[$t][$id] = $line; } } } }
/** * 写日志 * * @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); }
function getIsHotStr() { if (parent::getIsHot() > 0) { return lang::get('Is hot'); } //else return lang::get('Is normal'); }
/** * 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>'); } } }
public final function check_app_params() { if (!in_array($this->projectId, array_keys(self::$projects))) { $this->setError(1101, lang::getLang('param_error')); return false; } if ($this->version) { $this->setError(1102, "参数错误"); return false; } if ($this->vn) { $this->setError(1103, "签名错误"); return false; } if ($this->client) { $this->setError(1104, "签名错误"); return false; } if ($this->token) { $this->setError(1105, "签名错误"); return false; } if (!$this->init_verifySign()) { $this->setError(1106, "签名错误"); return false; } self::$code = 200; self::$msg = "正常"; return true; }
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; } }
/** * Инициализация управления категориями * @return null */ public function init() { $admin_file = globals::g('admin_file'); lang::o()->get('admin/cats'); $act = $_GET['act']; $type = $_GET['type']; if (!$type || !$this->cats->change_type($type)) { $type = 'content'; } tpl::o()->assign('oldadmin_file', $admin_file); $admin_file .= '&type=' . $type; globals::s('admin_file', $admin_file); tpl::o()->assign('admin_file', $admin_file); tpl::o()->assign('cat_type', $type); switch ($act) { case "add": case "edit": try { $this->add((int) $_GET['id'], $act == "add"); } catch (EngineException $e) { $e->defaultCatch(true); } break; case "save": $this->save($type, $_POST); break; default: $this->show(); break; } }
public function clear_by_app($app_id) { if (!$app_id) { return false; } lang::del_res($app_id); }
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(); }
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); } } }
/** * 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; }
function try_login() { //defaultni vypis problemu s prihlasenim $l = new lang("layout"); $msg = new msg(); //pokud nam google vrati code, muzeme se autentifikovat a ziksat token $code = clear("code"); if ($code) { $this->client->authenticate(); $this->token = $this->client->getAccessToken(); } /* //kdybychom chteli na nejake jine strance zase s uctem u googlu pracovat // musimve vytvorit to spojeni a pomoci se token ze session se autorizovat u googlu //ale mi tady session token nulujeme, takze uz se dal pouzit neda if ($_SESSION['token']) { $this->client->setAccessToken($_SESSION['token']); } //kdyz ho chceme ziskat $_SESSION['token'] = $this->client->getAccessToken(); */ if ($this->token) { $my_data = $this->plus->people->get('me'); $gp_id = $my_data['id']; //nyni mame udaje o uzivateli //pokusime se zjistit, zda-li j*z v databazi nekdo takovy je (gp_id) $sql = sql_query("select id, nick from users\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twhere (gp_id = '" . $gp_id . "')"); $data = sql_fetch_object($sql); //j*z v databazi existuje if ($data->id) { $_SESSION['uid'] = $data->id; $_SESSION['me'] = new me($data->id); $_SESSION['me']->homepage_redirect(); } else { $new_login = $this->create_login($my_data); if ($new_login) { $_SESSION['uid'] = $new_login[0]; $_SESSION['me'] = new me($new_login[0]); //prvotni presun po registraci na nastaveni a doplneni udaju header("location: " . $l->l("osobni-udaje") . "?first=true"); return true; } } } $msg->set_text($l->t("bad_gplus_login"), "error"); redirect($l->l("prihlaseni")); }
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; }
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'); } }
function getState() { if (parent::getIsLock() == 1) { return lang::get("Is normal!"); } else { return lang::get("Is lock!"); } }