Example #1
1
 function __construct($cmid = 0)
 {
     global $db;
     $this->_cmid = $cmid;
     if ($this->_cmid != 0) {
         $this->_dbo = DB_DataObject::Factory("phph_comments");
         if (PEAR::isError($this->_dbo)) {
             throw new Exception2("Bd wewn�rzny", $this->_dbo->getMessage());
         }
         $r = $this->_dbo->get($cmid);
         if (PEAR::isError($r)) {
             throw new Exception2("Bd wewn�rzny", $r->getMessage());
         }
         if ($r == 0) {
             throw new Exception2("Bd", "Komentarz nie istnieje", COMMENT_NOT_FOUND);
         }
         $this->_user = DB_DataObject::Factory("phph_users");
         if (PEAR::isError($this->_user)) {
             throw new Exception2("Bd wewn�rzny", $this->_user->getMessage());
         }
         $r = $this->_user->get($this->_dbo->user_id);
         if (PEAR::isError($r)) {
             throw new Exception2("Bd wewn�rzny", $r->getMessage());
         }
         if ($r == 0) {
             throw new Exception2("Bd sp�noci danych", "Uytkownik do kt�ego nalezy komentarz nie istnieje.<br />Skontakuj si�z administratorem, podajc numer komentarza ({$cmid}).", COMMENT_USER_NOT_FOUND);
         }
     }
 }
Example #2
0
File: db.php Project: demental/m
 protected function _newImage(DB_DataObject $obj)
 {
     $defs = $obj->_getPluginsDef();
     $tbl = DB_DataObject::factory($defs['otfimagereceiver']['table']);
     $tbl->record_table = $obj->tableName();
     $tbl->record_id = $obj->pk();
     return $tbl;
 }
Example #3
0
 public function __construct(DB_DataObject $do, $values)
 {
     $this->do = $do;
     if (!is_array($values)) {
         throw new Exception('Values must be an array !');
     }
     $this->values = $values;
     $this->db = $do->getDatabaseConnection();
 }
 /**
  * @param DB_DataObject $class
  * @param string $label
  * @param string $field
  * @return array
  */
 function getSessionFilterSubTable($class, $label, $field)
 {
     $class->orderBy('value ASC');
     $class->find();
     $filter = array();
     $filter['label'] = $label;
     $filter['field'] = $field;
     $filter['values'] = array();
     $filter['values']['null'] = 'unset';
     while ($class->fetch()) {
         $filter['values'][$class->id] = $class->value;
     }
     natcasesort($filter['values']);
     return $filter;
 }
 function del($params)
 {
     $json = new Services_JSON();
     $subcategory = DB_DataObject::factory("subcategory");
     $subcategory->id = $params["id"];
     print $subcategory->delete() ? $json->encode(array("error" => false)) : $json->encode(array("error" => true));
 }
 function getq($params)
 {
     $json = new Services_JSON();
     $item = DB_DataObject::factory("item");
     if (isset($params["categ"]) && $params["categ"] > 0) {
         $item->whereAdd("subcategory_id = {$params['categ']}", "OR");
         $item->whereAdd("subcategory_id2 = {$params['categ']}", "OR");
         $item->whereAdd("subcategory_id3 = {$params['categ']}", "OR");
     }
     $count = $item->count();
     $total = $count > 0 ? ceil($count / (int) $params["rows"]) : 0;
     $page = min($params["page"], $total);
     $start = max(0, (int) $params["rows"] * $page - (int) $params["rows"]);
     $item->selectAdd();
     $item->selectAdd("id, url, title, descr");
     $item->orderBy("{$params['sidx']} {$params['sord']}");
     $item->limit($start, (int) $params["rows"]);
     $item->find();
     $res = array();
     while ($item->fetch()) {
         $res["rows"][] = array("id" => $item->id, "cell" => array($item->id, $item->url, $item->title, $item->descr));
     }
     $res["page"] = $page;
     $res["total"] = $total;
     $res["records"] = $count;
     print $json->encode($res);
 }
