Example #1
0
 public function getRow($select)
 {
     if (!$select) {
         throw new Kwf_Exception('getRow needs a parameter, null is not allowed.');
     }
     if (!is_object($select)) {
         $select = $this->select($select);
     }
     if (count($select->getParts()) != 1) {
         throw new Kwf_Exception("only whereId in select allowed");
     }
     if ($select->getPart(Kwf_Model_Select::WHERE_ID)) {
         $BrowseNodeId = $select->getPart(Kwf_Model_Select::WHERE_ID);
     } else {
         if ($w = $select->getPart(Kwf_Model_Select::WHERE_EQUALS)) {
             foreach ($w as $f => $i) {
                 if ($f != $this->getPrimaryKey()) {
                     throw new Kwf_Exception("only whereEquals with primaryKey in select allowed");
                 }
                 $BrowseNodeId = $i;
             }
         } else {
             throw new Kwf_Exception("only whereEquals or whereId in select allowed");
         }
     }
     if (!isset($this->_rows[$BrowseNodeId])) {
         $options = array('AssociateTag' => Kwf_Registry::get('config')->service->amazon->associateTag);
         $result = $this->_amazon->browseNodeLookup($BrowseNodeId, $options);
         $this->_rows[$BrowseNodeId] = new $this->_rowClass(array('item' => $result, 'model' => $this));
     }
     return $this->_rows[$BrowseNodeId];
 }
 public function __construct($config = array())
 {
     $this->_tableName = 'import' . uniqid();
     $config['table'] = $this->_tableName;
     Kwf_Registry::get('db')->query("CREATE TABLE {$this->_tableName} (\n            `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,\n            `foo` VARCHAR( 200 ) NOT NULL ,\n            `bar` VARCHAR( 200 ) NOT NULL\n        ) ENGINE = INNODB");
     parent::__construct($config);
 }
 public function update()
 {
     $table = $this->model->getRow($this->table);
     if (!$table) {
         throw new Kwf_ClientException("Table '{$this->table}' not found");
     }
     $field = $table->getChildRows('Fields', $this->model->select()->whereId('component_id'))->current();
     if (!$field) {
         throw new Kwf_ClientException("Field 'component_id' not found");
     }
     if ($field->key != 'PRI') {
         throw new Kwf_ClientException("Field 'component_id' is not the primary key");
     }
     if (!$this->model->getRow('kwc_data')) {
         Kwf_Registry::get('db')->query("CREATE TABLE IF NOT EXISTS `kwc_data` (\n                `component_id` varchar(255) collate utf8_unicode_ci NOT NULL,\n                `data` text collate utf8_unicode_ci NOT NULL,\n                PRIMARY KEY  (`component_id`)\n            ) ENGINE=InnoDB;");
     }
     $model = new Kwf_Component_FieldModel();
     $rows = Kwf_Registry::get('db')->fetchAssoc("SELECT * FROM {$this->table}");
     foreach ($rows as $row) {
         if ($model->getRow($row['component_id'])) {
             throw new Kwf_ClientException("entry with component_id '{$row['component_id']}' does already exist");
         }
     }
     foreach ($rows as $row) {
         $r = $model->createRow();
         foreach ($row as $k => $i) {
             $r->{$k} = $i;
         }
         $r->save();
     }
 }
