示例#1
0
    public function updateConfig($args)
    {
        // Security check
        if (!SecurityUtil::checkPermission('SiriusXtecAuth::', '::', ACCESS_ADMIN)) {
            return LogUtil::registerPermissionError();
        }
        $items = array( 'ldap_active' => FormUtil::getPassedValue('ldap_active', false, 'POST')?true:false,
                'users_creation' => FormUtil::getPassedValue('users_creation', false, 'POST')?true:false,
                'new_users_activation' => FormUtil::getPassedValue('new_users_activation', false, 'POST')?true:false,
                'iw_write' => FormUtil::getPassedValue('iw_write', false, 'POST')?true:false,
                'iw_lastnames' => FormUtil::getPassedValue('iw_lastnames', false, 'POST')?true:false,
                'new_users_groups' => FormUtil::getPassedValue('new_users_groups', array(), 'POST'),
                'ldap_server' => FormUtil::getPassedValue('ldap_server', false, 'POST'),
                'ldap_basedn' => FormUtil::getPassedValue('ldap_basedn', false, 'POST'),
                'ldap_searchattr' => FormUtil::getPassedValue('ldap_searchattr', false, 'POST'),
                'loginXtecApps' => FormUtil::getPassedValue('loginXtecApps', false, 'POST'),
                'logoutXtecApps' => FormUtil::getPassedValue('logoutXtecApps', false, 'POST'),
                'gtafProtocol' => FormUtil::getPassedValue('gtafProtocol', false, 'POST'),
                'e13Protocol' => FormUtil::getPassedValue('e13Protocol', false, 'POST'),
                'gtafURL' => FormUtil::getPassedValue('gtafURL', false, 'POST'),
                'e13URL' => FormUtil::getPassedValue('e13URL', false, 'POST'),
				'loginTime' => FormUtil::getPassedValue('loginTime', false, 'POST'),
				'logoutTime' => FormUtil::getPassedValue('logoutTime', false, 'POST'));
        ModUtil::setVars($this->name,$items);
        LogUtil::registerStatus($this->__('S\'ha actualitzat la configuració del mòdul.'));
        return System::redirect(ModUtil::url('SiriusXtecAuth', 'admin', 'main'));
    }
示例#2
0
    /**
     * initialise the Feeds module
     */
    public function install()
    {
        // create table
        if (!DBUtil::createTable('feeds')) {
            return false;
        }

        // create cache directory
        CacheUtil::createLocalDir('feeds');

        // set up config variables
        $modvars = array(
                'enablecategorization' => true,
                'bold' => false,
                'openinnewwindow' => false,
                'itemsperpage' => 10,
                'cachedirectory' => 'feeds',
                'cacheinterval' => 180,
                'multifeedlimit' => 0,
                'usingcronjob' => 0,
                'key' => md5(time())
        );

        // create our default category
        if (!$this->_feeds_createdefaultcategory()) {
            LogUtil::registerStatus(__('Warning! Could not create the default Feeds category tree. If you want to use categorisation with Feeds, register at least one property for the module in the Category Registry.'));
            $modvars['enablecategorization'] = false;
        }

        // set up module variables
        ModUtil::setVars('Feeds', $modvars);

        // initialisation successful
        return true;
    }
示例#3
0
 /**
  * Search
  *
  * do the actual search and display the results
  *
  * @return output the search results
  */
 public function search($args)
 {
     if (!SecurityUtil::checkPermission('EZComments::', '::', ACCESS_READ)) {
         return true;
     }
     $minlen = 3;
     $maxlen = 30;
     if (strlen($args['q']) < $minlen || strlen($args['q']) > $maxlen) {
         return LogUtil::registerStatus($this->__f('The comments can only be searched for words that are longer than %1$s and less than %2$s characters!', array($minlen, $maxlen)));
     }
     ModUtil::dbInfoLoad('Search');
     $tables = DBUtil::getTables();
     // ezcomments tables
     $ezcommentstable = $tables['EZComments'];
     $ezcommentscolumn = $tables['EZComments_column'];
     // our own tables
     $searchTable = $tables['search_result'];
     $searchColumn = $tables['search_result_column'];
     // where
     $where = Search_Api_User::construct_where($args, array($ezcommentscolumn['subject'], $ezcommentscolumn['comment']));
     $where .= " AND " . $ezcommentscolumn['url'] . " != ''";
     $sessionId = session_id();
     $insertSql = "INSERT INTO {$searchTable}\n              ({$searchColumn['title']},\n               {$searchColumn['text']},\n               {$searchColumn['extra']},\n               {$searchColumn['module']},\n               {$searchColumn['created']},\n               {$searchColumn['session']})\n            VALUES\n            ";
     $comments = DBUtil::selectObjectArray('EZComments', $where);
     foreach ($comments as $comment) {
         $sql = $insertSql . '(' . '\'' . DataUtil::formatForStore($comment['subject']) . '\', ' . '\'' . DataUtil::formatForStore($comment['comment']) . '\', ' . '\'' . DataUtil::formatForStore($comment['url']) . '\', ' . '\'' . 'EZComments' . '\', ' . '\'' . DataUtil::formatForStore($comment['date']) . '\', ' . '\'' . DataUtil::formatForStore($sessionId) . '\')';
         $insertResult = DBUtil::executeSQL($sql);
         if (!$insertResult) {
             return LogUtil::registerError($this->__('Error! Could not load items.'));
         }
     }
     return true;
 }
示例#4
0
    public function handleCommand(Zikula_Form_View $view, &$args)
    {
        if ($args['commandName'] == 'save') {
            if (!$this->view->isValid()) {
                return false;
            }

            $data = $this->view->getValues();

            if (!ModUtil::setVars('Content', $data['config'])) {
                return $this->view->setErrorMsg($this->__('Failed to set configuration variables'));
            }
            if ($data['config']['categoryUsage'] < 4) {
                // load the category registry util
                $mainCategory = CategoryRegistryUtil::getRegisteredModuleCategory('Content', 'content_page', $data['config']['categoryPropPrimary']);
                if (!$mainCategory) {
                    return LogUtil::registerError($this->__('Main category property does not exist.'));
                }
                if ($data['config']['categoryUsage'] < 3) {
                    $secondCategory = CategoryRegistryUtil::getRegisteredModuleCategory('Content', 'content_page', $data['config']['categoryPropSecondary']);
                    if (!$secondCategory) {
                        return LogUtil::registerError($this->__('Second category property does not exist.'));
                    }
                }
            }
            LogUtil::registerStatus($this->__('Done! Saved module configuration.'));
        } else if ($args['commandName'] == 'cancel') {
        }

        $url = ModUtil::url('Content', 'admin', 'main');

        return $this->view->redirect($url);
    }