Example #7
0
 function init($pg)
 {
     $group = DB_DataObject::factory('core_group');
     // group should be auto created - by update-database...
     if (!$group->get('name', 'core-person-signup-bcc')) {
         $group = DB_DataObject::factory('core_group');
         $group->name = 'core-person-signup-bcc';
         $group->insert();
     }
     $p = DB_DataObject::factory('core_person');
     if (!$p->count()) {
         return;
         // can not check people...
     }
     // got people...
     $member = DB_DataObject::factory('core_group_member');
     $member->group_id = $group->id;
     if ($member->count()) {
         return;
     }
     // not got members..
     // if we only have one member - then add it .... (it's the admin, and they can modify this later.. - after they get annoyed with it..
     $p->find(true);
     $member = DB_DataObject::factory('core_group_member');
     $member->group_id = $group->id;
     $member->user_id = $p->id;
     $member->insert();
     // only display if we have members..
 }
Example #8
0
function launchFacebook($terminoBuscar)
{
    $app_access_token = genToken();
    $resultFacebook = app_request("https://graph.facebook.com/v2.5/search?q=" . $terminoBuscar . "&type=page&limit=10&fields=id,name,picture.type(normal),likes&" . $app_access_token);
    //printVar($resultFacebook,$_SERVER['SERVER_NAME'].'/publication/search/results/resultFacebook.json');
    //printVar($_SERVER["DOCUMENT_ROOT"]);
    $fp = fopen($_SERVER["DOCUMENT_ROOT"] . '/publication/search/results/resultFacebook.json', 'w');
    $qpaso = fwrite($fp, json_encode($resultFacebook));
    fclose($fp);
    //printVar($qpaso,'que paso');
    $obj = DB_DataObject::Factory('MpBrand');
    $obj->name = $terminoBuscar;
    $find = $obj->find();
    if ($find > 0) {
        // echo 'entra al if';
        while ($obj->fetch()) {
            //DB_DataObject::debugLevel(1);
            $obj->picture = $resultFacebook['data'][0]['picture']['data']['url'];
            $obj->update();
        }
    } else {
    }
    $obj->free();
    //echo json_encode('');
}
Example #9
0
 function execute(&$controller, &$request, &$user)
 {
     $account = $request->getParameter('account');
     $format = $request->hasParameter('format') ? $request->getParameter('format') : 'html';
     $member = DB_DataObject::factory('member');
     $member->get('account', $account);
     $site = DB_DataObject::factory('site');
     $site->get('member_id', $member->id);
     $feed = DB_DataObject::factory('feed');
     $feeds = $feed->getListsByAccount($account);
     switch ($format) {
         case 'opml11':
             foreach ($feeds as $key => $feed) {
                 $f = array('title' => $feed->title, 'text' => $feed->description, 'link' => $feed->link, 'uri' => $feed->uri);
                 $feeds[$key] = $f;
             }
             $writer =& new OPMLWriter();
             $writer->setHead(array('title' => $site->title, 'date' => time(), 'owner' => $account));
             $writer->setOutlines($feeds);
             $writer->display($format);
             return VIEW_NONE;
         case 'html':
         default:
             $request->setAttribute('sources', $feeds);
             return VIEW_SUCCESS;
     }
 }
Example #10
0
 function recover($code)
 {
     if (!$this->getAuthUser()) {
         $this->jerr("invalid");
     }
     // fixme!!!!
     $fn = $this->rootDir . '/Pman/' . $code . '.js';
     list($app, $mod) = explode('/', $code);
     if (!file_exists($fn)) {
         $this->jerr("file does not exist.:" . $fn);
     }
     $data = file_get_contents($fn);
     preg_match("#/*\n--SOURCE--\n([^\\*]+)#m", $data, $matches);
     // echo "<PRE>";print_R($matches);
     $base = $matches[1];
     $str = bzdecompress(base64_decode($base));
     $js = json_decode($str);
     //echo "<PRE>";print_R($str);
     $b = DB_DataObject::factory('builder');
     $b->app = $app;
     $b->module = $mod;
     $b->btype = 'FORM';
     $b->name = $js->name;
     if (!$b->find(true)) {
         $b->insert();
     }
     echo "<PRE>" . htmlspecialchars(print_r($b, true));
     $b->json = $str;
     $b->update();
     $this->jok("DONE");
     exit;
 }