Example #4
0
 public function testOneLang()
 {
     $c = $this->_root->getPageByUrl('http://' . Kwf_Registry::get('config')->server->domain . '/trltest', 'de');
     $this->assertEquals('de', $c->getLanguage());
     $render = $c->render();
     $this->assertContains('trlTest: Sichtbar', $render);
     $this->assertContains('trlcTest: Am', $render);
     $this->assertContains('trlpTest1: Antwort', $render);
     $this->assertContains('trlpTest2: Antworten', $render);
     $this->assertContains('trlcpTest1: Antwort', $render);
     $this->assertContains('trlcpTest2: Antworten', $render);
     $this->assertContains('trlKwfTest: Sichtbar', $render);
     $this->assertContains('trlcKwfTest: Am', $render);
     $this->assertContains('trlpKwfTest1: Antwort', $render);
     $this->assertContains('trlpKwfTest2: Antworten', $render);
     $this->assertContains('trlcpKwfTest1: Antwort', $render);
     $this->assertContains('trlcpKwfTest2: Antworten', $render);
     $this->assertContains('trlTestTpl: Sichtbar', $render);
     $this->assertContains('trlcTestTpl: Am', $render);
     $this->assertContains('trlpTest1Tpl: Antwort', $render);
     $this->assertContains('trlpTest2Tpl: Antworten', $render);
     $this->assertContains('trlcpTest1Tpl: Antwort', $render);
     $this->assertContains('trlcpTest2Tpl: Antworten', $render);
     $this->assertContains('trlKwfTestTpl: Sichtbar', $render);
     $this->assertContains('trlcKwfTestTpl: Am', $render);
     $this->assertContains('trlpKwfTest1Tpl: Antwort', $render);
     $this->assertContains('trlpKwfTest2Tpl: Antworten', $render);
     $this->assertContains('trlcpKwfTest1Tpl: Antwort', $render);
     $this->assertContains('trlcpKwfTest2Tpl: Antworten', $render);
 }
 public function getTemplateVars(Kwf_Component_Renderer_Abstract $renderer)
 {
     $ret = parent::getTemplateVars($renderer);
     $user = Kwf_Registry::get('userModel')->getAuthedUser();
     $ret['redirectToUrl'] = $this->getData()->getParentByClass(array('Kwc_User_Login_Component', 'Kwc_User_Login_Trl_Component'))->getComponent()->getUrlForRedirect($_REQUEST, $user);
     return $ret;
 }
Example #6
0
 protected function _beforeInsert()
 {
     $user = Kwf_Registry::get('userModel')->getAuthedUser();
     if (!$this->user_id && $user) {
         $this->user_id = $user->id;
     }
 }
 /**
  * returns a list of all visible favourite componentIds
  */
 public static function getFavouriteComponentIds($favouritesModel)
 {
     $ret = array();
     $userId = Kwf_Registry::get('userModel')->getAuthedUserId();
     if ($userId) {
         $cacheIdUser = '******' . $userId;
         $ret = Kwf_Cache_Simple::fetch($cacheIdUser, $success);
         if (!$success) {
             // get all favourites related to user
             $select = new Kwf_Model_Select();
             $select->whereEquals('user_id', $userId);
             $favouritesModel = Kwf_Model_Abstract::getInstance($favouritesModel);
             $favourites = $favouritesModel->getRows($select);
             $componentIds = array();
             foreach ($favourites as $favourite) {
                 $component = Kwf_Component_Data_Root::getInstance()->getComponentById($favourite->component_id);
                 // check if component is visible and existent
                 if ($component) {
                     // if component is visible create list of users related to component
                     $componentIds[] = $component->componentId;
                 }
             }
             // cache relation of visible components to user
             Kwf_Cache_Simple::add($cacheIdUser, $componentIds);
             $ret = $componentIds;
         }
     }
     return $ret;
 }
