Exemple #1
0
 /**
  * 
  */
 function setup()
 {
     // set wikilist
     require_once WIKI_CLASSES . 'Wiki.php';
     $wikipage = new Wiki($this->db);
     $this->wikilist = $wikipage->getWikis();
 }
Exemple #2
0
 /**
  * Loads list of all SiteMatrix wikis
  *
  * @static
  * @access public
  * @param  Wiki &$wikiClass The Wiki class object
  * @return array List of all wikis
  * @throws AssertFailure
  * @throws DependencyError
  * @throws LoggedOut
  * @throws MWAPIError
  */
 public static function load(Wiki &$wikiClass)
 {
     if (!array_key_exists('SiteMatrix', $wikiClass->get_extensions())) {
         throw new DependencyError("SiteMatrix");
     }
     $SMres = $wikiClass->apiQuery(array('action' => 'sitematrix'));
     $wikis = $SMres['sitematrix'];
     //return $wikis;
     $retarray = array('raw' => $wikis, 'urls' => array(), 'langs' => array(), 'names' => array(), 'privates' => array());
     foreach ($wikis as $site) {
         if (is_array($site)) {
             if (isset($site['site'])) {
                 $retarray['langs'][] = $site['code'];
                 $retarray['names'][$site['code']] = $site['name'];
                 foreach ($site['site'] as $site2) {
                     $retarray['urls'][] = $site2['url'];
                     if (isset($site2['private'])) {
                         $retarray['privates'][] = $site2;
                     }
                 }
             } else {
                 foreach ($site as $site2) {
                     $sites2['urls'][] = $site2['url'];
                     if (isset($site2['private'])) {
                         $retarray['privates'][] = $site2;
                     }
                 }
             }
         }
     }
     return $retarray;
 }
Exemple #3
0
 /**
  * @param Wiki $wikiClass
  * @throws DependencyError
  */
 function __construct(Wiki &$wikiClass)
 {
     if (!array_key_exists('FlaggedRevs', $wikiClass->get_extensions())) {
         throw new DependencyError("FlaggedRevs", "http://www.mediawiki.org/wiki/Extension:FlaggedRevs");
     }
     $this->wiki = $wikiClass;
 }
Exemple #4
0
 public function __construct(Wiki &$wikiClass, $repo)
 {
     $this->wiki = $wikiClass;
     $this->repo = $repo;
     if (!array_key_exists('CodeReview', $wikiClass->get_extensions())) {
         throw new DependencyError("CodeReview", "http://www.mediawiki.org/wiki/Extension:CodeReview");
     }
 }
Exemple #5
0
 /**
  * Load a Wiki
  * @param int wikiId ID of the Wiki
  * @return Wiki the loaded Wiki
  */
 public function loadWiki($wikiId)
 {
     $wiki = new Wiki($this->con, $this->config);
     $wiki->load($wikiId);
     if ($wiki->hasError()) {
         $this->setError($wiki->error, $wiki->errno);
     }
     return $wiki;
 }
Exemple #6
0
 /**
  * testFindByProjectId method
  *
  * @return void
  */
 public function testFindByProjectId()
 {
     $data = $this->Wiki->findByProjectId(1);
     $this->assertEqual($data['Wiki']['id'], 1);
     foreach ($data['WikiPage'] as $row) {
         $this->assertEqual($row['wiki_id'], 1);
     }
     //$this->assertEqual($data['WikiPage'][1]['title'], "日本語ページ");
 }
    /**
     * Load a Wiki
     * @param int wikiId ID of the Wiki
     * @return Wiki the loaded Wiki
     */
    function loadWiki($wikiId) {
        $wiki = new Wiki();
        
        if ($wiki->hasError()) {
        	$this->setError($wiki->error);
        }
        
        $wiki->load($wikiId);

        return $wiki;
    }