示例#5
0
/**
 * Do the migration
 * 
 * With this function, the actual migration is done.
 * 
 * @return   boolean   true on sucessful migration, false else
 * @since    0.2
 */
function EZComments_migrateapi_pnFlashGames()
{
    // Security check
    if (!SecurityUtil::checkPermission('EZComments::', '::', ACCESS_ADMIN)) {
        return LogUtil::registerError('pnFlashGames comments migration: Not Admin');
    }
    // Get datbase setup
    $tables = DBUtil::getTables();
    $Commentstable = $tables['pnFlashGames_comments'];
    $Commentscolumn = $tables['pnFlashGames_comments_column'];
    $Usertable = $tables['users'];
    $Usercolumn = $tables['users_column'];
    $sql = "SELECT {$Commentscolumn['gid']},\n                   {$Commentscolumn['uname']},\n                   {$Commentscolumn['date']},\n                   {$Commentscolumn['comment']},\n                   {$Usercolumn['uid']}\n             FROM  {$Commentstable}\n         LEFT JOIN {$Usertable}\n                ON {$Commentscolumn['uname']} = {$Usercolumn['uname']}";
    $result = DBUtil::executeSQL($sql);
    if ($result == false) {
        return LogUtil::registerError('pnFlashGames migration: DB Error: ' . $sql . ' -- ' . mysql_error());
    }
    // loop through the old comments and insert them one by one into the DB
    $items = DBUtil::marshalObjects($result, array('gid', 'uname', 'date', 'comment', 'uid'));
    foreach ($items as $item) {
        // set the correct user id for anonymous users
        if (empty($item['uid'])) {
            $item['uid'] = 1;
        }
        $id = ModUtil::apiFunc('EZComments', 'user', 'create', array('mod' => 'pnFlashGames', 'objectid' => DataUtil::formatForStore($item['gid']), 'url' => ModUtil::url('pnFlashGames', 'user', 'display', array('id' => $item['gid'])), 'comment' => $item['comment'], 'subject' => '', 'uid' => $item['uid'], 'date' => $item['date']));
        if (!$id) {
            return LogUtil::registerError('pnFlashGames migration: Error creating comment');
        }
    }
    return LogUtil::registerStatus('pnFlashGames migration successful');
}
示例#6
0
 function handleCommand(Zikula_Form_View $view, &$args)
 {
     if ($args['commandName'] == 'cancel') {
         $url = ModUtil::url('Scribite', 'admin', 'main');
         return $view->redirect($url);
     } else {
         if ($args['commandName'] == 'restore') {
             $classname = 'ModulePlugin_Scribite_' . $this->editor . '_Plugin';
             if (method_exists($classname, 'getDefaults')) {
                 $defaults = $classname::getDefaults();
                 if (!empty($defaults)) {
                     ModUtil::setVars("moduleplugin.scribite." . strtolower($this->editor), $defaults);
                     LogUtil::registerStatus('Defaults succesfully restored.');
                 }
             }
             return true;
         }
     }
     // check for valid form
     if (!$view->isValid()) {
         return false;
     }
     $data = $view->getValues();
     ModUtil::setVars("moduleplugin.scribite." . strtolower($this->editor), $data);
     LogUtil::registerStatus($this->__('Done! Module configuration updated.'));
     return true;
 }
示例#7
0
 function delete()
 {
     // security check
     if (!SecurityUtil::checkPermission('AddressBook::', '::', ACCESS_ADMIN)) {
         return LogUtil::registerPermissionError();
     }
     $ot = FormUtil::getPassedValue('ot', 'categories', 'GETPOST');
     $id = (int) FormUtil::getPassedValue('id', 0, 'GETPOST');
     $url = ModUtil::url('AddressBook', 'admin', 'view', array('ot' => $ot));
     $class = 'AddressBook_DBObject_' . ucfirst($ot);
     if (!class_exists($class)) {
         return z_exit(__f('Error! Unable to load class [%s]', $ot));
     }
     $object = new $class();
     $data = $object->get($id);
     if (!$data) {
         LogUtil::registerError(__f('%1$s with ID of %2$s doesn\'\\t seem to exist', array($ot, $id)));
         return System::redirect($url);
     }
     $object->delete();
     if ($ot == "customfield") {
         $sql = "ALTER TABLE addressbook_address DROP adr_custom_" . $id;
         try {
             DBUtil::executeSQL($sql, -1, -1, true, true);
         } catch (Exception $e) {
         }
     }
     LogUtil::registerStatus($this->__('Done! Item deleted.'));
     return System::redirect($url);
 }
示例#8
0
    public function changeGroup($args) {
        $gid = FormUtil::getPassedValue('gid', isset($args['gid']) ? $args['gid'] : null, 'POST');
        $groups = FormUtil::getPassedValue('groups', isset($args['groups']) ? $args['groups'] : null, 'POST');

        // Security check
        if (!SecurityUtil::checkPermission('IWmyrole::', "::", ACCESS_ADMIN)) {
            throw new Zikula_Exception_Forbidden();
        }

        $this->checkCsrfToken();

        $groupsString = '$';
        foreach ($groups as $group) {
            $groupsString .= '$' . $group . '$';
        }

        if ($gid) {
            // Modify the permissions in group_perms
            $changePerms = ModUtil::apiFunc('IWmyrole', 'admin', 'changePermissions',
                            array('gid' => $gid));
            if ($changePerms) {
                //Update module var with new value
                ModUtil::setVar('IWmyrole', 'rolegroup', $gid);
                LogUtil::registerStatus($this->__('The group change has been made.'));
            } else {
                LogUtil::registerError($this->__('The group change has not been made.'));
            }
        }

        $this->setVar('groupsNotChangeable', $groupsString);

        return System::redirect(ModUtil::url('IWmyrole', 'admin', 'main'));
    }