Example #8
0
 public static function getLanguages()
 {
     $config = Zend_Registry::get('config');
     $langs = array();
     if ($config->webCodeLanguage) {
         $langs[] = $config->webCodeLanguage;
     }
     $possibleUserLanguages = array();
     if ($config->languages) {
         foreach ($config->languages as $lang => $name) {
             $possibleUserLanguages[] = $lang;
         }
     }
     $userModel = Kwf_Registry::get('userModel');
     if (isset($userModel->getAuthedUser()->language) && $userModel->getAuthedUser()->language && in_array($userModel->getAuthedUser()->language, $possibleUserLanguages)) {
         $langs[] = $userModel->getAuthedUser()->language;
     }
     if (Kwf_Component_Data_Root::getComponentClass()) {
         $lngClasses = array();
         foreach (Kwc_Abstract::getComponentClasses() as $c) {
             if (Kwc_Abstract::hasSetting($c, 'baseProperties') && in_array('language', Kwc_Abstract::getSetting($c, 'baseProperties'))) {
                 $lngClasses[] = $c;
             }
         }
         $lngs = Kwf_Component_Data_Root::getInstance()->getComponentsBySameClass($lngClasses, array('ignoreVisible' => true));
         foreach ($lngs as $c) {
             if (Kwf_Registry::get('acl')->getComponentAcl()->isAllowed($userModel->getAuthedUser(), $c)) {
                 $langs[] = $c->getLanguage();
             }
         }
     }
     return array_unique($langs);
 }
 public function getTemplateVars(Kwf_Component_Renderer_Abstract $renderer)
 {
     $ret = parent::getTemplateVars($renderer);
     $users = Kwf_Registry::get('userModel');
     $showPassword = false;
     //is there a password auth?
     foreach ($users->getAuthMethods() as $auth) {
         if ($auth instanceof Kwf_User_Auth_Interface_Password) {
             $showPassword = true;
         }
     }
     if ($showPassword) {
         //if a redirect auth doesn't allow password hide it
         foreach ($users->getAuthMethods() as $auth) {
             if ($auth instanceof Kwf_User_Auth_Interface_Redirect) {
                 $user = $this->getData()->getChildComponent('-form')->getComponent()->getUserRow();
                 if (!$auth->allowPasswordForUser($user)) {
                     $showPassword = false;
                 }
             }
         }
     }
     $ret['showPassword'] = $showPassword;
     $ret['redirects'] = array();
     foreach ($users->getAuthMethods() as $authKey => $auth) {
         if ($auth instanceof Kwf_User_Auth_Interface_Redirect && $auth->showInFrontend()) {
             $label = $auth->getLoginRedirectLabel();
             $ret['redirects'][] = array('url' => $this->getData()->url, 'code' => $_GET['code'], 'authMethod' => $authKey, 'name' => $this->getData()->trlStaticExecute($label['name']), 'icon' => isset($label['icon']) ? '/assets/' . $label['icon'] : false, 'formOptions' => Kwf_User_Auth_Helper::getRedirectFormOptionsHtml($auth->getLoginRedirectFormOptions()));
         }
     }
     return $ret;
 }
Example #10
0
 /**
  * Gibt die Geokoordinaten anhand einer Adresse zurück
  *
  * @param string $address Die Adresse die geocodet werden woll
  * @return array|null $geocode Ein Array mit key 'lat' und 'lng'
  */
 public static function getCoordinates($address)
 {
     $q = $address;
     $q = str_replace(array('ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü', 'ß'), array('ae', 'oe', 'ue', 'Ae', 'Oe', 'Ue', 'ss'), $q);
     $getParams = array('address' => $q, 'sensor' => 'false');
     $httpClientConfig = array('timeout' => 20, 'persistent' => false);
     $config = Kwf_Registry::get('config');
     if ($config->http && $config->http->proxy && $config->http->proxy->host && $config->http->proxy->port) {
         $httpClientConfig['adapter'] = 'Zend_Http_Client_Adapter_Proxy';
         $httpClientConfig['proxy_host'] = $config->http->proxy->host;
         $httpClientConfig['proxy_port'] = $config->http->proxy->port;
     }
     $client = new Zend_Http_Client("http://maps.googleapis.com/maps/api/geocode/json", $httpClientConfig);
     $client->setMethod(Zend_Http_Client::GET);
     $client->setParameterGet($getParams);
     $body = utf8_encode($client->request()->getBody());
     try {
         $result = Zend_Json::decode($body);
     } catch (Zend_Json_Exception $e) {
         $e = new Kwf_Exception_Other($e);
         $e->logOrThrow();
     }
     if (isset($result['results'][0]['geometry']['location']['lat']) && isset($result['results'][0]['geometry']['location']['lng'])) {
         return array('lat' => $result['results'][0]['geometry']['location']['lat'], 'lng' => $result['results'][0]['geometry']['location']['lng']);
     }
     return null;
 }