Exemple #8
0
 /**
  * Parses wikitext and returns parser output. Shortcut for Wiki::parse
  *
  * @param string $summary Summary to parse. Default null.
  * @param string $id Parse the content of this revision
  * @param array $prop Properties to retrieve. array( 'text', 'langlinks', 'categories', 'links', 'templates', 'images', 'externallinks', 'sections', 'revid', 'displaytitle', 'headitems', 'headhtml', 'iwlinks', 'wikitext', 'properties' )
  * @param string $uselang Code of the language to use in interface messages, etc. (where applicable). Default 'en'.
  * @param string $section Only retrieve the content of this section number.  Default null.
  * @return array
  */
 public function parse($summary = null, $id = null, $prop = null, $uselang = 'en', $section = null)
 {
     if ($prop === null) {
         $prop = array('text', 'langlinks', 'categories', 'links', 'templates', 'images', 'externallinks', 'sections', 'revid', 'displaytitle', 'headitems', 'headhtml', 'iwlinks', 'wikitext', 'properties');
     }
     return $this->wiki->parse(null, null, $summary, false, false, $prop, $uselang, $this->title, $id, null, false, $section);
 }
Exemple #9
0
 /**
  * Gets the single instance of the class
  *
  * @since 1.2.5
  * @access public
  */
 public static function get_instance()
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new Wiki();
     }
     return self::$_instance;
 }
 /**
  * Return manager instance
  *
  * @access protected
  * @param void
  * @return ProjectLinks 
  */
 function manager()
 {
     if (!instance_of($this->manager, 'Wiki')) {
         $this->manager = Wiki::instance();
     }
     return $this->manager;
 }
Exemple #11
0
 /**
  * Returns a list of all filters
  *
  * @access public
  * @param int $start Filter ID to start at. Default null
  * @param int $end Filter ID to end at. Default null
  * @param string $dir Direction to list. Default newer
  * @param bool $enabled Only list enabled filters. true => only enabled, false => only disabled, null => all
  * @param bool $deleted Only list deleted filters. true => only deleted, false => only non-deleted, null => all
  * @param bool $private Only list private filters. true => only private, false => only non-private, null => all
  * @param int $limit Number of filters to get. Default null
  * @param array $prop Properties to retrieve. Default array( 'id', 'description', 'pattern', 'actions', 'hits', 'comments', 'lasteditor', 'lastedittime', 'status', 'private' )
  * @return array
  */
 public function abusefilters($start = null, $end = null, $dir = 'newer', $enabled = null, $deleted = false, $private = null, $limit = null, $prop = array('id', 'description', 'pattern', 'actions', 'hits', 'comments', 'lasteditor', 'lastedittime', 'status', 'private'))
 {
     $tArray = array('prop' => $prop, '_code' => 'abf', 'abfdir' => $dir, '_limit' => $limit, 'abfshow' => array(), 'list' => 'abusefilters');
     if (!is_null($enabled)) {
         if ($enabled) {
             $tArray['abfshow'][] = 'enabled';
         } else {
             $tArray['abfshow'][] = '!enabled';
         }
     }
     if (!is_null($deleted)) {
         if ($deleted) {
             $tArray['abfshow'][] = 'deleted';
         } else {
             $tArray['abfshow'][] = '!deleted';
         }
     }
     if (!is_null($private)) {
         if ($private) {
             $tArray['abfshow'][] = 'private';
         } else {
             $tArray['abfshow'][] = '!private';
         }
     }
     $tArray['abfshow'] = implode('|', $tArray['abfshow']);
     if (!is_null($start)) {
         $tArray['abfstartid'] = $start;
     }
     if (!is_null($end)) {
         $tArray['abfendid'] = $end;
     }
     pecho("Getting abuse filter list...\n\n", PECHO_NORMAL);
     return $this->wiki->listHandler($tArray);
 }
