private function installOrUpgrade($pkg, $fromVersion)
 {
     $at = AttributeType::getByHandle('handle_https');
     if (!is_object($at)) {
         $at = AttributeType::add('handle_https', tc('AttributeTypeName', 'HTTPS handling'), $pkg);
     }
     $akc = AttributeKeyCategory::getByHandle('collection');
     if (is_object($akc)) {
         if (!$akc->hasAttributeKeyTypeAssociated($at)) {
             $akc->associateAttributeKeyType($at);
         }
     }
     if (empty($fromVersion)) {
         $ak = CollectionAttributeKey::getByHandle('handle_https');
         if (!is_object($ak)) {
             $hhh = Loader::helper('https_handling', 'handle_https');
             /* @var $hhh HttpsHandlingHelper */
             $httpDomain = defined('BASE_URL') ? BASE_URL : Config::get('BASE_URL');
             if (!$httpDomain) {
                 $httpDomain = 'http://' . $hhh->getRequestDomain();
             }
             $httpsDomain = defined('BASE_URL_SSL') ? BASE_URL_SSL : Config::get('BASE_URL_SSL');
             if (!$httpsDomain) {
                 $httpsDomain = 'https://' . $hhh->getRequestDomain();
             }
             $ak = CollectionAttributeKey::add($at, array('akHandle' => 'handle_https', 'akName' => tc('AttributeKeyName', 'Page HTTP/HTTPS'), 'akIsSearchable' => 1, 'akIsSearchableIndexed' => 1, 'akIsAutoCreated' => 1, 'akIsEditable' => 1, 'akIsInternal' => 0, 'akEnabled' => 0, 'akDefaultRequirement' => HttpsHandlingHelper::SSLHANDLING_DOESNOT_MATTER, 'akCustomDomains' => 0, 'akHTTPDomain' => $httpDomain, 'akHTTPSDomain' => $httpsDomain), $pkg);
         }
     }
 }
Exemple #2
0
 private function _setupDashboardIcon($page, $icon)
 {
     $cak = CollectionAttributeKey::getByHandle('icon_dashboard');
     if (is_object($cak)) {
         $page->setAttribute('icon_dashboard', $icon);
     }
 }
 function getPages($query = null)
 {
     Loader::model('page_list');
     $db = Loader::db();
     $bID = $this->bID;
     if ($this->bID) {
         $q = "select * from btDateNav where bID = '{$bID}'";
         $r = $db->query($q);
         if ($r) {
             $row = $r->fetchRow();
         }
     } else {
         $row['num'] = $this->num;
         $row['cParentID'] = $this->cParentID;
         $row['cThis'] = $this->cThis;
         $row['orderBy'] = $this->orderBy;
         $row['ctID'] = $this->ctID;
         $row['rss'] = $this->rss;
     }
     $pl = new PageList();
     $pl->setNameSpace('b' . $this->bID);
     $cArray = array();
     //$pl->sortByPublicDate();
     $pl->sortByPublicDateDescending();
     $num = (int) $row['num'];
     if ($num > 0) {
         $pl->setItemsPerPage($num);
     }
     $c = $this->getCollectionObject();
     if (is_object($c)) {
         $this->cID = $c->getCollectionID();
     }
     $cParentID = $row['cThis'] ? $this->cID : $row['cParentID'];
     if ($this->displayFeaturedOnly == 1) {
         Loader::model('attribute/categories/collection');
         $cak = CollectionAttributeKey::getByHandle('is_featured');
         if (is_object($cak)) {
             $pl->filterByIsFeatured(1);
         }
     }
     $pl->filter('cvName', '', '!=');
     if ($row['ctID']) {
         $pl->filterByCollectionTypeID($row['ctID']);
     }
     $pl->filterByAttribute('exclude_nav', false);
     if ($row['cParentID'] != 0) {
         $pl->filterByParentID($cParentID);
     }
     if ($num > 0) {
         $pages = $pl->getPage();
     } else {
         $pages = $pl->get();
     }
     $this->set('pl', $pl);
     return $pages;
 }
 /**
  *  @dataProvider commonAttributeHandles
  */
 public function testUnsetCommonAttributes($handle)
 {
     $page = Page::getByPath('/about');
     $ak = CollectionAttributeKey::getByHandle($handle);
     $page->clearAttribute($ak);
     $cav = $page->getAttributeValueObject($ak);
     if (is_object($cav)) {
         $this->fail(t("Page::clearAttribute did not delete '%s'.", $handle));
     }
 }
