Beispiel #1
1
 public function upgrade()
 {
     if (php_sapi_name() == "cli") {
         // @todo this may screw up some module installers, but we don't have a better answer at
         // this time.
         $_SERVER["HTTP_HOST"] = "example.com";
     } else {
         if (!user::active()->admin && !Session::instance()->get("can_upgrade", false)) {
             access::forbidden();
         }
     }
     // Upgrade gallery and user first
     module::install("gallery");
     module::install("user");
     // Then upgrade the rest
     foreach (module::available() as $id => $module) {
         if ($id == "gallery") {
             continue;
         }
         if ($module->active && $module->code_version != $module->version) {
             module::install($id);
         }
     }
     if (php_sapi_name() == "cli") {
         print "Upgrade complete\n";
     } else {
         url::redirect("upgrader?done=1");
     }
 }
Beispiel #2
0
 /**
  * @description Parsing URLs and setting properties
  */
 function url()
 {
     using('lepton.web.url');
     $u = new url('http://www.google.com?foo=bar');
     $u->setParameter('baz', 'bin');
     $this->assertEquals($u->toString(), 'http://www.google.com?foo=bar&baz=bin');
 }
 public static function rpc_post_subscribe(Context $ctx)
 {
     $data = $ctx->post;
     if (empty($data['sections'])) {
         throw new InvalidArgumentException("Не выбраны разделы для подписки.");
     }
     if (false === strpos($data['email'], '@')) {
         throw new InvalidArgumentException(t('Введённый email не похож на email.'));
     }
     // В массиве могут быть и другие данные, поэтому мы
     // выбираем только то, что нам нужно завернуть.
     $bulk = array('email' => $data['email'], 'sections' => $data['sections']);
     $link = new url(array('args' => array('q' => 'subscription.rpc', 'action' => 'confirm', 'code' => base64_encode(serialize($bulk)))));
     $sections = Node::findXML(array('class' => 'tag', 'deleted' => 0, 'published' => 1, 'id' => $data['sections'], '#sort' => 'name'), $ctx->db, 'section');
     if (empty($sections)) {
         throw new InvalidArgumentException("Выбраны несуществующие разделы для подписки.");
     }
     $xml = html::em('message', array('mode' => 'confirm', 'host' => MCMS_HOST_NAME, 'email' => $data['email'], 'base' => $ctx->url()->getBase($ctx), 'confirmLink' => $link->string()), html::em('sections', $sections));
     $xsl = $ctx->config->get('modules/subscription/stylesheet', os::path('lib', 'modules', 'subscription', 'message.xsl'));
     if (false === ($body = xslt::transform($xml, $xsl, null))) {
         throw new RuntimeException(t('Возникла ошибка при форматировании почтового сообщения.'));
     }
     $subject = t('Подписка на новости сайта %host', array('%host' => MCMS_HOST_NAME));
     // mcms::debug($data['email'], $subject, $body);
     BebopMimeMail::send(null, $data['email'], $subject, $body);
 }