示例#9
0
    /**
     * Update the configuration values
     * @author: Sara Arjona Téllez (sarjona@xtec.cat)
     * @params	The config values from the form
     * @return	Thue if success
     */
    public function confupdate($args) {
        $skins = FormUtil::getPassedValue('skins', isset($args['skins']) ? $args['skins'] : null, 'POST');
        $langs = FormUtil::getPassedValue('langs', isset($args['langs']) ? $args['langs'] : null, 'POST');
        $maxdelivers = FormUtil::getPassedValue('maxdelivers', isset($args['maxdelivers']) ? $args['maxdelivers'] : null, 'POST');
        $basedisturl = FormUtil::getPassedValue('basedisturl', isset($args['basedisturl']) ? $args['basedisturl'] : null, 'POST');

        // Security check
        if (!SecurityUtil::checkPermission('IWqv::', "::", ACCESS_ADMIN)) {
            throw new Zikula_Exception_Forbidden();
        }

        // Confirm authorisation code
        $this->checkCsrfToken();

        if (isset($skins))
            ModUtil::setVar('IWqv', 'skins', $skins);
        if (isset($langs))
            ModUtil::setVar('IWqv', 'langs', $langs);
        if (isset($maxdelivers))
            ModUtil::setVar('IWqv', 'maxdelivers', $maxdelivers);
        if (isset($basedisturl))
            ModUtil::setVar('IWqv', 'basedisturl', $basedisturl);

        LogUtil::registerStatus($this->__f('Done! %1$s updated.', $this->__('settings')));
        return System::redirect(ModUtil::url('IWqv', 'admin', 'main'));
    }
示例#10
0
 public function setDocRoot($value)
 {
     $this->throwForbiddenUnless(SecurityUtil::checkPermission('Llicencies::', '::', ACCESS_ADMIN));
     if (ModUtil::setVar($this->name, 'LlicenciesDocRoot', $value)){
            LogUtil::registerStatus(__('El paràmetre s\'ha actualitzat correctament.'));               
     }
     else
         LogUtil::registerError(__('El paràmetre no s\'ha pogut actualitzar.'));
     return true;
 }
示例#11
0
    public function handleCommand(Zikula_Form_View $view, &$args)
    {
        switch($args['commandName']) {
            case 'cancel':
                break;
            case 'save':
                if (!$view->isValid()) {
                    return false;
                }
                $formValues = $view->getValues();
                $toname = (string)$formValues['toname'];
                $toaddress = (string)$formValues['toaddress'];
                $subject = (string)$formValues['subject'];
                $msgtype = (string)$formValues['msgtype'];
                $textBody = (string)$formValues['mailer_textbody'];
                $htmlBody = (string)$formValues['mailer_body'];

                $html = in_array($msgtype, array('html', 'multipart')) ? true : false;
                if ($html) {
                    $msgBody = $htmlBody;
                    $altBody = $textBody;
                } else {
                    $msgBody = $textBody;
                    $altBody = '';
                }

                // set the email
                $result = ModUtil::apiFunc('Mailer', 'user', 'sendmessage', array(
                    'toname' => $toname,
                    'toaddress' => $toaddress,
                    'subject' => $subject,
                    'body' => $msgBody,
                    'altbody' => $altBody,
                    'html' => $html)
                );

                // check our result and return the correct error code
                if ($result === true) {
                    // Success
                    LogUtil::registerStatus($this->__('Done! Message sent.'));
                } elseif ($result === false) {
                    // Failiure
                    LogUtil::registerError($this->__f('Error! Could not send message. %s', ''));
                } else {
                    // Failiure with error
                    LogUtil::registerError($this->__f('Error! Could not send message. %s', $result));
                }

                break;
        }

        return $view->redirect(ModUtil::url('Mailer', 'admin', 'testconfig'));
    }
示例#12
0
/**
 * Do the migration
 * 
 * With this function, the actual migration is done.
 * 
 * @return   boolean   true on sucessful migration, false else
 * @since    0.2
 */
function EZComments_migrateapi_news()
{
    // Security check
    if (!SecurityUtil::checkPermission('EZComments::', '::', ACCESS_ADMIN)) {
        return LogUtil::registerError('News migration: Not Admin');
    }
    // Get datbase setup
    $tables = DBUtil::getTables();
    $EZCommentstable = $tables['EZComments'];
    $EZCommentscolumn = $tables['EZComments_column'];
    $Commentstable = $tables['comments'];
    $Commentscolumn = $tables['comments_column'];
    if (version_compare(PN_VERSION_NUM, '1', '>=')) {
        EZComments_get76xcolumns_news($Commentstable, $Commentscolumn);
    }
    if (is_null($Commentstable) || is_null($Commentscolumn)) {
        return LogUtil::registerError('News migration: Comments tables not found');
    }
    $Usertable = $tables['users'];
    $Usercolumn = $tables['users_column'];
    $sql = "SELECT {$Commentscolumn['tid']},\n                   {$Commentscolumn['sid']},\n                   {$Commentscolumn['date']}, \n                   {$Usercolumn['uid']},\n                   {$Commentscolumn['comment']},\n                   {$Commentscolumn['subject']},\n                   {$Commentscolumn['pid']}\n              FROM {$Commentstable}\n         LEFT JOIN {$Usertable}\n                ON {$Commentscolumn['name']} = {$Usercolumn['uname']}";
    $result = DBUtil::executeSQL($sql);
    if ($result == false) {
        return LogUtil::registerError('News migration: DB Error');
    }
    // array to rebuild the patents
    $comments = array(0 => array('newid' => -1));
    // loop through the old comments and insert them one by one into the DB
    $items = DBUtil::marshalObjects($result, array('tid', 'sid', 'date', 'uid', 'comment', 'subject', 'replyto'));
    foreach ($items as $item) {
        // set the correct user id for anonymous users
        if (empty($item['uid'])) {
            $item['uid'] = 1;
        }
        $id = ModUtil::apiFunc('EZComments', 'user', 'create', array('mod' => 'News', 'objectid' => DataUtil::formatForStore($item['sid']), 'url' => ModUtil::url('News', 'user', 'display', array('sid' => $item['sid'])), 'comment' => $item['comment'], 'subject' => $item['subject'], 'uid' => $item['uid'], 'date' => $item['date']));
        if (!$id) {
            return LogUtil::registerError('News migration: Error creating comment');
        }
        $comments[$item['tid']] = array('newid' => $id, 'pid' => $item['replyto']);
    }
    // rebuild the links to the parents
    $tids = array_keys($comments);
    foreach ($tids as $tid) {
        if ($tid != 0) {
            $v = $comments[$tid];
            $sql = "UPDATE {$EZCommentstable}\n                       SET {$EZCommentscolumn['replyto']} = '" . $comments[$v['pid']]['newid'] . "'\n                     WHERE {$EZCommentscolumn['id']} = '{$v['newid']}'";
            $result = DBUtil::executeSQL($sql);
        }
    }
    // activate the ezcomments hook for the news module
    ModUtil::apiFunc('Modules', 'admin', 'enablehooks', array('callermodname' => 'News', 'hookmodname' => 'EZComments'));
    return LogUtil::registerStatus('News migration successful');
}
示例#13
0
 /**
  * delete an avatar
  *
  */
 public function deleteavatar($args)
 {
     if (!SecurityUtil::checkPermission('Avatar::', '::', ACCESS_ADMIN)) {
         return LogUtil::registerPermissionError();
     }
     $osdir = DataUtil::formatForOS(ModUtil::getVar('Users', 'avatarpath'));
     $avatarfile = $osdir . '/' . DataUtil::formatForOS($args['avatar']);
     if (unlink($avatarfile) == false) {
         return LogUtil::registerError($this->__f('Error! Unable to delete avatar \'%s\'.', $avatarfile));
     }
     LogUtil::registerStatus($this->__f('Done! The Avatar \'%s\' has been deleted.', $avatarfile));
     return true;
 }