Example #11
0
 function login()
 {
     $this->showStylesheets();
     $nickname = common_canonical_nickname($this->trimmed('nickname'));
     $password = $this->arg('password');
     $msg = null;
     if ($nickname) {
         if (common_check_user($nickname, $password)) {
             $user = User::staticGet('nickname', $nickname);
             if (!$user) {
                 $this->showLoginForm(_m("Server error: Couldn't get user!"));
             }
             $flink = DB_DataObject::factory('foreign_link');
             $flink->user_id = $user->id;
             $flink->foreign_id = $this->fbuid;
             $flink->service = FACEBOOK_SERVICE;
             $flink->created = common_sql_now();
             $flink->set_flags(true, false, false, false);
             $flink_id = $flink->insert();
             // XXX: Do some error handling here
             $this->setDefaults();
             $this->getUpdatePermission();
             return;
         } else {
             $msg = _m('Incorrect username or password.');
         }
     }
     $this->showLoginForm($msg);
     $this->showFooter();
 }
Example #12
0
 /**
  * Get a list of memberships for a person
  * @param Pman_Core_DataObjects_Person $person who
  * @param String column to fetch.. eg. group_id or 'name'
  *
  */
 function listGroupMembership($person, $arrayof = 'group_id')
 {
     $this->inAdmin = false;
     $t = clone $this;
     //DB_DataObject::debugLevel(1);
     $grp = DB_DataObject::factory('core_group');
     $t->joinAdd($grp, 'LEFT');
     //$person->id = (int)$person->id;
     $t->whereAdd("\n            user_id = {$person->id}\n        ");
     $t->selectAdd();
     $t->selectAdd("distinct(group_id), {$grp->tableName()}.name as name");
     $t->whereAdd('group_id IS NOT NULL');
     $t->find();
     $ret = array();
     // $ret = $arrayof == 'group_id' ? array(0) : array();
     // default member of 'All groups'!!
     while ($t->fetch()) {
         $ret[] = $t->{$arrayof};
         if ($t->name == 'Administrators') {
             /// mmh... bit risky?
             $this->inAdmin = true;
         }
     }
     if ($arrayof == 'group_id' && !count($ret)) {
         $ret = array(0);
         /// default if they are not a member of any group.
     }
     //var_dump($ret);
     return $ret;
 }
 public function lunchReport($idBrand, $idSocialNetwork, $idInteraction)
 {
     $report = DB_DataObject::Factory('MpBrandXSocialNetwork');
     // DB_DataObject::debugLevel(1);
     $report->idBrand = $idBrand;
     $report->idInteraction = $idInteraction;
     $report->idSocialNetwork = $idSocialNetwork;
     $find = $report->find();
     if ($find > 0) {
         while ($report->fetch()) {
             if ($report->status == 'L') {
                 $report->status = 'E';
                 $report->update();
             }
         }
     } else {
         $report->snID = "Aqui va algo";
         $report->ownedBrand = 'N';
         $report->status = 'E';
         $report->date = date('Y-m-d h:i:s');
         $l = $report->insert();
         // printVar($l);
     }
     $report->free();
     return 'ok';
 }
Example #14
0
 function get($table)
 {
     $d = DB_DAtaObject::Factory($table);
     if (method_exists($d, 'availableColumns')) {
         $cols = $d->availableColumns();
     } else {
         $re = $d->autoJoin();
         //echo '<PRE>';print_r($re);
         $cols = $re['cols'];
         $types = array();
         $tables = array();
         $schemas = array($table => $d->table());
         foreach ($cols as $name => $table_col) {
             list($tbl, $col) = explode('.', $table_col);
             if (!isset($schemas[$tbl])) {
                 $schemas[$tbl] = DB_DataObject::Factory($tbl)->table();
             }
             $types[$name] = $schemas[$tbl][$col];
             $tables[$name] = $tbl;
         }
         foreach ($re['join_names'] as $c => $f) {
             $cols[$c] = $f;
         }
     }
     foreach ($cols as $c => $f) {
         $ret[] = array('name' => $c, 'val' => $f, 'type' => isset($types[$c]) ? $this->typeToName($types[$c]) : -1, 'table' => isset($tables[$c]) ? $tables[$c] : "");
     }
     $this->jdata($ret);
 }