Example #11
0
 protected function _initFields()
 {
     parent::_initFields();
     $userEditForm = $this->fields->add(new $this->_userDataFormName('user'));
     $userEditForm->setIdTemplate('{0}');
     $root = Kwf_Component_Data_Root::getInstance();
     if ($root) {
         $userDirectory = $root->getComponentByClass('Kwc_User_Directory_Component');
     }
     if ($root && isset($userDirectory) && $userDirectory) {
         $detailClass = Kwc_Abstract::getChildComponentClass($userDirectory->componentClass, 'detail');
         $userEditForm->addUserForms($detailClass, array('general'));
         $userEditForm->fields['firstname']->setAllowBlank(true);
         $userEditForm->fields['lastname']->setAllowBlank(true);
     } else {
         $this->fields->add(new Kwc_User_Detail_General_Form('general', null))->setIdTemplate('{0}');
     }
     $config = Zend_Registry::get('config');
     $authedUser = Kwf_Registry::get('userModel')->getAuthedUser();
     if (isset($authedUser->language) && $config->languages) {
         $data = array();
         foreach ($config->languages as $key => $value) {
             $data[$key] = $value;
         }
         $this->fields->add(new Kwf_Form_Field_Select('language', trlKwf('Language')))->setValues($data);
     }
 }
Example #12
0
 public function testEn()
 {
     $c = $this->_root->getPageByUrl('http://' . Kwf_Registry::get('config')->server->domain . '/en/test', 'en');
     $this->assertEquals('en', $c->getLanguage());
     $render = $c->render();
     $this->assertContains('trlTest: Visible', $render);
     $this->assertContains('trlcTest: On', $render);
     $this->assertContains('trlpTest1: reply', $render);
     $this->assertContains('trlpTest2: replies', $render);
     $this->assertContains('trlcpTest1: reply', $render);
     $this->assertContains('trlcpTest2: replies', $render);
     $this->assertContains('trlKwfTest: Visible', $render);
     $this->assertContains('trlcKwfTest: On', $render);
     $this->assertContains('trlpKwfTest1: reply', $render);
     $this->assertContains('trlpKwfTest2: replies', $render);
     $this->assertContains('trlcpKwfTest1: reply', $render);
     $this->assertContains('trlcpKwfTest2: replies', $render);
     $this->assertContains('trlTestTpl: Visible', $render);
     $this->assertContains('trlcTestTpl: On', $render);
     $this->assertContains('trlpTest1Tpl: reply', $render);
     $this->assertContains('trlpTest2Tpl: replies', $render);
     $this->assertContains('trlcpTest1Tpl: reply', $render);
     $this->assertContains('trlcpTest2Tpl: replies', $render);
     $this->assertContains('trlKwfTestTpl: Visible', $render);
     $this->assertContains('trlcKwfTestTpl: On', $render);
     $this->assertContains('trlpKwfTest1Tpl: reply', $render);
     $this->assertContains('trlpKwfTest2Tpl: replies', $render);
     $this->assertContains('trlcpKwfTest1Tpl: reply', $render);
     $this->assertContains('trlcpKwfTest2Tpl: replies', $render);
 }
 public function update()
 {
     $db = Kwf_Registry::get('db');
     if (!$db->fetchOne("SHOW FIELDS FROM kwc_fulltext_meta LIKE 'changed_recursive'")) {
         $db->query('ALTER TABLE  `kwc_fulltext_meta` ADD  `changed_recursive` TINYINT NOT NULL');
     }
 }