示例#14
0
 function handleCommand(Zikula_Form_View $view, &$args)
 {
     $url = ModUtil::url('Scribite', 'admin', 'main');
     if ($args['commandName'] == 'cancel') {
         return $view->redirect($url);
     }
     // check for valid form
     if (!$view->isValid()) {
         return false;
     }
     // get passed args and store to array
     $data = $view->getValues();
     $this->setVars($data);
     LogUtil::registerStatus($this->__('Done! Module configuration updated.'));
     return $view->redirect($url);
 }
示例#15
0
 public function getYoutubeVideos($channelId = '', $collectionId = 0)
 {
     $dom = ZLanguage::getModuleDomain($this->name);
     $youtubeApi = ModUtil::getVar($this->name, 'youtubeApi');
     $collectionRepository = MUVideo_Util_Model::getCollectionRepository();
     $collectionObject = $collectionRepository->selectById($collectionId);
     $api = self::getData("https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=" . $channelId . "&key=" . $youtubeApi);
     // https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCJC8ynLpY_q89tmNhqIf1Sg&key={YOUR_API_KEY}
     //$api = self::getData("https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId={DEINE_PLAYLIST_ID}&maxResults=10&fields=items%2Fsnippet&key=" . $youtubeApi);
     $videos = json_decode($api, true);
     $movieRepository = MUVideo_Util_Model::getMovieRepository();
     $where = 'tbl.urlOfYoutube != \'' . DataUtil::formatForStore('') . '\'';
     // we look for movies with a youtube url entered
     $existingYoutubeVideos = $movieRepository->selectWhere($where);
     if ($existingYoutubeVideos && count($existingYoutubeVideos > 0)) {
         foreach ($existingYoutubeVideos as $existingYoutubeVideo) {
             $youtubeId = str_replace('https://www.youtube.com/watch?v=', '', $existingYoutubeVideo['urlOfYoutube']);
             $videoIds[] = $youtubeId;
         }
     }
     if (is_array($videos['items'])) {
         foreach ($videos['items'] as $videoData) {
             if (isset($videoData['id']['videoId'])) {
                 if (isset($videoIds) && is_array($videoIds)) {
                     if (in_array($videoData['id']['videoId'], $videoIds)) {
                         continue;
                     }
                 }
                 $serviceManager = ServiceUtil::getManager();
                 $entityManager = $serviceManager->getService('doctrine.entitymanager');
                 $newYoutubeVideo = new MUVideo_Entity_Movie();
                 $newYoutubeVideo->setTitle($videoData['snippet']['title']);
                 $newYoutubeVideo->setDescription($videoData['snippet']['description']);
                 $newYoutubeVideo->setUrlOfYoutube('https://www.youtube.com/watch?v=' . $videoData['id']['videoId']);
                 $newYoutubeVideo->setWidthOfMovie('400');
                 $newYoutubeVideo->setHeightOfMovie('300');
                 $newYoutubeVideo->setWorkflowState('approved');
                 $newYoutubeVideo->setCollection($collectionObject);
                 $entityManager->persist($newYoutubeVideo);
                 $entityManager->flush();
                 LogUtil::registerStatus(__('The movie', $dom) . ' ' . $videoData['snippet']['title'] . ' ' . __('was created and put into the collection', $dom) . ' ' . $collectionObject['title']);
             }
         }
     }
     $redirectUrl = ModUtil::url($this->name, 'user', 'display', array('ot' => 'collection', 'id' => $collectionId));
     return System::redirect($redirectUrl);
 }
示例#16
0
文件: Edit.php 项目: rmaiwald/MUBoard
 /**
  * Command event handler.
  *
  * This event handler is called when a command is issued by the user.
  */
 public function handleCommand(Zikula_Form_View $view, &$args)
 {
     parent::HandleCommand($view, $args);
     $dom = ZLanguage::getModuleDomain($this->name);
     // we handle the redirect to the frontend after moving an issue
     // to another forum
     $work = $this->request->query->filter('work', 'none', FILTER_SANITIZE_STRING);
     $id = $this->request->query->filter('id', 0, FILTER_SANITIZE_NUMBER_INT);
     if ($id > 0) {
         $url = ModUtil::url($this->name, 'user', 'display', array('ot' => 'posting', 'id' => $id));
         return LogUtil::registerStatus(__('Done! Moving of issue successful.', $dom), $url);
     } else {
         $url = ModUtil::url($this->name, 'user');
         LogUtil::registerError('Sorry! Moving the issue failed', $dom);
     }
     return System::redirect($url);
 }
示例#17
0
 public function updateconfig()
 {
     $this->checkCsrfToken();
     if (!SecurityUtil::checkPermission('Dashboard::', '::', ACCESS_ADMIN)) {
         return LogUtil::registerPermissionError();
     }
     $settings = $this->request->request->get('settings');
     if ($settings === null) {
         $this->redirect(ModUtil::url('Dashboard', 'admin', 'config'));
     }
     foreach ($settings as $key => $value) {
         if ($value != $this->getVar($key)) {
             $this->setVar($key, $value);
         }
     }
     LogUtil::registerStatus($this->__('Done! Saved configuration.'));
     $this->redirect(ModUtil::url('Dashboard', 'admin', 'config'));
 }
示例#18
0
 public function install()
 {
     // create hook
     HookUtil::registerProviderBundles($this->version->getHookProviderBundles());
     // set all modvars
     $this->setVar('DefaultEditor', 'CKEditor');
     $classes = PluginUtil::loadAllModulePlugins();
     foreach ($classes as $class) {
         if (strpos($class, 'Scribite') !== false) {
             try {
                 PluginUtil::install($class);
             } catch (Exception $e) {
                 LogUtil::registerStatus($e->getMessage());
             }
         }
     }
     // initialisation successful
     return true;
 }