function tujuanDes($destkota, $stat = 'provinsi', $tambah)
{
    global $app;
    $dbu = new db();
    $appx = new app();
    $urlx = new url();
    if ($stat == "destinasi") {
        while ($desty = $dbu->fetch($destkota)) {
            $destinasi = $desty[nama];
            $desty[thumb] = $appx->cekFile("/destinasi/thumb/", $desty[thumb], 'default.jpg');
            $desty[thumb] = $app[data_www] . "/destinasi/thumb/" . $desty[thumb];
            $outnya .= '<li>
							<div class="img_box">
								<img src="' . $desty[thumb] . '">
							</div>
							<div class="text">
								<h1>' . $destinasi . '</h1>
								<p>' . $dbu->lookup('deskripsi', $app[table][destinasi_bahasa], "id_reff ='" . $desty[id_reff] . "' AND id_bahasa='" . $_SESSION[bhs] . "'") . '</p>									
							</div>
							<a href="' . $app[www] . "/" . $dbu->lookup('nama', 'action', "action='21' and id_bahasa='" . $_SESSION[bhs] . "'") . "/" . $urlx->shortLink($destinasi) . "/" . '"><div class="explore">EXPLORE MORE</div></a>
						</li>';
        }
    } elseif ($stat == "provinsi") {
        while ($desty = $dbu->fetch($destkota)) {
            $destinasi = $desty[nama];
            $desty[thumb] = $appx->cekFile("/destinasi/thumb/", $desty[thumb], 'default.jpg');
            $desty[thumb] = $app[data_www] . "/destinasi/thumb/" . $desty[thumb];
            $outnya .= '<li>
							<div class="img_box">

								<img src="' . $desty[thumb] . '">
							</div>
							<div class="text">
								<h1>' . $destinasi . '</h1>
								<p>' . $dbu->lookup('deskripsi', $app[table][destinasi_bahasa], "id_reff ='" . $desty[id_reff] . "' AND id_bahasa='" . $_SESSION[bhs] . "'") . '</p>									
							</div>
							<a href="' . $app[www] . "/" . $dbu->lookup('nama', 'action', "action='21' and id_bahasa='" . $_SESSION[bhs] . "'") . "/" . $urlx->shortLink($destinasi) . "/" . '"><div class="explore">EXPLORE MORE</div></a>
						</li>';
        }
    } else {
        //echo "sedel";exit;
        while ($dkota = $dbu->fetch($destkota)) {
            $dkota[thumb] = $appx->cekFile("/kota/thumb/", $dkota[thumb], 'default.jpg');
            $dkota[thumb] = $app[data_www] . "/kota/thumb/" . $dkota[thumb];
            //echo "asdasdas".$dkota[thumb];
            $outnya .= '<li>
							<div class="img_box">
								<img src="' . $dkota[thumb] . '">
							</div>
							<div class="text">
								<h1>' . $dkota[nama] . '</h1>
								<p>' . $dbu->lookup('deskripsi', $app[table][kota_bahasa], "id_kota ='" . $dkota[id] . "' AND id_bahasa='" . $_SESSION[bhs] . "'") . '</p>									
							</div>
							<a href="' . $app[www] . "/" . $dbu->lookup('nama', 'action', "action='2' and id_bahasa='" . $_SESSION[bhs] . "'") . "/id_" . $urlx->shortLink($dkota[nama]) . "_" . $urlx->shortLink($tambah) . "/" . '"><div class="explore">EXPLORE MORE</div></a>
						</li>';
        }
    }
    return $outnya;
}
Beispiel #5
0
    function feedCheckIn($dfeed, $sBahasa, $member)
    {
        global $app;
        $appx = new app();
        $dbu = new db();
        $urlx = new url();
        $fcek_in = "";
        $icon = $app[css_www] . "/images/ic_cat_2.png";
        $avatar = $appx->cekFile('/pengguna/avatar/', $member[avatar], 'default.jpg');
        $avatar = $app[data_www] . '/pengguna/avatar/' . $avatar;
        $linkAva = $app["www"] . "/" . $dbu->lookup('nama', 'action', "action='8' and id_bahasa ='" . $sBahasa . "'") . "/" . $urlx->shortLink($member[username]) . "/";
        $fcek_in = '<div class="con_newsfeed add_fix">
					<div class="line_newsfeed">
						<div class="circle_pict circle_pict_nf"><a href="' . $linkAva . '"><img src="' . $avatar . '"></a></div>
						<div class="bar"></div>
						<div class="ic_cat"><a href="#"><img src="' . $icon . '"></a></div>
					</div>';
        $dipost = $appx->time_delta('now', $dfeed[tgl_post], 0, 2, true);
        if ($_SESSION[member][id] != "") {
            $bolehKomen = '<li>
							<div class="circle_pict circle_pict_nf"><a href="' . $linkAva . '"><img src="' . $avatar . '"></a></div>
							<textarea id="cekin" placeholder="Write your comment..."></textarea>
						</li>';
        }
        $sql = "SELECT a.nama , b.nama as kota , c.nama as provinsi, d.nama as negara FROM " . $app[table][destinasi_bahasa] . " as a LEFT JOIN " . $app[table][destinasi] . " as e ON (a.id_reff = e.id_reff)  LEFT JOIN " . $app[table][kota] . " as b ON(e.id_kota = b.id) LEFT JOIN " . $app[table][provinsi] . " as c ON(b.id_provinsi = c.id) LEFT JOIN " . $app[table][negara] . " as d ON(c.id_negara = d.id) LEFT JOIN " . $app[table][cekin] . " as f ON(e.id = f.id_destinasi ) LEFT JOIN " . $app[table][pengguna_feed] . " as g ON(f.id = g.id_tabel) WHERE g.id ='" . $dfeed[id] . "' AND a.id_bahasa ='" . $sBahasa . "'";
        $lokasi = $dbu->get_recordmix($sql);
        $cekin_di = '<span>Check in at <a href="#"><i>' . $lokasi[nama] . '(' . $lokasi[kota] . '), ' . $lokasi[provinsi] . ', ' . $lokasi[negara] . '</i></a></span>';
        $fcek_in .= '<div class="box_con_newsfeed">
						<h1>' . $member[nama] . '</h1>
						<span>' . $dipost . '</span>
						<div class="frame_post">
							' . $cekin_di . '
							<div class="box_comment">
								<ul class="add_fix" id="list_cekin" rel="cekin_' . $dfeed[id_tabel] . '">
									' . $bolehKomen;
        #komen cekin---------------------------
        $sql = "SELECT a.nama , a.avatar, a.username, b.id, b.komen, b.tgl_post as tgl_komen FROM " . $app[table][pengguna] . " as a LEFT JOIN " . $app[table][cekin_komen] . " as b ON(b.id_user = a.id) WHERE b.id_cekin = '" . $dfeed[id_tabel] . "'";
        $dbu->query($sql, $rkomen, $nkomen);
        if ($nkomen > 0) {
            while ($dkomen = $dbu->fetch($rkomen)) {
                $dkomen[avatar] = $appx->cekFile("/pengguna/avatar/", $dkomen[avatar]);
                $other_avatar = $app[data_www] . '/pengguna/avatar/' . $dkomen[avatar];
                $other_linkAva = $app["www"] . "/" . $dbu->lookup('nama', 'action', "action='8' and id_bahasa ='" . $sBahasa . "'") . "/" . $urlx->shortLink($dkomen[username]) . "/";
                $fcek_in .= '<li>		
							<div class="circle_pict circle_pict_nf"><a href="' . $other_linkAva . '"><img src="' . $other_avatar . '"></a></div>
							<div class="text_box_c">
								<h1>' . $dkomen[nama] . '</h1>
								<p>' . $dkomen[komen] . '</p>
							</div>					
						</li>';
            }
        }
        $fcek_in .= '</ul></div></div></div></div>';
        return $fcek_in;
    }