Exemple #5
0
	public function run() {
		$db = Loader::db();
		Loader::model('collection_attributes');
		Loader::model('single_page');
		Loader::model('file_version');
		
		// Add in stuff that may have gotten missed before
		$p = Page::getByPath('/profile');
		if ($p->isError()) {
			$d1 = SinglePage::add('/profile');
			$d2 = SinglePage::add('/profile/edit');
			$d3 = SinglePage::add('/profile/avatar');				
		}
		$p2 = Page::getByPath('/dashboard/users/registration');
		if ($p2->isError()) {
			$d4 = SinglePage::add('/dashboard/users/registration');
		}
		
		// Move any global blocks to new scrapbook page.
		$sc = Page::getByPath("/dashboard/scrapbook/global");
		$scn = Page::getByPath('/dashboard/scrapbook');
		$scu = Page::getByPath('/dashboard/scrapbook/user');
		if (!$sc->isError()) {
			$blocks = $sc->getBlocks("Global Scrapbook");
			if (count($blocks) > 0) {
				// we create the new shared scrapbook 1
				$a = Area::getOrCreate($scn, t('Shared Scrapbook 1'));
				foreach($blocks as $_b) {
					// we move them into the area on the new page. 
					$_b->move($scn, $a);
					$_b->refreshCacheAll();
				}
			}
			$sc->delete();
		}
		if (!$scu->isError()) {
			$scu->delete();
		}
		//add the new collection attribute keys
		$cak=CollectionAttributeKey::getByHandle('header_extra_content');
		if(!is_object($cak)) {
			CollectionAttributeKey::add('header_extra_content', t('Header Extra Content'), true, null, 'TEXT');
		}
		$cak=CollectionAttributeKey::getByHandle('exclude_search_index');
		if (!is_object($cak)) {
			CollectionAttributeKey::add('exclude_search_index', t('Exclude From Search Index'), true, null, 'BOOLEAN');
		}
		
		//convert file tags to new format, cleaned up with leading and trailing line breaks  
		$fileVersionsData=$db->GetAll('SELECT fID, fvID, fvTags FROM FileVersions');
		foreach($fileVersionsData as $fvData){
			$vals=array( FileVersion::cleanTags($fvData['fvTags']) , $fvData['fID'] , $fvData['fvID'] );
			$db->query('UPDATE FileVersions SET fvTags=? WHERE fID=? AND fvID=?',  $vals );
		}
	}
 public function import_wordpress_xml()
 {
     if ($this->post('import-images') == 'on') {
         $this->importImages = true;
         $filesetname;
         $this->post('file-set-name') ? $this->filesetname = $this->post('file-set-name') : ($this->filesetname = t("Imported Wordpress Files"));
         $this->createFileSet = true;
     }
     $pages = array();
     if (intval($this->post('wp-file')) > 0) {
         Loader::model('file');
         $co = new Config();
         $pkg = Package::getByHandle('wordpress_site_importer');
         $co->setPackageObject($pkg);
         $co->save("WORDPRESS_IMPORT_FID", $this->post('wp-file'));
         $importFile = File::getByID($this->post('wp-file'));
         $nv = $importFile->getVersion();
         $fileUrl = $nv->getDownloadURL();
         $xml = @simplexml_load_file($fileUrl, "SimpleXMLElement", LIBXML_NOCDATA);
         $items = array();
         foreach ($xml->channel->item as $item) {
             $items[] = $item->asxml();
         }
         $db = Loader::db();
         $sql = $db->Prepare('insert into WordpressItems (wpItem) values(?)');
         foreach ($items as $item) {
             $db->Execute($sql, $item);
         }
         $categories = array();
         $namespaces = $xml->getDocNamespaces();
         foreach ($xml->xpath('/rss/channel/wp:category') as $term_arr) {
             $t = $term_arr->children($namespaces['wp']);
             $categories[] = array('term_id' => (int) $t->term_id, 'category_nicename' => (string) $t->category_nicename, 'category_parent' => (string) $t->category_parent, 'cat_name' => (string) $t->cat_name, 'category_description' => (string) $t->category_description);
         }
         Loader::model('attribute/categories/collection');
         $akt = CollectionAttributeKey::getByHandle("wordpress_category");
         for ($i = 0; $i < count($categories); $i++) {
             $opt = new SelectAttributeTypeOption(0, $categories[$i]['cat_name'], $i);
             $opt = $opt->saveOrCreate($akt);
         }
         foreach ($xml->xpath('/rss/channel/wp:tag') as $term_arr) {
             $t = $term_arr->children($namespaces['wp']);
             $tags[] = array('term_id' => (int) $t->term_id, 'tag_slug' => (string) $t->tag_slug, 'tag_name' => (string) $t->tag_name, 'tag_description' => (string) $t->tag_description);
         }
         $akt = CollectionAttributeKey::getByHandle("tags");
         for ($i = 0; $i < count($tags); $i++) {
             $opt = new SelectAttributeTypeOption(0, $tags[$i]['tag_name'], $i);
             $opt = $opt->saveOrCreate($akt);
         }
     } else {
         echo t("No file");
         exit;
     }
     $this->view();
 }