Example #14
0
 public function __construct(array $config = array())
 {
     if (!empty($config['client'])) {
         $this->_client = $config['client'];
     } else {
         if (!empty($config['serverUrl'])) {
             $this->_serverUrl = $config['serverUrl'];
         } else {
             if (!empty($config['serverConfig'])) {
                 $this->_serverConfig = $config['serverConfig'];
             }
         }
     }
     // wenn aus config verwendet, z.B.: service.xxx.url
     if ($this->_serverConfig && !$this->_serverUrl) {
         $cfg = Kwf_Registry::get('config');
         $this->_serverUrl = $cfg->service->{$this->_serverConfig}->url;
         if ($cfg->service->{$this->_serverConfig}->proxy) {
             if (!empty($cfg->service->{$this->_serverConfig}->proxy->host)) {
                 $config['proxyHost'] = $cfg->service->{$this->_serverConfig}->proxy->host;
             }
             if (!empty($cfg->service->{$this->_serverConfig}->proxy->port)) {
                 $config['proxyPort'] = $cfg->service->{$this->_serverConfig}->proxy->port;
             }
             if (!empty($cfg->service->{$this->_serverConfig}->proxy->user)) {
                 $config['proxyUser'] = $cfg->service->{$this->_serverConfig}->proxy->user;
             }
             if (!empty($cfg->service->{$this->_serverConfig}->proxy->password)) {
                 $config['proxyPassword'] = $cfg->service->{$this->_serverConfig}->proxy->password;
             }
         }
     }
     if ($this->_serverUrl) {
         $srpcClientConfig = array('serverUrl' => $this->_serverUrl);
         if (!empty($config['proxyHost'])) {
             $srpcClientConfig['proxyHost'] = $config['proxyHost'];
         }
         if (!empty($config['proxyPort'])) {
             $srpcClientConfig['proxyPort'] = $config['proxyPort'];
         }
         if (!empty($config['proxyUser'])) {
             $srpcClientConfig['proxyUser'] = $config['proxyUser'];
         }
         if (!empty($config['proxyPassword'])) {
             $srpcClientConfig['proxyPassword'] = $config['proxyPassword'];
         }
         $this->_client = new Kwf_Srpc_Client($srpcClientConfig);
     }
     $this->_init();
     if (!$this->_client) {
         throw new Kwf_Exception("No client or serverUrl has been set in '" . get_class($this) . "'");
     } else {
         if (!$this->_client instanceof Kwf_Srpc_Client) {
             throw new Kwf_Exception("Client must be of type 'Kwf_Srpc_Client' in '" . get_class($this) . "'");
         }
     }
     if (!empty($config['timeout']) && is_integer($config['timeout'])) {
         $this->_client->setTimeout($config['timeout']);
     }
 }
 public function preProcessInput()
 {
     //use custom user model
     Kwf_Registry::get('config')->user->model = 'Kwc_FavouritesSelenium_UserModel';
     //unset existing userModel instance to get new one
     $reg = Kwf_Registry::getInstance()->set('userModel', Kwf_Model_Abstract::getInstance('Kwc_FavouritesSelenium_UserModel'));
 }
 protected function _getDb()
 {
     if (isset($this->_db)) {
         return $this->_db;
     }
     return Kwf_Registry::get('db');
 }
 public function log(Kwf_Exception_Abstract $exception, $type, $content)
 {
     $path = 'log/' . $type . '/' . date('Y-m-d');
     $filename = date('H_i_s') . '_' . uniqid() . '.txt';
     $exception->setLogId($type . ':' . $filename);
     if (!is_dir($path)) {
         @mkdir($path, 0777);
     }
     try {
         $fp = fopen("{$path}/{$filename}", 'a');
         fwrite($fp, $content);
         fclose($fp);
     } catch (Exception $e) {
         $to = array();
         if (Kwf_Registry::get('config')->developers) {
             foreach (Kwf_Registry::get('config')->developers as $dev) {
                 if (isset($dev->sendException) && $dev->sendException) {
                     $to[] = $dev->email;
                 }
             }
         }
         if ($to) {
             mail(implode('; ', $to), 'Error while trying to write error file', $e->__toString() . "\n\n---------------------------\n\nOriginal Exception:\n\n" . $content);
         }
     }
     return true;
 }
Example #18
0
 public function update()
 {
     $dbConfig = Zend_Registry::get('db')->getConfig();
     $mysqlOptions = "--host=" . escapeshellarg($dbConfig['host']) . " --user="******" --password="******" " . escapeshellarg($dbConfig['dbname']) . " ";
     $mysqlBinary = 'mysql';
     exec("which {$mysqlBinary} 2>&1", $out, $ret);
     if (!$ret) {
         $descriptorspec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w"));
         $process = proc_open($mysqlBinary . ' ' . $mysqlOptions, $descriptorspec, $pipes);
         if (!is_resource($process)) {
             throw new Kwf_Exception("Can't execute mysql");
         }
         fwrite($pipes[0], $this->sql);
         fclose($pipes[0]);
         $output = stream_get_contents($pipes[1]);
         fclose($pipes[1]);
         $output .= stream_get_contents($pipes[2]);
         fclose($pipes[2]);
         if (proc_close($process) != 0) {
             throw new Kwf_Exception("Executing '{$this->_uniqueName}' sql statement failed: " . $output);
         }
     } else {
         //fallback falls kein mysql-binary vorhanden
         //regexp von http://www.dev-explorer.com/articles/multiple-mysql-queries
         $queries = preg_split("/;+(?=([^'|^\\\\']*['|\\\\'][^'|^\\\\']*['|\\\\'])*[^'|^\\\\']*[^'|^\\\\']\$)/", $this->sql);
         foreach ($queries as $query) {
             if (trim($query)) {
                 Kwf_Registry::get('db')->getConnection()->query($query);
             }
         }
     }
 }