Beispiel #6
0
 public function __construct($url = '', $code = 302)
 {
     if ('POST' == $_SERVER['REQUEST_METHOD']) {
         $code = self::OTHER;
     }
     $u = new url($url);
     $url = $u->getAbsolute(Context::last());
     $this->url = $url;
     $message = t('<html><head><title>Redirecting</title>' . '<meta http-equiv=\'refresh\' content=\'0; url=@url\' />' . '</head><body>' . '<h1>Redirecting</h1><p>Redirecting to <a href=\'@url\'>a new location</a>.</p>' . '</body></html>', array('@url' => $url));
     $this->headers[] = 'Location: ' . $this->url;
     parent::__construct($message, 'text/html', $code);
 }
Beispiel #7
0
 public function testBulk()
 {
     $urls = array('http://www.google.com/', 'https://user:password@gmail.com/inbox/#label', '?fid=123&q=attachment.rpc', '?action=stop&q=nodeapi.rpc');
     foreach ($urls as $k => $v) {
         if (is_numeric($k)) {
             $u = new url($v);
             $link = $u->string();
         } else {
             $u = new url($k);
             $link = $u->string();
         }
         $this->assertEquals($v, $link);
     }
 }
 /**
  * Loads ushahidi themes
  */
 public function register()
 {
     // Array to hold all the CSS files
     $theme_css = array();
     // 1. Load the default theme
     Kohana::config_set('core.modules', array_merge(array(THEMEPATH . "default"), Kohana::config("core.modules")));
     $css_url = Kohana::config("cache.cdn_css") ? Kohana::config("cache.cdn_css") : url::base();
     // HACK: don't include the default style.css if using the ccnz theme
     if (Kohana::config("settings.site_style") != "ccnz") {
         $theme_css[] = $css_url . "themes/default/css/style.css";
     }
     // 2. Extend the default theme
     if (Kohana::config("settings.site_style") != "default") {
         $theme = THEMEPATH . Kohana::config("settings.site_style");
         Kohana::config_set('core.modules', array_merge(array($theme), Kohana::config("core.modules")));
         if (is_dir($theme . '/css')) {
             $css = dir($theme . '/css');
             // Load all the themes css files
             while (($css_file = $css->read()) !== FALSE) {
                 if (preg_match('/\\.css/i', $css_file)) {
                     $theme_css[] = url::base() . "themes/" . Kohana::config("settings.site_style") . "/css/" . $css_file;
                 }
             }
         }
     }
     Kohana::config_set('settings.site_style_css', $theme_css);
 }