示例#19
0
/**
 * Do the migration
 * 
 * With this function, the actual migration is done.
 * 
 * @return   boolean   true on sucessful migration, false else
 */
function EZComments_migrateapi_pnProfile()
{
    if (!SecurityUtil::checkPermission('EZComments::', '::', ACCESS_ADMIN)) {
        return LogUtil::registerError('pnProfile comments migration: Not Admin');
    }
    $columnArray = array('id', 'modname', 'objectid');
    $comments = DBUtil::selectObjectArray('EZComments', '', '', -1, -1, '', null, null, $columnArray);
    $counter = 0;
    foreach ($comments as $comment) {
        if ($comment['modname'] == 'pnProfile') {
            $comment['modname'] = 'MyProfile';
            $comment['url'] = ModUtil::url('MyProfile', 'user', 'display', array('uid' => $comment['objectid']));
            $comment['owneruid'] = $comment['objectid'];
            if (DBUtil::updateObject($comment, 'EZComments')) {
                $counter++;
            }
        }
    }
    return LogUtil::registerStatus("Updated / migrated: {$counter} comments from pnProfile to MyProfile, the successor of pnProfile");
}
示例#20
0
/**
 * Do the migration
 * 
 * With this function, the actual migration is done.
 * 
 * @return   boolean   true on sucessful migration, false else
 */
function EZComments_migrateapi_pnComments()
{
    if (!SecurityUtil::checkPermission('EZComments::', '::', ACCESS_ADMIN)) {
        return LogUtil::registerPermissionError();
    }
    if (!ModUtil::available('pnComments')) {
        return LogUtil::RegisterError('pnComments not available');
    }
    ModUtil::dbInfoLoad('pnComments');
    $comments = DBUtil::SelectObjectArray('pncomments');
    $counter = 0;
    foreach ($comments as $c) {
        $obj = array('modname' => $c['module'], 'objectid' => $c['objectid'], 'comment' => $c['text'], 'replyto' => -1, 'subject' => $c['subject'], 'uid' => $c['uid'], 'date' => $c['date'] . ' 00:00:00');
        if (!DBUtil::insertObject($obj, 'EZComments')) {
            return LogUtil::registerError('error inserting comments in ezcomments table');
        }
        $counter++;
    }
    return LogUtil::registerStatus("Migrated: {$counter} comments successfully.");
}
示例#21
0
/**
 * Do the migration
 * 
 * With this function, the actual migration is done.
 * 
 * @return   boolean   true on sucessful migration, false else
 * @since    0.6
 */
function EZComments_migrateapi_reviews()
{
    // Security check
    if (!SecurityUtil::checkPermission('EZComments::', '::', ACCESS_ADMIN)) {
        return LogUtil::registerError('Reviews migration: Not Admin');
    }
    // Get datbase setup
    ModUtil::dbInfoLoad('Reviews', 'EZComments/migrateapi/Reviews', true);
    $tables = DBUtil::getTables();
    $Commentstable = $tables['reviews_comments'];
    $Commentscolumn = $tables['reviews_comments_column'];
    if (version_compare(PN_VERSION_NUM, '1', '>=')) {
        EZComments_get76xcolumns_reviews($Commentstable, $Commentscolumn);
    }
    if (is_null($Commentstable) || is_null($Commentscolumn)) {
        return LogUtil::registerError('Reviews migration: Comments tables not found');
    }
    $Usertable = $tables['users'];
    $Usercolumn = $tables['users_column'];
    // note: there's nothing we can do with the score......
    $sql = "SELECT {$Commentscolumn['cid']},\n                   {$Commentscolumn['rid']},\n                   {$Commentscolumn['date']}, \n                   {$Usercolumn['uid']}, \n                   {$Commentscolumn['comments']},\n                   {$Commentscolumn['score']}\n              FROM {$Commentstable}\n         LEFT JOIN {$Usertable}\n                ON {$Commentscolumn['userid']} = {$Usercolumn['uname']}";
    $result = DBUtil::executeSQL($sql);
    if ($result == false) {
        return LogUtil::registerError('Reviews migration: DB Error');
    }
    // loop through the old comments and insert them one by one into the DB
    $items = DBUtil::marshalObjects($result, array('cid', 'rid', 'date', 'uid', 'comment', 'score'));
    foreach ($items as $item) {
        // set the correct user id for anonymous users
        if (empty($item['uid'])) {
            $item['uid'] = 1;
        }
        $id = ModUtil::apiFunc('EZComments', 'user', 'create', array('mod' => 'Reviews', 'objectid' => DataUtil::formatForStore($item['rid']), 'url' => ModUtil::url('Reviews', 'user', 'display', array('id' => $item['rid'])), 'comment' => $item['comment'], 'subject' => '', 'uid' => $item['uid'], 'date' => $item['date']));
        if (!$id) {
            return LogUtil::registerError('Reviews migration: Error creating comment');
        }
    }
    // activate the ezcomments hook for the Reviews module
    ModUtil::apiFunc('Modules', 'admin', 'enablehooks', array('callermodname' => 'Reviews', 'hookmodname' => 'EZComments'));
    return LogUtil::registerStatus('Reviews migration successful');
}
示例#22
0
 /**
  * Init quotes module
  * @author The Zikula Development Team
  * @return true if init successful, false otherwise
  */
 public function install()
 {
     // create table
     if (!DBUtil::createTable('quotes')) {
         return false;
     }
     // set up module config variables
     $modvars = array('itemsperpage' => 25, 'enablecategorization' => true, 'enablefacebookshare' => false);
     // create our default category
     if (!$this->_createdefaultcategory()) {
         LogUtil::registerStatus($this->{$this}->__('Warning! Could not create the default Quotes category tree. If you want to use categorisation with Quotes, register at least one property for the module in the Category Registry.'));
         $modvars['enablecategorization'] = false;
     }
     // set up module variables
     ModUtil::setVars('Quotes', $modvars);
     // Register hooks
     HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
     HookUtil::registerProviderBundles($this->version->getHookProviderBundles());
     // initialisation successful
     return true;
 }