Example #15
0
 function post()
 {
     $si = DB_DataObject::factory('Signup');
     if (empty($_REQUEST['id']) || !$si->get($_REQUEST['id'])) {
         $this->jerr("invalid request");
     }
     if ($si->person_id != 0) {
         $si->jerr("Account already processed");
     }
     // rejected..
     if ($_REQUEST['person_id'] < 0) {
         $si->setFrom($_REQUEST);
         $si->update();
         $this->jok("OK");
     }
     $p = DB_DataObject::factory("core_person");
     $p->setFrom($_REQUEST);
     $p->insert();
     $si->setFrom($_REQUEST);
     $si->person_id = $p->id;
     $si->update();
     // generate a password
     // and send welcome message.
     $this->jok($p->toArray());
 }
Example #16
0
 public function delete()
 {
     $log = DB_DataObject::factory('log');
     $log->id_users = $this->id;
     $this->user_log(e('log_cleanup', array($log->delete())));
     redirect('log');
 }
Example #17
0
function makeEditForm($selfurl)
{
    // nice names for each field
    $formNames = array('cfg_incoming_path' => 'Kannel Incoming Path: ', 'cfg_username' => 'Username:'******'cfg_password' => 'Password:'******'cfg_global_sender' => 'Global Sender:', 'cfg_bearerbox_host' => 'Bearerbox IP:', 'cfg_sendsms_port' => 'Send SMS Port:', 'cfg_playsms_web' => 'PlaySMS web url:', 'cfg_restart_frequency' => 'Restart Kannel Regularly?');
    // infer the fields we're going to show
    // from the list of formNames
    $renderFields = array();
    foreach ($formNames as $field => $name) {
        $renderFields[] = $field;
    }
    // find the first record in the config table
    $do = DB_DataObject::factory('playsms_gwmodKannel_config');
    $do->get(1);
    // create the form with the user-showable names
    $fb = DB_DataObject_FormBuilder::create($do, array("fieldLabels" => $formNames, "fieldsToRender" => $renderFields));
    // set up enums
    $fb->enumFields = array('cfg_restart_frequency');
    $form = $fb->getForm("{$selfurl}");
    if ($form->validate()) {
        $err = "Gateway module configurations has been saved";
        print "<p><font color=red>{$err}</font><p>";
        $form->process(array(&$fb, 'processForm'), false);
    }
    $form->display();
    echo "<p/><hr/><p/>";
    echo "<a href=\"plugin/gateway/kannel/kannel-monitor/\">[ Monitor Status ]</a> \n";
    echo "<a href=\"{$selfurl}&op=manage_smsc\">[ Bind SMSC ]</a>";
}
Example #18
0
 function _getCache($uri)
 {
     $feed = DB_DataObject::factory('feed');
     $feed->uri = $uri;
     $feed->find();
     $feed->fetch();
     $channel = array('title' => $feed->title, 'link' => $feed->link, 'favicon' => $feed->favicon);
     // items
     $items = array();
     $f2e = DB_DataObject::factory('feed_to_entry');
     $f2e->feed_id = $feed->id;
     $f2e->find();
     while ($f2e->fetch()) {
         $entry = DB_DataObject::factory('entry');
         $entry->id = $f2e->entry_id;
         $entry->find();
         while ($entry->fetch()) {
             $item = array();
             $item['title'] = $entry->title;
             $item['link'] = $entry->uri;
             $item['description'] = $entry->description;
             $item['date'] = $entry->date;
             $items[] = $item;
         }
     }
     $struct = array('channel' => $channel, 'items' => $items);
     return $struct;
 }
Example #19
0
 function hasReleases()
 {
     $rel =& DB_DataObject::factory('releases');
     $rel->channel = $this->channel;
     $rel->package = $this->package;
     return $rel->find();
 }