Exemple #7
0
 public function setAuthor($p)
 {
     $ak = CollectionAttributeKey::getByHandle('blog_author');
     if ($this->wp_post->author) {
         Loader::model('userinfo');
         $ui = UserInfo::getByUserName($this->wp_post->author);
         if (is_object($ui)) {
             $p->setAttribute($ak, $ui->getUserID());
         }
     }
 }
 /** Executes the job.
  * @return string Returns a string describing the job result in case of success.
  * @throws Exception Throws an exception in case of errors.
  */
 public function run()
 {
     Cache::disableCache();
     Cache::disableLocalCache();
     try {
         $db = Loader::db();
         $instances = array('navigation' => Loader::helper('navigation'), 'dashboard' => Loader::helper('concrete/dashboard'), 'view_page' => PermissionKey::getByHandle('view_page'), 'guestGroup' => Group::getByID(GUEST_GROUP_ID), 'now' => new DateTime('now'), 'ak_exclude_sitemapxml' => CollectionAttributeKey::getByHandle('exclude_sitemapxml'), 'ak_sitemap_changefreq' => CollectionAttributeKey::getByHandle('sitemap_changefreq'), 'ak_sitemap_priority' => CollectionAttributeKey::getByHandle('sitemap_priority'));
         $instances['guestGroupAE'] = array(GroupPermissionAccessEntity::getOrCreate($instances['guestGroup']));
         $xmlDoc = new SimpleXMLElement('<' . '?xml version="1.0" encoding="' . APP_CHARSET . '"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" />');
         $rs = Loader::db()->Query('SELECT cID FROM Pages');
         while ($row = $rs->FetchRow()) {
             self::addPage($xmlDoc, intval($row['cID']), $instances);
         }
         $rs->Close();
         Events::fire('on_sitemap_xml_ready', $xmlDoc);
         $dom = dom_import_simplexml($xmlDoc)->ownerDocument;
         $dom->formatOutput = true;
         $addedPages = count($xmlDoc->url);
         $relName = ltrim(SITEMAPXML_FILE, '\\/');
         $osName = rtrim(DIR_BASE, '\\/') . '/' . $relName;
         $urlName = rtrim(BASE_URL . DIR_REL, '\\/') . '/' . $relName;
         if (!file_exists($osName)) {
             @touch($osName);
         }
         if (!is_writable($osName)) {
             throw new Exception(t('The file %s is not writable', $osName));
         }
         if (!($hFile = @fopen($osName, 'w'))) {
             throw new Exception(t('Cannot open file %s', $osName));
         }
         if (!@fwrite($hFile, $dom->saveXML())) {
             throw new Exception(t('Error writing to file %s', $osName));
         }
         @fflush($hFile);
         @fclose($hFile);
         unset($hFile);
         return t('%1$s file saved (%2$d pages).', sprintf('<a href="%s" target="_blank">%s</a>', $urlName, preg_replace('/^https?:\\/\\//i', '', $urlName)), $addedPages);
     } catch (Exception $x) {
         if (isset($hFile) && $hFile) {
             @fflush($hFile);
             @ftruncate($hFile, 0);
             @fclose($hFile);
             $hFile = null;
         }
         throw $x;
     }
 }
Exemple #9
0
 /**
  * Looks up the list of options from the DB
  * This is the only place where themes are 'categorized', which is purely for presentation in the walk create form
  *
  * @param string $type Which type of tag to return (e.g. theme, accessible)
  * @return array
  */
 public static function getSelectOptions($type = 'all')
 {
     $options = array();
     $satc = new SelectAttributeTypeController(AttributeType::getByHandle('select'));
     if ($type === 'all' || $type === 'theme') {
         $satc->setAttributeKey(CollectionAttributeKey::getByHandle('theme'));
         $themeAK = CollectionAttributeKey::getByHandle('theme');
         foreach ($satc->getOptions() as $v) {
             $category = $this->getCategory($v->value);
             $options['theme'][$category][] = ['handle' => $v->value, 'name' => self::getName($v->value)];
         }
     }
     if ($type === 'all' || $type === 'accessibile') {
         $satc->setAttributeKey(CollectionAttributeKey::getByHandle('accessible'));
         foreach ($satc->getOptions() as $v) {
             $options['accessible'][] = ['handle' => $v->value, 'name' => self::getName($v->value)];
         }
     }
     return $options;
 }
Exemple #10
0
 public function run()
 {
     $db = Loader::db();
     Cache::disableLocalCache();
     Loader::model('attribute/categories/collection');
     $cak = CollectionAttributeKey::getByHandle('exclude_page_list');
     if (!is_object($cak)) {
         $boolt = AttributeType::getByHandle('boolean');
         $cab4b = CollectionAttributeKey::add($boolt, array('akHandle' => 'exclude_page_list', 'akName' => t('Exclude From Page List'), 'akIsSearchable' => true));
         Loader::model('page_list');
         $pl = new PageList();
         $pl->filterByExcludeNav(1);
         $list = $pl->get();
         foreach ($list as $c) {
             $c->setAttribute('exclude_page_list', 1);
             $c->reindex();
         }
     }
     Cache::enableLocalCache();
 }
 public function getAttribute($ak, $c, $displayMode = false)
 {
     if (is_object($ak)) {
         $akHandle = $ak->getAttributeKeyHandle();
     } else {
         $akHandle = $ak;
         $ak = null;
     }
     $akHash = $akHandle . ':' . $displayMode;
     if (!isset($this->attributes[$akHash])) {
         $this->attributes[$akHash] = false;
         if (!$ak) {
             $ak = CollectionAttributeKey::getByHandle($akHandle);
         }
         if (is_object($ak)) {
             $av = $c->getAttributeValueObject($ak);
             if (is_object($av)) {
                 $this->attributes[$akHash] = $av->getValue($displayMode);
             }
         }
     }
     return $this->attributes[$akHash];
 }
 public function install()
 {
     $pkg = parent::install();
     Loader::model('single_page');
     $single_page = SinglePage::add('/dashboard/wordpress_import', $pkg);
     $single_page->update(array('cName' => t('WordPress Import'), 'cDescription' => t('Import WordPress Sites')));
     $import_stuff = SinglePage::add('/dashboard/wordpress_import/import', $pkg);
     $import_stuff->update(array('cName' => t('Import')));
     $import_stuff = SinglePage::add('/dashboard/wordpress_import/file', $pkg);
     $import_stuff->update(array('cName' => t('File')));
     $select = AttributeType::getByHandle('select');
     $wpCategory = CollectionAttributeKey::getByHandle('wordpress_category');
     if (!$wpCategory instanceof CollectionAttributeKey) {
         $wpCategory = CollectionAttributeKey::add($select, array('akSelectAllowMultipleValues' => 1, 'akSelectOptionDisplayOrder' => 'popularity_desc', 'akSelectAllowOtherValues' => 1, 'akHandle' => 'wordpress_category', 'akName' => t('Wordpress Category')), $pkg);
     }
     $tags = CollectionAttributeKey::getByHandle('tags');
     if (!$tags instanceof CollectionAttributeKey) {
         $tags = CollectionAttributeKey::add($select, array('akSelectAllowMultipleValues' => 1, 'akSelectOptionDisplayOrder' => 'popularity_desc', 'akSelectAllowOtherValues' => 1, 'akHandle' => 'tagsy', 'akName' => t('Tags')), $pkg);
     }
     $co = new Config();
     $co->setPackageObject($pkg);
     $co->save("WORDPRESS_IMPORT_FID", 0);
 }