Beispiel #9
0
    public function action_accessDenied()
    {
        $image = url::site('static/img/accessDenied.gif');
        $this->session = Session::instance();
        $email = $this->session->get('account_email');
        if ($email) {
            $email = " <b>({$email})</b>";
        } else {
            $email = "";
        }
        $this->request->response = <<<HEREDOC
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 

<head> 
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> 
<title>Access Denied</title> 
</head> 

<body> 
<div style="text-align: center">
<h1>Access Denied</h1> 

<img src="{$image}" alt="accessDenied" />

<p>Your login is not permitted in this section.</p>
<p>Let the admin know what your email{$email} address is.</p>
</div> 
</body> 
</html> 
HEREDOC;
    }
Beispiel #10
0
 /**
  * Require the user to log in if they are not yet logged in
  * @Developer Brandon Hansen
  * @Date April 06, 2010
  * @Return void
  */
 public static function require_login()
 {
     if (!self::logged_in()) {
         Session::instance()->set('redirect', url::current(true));
         url::redirect('login');
     }
 }
Beispiel #11
0
 static function send_confirmation($user)
 {
     $message = new View("confirm_registration.html");
     $message->confirm_url = url::abs_site("register/confirm/{$user->hash}");
     $message->user = $user;
     self::_sendemail($user->email, t("User registration confirmation"), $message);
 }
 static function photo_menu($menu, $theme)
 {
     if (module::get_var("ecard", "location") == "top") {
         $item = $theme->item();
         $menu->append(Menu::factory("link")->id("ecard")->label(t("Send as eCard"))->url(url::site("ecard/form_send/{$item->id}"))->css_class("g-dialog-link ui-icon-ecard")->css_id("g-send-ecard"));
     }
 }
Beispiel #13
0
 public function show($tag_id)
 {
     $tag = ORM::factory("tag", $tag_id);
     $page_size = module::get_var("gallery", "page_size", 9);
     $page = (int) Input::instance()->get("page", "1");
     $children_count = $tag->items_count();
     $offset = ($page - 1) * $page_size;
     $max_pages = max(ceil($children_count / $page_size), 1);
     // Make sure that the page references a valid offset
     if ($page < 1) {
         url::redirect($album->abs_url());
     } else {
         if ($page > $max_pages) {
             url::redirect($album->abs_url("page={$max_pages}"));
         }
     }
     $template = new Theme_View("page.html", "collection", "tag");
     $template->set_global("page", $page);
     $template->set_global("max_pages", $max_pages);
     $template->set_global("page_size", $page_size);
     $template->set_global("tag", $tag);
     $template->set_global("children", $tag->items($page_size, $offset));
     $template->set_global("children_count", $children_count);
     $template->content = new View("dynamic.html");
     $template->content->title = $tag->name;
     print $template;
 }
Beispiel #14
0
 static function admin_menu($menu, $theme) {
   $menu->get("content_menu")
     ->append(Menu::factory("link")
              ->id("comments")
              ->label(t("Comments"))
              ->url(url::site("admin/comments")));
 }
Beispiel #15
0
 public function index()
 {
     $view = new View(url::location());
     $view->articles = orm::factory('news')->where('group', 'site')->where('status', 'approved')->find_all(6);
     $this->template->title = 'About Us &rsaquo; News &amp; Updates';
     $this->template->content = $view;
 }