Exemple #12
0
function wiki_replace_link_callback($matches)
{
    if (count($matches) < 2) {
        return null;
    }
    if ($matches[1] == 'wiki') {
        $rev = Revisions::instance()->getTableName(true);
        $page = Wiki::instance()->getTableName(true);
        $where1 = 'WHERE page_id = ' . $matches[2] . ' AND project_id = ' . active_project()->getId();
        $where2 = 'WHERE id = ' . $matches[2] . ' AND project_id = ' . active_project()->getId();
        $sql = "SELECT page_id, name FROM {$rev} {$where1} ";
        $sql .= "AND revision = ( select revision from {$page} {$where2} )";
        //echo $sql;
        $row = DB::executeOne($sql);
        if (!count($row)) {
            return null;
        }
        $url = get_url($matches[1], 'view', array('id' => $matches[2]));
        $url = str_replace('&amp;', '&', $url);
        return '"' . $row['name'] . '(' . $row['page_id'] . ')":' . $url;
    }
    $user = Users::instance()->getTableName(true);
    $where1 = 'WHERE id = ' . $matches[2];
    $sql = "SELECT id, display_name FROM {$user} {$where1} ";
    echo $sql;
    $row = DB::executeOne($sql);
    if (!count($row)) {
        return null;
    }
    $url = get_url($matches[1], 'card', array('id' => $matches[2]));
    $url = str_replace('&amp;', '&', $url);
    return '"' . $row['display_name'] . '(' . $row['id'] . ')":' . $url;
}
Exemple #13
0
 public function helpAction()
 {
     $uri = $this->getRequest()->getParam('uri');
     $ns = new Zend_Session_Namespace();
     if (!empty($uri)) {
         $uri = Shineisp_Commons_UrlRewrites::format($uri);
         $data = $this->wiki->getPostbyUri($uri, "w.wiki_id, w.subject as subject, w.views as views, w.creationdate as creationdate, w.content as content, w.metakeywords as metakeywords, w.metadescription as metadescription, wc.category_id as category_id, wc.category as category");
         if (isset($data[0])) {
             // Set the Metatag information
             $this->view->headTitle(" | " . $data[0]['subject']);
             if (!empty($data[0]['metakeywords'])) {
                 $this->view->headMeta()->setName('keywords', $data[0]['metakeywords']);
             }
             if (!empty($data[0]['metadescription'])) {
                 $this->view->headMeta()->setName('description', $data[0]['metadescription']);
             }
             // Getting the Products
             $products = Wikilinks::getProductsAttached($data[0]['wiki_id'], $ns->langid);
             if (count($products) > 0) {
                 $this->view->placeholder("right")->append($this->view->partial('wiki/products_reference.phtml', array('products' => $products)));
                 $this->getHelper('layout')->setLayout('2columns-right');
             }
             // Update the counter
             Wiki::update_views($data[0]['wiki_id']);
             $data[0]['content'] = Shineisp_Commons_Contents::chkModule($data[0]['content']);
             $data[0]['content'] = Shineisp_Commons_Contents::chkCmsBlocks($data[0]['content'], $ns->lang);
             // Send the content to the page
             $this->view->headertitle = $this->translator->translate('Wiki page');
             $this->view->post = $data[0];
         }
     }
 }
Exemple #14
0
/**
 * Renders select page box
 *
 * @param string $name Name to use in HTML for the select
 * @param Project $project
 * @param integer $selected Id of selected element
 * @param array $attributes Array of additional attributes
 * @return string
 */