Example #20
0
File: CMS.php Project: demental/m
 protected function populateCMS($action)
 {
     try {
         $content = Mreg::get('content');
     } catch (Exception $e) {
         $content = DB_DataObject::factory($this->_dbtable);
     }
     if (!$this->_forceaccessible && !empty($this->_dbaccessibleaspage)) {
         $content->{$this->_dbaccessibleaspage} = 1;
     }
     if (key_exists('alias_id', $content->table())) {
         $content->whereAdd('alias_id is null');
     }
     if (!$content->get($this->_dbstrip, $action)) {
         $this->handleNotFound($action);
         return;
     }
     if ($content->{$this->_dbisnode}) {
         $target = strtolower(str_replace('Module_', '', get_class($this))) . '/' . $content->getPlugin('tree')->getFirstChild($content)->{$this->_dbstrip};
         $this->redirect301($target);
     }
     $this->assignRef('content', $content);
     $this->_content = $content;
     try {
         Mreg::set('content', $content);
     } catch (Exception $e) {
     }
     $this->assign($this->_tpltitle, $content->{$this->_dbtitle});
 }
Example #21
0
 function execute(&$controller, &$request, &$user)
 {
     $member = $user->getAttribute('member', GLU_NS);
     $user->setAttribute('member', $member, GLU_NS);
     $custom = $request->hasParameter('custom_design_submit') ? $request->getParameter('custom_design_submit') : null;
     if ($custom) {
         $ct = DB_DataObject::factory('custom_template');
         $ct->member_id = $member->id;
         if ($ct->count() > 0) {
             $ct->get('member_id', $member->id);
             $ct->template = $request->getParameter('css');
             $ct->update();
         } else {
             $ct->member_id = $member->id;
             $ct->template = $request->getParameter('css');
             $ct->insert();
         }
         Controller::redirect(SCRIPT_PATH . 'setting/design/changed_custom');
     } else {
         $member->design_id = $request->getParameter('design_id');
         $member->update();
         Controller::redirect(SCRIPT_PATH . 'setting/design/changed');
     }
     return VIEW_NONE;
 }
Example #22
0
 public function testAddtag()
 {
     $do = DB_DataObject::factory('tagged');
     $this->assertFalse($do->addTag($this->tag), 'a tag cannot be added to a record that dont have an ID');
     $do->title = 'test title';
     $do->insert();
     $this->assertTrue($do->addTag($this->tag));
     $t = DB_DataObject::factory('tag_record');
     $t->record_id = $do->id;
     $t->tag_id = $this->tag->id;
     $t->tagged_table = 'tagged';
     $this->assertTrue($t->find());
     // Adding a tag a second time returns true although....
     $this->assertTrue($do->addTag($this->tag));
     // ... It's not recorded twice in the relationship table
     $t = DB_DataObject::factory('tag_record');
     $t->record_id = $do->id;
     $t->tag_id = $this->tag->id;
     $t->tagged_table = 'tagged';
     $t->find(true);
     $this->assertFalse($t->fetch(), 'A tag can be added only once to a record');
     // Testing on another table to see if table name is saved successfully
     $do2 = DB_DataObject::factory('tagged2');
     $do2->title = 'test title';
     $do2->insert();
     $this->assertTrue($do2->addTag($this->tag));
     $t = DB_DataObject::factory('tag_record');
     $t->record_id = $do2->id;
     $t->tag_id = $this->tag->id;
     $t->tagged_table = 'tagged2';
     $this->assertTrue($t->find());
 }