Beispiel #16
0
 /**
  * @return string An error message suitable for inclusion in the task log
  */
 static function check_index()
 {
     list($remaining) = search::stats();
     if ($remaining) {
         site_status::warning(t('Your search index needs to be updated.  <a href="%url" class="g-dialog-link">Fix this now</a>', array("url" => html::mark_clean(url::site("admin/maintenance/start/search_task::update_index?csrf=__CSRF__")))), "search_index_out_of_date");
     }
 }
 public function index()
 {
     $form = $this->_get_form();
     if (request::method() == "post") {
         access::verify_csrf();
         if ($form->validate()) {
             module::set_var("strip_exif", "exiv_path", $_POST['exiv_path']);
             if ($_POST['exif_tags'] != "") {
                 module::set_var("strip_exif", "exif_remove", isset($_POST['exif_remove']) ? $_POST['exif_remove'] : false);
                 module::set_var("strip_exif", "exif_tags", $_POST['exif_tags']);
             } else {
                 module::set_var("strip_exif", "exif_remove", false);
                 module::set_var("strip_exif", "exif_tags", self::$defExifTags);
             }
             if ($_POST['iptc_tags'] != "") {
                 module::set_var("strip_exif", "iptc_remove", isset($_POST['iptc_remove']) ? $_POST['iptc_remove'] : false);
                 module::set_var("strip_exif", "iptc_tags", $_POST['iptc_tags']);
             } else {
                 module::set_var("strip_exif", "iptc_remove", false);
                 module::set_var("strip_exif", "iptc_tags", self::$defIptcTags);
             }
             if (isset($_POST['verbose'])) {
                 module::set_var("strip_exif", "verbose", $_POST['verbose']);
             }
             message::success(t("Settings have been saved"));
             url::redirect("admin/strip_exif");
         } else {
             message::error(t("There was a problem with the submitted form. Please check your values and try again."));
         }
     }
     print $this->_get_view();
 }
Beispiel #18
0
 public function save()
 {
     access::verify_csrf();
     $changes->activate = array();
     $changes->deactivate = array();
     $activated_names = array();
     $deactivated_names = array();
     foreach (module::available() as $module_name => $info) {
         if ($info->locked) {
             continue;
         }
         $desired = $this->input->post($module_name) == 1;
         if ($info->active && !$desired && module::is_active($module_name)) {
             $changes->deactivate[] = $module_name;
             $deactivated_names[] = $info->name;
             module::deactivate($module_name);
         } else {
             if (!$info->active && $desired && !module::is_active($module_name)) {
                 $changes->activate[] = $module_name;
                 $activated_names[] = $info->name;
                 module::install($module_name);
                 module::activate($module_name);
             }
         }
     }
     module::event("module_change", $changes);
     // @todo this type of collation is questionable from a i18n perspective
     if ($activated_names) {
         message::success(t("Activated: %names", array("names" => join(", ", $activated_names))));
     }
     if ($deactivated_names) {
         message::success(t("Deactivated: %names", array("names" => join(", ", $deactivated_names))));
     }
     url::redirect("admin/modules");
 }
 function __construct()
 {
     parent::__construct("feed");
     /* Set feed ID and self link. */
     $this->id(html::specialchars(url::abs_current()));
     $this->link()->rel("self")->href(url::abs_current());
 }
 public function saveprefs()
 {
     // Prevent Cross Site Request Forgery
     access::verify_csrf();
     $form = $this->_get_admin_form();
     if ($form->validate()) {
         Kohana_Log::add("error", print_r($form, 1));
         module::set_var("tag_albums", "tag_page_title", $form->Tag_Albums_Tag_Sort->tag_page_title->value);
         module::set_var("tag_albums", "tag_index", $form->Tag_Albums_Tag_Sort->tag_index->value);
         module::set_var("tag_albums", "tag_index_scope", count($form->Tag_Albums_Tag_Sort->tag_index_scope->value));
         module::set_var("tag_albums", "tag_index_filter_top", count($form->Tag_Albums_Tag_Sort->tag_index_filter_top->value));
         module::set_var("tag_albums", "tag_index_filter_bottom", count($form->Tag_Albums_Tag_Sort->tag_index_filter_bottom->value));
         module::set_var("tag_albums", "tag_sort_by", $form->Tag_Albums_Tag_Sort->tag_sort_by->value);
         module::set_var("tag_albums", "tag_sort_direction", $form->Tag_Albums_Tag_Sort->tag_sort_direction->value);
         module::set_var("tag_albums", "subalbum_sort_by", $form->Tag_Albums_Tag_Item_Sort->subalbum_sort_by->value);
         module::set_var("tag_albums", "subalbum_sort_direction", $form->Tag_Albums_Tag_Item_Sort->subalbum_sort_direction->value);
         message::success(t("Your settings have been saved."));
         url::redirect("admin/tag_albums");
     }
     // Else show the page with errors
     $view = new Admin_View("admin.html");
     $view->content = new View("admin_tag_albums.html");
     $view->content->tag_albums_form = $form;
     print $view;
 }
 static function movie_menu($menu, $theme)
 {
     // Display embedlinks toolbar icon, if the corresponding setting is enabled.
     if (module::get_var("embedlinks", "ToolbarLinks") == true) {
         $menu->append(Menu::factory("link")->id("embedlinks")->label(t("Link to this page"))->url(url::site("embedlinks/showlinks/" . $theme->item()->id))->css_class("g-dialog-link")->css_id("g-embedlinks-link"));
     }
 }
