Exemplo n.º 1
0
    static function renderForgetPasswordForm()
    {
        $rtn = Message::renderMessages() . '
<form role="form" action="" method="post" id="forget_password">
  <fieldset>
    <div class="form-group">
      <label for="email">' . i18n(array('en' => 'Your E-mail address', 'zh' => '您的电子箱地址')) . '</label>
      <input class="form-control" name="email" type="email" id="email" autofocus required="">
    </div>
    <input type="submit" name="submit" class="btn btn-primary btn-block ' . (module_enabled('form') ? 'disabled' : '') . '" value="' . i18n(array('en' => 'Confirm', 'zh' => '确认')) . '" />
    ' . (module_enabled('form') ? Form::loadSpamToken('#forget_password', SITEUSER_FORM_SPAM_TOKEN) : '') . '
    <div style="text-align:center;"><br /><small><a href="' . uri('users') . '">返回登录界面</a></small></div>
  </fieldset>
</form>
';
        return $rtn;
    }
Exemplo n.º 2
0
 static function read_more($text, $string = null)
 {
     if (!substr_count($text, "e51b2b9a58824dd068d8777ec6e97e4d")) {
         return $text;
     }
     if (Route::current()->action == "view") {
         return preg_replace('/(<p>)?<a class="read_more" href="([^"]+)">e51b2b9a58824dd068d8777ec6e97e4d<\\/a>\\(\\(\\(more(\\((.+)\\))?\\)\\)\\)(<\\/p>(\\n\\n<\\/p>(\\n\\n)?)?)?/', "", $text);
     }
     if (module_enabled('smartypants')) {
         preg_match_all("/e51b2b9a58824dd068d8777ec6e97e4d(\\(\\(\\(more(\\((.+)\\))?\\)\\)\\))/", preg_replace("/<[^>]+>/", "", html_entity_decode(Smartypants::stupify($text), ENT_QUOTES, 'UTF-8')), $more, PREG_OFFSET_CAPTURE);
         $body = truncate(html_entity_decode(Smartypants::stupify($text), ENT_QUOTES, 'UTF-8'), $more[1][0][1], "", true, true);
     } else {
         preg_match_all("/e51b2b9a58824dd068d8777ec6e97e4d(\\(\\(\\(more(\\((.+)\\))?\\)\\)\\))/", preg_replace("/<[^>]+>/", "", html_entity_decode(str_replace("&nbsp;", " ", $text), ENT_QUOTES, 'UTF-8')), $more, PREG_OFFSET_CAPTURE);
         $body = truncate($text, $more[1][0][1], "", true, true);
     }
     $body .= @$more[3][0];
     if (!empty($more[2][0])) {
         $string = $more[2][0];
     } elseif (!isset($string) or $string instanceof Post) {
         # If it's called from anywhere but Twig the post will be passed as a second argument.
         $string = __("Read More &raquo;", "theme");
     }
     return str_replace("e51b2b9a58824dd068d8777ec6e97e4d", $string, $body);
 }
Exemplo n.º 3
0
function mktable($title, $content) {
        echo "<h3>$title</h3>\n";
        echo $content;
}

if (ldap_get_right("lcs_is_admin",$login)!="Y")
  die (gettext("Vous n'avez pas les droits suffisants pour acc&egrave;der &agrave; cette fonction.")."</BODY></HTML>");


function module_enabled($name) {
    return function_exists('apache_get_modules') && in_array($name, apache_get_modules());
}