Example #23
0
 function execute(&$controller, &$request, &$user)
 {
     $account = $request->getParameter('account');
     $request->setAttribute('account', $account);
     $count = $request->hasParameter('count') ? $request->getParameter('count') : 16;
     $callback = $request->hasParameter('callback') ? $request->getParameter('callback') : false;
     $request->setAttribute('callback', $callback);
     $raw = $request->hasParameter('raw') ? true : false;
     $request->setAttribute('raw', $raw);
     $member = DB_DataObject::factory('member');
     $member->get('account', $account);
     $site = DB_DataObject::factory('site');
     $site->get('member_id', $member->id);
     $feed = array();
     $feed['uri'] = SCRIPT_PATH . "{$member->account}/";
     $feed['title'] = $site->title;
     $feed['description'] = $site->description;
     $feed['author'] = $member->account;
     $entries = EntryUtils::get_entries_by_account($account, $count);
     foreach ($entries as $key => $entry) {
         $entry['tags'] = TagUtils::get_tags_by_entry_id($entry['id']);
         $entries[$key] = $entry;
     }
     $feed = $feed + $entries;
     $request->setAttribute('feed', $feed);
     $request->setAttribute('entries', $entries);
     return VIEW_SUCCESS;
 }
Example #24
0
 function execute(&$controller, &$request, &$user)
 {
     $member = $user->getAttribute('member', GLU_NS);
     // my feeds
     $source = DB_DataObject::factory('source');
     $source->whereAdd('member_id = ' . $source->escape($member->id));
     if ($request->hasParameter('id')) {
         $source->whereAdd('id = ' . $source->escape($request->getParameter('id')));
     }
     $source->find();
     $feeds = array();
     while ($source->fetch()) {
         $rss = new FeedParser($source->uri);
         $rss->parse();
         foreach ($rss->getItems() as $item) {
             $feed['id'] = $source->id;
             $feed['title'] = $item['title'];
             $feed['link'] = $item['link'];
             $feed['description'] = isset($item['description']) ? $item['description'] : '';
             $feed['date'] = isset($item['dc:date']) ? $item['dc:date'] : (isset($item['date']) ? $item['date'] : '');
             $feeds[] = $feed;
         }
     }
     $haj = new HTML_AJAX_JSON();
     $output = $haj->encode($feeds);
     header('Content-Type: application/x-javascript; charset=utf-8');
     echo $output;
     return VIEW_NONE;
 }
Example #25
0
 public function doExecSetasmain()
 {
     $p = DB_DataObject::factory('photo');
     $p->get_or_die($_GET['record']);
     $p->setAsMain();
     return $this->setOuput('ok');
 }
 static function getUserLevel($uid)
 {
     global $db;
     $gl = 0;
     $q = $db->prepare("SELECT IFNULL(MAX(group_level), 0) AS gl FROM phph_groups WHERE group_id IN (SELECT group_id FROM phph_group_users WHERE user_id = ?)");
     if (PEAR::isError($q)) {
         die($q->getMessage());
     }
     $r = $db->execute($q, $uid);
     if (PEAR::isError($r)) {
         die($r->getMessage());
     }
     $row = $r->fetchRow();
     $gl = $row['gl'];
     $user = DB_DataObject::Factory("phph_users");
     if (PEAR::isError($user)) {
         die($user->getMessage());
     }
     $r = $user->get($uid);
     if (PEAR::isError($r)) {
         die($r->getMessage());
     }
     if ($r == 0) {
         return 0;
     }
     return max($gl, $user->user_level);
 }
Example #27
0
 function execute(&$filterChain, &$controller, &$request, &$user)
 {
     $loaded =& $request->getAttribute('AutoLoginFilter');
     if ($loaded == null) {
         $token = isset($_COOKIE['token']) ? $_COOKIE['token'] : null;
         if ($token and !$user->isAuthenticated()) {
             list($id, $password) = split('-', $token);
             $member = DB_DataObject::factory('member');
             $member->get($id);
             if ($member->password == $password) {
                 $user->setAuthenticated(true);
                 $user->addPrivilege('member', GLU_NS);
                 $user->setAttribute('member', $member, GLU_NS);
                 // added cookie liftime for footprint
                 /*
                                     setcookie(
                                         'token', $token, time() + PLNET_LOGIN_LIFETIME
                                     );
                 */
             }
         }
         $filterChain->execute($controller, $request, $user);
     } else {
         $filterChain->execute($controller, $request, $user);
     }
 }