Beispiel #22
0
 public static function header($form = array())
 {
     if (isset($form['template'])) {
         form::$template = arr::take('template', $form);
     }
     $attrs['class'] = isset($form['class']) ? $form['class'] : 'form';
     $attrs['method'] = isset($form['method']) ? $form['method'] : 'post';
     $attrs['action'] = isset($form['action']) ? $form['action'] : url::current();
     //加载表头
     $html[] = '';
     $html[] = '<form' . html::attributes($attrs) . '>';
     $html[] = field::hidden(array('name' => '_REFERER', 'value' => request::referer()));
     $html[] = field::hidden(array('name' => '_FORMHASH', 'value' => form::hash()));
     //加载常用js
     $html[] = html::script(url::common() . '/js/jquery.validate.js');
     $html[] = html::script(url::common() . '/js/jquery.validate.additional.js');
     $html[] = html::script(url::common() . '/js/jquery.form.js');
     //表单头部
     if (isset($form['title']) || isset($form['description'])) {
         $html[] = '<div class="form-header clearfix">';
         $html[] = isset($form['icon']) ? '		<div class="form-icon"></div>' : '';
         $html[] = isset($form['title']) ? '		<div class="form-title">' . $form['title'] . '</div>' : '';
         $html[] = isset($form['description']) ? '		<div class="form-description">' . $form['description'] . '</div>' : '';
         $html[] = '</div>';
     }
     //表单body部分开始
     $html[] = '<div class="form-body">';
     echo implode("\n", $html);
 }
 public function handler()
 {
     access::verify_csrf();
     $form = $this->_get_form();
     if ($form->validate()) {
         module::set_var("social_share", "general_impage_only", $form->general_settings->general_impage_only->value);
         module::set_var("social_share", "facebook_share_enabled", $form->facebook_share_settings->facebook_share_enabled->value);
         module::set_var("social_share", "facebook_share_layout", $form->facebook_share_settings->facebook_share_layout->value);
         module::set_var("social_share", "facebook_share_link_text", $form->facebook_share_settings->facebook_share_link_text->value);
         module::set_var("social_share", "facebook_like_enabled", $form->facebook_like_settings->facebook_like_enabled->value);
         module::set_var("social_share", "facebook_like_appId", $form->facebook_like_settings->facebook_like_appId->value);
         module::set_var("social_share", "facebook_like_adminId", $form->facebook_like_settings->facebook_like_adminId->value);
         module::set_var("social_share", "facebook_like_site_name", $form->facebook_like_settings->facebook_like_site_name->value);
         module::set_var("social_share", "facebook_like_code_type", $form->facebook_like_settings->facebook_like_code_type->value);
         module::set_var("social_share", "facebook_like_show_faces", $form->facebook_like_settings->facebook_like_show_faces->value, true);
         module::set_var("social_share", "facebook_like_send", $form->facebook_like_settings->facebook_like_send->value, true);
         module::set_var("social_share", "facebook_like_action", $form->facebook_like_settings->facebook_like_action->value);
         module::set_var("social_share", "facebook_like_layout", $form->facebook_like_settings->facebook_like_layout->value);
         module::set_var("social_share", "google_enabled", $form->google_settings->google_enabled->value);
         module::set_var("social_share", "google_size", $form->google_settings->google_size->value);
         module::set_var("social_share", "google_annotation", $form->google_settings->google_annotation->value);
         module::set_var("social_share", "pinterest_enabled", $form->pinterest_settings->pinterest_enabled->value);
         module::set_var("social_share", "pinterest_count_location", $form->pinterest_settings->pinterest_count_location->value);
         module::set_var("social_share", "twitter_enabled", $form->twitter_settings->twitter_enabled->value);
         module::set_var("social_share", "twitter_count_location", $form->twitter_settings->twitter_count_location->value);
         module::set_var("social_share", "twitter_size", $form->twitter_settings->twitter_size->value);
         message::success(t("Your settings have been saved."));
         url::redirect("admin/social_share");
     }
     print $this->_get_view($form);
 }