if (module_enabled('mod_security2')) {
    echo "<h2>Le module de s&eacutecurit&eacute est actif.</h2>";
    if ( file_exists("/tmp/disablemodesecurity.lock") ) {
    	#echo "D&eacute;sactivation du mode s&eacute;curit&eacute; en cours !..<br />";
        echo "<div align='center'>\n
				<img src=\"Images/wait.gif\" title=\"Patientez...\" align=\"middle\" border=\"0\" ALT=\"Patientez\">\n&nbsp;D&eacute;sactivation du mode s&eacute;curit&eacute; en cours ! Veuillez patienter...
        	</div>\n";
    } else {
		if (!isset($disable))
		{
			echo "<form name ='security' action='mod_security.php' method='post'>\n";
			echo "	</select></br><input name=disable type='submit' value='Désactiver le mode sécurité' />\n";
                                                      echo '<input name="jeton" type="hidden"  value="'.md5($_SESSION['token'].htmlentities($_SERVER['PHP_SELF'])).'" />';
			echo "<input type=\"hidden\" name=\"reload\" value=\"true\">\n";
			echo "</form>\n";
		}
Exemplo n.º 4
0
}
if ($hasDocuments) {
	tpl_assign("widgetClass", 'dashDocuments');
	tpl_assign("widgetTitle", lang('documents'));
	tpl_assign("widgetTemplate", 'documents');
	$this->includeTemplate(get_template_path('widget', 'dashboard'));
}
?>

</td>

<?php if ($hasMessages  || $hasCharts || $hasEmails || $hasComments || $showWorkspaceInfo){ ?>
<td style="<?php echo ($hasPendingTasks || $hasLate || $hasToday || $hasDocuments)? 'width:38%;min-width:330px' : 'width:100%' ?>">
<?php 

if ($hasEmails && (module_enabled('mails', defined('SHOW_MAILS_TAB') ? SHOW_MAILS_TAB : 0))) {
	tpl_assign("widgetClass", 'dashUnreadEmails');
	tpl_assign("widgetTitle", $unread_emails?lang('unread emails'):lang('workspace emails'));
	tpl_assign("widgetTemplate", 'emails');
	$this->includeTemplate(get_template_path('widget', 'dashboard'));
}

if ($hasMessages) {
	tpl_assign("widgetClass", 'dashMessages');
	tpl_assign("widgetTitle", lang('messages'));
	tpl_assign("widgetTemplate", 'messages');
	$this->includeTemplate(get_template_path('widget', 'dashboard'));
}

if ($hasComments) {
	tpl_assign("widgetClass", 'dashComments');
Exemplo n.º 5
0
    </div>
    <div class="checkbox">
      <label>
        <input name="remember" type="checkbox" value="Remeber me" <?php 
if (isset($_POST['remember'])) {
    ?>
checked="checked"<?php 
}
?>
><?php 
i18n_echo(array('en' => 'Remember Me', 'zh' => '下次自动登录'));
?>
      </label>
    </div>
    <!-- Change this to a button or input when using this as a form -->
    <input type="submit" name="submit" class="btn btn-success btn-block disabled" value="<?php 
i18n_echo(array('en' => 'Login', 'zh' => '登录'));
?>
" />
    <?php 
if (module_enabled('form')) {
    ?>
      <?php 
    Form::loadSpamToken('#login', UID_BACKEND_LOGIN_FORM);
    ?>
    <?php 
}
?>
  </fieldset>
</form>
Exemplo n.º 6
0
Arquivo: Admin.php Projeto: eadz/chyrp
 /**
  * Function: disable
  * Disables a module or feather.
  */
 public function disable()
 {
     $config = Config::current();
     $visitor = Visitor::current();
     $type = isset($_GET['module']) ? "module" : "feather";
     if (!$visitor->group->can("toggle_extensions")) {
         if ($type == "module") {
             show_403(__("Access Denied"), __("You do not have sufficient privileges to enable/disable modules."));
         } else {
             show_403(__("Access Denied"), __("You do not have sufficient privileges to enable/disable feathers."));
         }
     }
     if ($type == "module" and !module_enabled($_GET[$type])) {
         Flash::warning(__("Module already disabled."), "/admin/?action=modules");
     }
     if ($type == "feather" and !feather_enabled($_GET[$type])) {
         Flash::warning(__("Feather already disabled."), "/admin/?action=feathers");
     }
     $enabled_array = $type == "module" ? "enabled_modules" : "enabled_feathers";
     $folder = $type == "module" ? MODULES_DIR : FEATHERS_DIR;
     $class_name = camelize($_GET[$type]);
     if (method_exists($class_name, "__uninstall")) {
         call_user_func(array($class_name, "__uninstall"), false);
     }
     $config->set($type == "module" ? "enabled_modules" : "enabled_feathers", array_diff($config->{$enabled_array}, array($_GET[$type])));
     $info = YAML::load($folder . "/" . $_GET[$type] . "/info.yaml");
     if ($type == "module") {
         Flash::notice(_f("&#8220;%s&#8221; module disabled.", array($info["name"])), "/admin/?action=" . pluralize($type));
     } elseif ($type == "feather") {
         Flash::notice(_f("&#8220;%s&#8221; feather disabled.", array($info["name"])), "/admin/?action=" . pluralize($type));
     }
 }
Exemplo n.º 7
0
 }
 if ($active !== false) {
     $user->setActive($active == "1" ? 1 : 0);
     $user->setEmailActivated(1);
 }
 // for new user
 if (empty($uid)) {
     $user->setCreatedAt(time());
     // if $noemailnotification flag is not set
     if (!$noemailnotification) {
         $user->setEmailActivated(0);
     }
 }
 if ($user->save()) {
     // update profile
     if (module_enabled('siteuser_profile')) {
         require MODULESROOT . '/siteuser_profile/controllers/fields_update.php';
     }
     if (empty($uid)) {
         if (!$noemailnotification) {
             $user->sendAccountActivationEmail();
             Message::register(new Message(Message::SUCCESS, i18n(array('en' => 'Thank you for registering with us. An activation email has been sent to your mail box. Please activate your account by clicking the link in the mail.', 'zh' => '感谢您注册新帐号。我们刚给您的注册邮箱发送了一份帐号激活邮件,请点击邮件内的激活链接')) . '<br /><br />' . i18n(array('en' => 'After you activate your account, you can ', 'zh' => '激活您的账号后,您可以')) . '<a href="' . uri('users') . '">' . i18n(array('en' => 'login here', 'zh' => '在此登录')) . '</a>'));
         } else {
             Message::register(new Message(Message::SUCCESS, i18n(array('en' => 'New user created successfully', 'zh' => '新用户添加成功'))));
             // clear $_POST so that our form is not pre-populated
             unset($_POST);
         }
     } else {
         Message::register(new Message(Message::SUCCESS, i18n(array('en' => 'User updated successfully', 'zh' => '用户更新成功'))));
     }
     // update user-role
Exemplo n.º 8
0
 /**
  * Function: delete
  * Deletes the given milestone. Calls the "delete_milestone" trigger and passes the <Milestone> as an argument.
  *
  * Parameters:
  *     $id - The milestone to delete.
  */
 static function delete($id)
 {
     parent::destroy(get_class(), $id);
     if (module_enabled("cacher")) {
         Modules::$instances["cacher"]->regenerate();
     }
 }
Exemplo n.º 9
0
<?php

if (version_compare(PHP_VERSION, "5.1.3", "<")) {
    exit("Chyrp requires PHP 5.1.3 or greater.");
}
require_once "../includes/common.php";
# Prepare the controller.
$extend = ExtendController::current();
# Parse the route.
$route = Route::current($extend);
if (module_enabled("cacher") and !empty(Modules::$instances["cacher"]->cacher->path)) {
    $cacher =& Modules::$instances["cacher"]->cacher;
    $cacher->caches = INCLUDES_DIR . "/caches/extend";
    $cacher->path = str_replace(INCLUDES_DIR . "/caches", INCLUDES_DIR . "/caches/extend", $cacher->path);
    $cacher->file = $cacher->path . "/" . md5($cacher->url) . ".html";
    $cacher->remove_expired();
}
# Execute the appropriate Controller responder.
$route->init();
# If the route failed or nothing was displayed, check for:
#     1. Module-provided pages.
#     2. Feather-provided pages.
#     3. Theme-provided pages.
if (!$route->success) {
    $displayed = false;
    if (!$displayed and $theme->file_exists("pages/" . $route->action)) {
        $extend->display("pages/extend/" . $route->action);
    } elseif (!$displayed) {
        show_404();
    }
}
Exemplo n.º 10
0
    if (empty($msg)) {
        $messages[] = new Message(Message::DANGER, i18n(array('en' => 'Please enter your message', 'zh' => '请填写您的留言')));
    }
    if (!empty($messages)) {
        Message::register($messages);
        HTML::forward($_SERVER['HTTP_REFERER'] . '#contact-form');
    }
    // check spam
    if (module_enabled('form') && !Form::checkSpamToken('global contact form')) {
        $message = new Message(Message::DANGER, i18n(array('en' => 'Form login session expired. Please try again', 'zh' => '表单提交时限过期,请重新尝试登录')));
        Message::register($message);
        HTML::forward($_SERVER['HTTP_REFERER'] . '#contact-form');
    }
    /** success action **/
    Message::register(new Message(Message::SUCCESS, i18n(array('en' => 'Thank you for your contact ;) We will get back to you soon.', 'zh' => '感谢您的留言 ;) 我们会及时和您沟通'))));
    if (module_enabled('mail')) {
        $message = array();
        foreach ($_POST['contact'] as $key => $val) {
            $message[] = "<p><strong>{$key}</strong>:<br />" . str_replace("\n", "<br />", $val) . "</p><br />";
        }
        $message = implode("\n", $message);
        sendemailAdmin('Site contact form', $message);
    }
    HTML::forward($_SERVER['HTTP_REFERER'] . '#contact-form');
}
$html = new HTML();
$html->renderOut('site/components/html_header', array('title' => 'Contact', 'body_class' => 'page page-template page-template-templates page-template-full-width page-template-templatesfull-width-php has-toolbar'));
$html->output('<div id="page-container">');
//$html->renderOut('site/components/toptoolbar');
$html->renderOut('site/components/header');
$html->renderOut('site/contact', array('pagetitle' => $page->getTitle(), 'content' => $page->getContent(), 'googlemap' => $html->render('site/components/googlemap', array('latitude' => '-33.877348', 'longitude' => '151.2079613')), 'full_page_sidebar_right' => $html->render('site/components/full_page_sidebar_right', array('blocks' => array(Block::findByName('Get in Touch'), Block::findByName('Apply Now'))))));
 /**
  * Returns array of queries that will return Dashboard Objects
  *
  * @param string $proj_ids
  * @param string $tag
  * @param boolean $count if false the query will return objects, if true it will return object count
  */
 static function getDashboardObjectQueries($project = null, $tag = null, $count = false, $trashed = false, $linkedObject = null, $order = 'updatedOn', $filterName = '', $archived = false, $filterManager = '')
 {
     if ($trashed && $trashed !== 'all') {
         $order = 'trashedOn';
     } else {
         if ($archived) {
             $order = 'archivedOn';
         }
     }
     switch ($order) {
         case 'dateCreated':
             $order_crit_companies = '`created_on`';
             $order_crit_contacts = '`created_on`';
             $order_crit_file_revisions = '`created_on`';
             $order_crit_calendar = '`created_on`';
             $order_crit_tasks = '`created_on`';
             $order_crit_milestones = '`created_on`';
             $order_crit_webpages = '`created_on`';
             $order_crit_files = '`created_on`';
             $order_crit_emails = '`received_date`';
             $order_crit_comments = '`created_on`';
             $order_crit_messages = '`created_on`';
             $order_crit_workspaces = '`created_on`';
             break;
         case 'trashedOn':
             $order_crit_companies = '`trashed_on`';
             $order_crit_contacts = '`trashed_on`';
             $order_crit_file_revisions = '`trashed_on`';
             $order_crit_calendar = '`trashed_on`';
             $order_crit_tasks = '`trashed_on`';
             $order_crit_milestones = '`trashed_on`';
             $order_crit_webpages = '`trashed_on`';
             $order_crit_files = '`trashed_on`';
             $order_crit_emails = '`trashed_on`';
             $order_crit_comments = '`trashed_on`';
             $order_crit_messages = '`trashed_on`';
             $order_crit_workspaces = '`updated_on`';
             break;
         case 'archivedOn':
             $order_crit_companies = '`archived_on`';
             $order_crit_contacts = '`archived_on`';
             $order_crit_file_revisions = '`updated_on`';
             $order_crit_calendar = '`archived_on`';
             $order_crit_tasks = '`archived_on`';
             $order_crit_milestones = '`archived_on`';
             $order_crit_webpages = '`archived_on`';
             $order_crit_files = '`archived_on`';
             $order_crit_emails = '`archived_on`';
             $order_crit_comments = '`updated_on`';
             $order_crit_messages = '`archived_on`';
             $order_crit_workspaces = '`completed_on`';
             break;
         case 'name':
             $order_crit_companies = '`name`';
             $order_crit_contacts = "TRIM(CONCAT(' ', `lastname`, `firstname`, `middlename`))";
             $order_crit_file_revisions = "'zzzzzzzzzzzzzz'";
             //Revisar
             $order_crit_calendar = '`subject`';
             $order_crit_tasks = '`title`';
             $order_crit_milestones = '`name`';
             $order_crit_webpages = '`title`';
             $order_crit_files = '`filename`';
             $order_crit_emails = '`subject`';
             $order_crit_comments = '`text`';
             $order_crit_messages = '`title`';
             $order_crit_workspaces = '`name`';
             break;
         default:
             $order_crit_companies = '`updated_on`';
             $order_crit_contacts = '`updated_on`';
             $order_crit_file_revisions = '`updated_on`';
             $order_crit_calendar = '`updated_on`';
             $order_crit_tasks = '`updated_on`';
             $order_crit_milestones = '`updated_on`';
             $order_crit_webpages = '`updated_on`';
             $order_crit_files = '`updated_on`';
             $order_crit_emails = '`received_date`';
             $order_crit_comments = '`updated_on`';
             $order_crit_messages = '`updated_on`';
             $order_crit_workspaces = '`updated_on`';
             break;
     }
     if ($project instanceof Project) {
         $proj_ids = $project->getAllSubWorkspacesQuery(true);
         $proj_cond_companies = Companies::getWorkspaceString($proj_ids);
         $proj_cond_messages = ProjectMessages::getWorkspaceString($proj_ids);
         $proj_cond_documents = ProjectFiles::getWorkspaceString($proj_ids);
         $proj_cond_emails = MailContents::getWorkspaceString($proj_ids);
         $proj_cond_events = ProjectEvents::getWorkspaceString($proj_ids);
         $proj_cond_tasks = ProjectTasks::getWorkspaceString($proj_ids);
         $proj_cond_charts = ProjectCharts::getWorkspaceString($proj_ids);
         $proj_cond_milestones = ProjectMilestones::getWorkspaceString($proj_ids);
         $proj_cond_weblinks = ProjectWebpages::getWorkspaceString($proj_ids);
         $proj_cond_contacts = Contacts::getWorkspaceString($proj_ids);
     } else {
         $proj_cond_companies = "true";
         $proj_cond_messages = "true";
         $proj_cond_documents = "true";
         $proj_cond_emails = "true";
         $proj_cond_events = "true";
         $proj_cond_tasks = "true";
         $proj_cond_charts = "true";
         $proj_cond_milestones = "true";
         $proj_cond_weblinks = "true";
         $proj_cond_contacts = "true";
     }
     if ($trashed) {
         if ($trashed === 'all') {
             $trashed_cond = '`trashed_on` >= ' . DB::escape(EMPTY_DATETIME);
         } else {
             $trashed_cond = '`trashed_on` > ' . DB::escape(EMPTY_DATETIME);
         }
         $archived_cond = '1 = 1';
         // Show all objects in trash
         $comments_arch_cond = "1 = 1";
     } else {
         $trashed_cond = '`trashed_on` = ' . DB::escape(EMPTY_DATETIME);
         if ($archived) {
             $archived_cond = "`archived_by_id` > 0";
             $comments_arch_cond = "1 = 0";
             // Don't show comments in archived objects listings
         } else {
             $archived_cond = "`archived_by_id` = 0";
             $comments_arch_cond = "1 = 1";
         }
     }
     if (isset($tag) && $tag && $tag != '') {
         $tag_str = " AND EXISTS (SELECT * FROM `" . TABLE_PREFIX . "tags` `t` WHERE `tag`= " . DB::escape($tag) . " AND `co`.`id` = `t`.`rel_object_id` AND `t`.`rel_object_manager` = `object_manager_value`) ";
     } else {
         $tag_str = ' ';
     }
     if ($linkedObject instanceof ProjectDataObject) {
         $link_id = $linkedObject->getId();
         $link_mgr = get_class($linkedObject->manager());
         $link_str = " AND EXISTS (SELECT * FROM `" . TABLE_PREFIX . "linked_objects` `t` WHERE\n\t\t\t(`t`.`object_id`=" . DB::escape($link_id) . " AND `t`.object_manager = " . DB::escape($link_mgr) . " AND `co`.`id` = `t`.`rel_object_id` AND `t`.`rel_object_manager` = `object_manager_value`) OR\n\t\t\t(`t`.`rel_object_id`=" . DB::escape($link_id) . " AND `t`.rel_object_manager = " . DB::escape($link_mgr) . " AND `co`.`id` = `t`.`object_id` AND `t`.`object_manager` = `object_manager_value`)) ";
     } else {
         $link_str = ' ';
     }
     $tag_str .= $link_str;
     $res = array();
     /** If the name of the query ends with Comments it is assumed to be a list of Comments **/
     $cfn = '';
     if ($filterName != '') {
         $cfn = " AND text LIKE '%" . $filterName . "%'";
     }
     // Notes
     if (module_enabled('notes')) {
         $fn = '';
         if ($filterName != '') {
             $fn = " AND title LIKE '%" . $filterName . "%'";
         }
         $permissions = ' AND ( ' . permissions_sql_for_listings(ProjectMessages::instance(), ACCESS_LEVEL_READ, logged_user(), '`project_id`', '`co`') . ')';
         if ($filterManager == '' || $filterManager == "ProjectMessages") {
             $res['ProjectMessages'] = "SELECT  'ProjectMessages' AS `object_manager_value`, `id` AS `oid`, {$order_crit_messages} AS `order_value` FROM `" . TABLE_PREFIX . "project_messages` `co` WHERE " . $trashed_cond . " AND {$archived_cond} AND " . $proj_cond_messages . str_replace('= `object_manager_value`', "= 'ProjectMessages'", $tag_str) . $permissions . $fn;
         }
         if ($filterManager == '' || $filterManager == "Comments") {
             $res['ProjectMessagesComments'] = "SELECT  'Comments' AS `object_manager_value`, `id` AS `oid`, {$order_crit_comments} AS `order_value` FROM `" . TABLE_PREFIX . "comments` WHERE {$trashed_cond} AND `rel_object_manager` = 'ProjectMessages' AND `rel_object_id` IN (SELECT `co`.`id` FROM `" . TABLE_PREFIX . "project_messages` `co` WHERE `trashed_by_id` = 0 AND {$comments_arch_cond} AND " . $proj_cond_messages . str_replace('= `object_manager_value`', "= 'ProjectMessages'", $tag_str) . $permissions . $cfn . ")";
         }
     }
     // Events
     if (module_enabled("calendar")) {
         $fn = '';
         if ($filterName != '') {
             $fn = " AND subject LIKE '%" . $filterName . "%'";
         }
         $permissions = ' AND ( ' . permissions_sql_for_listings(ProjectEvents::instance(), ACCESS_LEVEL_READ, logged_user(), '`project_id`', '`co`') . ')';
         if ($filterManager == '' || $filterManager == "ProjectEvents") {
             $res['ProjectEvents'] = "SELECT  'ProjectEvents' AS `object_manager_value`, `id` AS `oid`, {$order_crit_calendar} AS `order_value` FROM `" . TABLE_PREFIX . "project_events` `co` WHERE  " . $trashed_cond . " AND {$archived_cond} AND " . $proj_cond_events . str_replace('= `object_manager_value`', "= 'ProjectEvents'", $tag_str) . $permissions . $fn;
         }
         if ($filterManager == '' || $filterManager == "Comments") {
             $res['ProjectEventsComments'] = "SELECT  'Comments' AS `object_manager_value`, `id` AS `oid`, {$order_crit_comments} AS `order_value` FROM `" . TABLE_PREFIX . "comments` WHERE {$trashed_cond} AND `rel_object_manager` = 'ProjectEvents' AND `rel_object_id` IN (SELECT `co`.`id` FROM `" . TABLE_PREFIX . "project_events` `co` WHERE `trashed_by_id` = 0 AND {$comments_arch_cond} AND " . $proj_cond_events . str_replace('= `object_manager_value`', "= 'ProjectEvents'", $tag_str) . $permissions . $cfn . ")";
         }
     }
     // Documents
     if (module_enabled("documents")) {
         $fn = '';
         if ($filterName != '') {
             $fn = " AND filename LIKE '%" . $filterName . "%'";
         }
         $permissions = ' AND ( ' . permissions_sql_for_listings(ProjectFiles::instance(), ACCESS_LEVEL_READ, logged_user(), '`project_id`', '`co`') . ')';
         $typestring = array_var($_GET, "typestring");
         if ($typestring) {
             $typecond = " AND  ((SELECT count(*) FROM `" . TABLE_PREFIX . "project_file_revisions` `pfr` WHERE `" . "pfr`.`type_string` LIKE " . DB::escape($typestring) . " AND `" . "co`.`id` = `pfr`.`file_id`) > 0)";
         } else {
             $typecond = "";
         }
         if ($filterManager == '' || $filterManager == "ProjectFiles") {
             $res['ProjectFiles'] = "SELECT  'ProjectFiles' AS `object_manager_value`, `id` as `oid`, {$order_crit_files} AS `order_value` FROM `" . TABLE_PREFIX . "project_files` `co` WHERE " . $trashed_cond . " AND {$archived_cond} AND " . $proj_cond_documents . str_replace('= `object_manager_value`', "= 'ProjectFiles'", $tag_str) . $permissions . $typecond . $fn;
         }
         if ($filterManager == '' || $filterManager == "Comments") {
             $res['ProjectFilesComments'] = "SELECT  'Comments' AS `object_manager_value`, `id` AS `oid`, {$order_crit_comments} AS `order_value` FROM `" . TABLE_PREFIX . "comments` WHERE {$trashed_cond} AND `rel_object_manager` = 'ProjectFiles' AND `rel_object_id` IN (SELECT `co`.`id` FROM `" . TABLE_PREFIX . "project_files` `co` WHERE `trashed_by_id` = 0 AND {$comments_arch_cond} AND " . $proj_cond_documents . str_replace('= `object_manager_value`', "= 'ProjectFiles'", $tag_str) . $permissions . $cfn . ")";
         }
         if ($trashed) {
             $file_rev_docs = "SELECT `id` FROM `" . TABLE_PREFIX . "project_files` `co` WHERE `trashed_by_id` = 0 AND " . $proj_cond_documents . str_replace('= `object_manager_value`', "= 'ProjectFiles'", $tag_str) . $permissions . $typecond;
             $res['FileRevisions'] = "SELECT 'ProjectFileRevisions' AS `object_manager_value`, `id` AS `oid`, {$order_crit_file_revisions} AS `order_value` FROM `" . TABLE_PREFIX . "project_file_revisions` `co` WHERE {$trashed_cond} AND `file_id` IN (" . $file_rev_docs . ")";
         }
     }
     // Tasks and Milestones
     if (module_enabled("tasks")) {
         $fn = '';
         if ($filterName != '') {
             $fn = " AND title LIKE '%" . $filterName . "%'";
         }
         $completed = $trashed || $archived ? '' : 'AND `completed_on` = ' . DB::escape(EMPTY_DATETIME);
         $permissions = ' AND ( ' . permissions_sql_for_listings(ProjectTasks::instance(), ACCESS_LEVEL_READ, logged_user(), '`project_id`', '`co`') . ')';
         if ($filterManager == '' || $filterManager == "ProjectTasks") {
             $res['ProjectTasks'] = "SELECT  'ProjectTasks' AS `object_manager_value`, `id` AS `oid`, {$order_crit_tasks} AS `order_value` FROM `" . TABLE_PREFIX . "project_tasks` `co` WHERE `is_template` = false {$completed} AND " . $trashed_cond . " AND {$archived_cond} AND `is_template` = false AND " . $proj_cond_tasks . str_replace('= `object_manager_value`', "= 'ProjectTasks'", $tag_str) . $permissions . $fn;
         }
         if ($filterManager == '' || $filterManager == "Comments") {
             $res['ProjectTasksComments'] = "SELECT  'Comments' AS `object_manager_value`, `id` AS `oid`, {$order_crit_comments} AS `order_value` FROM `" . TABLE_PREFIX . "comments` WHERE {$trashed_cond} AND `rel_object_manager` = 'ProjectTasks' AND `rel_object_id` IN (SELECT `co`.`id` FROM `" . TABLE_PREFIX . "project_tasks` `co` WHERE `trashed_by_id` = 0 AND {$comments_arch_cond} AND `is_template` = false AND " . $proj_cond_tasks . str_replace('= `object_manager_value`', "= 'ProjectTasks'", $tag_str) . $permissions . $cfn . ")";
         }
         $fn = '';
         if ($filterName != '') {
             $fn = " AND name LIKE '%" . $filterName . "%'";
         }
         $permissions = ' AND ( ' . permissions_sql_for_listings(ProjectMilestones::instance(), ACCESS_LEVEL_READ, logged_user(), '`project_id`', '`co`') . ')';
         if ($filterManager == '' || $filterManager == "ProjectMilestones") {
             $res['ProjectMilestones'] = "SELECT  'ProjectMilestones' AS `object_manager_value`, `id` AS `oid`, {$order_crit_milestones} AS `order_value` FROM `" . TABLE_PREFIX . "project_milestones` `co` WHERE " . $trashed_cond . " AND {$archived_cond} AND `is_template` = false AND " . $proj_cond_milestones . str_replace('= `object_manager_value`', "= 'ProjectMilestones'", $tag_str) . $permissions . $fn;
         }
         if ($filterManager == '' || $filterManager == "Comments") {
             $res['ProjectMilestonesComments'] = "SELECT  'Comments' AS `object_manager_value`, `id` AS `oid`, {$order_crit_comments} AS `order_value` FROM `" . TABLE_PREFIX . "comments` WHERE {$trashed_cond} AND `rel_object_manager` = 'ProjectMilestones' AND `rel_object_id` IN (SELECT `co`.`id` FROM `" . TABLE_PREFIX . "project_milestones` `co` WHERE `trashed_by_id` = 0 AND {$comments_arch_cond} AND `is_template` = false AND " . $proj_cond_milestones . str_replace('= `object_manager_value`', "= 'ProjectMilestones'", $tag_str) . $permissions . $cfn . ")";
         }
     }
     // Weblinks
     if (module_enabled("weblinks")) {
         $fn = '';
         if ($filterName != '') {
             $fn = " AND title LIKE '%" . $filterName . "%'";
         }
         $permissions = ' AND ( ' . permissions_sql_for_listings(ProjectWebpages::instance(), ACCESS_LEVEL_READ, logged_user(), '`project_id`', '`co`') . ')';
         if ($filterManager == '' || $filterManager == "ProjectWebpages") {
             $res['ProjectWebPages'] = "SELECT  'ProjectWebPages' AS `object_manager_value`, `id` AS `oid`, {$order_crit_webpages} AS `order_value` FROM `" . TABLE_PREFIX . "project_webpages` `co` WHERE " . $trashed_cond . " AND {$archived_cond} AND " . $proj_cond_weblinks . str_replace('= `object_manager_value`', "= 'ProjectWebpages'", $tag_str) . $permissions . $fn;
         }
         if ($filterManager == '' || $filterManager == "Comments") {
             $res['ProjectWebPagesComments'] = "SELECT  'Comments' AS `object_manager_value`, `id` AS `oid`, {$order_crit_comments} AS `order_value` FROM `" . TABLE_PREFIX . "comments` WHERE {$trashed_cond} AND `rel_object_manager` = 'ProjectWebpages' AND `rel_object_id` IN (SELECT `co`.`id` FROM `" . TABLE_PREFIX . "project_webpages` `co` WHERE " . $trashed_cond . " AND {$comments_arch_cond} AND " . $proj_cond_weblinks . str_replace('= `object_manager_value`', "= 'ProjectWebpages'", $tag_str) . $permissions . $cfn . ")";
         }
     }
     // Email
     if (module_enabled("email")) {
         $fn = '';
         if ($filterName != '') {
             $fn = " AND subject LIKE '%" . $filterName . "%'";
         }
         $permissions = ' AND ( ' . permissions_sql_for_listings(MailContents::instance(), ACCESS_LEVEL_READ, logged_user(), $project instanceof Project ? $project->getId() : 0, '`co`') . ')';
         if ($filterManager == '' || $filterManager == "MailContents") {
             $res['MailContents'] = "SELECT  'MailContents' AS `object_manager_value`, `id` AS `oid`, {$order_crit_emails} AS `order_value` FROM `" . TABLE_PREFIX . "mail_contents` `co` WHERE (" . $trashed_cond . " AND {$archived_cond} AND `is_deleted` = 0 AND " . $proj_cond_emails . str_replace('= `object_manager_value`', "= 'MailContents'", $tag_str) . $permissions . ") {$fn}";
         }
         if ($filterManager == '' || $filterManager == "Comments") {
             $res['MailContentsComments'] = "SELECT  'Comments' AS `object_manager_value`, `id` AS `oid`, {$order_crit_comments} AS `order_value` FROM `" . TABLE_PREFIX . "comments` WHERE {$trashed_cond} AND `rel_object_manager` = 'MailContents' AND `rel_object_id` IN (SELECT `co`.`id` FROM `" . TABLE_PREFIX . "mail_contents` `co` WHERE `trashed_by_id` = 0 AND {$comments_arch_cond} AND " . $proj_cond_emails . str_replace('= `object_manager_value`', "= 'MailContents'", $tag_str) . $permissions . $cfn . ")";
         }
     }
     // Conacts and Companies
     if (module_enabled("contacts")) {
         $fn = '';
         $fn2 = '';
         if ($filterName != '') {
             $fn = " AND firstname LIKE '%" . $filterName . "%'";
             $fn2 = " AND name LIKE '%" . $filterName . "%'";
         }
         // companies
         $permissions = ' AND ( ' . permissions_sql_for_listings(Companies::instance(), ACCESS_LEVEL_READ, logged_user(), '`project_id`', '`co`') . ')';
         if ($filterManager == '' || $filterManager == "Companies") {
             $res['Companies'] = "SELECT  'Companies' AS `object_manager_value`, `id` as `oid`, {$order_crit_companies} AS `order_value` FROM `" . TABLE_PREFIX . "companies` `co` WHERE " . $trashed_cond . " AND {$archived_cond} AND " . $proj_cond_companies . str_replace('= `object_manager_value`', "= 'Companies'", $tag_str) . $permissions . $fn2;
         }
         $res['CompaniesComments'] = "SELECT  'Comments' AS `object_manager_value`, `id` AS `oid`, {$order_crit_comments} AS `order_value` FROM `" . TABLE_PREFIX . "comments` WHERE {$trashed_cond} AND `rel_object_manager` = 'Companies' AND `rel_object_id` IN (SELECT `co`.`id` FROM `" . TABLE_PREFIX . "companies` `co` WHERE `trashed_by_id` = 0 AND {$comments_arch_cond} AND " . $proj_cond_documents . str_replace('= `object_manager_value`', "= 'Companies'", $tag_str) . $permissions . $cfn . ")";
         // contacts
         $permissions = ' AND ( ' . permissions_sql_for_listings(Contacts::instance(), ACCESS_LEVEL_READ, logged_user(), '`project_id`', '`co`') . ')';
         if ($filterManager == '' || $filterManager == "Contacts") {
             $res['Contacts'] = "SELECT 'Contacts' AS `object_manager_value`, `id` AS `oid`, {$order_crit_contacts} AS `order_value` FROM `" . TABLE_PREFIX . "contacts` `co` WHERE {$trashed_cond} AND {$archived_cond} AND {$proj_cond_contacts} " . str_replace('= `object_manager_value`', "= 'Contacts'", $tag_str) . $permissions . $fn;
         }
         $res['ContactsComments'] = "SELECT  'Comments' AS `object_manager_value`, `id` AS `oid`, {$order_crit_comments} AS `order_value` FROM `" . TABLE_PREFIX . "comments` WHERE {$trashed_cond} AND `rel_object_manager` = 'Contacts' AND `rel_object_id` IN (SELECT `co`.`id` FROM `" . TABLE_PREFIX . "contacts` `co` WHERE `trashed_by_id` = 0 AND {$comments_arch_cond} AND " . $proj_cond_documents . str_replace('= `object_manager_value`', "= 'Contacts'", $tag_str) . $permissions . $cfn . ")";
     }
     // Workspaces (only for archived objects view)
     if ($archived) {
         if ($filterManager == '' || $filterManager == "Projects") {
             $res['Projects'] = "SELECT  'Projects' AS `object_manager_value`, `id` AS `oid`, {$order_crit_workspaces} AS `order_value` FROM `" . TABLE_PREFIX . "projects` `co` WHERE `completed_on` <> " . DB::escape(EMPTY_DATETIME) . " AND `id` IN (" . logged_user()->getWorkspacesQuery() . ")";
         }
     }
     if ($count) {
         foreach ($res as $p => $q) {
             $res[$p] = "SELECT count(*) AS `quantity`, '{$p}' AS `objectName` FROM ( {$q} ) `table_alias`";
         }
     }
     return $res;
 }
Exemplo n.º 12
0
 /**
  * Function: delete
  * Deletes the given version, including its notes. Calls the "delete_version" trigger and passes the <Version> as an argument.
  *
  * Parameters:
  *     $id - The version to delete.
  */
 static function delete($id)
 {
     $version = new self($id);
     foreach ($version->notes as $note) {
         Note::delete($note->id);
     }
     foreach ($version->attachments as $attachment) {
         Attachment::delete($attachment->id);
     }
     @unlink(uploaded($version->filename, false));
     @unlink(uploaded($version->preview, false));
     parent::destroy(get_class(), $id);
     if (module_enabled("cacher")) {
         Modules::$instances["cacher"]->regenerate();
     }
 }
Exemplo n.º 13
0
<?php

// dependency check
if (!module_enabled('crawler')) {
    die('Please enable crawler module');
}
$user = User::getInstance();
if (!is_cli() && $user->isLogin() && is_backend()) {
    // register admin
    Backend::registerSideNav('
  <li>
    <a href="' . uri('admin/queue/list') . '"><i class="fa fa-tasks"></i> ' . i18n(array('en' => 'Queue', 'zh' => '队列')) . '</a>
  </li>
  ');
}
Exemplo n.º 14
0
<?php

$user = User::getInstance();
// we only do stuff when the user is not login
if (!$user->isLogin()) {
    $isSubmit = isset($_POST['submit']) ? true : false;
    // is submission or not;
    // deal with form submission
    if ($isSubmit) {
        // check spam
        if (module_enabled('form') && !Form::checkSpamToken(UID_BACKEND_LOGIN_FORM)) {
            $message = new Message(Message::DANGER, 'Form submission error.');
            Message::register($message);
            HTML::forwardBackToReferer();
        }
        // authentication
        $authentication_success = false;
        $email = isset($_POST['email']) ? strip_tags($_POST['email']) : null;
        $password = isset($_POST['password']) ? strip_tags($_POST['password']) : null;
        $settings = Vars::getSettings();
        foreach ($settings['users'] as $u) {
            if ($u['email'] == $email && $u['password'] == $password) {
                $authentication_success = true;
            }
        }
        // if success
        if ($authentication_success) {
            $user = User::findByEmail($email);
            $user->login();
            HTML::forwardBackToReferer();
            // if fail
Exemplo n.º 15
0
     $new = $config->{$enabled_array};
     array_push($new, $_POST["extension"]);
     $config->set($enabled_array, $new);
     exit('{ notifications: [' . (!empty($info["notifications"]) ? '"' . implode('", "', $info["notifications"]) . '"' : "") . '] }');
     break;
 case "disable_module":
 case "disable_feather":
     $type = $_POST['action'] == "disable_module" ? "module" : "feather";
     if (!$visitor->group->can("change_settings")) {
         if ($type == "module") {
             exit("{ notifications: ['" . __("You do not have sufficient privileges to enable/disable modules.") . "'] }");
         } else {
             exit("{ notifications: ['" . __("You do not have sufficient privileges to enable/disable feathers.") . "'] }");
         }
     }
     if ($type == "module" and !module_enabled($_POST['extension']) or $type == "feather" and !feather_enabled($_POST['extension'])) {
         exit("{ notifications: [] }");
     }
     $class_name = camelize($_POST["extension"]);
     if (method_exists($class_name, "__uninstall")) {
         call_user_func(array($class_name, "__uninstall"), $_POST['confirm'] == "1");
     }
     $enabled_array = $type == "module" ? "enabled_modules" : "enabled_feathers";
     $config->set($enabled_array, array_diff($config->{$enabled_array}, array($_POST['extension'])));
     exit('{ notifications: [] }');
     break;
 case "reorder_feathers":
     $reorder = oneof(@$_POST['list'], $config->enabled_feathers);
     foreach ($reorder as &$value) {
         $value = preg_replace("/feathers\\[([^\\]]+)\\]/", "\\1", $value);
     }
Exemplo n.º 16
0
}
// check if user exists
$class = class_exists('MySiteUser') ? 'MySiteUser' : 'SiteUser';
if (strpos($username, '@') == false) {
    $user = $class::findByUsername($username, $class);
} else {
    $user = $class::findByEmail($username, $class);
}
if (is_null($user) || !$user->checkPassword($password) || $user->getActive() == 0) {
    Message::register(new Message(Message::DANGER, i18n(array('en' => 'Username and password don\'t match. Please try again', 'zh' => '用户名和密码不匹配,请重新尝试'))));
    HTML::forwardBackToReferer();
} else {
    if ($user->getEmailActivated() == 0) {
        Message::register(new Message(Message::DANGER, i18n(array('en' => 'Your account is not yet activated. To resend the activation email, please <a href="' . uri('user/' . $user->getId() . '/activate_resend_email/' . encrypt($user->getSalt()), false) . '">click here</a>', 'zh' => '您的账号还未激活。如需重新发送激活邮件,请<a href="' . uri('user/' . $user->getId() . '/activate_resend_email/' . encrypt($user->getSalt()), false) . '">点击此处</a>'))));
        HTML::forwardBackToReferer();
    }
}
// check spam
if (module_enabled('form') && !Form::checkSpamToken(SITEUSER_FORM_SPAM_TOKEN)) {
    $message = new Message(Message::DANGER, i18n(array('en' => 'Form login session expired. Please try again', 'zh' => '表单提交时限过期,请重新尝试登录')));
    Message::register($message);
    HTML::forwardBackToReferer();
}
/** login action **/
$user->login(is_null($remember) ? false : true);
// forward back to referer if exists
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : false;
if ($referer && !preg_match('/\\/users\\/?$/', $referer) && !preg_match('/\\/confirm\\/?$/', $referer) && !preg_match('/forget\\-password\\/?$/', $referer)) {
    HTML::forward($referer);
}
HTML::forward('');
Exemplo n.º 17
0
    tpl_assign("widgetTemplate", 'documents');
    $this->includeTemplate(get_template_path('widget', 'dashboard'));
}
?>

</td>

<?php 
if ($hasMessages || $hasCharts || $hasEmails || $hasComments || $showWorkspaceInfo) {
    ?>
<td style="<?php 
    echo $hasPendingTasks || $hasLate || $hasToday || $hasDocuments ? 'width:38%;min-width:330px' : 'width:100%';
    ?>
">
<?php 
    if ($hasEmails && module_enabled('email', defined('SHOW_MAILS_TAB') ? SHOW_MAILS_TAB : 0)) {
        tpl_assign("widgetClass", 'dashUnreadEmails');
        tpl_assign("widgetTitle", $unread_emails ? lang('unread emails') : lang('workspace emails'));
        tpl_assign("widgetTemplate", 'emails');
        $this->includeTemplate(get_template_path('widget', 'dashboard'));
    }
    if ($hasMessages) {
        tpl_assign("widgetClass", 'dashMessages');
        tpl_assign("widgetTitle", lang('messages'));
        tpl_assign("widgetTemplate", 'messages');
        $this->includeTemplate(get_template_path('widget', 'dashboard'));
    }
    if ($hasComments) {
        tpl_assign("widgetClass", 'dashComments');
        tpl_assign("widgetTitle", lang('latest comments'));
        tpl_assign("widgetTemplate", 'comments');
Exemplo n.º 18
0
 /**
  * Function: delete
  * Deletes the given extension, including its notes. Calls the "delete_extension" trigger and passes the <Extension> as an argument.
  *
  * Parameters:
  *     $id - The extension to delete.
  */
 static function delete($id)
 {
     $extension = new self($id);
     foreach ($extension->versions as $version) {
         Version::delete($version->id);
     }
     parent::destroy(get_class(), $id);
     if (module_enabled("cacher")) {
         Modules::$instances["cacher"]->regenerate();
     }
 }
Exemplo n.º 19
0
?>
,
	'enable_tasks_module': <?php 
echo json_encode(module_enabled("tasks"));
?>
,
	'enable_weblinks_module': <?php 
echo json_encode(module_enabled('weblinks'));
?>
,
	'enable_time_module': <?php 
echo json_encode(module_enabled("time") && can_manage_time(logged_user(), true));
?>
,
	'enable_reporting_module': <?php 
echo json_encode(module_enabled("reporting"));
?>
};
og.preferences = {
	'rememberGUIState': <?php 
echo user_config_option('rememberGUIState') ? '1' : '0';
?>
,
	'show_unread_on_title': <?php 
echo user_config_option('show_unread_on_title') ? '1' : '0';
?>
,
	'email_polling': <?php 
echo json_encode(user_config_option('email_polling'));
?>
 ,
Exemplo n.º 20
0
// 页面启动时间
$GLOBALS['AX_XHPROF_IS_RUN'] = false;
// 当前页面是否启动xhprof
// 获取ini中相关配置信息
$ax_ini = parse_ini_file(__XHPROF_DIR . '/auto-xhprof.ini', true);
$ax_config = $ax_ini['auto_xhprof'];
$GLOBALS['AX_XHPROF_AUTOSTART'] = get_ini_value($ax_config, 'xhprof.autostart');
$GLOBALS['AX_XHPROF_TIMEOUT'] = get_ini_value($ax_config, 'xhprof.timeout');
$GLOBALS['AX_XHPROF_IGNORE'] = get_ini_value($ax_config, 'xhprof.ignore');
$GLOBALS['AX_DATABASE_DSN'] = get_ini_value($ax_config, 'database.dsn');
$GLOBALS['AX_DATABASE_USER'] = get_ini_value($ax_config, 'database.user');
$GLOBALS['AX_DATABASE_PASS'] = get_ini_value($ax_config, 'database.pass');
$GLOBALS['AX_GEARMAN_SERVER'] = get_ini_value($ax_config, 'gearman.server');
$xhprof_enabled = module_enabled('xhprof');
// 检查xhprof模块是否可用
$gearman_enabled = module_enabled('gearman');
// 检查gearman模块是否可用
if ($gearman_enabled && !$GLOBALS['AX_GEARMAN_SERVER']) {
    $gearman_enabled = false;
}
function get_ini_value($ini, $key)
{
    return array_key_exists($key, $ini) ? $ini[$key] : false;
}
function module_enabled($module)
{
    // 检查模块是否可用
    return in_array($module, get_loaded_extensions());
}
function xhprof_start()
{
Exemplo n.º 21
0
 /**
  * Loads the gazillion of stuff, in Flash Gordon speed.
  * @todo Document properly please.
  */
 public function __construct()
 {
     parent::__construct();
     $this->benchmark->mark('public_controller_start');
     // Check redirects if GET and Not AJAX
     if (!$this->input->is_ajax_request() and $_SERVER['REQUEST_METHOD'] == 'GET') {
         $this->load->model('redirects/redirect_m');
         $uri = trim(uri_string(), '/');
         if ($uri and $redirect = $this->redirect_m->get_from($uri)) {
             // Check if it was direct match
             if ($redirect->from == $uri) {
                 redirect($redirect->to, 'location', $redirect->type);
             }
             // If it has back reference
             if (strpos($redirect->to, '$') !== false) {
                 $from = str_replace('%', '(.*?)', $redirect->from);
                 $redirect->to = preg_replace('#^' . $from . '$#', $redirect->to, $uri);
             }
             // Redirect with wanted redirect header type
             redirect($redirect->to, 'location', $redirect->type);
         }
     }
     Events::trigger('public_controller');
     // Check the frontend hasnt been disabled by an admin
     if (!$this->settings->frontend_enabled && (empty($this->current_user) or $this->current_user->group != 'admin')) {
         header('Retry-After: 600');
         $error = $this->settings->unavailable_message ? $this->settings->unavailable_message : lang('cms:fatal_error');
         show_error($error, 503);
     }
     // -- Navigation menu -----------------------------------
     $this->load->model(array('pages/page_m', 'category_model'));
     // Load the current theme so we can set the assets right away
     ci()->theme = $this->theme_m->get();
     if (empty($this->theme->slug)) {
         show_error('This site has been set to use a theme that does not exist. If you are an administrator please ' . anchor('admin/themes', 'change the theme') . '.');
     }
     // Set the theme as a path for Asset library
     Asset::add_path('theme', $this->theme->path . '/');
     Asset::set_path('theme');
     // Support CDN URL's like Amazon CloudFront
     if (Settings::get('cdn_domain')) {
         $protocol = !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' ? 'https' : 'http';
         // Make cdn.pyrocms.com into https://cdn.pyrocms.com/
         Asset::set_url($protocol . '://' . rtrim(Settings::get('cdn_domain'), '/') . '/');
     }
     // Set the theme view folder
     $this->template->set_theme($this->theme->slug);
     // Is there a layout file for this module?
     if ($this->template->layout_exists($this->module . '.html')) {
         $this->template->set_layout($this->module . '.html');
     } elseif ($this->template->layout_exists('default.html')) {
         $this->template->set_layout('default.html');
     }
     // Make sure whatever page the user loads it by, its telling search robots the correct formatted URL
     $this->template->set_metadata('canonical', site_url($this->uri->uri_string()), 'link');
     // If there is a blog module, link to its RSS feed in the head
     if (module_enabled('blog')) {
         $this->template->append_metadata('<link rel="alternate" type="application/rss+xml" title="' . Settings::get('site_name') . '" href="' . site_url('blog/rss/all.rss') . '" />');
     }
     // Frontend data
     $this->load->library('variables/variables');
     // grab the theme options if there are any
     $this->theme->options = $this->pyrocache->model('theme_m', 'get_values_by', array(array('theme' => $this->theme->slug)));
     // Assign segments to the template the new way
     $this->template->server = $_SERVER;
     $this->template->theme = $this->theme;
     $this->load->library("go_cart");
     $this->template->set("cart_total", $this->go_cart->total_items());
     $categories = $this->category_model->get_categories(1);
     $this->template->set("categories", (array) $categories);
     $this->lang->load("common");
     //
     $this->benchmark->mark('public_controller_end');
 }
Exemplo n.º 22
0
 /**
  * Show dashboard index page
  *
  * @param void
  * @return null
  */
 function index()
 {
     $this->setHelp('dashboard');
     ajx_set_no_toolbar(true);
     $logged_user = logged_user();
     $activity_log = null;
     $include_private = $logged_user->isMemberOfOwnerCompany();
     $include_silent = $logged_user->isAdminGroup();
     // FIXME
     $activity_log = array();
     //ApplicationLogs::getOverallLogs($include_private, $include_silent, $wscsv, config_option('dashboard_logs_count', 15));
     /* FIXME if (user_config_option('show charts widget') && module_enabled('reporting')) {
     			$charts = ProjectCharts::getChartsAtProject(active_project(), active_tag());
     			tpl_assign('charts', $charts);
     			
     			if (BillingCategories::count() > 0 && active_project() instanceof Project){
     				tpl_assign('billing_chart_data', active_project()->getBillingTotalByUsers(logged_user()));
     			}
     		}*/
     if (user_config_option('show messages widget') && module_enabled('notes')) {
         //FIXME list($messages, $pagination) = ProjectMessages::getMessages(active_tag(), active_project(), 0, 10, '`updated_on`', 'DESC', false);
         tpl_assign('messages', $messages);
     }
     if (user_config_option('show comments widget')) {
         //FIXME $comments = Comments::getSubscriberComments(active_project(), $tag);
         tpl_assign('comments', $comments);
     }
     if (user_config_option('show documents widget') && module_enabled('documents')) {
         //FIXME list($documents, $pagination) = ProjectFiles::getProjectFiles(active_project(), null, false, ProjectFiles::ORDER_BY_MODIFYTIME, 'DESC', 1, 10, false, active_tag(), null);
         tpl_assign('documents', $documents);
     }
     if (user_config_option('show emails widget') && module_enabled('email')) {
         /* FIXME $activeWs = active_project();
         			list($unread_emails, $pagination) = MailContents::getEmails($tag, null, 'received', 'unread', '', $activeWs, 0, 10);
         
         			if ($activeWs && user_config_option('always show unread mail in dashboard')) {
         				// add unread unclassified emails
         				list($all_unread, $pagination) = MailContents::getEmails($tag, null, 'received', 'unread', 'unclassified', null, 0, 10);
         				$unread_emails = array_merge($unread_emails, $all_unread);
         			}*/
         tpl_assign('unread_emails', $unread_emails);
     }
     //Tasks widgets
     $show_pending = user_config_option('show pending tasks widget') && module_enabled('tasks');
     $show_in_progress = user_config_option('show tasks in progress widget') && module_enabled('tasks');
     $show_late = user_config_option('show late tasks and milestones widget') && module_enabled('tasks');
     if ($show_pending || $show_in_progress || $show_late) {
         $assigned_to = explode(':', user_config_option('pending tasks widget assigned to filter'));
         $to_company = array_var($assigned_to, 0, 0);
         $to_user = array_var($assigned_to, 1, 0);
         tpl_assign('assigned_to_user_filter', $to_user);
         tpl_assign('assigned_to_company_filter', $to_company);
     }
     if ($show_pending) {
         //FIXME $tasks = ProjectTasks::getProjectTasks(active_project(), ProjectTasks::ORDER_BY_DUEDATE, 'ASC', null, null, $tag, $to_company, $to_user, null, true, 'all', false, false, false, 10);
         tpl_assign('dashtasks', $tasks);
     }
     if ($show_in_progress) {
         //FIXME $tasks_in_progress = ProjectTasks::getOpenTimeslotTasks(logged_user(),logged_user(), active_project(), $tag,$to_company,$to_user);
         tpl_assign('tasks_in_progress', $tasks_in_progress);
     }
     if ($show_late) {
         //FIXME tpl_assign('today_milestones', $logged_user->getTodayMilestones(active_project(), $tag, 10));
         //FIXME tpl_assign('late_milestones', $logged_user->getLateMilestones(active_project(), $tag, 10));
         //FIXME tpl_assign('today_tasks', ProjectTasks::getDayTasksByUser(DateTimeValueLib::now(), $logged_user, active_project(), $tag, $to_company, $to_user, 10));
         //FIXME tpl_assign('late_tasks', ProjectTasks::getLateTasksByUser($logged_user, active_project(), $tag, $to_company, $to_user, 10));
     }
     tpl_assign('activity_log', $activity_log);
     $usu = logged_user();
     $conditions = array("conditions" => array("`state` >= 200 AND (`state`%2 = 0) AND `trashed_on=0 AND `created_by_id` =" . $usu->getId()));
     //FIXME $outbox_mails = MailContents::findAll($conditions);
     if ($outbox_mails != null) {
         if (count($outbox_mails) == 1) {
             flash_error(lang('outbox mail not sent', 1));
         } else {
             if (count($outbox_mails) > 1) {
                 flash_error(lang('outbox mails not sent', count($outbox_mails)));
             }
         }
     }
 }
Exemplo n.º 23
0
        echo lang('cp:manage_pages');
        ?>
" href="<?php 
        echo site_url('admin/pages');
        ?>
"><?php 
        echo Asset::img('icons/pages.png', lang('cp:manage_pages'));
        ?>
</a>
					</li>
					<?php 
    }
    ?>
					
					<?php 
    if ((array_key_exists('files', $this->permissions) or $this->current_user->group == 'admin') and module_enabled('files')) {
        ?>
					<li>
						<a class="tooltip-s" title="<?php 
        echo lang('cp:manage_files');
        ?>
" href="<?php 
        echo site_url('admin/files');
        ?>
"><?php 
        echo Asset::img('icons/files.png', lang('cp:manage_files'));
        ?>
</a>
					</li>
					<?php 
    }
Exemplo n.º 24
0
    static function renderPasswordResetForm()
    {
        $rtn = Message::renderMessages() . '
<form role="form" action="" method="post" id="forget_password_reset">
  <fieldset>
    <div class="form-group form-field-password">
      <label for="password">' . i18n(array('en' => 'Your new password', 'zh' => '您的新密码')) . '</label>
      <input class="form-control" name="password" type="password" id="password" autofocus required="">
    </div>
    <div class="form-group form-field-password-confirm">
      <label for="password_confirm">' . i18n(array('en' => 'Confirm your password', 'zh' => '确认密码')) . '</label>
      <input class="form-control" name="password_confirm" type="password" id="password_confirm" required="">
    </div>
    <input type="submit" name="submit" class="btn btn-primary btn-block ' . (module_enabled('form') ? 'disabled' : '') . '" value="' . i18n(array('en' => 'Update password', 'zh' => '更新密码')) . '" />
    ' . (module_enabled('form') ? Form::loadSpamToken('#forget_password_reset', SITEUSER_FORM_SPAM_TOKEN) : '') . '
  </fieldset>
</form>
';
        return $rtn;
    }
Exemplo n.º 25
0
						<?php 
echo form_input('created_on', date('Y-m-d', $post->created_on), 'maxlength="10" id="datepicker" class="text width-20"');
?>
 &nbsp;
						<?php 
echo form_dropdown('created_on_hour', $hours, date('H', $post->created_on));
?>
 :
						<?php 
echo form_dropdown('created_on_minute', $minutes, date('i', ltrim($post->created_on, '0')));
?>
					</div>
				</li>
	
				<?php 
if (!module_enabled('comments')) {
    ?>
					<?php 
    echo form_hidden('comments_enabled', 'no');
    ?>
				<?php 
} else {
    ?>
					<li>
						<label for="comments_enabled"><?php 
    echo lang('blog:comments_enabled_label');
    ?>
</label>
						<div class="input">
							<?php 
    echo form_dropdown('comments_enabled', array('no' => lang('global:no'), '1 day' => lang('global:duration:1-day'), '1 week' => lang('global:duration:1-week'), '2 weeks' => lang('global:duration:2-weeks'), '1 month' => lang('global:duration:1-month'), '3 months' => lang('global:duration:3-months'), 'always' => lang('global:duration:always')), $post->comments_enabled ? $post->comments_enabled : '3 months');
Exemplo n.º 26
0
 /**
  * Function: delete
  * Deletes the given topic. Calls the "delete_topic" trigger and passes the <Topic> as an argument.
  *
  * Parameters:
  *     $id - The topic to delete.
  */
 static function delete($id)
 {
     $topic = new self($id);
     foreach ($topic->message as $message) {
         Message::delete($message->id);
     }
     parent::destroy(get_class(), $id);
     foreach ($topic->attachments as $attachment) {
         unlink(uploaded($attachment->path, false));
     }
     if (module_enabled("cacher")) {
         Modules::$instances["cacher"]->regenerate();
     }
 }
Exemplo n.º 27
0
<?php

$site_module_controller_file = MODULESROOT . DS . 'site' . DS . 'controllers' . DS . 'page' . DS . 'default.php';
if (module_enabled('site') && is_file($site_module_controller_file)) {
    dispatch('site/page/default', array('page' => $page));
} else {
    echo "<h1>" . $page->getTitle() . "</h1>";
    echo $page->getContent();
}
Exemplo n.º 28
0
	'mails_per_page': <?php echo json_encode(user_config_option('mails_per_page',50)) ?>,
	'contacts_per_page': <?php echo json_encode(user_config_option('contacts_per_page',50)) ?>,
	'files_per_page': <?php echo json_encode(config_option('files_per_page', 50)) ?>,
	'days_on_trash': <?php echo json_encode(config_option("days_on_trash", 0)) ?>,
	'checkout_notification_dialog': <?php echo json_encode(config_option('checkout_notification_dialog', 0)) ?>,
	'use_time_in_task_dates': <?php echo json_encode(config_option('use_time_in_task_dates')) ?>,
	'can_assign_tasks_to_companies': <?php echo json_encode(config_option('can_assign_tasks_to_companies')) ?>,
	'enable_notes_module': <?php echo json_encode(module_enabled("messages")) ?>,
	'enable_email_module': <?php echo json_encode(module_enabled("mails")) ?>,
	'enable_contacts_module': <?php echo json_encode(module_enabled("contacts")) ?>,
	'enable_calendar_module': <?php echo json_encode(module_enabled("calendar")) ?>,
	'enable_documents_module': <?php echo json_encode(module_enabled("documents")) ?>,
	'enable_tasks_module': <?php echo json_encode(module_enabled("tasks")) ?>,
	'enable_weblinks_module': <?php echo json_encode(module_enabled('weblinks')) ?>,
	'enable_time_module': <?php echo json_encode(module_enabled("time") && can_manage_time(logged_user())) ?>,
	'enable_reporting_module': <?php echo json_encode(module_enabled("reporting")) ?>
};
og.preferences = {
	'viewContactsChecked': <?php echo json_encode(user_config_option('viewContactsChecked')) ?>,
	'viewUsersChecked': <?php echo json_encode(user_config_option('viewUsersChecked')) ?>,
	'viewCompaniesChecked': <?php echo json_encode(user_config_option('viewCompaniesChecked')) ?>,
	'rememberGUIState': <?php echo user_config_option('rememberGUIState') ? '1' : '0' ?>,
	'time_format_use_24': <?php echo json_encode(user_config_option('time_format_use_24')) ?>,
	'show_unread_on_title': <?php echo user_config_option('show_unread_on_title') ? '1' : '0' ?>,
	'email_polling': <?php echo json_encode(user_config_option('email_polling')) ?> ,
	'email_check_acc_errors': <?php echo json_encode(user_config_option('mail_account_err_check_interval')) ?> ,
	'date_format': <?php echo json_encode(user_config_option('date_format')) ?>,
	'date_format_tip': <?php echo json_encode(date_format_tip(user_config_option('date_format'))) ?>,
	'start_monday': <?php echo user_config_option('start_monday') ? '1' : '0' ?>,
	'draft_autosave_timeout': <?php echo json_encode(user_config_option('draft_autosave_timeout')) ?>,
	'drag_drop_prompt': <?php echo json_encode(user_config_option('drag_drop_prompt')) ?>,
Exemplo n.º 29
0
function sendsystemmail($subject, $msg, $to)
{
    $settings = Vars::getSettings();
    $username = $settings['mail']['system']['username'];
    $password = $settings['mail']['system']['password'];
    if (strpos($username, '@') == false) {
        $username = decrypt($username);
        $password = decrypt($password);
    }
    load_library_phpmailer();
    $mail = new PHPMailer(true);
    // the true param means it will throw exceptions on errors, which we need to catch
    $mail->IsSMTP();
    // telling the class to use SMTP
    try {
        //    $mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
        $mail->Mailer = $settings['mail']['system']['mailer'];
        $mail->SMTPAuth = true;
        // enable SMTP authentication
        $mail->CharSet = 'UTF-8';
        $mail->SMTPSecure = $settings['mail']['system']['SMTPSecure'];
        // sets the prefix to the servier
        $mail->Host = $settings['mail']['system']['host'];
        // sets GMAIL as the SMTP server
        $mail->Port = $settings['mail']['system']['port'];
        // set the SMTP port for the GMAIL server
        $mail->Username = $username;
        // GMAIL username
        $mail->Password = $password;
        // GMAIL password
        $mail->AddReplyTo($settings['mail']['system']['reply_to']);
        $mail->AddAddress($to);
        $mail->SetFrom($settings['mail']['system']['from'], $settings['mail']['system']['from_nickname']);
        $mail->Subject = (ENV == 'prod' ? '' : 'DEV: ') . $subject;
        $mail->MsgHTML($msg);
        $mail->Send();
        //    if (class_exists('Log')) {
        //      $log = new Log('mail', Log::SUCCESS, 'Send email to admin');
        //      $log->save();
        //    }
    } catch (phpmailerException $e) {
        if (module_enabled('Log')) {
            $log = new Log('mail', Log::ERROR, 'Failed to send email: ' . $e->errorMessage());
            $log->save();
        }
    } catch (Exception $e) {
        if (module_enabled('Log')) {
            $log = new Log('mail', Log::ERROR, 'Failed to send email: ' . $e->getMessage());
            $log->save();
        }
    }
}
Exemplo n.º 30
0
 /**
  * Function: delete
  * Deletes the given ticket, including its revisions and attachment. Calls the "delete_ticket" trigger and passes the <Ticket> as an argument.
  *
  * Parameters:
  *     $id - The ticket to delete.
  */
 static function delete($id)
 {
     $ticket = new self($id);
     foreach ($ticket->revisions as $revision) {
         Revision::delete($revision->id);
     }
     parent::destroy(get_class(), $id);
     foreach ($ticket->attachments as $attachment) {
         unlink(uploaded($attachment->path, false));
     }
     if (module_enabled("cacher")) {
         Modules::$instances["cacher"]->regenerate();
     }
 }