Esempio n. 1
0
/**
 * Get site configuration by domain name
 *
 * @param string $domain
 *        Domain name, hostname or IP address
 * @return array Site configuration matched the domain
 */
function site_config_getbydomain($domain)
{
    $list = array();
    if ($domain) {
        $list = registry_search_record(array('registry_group' => 'core', 'registry_family' => 'site_config', 'registry_key' => 'domain', 'registry_value' => $domain));
    }
    return $list;
}
Esempio n. 2
0
function sender_id_search($uid = 0)
{
    $search_items['registry_family'] = 'sender_id';
    if ((int) $uid) {
        $search_items['uid'] = (int) $uid;
    }
    foreach (registry_search_record($search_items, '', array('ORDER BY' => 'c_timestamp DESC, uid')) as $sender_id) {
        // show only approved sender_id
        if ($sender_id['registry_value'] == 1) {
            $ret[] = core_sanitize_sender($sender_id['registry_key']);
        }
    }
    return $ret;
}
Esempio n. 3
0
     $select_default = _yesno('default', strtoupper($data_sender_id[0]['registry_key']) == strtoupper($default_sender_id) ? 1 : 0);
     $tpl = array('name' => 'sender_id_add', 'vars' => array('DIALOG_DISPLAY' => _dialog(), 'FORM_TITLE' => _('Manage sender ID'), 'FORM_SUBTITLE' => _('Edit sender ID'), 'ACTION_URL' => _u('index.php?app=main&inc=core_sender_id&op=sender_id_edit_yes'), 'BUTTON_BACK' => _back($ref), 'HTTP_PATH_THEMES' => _HTTP_PATH_THEMES_, 'HINT_DEFAULT' => _hint(_('Only when the sender ID is approved')), 'input_tag' => 'readonly', 'Sender ID' => _mandatory(_('Sender ID')), 'Description' => _('Description'), 'User' => _('User'), 'Approve sender ID' => _('Approve sender ID'), 'Set as default' => _('Set as default')), 'ifs' => array('isadmin' => auth_isadmin()), 'injects' => array('select_default', 'select_approve', 'select_users', 'items', 'icon_config', 'core_config'));
     _p(tpl_apply($tpl));
     break;
 case "sender_id_edit_yes":
     if (sender_id_update($uid, $c_sender_id, $c_sender_id_description, $_REQUEST['default'], $_REQUEST['approved'])) {
         $_SESSION['dialog']['info'][] = _('Sender ID description has been updated') . ' (' . _('Sender ID') . ': ' . $c_sender_id . ')';
     } else {
         $_SESSION['dialog']['info'][] = _('Fail to update due to invalid sender ID') . ' (' . _('Sender ID') . ': ' . $c_sender_id . ')';
     }
     header("Location: " . _u('index.php?app=main&inc=core_sender_id&op=sender_id_edit&id=' . $_REQUEST['id']));
     exit;
     break;
 case "toggle_status":
     $search = array('id' => $_REQUEST['id'], 'registry_family' => 'sender_id');
     foreach (registry_search_record($search) as $row) {
         $status = $row['registry_value'] == 0 ? 1 : 0;
         $items[$row['registry_key']] = $status;
         registry_update($row['uid'], 'features', 'sender_id', $items);
     }
     $_SESSION['dialog']['info'][] = ($status == 1 ? _('Sender ID is now approved') : _('Sender ID is now disabled')) . ' (' . _('Sender ID') . ': ' . $row['registry_key'] . ')';
     header("Location: " . _u('index.php?app=main&inc=core_sender_id&op=sender_id_list'));
     exit;
     break;
 case "sender_id_delete":
     $nav = themes_nav_session();
     $search = themes_search_session();
     $ref = $nav['url'] . '&search_keyword=' . $search['keyword'] . '&page=' . $nav['page'] . '&nav=' . $nav['nav'];
     $uid = auth_isadmin() && $data_sender_id[0]['uid'] ? $data_sender_id[0]['uid'] : $user_config['uid'];
     registry_remove($uid, 'features', 'sender_id', $data_sender_id[0]['registry_key']);
     registry_remove($uid, 'features', 'sender_id_description', $data_sender_id[0]['registry_key']);