/** * Helper main function * @param $actionsHtml String HTML code showing the action buttons * @param $content String The content of this element * @param $dbId Int DB id of the object * @param $order Int order of this item in the DB * @param $params Array parameters (if any) * @return String HTML to be inserted in the view */ public function contentViewembeder($actionsHtml = '', $content = '', $dbId = 0, $order = 0, $params = array(), $moduleName = 'adminpages', $pageStructureId = 0, $sharedInIds = '') { $toReturn = ''; if (!empty($content)) { switch (Sydney_Tools::getConf('helpers')->content->viewembedder->method) { case 'ajax': $toReturn = Sydney_View_Embedder_Content::ajaxContents($content); break; case 'filegetcontents': $toReturn = file_get_contents(Sydney_Tools::getRootUrl() . '/' . $content . '/sydneylayout/no/'); break; case 'curlgetcontents': $toReturn = Sydney_View_Embedder_Content::curlGetContents(Sydney_Tools::getRootUrl() . $content . '/sydneylayout/no/'); break; case 'action': default: $i = 0; $module = null; $controller = null; $action = null; $oldv = null; $params2 = array(); foreach (preg_split("/\\//", $content) as $v) { if ($i == 1) { $module = $v; } elseif ($i == 2) { $controller = $v; } elseif ($i == 3) { $action = $v; } elseif ($i > 3) { if ($i % 2 == 0) { $params2[$v] = null; $oldv = $v; } if ($i % 2 == 1) { $params2[$oldv] = $v; $oldv = null; } } $i++; } $toReturn = $this->view->action($action, $controller, $module, $params2); break; } } // END - if content return ' <li class="' . $params['addClass'] . ' sydney_editor_li" type="" dbparams="' . $content . '" editclass="viewembeder" dbid="' . $dbId . '" dborder="' . $order . '" data-content-type="view-embedder-block" pagstructureid="' . $pageStructureId . '" sharedinids="' . $sharedInIds . '">' . $actionsHtml . '<div class="content">' . $toReturn . '</div></li>'; }
public function processuserAction() { $data = $this->getRequest()->getPost(); $objectUser = new Users(); if (!($this->view->status = $objectUser->save($data, true))) { $msg = Sydney_Messages::getInstance()->getMessages(); $this->view->message = 'Validation errors found...'; if (!is_array($msg)) { $this->view->message .= ' (' . $msg . ')'; } $this->view->ResultSet = array('errors' => Sydney_Messages::getInstance()->getMessages(), 'entry' => array()); } else { // send email if (!$objectUser->isEditMode($data)) { $data['id'] = $objectUser->get()->id; $mailSubject = str_replace('[SITE_TITLE]', Sydney_Tools::getConf('general')->siteTitle, Sydney_Tools::_('subjectMailSubscribe')); $objectUser->registermail($objectUser->get()->login, $mailSubject, $data, $confirmationAction = '/publicms/profile/confirm/init/2', false, array('management/partialmailconfirm.phtml', 'publictimedex')); } $this->view->message = Sydney_Messages::getInstance()->getMessages(); $this->view->ResultSet = array('errors' => Sydney_Messages::getInstance()->getMessages(), 'entry' => $objectUser->get()->toArray()); } $this->view->showtime = 3; $this->view->modal = false; }
/** * * @return void */ public function editindexAction() { // call upload action from adminfiles //$this->view->action('upload', 'index', 'adminfiles', array('calledBy' => 'adminpeople','peopleId' => $this->view->id)); $this->layout->currentModule = $this->_request->getModuleName(); $modeEdit = false; if (isset($this->getRequest()->id)) { $this->setSubtitle2('Edit'); } else { $this->setSubtitle2('Create'); } $this->setSideBar('edit', 'people'); // request id if (isset($this->view->id)) { // search user $sql = $this->_getQuery('people', 'AND users.id = ' . $this->view->id); $u = $this->_db->fetchAll($sql); // if user exist if (count($u) == 1) { $d = array(); $modeEdit = true; // get the user $uDB = new Users(); $usr = $uDB->find($u[0]['id']); $user = $usr[0]; //$this->view->usersForm->populate($user->toArray()); $this->view->avatar = $user->avatar; } // END - if user exist } // Set a custom form user on publicms if exist for the current instance $formclass = 'UsersFormOp'; if ($this->view->moduleName == 'publicms' && !empty(Sydney_Tools::getConf('general')->form->profile) && @class_exists(Sydney_Tools::getConf('general')->form->profile)) { $formclass = Sydney_Tools::getConf('general')->form->profile; } Sydney_Form::setParams(array('request' => $this->r)); $this->view->usersForm = new $formclass(null, $this->usersData['member_of_groups'], $modeEdit); if (isset($this->view->id)) { $usera = $user->toArray(); } if ($modeEdit) { $this->view->usersForm->populate($usera); } }
public function registermail($to, $mailSubject, array $row, $confirmationAction = '/publicms/profile/confirm/init/2', $generatePassword = false, array $partialMailConfirm = array('profile/mailconfirm.phtml', 'publicms'), array $partialMailPassword = array('profile/mailpassword.phtml', 'publicms')) { // Init $data = $row; //->toArray(); // Mail content $objectByPass = new Sydney_Auth_Bypass(); $sBypass = $objectByPass->get($row['id']); $data['link_confirmation'] = Sydney_Tools::getConf('general')->siteDomain . $confirmationAction . '/passid/' . $row['id'] . '/pass/' . $sBypass; if (empty($mailSubject)) { $mailSubject = 'Confirmation ' . Sydney_Tools::getConf('general')->siteTitle; } if (count($partialMailConfirm) >= 2) { $view = new Zend_View(); $tmsg = $view->partial($partialMailConfirm[0], $partialMailConfirm[1], array('data' => $data)); if (array_key_exists(2, $partialMailConfirm) && !empty($partialMailConfirm[2])) { $mailSubject = $partialMailConfirm[2]; } } else { $view = new Zend_View(); $tmsg = $view->partial('profile/mailconfirm.phtml', 'publicms', array('data' => $data)); } $mail = new Zend_Mail('UTF-8'); $mail->setBodyHtml($tmsg); $mail->setFrom(Sydney_Tools::getConf('general')->siteEmail, Sydney_Tools::getConf('general')->siteTitle); $mail->addTo($to, $to); $mail->setSubject($mailSubject); $mail->send(); if ($generatePassword) { // Change password $data['password'] = Sydney_Tools_Security::generatePassword($length = 8, $use_lower = true, $use_upper = true, $use_number = true, $use_custom = ''); $user = new Users($row->id); $user->changePassword($data['password'], $row->id); // Send informations by email $view = new Zend_View(); $tmsg = $view->partial($partialMailPassword[0], $partialMailPassword[1], array('data' => $data)); // Mailer $mail = new Zend_Mail('UTF-8'); $mail->setBodyHtml($tmsg); $mail->setFrom(Sydney_Tools::getConf('general')->siteEmail, Sydney_Tools::getConf('general')->siteTitle); $mail->addTo($row->login, $row->login); $mail->setSubject($mailSubject); $mail->send(); } //} }