function wiki_select_page($name, $project, $selected = null, $attributes = null)
{
    if (is_array($attributes)) {
        if (!isset($attributes['class'])) {
            $attributes['class'] = 'wiki_select_page';
        }
    } else {
        $attributes = array('class' => 'wiki_select_page');
    }
    // if
    $options = array(option_tag(lang('none'), 0));
    if (logged_user()->isAdministrator()) {
        $pages = Wiki::getAllProjectPages($project);
    } else {
        $pages = Wiki::getAllProjectPages($project);
    }
    if (is_array($pages)) {
        foreach ($pages as $page) {
            $option_attributes = $page->getId() == $selected ? array('selected' => 'selected') : null;
            $options[] = option_tag($page->getObjectName(), $page->getId(), $option_attributes);
        }
        // foreach
    }
    // if
    return select_box($name, $options, $attributes);
}
Exemple #15
0
function create_wiki($gid = false, $wikiName = 'New wiki')
{
    $creatorId = claro_get_current_user_id();
    $tblList = claro_sql_get_course_tbl();
    $config = array();
    $config["tbl_wiki_properties"] = $tblList["wiki_properties"];
    $config["tbl_wiki_pages"] = $tblList["wiki_pages"];
    $config["tbl_wiki_pages_content"] = $tblList["wiki_pages_content"];
    $config["tbl_wiki_acls"] = $tblList["wiki_acls"];
    $con = Claroline::getDatabase();
    $acl = array();
    if ($gid) {
        $acl = WikiAccessControl::defaultGroupWikiACL();
    } else {
        $acl = WikiAccessControl::defaultCourseWikiACL();
    }
    $wiki = new Wiki($con, $config);
    $wiki->setTitle($wikiName);
    $wiki->setDescription('This is a sample wiki');
    $wiki->setACL($acl);
    $wiki->setGroupId($gid);
    $wikiId = $wiki->save();
    $wikiTitle = $wiki->getTitle();
    $mainPageContent = sprintf("This is the main page of the Wiki %s. Click on edit to modify the content.", $wikiTitle);
    $wikiPage = new WikiPage($con, $config, $wikiId);
    $wikiPage->create($creatorId, '__MainPage__', $mainPageContent, date("Y-m-d H:i:s"), true);
}
Exemple #16
0
 /**
  * Get a list of pages for a project
  * 
  * @param mixed $project
  * @return
  */
 function getPagesList(Project $project)
 {
     $sql = 'SELECT p.id, r.name FROM ' . Wiki::instance()->getTableName(true) . ' AS p, ' . Revisions::instance()->getTableName(true) . ' AS r WHERE p.project_id = ' . $project->getId() . ' AND p.id = r.page_id AND r.revision = p.revision AND p.project_sidebar = 0 ORDER BY 2';
     $return = array();
     foreach ((array) DB::executeAll($sql) as $page) {
         $return[] = array('name' => $page['name'], 'view_url' => get_url('wiki', 'view', array('id' => $page['id'])));
     }
     return $return;
 }
 public function actionEdit($id)
 {
     $model = Wiki::model()->findByPk($id);
     if (!$model) {
         $model = new Wiki();
         $model->id = $id;
     }
     if (!empty($_POST['Wiki'])) {
         if (!empty($_POST['Wiki']['text'])) {
             $model->text = $_POST['Wiki']['text'];
             if ($model->save()) {
                 $this->redirect(array('view', 'id' => $id));
             }
         } else {
             Wiki::model()->deleteByPk($id);
         }
     }
     $this->render('edit', array('model' => $model));
 }
Exemple #18
0
 protected function create_display_html(WikiPage $page)
 {
     $owner = $page->get_owner();
     $tfe = new TextFormattingEvent($page->body);
     send_event($tfe);
     global $user;
     $edit = "<table><tr>";
     $edit .= Wiki::can_edit($user, $page) ? "\n\t\t\t\t<td>" . make_form(make_link("wiki_admin/edit")) . "\n\t\t\t\t\t<input type='hidden' name='title' value='" . html_escape($page->title) . "'>\n\t\t\t\t\t<input type='hidden' name='revision' value='" . int_escape($page->revision) . "'>\n\t\t\t\t\t<input type='submit' value='Edit'>\n\t\t\t\t</form></td>\n\t\t\t" : "";
     if ($user->is_admin()) {
         $edit .= "\n\t\t\t\t<td>" . make_form(make_link("wiki_admin/delete_revision")) . "\n\t\t\t\t\t<input type='hidden' name='title' value='" . html_escape($page->title) . "'>\n\t\t\t\t\t<input type='hidden' name='revision' value='" . int_escape($page->revision) . "'>\n\t\t\t\t\t<input type='submit' value='Delete This Version'>\n\t\t\t\t</form></td>\n\t\t\t\t<td>" . make_form(make_link("wiki_admin/delete_all")) . "\n\t\t\t\t\t<input type='hidden' name='title' value='" . html_escape($page->title) . "'>\n\t\t\t\t\t<input type='submit' value='Delete All'>\n\t\t\t\t</form></td>\n\t\t\t";
     }
     $edit .= "</tr></table>";
     return "\n\t\t\t<div class='wiki-page'>\n\t\t\t{$tfe->formatted}\n\t\t\t<hr>\n\t\t\t<p class='wiki-footer'>\n\t\t\t\tRevision {$page->revision}\n\t\t\t\tby <a href='" . make_link("user/{$owner->name}") . "'>{$owner->name}</a>\n\t\t\t\tat {$page->date}\n\t\t\t\t{$edit}\n\t\t\t</p>\n\t\t\t</div>\n\t\t";
 }
