public function form() { Loader::model('page_list'); $pl = new PageList(); $lastParent = ''; $selected = $_REQUEST['akID'][$this->getAttributeKey()->getAttributeKeyID()]['value']; if (!$selected && $this->getAttributeValueID() > 0) { $selected = $this->getValue()->cID; } $selectString = "<select id='{$this->field('value')}' name='{$this->field('value')}' ><option value=''>--</option>"; $pl->filterByCollectionTypeHandle('city'); $pages = $pl->get(); uasort($pages, function ($a, $b) { $ap = $a->getCollectionParentID(); $bp = $b->getCollectionParentID(); return $ap === $bp ? 0 : strcmp(Page::getByID($ap)->getCollectionName(), Page::getByID($bp)->getCollectionName()); }); foreach ($pages as $page) { $parent = Page::getByID($page->getCollectionParentID())->getCollectionName(); if ($lastParent != $parent) { if ($lastParent !== '') { $selectString .= '</optgroup>'; } $selectString .= "<optgroup label='{$parent}'>"; $lastParent = $parent; } $selectedAttributeVal = ''; if ($selected === $page->cID) { $selectedAttributeVal = ' selected="selected"'; } $selectString .= "<option value=\"{$page->getCollectionID()}\"" . $selectedAttributeVal . ">{$page->getCollectionName()}</option>"; } $selectString .= '</select>'; echo $selectString; }
public function __construct() { $this->contentid = isset($_GET['contentid']) && trim(urldecode($_GET['contentid'])) ? trim(urldecode($_GET['contentid'])) : $this->_show_msg(L('illegal_parameters')); $this->contentid = safe_replace($this->contentid); $this->db = Loader::model('digg_model'); $this->db_log = Loader::model('digg_log_model'); }
public function __construct() { parent::__construct(); $this->db = Loader::model('admin_login_log_model'); $this->admin_username = cookie('admin_username'); // 管理员COOKIE }
/** * 推送选择界面 */ public function init() { if (isset($_POST['dosubmit'])) { $c = Loader::model('content_model'); $c->set_model($_POST['modelid']); $info = array(); $ids = explode('|', $_POST['id']); if (is_array($ids)) { foreach ($ids as $id) { $info[$id] = $c->get_content($_POST['catid'], $id); } } $_GET['add_action'] = isset($_GET['add_action']) ? $_GET['add_action'] : $_GET['act']; $this->push->{$_GET}['add_action']($info, $_POST); showmessage(L('success'), '', '', 'push'); } else { Loader::helper('template:global'); if (method_exists($this->push, $_GET['act'])) { $html = $this->push->{$_GET['act']}(array('modelid' => $_GET['modelid'], 'catid' => $_GET['catid'])); $tpl = isset($_GET['tpl']) ? 'push_to_category' : 'push_list'; include $this->view($tpl); } else { showmessage('CLASS METHOD NO EXISTS!', 'blank'); } } }
public function run_import_item() { Loader::model($_REQUEST['importType'], 'problog_importer'); $location = $_REQUEST['importLocation']; $ctID = $_REQUEST['selectedPageType']; $path = DIR_BASE . File::getRelativePathFromID($_REQUEST['importXml']); $xmlObject = simplexml_load_file($path, 'SimpleXMLElement'); $i = $_REQUEST['i']; foreach ($xmlObject->channel->item as $item_object) { $t++; if ($t == $i) { $method = ucfirst($_REQUEST['importType']) . 'Item'; $item = new $method($item_object); //var_dump($item);exit; $page = new CreateBlogPost($item, $location, $ctID); //print json_encode($child); if ($page) { print json_encode(array('success' => 1)); } else { print json_encode(array('error' => t('There was a problem with your import.'))); } } } exit; }
public function view() { $uh = Loader::helper('concrete/urls'); $bt = BlockType::getByHandle('switch_language'); Loader::model('section', 'multilingual'); $ml = MultilingualSection::getList(); $c = Page::getCurrentPage(); $al = MultilingualSection::getBySectionOfSite($c); $languages = array(); $locale = ACTIVE_LOCALE; if (is_object($al)) { $locale = $al->getLanguage(); } foreach ($ml as $m) { $languages[$m->getCollectionID()] = $m->getLanguageText($locale) . ' ' . (strlen($m->msIcon) ? '(' . $m->msIcon . ')' : ''); } $this->set('languages', $languages); $this->set('languageSections', $ml); $this->set('action', $uh->getBlockTypeToolsURL($bt) . '/switch'); if (is_object($al)) { $this->set('activeLanguage', $al->getCollectionID()); } $pkg = Package::getByHandle('multilingual'); $mdl = Loader::helper('default_language', 'multilingual'); $this->set('defaultLanguage', $mdl->getSessionDefaultLocale()); $this->set('cID', $c->getCollectionID()); }
function getFile($fID) { Loader::model('file'); $mf = new File(); $file_obj = $mf->getByID($fID); $fileversion_obj = $file_obj->getVersion(); $bf = new LibraryFileBlockController; $ftype = FileTypeList::getType($fileversion_obj->getExtension()); $this->generictype = strtolower($ftype->getGenericTypeText($ftype->getGenericType())); $this->filename = $fileversion_obj->getFileName(); $this->type = $fileversion_obj->getType(); $this->url = $fileversion_obj->getURL(); $this->filepath = $fileversion_obj->getPath(); $this->relpath = $fileversion_obj->getRelativePath(); $this->origfilename = $fileversion_obj->getRelativePath(); $this->filesize = $fileversion_obj->getFullSize(); $len = strlen(REL_DIR_FILES_UPLOADED); $fh = Loader::helper('concrete/file'); $bf->bID = $fileversion_obj->getFileID(); $bf->generictype = $this->generictype; $bf->type = $this->type; $bf->url = $this->url; $bf->filepath = $this->filepath; $bf->relpath = $this->relpath; $bf->filename = substr($this->relpath, $len); // for backwards compatibility this must include the prefixes $bf->filesize = $this->filesize; return $bf; }
public function view() { $u = new User(); $ui = UserInfo::getByID($u->getUserID()); Loader::model("page_statistics"); Loader::model("user_statistics"); $timeStr = ''; if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $timeStr = '%x ' . t('at') . ' %I:%M %p'; } else { $timeStr = '%x ' . t('at') . ' %l:%M %p'; } if (is_object($ui)) { $this->set('uLastLogin', strftime($timeStr, $ui->getLastLogin('user'))); $this->set('uName', $ui->getUserName()); $this->set('lastEditSite', strftime($timeStr, strtotime(PageStatistics::getSiteLastEdit('user')))); $llu = UserStatistics::getLastLoggedInUser(); if ($llu->getUserID() == $u->getUserID()) { $this->set('lastLoginSite', t('Your login is the most recent.')); } else { $this->set('lastLoginSite', strftime($timeStr, $llu->getLastLogin())); } Loader::block('form'); } $this->set('totalFormSubmissions', FormBlockStatistics::getTotalSubmissions()); $this->set('totalFormSubmissionsToday', FormBlockStatistics::getTotalSubmissions(date('Y-m-d'))); }
public function activate_files($ptID) { try { Loader::model("collection_types"); $pt = PageTheme::getByID($ptID); $txt = Loader::helper('text'); if (!is_array($this->post('pageTypes'))) { throw new Exception(t("You must specify at least one template to make into a page type.")); } $pkg = false; $pkgHandle = $pt->getPackageHandle(); if ($pkgHandle) { $pkg = Package::getByHandle($pkgHandle); } foreach ($this->post('pageTypes') as $ptHandle) { $data['ctName'] = $txt->unhandle($ptHandle); $data['ctHandle'] = $ptHandle; $ct = CollectionType::add($data, $pkg); } $this->set('message', t('Files in the theme were activated successfully.')); } catch (Exception $e) { $this->set('error', $e); } $this->view($ptID); }
public function prepare_remote_upgrade($remoteMPID = 0){ $tp = new TaskPermission(); if ($tp->canInstallPackages()) { Loader::model('marketplace_remote_item'); $mri = MarketplaceRemoteItem::getByID($remoteMPID); if (!is_object($mri)) { $this->set('error', array(t('Invalid marketplace item ID.'))); return; } $local = Package::getbyHandle($mri->getHandle()); if (!is_object($local) || $local->isPackageInstalled() == false) { $this->set('error', array(Package::E_PACKAGE_NOT_FOUND)); return; } $r = $mri->downloadUpdate(); if ($r != false) { if (!is_array($r)) { $this->set('error', array($r)); } else { $errors = Package::mapError($r); $this->set('error', $errors); } } else { $this->redirect('/dashboard/extend/update', 'do_update', $mri->getHandle()); } } }
public function run() { $db = Loader::db(); Loader::model('single_page'); Cache::disableLocalCache(); // we backup the custom styles table $this->backupCustomStylesTables(); // upgrade blocks that differ between versions $this->updateBlocks(); // Migrate data from the custom styles tables to the new approach $this->migrateCustomStyleData(); $this->setupSiteSearchIndexing(); $this->installTaskPermissions(); $this->updateDashboard(); // add the dark chocolate theme $pt = PageTheme::getByHandle('dark_chocolate'); if (!is_object($pt)) { $chocolate = PageTheme::add('dark_chocolate'); } Cache::enableLocalCache(); }
public function do_add() { extract($this->getHelperObjects()); Loader::model('file_set'); if (!$validation_token->validate("file_sets_add")) { $this->set('error', array($validation_token->getErrorMessage())); return; } if (!trim($this->post('file_set_name'))) { $this->set('error', array(t('Please Enter a Name'))); return; } $setName = trim($this->post('file_set_name')); if (preg_match('/[<>;{}?"`]/i', $setName)) { $this->set('error', array(t('File Set Name cannot contain the characters: %s', Loader::helper('text')->entities('<>;{}?"`')))); return; } //print('<pre>');print_r(get_included_files());print('</pre>'); $u = new User(); $file_set = new FileSet(); //AS: Adodb Active record is complaining a ?/value array mismatch unless //we explicatly set the primary key ID field to null $file_set->fsID = null; $file_set->fsName = $setName; $file_set->fsType = FileSet::TYPE_PUBLIC; $file_set->uID = $u->getUserID(); $file_set->fsOverrideGlobalPermissions = $this->post('fsOverrideGlobalPermissions') == 1 ? 1 : 0; $file_set->save(); $this->redirect('/dashboard/files/sets', 'file_set_added'); }
public function __construct() { Loader::model('system/captcha/library'); Loader::model('system/captcha/controller'); $captcha = SystemCaptchaLibrary::getActive(); $this->controller = $captcha->getController(); }
function run() { Loader::model('cobble', 'cobble'); $cbl = new Cobble(); $cbl->refresh(); return "Cobble Tables were Refreshed"; }
public function run() { $db = Loader::db(); $cnt = $db->GetOne('select count(*) from TaskPermissions where tpHandle = ?', array('delete_user')); if ($cnt < 1) { $g3 = Group::getByID(ADMIN_GROUP_ID); $tip = TaskPermission::addTask('delete_user', t('Delete Users'), false); if (is_object($g3)) { $tip->addAccess($g3); } } Loader::model('single_page'); $sp = Page::getByPath('/dashboard/settings/multilingual'); if ($sp->isError()) { $d1a = SinglePage::add('/dashboard/settings/multilingual'); $d1a->update(array('cName' => t('Multilingual Setup'))); } $sp = Page::getByPath('/dashboard/composer'); if ($sp->isError()) { $d2 = SinglePage::add('/dashboard/composer'); $d2->update(array('cName' => t('Composer Beta'), 'cDescription' => t('Write for your site.'))); } $sp = Page::getByPath('/dashboard/composer/write'); if ($sp->isError()) { $d3 = SinglePage::add('/dashboard/composer/write'); } $sp = Page::getByPath('/dashboard/composer/drafts'); if ($sp->isError()) { $d4 = SinglePage::add('/dashboard/composer/drafts'); } $sp = Page::getByPath('/dashboard/pages/types/composer'); if ($sp->isError()) { $d5 = SinglePage::add('/dashboard/pages/types/composer'); } }
/** * 编辑专题首页模板 */ public function init() { echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'; $specialid = isset($_GET['specialid']) && intval($_GET['specialid']) ? intval($_GET['specialid']) : showmessage(L('illegal_action'), HTTP_REFERER); if (!$specialid) { showmessage(L('illegal_action'), HTTP_REFERER); } $info = $this->db->where(array('id' => $specialid, 'disabled' => '0'))->find(); if (!$info['id']) { showmessage(L('illegal_parameters'), HTTP_REFERER); } $id = $specialid; if ($info['css']) { $css_param = unserialize($info['css']); } if (!$info['ispage']) { $type_db = Loader::model('type_model'); $types = $type_db->where(array('application' => 'special', 'parentid' => $id))->order('listorder ASC, typeid ASC')->select(); } extract($info); $css = get_css($css_param); $template = $info['index_template'] ? $info['index_template'] : 'index'; Loader::helper('template:global'); ob_start(); include template('special', $template); $html = ob_get_contents(); ob_clean(); $html = visualization($html, 'default', 'test', 'block.html'); include $this->view('template_edit'); }
public function addWorkflowProgress(Workflow $wf) { Loader::model('workflow/progress/categories/page'); $pwp = PageWorkflowProgress::add($wf, $this); $r = $pwp->start(); $pwp->setWorkflowProgressResponseObject($r); return $pwp; }
public function __construct() { Loader::model('user_statistics'); Loader::model('page_statistics'); $u = new User(); $ui = UserInfo::getByID($u->getUserID()); $us = new UserStatistics($ui); $this->set('uLastActivity', $us->getPreviousSessionPageViews()); $timeStr = ''; if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $timeStr = '%x ' . t('at') . ' %I:%M %p'; } else { $timeStr = '%x ' . t('at') . ' %l:%M %p'; } $this->set('uLastLogin', strftime($timeStr, $ui->getLastLogin('user'))); $this->set('uName', $ui->getUserName()); $this->set('totalViews', PageStatistics::getTotalPageViewsForOthers($u)); $this->set('totalVersions', PageStatistics::getTotalPageVersions()); $this->set('lastEditSite', strftime($timeStr, strtotime(PageStatistics::getSiteLastEdit('user')))); $llu = UserStatistics::getLastLoggedInUser(); if ($llu->getUserID() == $u->getUserID()) { $this->set('lastLoginSite', t('Your login is the most recent.')); } else { $this->set('lastLoginSite', strftime($timeStr, $llu->getLastLogin())); } $this->set('totalEditMode', PageStatistics::getTotalPagesCheckedOut()); Loader::block('form'); $this->set('totalFormSubmissions', FormBlockStatistics::getTotalSubmissions()); $this->set('totalFormSubmissionsToday', FormBlockStatistics::getTotalSubmissions(date('Y-m-d'))); }
public function module($module = null, $task = null) { Loader::model('dashboard/homepage'); $dh = new DashboardHomepageView(); $mod = $dh->getByHandle($module); if ($mod->pkgID > 0) { $pkg = Package::getByID($mod->pkgID); $class = Loader::dashboardModuleController($mod->dbhModule, $pkg); } else { $class = Loader::dashboardModuleController($mod->dbhModule); } $args = func_get_args(); array_shift($args); array_shift($args); // no that's not a misprint if (method_exists($class, $task)) { try { $resp = call_user_func_array(array($class, $task), $args); if ($resp) { $this->set('message', $resp); } } catch(Exception $e) { $this->set('error', $e); } } print $this->view(); }
function page_init($title = '', $keywords = '', $description = '', $album_id = null, $photo_id = null) { $plugin =& loader::lib('plugin'); $head_str = "<title>{$title}</title>\n"; $head_str .= "<meta name=\"keywords\" content=\"{$keywords}\" />\n"; $head_str .= "<meta name=\"description\" content=\"{$description}\" />\n"; $meu_head = $plugin->filter('meu_head', $head_str, $album_id, $photo_id); $meu_head .= "\n" . '<meta name="generator" content="Mei' . 'u' . 'Pic ' . MPIC_VERSION . '" />' . "\n"; $feed_url = $album_id ? site_link('feed', 'index', array('aid' => $album_id)) : site_link('feed'); $feed_title = $this->setting->get_conf('site.title'); $meu_head .= "<link rel=\"alternate\" title=\"{$feed_title}\" href=\"" . $feed_url . "\" type=\"application/rss+xml\" />\n"; $this->output->set('meu_head', $meu_head); if ($this->user->loggedin()) { //更新提示 $this->output->set('update_info', $this->setting->get_conf('update')); } $user_status = loader::view('block/user_status', false); $this->output->set('user_status', $plugin->filter('user_status', $user_status)); $page_head = $plugin->filter('page_head', '', $album_id, $photo_id); $page_foot = $plugin->filter('page_foot', '', $album_id, $photo_id); $this->output->set('page_head', $page_head); $this->output->set('page_foot', $page_foot); $this->output->set('trash_status', has_trash()); $mdl_nav =& Loader::model('nav'); $nav_menu = $mdl_nav->get_enabled_navs(); $this->output->set('nav_menu', $nav_menu); //$plugin->filter('main_menu',$nav_menu,$album_id,$photo_id); }
public function save() { $helper_file = Loader::helper('concrete/file'); $validation_token = Loader::helper('validation/token'); Loader::model('file_storage_location'); if (!$validation_token->validate("file_storage")) { $this->set('error', array($validation_token->getErrorMessage())); return; } if ($_POST['delete']) { $fsl = FileStorageLocation::getByID(FileStorageLocation::ALTERNATE_ID); if (is_object($fsl)) { $fsl->delete(); $this->redirect('/dashboard/system/environment/file_storage_locations', 'storage_deleted'); } } else { Config::save('DIR_FILES_UPLOADED', $this->post('DIR_FILES_UPLOADED')); if ($this->post('fslName') != '' && $this->post('fslDirectory') != '') { $fsl = FileStorageLocation::getByID(FileStorageLocation::ALTERNATE_ID); if (!is_object($fsl)) { FileStorageLocation::add($this->post('fslName'), $this->post('fslDirectory'), FileStorageLocation::ALTERNATE_ID); } else { $fsl->update($this->post('fslName'), $this->post('fslDirectory')); } } $this->redirect('/dashboard/system/environment/file_storage_locations', 'storage_saved'); } }
public function __construct($modelid) { $this->db = Loader::model('model_field_model'); $this->db_pre = $this->db->get_prefix(); $this->modelid = $modelid; $this->fields = S('member/model_field_' . $modelid); }
public function __construct() { parent::__construct(); $this->db = Loader::model('type_model'); $this->model = S('common/model'); $this->category_db = Loader::model('category_model'); }
public function __construct() { $admin_username = cookie('admin_username'); $userid = $_SESSION['userid']; $this->db = Loader::model('badword_model'); parent::__construct(); }
public function run() { Cache::disableCache(); Loader::library('database_indexed_search'); $is = new IndexedSearch(); if ($_GET['force'] == 1) { Loader::model('attribute/categories/collection'); Loader::model('attribute/categories/file'); Loader::model('attribute/categories/user'); $attributes = CollectionAttributeKey::getList(); $attributes = array_merge($attributes, FileAttributeKey::getList()); $attributes = array_merge($attributes, UserAttributeKey::getList()); foreach($attributes as $ak) { $ak->updateSearchIndex(); } $result = $is->reindexAll(true); } else { $result = $is->reindexAll(); } if ($result->count == 0) { return t('Indexing complete. Index is up to date'); } else { if ($result->count == $is->searchBatchSize) { return t('Index partially updated. %s pages indexed (maximum number.) Re-run this job to continue this process.', $result->count); } else { return t('Index updated. %s %s required reindexing.', $result->count, $result->count == 1 ? t('page') : t('pages')); } } }
/** * * @param string $name * @return void */ public function loadModel($name) { $model = Loader::model($name); if ($model !== NULL) { $this->{get_class($model)} = $model; } }
public function install() { $pkg = parent::install(); Loader::model('single_page'); $main = SinglePage::add('/dashboard/multisite', $pkg); $mainSites = SinglePage::add('/dashboard/multisite/sites', $pkg); }
public function __construct() { parent::__construct(); $this->db = Loader::model('search_model'); $this->application_db = Loader::model('application_model'); $this->type_db = Loader::model('type_model'); }
public function get() { $id = isset($_GET['id']) && intval($_GET['id']) ? intval($_GET['id']) : exit; if ($data = $this->db->getby_id($id)) { if (!($str = S('dbsource_' . $id))) { if ($data['type'] == 1) { // 自定义SQL调用 $get_db = Loader::model("get_model"); $sql = $data['data'] . (!empty($data['num']) ? " LIMIT {$data['num']}" : ''); $str = $get_db->query($sql); } else { $filepath = APPS_PATH . $data['application'] . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . $data['application'] . '_tag.php'; if (file_exists($filepath)) { $yun_tag = Loader::lib($data['application'] . ':' . $data['application'] . '_tag'); if (!method_exists($yun_tag, $data['do'])) { exit; } $sql = string2array($data['data']); $sql['do'] = $data['do']; $sql['limit'] = $data['num']; unset($data['num']); $str = $yun_tag->{$data}['do']($sql); } else { exit; } } if ($data['cache']) { S('tpl_data/dbsource_' . $id, $str, $data['cache']); } } echo $this->_format($data['id'], $str, $data['dis_type']); } }
protected function installAttributeType($pkg) { $attributeHandle = 'related_pages'; \Loader::model('attribute/categories/collection'); AttributeType::add($attributeHandle, t('Related Pages'), \Package::getByHandle($this->pkgHandle)); AttributeKeyCategory::getByHandle('collection')->associateAttributeKeyType(AttributeType::getByHandle($attributeHandle)); }