示例#23
0
 function handleCommand(Zikula_Form_View $view, &$args)
 {
     if ($args['commandName'] == 'cancel') {
         $url = ModUtil::url('BBSmile', 'admin', 'main');
         return $view->redirect($url);
     }
     // Security check
     if (!SecurityUtil::checkPermission('BBSmile::', '::', ACCESS_ADMIN)) {
         return LogUtil::registerPermissionError(ModUtil::url('BBSmile', 'admin', 'main'));
     }
     // check for valid form
     if (!$view->isValid()) {
         return false;
     }
     $ok = true;
     $data = $view->getValues();
     $ossmiliepath = DataUtil::formatForOS($data['smiliepath']);
     if (!file_exists($ossmiliepath) || !is_readable($ossmiliepath)) {
         $ifield = $this->view->getPluginById('smiliepath');
         $ifield->setError(DataUtil::formatForDisplay($this->__('The path does not exists or the system cannot read it.')));
         $ok = false;
     }
     $osautosmiliepath = DataUtil::formatForOS($data['smiliepath_auto']);
     if (!file_exists($osautosmiliepath) || !is_readable($osautosmiliepath)) {
         $ifield = $this->view->getPluginById('smiliepath_auto');
         $ifield->setError(DataUtil::formatForDisplay($this->__('The path does not exists or the system cannot read it.')));
         $ok = false;
     }
     if ($ok == false) {
         return false;
     }
     $this->setVar('smiliepath', $data['smiliepath']);
     $this->setVar('smiliepath_auto', $data['smiliepath_auto']);
     $this->setVar('activate_auto', $data['activate_auto']);
     $this->setVar('remove_inactive', $data['remove_inactive']);
     LogUtil::registerStatus($this->__('BBSmile configuration updated'));
     return true;
 }
示例#24
0
    /**
     * delete item
     *
     * @author       The PostNuke Development Team
     * @param        integer      $tid     the ID of the item to display
     * @return       output       The item detail page
     */
    public function check($args) {
        if (!SecurityUtil::checkPermission('IWmessages::', '::', ACCESS_OVERVIEW) || !UserUtil::isLoggedIn()) {
            throw new Zikula_Exception_Forbidden();
        }

        $msg_id = FormUtil::getPassedValue('msg_id', isset($args['msg_id']) ? $args['msg_id'] : null, 'POST');
        $total_messages = FormUtil::getPassedValue('total_messages', isset($args['total_messages']) ? $args['total_messages'] : null, 'POST');

        if (empty($msg_id)) {
            LogUtil::registerError($this->__('No message(s) selected'));
            return System::redirect(ModUtil::url('IWmessages', 'user', 'view'));
        }

        $status = false;
        $uid = UserUtil::getVar('uid');

        if (is_array($msg_id)) {
            // delete multiple messages for a list
            for ($i = 0; $i < $total_messages; $i++) {
                if (isset($msg_id[$i])) {
                    $status = ModUtil::apiFunc('IWmessages', 'user', 'check',
                                    array('msgid' => $msg_id[$i],
                                        'uid' => $uid));
                    if (!$status) {
                        return System::redirect(ModUtil::url('IWmessages', 'user', 'view'));
                    }
                }
            }
        } else {
            $status = ModUtil::apiFunc('IWmessages', 'user', 'delete',
                            array('msgid' => $msg_id,
                                'uid' => $uid));
            if (!$status) {
                return System::redirect(ModUtil::url('IWmessages', 'user', 'view'));
            }
        }
        if ($status) {
            $this->view->clear_cache(null, $uid);
            LogUtil::registerStatus($this->__('Marked/unmarked messages'));
            return System::redirect(ModUtil::url('IWmessages', 'user', 'view'));
        }
    }