Example #19
0
 public function testDomain()
 {
     $domain = Kwf_Registry::get('config')->server->domain;
     $this->assertEquals($domain, $this->_root->getDomain());
     $this->assertEquals("at.{$domain}", $this->_at->getDomain());
     $this->assertEquals("si.{$domain}", $this->_si->getDomain());
 }
 public static function getSettings($param = null)
 {
     $ret = parent::getSettings($param);
     $ret['recipientSources'] = array('u' => get_class(Kwf_Registry::get('userModel')));
     $ret['viewCache'] = false;
     return $ret;
 }
 public function createToken(Request $request, $providerKey)
 {
     $user = \Kwf_Registry::get('userModel')->getAuthedUser();
     if ($user) {
         $token = new KwfUserToken(new KwfUser($user));
         return $token;
     } else {
         return null;
     }
     /*
             // look for an apikey query parameter
             $apiKey = $request->query->get('apikey');
     
             // or if you want to use an "apikey" header, then do something like this:
             // $apiKey = $request->headers->get('apikey');
     
             if (!$apiKey) {
                 throw new BadCredentialsException('No API key found');
                 // or to just skip api key authentication
                 //return null;
             }
     
             return new PreAuthenticatedToken(
                 'anon.',
                 $apiKey,
                 $providerKey
             );
     */
 }
 protected function _init()
 {
     $userModelClass = get_class(Kwf_Registry::get('userModel')->getEditModel());
     $this->_referenceMap['User']['refModelClass'] = $userModelClass;
     $this->_referenceMap['ByUser']['refModelClass'] = $userModelClass;
     parent::_init();
 }
 protected function _getAuthData()
 {
     if (PHP_SAPI == 'cli') {
         return null;
     }
     return Kwf_Registry::get('userModel')->getAuthedUser();
 }
 public function postUpdate()
 {
     if ($this->_afterUpdateRequired) {
         $c = Kwf_Component_Data_Root::getInstance()->getComponentByClass('Kwc_NewsletterCategory_Component', array('limit' => 1));
         Kwf_Registry::get('db')->query("UPDATE `kwc_newsletter_categories` SET newsletter_component_id='{$c->dbId}'");
     }
 }
 protected function _beforeInsert(Kwf_Model_Row_Interface $row)
 {
     parent::_beforeInsert($row);
     $row->component_id = $this->getData()->dbId;
     $row->user_id = Kwf_Registry::get('userModel')->getAuthedUser()->id;
     $row->date = date('Y-m-d H:i:s', time());
 }
 public function update()
 {
     $entries = Kwf_Registry::get('db')->query('SELECT COUNT(*) FROM kwc_events_to_categories')->fetchColumn();
     if (!$entries) {
         return;
     }
     Kwf_Registry::get('db')->query('ALTER TABLE `kwc_events_to_categories` CHANGE `category_id` `category_id` INT( 11 ) NOT NULL DEFAULT \'0\'');
     Kwf_Registry::get('db')->query('UPDATE kwc_events_to_categories SET category_id=-category_id');
     $m = Kwf_Model_Abstract::getInstance('Kwf_Util_Model_Pool');
     $s = $m->select()->whereEquals('pool', 'Newskategorien');
     $pool = $m->getRows($s);
     $cats = Kwf_Component_Data_Root::getInstance()->getComponentsByClass('Kwc_Events_Category_Directory_Component');
     foreach ($cats as $cat) {
         foreach ($pool as $r) {
             $newRow = Kwf_Model_Abstract::getInstance('Kwc_Directories_Category_Directory_CategoriesModel')->createRow();
             $newRow->component_id = $cat->dbId;
             $newRow->pos = $r->pos;
             $newRow->name = $r->value;
             $newRow->visible = $r->visible;
             $newRow->save();
             $sql = "UPDATE kwc_events_to_categories SET category_id={$newRow->id} WHERE category_id=-{$r->id}\n                            AND event_id IN (SELECT id FROM kwc_events WHERE component_id='" . $cat->parent->dbId . "')";
             Kwf_Registry::get('db')->query($sql);
         }
     }
     Kwf_Registry::get('db')->query("DELETE FROM kwf_pools WHERE pool='Eventcategories'");
 }
 protected function _afterSave(Kwf_Model_Row_Interface $row)
 {
     parent::_afterSave($row);
     $user = Kwf_Registry::get('userModel')->getAuthedUser();
     $user->setPassword($this->_form->getRow()->new_password);
     $user->clearActivationToken();
 }