Exemple #13
0
 protected function loadAttribute()
 {
     Loader::model('attribute/categories/collection');
     $ak = CollectionAttributeKey::getByHandle($this->attributeHandle);
     return $ak;
 }
Exemple #14
0
<?php

defined('C5_EXECUTE') or die("Access Denied.");
?>

<?php 
// grab all tags in use based on the path
$ak = CollectionAttributeKey::getByHandle('tags');
$akc = $ak->getController();
$pp = false;
$tagCounts = array();
if ($baseSearchPath != '') {
    $pp = Page::getByPath($baseSearchPath);
}
$ttags = $akc->getOptionUsageArray($pp);
$tags = array();
foreach ($ttags as $t) {
    $tagCounts[] = $t->getSelectAttributeOptionUsageCount();
    $tags[] = $t;
}
shuffle($tags);
$tagSizes = array();
$count = count($tagCounts);
foreach ($tagCounts as $tagCount => $pos) {
    $tagSizes[$pos] = setFontPx(($pos + 1) / $count);
}
function setFontPx($weight)
{
    $tagMinFontPx = 10;
    $tagMaxFontPx = 24;
    $em = $weight * ($tagMaxFontPx - $tagMinFontPx) + $tagMinFontPx;
Exemple #15
0
 protected function setupDashboardIcons()
 {
     $cak = CollectionAttributeKey::getByHandle('icon_dashboard');
     if (!is_object($cak)) {
         $textt = AttributeType::getByHandle('text');
         $cab4b = CollectionAttributeKey::add($textt, array('akHandle' => 'icon_dashboard', 'akName' => t('Dashboard Icon'), 'akIsInternal' => true));
     }
     $iconArray = array('/dashboard/composer/write' => 'icon-pencil', '/dashboard/composer/drafts' => 'icon-book', '/dashboard/sitemap/full' => 'icon-home', '/dashboard/sitemap/explore' => 'icon-road', '/dashboard/sitemap/search' => 'icon-search', '/dashboard/files/search' => 'icon-picture', '/dashboard/files/attributes' => 'icon-cog', '/dashboard/files/sets' => 'icon-list-alt', '/dashboard/files/add_set' => 'icon-plus-sign', '/dashboard/users/search' => 'icon-user', '/dashboard/users/groups' => 'icon-globe', '/dashboard/users/attributes' => 'icon-cog', '/dashboard/users/add' => 'icon-plus-sign', '/dashboard/users/add_group' => 'icon-plus', '/dashboard/users/group_sets' => 'icon-list', '/dashboard/reports/statistics' => 'icon-signal', '/dashboard/reports/forms' => 'icon-briefcase', '/dashboard/reports/surveys' => 'icon-tasks', '/dashboard/reports/logs' => 'icon-time', '/dashboard/pages/themes' => 'icon-font', '/dashboard/pages/types' => 'icon-file', '/dashboard/pages/attributes' => 'icon-cog', '/dashboard/pages/single' => 'icon-wrench', '/dashboard/workflow/list' => 'icon-list', '/dashboard/workflow/me' => 'icon-user', '/dashboard/blocks/stacks' => 'icon-th', '/dashboard/blocks/permissions' => 'icon-lock', '/dashboard/blocks/types' => 'icon-wrench');
     foreach ($iconArray as $path => $icon) {
         $sp = Page::getByPath($path);
         if (is_object($sp) && !$sp->isError()) {
             $sp->setAttribute('icon_dashboard', $icon);
         }
     }
 }
Exemple #16
0
            <th class=""><?php 
echo t('blog Category');
?>
</th>
            <th><?php 
echo t('In Draft');
?>
</th>
        </tr>
        </thead>
        <tbody>
        <?php 
$pkt = Loader::helper('concrete/urls');
$pkg = Package::getByHandle('problog');
foreach ($blogResults as $cobj) {
    $akct = CollectionAttributeKey::getByHandle('blog_category');
    $blog_category = $cobj->getCollectionAttributeValue($akct);
    ?>
            <tr>
                <td width="75px">
                    <a href="<?php 
    echo $this->url('/dashboard/problog/add_blog', 'edit', $cobj->getCollectionID());
    ?>
" class="fa fa-edit"></a> &nbsp;
                    <a href="<?php 
    echo $this->url('/dashboard/problog/blog_list', 'delete_check', $cobj->getCollectionID(), $cobj->getCollectionName());
    ?>
" class="fa fa-trash"></a>
                </td>
                <td><a href="<?php 
    echo $navigation->getLinkToCollection($cobj);
Exemple #17
0
?>
            <div class="input">
                <?php 
if (is_object($blog)) {
    $metaKeywords = $blog->getAttribute('meta_keywords');
}
?>
                <?php 
echo $form->textarea('akID[3][value]', $metaKeywords, array('style' => 'width: 98%; height: 90px; font-family: sans-serif;'));
?>
            </div>
        </div>
    </div>
    <div class="pane seo" style="display: none;">
        <?php 
$akt = CollectionAttributeKey::getByHandle('composer_optimizer');
if (is_object($blog)) {
    $tvalue = $blog->getAttributeValueObject($akt);
}
?>
        <div class="clearfix">
            <div class="input">
                <div class="input-prepend">
                    <?php 
echo $akt->render('form', $tvalue, true);
?>
                </div>
            </div>
        </div>
    </div>
    <div id="blog-error">
Exemple #18
0
			if (is_array($ctArray)) { ?>
	  <select name="ctID" id="selectCTID">
		<option value="0">** <?php  echo t('All')?> **</option>
		<?php  foreach ($ctArray as $ct) { ?>
		<option value="<?php echo $ct->getCollectionTypeID()?>" <?php  if ($ctID == $ct->getCollectionTypeID()) { ?> selected <?php  } ?>>
		<?php echo $ct->getCollectionTypeName()?>
		</option>
		<?php  } ?>
	  </select>
	  <?php  } ?>
	  
	  <h2><?php echo t('Filter')?></h2>
	  
	  <?php 
	  Loader::model('attribute/categories/collection');
	  $cadf = CollectionAttributeKey::getByHandle('is_featured');
	  ?>
	  <input <?php  if (!is_object($cadf)) { ?> disabled <?php  } ?> type="checkbox" name="displayFeaturedOnly" value="1" <?php  if ($displayFeaturedOnly == 1) { ?> checked <?php  } ?> style="vertical-align: middle" />
	  <?php echo t('Featured pages only.')?>
		<?php  if (!is_object($cadf)) { ?>
			 <?php echo t('(<strong>Note</strong>: You must create the "is_featured" page attribute first.)');?></span>
		<?php  } ?>
		<br/>
		<input type="checkbox" name="displayAliases" value="1" <?php  if ($displayAliases == 1) { ?> checked <?php  } ?> />
		<?php echo t('Display page aliases.')?>
		<br/>
		
	</div>
	<div class="ccm-block-field-group">
		<h2><?php echo t('Pagination')?></h2>
		<input type="checkbox" name="paginate" value="1" <?php  if ($paginate == 1) { ?> checked <?php  } ?> />
Exemple #19
0
	public function run() {
		$db = Loader::db();
		
		Cache::disableLocalCache();
		Loader::model('attribute/categories/collection');
		Loader::model('attribute/categories/file');
		Loader::model('attribute/categories/user');
		$collectionErrors = array();
		$fileErrors = array();
		$userErrors = array();
		//add the new collection attribute keys
		$this->installCoreAttributeItems();	
		
		$dict = NewDataDictionary($db->db, DB_TYPE);
		$tables = $db->MetaTables();
		
		if (in_array('_CollectionAttributeKeys', $tables)) {
			$collectionErrors = $this->upgradeCollectionAttributes();
		}		
		if (in_array('_FileAttributeKeys', $tables)) {
			$fileErrors = $this->upgradeFileAttributes();
		}			
		if (in_array('_UserAttributeKeys', $tables)) {
			$userErrors = $this->upgradeUserAttributes();
		} 

		$cak=CollectionAttributeKey::getByHandle('exclude_sitemapxml');
		if (!is_object($cak)) {
			$cak = CollectionAttributeKey::add('exclude_sitemapxml', t('Exclude From sitemap.xml'), true, null, 'BOOLEAN');
		}
		
		//change the page/tab name of the dashboard users registration page
		$dashboardRegistrationPage=Page::getByPath('/dashboard/users/registration');
		if( intval($dashboardRegistrationPage->cID) ) 
			$dashboardRegistrationPage->update(array('cName'=>t('Login & Registration')));
		Config::save('LOGIN_ADMIN_TO_DASHBOARD', 1);
	
		//profile friends page install	
		Loader::model('single_page');
		$friendsPage=Page::getByPath('/profile/friends');
		if( !intval($friendsPage->cID)) {
			SinglePage::add('/profile/friends');
		}

		$membersPage =Page::getByPath('/members');
		if( !intval($membersPage->cID)) {
			SinglePage::add('/members');
		}

		$messagesPage =Page::getByPath('/profile/messages');
		if( !intval($messagesPage->cID)) {
			SinglePage::add('/profile/messages');
		}
		
		$ppme = UserAttributeKey::getByHandle('profile_private_messages_enabled');
		if (!is_object($ppme)) {
			UserAttributeKey::add('BOOLEAN', array('akHandle' => 'profile_private_messages_enabled', 'akName' => t('I would like to receive private messages.'), 'akIsSearchable' => true));
		}
		$ppmne = UserAttributeKey::getByHandle('profile_private_messages_notification_enabled');
		if (!is_object($ppmne)) {
			UserAttributeKey::add('BOOLEAN', array('akHandle' => 'profile_private_messages_notification_enabled', 'akName' => t('Send me email notifications when I receive a private message.'), 'akIsSearchable' => true));
		}
		
		$em = Page::getByPath('/dashboard/settings');
		if (!$em->isError()) {
			$em = SinglePage::getByID($em->getCollectionID());
			$em->refresh();
		}
		
		$em1=Page::getByPath('/dashboard/settings/mail');
		if ($em1->isError()) {
			$em1 = SinglePage::add('/dashboard/settings/mail');
			$em1->update(array('cName'=>t('Email'), 'cDescription'=>t('Enable post via email and other settings.')));
		}

		// remove adodb database logs
		$databaseReports = Page::getByPath('/dashboard/reports/database');
		if (!$databaseReports->isError()) {
			$databaseReports->delete();
		}
		if (in_array('adodb_logsql', $tables)) {			
			@$db->query('DROP TABLE adodb_logsql');	
		}
		
		Loader::library('mail/importer');
		$mi = MailImporter::getByHandle("private_message");
		if (!is_object($mi)) {
			MailImporter::add(array('miHandle' => 'private_message'));
		}

		Loader::model("job");
		Job::installByHandle('process_email');		

		Cache::enableLocalCache();
	
		return array_merge($collectionErrors, $fileErrors, $userErrors);
	}
Exemple #20
0
		public function setAttribute($ak, $value) {
			Loader::model('attribute/categories/collection');
			if (!is_object($ak)) {
				$ak = CollectionAttributeKey::getByHandle($ak);
			}
			$ak->setAttribute($this, $value);
			unset($ak);
			$this->refreshCache();
			$this->reindex();
		}
Exemple #21
0
 public function upgrade()
 {
     parent::upgrade();
     $pkg = Package::getByHandle($this->pkgHandle);
     //@todo write conversion from lang to locale
     //1.0 - 1.1 changed languaage to locale
     $db = Loader::db();
     // update the MultilingualSections table
     $rows = $db->getAll("SELECT * FROM MultilingualSections");
     if (is_array($rows) && count($rows)) {
         foreach ($rows as $r) {
             if (strlen($r['msLanguage']) && !strlen($r['msLocale'])) {
                 $locale = $r['msLanguage'] . (strlen($r['msIcon']) ? "_" . $r['msIcon'] : "");
                 $db->query("UPDATE MultilingualSections SET msLocale = ? WHERE cID = ?", array($locale, $r['cID']));
             }
         }
     }
     // install job
     Loader::model('job');
     $jb = Job::installByPackage('generate_multilingual_sitemap', $pkg);
     // update the MultilingualPageRelations table
     $hasLocales = $db->getOne("SELECT COUNT(msLocale) FROM MultilingualSections WHERE LENGTH(msLocale)");
     if (!$hasLocales) {
         $query = "UPDATE MultilingualPageRelations mpr, MultilingualSections \n\t\t\t\tSET mpr.mpLocale = MultilingualSections.msLocale\n\t\t\t\tWHERE mpr.mpLanguage = MultilingualSections.msLanguage";
         $db->query($query);
     }
     // 1.1.2
     $ak = CollectionAttributeKey::getByHandle('multilingual_exclude_from_copy');
     if (!is_object($ak)) {
         CollectionAttributeKey::add('BOOLEAN', array('akHandle' => 'multilingual_exclude_from_copy', 'akName' => t('Exclude from Internationalization Copy'), 'akIsSearchable' => true), $pkg);
     }
 }
Exemple #22
0
 protected function loadAttribute()
 {
     $ak = CollectionAttributeKey::getByHandle($this->attributeHandle);
     return $ak;
 }
Exemple #23
0
?>
    <div class="clearfix">
        <?php 
echo $form->label('send_subscription', t('Send To Subscribers?'));
?>
        <div class="input">
            <div class="input-prepend">
                <?php 
echo $akt->render('form', $tvalue, true);
?>
            </div>
        </div>
    </div>
    
    <?php 
$akt = CollectionAttributeKey::getByHandle('post_to_twitter');
if (is_object($blog)) {
    $tvalue = $blog->getAttributeValueObject($akt);
}
?>
    <div class="clearfix">
        <?php 
echo $form->label('notify', t('Post to Twitter?'));
?>
        <div class="input">
            <div class="input-prepend">
                <?php 
echo $akt->render('form', $tvalue, true);
?>
            </div>
        </div>
Exemple #24
0
	protected function importPageContent(SimpleXMLElement $sx) {
		if (isset($sx->pages)) {
			foreach($sx->pages->page as $px) {
				if ($px['path'] != '') {
					$page = Page::getByPath($px['path'], 'RECENT');
				} else {
					$page = Page::getByID(HOME_CID, 'RECENT');
				}
				if (isset($px->area)) {
					$this->importPageAreas($page, $px);
				}
				if (isset($px->attributes)) {
					foreach($px->attributes->children() as $attr) {
						$ak = CollectionAttributeKey::getByHandle($attr['handle']);
						if (is_object($ak)) { 
							$page->setAttribute((string) $attr['handle'], $ak->getController()->importValue($attr));
						}
					}
				}
				$page->reindex();
			}
		}
	}
        <div class="span4">
            <h3><?php 
echo t('Column Order');
?>
</h3>
            <ul id="remo-composer-list-attributes-sortable" class="ccm-search-sortable-column-wrapper">
                <?php 
if (is_array($selectedColumns) && !empty($selectedColumns)) {
    foreach ($selectedColumns as $selectedColumn) {
        ?>
                        <li id="sort_<?php 
        echo $selectedColumn;
        ?>
">
                            <?php 
        echo substr($selectedColumn, 0, 2) == 'ak' ? CollectionAttributeKey::getByHandle(substr($selectedColumn, 3))->getAttributeKeyName() : $standardProperties[substr($selectedColumn, 3)];
        ?>
                        </li>
                        <?php 
    }
}
?>
            </ul>
        </div>
    </form>
</div>

<div class="dialog-buttons">
    <input type="button" id="remo-composer-list-save" class="btn primary" value="<?php 
echo t('Save');
?>
Exemple #26
0
 private function setupDashboardIcons($iconArray)
 {
     $cak = CollectionAttributeKey::getByHandle('icon_dashboard');
     if (is_object($cak)) {
         foreach ($iconArray as $path => $icon) {
             $sp = Page::getByPath($path);
             if (is_object($sp) && !$sp->isError()) {
                 $sp->setAttribute('icon_dashboard', $icon);
             }
         }
     }
 }
Exemple #27
0
 public function importComposerSettings(SimpleXMLElement $sx)
 {
     $db = Loader::db();
     if ($sx['method'] == 'PAGE_TYPE') {
         $ctID = ContentImporter::getValue($sx['pagetype']);
         $cta = CollectionType::getByID($ctID);
         $this->saveComposerPublishTargetPageType($cta);
     } else {
         if ($sx['method'] == 'PARENT') {
             $cID = ContentImporter::getValue($sx['parent']);
             $c = Page::getByID($cID);
             $this->saveComposerPublishTargetPage($c);
         } else {
             $this->saveComposerPublishTargetAll();
         }
     }
     if (isset($sx->items)) {
         foreach ($sx->items->children() as $node) {
             $displayOrder = $db->GetOne('select max(displayOrder) as displayOrder from ComposerContentLayout where ctID = ?', array($this->ctID));
             if ($displayOrder !== false) {
                 if ($displayOrder > 0) {
                     $displayOrder++;
                 } else {
                     $displayOrder = 1;
                 }
             } else {
                 $displayOrder = 0;
             }
             if ($node->getName() == 'attributekey') {
                 $ak = CollectionAttributeKey::getByHandle((string) $node['handle']);
                 $v = array($ak->getAttributeKeyID(), $displayOrder, $this->ctID);
                 $db->Execute('insert into ComposerContentLayout (akID, displayOrder, ctID) values (?, ?, ?)', $v);
             }
             if ($node->getName() == 'block') {
                 $mcID = $this->getMasterCollectionID();
                 $bID = $db->GetOne('select Blocks.bID from CollectionVersionBlocks inner join Blocks on CollectionVersionBlocks.bID = Blocks.bID where cID = ? and Blocks.bName = ?', array($mcID, (string) $node['name']));
                 $v = array($bID, $displayOrder, (string) $node['composer-template'], $this->ctID);
                 $db->Execute('insert into ComposerContentLayout (bID, displayOrder, ccFilename, ctID) values (?, ?, ?, ?)', $v);
             }
         }
     }
 }
Exemple #28
0
	public function getAverageChildRating($cItem, $akHandle) {
		$cID = (is_object($cItem)) ? $cItem->getCollectionID() : $cItem;
		$db = Loader::db();
		Loader::model('attribute/categories/collection');
		$ak = CollectionAttributeKey::getByHandle('rating');
		if (is_object($ak)) {
			$val = $db->GetOne('select avg(ak_' . $akHandle . ') from CollectionSearchIndexAttributes c inner join Pages p on p.cID = c.cID where p.cParentID = ?', array($cID));
			return $val;
		}		
	}
Exemple #29
0
 function getPages($query = null)
 {
     Loader::model('page_list');
     $db = Loader::db();
     $bID = $this->bID;
     if ($this->bID) {
         $q = "select num, cParentID, cThis, orderBy, ctID, displayAliases, rss from btEasyNewsList where bID = '{$bID}'";
         $r = $db->query($q);
         if ($r) {
             $row = $r->fetchRow();
         }
     } else {
         $row['num'] = $this->num;
         $row['cParentID'] = $this->cParentID;
         $row['cThis'] = $this->cThis;
         $row['orderBy'] = $this->orderBy;
         $row['ctID'] = $this->ctID;
         $row['rss'] = $this->rss;
     }
     $pl = new PageList();
     $pl->setNameSpace('b' . $this->bID);
     $cArray = array();
     switch ($row['orderBy']) {
         case 'public_desc':
             $pl->sortBy('cvDatePublic', 'desc');
             break;
         case 'public_asc':
             $pl->sortBy('cvDatePublic', 'asc');
             break;
         case 'display_asc':
             $pl->sortByDisplayOrder();
             break;
         case 'display_desc':
             $pl->sortByDisplayOrderDescending();
             break;
         case 'chrono_asc':
             $pl->sortByPublicDate();
             break;
         case 'alpha_asc':
             $pl->sortByName();
             break;
         case 'alpha_desc':
             $pl->sortByNameDescending();
             break;
         default:
             $pl->sortByPublicDateDescending();
             break;
     }
     $num = (int) $row['num'];
     if ($num > 0) {
         $pl->setItemsPerPage($num);
     }
     $c = Page::getCurrentPage();
     if (is_object($c)) {
         $this->cID = $c->getCollectionID();
     }
     $cParentID = $row['cThis'] ? $this->cID : $row['cParentID'];
     Loader::model('attribute/categories/collection');
     if ($this->displayFeaturedOnly == 1) {
         $cak = CollectionAttributeKey::getByHandle('is_featured');
         if (is_object($cak)) {
             $pl->filterByIsFeatured(1);
         }
     }
     if (!$row['displayAliases']) {
         $pl->filterByIsAlias(0);
     }
     $pl->filter('cvName', '', '!=');
     if ($row['ctID']) {
         $pl->filterByCollectionTypeID($row['ctID']);
     }
     $columns = $db->MetaColumns(CollectionAttributeKey::getIndexedSearchTable());
     if (isset($columns['AK_EXCLUDE_PAGE_LIST'])) {
         $pl->filter(false, '(ak_exclude_page_list = 0 or ak_exclude_page_list is null)');
     }
     if (intval($row['cParentID']) != 0) {
         $pl->filterByParentID($cParentID);
     }
     //Publish Date Filter
     $dt = Loader::helper('date');
     $pl->filter('cvDatePublic', $dt->getLocalDateTime(), '<');
     if ($num > 0) {
         $pages = $pl->getPage();
     } else {
         $pages = $pl->get();
     }
     $this->set('pl', $pl);
     return $pages;
 }
 public function getPageList()
 {
     Loader::model('page_list');
     $db = Loader::db();
     $bID = $this->bID;
     if ($this->bID) {
         $q = 'select num, cParentID, cThis, orderBy, ctID, displayAliases, rss from btPageList where bID = \'' . $bID . '\'';
         $r = $db->query($q);
         if ($r) {
             $row = $r->fetchRow();
         }
     } else {
         $row['num'] = $this->num;
         $row['cParentID'] = $this->cParentID;
         $row['cThis'] = $this->cThis;
         $row['orderBy'] = $this->orderBy;
         $row['ctID'] = $this->ctID;
         $row['rss'] = $this->rss;
         $row['displayAliases'] = $this->displayAliases;
     }
     $pl = new PageList();
     $pl->setNameSpace('b' . $this->bID);
     $cArray = array();
     switch ($row['orderBy']) {
         case 'display_asc':
             $pl->sortByDisplayOrder();
             break;
         case 'display_desc':
             $pl->sortByDisplayOrderDescending();
             break;
         case 'chrono_asc':
             $pl->sortByPublicDate();
             break;
         case 'alpha_asc':
             $pl->sortByName();
             break;
         case 'alpha_desc':
             $pl->sortByNameDescending();
             break;
         case 'random':
             $pl->sortBy('RAND()');
             break;
         default:
             $pl->sortByPublicDateDescending();
             break;
     }
     $num = (int) $row['num'];
     $pl->setItemsPerPage($num);
     $c = Page::getCurrentPage();
     if (is_object($c)) {
         $this->cID = $c->getCollectionID();
     }
     Loader::model('attribute/categories/collection');
     if ((int) $this->displayFeaturedOnly === 1) {
         $cak = CollectionAttributeKey::getByHandle('is_featured');
         if (is_object($cak)) {
             $pl->filterByIsFeatured(1);
         }
     }
     if (!$row['displayAliases']) {
         $pl->filterByIsAlias(0);
     }
     $pl->filter('cvName', '', '!=');
     if ($row['ctID']) {
         $pl->filterByCollectionTypeID($row['ctID']);
     }
     $columns = $db->MetaColumns(CollectionAttributeKey::getIndexedSearchTable());
     if (isset($columns['AK_EXCLUDE_PAGE_LIST'])) {
         $pl->filter(false, '(ak_exclude_page_list = 0 or ak_exclude_page_list is null)');
     }
     if (intval($row['cParentID']) != 0) {
         $cParentID = $row['cThis'] ? $this->cID : $row['cParentID'];
         if ($this->includeAllDescendents) {
             $pl->filterByPath(Page::getByID($cParentID)->getCollectionPath());
         } else {
             $pl->filterByParentID($cParentID);
         }
     }
     return $pl;
 }