Beispiel #24
0
 public static function setting($id, $key = '')
 {
     static $modules;
     if (!is_array($modules)) {
         $modules = (include SYSROOT . DS . 'modules.php');
     }
     //设置空的module
     $module = $modules[strtolower($id)];
     if (!isset($module)) {
         $module = array('id' => $id, 'name' => $id, 'path' => $id, 'url' => $id, 'type' => 'system', 'status' => '0', 'publishtime' => '0', 'installtime' => '0', 'updatetime' => '0');
     }
     //修正module的路径
     if (empty($module['path'])) {
         $module['path'] = $module['id'];
     }
     switch (strtolower($module['type'])) {
         case 'core':
         case 'system':
             $module['root'] = SYSROOT . DS . 'modules' . DS . $module['path'];
             $module['url'] = url::system() . '/modules/' . $module['path'];
             break;
         case 'site':
             $module['root'] = SITEROOT . DS . 'modules' . DS . $module['path'];
             $module['url'] = url::site() . '/modules/' . $module['path'];
             break;
         default:
             $module['root'] = realpath($module['path']);
             $module['url'] = url::abs($module['path']);
             break;
     }
     if (empty($key)) {
         return $module;
     }
     return $module[strtolower($key)];
 }
Beispiel #25
0
 /**
  * 结算明细
  * @return
  */
 public function detail()
 {
     $this->contentHeaderTitle = app::get('topshop')->_('企业结算明细');
     $filter['shop_id'] = $this->shopId;
     $postSend = input::get();
     if ($postSend['timearea']) {
         $pagedata['timearea'] = $postSend['timearea'];
         $timeArray = explode('-', $postSend['timearea']);
         $filter['settlement_time|than'] = strtotime($timeArray[0]);
         $filter['settlement_time|lthan'] = strtotime($timeArray[1]);
     } else {
         $filter['settlement_time|than'] = time() - 3600 * 24 * 7;
         $filter['settlement_time|lthan'] = time();
         $pagedata['timearea'] = date('Y/m/d', time() - 3600 * 24 * 7) . '-' . date('Y/m/d', time());
     }
     if ($postSend['settlement_type']) {
         $filter['settlement_type'] = $postSend['settlement_type'];
         $pagedata['settlement_type'] = $postSend['settlement_type'];
     }
     //处理翻页数据
     $pagedata['page'] = $page = $postSend['page'] ? $postSend['page'] : 1;
     $pagedata['limits'] = $pageLimit = 10;
     $objMdlSettleDetail = app::get('sysclearing')->model('settlement_detail');
     $pagedata['settlement_detail_list'] = $objMdlSettleDetail->getList('*', $filter, ($page - 1) * $pageLimit, $pageLimit, 'settlement_time desc');
     $count = $objMdlSettleDetail->count($filter);
     $postSend['token'] = time();
     if ($count > 0) {
         $total = ceil($count / $pageLimit);
     }
     $pagedata['pagers'] = array('link' => url::action('topshop_ctl_clearing_settlement@detail', $postSend), 'current' => $page, 'total' => $total, 'token' => $postSend['token']);
     return $this->page('topshop/clearing/settlement_detail.html', $pagedata);
 }
Beispiel #26
0
 public function index()
 {
     $this->auto_render = FALSE;
     if ($this->service == "" && $this->host == "") {
         url::redirect("graph", 302);
     }
     $this->data->readXML($this->host, $this->service);
     if ($this->auth->is_authorized($this->data->MACRO['AUTH_HOSTNAME'], $this->data->MACRO['AUTH_SERVICEDESC']) === FALSE) {
         header('Content-Type: application/xml');
         print "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
         print "<NAGIOS>\n";
         print "<ERROR>not authorized</ERROR>\n";
         print "</NAGIOS>\n";
         exit;
     } else {
         $xmlfile = $this->config->conf['rrdbase'] . $this->host . "/" . $this->service . ".xml";
         if (is_readable($xmlfile)) {
             $fh = fopen($xmlfile, 'r');
             header('Content-Type: application/xml');
             fpassthru($fh);
             fclose($fh);
             exit;
         } else {
             header('Content-Type: application/xml');
             print "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
             print "<NAGIOS>\n";
             print "<ERROR>file not found</ERROR>\n";
             print "</NAGIOS>\n";
         }
     }
 }