示例#25
0
 /**
  * Upgrade ephemerides module
  * @author The Zikula Development Team
  * @return true if init successful, false otherwise
  */
 public function upgrade($oldversion)
 {
     // upgrade dependent on old version number
     switch ($oldversion) {
         case '1.2':
             // version 1.2 shipped with postnuke .72x/.75
             ModUtil::setVar('Ephemerides', 'itemsperpage', 25);
         case '1.6':
             $this->ephemerides_upgrade_updateEphemeridesLanguages();
         case '1.7':
             // needs update of table, added status column
         // needs update of table, added status column
         case '1.8':
             // needs update of table, added type column
         // needs update of table, added type column
         case '1.9':
             $connection = Doctrine_Manager::getInstance()->getConnection('default');
             // drop table prefix
             $prefix = $this->serviceManager['prefix'];
             $sqlQueries = array();
             $sqlQueries[] = 'RENAME TABLE ' . $prefix . '_ephem' . " TO `ephem`";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_eid` `eid` INT(11) NOT NULL AUTO_INCREMENT";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_did` `did` TINYINT(4) NOT NULL DEFAULT '0'";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_mid` `mid` TINYINT(4) NOT NULL DEFAULT '0'";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_yid` `yid` SMALLINT(6) NOT NULL DEFAULT '0'";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_content` `content` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_language` `language` VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ''";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_obj_status` `obj_status` VARCHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'A'";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_cr_date` `cr_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00'";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_cr_uid` `cr_uid` INT(11) NOT NULL DEFAULT '0'";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_lu_date` `lu_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00'";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_lu_uid` `lu_uid` INT(11) NOT NULL DEFAULT '0'";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_status` `status` TINYINT(4) NULL DEFAULT '1'";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_type` `type` TINYINT(4) NULL DEFAULT '1'";
             foreach ($sqlQueries as $sql) {
                 $stmt = $connection->prepare($sql);
                 try {
                     $stmt->execute();
                 } catch (Exception $e) {
                 }
             }
             // update table structure according to table defenition
             if (!DBUtil::changeTable('ephem')) {
                 return "1.9";
             }
             // enable categorisation this module
             ModUtil::setVar('Ephemerides', 'enablecategorization', true);
             // create our default category
             if (!$this->_createdefaultcategory()) {
                 LogUtil::registerStatus($this->{$this}->__('Warning! Could not create the default Ephemerides category tree. If you want to use categorisation with Ephemerides, register at least one property for the module in the Category Registry.'));
                 $modvars['enablecategorization'] = false;
             }
         case '3.0.0':
             $connection = Doctrine_Manager::getInstance()->getConnection('default');
             // Change module name from Ephemerids to Ephemerides
             $sqlQueries = array();
             $sqlQueries[] = "UPDATE `modules` SET `name`='Ephemerides', `directory`='Ephemerides', `securityschema`='a:1:{s:13:\"Ephemerides::\";s:14:\"::Ephemerid ID\";}' WHERE `directory`='Ephemerids';";
             $sqlQueries[] = "UPDATE `module_vars` SET `modname`='Ephemerides' WHERE `modname`='Ephemerids';";
             foreach ($sqlQueries as $sql) {
                 $stmt = $connection->prepare($sql);
                 try {
                     $stmt->execute();
                 } catch (Exception $e) {
                 }
             }
             // Register hooks
             $sqlQueries = array();
             $sqlQueries[] = 'DELETE FROM `hook_area` WHERE `owner`="Ephemerides"';
             $sqlQueries[] = 'DELETE FROM `hook_subscriber` WHERE `owner`="Ephemerides"';
             $sqlQueries[] = 'DELETE FROM `hook_provider` WHERE `owner`="Ephemerides"';
             foreach ($sqlQueries as $sql) {
                 $stmt = $connection->prepare($sql);
                 try {
                     $stmt->execute();
                 } catch (Exception $e) {
                 }
             }
             HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
             HookUtil::registerProviderBundles($this->version->getHookProviderBundles());
         case '3.1.0':
             ModUtil::setVar('Ephemerides', 'enablefacebookshare', false);
         case '3.1.1':
             // future upgrade routines
     }
     // upgrade success
     return true;
 }
示例#26
0
    /**
     * Importa, a la taula seleccionada, les dades d'un csv
     * 
     * Els registres existents s'actualitzen i els nous s'inserten
     * 
     * @return void (carrega la plantilla per importar/exportar taules)
     */
    public function importaTaula() {

        // Security check 
        $this->checkCsrfToken();
        $this->throwForbiddenUnless(SecurityUtil::checkPermission('Llicencies::', '::', ACCESS_ADMIN));
        if ($this->request->isPost()) {
            $taula = $this->request->request->get('taula_imp', false);
            $importFile = $this->request->files->get('importFile', null);
        }

        if (is_null($importFile)) {
            LogUtil::registerError(__('No s\'ha pogut processar l\'arxiu. Probablement supera la mida màxima.'));
        } else {
            $import = new CsvImporter($importFile['tmp_name'], true, null,';');

            $header = $import->getHeader();

            $check = ModUtil::apiFunc($this->name, 'admin', 'checkCSV', array('dbTable' => $taula, 'csvHeader' => $header));

            // Comprovar capçaleres del csv
            if (!$check['correcte']) {
                // Errades a l'arxiu CSV
                LogUtil::registerError($check['msg']);
            } else {
                // Obtenció del contingut del fitxer csv
                $data = $import->get();
                // Obtenció de les dades de la taula
                $tContent = DBUtil::selectFieldArray($taula, $check['clau']);
                // echo '<pre> tContent: ';print_r($tContent); echo '</pre>';

                LogUtil::registerStatus($check['msg']);
                //LogUtil::registerStatus(print_r($data,true));
                $update = array();
                $insert = array();
                foreach ($data as $row => $record) {
                    if (in_array($record[$check['clau']], $tContent)) {
                        $update[] = $record;
                    } else {
                        $insert[] = $record;
                    }
                }

                $inserts = count($insert);
                $updates = count($update);
                $ins = true;
                $upd = true;
                if ($inserts) {
                    $ins = (DBUtil::insertObjectArray($insert, $taula) && ($inserts));
                    $mi = __('S\'han afegit ' . $inserts . ' registres.');
                }
                if ($updates) {
                    $upd = (DBUtil::updateObjectArray($update, $taula, $check['clau'])) && ($updates);
                    $mu = __('S\'han actualitzat ' . $updates . ' registres.');
                }
                if (($ins) && ($upd))
                    LogUtil::registerStatus(__('La importació de dades cap a la taula:' . $taula . ' s\'ha realitzat correctament.') . " " . $mi . " " . $mu);
                else
                    LogUtil::registerError(__('No s\'han pogut modificar totes les dades de la taula: ' . $taula));
            }
        }
        $this->redirect(ModUtil::url('llicencies', 'admin', 'ieTables'));
    }
示例#27
0
 function update_company()
 {
     // Confirm the forms authorisation key
     $this->checkCsrfToken();
     $ot = FormUtil::getPassedValue('ot', 'address', 'GETPOST');
     $id = (int) FormUtil::getPassedValue('id', 0, 'GETPOST');
     $oldvalue = (int) FormUtil::getPassedValue('oldvalue', 0, 'GETPOST');
     $startnum = FormUtil::getPassedValue('startnum', 1, 'GET');
     $letter = FormUtil::getPassedValue('letter', 0);
     $sort = FormUtil::getPassedValue('sort', ModUtil::getVar('AddressBook', 'addressbooktype') == 1 ? 'sortname ASC' : 'sortcompany ASC');
     $search = FormUtil::getPassedValue('search', 0);
     $category = FormUtil::getPassedValue('category', 0);
     $private = FormUtil::getPassedValue('private', 0);
     $url = ModUtil::url('AddressBook', 'user', 'view', array('ot' => $ot, 'startnum' => $startnum, 'letter' => $letter, 'sort' => $sort, 'search' => $search, 'category' => $category, 'private' => $private));
     $object = new AddressBook_DBObject_Address();
     $data = $object->get($id);
     // security check
     // Get user id
     if (UserUtil::isLoggedIn()) {
         $user_id = UserUtil::getVar('uid');
     } else {
         $user_id = 0;
     }
     if (!(SecurityUtil::checkPermission('AddressBook::', '::', ACCESS_EDIT) || $user_id == $data['user_id'])) {
         return LogUtil::registerPermissionError();
     }
     $obj = array('company' => $data['company'], 'address1' => $data['address1'], 'address2' => $data['address2'], 'zip' => $data['zip'], 'city' => $data['city'], 'state' => $data['state'], 'country' => $data['country']);
     $res = DBUtil::updateObject($obj, 'addressbook_address', '', 'company');
     if (!$res) {
         LogUtil::registerError($this->__('Error! Company update failed.'));
         return System::redirect($url);
     }
     // clear respective cache
     ModUtil::apiFunc('AddressBook', 'user', 'clearItemCache', $data);
     LogUtil::registerStatus($this->__('Done! Company update successful.'));
     return System::redirect($url);
 }
示例#28
0
 /**
  * Command event handler.
  *
  * This event handler is called when a command is issued by the user. Commands are typically something
  * that originates from a {@link Zikula_Form_Plugin_Button} plugin. The passed args contains different properties
  * depending on the command source, but you should at least find a <var>$args['commandName']</var>
  * value indicating the name of the command. The command name is normally specified by the plugin
  * that initiated the command.
  *
  * @param Zikula_Form_View $view The form view instance.
  * @param array            $args Additional arguments.
  *
  * @see Zikula_Form_Plugin_Button
  * @see Zikula_Form_Plugin_ImageButton
  *
  * @return mixed Redirect or false on errors.
  */
 public function handleCommand(Zikula_Form_View $view, &$args)
 {
     if ($args['commandName'] == 'save') {
         // check if all fields are valid
         if (!$this->view->isValid()) {
             return false;
         }
         // retrieve form data
         $data = $this->view->getValues();
         // update all module vars
         try {
             $this->setVars($data['config']);
         } catch (\Exception $e) {
             $msg = $this->__('Error! Failed to set configuration variables.');
             if (System::isDevelopmentMode()) {
                 $msg .= ' ' . $e->getMessage();
             }
             return LogUtil::registerError($msg);
         }
         LogUtil::registerStatus($this->__('Done! Module configuration updated.'));
     } else {
         if ($args['commandName'] == 'cancel') {
             // nothing to do there
         }
     }
     // redirect back to the config page
     $url = ModUtil::url($this->name, 'admin', 'config');
     return $this->view->redirect($url);
 }
示例#29
0
    /**
     * This function processes the results of the test form
     * @author Francesc Bassas i Bullich
     * @param  string args['toname'] name to the recipient
     * @param  string args['toaddress'] the address of the recipient
     * @param  string args['subject'] message subject
     * @param  string args['body'] message body
     * @param  int args['html'] HTML flag
     * @return bool true if successful, false otherwise
     */
    public function sendmessage($args) {
        // security check
        if (!SecurityUtil::checkPermission('SiriusXtecMailer::', '::', ACCESS_ADMIN)) {
            return LogUtil::registerPermissionError();
        }

        $toaddress = (string) FormUtil::getPassedValue('toaddress', isset($args['toaddress']) ? $args['toaddress'] : null, 'POST');
        $subject = (string) FormUtil::getPassedValue('subject', isset($args['subject']) ? $args['subject'] : null, 'POST');
        $body = (string) FormUtil::getPassedValue('body', isset($args['body']) ? $args['body'] : null, 'POST');
        $html = (bool) FormUtil::getPassedValue('html', isset($args['html']) ? $args['html'] : false, 'POST');

        // Confirm authorisation code
        $this->checkCsrfToken();

        $result = ModUtil::apiFunc('Mailer', 'user', 'sendmessage', array('toaddress' => $toaddress,
                    'subject' => $subject,
                    'body' => $body,
                    'html' => $html));

        // check our result and return the correct error code
        if ($result === true) {
            // Success
            LogUtil::registerStatus(__('Done! Message sent.'));
        } elseif ($result === false) {
            // Failure
            LogUtil::registerError(__f('Error! Could not send message. %s', ''));
        } else {
            // Failure with error
            LogUtil::registerError(__f('Error! Could not send message. %s', $result));
        }

        // This function generated no output, and so now it is complete we redirect
        // the user to an appropriate page for them to carry on their work
        return System::redirect(ModUtil::url('SiriusXtecMailer', 'admin', 'main'));
    }
示例#30
0
 public function handleCommand(Zikula_Form_View $view, &$args)
 {
     $url = null;
     if ($args['commandName'] == 'save' || $args['commandName'] == 'saveAndView' || $args['commandName'] == 'translate') {
         $pageData = $this->view->getValues();
         // fetch old data *before* updating
         $oldPageData = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId, 'editing' => true, 'filter' => array('checkActive' => false), 'enableEscape' => false));
         if ($oldPageData === false) {
             return $this->view->registerError(null);
         }
         $hook = new Zikula_ValidationHook('content.ui_hooks.pages.validate_edit', new Zikula_Hook_ValidationProviders());
         $this->notifyHooks($hook);
         $validators = $hook->getValidators();
         if (!$validators->hasErrors() && $this->view->isValid()) {
             $ok = ModUtil::apiFunc('Content', 'Page', 'updatePage', array('page' => $pageData['page'], 'pageId' => $this->pageId));
             if ($ok === false) {
                 return $this->view->registerError(null);
             }
             // notify any hooks they may now commit the as the original form has been committed.
             $objectUrl = new Zikula_ModUrl($this->name, 'user', 'view', ZLanguage::getLanguageCode(), array('pid' => $this->pageId));
             $this->notifyHooks(new Zikula_ProcessHook('content.ui_hooks.pages.process_edit', $this->pageId, $objectUrl));
         } else {
             return false;
         }
         if ($args['commandName'] == 'translate') {
             $url = ModUtil::url('Content', 'admin', 'translatepage', array('pid' => $this->pageId));
         } else {
             if ($args['commandName'] == 'saveAndView') {
                 $url = ModUtil::url('Content', 'user', 'view', array('pid' => $this->pageId));
             } else {
                 if ($oldPageData['layout'] != $pageData['page']['layout']) {
                     $url = ModUtil::url('Content', 'admin', 'editpage', array('pid' => $this->pageId));
                     LogUtil::registerStatus($this->__('Layout changed'));
                 }
             }
         }
     } else {
         if ($args['commandName'] == 'deleteContent') {
             $ok = ModUtil::apiFunc('Content', 'Content', 'deleteContent', array('contentId' => $args['commandArgument']));
             if ($ok === false) {
                 return $this->view->registerError(null);
             }
             $url = ModUtil::url('Content', 'admin', 'editpage', array('pid' => $this->pageId));
         } else {
             if ($args['commandName'] == 'cloneContent') {
                 $clonedId = ModUtil::apiFunc('Content', 'Content', 'cloneContent', array('id' => (int) $args['commandArgument'], 'translation' => true));
                 if ($clonedId === false) {
                     return $this->view->registerError(null);
                 }
                 $url = ModUtil::url('Content', 'admin', 'editcontent', array('cid' => $clonedId));
             } else {
                 if ($args['commandName'] == 'deletePage') {
                     $hook = new Zikula_ValidationHook('content.ui_hooks.pages.validate_delete', new Zikula_Hook_ValidationProviders());
                     $validators = $this->notifyHooks($hook)->getValidators();
                     if (!$validators->hasErrors()) {
                         $ok = ModUtil::apiFunc('Content', 'Page', 'deletePage', array('pageId' => $this->pageId));
                         if ($ok === false) {
                             return $this->view->registerError(null);
                         }
                         // notify any hooks they may now commit the as the original form has been committed.
                         $this->notifyHooks(new Zikula_ProcessHook('content.ui_hooks.pages.process_delete', $this->pageId));
                     }
                     $url = ModUtil::url('Content', 'admin', 'main');
                 } else {
                     if ($args['commandName'] == 'cancel') {
                     }
                 }
             }
         }
     }
     ModUtil::apiFunc('PageLock', 'user', 'releaseLock', array('lockName' => "contentPage{$this->pageId}"));
     if ($url == null) {
         $url = $this->backref;
     }
     if ($url == null) {
         $url = ModUtil::url('Content', 'admin', 'main');
     }
     return $this->view->redirect($url);
 }