Exemple #19
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $user = \lms_steam::get_current_user();
     // Disable caching
     // TODO: Work on cache handling. An enabled cache leads to bugs
     // if used with the wiki.
     \CacheSettings::disable_caching();
     if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
         include "bad_link.php";
         exit;
     }
     if (!$wiki_container instanceof \steam_container) {
         $wiki_doc = $wiki_container;
         $wiki_container = $wiki_doc->get_environment();
         if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
             include "bad_link.php";
             exit;
         }
     }
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $compare = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[1]);
     $to = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[2]);
     $wiki_html_handler = new \lms_wiki($wiki_container);
     //$wiki_html_handler->set_admin_menu( "versions", $wiki_doc );
     $content = \Wiki::getInstance()->loadTemplate("wiki_version_compare.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "wiki_version_compare.template.html" );
     $difftext = wiki_diff_html($to, $compare);
     $content->setVariable("DIFF_TEXT", $difftext);
     $wiki_html_handler->set_main_html($content->get());
     $rootlink = \lms_steam::get_link_to_root($wiki_container);
     WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => PATH_URL . "wiki/versionoverview/" . $wiki_doc->get_id(), "name" => gettext("Version management")), array("link" => "", "name" => gettext("Version compare") . " (" . $compare->get_version() . " " . gettext("to") . " " . $to->get_version() . ")")) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => PATH_URL . "wiki/versionoverview/" . $wiki_doc->get_id() . "/versions/", "name" => gettext("Version management")), array("link" => "", "name" => gettext("Version compare") . " (" . $compare->get_version() . " " . gettext("to") . " " . $to->get_version() . ")")));
     /*$portal->set_page_main(
     		$headline,
     		$wiki_html_handler->get_html()
     		);
     		$portal->show_html();
     		*/
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($wiki_html_handler->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Exemple #20
0
 /**
  * Find the page with the given title
  *
  * @param string $title Title
  * @param array $options Options
  * @return array Page data
  */
 public function find_page($title, $options = array())
 {
     $param = array();
     if ($title === "") {
         $title = $this->field('start_page');
     }
     $title = Wiki::titleize($title);
     $page = $this->WikiPage->find('first', array('conditions' => array('WikiPage.wiki_id' => $this->id, 'WikiPage.title' => $title)));
     if (isset($page['WikiPage']['id'])) {
         $this->WikiPage->id = $page['WikiPage']['id'];
     }
     //    if !page && !(options[:with_redirect] == false)
     //      # search for a redirect
     //      redirect = redirects.find_by_title(title)
     //      page = find_page(redirect.redirects_to, :with_redirect => false) if redirect
     //    end
     return $page;
 }
Exemple #21
0
 public function Show($parameters)
 {
     $view = new Zend_View();
     $view->addScriptPath('../library/Shineisp/Custom/views');
     $limit = 10;
     $id = null;
     $ns = new Zend_Session_Namespace();
     $languageID = Languages::get_language_id($ns->lang);
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     if (!empty($parameters['category']) && is_numeric($parameters['category'])) {
         $id = $parameters['category'];
     }
     if (!empty($parameters['limit']) && is_numeric($parameters['limit'])) {
         $limit = $parameters['limit'];
     }
     // Get the products
     $view->wiki = Wiki::get_items($limit, $id);
     return $view->render('wikilist.phtml');
 }
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'name', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Name'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'uri', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('URI'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'googlecategs', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Google Categories'), 'description' => $translate->_('See at http://support.google.com/merchants/bin/answer.py?hl=it&answer=1705911 for the list of the tassonomy'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'position', array('filters' => array('StringTrim'), 'label' => $translate->_('Position'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('textarea', 'description', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Description'), 'class' => 'col-lg-12 form-control wysiwyg'));
     $this->addElement('textarea', 'keywords', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Keywords'), 'rows' => 5, 'class' => 'col-lg-12'));
     $this->addElement('select', 'parent', array('filters' => array('StringTrim'), 'label' => $translate->_('Parent Category'), 'description' => $translate->_('Select here the parent category.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('parent')->setAllowEmpty(false)->setMultiOptions(ProductsCategories::getList(true));
     $this->addElement('multiselect', 'products', array('label' => $translate->_('Products'), 'description' => $translate->_('Select here the products to add to this category. Use Ctrl button to select more categories.'), 'decorators' => array('Bootstrap'), 'size' => 20, 'class' => 'form-control'));
     $this->getElement('products')->setAllowEmpty(false)->setMultiOptions(Products::getList());
     $this->addElement('textarea', 'blocks', array('filters' => array('StringTrim'), 'label' => $translate->_('Blocks'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12'));
     $this->addElement('checkbox', 'enabled', array('label' => $translate->_('Enabled'), 'decorators' => array('Bootstrap'), 'class' => 'checkbox'));
     $this->addElement('multiselect', 'wikipages', array('label' => 'Wiki Pages', 'decorators' => array('Bootstrap'), 'class' => 'form-control multiselect'));
     $this->getElement('wikipages')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Wiki::getList());
     $this->addElement('submit', 'save', array('required' => false, 'label' => 'Save', 'decorators' => array('Bootstrap'), 'class' => 'btn'));
     $this->addElement('hidden', 'category_id');
 }
Exemple #23
0
 function editWikiSubmit($p)
 {
     if (!isset($p['wiki_name'])) {
         return false;
     }
     $session = SessionHandler::getInstance();
     $text = trim($p['text']);
     $name = normalizeString($p['wiki_name'], array("\t"));
     $wiki = Wiki::getByName($name);
     // abort if we are trying to save a exact copy as the last one
     if ($wiki->text == $text) {
         return false;
     }
     if ($wiki->id) {
         $rev = new Revision();
         $rev->type = WIKI;
         $rev->owner = $wiki->id;
         $rev->value = $wiki->text;
         $rev->time_created = $wiki->time_edited;
         $rev->created_by = $wiki->edited_by;
         $rev->event = EVENT_TEXT_CHANGED;
         $rev->id = $rev->store();
         $wiki->text = $p['text'];
         $wiki->edited_by = $session->id;
         $wiki->time_edited = sql_datetime(time());
         $wiki->revision++;
         $wiki->store();
         redir('u/wiki/show/' . $wiki->name);
     }
     $wiki->name = $name;
     $wiki->text = $p['text'];
     $wiki->edited_by = $session->id;
     $wiki->time_edited = sql_datetime(time());
     $wiki->store();
     redir('u/wiki/show/' . $wiki->name);
 }
Exemple #24
0
<br/>
Etape 12/16 : Insertion des localites&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: <a href="tools.php?p=cartowiki&action=insertion&file=x9">Go !</a>&nbsp;
<br/>
Etape 13/16 : Insertion des localites&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: <a href="tools.php?p=cartowiki&action=insertion&file=x10">Go !</a>&nbsp;
<br/>
Etape 14/16 : Insertion des localites&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: <a href="tools.php?p=cartowiki&action=insertion&file=x11">Go !</a>&nbsp;
<br/>
Etape 15/16 : Insertion des localites&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: <a href="tools.php?p=cartowiki&action=insertion&file=x12">Go !</a>&nbsp;
<br/>
Etape 16/16 : Insertion des localites&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: <a href="tools.php?p=cartowiki&action=insertion&file=x13">Go !</a>&nbsp;
<br/>
<br/>
Mise à jour&nbsp;: <a href="tools.php?p=cartowiki&action=synchronisation">Go !</a>&nbsp;
');
// Utilisation d'un objet Wiki minimaliste pour acces à la base de donnée
$wiki = new Wiki($wakkaConfig);
if (!empty($_REQUEST['action'])) {
    switch ($_REQUEST['action']) {
        case 'suppression':
            $sql_contenu = PMA_readFile('tools/cartowiki/locations/' . $_REQUEST['file']);
            $tab_requete_sql = array();
            PMA_splitSqlFile($tab_requete_sql, $sql_contenu, '');
            foreach ($tab_requete_sql as $value) {
                $table_nom = '';
                if (!empty($value['table_nom'])) {
                    $table_nom = $value['table_nom'];
                }
                $requete_type = '';
                if (!empty($value['type'])) {
                    $requete_type = $value['type'];
                }
 /**
  *
  */
 function setWikiPerms()
 {
     global $feedback;
     $w = new Wiki($this->gid);
     if ($_POST['reset']) {
         $ret = $w->resetPermissions();
     } else {
         $ret = $w->setPermissions($_POST['ugroups']);
     }
     if (!$ret) {
         exit_error($GLOBALS['Language']->getText('global', 'error'), $GLOBALS['Language']->getText('wiki_actions_wikiserviceadmin', 'update_perm_err', array($feedback)));
     }
 }
Exemple #26
0
<?php

require_once 'includes/class_Wiki.inc.php';
if (!isset($_POST['search'])) {
    header("Location: index.php");
    exit;
}
define('TITLE', 'Search');
require_once 'header.php';
$wikiDocuments = Wiki::search($_POST['search']);
if (sizeOf($wikiDocuments) == 0) {
    ?>
<h2>No Results Found</h2>
<p>
	<form action="addPage.php" method="POST">
	<input type="hidden" name="title" value="<?php 
    echo htmlentities($_POST['search']);
    ?>
">
	Would you like to <input type="submit" value="create"> a page here?
	</form>
</p>
<?php 
} else {
    ?>
<ul>
<?php 
    foreach ($wikiDocuments as $wikiDocument) {
        ?>
	<li><a href="viewPage.php?page=<?php 
        echo $wikiDocument->getId();
Exemple #27
0
<?php

if (!isset($_GET['id']) || !is_number($_GET['id'])) {
    error(404);
}
$ArticleID = (int) $_GET['id'];
$Latest = Wiki::get_article($ArticleID);
list($Revision, $Title, $Body, $Read, $Edit, $Date, $AuthorID, $AuthorName) = array_shift($Latest);
if ($Read > $LoggedUser['EffectiveClass']) {
    error(404);
}
if ($Edit > $LoggedUser['EffectiveClass']) {
    error(403);
}
View::show_header("Revisions of " . $Title);
?>
<div class="thin">
	<div class="header">
		<h2>Revision history for <a href="wiki.php?action=article&amp;id=<?php 
echo $ArticleID;
?>
"><?php 
echo $Title;
?>
</a></h2>
	</div>
	<form action="wiki.php" method="get">
		<input type="hidden" name="action" id="action" value="compare" />
		<input type="hidden" name="id" id="id" value="<?php 
echo $ArticleID;
?>
Exemple #28
0
<?php

// index.php
// Administration de l'extension : initialisations (tables, fichier de configuration) , information etc. : toutes
// opérations réservées à l'administrateur technique de Wikini.
// Vérification de sécurité
if (!defined("TOOLS_MANAGER")) {
    die("acc&egrave;s direct interdit");
}
// Affichage au moyen de la méthode statique buffer::str :
buffer::str('Parametrage de l\'extension Hello ...' . '<br />');
// Utilisation d'un objet Wiki pour acces à la base de donnée
$wiki = new Wiki($wakkaConfig);
buffer::str('Utilisateurs enregistrés : ' . '<br />');
$last_users = $wiki->LoadAll("select name, signuptime from " . $wiki->config["table_prefix"] . "users order by signuptime desc limit 10");
foreach ($last_users as $user) {
    buffer::str($user["name"] . " . . . " . $user["signuptime"] . "<br />\n");
}
 public function testSluggableChildTemplate()
 {
     $this->conn->clear();
     $wiki = new Wiki();
     $wiki->state(Doctrine_Record::STATE_TDIRTY);
     $wiki->save();
     $fi = $wiki->Translation['FI'];
     $fi->title = 'This is the title';
     $fi->content = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla sed.";
     $fi->save();
     $this->assertEqual($fi->slug, 'this-is-the-title');
 }
 } else {
     if ($args['mode'] == 'matrixif' || $args['mode'] == 'matrixis' || $args['mode'] == 'matrixts') {
         $output = $texFolderMatrix . $args['mode'] . ".tex";
         if ($args['output'] != '') {
             $output = $texFolderMatrix . $args['output'] . ".tex";
         }
         var_dump($output);
         $ilist = array();
         $tlist = array();
         if ($args['ilist'] != '') {
             $ilist = file(realpath($args['ilist']), FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
         }
         if ($args['tlist'] != '') {
             $tlist = file(realpath($args['tlist']), FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
         }
         $wiki = new Wiki();
         $features = $wiki->getFeaturePages();
         $catImpl = new CategoryPage("101implementation");
         $impl = $catImpl->getImplementations();
         $technologies = $wiki->getTechnologyPages();
         if ($args['mode'] == 'matrixif') {
             buildImplementationFeaturesMatrix($impl, $features, $output, $ilist);
         } else {
             if ($args['mode'] == 'matrixis') {
                 buildImplSpacesMatrix($impl, $ilist, $output);
             } else {
                 if ($args['mode'] == 'matrixts') {
                     buildTechnicalSpacesMatrix($technologies, $tlist, $output);
                 }
             }
         }