Beispiel #27
0
 public function index()
 {
     $view = new Admin_View("admin.html");
     $view->page_title = t("Users and groups");
     $view->page_type = "collection";
     $view->page_subtype = "admin_users";
     $view->content = new View("admin_users.html");
     // @todo: add this as a config option
     $page_size = module::get_var("user", "page_size", 10);
     $page = Input::instance()->get("page", "1");
     $builder = db::build();
     $user_count = $builder->from("users")->count_records();
     // Pagination info
     $view->page = $page;
     $view->page_size = $page_size;
     $view->children_count = $user_count;
     $view->max_pages = ceil($view->children_count / $view->page_size);
     $view->content->pager = new Pagination();
     $view->content->pager->initialize(array("query_string" => "page", "total_items" => $user_count, "items_per_page" => $page_size, "style" => "classic"));
     // Make sure that the page references a valid offset
     if ($page < 1) {
         url::redirect(url::merge(array("page" => 1)));
     } else {
         if ($page > $view->content->pager->total_pages) {
             url::redirect(url::merge(array("page" => $view->content->pager->total_pages)));
         }
     }
     // Join our users against the items table so that we can get a count of their items
     // in the same query.
     $view->content->users = ORM::factory("user")->order_by("users.name", "ASC")->find_all($page_size, $view->content->pager->sql_offset);
     $view->content->groups = ORM::factory("group")->order_by("name", "ASC")->find_all();
     print $view;
 }
Beispiel #28
0
 public function _update($user)
 {
     if ($user->guest || $user->id != user::active()->id) {
         access::forbidden();
     }
     $form = user::get_edit_form($user);
     $valid = $form->validate();
     if ($valid) {
         $user->full_name = $form->edit_user->full_name->value;
         if ($form->edit_user->password->value) {
             $user->password = $form->edit_user->password->value;
         }
         $user->email = $form->edit_user->email->value;
         $user->url = $form->edit_user->url->value;
         if ($form->edit_user->locale) {
             $desired_locale = $form->edit_user->locale->value;
             $user->locale = $desired_locale == "none" ? null : $desired_locale;
         }
         $user->save();
         message::success(t("User information updated."));
         print json_encode(array("result" => "success", "resource" => url::site("users/{$user->id}")));
     } else {
         print json_encode(array("result" => "error", "form" => $form->__toString()));
     }
 }
Beispiel #29
0
 public function random($item_id)
 {
     $item = ORM::factory("item", $item_id);
     access::required("view", $item);
     item::set_display_context_callback("Albums_Controller::get_display_context");
     url::redirect($item->abs_url());
 }
Beispiel #30
0
 /**
  * 资讯保存
  **/
 public function saveInfo()
 {
     $userId = userAuth::id();
     //$postData =utils::_filter_input(input::get());
     $postData = input::get();
     $postData['user_id'] = $userId;
     $postData['modified'] = time();
     $postData['pubtime'] = time();
     $postData['ifpub'] = 0;
     $postData["platform"] = 'pc';
     $userName = app::get('sysuser')->model('account');
     $infoName = $userName->getList(login_account, array('user_id' => $userId));
     $postData['source'] = $infoName[0]['login_account'];
     $postData["article_logo"] = $postData["article_logo"][0];
     try {
         $userMdlAddr = app::get('sysinfo')->model('article');
         $userMdlAddr->save($postData);
     } catch (Exception $e) {
         $msg = $e->getMessage();
         return $this->splash('error', null, $msg);
     } catch (\LogicException $e) {
         $msg = $e->getMessage();
         return $this->splash('error', null, $msg);
     }
     $url = url::action('topc_ctl_member_info@publishInfo');
     $msg = app::get('topc')->_('添加成功');
     return $this->splash('success', $url, $msg);
 }