Example #28
0
function makeEditForm($selfurl)
{
    // nice names for each field
    $formNames = array('cfg_web_title' => 'Website title:', 'cfg_web_url' => 'Website URL:', 'cfg_email_service' => 'Website email', 'cfg_email_footer' => 'Forwarded email footer:', 'cfg_gateway_module' => 'Activated gateway module:', 'cfg_gateway_number' => 'Gateway number:', 'cfg_system_from' => 'System messages <br/> (e.g., balance updates) are sent from:', 'cfg_system_restart_frequency' => 'Restart the entire system regularly?');
    // infer the fields we're going to show
    // from the list of formNames
    $renderFields = array();
    foreach ($formNames as $field => $name) {
        $renderFields[] = $field;
    }
    // List of gateway plugins.
    // TODO: make this get listing of the gw plugin files
    // rather than be hard-coded
    $gw_mods = array("kannel" => "Kannel", "gnokii" => "Gnokii", "uplink" => "UpLink", "clickatell" => "ClickAtell");
    // find the first record in the config table
    $do = DB_DataObject::factory(playsms_tblConfig_main);
    $do->find();
    $do->fetch();
    // create the form with the user-showable names
    $fb = DB_DataObject_FormBuilder::create($do, array("fieldLabels" => $formNames, "fieldsToRender" => $renderFields));
    $fb->submitText = "Save";
    // set up gw_mod enum
    $fb->enumFields = array('cfg_gateway_module', 'cfg_system_restart_frequency');
    $fb->enumOptions = array('cfg_gateway_module' => $gw_mods);
    $form = $fb->getForm("{$selfurl}");
    if ($form->validate()) {
        $err = "Main configuration has been saved";
        print "<p><font color=red>{$err}</font><p>";
        $form->process(array(&$fb, 'processForm'), false);
    }
    $form->display();
}
Example #29
0
 public function memo()
 {
     if (strlen($this->request['q']) < $this->min_search_chars) {
         die(e('min_fn_l') . $this->min_search_chars);
     }
     $searchlist = array('title', 'note');
     $q = str_replace('*', '.*', strtolower($this->request['q']));
     $memos = DB_DataObject::factory('memos');
     $memos->id_users = $this->id;
     $this->ret = $this->ret['ret'] = array();
     $this->ret['count'] = 0;
     if ($memos->find()) {
         while ($memos->fetch()) {
             $memo_array = $this->arc_decrypt_output(array(clone $memos));
             $treffer = FALSE;
             foreach ($searchlist as $s) {
                 if ($treffer == FALSE) {
                     if (preg_match('%.*' . $q . '.*%', strtolower($memo_array[0][$s]))) {
                         $treffer = TRUE;
                         if (!in_array($memos->id, $this->ret['ret'])) {
                             $this->ret['ret'][] = $memos->id;
                             $this->ret['count']++;
                         }
                     }
                 }
             }
         }
     }
     $this->content = json_encode($this->ret);
     $this->useview = $this->setlayout = FALSE;
 }
Example #30
0
 public function update()
 {
     $id = $this->request['id_arc'];
     $this->check_permissons('arcanums', $id);
     $old_arc = DB_DataObject::factory('arcanums');
     $old_arc->get($id);
     $portalid = $old_arc->id_portals;
     //!!!
     //olds to active = n
     $old_arcs = DB_DataObject::factory('arcanums');
     $old_arcs->id_portals = $portalid;
     if ($old_arcs->find()) {
         while ($old_arcs->fetch()) {
             $n_enc = $this->arc_encrypt_input('n');
             if ($old_arcs->active != $n_enc) {
                 $old_arcs->active = $n_enc;
                 $old_arcs->update();
             }
         }
     }
     $new_arcanum = DB_DataObject::factory('arcanums');
     $new_arcanum->id_portals = $portalid;
     $this->request['active'] = "y";
     $this->request['created'] = TIME;
     $new_arcanum = $this->arc_encrypt_input($new_arcanum, $this->request);
     $new_arcanum->insert();
     $this->content = 1;
     $port = DB_DataObject::factory('portals');
     $port->get($portalid);
     $portal = $this->arc_decrypt_output($port->name);
     $this->user_log(e('arcanums_changes') . ': [' . $portal . ']');
     $this->useview = FALSE;
 }