Example #28
0
 protected function _init()
 {
     parent::_init();
     $this->_referenceMap = array('Author' => array('refModel' => Kwf_Registry::get('userModel'), 'column' => 'author_id'));
     $this->_exprs['author_firstname'] = new Kwf_Model_Select_Expr_Parent('Author', 'firstname');
     $this->_exprs['author_lastname'] = new Kwf_Model_Select_Expr_Parent('Author', 'lastname');
 }
 public function headerAction()
 {
     try {
         $t = new Kwf_Util_Model_Welcome();
         $row = $t->getRow(1);
     } catch (Zend_Db_Statement_Exception $e) {
         //wenn tabelle nicht existiert fehler abfangen
         $row = null;
     }
     if ($row && $row->getParentRow('LoginImage')) {
         $this->view->image = Kwf_Media::getUrlByRow($row, 'LoginImage');
         $this->view->imageSize = Kwf_Media::getDimensionsByRow($row, 'LoginImage');
     } else {
         $this->view->image = false;
     }
     if (Kwf_Registry::get('config')->allowUntagged === true) {
         if (file_exists('.git') && Kwf_Util_Git::web()->getActiveBranch() != 'production') {
             $this->view->untagged = true;
         }
         if (file_exists(KWF_PATH . '/.git') && Kwf_Util_Git::kwf()->getActiveBranch() != 'production/' . Kwf_Registry::get('config')->application->id) {
             $this->view->untagged = true;
         }
     }
     $this->view->application = Zend_Registry::get('config')->application->toArray();
     $this->_helper->viewRenderer->setRender('loginheader');
 }
 public function update()
 {
     $model = new Kwf_Component_FieldModel();
     $db = Kwf_Registry::get('db');
     foreach ($db->query("SELECT * FROM kwc_basic_flash")->fetchAll() as $row) {
         if ($row['flash_source_type'] != 'external_flash_url') {
             echo "\n\nACHTUNG FLASH mit upload konnte nicht konvertiert werden ({$row['component_id']})\n\n";
             continue;
         }
         $newRow = $model->getRow($row['component_id']);
         if (!$newRow) {
             $newRow = $model->createRow();
             $newRow->component_id = $row['component_id'];
         }
         $code = "<object width=\"{$row['width']}\" height=\"{$row['height']}\">\n";
         $url = $row['external_flash_url'];
         $vars = array();
         foreach ($db->query("SELECT * FROM kwc_basic_flash_vars WHERE parent_id='{$row['component_id']}'") as $v) {
             $vars[] = urlencode($v['key']) . '=' . urlencode($v['value']);
         }
         if ($vars) {
             $url .= "?" . implode('&', $vars);
         }
         $code .= "  <param name=\"movie\" value=\"" . htmlspecialchars($url) . "\">\n";
         $code .= "  <param name=\"allow_fullscreen\" value=\"{$row['allow_fullscreen']}\">\n";
         $code .= "  <param name=\"menu\" value=\"{$row['menu']}\">\n";
         $code .= "</object>\n";
         $newRow->code = $code;
         $newRow->save();
     }
     //und tschüss
     $db->query("DROP TABLE kwc_basic_flash");
     $db->query("DROP TABLE kwc_basic_flash_vars");
 }